@bastani/atomic 0.10.4 → 0.10.5
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 +122 -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} +519 -316
- 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 +42 -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 +12 -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/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 +30 -1096
- package/dist/cli/auth-cli.impl.js.map +1 -1
- package/dist/cli/auth-cli.js +11 -7
- 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 +30 -900
- package/dist/cli/blueprint-command.impl.js.map +1 -1
- package/dist/cli/blueprint-command.js +11 -7
- 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 +33 -105
- package/dist/cli/intercom-command.impl.js.map +1 -1
- package/dist/cli/intercom-command.js +11 -7
- 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 +33 -57
- package/dist/cli/list-models.impl.js.map +1 -1
- package/dist/cli/list-models.js +11 -7
- 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 +33 -52
- package/dist/cli/session-picker.impl.js.map +1 -1
- package/dist/cli/session-picker.js +11 -7
- 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 +35 -4
- package/dist/cli/startup-ui.js +11 -7
- 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 +35 -2
- package/dist/cli/storage-command.js +11 -7
- 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 +33 -186
- package/dist/cli/storage-search-session.impl.js.map +1 -1
- package/dist/cli/storage-search-session.js +11 -7
- 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 +32 -213
- package/dist/cli/team-command.impl.js.map +1 -1
- package/dist/cli/team-command.js +11 -7
- 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 +35 -2
- package/dist/core/debug.js +11 -7
- 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 +34 -255
- package/dist/core/export-html/card-projection.impl.js.map +1 -1
- package/dist/core/export-html/card-projection.js +11 -7
- 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 +30 -604
- package/dist/core/export-html/index.impl.js.map +1 -1
- package/dist/core/export-html/index.js +11 -7
- 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 +35 -2
- package/dist/core/export-html/json-spans.js +11 -7
- 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 +31 -120
- package/dist/core/export-html/oversized-render-inputs.impl.js.map +1 -1
- package/dist/core/export-html/oversized-render-inputs.js +11 -7
- 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 +33 -347
- package/dist/core/export-html/tool-renderer.impl.js.map +1 -1
- package/dist/core/export-html/tool-renderer.js +11 -7
- 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 +35 -2
- package/dist/core/extensions/jiti-loader.js +11 -7
- 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 +35 -2
- package/dist/core/extensions/jiti-static-loader.js +11 -7
- 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 +35 -2
- package/dist/core/extensions/loader-host-modules.js +11 -7
- 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 +35 -4
- package/dist/core/intercom-broker-control-host.js +11 -7
- 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 +35 -17
- package/dist/core/intercom-broker-control.impl.js.map +1 -1
- package/dist/core/intercom-broker-control.js +11 -7
- 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 +35 -2
- package/dist/core/package-manager-storage-adapters.js +11 -7
- 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 +35 -8
- package/dist/core/sdk.js +11 -7
- 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 +35 -2
- package/dist/core/session-manager-list.js +11 -7
- 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 +35 -7
- package/dist/core/session-manager.js +11 -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 +35 -2
- package/dist/core/session-storage.js +11 -7
- 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 +33 -34
- package/dist/core/storage/offline-snapshot-file.impl.js.map +1 -1
- package/dist/core/storage/offline-snapshot-file.js +11 -7
- 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 +32 -97
- package/dist/core/storage/session/branch-fork-source.impl.js.map +1 -1
- package/dist/core/storage/session/branch-fork-source.js +11 -7
- 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 +34 -58
- package/dist/core/storage/session/card-view.impl.js.map +1 -1
- package/dist/core/storage/session/card-view.js +11 -7
- 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 +33 -91
- package/dist/core/storage/session/child-reader.impl.js.map +1 -1
- package/dist/core/storage/session/child-reader.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/chunked-resume-projection.js +11 -7
- 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 +31 -634
- package/dist/core/storage/session/expanded-child-details.impl.js.map +1 -1
- package/dist/core/storage/session/expanded-child-details.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/fork-row-bytes.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/fork-row-index.js +11 -7
- 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 +30 -574
- package/dist/core/storage/session/fork-staging.impl.js.map +1 -1
- package/dist/core/storage/session/fork-staging.js +11 -7
- 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 +30 -471
- package/dist/core/storage/session/fork-window.impl.js.map +1 -1
- package/dist/core/storage/session/fork-window.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/history-pages.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/jsonl-entry-projection.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/jsonl-session-store.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/memory-session-store.js +11 -7
- 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 +33 -69
- package/dist/core/storage/session/pinned-branch-resume.impl.js.map +1 -1
- package/dist/core/storage/session/pinned-branch-resume.js +11 -7
- 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 +32 -461
- package/dist/core/storage/session/released-history-files.impl.js.map +1 -1
- package/dist/core/storage/session/released-history-files.js +11 -7
- 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 +32 -53
- package/dist/core/storage/session/resident-fork-rows.impl.js.map +1 -1
- package/dist/core/storage/session/resident-fork-rows.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/session-resume.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/snapshot-cut.js +11 -7
- 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 +34 -60
- package/dist/core/storage/session/snapshot-history.impl.js.map +1 -1
- package/dist/core/storage/session/snapshot-history.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/sql-session-store.js +11 -7
- 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 +35 -2
- package/dist/core/storage/session/tree-outline.js +11 -7
- 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 +31 -337
- package/dist/core/storage/session/tree-presentation.impl.js.map +1 -1
- package/dist/core/storage/session/tree-presentation.js +11 -7
- 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 +35 -2
- package/dist/core/storage/storage-status.js +11 -7
- 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 +35 -2
- package/dist/core/storage/team.js +11 -7
- 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 +35 -2
- package/dist/core/structured-output/index.js +11 -7
- 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 +33 -251
- package/dist/core/tasks/task-completion-entry.impl.js.map +1 -1
- package/dist/core/tasks/task-completion-entry.js +11 -7
- 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 +32 -375
- package/dist/core/tasks/task-file-history.impl.js.map +1 -1
- package/dist/core/tasks/task-file-history.js +11 -7
- package/dist/core/tasks/{task-reference-archive.impl.js → task-reference-archive.code.js} +51 -6
- package/dist/core/tasks/{task-reference-archive.impl.js.map → task-reference-archive.code.js.map} +1 -1
- package/dist/core/tasks/task-reference-archive.js +11 -7
- package/dist/core/tasks/{task-reference-identity.impl.js → task-reference-identity.code.js} +1 -1
- package/dist/core/tasks/{task-reference-identity.impl.js.map → task-reference-identity.code.js.map} +1 -1
- package/dist/core/tasks/task-reference-identity.js +11 -7
- 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 +35 -2
- package/dist/core/tasks/task-reference-stream.js +11 -7
- 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 +35 -2
- package/dist/core/tasks/task-unsaved-answer.js +11 -7
- 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 +35 -2
- package/dist/core/tasks/task-view-source.js +12 -8
- 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 +30 -1524
- package/dist/core/tools/read-url.impl.js.map +1 -1
- package/dist/core/tools/read-url.js +11 -7
- 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 +35 -5
- package/dist/core/worktree-snapshot/errors.js +11 -7
- 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 +34 -134
- package/dist/core/worktree-snapshot/session-index-reset.impl.js.map +1 -1
- package/dist/core/worktree-snapshot/session-index-reset.js +11 -7
- 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 +30 -612
- package/dist/extensions/codemode/execute.impl.js.map +1 -1
- package/dist/extensions/codemode/execute.js +11 -7
- 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 +33 -107
- package/dist/extensions/codemode/renderer.impl.js.map +1 -1
- package/dist/extensions/codemode/renderer.js +11 -7
- 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 +32 -561
- package/dist/extensions/mcp/cli.impl.js.map +1 -1
- package/dist/extensions/mcp/cli.js +11 -7
- 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 -7
- package/dist/extensions/mcp/cli.lazy.impl.js.map +1 -1
- package/dist/extensions/mcp/cli.lazy.js +11 -7
- 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 +35 -4
- package/dist/extensions/mcp/runtime.js +11 -7
- 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 +35 -11
- package/dist/main-first-time-setup.impl.js.map +1 -1
- package/dist/main-first-time-setup.js +11 -7
- 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 +33 -290
- package/dist/modes/interactive/components/stored-tree-view.impl.js.map +1 -1
- package/dist/modes/interactive/components/stored-tree-view.js +11 -7
- 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 +34 -189
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector-archive.js +11 -7
- package/dist/modes/interactive/interactive-mode-base.d.ts +6 -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 -1067
- package/dist/package-manager-cli.impl.js.map +1 -1
- package/dist/package-manager-cli.js +11 -7
- 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 +33 -105
- package/dist/utils/startup-database-spare.impl.js.map +1 -1
- package/dist/utils/startup-database-spare.js +11 -7
- 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 +35 -2
- package/dist/utils/tools-manager.js +11 -7
- 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 +1 -1
- 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
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
decideBrokerProtocol,
|
|
27
27
|
protocolRangeOf,
|
|
28
28
|
} from "./protocol-version.js";
|
|
29
|
+
import { isUnansweredCloseFromRetiringBroker, snapshotBrokerPidBeforeRequest } from "./retiring-broker-check.js";
|
|
29
30
|
import {
|
|
30
31
|
describeSharedStorage,
|
|
31
32
|
readSharedStorageSetting,
|
|
@@ -100,27 +101,35 @@ async function queryBroker(
|
|
|
100
101
|
agentDir: string,
|
|
101
102
|
timeoutMs: number = BROKER_CONTROL_TIMEOUT_MS,
|
|
102
103
|
): Promise<{ readonly query: BrokerQuery; readonly found?: BrokerProcess }> {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"broker_status",
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
const socketPath = getBrokerSocketPath(process.platform, agentDir);
|
|
105
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
106
|
+
const pidBefore = await snapshotBrokerPidBeforeRequest(agentDir);
|
|
107
|
+
const answer = await controlRequest(socketPath, "broker_status", "broker_status", timeoutMs);
|
|
108
|
+
if (!answer.connected) return { query: { state: "stopped" } };
|
|
109
|
+
const reply = answer.reply;
|
|
110
|
+
if (typeof reply === "object" && reply !== null && !Array.isArray(reply) && isBrokerStatusReport(reply.report)) {
|
|
111
|
+
return { query: { state: "running", report: reply.report } };
|
|
112
|
+
}
|
|
113
|
+
if (
|
|
114
|
+
reply === undefined &&
|
|
115
|
+
answer.timedOut !== true &&
|
|
116
|
+
(await isUnansweredCloseFromRetiringBroker(socketPath, agentDir, pidBefore))
|
|
117
|
+
) {
|
|
118
|
+
if (attempt === 0) continue;
|
|
119
|
+
return { query: { state: "stopped" } };
|
|
120
|
+
}
|
|
121
|
+
const pid = readBrokerPid(agentDir);
|
|
122
|
+
if (pid === undefined) return { query: { state: "legacy" } };
|
|
123
|
+
// Windows can briefly accept a named-pipe connection after its broker has terminated, and gives its pid to another
|
|
124
|
+
// process within seconds: a pid that names a process created well after broker.pid was written is no broker.
|
|
125
|
+
if (!isProcessAlive(pid)) return { query: { state: "stopped" } };
|
|
126
|
+
// Only Windows tells a later process by broker.pid's write time here; elsewhere a restart reads the start itself.
|
|
127
|
+
if (process.platform !== "win32") return { query: { state: "legacy", pid } };
|
|
128
|
+
const found = await identifyBrokerProcess(pid, getBrokerPidPath(agentDir));
|
|
129
|
+
if (found.wroteBrokerPid === "no") return { query: { state: "stopped" } };
|
|
130
|
+
return { query: { state: "legacy", pid }, found };
|
|
113
131
|
}
|
|
114
|
-
|
|
115
|
-
if (pid === undefined) return { query: { state: "legacy" } };
|
|
116
|
-
// Windows can briefly accept a named-pipe connection after its broker has terminated, and gives its pid to another
|
|
117
|
-
// process within seconds: a pid that names a process created well after broker.pid was written is no broker.
|
|
118
|
-
if (!isProcessAlive(pid)) return { query: { state: "stopped" } };
|
|
119
|
-
// Only Windows tells a later process by broker.pid's write time here; elsewhere a restart reads the start itself.
|
|
120
|
-
if (process.platform !== "win32") return { query: { state: "legacy", pid } };
|
|
121
|
-
const found = await identifyBrokerProcess(pid, getBrokerPidPath(agentDir));
|
|
122
|
-
if (found.wroteBrokerPid === "no") return { query: { state: "stopped" } };
|
|
123
|
-
return { query: { state: "legacy", pid }, found };
|
|
132
|
+
return { query: { state: "stopped" } };
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
/** The shared selection a broker started from this environment and agent directory would read, if any. */
|
|
@@ -195,6 +204,60 @@ export async function restartIntercomBroker(agentDir: string, options: RestartOp
|
|
|
195
204
|
return current.state === "stopped" ? { status: "stopped", previous } : { status: "restarted", previous, current };
|
|
196
205
|
}
|
|
197
206
|
|
|
207
|
+
export type StopIdleOutcome =
|
|
208
|
+
| { readonly status: "not-running" }
|
|
209
|
+
/** A broker older than `broker_status`: its session count is unknown, so it is left running. */
|
|
210
|
+
| { readonly status: "unreported"; readonly pid?: number }
|
|
211
|
+
/** Connected sessions are using the broker, so it is left running without interruption. */
|
|
212
|
+
| { readonly status: "busy"; readonly pid: number; readonly sessions: number }
|
|
213
|
+
/** The idle broker (0 connected sessions) shut down cleanly. */
|
|
214
|
+
| { readonly status: "stopped"; readonly pid: number }
|
|
215
|
+
/** Shutdown was unanswered or did not finish within the timeout; the broker was left alone. */
|
|
216
|
+
| { readonly status: "not-stopped"; readonly pid: number };
|
|
217
|
+
|
|
218
|
+
export interface StopIdleOptions {
|
|
219
|
+
readonly stopTimeoutMs?: number;
|
|
220
|
+
readonly controlTimeoutMs?: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Stop the agent directory's Intercom broker only if it reports 0 connected sessions.
|
|
225
|
+
*
|
|
226
|
+
* Used before a Windows npm self-update so an idle broker (for example one left running by an earlier version whose
|
|
227
|
+
* working directory pinned `dist\builtin\intercom`) releases its directory handle before npm renames the package.
|
|
228
|
+
* Never stops a broker with connected sessions or a legacy broker whose session count is unreported. If a session
|
|
229
|
+
* connects while shutdown is in flight, the broker retires cleanly and the session reconnects automatically.
|
|
230
|
+
*/
|
|
231
|
+
export async function stopIdleIntercomBroker(
|
|
232
|
+
agentDir: string,
|
|
233
|
+
options: StopIdleOptions = {},
|
|
234
|
+
): Promise<StopIdleOutcome> {
|
|
235
|
+
const controlTimeoutMs = options.controlTimeoutMs ?? BROKER_CONTROL_TIMEOUT_MS;
|
|
236
|
+
const query = await queryIntercomBroker(agentDir, controlTimeoutMs);
|
|
237
|
+
if (query.state === "stopped") return { status: "not-running" };
|
|
238
|
+
if (query.state === "legacy") {
|
|
239
|
+
return query.pid === undefined ? { status: "unreported" } : { status: "unreported", pid: query.pid };
|
|
240
|
+
}
|
|
241
|
+
const { pid, sessions } = query.report;
|
|
242
|
+
if (sessions > 0) return { status: "busy", pid, sessions };
|
|
243
|
+
const found = identifyBrokerProcess(pid, getBrokerPidPath(agentDir));
|
|
244
|
+
const answer = await requestBrokerShutdown(getBrokerSocketPath(process.platform, agentDir), controlTimeoutMs);
|
|
245
|
+
if (answer === "unanswered") return { status: "not-stopped", pid };
|
|
246
|
+
try {
|
|
247
|
+
await waitForBrokerExit(
|
|
248
|
+
pid,
|
|
249
|
+
options.stopTimeoutMs ?? BROKER_STOP_TIMEOUT_MS,
|
|
250
|
+
undefined,
|
|
251
|
+
found,
|
|
252
|
+
readProcessStartWithoutProcess,
|
|
253
|
+
);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (isIntercomBrokerStopTimeoutError(error)) return { status: "not-stopped", pid };
|
|
256
|
+
throw error;
|
|
257
|
+
}
|
|
258
|
+
return { status: "stopped", pid };
|
|
259
|
+
}
|
|
260
|
+
|
|
198
261
|
export type UpgradeOutcome =
|
|
199
262
|
| { readonly status: "not-running" }
|
|
200
263
|
/** A broker older than `broker_status`: it cannot report its sessions, so stopping it is never known to be safe. */
|
|
@@ -55,6 +55,15 @@ export function endedQueueOpenWaitMs(env: NodeJS.ProcessEnv = process.env): numb
|
|
|
55
55
|
export const ENDED_QUEUE_TOTAL_WAIT_MS = PRESENCE_REGISTRATION_BOUND_MS;
|
|
56
56
|
/** How long a send that may join a restored queue waits for the restored rows, at most. */
|
|
57
57
|
export const ENDED_QUEUE_LOAD_WAIT_MS = 5_000;
|
|
58
|
+
/** Test-only override of {@link ENDED_QUEUE_LOAD_WAIT_MS} for deterministic restore-barrier tests, in milliseconds. */
|
|
59
|
+
export const ENDED_QUEUE_LOAD_WAIT_ENV = "ATOMIC_INTERCOM_ENDED_QUEUE_LOAD_WAIT_MS";
|
|
60
|
+
|
|
61
|
+
/** The wait a broker gives restoring its kept rows: the default, unless a test overrides it. */
|
|
62
|
+
export function endedQueueLoadWaitMs(env: NodeJS.ProcessEnv = process.env): number {
|
|
63
|
+
const value = env[ENDED_QUEUE_LOAD_WAIT_ENV];
|
|
64
|
+
const parsed = value === undefined || value.trim() === "" ? Number.NaN : Number(value);
|
|
65
|
+
return Number.isSafeInteger(parsed) && parsed > 0 && parsed <= MAX_TIMER_MS ? parsed : ENDED_QUEUE_LOAD_WAIT_MS;
|
|
66
|
+
}
|
|
58
67
|
|
|
59
68
|
/** What a queued message's sender is told while its `queued` answer still waits for the message to be kept. */
|
|
60
69
|
type EarlyOutcome = { readonly kind: "delivered" } | { readonly kind: "failed"; readonly reason: string };
|
|
@@ -200,8 +209,16 @@ function isSessionInRestoredSet(
|
|
|
200
209
|
export interface RestoreHoldLookupOptions {
|
|
201
210
|
/** Multi-node alias resolver (`localAliasTarget`), when multi-node routing is active. */
|
|
202
211
|
readonly localAliasTarget?: (target: string) => BrokerConnectedSession | undefined;
|
|
203
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Additional sessions the sender can reach directly across groups (matches `handleBrokerSend`'s `visibleCandidates`:
|
|
214
|
+
* authorized supervisor target, open ask reply route, or supervisor-channel vertical-bypass reply).
|
|
215
|
+
*/
|
|
204
216
|
readonly extraReachable?: readonly BrokerConnectedSession[];
|
|
217
|
+
/**
|
|
218
|
+
* Fallback-only cross-group sessions reachable via a return path (matches `handleBrokerSend`'s `returnPathCandidates`:
|
|
219
|
+
* consulted only when no visible/direct candidate matches, and never by host session ID).
|
|
220
|
+
*/
|
|
221
|
+
readonly returnPathReachable?: readonly BrokerConnectedSession[];
|
|
205
222
|
}
|
|
206
223
|
|
|
207
224
|
/**
|
|
@@ -227,11 +244,20 @@ export function shouldHoldSendForEndedQueueRestore(
|
|
|
227
244
|
if (trimmed.length === 0) return false;
|
|
228
245
|
const localAliasTarget = typeof options === "function" ? options : options?.localAliasTarget;
|
|
229
246
|
const extraReachable = typeof options === "function" ? undefined : options?.extraReachable;
|
|
247
|
+
const returnPathReachable = typeof options === "function" ? undefined : options?.returnPathReachable;
|
|
230
248
|
|
|
231
249
|
const senderCanReach = (session: BrokerConnectedSession): boolean => {
|
|
232
250
|
if (sender === undefined) return false;
|
|
233
251
|
if (reachesSession(sender, session.info)) return true;
|
|
234
|
-
if (extraReachable !== undefined && extraReachable.
|
|
252
|
+
if (extraReachable !== undefined && extraReachable.some((candidate) => candidate.info.id === session.info.id)) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
if (
|
|
256
|
+
returnPathReachable !== undefined &&
|
|
257
|
+
returnPathReachable.some((candidate) => candidate.info.id === session.info.id)
|
|
258
|
+
) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
235
261
|
return false;
|
|
236
262
|
};
|
|
237
263
|
|
|
@@ -248,26 +274,43 @@ export function shouldHoldSendForEndedQueueRestore(
|
|
|
248
274
|
if (aliased !== undefined) return holdResolved(aliased);
|
|
249
275
|
|
|
250
276
|
if (sender !== undefined) {
|
|
251
|
-
const
|
|
252
|
-
const
|
|
277
|
+
const candidateInfos: SessionInfo[] = [];
|
|
278
|
+
const candidateIds = new Set<string>();
|
|
253
279
|
for (const session of sessions.values()) {
|
|
254
280
|
if (!isAgentRecipient(session.info) || !reachesSession(sender, session.info)) continue;
|
|
255
|
-
|
|
256
|
-
|
|
281
|
+
candidateInfos.push(session.info);
|
|
282
|
+
candidateIds.add(session.info.id);
|
|
283
|
+
}
|
|
284
|
+
if (extraReachable !== undefined) {
|
|
285
|
+
for (const session of extraReachable) {
|
|
286
|
+
if (!isAgentRecipient(session.info) || candidateIds.has(session.info.id)) continue;
|
|
287
|
+
candidateInfos.push(session.info);
|
|
288
|
+
candidateIds.add(session.info.id);
|
|
289
|
+
}
|
|
257
290
|
}
|
|
258
|
-
let resolved = resolveSessionTarget(
|
|
259
|
-
if (resolved.kind === "not_found" &&
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
291
|
+
let resolved = resolveSessionTarget(candidateInfos, trimmed);
|
|
292
|
+
if (resolved.kind === "not_found" && returnPathReachable !== undefined && returnPathReachable.length > 0) {
|
|
293
|
+
const returnPathInfos: SessionInfo[] = [];
|
|
294
|
+
const returnPathIds = new Set<string>();
|
|
295
|
+
for (const session of returnPathReachable) {
|
|
296
|
+
if (
|
|
297
|
+
!isAgentRecipient(session.info) ||
|
|
298
|
+
candidateIds.has(session.info.id) ||
|
|
299
|
+
returnPathIds.has(session.info.id)
|
|
300
|
+
) {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
returnPathInfos.push(session.info);
|
|
304
|
+
returnPathIds.add(session.info.id);
|
|
305
|
+
}
|
|
306
|
+
if (returnPathInfos.length > 0) {
|
|
307
|
+
const returnPathRes = resolveSessionTarget(returnPathInfos, trimmed);
|
|
308
|
+
if (returnPathRes.kind !== "not_found") resolved = returnPathRes;
|
|
266
309
|
}
|
|
267
310
|
}
|
|
268
311
|
if (resolved.kind === "not_found") {
|
|
269
312
|
resolved = resolveSessionTargetByHostSessionId(
|
|
270
|
-
|
|
313
|
+
candidateInfos,
|
|
271
314
|
trimmed,
|
|
272
315
|
(info) => sessions.get(info.id)?.registrationReturnAddress,
|
|
273
316
|
);
|
|
@@ -275,6 +318,8 @@ export function shouldHoldSendForEndedQueueRestore(
|
|
|
275
318
|
if (resolved.kind === "resolved") {
|
|
276
319
|
const live = sessions.get(resolved.session.id);
|
|
277
320
|
if (live !== undefined) return holdResolved(live);
|
|
321
|
+
} else if (resolved.kind !== "not_found") {
|
|
322
|
+
return false;
|
|
278
323
|
}
|
|
279
324
|
}
|
|
280
325
|
|
|
@@ -397,17 +442,18 @@ export class DurableEndedQueue {
|
|
|
397
442
|
}
|
|
398
443
|
this.journalBudget(store);
|
|
399
444
|
this.restoreState = { phase: "identifying_targets", deferred: this.restoreState.deferred };
|
|
400
|
-
// One bound covers both `store.targets()` and `store.load()`: past
|
|
445
|
+
// One bound covers both `store.targets()` and `store.load()`: past loadWaitMs, fall back to
|
|
401
446
|
// ready and release every held send so a slow or hung store never causes client send timeouts.
|
|
447
|
+
const loadWaitMs = endedQueueLoadWaitMs();
|
|
402
448
|
const restoreTimer = setTimeout(() => {
|
|
403
449
|
if (this.restoreTimer === restoreTimer) this.restoreTimer = undefined;
|
|
404
450
|
if (this.restoreState.phase === "identifying_targets" || this.restoreState.phase === "loading") {
|
|
405
451
|
this.host.log(
|
|
406
|
-
`Intercom broker stopped holding sends for subagents that ended after ${
|
|
452
|
+
`Intercom broker stopped holding sends for subagents that ended after ${loadWaitMs} ms while reading their store`,
|
|
407
453
|
);
|
|
408
454
|
transitionToReady();
|
|
409
455
|
}
|
|
410
|
-
},
|
|
456
|
+
}, loadWaitMs);
|
|
411
457
|
restoreTimer.unref();
|
|
412
458
|
this.restoreTimer = restoreTimer;
|
|
413
459
|
resolveDecided();
|
|
@@ -479,7 +525,7 @@ export class DurableEndedQueue {
|
|
|
479
525
|
if (this.restoreState.phase === "ready" || this.loading === undefined) return Promise.resolve();
|
|
480
526
|
return Promise.race([
|
|
481
527
|
this.loading,
|
|
482
|
-
new Promise<void>((resolve) => setTimeout(resolve,
|
|
528
|
+
new Promise<void>((resolve) => setTimeout(resolve, endedQueueLoadWaitMs()).unref()),
|
|
483
529
|
]);
|
|
484
530
|
}
|
|
485
531
|
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { BROKER_SOCKET_PATH_ENV } from "./paths.js";
|
|
2
|
+
|
|
3
|
+
const STRIPPED_HOST_COMMAND_ENV_KEYS = new Set(["psmodulepath", BROKER_SOCKET_PATH_ENV.toLowerCase()]);
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* The environment for a host command. Windows PowerShell started from a PowerShell 7 parent inherits PowerShell 7's
|
|
3
7
|
* `PSModulePath`, finds PowerShell 7's copies of its built-in modules first and fails to load them, so `Get-Process`
|
|
4
8
|
* and `Get-CimInstance` fail. Without the variable Windows PowerShell uses its own module path; the other host commands
|
|
5
|
-
* do not read it.
|
|
9
|
+
* do not read it. Also strips {@link BROKER_SOCKET_PATH_ENV} so broker-spawned host commands never inherit the
|
|
10
|
+
* spawner's pipe-name handoff variable.
|
|
6
11
|
*/
|
|
7
12
|
export function hostCommandEnvironment(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
|
|
8
13
|
const result: NodeJS.ProcessEnv = {};
|
|
9
14
|
for (const [key, value] of Object.entries(env)) {
|
|
10
|
-
if (key.toLowerCase()
|
|
15
|
+
if (!STRIPPED_HOST_COMMAND_ENV_KEYS.has(key.toLowerCase())) result[key] = value;
|
|
11
16
|
}
|
|
12
17
|
return result;
|
|
13
18
|
}
|