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,79 @@
|
|
|
1
|
+
import type { AgentInvoke } from './agent-exec';
|
|
2
|
+
import type { CommandResult } from './gate';
|
|
3
|
+
/**
|
|
4
|
+
* F35 — A PROVIDER'S USAGE LIMIT IS WEATHER, NOT A VERDICT.
|
|
5
|
+
*
|
|
6
|
+
* 🔴 MEASURED LIVE (LIVE-2, 2026-09-25T23:27–23:30Z). The provider profile had hit its
|
|
7
|
+
* session limit. Every call came back in a few seconds as
|
|
8
|
+
*
|
|
9
|
+
* {"type":"result","is_error":true,"api_error_status":429,
|
|
10
|
+
* "result":"You've hit your session limit · resets 2:30am (Asia/Amman)", …}
|
|
11
|
+
*
|
|
12
|
+
* and nothing in the product could tell that from a real failure. Three Starts of one goal
|
|
13
|
+
* compiled nothing ("the compiler failed"), each ended as "nothing to do", and the controller
|
|
14
|
+
* bought the next Start at once: three of eight gone in ninety seconds, for a condition that
|
|
15
|
+
* cleared by itself at 2:30. The brain's question about another goal met the same refusal, and
|
|
16
|
+
* "the brain failed" was recorded as that goal version's standing answer, never asked again.
|
|
17
|
+
*
|
|
18
|
+
* So the refusal is read where it is written — the CLI's own envelope, never the model's prose
|
|
19
|
+
* — and the two callers stop treating it as an outcome: a run waits it out inside the Start it
|
|
20
|
+
* already holds (`waitingOutProviderLimits`), and the brain records nothing (`ask-brain.ts`).
|
|
21
|
+
*
|
|
22
|
+
* ⚠️ THE BUILT-IN PROVIDER ONLY. A configured provider's stdout is the model's own stream, so
|
|
23
|
+
* an "envelope" in it could be typed by the model; callers apply this only where the CLI writes
|
|
24
|
+
* the envelope, exactly as `unwrapping` is applied.
|
|
25
|
+
*/
|
|
26
|
+
export interface ProviderLimit {
|
|
27
|
+
/** The provider's own sentence, e.g. "You've hit your session limit · resets 2:30am (Asia/Amman)". */
|
|
28
|
+
readonly because: string;
|
|
29
|
+
/** When the sentence says the limit resets, as epoch ms; null when it says so in no form read here. */
|
|
30
|
+
readonly resetsAt: number | null;
|
|
31
|
+
}
|
|
32
|
+
/** The longest one call waits out a limit, counted from its first refusal. A session window is five hours. */
|
|
33
|
+
export declare const MAX_PROVIDER_LIMIT_WAIT_MS: number;
|
|
34
|
+
/** How long to wait when the refusal names no reset time, and the least wait once a retry is refused again. */
|
|
35
|
+
export declare const UNKNOWN_RESET_WAIT_MS: number;
|
|
36
|
+
/** The provider prints the reset to the minute, rounded down; this covers the seconds and a little clock skew. */
|
|
37
|
+
export declare const RESET_GRACE_MS: number;
|
|
38
|
+
/** How often a waiting run looks at whether it was told to stop. */
|
|
39
|
+
export declare const LIMIT_WAIT_SLICE_MS: number;
|
|
40
|
+
/** The provider's usage-limit refusal in this result, or null when it is not one. */
|
|
41
|
+
export declare function providerLimitOf(raw: CommandResult, now: number): ProviderLimit | null;
|
|
42
|
+
/** When a caller may ask again: the stated reset and a grace, or a fixed wait when none is stated. */
|
|
43
|
+
export declare function quietUntilOf(limit: ProviderLimit, now: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* The reset instant in the provider's sentence, or null.
|
|
46
|
+
*
|
|
47
|
+
* The CLI writes a reset within a day as `2:30am (Asia/Amman)` or `5pm (Asia/Amman)`, and a
|
|
48
|
+
* later one as `Oct 2, 5pm (…)`, with the year added only when it is not this one — each in
|
|
49
|
+
* the wall clock of the zone it names. A zone this runtime does not know, or any other shape,
|
|
50
|
+
* is null: the caller then waits a fixed time rather than guessing. (`\s` covers the no-break spaces
|
|
51
|
+
* newer ICU writes before the meridiem.)
|
|
52
|
+
*/
|
|
53
|
+
export declare function resetOf(sentence: string, now: number): number | null;
|
|
54
|
+
export interface LimitWaitDeps {
|
|
55
|
+
readonly now: () => number;
|
|
56
|
+
readonly sleep: (ms: number) => Promise<void>;
|
|
57
|
+
/** Whether the run was told to stop or pause; a waiting call then stops waiting and returns the refusal. */
|
|
58
|
+
readonly interrupted: () => boolean | Promise<boolean>;
|
|
59
|
+
readonly log: (line: string) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Where a person reads it. A run the daemon starts has its output discarded, so a wait only
|
|
62
|
+
* in the log would be a Start that looks stuck for hours; the run records it as an alert.
|
|
63
|
+
*/
|
|
64
|
+
readonly announce?: (text: string) => Promise<void>;
|
|
65
|
+
readonly maxWaitMs?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An invoke that waits out the provider's usage limit instead of reporting it as the answer.
|
|
69
|
+
*
|
|
70
|
+
* The Start that is waiting keeps its place: the controller sees a run that is still going and
|
|
71
|
+
* buys nothing, and nothing is spent while it waits. The same prompt is asked again once the
|
|
72
|
+
* provider said the limit resets. Bounded three ways — the call gives up (and the refusal stands,
|
|
73
|
+
* as before F35) when the reset is later than `maxWaitMs` from its first refusal, when it has
|
|
74
|
+
* waited that long, or when the run is told to stop — and a retry refused again waits at least
|
|
75
|
+
* `UNKNOWN_RESET_WAIT_MS`, so a reset that did not happen when it said is not asked every minute.
|
|
76
|
+
* Anything that is not a usage limit passes through untouched.
|
|
77
|
+
*/
|
|
78
|
+
export declare function waitingOutProviderLimits(invoke: AgentInvoke, deps: LimitWaitDeps): AgentInvoke;
|
|
79
|
+
//# sourceMappingURL=provider-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-limit.d.ts","sourceRoot":"","sources":["../src/provider-limit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC5B,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uGAAuG;IACvG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,8GAA8G;AAC9G,eAAO,MAAM,0BAA0B,QAAqB,CAAC;AAC7D,+GAA+G;AAC/G,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AACpD,kHAAkH;AAClH,eAAO,MAAM,cAAc,QAAgB,CAAC;AAC5C,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAE7C,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAKrF;AAED,sGAAsG;AACtG,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtE;AAID;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA6BpE;AAuCD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,4GAA4G;IAC5G,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAG,WAAW,CA8B9F"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LIMIT_WAIT_SLICE_MS = exports.RESET_GRACE_MS = exports.UNKNOWN_RESET_WAIT_MS = exports.MAX_PROVIDER_LIMIT_WAIT_MS = void 0;
|
|
4
|
+
exports.providerLimitOf = providerLimitOf;
|
|
5
|
+
exports.quietUntilOf = quietUntilOf;
|
|
6
|
+
exports.resetOf = resetOf;
|
|
7
|
+
exports.waitingOutProviderLimits = waitingOutProviderLimits;
|
|
8
|
+
const agent_envelope_1 = require("./agent-envelope");
|
|
9
|
+
/** The longest one call waits out a limit, counted from its first refusal. A session window is five hours. */
|
|
10
|
+
exports.MAX_PROVIDER_LIMIT_WAIT_MS = 6 * 60 * 60 * 1000;
|
|
11
|
+
/** How long to wait when the refusal names no reset time, and the least wait once a retry is refused again. */
|
|
12
|
+
exports.UNKNOWN_RESET_WAIT_MS = 15 * 60 * 1000;
|
|
13
|
+
/** The provider prints the reset to the minute, rounded down; this covers the seconds and a little clock skew. */
|
|
14
|
+
exports.RESET_GRACE_MS = 2 * 60 * 1000;
|
|
15
|
+
/** How often a waiting run looks at whether it was told to stop. */
|
|
16
|
+
exports.LIMIT_WAIT_SLICE_MS = 15 * 1000;
|
|
17
|
+
/** The provider's usage-limit refusal in this result, or null when it is not one. */
|
|
18
|
+
function providerLimitOf(raw, now) {
|
|
19
|
+
const env = (0, agent_envelope_1.parseAgentEnvelope)(raw.output ?? '');
|
|
20
|
+
if (env === null || env.ok || env.apiErrorStatus !== 429)
|
|
21
|
+
return null;
|
|
22
|
+
const because = env.text.trim().slice(0, 300) || 'the provider refused with HTTP 429';
|
|
23
|
+
return { because, resetsAt: resetOf(because, now) };
|
|
24
|
+
}
|
|
25
|
+
/** When a caller may ask again: the stated reset and a grace, or a fixed wait when none is stated. */
|
|
26
|
+
function quietUntilOf(limit, now) {
|
|
27
|
+
return limit.resetsAt === null ? now + exports.UNKNOWN_RESET_WAIT_MS : Math.max(limit.resetsAt, now) + exports.RESET_GRACE_MS;
|
|
28
|
+
}
|
|
29
|
+
const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
30
|
+
/**
|
|
31
|
+
* The reset instant in the provider's sentence, or null.
|
|
32
|
+
*
|
|
33
|
+
* The CLI writes a reset within a day as `2:30am (Asia/Amman)` or `5pm (Asia/Amman)`, and a
|
|
34
|
+
* later one as `Oct 2, 5pm (…)`, with the year added only when it is not this one — each in
|
|
35
|
+
* the wall clock of the zone it names. A zone this runtime does not know, or any other shape,
|
|
36
|
+
* is null: the caller then waits a fixed time rather than guessing. (`\s` covers the no-break spaces
|
|
37
|
+
* newer ICU writes before the meridiem.)
|
|
38
|
+
*/
|
|
39
|
+
function resetOf(sentence, now) {
|
|
40
|
+
const m = /resets\s+(?:([A-Za-z]{3})\s+(\d{1,2}),\s+(?:(\d{4}),\s+)?)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)\s*\(([^)]+)\)/i.exec(sentence);
|
|
41
|
+
if (m === null)
|
|
42
|
+
return null;
|
|
43
|
+
const [, mon, day, year, hourText, minuteText, meridiem, zone] = m;
|
|
44
|
+
const hour12 = Number(hourText);
|
|
45
|
+
const minute = minuteText === undefined ? 0 : Number(minuteText);
|
|
46
|
+
if (!Number.isInteger(hour12) || hour12 < 1 || hour12 > 12 || !Number.isInteger(minute) || minute > 59)
|
|
47
|
+
return null;
|
|
48
|
+
const hour = (hour12 % 12) + (meridiem?.toLowerCase() === 'pm' ? 12 : 0);
|
|
49
|
+
const tz = (zone ?? '').trim();
|
|
50
|
+
let today;
|
|
51
|
+
try {
|
|
52
|
+
today = wallClockIn(tz, now);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
// Within five minutes past still counts as this reset: the sentence was written before this ran.
|
|
58
|
+
const recent = now - 5 * 60 * 1000;
|
|
59
|
+
if (mon === undefined) {
|
|
60
|
+
const at = instantOf(tz, today.y, today.mo, today.d, hour, minute);
|
|
61
|
+
if (at >= recent)
|
|
62
|
+
return at;
|
|
63
|
+
const next = new Date(Date.UTC(today.y, today.mo - 1, today.d + 1));
|
|
64
|
+
return instantOf(tz, next.getUTCFullYear(), next.getUTCMonth() + 1, next.getUTCDate(), hour, minute);
|
|
65
|
+
}
|
|
66
|
+
const month = MONTHS.indexOf(mon.toLowerCase()) + 1;
|
|
67
|
+
const date = Number(day);
|
|
68
|
+
if (month === 0 || date < 1 || date > 31)
|
|
69
|
+
return null;
|
|
70
|
+
const y = year === undefined ? today.y : Number(year);
|
|
71
|
+
const at = instantOf(tz, y, month, date, hour, minute);
|
|
72
|
+
return year === undefined && at < recent ? instantOf(tz, y + 1, month, date, hour, minute) : at;
|
|
73
|
+
}
|
|
74
|
+
/** The wall clock in `zone` at `at`. Throws a RangeError for a zone this runtime does not know. */
|
|
75
|
+
function wallClockIn(zone, at) {
|
|
76
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
77
|
+
timeZone: zone,
|
|
78
|
+
hourCycle: 'h23',
|
|
79
|
+
year: 'numeric',
|
|
80
|
+
month: 'numeric',
|
|
81
|
+
day: 'numeric',
|
|
82
|
+
hour: 'numeric',
|
|
83
|
+
minute: 'numeric',
|
|
84
|
+
}).formatToParts(new Date(at));
|
|
85
|
+
const n = (t) => Number(parts.find((p) => p.type === t)?.value);
|
|
86
|
+
return { y: n('year'), mo: n('month'), d: n('day'), h: n('hour') % 24, mi: n('minute') };
|
|
87
|
+
}
|
|
88
|
+
/** The instant at which `zone`'s wall clock reads the given date and time. */
|
|
89
|
+
function instantOf(zone, y, mo, d, h, mi) {
|
|
90
|
+
const target = Date.UTC(y, mo - 1, d, h, mi);
|
|
91
|
+
let guess = target;
|
|
92
|
+
// Two corrections settle any fixed offset; the third covers a guess that crossed a DST change.
|
|
93
|
+
for (let i = 0; i < 3; i++) {
|
|
94
|
+
const w = wallClockIn(zone, guess);
|
|
95
|
+
const diff = target - Date.UTC(w.y, w.mo - 1, w.d, w.h, w.mi);
|
|
96
|
+
if (diff === 0)
|
|
97
|
+
break;
|
|
98
|
+
guess += diff;
|
|
99
|
+
}
|
|
100
|
+
return guess;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* An invoke that waits out the provider's usage limit instead of reporting it as the answer.
|
|
104
|
+
*
|
|
105
|
+
* The Start that is waiting keeps its place: the controller sees a run that is still going and
|
|
106
|
+
* buys nothing, and nothing is spent while it waits. The same prompt is asked again once the
|
|
107
|
+
* provider said the limit resets. Bounded three ways — the call gives up (and the refusal stands,
|
|
108
|
+
* as before F35) when the reset is later than `maxWaitMs` from its first refusal, when it has
|
|
109
|
+
* waited that long, or when the run is told to stop — and a retry refused again waits at least
|
|
110
|
+
* `UNKNOWN_RESET_WAIT_MS`, so a reset that did not happen when it said is not asked every minute.
|
|
111
|
+
* Anything that is not a usage limit passes through untouched.
|
|
112
|
+
*/
|
|
113
|
+
function waitingOutProviderLimits(invoke, deps) {
|
|
114
|
+
return async (prompt, timeoutMs) => {
|
|
115
|
+
let deadline = null;
|
|
116
|
+
let refusals = 0;
|
|
117
|
+
const say = async (text) => {
|
|
118
|
+
deps.log(`provider: ${text}`);
|
|
119
|
+
await deps.announce?.(text);
|
|
120
|
+
};
|
|
121
|
+
for (;;) {
|
|
122
|
+
const r = await invoke(prompt, timeoutMs);
|
|
123
|
+
const now = deps.now();
|
|
124
|
+
const limit = providerLimitOf(r, now);
|
|
125
|
+
if (limit === null)
|
|
126
|
+
return r;
|
|
127
|
+
refusals += 1;
|
|
128
|
+
deadline ??= now + (deps.maxWaitMs ?? exports.MAX_PROVIDER_LIMIT_WAIT_MS);
|
|
129
|
+
const until = Math.max(quietUntilOf(limit, now), refusals > 1 ? now + exports.UNKNOWN_RESET_WAIT_MS : now);
|
|
130
|
+
if (until > deadline) {
|
|
131
|
+
await say(`${limit.because} — later than this call waits (${iso(deadline)}); the refusal stands`);
|
|
132
|
+
return r;
|
|
133
|
+
}
|
|
134
|
+
await say(`${limit.because} — waiting until ${iso(until)} to ask again; this Start keeps its place and spends nothing while it waits`);
|
|
135
|
+
while (deps.now() < until) {
|
|
136
|
+
if (await deps.interrupted()) {
|
|
137
|
+
await say('stopped waiting for the usage limit — the run was told to stop');
|
|
138
|
+
return r;
|
|
139
|
+
}
|
|
140
|
+
await deps.sleep(Math.min(exports.LIMIT_WAIT_SLICE_MS, until - deps.now()));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function iso(ms) {
|
|
146
|
+
return new Date(ms).toISOString();
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=provider-limit.js.map
|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QAAQ,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,kCAA0B,CAAC,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,6BAAqB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnG,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;gBACrB,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,kCAAkC,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;gBAClG,OAAO,CAAC,CAAC;YACX,CAAC;YACD,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,oBAAoB,GAAG,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;YACvI,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;gBAC1B,IAAI,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;oBAC7B,MAAM,GAAG,CAAC,gEAAgE,CAAC,CAAC;oBAC5E,OAAO,CAAC,CAAC;gBACX,CAAC;gBACD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAAmB,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,GAAG,CAAC,EAAU;IACrB,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { AgentSpec } from './agent-exec';
|
|
2
|
+
/**
|
|
3
|
+
* DOES THE CONFIGURED PROVIDER ACTUALLY ANSWER?
|
|
4
|
+
*
|
|
5
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
6
|
+
* 🔴 THIS IS THE ONLY THING THAT MAKES A PRESET TRUSTWORTHY.
|
|
7
|
+
*
|
|
8
|
+
* `providers.ts` ships command lines, and two of the three have never been run
|
|
9
|
+
* by anybody here — the binaries are not installed on the machine they were
|
|
10
|
+
* written on. No amount of care in a table fixes that. What fixes it is running
|
|
11
|
+
* the thing on the machine that HAS it and reporting what happened, which is
|
|
12
|
+
* what this does.
|
|
13
|
+
*
|
|
14
|
+
* ⚠️ `looply doctor` DELIBERATELY MAKES NO AGENT CALL — it exists to find a
|
|
15
|
+
* wrong `tsc` command in ninety seconds. That was the right decision for the
|
|
16
|
+
* gate and it left a hole either side of it: a wrong AGENT command was found at
|
|
17
|
+
* round 1 of an overnight run, by which point a person is asleep. This is the
|
|
18
|
+
* other half, and it is opt-in for the same reason doctor is fast: it spends a
|
|
19
|
+
* model call.
|
|
20
|
+
*
|
|
21
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
22
|
+
* 🔴 WHAT IT ASKS FOR, AND WHY THAT EXACT SHAPE
|
|
23
|
+
*
|
|
24
|
+
* A prompt with one instruction and a literal answer. Not "hello", which any
|
|
25
|
+
* process echoing its input would pass; not a code task, which spends real
|
|
26
|
+
* money and takes real time. A token the provider could only produce by having
|
|
27
|
+
* read the prompt and generated from it.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ IT STILL CANNOT PROVE THE MODEL IS ANY GOOD. It proves the process starts,
|
|
30
|
+
* accepts a prompt on stdin, and returns something derived from it. That is
|
|
31
|
+
* exactly the class of failure the flags cause, and no more.
|
|
32
|
+
*/
|
|
33
|
+
/** The word the probe asks for, chosen to be one nothing else would emit. */
|
|
34
|
+
export declare const PREFLIGHT_TOKEN = "looply-preflight-ok";
|
|
35
|
+
export declare const PREFLIGHT_PROMPT = "Reply with exactly this word and nothing else: looply-preflight-ok";
|
|
36
|
+
/**
|
|
37
|
+
* How long to wait before calling it hung.
|
|
38
|
+
*
|
|
39
|
+
* 🔴 A HANG IS THE FAILURE THIS EXISTS TO CATCH, so the timeout is not a
|
|
40
|
+
* formality. An AppContainer that cannot create a named pipe returns EACCES and
|
|
41
|
+
* the spawn waits FOR EVER rather than failing — that is measured behaviour in
|
|
42
|
+
* this repository, and without a ceiling this check would inherit it.
|
|
43
|
+
*/
|
|
44
|
+
export declare const PREFLIGHT_TIMEOUT_MS = 120000;
|
|
45
|
+
export type PreflightVerdict =
|
|
46
|
+
/** Started, read the prompt, and produced the token. */
|
|
47
|
+
'answered'
|
|
48
|
+
/** Started and produced output, but not the token. Working, or not — unclear. */
|
|
49
|
+
| 'unrecognised'
|
|
50
|
+
/** The binary is not there. Almost always a name or a PATH. */
|
|
51
|
+
| 'missing'
|
|
52
|
+
/** Started and exited non-zero. Usually a flag it does not know. */
|
|
53
|
+
| 'refused'
|
|
54
|
+
/** Produced nothing within the ceiling. */
|
|
55
|
+
| 'hung';
|
|
56
|
+
export interface PreflightResult {
|
|
57
|
+
readonly verdict: PreflightVerdict;
|
|
58
|
+
readonly ms: number;
|
|
59
|
+
/** Bounded and safe to print. Never the whole transcript. */
|
|
60
|
+
readonly detail: string;
|
|
61
|
+
/** What a person should do next, in their terms. Empty when nothing is wrong. */
|
|
62
|
+
readonly advice: string;
|
|
63
|
+
}
|
|
64
|
+
export interface PreflightDeps {
|
|
65
|
+
/**
|
|
66
|
+
* Run the command line, write the prompt to stdin, and resolve with what came
|
|
67
|
+
* back. Injected so the tests drive real child processes of their own rather
|
|
68
|
+
* than the provider.
|
|
69
|
+
*/
|
|
70
|
+
run(input: {
|
|
71
|
+
commandLine: string;
|
|
72
|
+
prompt: string;
|
|
73
|
+
timeoutMs: number;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
stdout: string;
|
|
76
|
+
stderr: string;
|
|
77
|
+
code: number | null;
|
|
78
|
+
timedOut: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
now(): number;
|
|
81
|
+
/**
|
|
82
|
+
* The absolute provider executable the RUN would spawn, when one is known.
|
|
83
|
+
*
|
|
84
|
+
* Supplied so the check starts the same binary the run starts — see
|
|
85
|
+
* `preflightCommandLine`. Absent means "not resolved", and the spec's own
|
|
86
|
+
* command line is used unchanged.
|
|
87
|
+
*/
|
|
88
|
+
executable?: string | null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The command line the preflight actually spawns.
|
|
92
|
+
*
|
|
93
|
+
* 🔴 THE BUILT-IN PROVIDER HAS TO BE SPAWNED BY ABSOLUTE PATH, BECAUSE THIS
|
|
94
|
+
* CHECK'S OWN ENVIRONMENT CANNOT FIND IT BY NAME. `buildProviderEnv` pins PATH
|
|
95
|
+
* to the system directories deliberately — "not the machine's toolchain
|
|
96
|
+
* directory, which on this machine also holds `claude`" — so the bare `claude`
|
|
97
|
+
* in `DEFAULT_AGENT.command` resolves to nothing and `cmd` answers "is not
|
|
98
|
+
* recognized as an internal or external command".
|
|
99
|
+
*
|
|
100
|
+
* MEASURED: `looply doctor --provider` returned `missing` in 18 ms on a machine
|
|
101
|
+
* where the provider was installed, logged in, and perfectly able to run —
|
|
102
|
+
* three lines after `checkProviderAuth` had resolved its absolute path and
|
|
103
|
+
* printed "logged in (claude.ai)". The check contradicted itself inside one
|
|
104
|
+
* command, and it contradicted the run: `model-transport` spawns
|
|
105
|
+
* `spec.executable ?? providerExecutableFor(pkg)` and never consults PATH.
|
|
106
|
+
*
|
|
107
|
+
* A check that REFUSES a configuration the run ACCEPTS is the mirror of the
|
|
108
|
+
* defect this file's own header warns about, and costs the same thing — a
|
|
109
|
+
* person is told the provider is missing and goes looking for an install that
|
|
110
|
+
* is already there.
|
|
111
|
+
*
|
|
112
|
+
* ⚠️ ONLY THE BUILT-IN IS REWRITTEN. A configured `agent.command` is the
|
|
113
|
+
* person's own line, and rewriting it would discard exactly the intent
|
|
114
|
+
* `resolveProvider` takes such care to keep. An explicit `agent.executable` is
|
|
115
|
+
* already absolute and the transport already prefers it.
|
|
116
|
+
*/
|
|
117
|
+
export declare function preflightCommandLine(spec: AgentSpec, executable: string | null): string;
|
|
118
|
+
export declare function preflightProvider(spec: AgentSpec, deps: PreflightDeps): Promise<PreflightResult>;
|
|
119
|
+
/** Whether a run should be allowed to start on this result. */
|
|
120
|
+
export declare function preflightPasses(r: Pick<PreflightResult, 'verdict'>): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The real implementation, kept out of the module above so its logic stays
|
|
123
|
+
* drivable without spawning anything.
|
|
124
|
+
*
|
|
125
|
+
* 🔴 THE ENVIRONMENT HAD TO MATCH THE TRANSPORT'S, AND THE OLD DOCBLOCK
|
|
126
|
+
* CLAIMED IT ALREADY DID.
|
|
127
|
+
*
|
|
128
|
+
* It said "`shell: true` MATCHES HOW THE TRANSPORT STARTS THE PROVIDER", while
|
|
129
|
+
* the transport's own docblock says "NEVER `shell: true`" — and, far worse,
|
|
130
|
+
* this spawn passed no `env` at all, so the child inherited the OPERATOR'S
|
|
131
|
+
* ENTIRE AMBIENT ENVIRONMENT and their real HOME.
|
|
132
|
+
*
|
|
133
|
+
* MEASURED: the preflight child saw an injected marker variable and the
|
|
134
|
+
* operator's own home directory; the transport gives a scrubbed environment and
|
|
135
|
+
* a HOME redirected into `.looply/provider-sessions`. So a provider that
|
|
136
|
+
* authenticates from the operator's real home, or that is found on the
|
|
137
|
+
* operator's PATH rather than in `agent.runtime`, PASSED this check and then
|
|
138
|
+
* could not start in the run — precisely the failure the preflight exists to
|
|
139
|
+
* prevent, with the check itself supplying the credentials.
|
|
140
|
+
*
|
|
141
|
+
* ⚠️ THE SHELL STAYS, because the thing being checked IS a command line and
|
|
142
|
+
* the transport also reaches a configured provider through `cmd /c`. What
|
|
143
|
+
* changes is the environment that shell is given: `buildProviderEnv` over a
|
|
144
|
+
* session directory — the same function, and the same shape, the transport uses.
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* The environment a preflight hands the provider, as a pure function of its three
|
|
148
|
+
* inputs — so a test can hold it against what the transport builds.
|
|
149
|
+
*
|
|
150
|
+
* 🔴 EXTRACTED BECAUSE THE DIVERGENCE WAS INVISIBLE. It lived inside the spawn
|
|
151
|
+
* closure, where nothing could observe it, and it quietly omitted
|
|
152
|
+
* `CLAUDE_CONFIG_DIR` while `model-transport` always set it. The result was a
|
|
153
|
+
* readiness check that reported `refused` for a provider the run would have
|
|
154
|
+
* authenticated, advising the operator to go and compare command-line flags.
|
|
155
|
+
*/
|
|
156
|
+
export declare function preflightEnv(base: Record<string, string>, runtime: readonly string[], profile?: string): Record<string, string>;
|
|
157
|
+
/**
|
|
158
|
+
* @param runtime `agent.runtime`, prepended to PATH exactly as the transport does.
|
|
159
|
+
* @param profile The provider profile directory, set as `CLAUDE_CONFIG_DIR`.
|
|
160
|
+
*
|
|
161
|
+
* 🔴 THE PROFILE IS NOT OPTIONAL DECORATION. `buildProviderEnv` hands the provider
|
|
162
|
+
* an isolated HOME, so without `CLAUDE_CONFIG_DIR` the binary looks for its login
|
|
163
|
+
* in a directory nothing has ever logged into — and answers "Not logged in" for a
|
|
164
|
+
* profile the RUN never uses. Measured on a machine whose operator was logged in
|
|
165
|
+
* perfectly well: `doctor --provider` said `refused`, and advised checking flags.
|
|
166
|
+
*
|
|
167
|
+
* ⚠️ NO CREDENTIAL PASSES THROUGH HERE. This is a directory NAME. The provider owns
|
|
168
|
+
* its own login inside it; Looply names the place and holds nothing.
|
|
169
|
+
*/
|
|
170
|
+
export declare function nodePreflightDeps(runtime?: readonly string[], profile?: string, executable?: string | null): PreflightDeps;
|
|
171
|
+
//# sourceMappingURL=provider-preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-preflight.d.ts","sourceRoot":"","sources":["../src/provider-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAM9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD,eAAO,MAAM,gBAAgB,uEAAs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