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
package/dist/daemon.js
ADDED
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Daemon = exports.DEFAULT_AUTONOMY_POLL_MS = exports.DEFAULT_STALE_POLL_MS = exports.DEFAULT_GOAL_POLL_MS = exports.DEFAULT_COMMAND_POLL_MS = exports.DEFAULT_FLUSH_MS = exports.MAX_HEARTBEAT_MS = exports.MIN_HEARTBEAT_MS = exports.DEFAULT_HEARTBEAT_MS = void 0;
|
|
4
|
+
exports.heartbeatCadenceMs = heartbeatCadenceMs;
|
|
5
|
+
const uploader_1 = require("./uploader");
|
|
6
|
+
const server_client_1 = require("./server-client");
|
|
7
|
+
/** Boolean handlers predate dispositions; true was "done" and false was "leave it". */
|
|
8
|
+
function decisionOf(result) {
|
|
9
|
+
if (result === true)
|
|
10
|
+
return { disposition: 'done' };
|
|
11
|
+
if (result === false)
|
|
12
|
+
return { disposition: 'retry' };
|
|
13
|
+
if (typeof result === 'string')
|
|
14
|
+
return { disposition: result };
|
|
15
|
+
return { disposition: 'refused', reason: result.reason };
|
|
16
|
+
}
|
|
17
|
+
exports.DEFAULT_HEARTBEAT_MS = 15_000;
|
|
18
|
+
/**
|
|
19
|
+
* Bounds on a cadence the SERVER proposes.
|
|
20
|
+
*
|
|
21
|
+
* The floor stops a malformed or hostile `refreshS` turning the loop into a
|
|
22
|
+
* spin — `tick` is the MINIMUM of every cadence, so a zero here would busy-wait
|
|
23
|
+
* the whole daemon, not just the heartbeat. The ceiling is a sanity limit; a
|
|
24
|
+
* server that wants an hour between beats has almost certainly sent nonsense.
|
|
25
|
+
*/
|
|
26
|
+
exports.MIN_HEARTBEAT_MS = 2_000;
|
|
27
|
+
exports.MAX_HEARTBEAT_MS = 300_000;
|
|
28
|
+
/**
|
|
29
|
+
* How often to beat: what the operator configured, else what the server asked
|
|
30
|
+
* for, else the built-in default.
|
|
31
|
+
*
|
|
32
|
+
* 🔴 THE SERVER PUBLISHES THIS CADENCE ON PURPOSE AND NOTHING WAS READING IT.
|
|
33
|
+
* `MachinesService.heartbeat` returns `{ ttlS, refreshS }` and says why in its
|
|
34
|
+
* own words: "the cadence is server-owned, so tuning the TTL never requires
|
|
35
|
+
* shipping a new CLI." That property was FALSE. The daemon paced on
|
|
36
|
+
* `DEFAULT_HEARTBEAT_MS` and discarded the response — it could not have used
|
|
37
|
+
* `refreshS`, because `ServerClient` typed the reply `{ ok, nextBeatS? }` and
|
|
38
|
+
* BOTH of those fields were invented. Found by driving the real client against
|
|
39
|
+
* a real server (`daemon-client-flagship.e2e.spec.ts`).
|
|
40
|
+
*
|
|
41
|
+
* ⚠️ TODAY THIS CHANGES NOTHING, AND THAT IS THE UNCOMFORTABLE PART. The server
|
|
42
|
+
* says `PRESENCE_REFRESH_S = 15` and this file said `15_000`, so the two agreed
|
|
43
|
+
* — by coincidence, as two hardcoded constants written independently in two
|
|
44
|
+
* trees. The failure was asymmetric and waiting: RAISING the server's TTL is
|
|
45
|
+
* harmless, but LOWERING it (say to 21s, refresh 7s) leaves a CLI beating every
|
|
46
|
+
* 15s against a 21s window, and every machine in the fleet flickers offline for
|
|
47
|
+
* a reason nothing in the CLI could explain.
|
|
48
|
+
*
|
|
49
|
+
* The operator's own `--heartbeat-ms` still wins: a person who pinned a cadence
|
|
50
|
+
* on this machine outranks a suggestion from the other end of the wire.
|
|
51
|
+
*/
|
|
52
|
+
function heartbeatCadenceMs(configured, serverRefreshS) {
|
|
53
|
+
if (configured !== undefined)
|
|
54
|
+
return configured;
|
|
55
|
+
if (typeof serverRefreshS !== 'number' || !Number.isFinite(serverRefreshS)) {
|
|
56
|
+
return exports.DEFAULT_HEARTBEAT_MS;
|
|
57
|
+
}
|
|
58
|
+
const ms = Math.round(serverRefreshS * 1000);
|
|
59
|
+
if (ms <= 0)
|
|
60
|
+
return exports.DEFAULT_HEARTBEAT_MS;
|
|
61
|
+
return Math.min(exports.MAX_HEARTBEAT_MS, Math.max(exports.MIN_HEARTBEAT_MS, ms));
|
|
62
|
+
}
|
|
63
|
+
exports.DEFAULT_FLUSH_MS = 5_000;
|
|
64
|
+
/** Fast enough that a tap on a phone feels immediate, slow enough to be free. */
|
|
65
|
+
exports.DEFAULT_COMMAND_POLL_MS = 3_000;
|
|
66
|
+
/**
|
|
67
|
+
* Goal intent changes when a person types, not when the loop runs, so this is
|
|
68
|
+
* slow on purpose. Nothing reads the mirror in this phase; refreshing it faster
|
|
69
|
+
* would spend requests on a file with no consumer.
|
|
70
|
+
*/
|
|
71
|
+
exports.DEFAULT_GOAL_POLL_MS = 30_000;
|
|
72
|
+
/**
|
|
73
|
+
* How often a dead run is looked for.
|
|
74
|
+
*
|
|
75
|
+
* Slow on purpose. It reads a lease file and, at most, writes one ending for a
|
|
76
|
+
* process that is already gone — there is nothing to be gained by asking often,
|
|
77
|
+
* and a run that ends normally writes its own ending within milliseconds. The
|
|
78
|
+
* cost of being late is that something waiting on a CRASHED run waits up to
|
|
79
|
+
* this long, which is a minute, once, for a case that should be rare.
|
|
80
|
+
*/
|
|
81
|
+
exports.DEFAULT_STALE_POLL_MS = 60_000;
|
|
82
|
+
/**
|
|
83
|
+
* How often a controller gets a turn.
|
|
84
|
+
*
|
|
85
|
+
* Ten seconds, chosen against the cadences already here rather than picked: the
|
|
86
|
+
* command poll is 3s because a person is waiting for their tap to land, the
|
|
87
|
+
* heartbeat 15s, the goal pull 30s, the stale sweep 60s. Nobody is waiting on
|
|
88
|
+
* an autonomous Start — the person authorized it and went to bed — so it sits
|
|
89
|
+
* between the ones that serve a live tap and the ones that sweep.
|
|
90
|
+
*
|
|
91
|
+
* It also bounds the cost of the one thing a tick can do that is not free. A
|
|
92
|
+
* tick that launches a Start waits for the child's settle window (750ms) before
|
|
93
|
+
* returning, so at this cadence the controller can occupy at most about seven
|
|
94
|
+
* per cent of one daemon's time, and only on the ticks that actually launch.
|
|
95
|
+
*/
|
|
96
|
+
exports.DEFAULT_AUTONOMY_POLL_MS = 10_000;
|
|
97
|
+
class Daemon {
|
|
98
|
+
deps;
|
|
99
|
+
uploader;
|
|
100
|
+
running = false;
|
|
101
|
+
online = false;
|
|
102
|
+
lastBeatAt = null;
|
|
103
|
+
missedBeats = 0;
|
|
104
|
+
delivered = 0;
|
|
105
|
+
/** Whether the server-kept-fewer-than-it-was-sent line has been said. */
|
|
106
|
+
unackedReported = false;
|
|
107
|
+
/** Commands already reported as left-queued, so a retry loop says so once. */
|
|
108
|
+
retried = new Set();
|
|
109
|
+
/**
|
|
110
|
+
* Whether the current outage has been mentioned.
|
|
111
|
+
*
|
|
112
|
+
* Not `online`, which starts false: keying the message off a true→false
|
|
113
|
+
* transition means a daemon that never connects in the first place says
|
|
114
|
+
* nothing at all, which is the one case where the user most needs telling.
|
|
115
|
+
*/
|
|
116
|
+
outageReported = false;
|
|
117
|
+
/**
|
|
118
|
+
* The refresh interval the server last asked for, in seconds; null until a
|
|
119
|
+
* heartbeat has succeeded. Read through `heartbeatCadenceMs`, never directly.
|
|
120
|
+
*/
|
|
121
|
+
serverRefreshS = null;
|
|
122
|
+
/** Set when the server refuses the credential; retrying cannot fix that. */
|
|
123
|
+
revoked = false;
|
|
124
|
+
/** Whether the buffer overflow has been mentioned; see `enqueue`. */
|
|
125
|
+
overflowReported = false;
|
|
126
|
+
/** Whether the catching-up line has been said for the current backlog. */
|
|
127
|
+
replayReported = false;
|
|
128
|
+
/** Whether the ledger-unreadable line has been said for the current outage. */
|
|
129
|
+
replayFailureReported = false;
|
|
130
|
+
goalFailureReported = false;
|
|
131
|
+
constructor(deps) {
|
|
132
|
+
this.deps = deps;
|
|
133
|
+
const transport = {
|
|
134
|
+
post: (projectId, events) => deps.client.postEvents(projectId, events),
|
|
135
|
+
};
|
|
136
|
+
this.uploader = new uploader_1.EventUploader(deps.projectId, transport, undefined, deps.bufferLimit ?? uploader_1.DEFAULT_BUFFER_LIMIT);
|
|
137
|
+
}
|
|
138
|
+
/** Queue an event for the next flush. Called from the ledger append path. */
|
|
139
|
+
enqueue(event) {
|
|
140
|
+
this.uploader.enqueue(event);
|
|
141
|
+
// Said once, on the transition into overflow. This is the append path of a
|
|
142
|
+
// run that may last hours: a line per dropped event would be a second,
|
|
143
|
+
// louder way of running out of resources.
|
|
144
|
+
if (!this.overflowReported && this.uploader.dropped() > 0) {
|
|
145
|
+
this.overflowReported = true;
|
|
146
|
+
this.deps.log('daemon : the upload buffer is full — the oldest events are being dropped.');
|
|
147
|
+
this.deps.log(' Your phone will show a gap; the ledger on this machine is complete.');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Hand the uploader whatever the ledger holds and the cursor does not cover.
|
|
152
|
+
*
|
|
153
|
+
* Asked on every flush tick, not once. This used to latch itself off the
|
|
154
|
+
* first time a pass found nothing to send — and the ordinary case is that the
|
|
155
|
+
* very first pass finds nothing, because the daemon is started before any run
|
|
156
|
+
* exists. So it replayed zero on its first tick, closed the latch, and never
|
|
157
|
+
* looked at the ledger again for the rest of its life. A run that died an
|
|
158
|
+
* hour later left its tail on disk with nothing that would ever look at it:
|
|
159
|
+
* exactly the failure replay was written to close, put back by the
|
|
160
|
+
* optimisation meant to make replay cheap.
|
|
161
|
+
*
|
|
162
|
+
* **"Nothing to send now" and "nothing will ever need sending again" are not
|
|
163
|
+
* the same statement, and only the first is something a pass can prove.**
|
|
164
|
+
*
|
|
165
|
+
* Being cheap is the supplier's job, not this method's — `makeLedgerReplay`
|
|
166
|
+
* skips the read entirely while the ledger cannot have grown, which costs a
|
|
167
|
+
* stat rather than a parse of the whole file.
|
|
168
|
+
*/
|
|
169
|
+
async replayOnce() {
|
|
170
|
+
if (this.revoked || !this.deps.replay)
|
|
171
|
+
return;
|
|
172
|
+
// Not while a previous batch is still unsent. The skip filter is driven by
|
|
173
|
+
// the *durable* head, and that cannot advance until a flush succeeds — so
|
|
174
|
+
// every event this pass found last time is still above it and would be
|
|
175
|
+
// handed over again, and again. Five minutes offline is sixty copies of the
|
|
176
|
+
// same backlog, and the buffer sheds its oldest to make room for them: it
|
|
177
|
+
// would throw away the beginning of the history it is restoring in order to
|
|
178
|
+
// store duplicates of the middle. On the healthy path the flush below
|
|
179
|
+
// empties the buffer every tick, so this costs nothing.
|
|
180
|
+
if (this.uploader.pending() > 0)
|
|
181
|
+
return;
|
|
182
|
+
try {
|
|
183
|
+
const r = await this.deps.replay({
|
|
184
|
+
enqueue: (e) => this.enqueue(e),
|
|
185
|
+
durableHead: (runId) => this.uploader.durableHead(runId),
|
|
186
|
+
});
|
|
187
|
+
if (r.replayed === 0) {
|
|
188
|
+
// A catch-up that finished. Re-arm the notice so the *next* backlog —
|
|
189
|
+
// the run that dies in an hour — announces itself too, instead of going
|
|
190
|
+
// out in silence because an earlier one used the line up.
|
|
191
|
+
this.replayReported = false;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (!this.replayReported) {
|
|
195
|
+
this.replayReported = true;
|
|
196
|
+
this.deps.log(`daemon : sending ${r.replayed} event(s) a previous run never delivered.`);
|
|
197
|
+
}
|
|
198
|
+
if (r.damaged > 0) {
|
|
199
|
+
this.deps.log(`daemon : ${r.damaged} ledger line(s) were too damaged to send.`);
|
|
200
|
+
}
|
|
201
|
+
// Said apart from damage: nothing is torn, and the answer is a newer
|
|
202
|
+
// looply rather than a repair.
|
|
203
|
+
if ((r.fromNewerBuild ?? 0) > 0) {
|
|
204
|
+
this.deps.log(`daemon : ${r.fromNewerBuild} ledger line(s) were written by a newer build and cannot be sent from here.`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (e) {
|
|
208
|
+
// Replay is a repair, not a duty: a ledger that cannot be read must not
|
|
209
|
+
// stop the daemon doing everything else it is for. But it must not stop
|
|
210
|
+
// replay either. A file that could not be read this second — a lock, an
|
|
211
|
+
// exhausted fd table, a scanner holding it open — is very often readable
|
|
212
|
+
// the next, and latching off on one transient error is the same permanent
|
|
213
|
+
// blindness this method was just fixed for, wearing a different hat.
|
|
214
|
+
// Said once per outage, like every other repeating condition here.
|
|
215
|
+
if (!this.replayFailureReported) {
|
|
216
|
+
this.replayFailureReported = true;
|
|
217
|
+
this.deps.log(`daemon : could not replay the ledger — ${e.message}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/** Revocation is terminal: retrying a revoked token cannot ever succeed. */
|
|
222
|
+
markRevoked() {
|
|
223
|
+
if (this.revoked)
|
|
224
|
+
return;
|
|
225
|
+
this.revoked = true;
|
|
226
|
+
this.online = false;
|
|
227
|
+
this.deps.log("daemon : this machine's access was revoked. The run continues locally,");
|
|
228
|
+
this.deps.log(' but nothing will reach your phone until you run `looply pair`.');
|
|
229
|
+
}
|
|
230
|
+
status() {
|
|
231
|
+
return {
|
|
232
|
+
online: this.online,
|
|
233
|
+
lastBeatAt: this.lastBeatAt,
|
|
234
|
+
missedBeats: this.missedBeats,
|
|
235
|
+
buffered: this.uploader.pending(),
|
|
236
|
+
delivered: this.delivered,
|
|
237
|
+
dropped: this.uploader.dropped(),
|
|
238
|
+
unacked: this.uploader.unacked(),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* One heartbeat.
|
|
243
|
+
*
|
|
244
|
+
* Presence is a TTL key on the server, so missing a beat is what makes a
|
|
245
|
+
* machine read as offline. A failure here is logged once on the transition
|
|
246
|
+
* rather than every tick — an hour offline should not be an hour of identical
|
|
247
|
+
* log lines nobody reads.
|
|
248
|
+
*/
|
|
249
|
+
async beat() {
|
|
250
|
+
if (this.revoked)
|
|
251
|
+
return false;
|
|
252
|
+
try {
|
|
253
|
+
const reply = await this.deps.client.heartbeat(this.deps.machineId, this.deps.cliVersion);
|
|
254
|
+
// ⚠️ GUARDED, NOT DESTRUCTURED. Several test doubles predate the corrected
|
|
255
|
+
// type and answer `true` or `{ ok: true }`; a daemon that threw on an
|
|
256
|
+
// unexpected heartbeat reply would turn a cosmetic mismatch into an
|
|
257
|
+
// outage. An absent cadence simply leaves the previous one standing.
|
|
258
|
+
const refreshS = reply?.refreshS;
|
|
259
|
+
if (typeof refreshS === 'number' && Number.isFinite(refreshS)) {
|
|
260
|
+
this.serverRefreshS = refreshS;
|
|
261
|
+
}
|
|
262
|
+
if (this.outageReported)
|
|
263
|
+
this.deps.log('daemon : back online');
|
|
264
|
+
this.online = true;
|
|
265
|
+
this.outageReported = false;
|
|
266
|
+
this.lastBeatAt = this.deps.now();
|
|
267
|
+
this.missedBeats = 0;
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
catch (e) {
|
|
271
|
+
if (e instanceof server_client_1.ServerError && e.isAuth) {
|
|
272
|
+
this.markRevoked();
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
this.missedBeats += 1;
|
|
276
|
+
if (!this.outageReported) {
|
|
277
|
+
this.deps.log('daemon : lost the server — buffering locally, will catch up');
|
|
278
|
+
this.outageReported = true;
|
|
279
|
+
}
|
|
280
|
+
this.online = false;
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Give a dead run its ending, if one is owed.
|
|
286
|
+
*
|
|
287
|
+
* Never throws into the loop. A recovery that failed will be tried again on
|
|
288
|
+
* the next sweep, and a daemon that died over a lease file it could not read
|
|
289
|
+
* would have turned a recoverable condition into an outage.
|
|
290
|
+
*/
|
|
291
|
+
/**
|
|
292
|
+
* Give the controller one turn.
|
|
293
|
+
*
|
|
294
|
+
* Errors are logged and swallowed, exactly as the stale sweep's are: this
|
|
295
|
+
* would otherwise be the first job in the loop capable of rejecting
|
|
296
|
+
* `Daemon.run()`, and a daemon that dies because one grant's record was
|
|
297
|
+
* briefly unreadable would take the heartbeat, the command poll and every
|
|
298
|
+
* other project's work down with it.
|
|
299
|
+
*
|
|
300
|
+
* There is no retry here. The next cadence is the retry, and a tight catch
|
|
301
|
+
* loop would turn a server outage into a spin.
|
|
302
|
+
*/
|
|
303
|
+
async runAutonomyTick() {
|
|
304
|
+
if (this.revoked)
|
|
305
|
+
return;
|
|
306
|
+
try {
|
|
307
|
+
await this.deps.autonomyTick?.();
|
|
308
|
+
}
|
|
309
|
+
catch (e) {
|
|
310
|
+
this.deps.log(`autonomy: could not take a turn (${e.message})`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/** See {@link DaemonDeps.coordinatorTick}. Caught like every other job. */
|
|
314
|
+
async runCoordinatorTick() {
|
|
315
|
+
if (this.revoked)
|
|
316
|
+
return;
|
|
317
|
+
try {
|
|
318
|
+
await this.deps.coordinatorTick?.();
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
this.deps.log(`coord : could not take a turn (${e.message})`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
async sweepStaleRun() {
|
|
325
|
+
if (this.revoked)
|
|
326
|
+
return;
|
|
327
|
+
try {
|
|
328
|
+
await this.deps.recoverStaleRun?.();
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
this.deps.log(`recover: could not check for a dead run (${e.message})`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Refresh the local copy of the server's goals.
|
|
336
|
+
*
|
|
337
|
+
* Strictly a mirror: read the server's answer, write it down, and nothing
|
|
338
|
+
* else. It does not touch the queue, it does not start a run, and it does not
|
|
339
|
+
* call an agent — a goal is not read to decide what to do until a later phase,
|
|
340
|
+
* and this method existing is not that phase beginning.
|
|
341
|
+
*
|
|
342
|
+
* A failure keeps whatever the mirror already holds. Erasing a good copy
|
|
343
|
+
* because the server is briefly away would make an outage worse than it is,
|
|
344
|
+
* and the file's whole purpose is to be the answer when the server is not
|
|
345
|
+
* there to give one. Offline is already reported by the heartbeat, so this
|
|
346
|
+
* says nothing per tick.
|
|
347
|
+
*/
|
|
348
|
+
async pullGoals() {
|
|
349
|
+
const store = this.deps.goals;
|
|
350
|
+
if (this.revoked || !store)
|
|
351
|
+
return null;
|
|
352
|
+
let goals;
|
|
353
|
+
try {
|
|
354
|
+
const r = await this.deps.client.projectGoals(this.deps.projectId);
|
|
355
|
+
// A 200 is not an answer. `ServerClient.request` returns the raw text when
|
|
356
|
+
// a body is not JSON and returns any parsed JSON unchecked, so a captive
|
|
357
|
+
// portal, a proxy interstitial or a CDN error page all arrive here as a
|
|
358
|
+
// successful response — and `r.goals ?? []` would turn every one of them
|
|
359
|
+
// into a wholesale erase of the mirror. That is the precise moment the
|
|
360
|
+
// file exists for. `pollCommands` uses the same `?? []` idiom safely
|
|
361
|
+
// because an empty command list is inert; here the value REPLACES durable
|
|
362
|
+
// state, so the envelope has to be checked before it is allowed to.
|
|
363
|
+
const body = r;
|
|
364
|
+
if (typeof body !== 'object' || body === null || !Array.isArray(body.goals)) {
|
|
365
|
+
this.reportGoalFailure('the server answered with something that is not a goal list');
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
goals = body.goals;
|
|
369
|
+
}
|
|
370
|
+
catch (e) {
|
|
371
|
+
if (e instanceof server_client_1.ServerError && e.isAuth) {
|
|
372
|
+
this.markRevoked();
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
// Offline is already reported by the heartbeat. Everything else is NOT:
|
|
376
|
+
// the heartbeat is a different endpoint with a different authorization
|
|
377
|
+
// path, so a project deleted out from under this daemon, or a 500 on this
|
|
378
|
+
// route alone, would otherwise retry every thirty seconds in total silence
|
|
379
|
+
// for the machine's whole life. Said once, like `beat` and `replayOnce`.
|
|
380
|
+
if (!(e instanceof server_client_1.ServerError && e.isOffline)) {
|
|
381
|
+
this.reportGoalFailure(e.message);
|
|
382
|
+
}
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
try {
|
|
386
|
+
await store.replace(goals);
|
|
387
|
+
}
|
|
388
|
+
catch (e) {
|
|
389
|
+
// A mirror that cannot be written is a degraded cache, never a stopped
|
|
390
|
+
// daemon: the goals are safe on the server either way.
|
|
391
|
+
this.deps.log(`goals : could not write the mirror (${e.message})`);
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
this.goalFailureReported = false;
|
|
395
|
+
return goals.length;
|
|
396
|
+
}
|
|
397
|
+
/** Report a goal-refresh failure once per outage, not once per tick. */
|
|
398
|
+
reportGoalFailure(message) {
|
|
399
|
+
if (this.goalFailureReported)
|
|
400
|
+
return;
|
|
401
|
+
this.goalFailureReported = true;
|
|
402
|
+
this.deps.log(`goals : could not refresh the mirror — ${message}`);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Collect and carry out whatever the phone queued.
|
|
406
|
+
*
|
|
407
|
+
* A command is acked only once the handler says it was carried out. Acking on
|
|
408
|
+
* receipt would mean a command lost to a crash between pop and execution is
|
|
409
|
+
* gone forever, and the person who tapped Stop would never learn it did not
|
|
410
|
+
* happen.
|
|
411
|
+
*/
|
|
412
|
+
async pollCommands() {
|
|
413
|
+
if (this.revoked || !this.deps.onCommand)
|
|
414
|
+
return 0;
|
|
415
|
+
let commands;
|
|
416
|
+
try {
|
|
417
|
+
const r = await this.deps.client.popCommands(this.deps.machineId);
|
|
418
|
+
commands = r.commands ?? [];
|
|
419
|
+
}
|
|
420
|
+
catch (e) {
|
|
421
|
+
if (e instanceof server_client_1.ServerError && e.isAuth) {
|
|
422
|
+
this.markRevoked();
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
// Offline is already reported by the heartbeat; saying it twice per tick
|
|
426
|
+
// would bury everything else in the log.
|
|
427
|
+
return 0;
|
|
428
|
+
}
|
|
429
|
+
let done = 0;
|
|
430
|
+
for (const command of commands) {
|
|
431
|
+
let decided = { disposition: 'retry' };
|
|
432
|
+
try {
|
|
433
|
+
decided = decisionOf(await this.deps.onCommand(command));
|
|
434
|
+
}
|
|
435
|
+
catch (e) {
|
|
436
|
+
// Left as `retry`, and deliberately WITHOUT the thrown message as a
|
|
437
|
+
// reason: a handler that threw did not decide anything, and turning an
|
|
438
|
+
// exception into a client-visible terminal refusal is how a transient
|
|
439
|
+
// fault becomes a permanent-looking answer.
|
|
440
|
+
this.deps.log(`daemon : ${command.kind} failed — ${e.message}`);
|
|
441
|
+
}
|
|
442
|
+
const { disposition } = decided;
|
|
443
|
+
if (disposition === 'retry') {
|
|
444
|
+
// Left unacked on purpose so the next poll offers it again. Said once
|
|
445
|
+
// per command rather than per poll: a command that cannot be carried
|
|
446
|
+
// out is now genuinely retried every three seconds, and logging each
|
|
447
|
+
// attempt would turn one stuck instruction into a wall of text.
|
|
448
|
+
if (!this.retried.has(command.id)) {
|
|
449
|
+
this.retried.add(command.id);
|
|
450
|
+
this.deps.log(`daemon : ${command.kind} could not be carried out — leaving it queued`);
|
|
451
|
+
}
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
try {
|
|
455
|
+
// The reason travels with the ack, or not at all — and a `done` cannot
|
|
456
|
+
// carry one, because `decided.reason` is only ever set on a refusal.
|
|
457
|
+
// Passed as a third argument only when there IS one, so an ack with
|
|
458
|
+
// nothing to explain is the same call it has always been rather than
|
|
459
|
+
// one trailing an explicit `undefined`.
|
|
460
|
+
await (decided.reason === undefined
|
|
461
|
+
? this.deps.client.ackCommand(command.id, disposition)
|
|
462
|
+
: this.deps.client.ackCommand(command.id, disposition, decided.reason));
|
|
463
|
+
if (disposition === 'done')
|
|
464
|
+
done += 1;
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
// Carried out but unacked: it will be handed over again. Handlers are
|
|
468
|
+
// expected to be idempotent for exactly this reason.
|
|
469
|
+
this.deps.log(`daemon : ${command.kind} done but not acknowledged — it may repeat`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return done;
|
|
473
|
+
}
|
|
474
|
+
/** Ship whatever is buffered. Retained on failure; never dropped. */
|
|
475
|
+
async flush() {
|
|
476
|
+
if (this.revoked)
|
|
477
|
+
return;
|
|
478
|
+
const r = await this.uploader.flush();
|
|
479
|
+
this.delivered += r.delivered;
|
|
480
|
+
// Written after the ack, never before: a cursor ahead of what the server
|
|
481
|
+
// holds is the one failure mode worse than no cursor, because replay then
|
|
482
|
+
// skips events nothing will ever send again. `durableCursors` is a gapless
|
|
483
|
+
// prefix, not the server's max-seq — see the field it comes from.
|
|
484
|
+
await this.deps.cursors?.advance(this.uploader.durableCursors()).catch(() => undefined);
|
|
485
|
+
if (r.error && this.online) {
|
|
486
|
+
this.deps.log(`daemon : upload failed (${r.error}) — ${r.buffered} events kept for the next try`);
|
|
487
|
+
}
|
|
488
|
+
// Said once, like the overflow above. A server that accepts a batch and
|
|
489
|
+
// stores none of it answers 200, so without this the only symptom is a
|
|
490
|
+
// phone that never moves — which reads as "looply is broken" rather than
|
|
491
|
+
// "these two are disagreeing about what this project is called".
|
|
492
|
+
if (!this.unackedReported && r.unacked) {
|
|
493
|
+
this.unackedReported = true;
|
|
494
|
+
this.deps.log(`daemon : the server kept fewer events than it was sent (${r.unacked} unaccounted).`);
|
|
495
|
+
this.deps.log(' Your phone will show a gap; the ledger on this machine is complete.');
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Run until stopped.
|
|
500
|
+
*
|
|
501
|
+
* Heartbeat and flush share one clock rather than running two timers, so a
|
|
502
|
+
* slow server cannot let them drift into overlapping and doubling the load on
|
|
503
|
+
* a machine that is already struggling to reach it.
|
|
504
|
+
*/
|
|
505
|
+
async run() {
|
|
506
|
+
let heartbeatMs = heartbeatCadenceMs(this.deps.heartbeatMs, this.serverRefreshS);
|
|
507
|
+
const flushMs = this.deps.flushMs ?? exports.DEFAULT_FLUSH_MS;
|
|
508
|
+
const commandMs = this.deps.commandPollMs ?? exports.DEFAULT_COMMAND_POLL_MS;
|
|
509
|
+
const goalMs = this.deps.goalPollMs ?? exports.DEFAULT_GOAL_POLL_MS;
|
|
510
|
+
const staleMs = this.deps.stalePollMs ?? exports.DEFAULT_STALE_POLL_MS;
|
|
511
|
+
const autonomyMs = this.deps.autonomyPollMs ?? exports.DEFAULT_AUTONOMY_POLL_MS;
|
|
512
|
+
// Every cadence is in the min. Left out, a cadence smaller than the others
|
|
513
|
+
// would silently never be honoured — the loop would sleep past it every
|
|
514
|
+
// time and the dep would be a lie.
|
|
515
|
+
let tick = Math.min(heartbeatMs, flushMs, commandMs, goalMs, staleMs, autonomyMs);
|
|
516
|
+
this.running = true;
|
|
517
|
+
let lastHeartbeat = 0;
|
|
518
|
+
let lastFlush = 0;
|
|
519
|
+
let lastCommand = 0;
|
|
520
|
+
let lastGoals = 0;
|
|
521
|
+
let lastStale = 0;
|
|
522
|
+
let lastAutonomy = 0;
|
|
523
|
+
let lastCoordinator = 0;
|
|
524
|
+
// What a previous process already got through, so replay does not re-send
|
|
525
|
+
// a night's ledger every time the daemon starts.
|
|
526
|
+
const known = this.deps.cursors?.all();
|
|
527
|
+
if (known)
|
|
528
|
+
this.uploader.prime(known);
|
|
529
|
+
while (this.running && !this.deps.stopRequested?.()) {
|
|
530
|
+
const now = this.deps.now();
|
|
531
|
+
if (now - lastHeartbeat >= heartbeatMs) {
|
|
532
|
+
lastHeartbeat = now;
|
|
533
|
+
await this.beat();
|
|
534
|
+
// 🔴 `tick` IS RECOMPUTED WITH IT, AND LEAVING THAT OUT WOULD BE THE
|
|
535
|
+
// EXACT BUG THE COMMENT ABOVE WARNS OF. `tick` is the minimum of every
|
|
536
|
+
// cadence; a heartbeat that became FASTER than the old minimum would be
|
|
537
|
+
// slept straight past, every time, and the new cadence would be a lie.
|
|
538
|
+
const proposed = heartbeatCadenceMs(this.deps.heartbeatMs, this.serverRefreshS);
|
|
539
|
+
if (proposed !== heartbeatMs) {
|
|
540
|
+
this.deps.log(`daemon : heartbeat cadence now ${Math.round(proposed / 1000)}s (server)`);
|
|
541
|
+
heartbeatMs = proposed;
|
|
542
|
+
tick = Math.min(heartbeatMs, flushMs, commandMs, goalMs, staleMs, autonomyMs);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (now - lastCommand >= commandMs) {
|
|
546
|
+
lastCommand = now;
|
|
547
|
+
await this.pollCommands();
|
|
548
|
+
}
|
|
549
|
+
if (this.deps.goals && now - lastGoals >= goalMs) {
|
|
550
|
+
lastGoals = now;
|
|
551
|
+
await this.pullGoals();
|
|
552
|
+
}
|
|
553
|
+
if (this.deps.recoverStaleRun && now - lastStale >= staleMs) {
|
|
554
|
+
lastStale = now;
|
|
555
|
+
await this.sweepStaleRun();
|
|
556
|
+
}
|
|
557
|
+
// AFTER the stale sweep, on purpose. A run killed outright never writes
|
|
558
|
+
// its own ending; recovery writes it on the run's behalf. Ticking first
|
|
559
|
+
// would ask "has this run ended?" of a ledger that has not been repaired
|
|
560
|
+
// yet, and the honest answer then is "no" — so the controller would wait
|
|
561
|
+
// a whole cadence for a fact that was already available.
|
|
562
|
+
if (this.deps.autonomyTick && now - lastAutonomy >= autonomyMs) {
|
|
563
|
+
lastAutonomy = now;
|
|
564
|
+
await this.runAutonomyTick();
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* ⚠️ AFTER THE AUTONOMY TICK, ON THE SAME CADENCE, AND FOR THE SAME
|
|
568
|
+
* REASON THE AUTONOMY TICK SITS AFTER THE STALE SWEEP: a scheduler asked
|
|
569
|
+
* "what is running?" of a ledger that has not been repaired yet gets a
|
|
570
|
+
* stale answer, and the honest one was already available.
|
|
571
|
+
*/
|
|
572
|
+
if (this.deps.coordinatorTick && now - lastCoordinator >= autonomyMs) {
|
|
573
|
+
lastCoordinator = now;
|
|
574
|
+
await this.runCoordinatorTick();
|
|
575
|
+
}
|
|
576
|
+
if (now - lastFlush >= flushMs) {
|
|
577
|
+
lastFlush = now;
|
|
578
|
+
// Before the flush, so anything a dead process left behind goes out in
|
|
579
|
+
// the same pass as whatever is live. Bounded per pass: a machine that
|
|
580
|
+
// was offline all night has a very long ledger, and pouring it in at
|
|
581
|
+
// once would overflow the buffer and shed the beginning of the very
|
|
582
|
+
// history being restored. The next tick continues where this stopped.
|
|
583
|
+
await this.replayOnce();
|
|
584
|
+
await this.flush();
|
|
585
|
+
}
|
|
586
|
+
if (this.revoked)
|
|
587
|
+
break;
|
|
588
|
+
await this.deps.sleep(tick);
|
|
589
|
+
}
|
|
590
|
+
// One last flush on the way out: a graceful stop should not strand the
|
|
591
|
+
// events from the round that just finished.
|
|
592
|
+
await this.flush();
|
|
593
|
+
this.running = false;
|
|
594
|
+
return this.status();
|
|
595
|
+
}
|
|
596
|
+
stop() {
|
|
597
|
+
this.running = false;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
exports.Daemon = Daemon;
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