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,195 @@
|
|
|
1
|
+
import { type AdapterContext, type InboxMessage, type Instruction, type OutboxRuling, type ResultRuling, type SessionAcknowledgement } from '@looply/core';
|
|
2
|
+
/**
|
|
3
|
+
* THE ADAPTER'S TWO DIRECTORIES. `session-adapter.ts` decides; this reads and
|
|
4
|
+
* writes.
|
|
5
|
+
*
|
|
6
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
* WHERE THE CHANNEL LIVES, AND WHY NOT IN THE WORKSPACE.
|
|
8
|
+
*
|
|
9
|
+
* <stateDir>/sessions/<sessionId>/inbox/ looply → the session
|
|
10
|
+
* <stateDir>/sessions/<sessionId>/outbox/ the session → looply, about CONTROL
|
|
11
|
+
* <stateDir>/sessions/<sessionId>/results/ the session → looply, about INSTRUCTIONS
|
|
12
|
+
* <stateDir>/sessions/<sessionId>/consumed/ files already ruled on
|
|
13
|
+
* <stateDir>/sessions/<sessionId>/spent.jsonl handshakes that are finished
|
|
14
|
+
*
|
|
15
|
+
* ⚠️ RESULTS HAVE THEIR OWN DIRECTORY RATHER THAN SHARING THE OUTBOX, and the
|
|
16
|
+
* reason is mechanical: `readOutboxMessage` answers `null` for anything that is
|
|
17
|
+
* not a control message, so a result sitting in the outbox would be reported as
|
|
18
|
+
* "not an outbox message" on every single collection, for as long as it sat
|
|
19
|
+
* there. Two protocols, two directories, and neither collector trips over the
|
|
20
|
+
* other's files.
|
|
21
|
+
*
|
|
22
|
+
* The obvious alternative — a directory inside the session's own checkout —
|
|
23
|
+
* puts looply's writes inside the tree a watch is walking, so every offer
|
|
24
|
+
* becomes an observed event in the session's own record. The project's state
|
|
25
|
+
* directory is already looply's to write, is already where the session ledger
|
|
26
|
+
* lives, and is outside every granted scope.
|
|
27
|
+
*
|
|
28
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
* 🔴 THE SPENT JOURNAL IS WRITTEN BEFORE THE ACKNOWLEDGEMENT IS ACTED ON, AND
|
|
30
|
+
* THE ORDER IS A SAFETY DECISION WITH A COST THAT IS WORTH PAYING.
|
|
31
|
+
*
|
|
32
|
+
* Act first and record after, and a crash in between leaves a nonce that is
|
|
33
|
+
* still replayable — the exact thing the nonce exists to prevent, reachable by
|
|
34
|
+
* pulling a plug at the right moment.
|
|
35
|
+
*
|
|
36
|
+
* Record first and crash, and the session's genuine acknowledgement is lost and
|
|
37
|
+
* cannot be retried: the grant has to be re-issued. That is an inconvenience
|
|
38
|
+
* with a person in the loop, and the other is a hole. `retention-apply.ts`
|
|
39
|
+
* settles the same question the same way, for the same reason.
|
|
40
|
+
*
|
|
41
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
* ⚠️ AND IT SURVIVES A RESTART, WHICH THE CHARTER ASKS FOR BY NAME (§6.E:
|
|
43
|
+
* "revocation, restart and expired authority"). The spent handshakes are a file,
|
|
44
|
+
* not a set in a process — an in-memory one would make every restart a fresh
|
|
45
|
+
* opportunity to replay everything that came before it.
|
|
46
|
+
*/
|
|
47
|
+
export interface AdapterPaths {
|
|
48
|
+
readonly dir: string;
|
|
49
|
+
readonly inbox: string;
|
|
50
|
+
readonly outbox: string;
|
|
51
|
+
readonly results: string;
|
|
52
|
+
readonly consumed: string;
|
|
53
|
+
readonly spent: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function adapterPaths(stateDir: string, sessionId: string): AdapterPaths;
|
|
56
|
+
export interface CollectLimits {
|
|
57
|
+
/**
|
|
58
|
+
* How many outbox files one collection reads.
|
|
59
|
+
*
|
|
60
|
+
* 🔴 NOT A PERFORMANCE KNOB. The outbox is a directory a SESSION writes, and
|
|
61
|
+
* an unbounded read of it is an unbounded amount of work this process does on
|
|
62
|
+
* the word of the thing it is deciding about. Files past the limit are left
|
|
63
|
+
* where they are and NAMED, never silently skipped.
|
|
64
|
+
*/
|
|
65
|
+
readonly maxFiles: number;
|
|
66
|
+
/** Bytes. A message is a handful of fields; anything larger is not one. */
|
|
67
|
+
readonly maxBytes: number;
|
|
68
|
+
}
|
|
69
|
+
export declare const DEFAULT_COLLECT_LIMITS: CollectLimits;
|
|
70
|
+
export interface Collected {
|
|
71
|
+
/** The outbox file this came from, relative to the outbox. */
|
|
72
|
+
readonly file: string;
|
|
73
|
+
readonly ruling: OutboxRuling;
|
|
74
|
+
}
|
|
75
|
+
export interface CollectOutcome {
|
|
76
|
+
readonly rulings: readonly Collected[];
|
|
77
|
+
/**
|
|
78
|
+
* What could not be looked at, and why. Blind spots, named — the same rule
|
|
79
|
+
* `session-observe.ts` keeps, and for the same reason: an empty list of
|
|
80
|
+
* rulings must not be able to mean "the session said nothing" when it means
|
|
81
|
+
* "the outbox could not be read".
|
|
82
|
+
*/
|
|
83
|
+
readonly unreadable: readonly string[];
|
|
84
|
+
/** Whether the outbox directory existed at all. */
|
|
85
|
+
readonly present: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Put a message in the session's inbox.
|
|
89
|
+
*
|
|
90
|
+
* ⚠️ WRITTEN TO A TEMPORARY NAME AND RENAMED. A session polling this directory
|
|
91
|
+
* would otherwise be able to read a half-written offer, parse it as malformed,
|
|
92
|
+
* and discard the only copy of a handshake it will ever be sent.
|
|
93
|
+
*/
|
|
94
|
+
export declare function deliver(paths: AdapterPaths, message: InboxMessage, name?: string): string;
|
|
95
|
+
/** The handshakes this machine has already finished with, across restarts. */
|
|
96
|
+
export declare function spentHandshakes(paths: AdapterPaths): string[];
|
|
97
|
+
/**
|
|
98
|
+
* Record a handshake as finished, and WHAT IT ESTABLISHED. Append-only.
|
|
99
|
+
*
|
|
100
|
+
* 🔴 THE ACKNOWLEDGEMENT IS KEPT, NOT ONLY THE FACT THAT IT WAS SPENT, AND A
|
|
101
|
+
* LIVE RUN IS WHY.
|
|
102
|
+
*
|
|
103
|
+
* Without it, control lasted exactly one read: `sessions --offer` validated the
|
|
104
|
+
* acknowledgement, archived the file, reported `under management` — and the
|
|
105
|
+
* very next command found an empty outbox and answered "the session has not
|
|
106
|
+
* acknowledged this grant". Every `--direct` after a successful adoption ended
|
|
107
|
+
* direction. The whole feature worked once per acknowledgement and then
|
|
108
|
+
* un-worked itself.
|
|
109
|
+
*
|
|
110
|
+
* ⚠️ AND IT IS BOUND TO THE NONCE, WHICH IS WHAT KEEPS IT HONEST. A remembered
|
|
111
|
+
* acknowledgement answers for exactly one grant: the next grant carries a new
|
|
112
|
+
* server-minted handshake, this record does not match it, and the session has to
|
|
113
|
+
* acknowledge again. Control does not survive a re-issue, and a lapsed or
|
|
114
|
+
* revoked grant still refuses — because the GRANT is re-read from the server
|
|
115
|
+
* every time and only the session's cooperation is remembered here.
|
|
116
|
+
*/
|
|
117
|
+
export declare function markSpent(paths: AdapterPaths, nonce: string, at: string, why: string, ack?: SessionAcknowledgement): void;
|
|
118
|
+
/**
|
|
119
|
+
* The acknowledgement this machine validated for one handshake, if any.
|
|
120
|
+
*
|
|
121
|
+
* 🔴 THIS IS A RECORD OF A LOCAL VALIDATION, NOT A SOURCE OF AUTHORITY, and
|
|
122
|
+
* the difference is the whole reason it is safe. The grant is the server's and
|
|
123
|
+
* is re-read on every call; this only answers "did the session cooperate with
|
|
124
|
+
* THAT handshake". A machine editing this file by hand could claim cooperation
|
|
125
|
+
* for a grant a person genuinely issued — strictly weaker than the `--authorize`
|
|
126
|
+
* hole, which manufactured the HUMAN half, and it is the price of control
|
|
127
|
+
* lasting longer than a single read.
|
|
128
|
+
*
|
|
129
|
+
* ⚠️ AN ENTRY WITHOUT AN ACKNOWLEDGEMENT DOES NOT MATCH. The journal has
|
|
130
|
+
* carried bare `{nonce, at, why}` rows since before this existed, and reading
|
|
131
|
+
* one as "cooperation established" would turn every previously-spent handshake
|
|
132
|
+
* into a live one.
|
|
133
|
+
*/
|
|
134
|
+
export declare function validatedAck(paths: AdapterPaths, nonce: string): SessionAcknowledgement | null;
|
|
135
|
+
/**
|
|
136
|
+
* Read the outbox and rule on everything in it.
|
|
137
|
+
*
|
|
138
|
+
* 🔴 `lstat`, NEVER `stat`. An outbox entry that is a link is not descended and
|
|
139
|
+
* not read: a session that could point one at a file outside its own channel
|
|
140
|
+
* would be choosing what this process parses, and every path in the report
|
|
141
|
+
* would still look like an ordinary outbox file.
|
|
142
|
+
*/
|
|
143
|
+
export declare function collectOutbox(paths: AdapterPaths, ctx: Omit<AdapterContext, 'consumedNonces'>, limits?: CollectLimits): CollectOutcome;
|
|
144
|
+
/**
|
|
145
|
+
* Move a ruled-on file out of the outbox.
|
|
146
|
+
*
|
|
147
|
+
* ⚠️ MOVED, NOT DELETED. The file is the evidence — of a genuine
|
|
148
|
+
* acknowledgement, or of an attempted replay — and a runtime that deleted it
|
|
149
|
+
* would leave the refusal with nothing behind it. It also stops the next
|
|
150
|
+
* collection re-reading the same message and reporting it again.
|
|
151
|
+
*/
|
|
152
|
+
export declare function archive(paths: AdapterPaths, file: string): string | null;
|
|
153
|
+
/**
|
|
154
|
+
* One line each, for a person.
|
|
155
|
+
*
|
|
156
|
+
* ⚠️ THE BLIND SPOTS ARE PRINTED EVEN WHEN NOTHING WAS RULED ON. An outbox that
|
|
157
|
+
* could not be listed and an outbox that is empty produce the same empty list of
|
|
158
|
+
* rulings, and only one of them means the session said nothing.
|
|
159
|
+
*/
|
|
160
|
+
export declare function reportCollection(outcome: CollectOutcome, out: (line: string) => void): void;
|
|
161
|
+
export interface CollectedResult {
|
|
162
|
+
readonly file: string;
|
|
163
|
+
/** The instruction this answers, when it answers one this caller knows about. */
|
|
164
|
+
readonly instructionId: string;
|
|
165
|
+
readonly ruling: ResultRuling;
|
|
166
|
+
}
|
|
167
|
+
export interface ResultOutcome {
|
|
168
|
+
readonly results: readonly CollectedResult[];
|
|
169
|
+
readonly unreadable: readonly string[];
|
|
170
|
+
readonly present: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Read the results directory and rule on everything in it.
|
|
174
|
+
*
|
|
175
|
+
* 🔴 A RESULT FOR AN INSTRUCTION THIS CALLER NEVER SENT IS NOT DISCARDED. It
|
|
176
|
+
* is reported as unjudgeable with its own id, because "I do not know that
|
|
177
|
+
* instruction" is a fact worth seeing — it is what a replayed result, a
|
|
178
|
+
* confused adapter and a second looply on the same channel all look like, and
|
|
179
|
+
* dropping it would make all three invisible.
|
|
180
|
+
*
|
|
181
|
+
* The same bounds as the outbox, for the same reason: this is a directory the
|
|
182
|
+
* SESSION writes.
|
|
183
|
+
*/
|
|
184
|
+
export declare function collectResults(paths: AdapterPaths, instructions: readonly Instruction[], at: string, limits?: CollectLimits): ResultOutcome;
|
|
185
|
+
/** Move a ruled-on result out of the way, keeping it as evidence. */
|
|
186
|
+
export declare function archiveResult(paths: AdapterPaths, file: string): string | null;
|
|
187
|
+
/**
|
|
188
|
+
* One line each, for a person.
|
|
189
|
+
*
|
|
190
|
+
* ⚠️ AN ABSENT RESULTS DIRECTORY AND AN EMPTY ONE ARE DIFFERENT FACTS, the
|
|
191
|
+
* same distinction the outbox keeps: one means the session has never answered an
|
|
192
|
+
* instruction, the other that it has not answered THIS one yet.
|
|
193
|
+
*/
|
|
194
|
+
export declare function reportResults(outcome: ResultOutcome, out: (line: string) => void): void;
|
|
195
|
+
//# sourceMappingURL=session-adapter-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-adapter-runtime.d.ts","sourceRoot":"","sources":["../src/session-adapter-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAA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|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_COLLECT_LIMITS = void 0;
|
|
4
|
+
exports.adapterPaths = adapterPaths;
|
|
5
|
+
exports.deliver = deliver;
|
|
6
|
+
exports.spentHandshakes = spentHandshakes;
|
|
7
|
+
exports.markSpent = markSpent;
|
|
8
|
+
exports.validatedAck = validatedAck;
|
|
9
|
+
exports.collectOutbox = collectOutbox;
|
|
10
|
+
exports.archive = archive;
|
|
11
|
+
exports.reportCollection = reportCollection;
|
|
12
|
+
exports.collectResults = collectResults;
|
|
13
|
+
exports.archiveResult = archiveResult;
|
|
14
|
+
exports.reportResults = reportResults;
|
|
15
|
+
const node_fs_1 = require("node:fs");
|
|
16
|
+
const node_path_1 = require("node:path");
|
|
17
|
+
const core_1 = require("@looply/core");
|
|
18
|
+
function adapterPaths(stateDir, sessionId) {
|
|
19
|
+
const dir = (0, node_path_1.join)(stateDir, 'sessions', sessionId);
|
|
20
|
+
return {
|
|
21
|
+
dir,
|
|
22
|
+
inbox: (0, node_path_1.join)(dir, 'inbox'),
|
|
23
|
+
outbox: (0, node_path_1.join)(dir, 'outbox'),
|
|
24
|
+
results: (0, node_path_1.join)(dir, 'results'),
|
|
25
|
+
consumed: (0, node_path_1.join)(dir, 'consumed'),
|
|
26
|
+
spent: (0, node_path_1.join)(dir, 'spent.jsonl'),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.DEFAULT_COLLECT_LIMITS = { maxFiles: 64, maxBytes: 64 * 1024 };
|
|
30
|
+
const ensure = (dir) => {
|
|
31
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Put a message in the session's inbox.
|
|
35
|
+
*
|
|
36
|
+
* ⚠️ WRITTEN TO A TEMPORARY NAME AND RENAMED. A session polling this directory
|
|
37
|
+
* would otherwise be able to read a half-written offer, parse it as malformed,
|
|
38
|
+
* and discard the only copy of a handshake it will ever be sent.
|
|
39
|
+
*/
|
|
40
|
+
function deliver(paths, message, name) {
|
|
41
|
+
ensure(paths.inbox);
|
|
42
|
+
/**
|
|
43
|
+
* ⚠️ AN INSTRUCTION IS NAMED BY ITS OWN ID, NOT BY ITS GRANT. Every message
|
|
44
|
+
* about control is the latest word on one grant and replacing the previous one
|
|
45
|
+
* is right; every instruction is a separate thing to do, and naming them all
|
|
46
|
+
* after the grant would make each one delete the last.
|
|
47
|
+
*/
|
|
48
|
+
const base = name ??
|
|
49
|
+
(message.kind === 'instruction'
|
|
50
|
+
? `instruction-${message.instructionId}.json`
|
|
51
|
+
: `${message.kind}-${message.grantId}.json`);
|
|
52
|
+
const target = (0, node_path_1.join)(paths.inbox, base);
|
|
53
|
+
const temp = `${target}.partial`;
|
|
54
|
+
const fd = (0, node_fs_1.openSync)(temp, 'w');
|
|
55
|
+
try {
|
|
56
|
+
(0, node_fs_1.writeSync)(fd, JSON.stringify(message, null, 2));
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
(0, node_fs_1.closeSync)(fd);
|
|
60
|
+
}
|
|
61
|
+
(0, node_fs_1.renameSync)(temp, target);
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
64
|
+
/** The handshakes this machine has already finished with, across restarts. */
|
|
65
|
+
function spentHandshakes(paths) {
|
|
66
|
+
let raw;
|
|
67
|
+
try {
|
|
68
|
+
raw = (0, node_fs_1.readFileSync)(paths.spent, 'utf8');
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const out = [];
|
|
74
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
75
|
+
if (line.trim() === '')
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
const v = JSON.parse(line);
|
|
79
|
+
/**
|
|
80
|
+
* ⚠️ A TORN LAST LINE IS SKIPPED, NOT FATAL, and the rest of the journal
|
|
81
|
+
* still counts. A crash mid-append is the ordinary way this file ends,
|
|
82
|
+
* and refusing to read any of it would turn one bad line into every
|
|
83
|
+
* earlier handshake becoming replayable again.
|
|
84
|
+
*/
|
|
85
|
+
if (typeof v.nonce === 'string' && v.nonce !== '')
|
|
86
|
+
out.push(v.nonce);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Not a record; keep reading.
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Record a handshake as finished, and WHAT IT ESTABLISHED. Append-only.
|
|
96
|
+
*
|
|
97
|
+
* 🔴 THE ACKNOWLEDGEMENT IS KEPT, NOT ONLY THE FACT THAT IT WAS SPENT, AND A
|
|
98
|
+
* LIVE RUN IS WHY.
|
|
99
|
+
*
|
|
100
|
+
* Without it, control lasted exactly one read: `sessions --offer` validated the
|
|
101
|
+
* acknowledgement, archived the file, reported `under management` — and the
|
|
102
|
+
* very next command found an empty outbox and answered "the session has not
|
|
103
|
+
* acknowledged this grant". Every `--direct` after a successful adoption ended
|
|
104
|
+
* direction. The whole feature worked once per acknowledgement and then
|
|
105
|
+
* un-worked itself.
|
|
106
|
+
*
|
|
107
|
+
* ⚠️ AND IT IS BOUND TO THE NONCE, WHICH IS WHAT KEEPS IT HONEST. A remembered
|
|
108
|
+
* acknowledgement answers for exactly one grant: the next grant carries a new
|
|
109
|
+
* server-minted handshake, this record does not match it, and the session has to
|
|
110
|
+
* acknowledge again. Control does not survive a re-issue, and a lapsed or
|
|
111
|
+
* revoked grant still refuses — because the GRANT is re-read from the server
|
|
112
|
+
* every time and only the session's cooperation is remembered here.
|
|
113
|
+
*/
|
|
114
|
+
function markSpent(paths, nonce, at, why, ack) {
|
|
115
|
+
ensure(paths.dir);
|
|
116
|
+
const fd = (0, node_fs_1.openSync)(paths.spent, 'a');
|
|
117
|
+
try {
|
|
118
|
+
(0, node_fs_1.writeSync)(fd, `${JSON.stringify(ack === undefined ? { nonce, at, why } : { nonce, at, why, ack })}\n`);
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
(0, node_fs_1.closeSync)(fd);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The acknowledgement this machine validated for one handshake, if any.
|
|
126
|
+
*
|
|
127
|
+
* 🔴 THIS IS A RECORD OF A LOCAL VALIDATION, NOT A SOURCE OF AUTHORITY, and
|
|
128
|
+
* the difference is the whole reason it is safe. The grant is the server's and
|
|
129
|
+
* is re-read on every call; this only answers "did the session cooperate with
|
|
130
|
+
* THAT handshake". A machine editing this file by hand could claim cooperation
|
|
131
|
+
* for a grant a person genuinely issued — strictly weaker than the `--authorize`
|
|
132
|
+
* hole, which manufactured the HUMAN half, and it is the price of control
|
|
133
|
+
* lasting longer than a single read.
|
|
134
|
+
*
|
|
135
|
+
* ⚠️ AN ENTRY WITHOUT AN ACKNOWLEDGEMENT DOES NOT MATCH. The journal has
|
|
136
|
+
* carried bare `{nonce, at, why}` rows since before this existed, and reading
|
|
137
|
+
* one as "cooperation established" would turn every previously-spent handshake
|
|
138
|
+
* into a live one.
|
|
139
|
+
*/
|
|
140
|
+
function validatedAck(paths, nonce) {
|
|
141
|
+
let raw;
|
|
142
|
+
try {
|
|
143
|
+
raw = (0, node_fs_1.readFileSync)(paths.spent, 'utf8');
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
let found = null;
|
|
149
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
150
|
+
if (line.trim() === '')
|
|
151
|
+
continue;
|
|
152
|
+
try {
|
|
153
|
+
const v = JSON.parse(line);
|
|
154
|
+
if (v.nonce !== nonce || typeof v.ack !== 'object' || v.ack === null)
|
|
155
|
+
continue;
|
|
156
|
+
const a = v.ack;
|
|
157
|
+
if (a['handshakeNonce'] !== nonce)
|
|
158
|
+
continue;
|
|
159
|
+
if (a['via'] !== 'adapter')
|
|
160
|
+
continue;
|
|
161
|
+
found = v.ack;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Not a record; keep reading.
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return found;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Read the outbox and rule on everything in it.
|
|
171
|
+
*
|
|
172
|
+
* 🔴 `lstat`, NEVER `stat`. An outbox entry that is a link is not descended and
|
|
173
|
+
* not read: a session that could point one at a file outside its own channel
|
|
174
|
+
* would be choosing what this process parses, and every path in the report
|
|
175
|
+
* would still look like an ordinary outbox file.
|
|
176
|
+
*/
|
|
177
|
+
function collectOutbox(paths, ctx, limits = exports.DEFAULT_COLLECT_LIMITS) {
|
|
178
|
+
const unreadable = [];
|
|
179
|
+
let names;
|
|
180
|
+
try {
|
|
181
|
+
names = (0, node_fs_1.readdirSync)(paths.outbox).sort();
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return { rulings: [], unreadable: [], present: false };
|
|
185
|
+
}
|
|
186
|
+
const spent = spentHandshakes(paths);
|
|
187
|
+
const rulings = [];
|
|
188
|
+
let read = 0;
|
|
189
|
+
for (const name of names) {
|
|
190
|
+
if (read >= limits.maxFiles) {
|
|
191
|
+
unreadable.push(`${names.length - read} more outbox file(s) were left unread — ${limits.maxFiles} is this collection's limit`);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
const at = (0, node_path_1.join)(paths.outbox, name);
|
|
195
|
+
let st;
|
|
196
|
+
try {
|
|
197
|
+
st = (0, node_fs_1.lstatSync)(at);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
unreadable.push(`${name} could not be read`);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (st.isSymbolicLink()) {
|
|
204
|
+
unreadable.push(`${name} is a link, and a link in an outbox chooses what this process parses — not followed`);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
if (!st.isFile())
|
|
208
|
+
continue;
|
|
209
|
+
if (st.size > limits.maxBytes) {
|
|
210
|
+
unreadable.push(`${name} is ${st.size} bytes, past the ${limits.maxBytes}-byte limit for a message — not parsed`);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
read += 1;
|
|
214
|
+
let parsed;
|
|
215
|
+
try {
|
|
216
|
+
parsed = JSON.parse((0, node_fs_1.readFileSync)(at, 'utf8'));
|
|
217
|
+
}
|
|
218
|
+
catch (e) {
|
|
219
|
+
rulings.push({ file: name, ruling: { kind: 'unjudgeable', because: `${name} is not JSON: ${e.message}` } });
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const message = (0, core_1.readOutboxMessage)(parsed);
|
|
223
|
+
if (message === null) {
|
|
224
|
+
rulings.push({ file: name, ruling: { kind: 'unjudgeable', because: `${name} is not an outbox message` } });
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
rulings.push({ file: name, ruling: (0, core_1.ruleOnOutbox)(message, { ...ctx, consumedNonces: spent }) });
|
|
228
|
+
}
|
|
229
|
+
return { rulings, unreadable, present: true };
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Move a ruled-on file out of the outbox.
|
|
233
|
+
*
|
|
234
|
+
* ⚠️ MOVED, NOT DELETED. The file is the evidence — of a genuine
|
|
235
|
+
* acknowledgement, or of an attempted replay — and a runtime that deleted it
|
|
236
|
+
* would leave the refusal with nothing behind it. It also stops the next
|
|
237
|
+
* collection re-reading the same message and reporting it again.
|
|
238
|
+
*/
|
|
239
|
+
function archive(paths, file) {
|
|
240
|
+
ensure(paths.consumed);
|
|
241
|
+
const from = (0, node_path_1.join)(paths.outbox, file);
|
|
242
|
+
const to = (0, node_path_1.join)(paths.consumed, file);
|
|
243
|
+
try {
|
|
244
|
+
(0, node_fs_1.renameSync)(from, to);
|
|
245
|
+
return to;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* One line each, for a person.
|
|
253
|
+
*
|
|
254
|
+
* ⚠️ THE BLIND SPOTS ARE PRINTED EVEN WHEN NOTHING WAS RULED ON. An outbox that
|
|
255
|
+
* could not be listed and an outbox that is empty produce the same empty list of
|
|
256
|
+
* rulings, and only one of them means the session said nothing.
|
|
257
|
+
*/
|
|
258
|
+
function reportCollection(outcome, out) {
|
|
259
|
+
if (!outcome.present) {
|
|
260
|
+
out(' the session has no outbox — nothing was established about what it said');
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (outcome.rulings.length === 0 && outcome.unreadable.length === 0) {
|
|
264
|
+
out(' the outbox is empty: the session has not answered yet');
|
|
265
|
+
}
|
|
266
|
+
for (const u of outcome.unreadable)
|
|
267
|
+
out(` blind: ${u}`);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Read the results directory and rule on everything in it.
|
|
271
|
+
*
|
|
272
|
+
* 🔴 A RESULT FOR AN INSTRUCTION THIS CALLER NEVER SENT IS NOT DISCARDED. It
|
|
273
|
+
* is reported as unjudgeable with its own id, because "I do not know that
|
|
274
|
+
* instruction" is a fact worth seeing — it is what a replayed result, a
|
|
275
|
+
* confused adapter and a second looply on the same channel all look like, and
|
|
276
|
+
* dropping it would make all three invisible.
|
|
277
|
+
*
|
|
278
|
+
* The same bounds as the outbox, for the same reason: this is a directory the
|
|
279
|
+
* SESSION writes.
|
|
280
|
+
*/
|
|
281
|
+
function collectResults(paths, instructions, at, limits = exports.DEFAULT_COLLECT_LIMITS) {
|
|
282
|
+
const unreadable = [];
|
|
283
|
+
let names;
|
|
284
|
+
try {
|
|
285
|
+
names = (0, node_fs_1.readdirSync)(paths.results).sort();
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
return { results: [], unreadable: [], present: false };
|
|
289
|
+
}
|
|
290
|
+
const byId = new Map(instructions.map((i) => [i.id, i]));
|
|
291
|
+
const out = [];
|
|
292
|
+
let read = 0;
|
|
293
|
+
for (const name of names) {
|
|
294
|
+
if (read >= limits.maxFiles) {
|
|
295
|
+
unreadable.push(`${names.length - read} more result file(s) were left unread — ${limits.maxFiles} is this collection's limit`);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
const abs = (0, node_path_1.join)(paths.results, name);
|
|
299
|
+
let st;
|
|
300
|
+
try {
|
|
301
|
+
st = (0, node_fs_1.lstatSync)(abs);
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
unreadable.push(`${name} could not be read`);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (st.isSymbolicLink()) {
|
|
308
|
+
unreadable.push(`${name} is a link, and a link here chooses what this process parses — not followed`);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (!st.isFile())
|
|
312
|
+
continue;
|
|
313
|
+
if (st.size > limits.maxBytes) {
|
|
314
|
+
unreadable.push(`${name} is ${st.size} bytes, past the ${limits.maxBytes}-byte limit for a result — not parsed`);
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
read += 1;
|
|
318
|
+
let parsed;
|
|
319
|
+
try {
|
|
320
|
+
parsed = JSON.parse((0, node_fs_1.readFileSync)(abs, 'utf8'));
|
|
321
|
+
}
|
|
322
|
+
catch (e) {
|
|
323
|
+
out.push({ file: name, instructionId: '', ruling: { kind: 'unjudgeable', because: `${name} is not JSON: ${e.message}` } });
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const result = (0, core_1.readInstructionResult)(parsed);
|
|
327
|
+
if (result === null) {
|
|
328
|
+
out.push({ file: name, instructionId: '', ruling: { kind: 'unjudgeable', because: `${name} is not an instruction result` } });
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const instruction = byId.get(result.instructionId);
|
|
332
|
+
if (instruction === undefined) {
|
|
333
|
+
out.push({
|
|
334
|
+
file: name,
|
|
335
|
+
instructionId: result.instructionId,
|
|
336
|
+
ruling: { kind: 'unjudgeable', because: `${result.instructionId} is not an instruction this caller sent` },
|
|
337
|
+
});
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
out.push({ file: name, instructionId: result.instructionId, ruling: (0, core_1.ruleOnResult)(instruction, result, at) });
|
|
341
|
+
}
|
|
342
|
+
return { results: out, unreadable, present: true };
|
|
343
|
+
}
|
|
344
|
+
/** Move a ruled-on result out of the way, keeping it as evidence. */
|
|
345
|
+
function archiveResult(paths, file) {
|
|
346
|
+
ensure(paths.consumed);
|
|
347
|
+
try {
|
|
348
|
+
(0, node_fs_1.renameSync)((0, node_path_1.join)(paths.results, file), (0, node_path_1.join)(paths.consumed, file));
|
|
349
|
+
return (0, node_path_1.join)(paths.consumed, file);
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* One line each, for a person.
|
|
357
|
+
*
|
|
358
|
+
* ⚠️ AN ABSENT RESULTS DIRECTORY AND AN EMPTY ONE ARE DIFFERENT FACTS, the
|
|
359
|
+
* same distinction the outbox keeps: one means the session has never answered an
|
|
360
|
+
* instruction, the other that it has not answered THIS one yet.
|
|
361
|
+
*/
|
|
362
|
+
function reportResults(outcome, out) {
|
|
363
|
+
if (!outcome.present) {
|
|
364
|
+
out(' the session has written no results at all — nothing was established about what it did');
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
if (outcome.results.length === 0 && outcome.unreadable.length === 0) {
|
|
368
|
+
out(' no result yet');
|
|
369
|
+
}
|
|
370
|
+
for (const u of outcome.unreadable)
|
|
371
|
+
out(` blind: ${u}`);
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=session-adapter-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-adapter-runtime.js","sourceRoot":"","sources":["../src/session-adapter-runtime.ts"],"names":[],"mappings":";;;AAuEA,oCAUC;AAgDD,0BAuBC;AAGD,0CAwBC;AAsBD,8BAcC;AAkBD,oCAsBC;AAUD,sCAyDC;AAUD,0BAUC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,UAAU;QAAE,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type Checkpoint, type CheckpointMeasurements } from '@looply/core';
|
|
2
|
+
export interface CheckpointLimits {
|
|
3
|
+
/** Bytes of diff kept. Past it, the diff is recorded as truncated. */
|
|
4
|
+
readonly maxDiffBytes: number;
|
|
5
|
+
/** Untracked files copied. Past it, the rest are named and not copied. */
|
|
6
|
+
readonly maxUntrackedFiles: number;
|
|
7
|
+
/** Bytes per untracked file. */
|
|
8
|
+
readonly maxFileBytes: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const DEFAULT_CHECKPOINT_LIMITS: CheckpointLimits;
|
|
11
|
+
/**
|
|
12
|
+
* What this machine can establish about the workspace.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ EVERY FAILURE IS `null`, NEVER AN EMPTY LIST. `checkpointVerdict` answers
|
|
15
|
+
* `unmeasurable` for a null and would produce a clean-looking checkpoint from an
|
|
16
|
+
* empty one — which is the single most consequential thing this file could get
|
|
17
|
+
* wrong, so the distinction is made here rather than left to a caller.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* 🔴 LOOPLY'S OWN STATE DIRECTORY IS NOT THE SESSION'S WORK, AND A LIVE RUN
|
|
21
|
+
* PROVED WHY IT MATTERS.
|
|
22
|
+
*
|
|
23
|
+
* The checkpoint store lives at `<workspace>/.looply/state/checkpoints`, and
|
|
24
|
+
* `git ls-files --others` lists everything under it. So the FIRST checkpoint
|
|
25
|
+
* copied the session's work; the SECOND copied the session's work AND the first
|
|
26
|
+
* checkpoint; a third would have copied both. Measured: 5 untracked files became
|
|
27
|
+
* 12 on the second run. Each capture contained every capture before it.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ AND IT WAS ALSO MISLABELLED. `.looply/state/sessions.jsonl` is looply's
|
|
30
|
+
* own ledger, and it landed in a directory labelled "this session's untracked
|
|
31
|
+
* work" — a product's bookkeeping presented as somebody else's output.
|
|
32
|
+
*
|
|
33
|
+
* ⚠️ ONLY `state` IS EXCLUDED, NOT ALL OF `.looply`. A session that created
|
|
34
|
+
* `.looply/config.yaml` really did create it, and dropping that would be a guess
|
|
35
|
+
* about what counts as work. `state` is this product's runtime bookkeeping by
|
|
36
|
+
* construction, which is not a guess.
|
|
37
|
+
*/
|
|
38
|
+
export declare const STATE_SUBDIR = ".looply/state";
|
|
39
|
+
export interface WorkspaceReading extends CheckpointMeasurements {
|
|
40
|
+
/** Untracked paths left out because they are looply's own, named. */
|
|
41
|
+
readonly excluded: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export declare function measureWorkspace(workspace: string, liveness: CheckpointMeasurements['liveness'], heldBy: string | null, stateSubdir?: string): WorkspaceReading;
|
|
44
|
+
export interface WrittenCheckpoint {
|
|
45
|
+
readonly dir: string;
|
|
46
|
+
readonly manifest: string;
|
|
47
|
+
readonly diff: string | null;
|
|
48
|
+
readonly copied: number;
|
|
49
|
+
/** Everything that could not be captured in full, named. */
|
|
50
|
+
readonly incomplete: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Write the checkpoint: a manifest, the diff, and the untracked files.
|
|
54
|
+
*
|
|
55
|
+
* 🔴 THE MANIFEST IS WRITTEN LAST. Everything it names must already exist, or a
|
|
56
|
+
* crash mid-capture leaves a manifest describing an export that is not there —
|
|
57
|
+
* and a manifest is exactly what a later reader will trust.
|
|
58
|
+
*/
|
|
59
|
+
export declare function writeCheckpoint(root: string, checkpoint: Checkpoint, limits?: CheckpointLimits): WrittenCheckpoint;
|
|
60
|
+
/** The lines a person reads, with what the export actually contains. */
|
|
61
|
+
export declare function reportCheckpoint(written: WrittenCheckpoint, checkpoint: Checkpoint, out: (line: string) => void, excluded?: readonly string[]): void;
|
|
62
|
+
//# sourceMappingURL=session-checkpoint-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-checkpoint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