@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
|
@@ -56,7 +56,7 @@ function soleMarkerText(m) {
|
|
|
56
56
|
const text = content[0].text;
|
|
57
57
|
return typeof text === "string" ? text : undefined;
|
|
58
58
|
}
|
|
59
|
-
function isCleared(m) {
|
|
59
|
+
export function isCleared(m) {
|
|
60
60
|
const text = soleMarkerText(m);
|
|
61
61
|
if (text !== undefined && (text === CC_CLEARED_MARKER || text.startsWith(CC_CLEARED_EXTENDED_PREFIX)))
|
|
62
62
|
return true;
|
|
@@ -127,6 +127,7 @@ const CONTEXT_EDIT_OPTION_KEYS = new Set([
|
|
|
127
127
|
"keepRecentToolResults",
|
|
128
128
|
"offload",
|
|
129
129
|
"anchoredTotalTokens",
|
|
130
|
+
"netSavings",
|
|
130
131
|
"charsPerToken",
|
|
131
132
|
"compactableTools",
|
|
132
133
|
"toolNameOf",
|
|
@@ -168,7 +169,8 @@ export function clearStaleToolResults(messages, opts) {
|
|
|
168
169
|
if (clearable.length === 0) {
|
|
169
170
|
return messages;
|
|
170
171
|
}
|
|
171
|
-
const
|
|
172
|
+
const structuralSaved = clearable.reduce((sum, { target }) => sum + structuralClearSavings(target), 0);
|
|
173
|
+
const tokensSaved = opts.netSavings !== undefined ? opts.netSavings(clearable.map(({ idx }) => idx), structuralSaved) : structuralSaved;
|
|
172
174
|
if (tokensSaved < MIN_CLEAR_SAVINGS_TOKENS) {
|
|
173
175
|
return messages;
|
|
174
176
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { AgentMessage } from "../internal/harness.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type Model } from "../internal/llm.js";
|
|
3
3
|
import { type ContextWindowOverlay } from "./context-settings.js";
|
|
4
4
|
/**
|
|
5
5
|
* Last-resort, in-task context trim. Proper compaction (LLM summary) runs *between* tasks;
|
|
6
6
|
* this prevents a single task whose internal tool-loop balloons from overflowing the window.
|
|
7
7
|
*
|
|
8
|
-
* Keeps
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Keeps the request's irreducible core — every summary message and every row `held` names (the
|
|
9
|
+
* run's objective and its attachments, {@link objectiveInputRows}: the person's words are what the
|
|
10
|
+
* request is about, and a request without them answers nobody) — plus the most recent other
|
|
11
|
+
* messages that fit the budget, dropping older ones at a safe boundary (never starting on an orphan
|
|
12
|
+
* toolResult). The newest message rides the request unless it is itself part of the core. A core
|
|
13
|
+
* that alone exceeds the budget is not this function's to repair: the caller measures it with
|
|
14
|
+
* {@link irreducibleCoreTokens} and ends the request loudly instead. Returns the original array
|
|
15
|
+
* when already within budget.
|
|
11
16
|
*
|
|
12
17
|
* design/123 D3 (= fable-M5) — anchored accounting: when `anchoredTotalTokens`
|
|
13
18
|
* (= `estimateContextTokens(messages, charsPerToken).tokens` for the SAME array) is provided, the
|
|
@@ -18,8 +23,68 @@ import { type ContextWindowOverlay } from "./context-settings.js";
|
|
|
18
23
|
* a request-view drop only pays off on the NEXT request), so the trim keeps cutting deeper until
|
|
19
24
|
* the anchored total meets the budget or only the minimal tail is left. Absent ⇒ legacy structural
|
|
20
25
|
* behavior, byte-identical. `charsPerToken` (design/123 D2): structural coefficient, default 3 (design/374 slice 4).
|
|
26
|
+
* `sizeOf` (absent ⇒ the structural estimate): what one message of `messages` costs as this request sends it — the
|
|
27
|
+
* request's copy projection renders a repeated copy of a file as one sentence, so its cost depends on the view
|
|
28
|
+
* ({@link RequestSize}); a trim that changes which copy comes first is measured again by the caller.
|
|
21
29
|
*/
|
|
22
|
-
export declare function trimToBudget(messages: AgentMessage[], budgetTokens: number, anchoredTotalTokens?: number, charsPerToken?: number): AgentMessage[];
|
|
30
|
+
export declare function trimToBudget(messages: AgentMessage[], budgetTokens: number, anchoredTotalTokens?: number, charsPerToken?: number, held?: (m: AgentMessage) => boolean, sizeOf?: RequestSize): AgentMessage[];
|
|
31
|
+
/**
|
|
32
|
+
* The tokens of a request view's irreducible core — what no trim may drop: the compaction summaries and the rows `held`
|
|
33
|
+
* names (the run's objective and its attachments). One measure, read by the two places that ask whether the core fits
|
|
34
|
+
* one request: the guard chain's last resort (a core over the guard line ends the request loudly instead of being
|
|
35
|
+
* trimmed into one that answers nobody) and the objective's admission (refused before anything is sent when its core
|
|
36
|
+
* would not fit). Structural, in the model's coefficient — the trim's own estimator; `sizeOf` as the trim reads it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function irreducibleCoreTokens(view: readonly AgentMessage[], held: ((m: AgentMessage) => boolean) | undefined, charsPerToken?: number, sizeOf?: RequestSize): number;
|
|
39
|
+
/** What one message of a request view costs as the request sends it (structural tokens, the model's coefficient). */
|
|
40
|
+
export type RequestSize = (m: AgentMessage) => number;
|
|
41
|
+
/** The run's objective input as the request guard holds it: the exact text the objective's message was sent with and the
|
|
42
|
+
* `human_input` key its attachment frames carry. */
|
|
43
|
+
export interface ObjectiveInput {
|
|
44
|
+
readonly text: string;
|
|
45
|
+
readonly inputId: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The rows of a request view that ARE the run's objective input: the newest user message that opens with the objective's
|
|
49
|
+
* exact text, and every attachment frame declared on it (its delivery record names the input; a compaction's restore
|
|
50
|
+
* frames are the engine's re-reads, not the person's input). Read off the view itself — the text and the delivery record
|
|
51
|
+
* are what a rebuilt, copied or reloaded transcript keeps; an older message with the same words is history.
|
|
52
|
+
*/
|
|
53
|
+
export declare function objectiveInputRows(view: readonly AgentMessage[], input: ObjectiveInput | undefined): ReadonlySet<AgentMessage>;
|
|
54
|
+
/**
|
|
55
|
+
* The engine frames a request carries beside the objective input — what the guard trim holds with it and what a landed
|
|
56
|
+
* compaction states again: the newest carrier of each `protectedTexts` frame (its text inside an ENGINE region of a user
|
|
57
|
+
* message — the permission posture's), and the newest frame of each task-root instruction file (by label; a later
|
|
58
|
+
* withdrawal of that label releases it). An older copy is history and trims like it. Read off the view itself.
|
|
59
|
+
*/
|
|
60
|
+
export declare function heldEngineFrames(view: readonly AgentMessage[], protectedTexts: readonly string[]): Set<AgentMessage>;
|
|
61
|
+
/**
|
|
62
|
+
* The tokens a landed compaction states again whatever it summarizes: the task-root instruction frames the view holds
|
|
63
|
+
* (each a frame message of its own, {@link heldEngineFrames}) and the frame texts a landing writes again — the
|
|
64
|
+
* `protectedTexts` (the permission posture: its text, never the message that carries it, which may be the objective's own)
|
|
65
|
+
* and the `restatedTexts` (the git frame). With the fixed prefix it is the floor no summary gets a request below — the
|
|
66
|
+
* compaction trigger's "window below overhead" judgment reads the two together, while the prefix alone stays what the
|
|
67
|
+
* anchor-less trigger adds.
|
|
68
|
+
*/
|
|
69
|
+
export declare function restatedFramesTokens(view: readonly AgentMessage[], held: {
|
|
70
|
+
readonly protectedTexts: readonly string[];
|
|
71
|
+
readonly restatedTexts: readonly string[];
|
|
72
|
+
}, charsPerToken?: number): number;
|
|
73
|
+
/** The request's irreducible core across one run leg: the objective input the guard trim holds (set when the leg's
|
|
74
|
+
* objective is sent; absent on a leg that sends none) and the typed terminal once a core cannot fit — the loop folds a
|
|
75
|
+
* request-build throw into a text-only failure message, so result assembly reads the code here. */
|
|
76
|
+
export interface RequestCoreRef {
|
|
77
|
+
objective?: ObjectiveInput;
|
|
78
|
+
terminalCode?: "irreducible_core_over_budget";
|
|
79
|
+
}
|
|
80
|
+
/** The one mint of the request-build guard's loud terminal: `what` names the core that does not fit. Parks the code on the
|
|
81
|
+
* ref (the surface bridge) and returns the error to throw. */
|
|
82
|
+
export declare function coreOverBudgetTerminal(ref: RequestCoreRef, what: string): Error & {
|
|
83
|
+
code: "irreducible_core_over_budget";
|
|
84
|
+
};
|
|
85
|
+
/** The verdict on a request that reached the guard's trim over the line: its irreducible core (`coreTokens`, summaries plus
|
|
86
|
+
* `heldRows` held rows) still over the line has no honest form — throws the typed terminal; otherwise returns. */
|
|
87
|
+
export declare function refuseCoreOverLine(coreTokens: number, budgetTokens: number, heldRows: number, ref: RequestCoreRef): void;
|
|
23
88
|
/**
|
|
24
89
|
* In-band notice for a request view whose oldest messages were dropped by the guard trim. Every
|
|
25
90
|
* other history-reducing pass in the pipeline announces itself to the model (compaction injects a
|
|
@@ -43,10 +108,13 @@ export declare function engineRegionCovers(m: AgentMessage, start: number, len:
|
|
|
43
108
|
/** Outcome of {@link protectGitFrame} — `over_budget` means the irreducible core (summaries + the
|
|
44
109
|
* protected frame carrier) exceeds the budget even after the one-shot degraded shrink: the caller
|
|
45
110
|
* must fail the request LOUDLY (`irreducible_core_over_budget`) instead of pretending the trim
|
|
46
|
-
* succeeded or looping compaction/re-assertion.
|
|
111
|
+
* succeeded or looping compaction/re-assertion. `core` (present iff the caller passed the rows it
|
|
112
|
+
* holds): the request's whole irreducible core in the returned view — the summaries, the held rows
|
|
113
|
+
* and the frame — for the caller's own verdict on it. */
|
|
47
114
|
export type GitFrameGuardOutcome = {
|
|
48
115
|
messages: AgentMessage[];
|
|
49
116
|
action: "kept" | "absent" | "reinserted" | "shrunk";
|
|
117
|
+
core?: number;
|
|
50
118
|
} | {
|
|
51
119
|
action: "over_budget";
|
|
52
120
|
};
|
|
@@ -67,6 +135,11 @@ export type GitFrameGuardOutcome = {
|
|
|
67
135
|
* shrunk view through its own receipt machinery). Still over after the shrink ⇒ `over_budget`.
|
|
68
136
|
* - A total overshoot whose core FITS is left alone (turn-alignment overshoot is a pre-existing,
|
|
69
137
|
* tolerated trade — validity beats budget; this guard must not convert it into a failure).
|
|
138
|
+
* - `held` (the rows the trim holds — the run's objective input): the frame is part of a larger
|
|
139
|
+
* core. The one shrink step also runs when the frame alone fits but the whole core does not and
|
|
140
|
+
* the shrink makes it fit (the degraded rendering is engine bytes inside the objective's own
|
|
141
|
+
* message on the prefix-carry form); the whole core is returned as `core` for the caller to
|
|
142
|
+
* judge, while `over_budget` stays scoped to what it names (summaries + the frame).
|
|
70
143
|
*/
|
|
71
144
|
export declare function protectGitFrame(before: AgentMessage[], trimmed: AgentMessage[], budgetTokens: number, frame: {
|
|
72
145
|
protectedText: string;
|
|
@@ -75,7 +148,7 @@ export declare function protectGitFrame(before: AgentMessage[], trimmed: AgentMe
|
|
|
75
148
|
replace: string;
|
|
76
149
|
};
|
|
77
150
|
}, // protectedText = the wrapped frame SEGMENT (see the carrier scan below)
|
|
78
|
-
charsPerToken?: number): GitFrameGuardOutcome;
|
|
151
|
+
charsPerToken?: number, held?: (m: AgentMessage) => boolean, sizeOf?: RequestSize): GitFrameGuardOutcome;
|
|
79
152
|
/** Budget the in-task guard targets for a model — CC-aligned headroom numbers with a 0.85
|
|
80
153
|
* small-window floor, sema-owned drop-oldest action (see {@link GUARD_HEADROOM_TOKENS}); always
|
|
81
154
|
* above the compaction/clearStale frontier. Dual-window semantics: deliberately the PHYSICAL
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CHARS_PER_TOKEN, estimateContextTokens, estimateTokens } from "../internal/harness.js";
|
|
2
|
+
import { userAttachmentOf } from "../internal/llm.js";
|
|
2
3
|
import { isToolResult, messageRole } from "./message-utils.js";
|
|
3
4
|
import { physicalWindowOf } from "./context-settings.js";
|
|
4
5
|
const GUARD_FRACTION = 0.85;
|
|
@@ -6,38 +7,39 @@ const GUARD_HEADROOM_TOKENS = 23000;
|
|
|
6
7
|
function isSummary(m) {
|
|
7
8
|
return messageRole(m) === "compactionSummary";
|
|
8
9
|
}
|
|
9
|
-
export function trimToBudget(messages, budgetTokens, anchoredTotalTokens, charsPerToken) {
|
|
10
|
+
export function trimToBudget(messages, budgetTokens, anchoredTotalTokens, charsPerToken, held, sizeOf) {
|
|
10
11
|
const cpt = charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
12
|
+
const size = sizeOf ?? ((m) => estimateTokens(m, cpt));
|
|
13
|
+
const inCore = (m) => isSummary(m) || held?.(m) === true;
|
|
11
14
|
const anchored = anchoredTotalTokens !== undefined;
|
|
12
15
|
let structuralTotal = 0;
|
|
13
16
|
for (const m of messages) {
|
|
14
|
-
structuralTotal +=
|
|
17
|
+
structuralTotal += size(m);
|
|
15
18
|
}
|
|
16
19
|
const total = anchored ? anchoredTotalTokens : structuralTotal;
|
|
17
20
|
if (total <= budgetTokens || messages.length <= 1) {
|
|
18
21
|
return messages;
|
|
19
22
|
}
|
|
20
23
|
const anchorIdx = anchored ? (estimateContextTokens(messages, cpt).lastUsageIndex ?? -1) : -1;
|
|
21
|
-
const summaries = messages.filter(isSummary);
|
|
22
|
-
let summaryTokens = 0;
|
|
23
|
-
for (const s of summaries) {
|
|
24
|
-
summaryTokens += estimateTokens(s, cpt);
|
|
25
|
-
}
|
|
26
24
|
const nonSummary = [];
|
|
27
25
|
const reductions = [];
|
|
28
26
|
let reductionSum = 0;
|
|
29
|
-
for (
|
|
30
|
-
if (
|
|
27
|
+
for (const [i, m] of messages.entries()) {
|
|
28
|
+
if (inCore(m))
|
|
31
29
|
continue;
|
|
32
|
-
nonSummary.push(
|
|
33
|
-
const r = i > anchorIdx ?
|
|
30
|
+
nonSummary.push(m);
|
|
31
|
+
const r = i > anchorIdx ? size(m) : 0;
|
|
34
32
|
reductions.push(r);
|
|
35
33
|
reductionSum += r;
|
|
36
34
|
}
|
|
35
|
+
if (nonSummary.length === 0)
|
|
36
|
+
return messages;
|
|
37
|
+
const newest = messages.at(-1);
|
|
38
|
+
const floor = newest !== undefined && inCore(newest) ? 0 : 1;
|
|
37
39
|
const requiredReduction = total - budgetTokens;
|
|
38
40
|
let start;
|
|
39
41
|
if (anchored && reductionSum <= requiredReduction) {
|
|
40
|
-
start = nonSummary.length -
|
|
42
|
+
start = nonSummary.length - floor;
|
|
41
43
|
}
|
|
42
44
|
else {
|
|
43
45
|
const tailBudget = Math.max(0, reductionSum - requiredReduction);
|
|
@@ -45,7 +47,7 @@ export function trimToBudget(messages, budgetTokens, anchoredTotalTokens, charsP
|
|
|
45
47
|
start = nonSummary.length;
|
|
46
48
|
for (let i = nonSummary.length - 1; i >= 0; i--) {
|
|
47
49
|
acc += reductions[i];
|
|
48
|
-
if (acc > tailBudget && i +
|
|
50
|
+
if (acc > tailBudget && i + floor < nonSummary.length) {
|
|
49
51
|
start = i + 1;
|
|
50
52
|
break;
|
|
51
53
|
}
|
|
@@ -55,7 +57,7 @@ export function trimToBudget(messages, budgetTokens, anchoredTotalTokens, charsP
|
|
|
55
57
|
while (start < nonSummary.length && isToolResult(nonSummary[start])) {
|
|
56
58
|
start++;
|
|
57
59
|
}
|
|
58
|
-
if (start >= nonSummary.length) {
|
|
60
|
+
if (start >= nonSummary.length && floor === 1) {
|
|
59
61
|
start = nonSummary.length - 1;
|
|
60
62
|
while (start > 0 && isToolResult(nonSummary[start])) {
|
|
61
63
|
start--;
|
|
@@ -65,7 +67,98 @@ export function trimToBudget(messages, budgetTokens, anchoredTotalTokens, charsP
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
const keptTail = new Set(nonSummary.slice(start));
|
|
68
|
-
return messages.filter((m) =>
|
|
70
|
+
return messages.filter((m) => inCore(m) || keptTail.has(m));
|
|
71
|
+
}
|
|
72
|
+
export function irreducibleCoreTokens(view, held, charsPerToken, sizeOf) {
|
|
73
|
+
const cpt = charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
74
|
+
const size = sizeOf ?? ((m) => estimateTokens(m, cpt));
|
|
75
|
+
let tokens = 0;
|
|
76
|
+
for (const m of view)
|
|
77
|
+
if (isSummary(m) || held?.(m) === true)
|
|
78
|
+
tokens += size(m);
|
|
79
|
+
return tokens;
|
|
80
|
+
}
|
|
81
|
+
function openingText(m) {
|
|
82
|
+
const c = m.content;
|
|
83
|
+
if (typeof c === "string")
|
|
84
|
+
return c;
|
|
85
|
+
if (!Array.isArray(c))
|
|
86
|
+
return undefined;
|
|
87
|
+
const first = c.find((b) => b?.type === "text" && typeof b.text === "string");
|
|
88
|
+
return first?.text;
|
|
89
|
+
}
|
|
90
|
+
export function objectiveInputRows(view, input) {
|
|
91
|
+
const rows = new Set();
|
|
92
|
+
if (input === undefined)
|
|
93
|
+
return rows;
|
|
94
|
+
let objectiveFound = false;
|
|
95
|
+
for (let i = view.length - 1; i >= 0; i--) {
|
|
96
|
+
const m = view[i];
|
|
97
|
+
if (messageRole(m) !== "user")
|
|
98
|
+
continue;
|
|
99
|
+
const frame = userAttachmentOf(m);
|
|
100
|
+
if (frame !== undefined) {
|
|
101
|
+
if (frame.origin === undefined && frame.inputId === input.inputId)
|
|
102
|
+
rows.add(m);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (!objectiveFound && openingText(m) === input.text) {
|
|
106
|
+
rows.add(m);
|
|
107
|
+
objectiveFound = true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return rows;
|
|
111
|
+
}
|
|
112
|
+
export function heldEngineFrames(view, protectedTexts) {
|
|
113
|
+
const rows = new Set();
|
|
114
|
+
const owed = new Set(protectedTexts);
|
|
115
|
+
const labels = new Set();
|
|
116
|
+
for (let i = view.length - 1; i >= 0; i--) {
|
|
117
|
+
const m = view[i];
|
|
118
|
+
if (messageRole(m) !== "user")
|
|
119
|
+
continue;
|
|
120
|
+
const frame = userAttachmentOf(m);
|
|
121
|
+
if (frame?.origin === "project_instructions") {
|
|
122
|
+
if (labels.has(frame.label))
|
|
123
|
+
continue;
|
|
124
|
+
labels.add(frame.label);
|
|
125
|
+
if (frame.withdraws === undefined && (frame.outcome === "attached" || frame.outcome === "partial"))
|
|
126
|
+
rows.add(m);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (owed.size === 0)
|
|
130
|
+
continue;
|
|
131
|
+
const text = singleText(m);
|
|
132
|
+
if (text === undefined)
|
|
133
|
+
continue;
|
|
134
|
+
for (const t of owed) {
|
|
135
|
+
const at = text.indexOf(t);
|
|
136
|
+
if (at === -1 || !engineRegionCovers(m, at, t.length))
|
|
137
|
+
continue;
|
|
138
|
+
rows.add(m);
|
|
139
|
+
owed.delete(t);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return rows;
|
|
143
|
+
}
|
|
144
|
+
export function restatedFramesTokens(view, held, charsPerToken) {
|
|
145
|
+
const cpt = charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
146
|
+
let tokens = 0;
|
|
147
|
+
for (const m of heldEngineFrames(view, []))
|
|
148
|
+
tokens += estimateTokens(m, cpt);
|
|
149
|
+
for (const t of [...held.protectedTexts, ...held.restatedTexts])
|
|
150
|
+
tokens += estimateTokens({ role: "user", content: [{ type: "text", text: t }] }, cpt);
|
|
151
|
+
return tokens;
|
|
152
|
+
}
|
|
153
|
+
export function coreOverBudgetTerminal(ref, what) {
|
|
154
|
+
ref.terminalCode = "irreducible_core_over_budget";
|
|
155
|
+
return Object.assign(new Error(`irreducible core over budget: ${what} alone exceed the request budget — no trim can produce an honest request`), { code: "irreducible_core_over_budget" });
|
|
156
|
+
}
|
|
157
|
+
export function refuseCoreOverLine(coreTokens, budgetTokens, heldRows, ref) {
|
|
158
|
+
if (coreTokens <= budgetTokens)
|
|
159
|
+
return;
|
|
160
|
+
const what = heldRows > 0 ? "the compaction summaries plus this run's objective, its attachments and the engine frames it carries" : "the compaction summaries";
|
|
161
|
+
throw coreOverBudgetTerminal(ref, `${what} (about ${coreTokens} tokens, over the ${budgetTokens} tokens one request can hold on this model)`);
|
|
69
162
|
}
|
|
70
163
|
export const CONTEXT_TRIM_NOTICE = "[Note: earlier messages were omitted from this request to fit the context window — the full " +
|
|
71
164
|
"history is preserved in the session. If an earlier instruction, constraint, or detail seems to " +
|
|
@@ -98,8 +191,9 @@ function singleText(m) {
|
|
|
98
191
|
}
|
|
99
192
|
return undefined;
|
|
100
193
|
}
|
|
101
|
-
export function protectGitFrame(before, trimmed, budgetTokens, frame, charsPerToken) {
|
|
194
|
+
export function protectGitFrame(before, trimmed, budgetTokens, frame, charsPerToken, held, sizeOf) {
|
|
102
195
|
const cpt = charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
196
|
+
const size = sizeOf ?? ((m) => estimateTokens(m, cpt));
|
|
103
197
|
let carrier;
|
|
104
198
|
for (let i = before.length - 1; i >= 0; i--) {
|
|
105
199
|
const candidate = before[i];
|
|
@@ -115,7 +209,7 @@ export function protectGitFrame(before, trimmed, budgetTokens, frame, charsPerTo
|
|
|
115
209
|
break;
|
|
116
210
|
}
|
|
117
211
|
if (carrier === undefined)
|
|
118
|
-
return { messages: trimmed, action: "absent" };
|
|
212
|
+
return { messages: trimmed, action: "absent", ...(held !== undefined ? { core: irreducibleCoreTokens(trimmed, held, cpt, size) } : {}) };
|
|
119
213
|
let out = trimmed;
|
|
120
214
|
let action = "kept";
|
|
121
215
|
if (!out.includes(carrier)) {
|
|
@@ -134,24 +228,31 @@ export function protectGitFrame(before, trimmed, budgetTokens, frame, charsPerTo
|
|
|
134
228
|
let t = segTokens(frameText);
|
|
135
229
|
for (const m of view)
|
|
136
230
|
if (isSummary(m))
|
|
137
|
-
t +=
|
|
231
|
+
t += size(m);
|
|
138
232
|
return t;
|
|
139
233
|
};
|
|
140
|
-
|
|
141
|
-
|
|
234
|
+
const carrierHeld = held?.(carrier) === true;
|
|
235
|
+
const requestCore = (view, carrierNow, frameText) => irreducibleCoreTokens(view, (m) => held?.(m) === true || (carrierHeld && m === carrierNow), cpt, size) + (carrierHeld ? 0 : segTokens(frameText));
|
|
236
|
+
const withCore = (messages, act, carrierNow, frameText) => ({ messages, action: act, ...(held !== undefined ? { core: requestCore(messages, carrierNow, frameText) } : {}) });
|
|
237
|
+
const frameOver = coreTokens(out, frame.protectedText) > budgetTokens;
|
|
238
|
+
if (!frameOver && (held === undefined || requestCore(out, carrier, frame.protectedText) <= budgetTokens))
|
|
239
|
+
return withCore(out, action, carrier, frame.protectedText);
|
|
142
240
|
if (frame.substitute !== undefined) {
|
|
143
241
|
const text = singleText(carrier);
|
|
144
242
|
const shrunkText = text.replace(frame.substitute.find, () => frame.substitute.replace);
|
|
145
243
|
if (shrunkText !== text) {
|
|
146
244
|
const shrunkCarrier = { ...carrier, content: [{ type: "text", text: shrunkText }] };
|
|
147
245
|
const idx = out.indexOf(carrier);
|
|
148
|
-
|
|
149
|
-
if (coreTokens(
|
|
150
|
-
return {
|
|
151
|
-
|
|
246
|
+
const shrunk = [...out.slice(0, idx), shrunkCarrier, ...out.slice(idx + 1)];
|
|
247
|
+
if (coreTokens(shrunk, frame.substitute.replace) > budgetTokens)
|
|
248
|
+
return { action: "over_budget" };
|
|
249
|
+
if (frameOver || requestCore(shrunk, shrunkCarrier, frame.substitute.replace) <= budgetTokens)
|
|
250
|
+
return withCore(shrunk, "shrunk", shrunkCarrier, frame.substitute.replace);
|
|
152
251
|
}
|
|
153
252
|
}
|
|
154
|
-
|
|
253
|
+
if (frameOver)
|
|
254
|
+
return { action: "over_budget" };
|
|
255
|
+
return withCore(out, action, carrier, frame.protectedText);
|
|
155
256
|
}
|
|
156
257
|
export function guardBudget(model, overlay) {
|
|
157
258
|
const window = physicalWindowOf(model, overlay);
|
|
@@ -29,12 +29,18 @@ import type { ModelRef } from "./model-seat.js";
|
|
|
29
29
|
* · `autoCompactTokens` — the trigger-side window (dual-window semantics: lowers the compaction trigger and
|
|
30
30
|
* the context-editing frontier without touching the physical request budget). Clamped to the physical
|
|
31
31
|
* window by the one resolver, exactly as a model-card declaration is.
|
|
32
|
+
* · `reserveTokens` — the trigger deduction (the compaction threshold is the trigger window minus it): the
|
|
33
|
+
* deployment's per-model twin of `TaskSpec.compaction.reserveTokens`, under {@link compactionReserve}'s law — the
|
|
34
|
+
* request's own value is the author, this fills an unset one, nothing declared is the engine's default. A positive
|
|
35
|
+
* whole number, below every window this overlay itself declares (a window only the model card declares is judged
|
|
36
|
+
* where the pass runs: the trigger repairs a reserve that would leave no threshold).
|
|
32
37
|
* · `autoCompact` / `manualCompact` — the deployment's twins of the task's two compaction seats, each with its
|
|
33
38
|
* seat's reach and each the default for its own seat only ({@link compactionEnabled}).
|
|
34
39
|
*/
|
|
35
40
|
export interface ContextWindowOverlay {
|
|
36
41
|
readonly contextTokens?: number;
|
|
37
42
|
readonly autoCompactTokens?: number;
|
|
43
|
+
readonly reserveTokens?: number;
|
|
38
44
|
readonly autoCompact?: boolean;
|
|
39
45
|
readonly manualCompact?: boolean;
|
|
40
46
|
}
|
|
@@ -117,6 +123,32 @@ export declare function assertContextSettingsValue(v: unknown, where: string): C
|
|
|
117
123
|
* (`trigger: "manual"`) and no model call, and the boundary goes on with its own pass.
|
|
118
124
|
*/
|
|
119
125
|
export declare function compactionEnabled(seat: CompactionSeat, requested: Readonly<Partial<Record<CompactionSeat, boolean>>> | undefined, overlay: ContextWindowOverlay | undefined): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* The reserve a compaction pass subtracts from its trigger window — the same law the seats follow, for the number: the
|
|
128
|
+
* request's own value is the author (`TaskSpec.compaction.reserveTokens`, a `compactSession` request's), the deployment's
|
|
129
|
+
* overlay for the leg's model fills an unset one, and nothing declared is the engine's default (`undefined` here: the caller
|
|
130
|
+
* holds the default). Read by the one settings assembly (`legCompactionSettings`) that every pass and the disclosure
|
|
131
|
+
* estimating the same threshold share, so no pass and no estimate can read another number.
|
|
132
|
+
*/
|
|
133
|
+
export declare function compactionReserve(requested: number | undefined, overlay: ContextWindowOverlay | undefined): number | undefined;
|
|
134
|
+
/** Is this a compaction reserve a person could have meant — a positive whole number of tokens? The one reading of that shape: the overlay
|
|
135
|
+
* door's twin of the number (`assertContextSettingsValue`) and the task's own ({@link compactionReserveDefect}) both ask it. */
|
|
136
|
+
export declare function isReserveTokenCount(value: unknown): value is number;
|
|
137
|
+
/**
|
|
138
|
+
* The ONE gate of a DECLARED compaction reserve, asked at prepare where the leg's model is known. The request's value
|
|
139
|
+
* (`TaskSpec.compaction.reserveTokens`) is a positive whole number of tokens when given — `null` or a string is refused, never a
|
|
140
|
+
* fall-through to the overlay's value or the default, and neither is `NaN`, an infinity, a fraction, zero or a negative ({@link isReserveTokenCount}, the overlay's law) — and the value in force ({@link compactionReserve}) must be below the leg's physical window
|
|
141
|
+
* ({@link physicalWindowOf}): at or above it no threshold is left, and the trigger's repair (a fraction of the window,
|
|
142
|
+
* `sanitizeCompactionSettings`) is for the DEFAULT meeting a small window, not for a number someone wrote. Nothing declared, or a
|
|
143
|
+
* card with no window of its own, answers `undefined`. Returns the refusing sentence.
|
|
144
|
+
*
|
|
145
|
+
* A delegated child's `compaction` travels whole from its parent, which judged it against the parent's model; the child's own
|
|
146
|
+
* model may have a smaller window, where the trigger's repair stands — so for a child (`inherited`) a task value is held to the
|
|
147
|
+
* type and shape gates only (never to the window), and the overlay's value (the deployment's declaration for the child's own model) is still held to the window.
|
|
148
|
+
*/
|
|
149
|
+
export declare function compactionReserveDefect(requested: unknown, overlay: ContextWindowOverlay | undefined, model: Model, inherited?: boolean): string | undefined;
|
|
150
|
+
/** The prepare door of {@link compactionReserveDefect}: the refusal as `config.invalid_argument`, thrown before any resource is acquired. */
|
|
151
|
+
export declare function assertCompactionReserve(requested: unknown, overlay: ContextWindowOverlay | undefined, model: Model, inherited: boolean): void;
|
|
120
152
|
/**
|
|
121
153
|
* The overlay's view of a model's PHYSICAL window — the model card's chain with the deployment's live
|
|
122
154
|
* declaration CLAMPED over it. The single expression `guardBudget` and `resolveTriggerWindow` share.
|
|
@@ -2,7 +2,7 @@ import { tierAliasVia } from "./roles.js";
|
|
|
2
2
|
import { optionKeys, receiveMembers } from "./own-property-receipt.js";
|
|
3
3
|
import { RETIRED_COMPACTION_SEAT_KEYS, retiredKeyOf, retiredKeyRefusal } from "./retired-keys.js";
|
|
4
4
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
5
|
-
const OVERLAY_KEYS = optionKeys()({ contextTokens: 0, autoCompactTokens: 0, autoCompact: 0, manualCompact: 0 });
|
|
5
|
+
const OVERLAY_KEYS = optionKeys()({ contextTokens: 0, autoCompactTokens: 0, reserveTokens: 0, autoCompact: 0, manualCompact: 0 });
|
|
6
6
|
const OVERLAY_READ_NAMES = Object.freeze([...OVERLAY_KEYS, ...Object.keys(RETIRED_COMPACTION_SEAT_KEYS)]);
|
|
7
7
|
export const COMPACTION_SEATS = Object.freeze(["autoCompact", "manualCompact"]);
|
|
8
8
|
const SEAT_REACH = Object.freeze({
|
|
@@ -49,11 +49,21 @@ export function assertContextSettingsValue(v, where) {
|
|
|
49
49
|
throw new Error(`${where}: contextSettings[${JSON.stringify(word)}] must be a plain object (got ${raw === null ? "null" : Array.isArray(raw) ? "array" : typeof raw})`);
|
|
50
50
|
}
|
|
51
51
|
const subject = `${where}: contextSettings[${JSON.stringify(word)}]`;
|
|
52
|
-
const o = receiveMembers(raw, { subject, unit: "member", moment: "when the overlay is read" }, OVERLAY_READ_NAMES, (_, unknown) => new Error(`${subject} carries ${unknown.map((k) => JSON.stringify(String(k))).join(", ")} — this seat declares window geometry and the compaction seats only (contextTokens | autoCompactTokens | autoCompact | manualCompact); routing, pricing and fencing stay on the model card`));
|
|
52
|
+
const o = receiveMembers(raw, { subject, unit: "member", moment: "when the overlay is read" }, OVERLAY_READ_NAMES, (_, unknown) => new Error(`${subject} carries ${unknown.map((k) => JSON.stringify(String(k))).join(", ")} — this seat declares window geometry and the compaction seats only (contextTokens | autoCompactTokens | reserveTokens | autoCompact | manualCompact); routing, pricing and fencing stay on the model card`));
|
|
53
53
|
for (const k of ["contextTokens", "autoCompactTokens"]) {
|
|
54
54
|
const n = o[k];
|
|
55
55
|
if (n !== undefined && (typeof n !== "number" || !Number.isFinite(n) || n <= 0)) {
|
|
56
|
-
throw new Error(`${subject}.${k} must be a positive finite number (got ${
|
|
56
|
+
throw new Error(`${subject}.${k} must be a positive finite number (got ${describeRejectedValue(n)}) — an unusable window is a configuration defect, not a request to fall back to the model's own`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const reserve = o.reserveTokens;
|
|
60
|
+
if (reserve !== undefined) {
|
|
61
|
+
if (!isReserveTokenCount(reserve)) {
|
|
62
|
+
throw new Error(`${subject}.reserveTokens must be a positive whole number of tokens (got ${describeRejectedValue(reserve)}) — an unusable reserve is a configuration defect, not a request for the engine's default`);
|
|
63
|
+
}
|
|
64
|
+
const declared = [o.contextTokens, o.autoCompactTokens].filter((n) => typeof n === "number");
|
|
65
|
+
if (declared.length > 0 && reserve >= Math.min(...declared)) {
|
|
66
|
+
throw new Error(`${subject}.reserveTokens (${reserve}) must be below the window this overlay declares (${Math.min(...declared)}) — the compaction threshold is that window minus the reserve, and it would be none`);
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
const seatDefect = compactionSeatsDefect(o, subject);
|
|
@@ -62,6 +72,7 @@ export function assertContextSettingsValue(v, where) {
|
|
|
62
72
|
out[word] = Object.freeze({
|
|
63
73
|
...(o.contextTokens !== undefined ? { contextTokens: o.contextTokens } : {}),
|
|
64
74
|
...(o.autoCompactTokens !== undefined ? { autoCompactTokens: o.autoCompactTokens } : {}),
|
|
75
|
+
...(o.reserveTokens !== undefined ? { reserveTokens: o.reserveTokens } : {}),
|
|
65
76
|
...(o.autoCompact !== undefined ? { autoCompact: o.autoCompact } : {}),
|
|
66
77
|
...(o.manualCompact !== undefined ? { manualCompact: o.manualCompact } : {}),
|
|
67
78
|
});
|
|
@@ -71,6 +82,33 @@ export function assertContextSettingsValue(v, where) {
|
|
|
71
82
|
export function compactionEnabled(seat, requested, overlay) {
|
|
72
83
|
return requested?.[seat] ?? overlay?.[seat] ?? true;
|
|
73
84
|
}
|
|
85
|
+
export function compactionReserve(requested, overlay) {
|
|
86
|
+
return requested ?? overlay?.reserveTokens;
|
|
87
|
+
}
|
|
88
|
+
export function isReserveTokenCount(value) {
|
|
89
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
90
|
+
}
|
|
91
|
+
export function compactionReserveDefect(requested, overlay, model, inherited = false) {
|
|
92
|
+
if (requested !== undefined && typeof requested !== "number") {
|
|
93
|
+
return `TaskSpec.compaction.reserveTokens must be a number when given (got ${describeRejectedValue(requested)}) — a value that is not a number would read as unset and fall through to the deployment's reserve or the default; omit the key for that`;
|
|
94
|
+
}
|
|
95
|
+
if (requested !== undefined && !isReserveTokenCount(requested)) {
|
|
96
|
+
return `TaskSpec.compaction.reserveTokens must be a positive whole number of tokens (got ${describeRejectedValue(requested)}) — an unusable reserve is a configuration defect, not a request for the engine's default; omit the key for that`;
|
|
97
|
+
}
|
|
98
|
+
if (inherited && requested !== undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
const reserve = compactionReserve(requested, overlay);
|
|
101
|
+
const window = physicalWindowOf(model, overlay);
|
|
102
|
+
if (reserve === undefined || !(window > 0) || reserve < window)
|
|
103
|
+
return undefined;
|
|
104
|
+
const source = requested !== undefined ? "TaskSpec.compaction.reserveTokens" : "the deployment's contextSettings reserveTokens for this model";
|
|
105
|
+
return `${source} (${reserve}) must be below the window of model ${JSON.stringify(model.id)} (${window}) — the compaction threshold is the window minus the reserve, and it would be none; lower the reserve rather than have the trigger repair it`;
|
|
106
|
+
}
|
|
107
|
+
export function assertCompactionReserve(requested, overlay, model, inherited) {
|
|
108
|
+
const defect = compactionReserveDefect(requested, overlay, model, inherited);
|
|
109
|
+
if (defect !== undefined)
|
|
110
|
+
throw Object.assign(new Error(defect), { code: "config.invalid_argument" });
|
|
111
|
+
}
|
|
74
112
|
export function physicalWindowOf(model, overlay) {
|
|
75
113
|
const card = model.contextTokens ?? model.contextWindow;
|
|
76
114
|
const declared = overlay?.contextTokens;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the engine's published vocabularies and types a consumer may NOT treat as closed.
|
|
3
|
+
*
|
|
4
|
+
* @contract vocabulary.open — A subject listed in `OPEN_FACE` may gain words — and, for a type, arms and optional
|
|
5
|
+
* members — in any release, a patch included; a word leaves it only in a minor, as a BREAKING line. Where such a
|
|
6
|
+
* record is read across a process or version boundary (stored and read back, or forwarded and read elsewhere), the
|
|
7
|
+
* reader takes it as the subject's open record type and meets a word it does not know with a default arm that
|
|
8
|
+
* (1) keeps the record — it never drops it or fails the request because of the word; (2) shows it no wider than the
|
|
9
|
+
* narrowest audience that face has; (3) records the word once — subject, word, and the engine version that sent
|
|
10
|
+
* it — where an operator can audit it; and (4) takes every decision from a closed word beside it, never from the
|
|
11
|
+
* unknown word. It may recognise today's words (a `Partial` table, the subject's `isKnown…` guard) but never refuses
|
|
12
|
+
* a word for being missing from one, never ends a `switch` over it with a `never` fence, and never keys a total
|
|
13
|
+
* `Record` on its type. On the producer side, a word of an open subject is never the only carrier of something a
|
|
14
|
+
* consumer must do: an obligation rides a closed word.
|
|
15
|
+
*
|
|
16
|
+
* Each row is a subject as the wire-change manifest names it: a word list (a frozen array), or a type — a type
|
|
17
|
+
* row covers its discriminating words, its arms and their optional members (a member vocabulary `<Type>.<path>`
|
|
18
|
+
* follows its owner). A subject not listed is closed: its words move only in a minor, and a consumer may fence
|
|
19
|
+
* them. This list is itself closed — a row added here widens the contract and ships in a minor.
|
|
20
|
+
*/
|
|
21
|
+
export declare const OPEN_FACE: readonly ["TraceEvent", "TRACE_EVENT_KINDS"];
|
|
22
|
+
export type OpenFaceSubject = (typeof OPEN_FACE)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const OPEN_FACE = Object.freeze(["TraceEvent", "TRACE_EVENT_KINDS"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A protocol peer's account of itself, read without the credentials its connection's requests carried — the MCP server's `serverInfo`,
|
|
3
|
-
* its instructions and its tool listing, the A2A peer's agent card. The needle is the connection's credentials (`PeerCarrier.credentials`:
|
|
3
|
+
* its instructions and its tool, prompt and resource listings (a resource template listing reads as the resource listing), the A2A peer's agent card. The needle is the connection's credentials (`PeerCarrier.credentials`:
|
|
4
4
|
* what the seat answered that the withheld table holds) and the one eraser is `eraseSentCredentials` (protocol-http-auth.ts, beside the
|
|
5
5
|
* failure text's). Free text holding the needle is erased in place; a NAME holding it (a tool's name or input schema, the server's own
|
|
6
6
|
* name, a skill's id, the card's name) is never rewritten — what it names is refused instead. Either way the site is announced, once per
|
|
@@ -10,7 +10,7 @@ import { type EngineNotice } from "./engine-notice.js";
|
|
|
10
10
|
import type { PeerCarrier } from "./peer-seat.js";
|
|
11
11
|
/** Where a peer echoed its connection's credentials into what it said about itself — the closed set `mcp.credential_echoed` names
|
|
12
12
|
* (`detail.where`). */
|
|
13
|
-
export declare const CREDENTIAL_ECHO_SITES: readonly ["server_info", "instructions", "tool_listing", "agent_card"];
|
|
13
|
+
export declare const CREDENTIAL_ECHO_SITES: readonly ["server_info", "instructions", "tool_listing", "prompt_listing", "resource_listing", "agent_card"];
|
|
14
14
|
export type CredentialEchoSite = (typeof CREDENTIAL_ECHO_SITES)[number];
|
|
15
15
|
/** What a peer's account is read with: the needle, and who hears that a site held it. */
|
|
16
16
|
export interface CredentialEcho {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
2
2
|
import { eraseSentCredentials } from "./protocol-http-auth.js";
|
|
3
3
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
4
|
-
export const CREDENTIAL_ECHO_SITES = Object.freeze(["server_info", "instructions", "tool_listing", "agent_card"]);
|
|
4
|
+
export const CREDENTIAL_ECHO_SITES = Object.freeze(["server_info", "instructions", "tool_listing", "prompt_listing", "resource_listing", "agent_card"]);
|
|
5
5
|
export const NO_CREDENTIAL_ECHO = Object.freeze({ credentials: Object.freeze([]), announce: () => undefined });
|
|
6
6
|
export const CREDENTIAL_ECHO_DROP_REASON = "its name or input schema holds a credential this connection's requests carried (the server echoed it back); neither is rewritten, so the tool is not mounted";
|
|
7
7
|
export function erasedEcho(text, echo, where) {
|
|
@@ -55,7 +55,7 @@ export function echoAnnouncer(onCredentialEchoed) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
const SITE_WORDS = { server_info: "serverInfo", instructions: "instructions", tool_listing: "tool listing", agent_card: "agent card" };
|
|
58
|
+
const SITE_WORDS = { server_info: "serverInfo", instructions: "instructions", tool_listing: "tool listing", prompt_listing: "prompt listing", resource_listing: "resource listing", agent_card: "agent card" };
|
|
59
59
|
export function credentialEchoNotice(onNotice, sessionId, runId, protocol) {
|
|
60
60
|
return (server, where) => deliverEngineNotice(onNotice, {
|
|
61
61
|
code: "mcp.credential_echoed",
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
* call is allowed, the tree's off-target-read bit is set. {@link crossBoundaryObligation} is the one function that
|
|
11
11
|
* answers it; every place that asks calls it and none restates a cell.
|
|
12
12
|
*/
|
|
13
|
-
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
13
|
+
import type { AskClass, AssertAllKeysHandled } from "./ask-origin.js";
|
|
14
14
|
import type { EngineNotice } from "./engine-notice.js";
|
|
15
15
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
16
|
-
import type { HostDecider } from "./gate-outcome.js";
|
|
17
16
|
/** The run tree's two TAINT bits: the tree executes on a target device (`targetExecutionArmed`), and an off-target read
|
|
18
17
|
* was allowed into it since (`offTargetReadObserved`). Presence-coded on every carrier: `true` or absent, never `false`. */
|
|
19
18
|
export declare const CROSS_BOUNDARY_TAINT_BITS: readonly ["targetExecutionArmed", "offTargetReadObserved"];
|
|
@@ -72,9 +71,10 @@ export interface CrossBoundaryTreeToken {
|
|
|
72
71
|
export type BoundaryLegsFor = (args: unknown, at: {
|
|
73
72
|
readonly tree: CrossBoundaryTreeToken;
|
|
74
73
|
}) => BoundaryLegsGiven;
|
|
75
|
-
/** Why an exit refused a call its decision allowed: the call needs a person's confirmation under the tree's state NOW and
|
|
76
|
-
*
|
|
77
|
-
*
|
|
74
|
+
/** Why an exit refused a call its decision allowed: the call needs a person's confirmation under the tree's state NOW and no person
|
|
75
|
+
* answered a question that asked for it (`unconfirmed` — a configuration's or a policy's answer, or a person's answer to a question
|
|
76
|
+
* that did not carry the cross-boundary class), or the session record the call owes could not be written before it ran
|
|
77
|
+
* (`unrecorded`). `message` is the one sentence the refusal carries to the model and the wire. */
|
|
78
78
|
export interface CrossBoundaryExitRefusal {
|
|
79
79
|
readonly kind: "unconfirmed" | "unrecorded";
|
|
80
80
|
readonly message: string;
|
|
@@ -89,10 +89,12 @@ export interface CrossBoundaryCall {
|
|
|
89
89
|
export interface CrossBoundaryCheck {
|
|
90
90
|
/** This call's obligation under the tree's state at this moment (the station reads it on the final arguments). */
|
|
91
91
|
obligation(call: CrossBoundaryCall): CrossBoundaryObligation;
|
|
92
|
-
/** The allow exit's rule, on the bytes that run and the
|
|
93
|
-
*
|
|
92
|
+
/** The allow exit's rule, on the bytes that run and the classes of the question a PERSON answered for this call (`undefined` when
|
|
93
|
+
* no person answered — a policy's or a configuration's allow, a relayed grant, a row or record without classes): re-reads the
|
|
94
|
+
* obligation; a mandate stands only when `answered` is a class list that carries `cross_boundary` — anything else refuses
|
|
95
|
+
* (`unconfirmed`); otherwise the session record carrying the off-target-read bit the call owes is written, and the bit joins the
|
|
94
96
|
* tree, before it runs — a call the exit refuses joins nothing. */
|
|
95
|
-
exit(call: CrossBoundaryCall,
|
|
97
|
+
exit(call: CrossBoundaryCall, answered: readonly AskClass[] | undefined): Promise<CrossBoundaryExitRefusal | undefined>;
|
|
96
98
|
}
|
|
97
99
|
/** The gate input's seat for {@link CrossBoundaryCheck}: present on a leg whose station is ENGAGED (a posture is declared, the leg runs
|
|
98
100
|
* on a target, or its tree is governed); absent ⇒ the decision path is byte-identical. */
|