@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,18 +1,18 @@
|
|
|
1
1
|
import { __name } from "./rolldown-runtime-BGM3D5V3.js";
|
|
2
2
|
import { APP_NAME, APP_TITLE, CHANGELOG_URL, CONFIG_DIR_NAME, UpdatedInstallError, VERSION, VERSION_ADOPTION_ENDPOINT, canonicalizePathAsync, createChildProcessEnvironment, createModuleRequire, detectInstallChangeAsync, engineHeapRuntimeArgsForHost, findHelperExecutableAsync, getAgentDir, getAuthPath, getChangelogPath, getCwdRelativePath, getDebugLogPath, getDocsPath, getShareViewerUrl, helperLaunchAsync, isBunBinary, isModuleLoadFailure, loadOnDemand, markLifecycleTiming, missingHelperOptions, processCompileCacheDeferral, setDebugSetting, shortenHomePath, updatedInstallError } from "./p0-cli-BB45ZQY6.js";
|
|
3
|
-
import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, CountdownTimer, DynamicBorder, MissingSessionCwdError, NO_QUEUED_MESSAGES, TrustDecisionSelector, asyncScope, carryRowSource, chatPosition, chatReceipt, deduplicateDiagnostics, fetchSubscriptionUsage, findProviderDefaultModel, formatAppendRecoveryNotice, formatMissingSessionCwdPrompt, formatNoModelsAvailableMessage, getEngineSessionStats, getMissingSessionCwdOptions, getPiUserAgent,
|
|
4
|
-
import { ExtensionInputComponent, ExtensionSelectorComponent, ReopenedCompletionHeaders, cancelInitialBinding, codexAccountId, createCustomMessage, ensurePngTranscoder, ensureTool, formatResumeTimings, formatToolStatus, getBuiltinExtensionEntryLabel, getPromptCacheTtlMs as getPromptCacheTtlMs$1, initialBindScope, isOfflineModeEnabled, isVerbatimCompactionMessage,
|
|
3
|
+
import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, CountdownTimer, DynamicBorder, MissingSessionCwdError, NO_QUEUED_MESSAGES, TrustDecisionSelector, acquireLiveSessionClaim, asyncScope, carryRowSource, chatPosition, chatReceipt, deduplicateDiagnostics, fetchSubscriptionUsage, findProviderDefaultModel, formatAppendRecoveryNotice, formatMissingSessionCwdPrompt, formatNoModelsAvailableMessage, getEngineSessionStats, getMissingSessionCwdOptions, getPiUserAgent, isInstallTelemetryEnabled, isInteractiveEngineResourceReadinessError, isPathInside, isTrustDecision, isUnknownModel, keepDroppedQueuedMessages, markEventLoopShutdown, markEventLoopStartupComplete, noteRowSource, noteSavedSeq, onSessionProviderRequestDispatched, parseSlashCommand, placeTranscriptFrame, projectTrustWarningVisible, queuedMessagesUnderWay, quitAsInteractiveApp, raceWithAbortSignal, readSubscriptionCredential, recordStartupThinkingLevel, rowSource, safeTrustChoiceIndex, savedRowKey, savedSeqOf, setDeprecationWarningSink, setMarkitDiagnosticSink, shouldRenderEngineDiagnosticAsChatError, takeQueuedMessagesDroppedAt, usageCostBreakdown, userMessageOrigin, yieldToEventLoop, yieldToTimerTurn } from "./startup-0-0-OWBJIX35.js";
|
|
4
|
+
import { ExtensionInputComponent, ExtensionSelectorComponent, ReopenedCompletionHeaders, cancelInitialBinding, codexAccountId, createCustomMessage, describeSessionParentRepairs, ensurePngTranscoder, ensureTool, formatResumeTimings, formatToolStatus, getBuiltinExtensionEntryLabel, getPromptCacheTtlMs as getPromptCacheTtlMs$1, initialBindScope, isOfflineModeEnabled, isVerbatimCompactionMessage, latestResumeTimings, normalizeMessageContent, normalizeModelFailureSignal, observedOpenAiDirectUsage, observedSubscriptionUsage, prewarmModelApi, readHostInputFormRequest, registerInitialBindings, sessionParent, stripVerbatimCompactionPrefix, subscriptionBearer, subscriptionCredentialKey, taskPromptHost, thinkingLevelForModelSwitch, usageObservationStore } from "./startup-0-1-DZYE4E5Z.js";
|
|
5
5
|
import { KeybindingsManager as KeybindingsManager$1, OVERLAY_ACTIVE_ROW_MARKER, Theme, clickableKeyTextHint, consumeStartupInput, formatKeyText, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, isNavHelpKey, keyDisplayText, keyHint, keyText, keyTextHint, loadAllHighlightLanguages, navEntryKeyParts, onThemeChange, recordTimeSinceReset, refreshCustomThemes, renderNavKeyOverlay, setRegisteredThemes, slashCommandHint, stopThemeWatcher, theme } from "./p2-shell-main-B2WIALFD.js";
|
|
6
6
|
import { ProjectTrustStore, failureDebugFields, getProjectTrustPathAsync, hasTrustRequiringProjectResourcesAsync, reportDebugAsync } from "./p1b-elig-BY2G5BUE.js";
|
|
7
|
-
import { WorkingRunMeter, compactionMeta, findExactModelReferenceMatch, getPowerShellConfigAsync, killSupervisedProcessTrees, killTrackedDetachedChildren, runInProgress, sessionLifetime, showStartupInput, showStartupSelector, taskTranscriptSource } from "./startup-0-2-
|
|
7
|
+
import { WorkingRunMeter, compactionMeta, findExactModelReferenceMatch, getPowerShellConfigAsync, isSessionLoadEvent, killSupervisedProcessTrees, killTrackedDetachedChildren, observeSessionLoadHistory, readUsageAccountKey, runInProgress, sessionLifetime, showStartupInput, showStartupSelector, taskTranscriptSource, usageCredentialToken } from "./startup-0-2-WFLTE4SC.js";
|
|
8
8
|
import { AtomicWorkedStatusComponent, AtomicWorkingLoader, DEFAULT_WORKING_MESSAGE, buildContextEntries, getOwnerTaskStore, isResumeFailure, parseGitUrl, resolveModelScopeFromModels, resolveModelScopeWithDiagnostics, sessionEntryToDisplayMessages, watchAtomicWorkingClock, watchOwnerTaskStoreBinding } from "./startup-0-3-DE2NCS6A.js";
|
|
9
|
-
import { SESSION_HISTORY_SCAN_ENTRIES, findDecisionError, isDecisionConfigError, isRpcRequestAcceptedFailure, isRpcTransportFailure } from "./settings-startup-HXQLSUWM.js";
|
|
10
|
-
import { readAhead } from "./startup-8-0-34CBHPZH.js";
|
|
11
|
-
import { CredentialSynchronizationError, DefaultPackageManager, chunkedToolResult, chunkedToolResultEntry, findInitialModel, firstSubagentAttempt, getSkillCatalog, isOAuthLoginCancelled, resolveRestoredModelReference, uncachedCopilotModelHint } from "./startup-0-5-
|
|
12
|
-
import { formatModelLabel } from "./startup-0-4-
|
|
13
|
-
import { ENGINE_SHUTDOWN_GRACE_MS, FooterDataProvider, appendBoundedStderr, compareWorktreeSnapshot, currentWorktreeSnapshots, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeWorktreeRestoreStatus, describeWorktreeSnapshot, dismissedAgentPanelItems, ownerTaskViewSource, sourceError, subscribeAgentPanel, worktreeRestoreNotices } from "./startup-8-1-
|
|
14
|
-
import { tryExecuteSessionSlashCommand } from "./startup-15-0-
|
|
15
|
-
import { SessionManager } from "./startup-10-0-
|
|
9
|
+
import { SESSION_HISTORY_SCAN_ENTRIES, SessionAlreadyOpenError, findDecisionError, isDecisionConfigError, isRpcRequestAcceptedFailure, isRpcTransportFailure } from "./settings-startup-HXQLSUWM.js";
|
|
10
|
+
import { createSessionId, readAhead } from "./startup-8-0-34CBHPZH.js";
|
|
11
|
+
import { CredentialSynchronizationError, DefaultPackageManager, chunkedToolResult, chunkedToolResultEntry, findInitialModel, firstSubagentAttempt, getSkillCatalog, isOAuthLoginCancelled, resolveRestoredModelReference, uncachedCopilotModelHint } from "./startup-0-5-DNS6FYS7.js";
|
|
12
|
+
import { SessionLoadingStatus, formatModelLabel } from "./startup-0-4-6XXL4JMZ.js";
|
|
13
|
+
import { ENGINE_SHUTDOWN_GRACE_MS, FooterDataProvider, appendBoundedStderr, compareWorktreeSnapshot, currentWorktreeSnapshots, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeWorktreeRestoreStatus, describeWorktreeSnapshot, dismissedAgentPanelItems, ownerTaskViewSource, sourceError, subscribeAgentPanel, worktreeRestoreNotices } from "./startup-8-1-VXBL37AI.js";
|
|
14
|
+
import { tryExecuteSessionSlashCommand } from "./startup-15-0-E7RYG5YF.js";
|
|
15
|
+
import { SessionManager } from "./startup-10-0-O6DAT7U4.js";
|
|
16
16
|
import { IsolatedInteractiveRuntime, SessionImportFileNotFoundError, parseSkillBlock, sessionCloseReason } from "./startup-15-1-WQZBOTMZ.js";
|
|
17
17
|
import { configureHttpDispatcher } from "./http-YFAPTIZD.js";
|
|
18
18
|
import { AGENT_PANEL_WIDGET_KEY, ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, AgentViewSwitcher, ArminComponent, AssistantMessageComponent, BUILTIN_SLASH_COMMAND_NAMES, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, COMMITTED_WIDGET_PREVIEW_GATE, CONSOLE_CLOSED_EXIT_CODE, CONSOLE_CLOSED_SHUTDOWN_MS, ChatSessionHost, CombinedAutocompleteProvider as CombinedAutocompleteProvider$1, CompactionBoundaryMessageComponent, Container as Container$1, CustomMessageComponent, EarendilAnnouncementComponent, ExpandableText, ExtensionEditorComponent, FooterComponent, InteractiveThemeController, KeybindingsReloadCoordinator, Loader as Loader$1, LoginDialogComponent, Markdown as Markdown$1, ModelSelectorComponent, OAuthSelectorComponent, PromptHistorySelectorComponent, QueuedMessagesView, RemoteCustomMessageComponent, RemoteFrameWidthClamp, RemoteToolExecutionComponent, STARTUP_ASSEMBLY_GAPS, STOP_ALL_STATUS_KEY, SavedRendererInstances, ScopedModelsSelectorComponent, SessionSelectorComponent, SettingsSelectorComponent, SkillInvocationMessageComponent, Spacer as Spacer$1, SteeringQueueController, Text as Text$1, ThinkingSelectorComponent, ToolExecutionComponent, ToolGroupTracker, TranscriptTaskRow, TreeSelectorComponent, TrustSelectorComponent, UsageMeterComponent, UserMessageSelectorComponent, WorkingStatusComponent, addChatTranscriptEntry, agentPanelBoardSource, agentPanelCounts, agentPanelHasRows, applyAssistantMessageDelta, applyToolEntryState, assistantCallBreaks, atomicWordmark, beginStreamingAssistantMessage, bindAgentPanel, blockRows, boundedInteractiveModelRefresh, callsAwaitingLaterResults, canPaintWidgetFrame, chalk, chatEntriesFromAgentMessages, chatRecordsChanged, checkForNewPiVersion, classifyWidgetFrame, clickableBlocksView, combineQueuedMessagesForEditor, compareProviders, composeStartupIdentity, countTasksBy, createChatAutocompleteProvider, createRemoteAgentSteering, createStopAllChord, createStopAllNotices, decisionSettingScopes, declaresHistoryReplayable, discardChatMount, disposeRemoteRenderers, disposeRenderer, endsAwaitedResults, exitWithStatus, formatAuthSelectorProviderType, formatCrashExtensionHint, formatResumeCommand, fs, fuzzyFilter as fuzzyFilter$1, getAutocompleteSourceTag, getCachedChangelog, getCapabilities as getCapabilities$1, getChangelogHighlights, getEntriesForVersion, getModelSearchText, getNewEntries, getSessionSkillCommands, handleTranscriptBlockClick, hasAssistantVisibleContent, hasDefaultModelProvider, hyperlink as hyperlink$1, initialHostEngineViewSyncState, interruptedNotice, isAnthropicSubscriptionAuthKey, isChatSessionWorking, isClickExpandableBlock, isDeadTerminalError, isEngineHintRoute, isExpandable, isResultWithoutCall, isSingleLeftClick, isUnansweredCancelMatch, loadEarendilAnnouncementImage, matchesKey as matchesKey$1, needsChangelogPreload, normalizeChangelogLinks, observeClickExpansion, openExternalEditorForText, openLocalAgentViewPort, openWaitedShellOf, os, panelHintParts, panelHintSegments, parkedRun, parseChangelogAsync, pasteClipboardImageToEditor, path as path$1, pickWhimsicalWorkingMessage, planPreViewCancelAck, prefixAutocompleteDescription, preloadChangelog, promptHistoryEntries, queuedMessageRows, readMountedAnchors, readTaskCompletionHistory, refreshModelCatalogs, remoteAgentCommands, remoteAgentPrompts, renderAtomicAssemblyBanner, renderChatMessageEntry, renderStartupManifesto, restoredQueue, retainChatRecords, retryCancelHint, retryWaitFromEvent, retryWaitMessage, rowsFrom, runHintRoute, sessionChatMount, sessionPromptsFromEntries, setAgentViewBridge, setKeybindings as setKeybindings$1, setRendererClickTarget, settleUnansweredCalls, shouldCancelEngineViewOnArrival, showAgentPanel, showTaskInspector, spawn, stopAllBackgroundWork, supersedeBlockClicks, supportsAtomicBanner, taskNameAndTitle, taskSiblings, themedChatHostStyle, toolResultGroupState, viewedAgentCommand, visibleWidth as visibleWidth$1 } from "./mode-shared-2QJSCUM6.js";
|
|
@@ -21,7 +21,7 @@ import { exitOnDecisionConfigError } from "./settings-startup-8-DNZ2RIHM.js";
|
|
|
21
21
|
import { dirname } from "node:path";
|
|
22
22
|
import { setLongTimeout } from "../__atomic_timers/index.js";
|
|
23
23
|
import { normalizeProviderId } from "@bastani/atomic-ai";
|
|
24
|
-
import { Box, CURSOR_MARKER, Container, Editor, Input, Key, Marked, ScrollView, Spacer, Text, TuiAltScreen, VStack, WindowedContainer, bindBundledHintCommands, clickableKeysHint, decodePrintableKey, editorDraftText, emptyEditorDraft, fuzzyFilter, getCapabilities, isHintActivation, isKeyRelease, isViewportTUI, matchesKey, replaceControlCharacters, setCapabilityOverrides, setKeybindings, stripHintMarkers, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@bastani/atomic-tui";
|
|
24
|
+
import { Box, CURSOR_MARKER, Container, Editor, HStack, Input, Key, Marked, ScrollView, Spacer, Text, TuiAltScreen, VStack, WindowedContainer, bindBundledHintCommands, clickableKeysHint, decodePrintableKey, editorDraftText, emptyEditorDraft, fuzzyFilter, getCapabilities, isHintActivation, isKeyRelease, isViewportTUI, matchesKey, replaceControlCharacters, setCapabilityOverrides, setKeybindings, stripHintMarkers, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@bastani/atomic-tui";
|
|
25
25
|
import { createHash, randomUUID } from "node:crypto";
|
|
26
26
|
import { setImmediate as setImmediate$1 } from "node:timers/promises";
|
|
27
27
|
import { clampThinkingLevel, modelsAreEqual } from "@bastani/atomic-ai/compat";
|
|
@@ -31,7 +31,8 @@ import { isProxy } from "node:util/types";
|
|
|
31
31
|
import { copyScopedModels } from "../core/extensions/runner-context.js";
|
|
32
32
|
import { ModelRegistry } from "../core/model-registry.js";
|
|
33
33
|
import "@bastani/atomic-ai/providers/all";
|
|
34
|
-
import { LAYOUT_NODE } from "@bastani/atomic-tui/dist/layout-node.js";
|
|
34
|
+
import { LAYOUT_NODE, getLayoutNode } from "@bastani/atomic-tui/dist/layout-node.js";
|
|
35
|
+
import { renderLayoutFrame } from "@bastani/atomic-tui/dist/layout.js";
|
|
35
36
|
// dist/modes/interactive-engine/engine-dialog-host.js
|
|
36
37
|
/** Requests that mount a host dialog and therefore need generation ownership. */
|
|
37
38
|
const MOUNTING_METHODS = /* @__PURE__ */ new Set([
|
|
@@ -879,6 +880,11 @@ function awaitsFirstContent(component) {
|
|
|
879
880
|
}
|
|
880
881
|
/** Views that navigate (`/tasks`, the focused agent panel): the footer's hints and the widgets give way to them. */
|
|
881
882
|
const navigationViews = /* @__PURE__ */ new WeakSet();
|
|
883
|
+
const nativeViews = /* @__PURE__ */ new WeakSet();
|
|
884
|
+
/** When drawn live, let the terminal lay out this view's own scrollable regions. */
|
|
885
|
+
function usePromptSlotLayout(view) {
|
|
886
|
+
nativeViews.add(view);
|
|
887
|
+
}
|
|
882
888
|
/**
|
|
883
889
|
* `view` is mounted as a navigation view, until it is unmounted (`navigation` false): while the slot draws it, the
|
|
884
890
|
* footer's hints and the widgets around the prompt hide.
|
|
@@ -933,6 +939,7 @@ var PromptSlot = class extends Container {
|
|
|
933
939
|
/** What the last render drew. */
|
|
934
940
|
drawn;
|
|
935
941
|
showingHeldRows = false;
|
|
942
|
+
nativeLayout = false;
|
|
936
943
|
ui;
|
|
937
944
|
showsRunStatus;
|
|
938
945
|
screen;
|
|
@@ -1042,6 +1049,7 @@ var PromptSlot = class extends Container {
|
|
|
1042
1049
|
render(width) {
|
|
1043
1050
|
const live = super.render(width);
|
|
1044
1051
|
const held = this.resolve(width);
|
|
1052
|
+
this.nativeLayout = false;
|
|
1045
1053
|
this.showingHeldRows = held !== void 0;
|
|
1046
1054
|
this.drawn = {
|
|
1047
1055
|
width,
|
|
@@ -1094,8 +1102,14 @@ var PromptSlot = class extends Container {
|
|
|
1094
1102
|
return held;
|
|
1095
1103
|
}
|
|
1096
1104
|
/** Held rows are a picture of what was there: a click on them reaches nothing. */
|
|
1105
|
+
[LAYOUT_NODE]() {
|
|
1106
|
+
const view = this.children.length === 1 ? this.children[0] : void 0;
|
|
1107
|
+
const layout = !this.showingHeldRows && view && nativeViews.has(view) ? getLayoutNode(view) : void 0;
|
|
1108
|
+
this.nativeLayout = layout !== void 0;
|
|
1109
|
+
return layout;
|
|
1110
|
+
}
|
|
1097
1111
|
handleMouse(event) {
|
|
1098
|
-
return this.showingHeldRows ? void 0 : super.handleMouse(event);
|
|
1112
|
+
return this.showingHeldRows || this.nativeLayout ? void 0 : super.handleMouse(event);
|
|
1099
1113
|
}
|
|
1100
1114
|
showsHeldRows(state, width) {
|
|
1101
1115
|
if (width !== state.width || this.showsRunStatus()) return false;
|
|
@@ -13194,6 +13208,47 @@ var ProgramStatusReporter = class {
|
|
|
13194
13208
|
return status;
|
|
13195
13209
|
}
|
|
13196
13210
|
};
|
|
13211
|
+
// dist/modes/interactive/session-loading.js
|
|
13212
|
+
/** The newest visible operation takes the row, even if startup or a prior operation is still settling. */
|
|
13213
|
+
var SessionLoadingDock = class extends Container {
|
|
13214
|
+
render(width) {
|
|
13215
|
+
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
13216
|
+
const rows = this.children[i]?.render(width);
|
|
13217
|
+
if (rows?.length) return rows;
|
|
13218
|
+
}
|
|
13219
|
+
return [];
|
|
13220
|
+
}
|
|
13221
|
+
};
|
|
13222
|
+
const docks = /* @__PURE__ */ new WeakMap();
|
|
13223
|
+
function sessionLoadingDock(mode) {
|
|
13224
|
+
let dock = docks.get(mode);
|
|
13225
|
+
if (!dock) {
|
|
13226
|
+
dock = new SessionLoadingDock();
|
|
13227
|
+
docks.set(mode, dock);
|
|
13228
|
+
}
|
|
13229
|
+
return dock;
|
|
13230
|
+
}
|
|
13231
|
+
function withSessionLoading(mode, label, run) {
|
|
13232
|
+
if (!mode.tuiStarted || mode.isShuttingDown) return run();
|
|
13233
|
+
const dock = sessionLoadingDock(mode);
|
|
13234
|
+
const status = new SessionLoadingStatus(() => mode.ui.requestRender(), label);
|
|
13235
|
+
dock.addChild(status);
|
|
13236
|
+
status.begin();
|
|
13237
|
+
return observeSessionLoadHistory(status.phase, async () => {
|
|
13238
|
+
try {
|
|
13239
|
+
return await run(status.phase);
|
|
13240
|
+
} finally {
|
|
13241
|
+
status.done();
|
|
13242
|
+
dock.removeChild(status);
|
|
13243
|
+
}
|
|
13244
|
+
});
|
|
13245
|
+
}
|
|
13246
|
+
function stopSessionLoading(mode) {
|
|
13247
|
+
const dock = docks.get(mode);
|
|
13248
|
+
if (!dock) return;
|
|
13249
|
+
for (const child of dock.children) if (child instanceof SessionLoadingStatus) child.done();
|
|
13250
|
+
dock.clear();
|
|
13251
|
+
}
|
|
13197
13252
|
// dist/modes/interactive/interactive-mode-base.js
|
|
13198
13253
|
/**
|
|
13199
13254
|
* Shared state and constructor wiring for interactive mode.
|
|
@@ -13599,6 +13654,7 @@ var InteractiveModeBase = class {
|
|
|
13599
13654
|
return this.renderer.mode === "fullscreen";
|
|
13600
13655
|
}
|
|
13601
13656
|
stopInteractiveTui(fullscreenExitOutput) {
|
|
13657
|
+
stopSessionLoading(this);
|
|
13602
13658
|
const isFullscreen = this.renderer.mode === "fullscreen";
|
|
13603
13659
|
if (isFullscreen && fullscreenExitOutput === "transcript") {
|
|
13604
13660
|
while (this.renderer.hasOverlayEntries) this.renderer.hideOverlay();
|
|
@@ -18087,16 +18143,25 @@ function missForOccurrence(notes) {
|
|
|
18087
18143
|
function precedingDropCount(mode, notes) {
|
|
18088
18144
|
if (notes.previousReply) return countDroppedThinkingBlocks(notes.previousReply);
|
|
18089
18145
|
if (notes.earlier) return notes.earlier.drops;
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18096
|
-
if (
|
|
18146
|
+
if (notes.summarizedParent === void 0) return 0;
|
|
18147
|
+
const manager = mode.sessionManager;
|
|
18148
|
+
if (manager?.getHistoryWarning()) {
|
|
18149
|
+
const branch = manager.getBranch(notes.summarizedParent);
|
|
18150
|
+
const previous = branch.findLast((entry) => entry.type === "message" && entry.message.role === "assistant");
|
|
18151
|
+
if (previous?.type === "message" && previous.message.role === "assistant") return countDroppedThinkingBlocks(previous.message);
|
|
18152
|
+
if (manager.hasFullHistory()) return 0;
|
|
18153
|
+
const first = branch[0];
|
|
18154
|
+
return first && (first.parentId == null || manager.getEntrySeq(first.id) === 1) ? 0 : void 0;
|
|
18155
|
+
}
|
|
18156
|
+
const getEntry = (id) => manager?.getEntry(id);
|
|
18157
|
+
const positionOf = (id) => manager?.getEntrySeq(id);
|
|
18158
|
+
let entry = getEntry(notes.summarizedParent);
|
|
18159
|
+
while (entry) {
|
|
18097
18160
|
if (entry.type === "message" && entry.message.role === "assistant") return countDroppedThinkingBlocks(entry.message);
|
|
18098
|
-
if (
|
|
18099
|
-
|
|
18161
|
+
if (entry.parentId === null) return 0;
|
|
18162
|
+
const parent = sessionParent(entry, getEntry, positionOf);
|
|
18163
|
+
if (!parent) return positionOf(entry.parentId) === void 0 ? void 0 : 0;
|
|
18164
|
+
entry = parent;
|
|
18100
18165
|
}
|
|
18101
18166
|
}
|
|
18102
18167
|
function paintReplyNotices(mode, notes) {
|
|
@@ -18891,7 +18956,7 @@ InteractiveModeBase.prototype.bindCurrentSessionExtensions = async function() {
|
|
|
18891
18956
|
newSession: async (options) => {
|
|
18892
18957
|
InteractiveModeBase.prototype.clearWorkingLoader.call(this);
|
|
18893
18958
|
try {
|
|
18894
|
-
const result = await this.runtimeHost.newSession(options);
|
|
18959
|
+
const result = await withSessionLoading(this, "Starting session", () => this.runtimeHost.newSession(options));
|
|
18895
18960
|
if (!result.cancelled) {
|
|
18896
18961
|
this.renderCurrentSessionState();
|
|
18897
18962
|
this.ui.requestRender();
|
|
@@ -18903,7 +18968,7 @@ InteractiveModeBase.prototype.bindCurrentSessionExtensions = async function() {
|
|
|
18903
18968
|
},
|
|
18904
18969
|
fork: async (entryId, options) => {
|
|
18905
18970
|
try {
|
|
18906
|
-
const result = await this.runtimeHost.fork(entryId, options);
|
|
18971
|
+
const result = await withSessionLoading(this, "Forking session", () => this.runtimeHost.fork(entryId, options));
|
|
18907
18972
|
if (!result.cancelled) {
|
|
18908
18973
|
this.renderCurrentSessionState();
|
|
18909
18974
|
this.editor.setText(result.selectedText ?? "");
|
|
@@ -19153,7 +19218,7 @@ function canArmMaxDeferralCap(host, controller) {
|
|
|
19153
19218
|
}
|
|
19154
19219
|
function isPromptStreamingEvent(event) {
|
|
19155
19220
|
if (!event) return false;
|
|
19156
|
-
return event.type === "message_start" && event.message?.role === "assistant" || event.type === "message_update" || event.type === "tool_execution_start";
|
|
19221
|
+
return event.type === "message_start" && typeof event.message !== "string" && event.message?.role === "assistant" || event.type === "message_update" || event.type === "tool_execution_start";
|
|
19157
19222
|
}
|
|
19158
19223
|
function startBackgroundWarmup(host, controller) {
|
|
19159
19224
|
clearQuietTimer(controller);
|
|
@@ -19819,7 +19884,7 @@ InteractiveModeBase.prototype.showUserMessageSelector = async function() {
|
|
|
19819
19884
|
done();
|
|
19820
19885
|
try {
|
|
19821
19886
|
await this.ensureDeferredStartupComplete();
|
|
19822
|
-
const result = await this.runtimeHost.fork(entryId);
|
|
19887
|
+
const result = await withSessionLoading(this, "Forking session", () => this.runtimeHost.fork(entryId));
|
|
19823
19888
|
if (result.cancelled) {
|
|
19824
19889
|
this.ui.requestRender();
|
|
19825
19890
|
return;
|
|
@@ -22665,12 +22730,18 @@ InteractiveModeBase.prototype.init = async function() {
|
|
|
22665
22730
|
scrollbarThumbStyle: (text) => theme.bg("scrollbarThumb", text)
|
|
22666
22731
|
});
|
|
22667
22732
|
const pendingMessagesPreview = clickableBlocksView(this.pendingMessagesContainer, () => this.navigationInlineCustomUiDepth > 0);
|
|
22733
|
+
const sessionLoading = sessionLoadingDock(this);
|
|
22668
22734
|
const dock = new VStack([
|
|
22669
22735
|
{
|
|
22670
22736
|
component: pendingMessagesPreview,
|
|
22671
22737
|
shrink: 1,
|
|
22672
22738
|
minSize: 0
|
|
22673
22739
|
},
|
|
22740
|
+
{
|
|
22741
|
+
component: sessionLoading,
|
|
22742
|
+
shrink: 1,
|
|
22743
|
+
minSize: 0
|
|
22744
|
+
},
|
|
22674
22745
|
{
|
|
22675
22746
|
component: this.statusContainer,
|
|
22676
22747
|
shrink: 1,
|
|
@@ -22719,6 +22790,7 @@ InteractiveModeBase.prototype.init = async function() {
|
|
|
22719
22790
|
this.mountInteractiveTui(this.ui, [
|
|
22720
22791
|
this.documentContainer,
|
|
22721
22792
|
pendingMessagesPreview,
|
|
22793
|
+
sessionLoading,
|
|
22722
22794
|
this.statusContainer,
|
|
22723
22795
|
this.widgetContainerAbove,
|
|
22724
22796
|
this.usageMeter,
|
|
@@ -22805,12 +22877,14 @@ InteractiveModeBase.prototype.init = async function() {
|
|
|
22805
22877
|
eagerChangelogPreload?.catch(() => {});
|
|
22806
22878
|
let bootstrapPreview;
|
|
22807
22879
|
try {
|
|
22808
|
-
|
|
22880
|
+
const waitForBinding = () => waitForInteractiveEngineBound(this.runtimeHost, (lines) => {
|
|
22809
22881
|
if (this.isShuttingDown) return;
|
|
22810
22882
|
bootstrapPreview = new Text$1(lines.map(replaceControlCharacters).join("\n\n"), 1, 0);
|
|
22811
22883
|
this.chatContainer.addChild(bootstrapPreview);
|
|
22812
22884
|
this.ui.requestRender();
|
|
22813
22885
|
});
|
|
22886
|
+
if ((this.sessionManager?.getEntryCount?.() ?? 0) > 0) await withSessionLoading(this, "Loading session", waitForBinding);
|
|
22887
|
+
else await waitForBinding();
|
|
22814
22888
|
} finally {
|
|
22815
22889
|
if (bootstrapPreview) {
|
|
22816
22890
|
this.chatContainer.removeChild(bootstrapPreview);
|
|
@@ -23781,6 +23855,7 @@ InteractiveModeBase.prototype.setupExtensionShortcuts = function(extensionRunner
|
|
|
23781
23855
|
this.shutdownRequested = true;
|
|
23782
23856
|
},
|
|
23783
23857
|
getContextUsage: () => this.session.getContextUsage(),
|
|
23858
|
+
getSubscriptionUsage: (options) => extensionRunner.createContext().getSubscriptionUsage(options),
|
|
23784
23859
|
compact: (options) => {
|
|
23785
23860
|
(async () => {
|
|
23786
23861
|
try {
|
|
@@ -25219,6 +25294,7 @@ InteractiveModeBase.prototype.handleEvent = function(event) {
|
|
|
25219
25294
|
return result;
|
|
25220
25295
|
};
|
|
25221
25296
|
async function handleAgentEvent(event, call) {
|
|
25297
|
+
if (isSessionLoadEvent(event)) return;
|
|
25222
25298
|
if ("parentToolCallId" in event && event.parentToolCallId && event.type.startsWith("tool_execution_")) return;
|
|
25223
25299
|
if (!this.isInitialized) {
|
|
25224
25300
|
const startup = {
|
|
@@ -26408,6 +26484,7 @@ InteractiveModeBase.prototype.showPackageUpdateNotification = function(packages,
|
|
|
26408
26484
|
// dist/core/subscription-usage.js
|
|
26409
26485
|
const USAGE_TIMEOUT_MS = 5e3;
|
|
26410
26486
|
const CACHE_MS = 6e4;
|
|
26487
|
+
const OBSERVATION_WAIT_MS = 1e3;
|
|
26411
26488
|
const usageProviders = {
|
|
26412
26489
|
anthropic: "claude",
|
|
26413
26490
|
openai: "openai-direct",
|
|
@@ -26417,53 +26494,73 @@ const usageProviders = {
|
|
|
26417
26494
|
"kimi-coding": "kimi",
|
|
26418
26495
|
openrouter: "openrouter"
|
|
26419
26496
|
};
|
|
26420
|
-
function
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26497
|
+
function hasFigures(details) {
|
|
26498
|
+
return Boolean(details.windows.length || details.rateLimits?.length || details.resetCredits !== void 0 || details.credits || details.extraUsage || details.creditCap || details.unlimitedWindows?.length);
|
|
26499
|
+
}
|
|
26500
|
+
function withAvailability(result) {
|
|
26501
|
+
const available = result.status === "ready" ? hasFigures(result) : result.status === "unavailable" && result.reason === "api_key";
|
|
26502
|
+
return {
|
|
26503
|
+
...result,
|
|
26504
|
+
availability: available ? "available" : "unavailable"
|
|
26425
26505
|
};
|
|
26506
|
+
}
|
|
26507
|
+
function accountType(runtime, provider, refresh = true) {
|
|
26508
|
+
const registered = runtime.getProvider(provider);
|
|
26426
26509
|
const status = runtime.getProviderAuthStatus(provider, { refresh });
|
|
26427
26510
|
const source = runtime.getBuiltinAccountProvider(provider);
|
|
26428
26511
|
const kind = source ? usageProviders[source] : void 0;
|
|
26429
26512
|
const credential = runtime.getCredentialSnapshot(provider);
|
|
26430
26513
|
const claudeToken = kind === "claude" && (status.source === "stored" && credential?.type === "api_key" && credential.key?.startsWith("sk-ant-oat") || status.source === "environment" && status.label === "ANTHROPIC_OAUTH_TOKEN");
|
|
26431
|
-
|
|
26514
|
+
const oauth = status.source === "stored" && (credential?.type ?? runtime.getStoredCredentialType(provider)) === "oauth";
|
|
26515
|
+
const account = {
|
|
26516
|
+
provider,
|
|
26517
|
+
name: registered?.name ?? provider,
|
|
26518
|
+
current: false
|
|
26519
|
+
};
|
|
26520
|
+
const subscription = status.configured && (claudeToken || oauth && registered?.auth.oauth?.isSubscription === true);
|
|
26521
|
+
if (status.configured && (oauth || claudeToken)) {
|
|
26432
26522
|
if (kind) return {
|
|
26433
26523
|
account,
|
|
26524
|
+
subscription,
|
|
26434
26525
|
kind
|
|
26435
26526
|
};
|
|
26436
26527
|
return {
|
|
26437
26528
|
account,
|
|
26529
|
+
subscription,
|
|
26438
26530
|
reason: "unsupported"
|
|
26439
26531
|
};
|
|
26440
26532
|
}
|
|
26441
26533
|
return {
|
|
26442
26534
|
account,
|
|
26535
|
+
subscription,
|
|
26443
26536
|
reason: status.configured ? "api_key" : "not_signed_in"
|
|
26444
26537
|
};
|
|
26445
26538
|
}
|
|
26446
|
-
async function listUsageAccounts(runtime, current, signal) {
|
|
26539
|
+
async function listUsageAccounts(runtime, current, signal, subscriptionsOnly = false) {
|
|
26447
26540
|
const credentials = await runtime.listCredentials({ signal });
|
|
26448
26541
|
const catalog = runtime.getProviders();
|
|
26449
26542
|
if (catalog[0]) runtime.getProviderAuthStatus(catalog[0].id);
|
|
26450
|
-
return [.../* @__PURE__ */ new Set([...credentials.map(({ providerId }) => providerId), ...catalog.filter(({ id }) => runtime.getProviderAuthStatus(id, { refresh: false }).configured).map(({ id }) => id)])].
|
|
26451
|
-
const { account, reason } = accountType(runtime, provider, false);
|
|
26452
|
-
|
|
26453
|
-
|
|
26543
|
+
return [.../* @__PURE__ */ new Set([...credentials.map(({ providerId }) => providerId), ...catalog.filter(({ id }) => runtime.getProviderAuthStatus(id, { refresh: false }).configured).map(({ id }) => id)])].flatMap((provider) => {
|
|
26544
|
+
const { account, reason, subscription } = accountType(runtime, provider, false);
|
|
26545
|
+
if (subscriptionsOnly && !subscription) return [];
|
|
26546
|
+
account.current = !subscriptionsOnly && provider === current;
|
|
26547
|
+
return [reason ? withAvailability({
|
|
26454
26548
|
...account,
|
|
26455
26549
|
status: "unavailable",
|
|
26456
26550
|
reason,
|
|
26457
26551
|
message: usageReason[reason]
|
|
26458
|
-
} : {
|
|
26552
|
+
}) : {
|
|
26459
26553
|
...account,
|
|
26460
26554
|
status: "loading"
|
|
26461
|
-
};
|
|
26555
|
+
}];
|
|
26462
26556
|
}).sort((a, b) => Number(b.current) - Number(a.current) || a.name.localeCompare(b.name) || a.provider.localeCompare(b.provider));
|
|
26463
26557
|
}
|
|
26464
26558
|
const cache = /* @__PURE__ */ new Map();
|
|
26465
26559
|
const RETAIN_CACHE_MS = 9e5;
|
|
26466
26560
|
async function loadAccountUsage(runtime, provider, current, options = {}) {
|
|
26561
|
+
return withAvailability(await resolveAccountUsage(runtime, provider, current, options));
|
|
26562
|
+
}
|
|
26563
|
+
async function resolveAccountUsage(runtime, provider, current, options) {
|
|
26467
26564
|
options.signal?.throwIfAborted();
|
|
26468
26565
|
const { account, kind, reason } = accountType(runtime, provider);
|
|
26469
26566
|
account.current = provider === current;
|
|
@@ -26476,104 +26573,167 @@ async function loadAccountUsage(runtime, provider, current, options = {}) {
|
|
|
26476
26573
|
message: usageReason[unavailable]
|
|
26477
26574
|
};
|
|
26478
26575
|
}
|
|
26479
|
-
const
|
|
26480
|
-
|
|
26481
|
-
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
|
|
26489
|
-
|
|
26490
|
-
...account,
|
|
26491
|
-
status: "unavailable",
|
|
26492
|
-
reason: "not_observed",
|
|
26493
|
-
message: usageReason.not_observed
|
|
26494
|
-
};
|
|
26495
|
-
} catch {
|
|
26496
|
-
options.signal?.throwIfAborted();
|
|
26497
|
-
return {
|
|
26498
|
-
...account,
|
|
26499
|
-
status: "failed",
|
|
26500
|
-
reason: "request_failed",
|
|
26501
|
-
message: "Could not read local account details."
|
|
26502
|
-
};
|
|
26576
|
+
const store = options.store ?? usageObservationStore(runtime);
|
|
26577
|
+
const attempt = (operation) => withProviderTimeout(OBSERVATION_WAIT_MS, options.signal, operation, "Stored subscription usage").catch(() => void 0);
|
|
26578
|
+
const fromStorage = store ? attempt(async (signal) => {
|
|
26579
|
+
const key = await runtime[readUsageAccountKey](provider, kind, signal);
|
|
26580
|
+
return key ? store.read(key) : void 0;
|
|
26581
|
+
}) : void 0;
|
|
26582
|
+
const credential = runtime.getCredentialSnapshot(provider);
|
|
26583
|
+
let token = credential ? usageCredentialToken(credential) : kind === "claude" ? process.env.ANTHROPIC_OAUTH_TOKEN : void 0;
|
|
26584
|
+
if (kind === "openai-direct" && !token) {
|
|
26585
|
+
const direct = await attempt((signal) => runtime[readSubscriptionCredential](provider, signal));
|
|
26586
|
+
if (direct?.type === "oauth") token = direct.access;
|
|
26503
26587
|
}
|
|
26504
|
-
|
|
26505
|
-
|
|
26588
|
+
const offline = isOfflineModeEnabled();
|
|
26589
|
+
const failure = {
|
|
26506
26590
|
status: "unavailable",
|
|
26507
|
-
reason: "
|
|
26508
|
-
message: usageReason.offline
|
|
26591
|
+
reason: "no_subscription"
|
|
26509
26592
|
};
|
|
26510
|
-
let
|
|
26511
|
-
|
|
26512
|
-
|
|
26513
|
-
|
|
26514
|
-
let token;
|
|
26593
|
+
let fetched;
|
|
26594
|
+
if (!options.observedOnly && !offline && kind !== "openai-direct") try {
|
|
26595
|
+
fetched = await withProviderTimeout(options.timeoutMs ?? USAGE_TIMEOUT_MS, options.signal, async (signal) => {
|
|
26596
|
+
let identityToken;
|
|
26515
26597
|
if (kind === "copilot") {
|
|
26516
26598
|
const github = await runtime[readSubscriptionCredential](provider, signal);
|
|
26517
26599
|
if (github?.type === "oauth" && github.enterpriseUrl) return {
|
|
26518
|
-
|
|
26519
|
-
|
|
26600
|
+
observedAt: Date.now(),
|
|
26601
|
+
result: failure
|
|
26520
26602
|
};
|
|
26603
|
+
identityToken = github?.type === "oauth" ? github.access : void 0;
|
|
26521
26604
|
token = github?.type === "oauth" ? github.refresh : void 0;
|
|
26522
26605
|
} else {
|
|
26523
26606
|
const auth = await runtime.getAuth(provider, { signal });
|
|
26524
26607
|
token = auth && subscriptionBearer(auth.auth);
|
|
26608
|
+
identityToken = token;
|
|
26525
26609
|
}
|
|
26526
26610
|
if (!token) return {
|
|
26527
|
-
|
|
26528
|
-
|
|
26611
|
+
observedAt: Date.now(),
|
|
26612
|
+
result: {
|
|
26613
|
+
status: "unavailable",
|
|
26614
|
+
reason: "sign_in_again"
|
|
26615
|
+
}
|
|
26529
26616
|
};
|
|
26530
26617
|
signal.throwIfAborted();
|
|
26531
|
-
|
|
26532
|
-
const cached = cache.get(
|
|
26533
|
-
|
|
26534
|
-
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
|
|
26538
|
-
|
|
26618
|
+
const cacheKey = subscriptionCredentialKey(kind, token);
|
|
26619
|
+
const cached = cache.get(cacheKey);
|
|
26620
|
+
if (cached && Date.now() - cached.observedAt < Math.min(options.maxAgeMs ?? CACHE_MS, RETAIN_CACHE_MS)) return cached;
|
|
26621
|
+
const current = runtime.getCredentialSnapshot(provider);
|
|
26622
|
+
if (kind === "claude" && current?.type === "oauth" && Array.isArray(current.scopes) && !current.scopes.includes("user:profile")) return {
|
|
26623
|
+
observedAt: Date.now(),
|
|
26624
|
+
result: {
|
|
26625
|
+
status: "unavailable",
|
|
26626
|
+
reason: "needs_profile_scope"
|
|
26627
|
+
}
|
|
26539
26628
|
};
|
|
26540
|
-
const accountId = kind === "codex" ? codexAccountId(token) ?? (
|
|
26629
|
+
const accountId = kind === "codex" ? codexAccountId(token) ?? (current?.type === "oauth" && typeof current.accountId === "string" ? current.accountId : void 0) : void 0;
|
|
26541
26630
|
const result = await fetchSubscriptionUsage(kind, token, accountId, signal, options.fetch);
|
|
26631
|
+
const observedAt = Date.now();
|
|
26542
26632
|
if (!signal.aborted) {
|
|
26543
|
-
const observedAt = Date.now();
|
|
26544
26633
|
for (const [id, entry] of cache) if (observedAt - entry.observedAt >= RETAIN_CACHE_MS) cache.delete(id);
|
|
26545
|
-
cache.set(
|
|
26634
|
+
cache.set(cacheKey, {
|
|
26546
26635
|
observedAt,
|
|
26547
26636
|
result
|
|
26548
26637
|
});
|
|
26638
|
+
if (store && identityToken && result.status === "ready" && hasFigures(result)) {
|
|
26639
|
+
const { status: _status, ...details } = result;
|
|
26640
|
+
await attempt(async (storeSignal) => {
|
|
26641
|
+
const key = await runtime[readUsageAccountKey](provider, kind, storeSignal, identityToken);
|
|
26642
|
+
if (key) await store.write(key, {
|
|
26643
|
+
observedAt,
|
|
26644
|
+
details
|
|
26645
|
+
});
|
|
26646
|
+
});
|
|
26647
|
+
}
|
|
26549
26648
|
}
|
|
26550
|
-
return
|
|
26649
|
+
return {
|
|
26650
|
+
observedAt,
|
|
26651
|
+
result
|
|
26652
|
+
};
|
|
26551
26653
|
}, "Subscription usage");
|
|
26552
26654
|
} catch (error) {
|
|
26553
26655
|
options.signal?.throwIfAborted();
|
|
26554
|
-
|
|
26555
|
-
|
|
26556
|
-
|
|
26656
|
+
fetched = {
|
|
26657
|
+
observedAt: Date.now(),
|
|
26658
|
+
result: {
|
|
26659
|
+
status: "failed",
|
|
26660
|
+
reason: error instanceof Error && error.name === "TimeoutError" ? "timeout" : "request_failed"
|
|
26661
|
+
}
|
|
26557
26662
|
};
|
|
26558
26663
|
}
|
|
26559
|
-
|
|
26560
|
-
|
|
26561
|
-
|
|
26562
|
-
|
|
26664
|
+
const shared = await fromStorage;
|
|
26665
|
+
options.signal?.throwIfAborted();
|
|
26666
|
+
const local = !token ? void 0 : kind === "openai-direct" ? observedOpenAiDirectUsage(provider, token) : observedSubscriptionUsage(subscriptionCredentialKey(kind, token));
|
|
26667
|
+
const result = fetched?.result ?? {
|
|
26668
|
+
status: "unavailable",
|
|
26669
|
+
reason: kind === "openai-direct" || options.observedOnly ? "not_observed" : "offline"
|
|
26563
26670
|
};
|
|
26564
|
-
const
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26671
|
+
const fresh = result.status === "ready" && fetched && hasFigures(result) ? fetched.observedAt : -1;
|
|
26672
|
+
if (shared && shared.observedAt > fresh && (!local || shared.observedAt > local.observedAt)) {
|
|
26673
|
+
const check = fetched?.result;
|
|
26674
|
+
return {
|
|
26675
|
+
...account,
|
|
26676
|
+
...displayObservation(shared),
|
|
26677
|
+
status: "ready",
|
|
26678
|
+
source: "stored",
|
|
26679
|
+
...check && check.status !== "ready" ? {
|
|
26680
|
+
reason: check.reason,
|
|
26681
|
+
message: usageReason[check.reason]
|
|
26682
|
+
} : {}
|
|
26683
|
+
};
|
|
26684
|
+
}
|
|
26685
|
+
if (local && local.observedAt > fresh) {
|
|
26686
|
+
const details = displayObservation(local);
|
|
26687
|
+
if (kind === "openai-direct") return {
|
|
26688
|
+
...account,
|
|
26689
|
+
...details,
|
|
26690
|
+
status: "ready",
|
|
26691
|
+
source: "last_request"
|
|
26692
|
+
};
|
|
26693
|
+
if (result.status !== "ready" && result.reason !== "offline" && result.reason !== "not_observed") return {
|
|
26694
|
+
...account,
|
|
26695
|
+
...details,
|
|
26696
|
+
status: "ready",
|
|
26697
|
+
source: "recent_response",
|
|
26698
|
+
reason: result.reason,
|
|
26699
|
+
message: usageReason[result.reason]
|
|
26700
|
+
};
|
|
26701
|
+
return {
|
|
26702
|
+
...account,
|
|
26703
|
+
...details,
|
|
26704
|
+
status: "ready",
|
|
26705
|
+
source: "last_request"
|
|
26706
|
+
};
|
|
26707
|
+
}
|
|
26708
|
+
if (result.status === "ready") {
|
|
26709
|
+
const { status, ...details } = result;
|
|
26710
|
+
return {
|
|
26711
|
+
...account,
|
|
26712
|
+
...displayObservation({
|
|
26713
|
+
observedAt: fetched.observedAt,
|
|
26714
|
+
details
|
|
26715
|
+
}),
|
|
26716
|
+
status,
|
|
26717
|
+
source: "live"
|
|
26718
|
+
};
|
|
26719
|
+
}
|
|
26720
|
+
return {
|
|
26574
26721
|
...account,
|
|
26575
26722
|
...result,
|
|
26576
|
-
message
|
|
26723
|
+
message: usageReason[result.reason]
|
|
26724
|
+
};
|
|
26725
|
+
}
|
|
26726
|
+
function displayObservation(observation) {
|
|
26727
|
+
const details = structuredClone(observation.details);
|
|
26728
|
+
const now = Date.now();
|
|
26729
|
+
return {
|
|
26730
|
+
...details,
|
|
26731
|
+
windows: details.windows.map((window) => window.resetsAt && Date.parse(window.resetsAt) <= now ? {
|
|
26732
|
+
...window,
|
|
26733
|
+
usedPercent: 0,
|
|
26734
|
+
resetsAt: null
|
|
26735
|
+
} : window),
|
|
26736
|
+
observedAt: new Date(observation.observedAt).toISOString()
|
|
26577
26737
|
};
|
|
26578
26738
|
}
|
|
26579
26739
|
async function loadSubscriptionUsage(runtime, current, options = {}) {
|
|
@@ -26583,7 +26743,7 @@ async function loadSubscriptionUsage(runtime, current, options = {}) {
|
|
|
26583
26743
|
const providers = [...new Set(accounts.map(normalizeProviderId))];
|
|
26584
26744
|
return { accounts: await Promise.all(providers.map((provider) => loadAccountUsage(runtime, provider, current, options))) };
|
|
26585
26745
|
}
|
|
26586
|
-
const listed = listUsageAccounts(runtime, current, signal);
|
|
26746
|
+
const listed = listUsageAccounts(runtime, current, signal, options.subscriptionsOnly);
|
|
26587
26747
|
const rows = signal ? await raceWithAbortSignal(listed, signal) : await listed;
|
|
26588
26748
|
return { accounts: await Promise.all(rows.map((row) => row.status === "loading" ? loadAccountUsage(runtime, row.provider, current, options) : row)) };
|
|
26589
26749
|
}
|
|
@@ -26680,6 +26840,16 @@ function usageExtras(usage, now) {
|
|
|
26680
26840
|
return lines;
|
|
26681
26841
|
}
|
|
26682
26842
|
// dist/modes/interactive/components/usage-selector.js
|
|
26843
|
+
const OBSERVATION_POLL_MS = 1e3;
|
|
26844
|
+
function fixedLines(lines) {
|
|
26845
|
+
return {
|
|
26846
|
+
render: () => lines,
|
|
26847
|
+
invalidate() {}
|
|
26848
|
+
};
|
|
26849
|
+
}
|
|
26850
|
+
function hasWindows(row) {
|
|
26851
|
+
return row?.status === "ready" && row.windows.length > 0;
|
|
26852
|
+
}
|
|
26683
26853
|
function safeLabel(text) {
|
|
26684
26854
|
return replaceControlCharacters(stripTerminalSequences(text)).replace(/\s+/g, " ");
|
|
26685
26855
|
}
|
|
@@ -26698,103 +26868,157 @@ function windowLines(window, width, labelWidth, now) {
|
|
|
26698
26868
|
return [...wrapTextWithAnsi(label, width), ...visibleWidth(`${gauge} ${time}`) <= width ? [`${gauge} ${time}`] : [...wrapTextWithAnsi(gauge, width), ...wrapTextWithAnsi(time, width)]];
|
|
26699
26869
|
}
|
|
26700
26870
|
var UsageSelector = class {
|
|
26701
|
-
rows;
|
|
26871
|
+
rows = /* @__PURE__ */ new Map();
|
|
26702
26872
|
loading = false;
|
|
26703
|
-
|
|
26873
|
+
checking = false;
|
|
26874
|
+
poll;
|
|
26704
26875
|
revision = 0;
|
|
26705
|
-
|
|
26706
|
-
|
|
26876
|
+
viewport;
|
|
26877
|
+
layout;
|
|
26707
26878
|
border = new DynamicBorder();
|
|
26708
26879
|
options;
|
|
26709
26880
|
constructor(options) {
|
|
26710
26881
|
this.options = options;
|
|
26882
|
+
this.viewport = new ScrollView({
|
|
26883
|
+
render: (width) => this.renderBody(width),
|
|
26884
|
+
invalidate() {}
|
|
26885
|
+
}, {
|
|
26886
|
+
overscroll: "contain",
|
|
26887
|
+
scrollbarThumbStyle: (text) => theme.bg("scrollbarThumb", text)
|
|
26888
|
+
});
|
|
26711
26889
|
this.reload(false);
|
|
26890
|
+
if (options.observed) this.poll = setInterval(() => this.checkObservations(), OBSERVATION_POLL_MS).unref();
|
|
26712
26891
|
}
|
|
26713
26892
|
dispose() {
|
|
26893
|
+
clearInterval(this.poll);
|
|
26894
|
+
this.viewport.setScrollbar("hidden");
|
|
26714
26895
|
this.revision++;
|
|
26715
26896
|
}
|
|
26716
26897
|
invalidate() {}
|
|
26717
26898
|
async reload(refresh) {
|
|
26718
26899
|
const revision = ++this.revision;
|
|
26719
26900
|
this.loading = true;
|
|
26720
|
-
this.listFailed = false;
|
|
26721
|
-
this.offset = 0;
|
|
26722
|
-
this.rows = void 0;
|
|
26723
|
-
this.options.requestRender();
|
|
26724
26901
|
try {
|
|
26725
26902
|
const rows = await this.options.list();
|
|
26726
26903
|
if (revision !== this.revision) return;
|
|
26727
|
-
this.rows
|
|
26904
|
+
this.rows.clear();
|
|
26905
|
+
for (const row of rows) this.rows.set(row.provider, row);
|
|
26728
26906
|
this.options.requestRender();
|
|
26729
|
-
|
|
26907
|
+
this.checkObservations();
|
|
26908
|
+
await Promise.all(rows.map(async (row) => {
|
|
26730
26909
|
if (row.status !== "loading") return;
|
|
26731
|
-
const result = await this.options.load(row.provider, refresh).catch(() =>
|
|
26732
|
-
|
|
26733
|
-
status: "failed",
|
|
26734
|
-
reason: "request_failed",
|
|
26735
|
-
message: usageReason.request_failed
|
|
26736
|
-
}));
|
|
26737
|
-
if (revision !== this.revision) return;
|
|
26738
|
-
rows[index] = result;
|
|
26739
|
-
this.options.requestRender();
|
|
26910
|
+
const result = await this.options.load(row.provider, refresh).catch(() => void 0);
|
|
26911
|
+
if (revision === this.revision && result) this.update(result);
|
|
26740
26912
|
}));
|
|
26741
|
-
} catch {
|
|
26742
|
-
if (revision === this.revision) this.listFailed = true;
|
|
26743
|
-
} finally {
|
|
26913
|
+
} catch {} finally {
|
|
26744
26914
|
if (revision === this.revision) {
|
|
26745
26915
|
this.loading = false;
|
|
26746
26916
|
this.options.requestRender();
|
|
26747
26917
|
}
|
|
26748
26918
|
}
|
|
26749
26919
|
}
|
|
26920
|
+
update(row) {
|
|
26921
|
+
const current = this.rows.get(row.provider);
|
|
26922
|
+
if (!current || hasWindows(current) && (!hasWindows(row) || (current.observedAt ?? "") > (row.observedAt ?? ""))) return;
|
|
26923
|
+
if (hasWindows(current) && hasWindows(row) && JSON.stringify(current.windows) === JSON.stringify(row.windows)) return;
|
|
26924
|
+
this.rows.set(row.provider, row);
|
|
26925
|
+
this.options.requestRender();
|
|
26926
|
+
}
|
|
26927
|
+
checkObservations() {
|
|
26928
|
+
if (this.checking || !this.options.observed || !this.rows.size) return;
|
|
26929
|
+
this.checking = true;
|
|
26930
|
+
const revision = this.revision;
|
|
26931
|
+
this.options.observed().then((rows) => {
|
|
26932
|
+
if (revision !== this.revision) return;
|
|
26933
|
+
for (const row of rows) if (hasWindows(row)) this.update(row);
|
|
26934
|
+
}, () => {}).finally(() => {
|
|
26935
|
+
this.checking = false;
|
|
26936
|
+
});
|
|
26937
|
+
}
|
|
26938
|
+
handleMouse(event) {
|
|
26939
|
+
if (event.type !== "wheel" || !event.wheelDelta) return void 0;
|
|
26940
|
+
return {
|
|
26941
|
+
handled: true,
|
|
26942
|
+
render: this.viewport.scrollBy(event.wheelDelta) !== event.wheelDelta
|
|
26943
|
+
};
|
|
26944
|
+
}
|
|
26750
26945
|
handleInput(data) {
|
|
26751
26946
|
if (matchesKey(data, "escape")) this.options.close();
|
|
26752
26947
|
else if (matchesKey(data, "r") && !this.loading) this.reload(true);
|
|
26753
|
-
else if (matchesKey(data, "up")) this.
|
|
26754
|
-
else if (matchesKey(data, "down")) this.
|
|
26948
|
+
else if (matchesKey(data, "up")) this.viewport.scrollBy(-1);
|
|
26949
|
+
else if (matchesKey(data, "down")) this.viewport.scrollBy(1);
|
|
26755
26950
|
}
|
|
26756
|
-
|
|
26757
|
-
const pad = width >= 20 ? " " : "";
|
|
26758
|
-
const inner = Math.max(1, width - 2 * pad.length);
|
|
26951
|
+
renderBody(inner) {
|
|
26759
26952
|
const body = [];
|
|
26760
26953
|
const now = Date.now();
|
|
26761
26954
|
const add = (value) => body.push(...wrapTextWithAnsi(value, inner));
|
|
26762
|
-
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
|
|
26766
|
-
|
|
26767
|
-
|
|
26768
|
-
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
}
|
|
26781
|
-
}
|
|
26955
|
+
for (const row of this.rows.values()) {
|
|
26956
|
+
if (body.length) body.push("");
|
|
26957
|
+
const id = row.provider === row.name ? "" : theme.fg("muted", ` · ${safeLabel(row.provider)}`);
|
|
26958
|
+
add(`${theme.bold(safeLabel(row.name))}${id}`);
|
|
26959
|
+
if (hasWindows(row)) {
|
|
26960
|
+
const labelWidth = Math.min(18, Math.max(0, ...row.windows.map((window) => usageWindowLabel(window).length)));
|
|
26961
|
+
for (const window of row.windows) body.push(...windowLines(window, inner, labelWidth, now));
|
|
26962
|
+
} else add(theme.fg("muted", "Not available"));
|
|
26963
|
+
}
|
|
26964
|
+
if (!this.rows.size && !this.loading) add(theme.fg("muted", "Not available"));
|
|
26965
|
+
return body;
|
|
26966
|
+
}
|
|
26967
|
+
[LAYOUT_NODE]() {
|
|
26968
|
+
return this.layout?.[LAYOUT_NODE]();
|
|
26969
|
+
}
|
|
26970
|
+
render(width) {
|
|
26971
|
+
const pad = width >= 20 ? " " : "";
|
|
26972
|
+
const inner = Math.max(1, width - 2 * pad.length);
|
|
26782
26973
|
const capacity = Math.max(1, Math.min(18, this.options.terminalRows() - 9));
|
|
26783
|
-
this.
|
|
26784
|
-
|
|
26785
|
-
const
|
|
26786
|
-
const
|
|
26787
|
-
|
|
26788
|
-
"",
|
|
26789
|
-
...body.slice(this.offset, this.offset + capacity),
|
|
26790
|
-
"",
|
|
26791
|
-
theme.fg("muted", keys)
|
|
26792
|
-
];
|
|
26793
|
-
return [
|
|
26974
|
+
this.viewport.setScrollbar(this.options.scrollbar?.() ?? "hidden");
|
|
26975
|
+
const rowCount = this.viewport.render(inner).length;
|
|
26976
|
+
const bodyHeight = Math.min(rowCount, capacity);
|
|
26977
|
+
const keys = `${theme.bold("↑ ↓")} scroll ${theme.bold("Esc")} close ${theme.bold("r")} refresh`;
|
|
26978
|
+
const head = [
|
|
26794
26979
|
...this.border.render(width),
|
|
26795
|
-
|
|
26980
|
+
`${pad}${truncateToWidth(theme.bold("Subscription usage"), inner)}`,
|
|
26981
|
+
""
|
|
26982
|
+
];
|
|
26983
|
+
const foot = [
|
|
26984
|
+
"",
|
|
26985
|
+
`${pad}${truncateToWidth(theme.fg("muted", keys), inner)}`,
|
|
26796
26986
|
...this.border.render(width)
|
|
26797
26987
|
];
|
|
26988
|
+
const body = pad ? new HStack([
|
|
26989
|
+
{
|
|
26990
|
+
component: fixedLines([pad]),
|
|
26991
|
+
basis: pad.length,
|
|
26992
|
+
shrink: 0
|
|
26993
|
+
},
|
|
26994
|
+
{
|
|
26995
|
+
component: this.viewport,
|
|
26996
|
+
basis: 0,
|
|
26997
|
+
grow: 1
|
|
26998
|
+
},
|
|
26999
|
+
{
|
|
27000
|
+
component: fixedLines([pad]),
|
|
27001
|
+
basis: pad.length,
|
|
27002
|
+
shrink: 0
|
|
27003
|
+
}
|
|
27004
|
+
]) : this.viewport;
|
|
27005
|
+
this.layout = new VStack([
|
|
27006
|
+
{
|
|
27007
|
+
component: fixedLines(head),
|
|
27008
|
+
basis: head.length,
|
|
27009
|
+
shrink: 0
|
|
27010
|
+
},
|
|
27011
|
+
{
|
|
27012
|
+
component: body,
|
|
27013
|
+
basis: bodyHeight
|
|
27014
|
+
},
|
|
27015
|
+
{
|
|
27016
|
+
component: fixedLines(foot),
|
|
27017
|
+
basis: foot.length,
|
|
27018
|
+
shrink: 0
|
|
27019
|
+
}
|
|
27020
|
+
]);
|
|
27021
|
+
return renderLayoutFrame(this, width, head.length + foot.length + bodyHeight, this.options.requestRender).lines;
|
|
26798
27022
|
}
|
|
26799
27023
|
};
|
|
26800
27024
|
// dist/modes/interactive/interactive-selectors.js
|
|
@@ -26837,16 +27061,22 @@ InteractiveModeBase.prototype.showUsageSelector = function() {
|
|
|
26837
27061
|
list: async () => {
|
|
26838
27062
|
if (runtime instanceof IsolatedInteractiveRuntime) return runtime.listUsageAccounts();
|
|
26839
27063
|
await this.ensureDeferredStartupComplete();
|
|
26840
|
-
return listUsageAccounts(this.session.modelRuntime,
|
|
27064
|
+
return listUsageAccounts(this.session.modelRuntime, void 0, void 0, true);
|
|
26841
27065
|
},
|
|
26842
|
-
load: (provider, refresh) => runtime instanceof IsolatedInteractiveRuntime ? runtime.loadAccountUsage(provider, refresh) : loadAccountUsage(this.session.modelRuntime, provider,
|
|
27066
|
+
load: (provider, refresh) => runtime instanceof IsolatedInteractiveRuntime ? runtime.loadAccountUsage(provider, refresh) : loadAccountUsage(this.session.modelRuntime, provider, void 0, { maxAgeMs: refresh ? 0 : void 0 }),
|
|
27067
|
+
observed: async () => runtime instanceof IsolatedInteractiveRuntime ? runtime.observedUsage() : (await loadSubscriptionUsage(this.session.modelRuntime, void 0, {
|
|
27068
|
+
observedOnly: true,
|
|
27069
|
+
subscriptionsOnly: true
|
|
27070
|
+
})).accounts,
|
|
26843
27071
|
requestRender: () => this.ui.requestRender(),
|
|
26844
27072
|
close: () => {
|
|
26845
27073
|
done();
|
|
26846
27074
|
this.ui.requestRender();
|
|
26847
27075
|
},
|
|
26848
|
-
terminalRows: () => this.ui.terminal.rows
|
|
27076
|
+
terminalRows: () => this.ui.terminal.rows,
|
|
27077
|
+
scrollbar: () => this.settingsManager.getFullscreenScrollbar()
|
|
26849
27078
|
});
|
|
27079
|
+
usePromptSlotLayout(component);
|
|
26850
27080
|
return {
|
|
26851
27081
|
component,
|
|
26852
27082
|
focus: component,
|
|
@@ -27166,7 +27396,7 @@ InteractiveModeBase.prototype.handleCloneCommand = async function() {
|
|
|
27166
27396
|
return;
|
|
27167
27397
|
}
|
|
27168
27398
|
try {
|
|
27169
|
-
if ((await this.runtimeHost.fork(leafId, { position: "at" })).cancelled) {
|
|
27399
|
+
if ((await withSessionLoading(this, "Cloning session", () => this.runtimeHost.fork(leafId, { position: "at" }))).cancelled) {
|
|
27170
27400
|
this.ui.requestRender();
|
|
27171
27401
|
return;
|
|
27172
27402
|
}
|
|
@@ -27437,7 +27667,7 @@ InteractiveModeBase.prototype.handleResumeTarget = async function(target) {
|
|
|
27437
27667
|
return;
|
|
27438
27668
|
}
|
|
27439
27669
|
try {
|
|
27440
|
-
const resolution = resolveResumeTarget(target, await SessionManager.listAll(this.sessionManager.getSessionStore()));
|
|
27670
|
+
const resolution = resolveResumeTarget(target, await withSessionLoading(this, "Finding session", () => SessionManager.listAll(this.sessionManager.getSessionStore())));
|
|
27441
27671
|
if (resolution.kind === "session") await resumeCatalogSelection(this, resolution.session);
|
|
27442
27672
|
else if (resolution.kind === "ambiguous") this.showError(`Resume id "${target}" is ambiguous: ${resolution.matches.map((entry) => `session ${entry.id}`).join(", ")}. Use /resume to choose an entry, or provide a unique full id.`);
|
|
27443
27673
|
else this.showError(`No session matches "${target}". Use /resume to choose an entry, or provide a full id or unique 8-character hexadecimal prefix.`);
|
|
@@ -27451,12 +27681,13 @@ InteractiveModeBase.prototype.handleResumeSession = async function(sessionId, op
|
|
|
27451
27681
|
mountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());
|
|
27452
27682
|
const resumeStartedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
27453
27683
|
try {
|
|
27454
|
-
const result = await this.runtimeHost.switchSession(sessionId, {
|
|
27684
|
+
const result = await withSessionLoading(this, "Loading session", (onProgress) => this.runtimeHost.switchSession(sessionId, {
|
|
27455
27685
|
withSession: options?.withSession,
|
|
27456
27686
|
sessionDirectory,
|
|
27457
27687
|
projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
|
|
27458
|
-
history: "tail"
|
|
27459
|
-
|
|
27688
|
+
history: "tail",
|
|
27689
|
+
onProgress
|
|
27690
|
+
}));
|
|
27460
27691
|
if (result.cancelled) return result;
|
|
27461
27692
|
this.renderCurrentSessionState();
|
|
27462
27693
|
if (this.firstRunNoticeVisible) this.clearFirstRunOnboardingUi();
|
|
@@ -27471,12 +27702,17 @@ InteractiveModeBase.prototype.handleResumeSession = async function(sessionId, op
|
|
|
27471
27702
|
}
|
|
27472
27703
|
if (error instanceof MissingSessionCwdError) switch (await this.promptForMissingSessionCwd(error)) {
|
|
27473
27704
|
case "continue": {
|
|
27474
|
-
const result = await this.runtimeHost.switchSession(sessionId, {
|
|
27705
|
+
const result = await withSessionLoading(this, "Loading session", (onProgress) => this.runtimeHost.switchSession(sessionId, {
|
|
27475
27706
|
cwdOverride: error.issue.fallbackCwd,
|
|
27476
27707
|
sessionDirectory,
|
|
27477
27708
|
withSession: options?.withSession,
|
|
27478
27709
|
projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
|
|
27479
|
-
history: "tail"
|
|
27710
|
+
history: "tail",
|
|
27711
|
+
onProgress
|
|
27712
|
+
})).catch((failure) => {
|
|
27713
|
+
if (!(failure instanceof SessionAlreadyOpenError)) throw failure;
|
|
27714
|
+
this.showError(failure.message);
|
|
27715
|
+
return { cancelled: true };
|
|
27480
27716
|
});
|
|
27481
27717
|
if (!result.cancelled) finishMissingCwdResume(this, `Resumed session in ${error.issue.fallbackCwd}`);
|
|
27482
27718
|
return result;
|
|
@@ -27499,12 +27735,12 @@ function finishMissingCwdResume(mode, status) {
|
|
|
27499
27735
|
showSessionNotices(mode, mode.runtimeHost.takeResumeNotices());
|
|
27500
27736
|
mode.startSessionRecovery("resume");
|
|
27501
27737
|
}
|
|
27502
|
-
async function forkIntoActiveStore(mode, source, cwd) {
|
|
27738
|
+
async function forkIntoActiveStore(mode, source, cwd, id) {
|
|
27503
27739
|
const store = mode.sessionManager.getSessionStore();
|
|
27504
|
-
if ("exportPath" in source) return SessionManager.forkFrom(source.exportPath, cwd, store);
|
|
27740
|
+
if ("exportPath" in source) return SessionManager.forkFrom(source.exportPath, cwd, store, { id });
|
|
27505
27741
|
const stored = await mode.sessionManager.openSessionById(source.sessionId, void 0, source.sessionDirectory);
|
|
27506
27742
|
try {
|
|
27507
|
-
return await stored.forkTo(cwd, store);
|
|
27743
|
+
return await stored.forkTo(cwd, store, { id });
|
|
27508
27744
|
} finally {
|
|
27509
27745
|
if (stored.getSessionStore() !== store) await stored.getSessionStore().close();
|
|
27510
27746
|
}
|
|
@@ -27514,19 +27750,28 @@ async function forkIntoActiveStore(mode, source, cwd) {
|
|
|
27514
27750
|
* fork. An extension that cancels the switch leaves no copy behind.
|
|
27515
27751
|
*/
|
|
27516
27752
|
InteractiveModeBase.prototype.switchToForkedSession = async function(source, cwd, options) {
|
|
27517
|
-
const
|
|
27518
|
-
|
|
27519
|
-
|
|
27520
|
-
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
|
|
27753
|
+
const { result, forkId } = await withSessionLoading(this, "Forking session", async (onProgress) => {
|
|
27754
|
+
const forkId = createSessionId();
|
|
27755
|
+
const releaseClaim = this.sessionManager.isPersisted() ? await acquireLiveSessionClaim(forkId, { agentDir: this.runtimeHost.services.agentDir }) : void 0;
|
|
27756
|
+
try {
|
|
27757
|
+
const fork = await forkIntoActiveStore(this, source, cwd, forkId);
|
|
27758
|
+
const result = await this.runtimeHost.switchSession(forkId, {
|
|
27759
|
+
withSession: options?.withSession,
|
|
27760
|
+
projectTrustContextFactory: (forkCwd) => this.createProjectTrustContext(forkCwd),
|
|
27761
|
+
history: "tail",
|
|
27762
|
+
onProgress,
|
|
27763
|
+
startedSession: fork
|
|
27764
|
+
});
|
|
27765
|
+
if (result.cancelled) await this.sessionManager.deleteSession(forkId);
|
|
27766
|
+
return {
|
|
27767
|
+
result,
|
|
27768
|
+
forkId
|
|
27769
|
+
};
|
|
27770
|
+
} finally {
|
|
27771
|
+
await releaseClaim?.();
|
|
27772
|
+
}
|
|
27524
27773
|
});
|
|
27525
|
-
if (result.cancelled) {
|
|
27526
|
-
await this.sessionManager.deleteSession(forkId);
|
|
27527
|
-
return result;
|
|
27528
|
-
}
|
|
27529
|
-
finishMissingCwdResume(this, `Forked into new session ${forkId} in ${cwd}`);
|
|
27774
|
+
if (!result.cancelled) finishMissingCwdResume(this, `Forked into new session ${forkId} in ${cwd}`);
|
|
27530
27775
|
return result;
|
|
27531
27776
|
};
|
|
27532
27777
|
// dist/modes/interactive/interactive-auth-routing.js
|
|
@@ -27928,39 +28173,34 @@ InteractiveModeBase.prototype.handleReloadCommand = async function() {
|
|
|
27928
28173
|
return;
|
|
27929
28174
|
}
|
|
27930
28175
|
this.resetExtensionUI();
|
|
27931
|
-
const reloadBox = new Container$1();
|
|
27932
|
-
const borderColor = (s) => theme.fg("border", s);
|
|
27933
|
-
reloadBox.addChild(new DynamicBorder(borderColor));
|
|
27934
|
-
reloadBox.addChild(new Spacer$1(1));
|
|
27935
|
-
reloadBox.addChild(new Text$1(theme.fg("muted", "Reloading keybindings, extensions, skills, prompts, themes..."), 1, 0));
|
|
27936
|
-
reloadBox.addChild(new Spacer$1(1));
|
|
27937
|
-
reloadBox.addChild(new DynamicBorder(borderColor));
|
|
27938
28176
|
const previousEditor = this.editor;
|
|
28177
|
+
const reloadFocus = new Container$1();
|
|
27939
28178
|
this.editorContainer.clear();
|
|
27940
|
-
this.editorContainer.addChild(
|
|
27941
|
-
this.ui.setFocus(
|
|
27942
|
-
this.ui.requestRender(
|
|
27943
|
-
|
|
27944
|
-
const dismissReloadBox = (editor) => {
|
|
28179
|
+
this.editorContainer.addChild(reloadFocus);
|
|
28180
|
+
this.ui.setFocus(reloadFocus);
|
|
28181
|
+
this.ui.requestRender();
|
|
28182
|
+
const restoreEditor = (editor) => {
|
|
27945
28183
|
this.editorContainer.clear();
|
|
27946
28184
|
this.editorContainer.addChild(editor);
|
|
27947
28185
|
this.ui.setFocus(editor);
|
|
27948
28186
|
this.ui.requestRender();
|
|
27949
28187
|
};
|
|
27950
28188
|
try {
|
|
27951
|
-
|
|
27952
|
-
|
|
27953
|
-
|
|
27954
|
-
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
|
|
28189
|
+
await withSessionLoading(this, "Reloading session", async () => {
|
|
28190
|
+
if (this.runtimeHost instanceof IsolatedInteractiveRuntime) await this.session.reload();
|
|
28191
|
+
else await this.reloadCoordinator.reload(this.session);
|
|
28192
|
+
const activeHeader = this.customHeader ?? this.builtInHeader;
|
|
28193
|
+
if (isExpandable(activeHeader)) activeHeader.setExpanded(this.toolOutputExpanded);
|
|
28194
|
+
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
28195
|
+
this.applyRuntimeSettings();
|
|
28196
|
+
await this.themeController.applyFromSettings();
|
|
28197
|
+
this.setupAutocompleteProvider();
|
|
28198
|
+
const runner = this.session.extensionRunner;
|
|
28199
|
+
this.setupExtensionShortcuts(runner);
|
|
28200
|
+
watchSessionRenderers(this, this.session, runner);
|
|
28201
|
+
this.rebuildChatFromMessages({ resetStartupDisclosure: true });
|
|
28202
|
+
});
|
|
28203
|
+
restoreEditor(this.editor);
|
|
27964
28204
|
const savedImplicitProjectTrust = await this.maybeSaveImplicitProjectTrustAfterReload();
|
|
27965
28205
|
this.showLoadedResources({
|
|
27966
28206
|
force: false,
|
|
@@ -27973,7 +28213,7 @@ InteractiveModeBase.prototype.handleReloadCommand = async function() {
|
|
|
27973
28213
|
this.showStatus("Reloaded keybindings, extensions, skills, prompts, themes");
|
|
27974
28214
|
} catch (error) {
|
|
27975
28215
|
showRestartExtensionErrors(this);
|
|
27976
|
-
|
|
28216
|
+
restoreEditor(previousEditor);
|
|
27977
28217
|
this.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
27978
28218
|
}
|
|
27979
28219
|
};
|
|
@@ -28033,28 +28273,43 @@ InteractiveModeBase.prototype.handleImportCommand = async function(text) {
|
|
|
28033
28273
|
return;
|
|
28034
28274
|
}
|
|
28035
28275
|
const importStartedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
28036
|
-
const finishSuccessfulImport = () => {
|
|
28276
|
+
const finishSuccessfulImport = (repaired = []) => {
|
|
28037
28277
|
this.renderCurrentSessionState();
|
|
28038
28278
|
if (this.firstRunNoticeVisible) this.clearFirstRunOnboardingUi();
|
|
28039
28279
|
this.showStatus(`Session imported from: ${inputPath}`);
|
|
28040
|
-
|
|
28280
|
+
const summary = describeSessionParentRepairs(repaired);
|
|
28281
|
+
showSessionNotices(this, [
|
|
28282
|
+
...summary === void 0 ? [] : [{
|
|
28283
|
+
type: "info",
|
|
28284
|
+
message: summary
|
|
28285
|
+
}],
|
|
28286
|
+
...worktreeRestoreNotices(this.sessionManager, importStartedAt),
|
|
28287
|
+
...this.runtimeHost.takeResumeNotices()
|
|
28288
|
+
]);
|
|
28041
28289
|
};
|
|
28042
28290
|
try {
|
|
28043
28291
|
InteractiveModeBase.prototype.clearWorkingLoader.call(this);
|
|
28044
|
-
|
|
28292
|
+
const result = await withSessionLoading(this, "Importing session", () => this.runtimeHost.importFromJsonl(inputPath));
|
|
28293
|
+
if (result.cancelled) {
|
|
28045
28294
|
this.showStatus("Import cancelled");
|
|
28046
28295
|
return;
|
|
28047
28296
|
}
|
|
28048
|
-
finishSuccessfulImport();
|
|
28297
|
+
finishSuccessfulImport(result.repaired);
|
|
28049
28298
|
} catch (error) {
|
|
28050
28299
|
if (error instanceof MissingSessionCwdError) switch (await this.promptForMissingSessionCwd(error)) {
|
|
28051
|
-
case "continue":
|
|
28052
|
-
|
|
28300
|
+
case "continue": {
|
|
28301
|
+
const result = await withSessionLoading(this, "Importing session", () => this.runtimeHost.importFromJsonl(inputPath, error.issue.fallbackCwd)).catch((failure) => {
|
|
28302
|
+
if (!(failure instanceof SessionAlreadyOpenError)) throw failure;
|
|
28303
|
+
this.showError(failure.message);
|
|
28304
|
+
return { cancelled: true };
|
|
28305
|
+
});
|
|
28306
|
+
if (result.cancelled) {
|
|
28053
28307
|
this.showStatus("Import cancelled");
|
|
28054
28308
|
return;
|
|
28055
28309
|
}
|
|
28056
|
-
finishSuccessfulImport();
|
|
28310
|
+
finishSuccessfulImport(result.repaired);
|
|
28057
28311
|
return;
|
|
28312
|
+
}
|
|
28058
28313
|
case "fork":
|
|
28059
28314
|
if ((await this.switchToForkedSession({ exportPath: inputPath }, error.issue.fallbackCwd)).cancelled) this.showStatus("Import cancelled");
|
|
28060
28315
|
return;
|
|
@@ -28066,7 +28321,7 @@ InteractiveModeBase.prototype.handleImportCommand = async function(text) {
|
|
|
28066
28321
|
this.showError(`Failed to import session: ${error.message}`);
|
|
28067
28322
|
return;
|
|
28068
28323
|
}
|
|
28069
|
-
if (
|
|
28324
|
+
if (isResumeFailure(error)) {
|
|
28070
28325
|
this.showError(error.message);
|
|
28071
28326
|
return;
|
|
28072
28327
|
}
|
|
@@ -28563,7 +28818,7 @@ InteractiveModeBase.prototype.handleClearCommand = async function() {
|
|
|
28563
28818
|
await this.ensureDeferredStartupComplete();
|
|
28564
28819
|
InteractiveModeBase.prototype.clearWorkingLoader.call(this);
|
|
28565
28820
|
try {
|
|
28566
|
-
if ((await this.runtimeHost.newSession()).cancelled) return;
|
|
28821
|
+
if ((await withSessionLoading(this, "Starting session", () => this.runtimeHost.newSession())).cancelled) return;
|
|
28567
28822
|
this.renderCurrentSessionState();
|
|
28568
28823
|
if (this.firstRunNoticeVisible) this.clearFirstRunOnboardingUi();
|
|
28569
28824
|
this.chatContainer.addChild(new Spacer$1(1));
|
|
@@ -28629,7 +28884,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
28629
28884
|
return (async () => {
|
|
28630
28885
|
const root = new URL("../", import.meta.url);
|
|
28631
28886
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
28632
|
-
const key = `${root.href}#0.10.
|
|
28887
|
+
const key = `${root.href}#0.10.20-alpha.2`;
|
|
28633
28888
|
let release = releases.get(key);
|
|
28634
28889
|
if (release === undefined) {
|
|
28635
28890
|
const current = (async () => {
|
|
@@ -28657,7 +28912,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
28657
28912
|
} catch {
|
|
28658
28913
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
28659
28914
|
}
|
|
28660
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.
|
|
28915
|
+
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;
|
|
28661
28916
|
if (updatedTo === undefined) throw error;
|
|
28662
28917
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
28663
28918
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|