@bastani/atomic 0.10.9 → 0.10.10-alpha.2
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 +83 -0
- package/README.md +226 -163
- 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 +27 -12
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
- package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
- package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
- package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
- package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
- package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
- package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
- package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
- package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
- package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
- package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
- package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
- package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
- package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
- package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
- package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
- package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
- package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
- package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +87 -116
- package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
- package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
- package/dist/builtin/intercom/group.ts +7 -3
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/README.md +61 -27
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -0
- package/dist/builtin/subagents/README.md +74 -141
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/README.md +61 -88
- package/dist/builtin/web-access/index.bundle.mjs +387 -351
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +2 -2
- 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.code.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 +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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/agent-session-methods.d.ts +4 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/compaction/compactor.d.ts +20 -14
- package/dist/core/compaction/errors.d.ts +120 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/model-resolver.d.ts +2 -2
- 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.code.js +1 -1
- 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/api-types.d.ts +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- 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.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/provider-types.d.ts +18 -6
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-context.js +1 -1
- 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 +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/model-config.d.ts +40 -0
- package/dist/core/model-registry.js +1 -1
- package/dist/core/model-resolver-scope.d.ts +4 -4
- package/dist/core/model-runtime.d.ts +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/provider-composer-internal.d.ts +11 -2
- package/dist/core/sdk.code.js +3 -3
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +5 -5
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- 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/settings-manager-basic-accessors.d.ts +6 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.code.js +1 -1
- 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.code.js +2 -2
- 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 +3 -3
- 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.code.js +1 -1
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +2 -2
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +2 -2
- 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-extensions.d.ts +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -7
- package/dist/main-first-time-setup.code.js +2 -2
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- 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/interactive/theme/color-utils.d.ts +5 -5
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
- package/dist/modes/rpc/rpc-types.d.ts +29 -2
- package/dist/package-manager-cli.code.js +5 -5
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +1 -1
- package/dist/startup-stages/8.js +1 -2
- package/dist/startup-stages/9.js +2 -1
- package/dist/utils/native-module.d.ts +44 -0
- package/dist/utils/startup-database-spare.code.js +3 -3
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks.md +238 -243
- package/docs/build.md +21 -15
- package/docs/changelog.mdx +1 -1
- package/docs/codemode.md +68 -51
- package/docs/compaction/reference.md +65 -26
- package/docs/compaction.md +118 -66
- package/docs/computer-use.md +179 -146
- package/docs/containerization.md +87 -33
- package/docs/custom-provider/api-reference.md +152 -13
- package/docs/custom-provider/oauth.md +45 -28
- package/docs/custom-provider/override.md +14 -7
- package/docs/custom-provider/registration.md +77 -67
- package/docs/custom-provider/streaming.md +42 -19
- package/docs/custom-provider.md +26 -62
- package/docs/development.md +81 -42
- package/docs/docs.json +54 -38
- package/docs/environment-variables.md +92 -64
- package/docs/extensions/api-reference.md +326 -735
- package/docs/extensions/authoring.md +186 -269
- package/docs/extensions/events.md +308 -375
- package/docs/extensions/examples.md +122 -74
- package/docs/extensions/ui.md +217 -197
- package/docs/extensions.md +189 -259
- package/docs/getting-started/authentication.md +27 -14
- package/docs/getting-started/first-session.md +25 -26
- package/docs/getting-started/installation.md +62 -84
- package/docs/getting-started/project-instructions.md +39 -14
- package/docs/guides/configuration.md +62 -20
- package/docs/guides/intercom.md +20 -12
- package/docs/guides/non-interactive.md +31 -16
- package/docs/guides/orchestration.md +17 -9
- package/docs/guides/resume-on-any-machine.md +63 -52
- package/docs/guides/subagents.md +26 -14
- package/docs/guides/team-setup.md +49 -27
- package/docs/guides.md +30 -23
- package/docs/herdr.md +22 -17
- package/docs/index.md +24 -17
- package/docs/intercom/operations.md +90 -66
- package/docs/intercom/reference.md +219 -192
- package/docs/intercom.md +111 -92
- package/docs/json.md +73 -71
- package/docs/keybindings.md +74 -48
- package/docs/libraries/agent-core.md +52 -9
- package/docs/libraries/ai.md +90 -63
- package/docs/libraries/codemode.md +31 -8
- package/docs/libraries/schema.md +12 -9
- package/docs/libraries/storage-libsql.md +92 -0
- package/docs/libraries/storage-postgres.md +119 -0
- package/docs/libraries/telemetry.md +42 -9
- package/docs/libraries/tui.md +74 -94
- package/docs/libraries.md +25 -8
- package/docs/llama-cpp.md +38 -33
- package/docs/mcp-servers.md +140 -88
- package/docs/models/reference.md +53 -36
- package/docs/models-configuration.md +19 -13
- package/docs/models.md +102 -87
- package/docs/orchestration/migrating-workflows.md +22 -20
- package/docs/orchestration/patterns.md +36 -21
- package/docs/orchestration.md +24 -21
- package/docs/packages/authoring.md +29 -18
- package/docs/packages/reference.md +77 -16
- package/docs/packages.md +34 -34
- package/docs/programmatic.md +28 -21
- package/docs/prompt-templates.md +65 -41
- package/docs/providers/reference.md +36 -20
- package/docs/providers.md +78 -76
- package/docs/quickstart.md +42 -54
- package/docs/reference/cli.md +256 -254
- package/docs/reference.md +30 -23
- package/docs/rpc/examples.md +121 -17
- package/docs/rpc/extension-ui.md +86 -63
- package/docs/rpc/protocol.md +817 -358
- package/docs/rpc.md +78 -152
- package/docs/sdk/reference.md +309 -73
- package/docs/sdk/storage.md +614 -0
- package/docs/sdk/structured-decisions.md +168 -65
- package/docs/sdk/web-server.md +80 -46
- package/docs/sdk.md +168 -215
- package/docs/security.md +117 -44
- package/docs/session-format.md +127 -76
- package/docs/sessions.md +155 -113
- package/docs/settings.md +293 -205
- package/docs/shell-aliases.md +15 -6
- package/docs/skills/authoring.md +17 -9
- package/docs/skills/reference.md +23 -21
- package/docs/skills.md +148 -97
- package/docs/storage.md +172 -260
- package/docs/subagents/authoring.md +148 -15
- package/docs/subagents/reference.md +105 -29
- package/docs/subagents.md +247 -250
- package/docs/terminal-setup.md +97 -69
- package/docs/termux.md +51 -85
- package/docs/themes/reference.md +51 -37
- package/docs/themes.md +52 -55
- package/docs/tmux.md +38 -21
- package/docs/tools.md +209 -147
- package/docs/tui/reference.md +64 -32
- package/docs/tui.md +38 -66
- package/docs/usage.md +94 -86
- package/docs/verification.md +25 -25
- package/docs/web-access.md +106 -54
- package/docs/windows.md +55 -57
- package/docs/worktree-snapshots.md +82 -74
- package/examples/sdk/11-sessions.ts +4 -4
- package/package.json +8 -8
- package/schemas/models.schema.json +58 -7
- package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
- package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
- package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
- package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
- package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
package/docs/session-format.md
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Session format
|
|
3
|
-
|
|
2
|
+
title: "Session file format"
|
|
3
|
+
sidebarTitle: "Session format"
|
|
4
|
+
description: "Format-4 JSONL session schema, message and entry types, context rebuilding rules, and the SessionManager API."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
This page describes format-4 JSONL files used by explicit JSONL stores and session exports. Sessions default to SQLite; see [Session storage](/sessions#session-storage) to choose a store.
|
|
7
|
+
This reference describes format-4 JSONL files used by explicit JSONL stores and session exports. Sessions default to local SQLite; see [Session storage](/sessions#session-storage), [Storage backends](/storage), and [SDK session storage](/sdk/storage) to choose or open a store.
|
|
9
8
|
|
|
10
9
|
In JSONL, each line is a JSON object with a `type` field. Session entries form a tree through `id` and `parentId`.
|
|
11
10
|
|
|
12
11
|
## File location
|
|
13
12
|
|
|
13
|
+
JSONL stores use one of two directory layouts depending on `exactDirectory`:
|
|
14
|
+
|
|
14
15
|
```text
|
|
15
|
-
|
|
16
|
+
# Flat layout (exactDirectory: true)
|
|
17
|
+
<dir>/<timestamp>_<sha256-of-id>.jsonl
|
|
18
|
+
|
|
19
|
+
# Nested per-project layout (exactDirectory: false)
|
|
20
|
+
<dir>/--<encoded-cwd>--/<timestamp>_<sha256-of-id>.jsonl
|
|
16
21
|
```
|
|
17
22
|
|
|
18
|
-
`sessions.storage.dir
|
|
23
|
+
- **Flat layout (`exactDirectory: true`).** `sessions.storage.dir`, `--session-dir`, `ATOMIC_SESSIONS_STORAGE`, SDK `{ kind: "jsonl", dir }`, `SessionManager` string-directory overloads, and `JsonlSessionStore.open(dir, { exactDirectory: true })` write files directly inside `<dir>` and do not scan subdirectories.
|
|
24
|
+
- **Nested layout (`exactDirectory: false`).** Legacy `~/.atomic/agent/sessions` and direct `JsonlSessionStore.open(dir)` calls (where `exactDirectory` defaults to `false`) group files into a per-project subdirectory named `--<encoded-cwd>--`, falling back to `--<sha256-of-cwd>--` when the encoded directory name exceeds 180 UTF-8 bytes.
|
|
25
|
+
|
|
26
|
+
Do not mix both layouts on the same directory. Files stored under `--<encoded-cwd>--` are invisible to `exactDirectory: true` stores. In both layouts, each filename combines the session creation timestamp and the 64-character hex SHA-256 hash of the session ID.
|
|
27
|
+
|
|
28
|
+
Resume and fork selection match by session ID rather than file path. Local artifacts and tool-result files stay on the filesystem even when a session is stored in a database.
|
|
19
29
|
|
|
20
30
|
## Deleting sessions
|
|
21
31
|
|
|
@@ -23,8 +33,6 @@ In an explicit JSONL store, you can remove a session by deleting its `.jsonl` fi
|
|
|
23
33
|
|
|
24
34
|
To delete individual sessions from `/resume`, select a session, press `Ctrl+D`, and confirm. Database stores delete the session record, and JSONL stores use the `trash` CLI when available.
|
|
25
35
|
|
|
26
|
-
Entries in the active window keep their exact `id` and `parentId` strings. Very large IDs count toward that window's memory even when the message is short or referenced only by a compaction boundary. Atomic does not shorten IDs when copying or importing a session.
|
|
27
|
-
|
|
28
36
|
## Session version
|
|
29
37
|
|
|
30
38
|
`SessionManager` writes format-4 headers with `createdAt` and `parentSessionId`. Sessions in formats 1, 2, and 3, along with early format-4 files that use `timestamp` and `parentSession`, upgrade automatically when opened, resumed, imported, or forked.
|
|
@@ -37,13 +45,13 @@ Future versions, unrecognized version numbers, and structurally invalid entries
|
|
|
37
45
|
|
|
38
46
|
Inspect the exported TypeScript declarations in your installed packages:
|
|
39
47
|
|
|
40
|
-
- `@bastani/atomic`: `SessionManager`, `SessionHeader`, `SessionEntry`, `BashExecutionMessage`, `CustomMessage`, and `BranchSummaryMessage`.
|
|
48
|
+
- `@bastani/atomic`: `SessionManager`, `SessionHeader`, `SessionEntry`, `UsageEntry`, `BashExecutionMessage`, `CustomMessage`, and `BranchSummaryMessage`.
|
|
41
49
|
- `@bastani/atomic-ai`: `SystemMessage`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`, `Usage`, and `StopReason`.
|
|
42
50
|
- `@bastani/atomic-agent-core`: `AgentMessage`.
|
|
43
51
|
|
|
44
52
|
## Message types
|
|
45
53
|
|
|
46
|
-
Session entries store `AgentMessage` objects. Understanding these shapes helps when parsing exports or building extensions.
|
|
54
|
+
Session entries store `AgentMessage` objects (and `SystemMessage` checkpoints). Understanding these shapes helps when parsing exports or building extensions.
|
|
47
55
|
|
|
48
56
|
### Content blocks
|
|
49
57
|
|
|
@@ -192,6 +200,8 @@ type AgentMessage =
|
|
|
192
200
|
// compactionSummary appears only in older session files and is not part of the active union.
|
|
193
201
|
```
|
|
194
202
|
|
|
203
|
+
`SystemMessage` objects are saved inside `SessionMessageEntry` entries to track prompt and tool changes on each branch, but they are replayed into the session's system prompt and tool set separately rather than appearing in `AgentMessage`.
|
|
204
|
+
|
|
195
205
|
## Entry base
|
|
196
206
|
|
|
197
207
|
All entries except `SessionHeader` extend `SessionEntryBase`:
|
|
@@ -205,6 +215,8 @@ interface SessionEntryBase {
|
|
|
205
215
|
}
|
|
206
216
|
```
|
|
207
217
|
|
|
218
|
+
Entries loaded in the active context window keep their exact `id` and `parentId` strings. Very large IDs count toward memory even when the message is short or referenced only by a compaction boundary. Atomic does not shorten IDs when copying or importing a session.
|
|
219
|
+
|
|
208
220
|
## Entry types
|
|
209
221
|
|
|
210
222
|
### SessionHeader
|
|
@@ -221,6 +233,8 @@ Sessions created from another session through `/fork`, `/clone`, or `newSession(
|
|
|
221
233
|
{"type":"session","version":4,"id":"uuid","createdAt":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSessionId":"original-session-id"}
|
|
222
234
|
```
|
|
223
235
|
|
|
236
|
+
When a fork crosses into a different storage backend, Atomic also sets `parentInOtherStore: true` on the header and prints `Parent history is in its original store or is no longer available.` when the forked session reopens.
|
|
237
|
+
|
|
224
238
|
Any session with `internal: true` in its header is excluded from `/resume`, `atomic -r`, `-c`, and `history://sessions`, while remaining openable by exact ID. Fresh subagent sessions and `newSession({ internal: true })` set this flag:
|
|
225
239
|
|
|
226
240
|
```json
|
|
@@ -231,7 +245,7 @@ Older workflow-stage sessions also carried `workflow` metadata (`runId`, `stageI
|
|
|
231
245
|
|
|
232
246
|
### SessionMessageEntry
|
|
233
247
|
|
|
234
|
-
A conversation message whose `message` field holds an `AgentMessage
|
|
248
|
+
A conversation message whose `message` field holds an `AgentMessage` or `SystemMessage`. Queued messages also store an optional `queuedMessageId` receipt ID:
|
|
235
249
|
|
|
236
250
|
```json
|
|
237
251
|
{"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello"}}
|
|
@@ -262,6 +276,16 @@ Recorded when the thinking or reasoning level changes:
|
|
|
262
276
|
{"type":"thinking_level_change","id":"e5f6g7h8","parentId":"d4e5f6g7","timestamp":"2024-12-03T14:06:00.000Z","thinkingLevel":"high"}
|
|
263
277
|
```
|
|
264
278
|
|
|
279
|
+
### UsageEntry
|
|
280
|
+
|
|
281
|
+
Records auxiliary model usage (such as prompt cache warming with `kind: "cache_warm"`) toward session totals without adding anything to LLM context:
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{"type":"usage","id":"u1v2w3x4","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:06:10.000Z","kind":"cache_warm","provider":"anthropic","model":"claude-sonnet-4-5","usage":{"input":1200,"output":0,"cacheRead":0,"cacheWrite":1200,"totalTokens":1200,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0.0045,"total":0.0045}}}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Fields: `kind` (string category), `provider`, `model`, `usage` (`Usage`), and optional `note`.
|
|
288
|
+
|
|
265
289
|
### CompactionEntry
|
|
266
290
|
|
|
267
291
|
Created by `/compact`, RPC `compact`, and automatic compaction. The `summary` field holds the boundary message the model sees next, either a `Context cleared` message or a `Context compacted` message with compacted text, followed by recovery instructions. `firstKeptEntryId` is `null` because no earlier message stays in context.
|
|
@@ -274,6 +298,8 @@ An entry is active only when `details.strategy` is `"verbatim-lines"`:
|
|
|
274
298
|
|
|
275
299
|
Rebuilt context contains one visible `custom` message with `customType: "compaction"` holding `summary`. Messages appended after the boundary stay ordinary messages, and resuming requires no model request.
|
|
276
300
|
|
|
301
|
+
Optional top-level fields on `CompactionEntry` include `usage` (compactor usage), `fromHook` (`true` when an extension supplied compacted text), `systemMessage` (replayed system prompt and tool checkpoint), `coveredThroughEntryId` (legacy mid-tool-call boundaries), and `recallSessionId` (legacy fork history link source).
|
|
302
|
+
|
|
277
303
|
Key `details` fields include:
|
|
278
304
|
|
|
279
305
|
- `form`: `"cleared"` or `"compacted"`.
|
|
@@ -281,7 +307,7 @@ Key `details` fields include:
|
|
|
281
307
|
- `fallbackReason`: present when a configured compactor was not used and Atomic cleared context instead.
|
|
282
308
|
- `history`: locates the boundary in `history://sessions/<sessionId>` with `rangeUnit: "entries"`, `entriesBefore`, `boundaryEntry`, and `totalEntries`.
|
|
283
309
|
- `historyAccess`: `"read-search"` or `"session-history-tool"`.
|
|
284
|
-
- `backupPath`: optional pre-compaction backup path.
|
|
310
|
+
- `backupPath`: optional pre-compaction backup path (JSONL stores only).
|
|
285
311
|
|
|
286
312
|
See [Persistence and resume](/compaction/reference#persistence-and-resume) for every field.
|
|
287
313
|
|
|
@@ -331,9 +357,9 @@ Extension state persistence that does not enter LLM context:
|
|
|
331
357
|
{"type":"custom","id":"h8i9j0k1","parentId":"g7h8i9j0","timestamp":"2024-12-03T14:20:00.000Z","customType":"my-extension","data":{"count":42}}
|
|
332
358
|
```
|
|
333
359
|
|
|
334
|
-
Use `customType` to identify your extension's entries on reload. Atomic also writes
|
|
360
|
+
Use a unique `customType` to identify your extension's entries on reload. Atomic also writes built-in custom entry types for internal state, including:
|
|
335
361
|
|
|
336
|
-
- `atomic.tool-output`: written before a tool result
|
|
362
|
+
- `atomic.tool-output`: written before a tool result pointing to `tool-output://<sha256>` when oversized output from an unloaded subagent is stored with the session. `data` holds `{ toolCallId, hash, bytes }`. Exported JSONL files also include `base64` once per blob; import and fork verify each blob against `hash`, store it, and drop `base64`.
|
|
337
363
|
|
|
338
364
|
```json
|
|
339
365
|
{"type":"custom","id":"i9j0k1l2","parentId":"h8i9j0k1","timestamp":"2024-12-03T14:21:00.000Z","customType":"atomic.tool-output","data":{"toolCallId":"call_1","hash":"9c56...","bytes":1048576}}
|
|
@@ -351,6 +377,8 @@ Use `customType` to identify your extension's entries on reload. Atomic also wri
|
|
|
351
377
|
{"type":"custom","id":"k1l2m3n4","parentId":"j0k1l2m3","timestamp":"2024-12-03T14:23:00.000Z","customType":"resume_timings","data":{"version":1,"startedAt":"2024-12-03T14:22:00.000Z","restores":[{"root":"/home/me/project","mode":"fresh","fetch":"full","ms":18520,"phases":{"fetch":9900,"materialize":1400,"verify":210,"publish":12}}],"blueprint":[{"section":"maintenance","name":"npm install","ms":8600,"exit":"ok"}],"firstPromptReadyMs":28400,"blueprintReadyMs":28300}}
|
|
352
378
|
```
|
|
353
379
|
|
|
380
|
+
- `workspace_binding`: records a session's bound worktree path (`{ kind: "bound-workspace", worktree }`) when opened against a specific workspace binding. Atomic also uses additional reserved `customType` keys for Intercom memberships, tool deactivation, web search results, and task completion tracking.
|
|
381
|
+
|
|
354
382
|
### CustomMessageEntry
|
|
355
383
|
|
|
356
384
|
Extension messages that enter LLM context unless `excludeFromContext` is `true`:
|
|
@@ -364,14 +392,6 @@ Extension messages that enter LLM context unless `excludeFromContext` is `true`:
|
|
|
364
392
|
- `details`: optional extension metadata, never sent to the LLM.
|
|
365
393
|
- `excludeFromContext`: `true` marks a display-only message excluded from model requests.
|
|
366
394
|
|
|
367
|
-
### Reader-only chat records
|
|
368
|
-
|
|
369
|
-
Built-in stores save turn-ending diagnostic lines, such as cancelled retry errors, separately from session entries so reopening a session can display them in place. Each saved line is capped at 4,096 UTF-8 bytes and ends with `... [diagnostic truncated]` if trimmed, while the live terminal error stays intact.
|
|
370
|
-
|
|
371
|
-
These records are not session entries. `/tree`, model requests, compaction, token totals, conversation exports, and continuation logic ignore them. Copying a JSONL file or importing a session does not transfer them, and local libSQL `file:` databases do not store them.
|
|
372
|
-
|
|
373
|
-
Cache-miss and dropped-thinking notices are derived from saved assistant replies. When a compacted session opens on its active window, Atomic does not reload discarded history to reconstruct earlier notice counts.
|
|
374
|
-
|
|
375
395
|
### LabelEntry
|
|
376
396
|
|
|
377
397
|
User-defined bookmark on an entry:
|
|
@@ -400,7 +420,7 @@ Generated one-line session summary written when the agent goes idle and shown in
|
|
|
400
420
|
{"type":"session_summary","id":"l2m3n4o5","parentId":"k1l2m3n4","timestamp":"2024-12-03T14:36:00.000Z","summary":"Refactored auth module token refresh and added retry tests","summarizedThroughId":"j0k1l2m3","usage":{"input":812,"output":21}}
|
|
401
421
|
```
|
|
402
422
|
|
|
403
|
-
- `summary`: stored one-line text with collapsed whitespace and bounded length.
|
|
423
|
+
- `summary`: stored one-line text with collapsed whitespace and bounded length (up to 160 characters).
|
|
404
424
|
- `summarizedThroughId`: entry ID of the latest user or assistant message covered by the summary. Tool results do not invalidate it, but any newer user or assistant message or a later `branch_summary` retires it.
|
|
405
425
|
- `usage`: optional token usage from the summary request, counted toward session totals.
|
|
406
426
|
|
|
@@ -415,12 +435,21 @@ Repository state of one checkout at the end of a turn that ran a file-writing to
|
|
|
415
435
|
- `snapshot`: present when the state changed; an entry without `snapshot` references an earlier entry with the same `snapshotId`.
|
|
416
436
|
- `restore`: present when a resume restored the snapshot into a new worktree (`{ from, to, snapshotId, tree, restoredAt }`). Later resumes map `from` to `to`.
|
|
417
437
|
- `restore.degraded`: present when a resume restored less than the full snapshot (`{ stage, head, tree, basis?, missingLinks, missingPaths, missingCommits, cause, causeReason?, hint }`). `stage` is `"partial-changes"` or `"closest-commit"`, and `basis` (`"pushed-base"`, `"earlier-snapshot"`, or `"branch-tip"`) identifies the commit source for a closest-commit restore.
|
|
438
|
+
- `degradedFrom`: present on entries captured in a partly restored worktree to pin the original snapshot ID as the checkout's restore target until a full restore succeeds, `discardDegradedRestore()` releases it, or 30 days pass. On a full restore that carried over edits from a partly restored worktree, `degradedFrom` names the snapshot of those carried-over edits until the merged worktree is recorded or released.
|
|
418
439
|
- `unrestored`: present instead of `restore` when a resume continued without restoring `root` (`{ snapshotId, continuedIn, place, from?, cause, causeReason?, detail, hint, at }`). `place` is `"recorded"` or `"launch"`. When `from` is set on the active checkout, file tools map paths under `from` to `continuedIn` until a later resume restores the checkout.
|
|
419
440
|
- `restoreWarnings`: optional host warnings paired with `restore`, such as `{ code: "lfs-objects-unavailable", paths }` or `{ code: "stale-restore-retained", path, kind }`. Fresh-worktree LFS downloads run after the restore entry is written, so their warnings appear in resume notices instead.
|
|
420
441
|
- `captureMs`: capture duration in milliseconds for a turn capture.
|
|
421
442
|
- `capturedAt`: recording timestamp when a resume adopts a subagent's newer snapshot for a checkout.
|
|
422
443
|
- `blobs`: present only in exported JSONL files, holding base64 patch and bundle payloads keyed by SHA-256. Import verifies and stores them, then drops `blobs`.
|
|
423
444
|
|
|
445
|
+
## Saved diagnostic notices
|
|
446
|
+
|
|
447
|
+
Built-in stores save turn-ending diagnostic lines, such as cancelled retry errors, separately from session entries so reopening a session can display them in place. Each saved line is capped at 4,096 UTF-8 bytes and ends with `... [diagnostic truncated]` if trimmed, while the live terminal error stays intact.
|
|
448
|
+
|
|
449
|
+
These records are not session entries. `/tree`, model requests, compaction, token totals, conversation exports, and continuation logic ignore them. Copying a JSONL file or importing a session does not transfer them, and local libSQL `file:` databases do not store them.
|
|
450
|
+
|
|
451
|
+
Cache-miss and dropped-thinking notices are derived from saved assistant replies. When a compacted session opens on its active context window, Atomic does not reload discarded history to reconstruct earlier notice counts.
|
|
452
|
+
|
|
424
453
|
## Tree structure
|
|
425
454
|
|
|
426
455
|
Entries form a tree rooted at the first entry (`parentId: null`). Each subsequent entry points to its parent through `parentId`, branching adds sibling children from an earlier entry, and the leaf marks the active position:
|
|
@@ -433,7 +462,7 @@ Entries form a tree rooted at the first entry (`parentId: null`). Each subsequen
|
|
|
433
462
|
|
|
434
463
|
## Context building
|
|
435
464
|
|
|
436
|
-
`buildSessionProjection()` walks the active branch from root to leaf, replays model
|
|
465
|
+
`buildSessionProjection()` walks the active branch from root to leaf, replays model and thinking-level changes, selects the latest `compaction` entry with `details.strategy === "verbatim-lines"`, and applies the latest `context_edit` for each target.
|
|
437
466
|
|
|
438
467
|
It returns model-visible messages paired with their source entries (`entries[].sourceEntry` and `entries[].messages`). Omitted targets emit no message, content replacements preserve the source entry's role and metadata, and raw entries stay untouched. `buildSessionContext()` returns just the messages, thinking level, and model used for provider requests.
|
|
439
468
|
|
|
@@ -446,7 +475,7 @@ It returns model-visible messages paired with their source entries (`entries[].s
|
|
|
446
475
|
## Parsing example
|
|
447
476
|
|
|
448
477
|
```typescript
|
|
449
|
-
import { readFileSync } from "fs";
|
|
478
|
+
import { readFileSync } from "node:fs";
|
|
450
479
|
|
|
451
480
|
const lines = readFileSync("session.jsonl", "utf8").trim().split("\n");
|
|
452
481
|
|
|
@@ -460,6 +489,15 @@ for (const line of lines) {
|
|
|
460
489
|
case "message":
|
|
461
490
|
console.log(`[${entry.id}] ${entry.message.role}: ${JSON.stringify(entry.message.content)}`);
|
|
462
491
|
break;
|
|
492
|
+
case "model_change":
|
|
493
|
+
console.log(`[${entry.id}] Model: ${entry.provider}/${entry.modelId}`);
|
|
494
|
+
break;
|
|
495
|
+
case "thinking_level_change":
|
|
496
|
+
console.log(`[${entry.id}] Thinking: ${entry.thinkingLevel}`);
|
|
497
|
+
break;
|
|
498
|
+
case "usage":
|
|
499
|
+
console.log(`[${entry.id}] Usage (${entry.kind}): ${entry.provider}/${entry.model} ${entry.usage.totalTokens} tokens`);
|
|
500
|
+
break;
|
|
463
501
|
case "compaction":
|
|
464
502
|
if (entry.details?.strategy === "verbatim-lines") {
|
|
465
503
|
console.log(`[${entry.id}] Compaction boundary: ${entry.details.form ?? "compacted"}, ${entry.tokensBefore} tokens before`);
|
|
@@ -470,6 +508,9 @@ for (const line of lines) {
|
|
|
470
508
|
case "context_compaction":
|
|
471
509
|
console.log(`[${entry.id}] Retired logical-deletion compaction record`);
|
|
472
510
|
break;
|
|
511
|
+
case "context_edit":
|
|
512
|
+
console.log(`[${entry.id}] Context edit on ${entry.targetId}: ${entry.replacement === null ? "omitted" : "replaced"}`);
|
|
513
|
+
break;
|
|
473
514
|
case "branch_summary":
|
|
474
515
|
console.log(`[${entry.id}] Branch from ${entry.fromId}`);
|
|
475
516
|
break;
|
|
@@ -482,11 +523,14 @@ for (const line of lines) {
|
|
|
482
523
|
case "label":
|
|
483
524
|
console.log(`[${entry.id}] Label "${entry.label}" on ${entry.targetId}`);
|
|
484
525
|
break;
|
|
485
|
-
case "
|
|
486
|
-
console.log(`[${entry.id}]
|
|
526
|
+
case "session_info":
|
|
527
|
+
console.log(`[${entry.id}] Session name: ${entry.name ?? "(cleared)"}`);
|
|
487
528
|
break;
|
|
488
|
-
case "
|
|
489
|
-
console.log(`[${entry.id}]
|
|
529
|
+
case "session_summary":
|
|
530
|
+
console.log(`[${entry.id}] Summary: ${entry.summary}`);
|
|
531
|
+
break;
|
|
532
|
+
case "worktree_snapshot":
|
|
533
|
+
console.log(`[${entry.id}] Snapshot ${entry.snapshotId} for ${entry.root}`);
|
|
490
534
|
break;
|
|
491
535
|
}
|
|
492
536
|
}
|
|
@@ -496,88 +540,95 @@ for (const line of lines) {
|
|
|
496
540
|
|
|
497
541
|
Await `create`, `open`, `continueRecent`, `forkFrom`, and every session mutation. A resolved mutation has committed to its store, and a failed write rejects with a typed storage error without publishing the entry. There is no `flush` method.
|
|
498
542
|
|
|
499
|
-
`inMemory()` selects memory storage explicitly without filesystem I/O. Factories without an explicit store or directory resolve configured storage, defaulting to the shared local SQLite database. Passing a directory selects JSONL explicitly. Store-open failures never fall back to memory.
|
|
543
|
+
`inMemory()` selects memory storage explicitly without filesystem I/O. Factories without an explicit store or directory resolve configured storage, defaulting to the shared local SQLite database. Passing a directory selects JSONL explicitly. Store-open failures never fall back to memory. To open SQLite, PostgreSQL, libSQL, JSONL, or memory stores, see [SDK session storage](/sdk/storage), [Storage backends](/storage), and [Session management](/sdk/reference#session-management).
|
|
544
|
+
|
|
545
|
+
**Store ownership and closing.** `SessionManager` has no `close()` method. Calling `SessionManager.create(cwd)`, `SessionManager.continueRecent(cwd)`, or `SessionManager.open(filePath)` without passing a `SessionStore` opens an internal store that `createAgentSession({ sessionManager })` does **not** close during `session.dispose()`. Close `sessionManager.getSessionStore().close()` when finished, or open and close a `SessionStore` explicitly and pass it to `SessionManager.create(store, cwd)` or `SessionManager.open(store, sessionId)`. Calling `close()` twice on a direct `SqlSessionStore`, `JsonlSessionStore`, or `MemorySessionStore` throws `StoreClosedError`, and `SqlSessionStore.close()` leaves a caller-owned `database` open. See [SDK session storage](/sdk/storage) for the ownership matrix.
|
|
546
|
+
|
|
547
|
+
By default, opening an existing session loads only the active tail window (entries from the latest compaction boundary onward, plus required branch metadata) into memory rather than the entire history. Methods below note whether they inspect only entries loaded in memory or read older entries from storage on demand.
|
|
500
548
|
|
|
501
549
|
### Static creation methods
|
|
502
550
|
|
|
503
|
-
- `SessionManager.create(cwd, sessionDir?, options?)`: create a new session in configured storage, or in JSONL when `sessionDir` is provided.
|
|
551
|
+
- `SessionManager.create(cwd, sessionDir?, options?)`: create a new session in configured storage, or in flat-layout JSONL when `sessionDir` is provided.
|
|
504
552
|
- `SessionManager.create(store, cwd, options?)`: create a new session in a supplied `SessionStore`.
|
|
505
|
-
- `SessionManager.open(store, sessionId, cwdOverride?, options?)`: open an existing session by exact ID, raising `SessionNotFoundError` if missing. Defaults to `{ history: "tail" }`, loading from the latest compaction window; pass `{ history: "full" }` only when every stored entry must
|
|
506
|
-
- `SessionManager.open(path, sessionDir?, cwdOverride?)`: open a JSONL file directly, creating it if missing. This is a file API
|
|
553
|
+
- `SessionManager.open(store, sessionId, cwdOverride?, options?)`: open an existing session by exact ID in any `SessionStore` (required for SQLite, PostgreSQL, and libSQL sessions), raising `SessionNotFoundError` if missing. Defaults to `{ history: "tail" }`, loading from the latest compaction window; pass `{ history: "full" }` only when every stored entry must be loaded into memory. `continueRecent(store, cwd, options?)` and instance method `openSessionById()` share the same behavior.
|
|
554
|
+
- `SessionManager.open(path, sessionDir?, cwdOverride?, options?)`: open a JSONL file directly by filesystem path, creating it if missing. This is a JSONL file API only and cannot open a SQLite, PostgreSQL, or libSQL session ID.
|
|
507
555
|
- `SessionManager.continueRecent(cwd, sessionDir?, options?)` or `continueRecent(store, cwd, options?)`: continue the most recent regular session or create a new one. Pass `{ includeInternal: true }` to include internal sessions.
|
|
508
556
|
- `SessionManager.inMemory(cwd?, options?)`: create an empty memory-only session synchronously. To seed entries, await `SessionManager.inMemory(cwd, options, entries)` without mutating the supplied array until it resolves.
|
|
509
557
|
- `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)`: fork a JSONL file into the target store. For database sessions, open the session by ID and await `manager.forkTo(targetCwd, targetStore?, options?)`.
|
|
510
|
-
- `SessionManager.importFromJsonl(inputPath, cwd, targetStoreOrDir?)`: import a JSONL export preserving its ID and upgrading older supported formats. Raises `SessionExistsError` if the ID already exists, and opens at the
|
|
558
|
+
- `SessionManager.importFromJsonl(inputPath, cwd, targetStoreOrDir?)`: import a JSONL export preserving its ID and upgrading older supported formats. Raises `SessionExistsError` if the ID already exists, and opens at the active context window.
|
|
511
559
|
|
|
512
560
|
### Static listing methods
|
|
513
561
|
|
|
514
|
-
- `SessionManager.list(cwd, storeOrDir?, onProgress?, options?)`: list sessions for one project, excluding internal sessions by default.
|
|
515
|
-
- `SessionManager.listAll(storeOrDir?, onProgress?, options?)`: list sessions across all projects in the store.
|
|
562
|
+
- `SessionManager.list(cwd, storeOrDir?, onProgress?, options?)`: list sessions for one project (`cwd` is always the first argument), excluding internal sessions by default. When `storeOrDir` is omitted, Atomic opens and closes configured storage automatically.
|
|
563
|
+
- `SessionManager.listAll(storeOrDir?, onProgress?, options?)` or `SessionManager.listAll(onProgress?, signal?)`: list sessions across all projects in the store. The first argument is `storeOrDir` or `onProgress`, never `cwd`; passing a string scans that string as a JSONL directory instead of filtering by project. When `storeOrDir` is omitted, Atomic opens and closes configured storage automatically.
|
|
516
564
|
|
|
517
|
-
Select sessions by `SessionInfo.id`. `SessionInfo.path` holds a JSONL path when available and otherwise the session ID; do not treat it as a filesystem path.
|
|
565
|
+
Both methods accept `{ includeInternal: true, signal }`. Select sessions by `SessionInfo.id`. `SessionInfo.path` holds a JSONL path when available and otherwise the session ID; do not treat it as a filesystem path.
|
|
518
566
|
|
|
519
567
|
### Session management methods
|
|
520
568
|
|
|
521
569
|
- `newSession(options?)`: start a new session. `NewSessionOptions` accepts `id`, `parentSession`, and `internal` (`internal: true` hides the session from `/resume`, `atomic -r`, `-c`, and `history://sessions` while keeping it openable by ID).
|
|
522
|
-
- `
|
|
570
|
+
- `openSessionById(sessionId, cwdOverride?, sessionDirectory?, options?)`: open an existing session by exact ID from this manager's active store (or from a flat-layout JSONL directory when `sessionDirectory` is passed), returning a new `SessionManager`. Defaults to `{ history: "tail" }`; pass `{ history: "full" }` only when every stored entry must be loaded into memory.
|
|
571
|
+
- `setSessionFile(path)`: switch directly to a JSONL file. For ID-based loading, create a new manager with `SessionManager.open(store, sessionId)` or `manager.openSessionById(sessionId)`.
|
|
523
572
|
- `createBranchedSession(leafId)`: extract a branch into a new session in the same store.
|
|
524
573
|
- `forkTo(cwd, targetStoreOrDir?, options?)`: copy the session into a new session at the destination.
|
|
525
574
|
- `deleteSession(sessionId)`: delete another session and its entries from the active store. Deleting a missing ID is a no-op. Rejects for the currently open session, and raises `SessionOpenElsewhereError` if another live Atomic session holds it open (tracked by an active heartbeat that expires after 60 seconds on another host). A session deleted while running fails its next save once with `SessionDeletedError`. `SessionStore.delete(sessionId)` is the unguarded store-level operation underneath.
|
|
526
575
|
|
|
527
576
|
### Appending methods
|
|
528
577
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
| Method | Action |
|
|
532
|
-
| --- | --- |
|
|
533
|
-
| `appendMessage(message)` | Append a message entry |
|
|
534
|
-
| `appendThinkingLevelChange(level)` | Record a thinking-level change |
|
|
535
|
-
| `
|
|
536
|
-
| `
|
|
537
|
-
| `appendCompaction(compactedText, firstKeptEntryId, tokensBefore, details)` | Append a durable compaction boundary (`null` for `firstKeptEntryId` on current boundaries) |
|
|
538
|
-
| `appendCustomEntry(customType, data?)` | Append extension state (excluded from LLM context) |
|
|
539
|
-
| `appendSessionInfo(name)` | Set the session display name (empty string clears it) |
|
|
540
|
-
| `appendSessionSummary(summary, summarizedThroughId, usage?)` | Store a generated resume-picker summary anchored to a message |
|
|
541
|
-
| `appendCustomMessageEntry(customType, content, display, details?)` | Append an extension message |
|
|
542
|
-
| `appendLabelChange(targetId, label)` | Set or clear an entry bookmark label |
|
|
543
|
-
| `appendContextEdit(targetId, replacement)` | Append a branch-local context edit (`null` omits the target; `{ content }` replaces only its content) |
|
|
578
|
+
All append methods below return `Promise<string>` resolving to the new entry ID, except `appendUsage()`, which returns `Promise<UsageEntry>`:
|
|
579
|
+
|
|
580
|
+
| Method | Returns | Action |
|
|
581
|
+
| --- | --- | --- |
|
|
582
|
+
| `appendMessage(message, options?)` | `Promise<string>` | Append a message entry (optional `{ queuedMessageId?: string }`) |
|
|
583
|
+
| `appendThinkingLevelChange(level)` | `Promise<string>` | Record a thinking-level change |
|
|
584
|
+
| `appendModelChange(provider, modelId, fallback?)` | `Promise<string>` | Record a model change (optional `ModelFallbackRecord`) |
|
|
585
|
+
| `appendUsage(kind, provider, model, usage, note?)` | `Promise<UsageEntry>` | Record auxiliary model usage without adding it to LLM context |
|
|
586
|
+
| `appendCompaction(compactedText, firstKeptEntryId, tokensBefore, details)` | `Promise<string>` | Append a durable compaction boundary (`null` for `firstKeptEntryId` on current boundaries) |
|
|
587
|
+
| `appendCustomEntry(customType, data?)` | `Promise<string>` | Append extension state (excluded from LLM context) |
|
|
588
|
+
| `appendSessionInfo(name)` | `Promise<string>` | Set the session display name (empty string clears it) |
|
|
589
|
+
| `appendSessionSummary(summary, summarizedThroughId, usage?)` | `Promise<string>` | Store a generated resume-picker summary anchored to a message |
|
|
590
|
+
| `appendCustomMessageEntry(customType, content, display, details?)` | `Promise<string>` | Append an extension message |
|
|
591
|
+
| `appendLabelChange(targetId, label)` | `Promise<string>` | Set or clear an entry bookmark label |
|
|
592
|
+
| `appendContextEdit(targetId, replacement)` | `Promise<string>` | Append a branch-local context edit (`null` omits the target; `{ content }` replaces only its content) |
|
|
544
593
|
|
|
545
594
|
### Tree navigation methods
|
|
546
595
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
|
550
|
-
|
|
|
551
|
-
| `
|
|
552
|
-
| `
|
|
553
|
-
| `
|
|
554
|
-
| `
|
|
555
|
-
| `
|
|
556
|
-
| `
|
|
557
|
-
| `
|
|
558
|
-
| `
|
|
559
|
-
| `
|
|
596
|
+
Await `branch`, `resetLeaf`, `recordBranch`, and `branchWithSummary`. All read methods below are synchronous:
|
|
597
|
+
|
|
598
|
+
| Method | Returns | Action |
|
|
599
|
+
| --- | --- | --- |
|
|
600
|
+
| `getLeafId()` | `string \| null` | Return the current leaf entry ID |
|
|
601
|
+
| `getLeafEntry()` | `SessionEntry \| undefined` | Return the current leaf entry |
|
|
602
|
+
| `getEntry(id)` | `SessionEntry \| undefined` | Return an entry loaded in memory by ID |
|
|
603
|
+
| `getBranch(fromId?)` | `SessionEntry[]` | Walk from an entry to the root |
|
|
604
|
+
| `getTree()` | `SessionTreeNode[]` | Return the tree of entries loaded in memory; use `readHistory()` or `loadFullHistory()` for older entries |
|
|
605
|
+
| `getChildren(parentId)` | `SessionEntry[]` | Return direct child entries currently loaded in memory |
|
|
606
|
+
| `getLabel(id)` | `string \| undefined` | Return the label for an entry |
|
|
607
|
+
| `branch(entryId)` | `Promise<void>` (async) | Move the leaf to an earlier entry in memory only (the session reopens at its last saved entry) |
|
|
608
|
+
| `resetLeaf()` | `Promise<void>` (async) | Reset the leaf to `null` in memory only |
|
|
609
|
+
| `recordBranch(entryId \| null)` | `Promise<void>` (async) | Move the leaf like `branch()` or `resetLeaf()` and persist the move so the session reopens there |
|
|
610
|
+
| `branchWithSummary(entryId, summary, details?, fromHook?, usage?, fromId?)` | `Promise<string>` (async) | Branch with a context summary and return the new entry ID |
|
|
560
611
|
|
|
561
612
|
### Context, history, and metadata methods
|
|
562
613
|
|
|
563
614
|
- `buildSessionProjection(mode?)`: return the context-edited projection (`entries` with source entries and model-visible messages, plus `thinkingLevel` and `model`). Pass `"transcript"` for saved chat rows that keep original displayed content for edited or omitted entries while hiding non-displayed custom messages. For a live session, `session.transcriptMessages` also includes unsaved live messages.
|
|
564
615
|
- `buildSessionContext()`: return messages, thinking level, and model for the LLM.
|
|
565
616
|
- `buildContextEntries()`: return active-branch entries after the latest compaction boundary.
|
|
566
|
-
- `getEntries()`: return raw entries in
|
|
567
|
-
- `hasFullHistory()`: return whether every stored entry is
|
|
617
|
+
- `getEntries()`: return raw entries loaded in memory, excluding the header. System tool-change messages and `atomic.appendEntry()` extension entries on the active branch stay loaded here; use `readHistory()` or `readEntry(id)` for older retired entries.
|
|
618
|
+
- `hasFullHistory()`: return whether every stored entry is loaded in memory.
|
|
568
619
|
- `loadFullHistory()`: load every stored entry on every branch into memory. Prefer `readHistory()` so large sessions stay bounded; Atomic itself never calls `loadFullHistory()`.
|
|
569
620
|
- `readHistory({ fromSeq?, toSeq?, direction?, signal? }?)`: iterate pages of `{ seq, entry }` between inclusive bounds. Use `direction: "backward"` to start from the latest page while keeping entries inside each page in append order. Resume with `{ cursor: page.nextCursor }` without new bounds. Entries over 1 MiB appear as `{ kind: "oversized", seq, bytes }` references instead of truncated objects. Replaced or recreated sessions reject rather than mixing generations.
|
|
570
621
|
- `readHistoryChunks(reference, { offset?, signal? }?)`: read an oversized entry's encoded UTF-8 bytes in chunks of at most 64 KiB. Track consumed bytes to resume at an offset and decode with a streaming UTF-8 decoder.
|
|
571
622
|
- `readSessionHistory(store, sessionId, options?)` and `readSessionHistoryChunks(store, reference, options?)`: imported from `@bastani/atomic/storage` for read-only paged and chunked access directly from a `SessionStore` without opening a `SessionManager`.
|
|
572
|
-
- `readEntry(id)`: read one entry by ID, including entries outside the
|
|
573
|
-
- `getOmittedHistoryTotals()`: return usage and message counts omitted by a tail window, or `undefined` when full history is
|
|
574
|
-
- `getLastSeq()`: return the session's last stored sequence number, including entries not
|
|
575
|
-
- `getEntrySeq(id)` and `findEntrySeq(id)`: return a
|
|
623
|
+
- `readEntry(id)`: read one entry by ID, including entries outside the loaded window, or return `undefined` if absent.
|
|
624
|
+
- `getOmittedHistoryTotals()`: return usage and message counts omitted by a tail window, or `undefined` when full history is loaded.
|
|
625
|
+
- `getLastSeq()`: return the session's last stored sequence number, including entries not loaded in memory.
|
|
626
|
+
- `getEntrySeq(id)` and `findEntrySeq(id)`: return a loaded entry's sequence synchronously (`getEntrySeq`) or look up any entry's sequence in the store without loading earlier transcript entries (`findEntrySeq`).
|
|
576
627
|
- `forEachStoredEntry(fromSeq, visit)`: visit every stored entry from `fromSeq` in store order, paging older entries without holding them in memory, and resolve to the last visited sequence.
|
|
577
|
-
- `getWorktreeSnapshotRecords()` and `getLatestWorktreeSnapshots()`: return
|
|
578
|
-
- `loadWorktreeSnapshotRecords(ids, { signal? }?)`: resolve snapshot records by ID across any branch, reading the store for records outside the window and omitting unknown IDs.
|
|
628
|
+
- `getWorktreeSnapshotRecords()` and `getLatestWorktreeSnapshots()`: return loaded snapshot records (`getWorktreeSnapshotRecords`) or the latest snapshot per checkout root on the active branch (`getLatestWorktreeSnapshots`).
|
|
629
|
+
- `loadWorktreeSnapshotRecords(ids, { signal? }?)`: resolve snapshot records by ID across any branch, reading the store for records outside the loaded window and omitting unknown IDs.
|
|
579
630
|
- `readWorktreeSnapshotPages({ branch?, direction?, signal? }?)`: iterate `worktree_snapshot` entries in pages of `{ seq, entry }` across all branches or the active branch (`branch: true`) without retaining them in memory.
|
|
580
|
-
- `getAdmissionKeys().has(key)`: test synchronously whether
|
|
631
|
+
- `getAdmissionKeys().has(key)`: test synchronously whether a deduplication key (admission key) has already been persisted to prevent duplicate event or message admission after resume.
|
|
581
632
|
- `getSessionRecoveryState()`: return persisted recovery state (admission keys and delivered Intercom message IDs) used to prevent duplicate deliveries after resume.
|
|
582
633
|
- `getHeader()`: return the session header metadata.
|
|
583
634
|
- `getSessionName()` and `getSessionNameState()`: return the display name (`undefined` if unset or cleared), or the durable name state (`{ hasName: false }`, `{ hasName: true }`, or `{ hasName: true, name }`).
|