@bastani/atomic 0.10.19 → 0.10.20-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 +72 -0
- package/dist/_shared/adapter-open-DXXV6ATH.js +22 -0
- package/dist/_shared/adapter-open-DXXV6ATH.js.map +1 -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-JXBZ3H27.js +484 -229
- package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +63 -16
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/mode-shared-2QJSCUM6.js +61 -16
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/p0-cli-BB45ZQY6.js +2 -2
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/p1b-elig-BY2G5BUE.js +6 -3
- package/dist/_shared/p1b-elig-BY2G5BUE.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-BHX35EPK.js → sdk-5ZFNDXUJ.js} +319 -86
- package/dist/_shared/sdk-5ZFNDXUJ.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +15 -7
- package/dist/_shared/session-data-AHTU7IS6.js.map +1 -1
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-HXQLSUWM.js +2 -2
- package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -1
- package/dist/_shared/{startup-0-0-4EDVBK5P.js → startup-0-0-OWBJIX35.js} +162 -44
- package/dist/_shared/startup-0-0-OWBJIX35.js.map +1 -0
- package/dist/_shared/{startup-0-1-H5IXVRXQ.js → startup-0-1-DZYE4E5Z.js} +462 -37
- package/dist/_shared/startup-0-1-DZYE4E5Z.js.map +1 -0
- package/dist/_shared/{startup-0-2-YZZOC22D.js → startup-0-2-WFLTE4SC.js} +147 -6
- package/dist/_shared/startup-0-2-WFLTE4SC.js.map +1 -0
- package/dist/_shared/startup-0-3-DE2NCS6A.js +59 -50
- package/dist/_shared/startup-0-3-DE2NCS6A.js.map +1 -1
- package/dist/_shared/{startup-0-4-ZMJV547D.js → startup-0-4-6XXL4JMZ.js} +115 -25
- package/dist/_shared/startup-0-4-6XXL4JMZ.js.map +1 -0
- package/dist/_shared/{startup-0-5-HZX3ZPTP.js → startup-0-5-DNS6FYS7.js} +229 -156
- package/dist/_shared/startup-0-5-DNS6FYS7.js.map +1 -0
- package/dist/_shared/{startup-10-0-TDQNBDDL.js → startup-10-0-O6DAT7U4.js} +131 -162
- package/dist/_shared/startup-10-0-O6DAT7U4.js.map +1 -0
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +9 -6
- package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
- package/dist/_shared/{startup-15-0-YUKGAC63.js → startup-15-0-E7RYG5YF.js} +9 -9
- package/dist/_shared/{startup-15-0-YUKGAC63.js.map → startup-15-0-E7RYG5YF.js.map} +1 -1
- package/dist/_shared/startup-15-1-WQZBOTMZ.js +340 -128
- package/dist/_shared/startup-15-1-WQZBOTMZ.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +279 -151
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/{startup-8-1-QZMXUGHI.js → startup-8-1-VXBL37AI.js} +352 -27
- package/dist/_shared/startup-8-1-VXBL37AI.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +15 -273
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/{storage-status-K7PX2RXA.js → storage-status-T6FUXRIM.js} +8 -24
- package/dist/_shared/{storage-status-K7PX2RXA.js.map → storage-status-T6FUXRIM.js.map} +1 -1
- package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/team-DOQKICG2.js +4 -3
- package/dist/_shared/team-DOQKICG2.js.map +1 -1
- package/dist/_shared/tree-outline-MUEPK5B7.js +9 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js.map +1 -1
- package/dist/binary-self-update.js +3 -3
- package/dist/builtin/intercom/broker/broker.bundle.mjs +46 -8
- package/dist/builtin/intercom/broker/broker.ts +1 -0
- package/dist/builtin/intercom/broker/client.ts +5 -1
- package/dist/builtin/intercom/broker/departed-children.ts +12 -6
- package/dist/builtin/intercom/broker/ended-child-wakes.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +130 -264
- package/dist/builtin/intercom/message-display.ts +42 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +1 -0
- 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 +99 -20
- package/dist/builtin/web-access/index.bundle.mjs +15 -9
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +6 -6
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +4 -4
- 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 +3 -3
- 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 +3 -3
- 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-runtime.d.ts +16 -4
- package/dist/core/agent-session-types.d.ts +5 -1
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.code.js +74 -72
- package/dist/core/export-html/card-projection.code.js.map +1 -1
- 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 +52 -41
- package/dist/core/export-html/index.code.js.map +1 -1
- 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.code.js +1 -1
- 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/template.js +27 -39
- 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/context-types.d.ts +3 -0
- package/dist/core/extensions/context-types.js.map +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 +2 -2
- package/dist/core/extensions/runner-context.d.ts +1 -0
- package/dist/core/extensions/runner-context.js +18 -2
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runtime-types.d.ts +1 -0
- package/dist/core/extensions/runtime-types.js.map +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-registry.js +2 -2
- package/dist/core/model-runtime-streaming.d.ts +3 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/package-manager-storage-adapters.code.js +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/resume/failure.d.ts +1 -1
- package/dist/core/sdk.code.js +4 -4
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-claims.d.ts +13 -2
- package/dist/core/session-load-events.d.ts +42 -0
- package/dist/core/session-manager-core.d.ts +17 -2
- package/dist/core/session-manager-core.js +234 -93
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-errors.d.ts +2 -2
- package/dist/core/session-manager-history.d.ts +1 -1
- 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 +2 -2
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.code.js +1 -1
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/settings-manager.js +2 -2
- package/dist/core/storage/adapter-open.js +3 -0
- package/dist/core/storage/adapter-open.js.map +1 -0
- 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/prefix.js +1 -0
- package/dist/core/storage/prefix.js.map +1 -1
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +2 -1
- package/dist/core/storage/schema-catalog.js +25 -6
- package/dist/core/storage/schema-catalog.js.map +1 -1
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +17 -4
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
- 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 +7 -7
- package/dist/core/storage/session/child-reader.code.js.map +1 -1
- package/dist/core/storage/session/child-reader.d.ts +1 -0
- 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.code.js +1 -1
- 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 +3 -3
- 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 +9 -5
- package/dist/core/storage/session/fork-staging.code.js.map +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 +29 -13
- package/dist/core/storage/session/fork-window.code.js.map +1 -1
- 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.d.ts +8 -4
- 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.d.ts +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/parent-links.d.ts +122 -0
- 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 +5 -6
- package/dist/core/storage/session/snapshot-history.code.js.map +1 -1
- 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.d.ts +7 -20
- 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.code.js +1 -1
- 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/session/types.d.ts +11 -3
- package/dist/core/storage/session/usage-observations.d.ts +27 -0
- package/dist/core/storage/session/usage-observations.js +3 -0
- package/dist/core/storage/session/usage-observations.js.map +1 -0
- package/dist/core/storage/storage-status.code.js +1 -1
- 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/subscription-usage-identity.d.ts +9 -0
- package/dist/core/subscription-usage-observations.d.ts +15 -0
- package/dist/core/subscription-usage-storage.js +3 -0
- package/dist/core/subscription-usage-storage.js.map +1 -0
- package/dist/core/subscription-usage.d.ts +20 -3
- package/dist/core/tasks/task-completion-entry.code.js +1 -1
- 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 +5 -5
- 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.code.js +1 -1
- 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 +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 +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 +2 -2
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +12 -7
- package/dist/extensions/codemode/renderer.code.js.map +1 -1
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +3 -3
- 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 +6 -3
- package/dist/index.js +10 -10
- 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/main.js +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/interactive/components/intercom-wake-notice.d.ts +4 -0
- package/dist/modes/interactive/components/notice-line.d.ts +1 -1
- package/dist/modes/interactive/components/stored-tree-view.code.js +6 -5
- package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -1
- 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/tool-block.d.ts +5 -1
- package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
- 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-engine/isolated-runtime.d.ts +4 -3
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +5 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +26 -3
- package/dist/package-manager-cli.code.js +7 -7
- 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/10.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/13.js +2 -1
- package/dist/startup-stages/14.js +1 -0
- package/dist/startup-stages/4.js +1 -1
- package/dist/startup-stages/6.js +1 -1
- package/dist/startup-stages/7.js +1 -1
- package/dist/startup-stages/8.js +1 -1
- package/dist/startup-stages/stages.json +1 -1
- 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/.agents/context/DESIGN.md +30 -0
- package/docs/changelog.mdx +46 -0
- package/docs/docs.json +1 -1
- package/docs/extensions/api-reference.md +6 -0
- package/docs/guides/subscription-usage.md +28 -82
- package/docs/intercom.md +3 -1
- package/docs/json.md +3 -3
- package/docs/providers.md +2 -0
- package/docs/reference/cli.md +3 -1
- package/docs/rpc/protocol.md +31 -3
- package/docs/sdk/reference.md +26 -1
- package/docs/sdk.md +2 -0
- package/docs/sessions.md +38 -1
- package/docs/slash-commands.md +1 -1
- package/docs/subagents.md +2 -0
- package/docs/usage.md +1 -1
- package/package.json +8 -8
- package/dist/_shared/sdk-BHX35EPK.js.map +0 -1
- package/dist/_shared/startup-0-0-4EDVBK5P.js.map +0 -1
- package/dist/_shared/startup-0-1-H5IXVRXQ.js.map +0 -1
- package/dist/_shared/startup-0-2-YZZOC22D.js.map +0 -1
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +0 -1
- package/dist/_shared/startup-0-5-HZX3ZPTP.js.map +0 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js.map +0 -1
- package/dist/_shared/startup-8-1-QZMXUGHI.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import "./rolldown-runtime-BGM3D5V3.js";
|
|
2
2
|
import { APP_NAME, ENV_DEBUG, ENV_OFFLINE, ENV_SESSION_DIR, ENV_SKIP_VERSION_CHECK, ENV_STARTUP_BENCHMARK, VERSION, canonicalizePathAsync as canonicalizePathAsync$1, getAgentDir, getEnvValue, getPackageDir, inheritsDebugSetting, markLifecycleTiming, onDebugSettingChange, readInteractiveEngineBootstrap, resolvePath, setDebugSetting, setEnvValue, takeInteractiveEngineBootstrapArg } from "./p0-cli-BB45ZQY6.js";
|
|
3
|
-
import { CompactionCancelledError, CompactionStateError, CompactorFailure, EngineSessionStats, ExtensionStartupError, HostListenerFailures, INTERACTIVE_MODEL_REFRESH_TIMEOUT_MS, InteractiveEngineResourceReadinessError, MissingSessionCwdError, NativeModuleUnavailableError, QueuedDeliveryView, STALE_EXTENSION_CONTEXT_MESSAGE, SessionIntercomPolicy, TOOL_RESULTS_SUBDIR, VERBATIM_COMPACTION_STRATEGY, allToolNames, applyBashSessionEnvironment, assertSessionCwdExists, assignMissingToolCallIds, asyncScope, bindChatReceipt, blueprintBuildPending, blueprintBuildSettled, blueprintBuildsRunning, buildBoundaryText, buildBoundaryTextWithLocation, captureHerdrEnvironment, carryDroppedQueuedMessages, chatRecordSavesSettled, cleanupWindowsSelfUpdateQuarantine, completeStartup, createSyntheticSourceInfo, customMessageExcludesContext, deduplicateDiagnostics, deferDeprecationWarnings, endQueuedMessageDelivery, findMissingSessionCwdIssue, findMissingSessionCwdIssueAsync, formatCodexProviderError, formatNoModelSelectedMessage, formatNoModelsAvailableMessage, getBuiltinPackageLocations, getBuiltinPackagePaths, getDefaultCacheRetention, getToolListError, handlePackageCommandParseOutcome, heldInputView, holdToolsUntilOwnerBuilt, hostInputError, hostNoticeForEvent, interactiveQuitOf, isExtensionLoadError, isMandatoryRuntimeTool, isSingleGenericAbortTextContent, isToolModifier, isTrustedMandatoryRuntimeTool, isUnknownModel, loadShownDeprecationNotices, mergeSessionTrustDecisions, modelCallUsage, nativeModuleProblem, nativeModuleUnavailable, noteQueueUpdateDeliveries, noteQueuedMessagesDropped, noteUserMessageOrigin, notifySessionProviderRequestDispatched, observeToolExecutionTiming, parsePackageCommand, pendingProjectResourcesTrusted, projectTrustedBeforeExtensions, recordStartupThinkingLevel, refreshConfig, registerStartupRollback, releaseToolAbortGraceTimers, releaseUnownedPaneRegistration, replacementAbortContent, restoreStdout, retryStatusUpdate, rollbackStartup, sanitizeOpenAIResponsesPayload, saveChatRecord, savedConversationThinkingLevel, scrubPreCompactionAssistantUsage, serializeConversationForCompaction, serializeSessionMutation, sessionIntercomFacade, shareBlueprintBuild, shouldRunFirstTimeSetup, sleep, snapshotBashSessionEnvironment, startEventLoopMonitor, startupCleanupFailureMessage, startupProjectTrust, stopBlueprintBuilds, takeOverStdout, trackChatRecordSave, uniquifyToolCallIds, validateIntercomSessionOptions, waitForEventLoopMonitorReady, warnDeprecation, watchFirstProjectTrustHandler, writeRawStdout } from "./startup-0-0-
|
|
4
|
-
import { AgentRehydrateError, CacheWarmer, EngineHealthController, RemoteModelCatalog, RemoteQueuePause, TRANSPILE_CACHE_WRITE_WAIT_MS, ToolExecutionScheduler, acceptsForkReplay, assertSettingsWrites, captureForkReplayPair, claimInteractiveBind, collectSettingsDiagnostics, convertToLlm, convertToLlmWithForkBoundaries, currentResourceAdmission, deferMessagesInterleavedWithToolBatch, drainProcessStdio, drainWindowsDirectorySecurityReads, forkReplayFilter, getClientIdentity, isForkHeader, isLocalOnlySessionStorage, isTruthyEnvFlag, isVerbatimCompactionMessage, lifecycleScopeForOwner, migrateCompactionModelSettings, normalizeMessageContent, normalizeModelFailureSignal, noteCommandTurnMessage, ownedSettingsManagers, parseArgs, prewarmModelApi, printHelp, readPipedStdin, recordClosedStart, recordResumeTimings, repairOrphanToolResults, reportDiagnostics, resolveCompactionModel, serializeWorkspaceError, sessionLifecycleCreation, sessionLifecycleScopes, transpileCacheWritesSettled, unreadableTrustSettingsDiagnostics, withImagesBlocked, withWindowsDirectorySecurityOwner } from "./startup-0-1-
|
|
3
|
+
import { CompactionCancelledError, CompactionStateError, CompactorFailure, EngineSessionStats, ExtensionStartupError, HostListenerFailures, INTERACTIVE_MODEL_REFRESH_TIMEOUT_MS, InteractiveEngineResourceReadinessError, MissingSessionCwdError, NativeModuleUnavailableError, QueuedDeliveryView, STALE_EXTENSION_CONTEXT_MESSAGE, SessionIntercomPolicy, TOOL_RESULTS_SUBDIR, VERBATIM_COMPACTION_STRATEGY, acquireLiveSessionClaim, allToolNames, applyBashSessionEnvironment, assertSessionCwdExists, assignMissingToolCallIds, asyncScope, bindChatReceipt, blueprintBuildPending, blueprintBuildSettled, blueprintBuildsRunning, buildBoundaryText, buildBoundaryTextWithLocation, captureHerdrEnvironment, carryDroppedQueuedMessages, chatRecordSavesSettled, cleanupWindowsSelfUpdateQuarantine, completeStartup, createSyntheticSourceInfo, customMessageExcludesContext, deduplicateDiagnostics, deferDeprecationWarnings, endQueuedMessageDelivery, findMissingSessionCwdIssue, findMissingSessionCwdIssueAsync, flushRawStdout, formatCodexProviderError, formatNoModelSelectedMessage, formatNoModelsAvailableMessage, getBuiltinPackageLocations, getBuiltinPackagePaths, getDefaultCacheRetention, getToolListError, handlePackageCommandParseOutcome, heldInputView, holdToolsUntilOwnerBuilt, hostInputError, hostNoticeForEvent, interactiveQuitOf, isExtensionLoadError, isMandatoryRuntimeTool, isSingleGenericAbortTextContent, isToolModifier, isTrustedMandatoryRuntimeTool, isUnknownModel, loadShownDeprecationNotices, mergeSessionTrustDecisions, modelCallUsage, nativeModuleProblem, nativeModuleUnavailable, noteQueueUpdateDeliveries, noteQueuedMessagesDropped, noteUserMessageOrigin, notifySessionProviderRequestDispatched, observeToolExecutionTiming, parsePackageCommand, pendingProjectResourcesTrusted, projectTrustedBeforeExtensions, recordStartupThinkingLevel, refreshConfig, registerStartupRollback, releaseToolAbortGraceTimers, releaseUnownedPaneRegistration, replacementAbortContent, restoreStdout, retryStatusUpdate, rollbackStartup, sanitizeOpenAIResponsesPayload, saveChatRecord, savedConversationThinkingLevel, scrubPreCompactionAssistantUsage, serializeConversationForCompaction, serializeSessionMutation, sessionIntercomFacade, shareBlueprintBuild, shouldRunFirstTimeSetup, sleep, snapshotBashSessionEnvironment, startEventLoopMonitor, startupCleanupFailureMessage, startupProjectTrust, stopBlueprintBuilds, takeOverStdout, trackChatRecordSave, uniquifyToolCallIds, validateIntercomSessionOptions, waitForEventLoopMonitorReady, warnDeprecation, watchFirstProjectTrustHandler, writeRawStdout } from "./startup-0-0-OWBJIX35.js";
|
|
4
|
+
import { AgentRehydrateError, CacheWarmer, EngineHealthController, RemoteModelCatalog, RemoteQueuePause, TRANSPILE_CACHE_WRITE_WAIT_MS, ToolExecutionScheduler, acceptsForkReplay, assertSettingsWrites, captureForkReplayPair, claimInteractiveBind, collectSettingsDiagnostics, convertToLlm, convertToLlmWithForkBoundaries, currentResourceAdmission, deferMessagesInterleavedWithToolBatch, drainProcessStdio, drainWindowsDirectorySecurityReads, forkReplayFilter, getClientIdentity, isForkHeader, isLocalOnlySessionStorage, isTruthyEnvFlag, isVerbatimCompactionMessage, lifecycleScopeForOwner, migrateCompactionModelSettings, normalizeMessageContent, normalizeModelFailureSignal, noteCommandTurnMessage, ownedSettingsManagers, parseArgs, prewarmModelApi, printHelp, readPipedStdin, recordClosedStart, recordResumeTimings, repairOrphanToolResults, reportDiagnostics, resolveCompactionModel, serializeWorkspaceError, sessionLifecycleCreation, sessionLifecycleScopes, setUsageObservationStore, transpileCacheWritesSettled, unreadableTrustSettingsDiagnostics, usageObservationStore, withImagesBlocked, withWindowsDirectorySecurityOwner } from "./startup-0-1-DZYE4E5Z.js";
|
|
5
5
|
import { endTimingSpan, initTheme, printTimings, resetTimings, startEarlyInputCapture, startTimingSpan, stopThemeWatcher, time } from "./p2-shell-main-B2WIALFD.js";
|
|
6
6
|
import { ProjectTrustStore, hasErrorIdentity, hasProjectTrustInputs, hasProjectTrustInputsAsync, redactCredentialShapes, rehydrateErrorCause, reportDebugAsync, serializeErrorCause } from "./p1b-elig-BY2G5BUE.js";
|
|
7
7
|
import { shouldUseFullscreenTui } from "./p1-elig-shell-WWRO3L2R.js";
|
|
8
|
-
import { MessageAdmissionBoundary, abortSessionWork, acquireProtectedPaths, armSessionQuitStops, assertSessionOpen, buildCompactorMessages, calculateContextTokens, clearNestedToolCalls, drainSessionReload, drainSessionWork, drainSessionWorkWithin, estimateContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, getCallableTools, getShellEnvAsync, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, isPowerShellAvailable, isPowerShellAvailableAsync, isSelectedNativeMcpTool, limitQuitShutdownHandlers, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, processSharedStorageSelection, recordNestedToolCalls, registerSessionRetirement, registerSessionWorkOwner, renewSessionWork, requestCompactorOutput, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, retireSessionReloadGeneration, selectProcessStorage, sessionGenerationClosing, sessionLifetime, setActiveSessionTempId, setCliStorageSelection, shouldCompact, shutdownDeadline, trackSessionReload, trackSessionWork, untilShutdownHandlerDeadline, validateProcessStorageAsync } from "./startup-0-2-
|
|
8
|
+
import { MessageAdmissionBoundary, abortSessionWork, acquireProtectedPaths, armSessionQuitStops, assertSessionOpen, buildCompactorMessages, calculateContextTokens, clearNestedToolCalls, drainSessionReload, drainSessionWork, drainSessionWorkWithin, estimateContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, getCallableTools, getShellEnvAsync, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, isPowerShellAvailable, isPowerShellAvailableAsync, isSelectedNativeMcpTool, isSessionLoadEvent, limitQuitShutdownHandlers, observeSessionLoadHistory, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, processSharedStorageSelection, recordNestedToolCalls, registerSessionRetirement, registerSessionWorkOwner, renewSessionWork, replaySessionOpen, requestCompactorOutput, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, retireSessionReloadGeneration, selectProcessStorage, sessionGenerationClosing, sessionLifetime, setActiveSessionTempId, setCliStorageSelection, shouldCompact, shutdownDeadline, startSessionLoad, trackSessionReload, trackSessionWork, untilShutdownHandlerDeadline, validateProcessStorageAsync, withInitialSessionLoad, withSessionLoadEvents, withSessionLoadPhase } from "./startup-0-2-WFLTE4SC.js";
|
|
9
9
|
import { ChildTaskWaits, RESUME_CATALOG_TIMEOUT_MS, buildSessionProjection, createChildCommandTaskOwner, createProjectTrustContext, getLatestCompactionBoundaryEntry, ignoredProjectSettingsWarning, prepareSessionOpenMarkers, providerAdmissionTimeout, resolveModelScopeWithDiagnostics, resolveWorktreeSnapshotSettings, resumeFailureMessage, resumeLookupError, scheduleSessionTempCleanup, startInteractiveEngineLiveness, withResumeLookupDeadline } from "./startup-0-3-DE2NCS6A.js";
|
|
10
10
|
import { SESSION_HISTORY_SCAN_ENTRIES, SessionAlreadyOpenError, SessionEntryError, isRpcRequestAcceptedFailure, isRpcTransportFailure, markRpcTransportFailure, rpcTransportError } from "./settings-startup-HXQLSUWM.js";
|
|
11
|
-
import { JsonlSessionStore, agentSessionPersistenceFailureMethods, agentSessionReleaseMethods, clearPersistenceFailure, enableReleaseWhenIdle, getLatestSessionSummary, notReopenable, noteMessageSaved, onSessionClose, parseReleaseWhenIdle, recordPersistenceFailure, repeatsShownUnsavedInput, rethrowUnlessReportedPersistenceFailure, sessionClosing } from "./startup-8-0-34CBHPZH.js";
|
|
12
|
-
import { ModelRuntime, WORKSPACE_WRITE_TOOL_NAMES, activatesOnRegistration, agentSessionModelsMethods, agentSessionRetryMethods, assertSessionManagerInWorktreeAsync, bindSessionWorkspace, buildSessionOptions, buildSystemPrompt, computeDeferExtensions, computeInteractiveEngineResourceDeferral, computeStartupInputCaptureEnabled, computeStartupTrustPromptPossible, createToolNameMatcher, deferFirstPromptModel, engineExtensionsCanDecide, ensureRetryPromise, extensionsCanDecideProjectTrust, findInitialModel, formatScopedModelList, getModelFastRoute, getSkillCatalog, isRegisteredToolAllowed, isToolActivatable, isToolDeclarationHidden, loginIsolatedApiKeyProvider, loginIsolatedOAuthProvider, loginRuntimeOAuthProvider, markRuntimeStreamFunction, mergeHeaders, pendingTaskCompletionIntents, rateLimitGuidance, recordSessionWorkspace, resolveDeferredStartupModel, resolveRestoredModelReference, retryIsCurrent, sessionAccountCheckpoint, startupErrorHandlerTokens, streamWithFastRoute, uncachedCopilotModelHint, unresolvedFallbackModelDiagnostics, withFastRouteStreamOptions, workspaceSessionCwdAsync } from "./startup-0-5-
|
|
13
|
-
import { autoDetectCompactionQuery, executeBashWithOperations, formatModelLabel, prepareCompactionBoundary } from "./startup-0-4-
|
|
14
|
-
import { ENGINE_SHUTDOWN_GRACE_MS, RpcClient, SessionWorktreeSnapshotRecorder, SettingsManager, agentSessionSummaryMethods, agentSessionTreeMethods, applyToolModifiers, buildInteractiveEngineArgs, canIsolateSessionStore, cancelSessionSubscriptions, continueSessionWhereItWorked, createLocalBashOperations, createLocalPowerShellOperations, currentWorktreeRestoreNotices, currentWorktreeRootMappings, defaultToolSelectionFor, findUnansweredToolCall, hasSubagentCaptures, inheritChildSessionOptionsWithDefaults, isPlainRuntimeMetadataCommand, notifyAgentPanelSourceHubRebound, parentHistoryNotices, pathExists, prepareInitialMessage, prepareSessionResume, projectSettingsChooseSessionStorage, registerHostStoragePackages, releaseSessionWorktrees, removeSavedModelRoutingSettings, removeSavedModelRoutingSettingsAsync, resolveAppMode, resolveCliPaths, resolveExcludedToolsForAppMode, resolveSessionStore, resumeStoreDir, runMigrations, runMigrationsAsync, savedProjectTrustAsync, sessionResumeOptions, shellCommandPrefixFor, shouldStartRpcCatalogRefresh, showDeprecationWarnings, subscribeSession, takeEngineSessionStorageArg, toPrintOutputMode } from "./startup-8-1-
|
|
15
|
-
import { abortCurrentGeneration, activatesAfterRecordedLoadout, agentSessionCustomMessageCommitMethods, agentSessionDetachedToolMethods, agentSessionMessageQueueMethods, agentSessionPromptMethods, agentSessionStateMethods, agentSessionTaskMethods, agentSessionToolHooksMethods, agentSessionToolRegistryMethods, awaitedToolTurnEntryId, bindChildTaskNotices, blueprintSubject, childCommandTaskHost, dismissProtectedStreamingCustomMessage, forgetQueuedMessageReceipt, holdsTurnsForDetachedResults, installQueuedMessageTaking, isDetachedToolCall, isProtectedStreamingCustomMessage, isSubagentChildSession, markProtectedStreamingCustomMessageConsumed, markProtectedStreamingCustomMessagePersistenceFailed, normalizeQueuedMessageImages, openChildCommandTaskHost, pendingProtectedStreamingCustomMessages, pendingResumeUpdate, persistProtectedStreamingCustomMessage, prepareProtectedStreamingCustomMessagesForDisposal, preservesInitialToolLoadout, queueRunStarted, queuedMessageReceiptId, recordExplicitToolDeactivations, recordedToolLoadout, recoverProtectedStreamingCustomMessages, releaseDetachedCallHolds, replaceSessionTaskOwner, requeueQueuedMessagesNotStarted, retryConsumedProtectedStreamingCustomMessages, startQueuedMessage, withoutDetachedPlaceholders } from "./startup-15-0-
|
|
16
|
-
import { SessionManager, SessionSelectorConflictError, agentSessionExportMethods, createResumeProgress, openCliSession, openSessionInCurrentCwdOrExit, promptForDirtyCheckout, promptForMissingSessionCwd, recordPromptOrder, refreshSessionStorage, sessionStorageWouldMove, startupResumeDiagnostics, validateForkFlags, validateImportFlags, validateSessionIdFlags } from "./startup-10-0-
|
|
11
|
+
import { JsonlSessionStore, MemorySessionStore, agentSessionPersistenceFailureMethods, agentSessionReleaseMethods, clearPersistenceFailure, createSessionId, enableReleaseWhenIdle, getLatestSessionSummary, notReopenable, noteMessageSaved, onSessionClose, parseReleaseWhenIdle, recordPersistenceFailure, repeatsShownUnsavedInput, rethrowUnlessReportedPersistenceFailure, sessionClosing } from "./startup-8-0-34CBHPZH.js";
|
|
12
|
+
import { ModelRuntime, WORKSPACE_WRITE_TOOL_NAMES, activatesOnRegistration, agentSessionModelsMethods, agentSessionRetryMethods, assertSessionManagerInWorktreeAsync, bindSessionWorkspace, buildSessionOptions, buildSystemPrompt, computeDeferExtensions, computeInteractiveEngineResourceDeferral, computeStartupInputCaptureEnabled, computeStartupTrustPromptPossible, createToolNameMatcher, deferFirstPromptModel, engineExtensionsCanDecide, ensureRetryPromise, extensionsCanDecideProjectTrust, findInitialModel, formatScopedModelList, getModelFastRoute, getSkillCatalog, isRegisteredToolAllowed, isToolActivatable, isToolDeclarationHidden, loginIsolatedApiKeyProvider, loginIsolatedOAuthProvider, loginRuntimeOAuthProvider, markRuntimeStreamFunction, mergeHeaders, pendingTaskCompletionIntents, rateLimitGuidance, recordSessionWorkspace, resolveDeferredStartupModel, resolveRestoredModelReference, retryIsCurrent, sessionAccountCheckpoint, startupErrorHandlerTokens, streamWithFastRoute, uncachedCopilotModelHint, unresolvedFallbackModelDiagnostics, withFastRouteStreamOptions, workspaceSessionCwdAsync } from "./startup-0-5-DNS6FYS7.js";
|
|
13
|
+
import { autoDetectCompactionQuery, executeBashWithOperations, formatModelLabel, prepareCompactionBoundary } from "./startup-0-4-6XXL4JMZ.js";
|
|
14
|
+
import { ENGINE_SHUTDOWN_GRACE_MS, RpcClient, SessionWorktreeSnapshotRecorder, SettingsManager, agentSessionSummaryMethods, agentSessionTreeMethods, applyToolModifiers, buildInteractiveEngineArgs, canIsolateSessionStore, cancelSessionSubscriptions, continueSessionWhereItWorked, createLocalBashOperations, createLocalPowerShellOperations, currentWorktreeRestoreNotices, currentWorktreeRootMappings, defaultToolSelectionFor, findUnansweredToolCall, hasSubagentCaptures, inheritChildSessionOptionsWithDefaults, isPlainRuntimeMetadataCommand, notifyAgentPanelSourceHubRebound, parentHistoryNotices, pathExists, prepareInitialMessage, prepareSessionResume, projectSettingsChooseSessionStorage, registerHostStoragePackages, releaseSessionWorktrees, removeSavedModelRoutingSettings, removeSavedModelRoutingSettingsAsync, resolveAppMode, resolveCliPaths, resolveExcludedToolsForAppMode, resolveSessionStore, resumeStoreDir, runMigrations, runMigrationsAsync, savedProjectTrustAsync, sessionResumeOptions, shellCommandPrefixFor, shouldStartRpcCatalogRefresh, showDeprecationWarnings, subscribeSession, takeEngineSessionStorageArg, toPrintOutputMode } from "./startup-8-1-VXBL37AI.js";
|
|
15
|
+
import { abortCurrentGeneration, activatesAfterRecordedLoadout, agentSessionCustomMessageCommitMethods, agentSessionDetachedToolMethods, agentSessionMessageQueueMethods, agentSessionPromptMethods, agentSessionStateMethods, agentSessionTaskMethods, agentSessionToolHooksMethods, agentSessionToolRegistryMethods, awaitedToolTurnEntryId, bindChildTaskNotices, blueprintSubject, childCommandTaskHost, dismissProtectedStreamingCustomMessage, forgetQueuedMessageReceipt, holdsTurnsForDetachedResults, installQueuedMessageTaking, isDetachedToolCall, isProtectedStreamingCustomMessage, isSubagentChildSession, markProtectedStreamingCustomMessageConsumed, markProtectedStreamingCustomMessagePersistenceFailed, normalizeQueuedMessageImages, openChildCommandTaskHost, pauseQueuedMessages, pendingProtectedStreamingCustomMessages, pendingResumeUpdate, persistProtectedStreamingCustomMessage, prepareProtectedStreamingCustomMessagesForDisposal, preservesInitialToolLoadout, queueRunStarted, queuedMessageReceiptId, recordExplicitToolDeactivations, recordedToolLoadout, recoverProtectedStreamingCustomMessages, releaseDetachedCallHolds, replaceSessionTaskOwner, requeueQueuedMessagesNotStarted, retryConsumedProtectedStreamingCustomMessages, startQueuedMessage, withoutDetachedPlaceholders } from "./startup-15-0-E7RYG5YF.js";
|
|
16
|
+
import { SessionManager, SessionSelectorConflictError, agentSessionExportMethods, createResumeProgress, openCliSession, openSessionInCurrentCwdOrExit, promptForDirtyCheckout, promptForMissingSessionCwd, recordPromptOrder, refreshSessionStorage, sessionStorageWouldMove, startupResumeDiagnostics, validateForkFlags, validateImportFlags, validateSessionIdFlags } from "./startup-10-0-O6DAT7U4.js";
|
|
17
17
|
import { captureInteractiveEngineStartupEnv, discardPrewarmedEngine, interactiveEngineClientOptions, interactiveEngineStartupEnv, isInteractiveEngineChild } from "./p1a-prewarm-XIU57JHF.js";
|
|
18
18
|
import { builtInExtensions, factoryAcquisitions, factoryRollbackError, recordFactoryAcquisitions, rollbackFactoryAcquisitions } from "./startup-12-0-55AAXBJZ.js";
|
|
19
19
|
import { DefaultResourceLoader, ExtensionRunner, canCloneDefaultResourceDiscovery, canPrepareDeferredStartupCompletion, emitSessionShutdownEvent, formatBorrowedExtensionSourceTrustPrompt, getDeferredInitialSettingsSnapshot, isMandatoryResourceLoader, isolateMandatoryResourceLoader, limitMandatoryIntercomToTool, mandatoryLoaderCoversBuiltins, prepareDefaultResourceLoaderReload, prepareDeferredStartupCompletion, resolveProjectTrusted, stockResourceDiscovery, withBuiltinResourceLoader, withMandatoryResourceLoader } from "./startup-14-0-MLX36RBG.js";
|
|
@@ -159,6 +159,12 @@ const agentSessionBashMethods = {
|
|
|
159
159
|
};
|
|
160
160
|
// dist/core/agent-session-events.js
|
|
161
161
|
function _emit(event) {
|
|
162
|
+
if (isSessionLoadEvent(event)) {
|
|
163
|
+
for (const listener of this._eventListeners) try {
|
|
164
|
+
listener(event);
|
|
165
|
+
} catch {}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
162
168
|
if (event.type === "agent_start") {
|
|
163
169
|
if (this._retryStatus === void 0 || this._turnStartedAt === void 0) this._turnStartedAt = Date.now();
|
|
164
170
|
event = {
|
|
@@ -634,6 +640,14 @@ function subscribe(listenerOrSource, handler, options) {
|
|
|
634
640
|
if (typeof listenerOrSource !== "function") return subscribeSession(this, listenerOrSource, handler, options);
|
|
635
641
|
const listener = listenerOrSource;
|
|
636
642
|
this._eventListeners = [...this._eventListeners, listener];
|
|
643
|
+
replaySessionOpen(this, listener);
|
|
644
|
+
const warning = this.sessionManager.getHistoryWarning();
|
|
645
|
+
if (warning !== void 0) listener(warning);
|
|
646
|
+
const repaired = this.sessionManager.getImportRepairs();
|
|
647
|
+
if (repaired.length > 0) listener({
|
|
648
|
+
type: "session_history_repaired",
|
|
649
|
+
repaired
|
|
650
|
+
});
|
|
637
651
|
return () => {
|
|
638
652
|
const index = this._eventListeners.indexOf(listener);
|
|
639
653
|
if (index !== -1) this._eventListeners = this._eventListeners.filter((_, position) => position !== index);
|
|
@@ -661,10 +675,11 @@ function isSessionQuitting(session) {
|
|
|
661
675
|
return sessionClosures.get(session)?.quitting === true;
|
|
662
676
|
}
|
|
663
677
|
/** Shared terminal boundary for direct SDK disposal and runtime replacement. */
|
|
664
|
-
function closeAgentSession(session,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
678
|
+
function closeAgentSession(session, request, beforeInvalidate) {
|
|
679
|
+
const event = request ?? {
|
|
680
|
+
type: "session_shutdown",
|
|
681
|
+
reason: "quit"
|
|
682
|
+
};
|
|
668
683
|
const reason = event.reason;
|
|
669
684
|
const handoff = reason !== "quit" && hasCallingSessionWork(session);
|
|
670
685
|
const existing = sessionClosures.get(session);
|
|
@@ -696,7 +711,10 @@ function closeAgentSession(session, event = {
|
|
|
696
711
|
});
|
|
697
712
|
await attempt("event subscriptions", () => cancelSessionSubscriptions(session));
|
|
698
713
|
await attempt("shell abort", () => abortBash.call(session));
|
|
699
|
-
await attempt("abort", () =>
|
|
714
|
+
await attempt("abort", () => {
|
|
715
|
+
if (request?.reason === "quit") pauseQueuedMessages.call(session);
|
|
716
|
+
return abortCurrentGeneration.call(session);
|
|
717
|
+
});
|
|
700
718
|
releaseToolAbortGraceTimers(session);
|
|
701
719
|
await attempt("reload rollback", () => drainSessionReload(session));
|
|
702
720
|
await attempt("tasks", () => session.closeSessionTasks());
|
|
@@ -3173,6 +3191,10 @@ function _bindExtensionCore(runner, publication, startupToolNames, startupLoadou
|
|
|
3173
3191
|
else this._extensionShutdownHandler?.();
|
|
3174
3192
|
},
|
|
3175
3193
|
getContextUsage: () => this.getContextUsage(),
|
|
3194
|
+
getSubscriptionUsage: async (options) => {
|
|
3195
|
+
const { loadSubscriptionUsage } = await import("../core/subscription-usage.js").catch((error) => __atomicOnDemandFailed(error, "this feature"));
|
|
3196
|
+
return loadSubscriptionUsage(this.modelRuntime, this.model?.provider, options);
|
|
3197
|
+
},
|
|
3176
3198
|
compact: (options) => {
|
|
3177
3199
|
const compact = async () => {
|
|
3178
3200
|
try {
|
|
@@ -3215,9 +3237,16 @@ function _bindExtensionCore(runner, publication, startupToolNames, startupLoadou
|
|
|
3215
3237
|
});
|
|
3216
3238
|
}
|
|
3217
3239
|
async function reload(options) {
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3240
|
+
const run = async () => {
|
|
3241
|
+
if (this._disposed || sessionGenerationClosing.has(this) || hasSessionReload(this)) throw hostInputError("SessionClosed");
|
|
3242
|
+
sessionGenerationClosing.add(this);
|
|
3243
|
+
return trackSessionReload(this, () => reloadAdmitted.call(this, options));
|
|
3244
|
+
};
|
|
3245
|
+
if (options?.reason === "startup") return run();
|
|
3246
|
+
return withSessionLoadEvents(this.sessionId, (event) => this._emit(event), (phase) => {
|
|
3247
|
+
phase("Reloading session");
|
|
3248
|
+
return run();
|
|
3249
|
+
});
|
|
3221
3250
|
}
|
|
3222
3251
|
async function reloadAdmitted(options) {
|
|
3223
3252
|
const retiringRunner = this._extensionRunner;
|
|
@@ -4119,6 +4148,10 @@ var AgentSessionBase = class {
|
|
|
4119
4148
|
...notice
|
|
4120
4149
|
})
|
|
4121
4150
|
});
|
|
4151
|
+
this.sessionManager.bindHistoryRepairs((repaired) => this._emit({
|
|
4152
|
+
type: "session_history_repaired",
|
|
4153
|
+
repaired
|
|
4154
|
+
}));
|
|
4122
4155
|
this.settingsManager = config.settingsManager;
|
|
4123
4156
|
this._scopedModels = config.scopedModels ?? [];
|
|
4124
4157
|
this._configuredFallbackModels = config.fallbackModels;
|
|
@@ -4367,8 +4400,14 @@ function closeFailure(session, failure) {
|
|
|
4367
4400
|
* just before the switch.
|
|
4368
4401
|
*/
|
|
4369
4402
|
const HOST_STARTED_SESSION = Symbol("host-started-session");
|
|
4403
|
+
function interactiveEngineClaimHostPid() {
|
|
4404
|
+
const env = interactiveEngineStartupEnv();
|
|
4405
|
+
return env.child === "1" && env.hostPid !== void 0 ? Number(env.hostPid) : void 0;
|
|
4406
|
+
}
|
|
4370
4407
|
var AgentSessionRuntime = class {
|
|
4371
4408
|
rebindSession;
|
|
4409
|
+
listeners = /* @__PURE__ */ new Set();
|
|
4410
|
+
unsubscribeSessionEvents;
|
|
4372
4411
|
beforeSessionInvalidate;
|
|
4373
4412
|
projectTrustContextFactory;
|
|
4374
4413
|
closed = false;
|
|
@@ -4411,16 +4450,34 @@ var AgentSessionRuntime = class {
|
|
|
4411
4450
|
}
|
|
4412
4451
|
await finalize();
|
|
4413
4452
|
}
|
|
4414
|
-
|
|
4453
|
+
/** The isolated host views sessions already opened by its writer, the engine. */
|
|
4454
|
+
sessionClaimMirror = false;
|
|
4455
|
+
claimSessionTarget(sessionId, borrowHost = false) {
|
|
4456
|
+
return acquireLiveSessionClaim(sessionId, {
|
|
4457
|
+
agentDir: this.services.agentDir,
|
|
4458
|
+
mirror: this.sessionClaimMirror,
|
|
4459
|
+
hostPid: borrowHost ? interactiveEngineClaimHostPid() : void 0
|
|
4460
|
+
});
|
|
4461
|
+
}
|
|
4462
|
+
replace(target, operation) {
|
|
4463
|
+
return withSessionLoadEvents(target, (event) => this.emitEvent(event), (phase) => this.replaceOperation((claim) => operation(phase, claim)), ({ cancelled }) => cancelled);
|
|
4464
|
+
}
|
|
4465
|
+
replaceOperation(operation) {
|
|
4415
4466
|
registerSessionRetirement(this.session);
|
|
4416
4467
|
return this.admit(async () => {
|
|
4417
4468
|
this.replacements++;
|
|
4418
4469
|
let outcome;
|
|
4470
|
+
let releaseClaim;
|
|
4419
4471
|
try {
|
|
4420
|
-
outcome = { value: await operation() }
|
|
4472
|
+
outcome = { value: await operation(async (id, { borrowHost, persisted = this.session.sessionManager.isPersisted() } = {}) => {
|
|
4473
|
+
if (persisted) releaseClaim = await this.claimSessionTarget(id, borrowHost);
|
|
4474
|
+
this.assertOpen();
|
|
4475
|
+
}) };
|
|
4421
4476
|
} catch (error) {
|
|
4422
4477
|
outcome = { error };
|
|
4423
4478
|
this.retainCleanupFailures(error);
|
|
4479
|
+
} finally {
|
|
4480
|
+
await releaseClaim?.();
|
|
4424
4481
|
}
|
|
4425
4482
|
this.replacements--;
|
|
4426
4483
|
if (this.replacements === 0 && this.session._disposed) try {
|
|
@@ -4444,6 +4501,26 @@ var AgentSessionRuntime = class {
|
|
|
4444
4501
|
}
|
|
4445
4502
|
return trackSessionWork(this, operation);
|
|
4446
4503
|
}
|
|
4504
|
+
/** Subscribe to the active session's events across replacements. Replays this runtime's initial open. */
|
|
4505
|
+
subscribe(listener) {
|
|
4506
|
+
const subscription = (event) => listener(event);
|
|
4507
|
+
this.listeners.add(subscription);
|
|
4508
|
+
if (this.listeners.size === 1) this.bindSessionEvents();
|
|
4509
|
+
replaySessionOpen(this, subscription);
|
|
4510
|
+
return () => {
|
|
4511
|
+
this.listeners.delete(subscription);
|
|
4512
|
+
if (this.listeners.size === 0) this.bindSessionEvents();
|
|
4513
|
+
};
|
|
4514
|
+
}
|
|
4515
|
+
bindSessionEvents() {
|
|
4516
|
+
this.unsubscribeSessionEvents?.();
|
|
4517
|
+
this.unsubscribeSessionEvents = this.listeners.size > 0 ? this._session.subscribe((event) => this.emitEvent(event)) : void 0;
|
|
4518
|
+
}
|
|
4519
|
+
emitEvent(event) {
|
|
4520
|
+
for (const listener of [...this.listeners]) try {
|
|
4521
|
+
listener(event);
|
|
4522
|
+
} catch {}
|
|
4523
|
+
}
|
|
4447
4524
|
/** Bind a process-local trust UI; closures never cross the engine RPC boundary. */
|
|
4448
4525
|
setProjectTrustContextFactory(factory) {
|
|
4449
4526
|
this.projectTrustContextFactory = factory;
|
|
@@ -4732,6 +4809,7 @@ var AgentSessionRuntime = class {
|
|
|
4732
4809
|
this._diagnostics = result.diagnostics;
|
|
4733
4810
|
this._modelFallbackMessage = result.modelFallbackMessage;
|
|
4734
4811
|
this._modelFallbackReason = result.modelFallbackReason;
|
|
4812
|
+
this.bindSessionEvents();
|
|
4735
4813
|
if (setup) {
|
|
4736
4814
|
await setup(result.session.sessionManager);
|
|
4737
4815
|
this.assertOpen();
|
|
@@ -4781,10 +4859,11 @@ var AgentSessionRuntime = class {
|
|
|
4781
4859
|
* (a checkout whose snapshot record it lacks, #4744), which the caller queues once the switch succeeds; a mirror of
|
|
4782
4860
|
* a resume another process prepared gets that process's notices instead, so it has none.
|
|
4783
4861
|
*/
|
|
4784
|
-
async resumeWorktree(sessionManager, sessionDirectory, entryPoint = "switch-session") {
|
|
4862
|
+
async resumeWorktree(sessionManager, sessionDirectory, entryPoint = "switch-session", onProgress) {
|
|
4785
4863
|
const prepared = await prepareSessionResume(sessionManager, {
|
|
4786
4864
|
...this.resumeOptions(entryPoint),
|
|
4787
|
-
sessionDirectory
|
|
4865
|
+
sessionDirectory,
|
|
4866
|
+
onProgress
|
|
4788
4867
|
});
|
|
4789
4868
|
if (prepared.status !== "ready") return {
|
|
4790
4869
|
sessionManager,
|
|
@@ -4823,15 +4902,26 @@ var AgentSessionRuntime = class {
|
|
|
4823
4902
|
};
|
|
4824
4903
|
}
|
|
4825
4904
|
async switchSession(sessionId, options) {
|
|
4826
|
-
return this.replace(async () => {
|
|
4905
|
+
return this.replace(sessionId, async (phase, claim) => {
|
|
4827
4906
|
const beforeResult = await this.emitBeforeSwitch("resume", sessionId);
|
|
4828
4907
|
this.assertOpen();
|
|
4829
4908
|
if (beforeResult.cancelled) return beforeResult;
|
|
4830
4909
|
const previousSessionId = this.session.sessionId;
|
|
4831
|
-
|
|
4910
|
+
await claim(sessionId, {
|
|
4911
|
+
borrowHost: sessionId === previousSessionId || options?.startedSession === HOST_STARTED_SESSION,
|
|
4912
|
+
persisted: options?.sessionDirectory !== void 0 || this.session.sessionManager.isPersisted()
|
|
4913
|
+
});
|
|
4914
|
+
const onProgress = options?.onProgress;
|
|
4915
|
+
const report = onProgress ? (message, entries) => {
|
|
4916
|
+
onProgress(message);
|
|
4917
|
+
phase(message, entries);
|
|
4918
|
+
} : phase;
|
|
4919
|
+
const openHistory = () => this.boundedSessionLookup(this.session.sessionManager.openSessionById(sessionId, options?.cwdOverride, options?.sessionDirectory, { history: options?.history }), sessionId);
|
|
4920
|
+
report("Reading session history");
|
|
4921
|
+
const opened = await observeSessionLoadHistory(report, openHistory);
|
|
4832
4922
|
if (options?.startedSession === HOST_STARTED_SESSION) opened.markSessionStarted();
|
|
4833
4923
|
else if (options?.startedSession instanceof SessionManager) await options.startedSession.handOverStartedSession(opened);
|
|
4834
|
-
const { sessionManager, unrecorded } = await this.resumeWorktree(opened, options?.sessionDirectory);
|
|
4924
|
+
const { sessionManager, unrecorded } = await this.resumeWorktree(opened, options?.sessionDirectory, "switch-session", report);
|
|
4835
4925
|
const missingCwd = await findMissingSessionCwdIssueAsync(sessionManager, this.cwd);
|
|
4836
4926
|
if (missingCwd !== void 0) throw new MissingSessionCwdError(missingCwd);
|
|
4837
4927
|
const runtimeOptions = {
|
|
@@ -4845,6 +4935,7 @@ var AgentSessionRuntime = class {
|
|
|
4845
4935
|
},
|
|
4846
4936
|
projectTrustContext: (options?.projectTrustContextFactory ?? this.projectTrustContextFactory)?.(sessionManager.getCwd())
|
|
4847
4937
|
};
|
|
4938
|
+
report("Preparing session");
|
|
4848
4939
|
await this.settleActiveResponseBeforeTeardown();
|
|
4849
4940
|
this.assertOpen();
|
|
4850
4941
|
const complete = await this.createRuntime.prepareResume?.(runtimeOptions);
|
|
@@ -4856,12 +4947,18 @@ var AgentSessionRuntime = class {
|
|
|
4856
4947
|
});
|
|
4857
4948
|
}
|
|
4858
4949
|
async newSession(options) {
|
|
4859
|
-
return this.replace(async () => {
|
|
4950
|
+
return this.replace(this.cwd, async (phase, claim) => {
|
|
4860
4951
|
const beforeResult = await this.emitBeforeSwitch("new");
|
|
4861
4952
|
this.assertOpen();
|
|
4862
4953
|
if (beforeResult.cancelled) return beforeResult;
|
|
4954
|
+
phase("Starting session");
|
|
4863
4955
|
const previousSessionId = this.session.sessionId;
|
|
4864
|
-
const
|
|
4956
|
+
const id = createSessionId();
|
|
4957
|
+
await claim(id);
|
|
4958
|
+
const sessionManager = await SessionManager.create(this.session.sessionManager.getSessionStore(), this.cwd, {
|
|
4959
|
+
id,
|
|
4960
|
+
parentSession: options?.parentSession
|
|
4961
|
+
});
|
|
4865
4962
|
await this.teardownCurrent("new", sessionManager.getSessionId());
|
|
4866
4963
|
await this.apply(await this.createRuntime({
|
|
4867
4964
|
cwd: this.cwd,
|
|
@@ -4877,11 +4974,12 @@ var AgentSessionRuntime = class {
|
|
|
4877
4974
|
});
|
|
4878
4975
|
}
|
|
4879
4976
|
async fork(entryId, options) {
|
|
4880
|
-
return this.replace(async () => {
|
|
4977
|
+
return this.replace(this.session.sessionId, async (phase, claim) => {
|
|
4881
4978
|
const position = options?.position ?? "before";
|
|
4882
4979
|
const beforeResult = await this.emitBeforeFork(entryId, { position });
|
|
4883
4980
|
this.assertOpen();
|
|
4884
4981
|
if (beforeResult.cancelled) return { cancelled: true };
|
|
4982
|
+
phase(position === "at" ? "Cloning session" : "Forking session");
|
|
4885
4983
|
let targetLeafId;
|
|
4886
4984
|
let selectedText;
|
|
4887
4985
|
const selectedEntry = await this.session.sessionManager.readEntry(entryId);
|
|
@@ -4889,13 +4987,20 @@ var AgentSessionRuntime = class {
|
|
|
4889
4987
|
if (position === "at") targetLeafId = selectedEntry.id;
|
|
4890
4988
|
else {
|
|
4891
4989
|
if (selectedEntry.type !== "message" || selectedEntry.message.role !== "user") throw new SessionEntryError(entryId, "not-forkable");
|
|
4892
|
-
targetLeafId = selectedEntry
|
|
4990
|
+
targetLeafId = await this.session.sessionManager.readParentId(selectedEntry);
|
|
4893
4991
|
selectedText = extractUserMessageText(selectedEntry.message.content);
|
|
4894
4992
|
}
|
|
4993
|
+
this.assertOpen();
|
|
4895
4994
|
const previousSessionId = this.session.sessionId;
|
|
4896
|
-
const
|
|
4897
|
-
|
|
4898
|
-
|
|
4995
|
+
const openHistory = () => this.session.sessionManager.openSessionById(previousSessionId, this.session.sessionManager.getCwd());
|
|
4996
|
+
const sessionManager = await observeSessionLoadHistory(phase, openHistory);
|
|
4997
|
+
const id = createSessionId();
|
|
4998
|
+
await claim(id);
|
|
4999
|
+
if (!targetLeafId) await sessionManager.newSession({
|
|
5000
|
+
id,
|
|
5001
|
+
parentSession: previousSessionId
|
|
5002
|
+
});
|
|
5003
|
+
else await sessionManager.createBranchedSession(targetLeafId, { id });
|
|
4899
5004
|
await this.teardownCurrent("fork", sessionManager.getSessionId());
|
|
4900
5005
|
await this.apply(await this.createRuntime({
|
|
4901
5006
|
cwd: sessionManager.getCwd(),
|
|
@@ -4915,13 +5020,14 @@ var AgentSessionRuntime = class {
|
|
|
4915
5020
|
}
|
|
4916
5021
|
/** Import a format-4 JSONL export into the active session store. */
|
|
4917
5022
|
async importFromJsonl(inputPath, cwdOverride) {
|
|
4918
|
-
return this.replace(async () => {
|
|
5023
|
+
return this.replace(inputPath, async (phase, claim) => {
|
|
5024
|
+
phase("Importing session");
|
|
4919
5025
|
const resolvedPath = resolvePath(inputPath);
|
|
4920
5026
|
if (!await pathExists(resolvedPath)) throw new SessionImportFileNotFoundError(resolvedPath);
|
|
4921
5027
|
const source = await JsonlSessionStore.open(dirname(resolvedPath), { scanExisting: false });
|
|
4922
5028
|
let targetSessionId;
|
|
4923
5029
|
try {
|
|
4924
|
-
targetSessionId = (await source.loadFile(resolvedPath)).header.id;
|
|
5030
|
+
targetSessionId = (await source.loadFile(resolvedPath, { persistUpgrade: false })).header.id;
|
|
4925
5031
|
} finally {
|
|
4926
5032
|
await source.close();
|
|
4927
5033
|
}
|
|
@@ -4929,7 +5035,10 @@ var AgentSessionRuntime = class {
|
|
|
4929
5035
|
this.assertOpen();
|
|
4930
5036
|
if (beforeResult.cancelled) return beforeResult;
|
|
4931
5037
|
const previousSessionId = this.session.sessionId;
|
|
4932
|
-
const
|
|
5038
|
+
const importHistory = () => this.session.sessionManager.importFromJsonl(resolvedPath, cwdOverride, claim);
|
|
5039
|
+
const imported = await observeSessionLoadHistory(phase, importHistory);
|
|
5040
|
+
const repaired = imported.getImportRepairs();
|
|
5041
|
+
const { sessionManager, unrecorded } = await this.resumeWorktree(imported, void 0, "switch-session", phase);
|
|
4933
5042
|
const missingCwd = await findMissingSessionCwdIssueAsync(sessionManager, this.cwd);
|
|
4934
5043
|
if (missingCwd !== void 0) {
|
|
4935
5044
|
const failure = new MissingSessionCwdError(missingCwd);
|
|
@@ -4948,7 +5057,10 @@ var AgentSessionRuntime = class {
|
|
|
4948
5057
|
}
|
|
4949
5058
|
}));
|
|
4950
5059
|
this.resumeNoticeQueue.push(...unrecorded);
|
|
4951
|
-
return {
|
|
5060
|
+
return {
|
|
5061
|
+
cancelled: false,
|
|
5062
|
+
...repaired.length === 0 ? {} : { repaired }
|
|
5063
|
+
};
|
|
4952
5064
|
});
|
|
4953
5065
|
}
|
|
4954
5066
|
/**
|
|
@@ -4973,6 +5085,9 @@ var AgentSessionRuntime = class {
|
|
|
4973
5085
|
* they were restored. Lookups in shared storage are bounded as `/resume`'s are.
|
|
4974
5086
|
*/
|
|
4975
5087
|
rehydrate(sessionId, options) {
|
|
5088
|
+
return withSessionLoadEvents(sessionId, (event) => this.emitEvent(event), (phase) => this.rehydrateSession(sessionId, options?.history, phase));
|
|
5089
|
+
}
|
|
5090
|
+
rehydrateSession(sessionId, history, phase) {
|
|
4976
5091
|
return this.admit(async () => {
|
|
4977
5092
|
const current = this.session;
|
|
4978
5093
|
if (this.session.sessionId === sessionId && !current._disposed) return this.session;
|
|
@@ -4980,7 +5095,7 @@ var AgentSessionRuntime = class {
|
|
|
4980
5095
|
if (live !== void 0 && !live._disposed) return live;
|
|
4981
5096
|
const pending = this.rehydrating.get(sessionId);
|
|
4982
5097
|
if (pending !== void 0) return pending;
|
|
4983
|
-
const rehydration = this.rehydrateFromStore(sessionId,
|
|
5098
|
+
const rehydration = this.rehydrateFromStore(sessionId, history, phase);
|
|
4984
5099
|
this.rehydrating.set(sessionId, rehydration);
|
|
4985
5100
|
try {
|
|
4986
5101
|
return await rehydration;
|
|
@@ -4990,14 +5105,16 @@ var AgentSessionRuntime = class {
|
|
|
4990
5105
|
});
|
|
4991
5106
|
}
|
|
4992
5107
|
/** Where a rehydrated session continues, decided checkout by checkout; see {@link continueSessionWhereItWorked}. */
|
|
4993
|
-
continueWhereItWorked(opened, history) {
|
|
5108
|
+
continueWhereItWorked(opened, history, onProgress) {
|
|
4994
5109
|
const options = {
|
|
4995
5110
|
...this.resumeOptions("rehydrate"),
|
|
5111
|
+
onProgress,
|
|
4996
5112
|
onNotices: (notices) => this.queueResumeNotices(notices)
|
|
4997
5113
|
};
|
|
4998
5114
|
return continueSessionWhereItWorked(opened, options, (cwd) => this.boundedSessionLookup(opened.openSessionById(opened.getSessionId(), cwd, void 0, { history }), opened.getSessionId()));
|
|
4999
5115
|
}
|
|
5000
|
-
async rehydrateFromStore(sessionId, history) {
|
|
5116
|
+
async rehydrateFromStore(sessionId, history, phase) {
|
|
5117
|
+
phase?.("Reading session history");
|
|
5001
5118
|
const store = this.session.sessionManager.getSessionStore();
|
|
5002
5119
|
if (await this.boundedSessionLookup(store.readHeader(sessionId), sessionId) === void 0) {
|
|
5003
5120
|
const storage = store.descriptor.adapter;
|
|
@@ -5007,29 +5124,37 @@ var AgentSessionRuntime = class {
|
|
|
5007
5124
|
localOnly: isLocalOnlySessionStorage(storage)
|
|
5008
5125
|
});
|
|
5009
5126
|
}
|
|
5010
|
-
const
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
sessionManager
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5127
|
+
const releaseClaim = this.session.sessionManager.isPersisted() ? await this.claimSessionTarget(sessionId) : void 0;
|
|
5128
|
+
try {
|
|
5129
|
+
const openHistory = () => this.boundedSessionLookup(this.session.sessionManager.openSessionById(sessionId, void 0, void 0, { history }), sessionId);
|
|
5130
|
+
const opened = await (phase ? observeSessionLoadHistory(phase, openHistory) : openHistory());
|
|
5131
|
+
const sessionManager = await this.continueWhereItWorked(opened, history, phase);
|
|
5132
|
+
phase?.("Preparing session");
|
|
5133
|
+
const cwd = sessionManager.getCwd();
|
|
5134
|
+
const create = () => sessionLifecycleCreation.run({ scope: {} }, () => this.sessionFactory({
|
|
5135
|
+
cwd,
|
|
5136
|
+
agentDir: this.services.agentDir,
|
|
5137
|
+
sessionManager,
|
|
5138
|
+
sessionStartEvent: {
|
|
5139
|
+
type: "session_start",
|
|
5140
|
+
reason: "resume"
|
|
5141
|
+
},
|
|
5142
|
+
...cwd === this.services.cwd ? { services: this.services } : {}
|
|
5143
|
+
}));
|
|
5144
|
+
const session = (await (phase ? withSessionLoadPhase(phase, create) : create())).session;
|
|
5145
|
+
this.rehydrated.set(sessionId, session);
|
|
5146
|
+
onSessionClose(session, () => this.rehydrated.delete(sessionId));
|
|
5147
|
+
if (this.closed) {
|
|
5148
|
+
const cleanupCause = await session.dispose().then(() => void 0, (failure) => closeFailure(session, failure));
|
|
5149
|
+
throw Object.assign(/* @__PURE__ */ new Error("Session is closed"), {
|
|
5150
|
+
code: "SessionClosed",
|
|
5151
|
+
...cleanupCause === void 0 ? {} : { cleanupCause }
|
|
5152
|
+
});
|
|
5153
|
+
}
|
|
5154
|
+
return session;
|
|
5155
|
+
} finally {
|
|
5156
|
+
await releaseClaim?.();
|
|
5031
5157
|
}
|
|
5032
|
-
return session;
|
|
5033
5158
|
}
|
|
5034
5159
|
/** Number of live sessions this runtime rehydrated; counted by tests. */
|
|
5035
5160
|
get rehydratedSessionCount() {
|
|
@@ -5104,20 +5229,30 @@ var AgentSessionRuntime = class {
|
|
|
5104
5229
|
* later /new, /resume, /fork, and import flows.
|
|
5105
5230
|
*/
|
|
5106
5231
|
async function createAgentSessionRuntime(createRuntime, options) {
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
return new AgentSessionRuntime(result.session, result.services, createRuntime, result.diagnostics, result.modelFallbackMessage, result.modelFallbackReason, options.interactive);
|
|
5111
|
-
} catch (error) {
|
|
5112
|
-
const store = ownedSessionManagerStores.get(options.sessionManager);
|
|
5113
|
-
ownedSessionManagerStores.delete(options.sessionManager);
|
|
5232
|
+
return withInitialSessionLoad(options.sessionManager.getSessionId(), async (phase) => {
|
|
5233
|
+
phase("Preparing session");
|
|
5234
|
+
let releaseClaim;
|
|
5114
5235
|
try {
|
|
5115
|
-
await
|
|
5116
|
-
|
|
5117
|
-
|
|
5236
|
+
if (options.sessionManager.isPersisted()) releaseClaim = await acquireLiveSessionClaim(options.sessionManager.getSessionId(), {
|
|
5237
|
+
agentDir: options.agentDir,
|
|
5238
|
+
hostPid: interactiveEngineClaimHostPid()
|
|
5239
|
+
});
|
|
5240
|
+
await assertSessionCwdExists(options.sessionManager, options.cwd);
|
|
5241
|
+
const result = await observeSessionLoadHistory(phase, () => sessionLifecycleCreation.run({ scope: {} }, () => createRuntime(options)));
|
|
5242
|
+
return new AgentSessionRuntime(result.session, result.services, createRuntime, result.diagnostics, result.modelFallbackMessage, result.modelFallbackReason, options.interactive);
|
|
5243
|
+
} catch (error) {
|
|
5244
|
+
const store = ownedSessionManagerStores.get(options.sessionManager);
|
|
5245
|
+
ownedSessionManagerStores.delete(options.sessionManager);
|
|
5246
|
+
try {
|
|
5247
|
+
await store?.close();
|
|
5248
|
+
} catch (cause) {
|
|
5249
|
+
throw new StorageRollbackError(error, cause);
|
|
5250
|
+
}
|
|
5251
|
+
throw error;
|
|
5252
|
+
} finally {
|
|
5253
|
+
await releaseClaim?.();
|
|
5118
5254
|
}
|
|
5119
|
-
|
|
5120
|
-
}
|
|
5255
|
+
}, (runtime) => runtime);
|
|
5121
5256
|
}
|
|
5122
5257
|
// dist/core/sdk.js
|
|
5123
5258
|
setDefaultStreamFn(streamSimple);
|
|
@@ -5180,13 +5315,18 @@ function sessionIntercomPolicyFor(options) {
|
|
|
5180
5315
|
return options.intercom === void 0 ? void 0 : SessionIntercomPolicy.fromOptions(options.intercom);
|
|
5181
5316
|
}
|
|
5182
5317
|
async function createAgentSession(options = {}) {
|
|
5183
|
-
return createScopedSession(options, false);
|
|
5318
|
+
if (sessionLifecycleCreation.getStore()?.replacement) return createScopedSession(options, false);
|
|
5319
|
+
const target = options.sessionManager?.getSessionId() ?? options.cwd ?? process.cwd();
|
|
5320
|
+
return withInitialSessionLoad(target, (phase) => {
|
|
5321
|
+
phase("Preparing session");
|
|
5322
|
+
return observeSessionLoadHistory(phase, () => createScopedSession(options, false, true, true, phase));
|
|
5323
|
+
}, (result) => result.session);
|
|
5184
5324
|
}
|
|
5185
5325
|
/** Internal CLI assembly seam. Not exported from the package entrypoint. */
|
|
5186
5326
|
function createUnstartedAgentSession(options, persistInitialState = true, recoverMissingModel = false) {
|
|
5187
5327
|
return createScopedSession(options, true, persistInitialState, recoverMissingModel);
|
|
5188
5328
|
}
|
|
5189
|
-
function createScopedSession(options, deferStart, persistInitialState = true, recoverMissingModel = !deferStart) {
|
|
5329
|
+
function createScopedSession(options, deferStart, persistInitialState = true, recoverMissingModel = !deferStart, phase) {
|
|
5190
5330
|
let releaseWhenIdle;
|
|
5191
5331
|
try {
|
|
5192
5332
|
const nativeProblem = nativeModuleProblem();
|
|
@@ -5220,7 +5360,7 @@ function createScopedSession(options, deferStart, persistInitialState = true, re
|
|
|
5220
5360
|
extensionBindings: options.extensionBindings ?? context.bindings,
|
|
5221
5361
|
resourceAdmission: admission
|
|
5222
5362
|
};
|
|
5223
|
-
return await constructAgentSession(scopedOptions, deferStart, persistInitialState, acquisition, recoverMissingModel && (Object.hasOwn(scopedOptions, "model") ? !scopedOptions.model : !("model" in scopedOptions)));
|
|
5363
|
+
return await constructAgentSession(scopedOptions, deferStart, persistInitialState, acquisition, recoverMissingModel && (Object.hasOwn(scopedOptions, "model") ? !scopedOptions.model : !("model" in scopedOptions)), phase);
|
|
5224
5364
|
} catch (error) {
|
|
5225
5365
|
if (acquisition.resumed) await releaseSessionWorktrees(acquisition.resumed);
|
|
5226
5366
|
const failures = await rollbackFactoryAcquisitions();
|
|
@@ -5231,6 +5371,8 @@ function createScopedSession(options, deferStart, persistInitialState = true, re
|
|
|
5231
5371
|
}
|
|
5232
5372
|
if (!failures.length) await acquisition.release?.();
|
|
5233
5373
|
throw factoryRollbackError(error, failures);
|
|
5374
|
+
} finally {
|
|
5375
|
+
await acquisition.releaseClaim?.();
|
|
5234
5376
|
}
|
|
5235
5377
|
});
|
|
5236
5378
|
sessionLifecycleScopes.set(result.session, context.scope);
|
|
@@ -5255,23 +5397,25 @@ async function acquireSessionPermit(admission, options) {
|
|
|
5255
5397
|
* unless `resume.waitForBlueprint` is `"prompt"`. The checkout is compared under the `snapshots` the session itself records with. A session
|
|
5256
5398
|
* without snapshots is returned unchanged, so creating it costs no Git call.
|
|
5257
5399
|
*/
|
|
5258
|
-
async function sessionResumedOnThisNode(sessionManager, agentDir, settingsManager, snapshots) {
|
|
5400
|
+
async function sessionResumedOnThisNode(sessionManager, agentDir, settingsManager, snapshots, onProgress) {
|
|
5259
5401
|
if (sessionManager === void 0 || !sessionManager.isPersisted()) return sessionManager;
|
|
5260
5402
|
if (sessionManager.getLatestWorktreeSnapshots().size === 0 && !hasSubagentCaptures(sessionManager)) return sessionManager;
|
|
5261
5403
|
const settings = settingsManager ?? await SettingsManager.createAsync(process.cwd(), agentDir);
|
|
5262
5404
|
const prepared = await prepareSessionResume(sessionManager, {
|
|
5263
5405
|
...sessionResumeOptions("create-agent-session", process.cwd(), agentDir, settings, savedProjectTrustAsync(agentDir, settings), false),
|
|
5264
|
-
settings: resolveWorktreeSnapshotSettings(snapshots, "sdk", "snapshots", settings.getWorktreeSnapshotSettings())
|
|
5406
|
+
settings: resolveWorktreeSnapshotSettings(snapshots, "sdk", "snapshots", settings.getWorktreeSnapshotSettings()),
|
|
5407
|
+
onProgress
|
|
5265
5408
|
});
|
|
5266
5409
|
return prepared.status === "ready" ? prepared.sessionManager : sessionManager;
|
|
5267
5410
|
}
|
|
5268
|
-
async function constructAgentSession(options, deferStart, persistInitialState, acquisition, recoverMissingModel) {
|
|
5411
|
+
async function constructAgentSession(options, deferStart, persistInitialState, acquisition, recoverMissingModel, phase) {
|
|
5269
5412
|
resolveWorktreeSnapshotSettings(options.snapshots, "sdk", "snapshots");
|
|
5270
5413
|
const workspace = options.workspace === void 0 ? void 0 : await bindSessionWorkspace(options.workspace, options.sessionManager, options.resourceAdmissionSignal);
|
|
5271
5414
|
if (workspace !== void 0) await assertSessionManagerInWorktreeAsync(workspace, options.sessionManager);
|
|
5272
5415
|
const agentDir = options.agentDir ? resolvePath(options.agentDir) : getDefaultAgentDir();
|
|
5273
5416
|
await validateProcessStorageAsync(agentDir);
|
|
5274
|
-
|
|
5417
|
+
if (!deferStart && options.sessionManager?.isPersisted()) acquisition.releaseClaim = await acquireLiveSessionClaim(options.sessionManager.getSessionId(), { agentDir });
|
|
5418
|
+
const suppliedSession = options.cwd === void 0 && workspace === void 0 ? await sessionResumedOnThisNode(options.sessionManager, agentDir, options.settingsManager, options.snapshots, phase) : options.sessionManager;
|
|
5275
5419
|
acquisition.resumed = suppliedSession;
|
|
5276
5420
|
const cwd = workspace === void 0 ? resolvePath(options.cwd ?? suppliedSession?.getCwd() ?? process.cwd()) : await workspaceSessionCwdAsync(workspace, options.cwd);
|
|
5277
5421
|
let resourceLoader = options.resourceLoader;
|
|
@@ -5315,8 +5459,11 @@ async function constructAgentSession(options, deferStart, persistInitialState, a
|
|
|
5315
5459
|
sessionStore
|
|
5316
5460
|
});
|
|
5317
5461
|
if (store !== options.sessionStore) acquisition.store = store;
|
|
5318
|
-
|
|
5462
|
+
const id = createSessionId();
|
|
5463
|
+
if (!(store instanceof MemorySessionStore)) acquisition.releaseClaim = await acquireLiveSessionClaim(id, { agentDir });
|
|
5464
|
+
sessionManager = await SessionManager.create(store, cwd, { id });
|
|
5319
5465
|
}
|
|
5466
|
+
setUsageObservationStore(modelRuntime, usageObservationStore(sessionManager.getSessionStore()));
|
|
5320
5467
|
if (workspace !== void 0 && persistInitialState) await recordSessionWorkspace(sessionManager, workspace);
|
|
5321
5468
|
if (!resourceLoader) {
|
|
5322
5469
|
resourceLoader = new DefaultResourceLoader({
|
|
@@ -6144,6 +6291,7 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
6144
6291
|
compactionHoldReported = false;
|
|
6145
6292
|
/** The engine prepares every resume of this session and builds its blueprints; this mirror only restores the same state. */
|
|
6146
6293
|
resumeBlueprints = "skip";
|
|
6294
|
+
sessionClaimMirror = true;
|
|
6147
6295
|
patchedSessions = /* @__PURE__ */ new WeakSet();
|
|
6148
6296
|
/** Only committed bytes, independent of host-local mutations. Never shared across engine session generations. */
|
|
6149
6297
|
privateMirror;
|
|
@@ -6430,8 +6578,18 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
6430
6578
|
this.patchSession(session);
|
|
6431
6579
|
return session;
|
|
6432
6580
|
}
|
|
6433
|
-
listUsageAccounts() {
|
|
6434
|
-
return this.client.
|
|
6581
|
+
async listUsageAccounts() {
|
|
6582
|
+
return (await this.client.requestInternal({
|
|
6583
|
+
type: "list_usage_accounts",
|
|
6584
|
+
subscriptionsOnly: true
|
|
6585
|
+
})).accounts;
|
|
6586
|
+
}
|
|
6587
|
+
async observedUsage() {
|
|
6588
|
+
return (await this.client.requestInternal({
|
|
6589
|
+
type: "get_usage",
|
|
6590
|
+
observedOnly: true,
|
|
6591
|
+
subscriptionsOnly: true
|
|
6592
|
+
})).accounts;
|
|
6435
6593
|
}
|
|
6436
6594
|
async loadAccountUsage(provider, refresh) {
|
|
6437
6595
|
const [usage] = await this.client.getUsage(provider, refresh);
|
|
@@ -7118,15 +7276,24 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
7118
7276
|
}
|
|
7119
7277
|
async switchSession(sessionId, options) {
|
|
7120
7278
|
const settledBefore = this.settledEngineSession;
|
|
7279
|
+
const onProgress = options?.onProgress;
|
|
7280
|
+
let requestId;
|
|
7281
|
+
const stopProgress = onProgress && this.client.onEvent((event) => {
|
|
7282
|
+
if (requestId !== void 0 && event.type === "session_load_progress" && event.id === requestId) onProgress(event.message);
|
|
7283
|
+
});
|
|
7121
7284
|
this.hostSwitchInFlight += 1;
|
|
7122
7285
|
try {
|
|
7123
|
-
const
|
|
7286
|
+
const started = options?.startedSession instanceof SessionManager && options.startedSession.getSessionId() === sessionId && options.startedSession.takeStartedSession();
|
|
7287
|
+
const result = started || onProgress ? await this.client.requestInternal({
|
|
7124
7288
|
type: "switch_session",
|
|
7125
7289
|
sessionId,
|
|
7126
7290
|
cwdOverride: options?.cwdOverride,
|
|
7127
7291
|
sessionDirectory: options?.sessionDirectory,
|
|
7128
|
-
startedSession:
|
|
7292
|
+
startedSession: started || void 0
|
|
7293
|
+
}, (id) => {
|
|
7294
|
+
requestId = id;
|
|
7129
7295
|
}) : await this.client.switchSession(sessionId, options?.cwdOverride, options?.sessionDirectory);
|
|
7296
|
+
requestId = void 0;
|
|
7130
7297
|
if (!result.cancelled) {
|
|
7131
7298
|
this.discardHeldHostEvents();
|
|
7132
7299
|
this.queueResumeNotices(result.notices ?? []);
|
|
@@ -7135,6 +7302,7 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
7135
7302
|
const targetSessionDirectory = settled?.sessionLocation ? dirname(settled.sessionLocation) : options?.sessionDirectory;
|
|
7136
7303
|
const targetCwdOverride = settled?.cwd ?? options?.cwdOverride;
|
|
7137
7304
|
const applied = this.recordFallbackHostSwitch(settledBefore, targetSessionId, settled?.sessionLocation, targetCwdOverride);
|
|
7305
|
+
onProgress?.("Opening transcript");
|
|
7138
7306
|
await super.switchSession(targetSessionId, {
|
|
7139
7307
|
cwdOverride: targetCwdOverride,
|
|
7140
7308
|
sessionDirectory: targetSessionDirectory,
|
|
@@ -7146,6 +7314,7 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
7146
7314
|
}
|
|
7147
7315
|
return { cancelled: result.cancelled };
|
|
7148
7316
|
} finally {
|
|
7317
|
+
stopProgress?.();
|
|
7149
7318
|
this.hostSwitchInFlight -= 1;
|
|
7150
7319
|
if (!this.disposed && this.hostSwitchInFlight === 0 && this.hasPendingMirrorSync()) this.scheduleMirrorSync();
|
|
7151
7320
|
}
|
|
@@ -7207,7 +7376,10 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
7207
7376
|
this.advanceHostMirrorOrder(applied.generation, applied.seq);
|
|
7208
7377
|
} else if (settled) this.advanceHostMirrorOrder(settled.generation, settled.seq);
|
|
7209
7378
|
await this.initializeFromEngine();
|
|
7210
|
-
return {
|
|
7379
|
+
return {
|
|
7380
|
+
cancelled: false,
|
|
7381
|
+
...result.repaired === void 0 ? {} : { repaired: result.repaired }
|
|
7382
|
+
};
|
|
7211
7383
|
} finally {
|
|
7212
7384
|
this.hostSwitchInFlight -= 1;
|
|
7213
7385
|
if (!this.disposed && this.hostSwitchInFlight === 0 && this.hasPendingMirrorSync()) this.scheduleMirrorSync();
|
|
@@ -7661,6 +7833,7 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
7661
7833
|
if (!this.hostEventsSubscribed) {
|
|
7662
7834
|
this.hostEventsSubscribed = true;
|
|
7663
7835
|
this.client.onEvent((event) => {
|
|
7836
|
+
if (isSessionLoadEvent(event)) return;
|
|
7664
7837
|
if (this.releasingHostEvents) this.releasingHostEvents.push({
|
|
7665
7838
|
event,
|
|
7666
7839
|
audience: this.lastHostListener
|
|
@@ -8066,6 +8239,7 @@ var IsolatedInteractiveRuntime = class extends AgentSessionRuntime {
|
|
|
8066
8239
|
return JSON.parse(json + decoder.decode());
|
|
8067
8240
|
}
|
|
8068
8241
|
observeEvent(event) {
|
|
8242
|
+
if (isSessionLoadEvent(event)) return;
|
|
8069
8243
|
const session = super.session;
|
|
8070
8244
|
const record = event;
|
|
8071
8245
|
if (isEngineExtensionError(record)) {
|
|
@@ -8649,12 +8823,13 @@ async function main(argv, options) {
|
|
|
8649
8823
|
};
|
|
8650
8824
|
if (usageCommand) {
|
|
8651
8825
|
try {
|
|
8652
|
-
const [{ modelRuntime }, { loadSubscriptionUsage }, { formatUsageReport }] = await Promise.all([
|
|
8826
|
+
const [{ modelRuntime }, { loadSubscriptionUsage }, { formatUsageReport }, { withSelectedUsageStore }] = await Promise.all([
|
|
8653
8827
|
loadMetadata(),
|
|
8654
8828
|
import("../core/subscription-usage.js").catch((error) => __atomicOnDemandFailed(error, "this feature")),
|
|
8655
|
-
import("../cli/usage-command.js").catch((error) => __atomicOnDemandFailed(error, "this feature"))
|
|
8829
|
+
import("../cli/usage-command.js").catch((error) => __atomicOnDemandFailed(error, "this feature")),
|
|
8830
|
+
import("../core/subscription-usage-storage.js").catch((error) => __atomicOnDemandFailed(error, "this feature"))
|
|
8656
8831
|
]);
|
|
8657
|
-
const report = await loadSubscriptionUsage(modelRuntime, startupSettingsManager.getDefaultProvider());
|
|
8832
|
+
const report = await withSelectedUsageStore(cwd, agentDir, startupSettingsManager.getSettings(), void 0, (store) => loadSubscriptionUsage(modelRuntime, startupSettingsManager.getDefaultProvider(), { store }));
|
|
8658
8833
|
writeRawStdout(args.includes("--json") ? `${JSON.stringify(report)}\n` : formatUsageReport(report));
|
|
8659
8834
|
} catch {
|
|
8660
8835
|
process.stderr.write("Could not read subscription accounts.\n");
|
|
@@ -9160,9 +9335,22 @@ async function main(argv, options) {
|
|
|
9160
9335
|
return false;
|
|
9161
9336
|
};
|
|
9162
9337
|
let sessionManager;
|
|
9338
|
+
let startupClaim;
|
|
9163
9339
|
let worktreeRestoreDiagnostics = [];
|
|
9164
|
-
const
|
|
9340
|
+
const createSessionStartupProgress = () => createResumeProgress(appMode, engineEnv.child === "1", process.stderr, startupSettingsManager.getThemeSetting());
|
|
9165
9341
|
const stopAnnouncingWaits = appMode !== "interactive" && engineEnv.child !== "1" ? (await import("../modes/print-mode.js").catch((error) => __atomicOnDemandFailed(error, "this feature"))).announceBlueprintBuildWaits(appMode !== "print") : void 0;
|
|
9342
|
+
const jsonSessionLoad = appMode === "json" || appMode === "rpc" ? startSessionLoad(parsed.session ?? parsed.sessionId ?? parsed.fork ?? parsed.import ?? cwd, (event) => writeRawStdout(`${JSON.stringify(event)}\n`)) : void 0;
|
|
9343
|
+
const jsonStartupProgress = jsonSessionLoad && {
|
|
9344
|
+
phase: jsonSessionLoad.phase,
|
|
9345
|
+
done() {},
|
|
9346
|
+
pause() {},
|
|
9347
|
+
async beforeExit(failure) {
|
|
9348
|
+
if (failure === void 0) jsonSessionLoad.finish(true);
|
|
9349
|
+
else jsonSessionLoad.fail(failure);
|
|
9350
|
+
await flushRawStdout();
|
|
9351
|
+
}
|
|
9352
|
+
};
|
|
9353
|
+
const startupProgress = jsonStartupProgress ?? createSessionStartupProgress();
|
|
9166
9354
|
try {
|
|
9167
9355
|
const opened = await openCliSession(parsed, cwd, startupSettingsManager, {
|
|
9168
9356
|
agentDir,
|
|
@@ -9174,12 +9362,16 @@ async function main(argv, options) {
|
|
|
9174
9362
|
},
|
|
9175
9363
|
blueprints: engineEnv.child === "1" ? "skip" : "build",
|
|
9176
9364
|
interactive: appMode === "interactive" || engineEnv.child === "1",
|
|
9177
|
-
|
|
9365
|
+
hostClaimPid: engineEnv.child === "1" && engineEnv.hostPid !== void 0 ? Number(engineEnv.hostPid) : void 0,
|
|
9178
9366
|
progress: startupProgress,
|
|
9179
9367
|
chooseDirtyCheckout: appMode === "interactive" ? (prompt) => promptForDirtyCheckout(prompt, startupSettingsManager) : void 0
|
|
9180
9368
|
});
|
|
9181
9369
|
stopAnnouncingWaits?.();
|
|
9182
|
-
if (opened === "cancelled")
|
|
9370
|
+
if (opened === "cancelled") {
|
|
9371
|
+
if (jsonStartupProgress) await jsonStartupProgress.beforeExit();
|
|
9372
|
+
process.exit(0);
|
|
9373
|
+
}
|
|
9374
|
+
startupClaim = opened;
|
|
9183
9375
|
sessionManager = opened.sessionManager;
|
|
9184
9376
|
if (engineEnv.startedSessionId !== void 0 && sessionManager.getSessionId() === engineEnv.startedSessionId) sessionManager.markSessionStarted();
|
|
9185
9377
|
worktreeRestoreDiagnostics = opened.notices;
|
|
@@ -9188,51 +9380,71 @@ async function main(argv, options) {
|
|
|
9188
9380
|
holdToolsUntilOwnerBuilt(resumeStoreDir(agentDir), Number(engineEnv.hostPid), resumed.getSessionId(), (timings) => recordResumeTimings(resumed, timings));
|
|
9189
9381
|
}
|
|
9190
9382
|
} catch (error) {
|
|
9383
|
+
await startupClaim?.releaseClaim();
|
|
9191
9384
|
const held = error instanceof SessionAlreadyOpenError;
|
|
9192
9385
|
const message = held || error instanceof StorageConfigError ? error.message : resumeFailureMessage(error);
|
|
9386
|
+
if (jsonStartupProgress) await jsonStartupProgress.beforeExit(message ?? "Could not open session");
|
|
9193
9387
|
if (message === void 0) throw error;
|
|
9194
9388
|
startupEarlyInputCapture?.consume();
|
|
9195
9389
|
console.error(chalk.red(`Error: ${message}`));
|
|
9196
9390
|
process.exit(held ? 75 : 1);
|
|
9197
9391
|
}
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9392
|
+
let sessionCwd;
|
|
9393
|
+
let autoTrustOnReloadCwd;
|
|
9394
|
+
let runtime;
|
|
9395
|
+
try {
|
|
9396
|
+
const missingSessionCwdIssue = findMissingSessionCwdIssue(sessionManager, cwd);
|
|
9397
|
+
if (missingSessionCwdIssue) {
|
|
9398
|
+
if (appMode === "interactive") {
|
|
9399
|
+
const choice = await promptForMissingSessionCwd(missingSessionCwdIssue, startupSettingsManager);
|
|
9400
|
+
const progress = createSessionStartupProgress();
|
|
9401
|
+
if (choice !== void 0) progress?.phase(choice === "fork" ? "Forking saved session" : "Reading session history");
|
|
9402
|
+
try {
|
|
9403
|
+
sessionManager = await openSessionInCurrentCwdOrExit(sessionManager, missingSessionCwdIssue, choice, progress, startupClaim?.reserveClaim);
|
|
9404
|
+
} finally {
|
|
9405
|
+
progress?.done();
|
|
9406
|
+
}
|
|
9407
|
+
} else if (engineEnv.child === "1" && engineEnv.sessionCwdOverride !== void 0) sessionManager = await sessionManager.openSessionById(sessionManager.getSessionId(), engineEnv.sessionCwdOverride, void 0, { history: "tail" });
|
|
9408
|
+
else {
|
|
9409
|
+
const message = new MissingSessionCwdError(missingSessionCwdIssue).message;
|
|
9410
|
+
if (jsonStartupProgress) await jsonStartupProgress.beforeExit(message);
|
|
9411
|
+
console.error(chalk.red(message));
|
|
9412
|
+
process.exit(1);
|
|
9413
|
+
}
|
|
9207
9414
|
}
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9415
|
+
if (parsed.name !== void 0) {
|
|
9416
|
+
if (!parsed.name.trim()) {
|
|
9417
|
+
const message = "--name requires a non-empty value";
|
|
9418
|
+
if (jsonStartupProgress) await jsonStartupProgress.beforeExit(message);
|
|
9419
|
+
console.error(chalk.red(`Error: ${message}`));
|
|
9420
|
+
startupEarlyInputCapture?.consume();
|
|
9421
|
+
process.exit(1);
|
|
9422
|
+
}
|
|
9214
9423
|
}
|
|
9424
|
+
jsonSessionLoad?.finish();
|
|
9425
|
+
time("createSessionManager");
|
|
9426
|
+
markLifecycleTiming("session-opened");
|
|
9427
|
+
isolateInteractiveHost &&= canIsolateSessionStore(sessionManager.getSessionStore());
|
|
9428
|
+
sessionCwd = sessionManager.getCwd();
|
|
9429
|
+
const selectedProjectTrusted = parsed.projectTrustOverride ?? (hasProjectTrustInputs(sessionCwd) ? projectTrustStore.get(sessionCwd) : true) ?? startupDefaultProjectTrust === "always";
|
|
9430
|
+
isolateInteractiveHost &&= storagePinned || selectedProjectTrusted;
|
|
9431
|
+
startupEarlyInputCapture ??= beginStartupInputCapture(sessionCwd, true, deprecationWarnings.length);
|
|
9432
|
+
autoTrustOnReloadCwd = parsed.projectTrustOverride === void 0 && !hasProjectTrustInputs(sessionCwd) ? sessionCwd : void 0;
|
|
9433
|
+
if (isolateInteractiveHost) await shareBlueprintBuild(resumeStoreDir(agentDir), sessionManager.getSessionId());
|
|
9434
|
+
const runtimeCreationSpan = startTimingSpan("createAgentSessionRuntime");
|
|
9435
|
+
runtime = await createRuntimeForMode(createRuntime, sessionManager.getCwd(), agentDir, sessionManager, isolateInteractiveHost, (options?.extensionFactories?.length ?? 0) > 0, parsed, {
|
|
9436
|
+
extensions: resolvedExtensionPaths,
|
|
9437
|
+
skills: resolvedSkillPaths,
|
|
9438
|
+
promptTemplates: resolvedPromptTemplatePaths,
|
|
9439
|
+
themes: resolvedThemePaths
|
|
9440
|
+
}, appMode === "interactive" || engineEnv.child === "1", async () => extensionsCanDecideTrust && {
|
|
9441
|
+
cwd: sessionManager.getCwd(),
|
|
9442
|
+
extensionsCanDecide: await extensionsCanDecideTrust
|
|
9443
|
+
}, engineInputsFinal);
|
|
9444
|
+
endTimingSpan(runtimeCreationSpan);
|
|
9445
|
+
} finally {
|
|
9446
|
+
await startupClaim?.releaseClaim();
|
|
9215
9447
|
}
|
|
9216
|
-
time("createSessionManager");
|
|
9217
|
-
markLifecycleTiming("session-opened");
|
|
9218
|
-
isolateInteractiveHost &&= canIsolateSessionStore(sessionManager.getSessionStore());
|
|
9219
|
-
const sessionCwd = sessionManager.getCwd();
|
|
9220
|
-
const selectedProjectTrusted = parsed.projectTrustOverride ?? (hasProjectTrustInputs(sessionCwd) ? projectTrustStore.get(sessionCwd) : true) ?? startupDefaultProjectTrust === "always";
|
|
9221
|
-
isolateInteractiveHost &&= storagePinned || selectedProjectTrusted;
|
|
9222
|
-
startupEarlyInputCapture ??= beginStartupInputCapture(sessionCwd, true, deprecationWarnings.length);
|
|
9223
|
-
const autoTrustOnReloadCwd = parsed.projectTrustOverride === void 0 && !hasProjectTrustInputs(sessionCwd) ? sessionCwd : void 0;
|
|
9224
|
-
if (isolateInteractiveHost) await shareBlueprintBuild(resumeStoreDir(agentDir), sessionManager.getSessionId());
|
|
9225
|
-
const runtimeCreationSpan = startTimingSpan("createAgentSessionRuntime");
|
|
9226
|
-
const runtime = await createRuntimeForMode(createRuntime, sessionManager.getCwd(), agentDir, sessionManager, isolateInteractiveHost, (options?.extensionFactories?.length ?? 0) > 0, parsed, {
|
|
9227
|
-
extensions: resolvedExtensionPaths,
|
|
9228
|
-
skills: resolvedSkillPaths,
|
|
9229
|
-
promptTemplates: resolvedPromptTemplatePaths,
|
|
9230
|
-
themes: resolvedThemePaths
|
|
9231
|
-
}, appMode === "interactive" || engineEnv.child === "1", async () => extensionsCanDecideTrust && {
|
|
9232
|
-
cwd: sessionManager.getCwd(),
|
|
9233
|
-
extensionsCanDecide: await extensionsCanDecideTrust
|
|
9234
|
-
}, engineInputsFinal);
|
|
9235
|
-
endTimingSpan(runtimeCreationSpan);
|
|
9236
9448
|
markLifecycleTiming("runtime-created");
|
|
9237
9449
|
ThreadConnection.releaseSpare();
|
|
9238
9450
|
startupRuntime = runtime;
|
|
@@ -9388,7 +9600,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
9388
9600
|
return (async () => {
|
|
9389
9601
|
const root = new URL("../", import.meta.url);
|
|
9390
9602
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9391
|
-
const key = `${root.href}#0.10.
|
|
9603
|
+
const key = `${root.href}#0.10.20-alpha.2`;
|
|
9392
9604
|
let release = releases.get(key);
|
|
9393
9605
|
if (release === undefined) {
|
|
9394
9606
|
const current = (async () => {
|
|
@@ -9416,7 +9628,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
9416
9628
|
} catch {
|
|
9417
9629
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
9418
9630
|
}
|
|
9419
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.
|
|
9631
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.20-alpha.2" ? installed : running !== undefined && running.version !== "0.10.20-alpha.2" ? "0.10.20-alpha.2" : undefined;
|
|
9420
9632
|
if (updatedTo === undefined) throw error;
|
|
9421
9633
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
9422
9634
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|