looply-cli 0.0.0-stage โ 0.2.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 +2719 -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/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 +54 -6
- 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,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.homesFor = homesFor;
|
|
4
|
+
exports.goalsFor = goalsFor;
|
|
5
|
+
exports.runsFor = runsFor;
|
|
6
|
+
exports.workspacesFor = workspacesFor;
|
|
7
|
+
exports.holdsFor = holdsFor;
|
|
8
|
+
exports.surfacesHeldFor = surfacesHeldFor;
|
|
9
|
+
exports.gatherScheduleState = gatherScheduleState;
|
|
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 git_driver_1 = require("./git-driver");
|
|
14
|
+
const workspace_1 = require("./workspace");
|
|
15
|
+
const workspace_quarantine_1 = require("./workspace-quarantine");
|
|
16
|
+
const run_lease_1 = require("./run-lease");
|
|
17
|
+
const surface_lease_1 = require("./surface-lease");
|
|
18
|
+
const integration_runtime_1 = require("./integration-runtime");
|
|
19
|
+
const lane_claims_1 = require("./lane-claims");
|
|
20
|
+
/**
|
|
21
|
+
* F28 (B13): where each goal's plan lives, keyed `goalId@version` โ the checkout named by the
|
|
22
|
+
* NEWEST `claims` record for that goal and version, matched to a checkout that still exists.
|
|
23
|
+
* The newest decides: when its checkout is gone, so is the plan, and the goal has no home.
|
|
24
|
+
*
|
|
25
|
+
* โ ๏ธ PATHS ARE COMPARED AS THE FILESYSTEM COMPARES THEM โ case-insensitively on Windows โ and
|
|
26
|
+
* the answer is the scheduler's own spelling of the checkout, so its match is exact.
|
|
27
|
+
*/
|
|
28
|
+
function homesFor(cwd, workspaces) {
|
|
29
|
+
const norm = (p) => (process.platform === 'win32' ? (0, node_path_1.resolve)(p).toLowerCase() : (0, node_path_1.resolve)(p));
|
|
30
|
+
const byPath = new Map(workspaces.map((w) => [norm(w.path), w.path]));
|
|
31
|
+
const out = new Map();
|
|
32
|
+
for (const r of (0, lane_claims_1.readLaneClaims)(cwd)) {
|
|
33
|
+
if (r.kind !== 'claims')
|
|
34
|
+
continue;
|
|
35
|
+
const key = `${r.goalId}@${r.goalVersion}`;
|
|
36
|
+
const path = r.workspace === undefined ? undefined : byPath.get(norm(r.workspace));
|
|
37
|
+
if (path === undefined)
|
|
38
|
+
out.delete(key);
|
|
39
|
+
else
|
|
40
|
+
out.set(key, path);
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Which goals the scheduler may consider, and when each became eligible.
|
|
46
|
+
*
|
|
47
|
+
* โ ๏ธ `queuedAt` IS `updatedAt`, WHICH IS THE HONEST APPROXIMATION AND IS SAID
|
|
48
|
+
* SO RATHER THAN LEFT TO BE FOUND. A goal has no "became eligible" timestamp;
|
|
49
|
+
* what it has is when it last changed, which for an authorized goal that has
|
|
50
|
+
* not run is when a person authorized it. The age boost is monotone in this
|
|
51
|
+
* value, so the anti-starvation bound holds whatever it is anchored to.
|
|
52
|
+
*
|
|
53
|
+
* โ ๏ธ AND THE OLD VERSION OF THIS SENTENCE WAS WRONG IN A WAY WORTH KEEPING. It
|
|
54
|
+
* said an inaccurate anchor "costs fairness between two goals, not liveness" โ
|
|
55
|
+
* true of an anchor that is merely wrong, and false of the one the code
|
|
56
|
+
* actually produced, which was the epoch. See `queuedAt` below.
|
|
57
|
+
*/
|
|
58
|
+
function goalsFor(store, autonomy,
|
|
59
|
+
/**
|
|
60
|
+
* The goal ids whose work has been published to the integration ref.
|
|
61
|
+
*
|
|
62
|
+
* โ ๏ธ ABSENT IS UNKNOWN, AND THE SCHEDULER READS UNKNOWN AS NOT INTEGRATED
|
|
63
|
+
* โ but only when the programme says it integrates. A project with no lane
|
|
64
|
+
* never consults it, which is why passing nothing is safe for every caller
|
|
65
|
+
* that had none.
|
|
66
|
+
*/
|
|
67
|
+
integrated) {
|
|
68
|
+
/**
|
|
69
|
+
* ๐ด THE AUTONOMY GRANT IS A SECOND STORE, AND READING IT OFF `Goal.state`
|
|
70
|
+
* WAS WHAT MADE THE SCHEDULER A NO-OP.
|
|
71
|
+
*
|
|
72
|
+
* `GoalState` is `draft | active | abandoned`. `authorized` and `satisfied`
|
|
73
|
+
* live in `GOAL_AUTONOMY_STATES`, in the autonomy store. Copying `g.state`
|
|
74
|
+
* into a field the scheduler compared against `'authorized'` matched nothing,
|
|
75
|
+
* on every goal, for ever โ and no test noticed because every fixture
|
|
76
|
+
* invented `state: 'authorized'` for itself.
|
|
77
|
+
*
|
|
78
|
+
* โ ๏ธ AND THE MATCH IS ON GOAL VERSION TOO. A grant never follows a goal to a
|
|
79
|
+
* new version โ that is the store's own rule โ so a grant for version 2 must
|
|
80
|
+
* not authorise version 3, which is the amendment somebody made precisely
|
|
81
|
+
* because they wanted it looked at again.
|
|
82
|
+
*/
|
|
83
|
+
const grants = autonomy?.all() ?? [];
|
|
84
|
+
/**
|
|
85
|
+
* ๐ด `find` TAKES THE FIRST ROW, AND NOTHING PRUNES A SETTLED GRANT โ SO A
|
|
86
|
+
* RE-AUTHORIZED GOAL SILENTLY NEVER RAN.
|
|
87
|
+
*
|
|
88
|
+
* A goal can be authorized, satisfied, and authorized again at the same
|
|
89
|
+
* version: a person re-opens a pursuit that was declared finished. Both rows
|
|
90
|
+
* stay in the store โ settling writes state, it does not delete โ and this
|
|
91
|
+
* took whichever the store happened to list first. When that was the
|
|
92
|
+
* `satisfied` one, the goal read as satisfied for ever: never a candidate,
|
|
93
|
+
* never started, and it also silently SATISFIED every dependency on it, so
|
|
94
|
+
* the goals waiting behind it started against work that had not been redone.
|
|
95
|
+
*
|
|
96
|
+
* โ ๏ธ THE PRECEDENCE IS EXPLICIT RATHER THAN POSITIONAL. `authorized` beats
|
|
97
|
+
* every other state, because a live grant is a person saying "go" and no
|
|
98
|
+
* older row outranks it. `satisfied` is preferred next, since a finished
|
|
99
|
+
* pursuit that was never re-opened is genuinely finished. Anything else โ
|
|
100
|
+
* cancelled, expired โ comes last and means "not startable", which is the
|
|
101
|
+
* direction that cannot spend somebody's evening on a stale row.
|
|
102
|
+
*/
|
|
103
|
+
const RANK = { authorized: 0, satisfied: 1 };
|
|
104
|
+
const stateOf = (id, version) => {
|
|
105
|
+
const mine = grants.filter((a) => a.goalId === id && a.goalVersion === version);
|
|
106
|
+
if (mine.length === 0)
|
|
107
|
+
return null;
|
|
108
|
+
let best = mine[0];
|
|
109
|
+
for (const g of mine) {
|
|
110
|
+
if ((RANK[g.state] ?? 9) < (RANK[best.state] ?? 9))
|
|
111
|
+
best = g;
|
|
112
|
+
}
|
|
113
|
+
return best.state;
|
|
114
|
+
};
|
|
115
|
+
return store.all().map((g) => ({
|
|
116
|
+
id: g.id,
|
|
117
|
+
version: g.version,
|
|
118
|
+
state: g.state,
|
|
119
|
+
autonomy: stateOf(g.id, g.version),
|
|
120
|
+
...(g.dependsOn === undefined ? {} : { dependsOn: g.dependsOn }),
|
|
121
|
+
...(integrated === undefined ? {} : { integrated: integrated.has(g.id) }),
|
|
122
|
+
...(g.priority === undefined ? {} : { priority: g.priority }),
|
|
123
|
+
/**
|
|
124
|
+
* ๐ด THE SURFACE GATE READ A FIELD THIS MAP NEVER WROTE.
|
|
125
|
+
*
|
|
126
|
+
* `Goal.surfaces` exists, `ScheduleGoal.surfaces` exists, `decideSchedule`
|
|
127
|
+
* refuses a goal whose surfaces are held โ and the one function that turns
|
|
128
|
+
* the first into the second dropped it. MEASURED: a goal declaring
|
|
129
|
+
* `src/app` came out of `goalsFor` with no `surfaces` key at all, so
|
|
130
|
+
* `surfacesHeldFor` iterated an empty wanted-set, `surfacesHeld` was `{}`
|
|
131
|
+
* on every cadence, and two goals over the same directory were placed
|
|
132
|
+
* together exactly as if neither had declared anything.
|
|
133
|
+
*
|
|
134
|
+
* The gate was not weak. It was reading a field nobody filled in.
|
|
135
|
+
*/
|
|
136
|
+
...(g.surfaces === undefined ? {} : { surfaces: g.surfaces }),
|
|
137
|
+
...(g.kind === undefined ? {} : { kind: g.kind }),
|
|
138
|
+
/**
|
|
139
|
+
* โ ๏ธ AN UNPARSEABLE TIMESTAMP IS THE LEAST URGENT, NOT THE MOST.
|
|
140
|
+
*
|
|
141
|
+
* This was `Date.parse(g.updatedAt) || 0`, and NaN||0 is 0 โ the Unix
|
|
142
|
+
* epoch, which the age boost reads as fifty-six years of waiting. MEASURED:
|
|
143
|
+
* a goal with `updatedAt: ''` scored 1,987,288 and took the only slot ahead
|
|
144
|
+
* of a priority-100 goal from a minute ago, with a reason line reporting
|
|
145
|
+
* the number as if it were earned. The comment claimed an inaccurate anchor
|
|
146
|
+
* "costs fairness, not liveness"; the fallback was the exact inverse of
|
|
147
|
+
* safe. `now` is the anchor for an unknown one: brand new, and it ages
|
|
148
|
+
* normally from here.
|
|
149
|
+
*/
|
|
150
|
+
queuedAt: Number.isFinite(Date.parse(g.updatedAt)) ? Date.parse(g.updatedAt) : Date.now(),
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The runs in flight, from the registry the bound already uses.
|
|
155
|
+
*
|
|
156
|
+
* โ ๏ธ ACTIVE ONLY. An orphaned record is a crashed run: counting it would hold
|
|
157
|
+
* capacity a dead process is not using, and the reaper is what clears it.
|
|
158
|
+
*/
|
|
159
|
+
function runsFor(registry) {
|
|
160
|
+
return registry
|
|
161
|
+
.list()
|
|
162
|
+
.filter((e) => e.kind === 'active')
|
|
163
|
+
.map((e) => ({
|
|
164
|
+
runId: e.record.runId,
|
|
165
|
+
goalId: goalOfRun(e.record.stateDir),
|
|
166
|
+
startedAt: Date.parse(e.record.startedAt) || 0,
|
|
167
|
+
workspace: e.record.workspace,
|
|
168
|
+
/**
|
|
169
|
+
* M4-2 โ PREEMPTIBILITY IS A FACT ABOUT WHO ASKED FOR THE RUN, and the
|
|
170
|
+
* record now carries it. A machine-started run (`startedBy: 'machine'`,
|
|
171
|
+
* written by the run from the launcher's `--autonomous`) may be asked to
|
|
172
|
+
* stop at its round boundary; a run a person started may not; a record
|
|
173
|
+
* from before the fact existed has no `startedBy` and is a person's.
|
|
174
|
+
* Acting on the scheduler's `preempt` is the daemon's, behind
|
|
175
|
+
* `machine.preemption` โ off, this fact changes nothing.
|
|
176
|
+
*/
|
|
177
|
+
preemptible: e.record.startedBy === 'machine',
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The checkouts the machine could hand out, and their state.
|
|
182
|
+
*
|
|
183
|
+
* โ ๏ธ QUARANTINED IS ITS OWN ANSWER, not "busy". A busy workspace frees itself
|
|
184
|
+
* when its run ends; a quarantined one never does, and a scheduler that could
|
|
185
|
+
* not tell them apart would wait for ever on a directory a person has to look
|
|
186
|
+
* at.
|
|
187
|
+
*/
|
|
188
|
+
function workspacesFor(cwd, registry, home = (0, node_os_1.homedir)()) {
|
|
189
|
+
const root = (0, workspace_1.workspacesRoot)(cwd, home);
|
|
190
|
+
let names;
|
|
191
|
+
try {
|
|
192
|
+
names = (0, node_fs_1.readdirSync)(root);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
197
|
+
const out = [];
|
|
198
|
+
for (const name of names) {
|
|
199
|
+
const path = (0, node_path_1.join)(root, name);
|
|
200
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(path, git_driver_1.STATE_DIR)))
|
|
201
|
+
continue;
|
|
202
|
+
const held = (0, workspace_quarantine_1.quarantineOf)(cwd, path);
|
|
203
|
+
if (held !== null) {
|
|
204
|
+
out.push({ path, state: 'quarantined' });
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
out.push({ path, state: (0, workspace_1.checkoutBusy)((0, node_path_1.join)(path, git_driver_1.STATE_DIR, 'state')) ? 'busy' : 'idle' });
|
|
208
|
+
}
|
|
209
|
+
// Deterministic: the scheduler hands out idle checkouts in this order, and
|
|
210
|
+
// two ticks over one machine must agree.
|
|
211
|
+
return out.sort((a, b) => (a.path < b.path ? -1 : 1));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The holds, flattened.
|
|
215
|
+
*
|
|
216
|
+
* โ ๏ธ THE COORDINATOR EVALUATES NO DETECTORS. It asks the store which goals are
|
|
217
|
+
* held and takes the answer. A scheduler that re-derived a hold would be a
|
|
218
|
+
* second brake with its own opinion, and the two would disagree exactly when
|
|
219
|
+
* it mattered.
|
|
220
|
+
*/
|
|
221
|
+
function holdsFor(safety, goals) {
|
|
222
|
+
if (safety === null)
|
|
223
|
+
return [];
|
|
224
|
+
/**
|
|
225
|
+
* ๐ด AN UNREADABLE HISTORY HOLDS EVERYTHING โ IT USED TO HOLD NOTHING.
|
|
226
|
+
*
|
|
227
|
+
* MEASURED: a cold store whose `open()` answers `unreadable` makes every
|
|
228
|
+
* `activeIncident` return null, so this returned `[]`, so `decideSchedule`
|
|
229
|
+
* saw no holds and emitted `start`. The machine started a goal it could not
|
|
230
|
+
* show was safe to start โ while the daemon had already PRINTED that autonomy
|
|
231
|
+
* would hold, because the sibling seam a few lines away in `daemon-cmd` gets
|
|
232
|
+
* this right and refuses.
|
|
233
|
+
*
|
|
234
|
+
* `loop-safety-store` says so itself, above `activeIncident`: "an unreadable
|
|
235
|
+
* file answers null โฆ the caller treats an unreadable store as a hold in its
|
|
236
|
+
* own right, because a machine that cannot read its safety history must not
|
|
237
|
+
* spend a night on the assumption that it is empty." One caller applied that
|
|
238
|
+
* rule and one did not, and the one that did not was the new one.
|
|
239
|
+
*/
|
|
240
|
+
if (!safety.readable()) {
|
|
241
|
+
return goals.map((g) => ({
|
|
242
|
+
goalId: g.id,
|
|
243
|
+
goalVersion: g.version,
|
|
244
|
+
because: 'this machine cannot read its own loop-safety history, so it cannot show this goal is not held',
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
const out = [];
|
|
248
|
+
for (const g of goals) {
|
|
249
|
+
const incident = safety.activeIncident(g.id, g.version);
|
|
250
|
+
if (incident !== null) {
|
|
251
|
+
out.push({ goalId: g.id, goalVersion: g.version, because: incident.because });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return out;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* WHICH SURFACES ARE HELD RIGHT NOW, AND BY WHICH RUN.
|
|
258
|
+
*
|
|
259
|
+
* ๐ด THE SCHEDULER'S SURFACE GATE WAS DEAD CODE. `decideSchedule` has a
|
|
260
|
+
* `waitingOn: 'surface'` branch โ written, specced, and unreachable, because
|
|
261
|
+
* NOTHING in production ever populated `surfacesHeld`. So two goals declaring
|
|
262
|
+
* the same directory were both started in one tick, and the only thing standing
|
|
263
|
+
* between them was the surface lease refusing the second run AFTER it had been
|
|
264
|
+
* spawned, a workspace assigned and a model paid for.
|
|
265
|
+
*
|
|
266
|
+
* โ ๏ธ THE COORDINATOR ONLY LOOKS. It reports what the leases say; acquiring is
|
|
267
|
+
* still the launcher's business, in a total order, all-or-nothing, before the
|
|
268
|
+
* run starts. This is the cheap check that avoids paying for the expensive one.
|
|
269
|
+
*
|
|
270
|
+
* โ ๏ธ AND IT IS AN OPTIMISATION, NOT THE GUARANTEE. The lease is the guarantee โ
|
|
271
|
+
* this is read at decision time and the world moves. A goal that slips through
|
|
272
|
+
* meets the lease and is refused there, which is exactly where it was refused
|
|
273
|
+
* before this existed.
|
|
274
|
+
*/
|
|
275
|
+
function surfacesHeldFor(cwd, goals, now) {
|
|
276
|
+
const out = {};
|
|
277
|
+
const wanted = new Set();
|
|
278
|
+
for (const g of goals)
|
|
279
|
+
for (const s of g.surfaces ?? [])
|
|
280
|
+
wanted.add(s);
|
|
281
|
+
for (const surface of wanted) {
|
|
282
|
+
try {
|
|
283
|
+
const holder = (0, surface_lease_1.holderOf)(cwd, surface, now);
|
|
284
|
+
if (holder !== null)
|
|
285
|
+
out[surface] = holder.runId;
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
/**
|
|
289
|
+
* โ ๏ธ A SURFACE THIS CANNOT READ IS LEFT UNREPORTED, and that is safe in
|
|
290
|
+
* the one direction that matters: the scheduler then does not wait on it,
|
|
291
|
+
* the run is started, and `acquireSurfaces` โ which treats an unreadable
|
|
292
|
+
* claim as a HOLDER โ refuses it there. The guarantee is the lease.
|
|
293
|
+
*/
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return out;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Which goal a run is for, from its own lease.
|
|
300
|
+
*
|
|
301
|
+
* โ ๏ธ THE LEASE, NOT THE REGISTRY RECORD. `RunRecord` carries no goal โ it is
|
|
302
|
+
* about a CHECKOUT and a process โ while the lease is what the run wrote about
|
|
303
|
+
* what it is doing. A run bound to nothing answers the empty string, which no
|
|
304
|
+
* goal matches, so an unbound run holds capacity without ever being confused
|
|
305
|
+
* for one of the goals being scheduled.
|
|
306
|
+
*/
|
|
307
|
+
function goalOfRun(stateDir) {
|
|
308
|
+
try {
|
|
309
|
+
const raw = JSON.parse((0, node_fs_1.readFileSync)((0, run_lease_1.leasePathIn)(stateDir), 'utf8'));
|
|
310
|
+
return typeof raw.goalId === 'string' ? raw.goalId : '';
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return '';
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/** Everything the tick needs, read once. */
|
|
317
|
+
function gatherScheduleState(cwd, deps) {
|
|
318
|
+
const home = deps.home ?? (0, node_os_1.homedir)();
|
|
319
|
+
/**
|
|
320
|
+
* WHICH GOALS HAVE ACTUALLY REACHED THE LANE, read from the attempt log the
|
|
321
|
+
* integrator already writes โ not inferred, and not asked of the goal store,
|
|
322
|
+
* which knows nothing about branches.
|
|
323
|
+
*
|
|
324
|
+
* โ ๏ธ AN ATTEMPT COUNTS ONLY WHEN IT PUBLISHED. A candidate that was
|
|
325
|
+
* validated and refused put nothing on the branch, so it satisfies nothing.
|
|
326
|
+
*/
|
|
327
|
+
const integrated = deps.integrates === true
|
|
328
|
+
? new Set((0, integration_runtime_1.readAttempts)(cwd)
|
|
329
|
+
.filter((a) => a.published !== undefined && typeof a.goalId === 'string')
|
|
330
|
+
.map((a) => a.goalId))
|
|
331
|
+
: undefined;
|
|
332
|
+
const workspaces = workspacesFor(cwd, deps.registry, home);
|
|
333
|
+
// F28: where each goal's plan lives, and which grants are only holding.
|
|
334
|
+
const planHomes = homesFor(cwd, workspaces);
|
|
335
|
+
const goals = goalsFor(deps.goals, deps.autonomy, integrated).map((g) => {
|
|
336
|
+
const at = planHomes.get(`${g.id}@${g.version}`);
|
|
337
|
+
const held = deps.held?.has(g.id) === true;
|
|
338
|
+
const awaiting = deps.advised !== undefined && !deps.advised.has(`${g.id}@${g.version}`);
|
|
339
|
+
return at === undefined && !held && !awaiting
|
|
340
|
+
? g
|
|
341
|
+
: { ...g, ...(at === undefined ? {} : { home: at }), ...(held ? { held: true } : {}), ...(awaiting ? { awaitingAdvice: true } : {}) };
|
|
342
|
+
});
|
|
343
|
+
const runs = runsFor(deps.registry);
|
|
344
|
+
/**
|
|
345
|
+
* ๐ด A RUN WHOSE GOAL CANNOT BE READ MAKES EVERY START UNSAFE.
|
|
346
|
+
*
|
|
347
|
+
* `goalOfRun` answers `''` when the lease will not parse โ a torn write, a
|
|
348
|
+
* permissions change, a run that has not written it yet โ and `''` matches no
|
|
349
|
+
* goal. So a live run working goal X was reported as bound to nothing, the
|
|
350
|
+
* `running` map had no entry for X, and the scheduler started X A SECOND
|
|
351
|
+
* TIME: two checkouts, two agent processes, two sets of commits on one goal.
|
|
352
|
+
* That is the exact outcome the daemon lock exists to prevent, reached
|
|
353
|
+
* without any second coordinator being involved.
|
|
354
|
+
*
|
|
355
|
+
* โ ๏ธ SO THE WHOLE TICK HOLDS, NOT JUST THAT GOAL โ because the unreadable
|
|
356
|
+
* lease is precisely the thing that stops us knowing WHICH goal to protect.
|
|
357
|
+
* It is a hold for one tick: the next one re-reads, and a run that was
|
|
358
|
+
* mid-write has finished by then.
|
|
359
|
+
*/
|
|
360
|
+
const blind = runs.some((r) => r.goalId === '');
|
|
361
|
+
return {
|
|
362
|
+
now: deps.now(),
|
|
363
|
+
goals,
|
|
364
|
+
runs,
|
|
365
|
+
workspaces,
|
|
366
|
+
capacity: deps.capacity,
|
|
367
|
+
// What the leases say, so the scheduler's surface gate is reachable at all.
|
|
368
|
+
surfacesHeld: surfacesHeldFor(cwd, goals, deps.now()),
|
|
369
|
+
...(deps.integrates === undefined ? {} : { integrationRequired: deps.integrates }),
|
|
370
|
+
holds: blind
|
|
371
|
+
? goals.map((g) => ({
|
|
372
|
+
goalId: g.id,
|
|
373
|
+
goalVersion: g.version,
|
|
374
|
+
because: 'a run is in flight whose goal this machine cannot read, so it cannot show that starting ' +
|
|
375
|
+
'anything would not start the same goal twice',
|
|
376
|
+
}))
|
|
377
|
+
: holdsFor(deps.safety, goals),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=coordinator-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-state.js","sourceRoot":"","sources":["../src/coordinator-state.ts"],"names":[],"mappings":";;AAkEA,4BAYC;AAgBD,4BAgGC;AAQD,0BAoBC;AAUD,sCA0BC;AAUD,4BAkCC;AAqBD,0CAsBC;AAqBD,kDAiEC;AA3aD,qCAAgE;AAChE,qCAAkC;AAClC,yCAA0C;AAK1C,6CAAyC;AACzC,2CAA6E;AAC7E,iEAAsD;AACtD,2CAA0C;AAC1C,mDAA2C;AAC3C,+DAAqD;AACrD,+CAA+C;AA6C/C;;;;;;;GAOG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,UAAwC;IAC5E,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAA,mBAAO,EAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAA,mBAAO,EAAC,CAAC,CAAC,CAAC,CAAC;IAC3G,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAU,CAAC,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,IAAA,4BAAc,EAAC,GAAG,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE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SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QAClF,KAAK,EAAE,KAAK;YACV,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAChB,MAAM,EAAE,CAAC,CAAC,EAAE;gBACZ,WAAW,EAAE,CAAC,CAAC,OAAO;gBACtB,OAAO,EACL,0FAA0F;oBAC1F,8CAA8C;aACjD,CAAC,CAAC;YACL,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type ScheduleAction, type ScheduleCapacity, type ScheduleGoal, type ScheduleHold, type ScheduleProposal, type ScheduleRun, type ScheduleWorkspace } from '@looply/core';
|
|
2
|
+
/**
|
|
3
|
+
* THE COORDINATOR TICK: GATHER, DECIDE, RECORD. IT EXECUTES NOTHING.
|
|
4
|
+
*
|
|
5
|
+
* โ ๏ธ WHAT THIS FILE MAY NOT IMPORT, AND A SPEC ENFORCES IT: `model-transport`,
|
|
6
|
+
* `agent-*`, `prover`, `providers`. A scheduler that could reach a model would
|
|
7
|
+
* be the brain, and the brain is Phase 7 and optional. The decision itself is
|
|
8
|
+
* `decideSchedule` in core โ pure, clockless, and testable with the executor
|
|
9
|
+
* deleted from the build.
|
|
10
|
+
*
|
|
11
|
+
* โ ๏ธ AND IT IS ONE MORE JOB IN THE DAEMON'S EXISTING LOOP, NOT A PROCESS. The
|
|
12
|
+
* loop is already deterministic and single-threaded with pluggable jobs and
|
|
13
|
+
* `tick = min(all cadences)`; its errors are caught per job, so a coordinator
|
|
14
|
+
* that throws cannot reject the loop.
|
|
15
|
+
*/
|
|
16
|
+
/** Everything the tick needs, read from stores by the caller. */
|
|
17
|
+
export interface CoordinatorInput {
|
|
18
|
+
readonly now: number;
|
|
19
|
+
readonly goals: readonly ScheduleGoal[];
|
|
20
|
+
readonly runs: readonly ScheduleRun[];
|
|
21
|
+
readonly workspaces: readonly ScheduleWorkspace[];
|
|
22
|
+
readonly capacity: ScheduleCapacity;
|
|
23
|
+
readonly holds: readonly ScheduleHold[];
|
|
24
|
+
/**
|
|
25
|
+
* Which surfaces are held, and by which run.
|
|
26
|
+
*
|
|
27
|
+
* ๐ด THE SCHEDULER'S SURFACE GATE WAS DEAD CODE WITHOUT THIS. `decideSchedule`
|
|
28
|
+
* has a `waitingOn: 'surface'` branch that nothing could ever reach, so two
|
|
29
|
+
* goals declaring the same directory were both started in one tick and the
|
|
30
|
+
* only thing between them was the surface lease refusing the second AFTER a
|
|
31
|
+
* workspace had been assigned and a model paid for.
|
|
32
|
+
*/
|
|
33
|
+
readonly surfacesHeld?: Readonly<Record<string, string>>;
|
|
34
|
+
/**
|
|
35
|
+
* Does this programme integrate, so that finishing locally is not finishing?
|
|
36
|
+
*
|
|
37
|
+
* ๐ด WITHOUT THIS THE SCHEDULER'S INTEGRATION RULE IS DEAD CODE, which is
|
|
38
|
+
* the shape this repository keeps writing tests about. `decideSchedule` has a
|
|
39
|
+
* branch that refuses to start a dependent on a predecessor that never
|
|
40
|
+
* reached the lane, and it can only ever fire if somebody reports that the
|
|
41
|
+
* lane exists.
|
|
42
|
+
*/
|
|
43
|
+
readonly integrationRequired?: boolean;
|
|
44
|
+
readonly proposals?: readonly ScheduleProposal[];
|
|
45
|
+
}
|
|
46
|
+
export type TickResult = {
|
|
47
|
+
readonly ok: true;
|
|
48
|
+
readonly actions: readonly ScheduleAction[];
|
|
49
|
+
}
|
|
50
|
+
/** The tick did not happen. Nothing was decided and nothing was recorded. */
|
|
51
|
+
| {
|
|
52
|
+
readonly ok: false;
|
|
53
|
+
readonly because: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Where a project's schedule decisions are appended.
|
|
57
|
+
*
|
|
58
|
+
* ๐ด MACHINE-LEVEL, NOT `.looply/state/`. The coordinator schedules ACROSS N
|
|
59
|
+
* workspaces; a per-workspace path would put the machine-wide decision log
|
|
60
|
+
* inside one arbitrary workspace's state directory, where a `worktree remove`
|
|
61
|
+
* deletes it and a second workspace cannot read it. That is the same mistake
|
|
62
|
+
* Phase 2 spent two steps undoing for the rails ledgers, and it is not made
|
|
63
|
+
* twice: this sits beside them, under the repository's identity.
|
|
64
|
+
*/
|
|
65
|
+
export declare function schedulePath(cwd: string, home?: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Append one decided action, BEFORE it is acted on.
|
|
68
|
+
*
|
|
69
|
+
* ๐ด LED BY A NEWLINE, which is the only multi-writer-safe append idiom in this
|
|
70
|
+
* tree. A crash part-way through a write leaves a fragment with no trailing
|
|
71
|
+
* newline; the next record appended straight onto it would make the two one
|
|
72
|
+
* unparseable line, so a single torn write would cost TWO decisions rather than
|
|
73
|
+
* one. Leading each record means a fragment ends up alone on its line and is
|
|
74
|
+
* skipped by itself. `loop-safety-store` worked this out first and wrote down
|
|
75
|
+
* why; this follows it rather than rediscovering it.
|
|
76
|
+
*
|
|
77
|
+
* โ ๏ธ BEFORE, NOT AFTER. A crashed coordinator's decisions have to be replayable,
|
|
78
|
+
* and a log written after the act cannot say what was decided but not done.
|
|
79
|
+
*/
|
|
80
|
+
export declare function recordActions(cwd: string, actions: readonly ScheduleAction[], at: string, home?: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* One tick.
|
|
83
|
+
*
|
|
84
|
+
* ๐ด IT REFUSES WITHOUT THE LOCK. See `daemon-lock.ts`: two coordinators reading
|
|
85
|
+
* the same Runs at the same moment both see the same idle capacity and both
|
|
86
|
+
* emit `start` for the same goal, and the machine runs it twice โ two
|
|
87
|
+
* checkouts, two agent processes, twice the spend โ with nothing in either
|
|
88
|
+
* log saying the other existed.
|
|
89
|
+
*
|
|
90
|
+
* โ ๏ธ THE LOCK IS ONLY INSPECTED HERE. Taking it is the daemon's business, done
|
|
91
|
+
* once at startup and held for the daemon's life; a tick that took and released
|
|
92
|
+
* it would open a window between every pair of ticks.
|
|
93
|
+
*/
|
|
94
|
+
export declare function coordinatorTick(cwd: string, input: CoordinatorInput, home?: string): TickResult;
|
|
95
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../src/coordinator.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AAEH,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD;;;;;;;;OAQG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAClD;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE;AACpE,6EAA6E;GAC3E;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,MAAkB,GACvB,IAAI,CAgBN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,gBAAgB,EACvB,IAAI,GAAE,MAAkB,GACvB,UAAU,CA2BZ"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schedulePath = schedulePath;
|
|
4
|
+
exports.recordActions = recordActions;
|
|
5
|
+
exports.coordinatorTick = coordinatorTick;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const core_1 = require("@looply/core");
|
|
10
|
+
const rails_home_1 = require("./rails-home");
|
|
11
|
+
const daemon_lock_1 = require("./daemon-lock");
|
|
12
|
+
/**
|
|
13
|
+
* Where a project's schedule decisions are appended.
|
|
14
|
+
*
|
|
15
|
+
* ๐ด MACHINE-LEVEL, NOT `.looply/state/`. The coordinator schedules ACROSS N
|
|
16
|
+
* workspaces; a per-workspace path would put the machine-wide decision log
|
|
17
|
+
* inside one arbitrary workspace's state directory, where a `worktree remove`
|
|
18
|
+
* deletes it and a second workspace cannot read it. That is the same mistake
|
|
19
|
+
* Phase 2 spent two steps undoing for the rails ledgers, and it is not made
|
|
20
|
+
* twice: this sits beside them, under the repository's identity.
|
|
21
|
+
*/
|
|
22
|
+
function schedulePath(cwd, home = (0, node_os_1.homedir)()) {
|
|
23
|
+
return (0, node_path_1.join)((0, rails_home_1.railsDir)(cwd, home), '..', 'schedule.jsonl');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Append one decided action, BEFORE it is acted on.
|
|
27
|
+
*
|
|
28
|
+
* ๐ด LED BY A NEWLINE, which is the only multi-writer-safe append idiom in this
|
|
29
|
+
* tree. A crash part-way through a write leaves a fragment with no trailing
|
|
30
|
+
* newline; the next record appended straight onto it would make the two one
|
|
31
|
+
* unparseable line, so a single torn write would cost TWO decisions rather than
|
|
32
|
+
* one. Leading each record means a fragment ends up alone on its line and is
|
|
33
|
+
* skipped by itself. `loop-safety-store` worked this out first and wrote down
|
|
34
|
+
* why; this follows it rather than rediscovering it.
|
|
35
|
+
*
|
|
36
|
+
* โ ๏ธ BEFORE, NOT AFTER. A crashed coordinator's decisions have to be replayable,
|
|
37
|
+
* and a log written after the act cannot say what was decided but not done.
|
|
38
|
+
*/
|
|
39
|
+
function recordActions(cwd, actions, at, home = (0, node_os_1.homedir)()) {
|
|
40
|
+
if (actions.length === 0)
|
|
41
|
+
return;
|
|
42
|
+
const path = schedulePath(cwd, home);
|
|
43
|
+
try {
|
|
44
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(path, '..'), { recursive: true });
|
|
45
|
+
const lines = actions.map((a) => `\n${JSON.stringify({ ...a, at })}\n`).join('');
|
|
46
|
+
(0, node_fs_1.appendFileSync)(path, lines, 'utf8');
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
/**
|
|
50
|
+
* โ ๏ธ A LOG THAT WILL NOT WRITE DOES NOT STOP THE MACHINE, and that is a
|
|
51
|
+
* deliberate direction rather than an oversight. The alternative โ refusing
|
|
52
|
+
* to schedule because a history file is unwritable โ turns a full disk into
|
|
53
|
+
* a stopped project. The decisions are still returned to the caller and
|
|
54
|
+
* still printed; what is lost is the ability to replay them later.
|
|
55
|
+
*/
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One tick.
|
|
60
|
+
*
|
|
61
|
+
* ๐ด IT REFUSES WITHOUT THE LOCK. See `daemon-lock.ts`: two coordinators reading
|
|
62
|
+
* the same Runs at the same moment both see the same idle capacity and both
|
|
63
|
+
* emit `start` for the same goal, and the machine runs it twice โ two
|
|
64
|
+
* checkouts, two agent processes, twice the spend โ with nothing in either
|
|
65
|
+
* log saying the other existed.
|
|
66
|
+
*
|
|
67
|
+
* โ ๏ธ THE LOCK IS ONLY INSPECTED HERE. Taking it is the daemon's business, done
|
|
68
|
+
* once at startup and held for the daemon's life; a tick that took and released
|
|
69
|
+
* it would open a window between every pair of ticks.
|
|
70
|
+
*/
|
|
71
|
+
function coordinatorTick(cwd, input, home = (0, node_os_1.homedir)()) {
|
|
72
|
+
const lock = (0, daemon_lock_1.inspectDaemonLock)(cwd);
|
|
73
|
+
if (lock.kind !== 'mine') {
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
because: lock.kind === 'held'
|
|
77
|
+
? `another daemon holds this project's coordinator lock (pid ${lock.claim.pid})`
|
|
78
|
+
: lock.kind === 'ambiguous'
|
|
79
|
+
? `the coordinator lock cannot be read: ${lock.reason}`
|
|
80
|
+
: 'this daemon does not hold the coordinator lock',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const state = {
|
|
84
|
+
now: input.now,
|
|
85
|
+
goals: input.goals,
|
|
86
|
+
runs: input.runs,
|
|
87
|
+
workspaces: input.workspaces,
|
|
88
|
+
capacity: input.capacity,
|
|
89
|
+
holds: input.holds,
|
|
90
|
+
...(input.surfacesHeld === undefined ? {} : { surfacesHeld: input.surfacesHeld }),
|
|
91
|
+
...(input.integrationRequired === undefined ? {} : { integrationRequired: input.integrationRequired }),
|
|
92
|
+
};
|
|
93
|
+
const actions = (0, core_1.decideSchedule)(state, input.proposals ?? []);
|
|
94
|
+
recordActions(cwd, actions, new Date(input.now).toISOString(), home);
|
|
95
|
+
return { ok: true, actions };
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../src/coordinator.ts"],"names":[],"mappings":";;AA8EA,oCAEC;AAgBD,sCAqBC;AAeD,0CA+BC;AAnKD,qCAAoD;AACpD,qCAAkC;AAClC,yCAAiC;AACjC,uCAUsB;AACtB,6CAAwC;AACxC,+CAAkD;AAqDlD;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,OAAe,IAAA,iBAAO,GAAE;IAChE,OAAO,IAAA,gBAAI,EAAC,IAAA,qBAAQ,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAC3B,GAAW,EACX,OAAkC,EAClC,EAAU,EACV,OAAe,IAAA,iBAAO,GAAE;IAExB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACjC,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,IAAA,mBAAS,EAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjF,IAAA,wBAAc,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP;;;;;;WAMG;IACL,CA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AAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;IACrE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { LedgerFs } from './ledger-store';
|
|
2
|
+
/**
|
|
3
|
+
* How far the server has confirmed each run โ `cursor.json` under the state dir.
|
|
4
|
+
*
|
|
5
|
+
* DESIGN ยง3.2 specifies this file and nothing ever wrote it. Acknowledged heads
|
|
6
|
+
* lived only in `EventUploader.acked`, a Map that dies with the process, and
|
|
7
|
+
* nothing replayed the ledger afterwards. So an event appended while the server
|
|
8
|
+
* was away, or buffered when the run exited, stayed on disk and never reached
|
|
9
|
+
* the server โ for good. The ledger was complete and the mirror was silently
|
|
10
|
+
* short, which is exactly the failure the ledger exists to make impossible.
|
|
11
|
+
*
|
|
12
|
+
* What is stored is the greatest **contiguous** seq per run that the server has
|
|
13
|
+
* confirmed holding. Contiguous is the load-bearing word โ see
|
|
14
|
+
* `EventUploader.durableCursors`.
|
|
15
|
+
*/
|
|
16
|
+
export interface CursorFile {
|
|
17
|
+
version: 1;
|
|
18
|
+
/** runId โ the highest seq below which nothing is missing. */
|
|
19
|
+
runs: Record<string, number>;
|
|
20
|
+
}
|
|
21
|
+
export declare class CursorStore {
|
|
22
|
+
private readonly stateDir;
|
|
23
|
+
private readonly fs;
|
|
24
|
+
/** Distinguishes two writes from ONE process; the pid distinguishes processes. */
|
|
25
|
+
private static writes;
|
|
26
|
+
private cursors;
|
|
27
|
+
private readable;
|
|
28
|
+
constructor(stateDir: string, fs: LedgerFs);
|
|
29
|
+
private get path();
|
|
30
|
+
/**
|
|
31
|
+
* Read what is on disk.
|
|
32
|
+
*
|
|
33
|
+
* A file that cannot be read is treated as no cursor at all, which replays
|
|
34
|
+
* more than necessary. That is the safe direction: ingest is idempotent on
|
|
35
|
+
* `(runId, seq)`, so the cost of replaying too much is duplicates the server
|
|
36
|
+
* discards, while the cost of trusting a cursor that is too high is events
|
|
37
|
+
* nothing will ever send again.
|
|
38
|
+
*/
|
|
39
|
+
open(): Promise<'ok' | 'unreadable'>;
|
|
40
|
+
all(): Record<string, number>;
|
|
41
|
+
headFor(runId: string): number;
|
|
42
|
+
/**
|
|
43
|
+
* Move the cursors forward and write them down.
|
|
44
|
+
*
|
|
45
|
+
* Monotonic by construction: a lower number is ignored rather than written.
|
|
46
|
+
* Acknowledgements can arrive out of order after a retry, and a cursor that
|
|
47
|
+
* went backwards would re-send events the server already holds โ harmless โ
|
|
48
|
+
* but one that could be *lowered by a stale ack* and then raised by a partial
|
|
49
|
+
* one could skip a gap, which is not.
|
|
50
|
+
*/
|
|
51
|
+
advance(next: Record<string, number>): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=cursor-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-store.d.ts","sourceRoot":"","sources":["../src/cursor-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,CAAC,CAAC;IACX,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qBAAa,WAAW;IAQpB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE;IARrB,kFAAkF;IAClF,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAE1B,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,QAAQ,CAAQ;gBAGL,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,QAAQ;IAG/B,OAAO,KAAK,IAAI,GAEf;IAED;;;;;;;;OAQG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;IA0B1C,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI9B;;;;;;;;OAQG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB3D"}
|