looply-cli 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -3
- package/dist/.src-hash +1 -0
- package/dist/acceptance-observe.d.ts +108 -0
- package/dist/acceptance-observe.d.ts.map +1 -0
- package/dist/acceptance-observe.js +152 -0
- package/dist/acceptance-observe.js.map +1 -0
- package/dist/agent-cmd.d.ts +131 -0
- package/dist/agent-cmd.d.ts.map +1 -0
- package/dist/agent-cmd.js +154 -0
- package/dist/agent-cmd.js.map +1 -0
- package/dist/agent-contained.d.ts +114 -0
- package/dist/agent-contained.d.ts.map +1 -0
- package/dist/agent-contained.js +292 -0
- package/dist/agent-contained.js.map +1 -0
- package/dist/agent-driver.d.ts +130 -0
- package/dist/agent-driver.d.ts.map +1 -0
- package/dist/agent-driver.js +170 -0
- package/dist/agent-driver.js.map +1 -0
- package/dist/agent-envelope.d.ts +94 -0
- package/dist/agent-envelope.d.ts.map +1 -0
- package/dist/agent-envelope.js +214 -0
- package/dist/agent-envelope.js.map +1 -0
- package/dist/agent-exec.d.ts +182 -0
- package/dist/agent-exec.d.ts.map +1 -0
- package/dist/agent-exec.js +125 -0
- package/dist/agent-exec.js.map +1 -0
- package/dist/agent-runtime.d.ts +23 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +143 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/approval-gate-read.d.ts +66 -0
- package/dist/approval-gate-read.d.ts.map +1 -0
- package/dist/approval-gate-read.js +138 -0
- package/dist/approval-gate-read.js.map +1 -0
- package/dist/approval-resolution.d.ts +87 -0
- package/dist/approval-resolution.d.ts.map +1 -0
- package/dist/approval-resolution.js +100 -0
- package/dist/approval-resolution.js.map +1 -0
- package/dist/approval-resumes.d.ts +102 -0
- package/dist/approval-resumes.d.ts.map +1 -0
- package/dist/approval-resumes.js +167 -0
- package/dist/approval-resumes.js.map +1 -0
- package/dist/ask-brain.d.ts +167 -0
- package/dist/ask-brain.d.ts.map +1 -0
- package/dist/ask-brain.js +355 -0
- package/dist/ask-brain.js.map +1 -0
- package/dist/autonomy-authority.d.ts +80 -0
- package/dist/autonomy-authority.d.ts.map +1 -0
- package/dist/autonomy-authority.js +82 -0
- package/dist/autonomy-authority.js.map +1 -0
- package/dist/autonomy-controller.d.ts +321 -0
- package/dist/autonomy-controller.d.ts.map +1 -0
- package/dist/autonomy-controller.js +517 -0
- package/dist/autonomy-controller.js.map +1 -0
- package/dist/autonomy-store.d.ts +327 -0
- package/dist/autonomy-store.d.ts.map +1 -0
- package/dist/autonomy-store.js +581 -0
- package/dist/autonomy-store.js.map +1 -0
- package/dist/autonomy-tick.d.ts +257 -0
- package/dist/autonomy-tick.d.ts.map +1 -0
- package/dist/autonomy-tick.js +616 -0
- package/dist/autonomy-tick.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +2719 -0
- package/dist/bin.js.map +1 -0
- package/dist/brain-advice.d.ts +21 -0
- package/dist/brain-advice.d.ts.map +1 -0
- package/dist/brain-advice.js +51 -0
- package/dist/brain-advice.js.map +1 -0
- package/dist/candidate-replay-runtime.d.ts +125 -0
- package/dist/candidate-replay-runtime.d.ts.map +1 -0
- package/dist/candidate-replay-runtime.js +188 -0
- package/dist/candidate-replay-runtime.js.map +1 -0
- package/dist/checkout-carry.d.ts +76 -0
- package/dist/checkout-carry.d.ts.map +1 -0
- package/dist/checkout-carry.js +125 -0
- package/dist/checkout-carry.js.map +1 -0
- package/dist/citation-readers.d.ts +26 -0
- package/dist/citation-readers.d.ts.map +1 -0
- package/dist/citation-readers.js +102 -0
- package/dist/citation-readers.js.map +1 -0
- package/dist/command-receipts.d.ts +79 -0
- package/dist/command-receipts.d.ts.map +1 -0
- package/dist/command-receipts.js +143 -0
- package/dist/command-receipts.js.map +1 -0
- package/dist/command-runner.d.ts +32 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +108 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/compatible-sets.d.ts +67 -0
- package/dist/compatible-sets.d.ts.map +1 -0
- package/dist/compatible-sets.js +81 -0
- package/dist/compatible-sets.js.map +1 -0
- package/dist/compile-check.d.ts +31 -0
- package/dist/compile-check.d.ts.map +1 -0
- package/dist/compile-check.js +34 -0
- package/dist/compile-check.js.map +1 -0
- package/dist/compile-store.d.ts +16 -0
- package/dist/compile-store.d.ts.map +1 -0
- package/dist/compile-store.js +21 -0
- package/dist/compile-store.js.map +1 -0
- package/dist/completion.d.ts +106 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +131 -0
- package/dist/completion.js.map +1 -0
- package/dist/config.d.ts +549 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +763 -0
- package/dist/config.js.map +1 -0
- package/dist/control-file.d.ts +142 -0
- package/dist/control-file.d.ts.map +1 -0
- package/dist/control-file.js +144 -0
- package/dist/control-file.js.map +1 -0
- package/dist/coordinator-state.d.ts +131 -0
- package/dist/coordinator-state.d.ts.map +1 -0
- package/dist/coordinator-state.js +380 -0
- package/dist/coordinator-state.js.map +1 -0
- package/dist/coordinator.d.ts +95 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +97 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/cursor-store.d.ts +53 -0
- package/dist/cursor-store.d.ts.map +1 -0
- package/dist/cursor-store.js +98 -0
- package/dist/cursor-store.js.map +1 -0
- package/dist/daemon-cmd.d.ts +239 -0
- package/dist/daemon-cmd.d.ts.map +1 -0
- package/dist/daemon-cmd.js +1751 -0
- package/dist/daemon-cmd.js.map +1 -0
- package/dist/daemon-lock.d.ts +140 -0
- package/dist/daemon-lock.d.ts.map +1 -0
- package/dist/daemon-lock.js +352 -0
- package/dist/daemon-lock.js.map +1 -0
- package/dist/daemon-recovery.d.ts +78 -0
- package/dist/daemon-recovery.d.ts.map +1 -0
- package/dist/daemon-recovery.js +161 -0
- package/dist/daemon-recovery.js.map +1 -0
- package/dist/daemon.d.ts +368 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +601 -0
- package/dist/daemon.js.map +1 -0
- package/dist/declared-response-shape.d.ts +93 -0
- package/dist/declared-response-shape.d.ts.map +1 -0
- package/dist/declared-response-shape.js +200 -0
- package/dist/declared-response-shape.js.map +1 -0
- package/dist/declared-surfaces.d.ts +16 -0
- package/dist/declared-surfaces.d.ts.map +1 -0
- package/dist/declared-surfaces.js +19 -0
- package/dist/declared-surfaces.js.map +1 -0
- package/dist/depends-review.d.ts +113 -0
- package/dist/depends-review.d.ts.map +1 -0
- package/dist/depends-review.js +110 -0
- package/dist/depends-review.js.map +1 -0
- package/dist/doctor.d.ts +91 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +71 -0
- package/dist/doctor.js.map +1 -0
- package/dist/edge-approval.d.ts +105 -0
- package/dist/edge-approval.d.ts.map +1 -0
- package/dist/edge-approval.js +100 -0
- package/dist/edge-approval.js.map +1 -0
- package/dist/evidence-cache.d.ts +45 -0
- package/dist/evidence-cache.d.ts.map +1 -0
- package/dist/evidence-cache.js +90 -0
- package/dist/evidence-cache.js.map +1 -0
- package/dist/evidence-cmd.d.ts +133 -0
- package/dist/evidence-cmd.d.ts.map +1 -0
- package/dist/evidence-cmd.js +347 -0
- package/dist/evidence-cmd.js.map +1 -0
- package/dist/evidence-facts.d.ts +40 -0
- package/dist/evidence-facts.d.ts.map +1 -0
- package/dist/evidence-facts.js +114 -0
- package/dist/evidence-facts.js.map +1 -0
- package/dist/exclusive-lock.d.ts +52 -0
- package/dist/exclusive-lock.d.ts.map +1 -0
- package/dist/exclusive-lock.js +150 -0
- package/dist/exclusive-lock.js.map +1 -0
- package/dist/exec-domains.d.ts +140 -0
- package/dist/exec-domains.d.ts.map +1 -0
- package/dist/exec-domains.js +287 -0
- package/dist/exec-domains.js.map +1 -0
- package/dist/exemption-store.d.ts +197 -0
- package/dist/exemption-store.d.ts.map +1 -0
- package/dist/exemption-store.js +266 -0
- package/dist/exemption-store.js.map +1 -0
- package/dist/explicit-start-gate.d.ts +96 -0
- package/dist/explicit-start-gate.d.ts.map +1 -0
- package/dist/explicit-start-gate.js +103 -0
- package/dist/explicit-start-gate.js.map +1 -0
- package/dist/fs-trouble.d.ts +70 -0
- package/dist/fs-trouble.d.ts.map +1 -0
- package/dist/fs-trouble.js +98 -0
- package/dist/fs-trouble.js.map +1 -0
- package/dist/gate.d.ts +278 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +278 -0
- package/dist/gate.js.map +1 -0
- package/dist/git-driver.d.ts +519 -0
- package/dist/git-driver.d.ts.map +1 -0
- package/dist/git-driver.js +900 -0
- package/dist/git-driver.js.map +1 -0
- package/dist/git-push-executor.d.ts +41 -0
- package/dist/git-push-executor.d.ts.map +1 -0
- package/dist/git-push-executor.js +142 -0
- package/dist/git-push-executor.js.map +1 -0
- package/dist/glob.d.ts +26 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +93 -0
- package/dist/glob.js.map +1 -0
- package/dist/goal-adaptive.d.ts +295 -0
- package/dist/goal-adaptive.d.ts.map +1 -0
- package/dist/goal-adaptive.js +393 -0
- package/dist/goal-adaptive.js.map +1 -0
- package/dist/goal-compile.d.ts +342 -0
- package/dist/goal-compile.d.ts.map +1 -0
- package/dist/goal-compile.js +444 -0
- package/dist/goal-compile.js.map +1 -0
- package/dist/goal-depends-executor.d.ts +55 -0
- package/dist/goal-depends-executor.d.ts.map +1 -0
- package/dist/goal-depends-executor.js +202 -0
- package/dist/goal-depends-executor.js.map +1 -0
- package/dist/goal-execution-evidence.d.ts +135 -0
- package/dist/goal-execution-evidence.d.ts.map +1 -0
- package/dist/goal-execution-evidence.js +159 -0
- package/dist/goal-execution-evidence.js.map +1 -0
- package/dist/goal-gap.d.ts +140 -0
- package/dist/goal-gap.d.ts.map +1 -0
- package/dist/goal-gap.js +197 -0
- package/dist/goal-gap.js.map +1 -0
- package/dist/goal-met-target.d.ts +98 -0
- package/dist/goal-met-target.d.ts.map +1 -0
- package/dist/goal-met-target.js +92 -0
- package/dist/goal-met-target.js.map +1 -0
- package/dist/goal-ownership.d.ts +416 -0
- package/dist/goal-ownership.d.ts.map +1 -0
- package/dist/goal-ownership.js +576 -0
- package/dist/goal-ownership.js.map +1 -0
- package/dist/goal-runs.d.ts +82 -0
- package/dist/goal-runs.d.ts.map +1 -0
- package/dist/goal-runs.js +120 -0
- package/dist/goal-runs.js.map +1 -0
- package/dist/goal-store.d.ts +146 -0
- package/dist/goal-store.d.ts.map +1 -0
- package/dist/goal-store.js +294 -0
- package/dist/goal-store.js.map +1 -0
- package/dist/goal-view.d.ts +156 -0
- package/dist/goal-view.d.ts.map +1 -0
- package/dist/goal-view.js +499 -0
- package/dist/goal-view.js.map +1 -0
- package/dist/governed-approvals.d.ts +152 -0
- package/dist/governed-approvals.d.ts.map +1 -0
- package/dist/governed-approvals.js +246 -0
- package/dist/governed-approvals.js.map +1 -0
- package/dist/governed-broker.d.ts +169 -0
- package/dist/governed-broker.d.ts.map +1 -0
- package/dist/governed-broker.js +196 -0
- package/dist/governed-broker.js.map +1 -0
- package/dist/governed-run.d.ts +220 -0
- package/dist/governed-run.d.ts.map +1 -0
- package/dist/governed-run.js +406 -0
- package/dist/governed-run.js.map +1 -0
- package/dist/grant-reconcile.d.ts +63 -0
- package/dist/grant-reconcile.d.ts.map +1 -0
- package/dist/grant-reconcile.js +121 -0
- package/dist/grant-reconcile.js.map +1 -0
- package/dist/index-for-head.d.ts +56 -0
- package/dist/index-for-head.d.ts.map +1 -0
- package/dist/index-for-head.js +103 -0
- package/dist/index-for-head.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/init-detect.d.ts +39 -0
- package/dist/init-detect.d.ts.map +1 -0
- package/dist/init-detect.js +188 -0
- package/dist/init-detect.js.map +1 -0
- package/dist/integration-deps.d.ts +62 -0
- package/dist/integration-deps.d.ts.map +1 -0
- package/dist/integration-deps.js +251 -0
- package/dist/integration-deps.js.map +1 -0
- package/dist/integration-runtime.d.ts +458 -0
- package/dist/integration-runtime.d.ts.map +1 -0
- package/dist/integration-runtime.js +681 -0
- package/dist/integration-runtime.js.map +1 -0
- package/dist/integration.d.ts +45 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +87 -0
- package/dist/integration.js.map +1 -0
- package/dist/integrator.d.ts +84 -0
- package/dist/integrator.d.ts.map +1 -0
- package/dist/integrator.js +193 -0
- package/dist/integrator.js.map +1 -0
- package/dist/lane-claims.d.ts +174 -0
- package/dist/lane-claims.d.ts.map +1 -0
- package/dist/lane-claims.js +218 -0
- package/dist/lane-claims.js.map +1 -0
- package/dist/lane-coverage.d.ts +87 -0
- package/dist/lane-coverage.d.ts.map +1 -0
- package/dist/lane-coverage.js +129 -0
- package/dist/lane-coverage.js.map +1 -0
- package/dist/ledger-replay.d.ts +115 -0
- package/dist/ledger-replay.d.ts.map +1 -0
- package/dist/ledger-replay.js +155 -0
- package/dist/ledger-replay.js.map +1 -0
- package/dist/ledger-store.d.ts +68 -0
- package/dist/ledger-store.d.ts.map +1 -0
- package/dist/ledger-store.js +111 -0
- package/dist/ledger-store.js.map +1 -0
- package/dist/loop-safety-observer.d.ts +132 -0
- package/dist/loop-safety-observer.d.ts.map +1 -0
- package/dist/loop-safety-observer.js +76 -0
- package/dist/loop-safety-observer.js.map +1 -0
- package/dist/loop-safety-store.d.ts +339 -0
- package/dist/loop-safety-store.d.ts.map +1 -0
- package/dist/loop-safety-store.js +800 -0
- package/dist/loop-safety-store.js.map +1 -0
- package/dist/machine-store.d.ts +54 -0
- package/dist/machine-store.d.ts.map +1 -0
- package/dist/machine-store.js +149 -0
- package/dist/machine-store.js.map +1 -0
- package/dist/mcp-main.d.ts +2 -0
- package/dist/mcp-main.d.ts.map +1 -0
- package/dist/mcp-main.js +116 -0
- package/dist/mcp-main.js.map +1 -0
- package/dist/mcp-server.d.ts +72 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +259 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/model-routing.d.ts +75 -0
- package/dist/model-routing.d.ts.map +1 -0
- package/dist/model-routing.js +108 -0
- package/dist/model-routing.js.map +1 -0
- package/dist/model-transport.d.ts +188 -0
- package/dist/model-transport.d.ts.map +1 -0
- package/dist/model-transport.js +625 -0
- package/dist/model-transport.js.map +1 -0
- package/dist/notify-cadence.d.ts +55 -0
- package/dist/notify-cadence.d.ts.map +1 -0
- package/dist/notify-cadence.js +68 -0
- package/dist/notify-cadence.js.map +1 -0
- package/dist/notify-channel.d.ts +69 -0
- package/dist/notify-channel.d.ts.map +1 -0
- package/dist/notify-channel.js +151 -0
- package/dist/notify-channel.js.map +1 -0
- package/dist/notify.d.ts +71 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +125 -0
- package/dist/notify.js.map +1 -0
- package/dist/observation-inventory.d.ts +65 -0
- package/dist/observation-inventory.d.ts.map +1 -0
- package/dist/observation-inventory.js +139 -0
- package/dist/observation-inventory.js.map +1 -0
- package/dist/owned-children.d.ts +45 -0
- package/dist/owned-children.d.ts.map +1 -0
- package/dist/owned-children.js +64 -0
- package/dist/owned-children.js.map +1 -0
- package/dist/packet-for-goal.d.ts +19 -0
- package/dist/packet-for-goal.d.ts.map +1 -0
- package/dist/packet-for-goal.js +32 -0
- package/dist/packet-for-goal.js.map +1 -0
- package/dist/pair-cmd.d.ts +85 -0
- package/dist/pair-cmd.d.ts.map +1 -0
- package/dist/pair-cmd.js +205 -0
- package/dist/pair-cmd.js.map +1 -0
- package/dist/partial-asker.d.ts +96 -0
- package/dist/partial-asker.d.ts.map +1 -0
- package/dist/partial-asker.js +117 -0
- package/dist/partial-asker.js.map +1 -0
- package/dist/pdf-text-lines.d.ts +17 -0
- package/dist/pdf-text-lines.d.ts.map +1 -0
- package/dist/pdf-text-lines.js +70 -0
- package/dist/pdf-text-lines.js.map +1 -0
- package/dist/pdf-text-worker.d.ts +2 -0
- package/dist/pdf-text-worker.d.ts.map +1 -0
- package/dist/pdf-text-worker.js +81 -0
- package/dist/pdf-text-worker.js.map +1 -0
- package/dist/pdf-text.d.ts +56 -0
- package/dist/pdf-text.d.ts.map +1 -0
- package/dist/pdf-text.js +64 -0
- package/dist/pdf-text.js.map +1 -0
- package/dist/pending-action.d.ts +154 -0
- package/dist/pending-action.d.ts.map +1 -0
- package/dist/pending-action.js +148 -0
- package/dist/pending-action.js.map +1 -0
- package/dist/preemptor.d.ts +40 -0
- package/dist/preemptor.d.ts.map +1 -0
- package/dist/preemptor.js +49 -0
- package/dist/preemptor.js.map +1 -0
- package/dist/programme-mode.d.ts +29 -0
- package/dist/programme-mode.d.ts.map +1 -0
- package/dist/programme-mode.js +50 -0
- package/dist/programme-mode.js.map +1 -0
- package/dist/progress-view.d.ts +14 -0
- package/dist/progress-view.d.ts.map +1 -0
- package/dist/progress-view.js +114 -0
- package/dist/progress-view.js.map +1 -0
- package/dist/project-graph-builder.d.ts +81 -0
- package/dist/project-graph-builder.d.ts.map +1 -0
- package/dist/project-graph-builder.js +246 -0
- package/dist/project-graph-builder.js.map +1 -0
- package/dist/project-graph-runtime.d.ts +86 -0
- package/dist/project-graph-runtime.d.ts.map +1 -0
- package/dist/project-graph-runtime.js +112 -0
- package/dist/project-graph-runtime.js.map +1 -0
- package/dist/project-index-builder.d.ts +96 -0
- package/dist/project-index-builder.d.ts.map +1 -0
- package/dist/project-index-builder.js +298 -0
- package/dist/project-index-builder.js.map +1 -0
- package/dist/project-index-facts.d.ts +51 -0
- package/dist/project-index-facts.d.ts.map +1 -0
- package/dist/project-index-facts.js +117 -0
- package/dist/project-index-facts.js.map +1 -0
- package/dist/project-index-store.d.ts +97 -0
- package/dist/project-index-store.d.ts.map +1 -0
- package/dist/project-index-store.js +140 -0
- package/dist/project-index-store.js.map +1 -0
- package/dist/project-memory-store.d.ts +127 -0
- package/dist/project-memory-store.d.ts.map +1 -0
- package/dist/project-memory-store.js +302 -0
- package/dist/project-memory-store.js.map +1 -0
- package/dist/proposal-store.d.ts +14 -0
- package/dist/proposal-store.d.ts.map +1 -0
- package/dist/proposal-store.js +19 -0
- package/dist/proposal-store.js.map +1 -0
- package/dist/prover.d.ts +80 -0
- package/dist/prover.d.ts.map +1 -0
- package/dist/prover.js +137 -0
- package/dist/prover.js.map +1 -0
- package/dist/provider-identity-store.d.ts +34 -0
- package/dist/provider-identity-store.d.ts.map +1 -0
- package/dist/provider-identity-store.js +72 -0
- package/dist/provider-identity-store.js.map +1 -0
- package/dist/provider-identity.d.ts +104 -0
- package/dist/provider-identity.d.ts.map +1 -0
- package/dist/provider-identity.js +167 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/provider-limit.d.ts +79 -0
- package/dist/provider-limit.d.ts.map +1 -0
- package/dist/provider-limit.js +148 -0
- package/dist/provider-limit.js.map +1 -0
- package/dist/provider-preflight.d.ts +171 -0
- package/dist/provider-preflight.d.ts.map +1 -0
- package/dist/provider-preflight.js +395 -0
- package/dist/provider-preflight.js.map +1 -0
- package/dist/provider-state.d.ts +120 -0
- package/dist/provider-state.d.ts.map +1 -0
- package/dist/provider-state.js +182 -0
- package/dist/provider-state.js.map +1 -0
- package/dist/providers.d.ts +132 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +161 -0
- package/dist/providers.js.map +1 -0
- package/dist/publication-recorder.d.ts +117 -0
- package/dist/publication-recorder.d.ts.map +1 -0
- package/dist/publication-recorder.js +124 -0
- package/dist/publication-recorder.js.map +1 -0
- package/dist/pursuit-delivery.d.ts +24 -0
- package/dist/pursuit-delivery.d.ts.map +1 -0
- package/dist/pursuit-delivery.js +38 -0
- package/dist/pursuit-delivery.js.map +1 -0
- package/dist/queue-store.d.ts +132 -0
- package/dist/queue-store.d.ts.map +1 -0
- package/dist/queue-store.js +185 -0
- package/dist/queue-store.js.map +1 -0
- package/dist/queue-summary.d.ts +14 -0
- package/dist/queue-summary.d.ts.map +1 -0
- package/dist/queue-summary.js +82 -0
- package/dist/queue-summary.js.map +1 -0
- package/dist/queue-view.d.ts +20 -0
- package/dist/queue-view.d.ts.map +1 -0
- package/dist/queue-view.js +163 -0
- package/dist/queue-view.js.map +1 -0
- package/dist/queue-write-lease.d.ts +106 -0
- package/dist/queue-write-lease.d.ts.map +1 -0
- package/dist/queue-write-lease.js +282 -0
- package/dist/queue-write-lease.js.map +1 -0
- package/dist/rails-home.d.ts +162 -0
- package/dist/rails-home.d.ts.map +1 -0
- package/dist/rails-home.js +452 -0
- package/dist/rails-home.js.map +1 -0
- package/dist/rails-migrations.d.ts +75 -0
- package/dist/rails-migrations.d.ts.map +1 -0
- package/dist/rails-migrations.js +199 -0
- package/dist/rails-migrations.js.map +1 -0
- package/dist/rails-stores.d.ts +49 -0
- package/dist/rails-stores.d.ts.map +1 -0
- package/dist/rails-stores.js +100 -0
- package/dist/rails-stores.js.map +1 -0
- package/dist/reaper.d.ts +69 -0
- package/dist/reaper.d.ts.map +1 -0
- package/dist/reaper.js +152 -0
- package/dist/reaper.js.map +1 -0
- package/dist/record-store.d.ts +36 -0
- package/dist/record-store.d.ts.map +1 -0
- package/dist/record-store.js +78 -0
- package/dist/record-store.js.map +1 -0
- package/dist/recovery-io.d.ts +50 -0
- package/dist/recovery-io.d.ts.map +1 -0
- package/dist/recovery-io.js +122 -0
- package/dist/recovery-io.js.map +1 -0
- package/dist/recovery.d.ts +146 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +110 -0
- package/dist/recovery.js.map +1 -0
- package/dist/redraw.d.ts +34 -0
- package/dist/redraw.d.ts.map +1 -0
- package/dist/redraw.js +62 -0
- package/dist/redraw.js.map +1 -0
- package/dist/rejected-evidence.d.ts +255 -0
- package/dist/rejected-evidence.d.ts.map +1 -0
- package/dist/rejected-evidence.js +324 -0
- package/dist/rejected-evidence.js.map +1 -0
- package/dist/report-cmd.d.ts +32 -0
- package/dist/report-cmd.d.ts.map +1 -0
- package/dist/report-cmd.js +201 -0
- package/dist/report-cmd.js.map +1 -0
- package/dist/repos-cmd.d.ts +80 -0
- package/dist/repos-cmd.d.ts.map +1 -0
- package/dist/repos-cmd.js +240 -0
- package/dist/repos-cmd.js.map +1 -0
- package/dist/request-body-shape.d.ts +93 -0
- package/dist/request-body-shape.d.ts.map +1 -0
- package/dist/request-body-shape.js +407 -0
- package/dist/request-body-shape.js.map +1 -0
- package/dist/requirement-claims.d.ts +89 -0
- package/dist/requirement-claims.d.ts.map +1 -0
- package/dist/requirement-claims.js +92 -0
- package/dist/requirement-claims.js.map +1 -0
- package/dist/retention-apply-runtime.d.ts +105 -0
- package/dist/retention-apply-runtime.d.ts.map +1 -0
- package/dist/retention-apply-runtime.js +269 -0
- package/dist/retention-apply-runtime.js.map +1 -0
- package/dist/reverify.d.ts +41 -0
- package/dist/reverify.d.ts.map +1 -0
- package/dist/reverify.js +69 -0
- package/dist/reverify.js.map +1 -0
- package/dist/round-records.d.ts +65 -0
- package/dist/round-records.d.ts.map +1 -0
- package/dist/round-records.js +61 -0
- package/dist/round-records.js.map +1 -0
- package/dist/round-runner.d.ts +924 -0
- package/dist/round-runner.d.ts.map +1 -0
- package/dist/round-runner.js +1693 -0
- package/dist/round-runner.js.map +1 -0
- package/dist/run-approval.d.ts +180 -0
- package/dist/run-approval.d.ts.map +1 -0
- package/dist/run-approval.js +199 -0
- package/dist/run-approval.js.map +1 -0
- package/dist/run-cmd.d.ts +359 -0
- package/dist/run-cmd.d.ts.map +1 -0
- package/dist/run-cmd.js +4418 -0
- package/dist/run-cmd.js.map +1 -0
- package/dist/run-delivery.d.ts +71 -0
- package/dist/run-delivery.d.ts.map +1 -0
- package/dist/run-delivery.js +104 -0
- package/dist/run-delivery.js.map +1 -0
- package/dist/run-ended.d.ts +75 -0
- package/dist/run-ended.d.ts.map +1 -0
- package/dist/run-ended.js +27 -0
- package/dist/run-ended.js.map +1 -0
- package/dist/run-ending-locator.d.ts +125 -0
- package/dist/run-ending-locator.d.ts.map +1 -0
- package/dist/run-ending-locator.js +133 -0
- package/dist/run-ending-locator.js.map +1 -0
- package/dist/run-launcher.d.ts +459 -0
- package/dist/run-launcher.d.ts.map +1 -0
- package/dist/run-launcher.js +652 -0
- package/dist/run-launcher.js.map +1 -0
- package/dist/run-lease.d.ts +208 -0
- package/dist/run-lease.d.ts.map +1 -0
- package/dist/run-lease.js +301 -0
- package/dist/run-lease.js.map +1 -0
- package/dist/run-refusal-marks.d.ts +189 -0
- package/dist/run-refusal-marks.d.ts.map +1 -0
- package/dist/run-refusal-marks.js +249 -0
- package/dist/run-refusal-marks.js.map +1 -0
- package/dist/run-start-marks.d.ts +153 -0
- package/dist/run-start-marks.d.ts.map +1 -0
- package/dist/run-start-marks.js +269 -0
- package/dist/run-start-marks.js.map +1 -0
- package/dist/scan-cmd.d.ts +14 -0
- package/dist/scan-cmd.d.ts.map +1 -0
- package/dist/scan-cmd.js +270 -0
- package/dist/scan-cmd.js.map +1 -0
- package/dist/scan-events.d.ts +50 -0
- package/dist/scan-events.d.ts.map +1 -0
- package/dist/scan-events.js +91 -0
- package/dist/scan-events.js.map +1 -0
- package/dist/scan.d.ts +191 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +417 -0
- package/dist/scan.js.map +1 -0
- package/dist/scope-rule.d.ts +148 -0
- package/dist/scope-rule.d.ts.map +1 -0
- package/dist/scope-rule.js +121 -0
- package/dist/scope-rule.js.map +1 -0
- package/dist/self-repo-id.d.ts +18 -0
- package/dist/self-repo-id.d.ts.map +1 -0
- package/dist/self-repo-id.js +70 -0
- package/dist/self-repo-id.js.map +1 -0
- package/dist/server-client.d.ts +766 -0
- package/dist/server-client.d.ts.map +1 -0
- package/dist/server-client.js +475 -0
- package/dist/server-client.js.map +1 -0
- package/dist/session-adapter-runtime.d.ts +195 -0
- package/dist/session-adapter-runtime.d.ts.map +1 -0
- package/dist/session-adapter-runtime.js +373 -0
- package/dist/session-adapter-runtime.js.map +1 -0
- package/dist/session-checkpoint-runtime.d.ts +62 -0
- package/dist/session-checkpoint-runtime.d.ts.map +1 -0
- package/dist/session-checkpoint-runtime.js +268 -0
- package/dist/session-checkpoint-runtime.js.map +1 -0
- package/dist/session-control-transport.d.ts +106 -0
- package/dist/session-control-transport.d.ts.map +1 -0
- package/dist/session-control-transport.js +232 -0
- package/dist/session-control-transport.js.map +1 -0
- package/dist/session-observation-store.d.ts +98 -0
- package/dist/session-observation-store.d.ts.map +1 -0
- package/dist/session-observation-store.js +155 -0
- package/dist/session-observation-store.js.map +1 -0
- package/dist/session-observe-runtime.d.ts +123 -0
- package/dist/session-observe-runtime.d.ts.map +1 -0
- package/dist/session-observe-runtime.js +317 -0
- package/dist/session-observe-runtime.js.map +1 -0
- package/dist/session-store.d.ts +98 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +116 -0
- package/dist/session-store.js.map +1 -0
- package/dist/sessions-cmd.d.ts +202 -0
- package/dist/sessions-cmd.d.ts.map +1 -0
- package/dist/sessions-cmd.js +609 -0
- package/dist/sessions-cmd.js.map +1 -0
- package/dist/settings-overlay.d.ts +53 -0
- package/dist/settings-overlay.d.ts.map +1 -0
- package/dist/settings-overlay.js +175 -0
- package/dist/settings-overlay.js.map +1 -0
- package/dist/setup-prompt.d.ts +34 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/setup-prompt.js +92 -0
- package/dist/setup-prompt.js.map +1 -0
- package/dist/setup.d.ts +103 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +283 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared-grants.d.ts +164 -0
- package/dist/shared-grants.d.ts.map +1 -0
- package/dist/shared-grants.js +242 -0
- package/dist/shared-grants.js.map +1 -0
- package/dist/signals.d.ts +55 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +85 -0
- package/dist/signals.js.map +1 -0
- package/dist/source-cmd.d.ts +201 -0
- package/dist/source-cmd.d.ts.map +1 -0
- package/dist/source-cmd.js +684 -0
- package/dist/source-cmd.js.map +1 -0
- package/dist/source-verdict.d.ts +99 -0
- package/dist/source-verdict.d.ts.map +1 -0
- package/dist/source-verdict.js +182 -0
- package/dist/source-verdict.js.map +1 -0
- package/dist/spend-ledger.d.ts +350 -0
- package/dist/spend-ledger.d.ts.map +1 -0
- package/dist/spend-ledger.js +546 -0
- package/dist/spend-ledger.js.map +1 -0
- package/dist/stale-run-sweep.d.ts +79 -0
- package/dist/stale-run-sweep.d.ts.map +1 -0
- package/dist/stale-run-sweep.js +116 -0
- package/dist/stale-run-sweep.js.map +1 -0
- package/dist/start-attempts.d.ts +385 -0
- package/dist/start-attempts.d.ts.map +1 -0
- package/dist/start-attempts.js +613 -0
- package/dist/start-attempts.js.map +1 -0
- package/dist/status-cmd.d.ts +28 -0
- package/dist/status-cmd.d.ts.map +1 -0
- package/dist/status-cmd.js +116 -0
- package/dist/status-cmd.js.map +1 -0
- package/dist/stop-follow-up.d.ts +107 -0
- package/dist/stop-follow-up.d.ts.map +1 -0
- package/dist/stop-follow-up.js +172 -0
- package/dist/stop-follow-up.js.map +1 -0
- package/dist/surface-lease.d.ts +118 -0
- package/dist/surface-lease.d.ts.map +1 -0
- package/dist/surface-lease.js +485 -0
- package/dist/surface-lease.js.map +1 -0
- package/dist/sync.d.ts +54 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +93 -0
- package/dist/sync.js.map +1 -0
- package/dist/syncing-ledger.d.ts +45 -0
- package/dist/syncing-ledger.d.ts.map +1 -0
- package/dist/syncing-ledger.js +53 -0
- package/dist/syncing-ledger.js.map +1 -0
- package/dist/temp-fixtures.d.ts +68 -0
- package/dist/temp-fixtures.d.ts.map +1 -0
- package/dist/temp-fixtures.js +38 -0
- package/dist/temp-fixtures.js.map +1 -0
- package/dist/token-window.d.ts +84 -0
- package/dist/token-window.d.ts.map +1 -0
- package/dist/token-window.js +143 -0
- package/dist/token-window.js.map +1 -0
- package/dist/tool-bridge.d.ts +177 -0
- package/dist/tool-bridge.d.ts.map +1 -0
- package/dist/tool-bridge.js +329 -0
- package/dist/tool-bridge.js.map +1 -0
- package/dist/tool-call-record.d.ts +197 -0
- package/dist/tool-call-record.d.ts.map +1 -0
- package/dist/tool-call-record.js +276 -0
- package/dist/tool-call-record.js.map +1 -0
- package/dist/tool-protocol.d.ts +135 -0
- package/dist/tool-protocol.d.ts.map +1 -0
- package/dist/tool-protocol.js +104 -0
- package/dist/tool-protocol.js.map +1 -0
- package/dist/tool-worker.d.ts +3 -0
- package/dist/tool-worker.d.ts.map +1 -0
- package/dist/tool-worker.js +478 -0
- package/dist/tool-worker.js.map +1 -0
- package/dist/toolchain-mirror.d.ts +86 -0
- package/dist/toolchain-mirror.d.ts.map +1 -0
- package/dist/toolchain-mirror.js +307 -0
- package/dist/toolchain-mirror.js.map +1 -0
- package/dist/trusted-git.d.ts +243 -0
- package/dist/trusted-git.d.ts.map +1 -0
- package/dist/trusted-git.js +920 -0
- package/dist/trusted-git.js.map +1 -0
- package/dist/ui.d.ts +76 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +118 -0
- package/dist/ui.js.map +1 -0
- package/dist/untrusted-exec.d.ts +275 -0
- package/dist/untrusted-exec.d.ts.map +1 -0
- package/dist/untrusted-exec.js +479 -0
- package/dist/untrusted-exec.js.map +1 -0
- package/dist/untrusted-gate.d.ts +73 -0
- package/dist/untrusted-gate.d.ts.map +1 -0
- package/dist/untrusted-gate.js +226 -0
- package/dist/untrusted-gate.js.map +1 -0
- package/dist/uploader.d.ts +153 -0
- package/dist/uploader.d.ts.map +1 -0
- package/dist/uploader.js +204 -0
- package/dist/uploader.js.map +1 -0
- package/dist/verifier.d.ts +66 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +170 -0
- package/dist/verifier.js.map +1 -0
- package/dist/verify-apply.d.ts +26 -0
- package/dist/verify-apply.d.ts.map +1 -0
- package/dist/verify-apply.js +36 -0
- package/dist/verify-apply.js.map +1 -0
- package/dist/verify-cmd.d.ts +44 -0
- package/dist/verify-cmd.d.ts.map +1 -0
- package/dist/verify-cmd.js +125 -0
- package/dist/verify-cmd.js.map +1 -0
- package/dist/verify-pass.d.ts +73 -0
- package/dist/verify-pass.d.ts.map +1 -0
- package/dist/verify-pass.js +103 -0
- package/dist/verify-pass.js.map +1 -0
- package/dist/welcome.d.ts +43 -0
- package/dist/welcome.d.ts.map +1 -0
- package/dist/welcome.js +116 -0
- package/dist/welcome.js.map +1 -0
- package/dist/workspace-provisioner.d.ts +65 -0
- package/dist/workspace-provisioner.d.ts.map +1 -0
- package/dist/workspace-provisioner.js +66 -0
- package/dist/workspace-provisioner.js.map +1 -0
- package/dist/workspace-quarantine.d.ts +64 -0
- package/dist/workspace-quarantine.d.ts.map +1 -0
- package/dist/workspace-quarantine.js +156 -0
- package/dist/workspace-quarantine.js.map +1 -0
- package/dist/workspace-residue-sweep.d.ts +113 -0
- package/dist/workspace-residue-sweep.d.ts.map +1 -0
- package/dist/workspace-residue-sweep.js +158 -0
- package/dist/workspace-residue-sweep.js.map +1 -0
- package/dist/workspace.d.ts +639 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +2026 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +54 -6
- package/win/CredProbe.cs +64 -0
- package/win/FakeClaude.cs +56 -0
- package/win/HandleProbe.cs +116 -0
- package/win/TokenProbe.cs +53 -0
- package/win/appcontainer.ps1 +500 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.containedRoot = containedRoot;
|
|
4
|
+
exports.buildUntrustedGateEnv = buildUntrustedGateEnv;
|
|
5
|
+
exports.containedPath = containedPath;
|
|
6
|
+
exports.buildAgentEnv = buildAgentEnv;
|
|
7
|
+
exports.buildProviderEnv = buildProviderEnv;
|
|
8
|
+
exports.buildNotifyEnv = buildNotifyEnv;
|
|
9
|
+
exports.protectedPaths = protectedPaths;
|
|
10
|
+
exports.untrustedGrants = untrustedGrants;
|
|
11
|
+
exports.sharedGrantPaths = sharedGrantPaths;
|
|
12
|
+
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
14
|
+
const node_os_1 = require("node:os");
|
|
15
|
+
const node_path_1 = require("node:path");
|
|
16
|
+
const untrusted_exec_1 = require("./untrusted-exec");
|
|
17
|
+
const trusted_git_1 = require("./trusted-git");
|
|
18
|
+
/**
|
|
19
|
+
* Where a contained child keeps the profile Windows insists it has.
|
|
20
|
+
*
|
|
21
|
+
* An AppContainer needs USERPROFILE/APPDATA/LOCALAPPDATA to start at all — the
|
|
22
|
+
* loader resolves the container's redirected storage through them. Pointing
|
|
23
|
+
* them at the daemon's profile would hand back everything the container exists
|
|
24
|
+
* to keep away: `~/.looply/machine.json`, `~/.claude`, `~/.gitconfig`. So the
|
|
25
|
+
* child gets its own, created beside the system temp directory and granted to
|
|
26
|
+
* it explicitly.
|
|
27
|
+
*
|
|
28
|
+
* Per project and per domain, so a gate cannot read what an agent left behind.
|
|
29
|
+
*/
|
|
30
|
+
function containedRoot(kind, projectKey) {
|
|
31
|
+
const digest = (0, node_crypto_1.createHash)('sha256').update(projectKey, 'utf8').digest('hex').slice(0, 16);
|
|
32
|
+
const root = (0, node_path_1.join)((0, node_os_1.tmpdir)(), 'looply-contained', `${kind}-${digest}`);
|
|
33
|
+
for (const sub of ['', 'appdata', 'local', 'temp']) {
|
|
34
|
+
(0, node_fs_1.mkdirSync)(sub === '' ? root : (0, node_path_1.join)(root, sub), { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
return root;
|
|
37
|
+
}
|
|
38
|
+
/** Platform values a child cannot start without, and nothing else. */
|
|
39
|
+
function platformOnly() {
|
|
40
|
+
const out = {};
|
|
41
|
+
for (const name of untrusted_exec_1.PLATFORM_BASE) {
|
|
42
|
+
// The profile roots are deliberately NOT copied from the daemon: they are
|
|
43
|
+
// replaced below with the contained child's own.
|
|
44
|
+
if (/^(USERPROFILE|APPDATA|LOCALAPPDATA|TEMP|TMP|HOME)$/i.test(name))
|
|
45
|
+
continue;
|
|
46
|
+
const v = process.env[name];
|
|
47
|
+
if (typeof v === 'string' && v.length > 0)
|
|
48
|
+
out[name] = v;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 🔴 SystemRoot IS RESOLVED, NOT MERELY COPIED — AND THIS WAS THE SIXTH SITE
|
|
52
|
+
* THAT DID NOT ASK.
|
|
53
|
+
*
|
|
54
|
+
* The loop above copies whatever the parent happens to hold, which leaves two
|
|
55
|
+
* holes that `systemRoot()` exists to close and that an environment built from
|
|
56
|
+
* an allowlist makes reachable rather than theoretical:
|
|
57
|
+
*
|
|
58
|
+
* absent — `systemRoot`'s own comment says a child of a contained child
|
|
59
|
+
* legitimately has no `SystemRoot` at all, because THIS function
|
|
60
|
+
* is what builds its block. The loop then omits the variable, and
|
|
61
|
+
* CreateProcess fails with ERROR_ENVVAR_NOT_FOUND (203), which
|
|
62
|
+
* names no variable — an unreadable failure one level down.
|
|
63
|
+
* relative — a non-empty `SystemRoot=C:Windows` is copied through verbatim.
|
|
64
|
+
* That is the dropped-backslash value this module has been bitten
|
|
65
|
+
* by twice, handed to a child whose working directory is the
|
|
66
|
+
* project worktree.
|
|
67
|
+
*
|
|
68
|
+
* `systemRoot()` returns the parent's value unchanged whenever it is a real
|
|
69
|
+
* absolute path, so this is identical in the ordinary case and a repair in the
|
|
70
|
+
* two that are not.
|
|
71
|
+
*/
|
|
72
|
+
out['SystemRoot'] = (0, untrusted_exec_1.systemRoot)();
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function profileOf(root) {
|
|
76
|
+
return {
|
|
77
|
+
USERPROFILE: root,
|
|
78
|
+
HOME: root,
|
|
79
|
+
APPDATA: (0, node_path_1.join)(root, 'appdata'),
|
|
80
|
+
LOCALAPPDATA: (0, node_path_1.join)(root, 'local'),
|
|
81
|
+
TEMP: (0, node_path_1.join)(root, 'temp'),
|
|
82
|
+
TMP: (0, node_path_1.join)(root, 'temp'),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The environment for project-controlled test, build and typecheck commands.
|
|
87
|
+
*
|
|
88
|
+
* Carries no credential of any kind. The two extras are both about making the
|
|
89
|
+
* boundary work rather than about trust:
|
|
90
|
+
*
|
|
91
|
+
* `NODE_OPTIONS` — an AppContainer cannot stat `C:\`, and Node's module
|
|
92
|
+
* resolution walks to the drive root, so without these flags nothing Node runs
|
|
93
|
+
* at all. Scoped here rather than set on the daemon.
|
|
94
|
+
*
|
|
95
|
+
* `GIT_CONFIG_NOSYSTEM` — defence in depth only. It removes the system git
|
|
96
|
+
* config, and with it the ambient credential helper, from anything the gate
|
|
97
|
+
* runs. It is NOT the boundary: a determined process can clear a variable. The
|
|
98
|
+
* container is the boundary.
|
|
99
|
+
*/
|
|
100
|
+
function buildUntrustedGateEnv(projectKey, toolchain) {
|
|
101
|
+
const root = containedRoot('gate', projectKey);
|
|
102
|
+
return {
|
|
103
|
+
...platformOnly(),
|
|
104
|
+
...profileOf(root),
|
|
105
|
+
PATH: containedPath(projectKey, toolchain),
|
|
106
|
+
NODE_OPTIONS: '--preserve-symlinks --preserve-symlinks-main',
|
|
107
|
+
GIT_CONFIG_NOSYSTEM: '1',
|
|
108
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The search path a contained child gets.
|
|
113
|
+
*
|
|
114
|
+
* Built, not inherited. The daemon's PATH names sixty-odd directories the
|
|
115
|
+
* container cannot read, and — worse — it names the real toolchain directory,
|
|
116
|
+
* which on this machine also holds `claude`, `eas` and `heroku` shims. A gate
|
|
117
|
+
* that could resolve those would be a gate that could deploy.
|
|
118
|
+
*
|
|
119
|
+
* So: Looply's own runtime copy first, then the project's own `.bin` (which is
|
|
120
|
+
* inside the granted worktree and is how `tsc`, `jest` and friends are found),
|
|
121
|
+
* then the two system directories a shell needs to function.
|
|
122
|
+
*/
|
|
123
|
+
function containedPath(projectKey, toolchain) {
|
|
124
|
+
const win = (0, untrusted_exec_1.systemRoot)();
|
|
125
|
+
const parts = [
|
|
126
|
+
...(toolchain === undefined ? [] : [toolchain]),
|
|
127
|
+
(0, node_path_1.join)(projectKey, 'node_modules', '.bin'),
|
|
128
|
+
(0, node_path_1.join)(win, 'System32'),
|
|
129
|
+
win,
|
|
130
|
+
];
|
|
131
|
+
return parts.join(';');
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The environment for the coding agent.
|
|
135
|
+
*
|
|
136
|
+
* Separate from the gate's because the agent legitimately needs its model
|
|
137
|
+
* provider — and separate so that giving the agent something never gives it to
|
|
138
|
+
* the gate. It still carries no Looply machine token and no broker credential:
|
|
139
|
+
* using the model is the agent's job, speaking for the machine is not.
|
|
140
|
+
*/
|
|
141
|
+
function buildAgentEnv(projectKey, provider = {}, toolchain) {
|
|
142
|
+
const root = containedRoot('agent', projectKey);
|
|
143
|
+
return {
|
|
144
|
+
...platformOnly(),
|
|
145
|
+
...profileOf(root),
|
|
146
|
+
PATH: containedPath(projectKey, toolchain),
|
|
147
|
+
NODE_OPTIONS: '--preserve-symlinks --preserve-symlinks-main',
|
|
148
|
+
...provider,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The environment for the PROVIDER TRANSPORT.
|
|
153
|
+
*
|
|
154
|
+
* This one is different in kind from the others, and the difference is the
|
|
155
|
+
* point of the whole decomposition. The transport is not contained — it cannot
|
|
156
|
+
* be, because the packaged provider spawns children with piped stdio and an
|
|
157
|
+
* AppContainer cannot create the named pipes that needs. So it runs as the
|
|
158
|
+
* daemon user, and the only thing standing between it and the machine's
|
|
159
|
+
* authority is what Looply chooses to hand it.
|
|
160
|
+
*
|
|
161
|
+
* Which is: the platform baseline, its own profile, and whatever the person
|
|
162
|
+
* named in `agent.env`. Built up rather than filtered down, so a Looply
|
|
163
|
+
* credential added to the daemon's environment next year does not silently
|
|
164
|
+
* appear here.
|
|
165
|
+
*
|
|
166
|
+
* It carries NO PATH into the project. The transport has no reason to resolve
|
|
167
|
+
* anything from the worktree; the tools it can call are served over MCP and run
|
|
168
|
+
* somewhere else entirely.
|
|
169
|
+
*/
|
|
170
|
+
function buildProviderEnv(sessionDir, provider = {}) {
|
|
171
|
+
const win = (0, untrusted_exec_1.systemRoot)();
|
|
172
|
+
return {
|
|
173
|
+
...platformOnly(),
|
|
174
|
+
...profileOf(sessionDir),
|
|
175
|
+
// System directories only. Not the project's `.bin`, and not the machine's
|
|
176
|
+
// toolchain directory, which on this machine also holds `claude`, `eas` and
|
|
177
|
+
// `heroku` shims.
|
|
178
|
+
PATH: [(0, node_path_1.join)(win, 'System32'), win].join(';'),
|
|
179
|
+
...provider,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The environment for the user's own notification script.
|
|
184
|
+
*
|
|
185
|
+
* NOT contained: this file is the person's, stored under their home directory,
|
|
186
|
+
* and running it is the product working as intended. But it inherited the whole
|
|
187
|
+
* daemon environment — every secret the daemon holds — for no reason at all. A
|
|
188
|
+
* notification does not need the machine token.
|
|
189
|
+
*/
|
|
190
|
+
function buildNotifyEnv() {
|
|
191
|
+
const out = {};
|
|
192
|
+
for (const name of [...untrusted_exec_1.PLATFORM_BASE, 'HOME']) {
|
|
193
|
+
const v = process.env[name];
|
|
194
|
+
if (typeof v === 'string' && v.length > 0)
|
|
195
|
+
out[name] = v;
|
|
196
|
+
}
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Paths inside a granted worktree that untrusted execution must never reach.
|
|
201
|
+
*
|
|
202
|
+
* Derived from the execution kind rather than chosen per call site, because a
|
|
203
|
+
* caller that forgets one is a caller that quietly hands over the authority
|
|
204
|
+
* state.
|
|
205
|
+
*
|
|
206
|
+
* `.looply/state` holds every durable fact Phase 6 rests on — the grant, the
|
|
207
|
+
* receipts, the launch and claim records, the ledger, the human control file.
|
|
208
|
+
* `.git` is where a repository-controlled config can turn a trusted git command
|
|
209
|
+
* into arbitrary execution. `config.yaml` is the one file the person edits by
|
|
210
|
+
* hand, and it names the gate commands and the rails: a round that could write
|
|
211
|
+
* it could weaken every round after it.
|
|
212
|
+
*
|
|
213
|
+
* `<projectDir>/.git` IS PROTECTED WHATEVER IT TURNS OUT TO BE. In a linked
|
|
214
|
+
* worktree it is a pointer file rather than a directory, and a write to it
|
|
215
|
+
* redirects every later git command at metadata of the writer's choosing — so
|
|
216
|
+
* it is protected for its own sake, not merely as a route to a directory.
|
|
217
|
+
*
|
|
218
|
+
* AND WHEREVER THE METADATA REALLY LIVES, appended below. In a linked worktree
|
|
219
|
+
* the real gitdir is `<common>/worktrees/<name>` and the config that decides
|
|
220
|
+
* what git executes is in the shared common dir; neither is under `projectDir`,
|
|
221
|
+
* so neither is covered by the three literals.
|
|
222
|
+
*
|
|
223
|
+
* ⚠️ THE THREE LITERALS STAY AT THE TOP OF THE BODY, and the prose stays up
|
|
224
|
+
* here. `project-memory-reachability.spec.ts` pins them by slicing the first 400
|
|
225
|
+
* characters after the signature — a deliberate guard on the ground under
|
|
226
|
+
* `source: 'human'` — and a comment inside the body pushes them out of it.
|
|
227
|
+
*/
|
|
228
|
+
function protectedPaths(projectDir) {
|
|
229
|
+
const paths = [
|
|
230
|
+
(0, node_path_1.join)(projectDir, '.git'),
|
|
231
|
+
(0, node_path_1.join)(projectDir, '.looply', 'state'),
|
|
232
|
+
(0, node_path_1.join)(projectDir, '.looply', 'config.yaml'),
|
|
233
|
+
];
|
|
234
|
+
/**
|
|
235
|
+
* Resolution failures are swallowed on purpose: this list is consulted while
|
|
236
|
+
* building a container, a directory that is not a repository has nothing more
|
|
237
|
+
* to protect, and `repoConfigTroubleAt` is the check that refuses on
|
|
238
|
+
* unreadable metadata. Making this throw would turn "not a repository" into a
|
|
239
|
+
* crash at every call site.
|
|
240
|
+
*/
|
|
241
|
+
const meta = (0, trusted_git_1.worktreeMetadata)(projectDir);
|
|
242
|
+
if (meta !== null) {
|
|
243
|
+
for (const p of [meta.gitDir, meta.commonDir]) {
|
|
244
|
+
if (!paths.includes(p))
|
|
245
|
+
paths.push(p);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return paths;
|
|
249
|
+
}
|
|
250
|
+
/** What untrusted execution is granted: the worktree, and its own profile. */
|
|
251
|
+
function untrustedGrants(kind, projectDir) {
|
|
252
|
+
return [
|
|
253
|
+
{ path: projectDir, write: true },
|
|
254
|
+
{ path: containedRoot(kind, projectDir), write: true },
|
|
255
|
+
// READ AND EXECUTE ONLY. The runtime is Looply's, and untrusted code that
|
|
256
|
+
// could replace `node.exe` would be untrusted code choosing what every
|
|
257
|
+
// later gate runs.
|
|
258
|
+
/**
|
|
259
|
+
* 🔴 THE TOOLCHAIN IS NO LONGER GRANTED HERE, AND THAT IS THE n122 REPAIR.
|
|
260
|
+
*
|
|
261
|
+
* It is SHARED — every workspace, every project and every concurrent looply
|
|
262
|
+
* process on this machine resolves `node.exe` through it — so granting it
|
|
263
|
+
* per launch added one permanent inheritable ACE per container identity and
|
|
264
|
+
* nothing ever removed one. Measured before the repair: 262 container ACEs
|
|
265
|
+
* on the mirror and 509 on the tool-worker directory, against a DACL capped
|
|
266
|
+
* near 64 KB.
|
|
267
|
+
*
|
|
268
|
+
* Shared paths now go through `ensureSharedAccess`, which takes the same
|
|
269
|
+
* lock the removal takes — the addition and the removal of one shared DACL
|
|
270
|
+
* cannot be serialised by locking only one of them — records what it
|
|
271
|
+
* granted so a later mirror move does not orphan the entry, and does no
|
|
272
|
+
* work at all for an identity that already holds it.
|
|
273
|
+
*
|
|
274
|
+
* Run-OWNED paths stay here: the workspace and the contained root have a
|
|
275
|
+
* single owner, so they need no lock and are removed with the workspace.
|
|
276
|
+
*/
|
|
277
|
+
];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The shared directories a contained execution needs, which are granted under
|
|
281
|
+
* the shared-grant lock rather than per launch. `toolchain` is absent for the
|
|
282
|
+
* built-in provider, which resolves its own.
|
|
283
|
+
*/
|
|
284
|
+
function sharedGrantPaths(toolchain, extra = []) {
|
|
285
|
+
return [...(toolchain === undefined ? [] : [toolchain]), ...extra].filter((p) => p.length > 0);
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=exec-domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-domains.js","sourceRoot":"","sources":["../src/exec-domains.ts"],"names":[],"mappings":";;AAyCA,sCAOC;AAgED,sDAaC;AAcD,sCASC;AAUD,sCAaC;AAqBD,4CAcC;AAUD,wCAOC;AA+BD,wCAoBC;AAGD,0CA2BC;AAOD,4CAEC;AAzTD,6CAAyC;AACzC,qCAAoC;AACpC,qCAAiC;AACjC,yCAAiC;AACjC,qDAA+F;AAC/F,+CAAiD;AAwBjD;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,IAAmB,EAAE,UAAkB;IACnE,MAAM,MAAM,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1F,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAA,gBAAM,GAAE,EAAE,kBAAkB,EAAE,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;IACrE,KAAK,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;QACnD,IAAA,mBAAS,EAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAA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,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE;QACjC,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;QACtD,0EAA0E;QAC1E,uEAAuE;QACvE,mBAAmB;QACnB;;;;;;;;;;;;;;;;;;WAkBG;KACJ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,SAAkB,EAAE,QAA2B,EAAE;IAChF,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type { Exemption } from '@looply/core';
|
|
2
|
+
import type { LedgerFs } from './ledger-store';
|
|
3
|
+
/**
|
|
4
|
+
* Which granted exemptions this machine has already spent — `exemptions.json`
|
|
5
|
+
* under the state dir.
|
|
6
|
+
*
|
|
7
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
* 🔴 THE SINK WITHOUT WHICH THE SOURCE MUST NOT BE WIRED.
|
|
9
|
+
*
|
|
10
|
+
* `RoundRunner` refuses to start with `exemptionsFor` wired and no
|
|
11
|
+
* `spendExemption`, and its constructor says why: "one grant reopening the same
|
|
12
|
+
* rail every round until it expires". A grant is for ONE item, ONE path, ONCE.
|
|
13
|
+
* The core model carries `usedInRound` for exactly that, and something has to
|
|
14
|
+
* remember it after the process exits.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ THE SERVER CANNOT BE THAT SOMETHING, AND THAT IS BY DESIGN RATHER THAN AN
|
|
17
|
+
* OVERSIGHT. `model Exemption` records a DECISION — granted or refused, by whom,
|
|
18
|
+
* until when — and has no spent column, because the product's own account says a
|
|
19
|
+
* grant "is spent on commit, not on check" and "the commit itself carries the
|
|
20
|
+
* opening in its trailer". The durable audit record is the commit. This file is
|
|
21
|
+
* only what stops the same grant being handed to a second round on this machine.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ AND THERE IS A WINDOW THIS CANNOT CLOSE. Spending happens AFTER the commit,
|
|
24
|
+
* deliberately: "a discarded round leaves the door open for the retry; burning
|
|
25
|
+
* it on a failure would strand the next attempt outside its own door." So a
|
|
26
|
+
* crash between the commit and this write leaves the grant looking unspent, and
|
|
27
|
+
* a later run could open that rail once more. Reserving on hand-out would close
|
|
28
|
+
* it and would contradict the design outright, so the window is documented
|
|
29
|
+
* rather than engineered away — and the commit trailer is what makes it visible
|
|
30
|
+
* if it ever happens.
|
|
31
|
+
*/
|
|
32
|
+
export interface SpentFile {
|
|
33
|
+
version: 1;
|
|
34
|
+
/** Grant identity → the round that spent it. */
|
|
35
|
+
spent: Record<string, number>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A grant's identity, for a model that has no id of its own.
|
|
39
|
+
*
|
|
40
|
+
* 🔴 EXPIRY IS PART OF IT. Two grants for the same item and path with different
|
|
41
|
+
* expiries are two separate acts of permission — somebody granting the same door
|
|
42
|
+
* again tomorrow is not re-using yesterday's grant, and keying without the
|
|
43
|
+
* expiry would silently treat the new one as already spent.
|
|
44
|
+
*
|
|
45
|
+
* A NUL separator, so a path containing the separator cannot forge another
|
|
46
|
+
* grant's key; paths cannot contain NUL on any filesystem this runs on.
|
|
47
|
+
*/
|
|
48
|
+
export declare function grantKey(e: Pick<Exemption, 'itemId' | 'path' | 'expiresAt'>): string;
|
|
49
|
+
export declare class ExemptionStore {
|
|
50
|
+
private readonly stateDir;
|
|
51
|
+
private readonly fs;
|
|
52
|
+
private readonly migrate?;
|
|
53
|
+
/** Distinguishes two writes from ONE process; the pid distinguishes processes. */
|
|
54
|
+
private static writes;
|
|
55
|
+
private spent;
|
|
56
|
+
private readable;
|
|
57
|
+
/**
|
|
58
|
+
* ⚠️ `migrate` RUNS BEFORE ANY READ, AND ITS REFUSAL IS AN UNREADABLE STORE.
|
|
59
|
+
*
|
|
60
|
+
* The ledger's home moved out of the repository (see `rails-home.ts`), and a
|
|
61
|
+
* move is the one moment when "I could not see the old records" and "there
|
|
62
|
+
* were no old records" look identical. This store's entire safety argument is
|
|
63
|
+
* that they must never look identical: an unreadable ledger answers `isSpent`
|
|
64
|
+
* true for everything, because treating a corrupt ledger as "nothing spent"
|
|
65
|
+
* re-opens every door the machine has already used.
|
|
66
|
+
*
|
|
67
|
+
* So a migration that cannot prove what was spent fails the store closed,
|
|
68
|
+
* exactly as an unparseable `exemptions.json` does. Omitted, there is no
|
|
69
|
+
* migration and nothing changes — which is what every existing test relies on.
|
|
70
|
+
*/
|
|
71
|
+
constructor(stateDir: string, fs: LedgerFs, migrate?: (() => Promise<{
|
|
72
|
+
ok: boolean;
|
|
73
|
+
because?: string;
|
|
74
|
+
}>) | undefined);
|
|
75
|
+
private get path();
|
|
76
|
+
/**
|
|
77
|
+
* Where spends are written now: APPEND-ONLY, one JSON object per line.
|
|
78
|
+
*
|
|
79
|
+
* 🔴 THE WHOLE-MAP REWRITE BECAME A RAILS BYPASS THE MOMENT THIS LEDGER WAS
|
|
80
|
+
* SHARED. `record` used to serialise the entire `spent` map from the snapshot
|
|
81
|
+
* loaded at `open()` and rename it over the file. That was sound while one run
|
|
82
|
+
* owned one checkout. Phase 1 moved this file to the PROJECT state directory —
|
|
83
|
+
* so that a single-use grant could not be spent once per workspace — and made
|
|
84
|
+
* two runs concurrent in the same change. Two runs spending two DIFFERENT
|
|
85
|
+
* grants then each wrote a map that did not contain the other's spend, and the
|
|
86
|
+
* loser's spend was erased: a single-use grant over a railed path, spendable
|
|
87
|
+
* again. The scope fix had turned into a lost-update bug, which is precisely
|
|
88
|
+
* what the recon warned would happen if the format were left alone.
|
|
89
|
+
*
|
|
90
|
+
* An append never loses a concurrent write. `exemptions.json` is still READ,
|
|
91
|
+
* so a machine that has spent grants before this change keeps them, and it is
|
|
92
|
+
* never written again — that is the whole migration.
|
|
93
|
+
*/
|
|
94
|
+
private get spendLogPath();
|
|
95
|
+
/**
|
|
96
|
+
* Read what is on disk.
|
|
97
|
+
*
|
|
98
|
+
* 🔴 AN UNREADABLE FILE FAILS CLOSED, WHICH IS THE OPPOSITE OF `CursorStore`.
|
|
99
|
+
*
|
|
100
|
+
* There it is safe to replay too much, so a corrupt cursor is treated as no
|
|
101
|
+
* cursor. Here the equivalent — treating a corrupt file as "nothing spent" —
|
|
102
|
+
* would re-open every door this machine has already used. So an unreadable
|
|
103
|
+
* store stops handing out grants entirely: `isSpent` answers true for
|
|
104
|
+
* everything, and every rail stays shut. Deny is the default the whole rails
|
|
105
|
+
* design rests on.
|
|
106
|
+
*/
|
|
107
|
+
open(): Promise<'ok' | 'unreadable'>;
|
|
108
|
+
/**
|
|
109
|
+
* Fold the append-only spend log over whatever the legacy file held.
|
|
110
|
+
*
|
|
111
|
+
* ⚠️ FAILS CLOSED LIKE ITS SIBLING. A log that exists and cannot be read is a
|
|
112
|
+
* log whose spends cannot be seen, and a store that cannot see a spend would
|
|
113
|
+
* re-open a door somebody already used. A MALFORMED LINE is different and is
|
|
114
|
+
* skipped: an append can be torn by a crash mid-write, and discarding every
|
|
115
|
+
* spend on the strength of one truncated last line would be the same
|
|
116
|
+
* fail-open by another route.
|
|
117
|
+
*/
|
|
118
|
+
private readSpendLog;
|
|
119
|
+
/** True when this grant must not be handed to another round. Fails closed. */
|
|
120
|
+
isSpent(e: Pick<Exemption, 'itemId' | 'path' | 'expiresAt'>): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Record a grant as spent.
|
|
123
|
+
*
|
|
124
|
+
* ⚠️ IDEMPOTENT, AND THE FIRST ROUND WINS. A retry that spends the same grant
|
|
125
|
+
* again must not rewrite the round number: the round recorded is the one that
|
|
126
|
+
* actually used the door, and overwriting it would make the trailer and this
|
|
127
|
+
* file disagree about which commit opened it.
|
|
128
|
+
*
|
|
129
|
+
* A store that could not be read refuses to write. Writing a fresh file over
|
|
130
|
+
* one that failed to parse would discard every spend it contained.
|
|
131
|
+
*/
|
|
132
|
+
record(e: Exemption): Promise<void>;
|
|
133
|
+
/** What this machine has spent, for a report or a test. */
|
|
134
|
+
all(): Record<string, number>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The grants a round may be offered for one item.
|
|
138
|
+
*
|
|
139
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
140
|
+
* 🔴 THE `!isSpent` HERE IS NOT A DUPLICATE OF THE ONE IN `grantsFromServer`.
|
|
141
|
+
*
|
|
142
|
+
* That one runs ONCE, when the run starts. This one runs every time the gate
|
|
143
|
+
* asks, which is once per item per ROUND — and between two rounds of the same
|
|
144
|
+
* run a grant can be spent.
|
|
145
|
+
*
|
|
146
|
+
* Without it the wiring reproduced exactly the failure `RoundRunner` refuses to
|
|
147
|
+
* allow: its constructor rejects a grant source with no spend sink because that
|
|
148
|
+
* is "one grant reopening the same rail every round until it expires". Wiring
|
|
149
|
+
* both halves satisfied that check STRUCTURALLY while defeating it in fact —
|
|
150
|
+
* the sink recorded the spend and the source, a plain array captured before the
|
|
151
|
+
* first round, kept offering the same grant to every round after it. One grant,
|
|
152
|
+
* one round, was true only across runs and false within one.
|
|
153
|
+
*
|
|
154
|
+
* ⚠️ IT READS THE STORE'S IN-MEMORY STATE, WHICH IS WHAT MAKES IT WORK. `record`
|
|
155
|
+
* assigns `spent[key]` before it awaits the write, so the very next round sees
|
|
156
|
+
* the spend whether or not the file has landed. A store that cannot be read
|
|
157
|
+
* answers true for everything and every rail stays shut.
|
|
158
|
+
*
|
|
159
|
+
* ⚠️ WHAT IT DOES NOT DO: notice a grant made DURING a run. The source is
|
|
160
|
+
* fetched once at start, so a person who grants a rail while a run is going
|
|
161
|
+
* opens it for the NEXT run, not this one. That is a closed door rather than an
|
|
162
|
+
* open one, so it is recorded here instead of being engineered away with a
|
|
163
|
+
* mid-run refetch nothing asked for.
|
|
164
|
+
*/
|
|
165
|
+
export declare function offerableFor(grants: readonly Exemption[], itemId: string, isSpent: (e: Pick<Exemption, 'itemId' | 'path' | 'expiresAt'>) => boolean): Exemption[];
|
|
166
|
+
/** A granted exemption as the server sends it — the subset this mapping needs. */
|
|
167
|
+
export interface GrantRow {
|
|
168
|
+
itemId: string;
|
|
169
|
+
path: string;
|
|
170
|
+
decision: string;
|
|
171
|
+
actor: string;
|
|
172
|
+
expiresAt: string | null;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Server rows → the grants a round may be offered.
|
|
176
|
+
*
|
|
177
|
+
* 🔴 THREE FILTERS, AND EACH ONE IS LOAD-BEARING.
|
|
178
|
+
*
|
|
179
|
+
* - `decision === 'granted'` — a REFUSAL is recorded in the same table, and
|
|
180
|
+
* handing one to a gate would open the door a person explicitly shut.
|
|
181
|
+
* - a real `expiresAt` — the model treats a grant with no expiry as no grant;
|
|
182
|
+
* `listGranted` already excludes both, and asking again means a source that
|
|
183
|
+
* widened cannot widen the rails silently.
|
|
184
|
+
* - not already spent on this machine — one grant, one round.
|
|
185
|
+
*
|
|
186
|
+
* ⚠️ IT DOES NOT JUDGE THE PATH, AND MUST NOT. Whether a grant opens the file
|
|
187
|
+
* actually being written is decided at the interlock by `isExemptionValid`,
|
|
188
|
+
* which is the only place that sees it. Pre-filtering here would be a second
|
|
189
|
+
* opinion about the same question, free to disagree.
|
|
190
|
+
*/
|
|
191
|
+
export declare function grantsFromServer(rows: readonly GrantRow[], isSpent: (e: Pick<Exemption, 'itemId' | 'path' | 'expiresAt'>) => boolean, fromGrant: (p: {
|
|
192
|
+
itemId: string;
|
|
193
|
+
path: string;
|
|
194
|
+
expiresAt: string;
|
|
195
|
+
actor: string;
|
|
196
|
+
}) => Exemption): Exemption[];
|
|
197
|
+
//# sourceMappingURL=exemption-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exemption-store.d.ts","sour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