@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
|
@@ -111,7 +111,15 @@ function withNativeErrorCode(error) {
|
|
|
111
111
|
return mapped === undefined ? error : Object.assign(error, { code: mapped, errno: number });
|
|
112
112
|
}
|
|
113
113
|
function fileStat(stats) {
|
|
114
|
-
return {
|
|
114
|
+
return {
|
|
115
|
+
dev: stats.dev,
|
|
116
|
+
ino: stats.ino,
|
|
117
|
+
size: stats.size,
|
|
118
|
+
mtimeNs: stats.mtimeNs,
|
|
119
|
+
ctimeNs: stats.ctimeNs,
|
|
120
|
+
birthtimeNs: stats.birthtimeNs,
|
|
121
|
+
symbolicLink: stats.isSymbolicLink(),
|
|
122
|
+
};
|
|
115
123
|
}
|
|
116
124
|
function isMissingEntry(error) {
|
|
117
125
|
return error.code === "ENOENT";
|
|
@@ -298,17 +306,32 @@ export async function fileIdentityAsync(path) {
|
|
|
298
306
|
return undefined;
|
|
299
307
|
}
|
|
300
308
|
}
|
|
301
|
-
function
|
|
309
|
+
function decisionStampOf(stat) {
|
|
310
|
+
if (stat === undefined || stat.ino === 0n || (stat.mtimeNs === 0n && stat.ctimeNs === 0n))
|
|
311
|
+
return undefined;
|
|
312
|
+
return { dev: stat.dev, ino: stat.ino, size: stat.size, mtimeNs: stat.mtimeNs, ctimeNs: stat.ctimeNs };
|
|
313
|
+
}
|
|
314
|
+
function sameDecisionStamp(left, right) {
|
|
315
|
+
return (left.dev === right.dev &&
|
|
316
|
+
left.ino === right.ino &&
|
|
317
|
+
left.size === right.size &&
|
|
318
|
+
left.mtimeNs === right.mtimeNs &&
|
|
319
|
+
left.ctimeNs === right.ctimeNs);
|
|
320
|
+
}
|
|
321
|
+
function* fileIdentityWithStatSteps(path) {
|
|
302
322
|
try {
|
|
303
|
-
const
|
|
304
|
-
if (ino !== 0n)
|
|
305
|
-
return `${dev}:${ino}
|
|
306
|
-
return realPathIdentity(yield* io("realpath", path));
|
|
323
|
+
const stat = yield* io("stat", path);
|
|
324
|
+
if (stat.ino !== 0n)
|
|
325
|
+
return { identity: `${stat.dev}:${stat.ino}`, stat };
|
|
326
|
+
return { identity: realPathIdentity(yield* io("realpath", path)) };
|
|
307
327
|
}
|
|
308
328
|
catch {
|
|
309
329
|
return undefined;
|
|
310
330
|
}
|
|
311
331
|
}
|
|
332
|
+
function* fileIdentitySteps(path) {
|
|
333
|
+
return (yield* fileIdentityWithStatSteps(path))?.identity;
|
|
334
|
+
}
|
|
312
335
|
function realPathIdentity(real) {
|
|
313
336
|
return `path:${process.platform === "win32" || process.platform === "darwin" ? real.toLowerCase() : real}`;
|
|
314
337
|
}
|
|
@@ -378,7 +401,7 @@ function getPathComparisonKey(path) {
|
|
|
378
401
|
function pathsEqual(left, right) {
|
|
379
402
|
return getPathComparisonKey(left) === getPathComparisonKey(right);
|
|
380
403
|
}
|
|
381
|
-
function createStorageHomeEntry(home, adoptedClaim, provisionalWithoutSettings) {
|
|
404
|
+
function createStorageHomeEntry(home, adoptedClaim, provisionalWithoutSettings, decisionId, canonicalAgentPath) {
|
|
382
405
|
const workflowsDir = join(home, "workflows");
|
|
383
406
|
return {
|
|
384
407
|
home,
|
|
@@ -386,11 +409,16 @@ function createStorageHomeEntry(home, adoptedClaim, provisionalWithoutSettings)
|
|
|
386
409
|
sessionDatabasePath: join(workflowsDir, "journal.sqlite"),
|
|
387
410
|
sharedStoragePath: join(home, "storage.sqlite"),
|
|
388
411
|
...(adoptedClaim === undefined ? {} : { adoptedClaim }),
|
|
412
|
+
...(decisionId === undefined ? {} : { decisionId }),
|
|
413
|
+
...(canonicalAgentPath === undefined ? {} : { canonicalAgentPath }),
|
|
389
414
|
...(provisionalWithoutSettings ? { provisionalWithoutSettings: true } : {}),
|
|
390
415
|
};
|
|
391
416
|
}
|
|
392
|
-
function createDefaultStorageHomeEntry(home, provisionalWithoutSettings) {
|
|
393
|
-
return {
|
|
417
|
+
function createDefaultStorageHomeEntry(home, provisionalWithoutSettings, decisionId, canonicalAgentPath) {
|
|
418
|
+
return {
|
|
419
|
+
...createStorageHomeEntry(home, undefined, provisionalWithoutSettings, decisionId, canonicalAgentPath),
|
|
420
|
+
defaultHome: true,
|
|
421
|
+
};
|
|
394
422
|
}
|
|
395
423
|
export function readClaimFile(file) {
|
|
396
424
|
return runStorageStepsSync(readClaimFileSteps(file));
|
|
@@ -823,6 +851,7 @@ function recordSettledStorageHome(fastKey, cacheKey, settled) {
|
|
|
823
851
|
fastStorageHomes.set(fastKey.rawAgentDir, { ...fastKey, entry: settled });
|
|
824
852
|
return settled;
|
|
825
853
|
}
|
|
854
|
+
const decisionCanonicalPaths = new WeakMap();
|
|
826
855
|
let storageTargetDecisions = new WeakMap();
|
|
827
856
|
let defaultTargetClaims = new WeakMap();
|
|
828
857
|
function* canonicalPathSteps(path) {
|
|
@@ -905,17 +934,30 @@ function* readStorageHomeDecisionSteps(file) {
|
|
|
905
934
|
...(decision.parentOwner === undefined ? {} : { parentOwner: resolve(agentPath, decision.parentOwner) }),
|
|
906
935
|
};
|
|
907
936
|
}
|
|
908
|
-
|
|
937
|
+
const isHomeDecision = basename(file) === HOME_DECISION_FILE;
|
|
938
|
+
if (decision.parentOwner === undefined) {
|
|
939
|
+
if (isHomeDecision)
|
|
940
|
+
decisionCanonicalPaths.set(decision, agentPath);
|
|
909
941
|
return decision;
|
|
910
|
-
|
|
942
|
+
}
|
|
943
|
+
if (isHomeDecision) {
|
|
911
944
|
const owner = yield* readStorageOwnerSteps(join(parent, PARENT_CLAIM_FILE));
|
|
912
945
|
if (owner !== undefined) {
|
|
913
|
-
const
|
|
946
|
+
const context = {
|
|
947
|
+
path: dirname(file),
|
|
948
|
+
canonicalPath: agentPath,
|
|
949
|
+
decisionId: decision.id,
|
|
950
|
+
fresh: true,
|
|
951
|
+
};
|
|
952
|
+
const currentOwner = yield* currentStorageOwnerPathSteps(owner, parent, undefined, context);
|
|
914
953
|
if (pathsEqual(decision.parentOwner, owner.path) ||
|
|
915
954
|
(currentOwner !== undefined && (yield* sameDirectorySteps(decision.parentOwner, currentOwner)))) {
|
|
916
|
-
|
|
955
|
+
const resolvedDecision = { ...decision, home: parent, parentOwner: currentOwner ?? owner.path };
|
|
956
|
+
decisionCanonicalPaths.set(resolvedDecision, agentPath);
|
|
957
|
+
return resolvedDecision;
|
|
917
958
|
}
|
|
918
959
|
}
|
|
960
|
+
decisionCanonicalPaths.set(decision, agentPath);
|
|
919
961
|
}
|
|
920
962
|
else {
|
|
921
963
|
const homeFile = storageHomeDecisionFile(dirname(file));
|
|
@@ -994,6 +1036,7 @@ function* storageDecisionMetadataSteps(path) {
|
|
|
994
1036
|
if (decision === null ||
|
|
995
1037
|
typeof decision !== "object" ||
|
|
996
1038
|
(decision.id !== undefined && typeof decision.id !== "string") ||
|
|
1039
|
+
(decision.parentOwner !== undefined && typeof decision.parentOwner !== "string") ||
|
|
997
1040
|
(decision.targets !== undefined &&
|
|
998
1041
|
(!Array.isArray(decision.targets) || decision.targets.some((target) => typeof target !== "string"))))
|
|
999
1042
|
return undefined;
|
|
@@ -1048,66 +1091,65 @@ function* readStorageOwnerSteps(file) {
|
|
|
1048
1091
|
}
|
|
1049
1092
|
return owner;
|
|
1050
1093
|
}
|
|
1051
|
-
function*
|
|
1052
|
-
const path = owner.relativePath === undefined ? owner.path : resolve(claimDirectory, owner.relativePath);
|
|
1053
|
-
if (owner.identity === undefined ||
|
|
1054
|
-
(yield* fileIdentitySteps(owner.homeIdentity ? storageHomeDecisionFile(path) : path)) === owner.identity)
|
|
1055
|
-
return path;
|
|
1094
|
+
function* scanStorageOwnerCandidatesSteps(owner, claimDirectory, claimedTarget, recordedPath, excludedExactCandidate) {
|
|
1056
1095
|
const exact = [];
|
|
1057
1096
|
const recorded = [];
|
|
1058
1097
|
const fallback = [];
|
|
1059
1098
|
function* consider(candidate) {
|
|
1060
1099
|
if (!(yield* io("isDirectory", candidate)))
|
|
1061
1100
|
return;
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
if (identity === owner.identity) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
const metadata = yield* storageDecisionMetadataSteps(candidate);
|
|
1069
|
-
if ((owner.decisionId === undefined || metadata?.id !== owner.decisionId) &&
|
|
1070
|
-
(owner.directoryIdentity === undefined || (yield* fileIdentitySteps(candidate)) !== owner.directoryIdentity))
|
|
1071
|
-
return;
|
|
1072
|
-
const atRecordedPath = yield* sameDirectorySteps(candidate, path);
|
|
1073
|
-
const targets = [
|
|
1074
|
-
...(metadata?.targets ?? []),
|
|
1075
|
-
...(yield* configuredRelativeTargetsSteps(candidate, getHomeDir(), undefined, false)),
|
|
1076
|
-
];
|
|
1077
|
-
const physicalCandidate = yield* canonicalPathSteps(candidate);
|
|
1078
|
-
const ownTargets = [];
|
|
1079
|
-
for (const target of targets) {
|
|
1080
|
-
if (containsPath(physicalCandidate, yield* canonicalPathSteps(resolve(candidate, target))) &&
|
|
1081
|
-
(claimedTarget === undefined ||
|
|
1082
|
-
!pathsEqual(resolve(candidate, target), resolve(candidate, claimedTarget)) ||
|
|
1083
|
-
(yield* io("exists", yield* localTargetMarkerFileSteps(candidate, claimedTarget)))))
|
|
1084
|
-
ownTargets.push(target);
|
|
1101
|
+
const identityInfo = yield* fileIdentityWithStatSteps(owner.homeIdentity ? storageHomeDecisionFile(candidate) : candidate);
|
|
1102
|
+
const isExcludedExact = excludedExactCandidate !== undefined && (yield* sameDirectorySteps(candidate, excludedExactCandidate));
|
|
1103
|
+
if (!isExcludedExact && identityInfo !== undefined && identityInfo.identity === owner.identity) {
|
|
1104
|
+
for (const match of exact) {
|
|
1105
|
+
if (yield* sameDirectorySteps(match.path, candidate))
|
|
1106
|
+
return;
|
|
1085
1107
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1108
|
+
exact.push({ path: candidate, stat: identityInfo.stat });
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
const metadata = yield* storageDecisionMetadataSteps(candidate);
|
|
1112
|
+
if ((owner.decisionId === undefined || metadata?.id !== owner.decisionId) &&
|
|
1113
|
+
(owner.directoryIdentity === undefined || (yield* fileIdentitySteps(candidate)) !== owner.directoryIdentity))
|
|
1114
|
+
return;
|
|
1115
|
+
const atRecordedPath = yield* sameDirectorySteps(candidate, recordedPath);
|
|
1116
|
+
const targets = [
|
|
1117
|
+
...(metadata?.targets ?? []),
|
|
1118
|
+
...(yield* configuredRelativeTargetsSteps(candidate, getHomeDir(), undefined, false)),
|
|
1119
|
+
];
|
|
1120
|
+
const physicalCandidate = yield* canonicalPathSteps(candidate);
|
|
1121
|
+
const ownTargets = [];
|
|
1122
|
+
for (const target of targets) {
|
|
1123
|
+
if (containsPath(physicalCandidate, yield* canonicalPathSteps(resolve(candidate, target))) &&
|
|
1124
|
+
(claimedTarget === undefined ||
|
|
1125
|
+
!pathsEqual(resolve(candidate, target), resolve(candidate, claimedTarget)) ||
|
|
1126
|
+
(yield* io("exists", yield* localTargetMarkerFileSteps(candidate, claimedTarget)))))
|
|
1127
|
+
ownTargets.push(target);
|
|
1128
|
+
}
|
|
1129
|
+
const legacyTargets = owner.legacyTargets;
|
|
1130
|
+
let unownedTargets = ownTargets;
|
|
1131
|
+
if (legacyTargets !== undefined) {
|
|
1132
|
+
unownedTargets = [];
|
|
1133
|
+
for (const target of ownTargets) {
|
|
1134
|
+
if (!legacyTargets.some((legacy) => pathsEqual(resolve(candidate, legacy), resolve(candidate, target))) ||
|
|
1135
|
+
!(yield* hasRelativeTargetEntriesSteps(claimDirectory, candidate, [target], true)))
|
|
1136
|
+
unownedTargets.push(target);
|
|
1095
1137
|
}
|
|
1096
|
-
if ((yield* hasOwnStoreEntriesSteps(candidate, claimDirectory, [])) ||
|
|
1097
|
-
(owner.legacyTargets === undefined && atRecordedPath
|
|
1098
|
-
? yield* hasOwnTargetEntriesSteps(candidate, claimDirectory, ownTargets)
|
|
1099
|
-
: yield* hasRelativeTargetEntriesSteps(candidate, candidate, unownedTargets, true)))
|
|
1100
|
-
return;
|
|
1101
|
-
matches = atRecordedPath ? recorded : fallback;
|
|
1102
1138
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1139
|
+
if ((yield* hasOwnStoreEntriesSteps(candidate, claimDirectory, [])) ||
|
|
1140
|
+
(owner.legacyTargets === undefined && atRecordedPath
|
|
1141
|
+
? yield* hasOwnTargetEntriesSteps(candidate, claimDirectory, ownTargets)
|
|
1142
|
+
: yield* hasRelativeTargetEntriesSteps(candidate, candidate, unownedTargets, true)))
|
|
1143
|
+
return;
|
|
1144
|
+
const bucket = atRecordedPath ? recorded : fallback;
|
|
1145
|
+
for (const match of bucket) {
|
|
1146
|
+
if (yield* sameDirectorySteps(match.path, candidate))
|
|
1105
1147
|
return;
|
|
1106
1148
|
}
|
|
1107
|
-
|
|
1149
|
+
bucket.push({ path: candidate, metadata });
|
|
1108
1150
|
}
|
|
1109
1151
|
try {
|
|
1110
|
-
yield* consider(
|
|
1152
|
+
yield* consider(recordedPath);
|
|
1111
1153
|
for (const entry of yield* io("listDirectory", claimDirectory)) {
|
|
1112
1154
|
yield* consider(join(claimDirectory, entry.name));
|
|
1113
1155
|
}
|
|
@@ -1115,8 +1157,112 @@ function* currentStorageOwnerPathSteps(owner, claimDirectory = dirname(owner.pat
|
|
|
1115
1157
|
catch {
|
|
1116
1158
|
return undefined;
|
|
1117
1159
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1160
|
+
return { exact, recorded, fallback };
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* When a single inode-matched `.atomic-storage-home` candidate carries a conflicting on-disk `decisionId` and does not
|
|
1164
|
+
* still carry the original owner's evidence, check whether demoting it reveals a unique eligible owner with on-disk
|
|
1165
|
+
* `decisionId === owner.decisionId` (e.g. a moved/renamed owner whose deleted decision inode was reused by a sibling).
|
|
1166
|
+
* If no such unique replacement exists, preserve the inode match unchanged.
|
|
1167
|
+
*/
|
|
1168
|
+
function* maybeDisplaceConflictingExactCandidateSteps(owner, claimDirectory, claimedTarget, recordedPath, candidate, candidateStat, context) {
|
|
1169
|
+
if (!owner.homeIdentity ||
|
|
1170
|
+
owner.decisionId === undefined ||
|
|
1171
|
+
owner.identity === undefined ||
|
|
1172
|
+
owner.identity.startsWith("path:")) {
|
|
1173
|
+
return { ownerPath: candidate };
|
|
1174
|
+
}
|
|
1175
|
+
const directPathMatchesCaller = context !== undefined && pathsEqual(candidate, context.path);
|
|
1176
|
+
const cachedCanonicalMatchesCaller = context !== undefined && context.canonicalPath !== undefined && pathsEqual(candidate, context.canonicalPath);
|
|
1177
|
+
const pathMatchesCaller = directPathMatchesCaller || cachedCanonicalMatchesCaller;
|
|
1178
|
+
// Only trust cached canonicalPath as proving isSelf when freshly resolved in this call; a warm cached
|
|
1179
|
+
// symlink may have been repointed to a sibling, so leave isSelf undefined for live sameDirectorySteps verification.
|
|
1180
|
+
let isSelf = directPathMatchesCaller || (context?.fresh && cachedCanonicalMatchesCaller) ? true : undefined;
|
|
1181
|
+
if (!pathMatchesCaller && context?.onlySelf) {
|
|
1182
|
+
isSelf = yield* sameDirectorySteps(candidate, context.path);
|
|
1183
|
+
}
|
|
1184
|
+
if (context?.onlySelf && isSelf === false && context.decisionId !== owner.decisionId) {
|
|
1185
|
+
return { ownerPath: candidate, isSelf: false };
|
|
1186
|
+
}
|
|
1187
|
+
const liveStamp = decisionStampOf(candidateStat);
|
|
1188
|
+
if (context !== undefined && (pathMatchesCaller || isSelf === true)) {
|
|
1189
|
+
if (context.fresh && context.decisionId === owner.decisionId) {
|
|
1190
|
+
if (context.verifiedCache !== undefined && liveStamp !== undefined) {
|
|
1191
|
+
context.verifiedCache.verifiedDecision = { id: context.decisionId, stamp: liveStamp };
|
|
1192
|
+
}
|
|
1193
|
+
return { ownerPath: candidate, isSelf };
|
|
1194
|
+
}
|
|
1195
|
+
const cached = context.verifiedCache?.verifiedDecision;
|
|
1196
|
+
if (cached !== undefined &&
|
|
1197
|
+
cached.id === owner.decisionId &&
|
|
1198
|
+
liveStamp !== undefined &&
|
|
1199
|
+
sameDecisionStamp(cached.stamp, liveStamp)) {
|
|
1200
|
+
return { ownerPath: candidate, isSelf };
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
const candMetadata = yield* storageDecisionMetadataSteps(candidate);
|
|
1204
|
+
if (candMetadata?.id !== undefined &&
|
|
1205
|
+
context?.verifiedCache !== undefined &&
|
|
1206
|
+
liveStamp !== undefined &&
|
|
1207
|
+
(pathMatchesCaller || isSelf === true)) {
|
|
1208
|
+
context.verifiedCache.verifiedDecision = { id: candMetadata.id, stamp: liveStamp };
|
|
1209
|
+
}
|
|
1210
|
+
if (candMetadata?.id === undefined || candMetadata.id === owner.decisionId) {
|
|
1211
|
+
return { ownerPath: candidate, isSelf };
|
|
1212
|
+
}
|
|
1213
|
+
// Legitimate owners whose decision file was replaced in place keep parentOwner (parent claims) or directoryIdentity (target claims).
|
|
1214
|
+
if (claimedTarget === undefined) {
|
|
1215
|
+
if (candMetadata.parentOwner !== undefined)
|
|
1216
|
+
return { ownerPath: candidate, isSelf };
|
|
1217
|
+
}
|
|
1218
|
+
else if (owner.directoryIdentity !== undefined &&
|
|
1219
|
+
(yield* fileIdentitySteps(candidate)) === owner.directoryIdentity) {
|
|
1220
|
+
return { ownerPath: candidate, isSelf };
|
|
1221
|
+
}
|
|
1222
|
+
const demoted = yield* scanStorageOwnerCandidatesSteps(owner, claimDirectory, claimedTarget, recordedPath, candidate);
|
|
1223
|
+
if (demoted === undefined)
|
|
1224
|
+
return { ownerPath: candidate, isSelf };
|
|
1225
|
+
if (demoted.exact.length > 0) {
|
|
1226
|
+
if (demoted.exact.length !== 1)
|
|
1227
|
+
return { ownerPath: candidate, isSelf };
|
|
1228
|
+
const other = demoted.exact[0].path;
|
|
1229
|
+
if (yield* sameDirectorySteps(other, candidate))
|
|
1230
|
+
return { ownerPath: candidate, isSelf };
|
|
1231
|
+
const otherMeta = yield* storageDecisionMetadataSteps(other);
|
|
1232
|
+
return otherMeta?.id === owner.decisionId ? { ownerPath: other } : { ownerPath: candidate, isSelf };
|
|
1233
|
+
}
|
|
1234
|
+
const weakMatches = demoted.recorded.length > 0 ? demoted.recorded : demoted.fallback;
|
|
1235
|
+
if (weakMatches.length !== 1)
|
|
1236
|
+
return { ownerPath: candidate, isSelf };
|
|
1237
|
+
const replacement = weakMatches[0];
|
|
1238
|
+
if (yield* sameDirectorySteps(replacement.path, candidate))
|
|
1239
|
+
return { ownerPath: candidate, isSelf };
|
|
1240
|
+
return replacement.metadata?.id === owner.decisionId
|
|
1241
|
+
? { ownerPath: replacement.path }
|
|
1242
|
+
: { ownerPath: candidate, isSelf };
|
|
1243
|
+
}
|
|
1244
|
+
function* resolveStorageOwnerForCallerSteps(owner, claimDirectory = dirname(owner.path), claimedTarget, context) {
|
|
1245
|
+
const path = owner.relativePath === undefined ? owner.path : resolve(claimDirectory, owner.relativePath);
|
|
1246
|
+
if (owner.identity === undefined)
|
|
1247
|
+
return { ownerPath: path };
|
|
1248
|
+
const fastInfo = yield* fileIdentityWithStatSteps(owner.homeIdentity ? storageHomeDecisionFile(path) : path);
|
|
1249
|
+
if (fastInfo?.identity === owner.identity) {
|
|
1250
|
+
return yield* maybeDisplaceConflictingExactCandidateSteps(owner, claimDirectory, claimedTarget, path, path, fastInfo.stat, context);
|
|
1251
|
+
}
|
|
1252
|
+
const scanned = yield* scanStorageOwnerCandidatesSteps(owner, claimDirectory, claimedTarget, path);
|
|
1253
|
+
if (scanned === undefined)
|
|
1254
|
+
return { ownerPath: undefined };
|
|
1255
|
+
if (scanned.exact.length > 0) {
|
|
1256
|
+
if (scanned.exact.length !== 1)
|
|
1257
|
+
return { ownerPath: undefined };
|
|
1258
|
+
const soleExact = scanned.exact[0];
|
|
1259
|
+
return yield* maybeDisplaceConflictingExactCandidateSteps(owner, claimDirectory, claimedTarget, path, soleExact.path, soleExact.stat, context);
|
|
1260
|
+
}
|
|
1261
|
+
const weakMatches = scanned.recorded.length > 0 ? scanned.recorded : scanned.fallback;
|
|
1262
|
+
return { ownerPath: weakMatches.length === 1 ? weakMatches[0].path : undefined };
|
|
1263
|
+
}
|
|
1264
|
+
function* currentStorageOwnerPathSteps(owner, claimDirectory = dirname(owner.path), claimedTarget, context) {
|
|
1265
|
+
return (yield* resolveStorageOwnerForCallerSteps(owner, claimDirectory, claimedTarget, context)).ownerPath;
|
|
1120
1266
|
}
|
|
1121
1267
|
function* refreshStorageOwnerSteps(file, owner, agentPath, claimDirectory) {
|
|
1122
1268
|
const current = {
|
|
@@ -1144,22 +1290,47 @@ function* refreshStorageOwnerSteps(file, owner, agentPath, claimDirectory) {
|
|
|
1144
1290
|
catch { }
|
|
1145
1291
|
}
|
|
1146
1292
|
}
|
|
1147
|
-
function* parentStorageOwnerSteps(parent) {
|
|
1293
|
+
function* parentStorageOwnerSteps(parent, context) {
|
|
1148
1294
|
const owner = yield* readStorageOwnerSteps(join(parent, PARENT_CLAIM_FILE));
|
|
1149
1295
|
return owner === undefined
|
|
1150
1296
|
? yield* readClaimFileSteps(join(parent, "workflows", ADOPTION_CLAIM_FILE))
|
|
1151
|
-
: ((yield* currentStorageOwnerPathSteps(owner, parent)) ?? join(parent, PARENT_CLAIM_FILE));
|
|
1297
|
+
: ((yield* currentStorageOwnerPathSteps(owner, parent, undefined, context)) ?? join(parent, PARENT_CLAIM_FILE));
|
|
1298
|
+
}
|
|
1299
|
+
function* parentStorageOwnerMatchesSelfSteps(parent, context) {
|
|
1300
|
+
const owner = yield* readStorageOwnerSteps(join(parent, PARENT_CLAIM_FILE));
|
|
1301
|
+
if (owner === undefined) {
|
|
1302
|
+
const legacy = yield* readClaimFileSteps(join(parent, "workflows", ADOPTION_CLAIM_FILE));
|
|
1303
|
+
return {
|
|
1304
|
+
existingOwner: legacy,
|
|
1305
|
+
isSelf: legacy !== undefined && (yield* sameDirectorySteps(legacy, context.path)),
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
const resolved = yield* resolveStorageOwnerForCallerSteps(owner, parent, undefined, context);
|
|
1309
|
+
const existingOwner = resolved.ownerPath ?? join(parent, PARENT_CLAIM_FILE);
|
|
1310
|
+
const isSelf = resolved.isSelf !== undefined
|
|
1311
|
+
? resolved.isSelf
|
|
1312
|
+
: resolved.ownerPath !== undefined && (yield* sameDirectorySteps(resolved.ownerPath, context.path));
|
|
1313
|
+
return { existingOwner, isSelf };
|
|
1152
1314
|
}
|
|
1153
1315
|
function* applyStorageHomeDecisionSteps(decision, agentPath) {
|
|
1316
|
+
const canonicalAgentPath = decisionCanonicalPaths.get(decision);
|
|
1154
1317
|
if (decision.defaultHome) {
|
|
1155
1318
|
const home = yield* defaultHomeForAgentSteps(agentPath, join(getHomeDir(), CONFIG_DIR_NAME));
|
|
1156
|
-
return home === undefined
|
|
1319
|
+
return home === undefined
|
|
1320
|
+
? createStorageHomeEntry(agentPath, undefined, false, decision.id, canonicalAgentPath)
|
|
1321
|
+
: createDefaultStorageHomeEntry(home, false, decision.id, canonicalAgentPath);
|
|
1157
1322
|
}
|
|
1158
1323
|
if (decision.parentOwner === undefined)
|
|
1159
|
-
return createStorageHomeEntry(agentPath);
|
|
1324
|
+
return createStorageHomeEntry(agentPath, undefined, false, decision.id, canonicalAgentPath);
|
|
1325
|
+
const context = {
|
|
1326
|
+
path: agentPath,
|
|
1327
|
+
canonicalPath: canonicalAgentPath,
|
|
1328
|
+
decisionId: decision.id,
|
|
1329
|
+
fresh: true,
|
|
1330
|
+
};
|
|
1160
1331
|
const workflows = join(decision.home, "workflows");
|
|
1161
1332
|
const claim = join(decision.home, PARENT_CLAIM_FILE);
|
|
1162
|
-
const preferred = yield* canonicalPathSteps((yield* parentStorageOwnerSteps(decision.home)) ?? decision.parentOwner);
|
|
1333
|
+
const preferred = yield* canonicalPathSteps((yield* parentStorageOwnerSteps(decision.home, context)) ?? decision.parentOwner);
|
|
1163
1334
|
const ownerTargets = new Set([
|
|
1164
1335
|
...((yield* storageDecisionMetadataSteps(preferred))?.targets ?? []),
|
|
1165
1336
|
...(yield* configuredRelativeTargetsSteps(preferred, getHomeDir(), undefined, false)),
|
|
@@ -1175,7 +1346,7 @@ function* applyStorageHomeDecisionSteps(decision, agentPath) {
|
|
|
1175
1346
|
const winner = yield* readStorageOwnerSteps(claim);
|
|
1176
1347
|
if (winner === undefined)
|
|
1177
1348
|
throw new Error(`Cannot claim storage home at ${claim}`);
|
|
1178
|
-
const winnerPath = yield* currentStorageOwnerPathSteps(winner, decision.home);
|
|
1349
|
+
const winnerPath = yield* currentStorageOwnerPathSteps(winner, decision.home, undefined, context);
|
|
1179
1350
|
if (winnerPath !== undefined && (yield* sameDirectorySteps(winnerPath, agentPath))) {
|
|
1180
1351
|
yield* refreshStorageOwnerSteps(claim, winner, agentPath, decision.home);
|
|
1181
1352
|
}
|
|
@@ -1192,14 +1363,17 @@ function* applyStorageHomeDecisionSteps(decision, agentPath) {
|
|
|
1192
1363
|
}
|
|
1193
1364
|
}
|
|
1194
1365
|
if (winnerPath !== undefined && (yield* sameDirectorySteps(winnerPath, agentPath)))
|
|
1195
|
-
return createStorageHomeEntry(decision.home, claim);
|
|
1366
|
+
return createStorageHomeEntry(decision.home, claim, false, decision.id, canonicalAgentPath);
|
|
1196
1367
|
const weakCandidate = (winner.decisionId !== undefined && (yield* storageDecisionMetadataSteps(agentPath))?.id === winner.decisionId) ||
|
|
1197
1368
|
(winner.directoryIdentity !== undefined && (yield* fileIdentitySteps(agentPath)) === winner.directoryIdentity);
|
|
1198
1369
|
return weakCandidate && winner.legacyTargets !== undefined
|
|
1199
|
-
? {
|
|
1200
|
-
|
|
1370
|
+
? {
|
|
1371
|
+
...createStorageHomeEntry(agentPath, undefined, false, decision.id, canonicalAgentPath),
|
|
1372
|
+
rejectedParentAdoption: { legacyTargets: winner.legacyTargets },
|
|
1373
|
+
}
|
|
1374
|
+
: createStorageHomeEntry(agentPath, undefined, false, decision.id, canonicalAgentPath);
|
|
1201
1375
|
}
|
|
1202
|
-
function* resolveStorageHomeEntrySteps(agentDir, settings) {
|
|
1376
|
+
function* resolveStorageHomeEntrySteps(agentDir, settings, freshness) {
|
|
1203
1377
|
const platform = process.platform;
|
|
1204
1378
|
const rawHome = getHomeDir(platform);
|
|
1205
1379
|
const rawAgentDir = agentDir ?? resolveConfiguredAgentDir(rawHome);
|
|
@@ -1232,6 +1406,8 @@ function* resolveStorageHomeEntrySteps(agentDir, settings) {
|
|
|
1232
1406
|
fastStorageHomes.set(rawAgentDir, { ...fastKey, entry: cached });
|
|
1233
1407
|
return cached;
|
|
1234
1408
|
}
|
|
1409
|
+
if (freshness !== undefined)
|
|
1410
|
+
freshness.fresh = true;
|
|
1235
1411
|
const matchedDefaultHome = yield* defaultHomeForAgentSteps(agentPath, defaultHome);
|
|
1236
1412
|
if (matchedDefaultHome !== undefined) {
|
|
1237
1413
|
const file = storageHomeDecisionFile(agentPath);
|
|
@@ -1262,11 +1438,16 @@ function* resolveStorageHomeEntrySteps(agentDir, settings) {
|
|
|
1262
1438
|
}
|
|
1263
1439
|
const relativeTargets = yield* configuredRelativeTargetsSteps(agentPath, rawHome, settings);
|
|
1264
1440
|
const parentWorkflows = join(parent, "workflows");
|
|
1265
|
-
const existingOwner = yield*
|
|
1441
|
+
const { existingOwner, isSelf: existingOwnerIsSelf } = yield* parentStorageOwnerMatchesSelfSteps(parent, {
|
|
1442
|
+
path: agentPath,
|
|
1443
|
+
decisionId: undefined,
|
|
1444
|
+
fresh: true,
|
|
1445
|
+
onlySelf: true,
|
|
1446
|
+
});
|
|
1266
1447
|
let decision = { home: agentPath };
|
|
1267
1448
|
if (!(yield* hasOwnStoreEntriesSteps(agentPath, parent, relativeTargets))) {
|
|
1268
1449
|
if (existingOwner !== undefined) {
|
|
1269
|
-
if (
|
|
1450
|
+
if (existingOwnerIsSelf)
|
|
1270
1451
|
decision = { home: parent, parentOwner: existingOwner };
|
|
1271
1452
|
}
|
|
1272
1453
|
else if (yield* hasParentStoreEntriesSteps(parent, agentPath, relativeTargets)) {
|
|
@@ -1308,8 +1489,14 @@ function* coLocatesWorkflowStoreSteps(agentDir, settings) {
|
|
|
1308
1489
|
if (decision !== undefined) {
|
|
1309
1490
|
if (decision.defaultHome || decision.parentOwner === undefined)
|
|
1310
1491
|
return true;
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1492
|
+
const { existingOwner, isSelf } = yield* parentStorageOwnerMatchesSelfSteps(decision.home, {
|
|
1493
|
+
path: agentPath,
|
|
1494
|
+
canonicalPath: decisionCanonicalPaths.get(decision),
|
|
1495
|
+
decisionId: decision.id,
|
|
1496
|
+
fresh: true,
|
|
1497
|
+
onlySelf: true,
|
|
1498
|
+
});
|
|
1499
|
+
return existingOwner === undefined ? !(yield* sameDirectorySteps(decision.parentOwner, agentPath)) : !isSelf;
|
|
1313
1500
|
}
|
|
1314
1501
|
const parent = dirname(agentPath);
|
|
1315
1502
|
if (pathsEqual(parent, agentPath) || (yield* isDefaultStorageHomeSteps(parent, defaultHome)))
|
|
@@ -1318,9 +1505,14 @@ function* coLocatesWorkflowStoreSteps(agentDir, settings) {
|
|
|
1318
1505
|
if (yield* hasOwnStoreEntriesSteps(agentPath, parent, relativeTargets))
|
|
1319
1506
|
return true;
|
|
1320
1507
|
const parentWorkflows = join(parent, "workflows");
|
|
1321
|
-
const existingOwner = yield*
|
|
1508
|
+
const { existingOwner, isSelf: existingOwnerIsSelf } = yield* parentStorageOwnerMatchesSelfSteps(parent, {
|
|
1509
|
+
path: agentPath,
|
|
1510
|
+
decisionId: undefined,
|
|
1511
|
+
fresh: true,
|
|
1512
|
+
onlySelf: true,
|
|
1513
|
+
});
|
|
1322
1514
|
if (existingOwner !== undefined)
|
|
1323
|
-
return !
|
|
1515
|
+
return !existingOwnerIsSelf;
|
|
1324
1516
|
if (!(yield* hasParentStoreEntriesSteps(parent, agentPath, relativeTargets)))
|
|
1325
1517
|
return true;
|
|
1326
1518
|
const hostIdOwner = yield* eligibleLegacyHostOwnerSteps(parentWorkflows, rawHome);
|
|
@@ -1412,11 +1604,12 @@ export async function storagePathBaseDirAsync(path, agentDir, settings) {
|
|
|
1412
1604
|
return runStorageSteps(storagePathBaseDirSteps(path, agentDir, settings));
|
|
1413
1605
|
}
|
|
1414
1606
|
export function* storagePathBaseDirSteps(path, agentDir, settings) {
|
|
1415
|
-
const
|
|
1607
|
+
const entryFreshness = { fresh: false };
|
|
1608
|
+
const entry = yield* resolveStorageHomeEntrySteps(agentDir, settings, entryFreshness);
|
|
1416
1609
|
const targetCacheKey = `${agentDir}\0${path}`;
|
|
1417
1610
|
const cached = storageTargetDecisions.get(entry)?.get(targetCacheKey);
|
|
1418
1611
|
if (cached !== undefined)
|
|
1419
|
-
return yield* applyStorageTargetDecisionSteps(cached, settings);
|
|
1612
|
+
return yield* applyStorageTargetDecisionSteps(cached, settings, entryFreshness.fresh);
|
|
1420
1613
|
const home = entry.home;
|
|
1421
1614
|
const target = normalizeRelativeTarget(path, getHomeDir());
|
|
1422
1615
|
if (target === undefined)
|
|
@@ -1490,7 +1683,13 @@ export function* storagePathBaseDirSteps(path, agentDir, settings) {
|
|
|
1490
1683
|
};
|
|
1491
1684
|
}
|
|
1492
1685
|
}
|
|
1493
|
-
const resolved = {
|
|
1686
|
+
const resolved = {
|
|
1687
|
+
agentPath,
|
|
1688
|
+
...(entry.canonicalAgentPath === undefined ? {} : { canonicalAgentPath: entry.canonicalAgentPath }),
|
|
1689
|
+
target,
|
|
1690
|
+
decision,
|
|
1691
|
+
...(entry.decisionId === undefined ? {} : { decisionId: entry.decisionId }),
|
|
1692
|
+
};
|
|
1494
1693
|
if (!entry.provisionalWithoutSettings && settings !== undefined && (yield* io("isDirectory", agentPath))) {
|
|
1495
1694
|
let targets = storageTargetDecisions.get(entry);
|
|
1496
1695
|
if (targets === undefined) {
|
|
@@ -1499,7 +1698,7 @@ export function* storagePathBaseDirSteps(path, agentDir, settings) {
|
|
|
1499
1698
|
}
|
|
1500
1699
|
targets.set(targetCacheKey, resolved);
|
|
1501
1700
|
}
|
|
1502
|
-
return yield* applyStorageTargetDecisionSteps(resolved, settings);
|
|
1701
|
+
return yield* applyStorageTargetDecisionSteps(resolved, settings, entryFreshness.fresh);
|
|
1503
1702
|
}
|
|
1504
1703
|
function* defaultTargetVersionSteps({ agentPath, target, decision, }) {
|
|
1505
1704
|
if (!decision.defaultHome)
|
|
@@ -1524,10 +1723,18 @@ function* defaultTargetVersionSteps({ agentPath, target, decision, }) {
|
|
|
1524
1723
|
return undefined;
|
|
1525
1724
|
}
|
|
1526
1725
|
}
|
|
1527
|
-
function* applyStorageTargetDecisionSteps(targetDecision, settings) {
|
|
1528
|
-
const { agentPath, target, decision } = targetDecision;
|
|
1726
|
+
function* applyStorageTargetDecisionSteps(targetDecision, settings, entryFresh = false) {
|
|
1727
|
+
const { agentPath, canonicalAgentPath, target, decision, decisionId } = targetDecision;
|
|
1529
1728
|
if (decision.parentOwner === undefined)
|
|
1530
1729
|
return decision.home;
|
|
1730
|
+
const context = {
|
|
1731
|
+
path: agentPath,
|
|
1732
|
+
canonicalPath: canonicalAgentPath,
|
|
1733
|
+
decisionId,
|
|
1734
|
+
fresh: entryFresh,
|
|
1735
|
+
onlySelf: true,
|
|
1736
|
+
verifiedCache: targetDecision,
|
|
1737
|
+
};
|
|
1531
1738
|
const version = yield* defaultTargetVersionSteps(targetDecision);
|
|
1532
1739
|
const cached = defaultTargetClaims.get(targetDecision);
|
|
1533
1740
|
const selected = resolve(decision.home, target);
|
|
@@ -1546,8 +1753,11 @@ function* applyStorageTargetDecisionSteps(targetDecision, settings) {
|
|
|
1546
1753
|
}
|
|
1547
1754
|
if (owner === undefined)
|
|
1548
1755
|
throw new Error(`Cannot claim storage target at ${claim}`);
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1756
|
+
const resolved = yield* resolveStorageOwnerForCallerSteps(owner, dirname(claim), target, context);
|
|
1757
|
+
const isSelf = resolved.isSelf !== undefined
|
|
1758
|
+
? resolved.isSelf
|
|
1759
|
+
: resolved.ownerPath !== undefined && (yield* sameDirectorySteps(resolved.ownerPath, agentPath));
|
|
1760
|
+
if (isSelf)
|
|
1551
1761
|
continue;
|
|
1552
1762
|
const fallback = resolve(agentPath, target);
|
|
1553
1763
|
if (!containsPath(yield* canonicalPathSteps(agentPath), yield* canonicalPathSteps(fallback)) ||
|