@sema-agent/core 7.69.1 → 7.70.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/CHANGELOG.md +2477 -0
- package/dist/agents/agent-definition.d.ts +18 -0
- package/dist/agents/agent-definition.js +10 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +2 -0
- package/dist/agents/cascade.d.ts +10 -0
- package/dist/agents/cascade.js +33 -5
- package/dist/agents/cc-peer-directory.d.ts +1 -1
- package/dist/agents/cc-peer-directory.js +2 -1
- package/dist/agents/child-model-seat.d.ts +1 -1
- package/dist/agents/composition-allowance.d.ts +63 -19
- package/dist/agents/composition-allowance.js +62 -45
- package/dist/agents/composition-placement.d.ts +22 -4
- package/dist/agents/composition-placement.js +10 -1
- package/dist/agents/cross-session-envelope.d.ts +4 -5
- package/dist/agents/cross-session-envelope.js +4 -5
- package/dist/agents/inherited-tool-pool.js +1 -2
- package/dist/agents/list-agents-tool.js +2 -1
- package/dist/agents/parked-resume-drive.d.ts +38 -0
- package/dist/agents/parked-resume-drive.js +57 -0
- package/dist/agents/peer-admission.js +4 -3
- package/dist/agents/peer-held-queue.d.ts +4 -2
- package/dist/agents/peer-held-queue.js +2 -1
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +49 -29
- package/dist/agents/repair-loop.js +15 -11
- package/dist/agents/retain-ledger.d.ts +71 -18
- package/dist/agents/retain-ledger.js +45 -13
- package/dist/agents/roster-store.d.ts +11 -3
- package/dist/agents/roster-store.js +6 -2
- package/dist/agents/send-message-tool.d.ts +2 -1
- package/dist/agents/send-message-tool.js +10 -7
- package/dist/agents/subagent.d.ts +24 -7
- package/dist/agents/subagent.js +256 -144
- package/dist/agents/tool-filter.js +1 -1
- package/dist/agents/verify.d.ts +4 -1
- package/dist/agents/verify.js +22 -16
- package/dist/agents/yield-adoption.js +2 -1
- package/dist/bench/metrics.js +2 -2
- package/dist/brain/anthropic.d.ts +2 -1
- package/dist/brain/anthropic.js +3 -3
- package/dist/brain/circuit-breaker.js +1 -1
- package/dist/brain/model-lane.d.ts +2 -1
- package/dist/brain/model-lane.js +22 -9
- package/dist/brain/open-responses.d.ts +77 -1
- package/dist/brain/open-responses.js +1 -1
- package/dist/brain/openai.d.ts +2 -1
- package/dist/brain/openai.js +3 -3
- package/dist/brain/reasoning.d.ts +8 -1
- package/dist/brain/reasoning.js +3 -0
- package/dist/brain/reference-model-traits.d.ts +13 -12
- package/dist/brain/reference-model-traits.js +11 -10
- package/dist/brain/request-route.d.ts +1 -1
- package/dist/brain/request-route.js +2 -2
- package/dist/brain/route-adjudicator.d.ts +72 -2
- package/dist/brain/route-adjudicator.js +210 -69
- package/dist/brain/route-conformance.js +35 -0
- package/dist/brain/routing.js +2 -2
- package/dist/brain/spend-meter.d.ts +56 -0
- package/dist/brain/spend-meter.js +263 -0
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/brain/stream-shared.js +3 -1
- package/dist/core/a2a-bound-grant.d.ts +110 -0
- package/dist/core/a2a-bound-grant.js +83 -0
- package/dist/core/a2a-task-state.d.ts +153 -51
- package/dist/core/a2a-task-state.js +85 -45
- package/dist/core/a2a.d.ts +62 -14
- package/dist/core/a2a.js +298 -57
- package/dist/core/agent-config-dir.d.ts +53 -6
- package/dist/core/agent-config-dir.js +59 -6
- package/dist/core/agent-definition.d.ts +1 -1
- package/dist/core/agent-state.d.ts +10 -1
- package/dist/core/agent-state.js +11 -4
- package/dist/core/allow-entry.d.ts +80 -42
- package/dist/core/allow-entry.js +119 -61
- package/dist/core/allow-rule-shadow.d.ts +25 -3
- package/dist/core/allow-rule-shadow.js +7 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/artifact-host.d.ts +109 -6
- package/dist/core/artifact-host.js +68 -0
- package/dist/core/ask-headline.d.ts +10 -9
- package/dist/core/ask-headline.js +9 -3
- package/dist/core/ask-origin.d.ts +88 -28
- package/dist/core/ask-origin.js +73 -43
- package/dist/core/ask-question.d.ts +76 -38
- package/dist/core/ask-question.js +151 -22
- package/dist/core/ask-unresolvable-notice.d.ts +66 -10
- package/dist/core/ask-unresolvable-notice.js +38 -14
- package/dist/core/auto-compaction.d.ts +3 -49
- package/dist/core/auto-compaction.js +3 -8
- package/dist/core/auto-mode-directive.d.ts +17 -5
- package/dist/core/auto-mode-directive.js +12 -3
- package/dist/core/auto-mode.d.ts +34 -5
- package/dist/core/auto-mode.js +43 -5
- package/dist/core/background-agent-store.d.ts +100 -11
- package/dist/core/background-agent-store.js +64 -6
- package/dist/core/background-shell.d.ts +9 -0
- package/dist/core/background-shell.js +10 -0
- package/dist/core/caller-text.d.ts +2 -2
- package/dist/core/caller-tool-name.d.ts +6 -0
- package/dist/core/caller-tool-name.js +2 -1
- package/dist/core/checkpoint-features.d.ts +38 -422
- package/dist/core/checkpoint-features.js +44 -0
- package/dist/core/checkpoint-queries.d.ts +14 -3
- package/dist/core/checkpoint-queries.js +9 -4
- package/dist/core/checkpoint-requirements.d.ts +69 -2
- package/dist/core/checkpoint-requirements.js +12 -2
- package/dist/core/checkpoint-row-verdict.d.ts +70 -17
- package/dist/core/checkpoint-row-verdict.js +75 -29
- package/dist/core/checkpoint-store.d.ts +75 -69
- package/dist/core/checkpoint-store.js +24 -22
- package/dist/core/classifier-unavailable-arm.d.ts +6 -1
- package/dist/core/classifier-unavailable-arm.js +8 -5
- package/dist/core/config-refusal-codes.d.ts +7 -5
- package/dist/core/config-refusal-codes.js +7 -2
- package/dist/core/config-refusal-input.d.ts +46 -0
- package/dist/core/config-refusal-input.js +62 -0
- package/dist/core/context-edit.d.ts +18 -1
- package/dist/core/context-edit.js +13 -2
- package/dist/core/context-guard.d.ts +60 -13
- package/dist/core/context-guard.js +77 -35
- package/dist/core/context-settings.d.ts +2 -1
- package/dist/core/context-settings.js +10 -6
- package/dist/core/corrupt-session-form.d.ts +97 -0
- package/dist/core/corrupt-session-form.js +54 -0
- package/dist/core/cross-boundary-taint.d.ts +3 -3
- package/dist/core/data-root.d.ts +32 -0
- package/dist/core/data-root.js +86 -0
- package/dist/core/decision-receipt.d.ts +2 -0
- package/dist/core/decision-receipt.js +3 -2
- package/dist/core/declaration-words.d.ts +37 -0
- package/dist/core/declaration-words.js +21 -0
- package/dist/core/delegation-frames.d.ts +76 -35
- package/dist/core/delegation-frames.js +21 -1
- package/dist/core/durable-sync.d.ts +9 -0
- package/dist/core/durable-sync.js +37 -0
- package/dist/core/engine-capabilities.d.ts +110 -3
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +259 -139
- package/dist/core/engine-notice.js +13 -19
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +22 -0
- package/dist/core/entries-not-applied.js +26 -0
- package/dist/core/exec-gate.d.ts +8 -1
- package/dist/core/exec-gate.js +24 -9
- package/dist/core/exec-outcome.d.ts +102 -0
- package/dist/core/exec-outcome.js +79 -0
- package/dist/core/existing-target.d.ts +45 -0
- package/dist/core/existing-target.js +54 -8
- package/dist/core/fast-tier-door.d.ts +2 -2
- package/dist/core/fast-tier-door.js +3 -3
- package/dist/core/file-history-store.d.ts +138 -19
- package/dist/core/file-history-store.js +124 -33
- package/dist/core/gate-fold.js +8 -1
- package/dist/core/gate-lanes.js +65 -38
- package/dist/core/gate-outcome.d.ts +3 -1
- package/dist/core/gate-outcome.js +7 -1
- package/dist/core/git-worktree-env.d.ts +25 -5
- package/dist/core/git-worktree-env.js +38 -13
- package/dist/core/governance-codes.d.ts +179 -40
- package/dist/core/governance-codes.js +450 -43
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +75 -13
- package/dist/core/hooks.js +4 -0
- package/dist/core/host-floor.d.ts +1 -1
- package/dist/core/host-floor.js +1 -1
- package/dist/core/identity-rekey.d.ts +2 -1
- package/dist/core/identity-rekey.js +5 -5
- package/dist/core/image-admission.d.ts +2 -2
- package/dist/core/image-admission.js +1 -1
- package/dist/core/isolation-scope.d.ts +42 -17
- package/dist/core/isolation-scope.js +12 -4
- package/dist/core/leg-identity.d.ts +17 -2
- package/dist/core/leg-identity.js +6 -1
- package/dist/core/locked-config.d.ts +86 -16
- package/dist/core/locked-config.js +100 -34
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mailbox-store.js +7 -0
- package/dist/core/mcp-failure.d.ts +13 -4
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-injection-drop.d.ts +30 -13
- package/dist/core/mcp-injection-drop.js +25 -7
- package/dist/core/mcp-leg-wait.d.ts +88 -0
- package/dist/core/mcp-leg-wait.js +100 -0
- package/dist/core/mcp-name-judge.js +1 -2
- package/dist/core/mcp-probe.d.ts +30 -1
- package/dist/core/mcp-probe.js +5 -3
- package/dist/core/mcp-read-bound.d.ts +51 -0
- package/dist/core/mcp-read-bound.js +49 -0
- package/dist/core/mcp-server-link.js +4 -3
- package/dist/core/mcp-server-spec.d.ts +97 -26
- package/dist/core/mcp-server-spec.js +51 -19
- package/dist/core/mcp-server-unavailable-notice.d.ts +15 -6
- package/dist/core/mcp-server-unavailable-notice.js +12 -11
- package/dist/core/mcp-stderr-lines.d.ts +69 -0
- package/dist/core/mcp-stderr-lines.js +333 -0
- package/dist/core/mcp.d.ts +32 -9
- package/dist/core/mcp.js +187 -44
- package/dist/core/member-outcome.d.ts +281 -0
- package/dist/core/member-outcome.js +293 -0
- package/dist/core/memory-engine/consolidation.js +3 -3
- package/dist/core/memory-engine/content-origin.js +5 -4
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +12 -5
- package/dist/core/memory-engine/dual-root.js +13 -7
- package/dist/core/memory-engine/engine.d.ts +27 -31
- package/dist/core/memory-engine/engine.js +103 -61
- package/dist/core/memory-engine/file-backend.d.ts +16 -3
- package/dist/core/memory-engine/file-backend.js +15 -20
- package/dist/core/memory-engine/index-copies.d.ts +8 -6
- package/dist/core/memory-engine/index-copies.js +2 -1
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +3 -2
- package/dist/core/memory-engine/layout.d.ts +166 -23
- package/dist/core/memory-engine/layout.js +235 -40
- package/dist/core/memory-engine/memory-backend-contract.js +20 -20
- package/dist/core/memory-engine/memory-deployment.d.ts +29 -16
- package/dist/core/memory-engine/memory-deployment.js +30 -20
- package/dist/core/memory-engine/mount-failed-notice.d.ts +64 -0
- package/dist/core/memory-engine/mount-failed-notice.js +50 -2
- package/dist/core/memory-engine/projection-ledger.d.ts +48 -0
- package/dist/core/memory-engine/projection-ledger.js +130 -0
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.js +1 -2
- package/dist/core/memory-engine/types.d.ts +10 -4
- package/dist/core/memory.js +3 -5
- package/dist/core/mode-policy.d.ts +82 -16
- package/dist/core/mode-policy.js +63 -29
- package/dist/core/model-seat.d.ts +13 -1
- package/dist/core/mods/classic-events.d.ts +13 -1
- package/dist/core/mods/dollar.js +2 -1
- package/dist/core/mods/extension-call.d.ts +3 -0
- package/dist/core/mods/extension-call.js +3 -0
- package/dist/core/mods/kernel/dispatch.d.ts +4 -0
- package/dist/core/mods/kernel/dispatch.js +3 -3
- package/dist/core/mods/kernel/events.d.ts +11 -3
- package/dist/core/mods/kernel/events.js +4 -4
- package/dist/core/mods/message-display.d.ts +6 -3
- package/dist/core/mods/message-display.js +13 -5
- package/dist/core/mods/stations.d.ts +8 -1
- package/dist/core/mods/stations.js +5 -3
- package/dist/core/mods/teammate-stations.d.ts +75 -0
- package/dist/core/mods/teammate-stations.js +108 -0
- package/dist/core/mounted-mcp.js +1 -2
- package/dist/core/namespaced-rule-name.d.ts +1 -1
- package/dist/core/namespaced-rule-name.js +1 -1
- package/dist/core/notice-fact.d.ts +28 -0
- package/dist/core/notice-fact.js +25 -0
- package/dist/core/owner-identity.d.ts +8 -3
- package/dist/core/owner-identity.js +6 -3
- package/dist/core/parent-spec-seat.d.ts +16 -6
- package/dist/core/parent-spec-seat.js +28 -6
- package/dist/core/park-resumability.d.ts +10 -5
- package/dist/core/park-resumability.js +3 -0
- package/dist/core/park-selfcheck.js +2 -1
- package/dist/core/peer-seat.d.ts +1 -2
- package/dist/core/permission-rule-consent.d.ts +50 -1
- package/dist/core/permission-rule-consent.js +121 -14
- package/dist/core/permission-rule-model.d.ts +135 -39
- package/dist/core/permission-rule-model.js +151 -24
- package/dist/core/permission-rule-org.d.ts +13 -0
- package/dist/core/permission-rule-org.js +8 -0
- package/dist/core/permission-rule-provider.d.ts +107 -7
- package/dist/core/permission-rule-provider.js +434 -29
- package/dist/core/permission-rule-session.js +3 -1
- package/dist/core/permission-rule-store.d.ts +19 -2
- package/dist/core/permission-rule-store.js +29 -10
- package/dist/core/permission-rule-sync.js +5 -2
- package/dist/core/permission-rules.js +8 -3
- package/dist/core/persisted-rule-arms.d.ts +10 -4
- package/dist/core/persisted-rule-arms.js +16 -11
- package/dist/core/persisted-rule-buckets.d.ts +66 -0
- package/dist/core/persisted-rule-buckets.js +57 -0
- package/dist/core/plan-review-facts.d.ts +33 -0
- package/dist/core/plan-review-facts.js +25 -0
- package/dist/core/prefix-declaration.d.ts +50 -0
- package/dist/core/prefix-declaration.js +13 -0
- package/dist/core/present-plan-tool.d.ts +13 -3
- package/dist/core/present-plan-tool.js +14 -3
- package/dist/core/pricing.d.ts +5 -1
- package/dist/core/pricing.js +8 -5
- package/dist/core/principal-name.d.ts +55 -5
- package/dist/core/principal-name.js +57 -16
- package/dist/core/process-identity.d.ts +11 -7
- package/dist/core/process-identity.js +26 -36
- package/dist/core/process-table.d.ts +67 -0
- package/dist/core/process-table.js +177 -0
- package/dist/core/protocol-http-auth.d.ts +75 -12
- package/dist/core/protocol-http-auth.js +223 -26
- package/dist/core/protocol-revocation.d.ts +29 -10
- package/dist/core/protocol-revocation.js +9 -5
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/read-only-shell.js +1 -1
- package/dist/core/read-root-grant-screen.d.ts +17 -6
- package/dist/core/read-root-grant-screen.js +15 -5
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +13 -0
- package/dist/core/remote-env.d.ts +111 -3
- package/dist/core/remote-env.js +20 -0
- package/dist/core/request-copy-projection.js +97 -18
- package/dist/core/resource-limit-reasons.d.ts +52 -0
- package/dist/core/resource-limit-reasons.js +6 -0
- package/dist/core/resume-at-refusal.d.ts +10 -6
- package/dist/core/resume-at-refusal.js +2 -2
- package/dist/core/resume-config-judge.d.ts +3 -2
- package/dist/core/resume-config-judge.js +2 -1
- package/dist/core/resume-startup-cause.d.ts +18 -4
- package/dist/core/resume-startup-cause.js +30 -6
- package/dist/core/retention.d.ts +12 -2
- package/dist/core/retention.js +6 -1
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +12 -0
- package/dist/core/rewind-conversation.d.ts +54 -0
- package/dist/core/rewind-conversation.js +1 -0
- package/dist/core/roles.d.ts +61 -3
- package/dist/core/roles.js +81 -28
- package/dist/core/rule-lane-reads.d.ts +2 -1
- package/dist/core/rule-lane-reads.js +54 -29
- package/dist/core/rule-offer-read.js +5 -2
- package/dist/core/rule-owner.d.ts +6 -1
- package/dist/core/rule-owner.js +8 -2
- package/dist/core/rule-store-fault.d.ts +4 -2
- package/dist/core/rule-store-fault.js +4 -1
- package/dist/core/runner/advertised-writable-dirs.d.ts +17 -0
- package/dist/core/runner/advertised-writable-dirs.js +15 -9
- package/dist/core/runner/announce-once-ledger.js +12 -11
- package/dist/core/runner/assemble-result.d.ts +15 -6
- package/dist/core/runner/assemble-result.js +12 -5
- package/dist/core/runner/auto-strip-notice.d.ts +1 -1
- package/dist/core/runner/branch-window.d.ts +25 -2
- package/dist/core/runner/branch-window.js +47 -11
- package/dist/core/runner/chain-refusal-throw.d.ts +19 -0
- package/dist/core/runner/chain-refusal-throw.js +30 -0
- package/dist/core/runner/changes-git.d.ts +21 -0
- package/dist/core/runner/changes-git.js +291 -0
- package/dist/core/runner/changes-history.d.ts +80 -0
- package/dist/core/runner/changes-history.js +351 -0
- package/dist/core/runner/checkpoint-scope.d.ts +16 -8
- package/dist/core/runner/checkpoint-scope.js +6 -4
- package/dist/core/runner/child-tree.d.ts +31 -20
- package/dist/core/runner/child-tree.js +24 -9
- package/dist/core/runner/classifier-ladder.d.ts +4 -2
- package/dist/core/runner/classifier-ladder.js +14 -12
- package/dist/core/runner/clock-and-limits.d.ts +0 -3
- package/dist/core/runner/clock-and-limits.js +1 -2
- package/dist/core/runner/compact-session.js +19 -50
- package/dist/core/runner/compaction-restate.js +2 -1
- package/dist/core/runner/constraint-layers.d.ts +101 -0
- package/dist/core/runner/constraint-layers.js +96 -0
- package/dist/core/runner/construction-doors.js +2 -0
- package/dist/core/runner/content-ask-bindings.d.ts +3 -3
- package/dist/core/runner/continuation-gate.d.ts +8 -4
- package/dist/core/runner/continuation-gate.js +2 -0
- package/dist/core/runner/continues-from.d.ts +7 -0
- package/dist/core/runner/continues-from.js +9 -0
- package/dist/core/runner/contracts.d.ts +144 -44
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +3 -4
- package/dist/core/runner/earlier-grammar-notice.js +5 -3
- package/dist/core/runner/env-capability-census.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +35 -9
- package/dist/core/runner/file-history-restore.js +36 -9
- package/dist/core/runner/finish-reason-seat.js +13 -4
- package/dist/core/runner/gate-exit.d.ts +8 -0
- package/dist/core/runner/gate-exit.js +36 -11
- package/dist/core/runner/halt-attribution.js +1 -1
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +2 -2
- package/dist/core/runner/left-as-is-seat.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +15 -4
- package/dist/core/runner/mcp-redial.js +53 -6
- package/dist/core/runner/memory-capture-optout.d.ts +7 -11
- package/dist/core/runner/memory-capture-optout.js +7 -4
- package/dist/core/runner/memory-phase-refusals.d.ts +19 -0
- package/dist/core/runner/memory-phase-refusals.js +18 -0
- package/dist/core/runner/messages-omitted-seat.d.ts +24 -1
- package/dist/core/runner/messages-omitted-seat.js +30 -9
- package/dist/core/runner/model-fallback-seat.d.ts +18 -5
- package/dist/core/runner/model-fallback-seat.js +29 -24
- package/dist/core/runner/model-lane-seat.d.ts +23 -1
- package/dist/core/runner/model-lane-seat.js +20 -2
- package/dist/core/runner/nested-memory-lane.d.ts +64 -57
- package/dist/core/runner/nested-memory-lane.js +310 -110
- package/dist/core/runner/park-commit.d.ts +26 -5
- package/dist/core/runner/park-commit.js +19 -8
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -0
- package/dist/core/runner/permission-rule-lanes.js +44 -11
- package/dist/core/runner/person-path-rows.d.ts +124 -21
- package/dist/core/runner/person-path-rows.js +179 -20
- package/dist/core/runner/prefix-ledger.d.ts +57 -3
- package/dist/core/runner/prefix-ledger.js +98 -8
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +2 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +13 -65
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +4 -1
- package/dist/core/runner/prepare-artifact.js +3 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +4 -0
- package/dist/core/runner/prepare-ask-lane.js +7 -5
- package/dist/core/runner/prepare-boundary-parks.js +9 -3
- package/dist/core/runner/prepare-caps-and-workflow.js +37 -25
- package/dist/core/runner/prepare-config-doors.d.ts +13 -14
- package/dist/core/runner/prepare-config-doors.js +121 -122
- package/dist/core/runner/prepare-context-lane.d.ts +32 -11
- package/dist/core/runner/prepare-context-lane.js +77 -48
- package/dist/core/runner/prepare-defer-classify.d.ts +12 -0
- package/dist/core/runner/prepare-defer-classify.js +29 -7
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -0
- package/dist/core/runner/prepare-delegation-surface.js +8 -4
- package/dist/core/runner/prepare-execution-env.d.ts +3 -0
- package/dist/core/runner/prepare-execution-env.js +10 -5
- package/dist/core/runner/prepare-file-history.js +4 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +10 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -6
- package/dist/core/runner/prepare-hands-readface.d.ts +28 -7
- package/dist/core/runner/prepare-hands-readface.js +83 -23
- package/dist/core/runner/prepare-inherited-gate.d.ts +20 -11
- package/dist/core/runner/prepare-inherited-gate.js +27 -16
- package/dist/core/runner/prepare-memory-engine-session.js +4 -2
- package/dist/core/runner/prepare-memory.d.ts +8 -1
- package/dist/core/runner/prepare-memory.js +37 -33
- package/dist/core/runner/prepare-offload-wrappers.d.ts +7 -7
- package/dist/core/runner/prepare-offload-wrappers.js +26 -17
- package/dist/core/runner/prepare-park-ask.d.ts +8 -11
- package/dist/core/runner/prepare-park-ask.js +11 -8
- package/dist/core/runner/prepare-policy-chain.d.ts +24 -1
- package/dist/core/runner/prepare-policy-chain.js +53 -28
- package/dist/core/runner/prepare-project-context.d.ts +4 -0
- package/dist/core/runner/prepare-project-context.js +9 -8
- package/dist/core/runner/prepare-prompt-assembly.js +2 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -2
- package/dist/core/runner/prepare-protocol-tools.js +44 -24
- package/dist/core/runner/prepare-question-face.d.ts +4 -9
- package/dist/core/runner/prepare-question-face.js +8 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
- package/dist/core/runner/prepare-suspend-saga.js +10 -4
- package/dist/core/runner/prepare-task.d.ts +2 -2
- package/dist/core/runner/prepare-task.js +141 -57
- package/dist/core/runner/prepare-tool-disclosure-mount.js +10 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +10 -8
- package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -19
- package/dist/core/runner/prepare-wiring-manifest.js +17 -35
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -11
- package/dist/core/runner/prepare-workspace-restore.js +1 -14
- package/dist/core/runner/read-root-grant.d.ts +48 -13
- package/dist/core/runner/read-root-grant.js +53 -19
- package/dist/core/runner/read-session-changes.d.ts +9 -0
- package/dist/core/runner/read-session-changes.js +192 -0
- package/dist/core/runner/remote-env-retry.d.ts +4 -4
- package/dist/core/runner/resume-admission.d.ts +11 -7
- package/dist/core/runner/resume-admission.js +25 -15
- package/dist/core/runner/resume-apply.js +2 -1
- package/dist/core/runner/resume-checkpoint-screen.d.ts +7 -2
- package/dist/core/runner/resume-checkpoint-screen.js +32 -17
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -0
- package/dist/core/runner/resume-internals-and-config.js +10 -7
- package/dist/core/runner/resume-policy-outcome.d.ts +4 -3
- package/dist/core/runner/resume-policy-outcome.js +2 -2
- package/dist/core/runner/retired-name-policy.d.ts +15 -0
- package/dist/core/runner/retired-name-policy.js +37 -0
- package/dist/core/runner/retired-runner-deps.js +3 -1
- package/dist/core/runner/rewind-conversation.d.ts +10 -0
- package/dist/core/runner/rewind-conversation.js +100 -0
- package/dist/core/runner/rewind-files.js +37 -20
- package/dist/core/runner/rewind-target.d.ts +28 -0
- package/dist/core/runner/rewind-target.js +58 -0
- package/dist/core/runner/role-resolution-table.d.ts +3 -16
- package/dist/core/runner/role-resolution-table.js +1 -3
- package/dist/core/runner/role-seat-defaulted.d.ts +14 -5
- package/dist/core/runner/role-seat-defaulted.js +17 -13
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -6
- package/dist/core/runner/rule-store-unreadable-notice.js +6 -4
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-harness-handlers.js +43 -11
- package/dist/core/runner/run-identity-wiring.d.ts +2 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +19 -28
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-settle-and-teardown.js +32 -17
- package/dist/core/runner/run-stop-and-final-verify.js +66 -69
- package/dist/core/runner/run-telemetry-and-budget-seats.js +14 -8
- package/dist/core/runner/run-turn-boundary.js +3 -6
- package/dist/core/runner/runtask.d.ts +22 -16
- package/dist/core/runner/runtask.js +18 -8
- package/dist/core/runner/sandbox-network-seat.js +1 -1
- package/dist/core/runner/seat-model-doors.d.ts +6 -5
- package/dist/core/runner/seat-model-doors.js +4 -3
- package/dist/core/runner/session-file-state-replay.d.ts +47 -8
- package/dist/core/runner/session-file-state-replay.js +97 -11
- package/dist/core/runner/session-files-open.d.ts +64 -0
- package/dist/core/runner/session-files-open.js +33 -0
- package/dist/core/runner/session-read-file-states.d.ts +37 -41
- package/dist/core/runner/session-read-file-states.js +14 -6
- package/dist/core/runner/session-rule-policy.d.ts +5 -0
- package/dist/core/runner/session-rule-policy.js +16 -9
- package/dist/core/runner/session-verb-doors.d.ts +41 -4
- package/dist/core/runner/session-verb-doors.js +66 -11
- package/dist/core/runner/shared-read-classifier.d.ts +14 -3
- package/dist/core/runner/shared-read-classifier.js +14 -6
- package/dist/core/runner/shell-env-withheld.d.ts +4 -2
- package/dist/core/runner/shell-env-withheld.js +3 -2
- package/dist/core/runner/side-call-account.d.ts +47 -5
- package/dist/core/runner/side-call-account.js +37 -3
- package/dist/core/runner/skipped-rules-notice.d.ts +5 -5
- package/dist/core/runner/skipped-rules-notice.js +3 -3
- package/dist/core/runner/stream-settle-backstop.js +5 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +26 -7
- package/dist/core/runner/sub-agent-deny-lists.js +23 -15
- package/dist/core/runner/task-start-doors.d.ts +7 -3
- package/dist/core/runner/task-start-doors.js +72 -31
- package/dist/core/runner/terminal-account.js +14 -8
- package/dist/core/runner/terminal-projection.d.ts +3 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-defer-gate.d.ts +1 -1
- package/dist/core/runner/tool-end-body.d.ts +8 -1
- package/dist/core/runner/tool-end-body.js +4 -3
- package/dist/core/runner/tool-face-overlay.js +6 -4
- package/dist/core/runner/tool-result-media-seat.d.ts +2 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/trim-stretch.d.ts +43 -0
- package/dist/core/runner/trim-stretch.js +34 -0
- package/dist/core/runner/turn-attachments.js +7 -2
- package/dist/core/runner/unreadable-person-rows.d.ts +39 -0
- package/dist/core/runner/unreadable-person-rows.js +20 -0
- package/dist/core/runner/verdict-refusal.d.ts +22 -7
- package/dist/core/runner/verdict-refusal.js +35 -3
- package/dist/core/runner/workspace-sync.d.ts +49 -0
- package/dist/core/runner/workspace-sync.js +170 -0
- package/dist/core/runner-deps.d.ts +57 -32
- package/dist/core/scheduler.d.ts +34 -14
- package/dist/core/secret-env.d.ts +168 -18
- package/dist/core/secret-env.js +291 -56
- package/dist/core/sensitive-path-policy.js +3 -2
- package/dist/core/session-changes.d.ts +260 -0
- package/dist/core/session-changes.js +40 -0
- package/dist/core/session-checkout.d.ts +87 -3
- package/dist/core/session-checkout.js +134 -6
- package/dist/core/session-log-transfer.js +13 -7
- package/dist/core/session-policy-store.d.ts +40 -12
- package/dist/core/session-policy-store.js +51 -25
- package/dist/core/session-store.d.ts +23 -10
- package/dist/core/session-store.js +40 -13
- package/dist/core/session.d.ts +56 -9
- package/dist/core/session.js +8 -1
- package/dist/core/shell-read-silence.d.ts +3 -3
- package/dist/core/shell-read-silence.js +3 -1
- package/dist/core/shell-run-candidates.d.ts +23 -6
- package/dist/core/shell-run-candidates.js +34 -11
- package/dist/core/skill-grant.d.ts +11 -6
- package/dist/core/skill-grant.js +23 -15
- package/dist/core/spend-account.d.ts +232 -0
- package/dist/core/spend-account.js +286 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +85 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +60 -6
- package/dist/core/store-contracts/file-history-store-contract.js +4 -4
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +22 -11
- package/dist/core/store-contracts/peer-directory-contract.js +8 -0
- package/dist/core/store-contracts/permission-rule-sync-contract.js +3 -3
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +23 -4
- package/dist/core/store-contracts/session-policy-store-contract.js +9 -0
- package/dist/core/store-contracts/session-repo-contract.js +38 -1
- package/dist/core/store-contracts/session-store-contract.d.ts +21 -2
- package/dist/core/store-contracts/session-store-contract.js +369 -5
- package/dist/core/store-contracts/tool-result-store-contract.js +8 -7
- package/dist/core/store-contracts/workflow-journal-store-contract.js +33 -0
- package/dist/core/task-event.d.ts +57 -53
- package/dist/core/task-limits.d.ts +15 -8
- package/dist/core/task-notification.d.ts +17 -12
- package/dist/core/task-notification.js +20 -9
- package/dist/core/task-registry-agent.d.ts +35 -30
- package/dist/core/task-registry-agent.js +102 -32
- package/dist/core/task-registry-monitor.js +2 -1
- package/dist/core/task-registry-shared.d.ts +83 -16
- package/dist/core/task-registry-shared.js +26 -7
- package/dist/core/task-registry-workflow.d.ts +9 -1
- package/dist/core/task-registry-workflow.js +11 -3
- package/dist/core/task-registry.d.ts +26 -27
- package/dist/core/task-registry.js +42 -12
- package/dist/core/task-result.d.ts +145 -35
- package/dist/core/task-spec-members.d.ts +21 -3
- package/dist/core/task-spec-members.js +11 -2
- package/dist/core/task-spec.d.ts +42 -45
- package/dist/core/task-start-judge.js +10 -3
- package/dist/core/task-stream.d.ts +2 -1
- package/dist/core/terminal-cause.d.ts +30 -2
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-face-reader.d.ts +3 -2
- package/dist/core/tool-gate-phase.d.ts +16 -0
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-plan.d.ts +7 -0
- package/dist/core/tool-mount-plan.js +25 -1
- package/dist/core/tool-mount-static.js +3 -2
- package/dist/core/tool-name-aliases.d.ts +81 -106
- package/dist/core/tool-name-aliases.js +60 -155
- package/dist/core/tool-name-readings.d.ts +2 -0
- package/dist/core/tool-name-readings.js +9 -1
- package/dist/core/tool-policy.d.ts +165 -60
- package/dist/core/tool-policy.js +105 -69
- package/dist/core/tool-registry.d.ts +2 -0
- package/dist/core/tool-registry.js +3 -0
- package/dist/core/tool-result-bytes.d.ts +27 -3
- package/dist/core/tool-result-bytes.js +53 -0
- package/dist/core/tool-result-store.d.ts +11 -4
- package/dist/core/tool-result-store.js +6 -2
- package/dist/core/tool-roster.d.ts +33 -22
- package/dist/core/tool-roster.js +28 -18
- package/dist/core/tool-spec-members.d.ts +12 -0
- package/dist/core/tool-spec-members.js +31 -0
- package/dist/core/tool-spec.d.ts +41 -28
- package/dist/core/trace.d.ts +21 -64
- package/dist/core/trace.js +2 -3
- package/dist/core/types.d.ts +7 -7
- package/dist/core/types.js +2 -2
- package/dist/core/unavailable-landing.d.ts +72 -0
- package/dist/core/unavailable-landing.js +18 -0
- package/dist/core/untrusted-egress.d.ts +27 -5
- package/dist/core/untrusted-egress.js +30 -8
- package/dist/core/usage-window-store.d.ts +11 -1
- package/dist/core/usage-window-store.js +5 -0
- package/dist/core/user-attachment.d.ts +74 -48
- package/dist/core/user-attachment.js +137 -69
- package/dist/core/user-row-origin.d.ts +10 -0
- package/dist/core/user-row-origin.js +6 -0
- package/dist/core/wiring-manifest.d.ts +94 -24
- package/dist/core/wiring-manifest.js +65 -13
- package/dist/core/workflow-journal-store.d.ts +16 -7
- package/dist/core/workflow-journal-store.js +34 -6
- package/dist/core/workflow-run-store-contract.js +102 -0
- package/dist/core/workflow-run-store.d.ts +95 -4
- package/dist/core/workflow-run-store.js +74 -11
- package/dist/engine/compaction/compaction.d.ts +15 -3
- package/dist/engine/compaction/compaction.js +29 -10
- package/dist/engine/execution-env/kill-tree.js +44 -49
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -1
- package/dist/engine/execution-env/node-execution-env.js +18 -11
- package/dist/engine/harness/agent-harness.d.ts +13 -0
- package/dist/engine/harness/agent-harness.js +16 -1
- package/dist/engine/harness/types.d.ts +100 -30
- package/dist/engine/harness/types.js +36 -4
- package/dist/engine/llm/rejected-images.js +1 -1
- package/dist/engine/llm/types.d.ts +22 -2
- package/dist/engine/llm/types.js +5 -2
- package/dist/engine/loop/agent-loop.js +43 -11
- package/dist/engine/loop/types.d.ts +11 -0
- package/dist/engine/session/import-validate.d.ts +9 -0
- package/dist/engine/session/import-validate.js +50 -9
- package/dist/engine/session/memory-repo.d.ts +5 -1
- package/dist/engine/session/memory-repo.js +8 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +19 -12
- package/dist/engine/session/repo-utils.js +12 -7
- package/dist/engine/session/session.d.ts +30 -10
- package/dist/engine/session/session.js +52 -20
- package/dist/engine/session/storage-base.js +2 -2
- package/dist/fixtures/index.d.ts +3 -1
- package/dist/fixtures/index.js +3 -0
- package/dist/host-env.d.ts +17 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +83 -41
- package/dist/index.js +64 -30
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +5 -3
- package/dist/internal/harness.js +4 -3
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +40 -12
- package/dist/orchestration/run-workflow-tool.js +205 -102
- package/dist/orchestration/workflow-catalog.d.ts +254 -0
- package/dist/orchestration/workflow-catalog.js +702 -0
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-meta.d.ts +11 -1
- package/dist/orchestration/workflow-meta.js +48 -0
- package/dist/orchestration/workflow-observe.d.ts +8 -10
- package/dist/orchestration/workflow-observe.js +6 -1
- package/dist/orchestration/workflow-park-adoption.d.ts +71 -33
- package/dist/orchestration/workflow-park-adoption.js +153 -40
- package/dist/orchestration/workflow-requirements.d.ts +51 -0
- package/dist/orchestration/workflow-requirements.js +54 -0
- package/dist/orchestration/workflow-script-runner.d.ts +18 -0
- package/dist/orchestration/workflow-script-store.d.ts +19 -64
- package/dist/orchestration/workflow-script-store.js +1 -24
- package/dist/orchestration/workflow-types.d.ts +173 -41
- package/dist/orchestration/workflow-types.js +22 -4
- package/dist/orchestration/workflow.d.ts +56 -42
- package/dist/orchestration/workflow.js +654 -139
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -2
- package/dist/prompt-assembly/catalog/engine.d.ts +36 -0
- package/dist/prompt-assembly/catalog/engine.js +4 -0
- package/dist/prompt-assembly/catalog/events.d.ts +16 -0
- package/dist/prompt-assembly/catalog/events.js +2 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +4 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +2 -2
- package/dist/prompt-assembly/catalog/mechanism.js +2 -2
- package/dist/prompt-assembly/catalog/schema.d.ts +5 -2
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/epoch.d.ts +26 -0
- package/dist/prompt-assembly/epoch.js +29 -0
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +1 -1
- package/dist/prompts/default.d.ts +2 -2
- package/dist/shell/lex.d.ts +10 -7
- package/dist/shell/lex.js +56 -6
- package/dist/stores/file/adoption/adopt.d.ts +12 -0
- package/dist/stores/file/adoption/adopt.js +78 -31
- package/dist/stores/file/adoption/marker.d.ts +48 -26
- package/dist/stores/file/adoption/marker.js +24 -11
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +26 -5
- package/dist/stores/file/data-root-declaration.js +2 -1
- package/dist/stores/file/descriptor-seat.d.ts +100 -0
- package/dist/stores/file/descriptor-seat.js +150 -0
- package/dist/stores/file/file-history-store.js +2 -1
- package/dist/stores/file/fs-atomic.d.ts +126 -78
- package/dist/stores/file/fs-atomic.js +313 -253
- package/dist/stores/file/index.d.ts +10 -1
- package/dist/stores/file/index.js +28 -16
- package/dist/stores/file/ledger-damage.js +6 -10
- package/dist/stores/file/lock-reading.d.ts +158 -0
- package/dist/stores/file/lock-reading.js +252 -0
- package/dist/stores/file/mailbox-store.d.ts +8 -5
- package/dist/stores/file/mailbox-store.js +23 -14
- package/dist/stores/file/permission-rule-adopt.js +11 -11
- package/dist/stores/file/permission-rule-store.d.ts +14 -3
- package/dist/stores/file/permission-rule-store.js +33 -37
- package/dist/stores/file/process-anchor.d.ts +85 -0
- package/dist/stores/file/process-anchor.js +392 -0
- package/dist/stores/file/session-policy-store.d.ts +18 -2
- package/dist/stores/file/session-policy-store.js +71 -5
- package/dist/stores/file/session-store.d.ts +19 -1
- package/dist/stores/file/session-store.js +51 -19
- package/dist/stores/file/shared-ledger.d.ts +3 -3
- package/dist/stores/file/task-list-store.js +1 -1
- package/dist/stores/file/tool-result-store.js +2 -1
- package/dist/stores/file/usage-window-store.js +1 -1
- package/dist/stores/file/workflow-journal-store.d.ts +5 -2
- package/dist/stores/file/workflow-journal-store.js +12 -25
- package/dist/stores/file/workflow-run-store.d.ts +5 -0
- package/dist/stores/file/workflow-run-store.js +19 -12
- package/dist/tools/artifact/artifact-text.d.ts +29 -11
- package/dist/tools/artifact/artifact-text.js +13 -6
- package/dist/tools/artifact/artifact-tool.d.ts +35 -5
- package/dist/tools/artifact/artifact-tool.js +240 -45
- package/dist/tools/artifact/conformance.d.ts +27 -5
- package/dist/tools/artifact/conformance.js +420 -45
- package/dist/tools/artifact/local-stub.d.ts +2 -2
- package/dist/tools/artifact/local-stub.js +29 -26
- package/dist/tools/fs/bash-failure-output.d.ts +64 -0
- package/dist/tools/fs/bash-failure-output.js +40 -0
- package/dist/tools/fs/bash-program-position.d.ts +7 -3
- package/dist/tools/fs/bash-program-position.js +9 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +4 -3
- package/dist/tools/fs/bound-open.d.ts +9 -8
- package/dist/tools/fs/bound-open.js +6 -4
- package/dist/tools/fs/dead-cwd.d.ts +8 -0
- package/dist/tools/fs/dead-cwd.js +7 -7
- package/dist/tools/fs/file-read-check.d.ts +8 -6
- package/dist/tools/fs/file-read-check.js +8 -4
- package/dist/tools/fs/file-write-check.d.ts +14 -0
- package/dist/tools/fs/file-write-check.js +35 -0
- package/dist/tools/fs/find-actions.d.ts +186 -0
- package/dist/tools/fs/find-actions.js +538 -0
- package/dist/tools/fs/fs-bash.d.ts +6 -3
- package/dist/tools/fs/fs-bash.js +67 -60
- package/dist/tools/fs/fs-pdf.js +16 -5
- package/dist/tools/fs/fs-read.js +5 -3
- package/dist/tools/fs/fs-shared.d.ts +67 -3
- package/dist/tools/fs/fs-shared.js +70 -34
- package/dist/tools/fs/fs-write.d.ts +23 -3
- package/dist/tools/fs/fs-write.js +137 -33
- package/dist/tools/fs/index.d.ts +15 -2
- package/dist/tools/fs/index.js +8 -4
- package/dist/tools/fs/program-read-model.d.ts +17 -1
- package/dist/tools/fs/program-read-model.js +7 -2
- package/dist/tools/fs/program-read-model.rows.js +5 -1
- package/dist/tools/fs/read-deny-home.js +12 -5
- package/dist/tools/fs/read-floor.d.ts +16 -0
- package/dist/tools/fs/read-floor.js +10 -5
- package/dist/tools/fs/removal-targets.d.ts +22 -4
- package/dist/tools/fs/removal-targets.js +116 -6
- package/dist/tools/fs/safety.d.ts +2 -0
- package/dist/tools/fs/safety.js +9 -2
- package/dist/tools/fs/shell-read-bindings.d.ts +56 -7
- package/dist/tools/fs/shell-read-bindings.js +175 -26
- package/dist/tools/fs/shell-read-check.d.ts +11 -2
- package/dist/tools/fs/shell-read-check.js +31 -5
- package/dist/tools/fs/shell-read-command-environment.d.ts +56 -0
- package/dist/tools/fs/shell-read-command-environment.js +75 -0
- package/dist/tools/fs/shell-read-establish.js +62 -16
- package/dist/tools/fs/shell-read-judge.d.ts +52 -7
- package/dist/tools/fs/shell-read-judge.js +63 -21
- package/dist/tools/fs/shell-read-lost-walk.d.ts +19 -0
- package/dist/tools/fs/shell-read-lost-walk.js +35 -0
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +47 -13
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +28 -3
- package/dist/tools/fs/shell-read-start.d.ts +7 -0
- package/dist/tools/fs/shell-read-word.js +1 -0
- package/dist/tools/fs/shell-read-workdir.d.ts +9 -11
- package/dist/tools/fs/shell-read-workdir.js +20 -26
- package/dist/tools/fs/shell-read-write-targets.d.ts +13 -5
- package/dist/tools/fs/shell-read-write-targets.js +51 -9
- package/dist/tools/monitor.d.ts +2 -1
- package/dist/tools/monitor.js +2 -0
- package/dist/tools/scheduler-tools.d.ts +7 -4
- package/dist/tools/scheduler-tools.js +60 -20
- package/dist/tools/task-list.d.ts +11 -1
- package/dist/tools/task-list.js +187 -134
- package/dist/tools/todo.d.ts +1 -1
- package/dist/tools/worktree.js +10 -9
- package/package.json +6 -2
- package/test/export-surface.snapshot.json +592 -22
- package/wire-changes/core-stores-sql@7.68.7.json +39 -0
- package/wire-changes/core-stores-sql@7.70.0.json +414 -0
- package/wire-changes/core@7.68.7.json +140 -0
- package/wire-changes/core@7.70.0.json +14689 -0
- package/wire-changes/mods-kernel@7.68.7.json +39 -0
- package/wire-changes/mods-kernel@7.70.0.json +75 -0
- package/wire-changes/primitives@7.68.7.json +39 -0
- package/wire-changes/primitives@7.70.0.json +807 -0
- package/wire-changes/wiki-gate@7.68.7.json +39 -0
- package/wire-changes/wiki-gate@7.70.0.json +40 -0
- package/dist/core/cache-break-detector.d.ts +0 -98
- package/dist/core/cache-break-detector.js +0 -146
- package/dist/core/compaction-retired-members.d.ts +0 -12
- package/dist/core/compaction-retired-members.js +0 -22
- package/dist/core/loopback-host.d.ts +0 -18
- package/dist/core/loopback-host.js +0 -40
- package/dist/core/protocol-naming.d.ts +0 -95
- package/dist/core/protocol-naming.js +0 -70
- package/dist/core/protocol-table.d.ts +0 -88
- package/dist/core/protocol-table.js +0 -47
|
@@ -2,7 +2,7 @@ import type { Model, PerModelAuth } from "../internal/llm.js";
|
|
|
2
2
|
import type { RouteAdjudication, RouteCredential, RoutePairingConfig, RoutePairingPosture, RouteRefusalCode } from "../internal/llm.js";
|
|
3
3
|
import type { Brain, EngineNotice } from "../core/types.js";
|
|
4
4
|
import { BrainError } from "./errors.js";
|
|
5
|
-
import type { RequestRootOrigin } from "./request-route.js";
|
|
5
|
+
import type { RequestRootOrigin, RouteCarrier } from "./request-route.js";
|
|
6
6
|
/** What the pairing law answers: a servable posture or a CREDENTIAL refusal — never `route.model_unavailable`, which is a deployment's
|
|
7
7
|
* word about a model it does not serve, not a fact of a credential and a root. */
|
|
8
8
|
export type PairingAdjudication = Exclude<RouteAdjudication, {
|
|
@@ -92,6 +92,13 @@ export declare function resolveRequestRootOf(modelBaseUrl: string | undefined, c
|
|
|
92
92
|
* credential ({@link isCredentialHeaderName}: `Authorization`, `X-Api-Key`, Azure's `api-key`, `x-goog-api-key`,
|
|
93
93
|
* `Cookie`, …), the same reading the withheld-value intake keeps. */
|
|
94
94
|
export declare function hasAuthCarrier(headers: Record<string, string> | undefined): boolean;
|
|
95
|
+
/** A request root's ORIGIN as the request gate folds it — the one fold the engine compares origins by (a request's, an answer's
|
|
96
|
+
* declared `credentialOrigin`, a rebind's): scheme, host and port of its route key ({@link routeKeyOf}), the scheme's default
|
|
97
|
+
* port elided. Exported for a host that compares two roots' origins itself (a credential has one origin). It folds, it does not
|
|
98
|
+
* judge: a root the request-root judge refuses (userinfo, a fragment) folds to the origin of the URL it parses as; a spelling
|
|
99
|
+
* that does not parse as an http(s) URL folds to its whole route key and so equals no parsed origin; `""` = no root; a
|
|
100
|
+
* non-string throws (garbage, the module note). Like the route key it is a comparison value: **never render it** — {@link displayUrlOf}. */
|
|
101
|
+
export declare function requestOriginOf(root: string): string;
|
|
95
102
|
/** Test seam: empties the process's credential-origin table — every per-model credential is unbound again, as at a
|
|
96
103
|
* process start. Never called by production code (a deployment moves one credential with {@link rebindCredentialOrigin}, and a restart empties the table). A test
|
|
97
104
|
* suite that sends one fixture credential to two local mock upstreams (two `listen(0)` ports are two origins) calls it
|
|
@@ -107,6 +114,14 @@ export declare function __resetCredentialOriginBindings(): void;
|
|
|
107
114
|
* reads the resolved credential's `apiKey`, as the lanes do.
|
|
108
115
|
*/
|
|
109
116
|
export declare function keyCarriedBy(apiKey: string | undefined): string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* How a credential rides on the wire: its key in the lane's key header (`"apiKey"`), a credential header with a value (`"header"`),
|
|
119
|
+
* or nothing (`undefined`) — the keyless door at whatever rank (a blank key, a bag of blank credential headers), or no source at all.
|
|
120
|
+
* THE one reading of "does this request carry a credential": the route a request states
|
|
121
|
+
* ({@link import("./request-route.js").requestRouteOf}), the law's "over what" question ({@link plaintextRefusal}) and a brain that
|
|
122
|
+
* sends no request without a credential ({@link RoutePairingConfig.requireCredential}) all read it.
|
|
123
|
+
*/
|
|
124
|
+
export declare function credentialCarrierOf(credential: RouteCredential): RouteCarrier | undefined;
|
|
110
125
|
/**
|
|
111
126
|
* Resolve WHICH credential a request would carry, tagged with its source — the input half of the
|
|
112
127
|
* adjudication. One rank per SOURCE, most-specific wins; within a rank the apiKey knob and the rank's
|
|
@@ -172,7 +187,8 @@ export declare const KEYLESS_EXIT = "hand it none \u2014 answer an empty apiKey
|
|
|
172
187
|
* ({@link plaintextRefusal}: a credential is never sent across a network in the clear); then to whom: the answer's own
|
|
173
188
|
* credential belongs to the origin it named; any other per-model credential is judged against the origin it is bound to
|
|
174
189
|
* (refused when that is another one); one not bound yet, or built by hand (no resolution facts — the published corpus
|
|
175
|
-
* is such input), is servable.
|
|
190
|
+
* is such input), is servable. A route found servable that carries no credential is refused where the config declares
|
|
191
|
+
* `requireCredential` (`route.credential_missing`). Every refusal is a verdict: the law throws on garbage alone. The table is written by a first-party brain's request gate ({@link admitRouteRequest}), when the engine commits the request to be sent, and by the
|
|
176
192
|
* host's explicit rebind ({@link rebindCredentialOrigin}) — never by a judgment. The verdict reports nothing either: the
|
|
177
193
|
* request gate's refusal is {@link routeRefusalError}.
|
|
178
194
|
*/
|
|
@@ -254,6 +270,42 @@ export interface CredentialRebind {
|
|
|
254
270
|
/** `false` ⇒ every secret the credential carries was already bound to `origin`: nothing was written, nothing announced. */
|
|
255
271
|
readonly changed: boolean;
|
|
256
272
|
}
|
|
273
|
+
/** One entry of a catalog generation handed to {@link rebindCredentialOrigin} in its group form: the entry as it is in force,
|
|
274
|
+
* the per-model hook's answer the request will get for it, and one pairing config per lane root its request may be judged
|
|
275
|
+
* under (the brain that serves it, and each brain a failover may hand it to) — at least one. */
|
|
276
|
+
export interface CredentialRebindEntry {
|
|
277
|
+
readonly model: Pick<Model, "id" | "baseUrl" | "headers">;
|
|
278
|
+
readonly perModelAuth?: {
|
|
279
|
+
apiKey?: string;
|
|
280
|
+
headers?: Record<string, string>;
|
|
281
|
+
};
|
|
282
|
+
readonly configs: readonly RoutePairingConfig[];
|
|
283
|
+
}
|
|
284
|
+
/** What the group form of {@link rebindCredentialOrigin} did for one entry — one answer per entry, in the order and number handed:
|
|
285
|
+
* - `"rebound"` — its secrets now bound to `origin` (the table changed; `route.credential_rebound` was announced for it);
|
|
286
|
+
* - `"unchanged"` — every secret of it was already bound to `origin`;
|
|
287
|
+
* - `"withheld"` — a secret of it goes to more than one origin across the group (`origins`, `peers`): one credential has one
|
|
288
|
+
* root, so nothing is bound or announced on its account;
|
|
289
|
+
* - `"none"` — nothing of it can be bound: it carries no secret of its own (no per-model credential, or the keyless door), or
|
|
290
|
+
* none of its configs gives its request a servable root (that request is refused when it is built).
|
|
291
|
+
* Origins in display spelling — never a credential or a digest of one. `modelId` is for display: two entries may share it. */
|
|
292
|
+
export interface CredentialRebindAlignment {
|
|
293
|
+
readonly modelId: string;
|
|
294
|
+
readonly outcome: CredentialRebindOutcome;
|
|
295
|
+
/** `"rebound"` / `"unchanged"`: the one origin its secrets are bound to. */
|
|
296
|
+
readonly origin?: string;
|
|
297
|
+
/** `"rebound"`: the other origins one of its secrets was bound to before; empty otherwise. */
|
|
298
|
+
readonly previous: readonly string[];
|
|
299
|
+
/** `"withheld"` only: every origin a secret of this entry goes to across the group, its own included — two or more, in the
|
|
300
|
+
* order the group first names them. */
|
|
301
|
+
readonly origins?: readonly string[];
|
|
302
|
+
/** `"withheld"` only: the positions (in the group as handed) of the other entries that carry a secret of this entry that goes to
|
|
303
|
+
* more than one origin — ascending; empty when this entry alone sends it to two (two configs, two roots). */
|
|
304
|
+
readonly peers?: readonly number[];
|
|
305
|
+
}
|
|
306
|
+
/** The four outcomes of {@link CredentialRebindAlignment}. */
|
|
307
|
+
export declare const CREDENTIAL_REBIND_OUTCOMES: readonly ["rebound", "unchanged", "withheld", "none"];
|
|
308
|
+
export type CredentialRebindOutcome = (typeof CREDENTIAL_REBIND_OUTCOMES)[number];
|
|
257
309
|
/**
|
|
258
310
|
* The host's explicit rebind — the one way a per-model credential's binding MOVES inside a process. The credential is
|
|
259
311
|
* resolved here, from the entry and the per-model hook's answer for it, by the request's own resolution
|
|
@@ -279,7 +331,22 @@ export interface CredentialRebind {
|
|
|
279
331
|
* binding to move — or an answer through the keyless door), and an entry whose request has no servable root (the lane
|
|
280
332
|
* default the host hands is judged like the entry's and the brain's roots). A non-string
|
|
281
333
|
* id, URL half or key throws a `TypeError`, as for every caller of the law.
|
|
334
|
+
*
|
|
335
|
+
* **The group form** — `rebindCredentialOrigin(entries, onNotice?)`, every entry of a catalog generation that carries a
|
|
336
|
+
* credential of its own ({@link CredentialRebindEntry}: the entry, the hook's answer for it, one pairing config per lane root its
|
|
337
|
+
* request may be judged under) — is the same rebind applied to a generation, and it answers the question a host aligning a
|
|
338
|
+
* generation must otherwise answer itself: does one credential go to one origin across the catalog? Each entry is read as the
|
|
339
|
+
* one-entry form reads it, once per config; the origins it can go to are the union over its configs. A secret that the group sends
|
|
340
|
+
* to ONE origin is bound there (each entry that changed the table announced as above, in the order handed); a secret the group
|
|
341
|
+
* sends to two or more origins has no one root to move to, so every entry carrying it is `"withheld"` — nothing is bound or
|
|
342
|
+
* announced on its account, and its answer names those origins and the other entries carrying it. An entry with no secret of its
|
|
343
|
+
* own, or whose configs give its request no servable root, answers `"none"`. **Returned ⇒ every entry has its answer, in the
|
|
344
|
+
* order and number handed; thrown ⇒ nothing was bound**: every entry is read and judged, and every announcement built, before
|
|
345
|
+
* anything is written, and only a bad value throws — a `TypeError` (an entry, answer or config that is not an object, an empty `configs`, a
|
|
346
|
+
* non-string id / URL half / key, a non-boolean `requireCredential`), or the refusal (`config.invalid_argument`) the engine's
|
|
347
|
+
* credential intake gives a secret it refuses on every request. A secret the group leaves out is not counted: hand the generation whole.
|
|
282
348
|
*/
|
|
349
|
+
export declare function rebindCredentialOrigin(entries: readonly CredentialRebindEntry[], onNotice?: (notice: EngineNotice) => void): readonly CredentialRebindAlignment[];
|
|
283
350
|
export declare function rebindCredentialOrigin(model: Pick<Model, "id" | "baseUrl" | "headers">, perModelAuth: {
|
|
284
351
|
apiKey?: string;
|
|
285
352
|
headers?: Record<string, string>;
|
|
@@ -334,6 +401,9 @@ export declare function createBrainRouteJudge(config: {
|
|
|
334
401
|
/** The header the lane writes a per-call apiKey in ({@link resolveRouteCredential}'s `keyHeader`): the brain's own
|
|
335
402
|
* constant, so the judge refuses the requests its request build refuses. */
|
|
336
403
|
keyHeader?: string;
|
|
404
|
+
/** The brain sends no request without a credential ({@link RoutePairingConfig.requireCredential}); read here, when the brain is
|
|
405
|
+
* built, so a value that is not a boolean is refused at construction rather than at the first request. */
|
|
406
|
+
requireCredential?: boolean;
|
|
337
407
|
}): (model: Model, perModelAuth?: PerModelAuth) => RouteAdjudication;
|
|
338
408
|
/**
|
|
339
409
|
* Per-entry pairing status — the read-face predicate a roster/diagnostic surface annotates entries
|
|
@@ -218,10 +218,10 @@ function routeOriginOf(rootKey) {
|
|
|
218
218
|
const u = servableParse(rootKey);
|
|
219
219
|
return u === undefined ? rootKey : `${u.protocol}//${u.host}`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
if (typeof
|
|
223
|
-
throw new TypeError(`route pairing:
|
|
224
|
-
return routeOriginOf(routeKeyOf(
|
|
221
|
+
export function requestOriginOf(root) {
|
|
222
|
+
if (typeof root !== "string")
|
|
223
|
+
throw new TypeError(`route pairing: a request root must be a string (got ${typeof root})`);
|
|
224
|
+
return routeOriginOf(routeKeyOf(root));
|
|
225
225
|
}
|
|
226
226
|
const CREDENTIAL_ORIGIN_BINDINGS_MAX = 16_384;
|
|
227
227
|
const CREDENTIAL_ORIGIN_TABLE = Symbol.for("sema.core.credentialOriginTable");
|
|
@@ -304,6 +304,17 @@ function routeHalves(model, config) {
|
|
|
304
304
|
export function keyCarriedBy(apiKey) {
|
|
305
305
|
return apiKey !== undefined && !isBlankCredential(apiKey) ? apiKey : undefined;
|
|
306
306
|
}
|
|
307
|
+
export function credentialCarrierOf(credential) {
|
|
308
|
+
return keyCarriedBy(credential.apiKey) !== undefined ? "apiKey" : credential.headersBorne === true ? "header" : undefined;
|
|
309
|
+
}
|
|
310
|
+
function credentialRequiredBy(config) {
|
|
311
|
+
const declared = config.requireCredential;
|
|
312
|
+
if (declared === undefined || declared === false)
|
|
313
|
+
return false;
|
|
314
|
+
if (declared === true)
|
|
315
|
+
return true;
|
|
316
|
+
throw new TypeError(`route pairing: requireCredential must be a boolean (got ${describeRejectedValue(declared)})`);
|
|
317
|
+
}
|
|
307
318
|
function keyHeaderConflict(apiKey, headers, keyHeader) {
|
|
308
319
|
if (apiKey === undefined || keyHeader === undefined || headers === undefined)
|
|
309
320
|
return undefined;
|
|
@@ -312,7 +323,7 @@ function keyHeaderConflict(apiKey, headers, keyHeader) {
|
|
|
312
323
|
return written === undefined ? undefined : { header: written, keyHeader };
|
|
313
324
|
}
|
|
314
325
|
export function resolveRouteCredential(input) {
|
|
315
|
-
const answerOrigin = input.optionsCredentialOrigin === undefined ? undefined :
|
|
326
|
+
const answerOrigin = input.optionsCredentialOrigin === undefined ? undefined : requestOriginOf(input.optionsCredentialOrigin);
|
|
316
327
|
const { credential, answered } = resolveCredentialSource(input);
|
|
317
328
|
if (answerOrigin !== undefined)
|
|
318
329
|
return withAnswerOrigin(credential, answerOrigin, answered);
|
|
@@ -351,16 +362,17 @@ function resolveFallbackSource(modelHeaders, configApiKey, configHeaders) {
|
|
|
351
362
|
return { source: "absent" };
|
|
352
363
|
}
|
|
353
364
|
export const KEYLESS_EXIT = "hand it none — answer an empty apiKey and no credential header (this works under any brain; a brain configured with neither a baseUrl nor a credential of its own also accepts no apiKey at all), because a placeholder word handed in its place is still a credential and binds like any other";
|
|
354
|
-
function plaintextRefusal(model, credential, request, shown) {
|
|
355
|
-
if (credential.apiKey === undefined && credential.headersBorne !== true)
|
|
356
|
-
return undefined;
|
|
365
|
+
function plaintextRefusal(model, credential, request, shown, keylessDoorOpen) {
|
|
357
366
|
const parsed = request === "" ? undefined : servableParse(request);
|
|
358
367
|
if (parsed === undefined || !crossesNetworkInClear(parsed))
|
|
359
368
|
return undefined;
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
369
|
+
const carrier = credentialCarrierOf(credential);
|
|
370
|
+
if (carrier === undefined)
|
|
371
|
+
return undefined;
|
|
372
|
+
const carried = carrier === "apiKey" ? "its key" : "its credential header";
|
|
373
|
+
const without = !keylessDoorOpen
|
|
374
|
+
? ""
|
|
375
|
+
: `; if the endpoint takes no credential, ${credential.source === "deployment-config" ? "construct the brain with no apiKey and no credential header" : KEYLESS_EXIT}`;
|
|
364
376
|
return {
|
|
365
377
|
ok: false,
|
|
366
378
|
code: PROTOCOL_PLAINTEXT_CREDENTIALS_CODE,
|
|
@@ -371,11 +383,11 @@ function plaintextRefusal(model, credential, request, shown) {
|
|
|
371
383
|
configBaseUrl: shown.declared,
|
|
372
384
|
fixHint: `model "${model.id}" targets ${shown.request}, which is not https and not this machine — the request would carry ${carried} ` +
|
|
373
385
|
`across a network in the clear: declare the root as an https url, or serve the endpoint on this machine (localhost, ` +
|
|
374
|
-
`127.0.0.0/8, ::1)
|
|
386
|
+
`127.0.0.0/8, ::1)${without}`,
|
|
375
387
|
},
|
|
376
388
|
};
|
|
377
389
|
}
|
|
378
|
-
function originMismatch(model, boundOrigin, requestOrigin, shown, boundBy) {
|
|
390
|
+
function originMismatch(model, boundOrigin, requestOrigin, shown, boundBy, keylessDoorOpen) {
|
|
379
391
|
const boundShown = displayUrlOf(boundOrigin);
|
|
380
392
|
const requestOriginShown = displayUrlOf(requestOrigin);
|
|
381
393
|
const fixHint = boundBy === "generation"
|
|
@@ -395,7 +407,7 @@ function originMismatch(model, boundOrigin, requestOrigin, shown, boundBy) {
|
|
|
395
407
|
`does not follow its entry to another host: change ` +
|
|
396
408
|
`the entry's credential reference in the same step as its baseUrl (a new credential is a new binding), or point the entry ` +
|
|
397
409
|
`back at ${boundShown}; ` +
|
|
398
|
-
`if the endpoint takes no credential, ${KEYLESS_EXIT}; ` +
|
|
410
|
+
`${keylessDoorOpen ? `if the endpoint takes no credential, ${KEYLESS_EXIT}; ` : ""}` +
|
|
399
411
|
`a provider that only moved domains and accepts the same credential there needs the host's ` +
|
|
400
412
|
`explicit rebind (rebindCredentialOrigin) where the host offers one, otherwise an engine restart`;
|
|
401
413
|
return {
|
|
@@ -419,12 +431,14 @@ export function adjudicateModelRoute(model, credential, config) {
|
|
|
419
431
|
const declaredShown = displayUrlOf(declared);
|
|
420
432
|
const requestShown = displayUrlOf(request);
|
|
421
433
|
const shown = { entry: entryShown, request: requestShown, declared: declaredShown };
|
|
434
|
+
const required = credentialRequiredBy(config);
|
|
422
435
|
const facts = resolvedCredentialFacts.get(credential);
|
|
423
436
|
const requestOrigin = routeOriginOf(request);
|
|
424
437
|
if (facts?.answerOrigin !== undefined && facts.answerOrigin !== requestOrigin)
|
|
425
|
-
return originMismatch(model, facts.answerOrigin, requestOrigin, shown, "declaration");
|
|
438
|
+
return originMismatch(model, facts.answerOrigin, requestOrigin, shown, "declaration", !required);
|
|
426
439
|
const unsettled = facts?.originUnsettled;
|
|
427
|
-
const unsettledRefusal = () => unsettled === undefined || boundHere(unsettled.own, requestOrigin) ? undefined : originMismatch(model, "", requestOrigin, shown, "generation");
|
|
440
|
+
const unsettledRefusal = () => unsettled === undefined || boundHere(unsettled.own, requestOrigin) ? undefined : originMismatch(model, "", requestOrigin, shown, "generation", !required);
|
|
441
|
+
const servable = (posture) => required && credentialCarrierOf(credential) === undefined ? requiredCredentialMissing(model, shown) : { ok: true, posture };
|
|
428
442
|
if (credential.source === "per-model") {
|
|
429
443
|
const conflict = facts?.keyHeaderConflict;
|
|
430
444
|
if (conflict !== undefined) {
|
|
@@ -441,24 +455,24 @@ export function adjudicateModelRoute(model, credential, config) {
|
|
|
441
455
|
},
|
|
442
456
|
};
|
|
443
457
|
}
|
|
444
|
-
const plaintext = plaintextRefusal(model, credential, request, shown);
|
|
458
|
+
const plaintext = plaintextRefusal(model, credential, request, shown, !required);
|
|
445
459
|
if (plaintext !== undefined)
|
|
446
460
|
return plaintext;
|
|
447
461
|
const identities = facts?.identities;
|
|
448
462
|
const boundOrigin = identities === undefined || requestOrigin === "" || facts?.identitiesAnswered === true ? undefined : boundElsewhere(identities, requestOrigin);
|
|
449
463
|
if (boundOrigin !== undefined)
|
|
450
|
-
return originMismatch(model, boundOrigin, requestOrigin, shown, "table");
|
|
451
|
-
return unsettledRefusal() ??
|
|
464
|
+
return originMismatch(model, boundOrigin, requestOrigin, shown, "table", !required);
|
|
465
|
+
return unsettledRefusal() ?? servable("per-model");
|
|
452
466
|
}
|
|
453
467
|
const unsettledOther = unsettledRefusal();
|
|
454
468
|
if (unsettledOther !== undefined)
|
|
455
469
|
return unsettledOther;
|
|
456
470
|
if (credential.source === "deployment-config") {
|
|
457
|
-
const plaintext = plaintextRefusal(model, credential, request, shown);
|
|
471
|
+
const plaintext = plaintextRefusal(model, credential, request, shown, !required);
|
|
458
472
|
if (plaintext !== undefined)
|
|
459
473
|
return plaintext;
|
|
460
474
|
if (request !== "" && request === deploymentRoot)
|
|
461
|
-
return
|
|
475
|
+
return servable("paired");
|
|
462
476
|
const pairedWith = declared !== ""
|
|
463
477
|
? `is paired with ${declaredShown}`
|
|
464
478
|
: deploymentRoot !== ""
|
|
@@ -480,7 +494,7 @@ export function adjudicateModelRoute(model, credential, config) {
|
|
|
480
494
|
};
|
|
481
495
|
}
|
|
482
496
|
if (declared === "" || entry === "" || request === declared)
|
|
483
|
-
return
|
|
497
|
+
return servable("keyless");
|
|
484
498
|
return {
|
|
485
499
|
ok: false,
|
|
486
500
|
code: "route.credential_missing",
|
|
@@ -495,6 +509,22 @@ export function adjudicateModelRoute(model, credential, config) {
|
|
|
495
509
|
},
|
|
496
510
|
};
|
|
497
511
|
}
|
|
512
|
+
function requiredCredentialMissing(model, shown) {
|
|
513
|
+
return {
|
|
514
|
+
ok: false,
|
|
515
|
+
code: "route.credential_missing",
|
|
516
|
+
detail: {
|
|
517
|
+
modelId: model.id,
|
|
518
|
+
entryBaseUrl: shown.entry,
|
|
519
|
+
requestBaseUrl: shown.request,
|
|
520
|
+
configBaseUrl: shown.declared,
|
|
521
|
+
fixHint: `model "${model.id}" targets ${shown.request || "no root"} but the request carries no credential — no key and no credential header ` +
|
|
522
|
+
`with a value (a blank one is none) — and this brain is constructed to send no request without one (requireCredential): give ` +
|
|
523
|
+
`the model its own credential (a per-model key via getApiKeyAndHeaders, or an auth header on Model.headers), or, for a model on ` +
|
|
524
|
+
`the brain's own root, a deployment credential (config.apiKey or a credential header in config.headers)`,
|
|
525
|
+
},
|
|
526
|
+
};
|
|
527
|
+
}
|
|
498
528
|
export function routeRefusalText(verdict) {
|
|
499
529
|
return `${verdict.code}: ${verdict.detail.fixHint}`;
|
|
500
530
|
}
|
|
@@ -572,8 +602,12 @@ export function readRouteJudgment(ask, modelId) {
|
|
|
572
602
|
}
|
|
573
603
|
export function admitRouteRequest(model, credential, config) {
|
|
574
604
|
const judged = { id: model.id, baseUrl: model.baseUrl };
|
|
575
|
-
const { baseUrl, laneDefault } = config;
|
|
576
|
-
const pairing = {
|
|
605
|
+
const { baseUrl, laneDefault, requireCredential } = config;
|
|
606
|
+
const pairing = {
|
|
607
|
+
...(baseUrl !== undefined ? { baseUrl } : {}),
|
|
608
|
+
...(laneDefault !== undefined ? { laneDefault } : {}),
|
|
609
|
+
...(requireCredential !== undefined ? { requireCredential } : {}),
|
|
610
|
+
};
|
|
577
611
|
const judgeOrRefuse = () => {
|
|
578
612
|
const verdict = adjudicateModelRoute(judged, credential, pairing);
|
|
579
613
|
if (!verdict.ok)
|
|
@@ -589,56 +623,159 @@ export function admitRouteRequest(model, credential, config) {
|
|
|
589
623
|
bindCredentialOrigin(identities, requestOrigin);
|
|
590
624
|
};
|
|
591
625
|
}
|
|
626
|
+
export const CREDENTIAL_REBIND_OUTCOMES = Object.freeze(["rebound", "unchanged", "withheld", "none"]);
|
|
592
627
|
function rebindRefusal(modelId, why) {
|
|
593
628
|
return Object.assign(new Error(`rebindCredentialOrigin: model "${modelId}" — ${why}; nothing was rebound`), { code: "config.invalid_argument" });
|
|
594
629
|
}
|
|
595
|
-
|
|
630
|
+
function rebindReadingOf(model, perModelAuth, configs) {
|
|
596
631
|
const judged = { id: model.id, baseUrl: model.baseUrl };
|
|
597
632
|
if (typeof judged.id !== "string")
|
|
598
633
|
throw new TypeError(`rebindCredentialOrigin: model.id must be a string (got ${typeof judged.id})`);
|
|
599
|
-
const
|
|
600
|
-
const
|
|
634
|
+
const modelHeaders = headerBagOnce(model.headers);
|
|
635
|
+
const answerHeaders = headerBagOnce(perModelAuth?.headers);
|
|
601
636
|
const answerKey = perModelAuth?.apiKey;
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
637
|
+
const origins = [];
|
|
638
|
+
let noRoot;
|
|
639
|
+
for (const config of configs) {
|
|
640
|
+
const { baseUrl, laneDefault } = config;
|
|
641
|
+
credentialRequiredBy(config);
|
|
642
|
+
for (const [name, half] of [["baseUrl", baseUrl], ["laneDefault", laneDefault]]) {
|
|
643
|
+
if (half !== undefined && typeof half !== "string")
|
|
644
|
+
throw new TypeError(`rebindCredentialOrigin: config.${name} must be a string (got ${half === null ? "null" : typeof half})`);
|
|
645
|
+
}
|
|
646
|
+
const pairing = { ...(baseUrl !== undefined ? { baseUrl } : {}), ...(laneDefault !== undefined ? { laneDefault } : {}) };
|
|
647
|
+
const request = routeHalves(judged, pairing).request;
|
|
648
|
+
let root;
|
|
649
|
+
try {
|
|
650
|
+
const chosen = resolveRequestRootOf(judged.baseUrl, pairing.baseUrl, pairing.laneDefault);
|
|
651
|
+
root = chosen.root;
|
|
652
|
+
if (chosen.origin === "lane-default" && root.trim() !== "")
|
|
653
|
+
judgeRequestRoot(pairing.laneDefault, "config.laneDefault");
|
|
654
|
+
}
|
|
655
|
+
catch (e) {
|
|
656
|
+
if (!(e instanceof BrainError))
|
|
657
|
+
throw e;
|
|
658
|
+
noRoot ??= e.message.replace(/^\[[a-z_]+\] /, "");
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (root.trim() === "") {
|
|
662
|
+
noRoot ??= "it targets no root (the entry's baseUrl and the brain's root are both unset)";
|
|
663
|
+
continue;
|
|
664
|
+
}
|
|
665
|
+
const origin = routeOriginOf(request);
|
|
666
|
+
if (!origins.includes(origin))
|
|
667
|
+
origins.push(origin);
|
|
624
668
|
}
|
|
625
|
-
|
|
669
|
+
return { id: judged.id, origins, ...(noRoot !== undefined ? { noRoot } : {}), bags: { answerKey, answerHeaders, modelHeaders } };
|
|
670
|
+
}
|
|
671
|
+
function rebindIdentitiesOf(bags) {
|
|
672
|
+
return resolvedCredentialFacts.get(resolveRouteCredential({ optionsApiKey: bags.answerKey, optionsHeaders: bags.answerHeaders, modelHeaders: bags.modelHeaders }))?.identities ?? [];
|
|
673
|
+
}
|
|
674
|
+
function rebindAccountOf(reading) {
|
|
626
675
|
const table = credentialOriginTable();
|
|
627
|
-
const before = identities.map((id) => table.get(id));
|
|
628
|
-
const changed = before.some((bound) => bound !== origin);
|
|
629
|
-
const previous = [...new Set(before.filter((bound) => bound !== undefined && bound !== origin))].map(displayUrlOf);
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
676
|
+
const before = reading.identities.map((id) => table.get(id));
|
|
677
|
+
const changed = before.some((bound) => bound !== reading.origin);
|
|
678
|
+
const previous = [...new Set(before.filter((bound) => bound !== undefined && bound !== reading.origin))].map(displayUrlOf);
|
|
679
|
+
return Object.freeze({ origin: displayUrlOf(reading.origin), previous: Object.freeze(previous), changed });
|
|
680
|
+
}
|
|
681
|
+
function rebindNoticeOf(id, account) {
|
|
682
|
+
const { previous } = account;
|
|
683
|
+
return {
|
|
634
684
|
code: "route.credential_rebound",
|
|
635
|
-
message: `The host rebound the credential of model "${
|
|
636
|
-
`${previous.length > 0 ? ` (it was bound to ${previous.join(", ")})` : ""}: a request carrying it is sent to ${
|
|
685
|
+
message: `The host rebound the credential of model "${id}" to ${account.origin}` +
|
|
686
|
+
`${previous.length > 0 ? ` (it was bound to ${previous.join(", ")})` : ""}: a request carrying it is sent to ${account.origin} only — ` +
|
|
637
687
|
`any other entry that carries the same credential and still targets another host is refused.`,
|
|
638
|
-
detail: { modelId:
|
|
639
|
-
}
|
|
688
|
+
detail: { modelId: id, origin: account.origin, previous: [...previous], occurrenceId: uuidv7() },
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function applyRebind(identities, origin, notice, onNotice) {
|
|
692
|
+
deliverEngineNotice(onNotice, notice);
|
|
640
693
|
bindCredentialOrigin(identities, origin);
|
|
641
|
-
|
|
694
|
+
}
|
|
695
|
+
export function rebindCredentialOrigin(first, second, config, onNotice) {
|
|
696
|
+
if (Array.isArray(first))
|
|
697
|
+
return rebindGeneration(first, second);
|
|
698
|
+
const reading = rebindReadingOf(first, second, [config]);
|
|
699
|
+
const origin = reading.origins[0];
|
|
700
|
+
if (origin === undefined)
|
|
701
|
+
throw rebindRefusal(reading.id, reading.noRoot ?? "it targets no root");
|
|
702
|
+
const identities = rebindIdentitiesOf(reading.bags);
|
|
703
|
+
if (identities.length === 0) {
|
|
704
|
+
throw rebindRefusal(reading.id, "neither the hook's answer nor the entry carries a secret of its own (no per-model credential, or the keyless door) — only a per-model credential is bound to an origin");
|
|
705
|
+
}
|
|
706
|
+
const account = rebindAccountOf({ identities, origin });
|
|
707
|
+
if (account.changed)
|
|
708
|
+
applyRebind(identities, origin, rebindNoticeOf(reading.id, account), onNotice);
|
|
709
|
+
return account;
|
|
710
|
+
}
|
|
711
|
+
function rebindGeneration(entries, onNotice) {
|
|
712
|
+
const count = entries.length;
|
|
713
|
+
const slots = [];
|
|
714
|
+
for (let i = 0; i < count; i++)
|
|
715
|
+
slots.push(entries[i]);
|
|
716
|
+
const handed = [];
|
|
717
|
+
slots.forEach((entry, i) => {
|
|
718
|
+
const objectOr = (value, what) => {
|
|
719
|
+
if (typeof value !== "object" || value === null)
|
|
720
|
+
throw new TypeError(`rebindCredentialOrigin: entries[${i}]${what} must be an object (got ${value === null ? "null" : typeof value})`);
|
|
721
|
+
};
|
|
722
|
+
objectOr(entry, "");
|
|
723
|
+
const { model, perModelAuth, configs } = entry;
|
|
724
|
+
objectOr(model, ".model");
|
|
725
|
+
if (perModelAuth !== undefined)
|
|
726
|
+
objectOr(perModelAuth, ".perModelAuth");
|
|
727
|
+
const n = Array.isArray(configs) ? configs.length : 0;
|
|
728
|
+
if (n === 0)
|
|
729
|
+
throw new TypeError(`rebindCredentialOrigin: entries[${i}].configs must be a non-empty array of pairing configs`);
|
|
730
|
+
const own = [];
|
|
731
|
+
for (let c = 0; c < n; c++) {
|
|
732
|
+
const config = configs[c];
|
|
733
|
+
objectOr(config, `.configs[${c}]`);
|
|
734
|
+
own.push(config);
|
|
735
|
+
}
|
|
736
|
+
handed.push({ model, perModelAuth, configs: own });
|
|
737
|
+
});
|
|
738
|
+
const readings = handed.map(({ model, perModelAuth, configs }) => rebindReadingOf(model, perModelAuth, configs));
|
|
739
|
+
const identitiesOf = readings.map((reading) => rebindIdentitiesOf(reading.bags));
|
|
740
|
+
const originsOf = new Map();
|
|
741
|
+
const holdersOf = new Map();
|
|
742
|
+
const firstNamed = new Map();
|
|
743
|
+
readings.forEach((reading, i) => {
|
|
744
|
+
for (const origin of reading.origins)
|
|
745
|
+
if (!firstNamed.has(origin))
|
|
746
|
+
firstNamed.set(origin, firstNamed.size);
|
|
747
|
+
for (const id of identitiesOf[i] ?? []) {
|
|
748
|
+
holdersOf.set(id, (holdersOf.get(id) ?? new Set()).add(i));
|
|
749
|
+
for (const origin of reading.origins)
|
|
750
|
+
originsOf.set(id, (originsOf.get(id) ?? new Set()).add(origin));
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
const judged = [];
|
|
754
|
+
readings.forEach((reading, i) => {
|
|
755
|
+
const identities = identitiesOf[i] ?? [];
|
|
756
|
+
if (identities.length === 0 || reading.origins.length === 0) {
|
|
757
|
+
judged.push({ alignment: alignmentOf(reading.id, "none") });
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
const spread = [...new Set(identities.flatMap((id) => [...(originsOf.get(id) ?? [])]))].sort((a, b) => (firstNamed.get(a) ?? 0) - (firstNamed.get(b) ?? 0));
|
|
761
|
+
if (spread.length > 1) {
|
|
762
|
+
const contested = identities.filter((id) => (originsOf.get(id)?.size ?? 0) > 1);
|
|
763
|
+
const peers = [...new Set(contested.flatMap((id) => [...(holdersOf.get(id) ?? [])]))].filter((j) => j !== i).sort((a, b) => a - b);
|
|
764
|
+
judged.push({ alignment: Object.freeze({ ...alignmentOf(reading.id, "withheld"), origins: Object.freeze(spread.map(displayUrlOf)), peers: Object.freeze(peers) }) });
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
const origin = spread[0];
|
|
768
|
+
const account = rebindAccountOf({ identities, origin });
|
|
769
|
+
const alignment = Object.freeze({ ...alignmentOf(reading.id, account.changed ? "rebound" : "unchanged"), origin: account.origin, previous: account.changed ? account.previous : Object.freeze([]) });
|
|
770
|
+
judged.push(account.changed ? { alignment, write: { identities, origin, notice: rebindNoticeOf(reading.id, account) } } : { alignment });
|
|
771
|
+
});
|
|
772
|
+
for (const { write } of judged)
|
|
773
|
+
if (write !== undefined)
|
|
774
|
+
applyRebind(write.identities, write.origin, write.notice, onNotice);
|
|
775
|
+
return Object.freeze(judged.map(({ alignment }) => alignment));
|
|
776
|
+
}
|
|
777
|
+
function alignmentOf(modelId, outcome) {
|
|
778
|
+
return Object.freeze({ modelId, outcome, previous: Object.freeze([]) });
|
|
642
779
|
}
|
|
643
780
|
export function applyRouteCredentialHeaders(merged, credential) {
|
|
644
781
|
if (credential.source === "per-model") {
|
|
@@ -667,18 +804,22 @@ export function brainConfigSnapshot(given, subject) {
|
|
|
667
804
|
return snapshot;
|
|
668
805
|
}
|
|
669
806
|
export function createBrainRouteJudge(config) {
|
|
807
|
+
const requireCredential = credentialRequiredBy(config);
|
|
670
808
|
return (model, perModelAuth) => {
|
|
809
|
+
const routed = { id: model.id, baseUrl: model.baseUrl };
|
|
810
|
+
const modelHeaders = headerBagOnce(model.headers);
|
|
811
|
+
const optionsHeaders = headerBagOnce(perModelAuth?.headers);
|
|
671
812
|
const credential = resolveRouteCredential({
|
|
672
813
|
optionsApiKey: perModelAuth?.apiKey,
|
|
673
|
-
optionsHeaders
|
|
674
|
-
|
|
814
|
+
optionsHeaders,
|
|
815
|
+
optionsCredentialOrigin: perModelAuth?.credentialOrigin,
|
|
816
|
+
optionsCredentialOriginUnsettled: perModelAuth?.credentialOriginUnsettled === true,
|
|
817
|
+
modelHeaders,
|
|
675
818
|
configApiKey: config.apiKey,
|
|
676
819
|
configHeaders: config.headers,
|
|
677
820
|
keyHeader: config.keyHeader,
|
|
678
|
-
...(perModelAuth?.credentialOrigin !== undefined ? { optionsCredentialOrigin: perModelAuth.credentialOrigin } : {}),
|
|
679
|
-
...(perModelAuth?.credentialOriginUnsettled === true ? { optionsCredentialOriginUnsettled: true } : {}),
|
|
680
821
|
});
|
|
681
|
-
return adjudicateModelRoute(
|
|
822
|
+
return adjudicateModelRoute(routed, credential, { baseUrl: config.baseUrl, laneDefault: config.laneDefault, requireCredential });
|
|
682
823
|
};
|
|
683
824
|
}
|
|
684
825
|
const BROKEN_PAIRING_STATUS = {
|
|
@@ -738,7 +879,7 @@ function servableCredentialOrigin(value, modelId) {
|
|
|
738
879
|
}
|
|
739
880
|
if (judged === undefined)
|
|
740
881
|
throw refused("is empty");
|
|
741
|
-
return
|
|
882
|
+
return requestOriginOf(judged.trimmed);
|
|
742
883
|
}
|
|
743
884
|
export async function adjudicateDerivedRoute(args) {
|
|
744
885
|
const judge = args.brain.adjudicateRoute;
|
|
@@ -160,6 +160,41 @@ export const ROUTE_ADJUDICATION_CONFORMANCE_CORPUS = [
|
|
|
160
160
|
expect: { ok: false, code: "route.credential_missing" },
|
|
161
161
|
leg: "derived",
|
|
162
162
|
},
|
|
163
|
+
{
|
|
164
|
+
name: "required-absent-on-root",
|
|
165
|
+
intent: "no credential anywhere, on the deployment's own root, under a brain that requires one — refused where it would have been keyless",
|
|
166
|
+
model: { id: "m-req", baseUrl: "" },
|
|
167
|
+
credential: { source: "absent" },
|
|
168
|
+
config: { baseUrl: "https://gw.example.com", requireCredential: true },
|
|
169
|
+
expect: { ok: false, code: "route.credential_missing" },
|
|
170
|
+
leg: "named",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "required-keyless-door-per-model",
|
|
174
|
+
intent: "a per-model answer that holds its rank and carries nothing (a blank key) under a brain that requires a credential — refused; the deployment's key does not ride in its place",
|
|
175
|
+
model: { id: "m-req", baseUrl: "https://gw.example.com" },
|
|
176
|
+
credential: { source: "per-model" },
|
|
177
|
+
config: { baseUrl: "https://gw.example.com", requireCredential: true },
|
|
178
|
+
expect: { ok: false, code: "route.credential_missing" },
|
|
179
|
+
leg: "named",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "required-keyless-door-deployment",
|
|
183
|
+
intent: "a deployment credential that is blank, on its own root, under a brain that requires one — refused where it would have been paired",
|
|
184
|
+
model: { id: "m-req", baseUrl: "" },
|
|
185
|
+
credential: { source: "deployment-config" },
|
|
186
|
+
config: { baseUrl: "https://gw.example.com", requireCredential: true },
|
|
187
|
+
expect: { ok: false, code: "route.credential_missing" },
|
|
188
|
+
leg: "named",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "required-credential-carried",
|
|
192
|
+
intent: "a credential that rides is servable under a brain that requires one: the declaration refuses nothing else",
|
|
193
|
+
model: { id: "m-req", baseUrl: "https://gw.example.com" },
|
|
194
|
+
credential: { source: "per-model", apiKey: "k-req" },
|
|
195
|
+
config: { baseUrl: "https://gw.example.com", requireCredential: true },
|
|
196
|
+
expect: { ok: true, posture: "per-model" },
|
|
197
|
+
},
|
|
163
198
|
{
|
|
164
199
|
name: "plaintext-credential-off-machine",
|
|
165
200
|
intent: "a credential (here the deployment key, on its own paired root) to a plain-http root off this machine is refused: it would cross the network in the clear — a private-range address is not exempt",
|
package/dist/brain/routing.js
CHANGED
|
@@ -94,11 +94,11 @@ export function createRoutingBrain(routes, opts = {}) {
|
|
|
94
94
|
const placed = place(model);
|
|
95
95
|
return "target" in placed ? completeOf(placed.target)(model, context, options) : placed.refused;
|
|
96
96
|
};
|
|
97
|
-
const adjudicateRoute = (model, perModelAuth) => {
|
|
97
|
+
const adjudicateRoute = (model, perModelAuth, dispatch) => {
|
|
98
98
|
const resolved = resolveTarget(model);
|
|
99
99
|
if (!("target" in resolved))
|
|
100
100
|
return undefined;
|
|
101
|
-
return resolved.target === undefined ? unservedRefusal(model, by, routeKeyOf(model, by)) : resolved.target.adjudicateRoute?.(model, perModelAuth);
|
|
101
|
+
return resolved.target === undefined ? unservedRefusal(model, by, routeKeyOf(model, by)) : resolved.target.adjudicateRoute?.(model, perModelAuth, dispatch);
|
|
102
102
|
};
|
|
103
103
|
return { stream, complete, adjudicateRoute };
|
|
104
104
|
}
|