Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 6 additions & 34 deletions .config/config.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,44 @@
{
"defaultModel": "gpt-6-luna",
"modelAliases": {
"gpt-5": "gpt-6.2-sol",
"gpt-5.1": "gpt-6.2-sol",
"gpt-5.2": "gpt-6.2-sol",
"gpt-5-mini": "gpt-6.1-terra",
"gpt-5-nano": "gpt-6-luna"
},
"providers": [
{
"id": "openai",
"name": "OpenAI",
"type": "openai",
"enabled": true,
"apiKeyEnv": "OPENAI_API_KEY",
"models": [
{
"id": "gpt-6.2-astra",
"name": "GPT-6.2 Astra",
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "low"
},
{
"id": "gpt-6.2-sol",
"name": "GPT-6.2 Sol",
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
"id": "gpt-6-luna",
"name": "GPT-6 Luna",
"reasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "low"
},
{
"id": "gpt-6.1-terra",
"name": "GPT-6.1 Terra",
"reasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "low"
},
{
"id": "gpt-6-luna",
"name": "GPT-6 Luna",
"reasoningEfforts": ["none", "low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "low"
}
]
},
{
"id": "anthropic",
"name": "Anthropic",
"type": "anthropic",
"enabled": true,
"apiKeyEnv": "ANTHROPIC_API_KEY",
"models": [
{
"id": "claude-opus-5-5",
"name": "Claude Opus 5.5",
"id": "claude-haiku-5-5",
"name": "Claude Haiku 5.5",
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "medium",
"refusalFallback": true
"defaultReasoningEffort": "medium"
},
{
"id": "claude-sonnet-5-5",
"name": "Claude Sonnet 5.5",
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "medium",
"refusalFallback": true
},
{
"id": "claude-haiku-5-5",
"name": "Claude Haiku 5.5",
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"],
"defaultReasoningEffort": "medium"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Server routes:

- Set the API key of each provider you use (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`) before running agent workflows.
- Providers and models live in `.config/config.json`; keys stay in the environment, named by each provider's `apiKeyEnv`.
- Do not hard-code model ids in source: add them to `.config/config.json` (and `modelAliases` for retired ids).
- Do not hard-code model ids in source: `.config/config.json` is the only model list. A node whose model is no longer listed runs on the default model.
- Never commit secrets, `.env` files, or generated data from `data/runs/`.

## Design System Policy
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ git submodule update --init --recursive
- `OPENAI_API_KEY` / `ANTHROPIC_API_KEY`: key for each provider whose models are used.
- `PORT`: server port (default `3000`).
- `PROJECT_ROOT`: optional root override.
- `.config/config.json`: providers, models, default model and aliases; routes each Agent node to a provider (`apps/server/src/llm`). Schema in `docs/configuration.md`.
- `.config/config.json`: the only model list (providers, models in order of strength, default model); routes each Agent node to a provider (`apps/server/src/llm`). Schema in `docs/configuration.md`.
- `.config/default-workflow.json`: optional startup workflow (gitignored).

## References
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function readConfig(store: ConfigStore): ConfigSnapshot | undefined {

function logProviders(snapshot: ConfigSnapshot): void {
for (const provider of snapshot.config.providers) {
if (!provider.enabled) continue;
if (snapshot.isAvailable(provider)) {
logger.info('%s enabled with %d models (%s detected)', provider.name, provider.models.length, provider.apiKeyEnv);
} else {
Expand Down Expand Up @@ -55,7 +54,8 @@ async function bootstrap() {
const current = readConfig(configStore);
return current ? resolveAgentModels(current, graph) : {};
},
getPublicConfig: () => readConfig(configStore)?.toPublic(),
// Throws on a missing or invalid file, so the editor can show why.
getPublicConfig: () => configStore.get().toPublic(),
getDefaultModel: () => readConfig(configStore)?.defaultModel
});

Expand Down
40 changes: 15 additions & 25 deletions apps/server/src/llm/app-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { ConfigError, ConfigSnapshot, ConfigStore, parseAppConfig } from './app-

const twoProviders = {
defaultModel: 'claude-a',
modelAliases: { 'old-model': 'gpt-a' },
providers: [
{
id: 'openai',
Expand All @@ -23,17 +22,12 @@ const twoProviders = {
};

describe('parseAppConfig', () => {
it('fills in defaults so files written before provider types existed still load', () => {
it('fills in the type, key variable and API when the provider id names them', () => {
const config = parseAppConfig({
providers: [{ id: 'openai', name: 'OpenAI', enabled: true, models: [{ id: 'gpt-5', name: 'GPT-5', reasoningEfforts: ['low'] }] }]
providers: [{ id: 'openai', name: 'OpenAI', models: [{ id: 'gpt-5', name: 'GPT-5', reasoningEfforts: ['low'] }] }]
});
expect(config.providers[0]).toMatchObject({
type: 'openai',
apiKeyEnv: 'OPENAI_API_KEY',
api: 'responses',
enabled: true
});
expect(config.modelAliases).toEqual({});
expect(config.providers[0]).toMatchObject({ type: 'openai', apiKeyEnv: 'OPENAI_API_KEY', api: 'responses' });
expect(config.defaultModel).toBeUndefined();
});

it('reads provider and model options', () => {
Expand All @@ -56,21 +50,16 @@ describe('parseAppConfig', () => {
[{ providers: [{ id: 'openai', models: [{ id: 'm' }] }, { id: 'openai', models: [] }] }, /Provider id "openai" is duplicated/],
[{ providers: [{ id: 'a', type: 'openai', models: [{ id: 'm' }] }, { id: 'b', type: 'openai', models: [{ id: 'm' }] }] }, /listed by both "a" and "b"/],
[{ defaultModel: 'nope', providers: [{ id: 'openai', models: [{ id: 'm' }] }] }, /defaultModel "nope"/],
[{ modelAliases: { old: 'nope' }, providers: [{ id: 'openai', models: [{ id: 'm' }] }] }, /modelAliases\["old"\]/]
[{ providers: [{ id: 'openai', models: [] }] }, /lists no models/],
[{ modelAliases: { old: 'm' }, providers: [{ id: 'openai', models: [{ id: 'm' }] }] }, /modelAliases is no longer supported/],
[{ providers: [{ id: 'openai', enabled: false, models: [{ id: 'm' }] }] }, /providers\[0\]\.enabled is no longer supported/],
[{ defaultModle: 'm', providers: [{ id: 'openai', models: [{ id: 'm' }] }] }, /defaultModle is not a known field/],
[{ providers: [{ id: 'openai', models: [{ id: 'm', reasoningEffort: 'low' }] }] }, /models\[0\]\.reasoningEffort is not a known field/],
[{ providers: [{ id: 'anthropic', models: [{ id: 'm', refusalFallback: 'yes' }] }] }, /refusalFallback must be true or false/]
])('rejects invalid configuration %#', (raw, message) => {
expect(() => parseAppConfig(raw)).toThrow(ConfigError);
expect(() => parseAppConfig(raw)).toThrow(message);
});

it('allows the same model id in a disabled provider', () => {
const config = parseAppConfig({
providers: [
{ id: 'a', type: 'openai', models: [{ id: 'm' }] },
{ id: 'b', type: 'openai', enabled: false, models: [{ id: 'm' }] }
]
});
expect(config.providers).toHaveLength(2);
});
});

describe('ConfigSnapshot', () => {
Expand All @@ -81,21 +70,21 @@ describe('ConfigSnapshot', () => {
expect(lookup).toMatchObject({ ok: true, resolved: { provider: { id: 'openai' }, model: { id: 'gpt-a' }, apiKey: 'sk-test' } });
});

it('follows aliases and falls back to the default model', () => {
it('runs a missing or unlisted model on the default model', () => {
const both = snapshot({ OPENAI_API_KEY: 'a', ANTHROPIC_API_KEY: 'b' });
expect(both.lookup('old-model')).toMatchObject({ ok: true, resolved: { model: { id: 'gpt-a' } } });
expect(both.lookup('gpt-retired')).toMatchObject({ ok: true, resolved: { model: { id: 'claude-a' } } });
expect(both.lookup(undefined)).toMatchObject({ ok: true, resolved: { model: { id: 'claude-a' } } });
expect(both.lookup(' ')).toMatchObject({ ok: true, resolved: { model: { id: 'claude-a' } } });
});

it('explains a missing key and an unknown model', () => {
it('explains a missing key', () => {
const noKeys = snapshot({});
expect(noKeys.lookup('claude-a')).toEqual({
ok: false,
reason: 'missing_key',
message: 'ANTHROPIC_API_KEY is required to run Agent nodes that use Anthropic models.'
});
expect(noKeys.lookup('gpt-99')).toMatchObject({ ok: false, reason: 'unknown_model' });
expect(noKeys.lookup('gpt-retired')).toMatchObject({ ok: false, reason: 'missing_key' });
});

it('prefers a provider with a key when no default model is configured', () => {
Expand Down Expand Up @@ -141,6 +130,7 @@ describe('ConfigStore', () => {
it('accepts the configuration shipped with the project', () => {
const shipped = ConfigStore.forProject(path.resolve(import.meta.dirname, '../../../..'), {}).get();
expect(shipped.config.providers.map((p) => p.type)).toEqual(['openai', 'anthropic']);
expect(shipped.defaultModel).toBe(shipped.config.providers[0].models[0].id);
expect(shipped.lookup(undefined)).toMatchObject({ ok: false, reason: 'missing_key' });
});
});
Loading
Loading