@bastani/atomic 0.10.4-alpha.2 → 0.10.5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +238 -0
- package/dist/_shared/chunk-CDOYTDYM.js +4 -0
- package/dist/_shared/chunk-CDOYTDYM.js.map +1 -0
- package/dist/_shared/compile-cache-warmup-host-RU5L7I7A.js +1 -1
- package/dist/_shared/dist-KOELCESV.js +48 -3
- package/dist/_shared/fork-row-index-UAUAQRD5.js +47 -2
- package/dist/_shared/http-YFAPTIZD.js +16 -4
- package/dist/_shared/http-YFAPTIZD.js.map +1 -1
- package/dist/_shared/lib-4PES5P4V.js +59 -14
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +1706 -258
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +317 -64
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/{mode-shared-HP7GUA7J.js → mode-shared-2QJSCUM6.js} +432 -81
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -0
- package/dist/_shared/p0-cli-BB45ZQY6.js +3482 -0
- package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -0
- package/dist/_shared/p0-cli-GUFK7TPN.js +2 -2838
- package/dist/_shared/p0-cli-GUFK7TPN.js.map +1 -1
- package/dist/_shared/{p1a-prewarm-YK3KDTLN.js → p1a-prewarm-UQY3X2UK.js} +270 -73
- package/dist/_shared/p1a-prewarm-UQY3X2UK.js.map +1 -0
- package/dist/_shared/{p1b-elig-PXQA2FYP.js → p1b-elig-ENCUPKKJ.js} +190 -121
- package/dist/_shared/p1b-elig-ENCUPKKJ.js.map +1 -0
- package/dist/_shared/p2-common-YLSYXMDQ.js +1 -3
- package/dist/_shared/p2-common-YLSYXMDQ.js.map +1 -1
- package/dist/_shared/p2-shell-TJBYQMCJ.js +1 -1
- package/dist/_shared/p2-shell-main-B2WIALFD.js +500 -127
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +4 -4
- package/dist/_shared/sdk-WQIOHVKO.js +56 -11
- package/dist/_shared/session-data-AHTU7IS6.js +48 -3
- package/dist/_shared/session-manager-list-2BLEEZVG.js +2 -2
- package/dist/_shared/settings-startup-65YEWRV2.js.map +1 -1
- package/dist/_shared/sql-session-store-5FD3WBMZ.js +57 -12
- package/dist/_shared/{startup-0-0-X4NF3GKM.js → startup-0-0-TYUFUOJZ.js} +528 -321
- package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +1 -0
- package/dist/_shared/{startup-0-1-7QTG6VJZ.js → startup-0-1-D4LGGINF.js} +284 -81
- package/dist/_shared/startup-0-1-D4LGGINF.js.map +1 -0
- package/dist/_shared/{startup-0-2-KFDYPDJK.js → startup-0-2-SZGQIWHI.js} +483 -154
- package/dist/_shared/startup-0-2-SZGQIWHI.js.map +1 -0
- package/dist/_shared/startup-0-3-T4DVFYWX.js +340 -110
- package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
- package/dist/_shared/startup-0-4-HN5EB4K7.js +261 -59
- package/dist/_shared/startup-0-4-HN5EB4K7.js.map +1 -1
- package/dist/_shared/startup-0-5-OHJNE6JH.js +421 -148
- package/dist/_shared/startup-0-5-OHJNE6JH.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +62 -11
- package/dist/_shared/startup-10-0-TDQNBDDL.js.map +1 -1
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +12 -11
- package/dist/_shared/startup-14-0-MLX36RBG.js.map +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +53 -158
- package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +231 -46
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +115 -35
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/{startup-8-1-KQJBDKRU.js → startup-8-1-SJW2GMAM.js} +203 -62
- package/dist/_shared/startup-8-1-SJW2GMAM.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +55 -10
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +47 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +48 -3
- package/dist/builtin/intercom/CHANGELOG.md +59 -0
- package/dist/builtin/intercom/README.md +0 -1
- package/dist/builtin/intercom/broker/broker-instance.ts +13 -57
- package/dist/builtin/intercom/broker/broker-process.ts +30 -10
- package/dist/builtin/intercom/broker/broker-routing.ts +12 -2
- package/dist/builtin/intercom/broker/broker.bundle.mjs +2557 -498
- package/dist/builtin/intercom/broker/broker.ts +164 -55
- package/dist/builtin/intercom/broker/client.ts +36 -16
- package/dist/builtin/intercom/broker/control.ts +83 -20
- package/dist/builtin/intercom/broker/durable-ended-queue.ts +65 -19
- package/dist/builtin/intercom/broker/host-command-environment.ts +7 -2
- package/dist/builtin/intercom/broker/multinode-router.ts +1675 -387
- package/dist/builtin/intercom/broker/multinode-state-store.ts +10 -0
- package/dist/builtin/intercom/broker/paths.ts +68 -6
- package/dist/builtin/intercom/broker/pending-send-registry.ts +5 -0
- package/dist/builtin/intercom/broker/registration-bounds.ts +38 -0
- package/dist/builtin/intercom/broker/retiring-broker-check.ts +178 -0
- package/dist/builtin/intercom/broker/return-paths.ts +268 -7
- package/dist/builtin/intercom/broker/send-handler.ts +253 -28
- package/dist/builtin/intercom/broker/send-order-gate.ts +410 -0
- package/dist/builtin/intercom/broker/spawn.ts +950 -202
- package/dist/builtin/intercom/broker/sql-lease-store.ts +37 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +7 -0
- package/dist/builtin/intercom/broker/windows-cwd.ts +546 -0
- package/dist/builtin/intercom/index.bundle.mjs +3506 -2328
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/retry-policy.ts +4 -0
- package/dist/builtin/intercom/types.ts +2 -0
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +46 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +336 -86
- package/dist/builtin/web-access/CHANGELOG.md +12 -0
- package/dist/builtin/web-access/index.bundle.mjs +23 -38
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/bun/cli.js +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/internal-intercom-broker.js +119 -4
- package/dist/bun/internal-intercom-broker.js.map +1 -1
- package/dist/bun/register-theme-validator.js +6 -0
- package/dist/bun/register-theme-validator.js.map +1 -0
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +1102 -0
- package/dist/cli/auth-cli.code.js.map +1 -0
- package/dist/cli/auth-cli.impl.js +36 -0
- package/dist/cli/auth-cli.impl.js.map +1 -0
- package/dist/cli/auth-cli.js +30 -1096
- package/dist/cli/auth-cli.js.map +1 -1
- package/dist/cli/blueprint-command.code.js +906 -0
- package/dist/cli/blueprint-command.code.js.map +1 -0
- package/dist/cli/blueprint-command.impl.js +36 -0
- package/dist/cli/blueprint-command.impl.js.map +1 -0
- package/dist/cli/blueprint-command.js +30 -900
- package/dist/cli/blueprint-command.js.map +1 -1
- package/dist/cli/intercom-command.code.js +153 -0
- package/dist/cli/intercom-command.code.js.map +1 -0
- package/dist/cli/intercom-command.impl.js +36 -0
- package/dist/cli/intercom-command.impl.js.map +1 -0
- package/dist/cli/intercom-command.js +33 -105
- package/dist/cli/intercom-command.js.map +1 -1
- package/dist/cli/list-models.code.js +60 -0
- package/dist/cli/list-models.code.js.map +1 -0
- package/dist/cli/list-models.impl.js +36 -0
- package/dist/cli/list-models.impl.js.map +1 -0
- package/dist/cli/list-models.js +33 -57
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.code.js +55 -0
- package/dist/cli/session-picker.code.js.map +1 -0
- package/dist/cli/session-picker.impl.js +36 -0
- package/dist/cli/session-picker.impl.js.map +1 -0
- package/dist/cli/session-picker.js +33 -52
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.code.js +5 -0
- package/dist/cli/startup-ui.code.js.map +1 -0
- package/dist/cli/startup-ui.impl.js +36 -0
- package/dist/cli/startup-ui.impl.js.map +1 -0
- package/dist/cli/startup-ui.js +35 -4
- package/dist/cli/storage-command.code.js +3 -0
- package/dist/cli/storage-command.code.js.map +1 -0
- package/dist/cli/storage-command.impl.js +36 -0
- package/dist/cli/storage-command.impl.js.map +1 -0
- package/dist/cli/storage-command.js +35 -2
- package/dist/cli/storage-search-session.code.js +189 -0
- package/dist/cli/storage-search-session.code.js.map +1 -0
- package/dist/cli/storage-search-session.impl.js +36 -0
- package/dist/cli/storage-search-session.impl.js.map +1 -0
- package/dist/cli/storage-search-session.js +33 -186
- package/dist/cli/storage-search-session.js.map +1 -1
- package/dist/cli/team-command.code.js +217 -0
- package/dist/cli/team-command.code.js.map +1 -0
- package/dist/cli/team-command.impl.js +36 -0
- package/dist/cli/team-command.impl.js.map +1 -0
- package/dist/cli/team-command.js +32 -213
- package/dist/cli/team-command.js.map +1 -1
- package/dist/cli.js +60 -11
- package/dist/cli.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/core/agent-session-methods.d.ts +4 -3
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +5 -0
- package/dist/core/compaction/compaction.d.ts +6 -0
- package/dist/core/compaction/model-resolver.d.ts +1 -1
- package/dist/core/debug.code.js +3 -0
- package/dist/core/debug.code.js.map +1 -0
- package/dist/core/debug.impl.js +36 -0
- package/dist/core/debug.impl.js.map +1 -0
- package/dist/core/debug.js +35 -2
- package/dist/core/default-model-api-prewarm.d.ts +5 -0
- package/dist/core/export-html/card-projection.code.js +257 -0
- package/dist/core/export-html/card-projection.code.js.map +1 -0
- package/dist/core/export-html/card-projection.impl.js +36 -0
- package/dist/core/export-html/card-projection.impl.js.map +1 -0
- package/dist/core/export-html/card-projection.js +34 -255
- package/dist/core/export-html/card-projection.js.map +1 -1
- package/dist/core/export-html/index.code.js +655 -0
- package/dist/core/export-html/index.code.js.map +1 -0
- package/dist/core/export-html/index.impl.js +36 -0
- package/dist/core/export-html/index.impl.js.map +1 -0
- package/dist/core/export-html/index.js +30 -604
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/json-spans.code.js +3 -0
- package/dist/core/export-html/json-spans.code.js.map +1 -0
- package/dist/core/export-html/json-spans.impl.js +36 -0
- package/dist/core/export-html/json-spans.impl.js.map +1 -0
- package/dist/core/export-html/json-spans.js +35 -2
- package/dist/core/export-html/oversized-render-inputs.code.js +125 -0
- package/dist/core/export-html/oversized-render-inputs.code.js.map +1 -0
- package/dist/core/export-html/oversized-render-inputs.impl.js +36 -0
- package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -0
- package/dist/core/export-html/oversized-render-inputs.js +31 -120
- package/dist/core/export-html/oversized-render-inputs.js.map +1 -1
- package/dist/core/export-html/tool-renderer.code.js +350 -0
- package/dist/core/export-html/tool-renderer.code.js.map +1 -0
- package/dist/core/export-html/tool-renderer.impl.js +36 -0
- package/dist/core/export-html/tool-renderer.impl.js.map +1 -0
- package/dist/core/export-html/tool-renderer.js +33 -347
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/jiti-loader.code.js +3 -0
- package/dist/core/extensions/jiti-loader.code.js.map +1 -0
- package/dist/core/extensions/jiti-loader.impl.js +36 -0
- package/dist/core/extensions/jiti-loader.impl.js.map +1 -0
- package/dist/core/extensions/jiti-loader.js +35 -2
- package/dist/core/extensions/jiti-static-loader.code.js +3 -0
- package/dist/core/extensions/jiti-static-loader.code.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.impl.js +36 -0
- package/dist/core/extensions/jiti-static-loader.impl.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +35 -2
- package/dist/core/extensions/loader-host-modules.code.js +3 -0
- package/dist/core/extensions/loader-host-modules.code.js.map +1 -0
- package/dist/core/extensions/loader-host-modules.impl.js +36 -0
- package/dist/core/extensions/loader-host-modules.impl.js.map +1 -0
- package/dist/core/extensions/loader-host-modules.js +35 -2
- package/dist/core/extensions/loader-virtual-modules.d.ts +1 -6
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/runner-context.js +3 -3
- package/dist/core/extensions/session-events.d.ts +4 -0
- package/dist/core/extensions/session-events.js.map +1 -1
- package/dist/core/intercom-broker-control-host.code.js +5 -0
- package/dist/core/intercom-broker-control-host.code.js.map +1 -0
- package/dist/core/intercom-broker-control-host.impl.js +36 -0
- package/dist/core/intercom-broker-control-host.impl.js.map +1 -0
- package/dist/core/intercom-broker-control-host.js +35 -4
- package/dist/core/intercom-broker-control.code.js +63 -0
- package/dist/core/intercom-broker-control.code.js.map +1 -0
- package/dist/core/intercom-broker-control.d.ts +21 -0
- package/dist/core/intercom-broker-control.impl.js +36 -0
- package/dist/core/intercom-broker-control.impl.js.map +1 -0
- package/dist/core/intercom-broker-control.js +35 -17
- package/dist/core/intercom-broker-control.js.map +1 -1
- package/dist/core/package-manager-storage-adapters.code.js +3 -0
- package/dist/core/package-manager-storage-adapters.code.js.map +1 -0
- package/dist/core/package-manager-storage-adapters.impl.js +36 -0
- package/dist/core/package-manager-storage-adapters.impl.js.map +1 -0
- package/dist/core/package-manager-storage-adapters.js +35 -2
- package/dist/core/process-start-token.d.ts +8 -2
- package/dist/core/process-tree-containment.d.ts +27 -0
- package/dist/core/queued-message-delivery.d.ts +5 -2
- package/dist/core/resume/blueprint/process.d.ts +3 -1
- package/dist/core/sdk.code.js +9 -0
- package/dist/core/sdk.code.js.map +1 -0
- package/dist/core/sdk.impl.js +36 -0
- package/dist/core/sdk.impl.js.map +1 -0
- package/dist/core/sdk.js +35 -8
- package/dist/core/session-manager-core.d.ts +15 -5
- package/dist/core/session-manager-core.js +195 -38
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.code.js +3 -0
- package/dist/core/session-manager-list.code.js.map +1 -0
- package/dist/core/session-manager-list.impl.js +36 -0
- package/dist/core/session-manager-list.impl.js.map +1 -0
- package/dist/core/session-manager-list.js +35 -2
- package/dist/core/session-manager-types.d.ts +20 -0
- package/dist/core/session-manager.code.js +8 -0
- package/dist/core/session-manager.code.js.map +1 -0
- package/dist/core/session-manager.d.ts +1 -1
- package/dist/core/session-manager.impl.js +36 -0
- package/dist/core/session-manager.impl.js.map +1 -0
- package/dist/core/session-manager.js +35 -7
- package/dist/core/session-storage.code.js +3 -0
- package/dist/core/session-storage.code.js.map +1 -0
- package/dist/core/session-storage.impl.js +36 -0
- package/dist/core/session-storage.impl.js.map +1 -0
- package/dist/core/session-storage.js +35 -2
- package/dist/core/storage/file-identity.d.ts +3 -0
- package/dist/core/storage/file-identity.js +296 -86
- package/dist/core/storage/file-identity.js.map +1 -1
- package/dist/core/storage/index.d.ts +1 -1
- package/dist/core/storage/index.js +52 -7
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +47 -2
- package/dist/core/storage/node-sqlite.js +49 -4
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/offline-snapshot-file.code.js +37 -0
- package/dist/core/storage/offline-snapshot-file.code.js.map +1 -0
- package/dist/core/storage/offline-snapshot-file.impl.js +36 -0
- package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -0
- package/dist/core/storage/offline-snapshot-file.js +33 -34
- package/dist/core/storage/offline-snapshot-file.js.map +1 -1
- package/dist/core/storage/provider.js +52 -7
- package/dist/core/storage/selection.js +49 -4
- package/dist/core/storage/session/branch-fork-source.code.js +146 -0
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -0
- package/dist/core/storage/session/branch-fork-source.impl.js +36 -0
- package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -0
- package/dist/core/storage/session/branch-fork-source.js +32 -97
- package/dist/core/storage/session/branch-fork-source.js.map +1 -1
- package/dist/core/storage/session/card-view.code.js +60 -0
- package/dist/core/storage/session/card-view.code.js.map +1 -0
- package/dist/core/storage/session/card-view.impl.js +36 -0
- package/dist/core/storage/session/card-view.impl.js.map +1 -0
- package/dist/core/storage/session/card-view.js +34 -58
- package/dist/core/storage/session/card-view.js.map +1 -1
- package/dist/core/storage/session/child-reader.code.js +139 -0
- package/dist/core/storage/session/child-reader.code.js.map +1 -0
- package/dist/core/storage/session/child-reader.d.ts +1 -0
- package/dist/core/storage/session/child-reader.impl.js +36 -0
- package/dist/core/storage/session/child-reader.impl.js.map +1 -0
- package/dist/core/storage/session/child-reader.js +33 -91
- package/dist/core/storage/session/child-reader.js.map +1 -1
- package/dist/core/storage/session/chunked-resume-projection.code.js +3 -0
- package/dist/core/storage/session/chunked-resume-projection.code.js.map +1 -0
- package/dist/core/storage/session/chunked-resume-projection.impl.js +36 -0
- package/dist/core/storage/session/chunked-resume-projection.impl.js.map +1 -0
- package/dist/core/storage/session/chunked-resume-projection.js +35 -2
- package/dist/core/storage/session/expanded-child-details.code.js +684 -0
- package/dist/core/storage/session/expanded-child-details.code.js.map +1 -0
- package/dist/core/storage/session/expanded-child-details.impl.js +36 -0
- package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -0
- package/dist/core/storage/session/expanded-child-details.js +31 -634
- package/dist/core/storage/session/expanded-child-details.js.map +1 -1
- package/dist/core/storage/session/fork-row-bytes.code.js +3 -0
- package/dist/core/storage/session/fork-row-bytes.code.js.map +1 -0
- package/dist/core/storage/session/fork-row-bytes.impl.js +36 -0
- package/dist/core/storage/session/fork-row-bytes.impl.js.map +1 -0
- package/dist/core/storage/session/fork-row-bytes.js +35 -2
- package/dist/core/storage/session/fork-row-index.code.js +3 -0
- package/dist/core/storage/session/fork-row-index.code.js.map +1 -0
- package/dist/core/storage/session/fork-row-index.impl.js +36 -0
- package/dist/core/storage/session/fork-row-index.impl.js.map +1 -0
- package/dist/core/storage/session/fork-row-index.js +35 -2
- package/dist/core/storage/session/fork-staging.code.js +580 -0
- package/dist/core/storage/session/fork-staging.code.js.map +1 -0
- package/dist/core/storage/session/fork-staging.impl.js +36 -0
- package/dist/core/storage/session/fork-staging.impl.js.map +1 -0
- package/dist/core/storage/session/fork-staging.js +30 -574
- package/dist/core/storage/session/fork-staging.js.map +1 -1
- package/dist/core/storage/session/fork-window.code.js +522 -0
- package/dist/core/storage/session/fork-window.code.js.map +1 -0
- package/dist/core/storage/session/fork-window.impl.js +36 -0
- package/dist/core/storage/session/fork-window.impl.js.map +1 -0
- package/dist/core/storage/session/fork-window.js +30 -471
- package/dist/core/storage/session/fork-window.js.map +1 -1
- package/dist/core/storage/session/history-pages.code.js +3 -0
- package/dist/core/storage/session/history-pages.code.js.map +1 -0
- package/dist/core/storage/session/history-pages.impl.js +36 -0
- package/dist/core/storage/session/history-pages.impl.js.map +1 -0
- package/dist/core/storage/session/history-pages.js +35 -2
- package/dist/core/storage/session/jsonl-entry-projection.code.js +3 -0
- package/dist/core/storage/session/jsonl-entry-projection.code.js.map +1 -0
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +36 -0
- package/dist/core/storage/session/jsonl-entry-projection.impl.js.map +1 -0
- package/dist/core/storage/session/jsonl-entry-projection.js +35 -2
- package/dist/core/storage/session/jsonl-session-store.code.js +3 -0
- package/dist/core/storage/session/jsonl-session-store.code.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.impl.js +36 -0
- package/dist/core/storage/session/jsonl-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.js +35 -2
- package/dist/core/storage/session/memory-session-store.code.js +3 -0
- package/dist/core/storage/session/memory-session-store.code.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.impl.js +36 -0
- package/dist/core/storage/session/memory-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.js +35 -2
- package/dist/core/storage/session/pinned-branch-resume.code.js +117 -0
- package/dist/core/storage/session/pinned-branch-resume.code.js.map +1 -0
- package/dist/core/storage/session/pinned-branch-resume.impl.js +36 -0
- package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -0
- package/dist/core/storage/session/pinned-branch-resume.js +33 -69
- package/dist/core/storage/session/pinned-branch-resume.js.map +1 -1
- package/dist/core/storage/session/released-history-files.code.js +465 -0
- package/dist/core/storage/session/released-history-files.code.js.map +1 -0
- package/dist/core/storage/session/released-history-files.impl.js +36 -0
- package/dist/core/storage/session/released-history-files.impl.js.map +1 -0
- package/dist/core/storage/session/released-history-files.js +32 -461
- package/dist/core/storage/session/released-history-files.js.map +1 -1
- package/dist/core/storage/session/resident-fork-rows.code.js +57 -0
- package/dist/core/storage/session/resident-fork-rows.code.js.map +1 -0
- package/dist/core/storage/session/resident-fork-rows.impl.js +36 -0
- package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -0
- package/dist/core/storage/session/resident-fork-rows.js +32 -53
- package/dist/core/storage/session/resident-fork-rows.js.map +1 -1
- package/dist/core/storage/session/session-resume.code.js +3 -0
- package/dist/core/storage/session/session-resume.code.js.map +1 -0
- package/dist/core/storage/session/session-resume.impl.js +36 -0
- package/dist/core/storage/session/session-resume.impl.js.map +1 -0
- package/dist/core/storage/session/session-resume.js +35 -2
- package/dist/core/storage/session/snapshot-cut.code.js +3 -0
- package/dist/core/storage/session/snapshot-cut.code.js.map +1 -0
- package/dist/core/storage/session/snapshot-cut.impl.js +36 -0
- package/dist/core/storage/session/snapshot-cut.impl.js.map +1 -0
- package/dist/core/storage/session/snapshot-cut.js +35 -2
- package/dist/core/storage/session/snapshot-history.code.js +107 -0
- package/dist/core/storage/session/snapshot-history.code.js.map +1 -0
- package/dist/core/storage/session/snapshot-history.impl.js +36 -0
- package/dist/core/storage/session/snapshot-history.impl.js.map +1 -0
- package/dist/core/storage/session/snapshot-history.js +34 -60
- package/dist/core/storage/session/snapshot-history.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.code.js +3 -0
- package/dist/core/storage/session/sql-session-store.code.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.impl.js +36 -0
- package/dist/core/storage/session/sql-session-store.impl.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.js +35 -2
- package/dist/core/storage/session/tree-outline.code.js +3 -0
- package/dist/core/storage/session/tree-outline.code.js.map +1 -0
- package/dist/core/storage/session/tree-outline.impl.js +36 -0
- package/dist/core/storage/session/tree-outline.impl.js.map +1 -0
- package/dist/core/storage/session/tree-outline.js +35 -2
- package/dist/core/storage/session/tree-presentation.code.js +342 -0
- package/dist/core/storage/session/tree-presentation.code.js.map +1 -0
- package/dist/core/storage/session/tree-presentation.impl.js +36 -0
- package/dist/core/storage/session/tree-presentation.impl.js.map +1 -0
- package/dist/core/storage/session/tree-presentation.js +31 -337
- package/dist/core/storage/session/tree-presentation.js.map +1 -1
- package/dist/core/storage/session/types.d.ts +26 -0
- package/dist/core/storage/storage-status.code.js +3 -0
- package/dist/core/storage/storage-status.code.js.map +1 -0
- package/dist/core/storage/storage-status.impl.js +36 -0
- package/dist/core/storage/storage-status.impl.js.map +1 -0
- package/dist/core/storage/storage-status.js +35 -2
- package/dist/core/storage/team.code.js +3 -0
- package/dist/core/storage/team.code.js.map +1 -0
- package/dist/core/storage/team.impl.js +36 -0
- package/dist/core/storage/team.impl.js.map +1 -0
- package/dist/core/storage/team.js +35 -2
- package/dist/core/structured-output/index.code.js +3 -0
- package/dist/core/structured-output/index.code.js.map +1 -0
- package/dist/core/structured-output/index.impl.js +36 -0
- package/dist/core/structured-output/index.impl.js.map +1 -0
- package/dist/core/structured-output/index.js +35 -2
- package/dist/core/tasks/command-output.d.ts +4 -1
- package/dist/core/tasks/supervisor.d.ts +2 -0
- package/dist/core/tasks/task-completion-entry.code.js +254 -0
- package/dist/core/tasks/task-completion-entry.code.js.map +1 -0
- package/dist/core/tasks/task-completion-entry.impl.js +36 -0
- package/dist/core/tasks/task-completion-entry.impl.js.map +1 -0
- package/dist/core/tasks/task-completion-entry.js +33 -251
- package/dist/core/tasks/task-completion-entry.js.map +1 -1
- package/dist/core/tasks/task-file-history.code.js +424 -0
- package/dist/core/tasks/task-file-history.code.js.map +1 -0
- package/dist/core/tasks/task-file-history.impl.js +36 -0
- package/dist/core/tasks/task-file-history.impl.js.map +1 -0
- package/dist/core/tasks/task-file-history.js +32 -375
- package/dist/core/tasks/task-file-history.js.map +1 -1
- package/dist/core/tasks/task-reference-archive.code.js +514 -0
- package/dist/core/tasks/task-reference-archive.code.js.map +1 -0
- package/dist/core/tasks/task-reference-archive.js +34 -467
- package/dist/core/tasks/task-reference-archive.js.map +1 -1
- package/dist/core/tasks/task-reference-identity.code.js +164 -0
- package/dist/core/tasks/task-reference-identity.code.js.map +1 -0
- package/dist/core/tasks/task-reference-identity.js +32 -160
- package/dist/core/tasks/task-reference-identity.js.map +1 -1
- package/dist/core/tasks/task-reference-stream.code.js +3 -0
- package/dist/core/tasks/task-reference-stream.code.js.map +1 -0
- package/dist/core/tasks/task-reference-stream.impl.js +36 -0
- package/dist/core/tasks/task-reference-stream.impl.js.map +1 -0
- package/dist/core/tasks/task-reference-stream.js +35 -2
- package/dist/core/tasks/task-unsaved-answer.code.js +3 -0
- package/dist/core/tasks/task-unsaved-answer.code.js.map +1 -0
- package/dist/core/tasks/task-unsaved-answer.impl.js +36 -0
- package/dist/core/tasks/task-unsaved-answer.impl.js.map +1 -0
- package/dist/core/tasks/task-unsaved-answer.js +35 -2
- package/dist/core/tasks/task-view-source.code.js +3 -0
- package/dist/core/tasks/task-view-source.code.js.map +1 -0
- package/dist/core/tasks/task-view-source.d.ts +9 -0
- package/dist/core/tasks/task-view-source.impl.js +36 -0
- package/dist/core/tasks/task-view-source.impl.js.map +1 -0
- package/dist/core/tasks/task-view-source.js +35 -2
- package/dist/core/tools/read-url.code.js +1530 -0
- package/dist/core/tools/read-url.code.js.map +1 -0
- package/dist/core/tools/read-url.impl.js +36 -0
- package/dist/core/tools/read-url.impl.js.map +1 -0
- package/dist/core/tools/read-url.js +30 -1524
- package/dist/core/tools/read-url.js.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.js +50 -5
- package/dist/core/worktree-snapshot/errors.code.js +6 -0
- package/dist/core/worktree-snapshot/errors.code.js.map +1 -0
- package/dist/core/worktree-snapshot/errors.impl.js +36 -0
- package/dist/core/worktree-snapshot/errors.impl.js.map +1 -0
- package/dist/core/worktree-snapshot/errors.js +35 -5
- package/dist/core/worktree-snapshot/session-index-reset.code.js +136 -0
- package/dist/core/worktree-snapshot/session-index-reset.code.js.map +1 -0
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +36 -0
- package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -0
- package/dist/core/worktree-snapshot/session-index-reset.js +34 -134
- package/dist/core/worktree-snapshot/session-index-reset.js.map +1 -1
- package/dist/extensions/codemode/execute.code.js +618 -0
- package/dist/extensions/codemode/execute.code.js.map +1 -0
- package/dist/extensions/codemode/execute.impl.js +36 -0
- package/dist/extensions/codemode/execute.impl.js.map +1 -0
- package/dist/extensions/codemode/execute.js +30 -612
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/renderer.code.js +110 -0
- package/dist/extensions/codemode/renderer.code.js.map +1 -0
- package/dist/extensions/codemode/renderer.impl.js +36 -0
- package/dist/extensions/codemode/renderer.impl.js.map +1 -0
- package/dist/extensions/codemode/renderer.js +33 -107
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/mcp/cli.code.js +565 -0
- package/dist/extensions/mcp/cli.code.js.map +1 -0
- package/dist/extensions/mcp/cli.impl.js +36 -0
- package/dist/extensions/mcp/cli.impl.js.map +1 -0
- package/dist/extensions/mcp/cli.js +32 -561
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/cli.lazy.code.js +52 -0
- package/dist/extensions/mcp/cli.lazy.code.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.impl.js +36 -0
- package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +36 -7
- package/dist/extensions/mcp/cli.lazy.js.map +1 -1
- package/dist/extensions/mcp/client/transports/stdio.d.ts +2 -0
- package/dist/extensions/mcp/runtime.code.js +5 -0
- package/dist/extensions/mcp/runtime.code.js.map +1 -0
- package/dist/extensions/mcp/runtime.impl.js +36 -0
- package/dist/extensions/mcp/runtime.impl.js.map +1 -0
- package/dist/extensions/mcp/runtime.js +35 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/main-first-time-setup.code.js +12 -0
- package/dist/main-first-time-setup.code.js.map +1 -0
- package/dist/main-first-time-setup.impl.js +36 -0
- package/dist/main-first-time-setup.impl.js.map +1 -0
- package/dist/main-first-time-setup.js +35 -11
- package/dist/main-first-time-setup.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +2 -2
- package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +6 -1
- package/dist/modes/interactive/agent-view/contracts.d.ts +4 -0
- package/dist/modes/interactive/chat-reader-records.d.ts +1 -1
- package/dist/modes/interactive/components/stored-tree-view.code.js +338 -0
- package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -0
- package/dist/modes/interactive/components/stored-tree-view.impl.js +36 -0
- package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -0
- package/dist/modes/interactive/components/stored-tree-view.js +33 -290
- package/dist/modes/interactive/components/stored-tree-view.js.map +1 -1
- package/dist/modes/interactive/components/task-selection-state.d.ts +8 -3
- package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector-archive.code.js +191 -0
- package/dist/modes/interactive/components/user-message-selector-archive.code.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +36 -0
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector-archive.js +34 -189
- package/dist/modes/interactive/components/user-message-selector-archive.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode-deps.js +4 -0
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +4 -0
- package/dist/modes/interactive/interactive-render-chat.d.ts +22 -0
- package/dist/modes/interactive/interactive-startup.d.ts +2 -0
- package/dist/modes/interactive/program-status-reporter.d.ts +2 -1
- package/dist/modes/interactive/startup-shell-eligibility.js +1 -1
- package/dist/modes/interactive/steering-queue-controller.d.ts +4 -0
- package/dist/modes/interactive/theme/theme-schema-factory.d.ts +26 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +4 -5
- package/dist/modes/interactive-engine/engine-prewarm.d.ts +30 -5
- package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
- package/dist/modes/interactive-engine/protocol.d.ts +32 -1
- package/dist/modes/rpc/agent-view-rpc-types.d.ts +12 -1
- package/dist/modes/rpc/agent-view-rpc-types.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +3 -1
- package/dist/modes/rpc/rpc-types.d.ts +12 -0
- package/dist/package-manager-cli.code.js +1140 -0
- package/dist/package-manager-cli.code.js.map +1 -0
- package/dist/package-manager-cli.impl.js +36 -0
- package/dist/package-manager-cli.impl.js.map +1 -0
- package/dist/package-manager-cli.js +36 -1067
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.js +2 -2
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/10.js +1 -1
- package/dist/startup-stages/11.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/13.js +1 -0
- package/dist/startup-stages/2.js +1 -7
- package/dist/startup-stages/3.js +6 -2
- package/dist/startup-stages/4.js +2 -1
- package/dist/startup-stages/5.js +1 -7
- package/dist/startup-stages/6.js +7 -10
- package/dist/startup-stages/7.js +10 -3
- package/dist/startup-stages/8.js +3 -6
- package/dist/startup-stages/9.js +6 -1
- package/dist/startup-stages/stages.json +1 -1
- package/dist/utils/canonical-path.js +2 -0
- package/dist/utils/canonical-path.js.map +1 -1
- package/dist/utils/child-process.d.ts +41 -1
- package/dist/utils/compile-cache-warmup-host.js +63 -18
- package/dist/utils/compile-cache-warmup-host.js.map +1 -1
- package/dist/utils/credential-redaction.d.ts +50 -1
- package/dist/utils/interactive-engine-bootstrap.d.ts +2 -0
- package/dist/utils/interactive-engine-env.d.ts +2 -0
- package/dist/utils/memoize-async.d.ts +32 -0
- package/dist/utils/memoize-async.js +91 -0
- package/dist/utils/memoize-async.js.map +1 -0
- package/dist/utils/photon.js +19 -29
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts +7 -4
- package/dist/utils/startup-database-spare.code.js +108 -0
- package/dist/utils/startup-database-spare.code.js.map +1 -0
- package/dist/utils/startup-database-spare.impl.js +36 -0
- package/dist/utils/startup-database-spare.impl.js.map +1 -0
- package/dist/utils/startup-database-spare.js +33 -105
- package/dist/utils/startup-database-spare.js.map +1 -1
- package/dist/utils/tools-manager.code.js +3 -0
- package/dist/utils/tools-manager.code.js.map +1 -0
- package/dist/utils/tools-manager.impl.js +36 -0
- package/dist/utils/tools-manager.impl.js.map +1 -0
- package/dist/utils/tools-manager.js +35 -2
- package/dist/utils/windows-cwd.js +585 -0
- package/dist/utils/windows-cwd.js.map +1 -0
- package/docs/extensions.md +1 -1
- package/docs/getting-started/installation.md +2 -0
- package/docs/intercom/operations.md +1 -0
- package/docs/reference/cli.md +2 -2
- package/package.json +24 -24
- package/dist/_shared/mode-shared-HP7GUA7J.js.map +0 -1
- package/dist/_shared/p1a-prewarm-YK3KDTLN.js.map +0 -1
- package/dist/_shared/p1b-elig-PXQA2FYP.js.map +0 -1
- package/dist/_shared/startup-0-0-X4NF3GKM.js.map +0 -1
- package/dist/_shared/startup-0-1-7QTG6VJZ.js.map +0 -1
- package/dist/_shared/startup-0-2-KFDYPDJK.js.map +0 -1
- package/dist/_shared/startup-8-1-KQJBDKRU.js.map +0 -1
|
@@ -1,1067 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const source = typeof pkg === "string" ? pkg : pkg.source;
|
|
38
|
-
if (source === item.metadata.source) return true;
|
|
39
|
-
return itemRoot !== void 0 && isLocalPath(source) && resolvePath(source, projectBase, { trim: true }) === itemRoot;
|
|
40
|
-
});
|
|
41
|
-
if (index < 0) {
|
|
42
|
-
const source = isLocalPath(item.metadata.source) && itemRoot ? relative(projectBase, itemRoot) || "." : item.metadata.source;
|
|
43
|
-
packages.push({
|
|
44
|
-
source,
|
|
45
|
-
autoload: false
|
|
46
|
-
});
|
|
47
|
-
index = packages.length - 1;
|
|
48
|
-
}
|
|
49
|
-
let pkg = packages[index];
|
|
50
|
-
if (typeof pkg === "string") pkg = { source: pkg };
|
|
51
|
-
const pattern = packagePattern(item);
|
|
52
|
-
const entries = (pkg[item.resourceType] ?? []).filter((entry) => stripPrefix(entry) !== pattern);
|
|
53
|
-
entries.push(`${enabled ? "+" : "-"}${pattern}`);
|
|
54
|
-
pkg[item.resourceType] = entries;
|
|
55
|
-
packages[index] = pkg;
|
|
56
|
-
settings.setProjectPackages(packages);
|
|
57
|
-
}
|
|
58
|
-
function toggleProjectResource(settings, item, cwd, enabled) {
|
|
59
|
-
if (item.metadata.origin === "package") {
|
|
60
|
-
toggleProjectPackage(settings, item, cwd, enabled);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const current = [...settings.getProjectSettings()[item.resourceType] ?? []];
|
|
64
|
-
const projectBase = join(cwd, CONFIG_DIR_NAME);
|
|
65
|
-
const pattern = item.path.startsWith("builtin:") || item.metadata.scope === "user" ? item.path : relative(item.metadata.baseDir ?? projectBase, item.path);
|
|
66
|
-
const updated = current.filter((entry) => stripPrefix(entry) !== pattern);
|
|
67
|
-
updated.push(`${enabled ? "+" : "-"}${pattern}`);
|
|
68
|
-
setProjectPaths(settings, item.resourceType, updated);
|
|
69
|
-
}
|
|
70
|
-
// dist/modes/interactive/components/config-selector-list.js
|
|
71
|
-
const RESOURCE_TYPE_LABELS = {
|
|
72
|
-
extensions: "Extensions",
|
|
73
|
-
skills: "Skills",
|
|
74
|
-
prompts: "Prompts",
|
|
75
|
-
themes: "Themes"
|
|
76
|
-
};
|
|
77
|
-
function formatBaseDir(baseDir) {
|
|
78
|
-
const displayPath = shortenHomePath(baseDir).replace(/\\/g, "/");
|
|
79
|
-
return displayPath.endsWith("/") ? displayPath : `${displayPath}/`;
|
|
80
|
-
}
|
|
81
|
-
function getGroupLabel(metadata, agentDir) {
|
|
82
|
-
if (metadata.source === "builtin") return "Built-in extensions";
|
|
83
|
-
if (metadata.origin === "package") return `${metadata.source} (${metadata.scope})`;
|
|
84
|
-
if (metadata.source === "auto") {
|
|
85
|
-
if (metadata.baseDir) return metadata.scope === "user" ? `User (${formatBaseDir(metadata.baseDir)})` : `Project (${formatBaseDir(metadata.baseDir)})`;
|
|
86
|
-
return metadata.scope === "user" ? `User (${formatBaseDir(agentDir)})` : `Project (${CONFIG_DIR_NAME}/)`;
|
|
87
|
-
}
|
|
88
|
-
return metadata.scope === "user" ? "User settings" : "Project settings";
|
|
89
|
-
}
|
|
90
|
-
function buildGroups(resolved, agentDir) {
|
|
91
|
-
const groupMap = /* @__PURE__ */ new Map();
|
|
92
|
-
const addToGroup = (resources, resourceType) => {
|
|
93
|
-
for (const res of resources) {
|
|
94
|
-
const { path, enabled, metadata } = res;
|
|
95
|
-
const groupKey = `${metadata.origin}:${metadata.scope}:${metadata.source}:${metadata.baseDir ?? ""}`;
|
|
96
|
-
if (!groupMap.has(groupKey)) groupMap.set(groupKey, {
|
|
97
|
-
key: groupKey,
|
|
98
|
-
label: getGroupLabel(metadata, agentDir),
|
|
99
|
-
scope: metadata.scope,
|
|
100
|
-
origin: metadata.origin,
|
|
101
|
-
source: metadata.source,
|
|
102
|
-
subgroups: []
|
|
103
|
-
});
|
|
104
|
-
const group = groupMap.get(groupKey);
|
|
105
|
-
const subgroupKey = `${groupKey}:${resourceType}`;
|
|
106
|
-
let subgroup = group.subgroups.find((sg) => sg.type === resourceType);
|
|
107
|
-
if (!subgroup) {
|
|
108
|
-
subgroup = {
|
|
109
|
-
type: resourceType,
|
|
110
|
-
label: RESOURCE_TYPE_LABELS[resourceType],
|
|
111
|
-
items: []
|
|
112
|
-
};
|
|
113
|
-
group.subgroups.push(subgroup);
|
|
114
|
-
}
|
|
115
|
-
const fileName = basename(path);
|
|
116
|
-
const parentFolder = basename(dirname(path));
|
|
117
|
-
let displayName;
|
|
118
|
-
if (path.startsWith("builtin:")) displayName = path;
|
|
119
|
-
else if (resourceType === "extensions" && parentFolder !== "extensions") displayName = `${parentFolder}/${fileName}`;
|
|
120
|
-
else if (resourceType === "skills" && fileName === "SKILL.md") displayName = parentFolder;
|
|
121
|
-
else displayName = fileName;
|
|
122
|
-
subgroup.items.push({
|
|
123
|
-
path,
|
|
124
|
-
enabled,
|
|
125
|
-
metadata,
|
|
126
|
-
resourceType,
|
|
127
|
-
displayName,
|
|
128
|
-
groupKey,
|
|
129
|
-
subgroupKey
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
addToGroup(resolved.extensions, "extensions");
|
|
134
|
-
addToGroup(resolved.skills, "skills");
|
|
135
|
-
addToGroup(resolved.prompts, "prompts");
|
|
136
|
-
addToGroup(resolved.themes, "themes");
|
|
137
|
-
const groups = Array.from(groupMap.values());
|
|
138
|
-
groups.sort((a, b) => {
|
|
139
|
-
if (a.origin !== b.origin) return a.origin === "package" ? -1 : 1;
|
|
140
|
-
if (a.scope !== b.scope) return a.scope === "user" ? -1 : 1;
|
|
141
|
-
return a.source.localeCompare(b.source);
|
|
142
|
-
});
|
|
143
|
-
const typeOrder = {
|
|
144
|
-
extensions: 0,
|
|
145
|
-
skills: 1,
|
|
146
|
-
prompts: 2,
|
|
147
|
-
themes: 3
|
|
148
|
-
};
|
|
149
|
-
for (const group of groups) {
|
|
150
|
-
group.subgroups.sort((a, b) => typeOrder[a.type] - typeOrder[b.type]);
|
|
151
|
-
for (const subgroup of group.subgroups) subgroup.items.sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
152
|
-
}
|
|
153
|
-
return groups;
|
|
154
|
-
}
|
|
155
|
-
var ResourceList = class {
|
|
156
|
-
groups;
|
|
157
|
-
flatItems = [];
|
|
158
|
-
filteredItems = [];
|
|
159
|
-
selectedIndex = 0;
|
|
160
|
-
searchInput;
|
|
161
|
-
maxVisible = 15;
|
|
162
|
-
compactSearch = false;
|
|
163
|
-
scrollIndicatorFits = true;
|
|
164
|
-
settingsManager;
|
|
165
|
-
cwd;
|
|
166
|
-
agentDir;
|
|
167
|
-
onCancel;
|
|
168
|
-
writeScope = "global";
|
|
169
|
-
onExit;
|
|
170
|
-
onToggle;
|
|
171
|
-
onSwitchMode;
|
|
172
|
-
_focused = false;
|
|
173
|
-
get focused() {
|
|
174
|
-
return this._focused;
|
|
175
|
-
}
|
|
176
|
-
set focused(value) {
|
|
177
|
-
this._focused = value;
|
|
178
|
-
this.searchInput.focused = value;
|
|
179
|
-
}
|
|
180
|
-
constructor(groups, settingsManager, cwd, agentDir, terminalHeight) {
|
|
181
|
-
this.groups = groups;
|
|
182
|
-
this.settingsManager = settingsManager;
|
|
183
|
-
this.cwd = cwd;
|
|
184
|
-
this.agentDir = agentDir;
|
|
185
|
-
this.searchInput = this.createSearchInput();
|
|
186
|
-
this.maxVisible = Math.max(3, (terminalHeight ?? 24) - 10);
|
|
187
|
-
this.buildFlatList();
|
|
188
|
-
this.filteredItems = [...this.flatItems];
|
|
189
|
-
}
|
|
190
|
-
setViewportHeight(height) {
|
|
191
|
-
this.compactSearch = height < 8;
|
|
192
|
-
const searchAndHintRows = this.compactSearch ? 2 : 6;
|
|
193
|
-
this.scrollIndicatorFits = height - searchAndHintRows >= 2;
|
|
194
|
-
this.maxVisible = Math.max(1, height - searchAndHintRows - (this.scrollIndicatorFits ? 1 : 0));
|
|
195
|
-
}
|
|
196
|
-
getSearchQuery() {
|
|
197
|
-
return this.searchInput.getValue();
|
|
198
|
-
}
|
|
199
|
-
createSearchInput() {
|
|
200
|
-
const input = new Input({
|
|
201
|
-
prompt: "⌕ ",
|
|
202
|
-
placeholder: "Search…",
|
|
203
|
-
placeholderStyle: (text) => theme.fg("dim", text)
|
|
204
|
-
});
|
|
205
|
-
input.focused = this._focused;
|
|
206
|
-
return input;
|
|
207
|
-
}
|
|
208
|
-
renderSearch(width) {
|
|
209
|
-
const boxWidth = Math.max(8, width - 2);
|
|
210
|
-
const field = Math.max(1, boxWidth - 4);
|
|
211
|
-
const content = this.searchInput.render(field)[0] ?? "";
|
|
212
|
-
const pad = " ".repeat(Math.max(0, field - visibleWidth(content)));
|
|
213
|
-
const border = (text) => theme.fg(this.searchInput.getValue() ? "muted" : "borderMuted", text);
|
|
214
|
-
return [
|
|
215
|
-
` ${border(`╭${"─".repeat(boxWidth - 2)}╮`)}`,
|
|
216
|
-
` ${border("│ ")}${content}${pad}${border(" │")}`,
|
|
217
|
-
` ${border(`╰${"─".repeat(boxWidth - 2)}╯`)}`
|
|
218
|
-
];
|
|
219
|
-
}
|
|
220
|
-
setWriteScope(scope) {
|
|
221
|
-
this.writeScope = scope;
|
|
222
|
-
}
|
|
223
|
-
setGroups(groups) {
|
|
224
|
-
this.groups = groups;
|
|
225
|
-
this.buildFlatList();
|
|
226
|
-
this.filterItems(this.searchInput.getValue());
|
|
227
|
-
}
|
|
228
|
-
buildFlatList() {
|
|
229
|
-
this.flatItems = [];
|
|
230
|
-
for (const group of this.groups) {
|
|
231
|
-
this.flatItems.push({
|
|
232
|
-
type: "group",
|
|
233
|
-
group
|
|
234
|
-
});
|
|
235
|
-
for (const subgroup of group.subgroups) {
|
|
236
|
-
this.flatItems.push({
|
|
237
|
-
type: "subgroup",
|
|
238
|
-
subgroup,
|
|
239
|
-
group
|
|
240
|
-
});
|
|
241
|
-
for (const item of subgroup.items) this.flatItems.push({
|
|
242
|
-
type: "item",
|
|
243
|
-
item
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
this.selectedIndex = this.flatItems.findIndex((e) => e.type === "item");
|
|
248
|
-
if (this.selectedIndex < 0) this.selectedIndex = 0;
|
|
249
|
-
}
|
|
250
|
-
findNextItem(fromIndex, direction) {
|
|
251
|
-
let idx = fromIndex + direction;
|
|
252
|
-
while (idx >= 0 && idx < this.filteredItems.length) {
|
|
253
|
-
if (this.filteredItems[idx].type === "item") return idx;
|
|
254
|
-
idx += direction;
|
|
255
|
-
}
|
|
256
|
-
return fromIndex;
|
|
257
|
-
}
|
|
258
|
-
filterItems(query) {
|
|
259
|
-
if (!query.trim()) {
|
|
260
|
-
this.filteredItems = [...this.flatItems];
|
|
261
|
-
this.selectFirstItem();
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
const lowerQuery = query.toLowerCase();
|
|
265
|
-
const matchingItems = /* @__PURE__ */ new Set();
|
|
266
|
-
const matchingSubgroups = /* @__PURE__ */ new Set();
|
|
267
|
-
const matchingGroups = /* @__PURE__ */ new Set();
|
|
268
|
-
for (const entry of this.flatItems) if (entry.type === "item") {
|
|
269
|
-
const item = entry.item;
|
|
270
|
-
if (item.displayName.toLowerCase().includes(lowerQuery) || item.resourceType.toLowerCase().includes(lowerQuery) || item.path.toLowerCase().includes(lowerQuery)) matchingItems.add(item);
|
|
271
|
-
}
|
|
272
|
-
for (const group of this.groups) for (const subgroup of group.subgroups) for (const item of subgroup.items) if (matchingItems.has(item)) {
|
|
273
|
-
matchingSubgroups.add(subgroup);
|
|
274
|
-
matchingGroups.add(group);
|
|
275
|
-
}
|
|
276
|
-
this.filteredItems = [];
|
|
277
|
-
for (const entry of this.flatItems) if (entry.type === "group" && matchingGroups.has(entry.group)) this.filteredItems.push(entry);
|
|
278
|
-
else if (entry.type === "subgroup" && matchingSubgroups.has(entry.subgroup)) this.filteredItems.push(entry);
|
|
279
|
-
else if (entry.type === "item" && matchingItems.has(entry.item)) this.filteredItems.push(entry);
|
|
280
|
-
this.selectFirstItem();
|
|
281
|
-
}
|
|
282
|
-
selectFirstItem() {
|
|
283
|
-
const firstItemIndex = this.filteredItems.findIndex((e) => e.type === "item");
|
|
284
|
-
this.selectedIndex = firstItemIndex >= 0 ? firstItemIndex : 0;
|
|
285
|
-
}
|
|
286
|
-
updateItem(item, enabled) {
|
|
287
|
-
item.enabled = enabled;
|
|
288
|
-
for (const group of this.groups) for (const subgroup of group.subgroups) {
|
|
289
|
-
const found = subgroup.items.find((candidate) => candidate.path === item.path && candidate.resourceType === item.resourceType);
|
|
290
|
-
if (found) {
|
|
291
|
-
found.enabled = enabled;
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
invalidate() {}
|
|
297
|
-
render(width) {
|
|
298
|
-
const gap = this.compactSearch ? [] : [""];
|
|
299
|
-
return [
|
|
300
|
-
...this.renderList(width),
|
|
301
|
-
...gap,
|
|
302
|
-
this.renderHint(width)
|
|
303
|
-
].map((line) => visibleWidth(line) > width ? truncateToWidth(line, width) : line);
|
|
304
|
-
}
|
|
305
|
-
hintEntries() {
|
|
306
|
-
const kb = getKeybindings();
|
|
307
|
-
const items = this.filteredItems.filter((entry) => entry.type === "item").length;
|
|
308
|
-
const entries = [];
|
|
309
|
-
const up = navActionText(kb, "tui.select.up");
|
|
310
|
-
const down = navActionText(kb, "tui.select.down");
|
|
311
|
-
if (items > 1 && up && down) entries.push({
|
|
312
|
-
keys: up === "↑" && down === "↓" ? "↑↓" : `${up}/${down}`,
|
|
313
|
-
label: "select"
|
|
314
|
-
});
|
|
315
|
-
if (this.filteredItems[this.selectedIndex]?.type === "item") {
|
|
316
|
-
const confirm = navActionText(kb, "tui.select.confirm");
|
|
317
|
-
entries.push({
|
|
318
|
-
keys: confirm ? `space/${confirm}` : "space",
|
|
319
|
-
label: "toggle"
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
if (this.onSwitchMode) entries.push({
|
|
323
|
-
action: "tui.input.tab",
|
|
324
|
-
label: "switch scope"
|
|
325
|
-
});
|
|
326
|
-
entries.push({
|
|
327
|
-
keys: "type",
|
|
328
|
-
label: "to search"
|
|
329
|
-
});
|
|
330
|
-
const cancel = kb.getKeys("tui.select.cancel")[0];
|
|
331
|
-
entries.push({
|
|
332
|
-
keys: cancel === "escape" || !cancel ? "esc" : cancel,
|
|
333
|
-
label: this.searchInput.getValue() ? "clear" : "close"
|
|
334
|
-
});
|
|
335
|
-
return entries;
|
|
336
|
-
}
|
|
337
|
-
renderHint(width) {
|
|
338
|
-
return renderNavHintLine(this.hintEntries(), width, {
|
|
339
|
-
dim: (text) => theme.fg("dim", text),
|
|
340
|
-
text: (text) => theme.fg("text", text),
|
|
341
|
-
muted: (text) => theme.fg("muted", text),
|
|
342
|
-
border: (text) => theme.fg("borderMuted", text),
|
|
343
|
-
bold: (text) => theme.bold(text)
|
|
344
|
-
}, getKeybindings());
|
|
345
|
-
}
|
|
346
|
-
renderList(width) {
|
|
347
|
-
const lines = this.compactSearch ? this.searchInput.render(Math.max(1, width)) : [...this.renderSearch(width), ""];
|
|
348
|
-
if (this.filteredItems.length === 0) {
|
|
349
|
-
const query = this.searchInput.getValue().trim();
|
|
350
|
-
return [...lines, theme.fg("dim", query ? ` No matches for "${query}"` : " No resources found")];
|
|
351
|
-
}
|
|
352
|
-
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.filteredItems.length - this.maxVisible));
|
|
353
|
-
const endIndex = Math.min(startIndex + this.maxVisible, this.filteredItems.length);
|
|
354
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
355
|
-
const entry = this.filteredItems[i];
|
|
356
|
-
const selected = i === this.selectedIndex;
|
|
357
|
-
if (entry.type === "group") lines.push(truncateToWidth(` ${theme.fg("accent", theme.bold(entry.group.label))}`, width, ""));
|
|
358
|
-
else if (entry.type === "subgroup") lines.push(truncateToWidth(` ${theme.fg("muted", entry.subgroup.label)}`, width, ""));
|
|
359
|
-
else {
|
|
360
|
-
const cursor = selected ? theme.fg("accent", theme.bold("❯ ")) : " ";
|
|
361
|
-
const checkbox = entry.item.enabled ? theme.fg("success", "[✓]") : theme.fg("dim", "[ ]");
|
|
362
|
-
const name = selected ? theme.fg("accent", theme.bold(entry.item.displayName)) : theme.fg("text", entry.item.displayName);
|
|
363
|
-
lines.push(truncateToWidth(`${cursor} ${checkbox} ${name}`, width, "..."));
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
let above = 0;
|
|
367
|
-
for (let i = 0; i < startIndex; i++) if (this.filteredItems[i]?.type === "item") above++;
|
|
368
|
-
let below = 0;
|
|
369
|
-
for (let i = endIndex; i < this.filteredItems.length; i++) if (this.filteredItems[i]?.type === "item") below++;
|
|
370
|
-
if (this.scrollIndicatorFits && (above > 0 || below > 0)) {
|
|
371
|
-
const parts = [above > 0 ? `↑ ${above} more` : "", below > 0 ? `↓ ${below} more` : ""].filter(Boolean);
|
|
372
|
-
lines.push(theme.fg("dim", ` ${parts.join(" · ")}`));
|
|
373
|
-
}
|
|
374
|
-
return lines;
|
|
375
|
-
}
|
|
376
|
-
handleInput(data) {
|
|
377
|
-
const kb = getKeybindings();
|
|
378
|
-
if (kb.matches(data, "tui.select.up")) {
|
|
379
|
-
this.selectedIndex = this.findNextItem(this.selectedIndex, -1);
|
|
380
|
-
return true;
|
|
381
|
-
}
|
|
382
|
-
if (kb.matches(data, "tui.select.down")) {
|
|
383
|
-
this.selectedIndex = this.findNextItem(this.selectedIndex, 1);
|
|
384
|
-
return true;
|
|
385
|
-
}
|
|
386
|
-
if (kb.matches(data, "tui.select.pageUp")) {
|
|
387
|
-
let target = Math.max(0, this.selectedIndex - this.maxVisible);
|
|
388
|
-
while (target < this.filteredItems.length && this.filteredItems[target].type !== "item") target++;
|
|
389
|
-
if (target < this.filteredItems.length) this.selectedIndex = target;
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
if (kb.matches(data, "tui.select.pageDown")) {
|
|
393
|
-
let target = Math.min(this.filteredItems.length - 1, this.selectedIndex + this.maxVisible);
|
|
394
|
-
while (target >= 0 && this.filteredItems[target].type !== "item") target--;
|
|
395
|
-
if (target >= 0) this.selectedIndex = target;
|
|
396
|
-
return true;
|
|
397
|
-
}
|
|
398
|
-
if (kb.matches(data, "tui.select.cancel")) {
|
|
399
|
-
if (this.searchInput.getValue() && !matchesKey(data, "ctrl+c")) {
|
|
400
|
-
this.searchInput = this.createSearchInput();
|
|
401
|
-
this.filterItems("");
|
|
402
|
-
} else this.onCancel?.();
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
if (matchesKey(data, "ctrl+c")) {
|
|
406
|
-
this.onExit?.();
|
|
407
|
-
return true;
|
|
408
|
-
}
|
|
409
|
-
if (kb.matches(data, "tui.input.tab")) {
|
|
410
|
-
this.onSwitchMode?.();
|
|
411
|
-
return true;
|
|
412
|
-
}
|
|
413
|
-
if (data === " " || kb.matches(data, "tui.select.confirm")) {
|
|
414
|
-
const entry = this.filteredItems[this.selectedIndex];
|
|
415
|
-
if (entry?.type === "item") {
|
|
416
|
-
const newEnabled = !entry.item.enabled;
|
|
417
|
-
if (this.writeScope === "project") toggleProjectResource(this.settingsManager, entry.item, this.cwd, newEnabled);
|
|
418
|
-
else this.toggleResource(entry.item, newEnabled);
|
|
419
|
-
this.updateItem(entry.item, newEnabled);
|
|
420
|
-
this.onToggle?.(entry.item, newEnabled);
|
|
421
|
-
}
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
424
|
-
this.searchInput.handleInput(data);
|
|
425
|
-
this.filterItems(this.searchInput.getValue());
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
toggleResource(item, enabled) {
|
|
429
|
-
if (item.metadata.origin === "top-level") this.toggleTopLevelResource(item, enabled);
|
|
430
|
-
else this.togglePackageResource(item, enabled);
|
|
431
|
-
}
|
|
432
|
-
toggleTopLevelResource(item, enabled) {
|
|
433
|
-
const scope = item.metadata.scope;
|
|
434
|
-
const settings = scope === "project" ? this.settingsManager.getProjectSettings() : this.settingsManager.getGlobalSettings();
|
|
435
|
-
const arrayKey = item.resourceType;
|
|
436
|
-
const pattern = this.getResourcePattern(item);
|
|
437
|
-
const updated = (settings[arrayKey] ?? []).filter((entry) => {
|
|
438
|
-
return (/^[!+-]/.test(entry) ? entry.slice(1) : entry) !== pattern;
|
|
439
|
-
});
|
|
440
|
-
updated.push(`${enabled ? "+" : "-"}${pattern}`);
|
|
441
|
-
if (scope === "project") {
|
|
442
|
-
if (arrayKey === "extensions") this.settingsManager.setProjectExtensionPaths(updated);
|
|
443
|
-
else if (arrayKey === "skills") this.settingsManager.setProjectSkillPaths(updated);
|
|
444
|
-
else if (arrayKey === "prompts") this.settingsManager.setProjectPromptTemplatePaths(updated);
|
|
445
|
-
else this.settingsManager.setProjectThemePaths(updated);
|
|
446
|
-
} else if (arrayKey === "extensions") this.settingsManager.setExtensionPaths(updated);
|
|
447
|
-
else if (arrayKey === "skills") this.settingsManager.setSkillPaths(updated);
|
|
448
|
-
else if (arrayKey === "prompts") this.settingsManager.setPromptTemplatePaths(updated);
|
|
449
|
-
else this.settingsManager.setThemePaths(updated);
|
|
450
|
-
}
|
|
451
|
-
togglePackageResource(item, enabled) {
|
|
452
|
-
const scope = item.metadata.scope;
|
|
453
|
-
const packages = [...(scope === "project" ? this.settingsManager.getProjectSettings() : this.settingsManager.getGlobalSettings()).packages ?? []];
|
|
454
|
-
const pkgIndex = packages.findIndex((pkg) => (typeof pkg === "string" ? pkg : pkg.source) === item.metadata.source);
|
|
455
|
-
if (pkgIndex === -1) return;
|
|
456
|
-
let pkg = packages[pkgIndex];
|
|
457
|
-
if (typeof pkg === "string") pkg = { source: pkg };
|
|
458
|
-
const arrayKey = item.resourceType;
|
|
459
|
-
const pattern = this.getPackageResourcePattern(item);
|
|
460
|
-
const updated = (pkg[arrayKey] ?? []).filter((entry) => (/^[!+-]/.test(entry) ? entry.slice(1) : entry) !== pattern);
|
|
461
|
-
updated.push(`${enabled ? "+" : "-"}${pattern}`);
|
|
462
|
-
pkg[arrayKey] = updated;
|
|
463
|
-
packages[pkgIndex] = pkg;
|
|
464
|
-
if (scope === "project") this.settingsManager.setProjectPackages(packages);
|
|
465
|
-
else this.settingsManager.setPackages(packages);
|
|
466
|
-
}
|
|
467
|
-
getTopLevelBaseDir(scope) {
|
|
468
|
-
return scope === "project" ? join(this.cwd, CONFIG_DIR_NAME) : this.agentDir;
|
|
469
|
-
}
|
|
470
|
-
getResourcePattern(item) {
|
|
471
|
-
if (item.path.startsWith("builtin:")) return item.path;
|
|
472
|
-
const scope = item.metadata.scope;
|
|
473
|
-
const baseDir = item.metadata.baseDir ?? this.getTopLevelBaseDir(scope);
|
|
474
|
-
return relative(baseDir, item.path);
|
|
475
|
-
}
|
|
476
|
-
getPackageResourcePattern(item) {
|
|
477
|
-
const baseDir = item.metadata.baseDir ?? dirname(item.path);
|
|
478
|
-
return relative(baseDir, item.path);
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
// dist/modes/interactive/components/config-selector.js
|
|
482
|
-
/** TUI component for managing global and project package resources. */
|
|
483
|
-
var ConfigSelectorHeader = class {
|
|
484
|
-
writeScope;
|
|
485
|
-
agentDir;
|
|
486
|
-
constructor(writeScope, agentDir) {
|
|
487
|
-
this.writeScope = writeScope;
|
|
488
|
-
this.agentDir = agentDir;
|
|
489
|
-
}
|
|
490
|
-
setWriteScope(scope) {
|
|
491
|
-
this.writeScope = scope;
|
|
492
|
-
}
|
|
493
|
-
invalidate() {}
|
|
494
|
-
render(width) {
|
|
495
|
-
const title = theme.bold(theme.fg("text", this.writeScope === "project" ? "Project resources" : "Global resources"));
|
|
496
|
-
const scopeFile = this.writeScope === "project" ? `${CONFIG_DIR_NAME}/settings.json · global resources are inherited` : shortenHomePath(join(this.agentDir, "settings.json"));
|
|
497
|
-
return [truncateToWidth(` ${title}`, width, ""), truncateToWidth(` ${theme.fg("muted", scopeFile)}`, width, "")];
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
var ConfigSelectorComponent = class extends Container {
|
|
501
|
-
header;
|
|
502
|
-
resourceList;
|
|
503
|
-
groups;
|
|
504
|
-
writeScope;
|
|
505
|
-
getTerminalHeight;
|
|
506
|
-
terminalHeight = 0;
|
|
507
|
-
_focused = false;
|
|
508
|
-
get focused() {
|
|
509
|
-
return this._focused;
|
|
510
|
-
}
|
|
511
|
-
set focused(value) {
|
|
512
|
-
this._focused = value;
|
|
513
|
-
this.resourceList.focused = value;
|
|
514
|
-
}
|
|
515
|
-
constructor(resolvedPaths, settingsManager, cwd, agentDir, onClose, onExit, requestRender, terminalHeight, writeScope = "global", projectModeAvailable = true, getTerminalHeight) {
|
|
516
|
-
super();
|
|
517
|
-
this.writeScope = writeScope;
|
|
518
|
-
this.getTerminalHeight = getTerminalHeight ?? (() => terminalHeight ?? 24);
|
|
519
|
-
this.groups = {
|
|
520
|
-
global: buildGroups(resolvedPaths.global, agentDir),
|
|
521
|
-
project: buildGroups(resolvedPaths.project, agentDir)
|
|
522
|
-
};
|
|
523
|
-
this.resourceList = new ResourceList(this.groups[writeScope], settingsManager, cwd, agentDir, terminalHeight);
|
|
524
|
-
this.header = new ConfigSelectorHeader(writeScope, agentDir);
|
|
525
|
-
this.resourceList.setWriteScope(writeScope);
|
|
526
|
-
this.resourceList.onCancel = onClose;
|
|
527
|
-
this.resourceList.onExit = onExit;
|
|
528
|
-
this.resourceList.onToggle = requestRender;
|
|
529
|
-
if (projectModeAvailable) this.resourceList.onSwitchMode = () => {
|
|
530
|
-
this.writeScope = this.writeScope === "global" ? "project" : "global";
|
|
531
|
-
this.header.setWriteScope(this.writeScope);
|
|
532
|
-
this.resourceList.setWriteScope(this.writeScope);
|
|
533
|
-
this.resourceList.setGroups(this.groups[this.writeScope]);
|
|
534
|
-
requestRender();
|
|
535
|
-
};
|
|
536
|
-
this.updateLayout(this.getTerminalHeight());
|
|
537
|
-
}
|
|
538
|
-
updateLayout(height) {
|
|
539
|
-
this.terminalHeight = height;
|
|
540
|
-
const compactFrame = height < 16;
|
|
541
|
-
this.resourceList.setViewportHeight(height - (compactFrame ? 4 : 8));
|
|
542
|
-
this.clear();
|
|
543
|
-
if (!compactFrame) this.addChild(new Spacer(1));
|
|
544
|
-
this.addChild(new DynamicBorder());
|
|
545
|
-
if (!compactFrame) this.addChild(new Spacer(1));
|
|
546
|
-
this.addChild(this.header);
|
|
547
|
-
if (!compactFrame) this.addChild(new Spacer(1));
|
|
548
|
-
this.addChild(this.resourceList);
|
|
549
|
-
if (!compactFrame) this.addChild(new Spacer(1));
|
|
550
|
-
this.addChild(new DynamicBorder());
|
|
551
|
-
}
|
|
552
|
-
render(width) {
|
|
553
|
-
const height = this.getTerminalHeight();
|
|
554
|
-
if (height !== this.terminalHeight) this.updateLayout(height);
|
|
555
|
-
return super.render(width);
|
|
556
|
-
}
|
|
557
|
-
handleInput(data) {
|
|
558
|
-
return this.resourceList.handleInput(data);
|
|
559
|
-
}
|
|
560
|
-
getResourceList() {
|
|
561
|
-
return this.resourceList;
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
// dist/cli/config-selector.js
|
|
565
|
-
/**
|
|
566
|
-
* TUI config selector for `pi config` command
|
|
567
|
-
*/
|
|
568
|
-
/** Show TUI config selector and return when closed */
|
|
569
|
-
async function selectConfig(options) {
|
|
570
|
-
setCapabilityOverrides(options.settingsManager.getTerminalCapabilityOverrides());
|
|
571
|
-
initTheme(options.settingsManager.getTheme(), true);
|
|
572
|
-
setKeybindings(KeybindingsManager$1.create(options.agentDir));
|
|
573
|
-
return new Promise((resolve) => {
|
|
574
|
-
const ui = new TuiMainScreen(new ProcessTerminal(), void 0, options.agentDir);
|
|
575
|
-
let resolved = false;
|
|
576
|
-
const close = () => {
|
|
577
|
-
if (resolved) return;
|
|
578
|
-
resolved = true;
|
|
579
|
-
ui.stop();
|
|
580
|
-
stopThemeWatcher();
|
|
581
|
-
resolve();
|
|
582
|
-
};
|
|
583
|
-
const selector = new ConfigSelectorComponent(options.resolvedPaths, options.settingsManager, options.cwd, options.agentDir, close, close, () => ui.requestRender(), ui.terminal.rows, options.writeScope, options.projectModeAvailable, () => ui.terminal.rows);
|
|
584
|
-
ui.addChild(selector);
|
|
585
|
-
ui.setFocus(selector.getResourceList());
|
|
586
|
-
ui.start();
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
// dist/self-update-plan.js
|
|
590
|
-
function buildSelfUpdatePlan(release, force = false) {
|
|
591
|
-
const packageName = release.packageName ?? PACKAGE_NAME;
|
|
592
|
-
return {
|
|
593
|
-
packageName,
|
|
594
|
-
installSpec: `${packageName}@${release.version}`,
|
|
595
|
-
version: release.version,
|
|
596
|
-
shouldRun: force || packageName !== PACKAGE_NAME || isNewerPackageVersion(release.version, VERSION),
|
|
597
|
-
...release.note ? { note: release.note } : {}
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
async function resolveSelfUpdatePlan(force) {
|
|
601
|
-
let release;
|
|
602
|
-
try {
|
|
603
|
-
release = await getLatestPiRelease({ retry: true });
|
|
604
|
-
} catch (error) {
|
|
605
|
-
throw new Error(`Could not determine latest ${APP_NAME} version: ${formatVersionCheckError(error)}`, { cause: error });
|
|
606
|
-
}
|
|
607
|
-
if (!release) throw new Error(`Could not determine latest ${APP_NAME} version.`);
|
|
608
|
-
return buildSelfUpdatePlan(release, force);
|
|
609
|
-
}
|
|
610
|
-
function renderSelfUpdateNote(note, width = process.stdout.columns ?? 80) {
|
|
611
|
-
const trimmed = note.trim();
|
|
612
|
-
if (!trimmed) return void 0;
|
|
613
|
-
try {
|
|
614
|
-
return new Markdown(trimmed, 0, 0, getMarkdownTheme()).render(Math.max(20, width)).map((line) => line.trimEnd()).join("\n");
|
|
615
|
-
} catch {
|
|
616
|
-
return trimmed;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
// dist/package-manager-cli.js
|
|
620
|
-
function reportSettingsErrors(settingsManager, context) {
|
|
621
|
-
const errors = settingsManager.drainErrors();
|
|
622
|
-
for (const { scope, error } of errors) {
|
|
623
|
-
console.error(chalk.yellow(`Warning (${context}, ${scope} settings): ${error.message}`));
|
|
624
|
-
if (error.stack) console.error(chalk.dim(error.stack));
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
function updateTargetIncludesSelf(target) {
|
|
628
|
-
return target.type === "all" || target.type === "self";
|
|
629
|
-
}
|
|
630
|
-
function updateTargetIncludesExtensions(target) {
|
|
631
|
-
return target.type === "all" || target.type === "extensions";
|
|
632
|
-
}
|
|
633
|
-
async function refreshModelCatalogs(agentDir, options = {}) {
|
|
634
|
-
const controller = new AbortController();
|
|
635
|
-
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
636
|
-
const aborted = new Promise((resolve) => {
|
|
637
|
-
controller.signal.addEventListener("abort", () => resolve(null), { once: true });
|
|
638
|
-
});
|
|
639
|
-
try {
|
|
640
|
-
const cwd = options.cwd ?? process.cwd();
|
|
641
|
-
const settingsManager = options.settingsManager ?? SettingsManager.create(cwd, agentDir, { projectTrusted: true });
|
|
642
|
-
const resourceLoader = new DefaultResourceLoader({
|
|
643
|
-
cwd,
|
|
644
|
-
agentDir,
|
|
645
|
-
settingsManager,
|
|
646
|
-
extensionFactories: options.extensionFactories,
|
|
647
|
-
noSkills: true,
|
|
648
|
-
noPromptTemplates: true,
|
|
649
|
-
noThemes: true
|
|
650
|
-
});
|
|
651
|
-
if (!await Promise.race([resourceLoader.reload().then(() => true), aborted])) throw new Error("Model catalog refresh timed out.");
|
|
652
|
-
const authPaths = [join(agentDir, "auth.json"), ...getAgentConfigPaths("auth.json")].filter((path, index, paths) => paths.indexOf(path) === index);
|
|
653
|
-
const modelRuntime = await ModelRuntime.create({
|
|
654
|
-
credentials: AuthStorage.create(authPaths),
|
|
655
|
-
modelsPath: join(agentDir, "models.json")
|
|
656
|
-
});
|
|
657
|
-
const extensionsResult = resourceLoader.getExtensions();
|
|
658
|
-
if (extensionsResult.errors.length > 0) {
|
|
659
|
-
const details = extensionsResult.errors.map(({ path, error }) => `${path}: ${error}`).join("; ");
|
|
660
|
-
throw new Error(`Could not load extensions for model catalog refresh: ${details}`);
|
|
661
|
-
}
|
|
662
|
-
for (const registration of extensionsResult.runtime.pendingProviderRegistrations) if ("provider" in registration) modelRuntime.registerNativeProvider(registration.provider);
|
|
663
|
-
else modelRuntime.registerProvider(registration.name, registration.config);
|
|
664
|
-
const refresh = modelRuntime.refresh({
|
|
665
|
-
allowNetwork: true,
|
|
666
|
-
force: true,
|
|
667
|
-
signal: controller.signal
|
|
668
|
-
});
|
|
669
|
-
const result = await Promise.race([refresh, aborted]);
|
|
670
|
-
if (!result || result.aborted) throw new Error("Model catalog refresh timed out.");
|
|
671
|
-
const failures = [];
|
|
672
|
-
for (const [provider, error] of result.errors) if (error instanceof ModelsError && error.code === "oauth") console.warn(chalk.yellow(`Warning: skipped model catalog for ${provider}: ${error.message}\nLog in again with \`${APP_NAME} auth login ${provider}\` to refresh it.`));
|
|
673
|
-
else failures.push(`${provider}: ${error.message}`);
|
|
674
|
-
if (failures.length > 0) throw new Error(`Could not refresh model catalogs: ${failures.join("; ")}`);
|
|
675
|
-
} finally {
|
|
676
|
-
clearTimeout(timeout);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
function printSelfUpdateUnavailable(npmCommand, updateTarget) {
|
|
680
|
-
console.error(`error: ${APP_NAME} cannot self-update this installation.`);
|
|
681
|
-
console.error(getSelfUpdateUnavailableInstruction(PACKAGE_NAME, npmCommand, updateTarget));
|
|
682
|
-
console.error(`To make \`${APP_NAME} update\` run your own update command, set ${ENV_SELF_UPDATE_COMMAND} or the selfUpdateCommand setting.`);
|
|
683
|
-
const entrypoint = process.argv[1];
|
|
684
|
-
if (entrypoint) {
|
|
685
|
-
console.error("");
|
|
686
|
-
console.error(`Location of ${APP_NAME} executable: ${entrypoint}`);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
function printSelfUpdateFallback(command) {
|
|
690
|
-
console.error(chalk.dim(`If this keeps failing, run this command yourself: ${command.display}`));
|
|
691
|
-
}
|
|
692
|
-
function printSelfUpdateNote(note) {
|
|
693
|
-
const rendered = renderSelfUpdateNote(note);
|
|
694
|
-
if (!rendered) return;
|
|
695
|
-
console.log(`\n${chalk.bold(chalk.yellow("Update note"))}`);
|
|
696
|
-
console.log(rendered);
|
|
697
|
-
console.log();
|
|
698
|
-
}
|
|
699
|
-
async function runSelfUpdate(command) {
|
|
700
|
-
console.log(chalk.dim(`Updating ${APP_NAME} with ${command.display}...`));
|
|
701
|
-
for (const step of command.steps ?? [command]) {
|
|
702
|
-
const launch = await processLaunchAsync(step.command);
|
|
703
|
-
await new Promise((resolve, reject) => {
|
|
704
|
-
const child = spawnLaunchedProcess(launch, step.args, { stdio: "inherit" });
|
|
705
|
-
child.on("error", (error) => {
|
|
706
|
-
reject(error);
|
|
707
|
-
});
|
|
708
|
-
child.on("close", (code, signal) => {
|
|
709
|
-
if (code === 0) resolve();
|
|
710
|
-
else if (signal) reject(/* @__PURE__ */ new Error(`${step.display} terminated by signal ${signal}`));
|
|
711
|
-
else reject(/* @__PURE__ */ new Error(`${step.display} exited with code ${code ?? "unknown"}`));
|
|
712
|
-
});
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
/** Run the user-configured self-update command, then report the version installed on disk. */
|
|
717
|
-
async function runConfiguredSelfUpdate(argv, plan) {
|
|
718
|
-
const command = makeConfiguredSelfUpdateCommand(argv, plan);
|
|
719
|
-
if (plan.note) printSelfUpdateNote(plan.note);
|
|
720
|
-
try {
|
|
721
|
-
await runSelfUpdate(command);
|
|
722
|
-
} catch (error) {
|
|
723
|
-
const message = error instanceof Error ? error.message : "Unknown self-update command error";
|
|
724
|
-
console.error(chalk.red(`Error: ${message}`));
|
|
725
|
-
process.exitCode = 1;
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
const change = detectInstallChange();
|
|
729
|
-
const installedVersion = change?.kind === "updated" && change.version === plan.version ? change.version : readVersionOnPath();
|
|
730
|
-
if (installedVersion === plan.version) {
|
|
731
|
-
console.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${plan.version}`));
|
|
732
|
-
await runIntercomUpgrade();
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
console.log(chalk.yellow(`Ran ${command.display}, but \`${APP_NAME} --version\` reports ${installedVersion ?? "no version"}, not ${plan.version}.`));
|
|
736
|
-
}
|
|
737
|
-
/** The environment for running the Atomic on PATH, the Atomic the user runs next. */
|
|
738
|
-
function getInstalledAtomicEnv() {
|
|
739
|
-
const env = { ...process.env };
|
|
740
|
-
for (const name of getEnvNames(ENV_PACKAGE_DIR)) delete env[name];
|
|
741
|
-
return env;
|
|
742
|
-
}
|
|
743
|
-
/** Version printed by `atomic --version` as resolved from PATH, the Atomic the user runs next. */
|
|
744
|
-
function readVersionOnPath() {
|
|
745
|
-
const env = getInstalledAtomicEnv();
|
|
746
|
-
const result = spawnLaunchedProcessSync(processLaunch(APP_NAME, { env }), ["--version"], {
|
|
747
|
-
encoding: "utf-8",
|
|
748
|
-
stdio: [
|
|
749
|
-
"ignore",
|
|
750
|
-
"pipe",
|
|
751
|
-
"pipe"
|
|
752
|
-
],
|
|
753
|
-
env
|
|
754
|
-
});
|
|
755
|
-
return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
|
|
756
|
-
}
|
|
757
|
-
/**
|
|
758
|
-
* Whether the Atomic on PATH lists `atomic intercom upgrade` in its Intercom help. A release from before the command
|
|
759
|
-
* reads `intercom upgrade` as a prompt for the model (0.9.41 and older) or rejects it (0.9.42 to 0.9.71); `--help` is
|
|
760
|
-
* harmless on every release.
|
|
761
|
-
*/
|
|
762
|
-
function installedListsIntercomUpgrade() {
|
|
763
|
-
const env = getInstalledAtomicEnv();
|
|
764
|
-
const result = spawnLaunchedProcessSync(processLaunch(APP_NAME, { env }), ["intercom", "--help"], {
|
|
765
|
-
encoding: "utf-8",
|
|
766
|
-
stdio: [
|
|
767
|
-
"ignore",
|
|
768
|
-
"pipe",
|
|
769
|
-
"ignore"
|
|
770
|
-
],
|
|
771
|
-
env
|
|
772
|
-
});
|
|
773
|
-
return result.status === 0 && result.stdout.split("\n").some((line) => line.trim() === `${APP_NAME} intercom upgrade`);
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* Ask the newly installed Atomic to retire an Intercom broker left running by the previous version, when it has the
|
|
777
|
-
* command. It reads no input. The update has already succeeded, so a failure here only warns and never changes the
|
|
778
|
-
* exit code.
|
|
779
|
-
*/
|
|
780
|
-
async function runIntercomUpgrade() {
|
|
781
|
-
if (!installedListsIntercomUpgrade()) return;
|
|
782
|
-
const env = getInstalledAtomicEnv();
|
|
783
|
-
const launch = await processLaunchAsync(APP_NAME, { env });
|
|
784
|
-
const failure = await new Promise((resolve) => {
|
|
785
|
-
const child = spawnLaunchedProcess(launch, ["intercom", "upgrade"], {
|
|
786
|
-
stdio: [
|
|
787
|
-
"ignore",
|
|
788
|
-
"inherit",
|
|
789
|
-
"inherit"
|
|
790
|
-
],
|
|
791
|
-
env
|
|
792
|
-
});
|
|
793
|
-
child.on("error", (error) => resolve(error.message));
|
|
794
|
-
child.on("close", (code, signal) => {
|
|
795
|
-
if (code === 0) resolve(void 0);
|
|
796
|
-
else resolve(signal ? `terminated by signal ${signal}` : `exited with code ${code ?? "unknown"}`);
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
if (failure) console.error(chalk.yellow(`${APP_NAME} intercom upgrade ${failure}. Run \`${APP_NAME} intercom upgrade\` yourself if new sessions do not start.`));
|
|
800
|
-
}
|
|
801
|
-
function prepareWindowsNpmSelfUpdate() {
|
|
802
|
-
if (process.platform !== "win32") return;
|
|
803
|
-
const packageDir = getPackageDir();
|
|
804
|
-
cleanupWindowsSelfUpdateQuarantine(packageDir);
|
|
805
|
-
quarantineWindowsNativeDependencies(packageDir);
|
|
806
|
-
}
|
|
807
|
-
function getCommandAppMode() {
|
|
808
|
-
return process.stdin.isTTY && process.stdout.isTTY ? "interactive" : "print";
|
|
809
|
-
}
|
|
810
|
-
function reportProjectTrustWarnings(warnings) {
|
|
811
|
-
for (const warning of warnings) console.error(chalk.yellow(`Warning: ${warning}`));
|
|
812
|
-
}
|
|
813
|
-
async function createCommandSettingsManager(options) {
|
|
814
|
-
const settingsManager = SettingsManager.create(options.cwd, options.agentDir, { projectTrusted: false });
|
|
815
|
-
const projectTrustWarnings = [];
|
|
816
|
-
const appMode = getCommandAppMode();
|
|
817
|
-
const extensionsResult = options.projectTrustOverride === void 0 && hasProjectTrustInputs(options.cwd) ? await new DefaultResourceLoader({
|
|
818
|
-
cwd: options.cwd,
|
|
819
|
-
agentDir: options.agentDir,
|
|
820
|
-
settingsManager,
|
|
821
|
-
extensionFactories: options.extensionFactories
|
|
822
|
-
}).loadProjectTrustExtensions() : void 0;
|
|
823
|
-
for (const error of extensionsResult?.errors ?? []) projectTrustWarnings.push(`Failed to load extension "${error.path}": ${error.error}`);
|
|
824
|
-
const projectTrusted = await resolveProjectTrusted({
|
|
825
|
-
cwd: options.cwd,
|
|
826
|
-
trustStore: new ProjectTrustStore(options.agentDir),
|
|
827
|
-
trustOverride: options.projectTrustOverride,
|
|
828
|
-
defaultProjectTrust: settingsManager.getDefaultProjectTrust(),
|
|
829
|
-
extensionsResult,
|
|
830
|
-
projectTrustContext: createProjectTrustContext({
|
|
831
|
-
cwd: options.cwd,
|
|
832
|
-
mode: appMode,
|
|
833
|
-
settingsManager,
|
|
834
|
-
hasUI: appMode === "interactive"
|
|
835
|
-
}),
|
|
836
|
-
onExtensionError: (message) => projectTrustWarnings.push(message)
|
|
837
|
-
});
|
|
838
|
-
settingsManager.setProjectTrusted(projectTrusted);
|
|
839
|
-
return {
|
|
840
|
-
settingsManager,
|
|
841
|
-
projectTrustWarnings
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
async function handleConfigCommand(args, runtimeOptions = {}) {
|
|
845
|
-
const options = parseConfigCommand(args);
|
|
846
|
-
if (!options) return false;
|
|
847
|
-
const usage = `${APP_NAME} config [-l] [--approve|--no-approve]`;
|
|
848
|
-
if (options.help) {
|
|
849
|
-
console.log(`${chalk.bold("Usage:")}\n ${usage}\n\nOpen the resource configuration TUI. Without -l, starts in global settings (~/${CONFIG_DIR_NAME}/agent/settings.json).\n\n${chalk.bold("Options:")}\n -l, --local Start in project-local settings\n -a, --approve Trust this project\n -na, --no-approve Do not trust this project\n -h, --help Show this help`);
|
|
850
|
-
return true;
|
|
851
|
-
}
|
|
852
|
-
if (options.invalidOption || options.invalidArgument) {
|
|
853
|
-
const message = options.invalidOption ? `Unknown option ${options.invalidOption} for "config".` : `Unexpected argument ${options.invalidArgument}.`;
|
|
854
|
-
console.error(chalk.red(message));
|
|
855
|
-
console.error(chalk.dim(`Usage: ${usage}`));
|
|
856
|
-
process.exitCode = 1;
|
|
857
|
-
return true;
|
|
858
|
-
}
|
|
859
|
-
const cwd = process.cwd();
|
|
860
|
-
const agentDir = getAgentDir();
|
|
861
|
-
const { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({
|
|
862
|
-
cwd,
|
|
863
|
-
agentDir,
|
|
864
|
-
projectTrustOverride: options.projectTrustOverride,
|
|
865
|
-
extensionFactories: runtimeOptions.extensionFactories
|
|
866
|
-
});
|
|
867
|
-
reportProjectTrustWarnings(projectTrustWarnings);
|
|
868
|
-
if (options.local && !settingsManager.isProjectTrusted()) {
|
|
869
|
-
console.error(chalk.red("Project is not trusted. Use --approve to modify local resource config."));
|
|
870
|
-
process.exitCode = 1;
|
|
871
|
-
return true;
|
|
872
|
-
}
|
|
873
|
-
reportSettingsErrors(settingsManager, "config command");
|
|
874
|
-
const globalManager = SettingsManager.create(cwd, agentDir, { projectTrusted: false });
|
|
875
|
-
const builtinExtensions = (runtimeOptions.extensionFactories ?? []).flatMap((input) => typeof input !== "function" && input.builtin ? [input.name] : []);
|
|
876
|
-
const global = await new DefaultPackageManager({
|
|
877
|
-
cwd,
|
|
878
|
-
agentDir,
|
|
879
|
-
settingsManager: globalManager,
|
|
880
|
-
builtinExtensions
|
|
881
|
-
}).resolve();
|
|
882
|
-
const project = settingsManager.isProjectTrusted() ? await new DefaultPackageManager({
|
|
883
|
-
cwd,
|
|
884
|
-
agentDir,
|
|
885
|
-
settingsManager,
|
|
886
|
-
builtinExtensions
|
|
887
|
-
}).resolve() : global;
|
|
888
|
-
const installWarnings = new Set([...global.installFailures ?? [], ...project.installFailures ?? []].map(formatPackageInstallWarning));
|
|
889
|
-
for (const warning of installWarnings) console.error(chalk.yellow(`Warning: ${warning}`));
|
|
890
|
-
await selectConfig({
|
|
891
|
-
resolvedPaths: {
|
|
892
|
-
global,
|
|
893
|
-
project
|
|
894
|
-
},
|
|
895
|
-
settingsManager,
|
|
896
|
-
cwd,
|
|
897
|
-
agentDir,
|
|
898
|
-
writeScope: options.local ? "project" : "global",
|
|
899
|
-
projectModeAvailable: settingsManager.isProjectTrusted()
|
|
900
|
-
});
|
|
901
|
-
await settingsManager.flush();
|
|
902
|
-
process.exit(0);
|
|
903
|
-
}
|
|
904
|
-
async function handlePackageCommand(args, runtimeOptions = {}) {
|
|
905
|
-
const options = parsePackageCommand(args);
|
|
906
|
-
if (!options) return false;
|
|
907
|
-
if (handlePackageCommandParseOutcome(options)) return true;
|
|
908
|
-
const source = options.source;
|
|
909
|
-
const cwd = process.cwd();
|
|
910
|
-
const agentDir = getAgentDir();
|
|
911
|
-
const writesProjectPackageConfig = (options.command === "install" || options.command === "remove") && options.local;
|
|
912
|
-
const { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({
|
|
913
|
-
cwd,
|
|
914
|
-
agentDir,
|
|
915
|
-
projectTrustOverride: options.projectTrustOverride,
|
|
916
|
-
extensionFactories: runtimeOptions.extensionFactories
|
|
917
|
-
});
|
|
918
|
-
reportProjectTrustWarnings(projectTrustWarnings);
|
|
919
|
-
if (!settingsManager.isProjectTrusted() && writesProjectPackageConfig) {
|
|
920
|
-
console.error(chalk.red("Project is not trusted. Use --approve to modify local package config."));
|
|
921
|
-
process.exitCode = 1;
|
|
922
|
-
return true;
|
|
923
|
-
}
|
|
924
|
-
reportSettingsErrors(settingsManager, "package command");
|
|
925
|
-
const selfUpdateNpmCommand = settingsManager.getGlobalSettings().npmCommand;
|
|
926
|
-
const packageManager = new DefaultPackageManager({
|
|
927
|
-
cwd,
|
|
928
|
-
agentDir,
|
|
929
|
-
settingsManager
|
|
930
|
-
});
|
|
931
|
-
const updatedPackages = [];
|
|
932
|
-
let warningCount = 0;
|
|
933
|
-
packageManager.setProgressCallback((event) => {
|
|
934
|
-
if (event.type === "result" && event.action === "update" && event.message) updatedPackages.push(event.message);
|
|
935
|
-
else if (event.type === "start") process.stdout.write(chalk.dim(`${event.message}\n`));
|
|
936
|
-
else if (event.type === "progress" && event.message) {
|
|
937
|
-
warningCount++;
|
|
938
|
-
process.stdout.write(chalk.yellow(`${event.message}\n`));
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
try {
|
|
942
|
-
switch (options.command) {
|
|
943
|
-
case "install":
|
|
944
|
-
await packageManager.installAndPersist(source, { local: options.local });
|
|
945
|
-
console.log(chalk.green(`Installed ${source}`));
|
|
946
|
-
return true;
|
|
947
|
-
case "remove": {
|
|
948
|
-
const installedPath = packageManager.getInstalledPath(source, options.local ? "project" : "user");
|
|
949
|
-
const removed = await packageManager.removeAndPersist(source, { local: options.local });
|
|
950
|
-
if (!removed && installedPath && !existsSync(installedPath)) {
|
|
951
|
-
console.log(chalk.green(`Removed ${installedPath}; ${source} was not in your settings`));
|
|
952
|
-
return true;
|
|
953
|
-
}
|
|
954
|
-
if (!removed) {
|
|
955
|
-
console.error(chalk.red(`No matching package found for ${source}`));
|
|
956
|
-
process.exitCode = 1;
|
|
957
|
-
return true;
|
|
958
|
-
}
|
|
959
|
-
console.log(chalk.green(`Removed ${source}`));
|
|
960
|
-
return true;
|
|
961
|
-
}
|
|
962
|
-
case "list": {
|
|
963
|
-
const configuredPackages = packageManager.listConfiguredPackages();
|
|
964
|
-
const userPackages = configuredPackages.filter((pkg) => pkg.scope === "user");
|
|
965
|
-
const projectPackages = configuredPackages.filter((pkg) => pkg.scope === "project");
|
|
966
|
-
if (configuredPackages.length === 0) {
|
|
967
|
-
console.log(chalk.dim("No packages installed."));
|
|
968
|
-
return true;
|
|
969
|
-
}
|
|
970
|
-
const formatPackage = (pkg) => {
|
|
971
|
-
const display = pkg.filtered ? `${pkg.source} (filtered)` : pkg.source;
|
|
972
|
-
console.log(` ${display}`);
|
|
973
|
-
if (pkg.installedPath) console.log(chalk.dim(` ${pkg.installedPath}`));
|
|
974
|
-
};
|
|
975
|
-
if (userPackages.length > 0) {
|
|
976
|
-
console.log(chalk.bold("User packages:"));
|
|
977
|
-
for (const pkg of userPackages) formatPackage(pkg);
|
|
978
|
-
}
|
|
979
|
-
if (projectPackages.length > 0) {
|
|
980
|
-
if (userPackages.length > 0) console.log();
|
|
981
|
-
console.log(chalk.bold("Project packages:"));
|
|
982
|
-
for (const pkg of projectPackages) formatPackage(pkg);
|
|
983
|
-
}
|
|
984
|
-
return true;
|
|
985
|
-
}
|
|
986
|
-
case "update": {
|
|
987
|
-
const target = options.updateTarget ?? { type: "self" };
|
|
988
|
-
if (target.type === "models") {
|
|
989
|
-
if (runtimeOptions.refreshModelCatalogs) await runtimeOptions.refreshModelCatalogs(agentDir);
|
|
990
|
-
else await refreshModelCatalogs(agentDir, {
|
|
991
|
-
cwd,
|
|
992
|
-
settingsManager,
|
|
993
|
-
extensionFactories: runtimeOptions.extensionFactories
|
|
994
|
-
});
|
|
995
|
-
console.log(chalk.green("Model catalogs refreshed"));
|
|
996
|
-
return true;
|
|
997
|
-
}
|
|
998
|
-
if (options.showExtensionsSkippedNote) console.log(chalk.dim(`Extensions are skipped. Run ${APP_NAME} update --extensions to update extensions.`));
|
|
999
|
-
if (updateTargetIncludesExtensions(target)) {
|
|
1000
|
-
const updateSource = target.type === "extensions" ? target.source : void 0;
|
|
1001
|
-
await packageManager.update(updateSource);
|
|
1002
|
-
if (isOfflineModeEnabled()) console.log(chalk.yellow("Skipped package updates (offline mode)"));
|
|
1003
|
-
else if (updatedPackages.length === 0 && warningCount > 0) console.log(chalk.yellow(updateSource ? `${updateSource} was not updated, see the warnings above` : "No packages were updated, see the warnings above"));
|
|
1004
|
-
else if (updatedPackages.length === 0) console.log(chalk.green(updateSource ? `${updateSource} is already up to date` : "Packages are already up to date"));
|
|
1005
|
-
else {
|
|
1006
|
-
const count = updatedPackages.length;
|
|
1007
|
-
console.log(chalk.green(`Updated ${count} package${count === 1 ? "" : "s"}:`));
|
|
1008
|
-
for (const message of updatedPackages) console.log(` ${message}`);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
if (updateTargetIncludesSelf(target)) {
|
|
1012
|
-
const selfUpdatePlan = await resolveSelfUpdatePlan(options.force);
|
|
1013
|
-
if (!selfUpdatePlan.shouldRun) {
|
|
1014
|
-
console.log(chalk.green(`${APP_NAME} is already up to date (v${VERSION})`));
|
|
1015
|
-
return true;
|
|
1016
|
-
}
|
|
1017
|
-
const configuredSelfUpdateArgv = getConfiguredSelfUpdateArgv(settingsManager.getGlobalSettings().selfUpdateCommand);
|
|
1018
|
-
if (configuredSelfUpdateArgv) {
|
|
1019
|
-
await runConfiguredSelfUpdate(configuredSelfUpdateArgv, selfUpdatePlan);
|
|
1020
|
-
return true;
|
|
1021
|
-
}
|
|
1022
|
-
const installMethod = detectInstallMethod();
|
|
1023
|
-
if (process.platform === "win32" && installMethod !== "npm" && installMethod !== "pnpm") {
|
|
1024
|
-
console.error(chalk.red(`${APP_NAME} self-update on Windows is only supported for npm and pnpm installs.`));
|
|
1025
|
-
console.error(chalk.dim(`Detected install method: ${installMethod}. Update ${APP_NAME} manually.`));
|
|
1026
|
-
process.exitCode = 1;
|
|
1027
|
-
return true;
|
|
1028
|
-
}
|
|
1029
|
-
const selfUpdateTarget = {
|
|
1030
|
-
packageName: selfUpdatePlan.packageName,
|
|
1031
|
-
installSpec: selfUpdatePlan.installSpec
|
|
1032
|
-
};
|
|
1033
|
-
const selfUpdateCommand = getSelfUpdateCommand(PACKAGE_NAME, selfUpdateNpmCommand, selfUpdateTarget);
|
|
1034
|
-
if (!selfUpdateCommand) {
|
|
1035
|
-
printSelfUpdateUnavailable(selfUpdateNpmCommand, selfUpdateTarget);
|
|
1036
|
-
process.exitCode = 1;
|
|
1037
|
-
return true;
|
|
1038
|
-
}
|
|
1039
|
-
if (selfUpdatePlan.note) printSelfUpdateNote(selfUpdatePlan.note);
|
|
1040
|
-
try {
|
|
1041
|
-
if (installMethod === "npm") prepareWindowsNpmSelfUpdate();
|
|
1042
|
-
await runSelfUpdate(selfUpdateCommand);
|
|
1043
|
-
} catch (error) {
|
|
1044
|
-
const message = error instanceof Error ? error.message : "Unknown package command error";
|
|
1045
|
-
console.error(chalk.red(`Error: ${message}`));
|
|
1046
|
-
printSelfUpdateFallback(selfUpdateCommand);
|
|
1047
|
-
process.exitCode = 1;
|
|
1048
|
-
return true;
|
|
1049
|
-
}
|
|
1050
|
-
console.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${selfUpdatePlan.version}`));
|
|
1051
|
-
const installedVersion = readVersionOnPath();
|
|
1052
|
-
if (installedVersion === selfUpdatePlan.version) await runIntercomUpgrade();
|
|
1053
|
-
else console.log(chalk.dim(`\`${APP_NAME} --version\` on PATH reports ${installedVersion ?? "no version"}, not ${selfUpdatePlan.version}, so the Intercom broker was left as it is; run \`${APP_NAME} intercom upgrade\` with the new version.`));
|
|
1054
|
-
}
|
|
1055
|
-
return true;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
} catch (error) {
|
|
1059
|
-
const message = error instanceof Error ? error.message : "Unknown package command error";
|
|
1060
|
-
console.error(chalk.red(`Error: ${message}`));
|
|
1061
|
-
process.exitCode = 1;
|
|
1062
|
-
return true;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
export { handleConfigCommand, handlePackageCommand, refreshModelCatalogs };
|
|
1066
|
-
|
|
1067
|
-
//# sourceMappingURL=package-manager-cli.js.map
|
|
1
|
+
// Written by the build (scripts/in-place-update-gate.mjs): when this module's code cannot load in a process of an earlier release
|
|
2
|
+
// that an in-place update left running, the process is told to restart.
|
|
3
|
+
let module;
|
|
4
|
+
try {
|
|
5
|
+
module = await import("./package-manager-cli.code.js");
|
|
6
|
+
} catch (error) {
|
|
7
|
+
const root = new URL("./", import.meta.url);
|
|
8
|
+
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
+
const key = `${root.href}#0.10.5-alpha.1`;
|
|
10
|
+
let release = releases.get(key);
|
|
11
|
+
if (release === undefined) {
|
|
12
|
+
const current = (async () => {
|
|
13
|
+
for (const path of ["modes/interactive/interactive-mode-deps.js","_shared/chunk-CDOYTDYM.js","_shared/p0-cli-GUFK7TPN.js"]) {
|
|
14
|
+
try {
|
|
15
|
+
const held = await import(new URL(path, root).href);
|
|
16
|
+
if (typeof held.VERSION === "string") return { version: held.VERSION, name: held.APP_NAME };
|
|
17
|
+
} catch {
|
|
18
|
+
// Not a file this process can load: the next.
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
})().then((found) => {
|
|
23
|
+
if (found === undefined && releases.get(key) === current) releases.delete(key);
|
|
24
|
+
return found;
|
|
25
|
+
});
|
|
26
|
+
releases.set(key, current);
|
|
27
|
+
release = current;
|
|
28
|
+
}
|
|
29
|
+
const running = await release;
|
|
30
|
+
if (running === undefined || running.version === "0.10.5-alpha.1") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.5-alpha.1 while this session was running; restart it to keep using this feature.", {
|
|
32
|
+
cause: error,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export const { handleConfigCommand, handlePackageCommand, refreshModelCatalogs } = module;
|
|
36
|
+
//# sourceMappingURL=package-manager-cli.js.map
|