@bastani/atomic 0.8.29-alpha.3 → 0.8.29

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +9 -6
  2. package/dist/builtin/cursor/CHANGELOG.md +2 -0
  3. package/dist/builtin/cursor/package.json +2 -2
  4. package/dist/builtin/intercom/CHANGELOG.md +3 -1
  5. package/dist/builtin/intercom/package.json +1 -1
  6. package/dist/builtin/mcp/CHANGELOG.md +3 -1
  7. package/dist/builtin/mcp/package.json +1 -1
  8. package/dist/builtin/subagents/CHANGELOG.md +5 -4
  9. package/dist/builtin/subagents/README.md +4 -4
  10. package/dist/builtin/subagents/package.json +1 -1
  11. package/dist/builtin/subagents/src/extension/index.ts +14 -0
  12. package/dist/builtin/subagents/src/extension/schemas.ts +1 -1
  13. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +1 -6
  14. package/dist/builtin/subagents/src/runs/foreground/execution.ts +1 -6
  15. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +0 -1
  16. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +0 -1
  17. package/dist/builtin/subagents/src/runs/shared/structured-output.ts +16 -285
  18. package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +1 -9
  19. package/dist/builtin/subagents/src/shared/types.ts +0 -1
  20. package/dist/builtin/subagents/src/slash/saved-chain-mapping.ts +3 -18
  21. package/dist/builtin/web-access/CHANGELOG.md +3 -1
  22. package/dist/builtin/web-access/package.json +1 -1
  23. package/dist/builtin/workflows/CHANGELOG.md +6 -5
  24. package/dist/builtin/workflows/README.md +1 -1
  25. package/dist/builtin/workflows/builtin/goal.ts +8 -52
  26. package/dist/builtin/workflows/builtin/open-claude-design.ts +15 -38
  27. package/dist/builtin/workflows/builtin/ralph.ts +11 -50
  28. package/dist/builtin/workflows/package.json +1 -1
  29. package/dist/builtin/workflows/src/extension/index.ts +17 -0
  30. package/dist/builtin/workflows/src/extension/workflow-schema.ts +2 -29
  31. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +1 -5
  32. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +1 -1
  33. package/dist/builtin/workflows/src/shared/types.ts +1 -1
  34. package/dist/core/sdk.d.ts +3 -3
  35. package/dist/core/sdk.d.ts.map +1 -1
  36. package/dist/core/sdk.js +2 -2
  37. package/dist/core/sdk.js.map +1 -1
  38. package/dist/core/system-prompt.d.ts.map +1 -1
  39. package/dist/core/system-prompt.js +0 -36
  40. package/dist/core/system-prompt.js.map +1 -1
  41. package/dist/core/tools/index.d.ts +1 -1
  42. package/dist/core/tools/index.d.ts.map +1 -1
  43. package/dist/core/tools/index.js +1 -1
  44. package/dist/core/tools/index.js.map +1 -1
  45. package/dist/core/tools/structured-output.d.ts +7 -18
  46. package/dist/core/tools/structured-output.d.ts.map +1 -1
  47. package/dist/core/tools/structured-output.js +9 -89
  48. package/dist/core/tools/structured-output.js.map +1 -1
  49. package/dist/core/tools/todos.d.ts +1 -0
  50. package/dist/core/tools/todos.d.ts.map +1 -1
  51. package/dist/core/tools/todos.js +4 -0
  52. package/dist/core/tools/todos.js.map +1 -1
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/index.js.map +1 -1
  57. package/docs/extensions.md +1 -1
  58. package/docs/sdk.md +1 -1
  59. package/docs/subagents.md +4 -6
  60. package/docs/usage.md +1 -1
  61. package/docs/workflows.md +5 -5
  62. package/package.json +2 -2
package/docs/sdk.md CHANGED
@@ -655,7 +655,7 @@ const { session } = await createAgentSession({
655
655
  });
656
656
  ```
657
657
 
658
- The tool parameters are exactly `DecisionSchema`: the model calls `structured_output({ approved, findings })`, not `structured_output({ value: { approved, findings } })`. A successful call stores the flat params in `capture.value`, returns them as tool `details`, and sets `terminate: true` so there is no extra follow-up assistant turn. When an `output` file sink is configured, the factory writes the same flat schema-valid params to `output.json` and writes call metadata (`toolName`, `toolCallId`, `success`, `terminate`) to a private `output.meta.json` sidecar for finality-checked parent readback. Structured-output schemas must be top-level object tool-argument schemas; wrap array or primitive final values in object fields such as `{ items: [...] }` or `{ value: ... }`. Structured-output tool definitions opt out of oversized-result persistence, so large final JSON remains inline as the machine-readable result instead of being replaced by a `<persisted-output>` pointer; text print mode also emits the terminating JSON for factory-created tools, including custom names.
658
+ The tool parameters are exactly the supplied schema: with `DecisionSchema`, the model calls `structured_output({ approved, findings })`. Array and primitive schemas are also accepted by the factory when the target provider/tool runtime supports them; the captured value is whatever JSON value matches the schema. A successful call stores the params in `capture.value`, returns them as pretty-printed JSON tool-result text for text print mode, keeps the flat value in tool `details`, writes the same JSON to the configured `output.outputPath` when an `output` file sink is configured, and sets `terminate: true` so there is no extra follow-up assistant turn. Atomic relies on the tool schema instead of extra structured-output parsing or sidecar validation. Structured-output tool definitions opt out of oversized-result persistence.
659
659
 
660
660
  Custom tool names are supported, and the prompt metadata follows the configured name. If you use a custom name such as `final_decision`, include that name in any explicit `tools` allowlist. If the standard `structured_output` name is required, register the factory with its default name:
661
661
 
package/docs/subagents.md CHANGED
@@ -148,7 +148,7 @@ If an agent or chain step uses an explicit empty `tools: []` allowlist together
148
148
 
149
149
  ## Structured output schemas
150
150
 
151
- Chain and parallel steps can declare an `outputSchema` when the parent needs reliable machine-readable handoff data. Atomic passes that schema to the child as a schema-specific `structured_output` tool backed by the shared Atomic factory. The child must finish by calling `structured_output` exactly once with arguments that match the schema directly:
151
+ Chain and parallel steps can declare an `outputSchema` when the parent needs reliable machine-readable handoff data. Atomic passes that schema directly to a `structured_output` tool backed by the shared Atomic factory. The child should call `structured_output` when it is done:
152
152
 
153
153
  ```ts
154
154
  structured_output({
@@ -157,13 +157,11 @@ structured_output({
157
157
  })
158
158
  ```
159
159
 
160
- `outputSchema` itself must be a top-level object schema because the schema is used directly as the tool's argument contract. Wrap array or primitive handoff values in an explicit object field, such as `{ items: [...] }` or `{ value: ... }`.
160
+ `outputSchema` is a plain JSON Schema descriptor object. It may describe object, array, or primitive final values, and the child should pass a JSON value that matches that schema directly. Atomic no longer adds object-root restrictions, sidecar metadata, transcript-finality checks, duplicate-call guards, or extra parent-side schema parsing. The child runtime writes the tool arguments to `output.json`; the parent reads that JSON back as `result.structuredOutput` and in named-chain references under `outputs.name.structured`.
161
161
 
162
- Do not wrap the payload as `structured_output({ value: ... })` unless your own schema explicitly defines a top-level `value` field. The child runtime writes the flat schema-valid params to `output.json` and call metadata (`toolName`, `toolCallId`, `success`, `terminate`) to the `output.meta.json` sidecar; the parent validates both files before checking transcript finality. Prose-only completion, missing tool calls, missing sidecar metadata, invalid schema data, duplicate structured-output calls, stale output-file captures, sibling tool calls in the same assistant batch, and any assistant/custom/tool-result messages after the successful structured-output result fail the step. The parent accepts cross-process captures only when the transcript proves the same `structured_output` call was the final successful terminating action, then returns the validated flat value as `result.structuredOutput` and in named-chain references under `outputs.name.structured`.
162
+ Children without `outputSchema` do not receive `structured_output` from Atomic's default tool registry. They can still use a custom extension-provided terminating tool if you explicitly add one.
163
163
 
164
- Children without `outputSchema` do not receive `structured_output` from Atomic's default tool registry. They can still use a custom extension-provided terminating tool if you explicitly add one, but validated `result.structuredOutput` is reserved for schema-backed `outputSchema` captures.
165
-
166
- Dynamic fanout `collect.outputSchema` is different: it validates the collected result array after child runs finish, not a child tool-call argument object. Collection schemas remain general JSON Schemas and may use array roots such as `{ "type": "array", "minItems": 1 }`.
164
+ Dynamic fanout `collect.outputSchema` validates the collected result array after child runs finish.
167
165
 
168
166
  ## Fallback models
169
167
 
package/docs/usage.md CHANGED
@@ -160,7 +160,7 @@ In print mode, Atomic also reads piped stdin and merges it into the initial prom
160
160
  cat README.md | atomic -p "Summarize this text"
161
161
  ```
162
162
 
163
- When a print-mode turn correctly finishes by calling an opt-in terminating structured-output tool created with `createStructuredOutputTool` (for example from an extension, SDK caller, or workflow item with a schema), stdout contains the tool result's JSON text even though there is no follow-up assistant prose. This also works for custom factory names such as `final_decision`. Large final JSON from structured-output tools is preserved inline rather than redirected to a `<persisted-output>` pointer. Non-terminating or unrelated tool results are not printed as the final response.
163
+ When a print-mode turn correctly finishes by calling an opt-in terminating structured-output tool created with `createStructuredOutputTool` (for example from an extension, SDK caller, or workflow item with a schema), Atomic ends after that tool result without an extra follow-up assistant turn. Print-mode stdout contains the terminating structured JSON payload, so `atomic -p` remains script-friendly while the same value is also available through the SDK `capture` sink, tool `details`, a configured file sink, workflow `result.structured`, or subagent `result.structuredOutput`. This also works for custom factory names such as `final_decision`. Non-terminating or unrelated tool results are not printed as the final response.
164
164
 
165
165
  ### Model Options
166
166
 
package/docs/workflows.md CHANGED
@@ -1102,7 +1102,7 @@ Control-signal probing is fail-closed. When the executor inspects an arbitrary t
1102
1102
  - Avoid workflow-specific or stage-specific vocabulary that is not explained inside the current prompt.
1103
1103
  - Use clear software engineering terminology in self-described prompts.
1104
1104
  - Avoid hard-coded regular expressions for condition matching when gating reviews or model outputs.
1105
- - Prefer schema-backed workflow stages (`ctx.stage(..., { schema })`, `ctx.chain` items, or `ctx.parallel` items) for review/gate decisions whenever model output needs to be evaluated; Atomic injects the canonical `structured_output` tool only for those schema-enabled items.
1105
+ - Prefer schema-backed workflow stages (`ctx.stage(..., { schema })`, `ctx.chain` items, or `ctx.parallel` items) for review/gate decisions whenever model output needs to be evaluated; a schema-enabled item receives the structured-output tool automatically.
1106
1106
  - Treat atomic workflow units as language model stages, not deterministic tools.
1107
1107
  - When deterministic gates are needed, create small dedicated stages that instruct a model to run a specific tool or perform a specific check. This keeps gates adaptive to the current codebase while preserving explicit workflow structure.
1108
1108
 
@@ -1479,7 +1479,7 @@ Common task/stage options include:
1479
1479
  - `output`, `outputMode`, `reads`, `worktree`, `gitWorktreeDir`, `baseBranch`, `maxOutput`, `artifacts`, `sessionDir`, `cwd`, `agentDir`
1480
1480
  - advanced host-supplied SDK seams: `authStorage`, `resourceLoader`, `sessionManager`, `settingsManager`, `sessionStartEvent`
1481
1481
 
1482
- `schema` is opt-in. When a `ctx.stage` call, `ctx.task` call, `ctx.chain` item, or `ctx.parallel` item includes a top-level object TypeBox/JSON Schema, Atomic registers a schema-specific `structured_output` tool for that item only, appends final-answer instructions, and requires the stage to finish by calling the tool exactly once. The prompt result is the parsed structured value for `ctx.stage(..., { schema }).prompt(...)`; task/chain/parallel results also include `result.structured` and keep `result.text` as formatted JSON for handoffs. Because the result contract is single-use, a schema-backed `StageContext` supports one `prompt()` call; create a new `ctx.stage(..., { schema })` for each additional structured prompt. If the item also uses an explicit `tools` allowlist, Atomic automatically adds `structured_output` to that allowlist. Items without `schema` do not receive `structured_output` from the normal tool registry.
1482
+ `schema` is opt-in. When a `ctx.stage` call, `ctx.task` call, `ctx.chain` item, or `ctx.parallel` item includes a TypeBox schema or plain JSON Schema descriptor object, Atomic registers a schema-specific final-answer tool for that item only. The schema may describe object, array, or primitive final values; the captured value is the JSON value passed to the tool. The prompt result is the captured structured value for `ctx.stage(..., { schema }).prompt(...)`; task/chain/parallel results also include `result.structured` and keep `result.text` as formatted JSON for handoffs. Because the result contract is single-use, a schema-backed `StageContext` supports one `prompt()` call; create a new `ctx.stage(..., { schema })` for each additional structured prompt. If the item also uses an explicit `tools` allowlist, Atomic automatically adds the final-answer tool to that allowlist. Items without `schema` do not receive it from the normal tool registry.
1483
1483
 
1484
1484
  `subagent` is available as a default workflow-stage tool, with the same default two-hop nesting budget as main chat: a workflow stage can launch a subagent, and that subagent can launch one nested subagent before the guard blocks further delegation. `tools` remains an allowlist across built-in tools and bundled extension tools; if you set `tools`, list every tool the stage should see. Explicitly listing tools such as `subagent`, `web_search`, `fetch_content`, or `intercom` exposes those tools to the stage, while `excludedTools` and `noTools: "all"` still win. The bundled subagent definitions from `@bastani/subagents` are available to the `subagent` tool in workflow stages; when a workflow is itself running inside a subagent child process, Atomic isolates stage resource discovery from the parent child-process flags so `subagent` remains available while workflow-stage nested-depth guards remain in force.
1485
1485
 
@@ -1742,7 +1742,7 @@ Build validation into the workflow instead of waiting for a final manual check.
1742
1742
  - reviewer stages: fresh-context reviewers that inspect artifacts and current files
1743
1743
  - LLM-as-judge stages: direct scoring, pairwise comparison, or rubric-based grading for subjective outputs
1744
1744
 
1745
- Prefer schema-enabled workflow items for model review and gate decisions. `structured_output` is not available to workflow stages through the normal Atomic tool registry; it is injected only when a `ctx.stage`, `ctx.task`, `ctx.chain` item, or `ctx.parallel` item includes `schema`. Structured-output schemas must be top-level object tool-argument schemas, so wrap array or primitive decisions in object fields such as `{ items: [...] }` or `{ value: ... }`; direct JSON invocations of the `workflow` tool must use a schema with `type: "object"` so invalid array/primitive contracts fail at argument validation instead of later in the stage. Terminating `structured_output` JSON is preserved inline even when it exceeds the normal oversized-tool-result threshold, so workflow code can consume the parsed value instead of a `<persisted-output>` pointer. Do not add the old synthetic `{ value: ... }` wrapper around an object payload unless your schema defines that field, and do not make correctness depend on brittle regular-expression matching against free-form prose such as “looks good”, “approved”, or “PASS”. A schema with explicit booleans/enums, findings arrays, confidence, evidence fields, and error reporting is easier to validate, replay, and safely default to “not approved” when malformed.
1745
+ Prefer schema-enabled workflow items for model review and gate decisions. Atomic passes the schema directly to the final-answer tool and captures the tool arguments; it no longer adds separate structured-output parsing, object-root restrictions, or sidecar validation. Object-shaped decision schemas with explicit booleans/enums, findings arrays, confidence, evidence fields, and error reporting are usually easiest to consume, but array or primitive schemas are valid when they fit the handoff. Avoid brittle regular-expression matching against free-form prose such as “looks good”, “approved”, or “PASS”.
1746
1746
 
1747
1747
  Use small dedicated model stages for adaptive gates when deterministic code alone cannot decide what to check. For example, a stage can read an artifact, inspect the repo, run a named tool or command, and then emit a structured decision by configuring `schema` on that workflow item. Keep that stage's prompt narrow: tell it the specific check to perform, the files/tools it may use, and the structured decision it must return.
1748
1748
 
@@ -1801,5 +1801,5 @@ Good workflows are information-flow systems, not just prompt sequences. Keep sta
1801
1801
  - Do not call `kill` when the user asks to interrupt or pause resumably.
1802
1802
  - Keep stage names readable because they appear in workflow status and UI.
1803
1803
  - Do not write stage prompts that depend on hidden workflow-wide awareness; make each model stage locally scoped and self-described.
1804
- - Do not parse model gate decisions from ad-hoc prose with regular expressions; configure `schema` on a focused workflow item so Atomic injects the canonical `structured_output` tool for that item.
1805
- - Return compact structured output for decisions and save large artifacts to files; schema-enabled workflow items preserve final JSON inline, but artifact handoffs should still use files when the next stage does not need the whole payload in context.
1804
+ - Do not parse model gate decisions from ad-hoc prose with regular expressions; configure `schema` on a focused workflow item and consume `result.structured`.
1805
+ - Return compact structured decisions and save large artifacts to files; artifact handoffs should still use files when the next stage does not need the whole payload in context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/atomic",
3
- "version": "0.8.29-alpha.3",
3
+ "version": "0.8.29",
4
4
  "description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "atomicConfig": {
@@ -68,7 +68,7 @@
68
68
  "prepublishOnly": "bun run clean && bun run build"
69
69
  },
70
70
  "dependencies": {
71
- "@bastani/atomic-natives": "0.8.29-alpha.3",
71
+ "@bastani/atomic-natives": "0.8.29",
72
72
  "@bufbuild/protobuf": "^2.0.0",
73
73
  "@earendil-works/pi-agent-core": "^0.79.3",
74
74
  "@earendil-works/pi-ai": "^0.79.3",