feat(agents)!: plain-object agents entries; createAgent and limits removed

Merged
OK
2mo ago
+1117-1030

Stacked on #645; #648 (the app on the target and services) is stacked on this. Each agents entry is now one plain object; createAgent() and the top-level limits are gone.

agents: {
  default: { model, judge, system: 'Prefer the keyboard.', context: 'Plans are called tiers.', tools: { lookupOrder }, maxSteps: 25, maxModelCalls: 25, judgmentTimeout: 30_000, maxInputTokens: 64_000 },
  thorough: { model: sonnet, system: 'Verify every total before finishing.', maxSteps: 50, maxModelCalls: 60 },
  custom: { executor: myBrain, model, maxModelCalls: 10 },
},
  • One place for every agent option. Budgets used to be split between the entry and limits, and system/tools between the entry and createAgent(). Each entry starts from the built-in defaults, never from default's values.
  • executor is for a custom brain. model, judge, context and the budgets still apply; system or tools next to it are INVALID_CONFIG. AgentConfig is a union, so this is a type error too.
  • Removed keys fail naming their replacement:
    • timeout becomes judgmentTimeout.
    • maxTurns becomes maxModelCalls, also in createToolLoopExecutor.
    • limits.maxModelTokensPerCall becomes the entry's maxInputTokens.
    • limits itself is removed.
    • A bare StepExecutor entry points at { executor }.
    • Unknown keys get a did-you-mean.
  • Fixed internal limits: maxAgentContextBytes, maxLedgerBytes and maxEventsPerStep are fixed at 16384, 8192 and 1000. The report's run.limits keeps its wire shape, filled from the largest per-agent values and the fixed ones. No schema bump.
  • Tools are validated at config load: defineTool only, a real execute, and no built-in tool names.
  • e2e mcp serves the entry's tools.
  • explore extends the entry instead of building an executor.
  • createAgent() is deleted, not stubbed. A config that imports it fails to load with an ESM missing-export error. That's acceptable pre-1.0, and the changeset, config.mdx and the skill name the new shape.
  • Built-in agent identity is unchanged (e2e-default-agent/2), so committed recordings keep replaying.

Verified

Ran it locally: yes

  • Built CLI in the testbed:
    • Configs using limits, agent timeout and a bare executor each exit 2 with the new message.
    • A new-shape config with system, tools, judgmentTimeout and maxInputTokens passes tests/forms.e2e.ts.
    • run.limits in the report reads the max across agents.