looply-cli 0.0.0-stage → 0.3.0
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/LICENSE +21 -0
- package/README.md +137 -3
- package/dist/.src-hash +1 -0
- package/dist/acceptance-observe.d.ts +108 -0
- package/dist/acceptance-observe.d.ts.map +1 -0
- package/dist/acceptance-observe.js +152 -0
- package/dist/acceptance-observe.js.map +1 -0
- package/dist/agent-cmd.d.ts +131 -0
- package/dist/agent-cmd.d.ts.map +1 -0
- package/dist/agent-cmd.js +154 -0
- package/dist/agent-cmd.js.map +1 -0
- package/dist/agent-contained.d.ts +114 -0
- package/dist/agent-contained.d.ts.map +1 -0
- package/dist/agent-contained.js +292 -0
- package/dist/agent-contained.js.map +1 -0
- package/dist/agent-driver.d.ts +130 -0
- package/dist/agent-driver.d.ts.map +1 -0
- package/dist/agent-driver.js +170 -0
- package/dist/agent-driver.js.map +1 -0
- package/dist/agent-envelope.d.ts +94 -0
- package/dist/agent-envelope.d.ts.map +1 -0
- package/dist/agent-envelope.js +214 -0
- package/dist/agent-envelope.js.map +1 -0
- package/dist/agent-exec.d.ts +182 -0
- package/dist/agent-exec.d.ts.map +1 -0
- package/dist/agent-exec.js +125 -0
- package/dist/agent-exec.js.map +1 -0
- package/dist/agent-runtime.d.ts +23 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +143 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/approval-gate-read.d.ts +66 -0
- package/dist/approval-gate-read.d.ts.map +1 -0
- package/dist/approval-gate-read.js +138 -0
- package/dist/approval-gate-read.js.map +1 -0
- package/dist/approval-resolution.d.ts +87 -0
- package/dist/approval-resolution.d.ts.map +1 -0
- package/dist/approval-resolution.js +100 -0
- package/dist/approval-resolution.js.map +1 -0
- package/dist/approval-resumes.d.ts +102 -0
- package/dist/approval-resumes.d.ts.map +1 -0
- package/dist/approval-resumes.js +167 -0
- package/dist/approval-resumes.js.map +1 -0
- package/dist/ask-brain.d.ts +167 -0
- package/dist/ask-brain.d.ts.map +1 -0
- package/dist/ask-brain.js +355 -0
- package/dist/ask-brain.js.map +1 -0
- package/dist/autonomy-authority.d.ts +80 -0
- package/dist/autonomy-authority.d.ts.map +1 -0
- package/dist/autonomy-authority.js +82 -0
- package/dist/autonomy-authority.js.map +1 -0
- package/dist/autonomy-controller.d.ts +321 -0
- package/dist/autonomy-controller.d.ts.map +1 -0
- package/dist/autonomy-controller.js +517 -0
- package/dist/autonomy-controller.js.map +1 -0
- package/dist/autonomy-store.d.ts +327 -0
- package/dist/autonomy-store.d.ts.map +1 -0
- package/dist/autonomy-store.js +581 -0
- package/dist/autonomy-store.js.map +1 -0
- package/dist/autonomy-tick.d.ts +257 -0
- package/dist/autonomy-tick.d.ts.map +1 -0
- package/dist/autonomy-tick.js +616 -0
- package/dist/autonomy-tick.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +2727 -0
- package/dist/bin.js.map +1 -0
- package/dist/brain-advice.d.ts +21 -0
- package/dist/brain-advice.d.ts.map +1 -0
- package/dist/brain-advice.js +51 -0
- package/dist/brain-advice.js.map +1 -0
- package/dist/candidate-replay-runtime.d.ts +125 -0
- package/dist/candidate-replay-runtime.d.ts.map +1 -0
- package/dist/candidate-replay-runtime.js +188 -0
- package/dist/candidate-replay-runtime.js.map +1 -0
- package/dist/checkout-carry.d.ts +76 -0
- package/dist/checkout-carry.d.ts.map +1 -0
- package/dist/checkout-carry.js +125 -0
- package/dist/checkout-carry.js.map +1 -0
- package/dist/citation-readers.d.ts +26 -0
- package/dist/citation-readers.d.ts.map +1 -0
- package/dist/citation-readers.js +102 -0
- package/dist/citation-readers.js.map +1 -0
- package/dist/command-receipts.d.ts +79 -0
- package/dist/command-receipts.d.ts.map +1 -0
- package/dist/command-receipts.js +143 -0
- package/dist/command-receipts.js.map +1 -0
- package/dist/command-runner.d.ts +32 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +108 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/compatible-sets.d.ts +67 -0
- package/dist/compatible-sets.d.ts.map +1 -0
- package/dist/compatible-sets.js +81 -0
- package/dist/compatible-sets.js.map +1 -0
- package/dist/compile-check.d.ts +31 -0
- package/dist/compile-check.d.ts.map +1 -0
- package/dist/compile-check.js +34 -0
- package/dist/compile-check.js.map +1 -0
- package/dist/compile-store.d.ts +16 -0
- package/dist/compile-store.d.ts.map +1 -0
- package/dist/compile-store.js +21 -0
- package/dist/compile-store.js.map +1 -0
- package/dist/completion.d.ts +106 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +131 -0
- package/dist/completion.js.map +1 -0
- package/dist/config.d.ts +549 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +763 -0
- package/dist/config.js.map +1 -0
- package/dist/control-file.d.ts +142 -0
- package/dist/control-file.d.ts.map +1 -0
- package/dist/control-file.js +144 -0
- package/dist/control-file.js.map +1 -0
- package/dist/coordinator-state.d.ts +131 -0
- package/dist/coordinator-state.d.ts.map +1 -0
- package/dist/coordinator-state.js +380 -0
- package/dist/coordinator-state.js.map +1 -0
- package/dist/coordinator.d.ts +95 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +97 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/cursor-store.d.ts +53 -0
- package/dist/cursor-store.d.ts.map +1 -0
- package/dist/cursor-store.js +98 -0
- package/dist/cursor-store.js.map +1 -0
- package/dist/daemon-cmd.d.ts +239 -0
- package/dist/daemon-cmd.d.ts.map +1 -0
- package/dist/daemon-cmd.js +1751 -0
- package/dist/daemon-cmd.js.map +1 -0
- package/dist/daemon-lock.d.ts +140 -0
- package/dist/daemon-lock.d.ts.map +1 -0
- package/dist/daemon-lock.js +352 -0
- package/dist/daemon-lock.js.map +1 -0
- package/dist/daemon-recovery.d.ts +78 -0
- package/dist/daemon-recovery.d.ts.map +1 -0
- package/dist/daemon-recovery.js +161 -0
- package/dist/daemon-recovery.js.map +1 -0
- package/dist/daemon.d.ts +368 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +601 -0
- package/dist/daemon.js.map +1 -0
- package/dist/declared-response-shape.d.ts +93 -0
- package/dist/declared-response-shape.d.ts.map +1 -0
- package/dist/declared-response-shape.js +200 -0
- package/dist/declared-response-shape.js.map +1 -0
- package/dist/declared-surfaces.d.ts +16 -0
- package/dist/declared-surfaces.d.ts.map +1 -0
- package/dist/declared-surfaces.js +19 -0
- package/dist/declared-surfaces.js.map +1 -0
- package/dist/depends-review.d.ts +113 -0
- package/dist/depends-review.d.ts.map +1 -0
- package/dist/depends-review.js +110 -0
- package/dist/depends-review.js.map +1 -0
- package/dist/doctor.d.ts +91 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +71 -0
- package/dist/doctor.js.map +1 -0
- package/dist/edge-approval.d.ts +105 -0
- package/dist/edge-approval.d.ts.map +1 -0
- package/dist/edge-approval.js +100 -0
- package/dist/edge-approval.js.map +1 -0
- package/dist/evidence-cache.d.ts +45 -0
- package/dist/evidence-cache.d.ts.map +1 -0
- package/dist/evidence-cache.js +90 -0
- package/dist/evidence-cache.js.map +1 -0
- package/dist/evidence-cmd.d.ts +133 -0
- package/dist/evidence-cmd.d.ts.map +1 -0
- package/dist/evidence-cmd.js +347 -0
- package/dist/evidence-cmd.js.map +1 -0
- package/dist/evidence-facts.d.ts +40 -0
- package/dist/evidence-facts.d.ts.map +1 -0
- package/dist/evidence-facts.js +114 -0
- package/dist/evidence-facts.js.map +1 -0
- package/dist/exclusive-lock.d.ts +52 -0
- package/dist/exclusive-lock.d.ts.map +1 -0
- package/dist/exclusive-lock.js +150 -0
- package/dist/exclusive-lock.js.map +1 -0
- package/dist/exec-domains.d.ts +140 -0
- package/dist/exec-domains.d.ts.map +1 -0
- package/dist/exec-domains.js +287 -0
- package/dist/exec-domains.js.map +1 -0
- package/dist/exemption-store.d.ts +197 -0
- package/dist/exemption-store.d.ts.map +1 -0
- package/dist/exemption-store.js +266 -0
- package/dist/exemption-store.js.map +1 -0
- package/dist/explicit-start-gate.d.ts +96 -0
- package/dist/explicit-start-gate.d.ts.map +1 -0
- package/dist/explicit-start-gate.js +103 -0
- package/dist/explicit-start-gate.js.map +1 -0
- package/dist/fs-trouble.d.ts +70 -0
- package/dist/fs-trouble.d.ts.map +1 -0
- package/dist/fs-trouble.js +98 -0
- package/dist/fs-trouble.js.map +1 -0
- package/dist/gate.d.ts +278 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +278 -0
- package/dist/gate.js.map +1 -0
- package/dist/git-driver.d.ts +519 -0
- package/dist/git-driver.d.ts.map +1 -0
- package/dist/git-driver.js +900 -0
- package/dist/git-driver.js.map +1 -0
- package/dist/git-push-executor.d.ts +41 -0
- package/dist/git-push-executor.d.ts.map +1 -0
- package/dist/git-push-executor.js +142 -0
- package/dist/git-push-executor.js.map +1 -0
- package/dist/glob.d.ts +26 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +93 -0
- package/dist/glob.js.map +1 -0
- package/dist/goal-adaptive.d.ts +295 -0
- package/dist/goal-adaptive.d.ts.map +1 -0
- package/dist/goal-adaptive.js +393 -0
- package/dist/goal-adaptive.js.map +1 -0
- package/dist/goal-compile.d.ts +342 -0
- package/dist/goal-compile.d.ts.map +1 -0
- package/dist/goal-compile.js +444 -0
- package/dist/goal-compile.js.map +1 -0
- package/dist/goal-depends-executor.d.ts +55 -0
- package/dist/goal-depends-executor.d.ts.map +1 -0
- package/dist/goal-depends-executor.js +202 -0
- package/dist/goal-depends-executor.js.map +1 -0
- package/dist/goal-execution-evidence.d.ts +135 -0
- package/dist/goal-execution-evidence.d.ts.map +1 -0
- package/dist/goal-execution-evidence.js +159 -0
- package/dist/goal-execution-evidence.js.map +1 -0
- package/dist/goal-gap.d.ts +140 -0
- package/dist/goal-gap.d.ts.map +1 -0
- package/dist/goal-gap.js +197 -0
- package/dist/goal-gap.js.map +1 -0
- package/dist/goal-met-target.d.ts +98 -0
- package/dist/goal-met-target.d.ts.map +1 -0
- package/dist/goal-met-target.js +92 -0
- package/dist/goal-met-target.js.map +1 -0
- package/dist/goal-ownership.d.ts +416 -0
- package/dist/goal-ownership.d.ts.map +1 -0
- package/dist/goal-ownership.js +576 -0
- package/dist/goal-ownership.js.map +1 -0
- package/dist/goal-runs.d.ts +82 -0
- package/dist/goal-runs.d.ts.map +1 -0
- package/dist/goal-runs.js +120 -0
- package/dist/goal-runs.js.map +1 -0
- package/dist/goal-store.d.ts +146 -0
- package/dist/goal-store.d.ts.map +1 -0
- package/dist/goal-store.js +294 -0
- package/dist/goal-store.js.map +1 -0
- package/dist/goal-view.d.ts +156 -0
- package/dist/goal-view.d.ts.map +1 -0
- package/dist/goal-view.js +499 -0
- package/dist/goal-view.js.map +1 -0
- package/dist/governed-approvals.d.ts +152 -0
- package/dist/governed-approvals.d.ts.map +1 -0
- package/dist/governed-approvals.js +246 -0
- package/dist/governed-approvals.js.map +1 -0
- package/dist/governed-broker.d.ts +169 -0
- package/dist/governed-broker.d.ts.map +1 -0
- package/dist/governed-broker.js +196 -0
- package/dist/governed-broker.js.map +1 -0
- package/dist/governed-run.d.ts +220 -0
- package/dist/governed-run.d.ts.map +1 -0
- package/dist/governed-run.js +406 -0
- package/dist/governed-run.js.map +1 -0
- package/dist/grant-reconcile.d.ts +63 -0
- package/dist/grant-reconcile.d.ts.map +1 -0
- package/dist/grant-reconcile.js +121 -0
- package/dist/grant-reconcile.js.map +1 -0
- package/dist/index-for-head.d.ts +56 -0
- package/dist/index-for-head.d.ts.map +1 -0
- package/dist/index-for-head.js +103 -0
- package/dist/index-for-head.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/init-detect.d.ts +39 -0
- package/dist/init-detect.d.ts.map +1 -0
- package/dist/init-detect.js +188 -0
- package/dist/init-detect.js.map +1 -0
- package/dist/integration-deps.d.ts +62 -0
- package/dist/integration-deps.d.ts.map +1 -0
- package/dist/integration-deps.js +251 -0
- package/dist/integration-deps.js.map +1 -0
- package/dist/integration-runtime.d.ts +458 -0
- package/dist/integration-runtime.d.ts.map +1 -0
- package/dist/integration-runtime.js +681 -0
- package/dist/integration-runtime.js.map +1 -0
- package/dist/integration.d.ts +45 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +87 -0
- package/dist/integration.js.map +1 -0
- package/dist/integrator.d.ts +84 -0
- package/dist/integrator.d.ts.map +1 -0
- package/dist/integrator.js +193 -0
- package/dist/integrator.js.map +1 -0
- package/dist/lane-claims.d.ts +174 -0
- package/dist/lane-claims.d.ts.map +1 -0
- package/dist/lane-claims.js +218 -0
- package/dist/lane-claims.js.map +1 -0
- package/dist/lane-coverage.d.ts +87 -0
- package/dist/lane-coverage.d.ts.map +1 -0
- package/dist/lane-coverage.js +129 -0
- package/dist/lane-coverage.js.map +1 -0
- package/dist/ledger-replay.d.ts +115 -0
- package/dist/ledger-replay.d.ts.map +1 -0
- package/dist/ledger-replay.js +155 -0
- package/dist/ledger-replay.js.map +1 -0
- package/dist/ledger-store.d.ts +68 -0
- package/dist/ledger-store.d.ts.map +1 -0
- package/dist/ledger-store.js +111 -0
- package/dist/ledger-store.js.map +1 -0
- package/dist/loop-safety-observer.d.ts +132 -0
- package/dist/loop-safety-observer.d.ts.map +1 -0
- package/dist/loop-safety-observer.js +76 -0
- package/dist/loop-safety-observer.js.map +1 -0
- package/dist/loop-safety-store.d.ts +339 -0
- package/dist/loop-safety-store.d.ts.map +1 -0
- package/dist/loop-safety-store.js +800 -0
- package/dist/loop-safety-store.js.map +1 -0
- package/dist/machine-store.d.ts +54 -0
- package/dist/machine-store.d.ts.map +1 -0
- package/dist/machine-store.js +149 -0
- package/dist/machine-store.js.map +1 -0
- package/dist/mcp-main.d.ts +2 -0
- package/dist/mcp-main.d.ts.map +1 -0
- package/dist/mcp-main.js +116 -0
- package/dist/mcp-main.js.map +1 -0
- package/dist/mcp-server.d.ts +72 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +259 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/model-routing.d.ts +75 -0
- package/dist/model-routing.d.ts.map +1 -0
- package/dist/model-routing.js +108 -0
- package/dist/model-routing.js.map +1 -0
- package/dist/model-transport.d.ts +188 -0
- package/dist/model-transport.d.ts.map +1 -0
- package/dist/model-transport.js +625 -0
- package/dist/model-transport.js.map +1 -0
- package/dist/notify-cadence.d.ts +55 -0
- package/dist/notify-cadence.d.ts.map +1 -0
- package/dist/notify-cadence.js +68 -0
- package/dist/notify-cadence.js.map +1 -0
- package/dist/notify-channel.d.ts +69 -0
- package/dist/notify-channel.d.ts.map +1 -0
- package/dist/notify-channel.js +151 -0
- package/dist/notify-channel.js.map +1 -0
- package/dist/notify.d.ts +71 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +125 -0
- package/dist/notify.js.map +1 -0
- package/dist/observation-inventory.d.ts +65 -0
- package/dist/observation-inventory.d.ts.map +1 -0
- package/dist/observation-inventory.js +139 -0
- package/dist/observation-inventory.js.map +1 -0
- package/dist/owned-children.d.ts +45 -0
- package/dist/owned-children.d.ts.map +1 -0
- package/dist/owned-children.js +64 -0
- package/dist/owned-children.js.map +1 -0
- package/dist/packet-for-goal.d.ts +19 -0
- package/dist/packet-for-goal.d.ts.map +1 -0
- package/dist/packet-for-goal.js +32 -0
- package/dist/packet-for-goal.js.map +1 -0
- package/dist/pair-cmd.d.ts +85 -0
- package/dist/pair-cmd.d.ts.map +1 -0
- package/dist/pair-cmd.js +205 -0
- package/dist/pair-cmd.js.map +1 -0
- package/dist/partial-asker.d.ts +96 -0
- package/dist/partial-asker.d.ts.map +1 -0
- package/dist/partial-asker.js +117 -0
- package/dist/partial-asker.js.map +1 -0
- package/dist/pdf-text-lines.d.ts +17 -0
- package/dist/pdf-text-lines.d.ts.map +1 -0
- package/dist/pdf-text-lines.js +70 -0
- package/dist/pdf-text-lines.js.map +1 -0
- package/dist/pdf-text-worker.d.ts +2 -0
- package/dist/pdf-text-worker.d.ts.map +1 -0
- package/dist/pdf-text-worker.js +81 -0
- package/dist/pdf-text-worker.js.map +1 -0
- package/dist/pdf-text.d.ts +56 -0
- package/dist/pdf-text.d.ts.map +1 -0
- package/dist/pdf-text.js +64 -0
- package/dist/pdf-text.js.map +1 -0
- package/dist/pending-action.d.ts +154 -0
- package/dist/pending-action.d.ts.map +1 -0
- package/dist/pending-action.js +148 -0
- package/dist/pending-action.js.map +1 -0
- package/dist/preemptor.d.ts +40 -0
- package/dist/preemptor.d.ts.map +1 -0
- package/dist/preemptor.js +49 -0
- package/dist/preemptor.js.map +1 -0
- package/dist/programme-mode.d.ts +29 -0
- package/dist/programme-mode.d.ts.map +1 -0
- package/dist/programme-mode.js +50 -0
- package/dist/programme-mode.js.map +1 -0
- package/dist/progress-view.d.ts +14 -0
- package/dist/progress-view.d.ts.map +1 -0
- package/dist/progress-view.js +114 -0
- package/dist/progress-view.js.map +1 -0
- package/dist/project-graph-builder.d.ts +81 -0
- package/dist/project-graph-builder.d.ts.map +1 -0
- package/dist/project-graph-builder.js +246 -0
- package/dist/project-graph-builder.js.map +1 -0
- package/dist/project-graph-runtime.d.ts +86 -0
- package/dist/project-graph-runtime.d.ts.map +1 -0
- package/dist/project-graph-runtime.js +112 -0
- package/dist/project-graph-runtime.js.map +1 -0
- package/dist/project-index-builder.d.ts +96 -0
- package/dist/project-index-builder.d.ts.map +1 -0
- package/dist/project-index-builder.js +298 -0
- package/dist/project-index-builder.js.map +1 -0
- package/dist/project-index-facts.d.ts +51 -0
- package/dist/project-index-facts.d.ts.map +1 -0
- package/dist/project-index-facts.js +117 -0
- package/dist/project-index-facts.js.map +1 -0
- package/dist/project-index-store.d.ts +97 -0
- package/dist/project-index-store.d.ts.map +1 -0
- package/dist/project-index-store.js +140 -0
- package/dist/project-index-store.js.map +1 -0
- package/dist/project-memory-store.d.ts +127 -0
- package/dist/project-memory-store.d.ts.map +1 -0
- package/dist/project-memory-store.js +302 -0
- package/dist/project-memory-store.js.map +1 -0
- package/dist/proposal-store.d.ts +14 -0
- package/dist/proposal-store.d.ts.map +1 -0
- package/dist/proposal-store.js +19 -0
- package/dist/proposal-store.js.map +1 -0
- package/dist/prover.d.ts +80 -0
- package/dist/prover.d.ts.map +1 -0
- package/dist/prover.js +137 -0
- package/dist/prover.js.map +1 -0
- package/dist/provider-identity-store.d.ts +34 -0
- package/dist/provider-identity-store.d.ts.map +1 -0
- package/dist/provider-identity-store.js +72 -0
- package/dist/provider-identity-store.js.map +1 -0
- package/dist/provider-identity.d.ts +104 -0
- package/dist/provider-identity.d.ts.map +1 -0
- package/dist/provider-identity.js +167 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/provider-limit.d.ts +79 -0
- package/dist/provider-limit.d.ts.map +1 -0
- package/dist/provider-limit.js +148 -0
- package/dist/provider-limit.js.map +1 -0
- package/dist/provider-preflight.d.ts +171 -0
- package/dist/provider-preflight.d.ts.map +1 -0
- package/dist/provider-preflight.js +395 -0
- package/dist/provider-preflight.js.map +1 -0
- package/dist/provider-state.d.ts +120 -0
- package/dist/provider-state.d.ts.map +1 -0
- package/dist/provider-state.js +182 -0
- package/dist/provider-state.js.map +1 -0
- package/dist/providers.d.ts +132 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +161 -0
- package/dist/providers.js.map +1 -0
- package/dist/publication-recorder.d.ts +117 -0
- package/dist/publication-recorder.d.ts.map +1 -0
- package/dist/publication-recorder.js +124 -0
- package/dist/publication-recorder.js.map +1 -0
- package/dist/pursuit-delivery.d.ts +24 -0
- package/dist/pursuit-delivery.d.ts.map +1 -0
- package/dist/pursuit-delivery.js +38 -0
- package/dist/pursuit-delivery.js.map +1 -0
- package/dist/queue-store.d.ts +132 -0
- package/dist/queue-store.d.ts.map +1 -0
- package/dist/queue-store.js +185 -0
- package/dist/queue-store.js.map +1 -0
- package/dist/queue-summary.d.ts +14 -0
- package/dist/queue-summary.d.ts.map +1 -0
- package/dist/queue-summary.js +82 -0
- package/dist/queue-summary.js.map +1 -0
- package/dist/queue-view.d.ts +20 -0
- package/dist/queue-view.d.ts.map +1 -0
- package/dist/queue-view.js +163 -0
- package/dist/queue-view.js.map +1 -0
- package/dist/queue-write-lease.d.ts +106 -0
- package/dist/queue-write-lease.d.ts.map +1 -0
- package/dist/queue-write-lease.js +282 -0
- package/dist/queue-write-lease.js.map +1 -0
- package/dist/rails-home.d.ts +162 -0
- package/dist/rails-home.d.ts.map +1 -0
- package/dist/rails-home.js +452 -0
- package/dist/rails-home.js.map +1 -0
- package/dist/rails-migrations.d.ts +75 -0
- package/dist/rails-migrations.d.ts.map +1 -0
- package/dist/rails-migrations.js +199 -0
- package/dist/rails-migrations.js.map +1 -0
- package/dist/rails-stores.d.ts +49 -0
- package/dist/rails-stores.d.ts.map +1 -0
- package/dist/rails-stores.js +100 -0
- package/dist/rails-stores.js.map +1 -0
- package/dist/reaper.d.ts +69 -0
- package/dist/reaper.d.ts.map +1 -0
- package/dist/reaper.js +152 -0
- package/dist/reaper.js.map +1 -0
- package/dist/record-store.d.ts +36 -0
- package/dist/record-store.d.ts.map +1 -0
- package/dist/record-store.js +78 -0
- package/dist/record-store.js.map +1 -0
- package/dist/recovery-io.d.ts +50 -0
- package/dist/recovery-io.d.ts.map +1 -0
- package/dist/recovery-io.js +122 -0
- package/dist/recovery-io.js.map +1 -0
- package/dist/recovery.d.ts +146 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +110 -0
- package/dist/recovery.js.map +1 -0
- package/dist/redraw.d.ts +34 -0
- package/dist/redraw.d.ts.map +1 -0
- package/dist/redraw.js +62 -0
- package/dist/redraw.js.map +1 -0
- package/dist/rejected-evidence.d.ts +255 -0
- package/dist/rejected-evidence.d.ts.map +1 -0
- package/dist/rejected-evidence.js +324 -0
- package/dist/rejected-evidence.js.map +1 -0
- package/dist/report-cmd.d.ts +32 -0
- package/dist/report-cmd.d.ts.map +1 -0
- package/dist/report-cmd.js +201 -0
- package/dist/report-cmd.js.map +1 -0
- package/dist/repos-cmd.d.ts +80 -0
- package/dist/repos-cmd.d.ts.map +1 -0
- package/dist/repos-cmd.js +240 -0
- package/dist/repos-cmd.js.map +1 -0
- package/dist/request-body-shape.d.ts +93 -0
- package/dist/request-body-shape.d.ts.map +1 -0
- package/dist/request-body-shape.js +407 -0
- package/dist/request-body-shape.js.map +1 -0
- package/dist/requirement-claims.d.ts +89 -0
- package/dist/requirement-claims.d.ts.map +1 -0
- package/dist/requirement-claims.js +92 -0
- package/dist/requirement-claims.js.map +1 -0
- package/dist/retention-apply-runtime.d.ts +105 -0
- package/dist/retention-apply-runtime.d.ts.map +1 -0
- package/dist/retention-apply-runtime.js +269 -0
- package/dist/retention-apply-runtime.js.map +1 -0
- package/dist/reverify.d.ts +41 -0
- package/dist/reverify.d.ts.map +1 -0
- package/dist/reverify.js +69 -0
- package/dist/reverify.js.map +1 -0
- package/dist/round-records.d.ts +65 -0
- package/dist/round-records.d.ts.map +1 -0
- package/dist/round-records.js +61 -0
- package/dist/round-records.js.map +1 -0
- package/dist/round-runner.d.ts +924 -0
- package/dist/round-runner.d.ts.map +1 -0
- package/dist/round-runner.js +1693 -0
- package/dist/round-runner.js.map +1 -0
- package/dist/run-approval.d.ts +180 -0
- package/dist/run-approval.d.ts.map +1 -0
- package/dist/run-approval.js +199 -0
- package/dist/run-approval.js.map +1 -0
- package/dist/run-cmd.d.ts +359 -0
- package/dist/run-cmd.d.ts.map +1 -0
- package/dist/run-cmd.js +4418 -0
- package/dist/run-cmd.js.map +1 -0
- package/dist/run-delivery.d.ts +71 -0
- package/dist/run-delivery.d.ts.map +1 -0
- package/dist/run-delivery.js +104 -0
- package/dist/run-delivery.js.map +1 -0
- package/dist/run-ended.d.ts +75 -0
- package/dist/run-ended.d.ts.map +1 -0
- package/dist/run-ended.js +27 -0
- package/dist/run-ended.js.map +1 -0
- package/dist/run-ending-locator.d.ts +125 -0
- package/dist/run-ending-locator.d.ts.map +1 -0
- package/dist/run-ending-locator.js +133 -0
- package/dist/run-ending-locator.js.map +1 -0
- package/dist/run-launcher.d.ts +459 -0
- package/dist/run-launcher.d.ts.map +1 -0
- package/dist/run-launcher.js +652 -0
- package/dist/run-launcher.js.map +1 -0
- package/dist/run-lease.d.ts +208 -0
- package/dist/run-lease.d.ts.map +1 -0
- package/dist/run-lease.js +301 -0
- package/dist/run-lease.js.map +1 -0
- package/dist/run-refusal-marks.d.ts +189 -0
- package/dist/run-refusal-marks.d.ts.map +1 -0
- package/dist/run-refusal-marks.js +249 -0
- package/dist/run-refusal-marks.js.map +1 -0
- package/dist/run-start-marks.d.ts +153 -0
- package/dist/run-start-marks.d.ts.map +1 -0
- package/dist/run-start-marks.js +269 -0
- package/dist/run-start-marks.js.map +1 -0
- package/dist/scan-cmd.d.ts +14 -0
- package/dist/scan-cmd.d.ts.map +1 -0
- package/dist/scan-cmd.js +270 -0
- package/dist/scan-cmd.js.map +1 -0
- package/dist/scan-events.d.ts +50 -0
- package/dist/scan-events.d.ts.map +1 -0
- package/dist/scan-events.js +91 -0
- package/dist/scan-events.js.map +1 -0
- package/dist/scan.d.ts +191 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +417 -0
- package/dist/scan.js.map +1 -0
- package/dist/scope-rule.d.ts +148 -0
- package/dist/scope-rule.d.ts.map +1 -0
- package/dist/scope-rule.js +121 -0
- package/dist/scope-rule.js.map +1 -0
- package/dist/self-repo-id.d.ts +18 -0
- package/dist/self-repo-id.d.ts.map +1 -0
- package/dist/self-repo-id.js +70 -0
- package/dist/self-repo-id.js.map +1 -0
- package/dist/serve-cmd.d.ts +115 -0
- package/dist/serve-cmd.d.ts.map +1 -0
- package/dist/serve-cmd.js +505 -0
- package/dist/serve-cmd.js.map +1 -0
- package/dist/serve.d.ts +167 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +336 -0
- package/dist/serve.js.map +1 -0
- package/dist/server-client.d.ts +766 -0
- package/dist/server-client.d.ts.map +1 -0
- package/dist/server-client.js +475 -0
- package/dist/server-client.js.map +1 -0
- package/dist/session-adapter-runtime.d.ts +195 -0
- package/dist/session-adapter-runtime.d.ts.map +1 -0
- package/dist/session-adapter-runtime.js +373 -0
- package/dist/session-adapter-runtime.js.map +1 -0
- package/dist/session-checkpoint-runtime.d.ts +62 -0
- package/dist/session-checkpoint-runtime.d.ts.map +1 -0
- package/dist/session-checkpoint-runtime.js +268 -0
- package/dist/session-checkpoint-runtime.js.map +1 -0
- package/dist/session-control-transport.d.ts +106 -0
- package/dist/session-control-transport.d.ts.map +1 -0
- package/dist/session-control-transport.js +232 -0
- package/dist/session-control-transport.js.map +1 -0
- package/dist/session-observation-store.d.ts +98 -0
- package/dist/session-observation-store.d.ts.map +1 -0
- package/dist/session-observation-store.js +155 -0
- package/dist/session-observation-store.js.map +1 -0
- package/dist/session-observe-runtime.d.ts +123 -0
- package/dist/session-observe-runtime.d.ts.map +1 -0
- package/dist/session-observe-runtime.js +317 -0
- package/dist/session-observe-runtime.js.map +1 -0
- package/dist/session-store.d.ts +98 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +116 -0
- package/dist/session-store.js.map +1 -0
- package/dist/sessions-cmd.d.ts +202 -0
- package/dist/sessions-cmd.d.ts.map +1 -0
- package/dist/sessions-cmd.js +609 -0
- package/dist/sessions-cmd.js.map +1 -0
- package/dist/settings-overlay.d.ts +53 -0
- package/dist/settings-overlay.d.ts.map +1 -0
- package/dist/settings-overlay.js +175 -0
- package/dist/settings-overlay.js.map +1 -0
- package/dist/setup-prompt.d.ts +34 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/setup-prompt.js +92 -0
- package/dist/setup-prompt.js.map +1 -0
- package/dist/setup.d.ts +103 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +283 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared-grants.d.ts +164 -0
- package/dist/shared-grants.d.ts.map +1 -0
- package/dist/shared-grants.js +242 -0
- package/dist/shared-grants.js.map +1 -0
- package/dist/signals.d.ts +55 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +85 -0
- package/dist/signals.js.map +1 -0
- package/dist/source-cmd.d.ts +201 -0
- package/dist/source-cmd.d.ts.map +1 -0
- package/dist/source-cmd.js +684 -0
- package/dist/source-cmd.js.map +1 -0
- package/dist/source-verdict.d.ts +99 -0
- package/dist/source-verdict.d.ts.map +1 -0
- package/dist/source-verdict.js +182 -0
- package/dist/source-verdict.js.map +1 -0
- package/dist/spend-ledger.d.ts +350 -0
- package/dist/spend-ledger.d.ts.map +1 -0
- package/dist/spend-ledger.js +546 -0
- package/dist/spend-ledger.js.map +1 -0
- package/dist/stale-run-sweep.d.ts +79 -0
- package/dist/stale-run-sweep.d.ts.map +1 -0
- package/dist/stale-run-sweep.js +116 -0
- package/dist/stale-run-sweep.js.map +1 -0
- package/dist/start-attempts.d.ts +385 -0
- package/dist/start-attempts.d.ts.map +1 -0
- package/dist/start-attempts.js +613 -0
- package/dist/start-attempts.js.map +1 -0
- package/dist/status-cmd.d.ts +28 -0
- package/dist/status-cmd.d.ts.map +1 -0
- package/dist/status-cmd.js +116 -0
- package/dist/status-cmd.js.map +1 -0
- package/dist/stop-follow-up.d.ts +107 -0
- package/dist/stop-follow-up.d.ts.map +1 -0
- package/dist/stop-follow-up.js +172 -0
- package/dist/stop-follow-up.js.map +1 -0
- package/dist/surface-lease.d.ts +118 -0
- package/dist/surface-lease.d.ts.map +1 -0
- package/dist/surface-lease.js +485 -0
- package/dist/surface-lease.js.map +1 -0
- package/dist/sync.d.ts +54 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +93 -0
- package/dist/sync.js.map +1 -0
- package/dist/syncing-ledger.d.ts +45 -0
- package/dist/syncing-ledger.d.ts.map +1 -0
- package/dist/syncing-ledger.js +53 -0
- package/dist/syncing-ledger.js.map +1 -0
- package/dist/temp-fixtures.d.ts +68 -0
- package/dist/temp-fixtures.d.ts.map +1 -0
- package/dist/temp-fixtures.js +38 -0
- package/dist/temp-fixtures.js.map +1 -0
- package/dist/token-window.d.ts +84 -0
- package/dist/token-window.d.ts.map +1 -0
- package/dist/token-window.js +143 -0
- package/dist/token-window.js.map +1 -0
- package/dist/tool-bridge.d.ts +177 -0
- package/dist/tool-bridge.d.ts.map +1 -0
- package/dist/tool-bridge.js +329 -0
- package/dist/tool-bridge.js.map +1 -0
- package/dist/tool-call-record.d.ts +197 -0
- package/dist/tool-call-record.d.ts.map +1 -0
- package/dist/tool-call-record.js +276 -0
- package/dist/tool-call-record.js.map +1 -0
- package/dist/tool-protocol.d.ts +135 -0
- package/dist/tool-protocol.d.ts.map +1 -0
- package/dist/tool-protocol.js +104 -0
- package/dist/tool-protocol.js.map +1 -0
- package/dist/tool-worker.d.ts +3 -0
- package/dist/tool-worker.d.ts.map +1 -0
- package/dist/tool-worker.js +478 -0
- package/dist/tool-worker.js.map +1 -0
- package/dist/toolchain-mirror.d.ts +86 -0
- package/dist/toolchain-mirror.d.ts.map +1 -0
- package/dist/toolchain-mirror.js +307 -0
- package/dist/toolchain-mirror.js.map +1 -0
- package/dist/trusted-git.d.ts +243 -0
- package/dist/trusted-git.d.ts.map +1 -0
- package/dist/trusted-git.js +920 -0
- package/dist/trusted-git.js.map +1 -0
- package/dist/ui.d.ts +76 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +118 -0
- package/dist/ui.js.map +1 -0
- package/dist/untrusted-exec.d.ts +275 -0
- package/dist/untrusted-exec.d.ts.map +1 -0
- package/dist/untrusted-exec.js +479 -0
- package/dist/untrusted-exec.js.map +1 -0
- package/dist/untrusted-gate.d.ts +73 -0
- package/dist/untrusted-gate.d.ts.map +1 -0
- package/dist/untrusted-gate.js +226 -0
- package/dist/untrusted-gate.js.map +1 -0
- package/dist/uploader.d.ts +153 -0
- package/dist/uploader.d.ts.map +1 -0
- package/dist/uploader.js +204 -0
- package/dist/uploader.js.map +1 -0
- package/dist/verifier.d.ts +66 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +170 -0
- package/dist/verifier.js.map +1 -0
- package/dist/verify-apply.d.ts +26 -0
- package/dist/verify-apply.d.ts.map +1 -0
- package/dist/verify-apply.js +36 -0
- package/dist/verify-apply.js.map +1 -0
- package/dist/verify-cmd.d.ts +44 -0
- package/dist/verify-cmd.d.ts.map +1 -0
- package/dist/verify-cmd.js +125 -0
- package/dist/verify-cmd.js.map +1 -0
- package/dist/verify-pass.d.ts +73 -0
- package/dist/verify-pass.d.ts.map +1 -0
- package/dist/verify-pass.js +103 -0
- package/dist/verify-pass.js.map +1 -0
- package/dist/welcome.d.ts +43 -0
- package/dist/welcome.d.ts.map +1 -0
- package/dist/welcome.js +116 -0
- package/dist/welcome.js.map +1 -0
- package/dist/workspace-provisioner.d.ts +65 -0
- package/dist/workspace-provisioner.d.ts.map +1 -0
- package/dist/workspace-provisioner.js +66 -0
- package/dist/workspace-provisioner.js.map +1 -0
- package/dist/workspace-quarantine.d.ts +64 -0
- package/dist/workspace-quarantine.d.ts.map +1 -0
- package/dist/workspace-quarantine.js +156 -0
- package/dist/workspace-quarantine.js.map +1 -0
- package/dist/workspace-residue-sweep.d.ts +113 -0
- package/dist/workspace-residue-sweep.d.ts.map +1 -0
- package/dist/workspace-residue-sweep.js +158 -0
- package/dist/workspace-residue-sweep.js.map +1 -0
- package/dist/workspace.d.ts +639 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +2026 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +52 -4
- package/win/CredProbe.cs +64 -0
- package/win/FakeClaude.cs +56 -0
- package/win/HandleProbe.cs +116 -0
- package/win/TokenProbe.cs +53 -0
- package/win/appcontainer.ps1 +500 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.surfaceDir = surfaceDir;
|
|
4
|
+
exports.highestIssued = highestIssued;
|
|
5
|
+
exports.holderOf = holderOf;
|
|
6
|
+
exports.acquireSurfaces = acquireSurfaces;
|
|
7
|
+
exports.checkFence = checkFence;
|
|
8
|
+
exports.releaseSurface = releaseSurface;
|
|
9
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const core_1 = require("@looply/core");
|
|
14
|
+
const git_driver_1 = require("./git-driver");
|
|
15
|
+
const exclusive_lock_1 = require("./exclusive-lock");
|
|
16
|
+
const run_lease_1 = require("./run-lease");
|
|
17
|
+
/**
|
|
18
|
+
* A LEASE OVER A RESOURCE SURFACE, WITH A FENCE.
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ THE SAME PRIMITIVE `RunLeaseStore` USES, PARAMETERISED — the recon's own
|
|
21
|
+
* words: "`RunLeaseStore` parameterised from `run.lease.json` to
|
|
22
|
+
* `leases/<surfaceKey>.json` is a resource lease with no new correctness
|
|
23
|
+
* argument." What IS new is the fence, and it is new because this lease may
|
|
24
|
+
* expire and the run lease may not.
|
|
25
|
+
*
|
|
26
|
+
* 🔴 EXPIRY EXISTS ONLY HERE, AND ONLY BECAUSE OF THE FENCE.
|
|
27
|
+
*
|
|
28
|
+
* The run lease has no expiry on purpose: a run inside a forty-five-minute
|
|
29
|
+
* model call is legitimately silent, and a lease that timed out would be
|
|
30
|
+
* reclaimed from a run that was working perfectly. A SURFACE lease can expire
|
|
31
|
+
* because a stale holder is caught at the publishing site by comparing two
|
|
32
|
+
* integers — which still works when the thing being checked has been asleep.
|
|
33
|
+
* Take the fence away and the expiry becomes exactly the hazard the run lease
|
|
34
|
+
* refuses to have.
|
|
35
|
+
*/
|
|
36
|
+
/** Where one surface's claims live: `<projectState>/leases/<hash>/`. */
|
|
37
|
+
function surfaceDir(cwd, surface) {
|
|
38
|
+
/**
|
|
39
|
+
* ⚠️ HASHED, BECAUSE A SURFACE KEY IS A PATH PREFIX AND A PATH PREFIX IS NOT
|
|
40
|
+
* A FILENAME. `src/app` has a separator in it; `../..` has worse. Hashing is
|
|
41
|
+
* not obfuscation here, it is the doorway — the same reasoning that made the
|
|
42
|
+
* run registry validate a runId where it enters.
|
|
43
|
+
*
|
|
44
|
+
* 🔴 AND THE CANONICAL FORM IS HASHED, NOT THE RAW STRING. Seven spellings of
|
|
45
|
+
* `src/app` hashed to seven directories and took seven simultaneous leases
|
|
46
|
+
* over the same files. See `canonicalSurface`.
|
|
47
|
+
*/
|
|
48
|
+
const key = (0, node_crypto_1.createHash)('sha256').update((0, core_1.canonicalSurface)(surface), 'utf8').digest('hex').slice(0, 16);
|
|
49
|
+
return (0, node_path_1.join)((0, git_driver_1.projectStateDir)(cwd), 'leases', key);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* SERIALISE THE WHOLE CHECK-AND-CLAIM, BECAUSE OVERLAP CANNOT BE CONFIRMED
|
|
53
|
+
* AFTER THE FACT.
|
|
54
|
+
*
|
|
55
|
+
* 🔴 THE SAME-KEY RACE IS SETTLED BY READING BACK — whoever holds the lowest
|
|
56
|
+
* live ordinal won, and everyone else stands down. That works because all the
|
|
57
|
+
* contenders are comparing ONE ordered sequence.
|
|
58
|
+
*
|
|
59
|
+
* Overlapping keys have no such sequence. `src` and `src/app` are different
|
|
60
|
+
* directories with independent ordinals, so "who got there first" is not a
|
|
61
|
+
* question their contents can answer. MEASURED with the read-back in place and
|
|
62
|
+
* no mutex: eight racers over `src`, `src/app` and `src/app/api` produced FOUR
|
|
63
|
+
* simultaneous holders, three trials running.
|
|
64
|
+
*
|
|
65
|
+
* So acquisition takes a short project-wide lock. It is the right shape for
|
|
66
|
+
* this: acquiring surfaces happens once per run, takes microseconds, and is the
|
|
67
|
+
* only writer — while the READ paths (`holderOf`, `checkFence`) take nothing
|
|
68
|
+
* and stay lock-free. `queue-write-lease` settled the same discipline for the
|
|
69
|
+
* queue and for the same reason.
|
|
70
|
+
*
|
|
71
|
+
* ⚠️ AND A DEAD HOLDER'S LOCK IS BROKEN BY CONTENT MATCH, never by path. Phase
|
|
72
|
+
* 1 measured what removing a lock by path costs: a process that had already
|
|
73
|
+
* lost its claim deleted the winner's, and four processes then held one lock.
|
|
74
|
+
*/
|
|
75
|
+
function acquireLockPath(cwd) {
|
|
76
|
+
return (0, node_path_1.join)((0, git_driver_1.projectStateDir)(cwd), 'leases', '.acquire.lock');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* ⚠️ THE MUTEX ITSELF NOW LIVES IN `exclusive-lock`, because the spend ledger
|
|
80
|
+
* needs the same thing for the same reason — see the docblock there. This is
|
|
81
|
+
* the surface path's name for it, and nothing about the discipline changed.
|
|
82
|
+
*/
|
|
83
|
+
function withAcquireLock(cwd, fn, fallback) {
|
|
84
|
+
return (0, exclusive_lock_1.withExclusiveLock)(acquireLockPath(cwd), fn, () => fallback('another process is claiming surfaces here and did not finish in time'));
|
|
85
|
+
}
|
|
86
|
+
/** Every surface this project currently has a lease directory for. */
|
|
87
|
+
function leasedSurfaces(cwd) {
|
|
88
|
+
const root = (0, node_path_1.join)((0, git_driver_1.projectStateDir)(cwd), 'leases');
|
|
89
|
+
let dirs;
|
|
90
|
+
try {
|
|
91
|
+
dirs = (0, node_fs_1.readdirSync)(root);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
const out = new Set();
|
|
97
|
+
for (const d of dirs) {
|
|
98
|
+
// The key is not recoverable from the hash, so it is read back off a claim.
|
|
99
|
+
// Any claim will do: every claim in a directory names the same surface.
|
|
100
|
+
let names;
|
|
101
|
+
try {
|
|
102
|
+
names = (0, node_fs_1.readdirSync)((0, node_path_1.join)(root, d));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
for (const name of names) {
|
|
108
|
+
if (!name.endsWith('.json'))
|
|
109
|
+
continue;
|
|
110
|
+
const claim = readClaim((0, node_path_1.join)(root, d, name));
|
|
111
|
+
if (claim !== null) {
|
|
112
|
+
out.add(claim.surface);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return [...out];
|
|
118
|
+
}
|
|
119
|
+
/** The highest ordinal ever issued for a surface, or null when it cannot be read. */
|
|
120
|
+
function highestIssued(cwd, surface) {
|
|
121
|
+
const dir = surfaceDir(cwd, surface);
|
|
122
|
+
let names;
|
|
123
|
+
try {
|
|
124
|
+
names = (0, node_fs_1.readdirSync)(dir);
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
// ENOENT means nobody has ever taken it: zero, not unknown.
|
|
128
|
+
return e.code === 'ENOENT' ? 0 : null;
|
|
129
|
+
}
|
|
130
|
+
let top = 0;
|
|
131
|
+
for (const name of names) {
|
|
132
|
+
if (!name.endsWith('.json'))
|
|
133
|
+
continue;
|
|
134
|
+
const n = Number.parseInt(name.slice(0, -'.json'.length), 10);
|
|
135
|
+
if (Number.isInteger(n) && n > top)
|
|
136
|
+
top = n;
|
|
137
|
+
}
|
|
138
|
+
return top;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A claim, or null when the file is not one.
|
|
142
|
+
*
|
|
143
|
+
* ⚠️ NULL HERE MEANS "NOT A CLAIM", NOT "NOT HELD". The difference is the whole
|
|
144
|
+
* of `stillHeld`'s unreadable branch: a file that will not parse is a claim
|
|
145
|
+
* this process cannot judge, and the caller must treat that as held.
|
|
146
|
+
*/
|
|
147
|
+
function readClaim(path) {
|
|
148
|
+
try {
|
|
149
|
+
const c = JSON.parse((0, node_fs_1.readFileSync)(path, 'utf8'));
|
|
150
|
+
if (typeof c.ordinal !== 'number' || typeof c.runId !== 'string')
|
|
151
|
+
return null;
|
|
152
|
+
if (typeof c.pid !== 'number' || typeof c.host !== 'string')
|
|
153
|
+
return null;
|
|
154
|
+
return c;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Whether a claim file exists at this ordinal, whatever its contents. */
|
|
161
|
+
function claimFilePresent(dir, ordinal) {
|
|
162
|
+
return (0, node_fs_1.existsSync)((0, node_path_1.join)(dir, `${String(ordinal).padStart(4, '0')}.json`));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Is the claim at this ordinal still held?
|
|
166
|
+
*
|
|
167
|
+
* ⚠️ TWO WITNESSES, AS EVERYWHERE ELSE IN THIS CODEBASE: the holder's process
|
|
168
|
+
* must answer AND the lease must not have expired. Either one alone is a
|
|
169
|
+
* half-answer — a live process whose lease lapsed is a stale holder, and an
|
|
170
|
+
* unexpired lease whose process is gone is litter.
|
|
171
|
+
*
|
|
172
|
+
* ⚠️ AND A FOREIGN HOST IS NEVER JUDGED. A pid means nothing across machines.
|
|
173
|
+
*/
|
|
174
|
+
function stillHeld(claim, now) {
|
|
175
|
+
const lapsed = now - Date.parse(claim.acquiredAt) >= claim.ttlMs;
|
|
176
|
+
/**
|
|
177
|
+
* 🔴 A FOREIGN HOST'S CLAIM EXPIRES TOO — IT USED TO BE HELD FOR EVER.
|
|
178
|
+
*
|
|
179
|
+
* The old line returned `true` before the TTL was ever compared, so a claim
|
|
180
|
+
* written by another machine held the surface permanently: no verb cleared
|
|
181
|
+
* it, no reaper looked at it, and no amount of elapsed time changed it. On a
|
|
182
|
+
* shared checkout that is a surface lost for the life of the repository.
|
|
183
|
+
*
|
|
184
|
+
* The pid still cannot be judged across machines and is not. What CAN be
|
|
185
|
+
* judged is the clock, which is the reason this lease has a TTL at all and
|
|
186
|
+
* why the fence exists to make expiry safe: a stale holder that wakes up is
|
|
187
|
+
* caught at the publishing site by comparing two integers.
|
|
188
|
+
*/
|
|
189
|
+
if (claim.host !== (0, node_os_1.hostname)())
|
|
190
|
+
return !lapsed;
|
|
191
|
+
if ((0, run_lease_1.nodeProbe)(claim.pid) !== 'dead')
|
|
192
|
+
return !lapsed;
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Who holds this surface right now, if anybody.
|
|
197
|
+
*
|
|
198
|
+
* 🔴 THE LOWEST LIVE ORDINAL HOLDS IT — READING ONLY THE HIGHEST WAS A SECOND
|
|
199
|
+
* WRITER.
|
|
200
|
+
*
|
|
201
|
+
* MEASURED: run_LOW claims ordinal 1 and run_HIGH claims ordinal 2; run_HIGH
|
|
202
|
+
* releases; `holderOf` reads the top, sees it released, and answers NOBODY
|
|
203
|
+
* while run_LOW is alive and unaware. A third run then acquires ordinal 3 and
|
|
204
|
+
* two live holders write the same files.
|
|
205
|
+
*
|
|
206
|
+
* A lease is first-come-first-served, so the holder is the OLDEST claim that is
|
|
207
|
+
* still live. That composes with the fence rather than contradicting it: the
|
|
208
|
+
* fence asks "is my ordinal still the highest ever issued" at the moment of
|
|
209
|
+
* PUBLISHING, which is what catches a holder whose lease lapsed while a newer
|
|
210
|
+
* one took over.
|
|
211
|
+
*
|
|
212
|
+
* ⚠️ AND AN UNREADABLE CLAIM IS A HOLDER. `readClaim` returning null used to
|
|
213
|
+
* mean "free", which is the exact inversion of `mayPublish`'s own rule that
|
|
214
|
+
* unknown is a refusal — and it is reachable by a torn write, a full disk, or a
|
|
215
|
+
* permissions change. A surface this process cannot judge is one it must not
|
|
216
|
+
* take.
|
|
217
|
+
*/
|
|
218
|
+
function holderOf(cwd, surface, now = Date.now()) {
|
|
219
|
+
const top = highestIssued(cwd, surface);
|
|
220
|
+
if (top === null || top === 0)
|
|
221
|
+
return null;
|
|
222
|
+
const dir = surfaceDir(cwd, surface);
|
|
223
|
+
for (let ordinal = 1; ordinal <= top; ordinal++) {
|
|
224
|
+
if (released(dir, ordinal))
|
|
225
|
+
continue; // given back: the ordinal stands, the hold does not
|
|
226
|
+
if (!claimFilePresent(dir, ordinal))
|
|
227
|
+
continue; // an ordinal nobody ever wrote
|
|
228
|
+
const claim = readClaim((0, node_path_1.join)(dir, `${String(ordinal).padStart(4, '0')}.json`));
|
|
229
|
+
if (claim === null) {
|
|
230
|
+
// Present and unreadable. Deny is the default: report it as a holder
|
|
231
|
+
// nobody can identify rather than as free space.
|
|
232
|
+
return {
|
|
233
|
+
surface,
|
|
234
|
+
ordinal,
|
|
235
|
+
runId: '(unreadable)',
|
|
236
|
+
pid: 0,
|
|
237
|
+
host: '(unknown)',
|
|
238
|
+
acquiredAt: new Date(now).toISOString(),
|
|
239
|
+
ttlMs: 0,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
if (stillHeld(claim, now))
|
|
243
|
+
return claim;
|
|
244
|
+
}
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* TAKE EVERY DECLARED SURFACE, IN ORDER, ALL OR NOTHING.
|
|
249
|
+
*
|
|
250
|
+
* 🔴 THE ORDER IS WHAT MAKES DEADLOCK UNREPRESENTABLE. Lexicographic and
|
|
251
|
+
* total, so two Runs wanting the same pair always contend on the same one
|
|
252
|
+
* first. A Run never acquires a second surface while holding a first — which is
|
|
253
|
+
* the same statement, and is why there is no detector here to write.
|
|
254
|
+
*
|
|
255
|
+
* ⚠️ AND A PARTIAL ACQUISITION IS ROLLED BACK. Holding two of three surfaces
|
|
256
|
+
* while waiting for the third is precisely the state a total order exists to
|
|
257
|
+
* make impossible; leaving one behind on a failure would reintroduce it by the
|
|
258
|
+
* back door.
|
|
259
|
+
*/
|
|
260
|
+
function acquireSurfaces(cwd, surfaces, who, now = Date.now()) {
|
|
261
|
+
/**
|
|
262
|
+
* ⚠️ NO DECLARATION, NO OBLIGATION. This is the compatibility guarantee, and
|
|
263
|
+
* it is the first line so nothing below it can accidentally weaken it. It is
|
|
264
|
+
* also outside the lock, so a run that declares nothing — Simple Mode, and
|
|
265
|
+
* every run that existed before surfaces did — touches no lock at all.
|
|
266
|
+
*/
|
|
267
|
+
if (surfaces.length === 0)
|
|
268
|
+
return { ok: true, held: [] };
|
|
269
|
+
return withAcquireLock(cwd, () => claimAll(cwd, surfaces, who, now), (why) => ({ ok: false, because: why }));
|
|
270
|
+
}
|
|
271
|
+
function claimAll(cwd, surfaces, who, now) {
|
|
272
|
+
const taken = [];
|
|
273
|
+
/** Fences this run ALREADY held when it asked again. Never rolled back. */
|
|
274
|
+
const already = [];
|
|
275
|
+
const rollback = () => {
|
|
276
|
+
// ⚠️ MARKED, NOT DELETED — see `releaseSurface`. An ordinal that is handed
|
|
277
|
+
// back and then REUSED lets a revived holder from the previous generation
|
|
278
|
+
// compare equal to the current one.
|
|
279
|
+
for (const t of taken)
|
|
280
|
+
releaseSurface(cwd, t.fence, who.runId);
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* 🔴 A KEY THAT NAMES NOTHING IS REFUSED AT THE DOORWAY. `.` and `''` used to
|
|
284
|
+
* be accepted, took a lease that excluded nobody, and switched the trespass
|
|
285
|
+
* check off for the whole run. See `surfaceKeyTrouble`.
|
|
286
|
+
*/
|
|
287
|
+
for (const surface of surfaces) {
|
|
288
|
+
const trouble = (0, core_1.surfaceKeyTrouble)(surface);
|
|
289
|
+
if (trouble !== null)
|
|
290
|
+
return { ok: false, because: trouble, blockedBy: surface };
|
|
291
|
+
}
|
|
292
|
+
for (const surface of (0, core_1.acquisitionOrder)(surfaces)) {
|
|
293
|
+
/**
|
|
294
|
+
* 🔴 OVERLAP, NOT EQUALITY — `src`, `src/app` AND `src/app/api` WERE THREE
|
|
295
|
+
* LEASES OVER ONE TREE, ALL GRANTED, ALL WRITING THE SAME FILE.
|
|
296
|
+
*
|
|
297
|
+
* The lease compared surface keys for equality and nothing else, so a run
|
|
298
|
+
* declaring the parent and a run declaring the child never contended. This
|
|
299
|
+
* asks the question the lease exists to ask: does anybody already hold a
|
|
300
|
+
* surface that contains mine, or one mine contains?
|
|
301
|
+
*/
|
|
302
|
+
for (const other of leasedSurfaces(cwd)) {
|
|
303
|
+
if ((0, core_1.canonicalSurface)(other) === (0, core_1.canonicalSurface)(surface))
|
|
304
|
+
continue;
|
|
305
|
+
if (!(0, core_1.surfacesOverlap)(other, surface))
|
|
306
|
+
continue;
|
|
307
|
+
const overlapping = holderOf(cwd, other, now);
|
|
308
|
+
if (overlapping !== null && overlapping.runId !== who.runId) {
|
|
309
|
+
rollback();
|
|
310
|
+
return {
|
|
311
|
+
ok: false,
|
|
312
|
+
because: `${surface} overlaps ${other}, which is held by ${overlapping.runId} ` +
|
|
313
|
+
`(pid ${overlapping.pid}, since ${overlapping.acquiredAt})`,
|
|
314
|
+
blockedBy: surface,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
const held = holderOf(cwd, surface, now);
|
|
319
|
+
if (held !== null && held.runId !== who.runId) {
|
|
320
|
+
rollback();
|
|
321
|
+
return {
|
|
322
|
+
ok: false,
|
|
323
|
+
because: `${surface} is held by ${held.runId} (pid ${held.pid}, since ${held.acquiredAt})`,
|
|
324
|
+
blockedBy: surface,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* 🔴 A RUN THAT ALREADY HOLDS THIS SURFACE IS HANDED BACK ITS OWN FENCE —
|
|
329
|
+
* AND ASKING TWICE USED TO INVALIDATE THE FIRST ANSWER.
|
|
330
|
+
*
|
|
331
|
+
* The line above lets a run past its own claim, which is right: it is not
|
|
332
|
+
* blocked by itself. But the code then issued a NEW, HIGHER ordinal, and
|
|
333
|
+
* `checkFence` compares against "highest ever issued" — so the fence the
|
|
334
|
+
* run was already carrying stopped validating the moment it asked again.
|
|
335
|
+
*
|
|
336
|
+
* MEASURED: one run, two `acquireSurfaces` calls for `src/app`. The first
|
|
337
|
+
* fence validated before the second call and was refused after it —
|
|
338
|
+
* "src/app has been taken over — this holds fence 1 and the surface is at
|
|
339
|
+
* 2" — about a takeover by itself.
|
|
340
|
+
*
|
|
341
|
+
* Latent today because there is exactly one production call site, which is
|
|
342
|
+
* the same "no production caller" reasoning that made the fence itself a
|
|
343
|
+
* finding, pointing the other way. Idempotence is the honest answer: asking
|
|
344
|
+
* for what you already hold returns what you already hold.
|
|
345
|
+
*/
|
|
346
|
+
if (held !== null && held.runId === who.runId) {
|
|
347
|
+
// ⚠️ NOT IN `taken`, so a later rollback cannot release a fence this run
|
|
348
|
+
// was already carrying before it asked. Rollback undoes what THIS call
|
|
349
|
+
// claimed; this was claimed by an earlier one.
|
|
350
|
+
already.push({ surface, ordinal: held.ordinal });
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
const top = highestIssued(cwd, surface);
|
|
354
|
+
if (top === null) {
|
|
355
|
+
rollback();
|
|
356
|
+
return { ok: false, because: `the holders of ${surface} could not be read`, blockedBy: surface };
|
|
357
|
+
}
|
|
358
|
+
const dir = surfaceDir(cwd, surface);
|
|
359
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
360
|
+
let ordinal = top + 1;
|
|
361
|
+
let placed = false;
|
|
362
|
+
// Bounded: the number of claimants that could take a number between the
|
|
363
|
+
// read and the write. Far past any real machine.
|
|
364
|
+
for (; ordinal < top + 1 + 64 && !placed; ordinal++) {
|
|
365
|
+
const path = (0, node_path_1.join)(dir, `${String(ordinal).padStart(4, '0')}.json`);
|
|
366
|
+
const claim = {
|
|
367
|
+
surface,
|
|
368
|
+
ordinal,
|
|
369
|
+
runId: who.runId,
|
|
370
|
+
pid: process.pid,
|
|
371
|
+
host: (0, node_os_1.hostname)(),
|
|
372
|
+
acquiredAt: new Date(now).toISOString(),
|
|
373
|
+
ttlMs: who.ttlMs,
|
|
374
|
+
};
|
|
375
|
+
try {
|
|
376
|
+
(0, node_fs_1.writeFileSync)(path, `${JSON.stringify(claim, null, 2)}\n`, { encoding: 'utf8', flag: 'wx' });
|
|
377
|
+
taken.push({ surface, path, fence: { surface, ordinal } });
|
|
378
|
+
placed = true;
|
|
379
|
+
}
|
|
380
|
+
catch (e) {
|
|
381
|
+
const code = e.code;
|
|
382
|
+
// Windows answers EPERM rather than EEXIST against a pending-delete file.
|
|
383
|
+
if (code !== 'EEXIST' && code !== 'EPERM') {
|
|
384
|
+
rollback();
|
|
385
|
+
return { ok: false, because: `${surface} could not be claimed: ${e.message}`, blockedBy: surface };
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (!placed) {
|
|
390
|
+
rollback();
|
|
391
|
+
return { ok: false, because: `${surface} is being claimed too fast to join`, blockedBy: surface };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* 🔴 READ BACK AFTER CLAIMING — WITHOUT THIS THERE IS NO EXCLUSION AT ALL.
|
|
395
|
+
*
|
|
396
|
+
* MEASURED, eight real processes racing one surface, three trials:
|
|
397
|
+
* 8/8 acquired, 8/8 acquired, 8/8 acquired. ZERO refusals, every time.
|
|
398
|
+
*
|
|
399
|
+
* The reason is that `wx` was doing a different job from the one it looked
|
|
400
|
+
* like it was doing. Exclusive create guarantees that two writers never get
|
|
401
|
+
* the SAME ordinal — and that is all it guarantees. Process A takes ordinal
|
|
402
|
+
* 1, process B takes ordinal 2, both succeed, both believe they hold the
|
|
403
|
+
* surface. The check above ran BEFORE the write, against state that a
|
|
404
|
+
* competitor invalidates in the microsecond afterwards; nothing ever asked
|
|
405
|
+
* the question again once the claim existed.
|
|
406
|
+
*
|
|
407
|
+
* So the claim is a nomination and this is the election: whoever holds the
|
|
408
|
+
* lowest live ordinal won, and everybody else releases and reports who did.
|
|
409
|
+
* `queue-write-lease` settled this discipline for its own lock and wrote
|
|
410
|
+
* down why — "re-reads after claiming". This is the same rule, and the
|
|
411
|
+
* absence of it here is what made a whole subsystem decorative.
|
|
412
|
+
*/
|
|
413
|
+
const winner = holderOf(cwd, surface, now);
|
|
414
|
+
if (winner === null || winner.runId !== who.runId) {
|
|
415
|
+
// Give back the ordinal we nominated ourselves with, then report.
|
|
416
|
+
releaseSurface(cwd, { surface, ordinal: ordinal - 1 }, who.runId);
|
|
417
|
+
rollback();
|
|
418
|
+
return {
|
|
419
|
+
ok: false,
|
|
420
|
+
because: winner === null
|
|
421
|
+
? `${surface} could not be confirmed after claiming it`
|
|
422
|
+
: `${surface} is held by ${winner.runId} (pid ${winner.pid}, since ${winner.acquiredAt})`,
|
|
423
|
+
blockedBy: surface,
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return { ok: true, held: [...already, ...taken.map((t) => t.fence)] };
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* MAY THIS HOLDER PUBLISH?
|
|
431
|
+
*
|
|
432
|
+
* The whole point of the fence, asked at the moment of the write rather than
|
|
433
|
+
* assumed at the moment of the claim.
|
|
434
|
+
*/
|
|
435
|
+
function checkFence(cwd, fence) {
|
|
436
|
+
return (0, core_1.mayPublish)(fence, highestIssued(cwd, fence.surface));
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Give a surface back.
|
|
440
|
+
*
|
|
441
|
+
* 🔴 IT MARKS, IT DOES NOT DELETE — AND THE FIRST VERSION DELETED, WHICH BROKE
|
|
442
|
+
* THE FENCE OUTRIGHT. Caught by this file's own test.
|
|
443
|
+
*
|
|
444
|
+
* `highestIssued` reads the directory. Remove the claim and the count drops
|
|
445
|
+
* back, so the next acquirer is handed the SAME ordinal — and a revived holder
|
|
446
|
+
* from the previous generation then compares EQUAL to the current one and is
|
|
447
|
+
* allowed to publish. Two writers on one surface, arrived at by giving a
|
|
448
|
+
* surface back politely.
|
|
449
|
+
*
|
|
450
|
+
* "Highest ever issued" has to mean EVER. So the directory is append-only, like
|
|
451
|
+
* every other ledger in this codebase: a release adds `<NNNN>.released` beside
|
|
452
|
+
* the claim rather than taking the claim away. `highestIssued` counts claims;
|
|
453
|
+
* `holderOf` reads the marker.
|
|
454
|
+
*
|
|
455
|
+
* ⚠️ BY IDENTITY, AND BY EXCLUSIVE CREATE. Phase 1 measured what removing a
|
|
456
|
+
* claim by PATH costs: a process that had already lost its hold deleted the
|
|
457
|
+
* winner's, and four processes then held one lock.
|
|
458
|
+
*/
|
|
459
|
+
function releaseSurface(cwd, fence, runId) {
|
|
460
|
+
const dir = surfaceDir(cwd, fence.surface);
|
|
461
|
+
const n = String(fence.ordinal).padStart(4, '0');
|
|
462
|
+
const path = (0, node_path_1.join)(dir, `${n}.json`);
|
|
463
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
464
|
+
return false;
|
|
465
|
+
const claim = readClaim(path);
|
|
466
|
+
if (claim === null || claim.runId !== runId)
|
|
467
|
+
return false;
|
|
468
|
+
try {
|
|
469
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, `${n}.released`), `${new Date().toISOString()}\n`, {
|
|
470
|
+
encoding: 'utf8',
|
|
471
|
+
flag: 'wx',
|
|
472
|
+
});
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
catch (e) {
|
|
476
|
+
// Already released is success: the surface is given back either way.
|
|
477
|
+
const code = e.code;
|
|
478
|
+
return code === 'EEXIST' || code === 'EPERM';
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/** Whether the claim at this ordinal has been handed back. */
|
|
482
|
+
function released(dir, ordinal) {
|
|
483
|
+
return (0, node_fs_1.existsSync)((0, node_path_1.join)(dir, `${String(ordinal).padStart(4, '0')}.released`));
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=surface-lease.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-lease.js","sourceRoot":"","sources":["../src/surface-lease.ts"],"names":[],"mappings":";;AAsCA,gCAaC;AAwFD,sCAgBC;AA8ED,4BAwBC;AAeD,0CAmBC;AA8KD,gCAEC;AAuBD,wCAkBC;AA5fD,6CAAyC;AACzC,qCAAsG;AACtG,qCAAmC;AACnC,yCAAiC;AACjC,uCAQsB;AACtB,6CAA+C;AAC/C,qDAAqD;AACrD,2CAAwC;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wEAAwE;AACx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C1D,IAAI,CAAC;QACH,IAAA,uBAAa,EAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE;YACzE,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,qEAAqE;QACrE,MAAM,IAAI,GAAI,CAA2B,CAAC,IAAI,CAAC;QAC/C,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,8DAA8D;AAC9D,SAAS,QAAQ,CAAC,GAAW,EAAE,OAAe;IAC5C,OAAO,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/sync.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LooplyConfig } from './config';
|
|
2
|
+
import { ServerClient } from './server-client';
|
|
3
|
+
import { Daemon } from './daemon';
|
|
4
|
+
/**
|
|
5
|
+
* Attaching a local command to the server.
|
|
6
|
+
*
|
|
7
|
+
* Both of the CLI's long jobs need this and neither should own it: a run streams
|
|
8
|
+
* its rounds, a scan streams its passes, and the code that decides whether this
|
|
9
|
+
* machine is paired at all is the same either way.
|
|
10
|
+
*/
|
|
11
|
+
export interface Sync {
|
|
12
|
+
daemon: Daemon;
|
|
13
|
+
/** The authenticated client, so a caller can read settings without re-pairing. */
|
|
14
|
+
client: ServerClient;
|
|
15
|
+
/** The project id the *server* knows this repo by; see the note in attachSync. */
|
|
16
|
+
projectId: string;
|
|
17
|
+
/** False once the stream has died. Reported, never thrown — see superviseStream. */
|
|
18
|
+
alive(): boolean;
|
|
19
|
+
stop(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** A supervised daemon loop: it never rejects, and it says when it stopped. */
|
|
22
|
+
export interface SupervisedStream {
|
|
23
|
+
alive(): boolean;
|
|
24
|
+
/** Resolves when the loop is over, however it ended. Never rejects. */
|
|
25
|
+
settled: Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Watch the daemon loop that runs alongside the work.
|
|
29
|
+
*
|
|
30
|
+
* `daemon.run()` is started and not awaited until the end, so a throw inside it
|
|
31
|
+
* is a rejection nobody is holding — which Node turns into a process-level
|
|
32
|
+
* unhandled rejection and, since Node 15, into a dead process. The stream exists
|
|
33
|
+
* only to report on the run; it must never be able to end it. So the rejection
|
|
34
|
+
* is caught here, in the same tick it is created, the stream is marked dead, and
|
|
35
|
+
* the failure is said out loud once instead of the phone simply going quiet.
|
|
36
|
+
*
|
|
37
|
+
* A loop that finishes normally is not dead: `alive` means "did not fail", which
|
|
38
|
+
* is what a caller wants to know after a deliberate stop.
|
|
39
|
+
*/
|
|
40
|
+
export declare function superviseStream(loop: Promise<unknown>,
|
|
41
|
+
/** What is being streamed, for the message. "this run", not "this". */
|
|
42
|
+
what: string, log: (line: string) => void): SupervisedStream;
|
|
43
|
+
/**
|
|
44
|
+
* Connect to the server, when this machine is paired.
|
|
45
|
+
*
|
|
46
|
+
* Returns null for an unpaired machine, which is a normal state rather than a
|
|
47
|
+
* failure — looply runs perfectly well with no server, and the app is something
|
|
48
|
+
* you add. Any error here degrades to the same null: local work must never fail
|
|
49
|
+
* because a relay is unreachable.
|
|
50
|
+
*/
|
|
51
|
+
export declare function attachSync(cwd: string, config: LooplyConfig, log: (line: string) => void,
|
|
52
|
+
/** What is being attached, for the messages. "this run stays local", not "this". */
|
|
53
|
+
what?: string): Promise<Sync | null>;
|
|
54
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;;GAMG;AAEH,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,MAAM,EAAE,YAAY,CAAC;IACrB,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,KAAK,IAAI,OAAO,CAAC;IACjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,IAAI,OAAO,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;AACtB,uEAAuE;AACvE,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1B,gBAAgB,CAWlB;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI;AAC3B,oFAAoF;AACpF,IAAI,SAAQ,GACX,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAsDtB"}
|
package/dist/sync.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.superviseStream = superviseStream;
|
|
4
|
+
exports.attachSync = attachSync;
|
|
5
|
+
const machine_store_1 = require("./machine-store");
|
|
6
|
+
const server_client_1 = require("./server-client");
|
|
7
|
+
const daemon_1 = require("./daemon");
|
|
8
|
+
const daemon_cmd_1 = require("./daemon-cmd");
|
|
9
|
+
/**
|
|
10
|
+
* Watch the daemon loop that runs alongside the work.
|
|
11
|
+
*
|
|
12
|
+
* `daemon.run()` is started and not awaited until the end, so a throw inside it
|
|
13
|
+
* is a rejection nobody is holding — which Node turns into a process-level
|
|
14
|
+
* unhandled rejection and, since Node 15, into a dead process. The stream exists
|
|
15
|
+
* only to report on the run; it must never be able to end it. So the rejection
|
|
16
|
+
* is caught here, in the same tick it is created, the stream is marked dead, and
|
|
17
|
+
* the failure is said out loud once instead of the phone simply going quiet.
|
|
18
|
+
*
|
|
19
|
+
* A loop that finishes normally is not dead: `alive` means "did not fail", which
|
|
20
|
+
* is what a caller wants to know after a deliberate stop.
|
|
21
|
+
*/
|
|
22
|
+
function superviseStream(loop,
|
|
23
|
+
/** What is being streamed, for the message. "this run", not "this". */
|
|
24
|
+
what, log) {
|
|
25
|
+
let failed = false;
|
|
26
|
+
const settled = loop.then(() => undefined, (e) => {
|
|
27
|
+
failed = true;
|
|
28
|
+
log(`sync : the stream failed (${e.message}) — this ${what} is no longer streaming.`);
|
|
29
|
+
log(' It carries on locally and the ledger on disk stays complete.');
|
|
30
|
+
});
|
|
31
|
+
return { alive: () => !failed, settled };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Connect to the server, when this machine is paired.
|
|
35
|
+
*
|
|
36
|
+
* Returns null for an unpaired machine, which is a normal state rather than a
|
|
37
|
+
* failure — looply runs perfectly well with no server, and the app is something
|
|
38
|
+
* you add. Any error here degrades to the same null: local work must never fail
|
|
39
|
+
* because a relay is unreachable.
|
|
40
|
+
*/
|
|
41
|
+
async function attachSync(cwd, config, log,
|
|
42
|
+
/** What is being attached, for the messages. "this run stays local", not "this". */
|
|
43
|
+
what = 'run') {
|
|
44
|
+
const store = new machine_store_1.MachineStore((0, machine_store_1.machineFilePath)());
|
|
45
|
+
let identity;
|
|
46
|
+
try {
|
|
47
|
+
identity = store.load();
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
log(`sync : ${e.message}`);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (!identity) {
|
|
54
|
+
log(`sync : not paired — this ${what} stays local. \`looply pair\` to watch it from your phone.`);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const client = new server_client_1.ServerClient({ baseUrl: identity.serverUrl }).withToken(identity.token);
|
|
58
|
+
let projectId;
|
|
59
|
+
try {
|
|
60
|
+
projectId = await (0, daemon_cmd_1.resolveProjectId)(store, client, identity.machineId, cwd, config.project.name);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
log(`sync : could not reach ${identity.serverUrl} (${e.message}) — running local only.`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const daemon = new daemon_1.Daemon({
|
|
67
|
+
client,
|
|
68
|
+
machineId: identity.machineId,
|
|
69
|
+
projectId,
|
|
70
|
+
cliVersion: daemon_cmd_1.CLI_VERSION,
|
|
71
|
+
log,
|
|
72
|
+
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
73
|
+
now: () => Date.now(),
|
|
74
|
+
});
|
|
75
|
+
// Supervised, not fire-and-forget: the loop runs alongside the work and is
|
|
76
|
+
// stopped below. Most of its failures are handled inside the daemon, but not
|
|
77
|
+
// all of them are, and the ones that are not used to take the run with them.
|
|
78
|
+
const stream = superviseStream(daemon.run(), what, log);
|
|
79
|
+
log(`sync : streaming to ${identity.serverUrl} as ${projectId}`);
|
|
80
|
+
return {
|
|
81
|
+
daemon,
|
|
82
|
+
client,
|
|
83
|
+
projectId,
|
|
84
|
+
alive: () => stream.alive(),
|
|
85
|
+
stop: async () => {
|
|
86
|
+
daemon.stop();
|
|
87
|
+
// Never rethrows: stop() is called from a `finally`, where a throw would
|
|
88
|
+
// replace the run's result with the streamer's failure.
|
|
89
|
+
await stream.settled;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=sync.js.map
|
package/dist/sync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":";;AA6CA,0CAgBC;AAUD,gCA4DC;AAlID,mDAAgE;AAChE,mDAA+C;AAC/C,qCAAkC;AAClC,6CAA6D;AA4B7D;;;;;;;;;;;;GAYG;AACH,SAAgB,eAAe,CAC7B,IAAsB;AACtB,uEAAuE;AACvE,IAAY,EACZ,GAA2B;IAE3B,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CACvB,GAAG,EAAE,CAAC,SAAS,EACf,CAAC,CAAU,EAAE,EAAE;QACb,MAAM,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,gCAAiC,CAAW,CAAC,OAAO,YAAY,IAAI,0BAA0B,CAAC,CAAC;QACpG,GAAG,CAAC,wEAAwE,CAAC,CAAC;IAChF,CAAC,CACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,UAAU,CAC9B,GAAW,EACX,MAAoB,EACpB,GAA2B;AAC3B,oFAAoF;AACpF,IAAI,GAAG,KAAK;IAEZ,MAAM,KAAK,GAAG,IAAI,4BAAY,CAAC,IAAA,+BAAe,GAAE,CAAC,CAAC;IAClD,IAAI,QAA0C,CAAC;IAC/C,IAAI,CAAC;QACH,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,GAAG,CAAC,aAAc,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC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