looply-cli 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -3
- package/dist/.src-hash +1 -0
- package/dist/acceptance-observe.d.ts +108 -0
- package/dist/acceptance-observe.d.ts.map +1 -0
- package/dist/acceptance-observe.js +152 -0
- package/dist/acceptance-observe.js.map +1 -0
- package/dist/agent-cmd.d.ts +131 -0
- package/dist/agent-cmd.d.ts.map +1 -0
- package/dist/agent-cmd.js +154 -0
- package/dist/agent-cmd.js.map +1 -0
- package/dist/agent-contained.d.ts +114 -0
- package/dist/agent-contained.d.ts.map +1 -0
- package/dist/agent-contained.js +292 -0
- package/dist/agent-contained.js.map +1 -0
- package/dist/agent-driver.d.ts +130 -0
- package/dist/agent-driver.d.ts.map +1 -0
- package/dist/agent-driver.js +170 -0
- package/dist/agent-driver.js.map +1 -0
- package/dist/agent-envelope.d.ts +94 -0
- package/dist/agent-envelope.d.ts.map +1 -0
- package/dist/agent-envelope.js +214 -0
- package/dist/agent-envelope.js.map +1 -0
- package/dist/agent-exec.d.ts +182 -0
- package/dist/agent-exec.d.ts.map +1 -0
- package/dist/agent-exec.js +125 -0
- package/dist/agent-exec.js.map +1 -0
- package/dist/agent-runtime.d.ts +23 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +143 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/approval-gate-read.d.ts +66 -0
- package/dist/approval-gate-read.d.ts.map +1 -0
- package/dist/approval-gate-read.js +138 -0
- package/dist/approval-gate-read.js.map +1 -0
- package/dist/approval-resolution.d.ts +87 -0
- package/dist/approval-resolution.d.ts.map +1 -0
- package/dist/approval-resolution.js +100 -0
- package/dist/approval-resolution.js.map +1 -0
- package/dist/approval-resumes.d.ts +102 -0
- package/dist/approval-resumes.d.ts.map +1 -0
- package/dist/approval-resumes.js +167 -0
- package/dist/approval-resumes.js.map +1 -0
- package/dist/ask-brain.d.ts +167 -0
- package/dist/ask-brain.d.ts.map +1 -0
- package/dist/ask-brain.js +355 -0
- package/dist/ask-brain.js.map +1 -0
- package/dist/autonomy-authority.d.ts +80 -0
- package/dist/autonomy-authority.d.ts.map +1 -0
- package/dist/autonomy-authority.js +82 -0
- package/dist/autonomy-authority.js.map +1 -0
- package/dist/autonomy-controller.d.ts +321 -0
- package/dist/autonomy-controller.d.ts.map +1 -0
- package/dist/autonomy-controller.js +517 -0
- package/dist/autonomy-controller.js.map +1 -0
- package/dist/autonomy-store.d.ts +327 -0
- package/dist/autonomy-store.d.ts.map +1 -0
- package/dist/autonomy-store.js +581 -0
- package/dist/autonomy-store.js.map +1 -0
- package/dist/autonomy-tick.d.ts +257 -0
- package/dist/autonomy-tick.d.ts.map +1 -0
- package/dist/autonomy-tick.js +616 -0
- package/dist/autonomy-tick.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +2727 -0
- package/dist/bin.js.map +1 -0
- package/dist/brain-advice.d.ts +21 -0
- package/dist/brain-advice.d.ts.map +1 -0
- package/dist/brain-advice.js +51 -0
- package/dist/brain-advice.js.map +1 -0
- package/dist/candidate-replay-runtime.d.ts +125 -0
- package/dist/candidate-replay-runtime.d.ts.map +1 -0
- package/dist/candidate-replay-runtime.js +188 -0
- package/dist/candidate-replay-runtime.js.map +1 -0
- package/dist/checkout-carry.d.ts +76 -0
- package/dist/checkout-carry.d.ts.map +1 -0
- package/dist/checkout-carry.js +125 -0
- package/dist/checkout-carry.js.map +1 -0
- package/dist/citation-readers.d.ts +26 -0
- package/dist/citation-readers.d.ts.map +1 -0
- package/dist/citation-readers.js +102 -0
- package/dist/citation-readers.js.map +1 -0
- package/dist/command-receipts.d.ts +79 -0
- package/dist/command-receipts.d.ts.map +1 -0
- package/dist/command-receipts.js +143 -0
- package/dist/command-receipts.js.map +1 -0
- package/dist/command-runner.d.ts +32 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +108 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/compatible-sets.d.ts +67 -0
- package/dist/compatible-sets.d.ts.map +1 -0
- package/dist/compatible-sets.js +81 -0
- package/dist/compatible-sets.js.map +1 -0
- package/dist/compile-check.d.ts +31 -0
- package/dist/compile-check.d.ts.map +1 -0
- package/dist/compile-check.js +34 -0
- package/dist/compile-check.js.map +1 -0
- package/dist/compile-store.d.ts +16 -0
- package/dist/compile-store.d.ts.map +1 -0
- package/dist/compile-store.js +21 -0
- package/dist/compile-store.js.map +1 -0
- package/dist/completion.d.ts +106 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +131 -0
- package/dist/completion.js.map +1 -0
- package/dist/config.d.ts +549 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +763 -0
- package/dist/config.js.map +1 -0
- package/dist/control-file.d.ts +142 -0
- package/dist/control-file.d.ts.map +1 -0
- package/dist/control-file.js +144 -0
- package/dist/control-file.js.map +1 -0
- package/dist/coordinator-state.d.ts +131 -0
- package/dist/coordinator-state.d.ts.map +1 -0
- package/dist/coordinator-state.js +380 -0
- package/dist/coordinator-state.js.map +1 -0
- package/dist/coordinator.d.ts +95 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +97 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/cursor-store.d.ts +53 -0
- package/dist/cursor-store.d.ts.map +1 -0
- package/dist/cursor-store.js +98 -0
- package/dist/cursor-store.js.map +1 -0
- package/dist/daemon-cmd.d.ts +239 -0
- package/dist/daemon-cmd.d.ts.map +1 -0
- package/dist/daemon-cmd.js +1751 -0
- package/dist/daemon-cmd.js.map +1 -0
- package/dist/daemon-lock.d.ts +140 -0
- package/dist/daemon-lock.d.ts.map +1 -0
- package/dist/daemon-lock.js +352 -0
- package/dist/daemon-lock.js.map +1 -0
- package/dist/daemon-recovery.d.ts +78 -0
- package/dist/daemon-recovery.d.ts.map +1 -0
- package/dist/daemon-recovery.js +161 -0
- package/dist/daemon-recovery.js.map +1 -0
- package/dist/daemon.d.ts +368 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +601 -0
- package/dist/daemon.js.map +1 -0
- package/dist/declared-response-shape.d.ts +93 -0
- package/dist/declared-response-shape.d.ts.map +1 -0
- package/dist/declared-response-shape.js +200 -0
- package/dist/declared-response-shape.js.map +1 -0
- package/dist/declared-surfaces.d.ts +16 -0
- package/dist/declared-surfaces.d.ts.map +1 -0
- package/dist/declared-surfaces.js +19 -0
- package/dist/declared-surfaces.js.map +1 -0
- package/dist/depends-review.d.ts +113 -0
- package/dist/depends-review.d.ts.map +1 -0
- package/dist/depends-review.js +110 -0
- package/dist/depends-review.js.map +1 -0
- package/dist/doctor.d.ts +91 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +71 -0
- package/dist/doctor.js.map +1 -0
- package/dist/edge-approval.d.ts +105 -0
- package/dist/edge-approval.d.ts.map +1 -0
- package/dist/edge-approval.js +100 -0
- package/dist/edge-approval.js.map +1 -0
- package/dist/evidence-cache.d.ts +45 -0
- package/dist/evidence-cache.d.ts.map +1 -0
- package/dist/evidence-cache.js +90 -0
- package/dist/evidence-cache.js.map +1 -0
- package/dist/evidence-cmd.d.ts +133 -0
- package/dist/evidence-cmd.d.ts.map +1 -0
- package/dist/evidence-cmd.js +347 -0
- package/dist/evidence-cmd.js.map +1 -0
- package/dist/evidence-facts.d.ts +40 -0
- package/dist/evidence-facts.d.ts.map +1 -0
- package/dist/evidence-facts.js +114 -0
- package/dist/evidence-facts.js.map +1 -0
- package/dist/exclusive-lock.d.ts +52 -0
- package/dist/exclusive-lock.d.ts.map +1 -0
- package/dist/exclusive-lock.js +150 -0
- package/dist/exclusive-lock.js.map +1 -0
- package/dist/exec-domains.d.ts +140 -0
- package/dist/exec-domains.d.ts.map +1 -0
- package/dist/exec-domains.js +287 -0
- package/dist/exec-domains.js.map +1 -0
- package/dist/exemption-store.d.ts +197 -0
- package/dist/exemption-store.d.ts.map +1 -0
- package/dist/exemption-store.js +266 -0
- package/dist/exemption-store.js.map +1 -0
- package/dist/explicit-start-gate.d.ts +96 -0
- package/dist/explicit-start-gate.d.ts.map +1 -0
- package/dist/explicit-start-gate.js +103 -0
- package/dist/explicit-start-gate.js.map +1 -0
- package/dist/fs-trouble.d.ts +70 -0
- package/dist/fs-trouble.d.ts.map +1 -0
- package/dist/fs-trouble.js +98 -0
- package/dist/fs-trouble.js.map +1 -0
- package/dist/gate.d.ts +278 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +278 -0
- package/dist/gate.js.map +1 -0
- package/dist/git-driver.d.ts +519 -0
- package/dist/git-driver.d.ts.map +1 -0
- package/dist/git-driver.js +900 -0
- package/dist/git-driver.js.map +1 -0
- package/dist/git-push-executor.d.ts +41 -0
- package/dist/git-push-executor.d.ts.map +1 -0
- package/dist/git-push-executor.js +142 -0
- package/dist/git-push-executor.js.map +1 -0
- package/dist/glob.d.ts +26 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +93 -0
- package/dist/glob.js.map +1 -0
- package/dist/goal-adaptive.d.ts +295 -0
- package/dist/goal-adaptive.d.ts.map +1 -0
- package/dist/goal-adaptive.js +393 -0
- package/dist/goal-adaptive.js.map +1 -0
- package/dist/goal-compile.d.ts +342 -0
- package/dist/goal-compile.d.ts.map +1 -0
- package/dist/goal-compile.js +444 -0
- package/dist/goal-compile.js.map +1 -0
- package/dist/goal-depends-executor.d.ts +55 -0
- package/dist/goal-depends-executor.d.ts.map +1 -0
- package/dist/goal-depends-executor.js +202 -0
- package/dist/goal-depends-executor.js.map +1 -0
- package/dist/goal-execution-evidence.d.ts +135 -0
- package/dist/goal-execution-evidence.d.ts.map +1 -0
- package/dist/goal-execution-evidence.js +159 -0
- package/dist/goal-execution-evidence.js.map +1 -0
- package/dist/goal-gap.d.ts +140 -0
- package/dist/goal-gap.d.ts.map +1 -0
- package/dist/goal-gap.js +197 -0
- package/dist/goal-gap.js.map +1 -0
- package/dist/goal-met-target.d.ts +98 -0
- package/dist/goal-met-target.d.ts.map +1 -0
- package/dist/goal-met-target.js +92 -0
- package/dist/goal-met-target.js.map +1 -0
- package/dist/goal-ownership.d.ts +416 -0
- package/dist/goal-ownership.d.ts.map +1 -0
- package/dist/goal-ownership.js +576 -0
- package/dist/goal-ownership.js.map +1 -0
- package/dist/goal-runs.d.ts +82 -0
- package/dist/goal-runs.d.ts.map +1 -0
- package/dist/goal-runs.js +120 -0
- package/dist/goal-runs.js.map +1 -0
- package/dist/goal-store.d.ts +146 -0
- package/dist/goal-store.d.ts.map +1 -0
- package/dist/goal-store.js +294 -0
- package/dist/goal-store.js.map +1 -0
- package/dist/goal-view.d.ts +156 -0
- package/dist/goal-view.d.ts.map +1 -0
- package/dist/goal-view.js +499 -0
- package/dist/goal-view.js.map +1 -0
- package/dist/governed-approvals.d.ts +152 -0
- package/dist/governed-approvals.d.ts.map +1 -0
- package/dist/governed-approvals.js +246 -0
- package/dist/governed-approvals.js.map +1 -0
- package/dist/governed-broker.d.ts +169 -0
- package/dist/governed-broker.d.ts.map +1 -0
- package/dist/governed-broker.js +196 -0
- package/dist/governed-broker.js.map +1 -0
- package/dist/governed-run.d.ts +220 -0
- package/dist/governed-run.d.ts.map +1 -0
- package/dist/governed-run.js +406 -0
- package/dist/governed-run.js.map +1 -0
- package/dist/grant-reconcile.d.ts +63 -0
- package/dist/grant-reconcile.d.ts.map +1 -0
- package/dist/grant-reconcile.js +121 -0
- package/dist/grant-reconcile.js.map +1 -0
- package/dist/index-for-head.d.ts +56 -0
- package/dist/index-for-head.d.ts.map +1 -0
- package/dist/index-for-head.js +103 -0
- package/dist/index-for-head.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/init-detect.d.ts +39 -0
- package/dist/init-detect.d.ts.map +1 -0
- package/dist/init-detect.js +188 -0
- package/dist/init-detect.js.map +1 -0
- package/dist/integration-deps.d.ts +62 -0
- package/dist/integration-deps.d.ts.map +1 -0
- package/dist/integration-deps.js +251 -0
- package/dist/integration-deps.js.map +1 -0
- package/dist/integration-runtime.d.ts +458 -0
- package/dist/integration-runtime.d.ts.map +1 -0
- package/dist/integration-runtime.js +681 -0
- package/dist/integration-runtime.js.map +1 -0
- package/dist/integration.d.ts +45 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +87 -0
- package/dist/integration.js.map +1 -0
- package/dist/integrator.d.ts +84 -0
- package/dist/integrator.d.ts.map +1 -0
- package/dist/integrator.js +193 -0
- package/dist/integrator.js.map +1 -0
- package/dist/lane-claims.d.ts +174 -0
- package/dist/lane-claims.d.ts.map +1 -0
- package/dist/lane-claims.js +218 -0
- package/dist/lane-claims.js.map +1 -0
- package/dist/lane-coverage.d.ts +87 -0
- package/dist/lane-coverage.d.ts.map +1 -0
- package/dist/lane-coverage.js +129 -0
- package/dist/lane-coverage.js.map +1 -0
- package/dist/ledger-replay.d.ts +115 -0
- package/dist/ledger-replay.d.ts.map +1 -0
- package/dist/ledger-replay.js +155 -0
- package/dist/ledger-replay.js.map +1 -0
- package/dist/ledger-store.d.ts +68 -0
- package/dist/ledger-store.d.ts.map +1 -0
- package/dist/ledger-store.js +111 -0
- package/dist/ledger-store.js.map +1 -0
- package/dist/loop-safety-observer.d.ts +132 -0
- package/dist/loop-safety-observer.d.ts.map +1 -0
- package/dist/loop-safety-observer.js +76 -0
- package/dist/loop-safety-observer.js.map +1 -0
- package/dist/loop-safety-store.d.ts +339 -0
- package/dist/loop-safety-store.d.ts.map +1 -0
- package/dist/loop-safety-store.js +800 -0
- package/dist/loop-safety-store.js.map +1 -0
- package/dist/machine-store.d.ts +54 -0
- package/dist/machine-store.d.ts.map +1 -0
- package/dist/machine-store.js +149 -0
- package/dist/machine-store.js.map +1 -0
- package/dist/mcp-main.d.ts +2 -0
- package/dist/mcp-main.d.ts.map +1 -0
- package/dist/mcp-main.js +116 -0
- package/dist/mcp-main.js.map +1 -0
- package/dist/mcp-server.d.ts +72 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +259 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/model-routing.d.ts +75 -0
- package/dist/model-routing.d.ts.map +1 -0
- package/dist/model-routing.js +108 -0
- package/dist/model-routing.js.map +1 -0
- package/dist/model-transport.d.ts +188 -0
- package/dist/model-transport.d.ts.map +1 -0
- package/dist/model-transport.js +625 -0
- package/dist/model-transport.js.map +1 -0
- package/dist/notify-cadence.d.ts +55 -0
- package/dist/notify-cadence.d.ts.map +1 -0
- package/dist/notify-cadence.js +68 -0
- package/dist/notify-cadence.js.map +1 -0
- package/dist/notify-channel.d.ts +69 -0
- package/dist/notify-channel.d.ts.map +1 -0
- package/dist/notify-channel.js +151 -0
- package/dist/notify-channel.js.map +1 -0
- package/dist/notify.d.ts +71 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +125 -0
- package/dist/notify.js.map +1 -0
- package/dist/observation-inventory.d.ts +65 -0
- package/dist/observation-inventory.d.ts.map +1 -0
- package/dist/observation-inventory.js +139 -0
- package/dist/observation-inventory.js.map +1 -0
- package/dist/owned-children.d.ts +45 -0
- package/dist/owned-children.d.ts.map +1 -0
- package/dist/owned-children.js +64 -0
- package/dist/owned-children.js.map +1 -0
- package/dist/packet-for-goal.d.ts +19 -0
- package/dist/packet-for-goal.d.ts.map +1 -0
- package/dist/packet-for-goal.js +32 -0
- package/dist/packet-for-goal.js.map +1 -0
- package/dist/pair-cmd.d.ts +85 -0
- package/dist/pair-cmd.d.ts.map +1 -0
- package/dist/pair-cmd.js +205 -0
- package/dist/pair-cmd.js.map +1 -0
- package/dist/partial-asker.d.ts +96 -0
- package/dist/partial-asker.d.ts.map +1 -0
- package/dist/partial-asker.js +117 -0
- package/dist/partial-asker.js.map +1 -0
- package/dist/pdf-text-lines.d.ts +17 -0
- package/dist/pdf-text-lines.d.ts.map +1 -0
- package/dist/pdf-text-lines.js +70 -0
- package/dist/pdf-text-lines.js.map +1 -0
- package/dist/pdf-text-worker.d.ts +2 -0
- package/dist/pdf-text-worker.d.ts.map +1 -0
- package/dist/pdf-text-worker.js +81 -0
- package/dist/pdf-text-worker.js.map +1 -0
- package/dist/pdf-text.d.ts +56 -0
- package/dist/pdf-text.d.ts.map +1 -0
- package/dist/pdf-text.js +64 -0
- package/dist/pdf-text.js.map +1 -0
- package/dist/pending-action.d.ts +154 -0
- package/dist/pending-action.d.ts.map +1 -0
- package/dist/pending-action.js +148 -0
- package/dist/pending-action.js.map +1 -0
- package/dist/preemptor.d.ts +40 -0
- package/dist/preemptor.d.ts.map +1 -0
- package/dist/preemptor.js +49 -0
- package/dist/preemptor.js.map +1 -0
- package/dist/programme-mode.d.ts +29 -0
- package/dist/programme-mode.d.ts.map +1 -0
- package/dist/programme-mode.js +50 -0
- package/dist/programme-mode.js.map +1 -0
- package/dist/progress-view.d.ts +14 -0
- package/dist/progress-view.d.ts.map +1 -0
- package/dist/progress-view.js +114 -0
- package/dist/progress-view.js.map +1 -0
- package/dist/project-graph-builder.d.ts +81 -0
- package/dist/project-graph-builder.d.ts.map +1 -0
- package/dist/project-graph-builder.js +246 -0
- package/dist/project-graph-builder.js.map +1 -0
- package/dist/project-graph-runtime.d.ts +86 -0
- package/dist/project-graph-runtime.d.ts.map +1 -0
- package/dist/project-graph-runtime.js +112 -0
- package/dist/project-graph-runtime.js.map +1 -0
- package/dist/project-index-builder.d.ts +96 -0
- package/dist/project-index-builder.d.ts.map +1 -0
- package/dist/project-index-builder.js +298 -0
- package/dist/project-index-builder.js.map +1 -0
- package/dist/project-index-facts.d.ts +51 -0
- package/dist/project-index-facts.d.ts.map +1 -0
- package/dist/project-index-facts.js +117 -0
- package/dist/project-index-facts.js.map +1 -0
- package/dist/project-index-store.d.ts +97 -0
- package/dist/project-index-store.d.ts.map +1 -0
- package/dist/project-index-store.js +140 -0
- package/dist/project-index-store.js.map +1 -0
- package/dist/project-memory-store.d.ts +127 -0
- package/dist/project-memory-store.d.ts.map +1 -0
- package/dist/project-memory-store.js +302 -0
- package/dist/project-memory-store.js.map +1 -0
- package/dist/proposal-store.d.ts +14 -0
- package/dist/proposal-store.d.ts.map +1 -0
- package/dist/proposal-store.js +19 -0
- package/dist/proposal-store.js.map +1 -0
- package/dist/prover.d.ts +80 -0
- package/dist/prover.d.ts.map +1 -0
- package/dist/prover.js +137 -0
- package/dist/prover.js.map +1 -0
- package/dist/provider-identity-store.d.ts +34 -0
- package/dist/provider-identity-store.d.ts.map +1 -0
- package/dist/provider-identity-store.js +72 -0
- package/dist/provider-identity-store.js.map +1 -0
- package/dist/provider-identity.d.ts +104 -0
- package/dist/provider-identity.d.ts.map +1 -0
- package/dist/provider-identity.js +167 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/provider-limit.d.ts +79 -0
- package/dist/provider-limit.d.ts.map +1 -0
- package/dist/provider-limit.js +148 -0
- package/dist/provider-limit.js.map +1 -0
- package/dist/provider-preflight.d.ts +171 -0
- package/dist/provider-preflight.d.ts.map +1 -0
- package/dist/provider-preflight.js +395 -0
- package/dist/provider-preflight.js.map +1 -0
- package/dist/provider-state.d.ts +120 -0
- package/dist/provider-state.d.ts.map +1 -0
- package/dist/provider-state.js +182 -0
- package/dist/provider-state.js.map +1 -0
- package/dist/providers.d.ts +132 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +161 -0
- package/dist/providers.js.map +1 -0
- package/dist/publication-recorder.d.ts +117 -0
- package/dist/publication-recorder.d.ts.map +1 -0
- package/dist/publication-recorder.js +124 -0
- package/dist/publication-recorder.js.map +1 -0
- package/dist/pursuit-delivery.d.ts +24 -0
- package/dist/pursuit-delivery.d.ts.map +1 -0
- package/dist/pursuit-delivery.js +38 -0
- package/dist/pursuit-delivery.js.map +1 -0
- package/dist/queue-store.d.ts +132 -0
- package/dist/queue-store.d.ts.map +1 -0
- package/dist/queue-store.js +185 -0
- package/dist/queue-store.js.map +1 -0
- package/dist/queue-summary.d.ts +14 -0
- package/dist/queue-summary.d.ts.map +1 -0
- package/dist/queue-summary.js +82 -0
- package/dist/queue-summary.js.map +1 -0
- package/dist/queue-view.d.ts +20 -0
- package/dist/queue-view.d.ts.map +1 -0
- package/dist/queue-view.js +163 -0
- package/dist/queue-view.js.map +1 -0
- package/dist/queue-write-lease.d.ts +106 -0
- package/dist/queue-write-lease.d.ts.map +1 -0
- package/dist/queue-write-lease.js +282 -0
- package/dist/queue-write-lease.js.map +1 -0
- package/dist/rails-home.d.ts +162 -0
- package/dist/rails-home.d.ts.map +1 -0
- package/dist/rails-home.js +452 -0
- package/dist/rails-home.js.map +1 -0
- package/dist/rails-migrations.d.ts +75 -0
- package/dist/rails-migrations.d.ts.map +1 -0
- package/dist/rails-migrations.js +199 -0
- package/dist/rails-migrations.js.map +1 -0
- package/dist/rails-stores.d.ts +49 -0
- package/dist/rails-stores.d.ts.map +1 -0
- package/dist/rails-stores.js +100 -0
- package/dist/rails-stores.js.map +1 -0
- package/dist/reaper.d.ts +69 -0
- package/dist/reaper.d.ts.map +1 -0
- package/dist/reaper.js +152 -0
- package/dist/reaper.js.map +1 -0
- package/dist/record-store.d.ts +36 -0
- package/dist/record-store.d.ts.map +1 -0
- package/dist/record-store.js +78 -0
- package/dist/record-store.js.map +1 -0
- package/dist/recovery-io.d.ts +50 -0
- package/dist/recovery-io.d.ts.map +1 -0
- package/dist/recovery-io.js +122 -0
- package/dist/recovery-io.js.map +1 -0
- package/dist/recovery.d.ts +146 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +110 -0
- package/dist/recovery.js.map +1 -0
- package/dist/redraw.d.ts +34 -0
- package/dist/redraw.d.ts.map +1 -0
- package/dist/redraw.js +62 -0
- package/dist/redraw.js.map +1 -0
- package/dist/rejected-evidence.d.ts +255 -0
- package/dist/rejected-evidence.d.ts.map +1 -0
- package/dist/rejected-evidence.js +324 -0
- package/dist/rejected-evidence.js.map +1 -0
- package/dist/report-cmd.d.ts +32 -0
- package/dist/report-cmd.d.ts.map +1 -0
- package/dist/report-cmd.js +201 -0
- package/dist/report-cmd.js.map +1 -0
- package/dist/repos-cmd.d.ts +80 -0
- package/dist/repos-cmd.d.ts.map +1 -0
- package/dist/repos-cmd.js +240 -0
- package/dist/repos-cmd.js.map +1 -0
- package/dist/request-body-shape.d.ts +93 -0
- package/dist/request-body-shape.d.ts.map +1 -0
- package/dist/request-body-shape.js +407 -0
- package/dist/request-body-shape.js.map +1 -0
- package/dist/requirement-claims.d.ts +89 -0
- package/dist/requirement-claims.d.ts.map +1 -0
- package/dist/requirement-claims.js +92 -0
- package/dist/requirement-claims.js.map +1 -0
- package/dist/retention-apply-runtime.d.ts +105 -0
- package/dist/retention-apply-runtime.d.ts.map +1 -0
- package/dist/retention-apply-runtime.js +269 -0
- package/dist/retention-apply-runtime.js.map +1 -0
- package/dist/reverify.d.ts +41 -0
- package/dist/reverify.d.ts.map +1 -0
- package/dist/reverify.js +69 -0
- package/dist/reverify.js.map +1 -0
- package/dist/round-records.d.ts +65 -0
- package/dist/round-records.d.ts.map +1 -0
- package/dist/round-records.js +61 -0
- package/dist/round-records.js.map +1 -0
- package/dist/round-runner.d.ts +924 -0
- package/dist/round-runner.d.ts.map +1 -0
- package/dist/round-runner.js +1693 -0
- package/dist/round-runner.js.map +1 -0
- package/dist/run-approval.d.ts +180 -0
- package/dist/run-approval.d.ts.map +1 -0
- package/dist/run-approval.js +199 -0
- package/dist/run-approval.js.map +1 -0
- package/dist/run-cmd.d.ts +359 -0
- package/dist/run-cmd.d.ts.map +1 -0
- package/dist/run-cmd.js +4418 -0
- package/dist/run-cmd.js.map +1 -0
- package/dist/run-delivery.d.ts +71 -0
- package/dist/run-delivery.d.ts.map +1 -0
- package/dist/run-delivery.js +104 -0
- package/dist/run-delivery.js.map +1 -0
- package/dist/run-ended.d.ts +75 -0
- package/dist/run-ended.d.ts.map +1 -0
- package/dist/run-ended.js +27 -0
- package/dist/run-ended.js.map +1 -0
- package/dist/run-ending-locator.d.ts +125 -0
- package/dist/run-ending-locator.d.ts.map +1 -0
- package/dist/run-ending-locator.js +133 -0
- package/dist/run-ending-locator.js.map +1 -0
- package/dist/run-launcher.d.ts +459 -0
- package/dist/run-launcher.d.ts.map +1 -0
- package/dist/run-launcher.js +652 -0
- package/dist/run-launcher.js.map +1 -0
- package/dist/run-lease.d.ts +208 -0
- package/dist/run-lease.d.ts.map +1 -0
- package/dist/run-lease.js +301 -0
- package/dist/run-lease.js.map +1 -0
- package/dist/run-refusal-marks.d.ts +189 -0
- package/dist/run-refusal-marks.d.ts.map +1 -0
- package/dist/run-refusal-marks.js +249 -0
- package/dist/run-refusal-marks.js.map +1 -0
- package/dist/run-start-marks.d.ts +153 -0
- package/dist/run-start-marks.d.ts.map +1 -0
- package/dist/run-start-marks.js +269 -0
- package/dist/run-start-marks.js.map +1 -0
- package/dist/scan-cmd.d.ts +14 -0
- package/dist/scan-cmd.d.ts.map +1 -0
- package/dist/scan-cmd.js +270 -0
- package/dist/scan-cmd.js.map +1 -0
- package/dist/scan-events.d.ts +50 -0
- package/dist/scan-events.d.ts.map +1 -0
- package/dist/scan-events.js +91 -0
- package/dist/scan-events.js.map +1 -0
- package/dist/scan.d.ts +191 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +417 -0
- package/dist/scan.js.map +1 -0
- package/dist/scope-rule.d.ts +148 -0
- package/dist/scope-rule.d.ts.map +1 -0
- package/dist/scope-rule.js +121 -0
- package/dist/scope-rule.js.map +1 -0
- package/dist/self-repo-id.d.ts +18 -0
- package/dist/self-repo-id.d.ts.map +1 -0
- package/dist/self-repo-id.js +70 -0
- package/dist/self-repo-id.js.map +1 -0
- package/dist/serve-cmd.d.ts +115 -0
- package/dist/serve-cmd.d.ts.map +1 -0
- package/dist/serve-cmd.js +505 -0
- package/dist/serve-cmd.js.map +1 -0
- package/dist/serve.d.ts +167 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +336 -0
- package/dist/serve.js.map +1 -0
- package/dist/server-client.d.ts +766 -0
- package/dist/server-client.d.ts.map +1 -0
- package/dist/server-client.js +475 -0
- package/dist/server-client.js.map +1 -0
- package/dist/session-adapter-runtime.d.ts +195 -0
- package/dist/session-adapter-runtime.d.ts.map +1 -0
- package/dist/session-adapter-runtime.js +373 -0
- package/dist/session-adapter-runtime.js.map +1 -0
- package/dist/session-checkpoint-runtime.d.ts +62 -0
- package/dist/session-checkpoint-runtime.d.ts.map +1 -0
- package/dist/session-checkpoint-runtime.js +268 -0
- package/dist/session-checkpoint-runtime.js.map +1 -0
- package/dist/session-control-transport.d.ts +106 -0
- package/dist/session-control-transport.d.ts.map +1 -0
- package/dist/session-control-transport.js +232 -0
- package/dist/session-control-transport.js.map +1 -0
- package/dist/session-observation-store.d.ts +98 -0
- package/dist/session-observation-store.d.ts.map +1 -0
- package/dist/session-observation-store.js +155 -0
- package/dist/session-observation-store.js.map +1 -0
- package/dist/session-observe-runtime.d.ts +123 -0
- package/dist/session-observe-runtime.d.ts.map +1 -0
- package/dist/session-observe-runtime.js +317 -0
- package/dist/session-observe-runtime.js.map +1 -0
- package/dist/session-store.d.ts +98 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +116 -0
- package/dist/session-store.js.map +1 -0
- package/dist/sessions-cmd.d.ts +202 -0
- package/dist/sessions-cmd.d.ts.map +1 -0
- package/dist/sessions-cmd.js +609 -0
- package/dist/sessions-cmd.js.map +1 -0
- package/dist/settings-overlay.d.ts +53 -0
- package/dist/settings-overlay.d.ts.map +1 -0
- package/dist/settings-overlay.js +175 -0
- package/dist/settings-overlay.js.map +1 -0
- package/dist/setup-prompt.d.ts +34 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/setup-prompt.js +92 -0
- package/dist/setup-prompt.js.map +1 -0
- package/dist/setup.d.ts +103 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +283 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared-grants.d.ts +164 -0
- package/dist/shared-grants.d.ts.map +1 -0
- package/dist/shared-grants.js +242 -0
- package/dist/shared-grants.js.map +1 -0
- package/dist/signals.d.ts +55 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +85 -0
- package/dist/signals.js.map +1 -0
- package/dist/source-cmd.d.ts +201 -0
- package/dist/source-cmd.d.ts.map +1 -0
- package/dist/source-cmd.js +684 -0
- package/dist/source-cmd.js.map +1 -0
- package/dist/source-verdict.d.ts +99 -0
- package/dist/source-verdict.d.ts.map +1 -0
- package/dist/source-verdict.js +182 -0
- package/dist/source-verdict.js.map +1 -0
- package/dist/spend-ledger.d.ts +350 -0
- package/dist/spend-ledger.d.ts.map +1 -0
- package/dist/spend-ledger.js +546 -0
- package/dist/spend-ledger.js.map +1 -0
- package/dist/stale-run-sweep.d.ts +79 -0
- package/dist/stale-run-sweep.d.ts.map +1 -0
- package/dist/stale-run-sweep.js +116 -0
- package/dist/stale-run-sweep.js.map +1 -0
- package/dist/start-attempts.d.ts +385 -0
- package/dist/start-attempts.d.ts.map +1 -0
- package/dist/start-attempts.js +613 -0
- package/dist/start-attempts.js.map +1 -0
- package/dist/status-cmd.d.ts +28 -0
- package/dist/status-cmd.d.ts.map +1 -0
- package/dist/status-cmd.js +116 -0
- package/dist/status-cmd.js.map +1 -0
- package/dist/stop-follow-up.d.ts +107 -0
- package/dist/stop-follow-up.d.ts.map +1 -0
- package/dist/stop-follow-up.js +172 -0
- package/dist/stop-follow-up.js.map +1 -0
- package/dist/surface-lease.d.ts +118 -0
- package/dist/surface-lease.d.ts.map +1 -0
- package/dist/surface-lease.js +485 -0
- package/dist/surface-lease.js.map +1 -0
- package/dist/sync.d.ts +54 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +93 -0
- package/dist/sync.js.map +1 -0
- package/dist/syncing-ledger.d.ts +45 -0
- package/dist/syncing-ledger.d.ts.map +1 -0
- package/dist/syncing-ledger.js +53 -0
- package/dist/syncing-ledger.js.map +1 -0
- package/dist/temp-fixtures.d.ts +68 -0
- package/dist/temp-fixtures.d.ts.map +1 -0
- package/dist/temp-fixtures.js +38 -0
- package/dist/temp-fixtures.js.map +1 -0
- package/dist/token-window.d.ts +84 -0
- package/dist/token-window.d.ts.map +1 -0
- package/dist/token-window.js +143 -0
- package/dist/token-window.js.map +1 -0
- package/dist/tool-bridge.d.ts +177 -0
- package/dist/tool-bridge.d.ts.map +1 -0
- package/dist/tool-bridge.js +329 -0
- package/dist/tool-bridge.js.map +1 -0
- package/dist/tool-call-record.d.ts +197 -0
- package/dist/tool-call-record.d.ts.map +1 -0
- package/dist/tool-call-record.js +276 -0
- package/dist/tool-call-record.js.map +1 -0
- package/dist/tool-protocol.d.ts +135 -0
- package/dist/tool-protocol.d.ts.map +1 -0
- package/dist/tool-protocol.js +104 -0
- package/dist/tool-protocol.js.map +1 -0
- package/dist/tool-worker.d.ts +3 -0
- package/dist/tool-worker.d.ts.map +1 -0
- package/dist/tool-worker.js +478 -0
- package/dist/tool-worker.js.map +1 -0
- package/dist/toolchain-mirror.d.ts +86 -0
- package/dist/toolchain-mirror.d.ts.map +1 -0
- package/dist/toolchain-mirror.js +307 -0
- package/dist/toolchain-mirror.js.map +1 -0
- package/dist/trusted-git.d.ts +243 -0
- package/dist/trusted-git.d.ts.map +1 -0
- package/dist/trusted-git.js +920 -0
- package/dist/trusted-git.js.map +1 -0
- package/dist/ui.d.ts +76 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +118 -0
- package/dist/ui.js.map +1 -0
- package/dist/untrusted-exec.d.ts +275 -0
- package/dist/untrusted-exec.d.ts.map +1 -0
- package/dist/untrusted-exec.js +479 -0
- package/dist/untrusted-exec.js.map +1 -0
- package/dist/untrusted-gate.d.ts +73 -0
- package/dist/untrusted-gate.d.ts.map +1 -0
- package/dist/untrusted-gate.js +226 -0
- package/dist/untrusted-gate.js.map +1 -0
- package/dist/uploader.d.ts +153 -0
- package/dist/uploader.d.ts.map +1 -0
- package/dist/uploader.js +204 -0
- package/dist/uploader.js.map +1 -0
- package/dist/verifier.d.ts +66 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +170 -0
- package/dist/verifier.js.map +1 -0
- package/dist/verify-apply.d.ts +26 -0
- package/dist/verify-apply.d.ts.map +1 -0
- package/dist/verify-apply.js +36 -0
- package/dist/verify-apply.js.map +1 -0
- package/dist/verify-cmd.d.ts +44 -0
- package/dist/verify-cmd.d.ts.map +1 -0
- package/dist/verify-cmd.js +125 -0
- package/dist/verify-cmd.js.map +1 -0
- package/dist/verify-pass.d.ts +73 -0
- package/dist/verify-pass.d.ts.map +1 -0
- package/dist/verify-pass.js +103 -0
- package/dist/verify-pass.js.map +1 -0
- package/dist/welcome.d.ts +43 -0
- package/dist/welcome.d.ts.map +1 -0
- package/dist/welcome.js +116 -0
- package/dist/welcome.js.map +1 -0
- package/dist/workspace-provisioner.d.ts +65 -0
- package/dist/workspace-provisioner.d.ts.map +1 -0
- package/dist/workspace-provisioner.js +66 -0
- package/dist/workspace-provisioner.js.map +1 -0
- package/dist/workspace-quarantine.d.ts +64 -0
- package/dist/workspace-quarantine.d.ts.map +1 -0
- package/dist/workspace-quarantine.js +156 -0
- package/dist/workspace-quarantine.js.map +1 -0
- package/dist/workspace-residue-sweep.d.ts +113 -0
- package/dist/workspace-residue-sweep.d.ts.map +1 -0
- package/dist/workspace-residue-sweep.js +158 -0
- package/dist/workspace-residue-sweep.js.map +1 -0
- package/dist/workspace.d.ts +639 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +2026 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +52 -4
- package/win/CredProbe.cs +64 -0
- package/win/FakeClaude.cs +56 -0
- package/win/HandleProbe.cs +116 -0
- package/win/TokenProbe.cs +53 -0
- package/win/appcontainer.ps1 +500 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunStartMarks = exports.MAX_MARKS = exports.RUN_START_MARKS_SCHEMA = void 0;
|
|
4
|
+
exports.markingStartsOn = markingStartsOn;
|
|
5
|
+
/**
|
|
6
|
+
* Durable proof that a start-run command actually produced a Run.
|
|
7
|
+
*
|
|
8
|
+
* The daemon used to treat "the child it spawned was still alive 750ms later"
|
|
9
|
+
* as evidence that a run had started, and acked the command terminally on it.
|
|
10
|
+
* It is not evidence. A goal-bound run resolves its goal, takes the lease,
|
|
11
|
+
* adopts items and verifies drafts before a Run exists — verification alone
|
|
12
|
+
* calls an agent and can take minutes, and can still end in "nothing to do".
|
|
13
|
+
* Every one of those paths exits without a Run, long after the window closed,
|
|
14
|
+
* leaving a command acked done that nothing will ever carry out.
|
|
15
|
+
*
|
|
16
|
+
* So the run process says so itself, at the only moment that means anything:
|
|
17
|
+
* when `run.started` is durably appended to the ledger. That event IS the
|
|
18
|
+
* accepted start boundary — the server creates its Run row from it, and it is
|
|
19
|
+
* emitted after the dirty-tree check and after the branch exists.
|
|
20
|
+
*
|
|
21
|
+
* WHY A SEPARATE FILE, and not the ledger the mark is derived from: the daemon
|
|
22
|
+
* needs to answer "did command C produce a run" cheaply, on every poll, for a
|
|
23
|
+
* command whose run may have finished hours ago. The ledger answers it only by
|
|
24
|
+
* scanning, and grows without bound. This is a small, capped index over one
|
|
25
|
+
* question. It is also written by the RUN process, where `commands.json` is
|
|
26
|
+
* written by the daemon — one writer each, so neither can lose the other's
|
|
27
|
+
* updates.
|
|
28
|
+
*/
|
|
29
|
+
exports.RUN_START_MARKS_SCHEMA = 1;
|
|
30
|
+
/**
|
|
31
|
+
* How many to keep.
|
|
32
|
+
*
|
|
33
|
+
* Enough that a daemon which was down for a long time still finds the mark for
|
|
34
|
+
* anything the redelivery window could still be offering, and small enough that
|
|
35
|
+
* the file stays a few kilobytes for ever.
|
|
36
|
+
*/
|
|
37
|
+
exports.MAX_MARKS = 50;
|
|
38
|
+
class RunStartMarks {
|
|
39
|
+
stateDir;
|
|
40
|
+
fs;
|
|
41
|
+
log;
|
|
42
|
+
/** Distinguishes two writes from ONE process; the pid distinguishes processes. */
|
|
43
|
+
static writes = 0;
|
|
44
|
+
marks = [];
|
|
45
|
+
/** Whether `load` has run. Recording before it would truncate the file. */
|
|
46
|
+
loaded = false;
|
|
47
|
+
constructor(stateDir, fs,
|
|
48
|
+
/** A discarded file is worth saying once, not silently. */
|
|
49
|
+
log) {
|
|
50
|
+
this.stateDir = stateDir;
|
|
51
|
+
this.fs = fs;
|
|
52
|
+
this.log = log;
|
|
53
|
+
}
|
|
54
|
+
get path() {
|
|
55
|
+
return `${this.stateDir}/run-starts.json`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* THE APPEND-ONLY LOG BESIDE THE CAPPED INDEX.
|
|
59
|
+
*
|
|
60
|
+
* 🔴 THE INDEX IS A WHOLE-DOCUMENT REWRITE, AND THIS FILE IS NOW SHARED BY
|
|
61
|
+
* EVERY CONCURRENT RUN IN THE PROJECT.
|
|
62
|
+
*
|
|
63
|
+
* The comment in `bin.ts` predicted precisely this: "A later phase that
|
|
64
|
+
* launches into workspaces must move this channel to project scope AND make
|
|
65
|
+
* it append-only first: it is a whole-document rewrite, so sharing it between
|
|
66
|
+
* concurrent runs without that is the lost-update class." This is that phase.
|
|
67
|
+
*
|
|
68
|
+
* Two runs that cross their start boundary in the same instant both read the
|
|
69
|
+
* index, both add themselves, and both rename their own copy into place. One
|
|
70
|
+
* mark survives. The daemon then reads no mark for the other request,
|
|
71
|
+
* concludes its Start "never began", and after three attempts escalates a
|
|
72
|
+
* perfectly healthy goal to `human_required` — the same visible failure the
|
|
73
|
+
* scope bug produced, arrived at by a race instead of a path.
|
|
74
|
+
*
|
|
75
|
+
* ⚠️ THE INDEX IS KEPT, NOT REPLACED. It is what bounds the file at
|
|
76
|
+
* `MAX_MARKS` and what an older build reads. The log is the durable truth and
|
|
77
|
+
* `load` merges both, so a mark the index lost is still found.
|
|
78
|
+
*
|
|
79
|
+
* ⚠️ LED BY A NEWLINE, for the reason `coordinator.recordActions` wrote down:
|
|
80
|
+
* a torn write must cost one record rather than two.
|
|
81
|
+
*/
|
|
82
|
+
get logPath() {
|
|
83
|
+
return `${this.stateDir}/run-starts.jsonl`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Read what is on disk.
|
|
87
|
+
*
|
|
88
|
+
* Anything unreadable or wrongly shaped is DISCARDED rather than thrown over,
|
|
89
|
+
* exactly like the goal mirror. The cost of being wrong here is bounded and
|
|
90
|
+
* safe: without a mark the daemon cannot prove a run started, so it keeps the
|
|
91
|
+
* command queued rather than acking it — and the lease still stops a second
|
|
92
|
+
* runner. Losing this file delays an ack; it can never duplicate a run.
|
|
93
|
+
*/
|
|
94
|
+
async load() {
|
|
95
|
+
this.loaded = true;
|
|
96
|
+
const text = await this.fs.readFile(this.path);
|
|
97
|
+
if (text === null) {
|
|
98
|
+
this.marks = [];
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const parsed = JSON.parse(text);
|
|
103
|
+
if (typeof parsed !== 'object' ||
|
|
104
|
+
parsed === null ||
|
|
105
|
+
parsed.schema !== exports.RUN_START_MARKS_SCHEMA ||
|
|
106
|
+
!Array.isArray(parsed.marks)) {
|
|
107
|
+
throw new Error('not a mark file');
|
|
108
|
+
}
|
|
109
|
+
this.marks = parsed.marks.filter(isMark);
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
this.log?.(`run-starts: discarding an unreadable file (${e.message})`);
|
|
113
|
+
this.marks = [];
|
|
114
|
+
}
|
|
115
|
+
await this.mergeLog();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Fold the append-only log into what the index said.
|
|
119
|
+
*
|
|
120
|
+
* ⚠️ THE LOG WINS ON PRESENCE, NOT ON ORDER. A mark is a fact that a request
|
|
121
|
+
* produced a run; there is no version of it to be newer or older. So a
|
|
122
|
+
* commandId already known keeps the entry it has, and one the index lost is
|
|
123
|
+
* added — which is the whole repair.
|
|
124
|
+
*
|
|
125
|
+
* ⚠️ A FRAGMENT FROM A TORN WRITE IS SKIPPED ALONE, which is what the leading
|
|
126
|
+
* newline buys, and an unreadable log leaves the index exactly as it was.
|
|
127
|
+
*/
|
|
128
|
+
async mergeLog() {
|
|
129
|
+
let text;
|
|
130
|
+
try {
|
|
131
|
+
text = await this.fs.readFile(this.logPath);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (text === null)
|
|
137
|
+
return;
|
|
138
|
+
const known = new Set(this.marks.map((m) => m.commandId));
|
|
139
|
+
for (const line of text.split('\n')) {
|
|
140
|
+
const trimmed = line.trim();
|
|
141
|
+
if (trimmed === '')
|
|
142
|
+
continue;
|
|
143
|
+
try {
|
|
144
|
+
const parsed = JSON.parse(trimmed);
|
|
145
|
+
if (!isMark(parsed) || known.has(parsed.commandId))
|
|
146
|
+
continue;
|
|
147
|
+
known.add(parsed.commandId);
|
|
148
|
+
this.marks.push(parsed);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// A fragment. Skipped by itself.
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** The run this command produced, if it produced one. */
|
|
156
|
+
find(commandId) {
|
|
157
|
+
return this.marks.find((m) => m.commandId === commandId) ?? null;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The mark that names this run, if one does — the daemon's way from a runId
|
|
161
|
+
* back to the checkout that run is (or was) executing in.
|
|
162
|
+
*/
|
|
163
|
+
findByRun(runId) {
|
|
164
|
+
return this.marks.find((m) => m.runId === runId) ?? null;
|
|
165
|
+
}
|
|
166
|
+
all() {
|
|
167
|
+
return [...this.marks];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Record that a command's run crossed the boundary.
|
|
171
|
+
*
|
|
172
|
+
* Re-recording the same command is a no-op rather than a second entry: the
|
|
173
|
+
* first mark is the one that is true, and a run cannot start twice for one
|
|
174
|
+
* request.
|
|
175
|
+
*/
|
|
176
|
+
async record(mark) {
|
|
177
|
+
if (!this.loaded) {
|
|
178
|
+
// Recording without having read is how a fifty-entry index becomes a
|
|
179
|
+
// one-entry one: `this.marks` is empty, so the whole file is replaced by
|
|
180
|
+
// whatever is being written. The twin refusal store's writer loads first
|
|
181
|
+
// and `CommandReceipts.record` throws outright; this one silently did
|
|
182
|
+
// neither, and the accumulation its own documentation describes has never
|
|
183
|
+
// actually shipped.
|
|
184
|
+
throw new Error('RunStartMarks.record before load()');
|
|
185
|
+
}
|
|
186
|
+
if (this.find(mark.commandId))
|
|
187
|
+
return;
|
|
188
|
+
await this.fs.mkdir(this.stateDir);
|
|
189
|
+
/**
|
|
190
|
+
* 🔴 THE DURABLE WRITE FIRST, AND IT IS THE APPEND. See `logPath`: the
|
|
191
|
+
* index below is a whole-document rewrite, and two runs crossing their
|
|
192
|
+
* start boundary together lose one of the two marks — which the daemon
|
|
193
|
+
* reads as "never began" and escalates to a human.
|
|
194
|
+
*
|
|
195
|
+
* An append cannot lose a neighbour's record, so the fact is safe before
|
|
196
|
+
* the convenience index is touched.
|
|
197
|
+
*/
|
|
198
|
+
await this.fs.appendFile(this.logPath, `\n${JSON.stringify(mark)}\n`);
|
|
199
|
+
// Newest first, so the cap drops the oldest.
|
|
200
|
+
const next = [mark, ...this.marks].slice(0, exports.MAX_MARKS);
|
|
201
|
+
const body = { schema: exports.RUN_START_MARKS_SCHEMA, marks: next };
|
|
202
|
+
// Temp-then-rename, the same contract as every other store here: the daemon
|
|
203
|
+
// reads this file from another process and must never catch half of it.
|
|
204
|
+
// The temp name is PRIVATE TO THIS WRITER. A shared `run-starts.json.tmp` is
|
|
205
|
+
// two processes writing one path: the second truncates and rewrites what
|
|
206
|
+
// the first is midway through, and then both rename it into place. The
|
|
207
|
+
// rename is atomic and the file it renames is a splice of two writes, and
|
|
208
|
+
// nothing downstream can tell.
|
|
209
|
+
const tmp = `${this.path}.${process.pid}.${(RunStartMarks.writes += 1)}.tmp`;
|
|
210
|
+
await this.fs.writeFile(tmp, JSON.stringify(body, null, 2) + '\n');
|
|
211
|
+
await this.fs.rename(tmp, this.path);
|
|
212
|
+
// Committed to memory only after the durable write, so a failed write
|
|
213
|
+
// cannot leave this object claiming a mark the file does not have.
|
|
214
|
+
this.marks = next;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.RunStartMarks = RunStartMarks;
|
|
218
|
+
function isMark(v) {
|
|
219
|
+
if (typeof v !== 'object' || v === null)
|
|
220
|
+
return false;
|
|
221
|
+
const m = v;
|
|
222
|
+
if (typeof m['commandId'] !== 'string' || typeof m['runId'] !== 'string' || typeof m['at'] !== 'string') {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
// Optional, and when present it must be a path. A mark whose workspace is
|
|
226
|
+
// some other shape is not a mark this can act on.
|
|
227
|
+
return m['workspace'] === undefined || typeof m['workspace'] === 'string';
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* A ledger that records the start mark when the run crosses the boundary.
|
|
231
|
+
*
|
|
232
|
+
* A decorator rather than a hook on RoundRunner, so the runner gains nothing at
|
|
233
|
+
* all: it appends `run.started` because that is what starting a run means, and
|
|
234
|
+
* this notices. The runner has no idea a command exists, which is the same
|
|
235
|
+
* reason it has no idea a goal does.
|
|
236
|
+
*
|
|
237
|
+
* The mark is written AFTER the event is durably appended. The other order
|
|
238
|
+
* would claim a run that the ledger might then fail to record.
|
|
239
|
+
*/
|
|
240
|
+
function markingStartsOn(inner, marks, commandId, onError,
|
|
241
|
+
/** The checkout the run executes in, so a late mark still names its ledger. */
|
|
242
|
+
workspace) {
|
|
243
|
+
let recorded = false;
|
|
244
|
+
return {
|
|
245
|
+
async append(input) {
|
|
246
|
+
const event = await inner.append(input);
|
|
247
|
+
if (!recorded && input.kind === 'run.started') {
|
|
248
|
+
recorded = true;
|
|
249
|
+
try {
|
|
250
|
+
await marks.record({
|
|
251
|
+
commandId,
|
|
252
|
+
runId: input.data.runId,
|
|
253
|
+
at: input.ts,
|
|
254
|
+
...(workspace === undefined ? {} : { workspace }),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
catch (e) {
|
|
258
|
+
// Never fatal. A run that is genuinely under way must not be killed
|
|
259
|
+
// because the daemon's evidence file could not be written — the cost
|
|
260
|
+
// is an unacked command, which the redelivery window already bounds.
|
|
261
|
+
recorded = false;
|
|
262
|
+
onError?.(e);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return event;
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=run-start-marks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-start-marks.js","sourceRoot":"","sources":["../src/run-start-marks.ts"],"names":[],"mappings":";;;AAiRA,0CAgCC;AA/SD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEU,QAAA,sBAAsB,GAAG,CAAC,CAAC;AA6BxC;;;;;;GAMG;AACU,QAAA,SAAS,GAAG,EAAE,CAAC;AAE5B,MAAa,aAAa;IASL;IACA;IAEA;IAXnB,kFAAkF;IAC1E,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAElB,KAAK,GAAmB,EAAE,CAAC;IACnC,2EAA2E;IACnE,MAAM,GAAG,KAAK,CAAC;IAEvB,YACmB,QAAgB,EAChB,EAAY;IAC7B,2DAA2D;IAC1C,GAA4B;QAH5B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAU;QAEZ,QAAG,GAAH,GAAG,CAAyB;IAC5C,CAAC;IAEJ,IAAY,IAAI;QACd,OAAO,GAAG,IAAI,CAAC,QAAQ,kBAAkB,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,IAAY,OAAO;QACjB,OAAO,GAAG,IAAI,CAAC,QAAQ,mBAAmB,CAAC;IAC7C,CAA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BACX,oEAAoE;oBACpE,qEAAqE;oBACrE,qEAAqE;oBACrE,QAAQ,GAAG,KAAK,CAAC;oBACjB,OAAO,EAAE,CAAC,CAAU,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LooplyConfig } from './config';
|
|
2
|
+
import { type ScanReport } from './scan';
|
|
3
|
+
export interface ScanOptions {
|
|
4
|
+
cwd: string;
|
|
5
|
+
config: LooplyConfig;
|
|
6
|
+
/** Cap the lens set, for a cheap first look. */
|
|
7
|
+
only?: string[];
|
|
8
|
+
perLens?: number;
|
|
9
|
+
/** Report what it found without writing to the queue. */
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
log: (line: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function scanProject(opts: ScanOptions): Promise<ScanReport>;
|
|
14
|
+
//# sourceMappingURL=scan-cmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-cmd.d.ts","sourceRoot":"","sources":["../src/scan-cmd.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAgB7C,OAAO,EASL,KAAK,UAAU,EAChB,MAAM,QAAQ,CAAC;AAwBhB,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,YAAY,CAAC;IACrB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAsDD,wBAAsB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CASxE"}
|
package/dist/scan-cmd.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanProject = scanProject;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const queue_store_1 = require("./queue-store");
|
|
8
|
+
const ledger_store_1 = require("./ledger-store");
|
|
9
|
+
const syncing_ledger_1 = require("./syncing-ledger");
|
|
10
|
+
const sync_1 = require("./sync");
|
|
11
|
+
const scan_events_1 = require("./scan-events");
|
|
12
|
+
const git_driver_1 = require("./git-driver");
|
|
13
|
+
const model_transport_1 = require("./model-transport");
|
|
14
|
+
const providers_1 = require("./providers");
|
|
15
|
+
const agent_envelope_1 = require("./agent-envelope");
|
|
16
|
+
const scan_1 = require("./scan");
|
|
17
|
+
const queue_write_lease_1 = require("./queue-write-lease");
|
|
18
|
+
/**
|
|
19
|
+
* The composition root for `looply scan`.
|
|
20
|
+
*
|
|
21
|
+
* Lenses run one at a time rather than in parallel. Cost and rate limits are
|
|
22
|
+
* global, and six concurrent read-only passes over a large repository is a good
|
|
23
|
+
* way to spend a lot of money quickly for no better result — the passes do not
|
|
24
|
+
* depend on each other, so nothing is gained by overlapping them beyond finishing
|
|
25
|
+
* sooner.
|
|
26
|
+
*/
|
|
27
|
+
const LENS_TIMEOUT_MS = 8 * 60 * 1000;
|
|
28
|
+
/** Missing is the normal case for a lens that answered in prose; not an error. */
|
|
29
|
+
function readIfPresent(path) {
|
|
30
|
+
try {
|
|
31
|
+
return (0, node_fs_1.readFileSync)(path, 'utf8');
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Open the ledger this scan reports through, and stream it if the machine is
|
|
39
|
+
* paired.
|
|
40
|
+
*
|
|
41
|
+
* The project id comes from the sync when there is one. The config's
|
|
42
|
+
* `project.id` is a guess this repo made about itself, and ingest drops every
|
|
43
|
+
* event whose `projectId` is not the one the server registered — so events
|
|
44
|
+
* written under the guess would land on disk, upload, and be discarded in
|
|
45
|
+
* silence, which looks exactly like a scan that emitted nothing.
|
|
46
|
+
*/
|
|
47
|
+
async function openScanStream(cwd, config, log) {
|
|
48
|
+
const ledger = new ledger_store_1.LedgerStore((0, node_path_1.join)(cwd, git_driver_1.STATE_DIR, 'state'), ledger_store_1.nodeLedgerFs);
|
|
49
|
+
await ledger.open();
|
|
50
|
+
const sync = await (0, sync_1.attachSync)(cwd, config, log, 'scan');
|
|
51
|
+
const sink = sync ? new syncing_ledger_1.SyncingLedger(ledger, sync.daemon, (0, syncing_ledger_1.logSinkErrorOnce)(log)) : ledger;
|
|
52
|
+
return {
|
|
53
|
+
ctx: {
|
|
54
|
+
scanId: (0, scan_events_1.newScanId)(),
|
|
55
|
+
projectId: sync?.projectId ?? config.project.id ?? 'local',
|
|
56
|
+
now: () => Date.now(),
|
|
57
|
+
},
|
|
58
|
+
emit: async (input) => {
|
|
59
|
+
try {
|
|
60
|
+
await sink.append(input);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
// The scan's product is the queue, not the ledger. A failed append is
|
|
64
|
+
// worth saying out loud and is never worth throwing away the passes
|
|
65
|
+
// that have already been paid for.
|
|
66
|
+
log(`scan : could not record ${input.kind} — ${e.message}`);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
close: async () => {
|
|
70
|
+
// Flushes what the last passes produced; without it the scan's own
|
|
71
|
+
// `scan.finished` can be lost on exit and the phone shows a scan that
|
|
72
|
+
// never ends.
|
|
73
|
+
if (sync)
|
|
74
|
+
await sync.stop();
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function scanProject(opts) {
|
|
79
|
+
// A dry run answers a question and changes nothing, so it opens no ledger and
|
|
80
|
+
// tells the phone nothing — there is no scan to watch.
|
|
81
|
+
const stream = opts.dryRun ? null : await openScanStream(opts.cwd, opts.config, opts.log);
|
|
82
|
+
try {
|
|
83
|
+
return await runScan(opts, stream);
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
if (stream)
|
|
87
|
+
await stream.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function runScan(opts, stream) {
|
|
91
|
+
const { cwd, config, log } = opts;
|
|
92
|
+
const lenses = opts.only?.length
|
|
93
|
+
? scan_1.DEFAULT_LENSES.filter((l) => opts.only.includes(l.key))
|
|
94
|
+
: [...scan_1.DEFAULT_LENSES];
|
|
95
|
+
if (!lenses.length) {
|
|
96
|
+
throw new Error(`no lenses matched. Available: ${scan_1.DEFAULT_LENSES.map((l) => l.key).join(', ')}`);
|
|
97
|
+
}
|
|
98
|
+
const ctx = {
|
|
99
|
+
projectName: config.project.name,
|
|
100
|
+
scope: [...config.scope.free, ...config.scope.additive],
|
|
101
|
+
rails: config.rails.forbiddenPaths,
|
|
102
|
+
perLens: opts.perLens ?? 8,
|
|
103
|
+
outputPath: '',
|
|
104
|
+
};
|
|
105
|
+
// `--output-format json`, not `text`: the runner merges stdout and stderr into
|
|
106
|
+
// one stream, so in text mode a single warning line from the agent's own
|
|
107
|
+
// startup is concatenated with its answer and the whole-document parse of a
|
|
108
|
+
// findings object fails for a reason nothing in the transcript explains.
|
|
109
|
+
// `unwrapEnvelope` hands `runLens` the final message on its own, and turns a
|
|
110
|
+
// run truncated at its turn limit — which still exits zero — into a failed
|
|
111
|
+
// pass rather than a lens that reports the codebase clean.
|
|
112
|
+
// Read-only, for the same reason: a scan reports, it does not change code.
|
|
113
|
+
/**
|
|
114
|
+
* 🔴 THE PRESET, HERE TOO. This passed `config.agent` unresolved, so
|
|
115
|
+
* `agent.provider` was ignored by `looply scan` entirely and the same project
|
|
116
|
+
* used a different binary depending on which verb was typed.
|
|
117
|
+
*/
|
|
118
|
+
const picked = (0, providers_1.agentSpecFor)(config);
|
|
119
|
+
if (!picked.ok) {
|
|
120
|
+
log(picked.message);
|
|
121
|
+
throw new Error(picked.message);
|
|
122
|
+
}
|
|
123
|
+
if (picked.warning !== null)
|
|
124
|
+
log(`provider: ${picked.warning}`);
|
|
125
|
+
const agent = (0, model_transport_1.makeMediatedAgentRunner)(cwd, 'scanner', picked.spec, { format: 'json' });
|
|
126
|
+
const invoke = async (prompt, timeoutMs) => (0, agent_envelope_1.unwrapEnvelope)(await agent(prompt, timeoutMs));
|
|
127
|
+
if (stream) {
|
|
128
|
+
await stream.emit((0, scan_events_1.scanStartedEvent)(lenses.map((l) => l.key), stream.ctx));
|
|
129
|
+
}
|
|
130
|
+
const results = [];
|
|
131
|
+
for (const lens of lenses) {
|
|
132
|
+
log(`scan : ${lens.label}…`);
|
|
133
|
+
// Outside the repository, deliberately. Inside it, the findings file is a
|
|
134
|
+
// file in a project the same prompt tells the agent not to modify — and the
|
|
135
|
+
// agent correctly obeyed the wider instruction and wrote nothing, every
|
|
136
|
+
// time. A path in the temp directory removes the contradiction instead of
|
|
137
|
+
// asking the agent to resolve it.
|
|
138
|
+
//
|
|
139
|
+
// Fresh per lens and removed first: a stale file from the previous lens
|
|
140
|
+
// would be read as this one's answer, which is worse than no answer at all.
|
|
141
|
+
const outputPath = (0, node_path_1.join)((0, node_os_1.tmpdir)(), `looply-scan-${process.pid}-${lens.key}.json`);
|
|
142
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(outputPath), { recursive: true });
|
|
143
|
+
(0, node_fs_1.rmSync)(outputPath, { force: true });
|
|
144
|
+
// Forward slashes into the prompt. A Windows path travels through shell
|
|
145
|
+
// quoting and the agent's own parsing, and each layer treats a backslash as
|
|
146
|
+
// an escape — the path arrived as `C:UsersGeorge…`, so the agent wrote its
|
|
147
|
+
// findings somewhere meaningless and reported success. Windows accepts
|
|
148
|
+
// forward slashes, and nothing along the way can eat them.
|
|
149
|
+
const promptPath = outputPath.replace(/\\/g, '/');
|
|
150
|
+
const r = await (0, scan_1.runLens)(invoke, lens, { ...ctx, outputPath: promptPath }, LENS_TIMEOUT_MS, () => readIfPresent(outputPath));
|
|
151
|
+
// Per pass, not per scan: a lens that finishes in minute three is news in
|
|
152
|
+
// minute three, and a scan that reports only at the end is the silence this
|
|
153
|
+
// whole change exists to remove.
|
|
154
|
+
if (stream)
|
|
155
|
+
await stream.emit((0, scan_events_1.lensResultEvent)(r, lens.label, stream.ctx));
|
|
156
|
+
// A lens that failed is reported where it happened, not summarised away at
|
|
157
|
+
// the end — you want to know which pass to re-run, not that "some" failed.
|
|
158
|
+
if (!r.ok) {
|
|
159
|
+
log(` ${lens.key} produced nothing usable: ${r.reason ?? 'unknown'}`);
|
|
160
|
+
if (r.transcriptTail) {
|
|
161
|
+
// Without this the only symptom is a zero, and a zero from a healthy
|
|
162
|
+
// codebase and a zero from an agent that answered in prose look the same.
|
|
163
|
+
log(' what it actually said:');
|
|
164
|
+
for (const line of r.transcriptTail.trim().split('\n').slice(-6)) {
|
|
165
|
+
log(` | ${line.slice(0, 110)}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
const over = r.overflow ? ` (${r.overflow} past the cap, cut)` : '';
|
|
171
|
+
log(` ${r.findings.length} found${over}`);
|
|
172
|
+
// Said out loud because it is what this lens cost: the pass answered in
|
|
173
|
+
// prose and a second call had to turn it into findings.
|
|
174
|
+
if (r.distilled)
|
|
175
|
+
log(' (the pass answered in prose; a second call reformatted it)');
|
|
176
|
+
}
|
|
177
|
+
results.push(r);
|
|
178
|
+
}
|
|
179
|
+
const report = (0, scan_1.mergeFindings)(results, {
|
|
180
|
+
projectId: config.project.id ?? 'local',
|
|
181
|
+
maxSameShape: config.queue.maxSameShape,
|
|
182
|
+
});
|
|
183
|
+
log('');
|
|
184
|
+
log((0, scan_1.renderScanReport)(report));
|
|
185
|
+
if (opts.dryRun) {
|
|
186
|
+
log('dry run: nothing was added to the queue.');
|
|
187
|
+
return report;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 🔴 THE LEASE, AND ONLY HERE — AFTER THE DRY-RUN RETURN ABOVE.
|
|
191
|
+
*
|
|
192
|
+
* A scan that writes while a run is going does not merely race it: the run
|
|
193
|
+
* holds the whole queue in memory and writes it back wholesale after its next
|
|
194
|
+
* round, so the scan's items are silently reverted. See queue-write-lease.ts.
|
|
195
|
+
*
|
|
196
|
+
* A dry run "answers a question and changes nothing" by its own contract, so
|
|
197
|
+
* it must not need the machine to be idle — which is why this is not at the
|
|
198
|
+
* top of the function.
|
|
199
|
+
*/
|
|
200
|
+
/**
|
|
201
|
+
* 🔴 THE STREAM IS CLOSED ON THE REFUSAL PATH TOO, OR THE PHONE SHOWS A SCAN
|
|
202
|
+
* THAT NEVER ENDS.
|
|
203
|
+
*
|
|
204
|
+
* `scan.started` and the per-lens alerts have already been emitted by the
|
|
205
|
+
* time this refuses, and `scanFinishedEvents` — the only emitter of
|
|
206
|
+
* `scan.finished` — is below it. This file already states the standard:
|
|
207
|
+
* "without it the scan's own `scan.finished` can be lost on exit and the
|
|
208
|
+
* phone shows a scan that never ends." Moving the refusal to the write put a
|
|
209
|
+
* new throw between the two.
|
|
210
|
+
*
|
|
211
|
+
* ⚠️ AND THE FINDINGS ARE STILL PRINTED. Six lens passes at eight minutes
|
|
212
|
+
* apiece have already been paid for; discarding the report as well as the
|
|
213
|
+
* queue write would waste the whole cost twice.
|
|
214
|
+
*/
|
|
215
|
+
let held;
|
|
216
|
+
try {
|
|
217
|
+
held = await (0, queue_write_lease_1.takeQueueWriteLease)(cwd, 'a scan');
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
if (stream) {
|
|
221
|
+
for (const ev of (0, scan_events_1.scanFinishedEvents)({ ...report, items: [] }, stream.ctx))
|
|
222
|
+
await stream.emit(ev);
|
|
223
|
+
}
|
|
224
|
+
throw e;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const queue = new queue_store_1.QueueStore((0, node_path_1.join)(cwd, git_driver_1.STATE_DIR, 'state'), ledger_store_1.nodeLedgerFs);
|
|
228
|
+
await queue.open();
|
|
229
|
+
/**
|
|
230
|
+
* 🔴 ONE WRITE, NOT N. `insert()` persists the WHOLE map per call, so this
|
|
231
|
+
* was one full rewrite of queue.json per scanned item — and a crash part-way
|
|
232
|
+
* left an arbitrary prefix on disk with no record of what was missing.
|
|
233
|
+
*
|
|
234
|
+
* ⚠️ AND IT NO LONGER THROWS ON A RE-SCAN. `insert` rejects a duplicate id;
|
|
235
|
+
* `insertAll` skips it and reports it. Re-scanning a project is an ordinary
|
|
236
|
+
* thing to do, and ending the command on the first item it had already seen
|
|
237
|
+
* was never the useful answer.
|
|
238
|
+
*/
|
|
239
|
+
const written = await queue.insertAll(report.items);
|
|
240
|
+
if (!written.ok) {
|
|
241
|
+
/**
|
|
242
|
+
* ⚠️ THE SAME ID TWICE IN ONE BATCH IS A SCANNER BUG, NOT A REPEAT, and
|
|
243
|
+
* `insertAll` refuses the whole batch rather than picking one — which is
|
|
244
|
+
* why this reports instead of continuing. Nothing was written.
|
|
245
|
+
*/
|
|
246
|
+
log(`scan : nothing was queued — the scan produced ${written.id} twice`);
|
|
247
|
+
return report;
|
|
248
|
+
}
|
|
249
|
+
if (written.alreadyPresent.length > 0) {
|
|
250
|
+
log(`scan : ${written.alreadyPresent.length} item(s) were already queued and were left alone`);
|
|
251
|
+
}
|
|
252
|
+
// After the queue write, never before: an `item.created` the queue does not
|
|
253
|
+
// hold would send the phone to an item that is not there.
|
|
254
|
+
if (stream) {
|
|
255
|
+
for (const e of (0, scan_events_1.scanFinishedEvents)(report, stream.ctx))
|
|
256
|
+
await stream.emit(e);
|
|
257
|
+
}
|
|
258
|
+
// Only when something was written. "queued : 0 items, all unverified until a
|
|
259
|
+
// check pass confirms them" is a success line for a scan that produced
|
|
260
|
+
// nothing; the report above has already said what the zero means.
|
|
261
|
+
if (report.items.length) {
|
|
262
|
+
log(`queued : ${report.items.length} items, all unverified until a check pass confirms them.`);
|
|
263
|
+
}
|
|
264
|
+
return report;
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
await held.release();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=scan-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-cmd.js","sourceRoot":"","sources":["../src/scan-cmd.ts"],"names":[],"mappings":";;AAoHA,kCASC;AA7HD,yCAA0C;AAC1C,qCAA0D;AAC1D,qCAAiC;AAEjC,+CAA2C;AAC3C,iDAA+E;AAC/E,qDAAmE;AACnE,iCAAoC;AACpC,+CAMuB;AACvB,6CAAyC;AACzC,uDAA4D;AAC5D,2CAA2C;AAC3C,qDAAkD;AAClD,iCAUgB;AAChB,2DAA0D;AAE1D;;;;;;;;GAQG;AAEH,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtC,kFAAkF;AAClF,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QACH,OAAO,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAoBD;;;;;;;;;GASG;AACH,KAAK,UAAU,cAAc,CAC3B,GAAW,EACX,MAAoB,EACpB,GAA2B;IAE3B,MAAM,MAAM,GAAG,IAAI,0BAAW,CAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,sBAAS,EAAE,OAAO,CAAC,EAAE,2BAAY,CAAC,CAAC;IAC5E,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAU,EAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,8BAAa,CAAC,MAAM,EAAE,IAAI,CAA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C,CAAC;QAC1E,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB;;;;;;;;;WASG;QACH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAChB;;;;eAIG;YACH,GAAG,CAAC,oDAAoD,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC5E,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,GAAG,CAAC,aAAa,OAAO,CAAC,cAAc,CAAC,MAAM,kDAAkD,CAAC,CAAC;QACpG,CAAC;QAED,4EAA4E;QAC5E,0DAA0D;QAC1D,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,MAAM,CAAC,IAAI,IAAA,gCAAkB,EAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;gBAAE,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/E,CAAC;QAED,6EAA6E;QAC7E,uEAAuE;QACvE,kEAAkE;QAClE,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,GAAG,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,MAAM,0DAA0D,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AnyEventInput } from './ledger-store';
|
|
2
|
+
import type { LensResult, ScanReport } from './scan';
|
|
3
|
+
/**
|
|
4
|
+
* The events a scan writes.
|
|
5
|
+
*
|
|
6
|
+
* A scan is the longest thing looply does that produces nothing until it is
|
|
7
|
+
* finished: six read-only agent passes, twenty minutes, and — until now — not a
|
|
8
|
+
* single line in the ledger. From the phone that is indistinguishable from a
|
|
9
|
+
* machine that has stopped answering, which is the worst way for a working
|
|
10
|
+
* system to look.
|
|
11
|
+
*
|
|
12
|
+
* The builders are pure and the ledger is passed in, so what a scan reports is
|
|
13
|
+
* testable without a filesystem, an agent or a server.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Every event carries a `runId`, and a scan is not a run — but the lane is a
|
|
17
|
+
* free string, so it is what says which this is. A scan mints a run-shaped id
|
|
18
|
+
* (the server keys events on it and will create a row for it either way) and
|
|
19
|
+
* marks the lane, so the app can tell the two apart without a schema change.
|
|
20
|
+
*/
|
|
21
|
+
export declare const SCAN_LANE = "scan";
|
|
22
|
+
export interface ScanEventContext {
|
|
23
|
+
/** The id every event of this scan shares; see {@link newScanId}. */
|
|
24
|
+
scanId: string;
|
|
25
|
+
/** The project the server knows, not the one the config guesses; see scan-cmd. */
|
|
26
|
+
projectId: string;
|
|
27
|
+
now(): number;
|
|
28
|
+
}
|
|
29
|
+
export declare function newScanId(now?: number): string;
|
|
30
|
+
/** Written before the first pass, so the phone knows what it is waiting for. */
|
|
31
|
+
export declare function scanStartedEvent(lensKeys: readonly string[], ctx: ScanEventContext): AnyEventInput;
|
|
32
|
+
/**
|
|
33
|
+
* One pass finished.
|
|
34
|
+
*
|
|
35
|
+
* There is no per-lens kind in the schema, and the only kind that carries free
|
|
36
|
+
* text is `alert` — so this is an alert, at `info` when the pass worked. Waiting
|
|
37
|
+
* for `scan.finished` instead would mean the phone shows nothing at all for the
|
|
38
|
+
* length of the scan, which is the thing being fixed. A pass that produced
|
|
39
|
+
* nothing usable is a genuine `warn`: it means a sixth of the scan was wasted
|
|
40
|
+
* and the reason is worth reading now rather than after the whole scan.
|
|
41
|
+
*/
|
|
42
|
+
export declare function lensResultEvent(result: LensResult, label: string, ctx: ScanEventContext): AnyEventInput;
|
|
43
|
+
/**
|
|
44
|
+
* What the scan produced, in the order it happened: the items first, then the
|
|
45
|
+
* summary. An `item.created` for something the queue does not hold would send
|
|
46
|
+
* the phone to an item that is not there, so callers emit these only after the
|
|
47
|
+
* queue write, and only for the items that were actually inserted.
|
|
48
|
+
*/
|
|
49
|
+
export declare function scanFinishedEvents(report: ScanReport, ctx: ScanEventContext): AnyEventInput[];
|
|
50
|
+
//# sourceMappingURL=scan-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-events.d.ts","sourceRoot":"","sources":["../src/scan-events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAErD;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,SAAS,CAAC;AAMhC,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,IAAI,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9C;AAkBD,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAElG;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,gBAAgB,GACpB,aAAa,CAcf;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAY7F"}
|