@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
|
@@ -155,6 +155,11 @@ export type LeaseReadResult =
|
|
|
155
155
|
| { readonly status: "missing" }
|
|
156
156
|
| InvalidStateInput;
|
|
157
157
|
|
|
158
|
+
export interface LeaseRenewalRequest {
|
|
159
|
+
readonly lease: Lease;
|
|
160
|
+
readonly subject?: LeaseSubject;
|
|
161
|
+
}
|
|
162
|
+
|
|
158
163
|
/** S1: broker membership and recipient presence leases with fencing tokens. */
|
|
159
164
|
export interface BrokerLeaseStore {
|
|
160
165
|
/**
|
|
@@ -164,6 +169,11 @@ export interface BrokerLeaseStore {
|
|
|
164
169
|
acquire(subject: LeaseSubject, holderId: string, staleAfterMs: number): Promise<LeaseAcquireResult>;
|
|
165
170
|
/** Reset the age, replacing the subject when one is given. A superseded token is `stale`. */
|
|
166
171
|
renew(lease: Lease, subject?: LeaseSubject): Promise<LeaseRenewResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Reset the age of multiple leases in a single shared-store transaction, returning one result per entry in input
|
|
174
|
+
* order. Absent on custom stores that only implement `renew`.
|
|
175
|
+
*/
|
|
176
|
+
renewMany?(requests: readonly LeaseRenewalRequest[]): Promise<LeaseRenewResult[]>;
|
|
167
177
|
/** Give the lease up; the next acquisition still gets a greater token. A non-holder's release is `stale`. */
|
|
168
178
|
release(lease: Lease): Promise<LeaseReleaseResult>;
|
|
169
179
|
/** Current holder of the key at any age; `missing` when unheld. */
|
|
@@ -10,6 +10,15 @@ import { basename, dirname, join, resolve } from "path";
|
|
|
10
10
|
*/
|
|
11
11
|
export const BROKER_STORAGE_ENV = "ATOMIC_STORAGE";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Windows: exact named pipe derived by the launching process from its raw `ATOMIC_CODING_AGENT_DIR` /
|
|
15
|
+
* `PI_CODING_AGENT_DIR` before absolutizing the path for the detached broker (which runs in a safe cwd outside
|
|
16
|
+
* the installation directory). Lets the broker bind the exact byte-identical legacy pipe name that the parent and
|
|
17
|
+
* earlier-release sessions connect to while resolving its own files (`broker.pid`, `broker.log`, stores) against the
|
|
18
|
+
* absolutized agent directory.
|
|
19
|
+
*/
|
|
20
|
+
export const BROKER_SOCKET_PATH_ENV = "ATOMIC_INTERCOM_BROKER_SOCKET_PATH";
|
|
21
|
+
|
|
13
22
|
function getHomeDir(): string {
|
|
14
23
|
if (process.platform === "win32") {
|
|
15
24
|
if (process.env.USERPROFILE) return process.env.USERPROFILE;
|
|
@@ -28,15 +37,28 @@ function expandTildePath(path: string): string {
|
|
|
28
37
|
return path;
|
|
29
38
|
}
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
40
|
+
function envValue(env: NodeJS.ProcessEnv, canonicalKey: string): string | undefined {
|
|
41
|
+
if (process.platform !== "win32") return env[canonicalKey];
|
|
42
|
+
const upper = canonicalKey.toUpperCase();
|
|
43
|
+
const keys = Object.keys(env).filter((key) => key.toUpperCase() === upper);
|
|
44
|
+
const lastKey = keys.at(-1);
|
|
45
|
+
return lastKey === undefined ? env[canonicalKey] : env[lastKey];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The agent directory selected by `env`, keeping its exact raw spelling for pipe-name compatibility across versions. */
|
|
49
|
+
export function getAgentDirFromEnv(env: NodeJS.ProcessEnv = process.env): string {
|
|
50
|
+
const atomicAgentDir = envValue(env, "ATOMIC_CODING_AGENT_DIR");
|
|
34
51
|
if (atomicAgentDir) return expandTildePath(atomicAgentDir);
|
|
35
|
-
const piAgentDir =
|
|
52
|
+
const piAgentDir = envValue(env, "PI_CODING_AGENT_DIR");
|
|
36
53
|
if (piAgentDir) return expandTildePath(piAgentDir);
|
|
37
54
|
return join(getHomeDir(), ".atomic", "agent");
|
|
38
55
|
}
|
|
39
56
|
|
|
57
|
+
/** The agent directory the environment selects now. */
|
|
58
|
+
export function getAgentDir(): string {
|
|
59
|
+
return getAgentDirFromEnv(process.env);
|
|
60
|
+
}
|
|
61
|
+
|
|
40
62
|
function sanitizePipeSegment(value: string): string {
|
|
41
63
|
return value
|
|
42
64
|
.replace(/[^a-zA-Z0-9]+/g, "-")
|
|
@@ -112,6 +134,46 @@ export function maxUnixSocketPathBytes(platform: NodeJS.Platform): number {
|
|
|
112
134
|
|
|
113
135
|
/** A Windows pipe name is at most 256 characters. */
|
|
114
136
|
const MAX_PIPE_NAME_LENGTH = 256;
|
|
137
|
+
const WINDOWS_PIPE_PREFIX = "\\\\.\\pipe\\pi-intercom-";
|
|
138
|
+
|
|
139
|
+
function isValidWindowsPipeSuffix(suffix: string): boolean {
|
|
140
|
+
if (suffix.length === 0) return false;
|
|
141
|
+
for (let i = 0; i < suffix.length; i += 1) {
|
|
142
|
+
const code = suffix.charCodeAt(i);
|
|
143
|
+
const isLower = code >= 97 && code <= 122;
|
|
144
|
+
const isDigit = code >= 48 && code <= 57;
|
|
145
|
+
const isHyphen = code === 45;
|
|
146
|
+
if (!isLower && !isDigit && !isHyphen) return false;
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Validated Windows named-pipe override passed by the spawner via {@link BROKER_SOCKET_PATH_ENV} when the caller's
|
|
153
|
+
* raw `ATOMIC_CODING_AGENT_DIR`/`PI_CODING_AGENT_DIR` was relative or drive-relative rooted. Returns `undefined` off
|
|
154
|
+
* Windows, when unset, or when malformed.
|
|
155
|
+
*/
|
|
156
|
+
export function brokerSocketPathOverride(env: NodeJS.ProcessEnv = process.env): string | undefined {
|
|
157
|
+
if (process.platform !== "win32") return undefined;
|
|
158
|
+
const raw = envValue(env, BROKER_SOCKET_PATH_ENV);
|
|
159
|
+
if (raw === undefined || raw.length > MAX_PIPE_NAME_LENGTH || !raw.startsWith(WINDOWS_PIPE_PREFIX)) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
return isValidWindowsPipeSuffix(raw.slice(WINDOWS_PIPE_PREFIX.length)) ? raw : undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Reads the validated {@link BROKER_SOCKET_PATH_ENV} override and removes every case-insensitive copy of it from `env`
|
|
167
|
+
* so child processes spawned by the broker (such as host commands) never inherit it.
|
|
168
|
+
*/
|
|
169
|
+
export function consumeBrokerSocketPathOverride(env: NodeJS.ProcessEnv = process.env): string | undefined {
|
|
170
|
+
const override = brokerSocketPathOverride(env);
|
|
171
|
+
const target = BROKER_SOCKET_PATH_ENV.toLowerCase();
|
|
172
|
+
for (const key of Object.keys(env)) {
|
|
173
|
+
if (key.toLowerCase() === target) delete env[key];
|
|
174
|
+
}
|
|
175
|
+
return override;
|
|
176
|
+
}
|
|
115
177
|
|
|
116
178
|
/** Every spelling of one agent directory, such as a trailing separator or a `..` segment, gets the same digest. */
|
|
117
179
|
function agentDirDigest(agentDir: string): string {
|
|
@@ -198,8 +260,8 @@ export function directBrokerSocketPath(
|
|
|
198
260
|
agentDir: string = getAgentDir(),
|
|
199
261
|
): string | undefined {
|
|
200
262
|
if (platform === "win32") {
|
|
201
|
-
const pipe =
|
|
202
|
-
return pipe.length <= MAX_PIPE_NAME_LENGTH ? pipe :
|
|
263
|
+
const pipe = `${WINDOWS_PIPE_PREFIX}${sanitizePipeSegment(agentDir)}`;
|
|
264
|
+
return pipe.length <= MAX_PIPE_NAME_LENGTH ? pipe : `${WINDOWS_PIPE_PREFIX}${agentDirDigest(agentDir)}`;
|
|
203
265
|
}
|
|
204
266
|
const socketPath = inDirectorySocketPath(agentDir);
|
|
205
267
|
return fitsUnixSocketPath(socketPath, platform) ? socketPath : undefined;
|
|
@@ -35,6 +35,7 @@ interface OwnedPendingSend extends PendingSendAttempt {
|
|
|
35
35
|
resolve(result: SendResultLike): void;
|
|
36
36
|
reject(error: Error): void;
|
|
37
37
|
timer?: ReturnType<typeof setTimeout>;
|
|
38
|
+
expiresAt?: number;
|
|
38
39
|
timedOut?: boolean;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -112,6 +113,7 @@ export class PendingSendRegistry {
|
|
|
112
113
|
legacyEligible: generation === 1,
|
|
113
114
|
generation,
|
|
114
115
|
};
|
|
116
|
+
attempt.expiresAt = performance.now() + timeoutMs;
|
|
115
117
|
attempt.timer = setTimeout(() => {
|
|
116
118
|
this.expire(attempt);
|
|
117
119
|
}, timeoutMs);
|
|
@@ -136,6 +138,9 @@ export class PendingSendRegistry {
|
|
|
136
138
|
extend(messageId: string, attemptId: string | undefined, timeoutMs: number): boolean {
|
|
137
139
|
const attempt = this.attempts.get(messageId);
|
|
138
140
|
if (!attempt || attempt.timedOut || (attemptId === undefined ? !attempt.legacyEligible : attempt.attemptId !== attemptId)) return false;
|
|
141
|
+
const nextExpiresAt = performance.now() + timeoutMs;
|
|
142
|
+
if (attempt.expiresAt !== undefined && nextExpiresAt <= attempt.expiresAt) return true;
|
|
143
|
+
attempt.expiresAt = nextExpiresAt;
|
|
139
144
|
if (attempt.timer) clearTimeout(attempt.timer);
|
|
140
145
|
attempt.timer = setTimeout(() => {
|
|
141
146
|
this.expire(attempt);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol bounds for Intercom multi-node registration shared between broker and client.
|
|
3
|
+
* Zero-dependency module so client startup never pulls broker-only or storage modules.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The longest a registration waits for its presence lease (and known-session record) to be written to shared storage
|
|
8
|
+
* before answering the client; the write still finishes in the background if the store is slow.
|
|
9
|
+
*/
|
|
10
|
+
export const PRESENCE_REGISTRATION_BOUND_MS = 5_000;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The longest a registration that asks for its id back waits for the shared database to bind it, before the presence
|
|
14
|
+
* wait: both together stay within {@link BROKER_CONNECT_TIMEOUT_MS}. Past it the session gets a fresh id (or keeps the
|
|
15
|
+
* id if its binding write confirms it), never an unchecked one.
|
|
16
|
+
*/
|
|
17
|
+
export const SESSION_ID_CLAIM_BOUND_MS = 2_500;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The longest a claim waits in all once it found the id owned by a broker of this host that has exited: each step that
|
|
21
|
+
* gives that broker's ids up and binds the id again has {@link SESSION_ID_CLAIM_BOUND_MS} of its own, up to this. The
|
|
22
|
+
* registration's presence wait is shortened by the extra time (`presenceBoundAfterClaim`), so both together stay within
|
|
23
|
+
* {@link BROKER_CONNECT_TIMEOUT_MS}.
|
|
24
|
+
*/
|
|
25
|
+
export const SESSION_ID_CLAIM_PROGRESS_CAP_MS = 2 * SESSION_ID_CLAIM_BOUND_MS;
|
|
26
|
+
|
|
27
|
+
/** Headroom past the combined claim and presence registration bounds for IPC, accept queueing, and store I/O. */
|
|
28
|
+
export const REGISTRATION_CONNECT_HEADROOM_MS = 2_500;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* How long `connect()` waits for the broker to answer `register`: derived from the combined id-claim and presence
|
|
32
|
+
* registration bounds plus IPC/store headroom (2,500 + 5,000 + 2,500 = 10,000 ms).
|
|
33
|
+
*/
|
|
34
|
+
export const BROKER_CONNECT_TIMEOUT_MS =
|
|
35
|
+
SESSION_ID_CLAIM_BOUND_MS + PRESENCE_REGISTRATION_BOUND_MS + REGISTRATION_CONNECT_HEADROOM_MS;
|
|
36
|
+
|
|
37
|
+
/** Maximum IPC margin reserved below the client's remaining registration deadline when bounding broker-side waits. */
|
|
38
|
+
export const REGISTRATION_IPC_MARGIN_MS = 500;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { nativeProcessCreationTime, readProcessStartToken, wroteFileAt } from "./broker-process.js";
|
|
3
|
+
import { isProcessAlive } from "./broker-stop.js";
|
|
4
|
+
import { getBrokerPidPath, getBrokerSpawnLockPath } from "./paths.js";
|
|
5
|
+
import { isSocketAnswering } from "./socket-liveness.js";
|
|
6
|
+
import { completeLines, writerStateAsync } from "./stale-lock-file.js";
|
|
7
|
+
import { processCreationTimeOf, recognisedProcessStart } from "./start-announcement.js";
|
|
8
|
+
|
|
9
|
+
/** Matches `BROKER_SPAWN_LOCK_MAX_AGE_MS` in `spawn.ts` without pulling the spawner into routing/client checks. */
|
|
10
|
+
const SPAWN_LOCK_MAX_AGE_MS = 60_000;
|
|
11
|
+
|
|
12
|
+
/** Windows file times count 100 ns intervals from 1601-01-01 UTC; Node stat times count from 1970-01-01 UTC. */
|
|
13
|
+
const WINDOWS_EPOCH_OFFSET_TICKS = 116_444_736_000_000_000n;
|
|
14
|
+
|
|
15
|
+
export type BrokerPidStat =
|
|
16
|
+
| { readonly kind: "missing" }
|
|
17
|
+
| { readonly kind: "present"; readonly ino: bigint; readonly mtimeNs: bigint; readonly size: bigint }
|
|
18
|
+
| { readonly kind: "unreadable"; readonly code: string };
|
|
19
|
+
|
|
20
|
+
function parsePositivePid(value: string): number | undefined {
|
|
21
|
+
const trimmed = value.trim();
|
|
22
|
+
const pid = Number.parseInt(trimmed, 10);
|
|
23
|
+
return Number.isSafeInteger(pid) && pid > 0 && String(pid) === trimmed ? pid : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function parseLeadingPositivePid(line: string): number | undefined {
|
|
27
|
+
const space = line.indexOf(" ");
|
|
28
|
+
return parsePositivePid(space === -1 ? line : line.slice(0, space));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function windowsCreationNs(created: string): bigint {
|
|
32
|
+
return (BigInt(created) - WINDOWS_EPOCH_OFFSET_TICKS) * 100n;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Lightweight single-`stat` snapshot of `broker.pid` taken before a broker request (`broker_status` or
|
|
37
|
+
* `register_verified`), so the happy path pays at most one async `stat` and `readFile` runs only if the
|
|
38
|
+
* connection closes unanswered. Returns `undefined` when `agentDir` is `undefined` (for an explicit socket
|
|
39
|
+
* path unrelated to the ambient agent directory).
|
|
40
|
+
*/
|
|
41
|
+
export async function snapshotBrokerPidBeforeRequest(
|
|
42
|
+
agentDir: string | undefined,
|
|
43
|
+
): Promise<BrokerPidStat | undefined> {
|
|
44
|
+
if (agentDir === undefined) return undefined;
|
|
45
|
+
return statBrokerPidAsync(getBrokerPidPath(agentDir));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function statBrokerPidAsync(pidPath: string): Promise<BrokerPidStat> {
|
|
49
|
+
try {
|
|
50
|
+
const info = await stat(pidPath, { bigint: true });
|
|
51
|
+
return { kind: "present", ino: info.ino, mtimeNs: info.mtimeNs, size: info.size };
|
|
52
|
+
} catch (error) {
|
|
53
|
+
const code = (error as NodeJS.ErrnoException).code ?? "UNKNOWN";
|
|
54
|
+
if (code === "ENOENT" || code === "ENOTDIR") return { kind: "missing" };
|
|
55
|
+
return { kind: "unreadable", code };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function sameBrokerPidStat(before: BrokerPidStat, after: BrokerPidStat): boolean {
|
|
60
|
+
if (before.kind === "missing" && after.kind === "missing") return true;
|
|
61
|
+
if (before.kind === "unreadable" && after.kind === "unreadable") return before.code === after.code;
|
|
62
|
+
if (before.kind === "present" && after.kind === "present") {
|
|
63
|
+
return before.ino === after.ino && before.mtimeNs === after.mtimeNs && before.size === after.size;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type BrokerPidCheck =
|
|
69
|
+
| { readonly status: "dead" }
|
|
70
|
+
| { readonly status: "alive"; readonly pid: number }
|
|
71
|
+
| { readonly status: "unknown" };
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Read `broker.pid` after an unanswered close to see whether it names a process known to be gone (dead PID,
|
|
75
|
+
* unlinked mid-read, or on Windows a PID recycled to a later process after `broker.pid` was written).
|
|
76
|
+
* Permanently missing, empty, non-positive, corrupt, or unreadable pid files yield `"unknown"` rather than
|
|
77
|
+
* `"dead"` so they never trigger a retiring retry loop against a live broker.
|
|
78
|
+
*/
|
|
79
|
+
async function inspectBrokerPidAsync(agentDir: string, statAfter: BrokerPidStat): Promise<BrokerPidCheck> {
|
|
80
|
+
if (statAfter.kind !== "present") return { status: "unknown" };
|
|
81
|
+
let raw: string;
|
|
82
|
+
try {
|
|
83
|
+
raw = await readFile(getBrokerPidPath(agentDir), "utf8");
|
|
84
|
+
} catch (error) {
|
|
85
|
+
const code = (error as NodeJS.ErrnoException).code;
|
|
86
|
+
return code === "ENOENT" || code === "ENOTDIR" ? { status: "dead" } : { status: "unknown" };
|
|
87
|
+
}
|
|
88
|
+
const pid = parsePositivePid(raw);
|
|
89
|
+
if (pid === undefined) return { status: "unknown" };
|
|
90
|
+
if (!isProcessAlive(pid)) return { status: "dead" };
|
|
91
|
+
if (process.platform === "win32") {
|
|
92
|
+
const created = recognisedProcessStart(nativeProcessCreationTime(pid));
|
|
93
|
+
if (created !== undefined && wroteFileAt(windowsCreationNs(created), statAfter.mtimeNs) === "no") {
|
|
94
|
+
return { status: "dead" };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { status: "alive", pid };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Matches `spawn.ts:lockProcessStartAsync` across Linux, Windows, and macOS without starting a subprocess. */
|
|
101
|
+
async function lockProcessStartAsync(pid: number): Promise<string | undefined> {
|
|
102
|
+
if (process.platform === "linux") return readProcessStartToken(pid);
|
|
103
|
+
if (process.platform === "win32") return nativeProcessCreationTime(pid);
|
|
104
|
+
if (process.platform === "darwin") return processCreationTimeOf(pid);
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async function isSpawnLockLiveAsync(
|
|
109
|
+
agentDir: string,
|
|
110
|
+
runningBrokerPid: number | undefined,
|
|
111
|
+
nowMs: number = Date.now(),
|
|
112
|
+
): Promise<boolean> {
|
|
113
|
+
const lockPath = getBrokerSpawnLockPath(agentDir);
|
|
114
|
+
let written: string;
|
|
115
|
+
try {
|
|
116
|
+
written = await readFile(lockPath, "utf8");
|
|
117
|
+
} catch (error) {
|
|
118
|
+
const code = (error as NodeJS.ErrnoException).code;
|
|
119
|
+
// Transient Windows sharing violation while a spawner is writing or renaming the lock.
|
|
120
|
+
// Permanent errors (ENOENT, EACCES, EPERM, EISDIR) are not live locks.
|
|
121
|
+
return code === "EBUSY";
|
|
122
|
+
}
|
|
123
|
+
const content = completeLines(written) ?? "";
|
|
124
|
+
const [spawnerLine = "", createdAtLine = "", brokerLine = ""] = content.split("\n");
|
|
125
|
+
const spawnerPid = parseLeadingPositivePid(spawnerLine);
|
|
126
|
+
const createdAt = Number.parseInt(createdAtLine, 10);
|
|
127
|
+
if (spawnerPid === undefined || !Number.isFinite(createdAt)) {
|
|
128
|
+
return (await writerStateAsync(lockPath, written)) === "held";
|
|
129
|
+
}
|
|
130
|
+
if (nowMs - createdAt > SPAWN_LOCK_MAX_AGE_MS) return false;
|
|
131
|
+
const brokerPid = parseLeadingPositivePid(brokerLine);
|
|
132
|
+
// A 3-line lock handed off after a slow start to the same live broker that is already answering
|
|
133
|
+
// does not indicate a replacement in progress.
|
|
134
|
+
if (brokerPid !== undefined && runningBrokerPid !== undefined && brokerPid === runningBrokerPid) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const line = brokerPid !== undefined ? brokerLine : spawnerLine;
|
|
138
|
+
const pid = brokerPid ?? spawnerPid;
|
|
139
|
+
if (!isProcessAlive(pid)) return false;
|
|
140
|
+
const space = line.indexOf(" ");
|
|
141
|
+
if (space === -1) return true;
|
|
142
|
+
const recorded = recognisedProcessStart(line.slice(space + 1));
|
|
143
|
+
if (recorded === undefined || recorded === "") return true;
|
|
144
|
+
const current = await lockProcessStartAsync(pid);
|
|
145
|
+
return current === undefined || current === recorded;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Shared retiring-broker classifier for connections that closed unanswered (`broker_status` in
|
|
150
|
+
* `broker-routing.ts` / `control.ts` and `register` / `register_verified` in `client.ts`).
|
|
151
|
+
*
|
|
152
|
+
* Returns `true` when the broker retired, crashed, or was replaced while the request was in flight:
|
|
153
|
+
* - nothing answers on `socketPath` anymore, or (when tied to an agent directory):
|
|
154
|
+
* - `broker.pid` changed, was unlinked, or was created across the request,
|
|
155
|
+
* - `broker.pid` names a process known to be gone (exited, or recycled on Windows), or
|
|
156
|
+
* - a live (non-stale) `broker.spawn.lock` is held for a transition in progress.
|
|
157
|
+
*
|
|
158
|
+
* Returns `false` for an answering, unchanged live broker (including explicit custom sockets with
|
|
159
|
+
* `agentDir === undefined` that still answer), so genuinely unsupported or refusing brokers are never
|
|
160
|
+
* mistaken for retiring ones.
|
|
161
|
+
*/
|
|
162
|
+
export async function isUnansweredCloseFromRetiringBroker(
|
|
163
|
+
socketPath: string,
|
|
164
|
+
agentDir: string | undefined,
|
|
165
|
+
statBefore: BrokerPidStat | undefined,
|
|
166
|
+
): Promise<boolean> {
|
|
167
|
+
if (agentDir === undefined || statBefore === undefined) {
|
|
168
|
+
return !(await isSocketAnswering(socketPath));
|
|
169
|
+
}
|
|
170
|
+
const [answering, statAfter] = await Promise.all([
|
|
171
|
+
isSocketAnswering(socketPath),
|
|
172
|
+
statBrokerPidAsync(getBrokerPidPath(agentDir)),
|
|
173
|
+
]);
|
|
174
|
+
if (!answering || !sameBrokerPidStat(statBefore, statAfter)) return true;
|
|
175
|
+
const pidCheck = await inspectBrokerPidAsync(agentDir, statAfter);
|
|
176
|
+
if (pidCheck.status === "dead") return true;
|
|
177
|
+
return isSpawnLockLiveAsync(agentDir, pidCheck.status === "alive" ? pidCheck.pid : undefined);
|
|
178
|
+
}
|