@bastani/atomic 0.10.14 → 0.10.15-alpha.1
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 +17 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
- package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +2 -2
- package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
- package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
- package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
- package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
- package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
- package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
- package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
- package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
- package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
- package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/auth-cli.code.js +1 -1
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +1 -1
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +1 -1
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/compaction/compactor.d.ts +0 -8
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +2 -2
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +1 -1
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +3 -3
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +2 -2
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +2 -2
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +2 -2
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +2 -2
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +2 -2
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +1 -1
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +1 -1
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.d.ts +21 -1
- package/dist/index.js +2 -2
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/print-mode.js +1 -1
- package/dist/package-manager-cli.code.js +2 -2
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/6.js +1 -1
- package/dist/utils/startup-database-spare.code.js +1 -1
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks/reference.md +182 -0
- package/docs/background-tasks.md +98 -405
- package/docs/build.md +67 -27
- package/docs/changelog.mdx +1 -1
- package/docs/codemode.md +108 -39
- package/docs/compaction/branch-summaries.md +54 -0
- package/docs/compaction/custom-compactors.md +161 -0
- package/docs/compaction/memory-compaction.md +77 -0
- package/docs/compaction/reference.md +86 -38
- package/docs/compaction.md +51 -252
- package/docs/computer-use.md +169 -321
- package/docs/containerization.md +71 -57
- package/docs/custom-provider/api-reference.md +119 -25
- package/docs/custom-provider/oauth.md +114 -132
- package/docs/custom-provider/override.md +37 -27
- package/docs/custom-provider/registration.md +107 -83
- package/docs/custom-provider/streaming.md +85 -71
- package/docs/custom-provider.md +85 -52
- package/docs/development.md +39 -29
- package/docs/docs.json +76 -63
- package/docs/environment-variables.md +94 -44
- package/docs/extensions/api-reference.md +86 -43
- package/docs/extensions/authoring.md +162 -154
- package/docs/extensions/events.md +80 -25
- package/docs/extensions/examples.md +90 -85
- package/docs/extensions/ui.md +206 -82
- package/docs/extensions.md +79 -108
- package/docs/getting-started/authentication.md +67 -36
- package/docs/getting-started/first-session.md +53 -43
- package/docs/getting-started/installation.md +116 -89
- package/docs/getting-started/project-instructions.md +48 -34
- package/docs/guides/configuration.md +82 -20
- package/docs/guides/non-interactive.md +66 -24
- package/docs/guides/resume-on-any-machine.md +135 -82
- package/docs/guides/team-setup.md +114 -105
- package/docs/guides.md +76 -32
- package/docs/herdr.md +15 -16
- package/docs/how-atomic-works.md +140 -0
- package/docs/index.md +58 -44
- package/docs/intercom/operations.md +141 -151
- package/docs/intercom/reference.md +85 -108
- package/docs/intercom.md +84 -145
- package/docs/json.md +120 -67
- package/docs/keybindings.md +85 -49
- package/docs/libraries/agent-core.md +137 -275
- package/docs/libraries/ai.md +100 -84
- package/docs/libraries/codemode.md +210 -300
- package/docs/libraries/schema.md +59 -53
- package/docs/libraries/storage-postgres.md +49 -35
- package/docs/libraries/telemetry.md +153 -354
- package/docs/libraries/tui.md +265 -393
- package/docs/libraries.md +42 -26
- package/docs/llama-cpp.md +171 -161
- package/docs/mcp-servers.md +90 -51
- package/docs/models/choose-a-model.md +188 -0
- package/docs/models/reference.md +74 -30
- package/docs/models.md +153 -88
- package/docs/orchestration/migrating-workflows.md +23 -16
- package/docs/orchestration/patterns.md +39 -44
- package/docs/orchestration.md +65 -26
- package/docs/packages/authoring.md +51 -29
- package/docs/packages/reference.md +42 -21
- package/docs/packages.md +69 -58
- package/docs/programmatic.md +118 -24
- package/docs/prompt-templates.md +84 -83
- package/docs/providers/reference.md +43 -48
- package/docs/providers.md +219 -451
- package/docs/quickstart.md +140 -120
- package/docs/reference/cli.md +135 -97
- package/docs/reference.md +20 -18
- package/docs/rpc/examples.md +76 -20
- package/docs/rpc/extension-ui.md +64 -38
- package/docs/rpc/protocol.md +361 -110
- package/docs/rpc.md +57 -17
- package/docs/sdk/reference.md +409 -534
- package/docs/sdk/storage.md +53 -13
- package/docs/sdk/structured-decisions.md +82 -56
- package/docs/sdk/web-server.md +57 -43
- package/docs/sdk.md +106 -84
- package/docs/security.md +42 -64
- package/docs/session-format.md +62 -38
- package/docs/sessions.md +99 -214
- package/docs/settings.md +165 -195
- package/docs/shell-aliases.md +9 -6
- package/docs/skills/authoring.md +69 -48
- package/docs/skills/reference.md +51 -20
- package/docs/skills.md +99 -148
- package/docs/slash-commands.md +129 -0
- package/docs/storage/custom-adapters.md +160 -85
- package/docs/storage/jsonl.md +81 -66
- package/docs/storage/postgres/pgbouncer.md +120 -126
- package/docs/storage/postgres/tuning.md +120 -143
- package/docs/storage/postgres.md +314 -330
- package/docs/storage/sqlite.md +71 -42
- package/docs/storage.md +298 -302
- package/docs/subagents/authoring.md +55 -38
- package/docs/subagents/reference.md +73 -33
- package/docs/subagents.md +119 -187
- package/docs/terminal-setup.md +50 -38
- package/docs/termux.md +67 -41
- package/docs/themes/reference.md +23 -19
- package/docs/themes.md +142 -127
- package/docs/tmux.md +47 -55
- package/docs/tools.md +147 -109
- package/docs/tui/reference.md +166 -214
- package/docs/tui.md +196 -341
- package/docs/usage.md +118 -138
- package/docs/verification.md +79 -51
- package/docs/web-access.md +121 -101
- package/docs/windows.md +26 -27
- package/docs/worktree-snapshots/reference.md +245 -0
- package/docs/worktree-snapshots.md +71 -259
- package/package.json +8 -8
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
- package/docs/guides/intercom.md +0 -32
- package/docs/guides/orchestration.md +0 -28
- package/docs/guides/subagents.md +0 -37
package/docs/build.md
CHANGED
|
@@ -1,47 +1,87 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Build with Atomic"
|
|
3
|
-
sidebarTitle: "
|
|
3
|
+
sidebarTitle: "Build with Atomic"
|
|
4
4
|
description: "Choose how to customize an Atomic session, extend it with TypeScript or MCP, or embed it in your own software."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Customize
|
|
7
|
+
Customize how Atomic behaves in your repository, connect external tools, or embed the agent runtime in your own software.
|
|
8
8
|
|
|
9
|
-
New to Atomic? Start with the [Quickstart](/quickstart).
|
|
9
|
+
New to Atomic? Start with the [Quickstart](/quickstart) or [How Atomic works](/how-atomic-works). Looking for an exact CLI flag, setting, or API contract? Use the [Reference index](/reference).
|
|
10
10
|
|
|
11
11
|
## Choose the lightest mechanism
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Start at the top of this table and stop at the first mechanism that fits your task.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
| What you want | Start with | Needs code? |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Expand a reusable Markdown prompt from a `/command` | [Create prompt templates](/prompt-templates) | No |
|
|
18
|
+
| Give the agent on-demand instructions and optional scripts | [Use skills](/skills) | Optional scripts |
|
|
19
|
+
| Connect external tools and data sources over MCP | [MCP servers](/mcp-servers) | No (config only) |
|
|
20
|
+
| Delegate a focused, bounded task to a child agent | [Subagents](/subagents) | No |
|
|
21
|
+
| Coordinate live sessions on one host or across machines | [Intercom](/intercom) | No |
|
|
22
|
+
| Run multi-step fan-out, checks, and recovery logic | [Orchestration](/orchestration) | JavaScript in codemode |
|
|
23
|
+
| Add custom tools, slash commands, lifecycle hooks, or custom UI | [Extensions](/extensions) | TypeScript |
|
|
24
|
+
| Bundle and version customizations to share across teams | [Atomic packages](/packages) | Package manifest |
|
|
25
|
+
|
|
26
|
+
<Note>
|
|
27
|
+
Need restored worktrees to rebuild dependencies and caches automatically across machines or CI runners? Define `.atomic/blueprint.yaml` as an [environment blueprint](/guides/resume-on-any-machine#set-the-environment-up-with-a-blueprint).
|
|
28
|
+
</Note>
|
|
24
29
|
|
|
25
30
|
## Change the model layer
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
<Columns cols={2}>
|
|
33
|
+
<Card title="Choose a model" href="/models/choose-a-model">
|
|
34
|
+
Switch chat models, thinking levels, scoped models, and fallbacks day to day.
|
|
35
|
+
</Card>
|
|
36
|
+
<Card title="Custom models" href="/models">
|
|
37
|
+
Add model entries, parameter overrides, or compatible endpoints in `models.json`.
|
|
38
|
+
</Card>
|
|
39
|
+
<Card title="Remote compaction models" href="/compaction/custom-compactors">
|
|
40
|
+
Tune built-in Morph compaction parameters or connect your own remote compaction endpoint.
|
|
41
|
+
</Card>
|
|
42
|
+
<Card title="Custom providers" href="/custom-provider">
|
|
43
|
+
Implement a provider API, classifier, remote compactor, or OAuth flow that Atomic does not ship.
|
|
44
|
+
</Card>
|
|
45
|
+
</Columns>
|
|
30
46
|
|
|
31
47
|
## Customize appearance and controls
|
|
32
48
|
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
<Columns cols={2}>
|
|
50
|
+
<Card title="Create themes" href="/themes">
|
|
51
|
+
Switch built-in palettes, follow terminal light or dark mode, or author custom JSON themes with live hot reload.
|
|
52
|
+
</Card>
|
|
53
|
+
<Card title="Keybindings" href="/keybindings">
|
|
54
|
+
Rebind interactive shortcuts and navigation keys in `keybindings.json`.
|
|
55
|
+
</Card>
|
|
56
|
+
</Columns>
|
|
35
57
|
|
|
36
58
|
## Embed Atomic in your own software
|
|
37
59
|
|
|
38
|
-
|
|
60
|
+
Compare print mode, JSON streams, RPC, and the TypeScript SDK in [Programmatic modes](/programmatic), then jump to the integration that fits your stack.
|
|
39
61
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
<Columns cols={2}>
|
|
63
|
+
<Card title="TypeScript SDK" href="/sdk">
|
|
64
|
+
Embed Atomic directly in Node.js applications with full session and tool control.
|
|
65
|
+
</Card>
|
|
66
|
+
<Card title="SDK storage backends" href="/sdk/storage">
|
|
67
|
+
Wire local SQLite, JSONL, in-memory, or PostgreSQL storage into `createAgentSession()`.
|
|
68
|
+
</Card>
|
|
69
|
+
<Card title="Structured decisions" href="/sdk/structured-decisions">
|
|
70
|
+
Run typed classifier or chat decisions with `decide()` and `generateStructuredOutput()`.
|
|
71
|
+
</Card>
|
|
72
|
+
<Card title="Web server guide" href="/sdk/web-server">
|
|
73
|
+
Stream agent runs from an HTTP server or Next.js App Router endpoint.
|
|
74
|
+
</Card>
|
|
75
|
+
<Card title="RPC mode" href="/rpc">
|
|
76
|
+
Drive an Atomic session over stdin and stdout JSONL from any language.
|
|
77
|
+
</Card>
|
|
78
|
+
<Card title="JSON event stream mode" href="/json">
|
|
79
|
+
Run non-interactive prompts that emit structured JSONL events.
|
|
80
|
+
</Card>
|
|
81
|
+
<Card title="TUI components" href="/tui">
|
|
82
|
+
Build custom terminal UI components for extensions and embedded hosts.
|
|
83
|
+
</Card>
|
|
84
|
+
<Card title="Standalone libraries" href="/libraries">
|
|
85
|
+
Use Atomic's six core packages (`ai`, `tui`, `agent-core`, `codemode`, `schema`, `telemetry`) and the optional PostgreSQL storage adapter (`@bastani/atomic-storage-postgres`) directly.
|
|
86
|
+
</Card>
|
|
87
|
+
</Columns>
|
package/docs/changelog.mdx
CHANGED
|
@@ -10,7 +10,7 @@ description: "What's new in Atomic"
|
|
|
10
10
|
After each release, the publish-release skill regenerates this page in its own docs PR.
|
|
11
11
|
*/}
|
|
12
12
|
|
|
13
|
-
<Update label="November 27, 2026" description="0.10.14
|
|
13
|
+
<Update label="November 27, 2026" description="0.10.14">
|
|
14
14
|
|
|
15
15
|
This patch accepts `null` optional arguments across waitable tools and fixes PostgreSQL background snapshot collection.
|
|
16
16
|
|
package/docs/codemode.md
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Codemode
|
|
2
|
+
title: "Codemode"
|
|
3
3
|
sidebarTitle: "Codemode"
|
|
4
4
|
description: "Write JavaScript scripts inside Atomic's sandbox to compose tool calls, persist state across turns, and call classifier or image models."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
`codemode` lets the model run a
|
|
7
|
+
`codemode` lets the model run JavaScript inside a sandboxed worker to call permitted Atomic tools, chain or parallelize steps, call classifier and image models, and return only the filtered result. It is enabled by default.
|
|
8
|
+
|
|
9
|
+
<Columns cols={2}>
|
|
10
|
+
<Card title="Enable or disable codemode" href="/tools#codemode">
|
|
11
|
+
Toggle `codemode` via CLI flags, `settings.json`, or SDK options.
|
|
12
|
+
</Card>
|
|
13
|
+
<Card title="Orchestrate with codemode" href="/orchestration">
|
|
14
|
+
Coordinate parallel subagents, save handoff state, and recover after interruptions.
|
|
15
|
+
</Card>
|
|
16
|
+
<Card title="MCP servers" href="/mcp-servers">
|
|
17
|
+
Discover and call `codemode` and `deferred` MCP tools from scripts.
|
|
18
|
+
</Card>
|
|
19
|
+
<Card title="Embed @bastani/atomic-codemode" href="/libraries/codemode">
|
|
20
|
+
Embed the standalone codemode sandbox in your own Node.js or Cloudflare Workers app.
|
|
21
|
+
</Card>
|
|
22
|
+
</Columns>
|
|
8
23
|
|
|
9
24
|
## Scripts
|
|
10
25
|
|
|
11
|
-
Pass raw JavaScript source with no JSON wrapper or markdown code fences. Code runs as an async function body inside a sandboxed
|
|
26
|
+
Pass raw JavaScript source with no JSON wrapper or markdown code fences. Code runs as an async function body inside a sandboxed QuickJS runtime, so top-level `await` and `return` work.
|
|
12
27
|
|
|
13
28
|
```javascript
|
|
14
29
|
const [readme, pkg] = await Promise.all([
|
|
@@ -18,16 +33,19 @@ const [readme, pkg] = await Promise.all([
|
|
|
18
33
|
return { name: JSON.parse(pkg).name, excerpt: readme.slice(0, 400) };
|
|
19
34
|
```
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
- **Available built-ins.** Standard ECMAScript built-ins plus `atob`, `btoa`, `DOMException`, `eval`, and `Function` work inside the sandbox. `TextEncoder`, `TextDecoder`, `URL`, `fetch`, `crypto`, `setTimeout`, and all Node or Bun filesystem, network, and process APIs are unavailable—every external interaction goes through `tools` and `models`.
|
|
37
|
+
- **Per-script options directive.** An optional first-line comment sets the output budget and timeout. It must appear on **line 1** followed by JavaScript code; placing `// @options:` on any later line, using unknown keys, or sending an empty script fails before execution starts:
|
|
22
38
|
|
|
23
39
|
```javascript
|
|
24
40
|
// @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
|
|
25
41
|
```
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
| Option | Default | Behavior |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `max_output_tokens` | `10000` | Non-negative safe integer (`0` is accepted; character budget is `max_output_tokens * 4`). Text overflow keeps the start and end and writes full text to a temp file named in the result. Emitted images survive text truncation and keep their `[Image saved to ...]` paths intact. |
|
|
46
|
+
| `timeout_ms` | Unset | Hard deadline in milliseconds for the whole script, including waiting for a worker slot. Must be a positive integer up to `2147483647` (about 24.8 days); `0`, negative numbers, decimals, or larger values fail before running. Avoid short deadlines when generating images, which can take minutes. |
|
|
29
47
|
|
|
30
|
-
**Result format.**
|
|
48
|
+
**Result format.** Every run starts with `Script completed` or `Script failed` plus wall time, followed by text and image items in order. Multiple text items (from `text()` or `return`) are separated by `==> text N/M <==`, and `console.*` output follows in one `<console_output>` block. On failure, partial output is kept before `Script error:`. Side effects from completed tool calls are **not** rolled back; still-running tool calls are cancelled and unawaited promises are dropped when the script exits.
|
|
31
49
|
|
|
32
50
|
## Globals
|
|
33
51
|
|
|
@@ -36,40 +54,57 @@ Use `await` with every async global (`tools.*`, `searchTools()`, `describeTool()
|
|
|
36
54
|
| Global | Sync / Async | Purpose |
|
|
37
55
|
| --- | --- | --- |
|
|
38
56
|
| `tools.<name>(args)` | Async (`await`) | Call a permitted tool. See [Call tools](#call-tools). |
|
|
39
|
-
| `text(value)` | Sync | Emit a text item (
|
|
40
|
-
| `image(value)` | Sync | Emit an image from a base64 `data:` URL, `{ image_url }`, or `{ type: "image", data, mimeType }` (PNG, JPEG except JPEG-LS, GIF, or WebP; no remote URLs or SVG
|
|
57
|
+
| `text(value)` | Sync | Emit a text item (primitives as `String(value)`, objects as JSON). |
|
|
58
|
+
| `image(value)` | Sync | Emit an image from a base64 `data:` URL, `{ image_url }`, or `{ type: "image", data, mimeType }` (PNG, JPEG except JPEG-LS, GIF, or WebP; no remote URLs or SVG). Validates base64 magic bytes instead of trusting the declared MIME type, strips whitespace/newlines, throws `TypeError` on invalid or mismatched data, saves a temp file, and prints its path. |
|
|
41
59
|
| `console.log(...)` | Sync | Append a space-joined line to `<console_output>` (`info`, `warn`, `error`, and `debug` behave identically). |
|
|
42
|
-
| `return value` | Sync |
|
|
60
|
+
| `return value` | Sync | Emit the script's final value across the sandbox bridge via `JSON.stringify` (strings emit verbatim). Unlike `text()`, `return undefined` emits nothing, `return NaN` and `return Infinity` serialize to `"null"`, and non-JSON-serializable values (`BigInt`, circular objects) fail. |
|
|
43
61
|
| `exit()` | Sync | End the script immediately with success. Persists prior `store()` writes, takes no argument (call `text()` first to emit output), and ignores further `text()` or `image()` calls inside `finally` blocks. |
|
|
44
|
-
| `store(key, value)` / `load(key)` | Sync | Persist small JSON values across `codemode` calls on
|
|
62
|
+
| `store(key, value)` / `load(key)` | Sync | Persist small JSON values across `codemode` calls on the current branch. See [Store values](#store-values). |
|
|
45
63
|
| `ALL_TOOLS` | Value | Array of `{ name, description }` for every script-callable tool (excludes [model-only tools](#model-only-tools)). |
|
|
46
|
-
| `searchTools(query, { limit?, namespace? })` | Async (`await`) |
|
|
47
|
-
| `describeTool(name)` | Async (`await`) | Returns a script-callable tool's description and TypeScript declaration, a direct-call hint for an active model-only tool, or `undefined`. Accepts exact names, JS identifiers, `mcp.<server>.<tool>`, `mcp__<raw-server>__<tool>`, `<server>__<tool>`, or `<tool>` suffixes
|
|
64
|
+
| `searchTools(query, { limit?, namespace? })` | Async (`await`) | Ranked keyword search over script-callable tools (`limit` must be a positive integer, default `8`). Exact tool names or suffixes after `__` (such as `thread_read` for `mcp__app__thread_read`) rank first. Querying an exact active model-only tool name returns a hint to call it directly unless `namespace` is passed. |
|
|
65
|
+
| `describeTool(name)` | Async (`await`) | Returns a script-callable tool's description and TypeScript declaration, a direct-call hint for an active model-only tool, or `undefined`. Accepts exact names, JS identifiers, `mcp.<server>.<tool>`, `mcp__<raw-server>__<tool>`, `<server>__<tool>`, or `<tool>` suffixes; throws on ambiguous shorthand. |
|
|
48
66
|
| `describeNamespace(name)` | Async (`await`) | Returns `{ name, description?, instructions?, tools }` for a namespace (such as an MCP server), or `undefined`. |
|
|
49
|
-
| `models` | Async methods (`await`) | Inspect and invoke classifier and image models. See [Models](#models).
|
|
67
|
+
| `models` | Async methods (`await`) | Inspect and invoke classifier and image models. See [Models](#models). |
|
|
50
68
|
|
|
51
69
|
## Call tools
|
|
52
70
|
|
|
53
71
|
Every script-callable tool is exposed on `tools` under both its normalized JavaScript identifier (non-identifier characters replaced with `_`, such as `tools.mcp__dev_docs__search`) and its raw tool name (`tools["mcp__dev-docs__search"]`). If two tool names normalize to the same identifier, the first registered tool keeps the normalized key. Each method accepts one argument object.
|
|
54
72
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
### Return values by tool
|
|
74
|
+
|
|
75
|
+
| Tool | Resolves to | Notes and failure behavior |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `bash`, `powershell` (foreground finish) | `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }` | Resolves with this object even for nonzero `exit_code`. `output` keeps up to 1 MiB (first and last 512 KiB around an omission marker if truncated, with full output at `full_output_path`). Rejects if the command times out or is aborted. |
|
|
78
|
+
| `bash`, `powershell` (background yield or `action: "wait"`) | Plain `string` | When a command yields to the background (via `wait: { kind: "background" }` or after the default 10-second wait) or is observed with `{ action: "wait", id }`, the call returns a plain string rather than a structured object. Rejects if a waited command was stopped by its execution timeout or aborted. |
|
|
79
|
+
| `read` (text / URLs) | Plain `string` | Plain LF text with `[Lines S-E of N]` headers on partial reads (`:raw` returns exact bytes). Unselected HTTP(S) URL reads include `URL:`, `Content-Type:`, `Method:` (and optional `Notes:`) followed by `---`; only line-selected URL reads include `URL:`, `Status:`, and `Content-Type:`. |
|
|
80
|
+
| `read` (images) | `{ type: "image", data, mimeType, note }` | Pass directly to `image()` or `models.classify()`. |
|
|
81
|
+
| MCP tools | `{ content, isError?, structuredContent? }` | Complete untruncated MCP result (`_meta` stripped). Does not throw on `isError: true`—check `res.isError`, then read `res.structuredContent` or text blocks in `res.content`. |
|
|
82
|
+
| `subagent`, `intercom`, other structured tools | Tool-specific structured object | Returns structured results (including structured error objects when the tool defines an output schema). |
|
|
83
|
+
| `edit`, `write`, `find`, `search`, `todo`, `kill`, other text tools | Plain `string` | Rejects with `Error` on failure. |
|
|
84
|
+
|
|
85
|
+
Reading an MCP tool result safely:
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
const res = await tools.mcp__docs__search({ query: "compaction" });
|
|
89
|
+
if (res.isError) throw new Error("Docs search failed");
|
|
90
|
+
const textOut = res.structuredContent ?? res.content.find((b) => b.type === "text")?.text;
|
|
91
|
+
return textOut;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Errors and tool discovery
|
|
60
95
|
|
|
61
|
-
**
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
- `codemode.mode` in [settings](/settings#tools) controls tool visibility: `"on"` (default) keeps direct tools declared alongside codemode; `"only"` hides ordinary direct tools so the model calls them through codemode while keeping active model-only tools (like `ask_user_question`) top-level. Declarations in `codemode`, `describeTool()`, and `ALL_TOOLS` carry each tool's prompt guidelines.
|
|
96
|
+
- **Forwarded error details.** Failed, blocked, or invalid calls reject with `Error` (except structured tools that return `exit_code` or `isError`). When a tool throws an `Error` with extra JSON-serializable own properties (such as `code`, `hint`, or `fields`), those properties are copied onto the `Error` caught in your script. Use `Promise.allSettled()` for independent parallel calls.
|
|
97
|
+
- **Checking tool availability.** Accessing an unknown property on `tools` throws with close-match suggestions (for example `tools.Bash` suggests `tools.bash`). Check availability with `"name" in tools`.
|
|
98
|
+
- **Inline catalog and schema limits.** Inline tool declarations share a `3000`-token budget (`codemode.inlineBudget` in [settings](/settings#tools)); deferred tools stay unlisted and are found via `await searchTools()`, `await describeTool()`, `await describeNamespace()`, or `ALL_TOOLS`. Declarations carry each tool's usage instructions. If a tool's input schema exceeds 16,000 characters, `describeTool()` and inline declarations drop constraint annotations first and collapse it to `unknown` if still oversized.
|
|
99
|
+
- **Visibility mode.** `codemode.mode` in [settings](/settings#tools) defaults to `"on"` (direct tools declared alongside codemode). Setting `"only"` hides ordinary direct tools so the model calls them through codemode while keeping active model-only tools (such as `ask_user_question`) top-level.
|
|
66
100
|
|
|
67
101
|
### Model-only tools
|
|
68
102
|
|
|
69
103
|
Tools without script access (such as `ask_user_question` and `tool_search`) are absent from `tools`, `ALL_TOOLS`, and `searchTools()` rankings. Call them as top-level tools instead. Querying their exact name with `await searchTools()` or `await describeTool()` returns a hint to call them directly without making them script-callable.
|
|
70
104
|
|
|
71
105
|
Two tools expose a script-safe subset:
|
|
72
|
-
|
|
106
|
+
|
|
107
|
+
- **`tools.subagent`.** Launches subagents (`{ agent, task }` or `{ tasks }`) and returns task IDs at admission; also supports `status`, bounded `wait`, `pause`, `quit`, `resume`, and agent/model inspection. A script timeout cancels `wait`, not the subagent; admitted subagents keep running after a script returns or throws. See [Subagents from codemode scripts](/subagents#from-codemode-scripts).
|
|
73
108
|
- **`tools.intercom`.** Supports `list`, `status`, `pending`, and `send` to an exact target (returning structured results). Other actions and glob or `subagents:` targets must be called directly. See [Intercom from codemode scripts](/intercom/reference#from-codemode-scripts).
|
|
74
109
|
|
|
75
110
|
## Store values
|
|
@@ -77,18 +112,22 @@ Two tools expose a script-safe subset:
|
|
|
77
112
|
`store(key, value)` synchronously saves a JSON value for subsequent `codemode` calls; `store(key, undefined)` deletes it; `load(key)` synchronously reads it back (or returns `undefined`).
|
|
78
113
|
|
|
79
114
|
- Writes become visible to `load()` immediately inside the same script. They persist to the session history only when the script succeeds (including via `exit()`), so values survive resume and stay isolated per session branch. Failed scripts discard uncommitted writes.
|
|
80
|
-
- Keys must be strings. Non-JSON-serializable values (functions, BigInt
|
|
81
|
-
- Size caps are 262,144 JSON characters per value (`json.length`) and 1,048,576 characters total across all stored entries (`key.length + json.length`). Do not store images; emit them with `image()`, which writes a temp file automatically.
|
|
115
|
+
- Keys must be strings. Non-JSON-serializable values (functions, `BigInt`, circular references) throw `TypeError`.
|
|
116
|
+
- Size caps are **262,144** JSON characters per value (`json.length`) and **1,048,576** characters total across all stored entries (`key.length + json.length`). Do not store images; emit them with `image()`, which writes a temp file automatically.
|
|
82
117
|
|
|
83
118
|
## Models
|
|
84
119
|
|
|
85
|
-
`models` accesses the model catalog and calls non-LLM models using the session's credentials.
|
|
120
|
+
`models` accesses the model catalog and calls non-LLM models using the session's credentials.
|
|
86
121
|
|
|
87
122
|
- **Classifiers.** Answer typed questions about JSON state (and images when supported). Examples: [TypeSafe Jev](/providers#typesafe-jev), [OpenAI GPT-6 Luna](/models#use-classifier-models), and [local llama.cpp models](/llama-cpp).
|
|
88
123
|
- **Image models.** Generate or edit images. Examples: OpenRouter (`provider: "openrouter"`, IDs such as `google/gemini-2.5-flash-image` and `black-forest-labs/flux.2-pro`, reusing your OpenRouter credential) and OpenAI (`provider: "openai-images"`, such as `gpt-image-2.6-flare`, reusing your [OpenAI API key](/providers#subscription-and-api-key-at-the-same-time)).
|
|
89
124
|
|
|
90
125
|
Chat models are listed in the catalog (with active service-tier pricing) but cannot be called from scripts. Neither classifiers nor image models appear in `/model`.
|
|
91
126
|
|
|
127
|
+
<Note>
|
|
128
|
+
When a forked subagent does not declare `codemode` in its own tool list, Atomic may still provide a routing-only `codemode` channel so the child can call its own tools without altering its parent's tool declarations. Those routing-only subagents do not expose `models`.
|
|
129
|
+
</Note>
|
|
130
|
+
|
|
92
131
|
```typescript
|
|
93
132
|
type ModelType = "chat" | "image" | "classifier";
|
|
94
133
|
|
|
@@ -117,7 +156,7 @@ declare const models: {
|
|
|
117
156
|
|
|
118
157
|
- Pass a `ModelInfo` or `{ provider, id }`; script-supplied `baseUrl` or headers are ignored so credentials cannot be redirected.
|
|
119
158
|
- Provider errors do not throw; check `stopReason`, `errorMessage`, and (for images) `error`. Malformed arguments or unknown models do throw and point to `models.getAvailableOfType(type)`.
|
|
120
|
-
- Up to 4 model calls run concurrently per script (extra calls queue, so `Promise.all()` is safe). Token usage and cost count toward the session total.
|
|
159
|
+
- Up to **4** model calls run concurrently per script (extra calls queue, so `Promise.all()` is safe). Token usage and cost count toward the session total.
|
|
121
160
|
|
|
122
161
|
### Classify
|
|
123
162
|
|
|
@@ -237,12 +276,39 @@ type TextBlock = { type: "text"; text: string };
|
|
|
237
276
|
type ImageBlock = { type: "image"; data: string; mimeType: string; role?: "markup" | "mask" };
|
|
238
277
|
```
|
|
239
278
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
279
|
+
#### OpenAI image options and constraints
|
|
280
|
+
|
|
281
|
+
`ImagesOptions` targets OpenAI's `openai-images` models (OpenRouter models ignore them). For image editing, the first untagged image in `input` is the base image and additional untagged images are references; `role: "markup"` (a same-size transparent PNG overlay) and `role: "mask"` (an alpha mask) are mutually exclusive and require an untagged base image earlier in `input`.
|
|
282
|
+
|
|
283
|
+
| Option | Constraints |
|
|
284
|
+
| --- | --- |
|
|
285
|
+
| `outputCompression` | Integer `0`–`100`; valid only with `outputFormat: "jpeg"` or `"webp"`. |
|
|
286
|
+
| `background: "transparent"` | Valid only with `outputFormat: "png"`, `"webp"`, or omitted. |
|
|
287
|
+
| `safetyIdentifier` | Maximum 128 characters. |
|
|
288
|
+
| `complexity` | `"low"`, `"medium"`, or `"high"` (API default `"high"`); GPT Image 2.6 only. |
|
|
289
|
+
| `outputFormat: "gif"` | Requires GPT Image 2.6 and text-only input. `frameCount` (`2`–`16`, API default `9`) and `frameDurationMs` (`20`–`2000`, API default `200`, rounded to 10 ms) are valid only with `"gif"`. |
|
|
290
|
+
| `outputFormat: "svg"` | Requires GPT Image 2.6 and text-only input; `n` must be `1` or omitted; `svg` is valid only with `"svg"`. Allow at least `timeout_ms: 180000` (Atomic's own request timeout is at least 10 minutes). |
|
|
291
|
+
|
|
292
|
+
**SVG authoring model fallback.** `{ outputFormat: "svg" }` works without extra options. If an account requires `svg.model` and you omitted `svg`, Atomic retries once with `gpt-6.1-sol` (reported in `result.svgModel`), and retries once without `svg` if rejected as unsupported. An explicit `svg: { model, reasoning }` is sent verbatim without automatic fallback.
|
|
293
|
+
|
|
294
|
+
#### Structured errors
|
|
295
|
+
|
|
296
|
+
Branch on `result.error.code` and `result.error.retryable` rather than message text (see [Image generation](/libraries/ai#image-generation)):
|
|
297
|
+
|
|
298
|
+
| `error.code` | Meaning |
|
|
299
|
+
| --- | --- |
|
|
300
|
+
| `invalid-option` | Local or API option validation failure. `error.fields.field` names the field; SVG errors also set `error.fields.reason` (`required-by-api`, `rejected-by-api`, or `unsupported-by-api`). |
|
|
301
|
+
| `moderation-blocked` | Prompt or output blocked by provider safety filters. |
|
|
302
|
+
| `user-error` | Non-retryable client request error. |
|
|
303
|
+
| `quota-exceeded` | Account quota or billing limit reached. |
|
|
304
|
+
| `rate-limited` | Provider rate limit hit (`retryable: true`). |
|
|
305
|
+
| `server-error` | Provider 5xx failure (`retryable: true`). |
|
|
306
|
+
| `timeout` | Request exceeded its deadline. |
|
|
307
|
+
| `api-error` | Other provider API error. |
|
|
308
|
+
|
|
309
|
+
#### Displaying and saving generated images
|
|
310
|
+
|
|
311
|
+
Call `image(block)` for PNG, JPEG, GIF, and WebP—never print base64 `data` via `text()` or `return` (scripts that generate images without showing any receive a reminder note). `image()` automatically saves a private temp file and prints its path. For SVG (`image/svg+xml`), Atomic automatically saves a private temp `.svg` file (`[SVG saved to <path> (image/svg+xml, <size>)]`), and scripts can inspect the XML via `atob(block.data)`.
|
|
246
312
|
|
|
247
313
|
```javascript
|
|
248
314
|
// @options: {"timeout_ms": 300000}
|
|
@@ -279,9 +345,12 @@ Extensions can call `ctx.modelRegistry.classify()` and `ctx.modelRegistry.genera
|
|
|
279
345
|
|
|
280
346
|
## Limits
|
|
281
347
|
|
|
282
|
-
- **Memory.** 256 MiB per script sandbox (`InternalError: out of memory`)
|
|
283
|
-
- **Hard output caps.** Across `text()`, `image()`, and `console.*`, a script can emit at most 16 MiB (`16,777,216` characters) total and
|
|
348
|
+
- **Memory and stack.** **256 MiB** heap per script sandbox (`InternalError: out of memory`) and a **512 KiB** QuickJS recursion stack guard (deep recursion throws a catchable `RangeError` rather than crashing the worker). Filter or aggregate data instead of buffering everything in memory.
|
|
349
|
+
- **Hard output caps.** Across `text()`, `image()`, and `console.*`, a script can emit at most **16 MiB** (`16,777,216` characters) total and **100,000** items. Exceeding either cap stops the script immediately with an uncatchable `RangeError`.
|
|
284
350
|
- **Frozen built-in prototypes.** Standard JavaScript globals and built-in prototypes are frozen before your script starts. Monkey-patching built-in prototypes throws `TypeError`; normal own properties on your own objects (`name`, `message`, `toString`, `toJSON`, and custom keys) work normally.
|
|
285
|
-
- **
|
|
286
|
-
- **Worker concurrency.** Default limit is `2` concurrent script workers per Atomic process (override with `ATOMIC_CODEMODE_MAX_WORKERS` or legacy `PI_CODEMODE_MAX_WORKERS`). Cancelled workers occupy a slot until they exit. Additional scripts queue in FIFO order and fail if no slot opens within 60 seconds (or `timeout_ms`).
|
|
351
|
+
- **Worker concurrency.** Default limit is **2** concurrent script workers per Atomic process (override with `ATOMIC_CODEMODE_MAX_WORKERS`). Cancelled workers occupy a slot until they exit. Additional scripts queue in FIFO order and fail if no slot opens within 60 seconds (or `timeout_ms`).
|
|
287
352
|
- **Deadlocks and nesting.** Waiting on a promise with no pending tool call fails immediately because there are no timers. Scripts cannot invoke `codemode` recursively.
|
|
353
|
+
|
|
354
|
+
<Note>
|
|
355
|
+
**Cancellation in standalone binaries.** Stopping a script or hitting `timeout_ms` cancels execution promptly. In the standalone binary release, a single long-running native built-in operation (such as a catastrophic regular expression) finishes before the worker exits.
|
|
356
|
+
</Note>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Summarize branches"
|
|
3
|
+
sidebarTitle: "Branch summaries"
|
|
4
|
+
description: "Optionally summarize an abandoned conversation branch when switching paths with /tree."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
When [`/tree`](/sessions#branching-with-tree) switches away from a branch, Atomic can optionally summarize the abandoned branch and attach that summary at the new position. This preserves context from the path you left without replaying the entire branch.
|
|
8
|
+
|
|
9
|
+
<Note>
|
|
10
|
+
Branch summaries are separate from `/compact` and unaffected by `compactionModel`. Branch navigation generates a lossy prose summary of an abandoned path, whereas compaction uses [memory compaction](/compaction/memory-compaction) or a [custom compaction model](/compaction/custom-compactors) on your active context.
|
|
11
|
+
</Note>
|
|
12
|
+
|
|
13
|
+
## Choose whether to summarize
|
|
14
|
+
|
|
15
|
+
When leaving a branch in `/tree`, choose one of three options:
|
|
16
|
+
|
|
17
|
+
1. No summary
|
|
18
|
+
2. Summarize with the default prompt
|
|
19
|
+
3. Summarize with custom focus instructions
|
|
20
|
+
|
|
21
|
+
Set `"branchSummary": { "skipPrompt": true }` in `settings.json` to skip the prompt and default to no summary.
|
|
22
|
+
|
|
23
|
+
## How branch summarization works
|
|
24
|
+
|
|
25
|
+
Atomic collects as many recent messages from the abandoned branch (up to the common ancestor) as fit while leaving room for the summary prompt and reply. That history budget is `contextWindow - branchSummary.reserveTokens` (defaulting `contextWindow` to `128000` when unknown, and `reserveTokens` to `16384`). `branchSummary.reserveTokens` reserves headroom for the summary call rather than capping the history budget itself.
|
|
26
|
+
|
|
27
|
+
If the abandoned branch contains no summarizable messages, Atomic records `"No content to summarize"` without sending a model request.
|
|
28
|
+
|
|
29
|
+
Otherwise, the provider sizes summary output from the model's output limit and available context, inheriting the session's `thinkingLevel` unless it is `"off"`. Atomic rejects incomplete summaries rather than saving partial prose.
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
Tree before navigation:
|
|
33
|
+
|
|
34
|
+
┌─ B ─ C ─ D (old leaf, being abandoned)
|
|
35
|
+
A ───┤
|
|
36
|
+
└─ E ─ F (target)
|
|
37
|
+
|
|
38
|
+
Common ancestor: A
|
|
39
|
+
Entries to summarize: B, C, D
|
|
40
|
+
|
|
41
|
+
After navigation with summary:
|
|
42
|
+
|
|
43
|
+
┌─ B ─ C ─ D ─ [summary of B,C,D]
|
|
44
|
+
A ───┤
|
|
45
|
+
└─ E ─ F (new leaf)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Built-in branch summaries keep a cumulative list of read and modified files, carrying forward file lists from earlier built-in branch summaries (extension-supplied summaries are not parsed for file lists).
|
|
49
|
+
|
|
50
|
+
## How summary requests run
|
|
51
|
+
|
|
52
|
+
Branch summary requests run no tools and bypass prompt cache writes so summarizing an abandoned branch does not disturb prompt caching on your main branch. They use normal authentication, cancellation, and retry behavior.
|
|
53
|
+
|
|
54
|
+
For the exact prompt template, `BranchSummaryEntry` structure, message serialization, edge cases, and the `session_before_tree` extension hook, see [Branch summary format](/compaction/reference#branch-summary-format) and [Extension hooks for branch summarization](/compaction/reference#extension-hooks-for-branch-summarization).
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Use custom compaction models"
|
|
3
|
+
sidebarTitle: "Custom compaction models"
|
|
4
|
+
description: "Use built-in Morph or configure your own remote HTTP compactor model with custom parameters and automatic fallback to memory compaction."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Custom compaction models** are Atomic's second form of compaction. Instead of clearing the context window outright, Atomic sends the active context once to a dedicated remote compactor endpoint—either built-in `morph/morph-compactor` or a custom compactor you define in `models.json` or an extension—and places its response inside a `<compacted-context>` block.
|
|
8
|
+
|
|
9
|
+
Your full conversation still stays verbatim in session history, and the boundary includes the same history recovery instructions as [memory compaction](/compaction/memory-compaction) so the agent can pull back anything the compactor omitted.
|
|
10
|
+
|
|
11
|
+
<Warning>
|
|
12
|
+
A remote compactor receives your in-context conversation and uses its own provider credentials. Enable a remote compactor only if your policy permits sending session content to that provider.
|
|
13
|
+
</Warning>
|
|
14
|
+
|
|
15
|
+
## Quick start: use built-in Morph
|
|
16
|
+
|
|
17
|
+
<Steps>
|
|
18
|
+
<Step title="Authenticate Morph">
|
|
19
|
+
Run `/login morph` inside Atomic, or export `MORPH_API_KEY` in your shell.
|
|
20
|
+
</Step>
|
|
21
|
+
<Step title="Select the compaction model">
|
|
22
|
+
Open `/settings`, select **Compaction model**, and pick `morph/morph-compactor`. The change applies immediately with no `/reload` or restart.
|
|
23
|
+
</Step>
|
|
24
|
+
</Steps>
|
|
25
|
+
|
|
26
|
+
## How custom compactors work
|
|
27
|
+
|
|
28
|
+
When `compactionModel` names a registered compactor model, Atomic frames the current context window (previous compacted text first, followed by role-labelled user messages, assistant text, tool calls with arguments, tool results, shell commands with exit codes, and extension messages) and sends one HTTP `POST` request to that model's endpoint:
|
|
29
|
+
|
|
30
|
+
- **No forced request defaults.** Atomic sends `{ messages, query, model }` plus any optional keys you put in `compactionParams`. When `compactionParams` is omitted, Atomic adds no provider-specific fields so the remote API applies its own defaults.
|
|
31
|
+
- **No built-in output size limit.** Whatever the endpoint returns is kept as-is, however long it is. To ask the endpoint for shorter output, set its own parameter in `compactionParams` (for Morph, `compression_ratio`). To reject long output locally, set `maxTokens` on the compactor model: output exceeding that token estimate falls back to memory compaction. `maxTokens` has no default.
|
|
32
|
+
- **Oversized output does not loop.** If a compactor returns output that remains above the automatic threshold, nothing is rejected and Atomic does not re-compact before every tool call of the same turn. The next user turn compacts again before its first request. If the provider reports a context overflow, Atomic compacts and retries once; if the retry still overflows, the provider's error is shown.
|
|
33
|
+
- **Content filtering and redaction.** Images become omission markers, thinking blocks are omitted, role headers are wrapped in `<keepContext>` tags, and messages excluded from model context (such as `!!` shell commands and display-only extension messages) are not sent. If an endpoint echoes your API key or a sensitive auth header, Atomic replaces it with `[redacted]` before storing or displaying the output.
|
|
34
|
+
|
|
35
|
+
## Select a compaction model {#select-a-compaction-model}
|
|
36
|
+
|
|
37
|
+
Open `/settings` and choose **Compaction model** to switch between **Automatic** ([memory compaction](/compaction/memory-compaction)) and any registered compactor model immediately, without `/reload` or restarting.
|
|
38
|
+
|
|
39
|
+
Both built-in `morph/morph-compactor` and custom remote compactors defined in `~/.atomic/agent/models.json` or an extension appear in this searchable picker automatically (authenticated models first; unauthenticated ones show `requires /login <provider>`). The selector updates project settings when a project override already exists, and global settings otherwise.
|
|
40
|
+
|
|
41
|
+
You can also set `compactionModel` directly in `~/.atomic/agent/settings.json` or a trusted project's `.atomic/settings.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"compactionModel": "morph/morph-compactor"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- `"auto"` (lowercase) or `""` selects [memory compaction](/compaction/memory-compaction).
|
|
50
|
+
- A registered compactor ID must match `provider/model` **case-sensitively** (leading and trailing whitespace is trimmed).
|
|
51
|
+
- Compactor models never appear in `/model` and never run as chat models. Changing `compactionModel` does not affect [branch summaries](/compaction/branch-summaries).
|
|
52
|
+
|
|
53
|
+
Compaction never calls chat models or classifiers. On startup, once extensions finish loading, and when you trust a project, Atomic resets any saved chat or classifier `compactionModel` to `"auto"`. Compactor IDs and unknown IDs remain untouched; an unknown ID falls back to memory compaction with a notice.
|
|
54
|
+
|
|
55
|
+
For programmatic per-run overrides, live SDK/RPC switching, and registering compactors from extensions, see [Compaction reference](/compaction/reference), [Compaction and tree navigation](/sdk#compaction-and-tree-navigation), and [Custom providers](/custom-provider/api-reference).
|
|
56
|
+
|
|
57
|
+
## Configure Morph or add a custom compactor {#configure-morph-or-add-a-custom-compactor}
|
|
58
|
+
|
|
59
|
+
Keep `settings.json` free of endpoint knobs and configure API-specific parameters directly on the compactor model in `~/.atomic/agent/models.json` (see [Remote compaction models](/models#remote-compaction-models)).
|
|
60
|
+
|
|
61
|
+
### Override built-in Morph parameters
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"providers": {
|
|
66
|
+
"morph": {
|
|
67
|
+
"modelOverrides": {
|
|
68
|
+
"morph-compactor": {
|
|
69
|
+
"compactionParams": {
|
|
70
|
+
"compression_ratio": 0.35,
|
|
71
|
+
"preserve_recent": 2
|
|
72
|
+
},
|
|
73
|
+
"timeoutMs": 180000
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Add a custom remote compactor
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"providers": {
|
|
86
|
+
"my-compactor": {
|
|
87
|
+
"baseUrl": "https://compact.example.com/v1",
|
|
88
|
+
"apiKey": "$MY_COMPACTOR_API_KEY",
|
|
89
|
+
"headers": {
|
|
90
|
+
"X-Team": "platform"
|
|
91
|
+
},
|
|
92
|
+
"models": [
|
|
93
|
+
{
|
|
94
|
+
"id": "compact-v2",
|
|
95
|
+
"name": "Internal Compactor v2",
|
|
96
|
+
"type": "compactor",
|
|
97
|
+
"api": "custom-compact",
|
|
98
|
+
"endpointPath": "/compress",
|
|
99
|
+
"compactionParams": {
|
|
100
|
+
"target_ratio": 0.4,
|
|
101
|
+
"preserve_recent": 2
|
|
102
|
+
},
|
|
103
|
+
"timeoutMs": 180000
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Key configuration fields:
|
|
112
|
+
|
|
113
|
+
- **`type: "compactor"`** registers the model as a compactor so it appears in `/settings` under **Compaction model** instead of `/model`.
|
|
114
|
+
- **`api`** is required on the provider or model for custom compactors (built-in Morph defines `"api": "morph-compact"`). Overriding an existing compactor under `modelOverrides` inherits its provider's `api` and `baseUrl`.
|
|
115
|
+
- **`compactionParams`** merges arbitrary API-specific keys into the JSON request body alongside `{ messages, query, model }`. Omit it to let the remote API apply its own server defaults.
|
|
116
|
+
- **`endpointPath`** appends to `baseUrl` and defaults to `"/compact"`. Set `"endpointPath": ""` to `POST` directly to `baseUrl`.
|
|
117
|
+
- **`timeoutMs`** overrides the default 120-second request timeout.
|
|
118
|
+
- **`maxTokens`** sets an optional estimated-token cap on the compactor's response (no default; longer output falls back to memory compaction).
|
|
119
|
+
- **`headers`** supports `$ENV`, `${ENV}`, and `!command` for custom auth headers (such as `"X-API-Key": "$MY_KEY"`). Sensitive auth headers are redacted automatically from errors and compacted output.
|
|
120
|
+
|
|
121
|
+
For the exact HTTP payload, header, token estimator, and response contract, see [Compactor request contract](/compaction/reference#compactor-request-contract).
|
|
122
|
+
|
|
123
|
+
## Automatic fallback to memory compaction
|
|
124
|
+
|
|
125
|
+
Every compactor failure falls back automatically to **Automatic** ([memory compaction](/compaction/memory-compaction)) so a broken, unauthenticated, or slow remote endpoint never blocks a session:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
Compaction starts
|
|
129
|
+
├─ Cancelled by user or extension -> Cancelled (context unchanged)
|
|
130
|
+
├─ Extension supplies replacement text -> Context compacted (extension)
|
|
131
|
+
├─ Compaction model is "" / "auto" -> Memory compaction (Context cleared)
|
|
132
|
+
├─ Compaction model is unknown / chat / classifier -> Automatic fallback (Context cleared)
|
|
133
|
+
└─ Compaction model is a registered compactor
|
|
134
|
+
├─ success (within maxTokens, if you set one) -> Context compacted (compactor)
|
|
135
|
+
└─ missing auth / HTTP or network error / timeout / Esc /
|
|
136
|
+
malformed or empty output / longer than a maxTokens you set -> Automatic fallback (Context cleared)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Atomic prints a one-line notice (`Compaction model not used (<reason>); context cleared instead`) without exposing your API key or sensitive headers. Pressing `Escape` while a compactor request is in flight also falls back to memory compaction with reason `request aborted`. Taking over with `/compact`, closing the session, or an extension cancelling compaction stops compaction completely.
|
|
140
|
+
|
|
141
|
+
### Troubleshooting network and DNS errors
|
|
142
|
+
|
|
143
|
+
If Atomic cannot reach the compactor's server, the fallback notice names the underlying connection failure while falling back to memory compaction so your session keeps moving.
|
|
144
|
+
|
|
145
|
+
<Accordion title="Host name cannot be resolved (ENOTFOUND)">
|
|
146
|
+
```text
|
|
147
|
+
Compaction model not used (morph/morph-compactor failed: fetch failed: getaddrinfo ENOTFOUND api.morphllm.com); context cleared instead
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Check your network connection, proxy or VPN settings, and the compactor's `baseUrl`.
|
|
151
|
+
</Accordion>
|
|
152
|
+
|
|
153
|
+
<Accordion title="Blocked by a DNS filter (0.0.0.0 or ::)">
|
|
154
|
+
A DNS filter such as NextDNS, Pi-hole, or AdGuard can block the compactor by resolving its domain to `0.0.0.0` or `::`. When the host resolves only to those addresses, Atomic names the domain to allow:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
Compaction model not used (morph/morph-compactor failed: fetch failed: ERR_SSL_TLSV1_ALERT_INTERNAL_ERROR: tlsv1 alert internal error (api.morphllm.com resolves to 0.0.0.0, the address DNS filters such as NextDNS, Pi-hole or AdGuard return for blocked domains; allow api.morphllm.com in the resolver)); context cleared instead
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Add that domain to your DNS filter's allowlist. Until then, compaction continues working through memory compaction.
|
|
161
|
+
</Accordion>
|