@sema-agent/core 7.66.0 → 7.67.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 +3498 -0
- package/LICENSE +2 -1
- package/dist/agents/agent-definition.js +2 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/agent-transcript-tool.js +4 -3
- package/dist/agents/builtin-agents.d.ts +10 -7
- package/dist/agents/builtin-agents.js +1 -0
- package/dist/agents/cascade.d.ts +24 -11
- package/dist/agents/cascade.js +21 -9
- package/dist/agents/child-failure.d.ts +30 -0
- package/dist/agents/child-failure.js +25 -1
- package/dist/agents/composition-placement.d.ts +6 -2
- package/dist/agents/composition-placement.js +7 -3
- package/dist/agents/cross-session-envelope.d.ts +10 -1
- package/dist/agents/cross-session-envelope.js +6 -2
- package/dist/agents/cross-session-judge.d.ts +7 -1
- package/dist/agents/cross-session-judge.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +36 -2
- package/dist/agents/cumulative-stats.js +44 -9
- package/dist/agents/delegation-registry-seat.js +2 -3
- package/dist/agents/inherited-tool-pool.d.ts +9 -4
- package/dist/agents/inherited-tool-pool.js +7 -1
- package/dist/agents/leg-label.d.ts +28 -0
- package/dist/agents/leg-label.js +9 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/list-agents-tool.js +4 -4
- package/dist/agents/org-delivery-gate.d.ts +129 -23
- package/dist/agents/org-delivery-gate.js +41 -20
- package/dist/agents/peer-held-queue.d.ts +15 -10
- package/dist/agents/peer-held-queue.js +47 -19
- package/dist/agents/peer-notice-route.js +2 -2
- package/dist/agents/peer-notices.d.ts +13 -2
- package/dist/agents/peer-notices.js +12 -2
- package/dist/agents/peer-session-drain.d.ts +65 -15
- package/dist/agents/peer-session-drain.js +198 -41
- package/dist/agents/read-inbox-tool.d.ts +3 -2
- package/dist/agents/read-inbox-tool.js +7 -5
- package/dist/agents/repair-loop.js +20 -16
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/retain-ledger.js +2 -4
- package/dist/agents/root-session-lane.d.ts +27 -0
- package/dist/agents/root-session-lane.js +57 -0
- package/dist/agents/roster-store.js +1 -2
- package/dist/agents/send-message-tool.js +6 -4
- package/dist/agents/subagent.d.ts +20 -4
- package/dist/agents/subagent.js +218 -183
- package/dist/agents/tool-filter.d.ts +3 -10
- package/dist/agents/tool-filter.js +0 -13
- package/dist/agents/verifier-independence.d.ts +31 -0
- package/dist/agents/verifier-independence.js +23 -0
- package/dist/agents/verify.d.ts +23 -11
- package/dist/agents/verify.js +28 -12
- package/dist/agents/yield-adoption.d.ts +24 -0
- package/dist/agents/yield-adoption.js +84 -0
- package/dist/bench/metrics.d.ts +2 -2
- package/dist/brain/anthropic.d.ts +4 -2
- package/dist/brain/anthropic.js +49 -35
- package/dist/brain/brain-faces.d.ts +11 -0
- package/dist/brain/brain-faces.js +6 -0
- package/dist/brain/cache-retention.d.ts +2 -0
- package/dist/brain/cache-retention.js +9 -0
- package/dist/brain/circuit-breaker.js +51 -26
- package/dist/brain/errors.d.ts +15 -1
- package/dist/brain/errors.js +8 -0
- package/dist/brain/failover.d.ts +6 -0
- package/dist/brain/failover.js +52 -37
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +4 -0
- package/dist/brain/model-capability.d.ts +2 -1
- package/dist/brain/model-lane.d.ts +145 -0
- package/dist/brain/model-lane.js +444 -0
- package/dist/brain/open-responses.js +19 -22
- package/dist/brain/openai.js +23 -22
- package/dist/brain/provider-message.d.ts +9 -0
- package/dist/brain/provider-message.js +18 -0
- package/dist/brain/reasoning-request.d.ts +9 -7
- package/dist/brain/reasoning-request.js +9 -10
- package/dist/brain/reasoning.d.ts +47 -13
- package/dist/brain/reasoning.js +20 -10
- package/dist/brain/route-adjudicator.d.ts +8 -2
- package/dist/brain/route-adjudicator.js +35 -1
- package/dist/brain/route-conformance.js +17 -0
- package/dist/brain/routing.d.ts +2 -0
- package/dist/brain/routing.js +19 -8
- package/dist/brain/status-sink.d.ts +5 -4
- package/dist/brain/status-sink.js +2 -2
- package/dist/brain/stream-engine.js +8 -2
- package/dist/brain/stream-shared.d.ts +12 -0
- package/dist/brain/stream-shared.js +18 -0
- package/dist/brain/timeout.d.ts +28 -0
- package/dist/brain/timeout.js +13 -4
- package/dist/brain/tool-schema-projection.d.ts +2 -0
- package/dist/brain/tool-schema-projection.js +108 -0
- package/dist/brain/usage-reading.d.ts +49 -0
- package/dist/brain/usage-reading.js +44 -0
- package/dist/brain/usage-reasoning.d.ts +38 -0
- package/dist/brain/usage-reasoning.js +9 -0
- package/dist/config/catalog.d.ts +3 -0
- package/dist/config/catalog.js +18 -9
- package/dist/core/a2a.d.ts +22 -4
- package/dist/core/a2a.js +191 -50
- package/dist/core/agent-definition.d.ts +3 -1
- package/dist/core/agent-state.d.ts +29 -16
- package/dist/core/agent-state.js +36 -9
- package/dist/core/allow-entry.d.ts +12 -3
- package/dist/core/allow-entry.js +10 -3
- package/dist/core/approval-display.d.ts +18 -0
- package/dist/core/approval-display.js +26 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/approval-route.d.ts +16 -0
- package/dist/core/approval-route.js +5 -0
- package/dist/core/approval-words.d.ts +43 -0
- package/dist/core/approval-words.js +37 -0
- package/dist/core/ask-origin.d.ts +37 -10
- package/dist/core/ask-origin.js +19 -7
- package/dist/core/ask-question.d.ts +36 -8
- package/dist/core/ask-question.js +24 -9
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/ask-unresolvable-notice.js +3 -2
- package/dist/core/attachment-source.d.ts +50 -0
- package/dist/core/attachment-source.js +46 -0
- package/dist/core/auto-compaction.d.ts +151 -40
- package/dist/core/auto-compaction.js +115 -50
- package/dist/core/auto-mode.d.ts +5 -0
- package/dist/core/auto-mode.js +11 -4
- package/dist/core/background-agent-store.d.ts +151 -23
- package/dist/core/background-agent-store.js +201 -61
- package/dist/core/background-shell.d.ts +4 -1
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.d.ts +49 -25
- package/dist/core/cache-break-detector.js +99 -44
- package/dist/core/caller-text.d.ts +28 -0
- package/dist/core/caller-text.js +12 -0
- package/dist/core/canonical-json.d.ts +5 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +80 -9
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +8 -1
- package/dist/core/checkpoint-generation.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +47 -14
- package/dist/core/checkpoint-queries.js +63 -30
- package/dist/core/checkpoint-requirements.d.ts +36 -3
- package/dist/core/checkpoint-requirements.js +11 -1
- package/dist/core/checkpoint-row-verdict.d.ts +0 -2
- package/dist/core/checkpoint-row-verdict.js +5 -8
- package/dist/core/checkpoint-store.d.ts +166 -41
- package/dist/core/checkpoint-store.js +96 -15
- package/dist/core/child-clamp-seats.d.ts +10 -2
- package/dist/core/child-clamp-seats.js +2 -2
- package/dist/core/classifier-unavailable-arm.d.ts +11 -9
- package/dist/core/classifier-unavailable-arm.js +4 -2
- package/dist/core/command-sandbox-dispatch.d.ts +13 -0
- package/dist/core/command-sandbox-dispatch.js +8 -0
- package/dist/core/command-sandbox.d.ts +231 -0
- package/dist/core/command-sandbox.js +344 -0
- package/dist/core/completion-id.d.ts +21 -0
- package/dist/core/completion-id.js +14 -0
- package/dist/core/config-refusal-codes.d.ts +22 -0
- package/dist/core/config-refusal-codes.js +196 -0
- package/dist/core/context-edit.d.ts +26 -0
- package/dist/core/context-edit.js +4 -2
- package/dist/core/context-guard.d.ts +80 -7
- package/dist/core/context-guard.js +126 -25
- package/dist/core/context-settings.d.ts +32 -0
- package/dist/core/context-settings.js +41 -3
- package/dist/core/contract-faces.d.ts +22 -0
- package/dist/core/contract-faces.js +1 -0
- package/dist/core/credential-echo.d.ts +2 -2
- package/dist/core/credential-echo.js +2 -2
- package/dist/core/cross-boundary-taint.d.ts +10 -8
- package/dist/core/decision-receipt.d.ts +3 -2
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/definition-entry-grammar.d.ts +42 -0
- package/dist/core/definition-entry-grammar.js +15 -0
- package/dist/core/engine-attestation.d.ts +19 -4
- package/dist/core/engine-attestation.js +4 -0
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-contracts/open-face-contract.d.ts +39 -0
- package/dist/core/engine-contracts/open-face-contract.js +57 -0
- package/dist/core/engine-notice.d.ts +161 -33
- package/dist/core/exclusive-temp.d.ts +25 -0
- package/dist/core/exclusive-temp.js +19 -0
- package/dist/core/existing-target.d.ts +112 -0
- package/dist/core/existing-target.js +88 -0
- package/dist/core/file-history-store.d.ts +14 -6
- package/dist/core/gate-lanes.js +8 -3
- package/dist/core/gate-outcome.d.ts +2 -1
- package/dist/core/git-worktree-env.d.ts +92 -1
- package/dist/core/git-worktree-env.js +87 -6
- package/dist/core/governance-codes.d.ts +49 -8
- package/dist/core/governance-codes.js +59 -8
- package/dist/core/hands-band.d.ts +10 -6
- package/dist/core/hooks.d.ts +60 -6
- package/dist/core/hooks.js +10 -2
- package/dist/core/host-floor.d.ts +24 -8
- package/dist/core/host-floor.js +45 -16
- package/dist/core/human-input-projection.d.ts +7 -0
- package/dist/core/human-input-projection.js +11 -3
- package/dist/core/image-admission.d.ts +16 -4
- package/dist/core/image-admission.js +29 -17
- package/dist/core/input-author.d.ts +43 -1
- package/dist/core/input-author.js +19 -0
- package/dist/core/isolation-scope.d.ts +41 -0
- package/dist/core/isolation-scope.js +10 -0
- package/dist/core/json-schema-seats.d.ts +11 -0
- package/dist/core/json-schema-seats.js +5 -0
- package/dist/core/leg-identity.d.ts +53 -5
- package/dist/core/leg-identity.js +32 -1
- package/dist/core/locked-config.d.ts +33 -38
- package/dist/core/locked-config.js +21 -3
- package/dist/core/lsp.js +2 -1
- package/dist/core/mailbox-store.d.ts +111 -18
- package/dist/core/mailbox-store.js +101 -13
- package/dist/core/mcp-call-meta.js +1 -1
- package/dist/core/mcp-connection-pool.d.ts +8 -2
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +6 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-read.d.ts +293 -0
- package/dist/core/mcp-host-read.js +428 -0
- package/dist/core/mcp-server-link.d.ts +28 -6
- package/dist/core/mcp-server-link.js +35 -7
- package/dist/core/mcp-server-spec.d.ts +22 -29
- package/dist/core/mcp-server-spec.js +7 -14
- package/dist/core/mcp-server-unavailable-notice.d.ts +32 -0
- package/dist/core/mcp-server-unavailable-notice.js +15 -0
- package/dist/core/mcp-session-end.d.ts +5 -2
- package/dist/core/mcp-session-end.js +7 -2
- package/dist/core/mcp-tool-meta.d.ts +6 -0
- package/dist/core/mcp-tool-meta.js +1 -0
- package/dist/core/mcp.d.ts +54 -19
- package/dist/core/mcp.js +194 -241
- package/dist/core/memory-engine/committed-shadow-read.d.ts +16 -0
- package/dist/core/memory-engine/committed-shadow-read.js +21 -0
- package/dist/core/memory-engine/consolidation-driver.js +2 -1
- package/dist/core/memory-engine/consolidation.d.ts +3 -3
- package/dist/core/memory-engine/control-objects.d.ts +4 -3
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/delegation-settlement.d.ts +127 -25
- package/dist/core/memory-engine/delegation-settlement.js +145 -18
- package/dist/core/memory-engine/distiller.d.ts +2 -1
- package/dist/core/memory-engine/distiller.js +10 -5
- package/dist/core/memory-engine/dual-root.js +2 -2
- package/dist/core/memory-engine/engine.d.ts +127 -33
- package/dist/core/memory-engine/engine.js +774 -323
- package/dist/core/memory-engine/entry-scan.d.ts +3 -0
- package/dist/core/memory-engine/entry-scan.js +8 -0
- package/dist/core/memory-engine/export-bundle.d.ts +4 -0
- package/dist/core/memory-engine/export-bundle.js +2 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -17
- package/dist/core/memory-engine/file-backend.js +155 -99
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layer-observations.d.ts +7 -1
- package/dist/core/memory-engine/layer-observations.js +6 -0
- package/dist/core/memory-engine/layout.d.ts +88 -26
- package/dist/core/memory-engine/layout.js +105 -29
- package/dist/core/memory-engine/memory-deployment.js +4 -4
- package/dist/core/memory-engine/mount-failed-notice.d.ts +24 -0
- package/dist/core/memory-engine/mount-failed-notice.js +22 -0
- package/dist/core/memory-engine/origin-clearance.d.ts +15 -1
- package/dist/core/memory-engine/origin-clearance.js +30 -10
- package/dist/core/memory-engine/scan.js +1 -1
- package/dist/core/memory-engine/scope-contract.js +4 -3
- package/dist/core/memory-engine/session-write-home.js +13 -1
- package/dist/core/memory-engine/sync-client.d.ts +1 -1
- package/dist/core/memory-engine/sync-client.js +3 -1
- package/dist/core/memory-engine/tools.d.ts +5 -4
- package/dist/core/memory-engine/tools.js +1 -1
- package/dist/core/memory-engine/types.d.ts +18 -1
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.js +2 -6
- package/dist/core/mode-policy.d.ts +8 -1
- package/dist/core/mode-policy.js +6 -2
- package/dist/core/model-fallbacks.d.ts +103 -0
- package/dist/core/model-fallbacks.js +79 -0
- package/dist/core/model-receipt.d.ts +15 -3
- package/dist/core/model-receipt.js +22 -1
- package/dist/core/model-seat.d.ts +1 -1
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/dollar.d.ts +47 -2
- package/dist/core/mods/dollar.js +28 -5
- package/dist/core/mods/kernel/budget.d.ts +6 -0
- package/dist/core/mods/kernel/budget.js +6 -0
- package/dist/core/mods/kernel/dispatch.d.ts +23 -2
- package/dist/core/mods/kernel/dispatch.js +104 -15
- package/dist/core/mods/kernel/events.d.ts +18 -1
- package/dist/core/mods/kernel/events.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +2 -2
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/receive.d.ts +2 -1
- package/dist/core/mods/lifecycle-stations.d.ts +13 -4
- package/dist/core/mods/lifecycle-stations.js +8 -3
- package/dist/core/mods/message-display.d.ts +81 -0
- package/dist/core/mods/message-display.js +369 -0
- package/dist/core/mods/prompt-submit.d.ts +1 -1
- package/dist/core/mods/prompt-submit.js +5 -2
- package/dist/core/mods/session-append.d.ts +2 -2
- package/dist/core/mods/session-append.js +2 -1
- package/dist/core/mods/session-compact.js +2 -2
- package/dist/core/mods/stations.d.ts +48 -18
- package/dist/core/mods/stations.js +100 -19
- package/dist/core/mods/stop-answers.d.ts +23 -0
- package/dist/core/mods/stop-answers.js +20 -0
- package/dist/core/mounted-mcp.d.ts +48 -8
- package/dist/core/mounted-mcp.js +82 -16
- package/dist/core/namespaced-rule-name.js +2 -1
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/parent-spec-seat.d.ts +20 -1
- package/dist/core/parent-spec-seat.js +13 -3
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/path-identity.js +2 -1
- package/dist/core/peer-seat.d.ts +21 -7
- package/dist/core/peer-seat.js +25 -16
- package/dist/core/permission-rule-consent.js +15 -5
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +43 -23
- package/dist/core/permission-rule-store.d.ts +31 -16
- package/dist/core/permission-rule-store.js +27 -18
- package/dist/core/present-plan-tool.d.ts +6 -1
- package/dist/core/present-plan-tool.js +11 -3
- package/dist/core/pricing.d.ts +8 -6
- package/dist/core/pricing.js +1 -1
- package/dist/core/principal-name.d.ts +13 -0
- package/dist/core/principal-name.js +9 -2
- package/dist/core/process-identity.d.ts +140 -0
- package/dist/core/process-identity.js +215 -0
- package/dist/core/protocol-http-auth.d.ts +28 -6
- package/dist/core/protocol-http-auth.js +22 -5
- package/dist/core/protocol-naming.d.ts +7 -0
- package/dist/core/protocol-naming.js +12 -2
- package/dist/core/protocol-revocation.d.ts +72 -0
- package/dist/core/protocol-revocation.js +98 -0
- package/dist/core/protocol-table.d.ts +4 -4
- package/dist/core/protocol-table.js +3 -2
- package/dist/core/push-queue.d.ts +35 -2
- package/dist/core/push-queue.js +60 -4
- package/dist/core/read-only-shell.d.ts +19 -0
- package/dist/core/read-only-shell.js +38 -11
- package/dist/core/real-approval.d.ts +26 -0
- package/dist/core/real-approval.js +15 -0
- package/dist/core/redaction-marks.d.ts +6 -2
- package/dist/core/redaction-marks.js +3 -0
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +9 -8
- package/dist/core/remote-env.d.ts +31 -15
- package/dist/core/remote-env.js +29 -0
- package/dist/core/request-copy-projection.d.ts +51 -0
- package/dist/core/request-copy-projection.js +410 -0
- package/dist/core/resume-config-judge.d.ts +69 -0
- package/dist/core/resume-config-judge.js +78 -0
- package/dist/core/resume-startup-cause.d.ts +14 -4
- package/dist/core/resume-startup-cause.js +12 -2
- package/dist/core/retention-policy.js +2 -1
- package/dist/core/retention.d.ts +119 -24
- package/dist/core/retention.js +60 -16
- package/dist/core/retired-keys.d.ts +0 -10
- package/dist/core/retired-keys.js +2 -3
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +65 -4
- package/dist/core/row-shape.d.ts +149 -0
- package/dist/core/row-shape.js +184 -0
- package/dist/core/runner/advertised-writable-dirs.js +10 -9
- package/dist/core/runner/advisor-instructions.d.ts +11 -27
- package/dist/core/runner/advisor-instructions.js +18 -20
- package/dist/core/runner/advisor-tool.js +1 -0
- package/dist/core/runner/announce-once-ledger.js +4 -1
- package/dist/core/runner/approval-feedback.d.ts +17 -8
- package/dist/core/runner/approval-feedback.js +18 -13
- package/dist/core/runner/approver-defect-announcer.d.ts +17 -0
- package/dist/core/runner/approver-defect-announcer.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +29 -14
- package/dist/core/runner/assemble-result.js +16 -25
- package/dist/core/runner/cache-hit-account.d.ts +77 -0
- package/dist/core/runner/cache-hit-account.js +46 -0
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/call-hook-stations.js +5 -4
- package/dist/core/runner/changed-files-scan.d.ts +43 -0
- package/dist/core/runner/changed-files-scan.js +34 -0
- package/dist/core/runner/checkpoint-scope.d.ts +33 -9
- package/dist/core/runner/checkpoint-scope.js +27 -1
- package/dist/core/runner/classifier-ladder.d.ts +2 -2
- package/dist/core/runner/classifier-ladder.js +18 -9
- package/dist/core/runner/clock-and-limits.d.ts +15 -4
- package/dist/core/runner/clock-and-limits.js +19 -1
- package/dist/core/runner/compact-session.js +84 -14
- package/dist/core/runner/compaction-call-options.d.ts +2 -29
- package/dist/core/runner/compaction-call-options.js +2 -9
- package/dist/core/runner/compaction-restate.d.ts +18 -2
- package/dist/core/runner/compaction-restate.js +36 -2
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/context-room.d.ts +55 -0
- package/dist/core/runner/context-room.js +71 -0
- package/dist/core/runner/contracts.d.ts +313 -205
- package/dist/core/runner/conversation-segment.d.ts +49 -14
- package/dist/core/runner/conversation-segment.js +92 -19
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -0
- package/dist/core/runner/cross-boundary-lane.js +9 -6
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/deferred-ask.d.ts +62 -0
- package/dist/core/runner/deferred-ask.js +44 -0
- package/dist/core/runner/delegation-owner.d.ts +19 -0
- package/dist/core/runner/delegation-owner.js +27 -1
- package/dist/core/runner/denial-limit-arms.d.ts +10 -6
- package/dist/core/runner/denial-limit-arms.js +13 -7
- package/dist/core/runner/env-capability-census.d.ts +1 -1
- package/dist/core/runner/file-history-request.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +16 -2
- package/dist/core/runner/file-history-restore.js +9 -1
- package/dist/core/runner/gate-exit.d.ts +18 -5
- package/dist/core/runner/gate-exit.js +26 -15
- package/dist/core/runner/git-status-frame.d.ts +26 -8
- package/dist/core/runner/git-status-frame.js +14 -9
- package/dist/core/runner/halt-attribution.d.ts +29 -12
- package/dist/core/runner/halt-attribution.js +38 -11
- package/dist/core/runner/image.js +3 -2
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +4 -4
- package/dist/core/runner/language-frame.d.ts +66 -0
- package/dist/core/runner/language-frame.js +76 -0
- package/dist/core/runner/leg-frame.d.ts +81 -0
- package/dist/core/runner/leg-frame.js +68 -0
- package/dist/core/runner/main-call-account.d.ts +34 -0
- package/dist/core/runner/main-call-account.js +50 -0
- package/dist/core/runner/mcp-redial.d.ts +9 -7
- package/dist/core/runner/mcp-redial.js +20 -21
- package/dist/core/runner/memory-consolidation-driver.d.ts +2 -0
- package/dist/core/runner/memory-consolidation-driver.js +5 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -0
- package/dist/core/runner/messages-omitted-seat.js +21 -0
- package/dist/core/runner/model-fallback-seat.d.ts +20 -0
- package/dist/core/runner/model-fallback-seat.js +43 -0
- package/dist/core/runner/model-lane-seat.d.ts +12 -0
- package/dist/core/runner/model-lane-seat.js +35 -0
- package/dist/core/runner/nested-memory-content.d.ts +33 -0
- package/dist/core/runner/nested-memory-content.js +171 -0
- package/dist/core/runner/nested-memory-lane.d.ts +181 -0
- package/dist/core/runner/nested-memory-lane.js +673 -0
- package/dist/core/runner/park-commit.d.ts +7 -0
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-advisor.d.ts +7 -9
- package/dist/core/runner/prepare-advisor.js +11 -5
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +8 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +21 -3
- package/dist/core/runner/prepare-ask-lane.js +32 -28
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +21 -17
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +10 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +24 -18
- package/dist/core/runner/prepare-config-doors.d.ts +51 -5
- package/dist/core/runner/prepare-config-doors.js +73 -73
- package/dist/core/runner/prepare-context-lane.d.ts +68 -3
- package/dist/core/runner/prepare-context-lane.js +137 -27
- package/dist/core/runner/prepare-defer-classify.d.ts +0 -4
- package/dist/core/runner/prepare-defer-classify.js +9 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +8 -8
- package/dist/core/runner/prepare-delegation-surface.js +72 -64
- package/dist/core/runner/prepare-execution-env.js +1 -9
- package/dist/core/runner/prepare-file-history.d.ts +3 -2
- package/dist/core/runner/prepare-file-history.js +11 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +21 -11
- package/dist/core/runner/prepare-gate-stations.js +13 -13
- package/dist/core/runner/prepare-hands-readface.d.ts +23 -6
- package/dist/core/runner/prepare-hands-readface.js +18 -12
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -10
- package/dist/core/runner/prepare-lsp.js +2 -1
- package/dist/core/runner/prepare-memory-engine-session.js +30 -10
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +38 -16
- package/dist/core/runner/prepare-offload-wrappers.d.ts +3 -16
- package/dist/core/runner/prepare-offload-wrappers.js +6 -5
- package/dist/core/runner/prepare-park-ask.d.ts +13 -3
- package/dist/core/runner/prepare-park-ask.js +25 -19
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -3
- package/dist/core/runner/prepare-policy-chain.js +144 -120
- package/dist/core/runner/prepare-project-context.d.ts +15 -53
- package/dist/core/runner/prepare-project-context.js +20 -83
- package/dist/core/runner/prepare-prompt-assembly.d.ts +7 -1
- package/dist/core/runner/prepare-prompt-assembly.js +9 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +9 -3
- package/dist/core/runner/prepare-prompt-inputs.js +5 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +46 -27
- package/dist/core/runner/prepare-question-face.d.ts +7 -6
- package/dist/core/runner/prepare-question-face.js +7 -6
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -0
- package/dist/core/runner/prepare-suspend-saga.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +3 -3
- package/dist/core/runner/prepare-task.js +113 -61
- package/dist/core/runner/prepare-tool-disclosure-mount.js +6 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +33 -7
- package/dist/core/runner/prepare-turn-wiring.js +53 -17
- package/dist/core/runner/prepare-wiring-manifest.d.ts +42 -5
- package/dist/core/runner/prepare-wiring-manifest.js +81 -42
- package/dist/core/runner/prepare-workspace-restore.js +3 -2
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/reply-pricing.d.ts +31 -18
- package/dist/core/runner/reply-pricing.js +10 -15
- package/dist/core/runner/resume-admission.js +10 -15
- package/dist/core/runner/resume-apply.js +20 -9
- package/dist/core/runner/resume-checkpoint-screen.js +2 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +12 -9
- package/dist/core/runner/resume-internals-and-config.js +37 -9
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/retired-runner-deps.js +3 -0
- package/dist/core/runner/rewind-files.js +6 -6
- package/dist/core/runner/run-attachment-seats.d.ts +1 -3
- package/dist/core/runner/run-attachment-seats.js +1 -6
- package/dist/core/runner/run-brain-sinks.d.ts +4 -7
- package/dist/core/runner/run-brain-sinks.js +7 -10
- package/dist/core/runner/run-clock-and-content.d.ts +8 -5
- package/dist/core/runner/run-clock-and-content.js +18 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +8 -4
- package/dist/core/runner/run-compaction-machinery.js +4 -19
- package/dist/core/runner/run-git-lane.d.ts +8 -3
- package/dist/core/runner/run-git-lane.js +5 -3
- package/dist/core/runner/run-harness-handlers.d.ts +4 -1
- package/dist/core/runner/run-harness-handlers.js +70 -45
- package/dist/core/runner/run-identity-wiring.d.ts +6 -0
- package/dist/core/runner/run-identity-wiring.js +17 -8
- package/dist/core/runner/run-leg.d.ts +5 -2
- package/dist/core/runner/run-leg.js +156 -71
- package/dist/core/runner/run-notification-lane.d.ts +1 -1
- package/dist/core/runner/run-notification-lane.js +22 -10
- package/dist/core/runner/run-recovery-lanes.js +8 -6
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -0
- package/dist/core/runner/run-settle-and-teardown.js +77 -26
- package/dist/core/runner/run-stop-and-final-verify.js +46 -12
- package/dist/core/runner/run-telemetry-and-budget-seats.js +13 -28
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.js +14 -9
- package/dist/core/runner/run-tool-mount-facts.js +5 -9
- package/dist/core/runner/run-turn-boundary.d.ts +3 -2
- package/dist/core/runner/run-turn-boundary.js +112 -106
- package/dist/core/runner/runtask.d.ts +28 -8
- package/dist/core/runner/runtask.js +132 -41
- package/dist/core/runner/session-file-state-replay.d.ts +5 -3
- package/dist/core/runner/session-file-state-replay.js +10 -3
- package/dist/core/runner/session-rule-policy.d.ts +3 -3
- package/dist/core/runner/session-verb-doors.d.ts +18 -3
- package/dist/core/runner/session-verb-doors.js +38 -6
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +4 -4
- package/dist/core/runner/side-call-account.d.ts +12 -8
- package/dist/core/runner/side-call-account.js +24 -15
- package/dist/core/runner/stream-halt-verbs.js +1 -0
- package/dist/core/runner/stream-mode-verb.js +2 -1
- package/dist/core/runner/stream-settle-backstop.js +4 -1
- package/dist/core/runner/stream-steer-verb.js +35 -19
- package/dist/core/runner/sub-agent-deny-lists.d.ts +47 -11
- package/dist/core/runner/sub-agent-deny-lists.js +140 -39
- package/dist/core/runner/teardown-bounded.d.ts +6 -0
- package/dist/core/runner/teardown-bounded.js +12 -7
- package/dist/core/runner/terminal-account.d.ts +2 -0
- package/dist/core/runner/terminal-account.js +6 -1
- package/dist/core/runner/tool-disclosure.js +2 -1
- package/dist/core/runner/tool-end-body.js +3 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +34 -9
- package/dist/core/runner/tool-occurrence.js +32 -21
- package/dist/core/runner/tool-progress-lane.d.ts +20 -5
- package/dist/core/runner/tool-progress-lane.js +27 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +15 -4
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/turn-attachments.d.ts +44 -71
- package/dist/core/runner/turn-attachments.js +52 -104
- package/dist/core/runner/usage-accounting.d.ts +3 -2
- package/dist/core/runner/usage-accounting.js +3 -2
- package/dist/core/runner/void-verifier-pause.js +1 -1
- package/dist/core/runner-deps.d.ts +42 -158
- package/dist/core/runtime-caps.d.ts +16 -4
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +46 -23
- package/dist/core/sensitive-path-policy.d.ts +8 -0
- package/dist/core/sensitive-path-policy.js +10 -2
- package/dist/core/session-checkout.d.ts +32 -27
- package/dist/core/session-checkout.js +109 -61
- package/dist/core/session-log-transfer.js +2 -1
- package/dist/core/session-policy-store.d.ts +24 -11
- package/dist/core/session-policy-store.js +11 -2
- package/dist/core/session-store.d.ts +16 -2
- package/dist/core/session-store.js +43 -17
- package/dist/core/session.d.ts +31 -3
- package/dist/core/session.js +33 -2
- package/dist/core/shell-run-candidates.d.ts +20 -8
- package/dist/core/shell-run-candidates.js +44 -21
- package/dist/core/side-query.d.ts +17 -5
- package/dist/core/side-query.js +17 -14
- package/dist/core/skill-grant.js +2 -3
- package/dist/core/skills-directory.js +3 -66
- package/dist/core/snapshot-frame-seat.d.ts +8 -0
- package/dist/core/snapshot-frame-seat.js +24 -0
- package/dist/core/steer-replay.d.ts +19 -3
- package/dist/core/steer-replay.js +8 -1
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +17 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +131 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +63 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +213 -3
- package/dist/core/store-contracts/permission-rule-write-contract.js +24 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.d.ts +15 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +288 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +57 -36
- package/dist/core/store-contracts/session-repo-contract.js +130 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/session-store-contract.js +17 -0
- package/dist/core/store-contracts/task-list-store-contract.d.ts +32 -0
- package/dist/core/store-contracts/task-list-store-contract.js +240 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +41 -0
- package/dist/core/stub-env.d.ts +2 -2
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.d.ts +38 -28
- package/dist/core/synthetic-read-verdict.js +19 -28
- package/dist/core/task-event.d.ts +171 -19
- package/dist/core/task-intake.d.ts +26 -0
- package/dist/core/task-intake.js +31 -0
- package/dist/core/task-limits.d.ts +8 -6
- package/dist/core/task-notification.d.ts +88 -8
- package/dist/core/task-notification.js +45 -5
- package/dist/core/task-registry-agent.d.ts +24 -7
- package/dist/core/task-registry-agent.js +51 -28
- package/dist/core/task-registry-monitor.js +16 -14
- package/dist/core/task-registry-shared.d.ts +177 -35
- package/dist/core/task-registry-shared.js +44 -17
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry-yield.d.ts +32 -0
- package/dist/core/task-registry-yield.js +85 -0
- package/dist/core/task-registry.d.ts +88 -10
- package/dist/core/task-registry.js +124 -33
- package/dist/core/task-result.d.ts +115 -31
- package/dist/core/task-spec-members.d.ts +140 -1
- package/dist/core/task-spec-members.js +23 -8
- package/dist/core/task-spec.d.ts +181 -51
- package/dist/core/task-spec.js +1 -1
- package/dist/core/task-stream.d.ts +12 -2
- package/dist/core/terminal-cause.d.ts +12 -4
- package/dist/core/thrown-value.d.ts +49 -7
- package/dist/core/thrown-value.js +38 -2
- package/dist/core/tool-catalog-entries.js +13 -3
- package/dist/core/tool-data-door.d.ts +7 -0
- package/dist/core/tool-data-door.js +13 -0
- package/dist/core/tool-face-lists.d.ts +25 -0
- package/dist/core/tool-face-lists.js +38 -0
- package/dist/core/tool-face-reader.d.ts +0 -10
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-list-grammar.d.ts +103 -0
- package/dist/core/tool-list-grammar.js +130 -0
- package/dist/core/tool-mount-facts.d.ts +47 -0
- package/dist/core/tool-mount-facts.js +50 -0
- package/dist/core/tool-mount-plan.d.ts +196 -0
- package/dist/core/tool-mount-plan.js +404 -0
- package/dist/core/tool-mount-static.d.ts +12 -0
- package/dist/core/tool-mount-static.js +174 -0
- package/dist/core/tool-name-aliases.d.ts +60 -2
- package/dist/core/tool-name-aliases.js +22 -2
- package/dist/core/tool-name-list.d.ts +3 -0
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +246 -51
- package/dist/core/tool-policy.js +165 -71
- package/dist/core/tool-registry.d.ts +4 -11
- package/dist/core/tool-registry.js +0 -3
- package/dist/core/tool-result-bytes.d.ts +94 -0
- package/dist/core/tool-result-bytes.js +34 -0
- package/dist/core/tool-result-store.d.ts +97 -13
- package/dist/core/tool-result-store.js +52 -4
- package/dist/core/tool-roster.d.ts +71 -10
- package/dist/core/tool-roster.js +71 -21
- package/dist/core/tool-search-setting.d.ts +7 -9
- package/dist/core/tool-search-setting.js +23 -7
- package/dist/core/tool-spec.d.ts +32 -2
- package/dist/core/tools.js +6 -20
- package/dist/core/trace.d.ts +63 -11
- package/dist/core/trace.js +19 -0
- package/dist/core/types.d.ts +8 -6
- package/dist/core/types.js +3 -1
- package/dist/core/unmatched-tool-names.d.ts +37 -0
- package/dist/core/unmatched-tool-names.js +18 -0
- package/dist/core/untrusted-egress.d.ts +16 -5
- package/dist/core/untrusted-egress.js +202 -32
- package/dist/core/untrusted-text.d.ts +29 -8
- package/dist/core/untrusted-text.js +6 -3
- package/dist/core/user-attachment.d.ts +129 -35
- package/dist/core/user-attachment.js +124 -57
- package/dist/core/user-row-origin.d.ts +63 -0
- package/dist/core/user-row-origin.js +61 -0
- package/dist/core/wiring-manifest.d.ts +161 -39
- package/dist/core/wiring-manifest.js +42 -6
- package/dist/core/workflow-run-store-contract.d.ts +11 -1
- package/dist/core/workflow-run-store-contract.js +60 -7
- package/dist/core/workflow-run-store.d.ts +61 -12
- package/dist/core/workflow-run-store.js +100 -15
- package/dist/core/workspace-snapshot.d.ts +10 -14
- package/dist/core/workspace-snapshot.js +3 -22
- package/dist/core/write-protect.d.ts +3 -5
- package/dist/core/write-protect.js +2 -4
- package/dist/engine/compaction/compaction.d.ts +3 -0
- package/dist/engine/compaction/compaction.js +4 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +15 -4
- package/dist/engine/execution-env/node-execution-env.js +80 -27
- package/dist/engine/harness/agent-harness.d.ts +143 -27
- package/dist/engine/harness/agent-harness.js +162 -74
- package/dist/engine/harness/types.d.ts +84 -13
- package/dist/engine/harness/types.js +21 -1
- package/dist/engine/llm/tool-turns.d.ts +4 -0
- package/dist/engine/llm/tool-turns.js +7 -2
- package/dist/engine/llm/types.d.ts +111 -24
- package/dist/engine/llm/types.js +69 -5
- package/dist/engine/llm/validation.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +39 -6
- package/dist/engine/loop/agent-loop.js +172 -82
- package/dist/engine/loop/types.d.ts +43 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +5 -3
- package/dist/engine/lsp/node-lsp-manager.js +14 -10
- package/dist/engine/session/import-validate.js +9 -0
- package/dist/engine/session/memory-repo.d.ts +8 -1
- package/dist/engine/session/memory-repo.js +20 -12
- package/dist/engine/session/repo-utils.d.ts +10 -0
- package/dist/engine/session/repo-utils.js +11 -5
- package/dist/engine/session/row-cells.d.ts +32 -0
- package/dist/engine/session/row-cells.js +25 -0
- package/dist/index.d.ts +63 -34
- package/dist/index.js +44 -21
- package/dist/internal/harness.d.ts +8 -6
- package/dist/internal/harness.js +6 -4
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +7 -0
- package/dist/orchestration/governance-baseline-validity.js +33 -9
- package/dist/orchestration/run-workflow-tool.d.ts +2 -0
- package/dist/orchestration/run-workflow-tool.js +25 -12
- package/dist/orchestration/workflow-governance.d.ts +19 -4
- package/dist/orchestration/workflow-governance.js +30 -9
- package/dist/orchestration/workflow-primitives.d.ts +4 -1
- package/dist/orchestration/workflow-primitives.js +2 -2
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +21 -12
- package/dist/orchestration/workflow-types.js +15 -4
- package/dist/orchestration/workflow.d.ts +37 -7
- package/dist/orchestration/workflow.js +81 -35
- package/dist/prompt-assembly/artifact-store.js +6 -9
- package/dist/prompt-assembly/assemble.d.ts +4 -10
- package/dist/prompt-assembly/assemble.js +1 -3
- package/dist/prompt-assembly/catalog/constitution.d.ts +0 -20
- package/dist/prompt-assembly/catalog/constitution.js +2 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +5 -3
- package/dist/prompt-assembly/catalog/engine.d.ts +108 -0
- package/dist/prompt-assembly/catalog/engine.js +19 -0
- package/dist/prompt-assembly/catalog/environment.d.ts +276 -0
- package/dist/prompt-assembly/catalog/environment.js +61 -0
- package/dist/prompt-assembly/catalog/index.d.ts +9 -2
- package/dist/prompt-assembly/catalog/index.js +73 -2
- package/dist/prompt-assembly/catalog/locales/index.d.ts +16 -0
- package/dist/prompt-assembly/catalog/locales/index.js +22 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +124 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +120 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.js +442 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +15 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +50 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +163 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +148 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.js +246 -0
- package/dist/prompt-assembly/catalog/role.js +3 -6
- package/dist/prompt-assembly/catalog/schema.d.ts +23 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/composer.d.ts +6 -11
- package/dist/prompt-assembly/composer.js +7 -7
- package/dist/prompt-assembly/engine-text.d.ts +9 -0
- package/dist/prompt-assembly/engine-text.js +33 -0
- package/dist/prompt-assembly/event-registry.js +3 -3
- package/dist/prompt-assembly/explain.d.ts +1 -0
- package/dist/prompt-assembly/explain.js +1 -1
- package/dist/prompt-assembly/locale-review.d.ts +13 -0
- package/dist/prompt-assembly/locale-review.js +19 -0
- package/dist/prompt-assembly/overlay.d.ts +7 -3
- package/dist/prompt-assembly/overlay.js +27 -5
- package/dist/prompt-assembly/renderers.d.ts +4 -4
- package/dist/prompt-assembly/renderers.js +26 -17
- package/dist/prompt-assembly/role-base.d.ts +1 -1
- package/dist/prompt-assembly/select.d.ts +26 -5
- package/dist/prompt-assembly/select.js +25 -2
- package/dist/prompt-assembly/slots.d.ts +19 -0
- package/dist/prompt-assembly/slots.js +16 -0
- package/dist/prompt-assembly/sugar.d.ts +4 -7
- package/dist/prompt-assembly/sugar.js +1 -2
- package/dist/prompt-assembly/tool-catalog.d.ts +5 -1
- package/dist/prompt-assembly/tool-catalog.js +5 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +38 -10
- package/dist/prompt-assembly/turn-snapshot.js +43 -13
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/cowork.d.ts +6 -25
- package/dist/prompts/cowork.js +10 -12
- package/dist/prompts/default.d.ts +10 -32
- package/dist/prompts/default.js +37 -63
- package/dist/shell/lex.d.ts +39 -13
- package/dist/shell/lex.js +70 -30
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +35 -61
- package/dist/stores/file/checkpoint-store.d.ts +5 -3
- package/dist/stores/file/checkpoint-store.js +8 -10
- package/dist/stores/file/fs-atomic.d.ts +27 -70
- package/dist/stores/file/fs-atomic.js +52 -148
- package/dist/stores/file/index.d.ts +12 -0
- package/dist/stores/file/index.js +27 -2
- package/dist/stores/file/mailbox-store.d.ts +10 -1
- package/dist/stores/file/mailbox-store.js +40 -12
- package/dist/stores/file/permission-rule-adopt.js +5 -2
- package/dist/stores/file/permission-rule-store.d.ts +81 -20
- package/dist/stores/file/permission-rule-store.js +126 -33
- package/dist/stores/file/session-policy-store.d.ts +2 -2
- package/dist/stores/file/session-store.d.ts +21 -2
- package/dist/stores/file/session-store.js +27 -14
- package/dist/stores/file/task-list-store.js +23 -25
- package/dist/stores/file/tool-result-store.d.ts +45 -7
- package/dist/stores/file/tool-result-store.js +99 -36
- package/dist/stores/file/workflow-run-store.d.ts +1 -0
- package/dist/stores/file/workflow-run-store.js +14 -11
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/artifact/local-stub.js +6 -6
- package/dist/tools/fs/bash-program-position.d.ts +1 -2
- package/dist/tools/fs/bash-readonly-classifier.d.ts +35 -0
- package/dist/tools/fs/bash-readonly-classifier.js +50 -12
- package/dist/tools/fs/env-error-detail.d.ts +1 -0
- package/dist/tools/fs/env-error-detail.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +24 -6
- package/dist/tools/fs/fs-bash.js +73 -25
- package/dist/tools/fs/fs-pdf.js +6 -4
- package/dist/tools/fs/fs-read.d.ts +76 -31
- package/dist/tools/fs/fs-read.js +159 -79
- package/dist/tools/fs/fs-search-tools.d.ts +1 -1
- package/dist/tools/fs/fs-search-tools.js +3 -1
- package/dist/tools/fs/fs-shared.d.ts +59 -63
- package/dist/tools/fs/fs-shared.js +31 -18
- package/dist/tools/fs/fs-write.d.ts +13 -0
- package/dist/tools/fs/fs-write.js +69 -13
- package/dist/tools/fs/index.d.ts +19 -1
- package/dist/tools/fs/index.js +10 -2
- package/dist/tools/fs/pdf.js +10 -9
- package/dist/tools/fs/read-deny.js +4 -10
- package/dist/tools/fs/read-floor.d.ts +5 -4
- package/dist/tools/fs/removal-targets.d.ts +11 -5
- package/dist/tools/fs/removal-targets.js +62 -32
- package/dist/tools/fs/safety.d.ts +26 -19
- package/dist/tools/fs/safety.js +13 -8
- package/dist/tools/fs/search.d.ts +1 -1
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-bindings.d.ts +128 -26
- package/dist/tools/fs/shell-read-bindings.js +667 -139
- package/dist/tools/fs/shell-read-check.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +4 -1
- package/dist/tools/fs/shell-read-judge.js +5 -1
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +21 -19
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +18 -1
- package/dist/tools/fs/shell-read-start.d.ts +6 -6
- package/dist/tools/fs/shell-read-start.js +1 -6
- package/dist/tools/fs/shell-read-word.d.ts +4 -2
- package/dist/tools/fs/shell-read-word.js +7 -6
- package/dist/tools/fs/shell-read-workdir.d.ts +1 -1
- package/dist/tools/fs/shell-reentry-text.d.ts +24 -9
- package/dist/tools/fs/shell-reentry-text.js +50 -20
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +14 -4
- package/dist/tools/scheduler-tools.d.ts +5 -2
- package/dist/tools/scheduler-tools.js +8 -6
- package/dist/tools/task-list.d.ts +49 -20
- package/dist/tools/task-list.js +115 -35
- package/dist/tools/web.d.ts +13 -3
- package/dist/tools/web.js +17 -6
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +24 -25
- package/package.json +10 -3
- package/test/export-surface.snapshot.json +330 -32
- package/wire-changes/core-stores-sql@7.66.1.json +30 -0
- package/wire-changes/core-stores-sql@7.67.0.json +39 -0
- package/wire-changes/core@7.66.1.json +46 -0
- package/wire-changes/core@7.67.0.json +12578 -0
- package/wire-changes/mods-kernel@7.66.1.json +30 -0
- package/wire-changes/mods-kernel@7.67.0.json +167 -0
- package/wire-changes/primitives@7.66.1.json +30 -0
- package/wire-changes/primitives@7.67.0.json +325 -0
- package/wire-changes/wiki-gate@7.67.0.json +1636 -0
- package/dist/brain/degrading.d.ts +0 -93
- package/dist/brain/degrading.js +0 -189
- package/dist/core/tool-conformance.d.ts +0 -20
- package/dist/core/tool-conformance.js +0 -37
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The person-facing half of a memory mount that failed open (`memory.mount_failed`, audience `user`). The memory phase's
|
|
3
|
+
* fail-open arm runs the task without its memory when the mount does not complete; the operator hears it on `onError` and the
|
|
4
|
+
* result's `effectiveMemoryScopes` reads `memoryless` / `mount-failed`, and this notice is what the session's user hears.
|
|
5
|
+
*
|
|
6
|
+
* Minted by the memory phase under the guard that mints that observation — so the notice and the observation are one fact, and
|
|
7
|
+
* a throw after the session assembled (the run then proceeds WITH its memory) says nothing. Dedup unit: the consumer's key
|
|
8
|
+
* `(code, detail.sessionId)`, once per session; the phase mints once per prepared leg whose mount failed.
|
|
9
|
+
*
|
|
10
|
+
* `scopes` is what the task asked to mount — every read scope and the write scope when it is a further one (the whole span failed, not
|
|
11
|
+
* one scope's mount), `cause` the closed set below —
|
|
12
|
+
* never the thrown text and never a path (a store-form refusal's `detail.path` stays on the operator's lane).
|
|
13
|
+
*/
|
|
14
|
+
import type { EngineNotice } from "../types.js";
|
|
15
|
+
import { type StoreFormRefusalCode } from "./layout.js";
|
|
16
|
+
/** Why the store did not mount: the store-form refusal's own code when the mount was refused for the store's physical form, else `"unclassified"`. */
|
|
17
|
+
export type MemoryMountFailedCause = StoreFormRefusalCode | "unclassified";
|
|
18
|
+
/** The cause a mount failure reports: the thrown value's `code`, read once (a hostile accessor reads as absent), taken only when it is a member of the store-form family. */
|
|
19
|
+
export declare function memoryMountFailedCauseOf(thrown: unknown): MemoryMountFailedCause;
|
|
20
|
+
export declare function memoryMountFailedNotice(input: {
|
|
21
|
+
sessionId: string;
|
|
22
|
+
scopes: readonly string[];
|
|
23
|
+
cause: MemoryMountFailedCause;
|
|
24
|
+
}): EngineNotice;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readMember } from "../thrown-value.js";
|
|
2
|
+
import { STORE_FORM_REFUSAL_CODES } from "./layout.js";
|
|
3
|
+
const CLAUSE = {
|
|
4
|
+
"memory.target_outside_store": "a path of the memory store resolves outside the store (a symbolic link points out of it, or its root moved)",
|
|
5
|
+
"memory.scope_home_not_directory": "a memory scope's directory is a symbolic link or not a real directory",
|
|
6
|
+
"memory.control_plane_links_unsupported": "the file system under the memory store cannot make hard links",
|
|
7
|
+
"memory.control_plane_strays": "the memory control plane still holds records of an earlier governance store that nobody has adopted",
|
|
8
|
+
"memory.store_root_sensitive": "the memory store is configured inside a directory the engine's write guard protects (a credential or access-control directory)",
|
|
9
|
+
unclassified: "the memory store could not be opened",
|
|
10
|
+
};
|
|
11
|
+
export function memoryMountFailedCauseOf(thrown) {
|
|
12
|
+
const code = readMember(thrown, "code");
|
|
13
|
+
return typeof code === "string" && STORE_FORM_REFUSAL_CODES.includes(code) ? code : "unclassified";
|
|
14
|
+
}
|
|
15
|
+
export function memoryMountFailedNotice(input) {
|
|
16
|
+
return {
|
|
17
|
+
code: "memory.mount_failed",
|
|
18
|
+
message: `Memory did not mount for this session: ${CLAUSE[input.cause]}. The task runs without it — stored memory is not available to the assistant, ` +
|
|
19
|
+
`and nothing is saved into that memory store in this session; a later run may mount it.`,
|
|
20
|
+
detail: { sessionId: input.sessionId, scopes: [...input.scopes], cause: input.cause },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -85,13 +85,24 @@ export declare function moveOriginClearanceCustodyOut(store: OriginClearanceStor
|
|
|
85
85
|
/** Strict read of the whole account (host audit face; corrupt = throw). Each row answers its custody text, wherever the
|
|
86
86
|
* account keeps it (`""` once an erasure took it, `custodyErased`). */
|
|
87
87
|
export declare function readOriginClearances(store: Pick<MemoryGovernanceDocs, "readDoc"> & Pick<MemoryGovernanceObjects, "getObject">): Promise<OriginClearanceRow[]>;
|
|
88
|
+
/** The account's erasure count, read BEFORE a clearance judges its entry — the count {@link openOriginClearance} appends
|
|
89
|
+
* under. An account never written is written empty here first: an erasure that finds no account adds nothing to it (no
|
|
90
|
+
* open has read a count yet, so every judgement still to come follows that erasure's delete), and one that finds it adds one. */
|
|
91
|
+
export declare function readClearanceErasureCount(store: OriginClearanceStore): Promise<number>;
|
|
88
92
|
/**
|
|
89
93
|
* WRITE-AHEAD open: append the pending row (custody included) before any store mutation. Refuses a
|
|
90
94
|
* second OPEN while a pending row for the same entry stands — the pending row is a resume seat,
|
|
91
95
|
* not a queue (the caller resumes it instead). The custody text lands as its object before the update
|
|
92
96
|
* that appends the row naming it; a refused open removes the object it wrote (no row names it).
|
|
97
|
+
*
|
|
98
|
+
* UNDER THE COUNT IT JUDGED UNDER (#3559). `judgedUnder` is the account's erasure count the caller read before it read the
|
|
99
|
+
* entry ({@link readClearanceErasureCount}). Every erasure deletes its entries first and adds one to the count under the
|
|
100
|
+
* lock it marks their rows under, so the update that appends this row sees one of two things: the count it judged under —
|
|
101
|
+
* any erasure of the entry is still to come, reads this row and takes its custody — or a larger count, an erasure that may
|
|
102
|
+
* have taken the entry after it was judged and read no row of it: the open is refused (`memory.origin_clear_conflict`, a
|
|
103
|
+
* re-call re-judges) and the object it put goes with the refusal.
|
|
93
104
|
*/
|
|
94
|
-
export declare function openOriginClearance(store: OriginClearanceStore, row: Omit<OriginClearanceRow, "status" | "events" | "custodyErased"
|
|
105
|
+
export declare function openOriginClearance(store: OriginClearanceStore, row: Omit<OriginClearanceRow, "status" | "events" | "custodyErased">, judgedUnder: number): Promise<void>;
|
|
95
106
|
/**
|
|
96
107
|
* Record that THIS clearance's tombstone leg committed (called between the delete's success and
|
|
97
108
|
* the re-record attempt). The record is what lets a later resume read an ABSENT entry as "the
|
|
@@ -146,5 +157,8 @@ export interface ClearanceCustodyErasure {
|
|
|
146
157
|
* converges: its object is deleted again when one still stands, and a row is never rewritten twice). The row itself —
|
|
147
158
|
* who cleared, why, when, its events, its status — stays. A failed delete is counted in `remaining`, never swallowed; a
|
|
148
159
|
* document that cannot be read or updated throws (the lane that called decides what its attestation says about that).
|
|
160
|
+
* The same update adds one to the account's erasure count whenever the account was ever written, a row of these entries
|
|
161
|
+
* standing or not (#3559, {@link openOriginClearance}): every lane deletes the entries before it calls this, so an open
|
|
162
|
+
* that judged one of them before the delete and appends after this update is refused by the count.
|
|
149
163
|
*/
|
|
150
164
|
export declare function eraseOriginClearanceCustody(store: OriginClearanceStore, entryIds: ReadonlySet<string>, at: number): Promise<ClearanceCustodyErasure>;
|
|
@@ -31,12 +31,13 @@ async function keepCustody(store, clearanceId, text) {
|
|
|
31
31
|
async function clearanceUpdate(store, fn) {
|
|
32
32
|
const kept = new Map();
|
|
33
33
|
let seen;
|
|
34
|
+
let landed = false;
|
|
34
35
|
try {
|
|
35
36
|
for (const row of (await readClearanceRecord(store)).rows) {
|
|
36
37
|
if (row.entryText !== undefined)
|
|
37
38
|
kept.set(row.clearanceId, await keepCustody(store, row.clearanceId, row.entryText));
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
const answer = await store.updateDoc("origin-clearances", coerceClearances, (rec) => {
|
|
40
41
|
seen = [...rec.rows];
|
|
41
42
|
let moved = false;
|
|
42
43
|
for (const row of rec.rows) {
|
|
@@ -53,6 +54,8 @@ async function clearanceUpdate(store, fn) {
|
|
|
53
54
|
const out = fn(rec);
|
|
54
55
|
return out.next === undefined && moved ? { next: rec, result: out.result } : out;
|
|
55
56
|
});
|
|
57
|
+
landed = true;
|
|
58
|
+
return answer;
|
|
56
59
|
}
|
|
57
60
|
finally {
|
|
58
61
|
const rows = seen ?? (await readClearanceRecord(store).then((rec) => rec.rows, () => undefined));
|
|
@@ -67,7 +70,7 @@ async function clearanceUpdate(store, fn) {
|
|
|
67
70
|
deleteFailures.push(err);
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
if (deleteFailures.length > 0)
|
|
73
|
+
if (deleteFailures.length > 0 && landed)
|
|
71
74
|
throw deleteFailures[0];
|
|
72
75
|
}
|
|
73
76
|
}
|
|
@@ -93,6 +96,9 @@ function coerceClearances(raw) {
|
|
|
93
96
|
}
|
|
94
97
|
if (rec.version !== 1)
|
|
95
98
|
throw new ControlPlaneCorruptError(`memory origin-clearance ledger has an unrecognized version (${String(rec.version)}) — refusing (fail-closed)`);
|
|
99
|
+
if (rec.erasures !== undefined && !(Number.isSafeInteger(rec.erasures) && rec.erasures >= 0)) {
|
|
100
|
+
throw new ControlPlaneCorruptError("memory origin-clearance ledger carries a malformed erasure count (fail-closed)");
|
|
101
|
+
}
|
|
96
102
|
for (const r of rec.rows) {
|
|
97
103
|
const notErased = r?.custodyErased === undefined && r?.custodyErasedAt === undefined;
|
|
98
104
|
const custodyInline = typeof r?.entryText === "string" && r.entryText.length > 0 && r.custodyDigest === undefined && notErased;
|
|
@@ -140,25 +146,40 @@ function pendingClearanceRefusal(entryId) {
|
|
|
140
146
|
e.code = "memory.origin_clear_pending";
|
|
141
147
|
return e;
|
|
142
148
|
}
|
|
143
|
-
|
|
149
|
+
function erasedSinceJudgedRefusal(entryId) {
|
|
150
|
+
const e = new Error(`an erasure ran over the memory store while the clearance of entry ${JSON.stringify(entryId.slice(0, 80))} was being opened — nothing was recorded; call clearEntryOrigin again to re-judge (an erased entry then answers unknown).`);
|
|
151
|
+
e.code = "memory.origin_clear_conflict";
|
|
152
|
+
return e;
|
|
153
|
+
}
|
|
154
|
+
export async function readClearanceErasureCount(store) {
|
|
155
|
+
const raw = await store.readDoc("origin-clearances");
|
|
156
|
+
if (raw !== undefined)
|
|
157
|
+
return coerceClearances(raw).erasures ?? 0;
|
|
158
|
+
return clearanceUpdate(store, (rec) => ({ next: rec, result: rec.erasures ?? 0 }));
|
|
159
|
+
}
|
|
160
|
+
export async function openOriginClearance(store, row, judgedUnder) {
|
|
144
161
|
const pendingFor = (rec) => rec.rows.some((r) => r.entryId === row.entryId && r.status === "pending");
|
|
145
162
|
if (pendingFor(await readClearanceRecord(store)))
|
|
146
163
|
throw pendingClearanceRefusal(row.entryId);
|
|
147
164
|
const { entryText, ...rest } = row;
|
|
148
165
|
const custodyDigest = await keepCustody(store, row.clearanceId, entryText);
|
|
149
|
-
let
|
|
166
|
+
let refusedUnderLock = false;
|
|
150
167
|
try {
|
|
151
168
|
await clearanceUpdate(store, (rec) => {
|
|
152
169
|
if (pendingFor(rec)) {
|
|
153
|
-
|
|
170
|
+
refusedUnderLock = true;
|
|
154
171
|
throw pendingClearanceRefusal(row.entryId);
|
|
155
172
|
}
|
|
173
|
+
if ((rec.erasures ?? 0) !== judgedUnder) {
|
|
174
|
+
refusedUnderLock = true;
|
|
175
|
+
throw erasedSinceJudgedRefusal(row.entryId);
|
|
176
|
+
}
|
|
156
177
|
rec.rows.push({ ...rest, custodyDigest, status: "pending", events: [] });
|
|
157
178
|
return { next: rec, result: undefined };
|
|
158
179
|
});
|
|
159
180
|
}
|
|
160
181
|
catch (err) {
|
|
161
|
-
if (
|
|
182
|
+
if (refusedUnderLock)
|
|
162
183
|
await Promise.resolve(store.deleteObject("clearance-custody", clearanceCustodyName(row.clearanceId))).catch(() => undefined);
|
|
163
184
|
throw err;
|
|
164
185
|
}
|
|
@@ -195,12 +216,12 @@ export async function clearanceCustodyErased(store, clearanceId) {
|
|
|
195
216
|
return row === undefined || row.custodyErased === true;
|
|
196
217
|
}
|
|
197
218
|
export async function eraseOriginClearanceCustody(store, entryIds, at) {
|
|
198
|
-
if (entryIds.size === 0 ||
|
|
219
|
+
if (entryIds.size === 0 || (await store.readDoc("origin-clearances")) === undefined)
|
|
199
220
|
return { removed: 0, remaining: 0 };
|
|
200
221
|
const marked = await store.updateDoc("origin-clearances", coerceClearances, (rec) => {
|
|
222
|
+
rec.erasures = (rec.erasures ?? 0) + 1;
|
|
201
223
|
const objects = [];
|
|
202
224
|
let inline = 0;
|
|
203
|
-
let changed = false;
|
|
204
225
|
for (const row of rec.rows) {
|
|
205
226
|
if (!entryIds.has(row.entryId))
|
|
206
227
|
continue;
|
|
@@ -216,9 +237,8 @@ export async function eraseOriginClearanceCustody(store, entryIds, at) {
|
|
|
216
237
|
delete r.custodyDigest;
|
|
217
238
|
r.custodyErased = true;
|
|
218
239
|
r.custodyErasedAt = at;
|
|
219
|
-
changed = true;
|
|
220
240
|
}
|
|
221
|
-
return
|
|
241
|
+
return { next: rec, result: { objects, inline } };
|
|
222
242
|
});
|
|
223
243
|
const out = { removed: marked.inline, remaining: 0 };
|
|
224
244
|
for (const { clearanceId, take } of marked.objects) {
|
|
@@ -29,7 +29,7 @@ export function scanMemoryWrite(text, opts = {}) {
|
|
|
29
29
|
if (sanitizeUntrustedText(text, [...MEMORY_WRAPPER_TAGS]) !== text) {
|
|
30
30
|
findings.push({ code: "injection", reason: "contains a framing break-out tag (<system-reminder>/<user_memory> family)" });
|
|
31
31
|
}
|
|
32
|
-
else if (/^[ \t]*(?:<{3
|
|
32
|
+
else if (/^[ \t]*(?:<{3}<*|>{3}>*)/m.test(text) && defuseFenceMarkers(text) !== text) {
|
|
33
33
|
findings.push({ code: "injection", reason: "contains an untrusted-fence sentinel at line start (a run of 3+ '<' or '>')" });
|
|
34
34
|
}
|
|
35
35
|
return findings;
|
|
@@ -3,6 +3,8 @@ import { dirname, join, resolve } from "node:path";
|
|
|
3
3
|
import { err, FileError, ok } from "../../internal/harness.js";
|
|
4
4
|
import { performsIo } from "../remote-env.js";
|
|
5
5
|
import { thrownText } from "../thrown-value.js";
|
|
6
|
+
import { envErrorDetail } from "../../tools/fs/env-error-detail.js";
|
|
7
|
+
import { describeRejectedValue } from "../tool-search-setting.js";
|
|
6
8
|
import { canonicalize } from "./layout.js";
|
|
7
9
|
function pathSegmentsDualFamily(p) {
|
|
8
10
|
return p.split(/[\\/]/).filter(Boolean);
|
|
@@ -266,7 +268,7 @@ async function readOrFault(path, read) {
|
|
|
266
268
|
r = { ok: false, error: { message: thrownText(e) } };
|
|
267
269
|
}
|
|
268
270
|
if (!r.ok)
|
|
269
|
-
throw identityError("config.memory_project_marker", `project marker lookup could not read ${path}: ${r.error.message}`);
|
|
271
|
+
throw identityError("config.memory_project_marker", `project marker lookup could not read ${path}: ${envErrorDetail(r.error.message)}`);
|
|
270
272
|
return r.value;
|
|
271
273
|
}
|
|
272
274
|
const existsOrFault = (fs, path) => readOrFault(path, () => fs.exists(path));
|
|
@@ -312,8 +314,7 @@ export async function resolveProjectId(fs, rootDir) {
|
|
|
312
314
|
}
|
|
313
315
|
export async function resolveSessionProject(fs, taskRoot, declared) {
|
|
314
316
|
if (declared !== undefined && (typeof declared !== "string" || !UUID_RE.test(declared))) {
|
|
315
|
-
|
|
316
|
-
throw identityError("config.project_id_invalid", `TaskSpec.projectId must be a project UUID (the id a \`.sema/project\` marker carries), got ${shown}; the leg is refused rather than filed under no project.`);
|
|
317
|
+
throw identityError("config.project_id_invalid", `TaskSpec.projectId must be a project UUID (the id a \`.sema/project\` marker carries), got ${describeRejectedValue(declared)}; the leg is refused rather than filed under no project.`);
|
|
317
318
|
}
|
|
318
319
|
const declaredId = declared?.toLowerCase();
|
|
319
320
|
let marker;
|
|
@@ -40,10 +40,22 @@ export async function sessionWriteHomeOf(input) {
|
|
|
40
40
|
return { state: "unreadable" };
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
function readingOf(reading) {
|
|
44
|
+
if (typeof reading !== "object" || reading === null)
|
|
45
|
+
return { state: "unreadable" };
|
|
46
|
+
const r = reading;
|
|
47
|
+
if (r.state === "none")
|
|
48
|
+
return { state: "none" };
|
|
49
|
+
if (r.state === "named" && typeof r.home === "string" && r.home.trim() !== "" && typeof r.at === "number" && Number.isFinite(r.at)) {
|
|
50
|
+
return { state: "named", home: r.home, at: r.at };
|
|
51
|
+
}
|
|
52
|
+
return { state: "unreadable" };
|
|
53
|
+
}
|
|
43
54
|
export function chooseSessionWriteHome(readings) {
|
|
44
55
|
let best;
|
|
45
56
|
let tied = false;
|
|
46
|
-
for (const
|
|
57
|
+
for (const given of readings) {
|
|
58
|
+
const r = readingOf(given);
|
|
47
59
|
if (r.state === "unreadable")
|
|
48
60
|
return undefined;
|
|
49
61
|
if (r.state !== "named")
|
|
@@ -203,7 +203,7 @@ export interface MemorySyncClientResult {
|
|
|
203
203
|
warnings?: string[];
|
|
204
204
|
}
|
|
205
205
|
/** Does a name a sync carries verbatim (a peer identity, a target, a scope key) hold a credential — a URL with userinfo
|
|
206
|
-
* (
|
|
206
|
+
* (one holding a user or a password, a bare user name included: the slot is the credential's), or anything the same-principal egress pass would
|
|
207
207
|
* redact? Such a name is refused, never cleaned: a cleaned identity is another identity, and the cursor taken under it
|
|
208
208
|
* would not be this peer's. The userinfo is looked for wherever the string holds a URL's authority, not only at its head:
|
|
209
209
|
* a name that wraps a URL under another scheme (`proj:https://user@host/…`) parses as an opaque path, with no userinfo
|
|
@@ -7,6 +7,7 @@ import { MEMORY_ORIGIN_CAUSES } from "./types.js";
|
|
|
7
7
|
import { directoryPinOf } from "./dual-root.js";
|
|
8
8
|
import { landingPathOf } from "./layout.js";
|
|
9
9
|
import { egressText } from "../untrusted-egress.js";
|
|
10
|
+
import { userinfoHolds } from "@sema-agent/primitives";
|
|
10
11
|
import { REDACTION_MARKS } from "../redaction-marks.js";
|
|
11
12
|
import { isReplicableScope } from "./scope-contract.js";
|
|
12
13
|
const DROP_THE_CURSOR = "drop the cursor to accept re-convergence from an empty baseline — entries changed on both sides are reported as conflicts, " +
|
|
@@ -127,7 +128,8 @@ export function carriesCredential(peer) {
|
|
|
127
128
|
const rest = peer.slice(mark + 3);
|
|
128
129
|
const end = rest.search(SPECIAL_SCHEMES.has(peer.slice(from, mark).toLowerCase()) ? /[\s/\\?#]/ : /[\s/?#]/);
|
|
129
130
|
const authority = end === -1 ? rest : rest.slice(0, end);
|
|
130
|
-
|
|
131
|
+
const at = authority.lastIndexOf("@");
|
|
132
|
+
if (at !== -1 && userinfoHolds(authority.slice(0, at)))
|
|
131
133
|
return true;
|
|
132
134
|
}
|
|
133
135
|
try {
|
|
@@ -82,11 +82,12 @@ export interface MemoryEnginePlane {
|
|
|
82
82
|
* that took up marked content writes marked entries from then on. Consulted only under
|
|
83
83
|
* `provenance: "carry"` (the seat is not even wired under "off").
|
|
84
84
|
*
|
|
85
|
-
* A THROW here withholds the delivery, fail-closed (the tool answers a
|
|
86
|
-
* the taint cannot be recorded, the content must not enter the transcript —
|
|
87
|
-
* settlement account's record-failure arm.
|
|
85
|
+
* A THROW (or a rejected promise) here withholds the delivery, fail-closed (the tool answers a
|
|
86
|
+
* structured failure): if the taint cannot be recorded, the content must not enter the transcript —
|
|
87
|
+
* the same law as the settlement account's record-failure arm. A promise is awaited: the content is
|
|
88
|
+
* delivered once the record stands.
|
|
88
89
|
*/
|
|
89
|
-
onTaintedDelivery?: (ids: readonly string[]) => void
|
|
90
|
+
onTaintedDelivery?: (ids: readonly string[]) => void | Promise<void>;
|
|
90
91
|
/**
|
|
91
92
|
* design/383 §1.7 — the provenance mode of the WRITE-SIDE engine that owns this plane, read off
|
|
92
93
|
* the engine itself (`MemoryEngine.provenanceMode`), never re-declared by hand. Present ⇒ the
|
|
@@ -545,7 +545,7 @@ export function createMemoryEngineTools(opts) {
|
|
|
545
545
|
}
|
|
546
546
|
if (exposed) {
|
|
547
547
|
try {
|
|
548
|
-
entryPlane?.onTaintedDelivery?.([entry.id]);
|
|
548
|
+
await entryPlane?.onTaintedDelivery?.([entry.id]);
|
|
549
549
|
}
|
|
550
550
|
catch {
|
|
551
551
|
return refusedGet("taint_mark_failed", `Memory entry ${entry.id.slice(0, 64)} was not delivered: its external-origin take-up could not be recorded for this session (fail-closed). Report this to the operator and retry.`, "failed", { id: entry.id });
|
|
@@ -10,12 +10,25 @@ import type { LlmConsolidationPlan } from "./distiller.js";
|
|
|
10
10
|
* read face (recall-taint propagation);
|
|
11
11
|
* - `"static"` — a capability over-approximation under the static-face evidence standard
|
|
12
12
|
* (or an evidence window that closed unprovable);
|
|
13
|
-
* - `"unattributed"` —
|
|
13
|
+
* - `"unattributed"` — content whose writer session could not be attributed: a crash-residue file, or
|
|
14
|
+
* a write in a window another live writer of the same layer shared while that
|
|
15
|
+
* writer was exposed or of unknown state.
|
|
14
16
|
* ONE extensibility seat on purpose (§13-5): future exposure sources (hook/skill/import lanes)
|
|
15
17
|
* append here and ride the same carriage — nothing else in the origin shape changes per source.
|
|
16
18
|
*/
|
|
17
19
|
export declare const MEMORY_ORIGIN_CAUSES: readonly ["observed", "derived", "static", "unattributed"];
|
|
18
20
|
export type MemoryOriginCause = (typeof MEMORY_ORIGIN_CAUSES)[number];
|
|
21
|
+
/**
|
|
22
|
+
* Who a recorded contribution or terminal is attributed to — one word set; each seat mints a subset:
|
|
23
|
+
* - `"self"` — the attributed party itself reached it (a consolidation plan's apply landed the terminal);
|
|
24
|
+
* - `"unattributed"` — who reached it cannot be known (a consolidation replay found the terminal standing);
|
|
25
|
+
* - `"overlap"` — the session did not commit it: it was another live writer of the same memory
|
|
26
|
+
* layer in the committing session's window, so the committed bytes may be its
|
|
27
|
+
* (a lineage contribution row; the writer's own row carries no word).
|
|
28
|
+
* Consolidation's directed / receipt patches mint `"self" | "unattributed"`; lineage rows mint `"overlap"`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const MEMORY_ATTRIBUTIONS: readonly ["self", "unattributed", "overlap"];
|
|
31
|
+
export type MemoryAttribution = (typeof MEMORY_ATTRIBUTIONS)[number];
|
|
19
32
|
/**
|
|
20
33
|
* design/336 §2.1 — the typed external-origin marker carried in {@link MemoryEntryFrontmatter.origin}.
|
|
21
34
|
* Single-value `taint` union on purpose: there is no `"clean"` spelling (absence is the only
|
|
@@ -666,10 +679,14 @@ export interface MemorySessionHandle {
|
|
|
666
679
|
* session-long handle is not worth the restore convenience (the index, one bounded file the sweep
|
|
667
680
|
* restores BYTES of, keeps its text). Absent ⇔ no census was taken (no write plane, so no sweep
|
|
668
681
|
* either) or the handle predates the field ⇒ the sweep keeps its historic comparands.
|
|
682
|
+
* `at`: the instant this census's write window counts from (the materialize, or the scan start of the
|
|
683
|
+
* harvest that re-minted it) — the harvest asks the session account for the other writers live since
|
|
684
|
+
* then. Absent (a hand-built census) ⇒ the window counts from the epoch: every recorded writer is asked.
|
|
669
685
|
*/
|
|
670
686
|
planeBaseline?: {
|
|
671
687
|
files: Map<string, string>;
|
|
672
688
|
index?: string;
|
|
689
|
+
at?: number;
|
|
673
690
|
};
|
|
674
691
|
/**
|
|
675
692
|
* The read-only layers' census: every entry file of every layer this session holds read-only,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const MEMORY_ORIGIN_CAUSES = Object.freeze(["observed", "derived", "static", "unattributed"]);
|
|
2
|
+
export const MEMORY_ATTRIBUTIONS = Object.freeze(["self", "unattributed", "overlap"]);
|
|
2
3
|
export const MEMORY_GOVERNANCE_DOC_NAMES = Object.freeze(["lineage", "challenges", "settlements", "session-accounts", "announcements", "holds", "origin-clearances"]);
|
|
3
4
|
export const MEMORY_CONTROL_OBJECT_KINDS = Object.freeze(["pollution", "import-receipt", "quarantine", "hold", "clearance-custody", "capture"]);
|
|
4
5
|
export function writableRootOf(handle) {
|
package/dist/core/memory.d.ts
CHANGED
|
@@ -213,7 +213,7 @@ export declare const MEMORY_WRAPPER_TAGS: readonly string[];
|
|
|
213
213
|
* own `</scope>` and open a fresh `<scope name="managed">`: a forged higher-authority layer landing
|
|
214
214
|
* at the END of the block, where this function's own contract puts the highest-priority layer.
|
|
215
215
|
* Project-scope content is repository-controlled by our own stated posture
|
|
216
|
-
* (
|
|
216
|
+
* (the instruction frames' opening), i.e. reachable from untrusted input.
|
|
217
217
|
* ② the SIBLING envelopes — nesting a forged `<task-notification>` or `<new-diagnostics>` inside
|
|
218
218
|
* `<user_memory>` does not make it inert: the TAG is what a model reads as harness speech, and
|
|
219
219
|
* this payload lands in the SYSTEM PROMPT. Widening is safe precisely here because the sanitizer
|
package/dist/core/memory.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parseScopeKey } from "./memory-engine/scope-contract.js";
|
|
2
2
|
import { attrEscape } from "./task-notification.js";
|
|
3
3
|
import { sanitizeUntrustedText, ENGINE_AUTHORITY_ENVELOPE_TAGS } from "./untrusted-text.js";
|
|
4
|
+
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
4
5
|
import { CREDENTIAL_VOCABULARY, scanSecrets } from "@sema-agent/primitives";
|
|
5
6
|
const REFUSE_WRITE_POLICY = Object.freeze({
|
|
6
7
|
grade: "strict",
|
|
@@ -39,12 +40,7 @@ export function normalizeMemorySpec(input) {
|
|
|
39
40
|
}
|
|
40
41
|
if (input.capture !== undefined && input.capture !== "off") {
|
|
41
42
|
const rawCapture = input.capture;
|
|
42
|
-
const
|
|
43
|
-
? JSON.stringify(rawCapture.length > 64 ? `${rawCapture.slice(0, 64)}…` : rawCapture)
|
|
44
|
-
: rawCapture === null
|
|
45
|
-
? "null"
|
|
46
|
-
: typeof rawCapture;
|
|
47
|
-
const e = new Error(`TaskSpec.memory.capture must be exactly "off" when present (got ${got}) — the capture opt-out is a ` +
|
|
43
|
+
const e = new Error(`TaskSpec.memory.capture must be exactly "off" when present (got ${describeRejectedValue(rawCapture)}) — the capture opt-out is a ` +
|
|
48
44
|
`single-member closed set (absence = capture as usual; there is no "on" spelling). Refusing to guess ` +
|
|
49
45
|
`which way a privacy switch was meant.`);
|
|
50
46
|
e.code = "config.memory_capture_spelling";
|
|
@@ -20,6 +20,7 @@ import { type ToolRoster } from "./tool-roster.js";
|
|
|
20
20
|
import { type PermissionMode } from "./ask-origin.js";
|
|
21
21
|
import type { RuntimeCaps } from "./runtime-caps.js";
|
|
22
22
|
import type { RunnerDeps } from "./runner-deps.js";
|
|
23
|
+
import { type ResumeConfigRefusalField } from "./checkpoint-features.js";
|
|
23
24
|
import type { TaskSpec } from "./task-spec.js";
|
|
24
25
|
/** WHY an effective mode is not the requested one: the deployment's deny bit (`RuntimeCaps.bypassPermissions` /
|
|
25
26
|
* `RuntimeCaps.autoMode`), a requested `auto` with no classifier face wired, or a child's declaration folded under
|
|
@@ -49,6 +50,12 @@ export interface ModePolicy {
|
|
|
49
50
|
export declare const ACCEPT_EDITS_FILE_COMMANDS: readonly ["mkdir", "touch", "rm", "rmdir", "mv", "cp", "sed"];
|
|
50
51
|
/** The mode → seats table, total over {@link PermissionMode}. */
|
|
51
52
|
export declare function modePolicyOf(mode: PermissionMode): ModePolicy;
|
|
53
|
+
/** The spec with the mode's own seats applied: `plan` mounts the plan pair (every other tool stays, the mode gate asks at
|
|
54
|
+
* the call). The one place a mode becomes a spec seat — the leg's prepare and the static plan read both go through it, so a
|
|
55
|
+
* deployment's static answer for a mode is the answer the leg mounts. */
|
|
56
|
+
export declare function withModeSeats<S extends {
|
|
57
|
+
readonly enablePlanMode?: boolean;
|
|
58
|
+
}>(spec: S, mode: PermissionMode): S;
|
|
52
59
|
/**
|
|
53
60
|
* Is this call a shell command the mode's {@link ModePolicy.fileCommands} cover — every segment a SIMPLE command
|
|
54
61
|
* whose command word is, as written, one of them? The reference implementation's reading (it compares the first
|
|
@@ -181,7 +188,7 @@ export declare function refusePermissionModeDoors(spec: Pick<TaskSpec, "permissi
|
|
|
181
188
|
* leaves a refusal of one of {@link CHECKPOINT_CONFIG_REFUSAL_CODES} as `checkpoint.config_refused` — the sentence, prepare's code as `detail.code`, the input
|
|
182
189
|
* that carries it as `detail.field`, and prepare's own arm as `detail.reason` when its error names one. Anything else leaves as it was thrown. What the
|
|
183
190
|
* door returns is returned (a {@link ConfigDoorEntry}: the resume's way of entering a door the config-door phase lists). */
|
|
184
|
-
export declare function asResumeConfigRefusal<T>(field:
|
|
191
|
+
export declare function asResumeConfigRefusal<T>(field: ResumeConfigRefusalField, screen: () => T): T;
|
|
185
192
|
/** The three-member answer every mode question gets — the manifest member, the steer verb's return value and the
|
|
186
193
|
* fold notice's detail share it. `requested` is absent when the caller declared nothing (a root inherits `default`,
|
|
187
194
|
* a child inherits its parent). */
|
package/dist/core/mode-policy.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
1
2
|
import { createFsWriteGatePolicy } from "./fs-write-gate-policy.js";
|
|
2
3
|
import { isProtectedWrite } from "./tool-registry.js";
|
|
3
4
|
import { answeredFor } from "./tool-policy.js";
|
|
@@ -22,6 +23,9 @@ const MODE_POLICY_TABLE = {
|
|
|
22
23
|
export function modePolicyOf(mode) {
|
|
23
24
|
return MODE_POLICY_TABLE[mode];
|
|
24
25
|
}
|
|
26
|
+
export function withModeSeats(spec, mode) {
|
|
27
|
+
return modePolicyOf(mode).enablePlanMode && spec.enablePlanMode !== true ? { ...spec, enablePlanMode: true } : spec;
|
|
28
|
+
}
|
|
25
29
|
export function modeAcceptsFileCommand(mode, toolName, args) {
|
|
26
30
|
const commands = modePolicyOf(mode).fileCommands;
|
|
27
31
|
if (commands.length === 0 || toolName !== COMMAND_RULE_TOOL)
|
|
@@ -109,13 +113,13 @@ export function modeRequestAfterResume(seat, recorded, outcome) {
|
|
|
109
113
|
export function refusePermissionModeDoors(spec) {
|
|
110
114
|
const mode = spec.permissionMode;
|
|
111
115
|
if (mode !== undefined && !isPermissionMode(mode)) {
|
|
112
|
-
const e = new Error(`permissionMode must be one of ${PERMISSION_MODES.map((w) => JSON.stringify(w)).join(", ")} when present (got ${
|
|
116
|
+
const e = new Error(`permissionMode must be one of ${PERMISSION_MODES.map((w) => JSON.stringify(w)).join(", ")} when present (got ${describeRejectedValue(mode)}) — omit it for the default mode; an unrecognized word is refused rather than read as any mode.`);
|
|
113
117
|
e.code = "config.permission_mode_invalid";
|
|
114
118
|
throw e;
|
|
115
119
|
}
|
|
116
120
|
const floor = spec.shellGate;
|
|
117
121
|
if (floor !== undefined && floor !== "always") {
|
|
118
|
-
const e = new Error(`shellGate must be the floor word "always" when present (got ${
|
|
122
|
+
const e = new Error(`shellGate must be the floor word "always" when present (got ${describeRejectedValue(floor)}) — the doctrine values "off" / "classify" are retired: the shell's shape tier is installed on every full shell and the permission mode (permissionMode) decides what its asks become; omit shellGate for no operator floor.`);
|
|
119
123
|
e.code = "config.shell_gate_value_retired";
|
|
120
124
|
throw e;
|
|
121
125
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model request's FALLBACK CHAIN — the catalog half and the deployment's gate.
|
|
3
|
+
*
|
|
4
|
+
* The rule, once: a model request has ONE chain — the requested catalog entry, then the entries its `Model.fallbacks` words name,
|
|
5
|
+
* in order; every hop is served by the deployment's own Brain; only a failure BEFORE the first content, for a reason the gate
|
|
6
|
+
* admits, moves the request to the next hop. Where a chain is declared (the catalog entry), how it is walked (the model lane,
|
|
7
|
+
* `brain/model-lane.ts`) and why a hop is left (the gate below) each have one place.
|
|
8
|
+
*
|
|
9
|
+
* This module is what the catalog door resolves and what the deployment configures:
|
|
10
|
+
* - the CHAIN TABLE: each catalog entry's words resolved over the catalog generation that received it, keyed by the received
|
|
11
|
+
* entry object, so a leg in flight keeps the chain of the generation its model came from and a hot-swapped catalog writes the
|
|
12
|
+
* chains of its own entries. The lane reads a chain by the Model object a request names — never by a word at dispatch time.
|
|
13
|
+
* - the GATE: the closed reason words a hop failure is read in ({@link DEGRADE_REASONS}; the same words `TaskResult.degraded`
|
|
14
|
+
* reports), the default gate, and the deployment's policy seat (`RunnerDeps.modelFallback`), received once.
|
|
15
|
+
* - the code every refusal of a fallback declaration carries: `config.model_fallback_invalid`.
|
|
16
|
+
*/
|
|
17
|
+
import type { Model } from "../internal/llm.js";
|
|
18
|
+
/**
|
|
19
|
+
* Why a request left a hop — the reason words of the fallback gate, the words `TaskResult.degraded.reason` reports, one list both
|
|
20
|
+
* ways (a word a gate is configured with is a word a result can carry):
|
|
21
|
+
* - `rate_limit` (`[rate_limit]`), `server_error` (`[server]`: 5xx incl. 529, 408/409, past the brain's own retry budget),
|
|
22
|
+
* `last_resort` (`[http]`: 404 and other statuses no retry helps), `breaker_open` (a circuit breaker's open-circuit fast-fail) —
|
|
23
|
+
* the default gate;
|
|
24
|
+
* - `network` (`[network]` that is not an open circuit: a connection that never formed, a first-token timeout, the lane's own
|
|
25
|
+
* per-hop first-token deadline), `auth` (`[auth]`: 401/403), `stream_torn` (`[stream_torn]`: a response lost before any content) —
|
|
26
|
+
* admitted only when the deployment adds them;
|
|
27
|
+
* - `budget` — the run's near-budget switch (`TaskSpec.limits.degrade`), never a gate word.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEGRADE_REASONS: readonly ["breaker_open", "rate_limit", "budget", "server_error", "last_resort", "network", "auth", "stream_torn"];
|
|
30
|
+
export type DegradeReason = (typeof DEGRADE_REASONS)[number];
|
|
31
|
+
/** Whether a value is one of the reason words. */
|
|
32
|
+
export declare function isDegradeReason(value: unknown): value is DegradeReason;
|
|
33
|
+
/** The gate a deployment that configures none walks on: the four reactive classes. */
|
|
34
|
+
export declare const DEFAULT_FALLBACK_GATE: readonly DegradeReason[];
|
|
35
|
+
/** What a gate row may admit besides a list of reason words: every failure the shared judge lets through at all. */
|
|
36
|
+
export declare const ANY_HOP_FAILURE: "any";
|
|
37
|
+
/**
|
|
38
|
+
* One ROW of the hop gate — which failures before a hop's first content move a request to the next hop. There is ONE judge
|
|
39
|
+
* of a hop's failure (`gateReadingOf`, `brain/model-lane.ts`); a row is only the data it reads:
|
|
40
|
+
* - the MODEL row is the deployment's policy ({@link ReceivedModelFallbackPolicy.on}): reason words, the four reactive ones unless the
|
|
41
|
+
* deployment adds more; a first hop's `invalid_request` and a failure the Brain stated no code for never move it;
|
|
42
|
+
* - the GATEWAY row ({@link GATEWAY_HOP_GATE}, `createFailoverBrain`'s hops): any failure before content moves it — a gateway swap
|
|
43
|
+
* serves the same model, so even an `invalid_request` or an uncoded failure may be that gateway's own.
|
|
44
|
+
* Both rows share what never moves a hop: a caller's abort, anything after content, a refusal of the response's own kind
|
|
45
|
+
* (`length_empty`, `image_unprocessable`, `tool_schema_refused`).
|
|
46
|
+
*/
|
|
47
|
+
export interface HopGate {
|
|
48
|
+
readonly on: readonly DegradeReason[] | typeof ANY_HOP_FAILURE;
|
|
49
|
+
}
|
|
50
|
+
/** The gateway row of the hop gate. */
|
|
51
|
+
export declare const GATEWAY_HOP_GATE: HopGate;
|
|
52
|
+
/** Whether a gate row admits `reason` (a list holds it, or the row admits any failure). */
|
|
53
|
+
export declare function hopGateAdmits(gate: HopGate, reason: DegradeReason): boolean;
|
|
54
|
+
/** How many words one entry's chain may name (the reference implementation's cap of three); more is refused, never truncated. */
|
|
55
|
+
export declare const MAX_MODEL_FALLBACKS = 3;
|
|
56
|
+
/** The code of every refusal of a fallback declaration: a catalog entry's words, a Model object carrying them outside the catalog,
|
|
57
|
+
* the deployment's policy seat. */
|
|
58
|
+
export declare const MODEL_FALLBACK_INVALID = "config.model_fallback_invalid";
|
|
59
|
+
/** The refusal of a fallback declaration, at the seat that wrote it (`detail.field`). */
|
|
60
|
+
export declare function modelFallbackRefusal(field: string, message: string): Error & {
|
|
61
|
+
code: typeof MODEL_FALLBACK_INVALID;
|
|
62
|
+
detail: {
|
|
63
|
+
field: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** The chain the catalog door resolved for `model` — the hops after it, nearest first; empty for a model without one (an entry
|
|
67
|
+
* that declares none, a Model object that is no catalog entry). */
|
|
68
|
+
export declare function modelFallbackChainOf(model: Model): readonly Model[];
|
|
69
|
+
/** The chain recorded for `model`, or `undefined` when none was (the catalog door's read; the lane reads {@link modelFallbackChainOf}). */
|
|
70
|
+
export declare function recordedFallbackChainOf(model: Model): readonly Model[] | undefined;
|
|
71
|
+
/** The catalog door's write: `model`'s chain as this generation resolved it. Only the catalog door calls it, once per snapshot. */
|
|
72
|
+
export declare function recordFallbackChain(model: Model, hops: readonly Model[]): void;
|
|
73
|
+
/** The deployment's fallback policy as written at `RunnerDeps.modelFallback`. */
|
|
74
|
+
export interface ModelFallbackPolicy {
|
|
75
|
+
/**
|
|
76
|
+
* The reasons a hop failure before its first content moves the request to the next hop; absent ⇒ {@link DEFAULT_FALLBACK_GATE}
|
|
77
|
+
* (`network`, `auth` and `stream_torn` are the deployment's to add; `budget` is not a gate word). Never moved, whatever `on`
|
|
78
|
+
* says: a first hop's `invalid_request` (a later hop's moves on), a refusal, an empty-length cut, an image or tool schema the
|
|
79
|
+
* provider refused, the caller's abort, a failure the Brain stated no code for, and any failure after content (nothing is replayed).
|
|
80
|
+
*/
|
|
81
|
+
on?: readonly DegradeReason[];
|
|
82
|
+
/**
|
|
83
|
+
* A first-token deadline for every hop that is not the chain's last: a hop that streams no content within this many ms is
|
|
84
|
+
* abandoned as a `network` failure (its signal aborted with that coded reason, every wait on it cut), so `network` must be in
|
|
85
|
+
* `on`. The last hop keeps only the Brain's own clocks. Absent ⇒ none.
|
|
86
|
+
*/
|
|
87
|
+
firstTokenMs?: number;
|
|
88
|
+
}
|
|
89
|
+
/** The policy the lane walks on — the declared shape, frozen, with the gate filled in. */
|
|
90
|
+
export interface ReceivedModelFallbackPolicy {
|
|
91
|
+
readonly on: readonly DegradeReason[];
|
|
92
|
+
readonly firstTokenMs?: number;
|
|
93
|
+
}
|
|
94
|
+
/** The policy of a deployment that configures none. */
|
|
95
|
+
export declare const DEFAULT_MODEL_FALLBACK_POLICY: ReceivedModelFallbackPolicy;
|
|
96
|
+
/**
|
|
97
|
+
* THE policy door: `RunnerDeps.modelFallback` read once (a plain record of `on` / `firstTokenMs`, nothing else) and judged — `on`
|
|
98
|
+
* a list of reason words without `budget` and without a repeat, `firstTokenMs` a whole number of milliseconds a timer can hold,
|
|
99
|
+
* and a deadline only beside a gate that admits `network` (the deadline cuts a hop AS a network failure; without `network` it
|
|
100
|
+
* would end the request on the hop it was meant to leave). Every refusal is `config.model_fallback_invalid`. Absent ⇒ the
|
|
101
|
+
* default policy. A policy this door received comes back as itself.
|
|
102
|
+
*/
|
|
103
|
+
export declare function receiveModelFallbackPolicy(value: unknown, field: string): ReceivedModelFallbackPolicy;
|