@bastani/atomic 0.9.20-alpha.7 → 0.9.20-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/builtin/intercom/package.json +3 -5
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +11 -2
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +37 -0
- package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
- package/dist/builtin/workflows/builtin/{chunk-ffdrv23t.js → chunk-18yz7r43.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-9z3ztr2a.js → chunk-1pd5zcfa.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-5724b0cf.js → chunk-24c235x7.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-vn0wb31x.js → chunk-2jv44yz7.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-hmt5w62g.js → chunk-2npg6daz.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-njmf5ze7.js → chunk-7ps7bnb4.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-jngsbbpm.js → chunk-ad864596.js} +3 -3
- package/dist/builtin/workflows/builtin/{chunk-7n51c5gh.js → chunk-f8jjd90r.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-3tx8ry44.js → chunk-gxrhbnaj.js} +2 -1
- package/dist/builtin/workflows/builtin/{chunk-2hzrv5y8.js → chunk-twefqrv0.js} +986 -199
- package/dist/builtin/workflows/builtin/{chunk-7bzcersz.js → chunk-ynded223.js} +3 -3
- package/dist/builtin/workflows/builtin/{chunk-dxjxtgmp.js → chunk-z5xdqrs6.js} +1 -1
- package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
- package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
- package/dist/builtin/workflows/builtin/goal.js +4 -4
- package/dist/builtin/workflows/builtin/index.js +12 -12
- package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
- package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +4 -4
- package/dist/builtin/workflows/builtin/steering-context.js +1 -1
- package/dist/builtin/workflows/builtin/tournament.js +3 -3
- package/dist/builtin/workflows/package.json +4 -4
- package/dist/builtin/workflows/src/authoring.d.ts +6 -3
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +26991 -26238
- package/dist/builtin/workflows/src/index.js +41619 -12907
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +13 -0
- package/dist/core/agent-session-boundaries.d.ts.map +1 -1
- package/dist/core/agent-session-boundaries.js +9 -4
- package/dist/core/agent-session-boundaries.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +4 -0
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +3 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-tasks.js +4 -4
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +4 -3
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cache-stats.d.ts +7 -1
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +24 -5
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/execution-model-router.d.ts +1 -1
- package/dist/core/execution-model-router.d.ts.map +1 -1
- package/dist/core/execution-model-router.js +23 -14
- package/dist/core/execution-model-router.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +9 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +2 -1
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/event-types.d.ts +2 -2
- package/dist/core/extensions/event-types.d.ts.map +1 -1
- package/dist/core/extensions/event-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +1 -0
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +34 -16
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +4 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/tool-types.d.ts +9 -0
- package/dist/core/extensions/tool-types.d.ts.map +1 -1
- package/dist/core/extensions/tool-types.js.map +1 -1
- package/dist/core/fast-model-routing.d.ts.map +1 -1
- package/dist/core/fast-model-routing.js +1 -0
- package/dist/core/fast-model-routing.js.map +1 -1
- package/dist/core/fast-model-variants.d.ts +10 -0
- package/dist/core/fast-model-variants.d.ts.map +1 -1
- package/dist/core/fast-model-variants.js +13 -1
- package/dist/core/fast-model-variants.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +6 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime-auth.d.ts +2 -2
- package/dist/core/model-runtime-auth.d.ts.map +1 -1
- package/dist/core/model-runtime-auth.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +2 -1
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime.d.ts +11 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +41 -6
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager-npm.d.ts.map +1 -1
- package/dist/core/package-manager-npm.js +32 -8
- package/dist/core/package-manager-npm.js.map +1 -1
- package/dist/core/package-manager-resolver.js +3 -1
- package/dist/core/package-manager-resolver.js.map +1 -1
- package/dist/core/package-manager-types.d.ts +1 -0
- package/dist/core/package-manager-types.d.ts.map +1 -1
- package/dist/core/package-manager-types.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +40 -21
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +22 -20
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-composer.d.ts +3 -3
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +54 -10
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +8 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +46 -4
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +7 -3
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extension-warnings.d.ts +9 -0
- package/dist/core/resource-loader-extension-warnings.d.ts.map +1 -0
- package/dist/core/resource-loader-extension-warnings.js +54 -0
- package/dist/core/resource-loader-extension-warnings.js.map +1 -0
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +1 -0
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +6 -0
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +3 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.js +16 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +4 -4
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/skill-catalog.d.ts.map +1 -1
- package/dist/core/skill-catalog.js +18 -6
- package/dist/core/skill-catalog.js.map +1 -1
- package/dist/core/structured-output/choice-schema.d.ts +8 -0
- package/dist/core/structured-output/choice-schema.d.ts.map +1 -0
- package/dist/core/structured-output/choice-schema.js +79 -0
- package/dist/core/structured-output/choice-schema.js.map +1 -0
- package/dist/core/structured-output/index.d.ts +3 -5
- package/dist/core/structured-output/index.d.ts.map +1 -1
- package/dist/core/structured-output/index.js +218 -41
- package/dist/core/structured-output/index.js.map +1 -1
- package/dist/core/structured-output/resolver.d.ts +0 -46
- package/dist/core/structured-output/resolver.d.ts.map +1 -1
- package/dist/core/structured-output/resolver.js +15 -93
- package/dist/core/structured-output/resolver.js.map +1 -1
- package/dist/core/structured-output/types.d.ts +27 -21
- package/dist/core/structured-output/types.d.ts.map +1 -1
- package/dist/core/structured-output/types.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/owner-store.d.ts +6 -0
- package/dist/core/tasks/owner-store.d.ts.map +1 -1
- package/dist/core/tasks/owner-store.js +16 -3
- package/dist/core/tasks/owner-store.js.map +1 -1
- package/dist/core/tasks/pause.js +1 -1
- package/dist/core/tasks/pause.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +4 -2
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +9 -3
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.js +1 -0
- package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +16 -13
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +1 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-coordinator.d.ts +4 -3
- package/dist/core/tools/file-mutation-coordinator.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-coordinator.js +45 -38
- package/dist/core/tools/file-mutation-coordinator.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/structured-output.d.ts +9 -6
- package/dist/core/tools/structured-output.d.ts.map +1 -1
- package/dist/core/tools/structured-output.js +36 -8
- package/dist/core/tools/structured-output.js.map +1 -1
- package/dist/core/tools/todos.d.ts.map +1 -1
- package/dist/core/tools/todos.js +1 -0
- package/dist/core/tools/todos.js.map +1 -1
- package/dist/core/tools/tool-concurrency.d.ts +23 -0
- package/dist/core/tools/tool-concurrency.d.ts.map +1 -0
- package/dist/core/tools/tool-concurrency.js +58 -0
- package/dist/core/tools/tool-concurrency.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +4 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.js +3 -2
- package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +11 -9
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/startup-identity.d.ts +3 -0
- package/dist/modes/interactive/components/startup-identity.d.ts.map +1 -1
- package/dist/modes/interactive/components/startup-identity.js +11 -2
- package/dist/modes/interactive/components/startup-identity.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +1 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +11 -11
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +9 -3
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +26 -2
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +3 -9
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +1 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +3 -9
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +6 -9
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +1 -0
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -4
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +2 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive/overlay-line-composite.d.ts +7 -0
- package/dist/modes/interactive/overlay-line-composite.d.ts.map +1 -0
- package/dist/modes/interactive/overlay-line-composite.js +24 -0
- package/dist/modes/interactive/overlay-line-composite.js.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +5 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/utils/child-process.d.ts +1 -0
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +7 -8
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +14 -17
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +18 -1
- package/dist/utils/shell.js.map +1 -1
- package/docs/background-tasks.md +1 -0
- package/docs/computer-use.md +2 -2
- package/docs/custom-provider/registration.md +1 -1
- package/docs/custom-provider.md +43 -1
- package/docs/extensions/authoring.md +22 -3
- package/docs/extensions/events.md +18 -0
- package/docs/extensions/examples.md +1 -0
- package/docs/models/evals.md +31 -79
- package/docs/models/model-selection.md +5 -1
- package/docs/packages/authoring.md +3 -1
- package/docs/providers.md +11 -12
- package/docs/sdk/reference.md +18 -42
- package/docs/sdk/structured-decisions.md +44 -89
- package/docs/sdk.md +1 -1
- package/docs/settings.md +6 -6
- package/docs/subagents/reference.md +7 -8
- package/docs/usage.md +13 -0
- package/docs/workflows/api-reference.md +38 -35
- package/docs/workflows/authoring.md +113 -1
- package/docs/workflows/builtins.md +1 -1
- package/docs/workflows/operations.md +51 -29
- package/docs/workflows/verification.md +13 -0
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/structured-output.ts +6 -0
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/dist/builtin/workflows/src/durable/dependency-doctor-types.d.ts +0 -42
- package/dist/core/decision-provider.d.ts +0 -4
- package/dist/core/decision-provider.d.ts.map +0 -1
- package/dist/core/decision-provider.js +0 -12
- package/dist/core/decision-provider.js.map +0 -1
- package/dist/core/structured-output/jev-client.d.ts +0 -25
- package/dist/core/structured-output/jev-client.d.ts.map +0 -1
- package/dist/core/structured-output/jev-client.js +0 -174
- package/dist/core/structured-output/jev-client.js.map +0 -1
- package/dist/core/structured-output/jev.d.ts +0 -5
- package/dist/core/structured-output/jev.d.ts.map +0 -1
- package/dist/core/structured-output/jev.js +0 -249
- package/dist/core/structured-output/jev.js.map +0 -1
package/docs/sdk/reference.md
CHANGED
|
@@ -154,7 +154,7 @@ const builtinsOnly = await ModelRuntime.create({ modelsPath: null });
|
|
|
154
154
|
|
|
155
155
|
### Structured decisions
|
|
156
156
|
|
|
157
|
-
Use `
|
|
157
|
+
Use `generateStructuredOutput()` for one schema-validated semantic decision without starting an agent session. Pass optional exact `model` and `fallbackModels` IDs, `currentModel`, `modelRegistry`, `instructions`, `state`, and `schema`. Omit `model` to start with the current chat model; the current chat model is also the terminal fallback. Atomic resolves each ID through the supplied registry: a chat model uses chat inference, and a registered classifier uses the generic classify operation. A catalog entry does not prove that the provider can serve the request. Classifiers run only when the schema is a finite Choice and are otherwise skipped. General calls derive choice questions from that schema and never read `routerModel`. Workflow-stage and subagent `model: "auto"` selection use `routerModel` internally; no separate routing-decision API is exported. See [Structured decisions](/sdk/structured-decisions).
|
|
158
158
|
|
|
159
159
|
### System Prompt
|
|
160
160
|
|
|
@@ -306,69 +306,49 @@ Normal sessions also expose `kill({ id: taskId })` for their owned bash and Powe
|
|
|
306
306
|
|
|
307
307
|
#### Structured output final results
|
|
308
308
|
|
|
309
|
-
`structured_output` is not registered in normal agent sessions by default.
|
|
309
|
+
`structured_output` is not registered in normal agent sessions by default. Register the factory when a caller needs a schema-validated decision inferred by a selected model:
|
|
310
310
|
|
|
311
311
|
```typescript
|
|
312
|
-
import { Type
|
|
313
|
-
import {
|
|
314
|
-
createAgentSession,
|
|
315
|
-
createStructuredOutputTool,
|
|
316
|
-
type StructuredOutputCapture,
|
|
317
|
-
} from "@bastani/atomic";
|
|
312
|
+
import { Type } from "typebox";
|
|
313
|
+
import { createAgentSession, createStructuredOutputTool } from "@bastani/atomic";
|
|
318
314
|
|
|
319
315
|
const DecisionSchema = Type.Object({
|
|
320
|
-
|
|
321
|
-
findings: Type.Array(Type.String()),
|
|
316
|
+
category: Type.Union([Type.Literal("question"), Type.Literal("statement")]),
|
|
322
317
|
}, { additionalProperties: false });
|
|
323
318
|
|
|
324
|
-
|
|
325
|
-
const capture: StructuredOutputCapture<Decision> = {
|
|
326
|
-
called: false,
|
|
327
|
-
value: undefined,
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const structuredOutput = createStructuredOutputTool({
|
|
331
|
-
schema: DecisionSchema,
|
|
332
|
-
capture,
|
|
333
|
-
});
|
|
319
|
+
const structuredOutput = createStructuredOutputTool({ schema: DecisionSchema });
|
|
334
320
|
|
|
335
321
|
const { session } = await createAgentSession({
|
|
336
322
|
customTools: [structuredOutput],
|
|
323
|
+
tools: ["structured_output"],
|
|
337
324
|
});
|
|
338
325
|
```
|
|
339
326
|
|
|
340
|
-
The
|
|
341
|
-
|
|
342
|
-
A successful call:
|
|
327
|
+
The calling model does not supply the decision fields. It calls `structured_output` with:
|
|
343
328
|
|
|
344
|
-
-
|
|
345
|
-
-
|
|
346
|
-
-
|
|
347
|
-
-
|
|
329
|
+
- `instructions`: the judgment to make.
|
|
330
|
+
- `state`: a nonempty named object containing the task and relevant context. Do not put secrets here.
|
|
331
|
+
- `model`: optional exact `provider/model` ID of a chat model or a registered classifier. Omit it to use the current stage or session chat model.
|
|
332
|
+
- `fallbackModels`: optional ordered exact IDs tried after the primary.
|
|
348
333
|
|
|
349
|
-
|
|
334
|
+
The tool infers the result through the session model registry. A successful call returns the schema-validated value as pretty-printed JSON, stores that value in `details`, and sets `terminate: true`. It does not capture the calling model's arguments as the decision. A classifier is used only when the registered schema is a finite Choice; otherwise that candidate is skipped and the next fallback, then the current chat model, is tried. A classifier failure such as missing credentials, an unavailable provider, an unsupported classify operation, a refusal, or a malformed answer advances the same chain. A chat provider refusal advances immediately when reported as an error; plain text without a result gets up to three repairs before advancing. Cancellation stops the call. Saved `/login` credentials are used through the session model registry; a listed model does not prove live access.
|
|
350
335
|
|
|
351
|
-
|
|
336
|
+
A custom tool name still works. Include that name in any explicit `tools` allowlist:
|
|
352
337
|
|
|
353
338
|
```typescript
|
|
354
339
|
const finalDecision = createStructuredOutputTool({
|
|
355
340
|
name: "final_decision",
|
|
356
341
|
schema: DecisionSchema,
|
|
357
|
-
capture,
|
|
358
342
|
});
|
|
359
|
-
// The model is prompted to call final_decision exactly once, not structured_output.
|
|
360
343
|
|
|
361
344
|
await createAgentSession({
|
|
362
345
|
customTools: [finalDecision],
|
|
363
|
-
tools: ["final_decision"],
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
await createAgentSession({
|
|
367
|
-
customTools: [createStructuredOutputTool({ schema: DecisionSchema, capture })],
|
|
368
|
-
// Registers the standard structured_output tool for this session only.
|
|
346
|
+
tools: ["final_decision"],
|
|
369
347
|
});
|
|
370
348
|
```
|
|
371
349
|
|
|
350
|
+
Custom tool names are supported, and the prompt metadata follows the configured name. The examples above use `final_decision` and the default `structured_output` name. Include the name you register in any explicit `tools` allowlist.
|
|
351
|
+
|
|
372
352
|
> See [examples/sdk/05-tools.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/sdk/05-tools.ts)
|
|
373
353
|
|
|
374
354
|
### Extensions
|
|
@@ -845,11 +825,7 @@ defineTool
|
|
|
845
825
|
STRUCTURED_OUTPUT_TOOL_NAME
|
|
846
826
|
createStructuredOutputTool
|
|
847
827
|
createStructuredOutputCapture
|
|
848
|
-
|
|
849
|
-
inferRouterDecision
|
|
850
|
-
resolveRouterModel
|
|
851
|
-
getStructuredOutputProviders
|
|
852
|
-
JEV_STRUCTURED_OUTPUT_PROVIDER
|
|
828
|
+
generateStructuredOutput
|
|
853
829
|
getAgentDir
|
|
854
830
|
getPackageDir
|
|
855
831
|
getReadmePath
|
|
@@ -5,135 +5,90 @@ description: Make a schema-validated structured decision without starting an age
|
|
|
5
5
|
|
|
6
6
|
# Structured decisions
|
|
7
7
|
|
|
8
|
-
Use `
|
|
8
|
+
Use `generateStructuredOutput()` from `@bastani/atomic`, or the `structured_output` tool, when an integration needs one schema-validated semantic decision. Both use the same model contract. Neither starts a child agent, executes the caller's other tools, or authorizes an action. Neither reads `routerModel` or changes the selected chat model.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Automatic workflow-stage and subagent `model: "auto"` selection uses `routerModel` separately; it does not change calls to `generateStructuredOutput()`. See [Select the router](#select-the-router).
|
|
11
11
|
|
|
12
12
|
## Select the inference model
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Pass an optional exact `provider/model` string, not a model object and not `auto`:
|
|
15
15
|
|
|
16
|
-
`
|
|
16
|
+
- `model` is the primary. It may be a chat language model or a classifier registered in the current model registry. `typesafe/jev-latest` is one example classifier, not a separate request type.
|
|
17
|
+
- `fallbackModels` is an ordered list of the same kind of exact IDs.
|
|
18
|
+
- Omit `model` to use the current stage or chat model as the primary.
|
|
19
|
+
- After the primary and every explicit fallback, Atomic tries the current chat model if it has not already been tried.
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
2. Otherwise `typesafe-ai/jev-latest` when Jev credentials are configured through `/login typesafe-ai` or `TYPESAFE_API_KEY`.
|
|
20
|
-
3. Otherwise the chat model supplied as `currentModel` at invocation time.
|
|
21
|
+
Image-generation models, model patterns, reasoning suffixes, and surrounding whitespace are rejected. Atomic validates every model ID before sending the first request, so a mistyped fallback fails the call even if the primary model would have succeeded. A classifier is never an execution `auto` candidate. A catalog entry does not prove that the provider can classify, that credentials work, or that quota remains. Setting `routerModel` does not change this selection.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
A classifier can answer a finite Choice. Literal unions, enums, booleans, and flat objects whose required fields all use those types are Choice-compatible. Free-form text, unconstrained numbers, arrays, optional fields, and nested objects are not. Atomic compiles compatible schemas into generic choice questions and skips an incompatible classifier, recording the skip. A request whose entire chain is incompatible fails without inventing a decoder.
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Pass the full `ModelRegistry` to use saved Jev credentials with either decision API. Its provider-auth methods preserve normal credential resolution and logout behavior. Minimal custom adapters that omit `getProviderAuth` and `getProviderAuthStatus` retain environment-only Jev support. Never copy a resolved key into decision state.
|
|
27
|
-
|
|
28
|
-
OpenRouter Jev reuses the registry's existing OpenRouter sign-in or saved API key and normal `OPENROUTER_API_KEY` fallback. It never uses TypeSafe credentials. Minimal adapters use `OPENROUTER_API_KEY` for this selection. The Atomic ID includes `openrouter/`; the wire model is only `~typesafe/jev-latest`, sent to `https://openrouter.ai/api/alpha/decisions`. Both Jev selections accept the same Choice questions and return the same structured result. OpenRouter is explicit-only and does not change automatic selection precedence.
|
|
29
|
-
|
|
30
|
-
Vercel AI Gateway (`https://ai-gateway.vercel.sh/typesafe/v1/systemone`, wire model `typesafe-ai/jev`) and OpenCode Zen (`https://opencode.ai/zen/v1/systemone`, wire models `jev-1.13` and `jev-1.13-free`) follow the same rule with `AI_GATEWAY_API_KEY` and `OPENCODE_API_KEY` or that provider's `/login`. Their model IDs, `contextWindow`, and `cost` fields are read from the models.dev decision catalog bundled with `@bastani/pi-ai` (`getDecisionModels()`), so a gateway that drops or renames its Jev listing disappears from `getStructuredOutputProviders()` at the next catalog regeneration. Gateway Jev is explicit-only.
|
|
31
|
-
|
|
32
|
-
### Router repair attempts
|
|
33
|
-
|
|
34
|
-
By default, `inferRouterDecision()` gives each provider an initial attempt plus **up to three corrective retries** when an answer is malformed or fails the decision schema. When a chat fallback exists, a failed Jev attempt switches to chat immediately instead of repairing on Jev; the chat fallback then gets at most four attempts, without a structured-decision time limit. A valid answer stops retries immediately; a valid `none` is not retried. Repairs may increase latency and provider usage, but never start a workflow or child before final validation.
|
|
35
|
-
|
|
36
|
-
Separately from output repairs, transient provider failures — connection errors and HTTP 408, 429 and 5xx — are retried up to three times with exponential backoff for both Jev and chat decision requests. Every request honors cancellation; an aborted request is never retried. Both decision APIs accept a `retry` policy (`{ enabled, maxRetries, baseDelayMs }`) to change this; `inferRouterDecision()` also reads `settings.retry` when available.
|
|
37
|
-
|
|
38
|
-
Input/configuration errors, cancellation, and stale-catalog rejection are not repaired. Generic `inferStructuredOutput()` gains the same transient-failure retries but no output repairs or provider fallback.
|
|
39
|
-
|
|
40
|
-
Any Jev failure switches to the current chat model when the invocation has a concrete current chat model — exhausted output repairs, HTTP and connection errors after their transient retries, missing or unresolvable credentials, response-size violations, and local context-budget rejection. This applies to explicit Jev `routerModel` selections as well as automatic ones. Context-budget failures switch before sending an oversized request; HTTP errors such as `max_tokens_exceeded` switch without repeating an unchanged request. A warning reports the safe failure reason and fallback model. The fallback gets its own initial attempt plus three corrective retries, using the original state, schema and constraints. The result includes `fallback: { from, to, reason }` and identifies the chat model in `model`. This can send routing context to your chat provider and incur its normal charges. Cancellation never triggers fallback.
|
|
41
|
-
|
|
42
|
-
For [workflow-stage](/workflows/operations#automatic-stage-models) and [subagent](/subagents/reference#automatic-model-selection) `model: "auto"`, a complete routing-inference failure — Jev and the chat structured-output fallback both — runs the stage or child on the current chat model with a recorded warning instead of failing, provided that model is available and satisfies every routing constraint. If ranking a fallback model fails after the primary was chosen, the primary is kept. Validation, eligibility, credential-screening failures and cancellation still fail as before.
|
|
43
|
-
|
|
44
|
-
## Prepare a decision
|
|
45
|
-
|
|
46
|
-
Supply both the ordinary result schema and Jev Choice questions so either provider path can serve the same request. Instructions describe the judgment. Named `state` fields contain the actual task, relevant conversation, explicit constraints and reference text. Paths and URLs may identify a source, but do not replace its content. Exclude secrets from state and criteria.
|
|
47
|
-
|
|
48
|
-
Put candidate-specific descriptions and contracts in Choice criteria rather than repeating a complete catalog in state. Both chat and Jev receive the questions and criteria; Jev tournament batches contain only the options being compared. Keep shared state relevant to every comparison. Do not truncate requirements to fit.
|
|
25
|
+
Pass the session `modelRegistry`. Classifier credentials come from that registry's normal provider login, such as `/login typesafe` or `TYPESAFE_API_KEY` for TypeSafe Jev. Do not copy a resolved key into `state`.
|
|
49
26
|
|
|
50
27
|
```typescript
|
|
51
28
|
import { Type } from "typebox";
|
|
52
|
-
import {
|
|
53
|
-
inferStructuredOutput,
|
|
54
|
-
ModelRegistry,
|
|
55
|
-
ModelRuntime,
|
|
56
|
-
type StructuredOutputModel,
|
|
57
|
-
} from "@bastani/atomic";
|
|
29
|
+
import { generateStructuredOutput, ModelRegistry, ModelRuntime } from "@bastani/atomic";
|
|
58
30
|
|
|
59
31
|
const modelRuntime = await ModelRuntime.create();
|
|
60
32
|
const modelRegistry = new ModelRegistry(modelRuntime);
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
const inferenceModel: StructuredOutputModel = {
|
|
64
|
-
kind: "chat", fullId: `${model.provider}/${model.id}`, model,
|
|
65
|
-
};
|
|
33
|
+
const currentModel = modelRegistry.getAvailable()[0];
|
|
34
|
+
if (!currentModel) throw new Error("Choose a configured chat model before making this request.");
|
|
66
35
|
|
|
67
36
|
const schema = Type.Object(
|
|
68
|
-
{ category: Type.Union([Type.Literal("question"), Type.Literal("
|
|
37
|
+
{ category: Type.Union([Type.Literal("question"), Type.Literal("statement")]) },
|
|
69
38
|
{ additionalProperties: false },
|
|
70
39
|
);
|
|
71
|
-
const result = await
|
|
72
|
-
model:
|
|
40
|
+
const result = await generateStructuredOutput({
|
|
41
|
+
model: "typesafe/jev-latest",
|
|
42
|
+
fallbackModels: [`${currentModel.provider}/${currentModel.id}`],
|
|
43
|
+
currentModel,
|
|
73
44
|
modelRegistry,
|
|
74
45
|
schema,
|
|
75
|
-
instructions: "Classify whether the
|
|
76
|
-
state: {
|
|
77
|
-
task: "What does the router setting mean?",
|
|
78
|
-
constraints: { permittedAction: "classify only" },
|
|
79
|
-
reference: { text: "A question requests an explanation or information." },
|
|
80
|
-
candidates: ["question", "none"],
|
|
81
|
-
},
|
|
82
|
-
jev: {
|
|
83
|
-
questions: {
|
|
84
|
-
category: {
|
|
85
|
-
instructions: "Does the task request information or an explanation?",
|
|
86
|
-
criteria: {
|
|
87
|
-
question: "Requests information or an explanation",
|
|
88
|
-
none: "Does not request information or an explanation",
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
decode: (choices) => ({
|
|
93
|
-
category: choices.category === "question" ? "question" : "none",
|
|
94
|
-
} as const),
|
|
95
|
-
},
|
|
96
|
-
maxTokens: 4096,
|
|
46
|
+
instructions: "Classify whether the message asks a question or makes a statement.",
|
|
47
|
+
state: { message: "What time does the train leave?" },
|
|
97
48
|
});
|
|
98
|
-
console.log(result.value.category);
|
|
49
|
+
console.log(result.value.category, result.model);
|
|
99
50
|
```
|
|
100
51
|
|
|
101
|
-
|
|
52
|
+
The returned `value` is the schema-validated decision, not the request arguments. `model` names the candidate that produced it. `modelAttempts` records skips and failed candidates when a chain was used. A classifier result does not include token usage, so `usage` on a classifier-produced decision is not a classifier bill. Chat usage is reported only when a chat candidate supplies the accepted result. A valid shape is not proof that the judgment is correct. Validate current policy again before any later action.
|
|
102
53
|
|
|
103
|
-
|
|
54
|
+
The `structured_output` tool takes the same decision inputs from the calling model: required `instructions` and nonempty named `state`, plus optional `model` and `fallbackModels`. The registered schema is fixed by `createStructuredOutputTool({ schema })`. The tool resolves those IDs through the session registry and returns the inferred value. Omitting `model` uses the current stage or session chat model. See [Structured output final results](/sdk/reference#structured-output-final-results).
|
|
104
55
|
|
|
105
|
-
##
|
|
56
|
+
## Select the router
|
|
106
57
|
|
|
107
|
-
|
|
58
|
+
For workflow stages and subagents with `model: "auto"`, `routerModel` selects the decision provider: an explicit exact registered chat or classifier ID uses that model, while an unset or `auto` value uses the current chat model. Saved classifier credentials do not change this selection. An invalid explicit router selection fails instead of falling back. Set it through [/settings](/settings#routermodel); extensions can read the current value with `ctx.getRouterModel()`.
|
|
108
59
|
|
|
109
|
-
|
|
60
|
+
Chat routing gets an initial attempt plus up to three corrective retries for malformed or schema-invalid output. A failed explicit classifier routing attempt switches to the current chat model immediately when one exists, including missing credentials, an unsupported classify operation, a provider size or context rejection, and a refusal. Cancellation does not fall back. The result includes `fallback: { from, to, reason }` when that hop is used. Transient provider retries follow the selected provider's operation and the request's retry settings. General `generateStructuredOutput()` advances its own `fallbackModels` chain; it does not read `routerModel`.
|
|
110
61
|
|
|
111
|
-
[
|
|
62
|
+
For [workflow-stage](/workflows/operations#automatic-stage-models) and [subagent](/subagents/reference#automatic-model-selection) `model: "auto"`, a complete routing-inference failure runs the stage or child on the current chat model with a recorded warning instead of failing, provided that model is available and satisfies every routing constraint.
|
|
112
63
|
|
|
113
|
-
|
|
64
|
+
## Prepare a decision
|
|
65
|
+
|
|
66
|
+
Instructions describe the judgment. Named `state` fields contain the actual task, relevant conversation, explicit constraints, and reference text. Paths and URLs may identify a source, but do not replace its content. Exclude secrets from state and instructions.
|
|
114
67
|
|
|
115
|
-
|
|
68
|
+
A general structured-output request supplies `instructions`, `state`, and `schema`. Atomic derives choice questions from a compatible schema and skips a classifier for other schemas. Keep fixed numeric limits in code. Include a no-match outcome in the schema when abstention is valid.
|
|
116
69
|
|
|
117
|
-
|
|
70
|
+
Automatic routing builds its own finite Choice questions from eligible execution models. Call `generateStructuredOutput()` directly for other decisions; it derives questions from your result schema instead of reading `routerModel`.
|
|
118
71
|
|
|
119
|
-
|
|
72
|
+
## Provider behavior and limits
|
|
120
73
|
|
|
121
|
-
|
|
74
|
+
Chat candidates receive one internal result tool whose parameters are the registered schema. Atomic uses provider-aware serialization, requests strict sampling where supported, and validates the returned arguments without coercing values or removing extra fields. Use `additionalProperties: false` for closed objects. A prose-only response, extra tool call, truncated response, or invalid result fails that candidate and advances the chain. The public `structured_output` tool is separate: its parameters are `instructions`, `state`, and optional model selectors, and its result is the inferred value.
|
|
122
75
|
|
|
123
|
-
|
|
76
|
+
Chat decisions use HTTP/SSE rather than WebSocket transport fallback and disable configured Anthropic server-side fallbacks for this request only. The chat decision layer retries transient failures according to the request's retry settings. Classifier calls use the registered provider's `classify` operation and forward the retry limit and cancellation signal; provider implementations own their transport retries.
|
|
124
77
|
|
|
125
|
-
Jev
|
|
78
|
+
A registered classifier receives shared state and choice questions through the generic classify operation. [TypeSafe Jev](/providers#typesafe-jev) is one such classifier. Router classification is one classify request. A provider that rejects the request size or context fails that candidate; routing then uses the current chat model when one exists.
|
|
79
|
+
|
|
80
|
+
The structured-decision path never trims supplied state. A general structured-output call skips an incompatible classifier candidate and continues with the next fallback. A provider size rejection advances the same way without repeating the rejected request. Supply concise context or select a chat model with enough capacity when needed.
|
|
81
|
+
|
|
82
|
+
Automatic subagent and workflow-stage model selection uses a [bounded task excerpt](/subagents/reference#automatic-model-selection) for its routing decision. That excerpt preserves protected spans and does not replace the execution prompt. Direct SDK calls do not apply this task-excerpt policy.
|
|
83
|
+
|
|
84
|
+
Classifier response bodies are limited by the provider operation. Atomic validates that every question receives a known Choice option. The classify result does not report token usage. Reported model, probabilities, and confidence are advisory and never reject an otherwise valid decision.
|
|
126
85
|
|
|
127
86
|
## Cancellation and failures
|
|
128
87
|
|
|
129
|
-
Structured decisions have no built-in wall-clock timeout. Slow authentication, inference, repairs, chat fallback
|
|
88
|
+
Structured decisions have no built-in wall-clock timeout. Slow authentication, inference, repairs, and chat fallback can finish without the former 30-second cutoff. Pass an `AbortSignal` to cancel; SDK callers that need their own deadline can supply `signal: AbortSignal.timeout(milliseconds)`. Cancellation rejects the whole call immediately, even if a provider ignores its signal. Ordinary output is still bounded by `maxTokens`, default 4096.
|
|
130
89
|
|
|
131
90
|
The `timeoutMs` request option and `DEFAULT_STRUCTURED_OUTPUT_TIMEOUT_MS` export have been removed. Remove these from existing integrations and use `signal` for caller-owned cancellation. Provider transport, credential-preparation and enclosing tool-request limits remain independent; removing the decision timeout does not disable them.
|
|
132
91
|
|
|
133
92
|
No result is returned for missing state, invalid configuration, unrepaired malformed output or an unrecovered provider failure. Keep action admission after the awaited result and check cancellation again at that boundary. Neither API runs recursive agents or provider probes.
|
|
134
93
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
For direct Jev, HTTP 401 means check `/login typesafe-ai` or `TYPESAFE_API_KEY`; for OpenRouter Jev, check `/login openrouter` or `OPENROUTER_API_KEY`. HTTP 400 or 422 means check the state/question contract or reported context limit; 403 means access denied, 404 means check the endpoint/model, and a reported 429 or 529 means the provider stayed rate limited or overloaded through the automatic retries.
|
|
138
|
-
|
|
139
|
-
Malformed Jev response errors include a static diagnostic code, without response values or routing context: `choice_key` means an answer named no known Choice option (or was missing), and a non-JSON body reports malformed JSON. Include the code when reporting a failure. Router calls may repair these errors before returning a final failure; generic calls fail immediately. No decision naming an unknown option is accepted.
|
|
94
|
+
Provider errors report a static reason without raw response bodies or credentials. A failed classifier request, including a refusal or an unrecognized or missing Choice answer, advances to the next configured model or current chat model. Chat provider errors also advance, including explicit refusals. Ordinary text without a valid result gets up to three repairs before advancing; Atomic does not inspect the wording to guess whether it is a refusal. Cancellation stops the chain.
|
package/docs/sdk.md
CHANGED
|
@@ -111,7 +111,7 @@ When upgrading an existing host:
|
|
|
111
111
|
|
|
112
112
|
- Remove manual registration of Atomic's shipped builtin extensions. They and their resources are included by default. Use `builtins` to disable packages; use `tools`/`excludedTools` to control tool access. An empty tool allowlist also excludes Intercom.
|
|
113
113
|
- Supply all five `HostInput` methods (`confirm`, `select`, `input`, `editor`, `questionnaire`) through `extensionBindings.humanInput`. Preserve question text and option values, honor each request's abort signal, and return literal `true` only for explicit approval. No adapter is not consent: ordinary dialogs reject with `HumanInputUnavailable`, while required durable workflow gates remain pending. Do not translate cancellation into approval.
|
|
114
|
-
- Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that existing run and bind the new adapter with `session.bindExtensions({ humanInput })`; do not start a second run to answer an outstanding question. Durable resume requires working workflow persistence;
|
|
114
|
+
- Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that existing run and bind the new adapter with `session.bindExtensions({ humanInput })`; do not start a second run to answer an outstanding question. Durable resume requires working workflow persistence; inspect the original run's status and correct the reported database problem before retrying.
|
|
115
115
|
- Always `await session.dispose()` in `finally`, including on failure. Disposal is asynchronous and can reject with `ShutdownFailed` after attempting all cleanup; do not hide that rejection or call `process.exit()` to force a successful shutdown. Each session owns its own work, even when services are shared.
|
|
116
116
|
|
|
117
117
|
MCP servers and web providers still require their normal configuration and credentials. Importing the SDK does not connect them or take over standard input. Route host diagnostics through `extensionBindings.onDiagnostic`; a missing provider or extractor is an error, not an empty successful result.
|
package/docs/settings.md
CHANGED
|
@@ -55,7 +55,7 @@ See [Herdr](/herdr) for state aggregation, reporter conflicts, privacy, and Herd
|
|
|
55
55
|
|---------|------|---------|-------------|
|
|
56
56
|
| `defaultProvider` | string | - | Startup provider, saved automatically when you switch models interactively |
|
|
57
57
|
| `defaultModel` | string | - | Startup model ID, saved automatically when you switch models interactively |
|
|
58
|
-
| `routerModel` | string | `""` | Inference model for workflow-stage and subagent `model: "auto"` selection only.
|
|
58
|
+
| `routerModel` | string | `""` | Inference model for workflow-stage and subagent `model: "auto"` selection only. An exact `provider/model` selects a registered chat or classifier model. `auto` and empty use the current chat model. Does not change chat or `structured_output` tool inference. |
|
|
59
59
|
| `defaultThinkingLevel` | string | - | Startup thinking level, saved automatically on interactive model/thinking changes: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`; clamped to the active model's supported levels |
|
|
60
60
|
| `modelThinkingLevels` | object | - | Per-model startup thinking levels keyed by `"provider/modelId"`; updated automatically on interactive model/thinking changes, or configured from `/settings` → Default thinking level per model |
|
|
61
61
|
| `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
|
|
@@ -79,17 +79,17 @@ Normal automatic selection of an available authenticated model remains enabled i
|
|
|
79
79
|
{ "routerModel": "" }
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Use `/settings` → **Router model** to change the effective selection. If the project already defines `routerModel`, the picker edits that project override; otherwise it saves the global default in `~/.atomic/agent/settings.json`. The picker identifies which scope it will save. Choose **Automatic** to save `""` in that scope
|
|
82
|
+
Use `/settings` → **Router model** to change the effective selection. If the project already defines `routerModel`, the picker edits that project override; otherwise it saves the global default in `~/.atomic/agent/settings.json`. The picker identifies which scope it will save. Choose **Automatic** to save `""` in that scope. `""` and `auto` both use the current chat model; saved classifier credentials do not change that choice. To pin a decision model, choose an exact ID from the current registry, such as `typesafe/jev-latest`, or a chat model by provider/model ID. A classifier is not a chat model and does not appear in `/model`. Run `/reload` or restart Atomic to apply the saved choice to an already-running isolated engine.
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
An explicit ID other than `auto` is resolved through the current model registry: a registered classifier first, otherwise a chat model. Gateway classifier IDs are not registered automatically; configure their classifier models and operations before selecting them. An invalid explicit ID, image-generation model, non-string value, or surrounding whitespace fails the decision instead of silently changing providers. An explicit empty project value overrides a global selection and restores the current chat model.
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
A failed explicit classifier routing attempt switches to the current chat model when one exists. That includes missing credentials, an unavailable classify operation, a provider size or context rejection, a refusal, and a malformed answer. Transient retries follow the provider operation and retry settings. Chat routing gets an initial attempt plus three corrective retries for invalid output, using the same context. Routing has no built-in wall-clock deadline; cancel the request to stop waiting. Independent provider, credential-preparation, and enclosing tool-request limits still apply. Atomic reports the fallback; it can incur chat-provider charges. Cancellation does not trigger fallback.
|
|
87
87
|
|
|
88
88
|
Automatic subagent and workflow-stage model selection uses a bounded excerpt for long tasks, keeping the beginning, end, and `<keepContext>...</keepContext>` spans. Only the router's copy is shortened; execution receives the full task and hard model constraints stay enforced. Put essential model-selection requirements in protected spans. Unprotected middle text may be omitted, so excerpts can affect model choice. This does not truncate general structured decisions.
|
|
89
89
|
|
|
90
|
-
If
|
|
90
|
+
If the selected classifier rejects the request for size or context, routing switches to the current chat model.
|
|
91
91
|
|
|
92
|
-
This setting selects inference for [workflow-stage `model: "auto"`](/workflows/authoring#automatic-stage-model-selection) and [subagent `model: "auto"`](/subagents/reference#automatic-model-selection). It does not directly select the child execution model or change the selected chat model, `structured_output` tool, or general structured-output inference. The selected router provider receives the routing context, so choose a provider permitted to process that data. Authenticate
|
|
92
|
+
This setting selects inference for [workflow-stage `model: "auto"`](/workflows/authoring#automatic-stage-model-selection) and [subagent `model: "auto"`](/subagents/reference#automatic-model-selection). It does not directly select the child execution model or change the selected chat model, `structured_output` tool, or general structured-output inference. The decision provider may be any registered classifier or chat model, never an image-generation model; execution `auto` selects only chat language models, including multimodal-input chat. The selected router provider receives the routing context, so choose a provider permitted to process that data. Authenticate a pinned classifier with that provider's login, such as `/login typesafe` or `TYPESAFE_API_KEY` for TypeSafe Jev. See [Structured decisions](/sdk/structured-decisions) and [TypeSafe Jev](/providers#typesafe-jev).
|
|
93
93
|
|
|
94
94
|
Remove secrets from routing tasks, inputs, and workflow descriptions/contracts before calling the tool. A routing-context credential error stops before inference or launch. Known configured credentials are screened even when they belong to a provider other than the router. Remove the credential from the supplied context or registered definition, reload a changed definition, then retry explicitly. The guard does not detect every possible secret.
|
|
95
95
|
|
|
@@ -25,23 +25,22 @@ Put requirements that should influence model selection in the task. Atomic suppl
|
|
|
25
25
|
|
|
26
26
|
The agent's system prompt is not routing metadata. For a self-contained agent with no task, it remains the task fallback. The router weighs task-relevant evidence, cost, and latency rather than always choosing a benchmark winner or maximum effort. Benchmark measurement effort does not prescribe execution effort.
|
|
27
27
|
|
|
28
|
-
Long tasks use a model-selection excerpt capped at 9,000 JSON-encoded UTF-8 bytes, retaining the beginning, end, and `<keepContext>...</keepContext>` spans in source order. Omissions are marked. Put essential selection requirements in protected spans, since unprotected middle text may be omitted. This applies to
|
|
28
|
+
Long tasks use a model-selection excerpt capped at 9,000 JSON-encoded UTF-8 bytes, retaining the beginning, end, and `<keepContext>...</keepContext>` spans in source order. Omissions are marked. Put essential selection requirements in protected spans, since unprotected middle text may be omitted. This applies to the routing request, not execution: the child still receives its complete task. If protected content cannot fit, Atomic keeps the original task. A classifier that rejects that request falls back to the current chat model. Hard `modelConstraints` are never truncated.
|
|
29
29
|
|
|
30
30
|
The shared [`routerModel`](/settings#routermodel) setting chooses the model making the decision, not the child model. Selection follows this order:
|
|
31
31
|
|
|
32
|
-
1. An explicit
|
|
33
|
-
2.
|
|
34
|
-
3. The current chat model.
|
|
32
|
+
1. An explicit registered classifier or chat model.
|
|
33
|
+
2. The current chat model, including when `routerModel` is unset or `auto`.
|
|
35
34
|
|
|
36
|
-
Neither routing nor child fallback changes the parent chat model or the `structured_output` tool.
|
|
35
|
+
Saved classifier credentials do not change this order. Neither routing nor child fallback changes the parent chat model or the `structured_output` tool.
|
|
37
36
|
|
|
38
|
-
Routing has no built-in wall-clock deadline. Slow decisions can finish; cancel the request to stop waiting. Independent provider and credential-preparation limits still apply.
|
|
37
|
+
Routing has no built-in wall-clock deadline. Slow decisions can finish; cancel the request to stop waiting. Independent provider and credential-preparation limits still apply. Chat routing gets an initial attempt plus three corrective retries for malformed or schema-invalid answers. A classifier routing failure switches to the current chat model instead of repeating the classifier request. A valid answer stops repairs.
|
|
39
38
|
|
|
40
39
|
The result records a primary `{ model, effort }` and up to two ordered `fallbacks`, each with its own model and effort. Atomic ranks three distinct eligible provider/model IDs, or all available IDs when fewer than three qualify. It selects each rank from the remaining models, excluding all efforts of earlier choices. A supported `"off"` is distinct from `null`, which means no configurable reasoning. The catalog reflects configured authentication, not proof of valid credentials, quota, or entitlement.
|
|
41
40
|
|
|
42
|
-
The child does not start if no candidates are eligible, availability changes, or cancellation occurs.
|
|
41
|
+
The child does not start if no candidates are eligible, availability changes, or cancellation occurs. A classifier provider failure, missing credentials, unsupported classify operation, size rejection, or malformed answer triggers a reported switch to the current chat model. Transient provider failures are retried up to three times first. The chat model gets its own output-repair allowance. If routing inference fails completely, the child runs on the current chat model instead of failing, with a reported warning, but only when that model is available and satisfies every routing constraint (such as `allowedModels` and effort, cost, context and input limits). Otherwise the launch fails. Invalid inputs, conflicting constraints, cancellation and stale-catalog failures never trigger fallback. No partial decision can launch a child.
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
Router classification is one classify request for the prepared choices. If the provider rejects the request size, routing uses the current chat model. See [structured decision limits](/sdk/structured-decisions#provider-behavior-and-limits).
|
|
45
44
|
|
|
46
45
|
Execution tries the ranked models in order before remaining configured fallbacks and the current chat model, subject to normal retry rules and hard constraints. Duplicate model IDs are attempted only at their first position. Each ranked candidate retains its selected effort. Ranking can require up to three selection passes. Metadata preserves the ordered decision separately from the model and effort actually used; workflow checkpoints restore that order without rerouting.
|
|
47
46
|
|
package/docs/usage.md
CHANGED
|
@@ -162,6 +162,19 @@ Append to the default prompt without replacing it with `APPEND_SYSTEM.md` in eit
|
|
|
162
162
|
|
|
163
163
|
The default prompt asks the agent to write self-describing code and not add code comments unless you ask for them or the task calls for them. To get comments, request them in your prompt (for example "add JSDoc to the exported functions"), or make it a standing rule in a context file or `APPEND_SYSTEM.md` (for example "Document every exported function with a JSDoc block"). The default guideline explicitly defers to those instructions, so no other configuration is needed.
|
|
164
164
|
|
|
165
|
+
When a shell tool is available, the default prompt also asks the agent to record how each task ran in the commits, PRs, issues, and comments it writes, so later sessions can learn from your history:
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
Assistant-workflow: ralph (run 1a2b3c4d)
|
|
169
|
+
Assistant-duration: 42m converged, estimated 30m
|
|
170
|
+
Assistant-verification: vitest unit passed: npm run test:unit
|
|
171
|
+
Assistant-verification: herdr terminal E2E passed: /tasks lists running tasks first at 80x24
|
|
172
|
+
User-preference: keep PRs under 500 changed lines
|
|
173
|
+
Co-authored-by: Ada Lovelace <ada@example.com>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Tasks done without a workflow record `Assistant-workflow: inline`. Each `Assistant-verification` line names one check that ran or was attempted, such as unit or E2E tests, agent-browser, Cua Driver, Herdr terminal automation, or the qlty CLI, with its outcome (`passed`, `failed`, or `unavailable`). Each preference carries a `Co-authored-by` line naming the user who expressed it. Before choosing between a workflow and inline work, deciding how to verify a change, or estimating how long a task will take, the agent looks up comparable records with your version control system and its hosting CLI (for example `git log` and `gh` on GitHub) and uses them as a guide alongside your request. For verification, it starts from the checks that proved similar changes and skips setups previously recorded as unavailable unless something has changed, while still running the project's required checks. It applies your own recorded preferences first and falls back to other contributors' preferences as repository conventions only when yours don't cover the situation, so you can always override a convention by stating your preference. To turn off any of these records, such as only preferences or all of them, say so in your request, a context file, or `APPEND_SYSTEM.md`.
|
|
177
|
+
|
|
165
178
|
## Exporting and Sharing Sessions
|
|
166
179
|
|
|
167
180
|
Use `/export [file]` to write a session to HTML.
|