@bastani/atomic 0.10.4 → 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 +44 -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 +21 -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 +6 -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
|
@@ -1,906 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
/** A set environment variable; an empty one is unset. */
|
|
21
|
-
function variable(context, name) {
|
|
22
|
-
const value = context.env[name];
|
|
23
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
24
|
-
}
|
|
25
|
-
function underHome(context, ...segments) {
|
|
26
|
-
return join(context.home, ...segments);
|
|
27
|
-
}
|
|
28
|
-
/** `%LOCALAPPDATA%`, else its default under the home directory. */
|
|
29
|
-
function localAppData(context) {
|
|
30
|
-
return variable(context, "LOCALAPPDATA") ?? underHome(context, "AppData", "Local");
|
|
31
|
-
}
|
|
32
|
-
/** The XDG cache directory on Linux, `~/Library/Caches` on macOS, `%LOCALAPPDATA%` on Windows. */
|
|
33
|
-
function userCache(context) {
|
|
34
|
-
if (context.os === "macos") return underHome(context, "Library", "Caches");
|
|
35
|
-
if (context.os === "windows") return localAppData(context);
|
|
36
|
-
return variable(context, "XDG_CACHE_HOME") ?? underHome(context, ".cache");
|
|
37
|
-
}
|
|
38
|
-
const PACKAGE_MANAGERS = [
|
|
39
|
-
{
|
|
40
|
-
name: "npm",
|
|
41
|
-
files: ["package-lock.json", "npm-shrinkwrap.json"],
|
|
42
|
-
stores: (context) => [variable(context, "npm_config_cache") ?? (context.os === "windows" ? join(localAppData(context), "npm-cache") : underHome(context, ".npm"))]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "pnpm",
|
|
46
|
-
files: ["pnpm-lock.yaml"],
|
|
47
|
-
stores: (context) => {
|
|
48
|
-
const configured = variable(context, "npm_config_store_dir");
|
|
49
|
-
if (configured !== void 0) return [configured];
|
|
50
|
-
const pnpmHome = variable(context, "PNPM_HOME");
|
|
51
|
-
if (pnpmHome !== void 0) return [join(pnpmHome, "store")];
|
|
52
|
-
if (context.os === "macos") return [underHome(context, "Library", "pnpm", "store")];
|
|
53
|
-
if (context.os === "windows") return [join(localAppData(context), "pnpm", "store")];
|
|
54
|
-
const data = variable(context, "XDG_DATA_HOME") ?? underHome(context, ".local", "share");
|
|
55
|
-
return [join(data, "pnpm", "store")];
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "yarn",
|
|
60
|
-
files: ["yarn.lock"],
|
|
61
|
-
stores: (context) => {
|
|
62
|
-
if (context.present.has(".yarnrc.yml")) return [join(variable(context, "YARN_GLOBAL_FOLDER") ?? underHome(context, ".yarn", "berry"), "cache")];
|
|
63
|
-
const configured = variable(context, "YARN_CACHE_FOLDER");
|
|
64
|
-
if (configured !== void 0) return [configured];
|
|
65
|
-
if (context.os === "macos") return [join(userCache(context), "Yarn")];
|
|
66
|
-
if (context.os === "windows") return [join(localAppData(context), "Yarn", "Cache")];
|
|
67
|
-
return [join(userCache(context), "yarn")];
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "bun",
|
|
72
|
-
files: ["bun.lock", "bun.lockb"],
|
|
73
|
-
stores: (context) => [variable(context, "BUN_INSTALL_CACHE_DIR") ?? join(variable(context, "BUN_INSTALL") ?? underHome(context, ".bun"), "install", "cache")]
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "cargo",
|
|
77
|
-
files: ["Cargo.lock"],
|
|
78
|
-
stores: (context) => {
|
|
79
|
-
const cargoHome = variable(context, "CARGO_HOME") ?? underHome(context, ".cargo");
|
|
80
|
-
return [join(cargoHome, "registry"), join(cargoHome, "git")];
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "uv",
|
|
85
|
-
files: ["uv.lock"],
|
|
86
|
-
stores: (context) => [variable(context, "UV_CACHE_DIR") ?? (context.os === "windows" ? join(localAppData(context), "uv", "cache") : join(variable(context, "XDG_CACHE_HOME") ?? underHome(context, ".cache"), "uv"))]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "pip",
|
|
90
|
-
files: ["requirements.txt", "Pipfile.lock"],
|
|
91
|
-
stores: (context) => [variable(context, "PIP_CACHE_DIR") ?? join(userCache(context), context.os === "windows" ? join("pip", "Cache") : "pip")]
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: "poetry",
|
|
95
|
-
files: ["poetry.lock"],
|
|
96
|
-
stores: (context) => [variable(context, "POETRY_CACHE_DIR") ?? join(userCache(context), context.os === "windows" ? join("pypoetry", "Cache") : "pypoetry")]
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: "go",
|
|
100
|
-
files: ["go.sum"],
|
|
101
|
-
stores: (context) => {
|
|
102
|
-
const gopath = variable(context, "GOPATH")?.split(delimiter)[0] || underHome(context, "go");
|
|
103
|
-
return [variable(context, "GOMODCACHE") ?? join(gopath, "pkg", "mod"), variable(context, "GOCACHE") ?? join(userCache(context), "go-build")];
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "gradle",
|
|
108
|
-
files: [
|
|
109
|
-
"gradle.lockfile",
|
|
110
|
-
"gradle/wrapper/gradle-wrapper.properties",
|
|
111
|
-
"build.gradle",
|
|
112
|
-
"build.gradle.kts",
|
|
113
|
-
"settings.gradle",
|
|
114
|
-
"settings.gradle.kts"
|
|
115
|
-
],
|
|
116
|
-
stores: (context) => {
|
|
117
|
-
const gradleHome = variable(context, "GRADLE_USER_HOME") ?? underHome(context, ".gradle");
|
|
118
|
-
return [join(gradleHome, "caches"), join(gradleHome, "wrapper")];
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "maven",
|
|
123
|
-
files: ["pom.xml"],
|
|
124
|
-
stores: (context) => [underHome(context, ".m2", "repository")]
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
/** Every root-relative file detection looks at. */
|
|
128
|
-
const DETECTION_FILES = [.../* @__PURE__ */ new Set([...PACKAGE_MANAGERS.flatMap((manager) => manager.files), ".yarnrc.yml"])];
|
|
129
|
-
/** The root-relative detection files that exist as files under `root`. */
|
|
130
|
-
async function presentFiles(root) {
|
|
131
|
-
const found = await Promise.all(DETECTION_FILES.map(async (file) => {
|
|
132
|
-
try {
|
|
133
|
-
return (await stat(join(root, file))).isFile() ? file : void 0;
|
|
134
|
-
} catch {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
}));
|
|
138
|
-
return new Set(found.filter((file) => file !== void 0));
|
|
139
|
-
}
|
|
140
|
-
/** The stores of each package manager whose lockfile or build file is at the repository root `root`, in a fixed order. */
|
|
141
|
-
async function detectPackageManagerStores(root, context) {
|
|
142
|
-
const present = await presentFiles(root);
|
|
143
|
-
const full = {
|
|
144
|
-
...context,
|
|
145
|
-
present
|
|
146
|
-
};
|
|
147
|
-
return PACKAGE_MANAGERS.filter((manager) => manager.files.some((file) => present.has(file))).map((manager) => ({
|
|
148
|
-
manager: manager.name,
|
|
149
|
-
keyFiles: manager.files.filter((file) => present.has(file)),
|
|
150
|
-
paths: manager.stores(full).map((path) => resolve(path))
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
153
|
-
// dist/core/resume/blueprint/cache.js
|
|
154
|
-
/**
|
|
155
|
-
* The cache contract for runners (#4748): the package stores a repository's lockfiles name, any extra store or build
|
|
156
|
-
* paths its `resume.cache` setting declares, plus Atomic's Git object store and its extension transpile cache, each
|
|
157
|
-
* with an `actions/cache`-style key, a restore prefix and the paths to save. Atomic never uploads or downloads caches;
|
|
158
|
-
* a runner's cache action does, and only a trusted job saves. `.atomic/blueprint.yaml` keeps Devin's format: nothing
|
|
159
|
-
* here is declared in it. Package stores verify what they read, so `"kind": "store"` is the default; build output
|
|
160
|
-
* is opt-in.
|
|
161
|
-
*/
|
|
162
|
-
/** Bumped when the key derivation changes, so no runner restores an entry keyed the old way. */
|
|
163
|
-
const KEY_VERSION = "v1";
|
|
164
|
-
/**
|
|
165
|
-
* Credential locations under the home directory. A path that is one of them, inside one, or contains one is omitted,
|
|
166
|
-
* so `~/.cargo/registry` is kept and `~/.cargo` is not.
|
|
167
|
-
*/
|
|
168
|
-
const HOME_CREDENTIAL_PATHS = [
|
|
169
|
-
".aws",
|
|
170
|
-
".azure",
|
|
171
|
-
".cargo/credentials",
|
|
172
|
-
".cargo/credentials.toml",
|
|
173
|
-
".config/gcloud",
|
|
174
|
-
".config/gh",
|
|
175
|
-
".docker/config.json",
|
|
176
|
-
".gem/credentials",
|
|
177
|
-
".git-credentials",
|
|
178
|
-
".gnupg",
|
|
179
|
-
".gradle/gradle.properties",
|
|
180
|
-
".kube",
|
|
181
|
-
".m2/settings.xml",
|
|
182
|
-
".netrc",
|
|
183
|
-
".npmrc",
|
|
184
|
-
".pypirc",
|
|
185
|
-
".ssh",
|
|
186
|
-
".terraform.d/credentials.tfrc.json",
|
|
187
|
-
".yarnrc.yml"
|
|
188
|
-
];
|
|
189
|
-
/** Root-relative files that commonly carry registry tokens, which a build path may not name. */
|
|
190
|
-
const WORKTREE_CREDENTIAL_FILES = /* @__PURE__ */ new Set([
|
|
191
|
-
".npmrc",
|
|
192
|
-
".pypirc",
|
|
193
|
-
".yarnrc.yml"
|
|
194
|
-
]);
|
|
195
|
-
/**
|
|
196
|
-
* The cache keys and paths of the repository at `root` (its top level). A pure function of the inputs: the lockfiles
|
|
197
|
-
* at the root and the package-manager stores they name, the `resume.cache` setting, the root blueprint's content, the
|
|
198
|
-
* files that key each entry, the checkout's remotes and HEAD, the Atomic version, `platform` and `arch`. Paths that
|
|
199
|
-
* could carry secrets, store paths inside the worktree and build paths outside it are omitted with a warning; an
|
|
200
|
-
* invalid `resume.cache` entry only warns.
|
|
201
|
-
*/
|
|
202
|
-
async function blueprintCacheKeys(root, options = {}) {
|
|
203
|
-
const os = blueprintPlatformOf(options.platform ?? process.platform);
|
|
204
|
-
const arch = options.arch ?? process.arch;
|
|
205
|
-
const home = resolve(options.home ?? homedir());
|
|
206
|
-
const agentDir = resolve(options.agentDir ?? getAgentDir());
|
|
207
|
-
const storeDir = resolve(options.storeDir ?? join(agentDir, "worktree-snapshots"));
|
|
208
|
-
const warnings = [];
|
|
209
|
-
const blueprint = await blueprintDigest(root, warnings);
|
|
210
|
-
const detected = await detectPackageManagerStores(root, {
|
|
211
|
-
os,
|
|
212
|
-
home,
|
|
213
|
-
env: options.env ?? process.env
|
|
214
|
-
});
|
|
215
|
-
const settings = settingsCache(root, agentDir, warnings);
|
|
216
|
-
const remotes = await checkoutRemotes(root);
|
|
217
|
-
const checkout = canonicalizeWorktreePath(root);
|
|
218
|
-
const repository = sharedRepositoryIdOf(remotes, checkout) ?? repositoryIdOf(remotes);
|
|
219
|
-
const store = remotes.length > 0 ? objectStorePath(storeDir, remotes, checkout) : void 0;
|
|
220
|
-
if (store === void 0) warnings.push("the checkout has no Git remote; the git and build entries are omitted");
|
|
221
|
-
const stores = [];
|
|
222
|
-
const builds = [];
|
|
223
|
-
const addStore = (declared, member) => {
|
|
224
|
-
const refusal = refuseStore(declared, root, home, agentDir);
|
|
225
|
-
const path = storePath(declared, home);
|
|
226
|
-
if (refusal !== void 0) warnings.push(`cache path '${declared}' is omitted: ${refusal}`);
|
|
227
|
-
else stores.push({
|
|
228
|
-
...member,
|
|
229
|
-
path
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
for (const { manager, keyFiles, paths } of detected) for (const path of paths) addStore(path, {
|
|
233
|
-
declaration: ["detected", manager],
|
|
234
|
-
keyFiles
|
|
235
|
-
});
|
|
236
|
-
for (const setting of settings) {
|
|
237
|
-
const member = {
|
|
238
|
-
declaration: [
|
|
239
|
-
setting.path,
|
|
240
|
-
setting.kind,
|
|
241
|
-
setting.keyFiles ?? null
|
|
242
|
-
],
|
|
243
|
-
keyFiles: setting.keyFiles
|
|
244
|
-
};
|
|
245
|
-
if (setting.kind === "store") {
|
|
246
|
-
addStore(setting.path, member);
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
const refusal = refuseBuild(setting.path);
|
|
250
|
-
if (refusal !== void 0) {
|
|
251
|
-
warnings.push(`cache path '${setting.path}' is omitted: ${refusal}`);
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
if (await tracksFilesUnder(root, buildSegments(setting.path).join("/"))) warnings.push(`cache path '${setting.path}' holds files Git tracks; only its untracked and ignored files are parked, and tracked files stay in the worktree`);
|
|
255
|
-
if (store !== void 0) builds.push({
|
|
256
|
-
...member,
|
|
257
|
-
path: join(seedDirectory(storeDir, repository), ...buildSegments(setting.path))
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
const entries = [];
|
|
261
|
-
const inputs = new InputDigests(root);
|
|
262
|
-
const prefix = (name) => `atomic-${name}-${KEY_VERSION}-${os}-${arch}-`;
|
|
263
|
-
for (const [name, members] of [["stores", stores], ["build", builds]]) {
|
|
264
|
-
if (members.length === 0) continue;
|
|
265
|
-
const restorePrefix = prefix(name);
|
|
266
|
-
const key = `${restorePrefix}${await membersDigest(blueprint, members, inputs)}`;
|
|
267
|
-
const paths = [...new Set(members.map((member) => member.path))];
|
|
268
|
-
if (name === "build") paths.push(seedManifestPath(storeDir, repository));
|
|
269
|
-
entries.push({
|
|
270
|
-
name,
|
|
271
|
-
key,
|
|
272
|
-
restorePrefix,
|
|
273
|
-
paths
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
if (store !== void 0) {
|
|
277
|
-
const restorePrefix = `atomic-git-${KEY_VERSION}-${os}-${repository}-`;
|
|
278
|
-
entries.push({
|
|
279
|
-
name: "git",
|
|
280
|
-
key: `${restorePrefix}${await headOf(root)}`,
|
|
281
|
-
restorePrefix,
|
|
282
|
-
paths: [store]
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
const transpileCache = getExtensionTranspileCacheDir(agentDir);
|
|
286
|
-
entries.push({
|
|
287
|
-
name: "atomic",
|
|
288
|
-
key: `${prefix("atomic")}${hex16(`atomic\n${VERSION}\n${basename(transpileCache)}`)}`,
|
|
289
|
-
restorePrefix: prefix("atomic"),
|
|
290
|
-
paths: [transpileCache]
|
|
291
|
-
});
|
|
292
|
-
return {
|
|
293
|
-
entries,
|
|
294
|
-
warnings
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* A digest of the root blueprint's content, `absent` when there is none. A blueprint that still has the `cache:` key
|
|
299
|
-
* Atomic once read earns the parser's hint to move it to `resume.cache`.
|
|
300
|
-
*/
|
|
301
|
-
async function blueprintDigest(root, warnings) {
|
|
302
|
-
const path = getProjectBlueprintPath(root);
|
|
303
|
-
let source;
|
|
304
|
-
try {
|
|
305
|
-
source = await readFile(path, "utf8");
|
|
306
|
-
} catch (error) {
|
|
307
|
-
const code = error.code;
|
|
308
|
-
if (code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR") return "absent";
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
311
|
-
try {
|
|
312
|
-
for (const warning of parseBlueprint(source, {
|
|
313
|
-
path,
|
|
314
|
-
scope: "repository"
|
|
315
|
-
}).warnings) if (warning.code === "cache-ignored") warnings.push(warning.message);
|
|
316
|
-
} catch {}
|
|
317
|
-
return sha256Hex(source);
|
|
318
|
-
}
|
|
319
|
-
/** The `resume.cache` setting, project over global, with each file that could not be read named in `warnings`. */
|
|
320
|
-
function settingsCache(root, agentDir, warnings) {
|
|
321
|
-
const settings = SettingsManager.create(root, agentDir);
|
|
322
|
-
for (const { path, error, invalidKey } of settings.drainErrors()) {
|
|
323
|
-
if (path === void 0) continue;
|
|
324
|
-
if (invalidKey === void 0) warnings.push(`${path} could not be read, so its resume.cache is ignored: ${error.message}`);
|
|
325
|
-
else if (invalidKey === "resume") warnings.push(`${path}: ${error.message}`);
|
|
326
|
-
}
|
|
327
|
-
return readCacheSetting(settings.getSettings().resume?.cache, warnings);
|
|
328
|
-
}
|
|
329
|
-
/** A path whose text a cache path or key file may not contain: control characters such as a newline. */
|
|
330
|
-
const CONTROL_CHARACTER = /\p{Cc}/u;
|
|
331
|
-
/**
|
|
332
|
-
* Characters a cache action reads as a glob or an exclusion (`!`), which could match paths the credential checks never
|
|
333
|
-
* saw, such as `~/.ss[h]`. A cache path is a plain path.
|
|
334
|
-
*/
|
|
335
|
-
const GLOB_CHARACTER = /[*?[\]{}]|^\s*!/u;
|
|
336
|
-
const KEY_FILES_RULE = "'keyFiles' must be a list of files relative to the repository root, without '..'";
|
|
337
|
-
/**
|
|
338
|
-
* Reads `resume.cache` leniently: an invalid entry or path, or a value that is not a list, is left out with a warning
|
|
339
|
-
* and never fails the command, so a cache never depends on it.
|
|
340
|
-
*/
|
|
341
|
-
function readCacheSetting(value, warnings) {
|
|
342
|
-
if (value === void 0 || value === null) return [];
|
|
343
|
-
if (!Array.isArray(value)) {
|
|
344
|
-
warnings.push("resume.cache must be a list of { paths, kind, keyFiles } entries; ignored");
|
|
345
|
-
return [];
|
|
346
|
-
}
|
|
347
|
-
const settings = [];
|
|
348
|
-
for (const [index, item] of value.entries()) {
|
|
349
|
-
const name = `resume.cache[${index}]`;
|
|
350
|
-
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
351
|
-
warnings.push(`${name}: an entry must be a { paths, kind, keyFiles } object; entry ignored`);
|
|
352
|
-
continue;
|
|
353
|
-
}
|
|
354
|
-
const { paths, kind, keyFiles } = item;
|
|
355
|
-
const resolvedKind = kind === void 0 || kind === null ? "store" : kind;
|
|
356
|
-
if (resolvedKind !== "store" && resolvedKind !== "build") {
|
|
357
|
-
warnings.push(`${name}: 'kind' must be 'store' or 'build'; entry ignored`);
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
if (!Array.isArray(paths)) {
|
|
361
|
-
warnings.push(`${name}: 'paths' must be a list of paths; entry ignored`);
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
364
|
-
let files;
|
|
365
|
-
if (keyFiles !== void 0 && keyFiles !== null) {
|
|
366
|
-
if (!Array.isArray(keyFiles) || keyFiles.length === 0 || !keyFiles.every(isRelativeFile)) {
|
|
367
|
-
warnings.push(`${name}: ${KEY_FILES_RULE}; entry ignored`);
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
files = keyFiles.map((file) => file.replaceAll("\\", "/"));
|
|
371
|
-
}
|
|
372
|
-
for (const [position, path] of paths.entries()) if (typeof path !== "string" || path.trim() === "" || CONTROL_CHARACTER.test(path)) warnings.push(`${name}.paths[${position}]: a path must be a non-empty single-line string; ignored`);
|
|
373
|
-
else if (GLOB_CHARACTER.test(path)) warnings.push(`${name}.paths[${position}]: '${path}' must be a plain path, without glob characters or a leading '!'; ignored`);
|
|
374
|
-
else settings.push({
|
|
375
|
-
path: path.trim(),
|
|
376
|
-
kind: resolvedKind,
|
|
377
|
-
keyFiles: files
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
return settings;
|
|
381
|
-
}
|
|
382
|
-
function isRelativeFile(value) {
|
|
383
|
-
if (typeof value !== "string" || value === "" || CONTROL_CHARACTER.test(value)) return false;
|
|
384
|
-
const normalized = value.replaceAll("\\", "/");
|
|
385
|
-
return !posix.isAbsolute(normalized) && !/^[A-Za-z]:/.test(value) && !normalized.split("/").includes("..");
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* `keys` printed as `format`. `github-output` writes `<name>-key`, `<name>-restore-prefix` and `<name>-paths` lines
|
|
389
|
-
* for `$GITHUB_OUTPUT`, several paths in a heredoc whose delimiter is derived from them. Warnings are not included.
|
|
390
|
-
*/
|
|
391
|
-
function formatBlueprintCacheKeys(keys, format) {
|
|
392
|
-
if (format === "json") return `${JSON.stringify(keys, null, 2)}\n`;
|
|
393
|
-
const lines = [];
|
|
394
|
-
for (const entry of keys.entries) {
|
|
395
|
-
if (format === "text") {
|
|
396
|
-
lines.push(entry.name, ` key: ${entry.key}`, ` restore prefix: ${entry.restorePrefix}`);
|
|
397
|
-
for (const [index, path] of entry.paths.entries()) lines.push(` ${index === 0 ? "paths:" : " "} ${path}`);
|
|
398
|
-
continue;
|
|
399
|
-
}
|
|
400
|
-
lines.push(`${entry.name}-key=${entry.key}`, `${entry.name}-restore-prefix=${entry.restorePrefix}`);
|
|
401
|
-
if (entry.paths.length === 1) lines.push(`${entry.name}-paths=${entry.paths[0]}`);
|
|
402
|
-
else {
|
|
403
|
-
const delimiter = `ATOMIC_${hex16(entry.paths.join("\n"))}`;
|
|
404
|
-
lines.push(`${entry.name}-paths<<${delimiter}`, ...entry.paths, delimiter);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return lines.length === 0 ? "" : `${lines.join("\n")}\n`;
|
|
408
|
-
}
|
|
409
|
-
function hex16(text) {
|
|
410
|
-
return sha256Hex(text).slice(0, 16);
|
|
411
|
-
}
|
|
412
|
-
async function checkoutRemotes(root) {
|
|
413
|
-
try {
|
|
414
|
-
return (await readRepositoryConfig(root)).remotes;
|
|
415
|
-
} catch {
|
|
416
|
-
return [];
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/** Whether Git tracks a file at or under the root-relative `path` of the checkout at `root`; false when it cannot tell. */
|
|
420
|
-
async function tracksFilesUnder(root, path) {
|
|
421
|
-
try {
|
|
422
|
-
const { stdout } = await runGit([
|
|
423
|
-
"ls-files",
|
|
424
|
-
"-z",
|
|
425
|
-
"--",
|
|
426
|
-
`:(literal)${path}`
|
|
427
|
-
], { cwd: root });
|
|
428
|
-
return stdout.length > 0;
|
|
429
|
-
} catch {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
async function headOf(root) {
|
|
434
|
-
const { stdout } = await runGit([
|
|
435
|
-
"rev-parse",
|
|
436
|
-
"--verify",
|
|
437
|
-
"-q",
|
|
438
|
-
"HEAD"
|
|
439
|
-
], {
|
|
440
|
-
cwd: root,
|
|
441
|
-
allowExitCodes: [1]
|
|
442
|
-
});
|
|
443
|
-
return stdout.toString("utf8").trim() || "unborn";
|
|
444
|
-
}
|
|
445
|
-
/** The digests that key entries, read once each. */
|
|
446
|
-
var InputDigests = class {
|
|
447
|
-
#environment;
|
|
448
|
-
root;
|
|
449
|
-
constructor(root) {
|
|
450
|
-
this.root = root;
|
|
451
|
-
}
|
|
452
|
-
/** The paths and contents of `files` (absent files named as such). */
|
|
453
|
-
async files(files) {
|
|
454
|
-
const hash = createHash("sha256");
|
|
455
|
-
for (const file of files) try {
|
|
456
|
-
hash.update(`${file}\0${sha256Hex(await readFile(join(this.root, file)))}\n`);
|
|
457
|
-
} catch (error) {
|
|
458
|
-
const code = error.code;
|
|
459
|
-
if (code !== "ENOENT" && code !== "ENOTDIR" && code !== "EISDIR") throw error;
|
|
460
|
-
hash.update(`${file}\0absent\n`);
|
|
461
|
-
}
|
|
462
|
-
return `files:${hash.digest("hex")}`;
|
|
463
|
-
}
|
|
464
|
-
/** A setting's key files, else the environment hash, which covers every lockfile and toolchain file. */
|
|
465
|
-
async of(member) {
|
|
466
|
-
if (member.keyFiles !== void 0) return this.files(member.keyFiles);
|
|
467
|
-
this.#environment ??= computeEnvironmentHash(this.root);
|
|
468
|
-
return `env:${await this.#environment}`;
|
|
469
|
-
}
|
|
470
|
-
};
|
|
471
|
-
/** A digest of the root blueprint, the members as declared or detected, and each member's key inputs. */
|
|
472
|
-
async function membersDigest(blueprint, members, inputs) {
|
|
473
|
-
const lines = [`atomic-cache-${KEY_VERSION}`, `blueprint:${blueprint}`];
|
|
474
|
-
for (const member of members) lines.push(JSON.stringify(member.declaration), await inputs.of(member));
|
|
475
|
-
return hex16(lines.join("\n"));
|
|
476
|
-
}
|
|
477
|
-
function expandsHome(path) {
|
|
478
|
-
return path === "~" || path.startsWith("~/") || path.startsWith("~\\");
|
|
479
|
-
}
|
|
480
|
-
function storePath(path, home) {
|
|
481
|
-
return expandsHome(path) ? resolve(home, path.slice(2)) : resolve(path);
|
|
482
|
-
}
|
|
483
|
-
/** `child` is `parent` or below it. */
|
|
484
|
-
function within(parent, child) {
|
|
485
|
-
const path = relative(parent, child);
|
|
486
|
-
return path === "" || !escapes(path);
|
|
487
|
-
}
|
|
488
|
-
/** `path`, relative, leaves its base: `..` or `../…`, not a child named like `..keys`; or it is absolute (another drive). */
|
|
489
|
-
function escapes(path) {
|
|
490
|
-
return path === ".." || path.startsWith(`..${sep}`) || isAbsolute(path);
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* `path` as the credential checks compare it: every symbolic link in its existing part resolved, then lower-cased, so
|
|
494
|
-
* `~/.SSH` on a case-insensitive filesystem and a link to `~/.ssh` both compare equal to `~/.ssh`.
|
|
495
|
-
*/
|
|
496
|
-
function comparable(path) {
|
|
497
|
-
return canonicalizeWorktreePath(path).toLowerCase();
|
|
498
|
-
}
|
|
499
|
-
/** Why the store path `declared` is refused, if it is. */
|
|
500
|
-
function refuseStore(declared, root, home, agentDir) {
|
|
501
|
-
if (CONTROL_CHARACTER.test(declared) || GLOB_CHARACTER.test(declared)) return "a cache path must be a plain single-line path, without glob characters or a leading '!'";
|
|
502
|
-
if (!expandsHome(declared) && !isAbsolute(declared)) return "a store path must be outside the worktree (absolute or under ~); declare build output with \"kind\": \"build\"";
|
|
503
|
-
const path = storePath(declared, home);
|
|
504
|
-
if (within(path, root) || within(root, path)) return "a store path must be outside the worktree";
|
|
505
|
-
const credentials = [...HOME_CREDENTIAL_PATHS.map((entry) => join(home, entry)), join(agentDir, "auth.json")];
|
|
506
|
-
let candidates;
|
|
507
|
-
let locations;
|
|
508
|
-
try {
|
|
509
|
-
candidates = [path.toLowerCase(), comparable(path)];
|
|
510
|
-
locations = credentials.flatMap((credential) => [credential.toLowerCase(), comparable(credential)]);
|
|
511
|
-
} catch {
|
|
512
|
-
return "it cannot be resolved to check it for credentials";
|
|
513
|
-
}
|
|
514
|
-
if (candidates.some((candidate) => {
|
|
515
|
-
const fromFilesystemRoot = candidate.slice(parse(candidate).root.length).split(sep).join("/");
|
|
516
|
-
return fromFilesystemRoot !== "" && isDeniedSnapshotPath(fromFilesystemRoot);
|
|
517
|
-
}) || candidates.some((candidate) => locations.some((credential) => within(credential, candidate) || within(candidate, credential)))) return "it is, holds or is inside a location that keeps credentials";
|
|
518
|
-
}
|
|
519
|
-
function buildSegments(declared) {
|
|
520
|
-
return declared.replaceAll("\\", "/").split("/").filter((segment) => segment !== "" && segment !== ".");
|
|
521
|
-
}
|
|
522
|
-
/** Why the build path `declared` is refused, if it is. */
|
|
523
|
-
function refuseBuild(declared) {
|
|
524
|
-
const normalized = declared.replaceAll("\\", "/");
|
|
525
|
-
const segments = buildSegments(declared);
|
|
526
|
-
if (expandsHome(declared) || posix.isAbsolute(normalized) || /^[A-Za-z]:/.test(normalized)) return "a build path must be relative to the repository root";
|
|
527
|
-
if (segments.length === 0 || segments.includes("..") || segments[0] === ".git") return "a build path must be a directory inside the worktree, outside .git";
|
|
528
|
-
const path = segments.join("/").toLowerCase();
|
|
529
|
-
if (isDeniedSnapshotPath(path) || WORKTREE_CREDENTIAL_FILES.has(path)) return "it is or is inside a file that keeps credentials";
|
|
530
|
-
}
|
|
531
|
-
// dist/core/resume/blueprint/prebuild.js
|
|
532
|
-
/**
|
|
533
|
-
* `atomic blueprint prebuild` (#4748): builds a repository ahead of time, in a trusted job such as a default-branch CI
|
|
534
|
-
* run or on a developer's machine, so a later resume claims a ready worktree instead of building one. With `park`, the
|
|
535
|
-
* build output that `resume.cache` declares moves into the seed directory that `atomic blueprint cache-key` names, for a cache
|
|
536
|
-
* save; a resume on another machine adopts it.
|
|
537
|
-
*/
|
|
538
|
-
/** Who holds a worktree while a prebuild builds it. */
|
|
539
|
-
const PREBUILD_OWNER = Object.freeze({
|
|
540
|
-
kind: "prebuild",
|
|
541
|
-
id: "prebuild"
|
|
542
|
-
});
|
|
543
|
-
/**
|
|
544
|
-
* Restores the committed HEAD of the checkout at `root` into a new pooled worktree, builds it with the blueprints
|
|
545
|
-
* (`initialize` and `maintenance`, as a resume does), and leaves it idle for a later resume to claim; the oldest idle
|
|
546
|
-
* worktrees beyond `maxIdlePerRepository` go. Only committed content is restored, filtered by the snapshot deny list,
|
|
547
|
-
* so ignored and untracked files such as `.env` never reach it. A build that fails removes the new worktree and keeps
|
|
548
|
-
* earlier worktrees and seeds. Rejects when the checkout has no remote or uncommitted changes to tracked files, or the
|
|
549
|
-
* restore fails. Runs project code: callers check that the project is trusted.
|
|
550
|
-
*/
|
|
551
|
-
async function prebuildRepository(root, options) {
|
|
552
|
-
const recorder = new ResumeTimingsRecorder();
|
|
553
|
-
const { signal } = options;
|
|
554
|
-
const storeDir = resolve(options.storeDir);
|
|
555
|
-
const { remotes } = await readRepositoryConfig(root, signal);
|
|
556
|
-
if (remotes.length === 0) throw new Error(`${root} has no Git remote; a prebuilt worktree belongs to the repository its remotes name`);
|
|
557
|
-
if ((await runGit([
|
|
558
|
-
"status",
|
|
559
|
-
"--porcelain",
|
|
560
|
-
"-z",
|
|
561
|
-
"--untracked-files=no"
|
|
562
|
-
], {
|
|
563
|
-
cwd: root,
|
|
564
|
-
signal
|
|
565
|
-
})).stdout.length > 0) throw new Error(`${root} has uncommitted changes to tracked files; prebuild builds the committed HEAD`);
|
|
566
|
-
const blobs = new MemorySnapshotBlobStore();
|
|
567
|
-
const capture = await captureWorktreeSnapshot(root, {
|
|
568
|
-
settings: { includeUntracked: false },
|
|
569
|
-
blobs,
|
|
570
|
-
signal
|
|
571
|
-
});
|
|
572
|
-
if (capture.status === "unavailable") throw capture.reason;
|
|
573
|
-
if (capture.status === "disabled") throw new Error("snapshots are disabled");
|
|
574
|
-
const snapshot = capture.snapshot;
|
|
575
|
-
if (snapshot.omitted.some((omission) => omission.reason === "unpushed-history-denied")) throw new Error(`${root} has unpushed commits that touch files that can hold credentials; push or drop them before a prebuild`);
|
|
576
|
-
const state = {
|
|
577
|
-
snapshotId: snapshot.id,
|
|
578
|
-
head: snapshot.head,
|
|
579
|
-
tree: snapshot.tree
|
|
580
|
-
};
|
|
581
|
-
const repository = prebuiltRepositoryOf(snapshot);
|
|
582
|
-
await storeCheckoutHead(storeDir, remotes, snapshot.root, snapshot.head, signal);
|
|
583
|
-
const lease = await admitPooledWorktree({
|
|
584
|
-
storeDir,
|
|
585
|
-
remotes,
|
|
586
|
-
root: snapshot.root,
|
|
587
|
-
lastState: state,
|
|
588
|
-
envHash: snapshot.envHash,
|
|
589
|
-
signal
|
|
590
|
-
}, PREBUILD_OWNER);
|
|
591
|
-
return recorder.run(async () => {
|
|
592
|
-
let build;
|
|
593
|
-
try {
|
|
594
|
-
await timeCheckoutRestore(root, () => restoreWorktreeAt(snapshot, lease.path, {
|
|
595
|
-
storeDir,
|
|
596
|
-
blobs,
|
|
597
|
-
signal
|
|
598
|
-
}), () => "fresh");
|
|
599
|
-
build = await runBlueprintBuild([{
|
|
600
|
-
...blueprintRepository({
|
|
601
|
-
root: lease.path,
|
|
602
|
-
remotes
|
|
603
|
-
}),
|
|
604
|
-
initialize: true
|
|
605
|
-
}], {
|
|
606
|
-
agentDir: options.agentDir,
|
|
607
|
-
storeDir,
|
|
608
|
-
trusted: () => true,
|
|
609
|
-
setupCommand: options.setupCommand
|
|
610
|
-
}, signal);
|
|
611
|
-
} catch (error) {
|
|
612
|
-
await removeRestoredWorktree(lease.path, { storeDir }).catch(() => {});
|
|
613
|
-
await discardPooledWorktree(lease);
|
|
614
|
-
throw error;
|
|
615
|
-
}
|
|
616
|
-
const outcome = {
|
|
617
|
-
head: snapshot.head,
|
|
618
|
-
build,
|
|
619
|
-
parkMs: null,
|
|
620
|
-
parked: [],
|
|
621
|
-
warnings: []
|
|
622
|
-
};
|
|
623
|
-
if (build.status === "partial" || build.status === "failed") {
|
|
624
|
-
await removeRestoredWorktree(lease.path, { storeDir }).catch(() => {});
|
|
625
|
-
await discardPooledWorktree(lease);
|
|
626
|
-
return {
|
|
627
|
-
...outcome,
|
|
628
|
-
status: build.status,
|
|
629
|
-
path: void 0,
|
|
630
|
-
timings: recorder.finish()
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
let parkMs = null;
|
|
634
|
-
try {
|
|
635
|
-
if (options.park) {
|
|
636
|
-
const started = performance.now();
|
|
637
|
-
const keys = await blueprintCacheKeys(root, {
|
|
638
|
-
agentDir: options.agentDir,
|
|
639
|
-
storeDir
|
|
640
|
-
});
|
|
641
|
-
outcome.warnings.push(...keys.warnings);
|
|
642
|
-
const seeds = seedDirectory(storeDir, repository);
|
|
643
|
-
const declared = (keys.entries.find((entry) => entry.name === "build")?.paths ?? []).map((path) => relative(seeds, path).split(sep).join("/")).filter((path) => seedPathSegments(path) !== void 0);
|
|
644
|
-
outcome.parked.push(...await parkBuildOutput(storeDir, lease.path, declared, snapshot, signal));
|
|
645
|
-
parkMs = Math.floor(performance.now() - started);
|
|
646
|
-
}
|
|
647
|
-
} finally {
|
|
648
|
-
await releaseRestoredWorktree(lease, state);
|
|
649
|
-
}
|
|
650
|
-
await evictIdleWorktrees(storeDir, lease.repository, {
|
|
651
|
-
maxIdle: options.maxIdlePerRepository,
|
|
652
|
-
settings: options.settings,
|
|
653
|
-
signal
|
|
654
|
-
});
|
|
655
|
-
return {
|
|
656
|
-
...outcome,
|
|
657
|
-
parkMs,
|
|
658
|
-
status: "built",
|
|
659
|
-
path: lease.path,
|
|
660
|
-
timings: recorder.finish()
|
|
661
|
-
};
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* The repository the prebuilt worktree and seed of the checkout `snapshot` recorded belong to: the one its remotes name,
|
|
666
|
-
* relative paths resolved against its root (#4989). Rejects when they name none.
|
|
667
|
-
*/
|
|
668
|
-
function prebuiltRepositoryOf(snapshot) {
|
|
669
|
-
const repository = sharedRepositoryIdOf(snapshot.remotes, snapshot.root);
|
|
670
|
-
if (repository === void 0) throw new Error(`${snapshot.root} has no Git remote that names its repository; a prebuilt worktree belongs to it`);
|
|
671
|
-
return repository;
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* Moves the files Git does not track under each of `declared`, root-relative, from the worktree at `worktree` into a
|
|
675
|
-
* new seed directory of the repository, which then replaces the earlier one under the seed lock, and writes its
|
|
676
|
-
* manifest. Tracked files stay, so the worktree keeps the tree its pool record names and stays claimable (#4911); a
|
|
677
|
-
* declared path Git tracks nothing under moves whole. A path inside another declared one moves with it; a path that is
|
|
678
|
-
* a symbolic link or lies below one is left alone. Resolves to the paths moved; with none, the earlier seed goes and no
|
|
679
|
-
* manifest is written. A move that fails puts the moved paths back and rejects, keeping the earlier seed.
|
|
680
|
-
*/
|
|
681
|
-
async function parkBuildOutput(storeDir, worktree, declared, snapshot, signal) {
|
|
682
|
-
const repository = prebuiltRepositoryOf(snapshot);
|
|
683
|
-
const target = seedDirectory(storeDir, repository);
|
|
684
|
-
const staging = join(dirname(target), `.parking-${randomUUID()}`);
|
|
685
|
-
const outermost = declared.filter((path, index) => declared.indexOf(path) === index && !declared.some((other) => path.startsWith(`${other}/`)));
|
|
686
|
-
const parked = [];
|
|
687
|
-
await mkdir(staging, { recursive: true });
|
|
688
|
-
try {
|
|
689
|
-
await withSeedLock(storeDir, repository, true, async () => {
|
|
690
|
-
try {
|
|
691
|
-
for (const path of outermost) {
|
|
692
|
-
const segments = seedPathSegments(path);
|
|
693
|
-
const from = join(worktree, ...segments);
|
|
694
|
-
const entry = await lstat(from).catch(() => void 0);
|
|
695
|
-
if (entry === void 0 || entry.isSymbolicLink()) continue;
|
|
696
|
-
if (!await insideThroughDirectories(worktree, segments)) continue;
|
|
697
|
-
for (const untracked of await untrackedUnder(worktree, path)) {
|
|
698
|
-
const parts = seedPathSegments(untracked);
|
|
699
|
-
if (parts === void 0) continue;
|
|
700
|
-
const to = join(staging, ...parts);
|
|
701
|
-
await mkdir(dirname(to), { recursive: true });
|
|
702
|
-
await renameWithRetry(join(worktree, ...parts), to, { signal });
|
|
703
|
-
parked.push(untracked);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
} catch (error) {
|
|
707
|
-
for (const path of [...parked].reverse()) {
|
|
708
|
-
const segments = seedPathSegments(path);
|
|
709
|
-
await renameWithRetry(join(staging, ...segments), join(worktree, ...segments)).catch(() => {});
|
|
1
|
+
// Written by the build (scripts/in-place-update-gate.mjs): when this module's code cannot load in a process of an earlier release
|
|
2
|
+
// that an in-place update left running, the process is told to restart.
|
|
3
|
+
let module;
|
|
4
|
+
try {
|
|
5
|
+
module = await import("./blueprint-command.code.js");
|
|
6
|
+
} catch (error) {
|
|
7
|
+
const root = new URL("../", import.meta.url);
|
|
8
|
+
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
+
const key = `${root.href}#0.10.5-alpha.1`;
|
|
10
|
+
let release = releases.get(key);
|
|
11
|
+
if (release === undefined) {
|
|
12
|
+
const current = (async () => {
|
|
13
|
+
for (const path of ["modes/interactive/interactive-mode-deps.js","_shared/chunk-CDOYTDYM.js","_shared/p0-cli-GUFK7TPN.js"]) {
|
|
14
|
+
try {
|
|
15
|
+
const held = await import(new URL(path, root).href);
|
|
16
|
+
if (typeof held.VERSION === "string") return { version: held.VERSION, name: held.APP_NAME };
|
|
17
|
+
} catch {
|
|
18
|
+
// Not a file this process can load: the next.
|
|
710
19
|
}
|
|
711
|
-
throw error;
|
|
712
20
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
});
|
|
718
|
-
if (parked.length === 0) return;
|
|
719
|
-
await renameWithRetry(staging, target, { signal });
|
|
720
|
-
await writeSeedManifest(storeDir, {
|
|
721
|
-
version: 1,
|
|
722
|
-
repository,
|
|
723
|
-
head: snapshot.head,
|
|
724
|
-
tree: snapshot.tree,
|
|
725
|
-
envHash: snapshot.envHash,
|
|
726
|
-
paths: parked,
|
|
727
|
-
worktree,
|
|
728
|
-
parkedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
729
|
-
});
|
|
21
|
+
return undefined;
|
|
22
|
+
})().then((found) => {
|
|
23
|
+
if (found === undefined && releases.get(key) === current) releases.delete(key);
|
|
24
|
+
return found;
|
|
730
25
|
});
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
await rm(staging, {
|
|
734
|
-
recursive: true,
|
|
735
|
-
force: true
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
/**
|
|
740
|
-
* The untracked and ignored entries under `path` in the worktree at `worktree`, root-relative: `path` itself when Git
|
|
741
|
-
* tracks nothing under it, otherwise each untracked file and each directory holding no tracked file.
|
|
742
|
-
*/
|
|
743
|
-
async function untrackedUnder(worktree, path) {
|
|
744
|
-
const listed = await runGit([
|
|
745
|
-
"ls-files",
|
|
746
|
-
"-z",
|
|
747
|
-
"--others",
|
|
748
|
-
"--directory",
|
|
749
|
-
"--",
|
|
750
|
-
`:(literal)${path}`
|
|
751
|
-
], { cwd: worktree });
|
|
752
|
-
return nulFields(listed.stdout).map((entry) => entry.replace(/\/$/, ""));
|
|
753
|
-
}
|
|
754
|
-
// dist/cli/blueprint-command.js
|
|
755
|
-
/**
|
|
756
|
-
* `atomic blueprint cache-key` prints the cache contract of a repository for a runner's cache action: the package stores
|
|
757
|
-
* its lockfiles name and the paths its `resume.cache` setting adds, plus Atomic's Git object store and extension
|
|
758
|
-
* transpile cache (#4748).
|
|
759
|
-
* `atomic blueprint prebuild` builds a repository ahead of time into an idle worktree a later resume claims, and with
|
|
760
|
-
* `--park` moves its build output where the cache contract's `build` entry saves it from.
|
|
761
|
-
*/
|
|
762
|
-
const HELP = `Usage:
|
|
763
|
-
${APP_NAME} blueprint cache-key [dir] [--format text|json|github-output]
|
|
764
|
-
${APP_NAME} blueprint prebuild [dir] [--park] [--approve]
|
|
765
|
-
|
|
766
|
-
Commands:
|
|
767
|
-
cache-key Print the cache entries of the repository at [dir] (default: the current directory)
|
|
768
|
-
for a runner's cache action such as actions/cache: a key, a restore prefix and the
|
|
769
|
-
paths of each. "stores" holds the package stores detected from the repository's
|
|
770
|
-
lockfiles (npm, pnpm, Yarn, Bun, Cargo, uv, pip, Poetry, Go, Gradle, Maven) plus the
|
|
771
|
-
store paths of the resume.cache setting, "build" that setting's build paths, "git"
|
|
772
|
-
Atomic's Git object store of the repository, and "atomic" Atomic's extension
|
|
773
|
-
transpile cache. Paths that could carry credentials are left out with a warning on
|
|
774
|
-
stderr. Atomic never uploads or downloads caches; save them only from trusted
|
|
775
|
-
default-branch jobs.
|
|
776
|
-
prebuild Restore the committed HEAD of the repository at [dir] into a new restored worktree,
|
|
777
|
-
build it with its blueprints (initialize and maintenance), and leave it idle, so a
|
|
778
|
-
later resume of a session of the repository claims it ready-built. Only committed
|
|
779
|
-
files are restored; ignored and untracked files such as .env are not. A build that
|
|
780
|
-
fails removes the new worktree and keeps earlier ones. Runs project code: only for a
|
|
781
|
-
trusted project ("defaultProjectTrust": "always", a saved decision, or --approve).
|
|
782
|
-
|
|
783
|
-
Options:
|
|
784
|
-
--format <format> text (default), json, or github-output: <name>-key, <name>-restore-prefix and
|
|
785
|
-
<name>-paths lines to append to $GITHUB_OUTPUT
|
|
786
|
-
--park (prebuild) Move the build paths of resume.cache into the seed directory that
|
|
787
|
-
the "build" cache entry saves, for a resume on another machine to adopt
|
|
788
|
-
--approve, -a (prebuild) Trust the project for this run`;
|
|
789
|
-
const FORMATS = [
|
|
790
|
-
"text",
|
|
791
|
-
"json",
|
|
792
|
-
"github-output"
|
|
793
|
-
];
|
|
794
|
-
/** Parse the arguments after `blueprint`. */
|
|
795
|
-
function parseBlueprintCommand(args) {
|
|
796
|
-
const [command, ...rest] = args;
|
|
797
|
-
if (command === void 0 || command === "help" || args.includes("--help") || args.includes("-h")) return { kind: "help" };
|
|
798
|
-
if (command !== "cache-key" && command !== "prebuild") return {
|
|
799
|
-
kind: "error",
|
|
800
|
-
message: `Unknown command "${command}". Use cache-key or prebuild.`
|
|
801
|
-
};
|
|
802
|
-
let format = "text";
|
|
803
|
-
let park = false;
|
|
804
|
-
let approve = false;
|
|
805
|
-
const positional = [];
|
|
806
|
-
for (let index = 0; index < rest.length; index++) {
|
|
807
|
-
const arg = rest[index];
|
|
808
|
-
if (command === "prebuild" && arg === "--park") park = true;
|
|
809
|
-
else if (command === "prebuild" && (arg === "--approve" || arg === "-a")) approve = true;
|
|
810
|
-
else if (command === "cache-key" && (arg === "--format" || arg.startsWith("--format="))) {
|
|
811
|
-
const value = arg === "--format" ? rest[++index] : arg.slice(9);
|
|
812
|
-
const known = FORMATS.find((candidate) => candidate === value);
|
|
813
|
-
if (known === void 0) return {
|
|
814
|
-
kind: "error",
|
|
815
|
-
message: "--format must be text, json or github-output."
|
|
816
|
-
};
|
|
817
|
-
format = known;
|
|
818
|
-
} else if (arg.startsWith("-")) return {
|
|
819
|
-
kind: "error",
|
|
820
|
-
message: `Unknown option ${arg.split("=")[0]}.`
|
|
821
|
-
};
|
|
822
|
-
else positional.push(arg);
|
|
823
|
-
}
|
|
824
|
-
if (positional.length > 1) return {
|
|
825
|
-
kind: "error",
|
|
826
|
-
message: "Pass at most one directory."
|
|
827
|
-
};
|
|
828
|
-
if (command === "prebuild") return {
|
|
829
|
-
kind: "prebuild",
|
|
830
|
-
dir: positional[0],
|
|
831
|
-
park,
|
|
832
|
-
approve
|
|
833
|
-
};
|
|
834
|
-
return {
|
|
835
|
-
kind: "cache-key",
|
|
836
|
-
dir: positional[0],
|
|
837
|
-
format
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
/** Run `atomic blueprint <args>` and return the exit code: 0, 1 when the keys cannot be computed, 2 for bad usage. */
|
|
841
|
-
async function runBlueprintCommand(args, options) {
|
|
842
|
-
const stdout = options.stdout ?? ((text) => process.stdout.write(text));
|
|
843
|
-
const stderr = options.stderr ?? ((text) => process.stderr.write(text));
|
|
844
|
-
const command = parseBlueprintCommand(args);
|
|
845
|
-
if (command.kind === "help") {
|
|
846
|
-
stdout(`${HELP}\n`);
|
|
847
|
-
return 0;
|
|
26
|
+
releases.set(key, current);
|
|
27
|
+
release = current;
|
|
848
28
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
try {
|
|
854
|
-
const root = await repositoryRoot(resolve(options.cwd, command.dir ?? "."));
|
|
855
|
-
if (command.kind === "prebuild") return await prebuild(root, command, options, stdout, stderr);
|
|
856
|
-
const keys = await blueprintCacheKeys(root, {
|
|
857
|
-
agentDir: options.agentDir,
|
|
858
|
-
...options.home === void 0 ? {} : { home: options.home },
|
|
859
|
-
...options.env === void 0 ? {} : { env: options.env }
|
|
860
|
-
});
|
|
861
|
-
for (const warning of keys.warnings) stderr(`Warning: ${warning}\n`);
|
|
862
|
-
stdout(formatBlueprintCacheKeys(keys, command.format));
|
|
863
|
-
return 0;
|
|
864
|
-
} catch (error) {
|
|
865
|
-
stderr(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
866
|
-
return 1;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
/** The top level of the checkout `directory` is in, else `directory` itself. */
|
|
870
|
-
async function repositoryRoot(directory) {
|
|
871
|
-
const { stdout, exitCode } = await runGit(["rev-parse", "--show-toplevel"], {
|
|
872
|
-
cwd: directory,
|
|
873
|
-
allowExitCodes: [128]
|
|
29
|
+
const running = await release;
|
|
30
|
+
if (running === undefined || running.version === "0.10.5-alpha.1") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.5-alpha.1 while this session was running; restart it to keep using this feature.", {
|
|
32
|
+
cause: error,
|
|
874
33
|
});
|
|
875
|
-
return exitCode === 0 ? resolve(stdout.toString("utf8").trim()) : directory;
|
|
876
|
-
}
|
|
877
|
-
/** `atomic blueprint prebuild`: 0 when an idle worktree is ready, 1 when the project is untrusted or the build failed. */
|
|
878
|
-
async function prebuild(root, command, options, stdout, stderr) {
|
|
879
|
-
const settings = SettingsManager.create(root, options.agentDir, { projectTrusted: false });
|
|
880
|
-
if (!(command.approve || (new ProjectTrustStore(options.agentDir).get(root) ?? settings.getDefaultProjectTrust() === "always"))) {
|
|
881
|
-
stderr(`Error: ${root} is not a trusted project, and a prebuild runs its blueprints. Trust it, or pass --approve.\n`);
|
|
882
|
-
return 1;
|
|
883
|
-
}
|
|
884
|
-
const outcome = await prebuildRepository(root, {
|
|
885
|
-
agentDir: options.agentDir,
|
|
886
|
-
storeDir: resumeStoreDir(options.agentDir),
|
|
887
|
-
settings: settings.getWorktreeSnapshotSettings(),
|
|
888
|
-
maxIdlePerRepository: settings.getWorktreePoolSettings().maxIdlePerRepository,
|
|
889
|
-
park: command.park,
|
|
890
|
-
setupCommand: settings.getResumeSetupCommand()
|
|
891
|
-
});
|
|
892
|
-
for (const warning of outcome.warnings) stderr(`Warning: ${warning}\n`);
|
|
893
|
-
for (const line of formatResumeTimings(outcome.timings)) stderr(`${line}\n`);
|
|
894
|
-
if (outcome.path === void 0) {
|
|
895
|
-
const failure = outcome.build.failures[0];
|
|
896
|
-
const log = failure?.logPath ? ` (log: ${failure.logPath})` : "";
|
|
897
|
-
stderr(`Error: the blueprint build of ${outcome.head} did not finish; earlier worktrees and seeds are kept${log}.\n`);
|
|
898
|
-
return 1;
|
|
899
|
-
}
|
|
900
|
-
stdout(`prebuilt ${outcome.head} in ${outcome.path}\n`);
|
|
901
|
-
if (outcome.parkMs !== null) stdout(outcome.parked.length === 0 ? "parked nothing: resume.cache declares no build path that the build produced\n" : `parked ${outcome.parked.join(", ")} in ${(outcome.parkMs / 1e3).toFixed(1)} s\n`);
|
|
902
|
-
return 0;
|
|
903
34
|
}
|
|
904
|
-
export { parseBlueprintCommand, runBlueprintCommand };
|
|
905
|
-
|
|
906
|
-
//# sourceMappingURL=blueprint-command.impl.js.map
|
|
35
|
+
export const { parseBlueprintCommand, runBlueprintCommand } = module;
|
|
36
|
+
//# sourceMappingURL=blueprint-command.impl.js.map
|