@sema-agent/core 7.51.2 → 7.53.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 +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -3,10 +3,12 @@ import { READ_OUTCOMES } from "../tools/fs/fs-read.js";
|
|
|
3
3
|
import { renderDirectoryListing } from "../tools/fs/dir-entries.js";
|
|
4
4
|
import { MAX_READ_OUTPUT_CHARS } from "../tools/fs/fs-shared.js";
|
|
5
5
|
import { normalizeFileText } from "../tools/fs/encoding.js";
|
|
6
|
-
import { ADMITTED_IMAGE_MIME_TYPES, admitImageBytes } from "
|
|
6
|
+
import { ADMITTED_IMAGE_MIME_TYPES, admitImageBytes } from "./image-admission.js";
|
|
7
7
|
import { PDF_MAX_PAGES_PER_READ } from "../tools/fs/pdf.js";
|
|
8
8
|
import { MARKED_BLOCK_AFTER_DATA, mintSystemReminder } from "./reminder-mint.js";
|
|
9
9
|
import { commitReminderDisclosureEffects, planReminderDisclosure } from "./reminder-disclosure.js";
|
|
10
|
+
import { DEFAULT_CHARS_PER_TOKEN, estimateTokens } from "../internal/harness.js";
|
|
11
|
+
import { guardBudget } from "./context-guard.js";
|
|
10
12
|
export const USER_ATTACHMENTS_MAX = 20;
|
|
11
13
|
export const USER_ATTACHMENT_LABEL_MAX = 4096;
|
|
12
14
|
export const USER_ATTACHMENT_KINDS = Object.freeze(["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"]);
|
|
@@ -22,12 +24,16 @@ export const USER_ATTACHMENT_SEAT = Object.freeze({
|
|
|
22
24
|
supplies: USER_ATTACHMENT_SUPPLIES,
|
|
23
25
|
limits: Object.freeze({ maxEntries: USER_ATTACHMENTS_MAX, maxRenderedTextChars: MAX_READ_OUTPUT_CHARS }),
|
|
24
26
|
});
|
|
25
|
-
export function userAttachmentRefusal(
|
|
26
|
-
const e = new Error(`${
|
|
27
|
+
export function userAttachmentRefusal(at, problem) {
|
|
28
|
+
const e = new Error(`${at.path}: ${problem}`);
|
|
27
29
|
e.code = "config.user_attachment_invalid";
|
|
30
|
+
e.detail = { path: at.path, ...(at.index !== undefined ? { index: at.index } : {}) };
|
|
28
31
|
return e;
|
|
29
32
|
}
|
|
30
33
|
const SEAT_FIELD = "TaskSpec.userAttachments";
|
|
34
|
+
const SEAT_REF = { path: SEAT_FIELD };
|
|
35
|
+
const entryRef = (index) => ({ path: `${SEAT_FIELD}[${index}]`, index });
|
|
36
|
+
const memberRef = (at, member) => ({ ...at, path: `${at.path}.${member}` });
|
|
31
37
|
const isPlainObject = (v) => {
|
|
32
38
|
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
33
39
|
return false;
|
|
@@ -43,85 +49,87 @@ export function screenUserAttachments(seat, opts) {
|
|
|
43
49
|
if (seat === undefined)
|
|
44
50
|
return undefined;
|
|
45
51
|
if (!Array.isArray(seat))
|
|
46
|
-
throw userAttachmentRefusal(
|
|
52
|
+
throw userAttachmentRefusal(SEAT_REF, "must be an array of attachments.");
|
|
47
53
|
const entries = [...seat];
|
|
48
54
|
if (entries.length === 0)
|
|
49
55
|
return undefined;
|
|
50
56
|
if (entries.length > USER_ATTACHMENTS_MAX)
|
|
51
|
-
throw userAttachmentRefusal(
|
|
57
|
+
throw userAttachmentRefusal(SEAT_REF, `${entries.length} attachments, over the ${USER_ATTACHMENTS_MAX} one objective may carry.`);
|
|
52
58
|
if (opts.resumeLeg)
|
|
53
|
-
throw userAttachmentRefusal(
|
|
54
|
-
return entries.map((raw, i) => screenEntry(raw,
|
|
59
|
+
throw userAttachmentRefusal(SEAT_REF, "a durable resume continues the parked run and sends no new human message, so it cannot carry attachments — declare them on a new objective.");
|
|
60
|
+
return entries.map((raw, i) => screenEntry(raw, entryRef(i)));
|
|
55
61
|
}
|
|
56
|
-
function screenLabel(v,
|
|
62
|
+
function screenLabel(v, at) {
|
|
57
63
|
if (typeof v !== "string" || v.length === 0)
|
|
58
|
-
throw userAttachmentRefusal(
|
|
64
|
+
throw userAttachmentRefusal(at, "must be a non-empty string.");
|
|
59
65
|
if (v.length > USER_ATTACHMENT_LABEL_MAX)
|
|
60
|
-
throw userAttachmentRefusal(
|
|
66
|
+
throw userAttachmentRefusal(at, `${v.length} characters, over the ${USER_ATTACHMENT_LABEL_MAX}-character limit.`);
|
|
61
67
|
return v;
|
|
62
68
|
}
|
|
63
|
-
function screenPositiveInt(v,
|
|
69
|
+
function screenPositiveInt(v, at) {
|
|
64
70
|
if (typeof v !== "number" || !Number.isInteger(v) || v < 1)
|
|
65
|
-
throw userAttachmentRefusal(
|
|
71
|
+
throw userAttachmentRefusal(at, "must be an integer of at least 1.");
|
|
66
72
|
return v;
|
|
67
73
|
}
|
|
68
|
-
function onlyMembers(o, allowed,
|
|
74
|
+
function onlyMembers(o, allowed, at) {
|
|
69
75
|
for (const k of Object.keys(o))
|
|
70
76
|
if (!allowed.includes(k))
|
|
71
|
-
throw userAttachmentRefusal(
|
|
77
|
+
throw userAttachmentRefusal(memberRef(at, k), `is not a member of this attachment (allowed: ${allowed.join(", ")}).`);
|
|
72
78
|
}
|
|
73
|
-
function screenEntry(raw,
|
|
79
|
+
function screenEntry(raw, at) {
|
|
74
80
|
if (!isPlainObject(raw))
|
|
75
|
-
throw userAttachmentRefusal(
|
|
81
|
+
throw userAttachmentRefusal(at, "must be a plain object: { path } (a workspace file), { name, text } (host text) or { name, image } (a host image).");
|
|
76
82
|
const arms = ["path", "text", "image"].filter((k) => Object.prototype.hasOwnProperty.call(raw, k));
|
|
77
83
|
const arm = arms[0];
|
|
78
84
|
if (arm === undefined || arms.length !== 1) {
|
|
79
|
-
throw userAttachmentRefusal(
|
|
85
|
+
throw userAttachmentRefusal(at, arm === undefined ? "names no attachment: give exactly one of `path`, `text` or `image`." : `mixes ${arms.map((a) => `\`${a}\``).join(" and ")}: give exactly one of \`path\`, \`text\` or \`image\`.`);
|
|
80
86
|
}
|
|
81
87
|
switch (arm) {
|
|
82
88
|
case "path": {
|
|
83
|
-
onlyMembers(raw, ["path", "lines"],
|
|
84
|
-
const path = screenLabel(raw.path,
|
|
89
|
+
onlyMembers(raw, ["path", "lines"], at);
|
|
90
|
+
const path = screenLabel(raw.path, memberRef(at, "path"));
|
|
85
91
|
const linesRaw = raw.lines;
|
|
86
92
|
if (linesRaw === undefined)
|
|
87
93
|
return { supply: "path", path };
|
|
94
|
+
const linesAt = memberRef(at, "lines");
|
|
88
95
|
if (!isPlainObject(linesRaw))
|
|
89
|
-
throw userAttachmentRefusal(
|
|
90
|
-
onlyMembers(linesRaw, ["start", "end"],
|
|
91
|
-
const start = screenPositiveInt(linesRaw.start,
|
|
96
|
+
throw userAttachmentRefusal(linesAt, "must be { start, end? }.");
|
|
97
|
+
onlyMembers(linesRaw, ["start", "end"], linesAt);
|
|
98
|
+
const start = screenPositiveInt(linesRaw.start, memberRef(linesAt, "start"));
|
|
92
99
|
const endRaw = linesRaw.end;
|
|
93
100
|
if (endRaw === undefined)
|
|
94
101
|
return { supply: "path", path, lines: { start } };
|
|
95
|
-
const end = screenPositiveInt(endRaw,
|
|
102
|
+
const end = screenPositiveInt(endRaw, memberRef(linesAt, "end"));
|
|
96
103
|
if (end < start)
|
|
97
|
-
throw userAttachmentRefusal(
|
|
104
|
+
throw userAttachmentRefusal(memberRef(linesAt, "end"), `${end} is before the start line ${start}.`);
|
|
98
105
|
return { supply: "path", path, lines: { start, end } };
|
|
99
106
|
}
|
|
100
107
|
case "text": {
|
|
101
|
-
onlyMembers(raw, ["name", "text", "startLine"],
|
|
102
|
-
const name = screenLabel(raw.name,
|
|
108
|
+
onlyMembers(raw, ["name", "text", "startLine"], at);
|
|
109
|
+
const name = screenLabel(raw.name, memberRef(at, "name"));
|
|
103
110
|
const text = raw.text;
|
|
104
111
|
if (typeof text !== "string" || text.length === 0)
|
|
105
|
-
throw userAttachmentRefusal(
|
|
106
|
-
const startLine = raw.startLine === undefined ? 1 : screenPositiveInt(raw.startLine,
|
|
112
|
+
throw userAttachmentRefusal(memberRef(at, "text"), "must be a non-empty string.");
|
|
113
|
+
const startLine = raw.startLine === undefined ? 1 : screenPositiveInt(raw.startLine, memberRef(at, "startLine"));
|
|
107
114
|
const rendered = renderNumbered(text, startLine);
|
|
108
115
|
if (rendered.length > MAX_READ_OUTPUT_CHARS)
|
|
109
|
-
throw userAttachmentRefusal(
|
|
116
|
+
throw userAttachmentRefusal(memberRef(at, "text"), `renders to ${rendered.length} characters with line numbers, over the ${MAX_READ_OUTPUT_CHARS}-character limit a read may deliver — send a part of it.`);
|
|
110
117
|
return { supply: "content_text", name, text, startLine, rendered };
|
|
111
118
|
}
|
|
112
119
|
case "image": {
|
|
113
|
-
onlyMembers(raw, ["name", "image"],
|
|
114
|
-
const name = screenLabel(raw.name,
|
|
120
|
+
onlyMembers(raw, ["name", "image"], at);
|
|
121
|
+
const name = screenLabel(raw.name, memberRef(at, "name"));
|
|
115
122
|
const img = raw.image;
|
|
123
|
+
const imageAt = memberRef(at, "image");
|
|
116
124
|
if (!isPlainObject(img))
|
|
117
|
-
throw userAttachmentRefusal(
|
|
118
|
-
onlyMembers(img, ["data", "mimeType"],
|
|
125
|
+
throw userAttachmentRefusal(imageAt, "must be { data, mimeType } (base64 bytes and the image's type).");
|
|
126
|
+
onlyMembers(img, ["data", "mimeType"], imageAt);
|
|
119
127
|
const data = img.data;
|
|
120
128
|
const mimeType = img.mimeType;
|
|
121
129
|
if (typeof data !== "string" || data.length === 0)
|
|
122
|
-
throw userAttachmentRefusal(
|
|
130
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), "must be a non-empty base64 string.");
|
|
123
131
|
if (typeof mimeType !== "string" || !ADMITTED_IMAGE_MIME_TYPES.includes(mimeType)) {
|
|
124
|
-
throw userAttachmentRefusal(
|
|
132
|
+
throw userAttachmentRefusal(memberRef(imageAt, "mimeType"), `must be one of ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}.`);
|
|
125
133
|
}
|
|
126
134
|
return { supply: "content_image", name, data, mimeType };
|
|
127
135
|
}
|
|
@@ -130,7 +138,7 @@ function screenEntry(raw, field) {
|
|
|
130
138
|
export function refuseUserAttachmentPathsWithoutWorkspace(screened) {
|
|
131
139
|
const i = screened?.findIndex((a) => a.supply === "path") ?? -1;
|
|
132
140
|
if (i >= 0)
|
|
133
|
-
throw userAttachmentRefusal(
|
|
141
|
+
throw userAttachmentRefusal(memberRef(entryRef(i), "path"), "this run has no workspace (its hand tools are off), so the engine has no file to read — send the file's bytes as a `text` or `image` entry instead.");
|
|
134
142
|
}
|
|
135
143
|
export function userAttachmentDeclarations(screened) {
|
|
136
144
|
return screened.map((a, i) => a.supply === "path"
|
|
@@ -147,16 +155,16 @@ export async function admitUserAttachmentImages(screened) {
|
|
|
147
155
|
out.set(i + 1, admitted.block);
|
|
148
156
|
continue;
|
|
149
157
|
}
|
|
150
|
-
const
|
|
158
|
+
const imageAt = memberRef(entryRef(i), "image");
|
|
151
159
|
switch (admitted.reason) {
|
|
152
160
|
case "mime_unsupported":
|
|
153
|
-
throw userAttachmentRefusal(
|
|
161
|
+
throw userAttachmentRefusal(memberRef(imageAt, "mimeType"), `must be one of ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}.`);
|
|
154
162
|
case "magic_mismatch":
|
|
155
|
-
throw userAttachmentRefusal(
|
|
163
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `does not begin with a ${a.mimeType} signature (empty, mis-declared, or not base64) — refused rather than sent.`);
|
|
156
164
|
case "raw_too_large":
|
|
157
|
-
throw userAttachmentRefusal(
|
|
165
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
|
|
158
166
|
case "base64_too_large":
|
|
159
|
-
throw userAttachmentRefusal(
|
|
167
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `base64 of ${admitted.base64.length} characters, over the API's 5 MB image limit — shrink the image first.`);
|
|
160
168
|
}
|
|
161
169
|
}
|
|
162
170
|
return out;
|
|
@@ -383,7 +391,19 @@ function mintFrame(r, at, seat) {
|
|
|
383
391
|
const commit = result !== undefined || extra.length > 0 ? () => seat.commit(result, extra) : undefined;
|
|
384
392
|
return { seed: { content, attachment }, ...(commit !== undefined ? { commit } : {}) };
|
|
385
393
|
}
|
|
386
|
-
|
|
394
|
+
function refuseFramesOverWindow(frames, model, window) {
|
|
395
|
+
const budget = guardBudget(model, window.overlay());
|
|
396
|
+
if (!Number.isFinite(budget))
|
|
397
|
+
return;
|
|
398
|
+
const cpt = model.charsPerToken ?? DEFAULT_CHARS_PER_TOKEN;
|
|
399
|
+
const asMessage = (f) => ({ role: "user", content: [...f.seed.content], timestamp: 0 });
|
|
400
|
+
const tokens = frames.reduce((n, f) => n + estimateTokens(asMessage(f), cpt), 0) + Math.ceil(window.objectiveChars / cpt);
|
|
401
|
+
if (tokens <= budget)
|
|
402
|
+
return;
|
|
403
|
+
const n = frames.length;
|
|
404
|
+
throw userAttachmentRefusal(SEAT_REF, `the ${n} ${n === 1 ? "attachment" : "attachments"} and the objective come to about ${tokens} tokens, over the ${budget} tokens one request can hold on this model — to send it the engine would have to drop the objective or some of the attachments. Nothing was sent; attach fewer or smaller parts.`);
|
|
405
|
+
}
|
|
406
|
+
export async function readObjectiveAttachments(prepared, inputId, blocked, window) {
|
|
387
407
|
if (blocked || prepared.userAttachments === undefined)
|
|
388
408
|
return { frames: [], chars: 0 };
|
|
389
409
|
const frames = await readUserAttachments({
|
|
@@ -397,6 +417,7 @@ export async function readObjectiveAttachments(prepared, inputId, blocked) {
|
|
|
397
417
|
counts: prepared.reminderDisclosureCounts,
|
|
398
418
|
signal: prepared.abortController.signal,
|
|
399
419
|
});
|
|
420
|
+
refuseFramesOverWindow(frames, prepared.harness.getModel(), window);
|
|
400
421
|
return { frames, chars: frames.reduce((n, f) => n + f.seed.content.reduce((m, b) => m + (b.type === "text" ? b.text.length : 0), 0), 0) };
|
|
401
422
|
}
|
|
402
423
|
export function lastAttachmentFrameOf(entries, id) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { type PermissionMode } from "./ask-origin.js";
|
|
24
24
|
import type { RunnerDeps, TaskSpec } from "./types.js";
|
|
25
25
|
import { type StoreDurability } from "./checkpoint-store.js";
|
|
26
|
-
import type {
|
|
26
|
+
import type { ModAdmissionRecord } from "./mods/kernel/index.js";
|
|
27
27
|
import type { McpDelivered, McpFailureKind, McpServerLiveness } from "./mcp-failure.js";
|
|
28
28
|
import type { WriteProtectionTargetView } from "./write-protect.js";
|
|
29
29
|
import type { OnAsk } from "./tool-policy.js";
|
|
@@ -113,8 +113,7 @@ export interface AutoModeArmFact {
|
|
|
113
113
|
* One declared MCP server's materialization result for THIS leg — the per-server connection-state
|
|
114
114
|
* read face on {@link WiringManifest.mcp}. `status` is the connect-time verdict of this leg's
|
|
115
115
|
* materialize (a snapshot, never a heartbeat — the same semantics as `MaterializedMcp.statuses`,
|
|
116
|
-
* which it is projected from): `connected` (tools listed; `toolCount` = the
|
|
117
|
-
* intake), `failed` (the connect or the tool listing threw — `errorCode`/`delivered`/`httpStatus` are the
|
|
116
|
+
* which it is projected from): `connected` (tools listed; `toolCount` = see the field), `failed` (the connect or the tool listing threw — `errorCode`/`delivered`/`httpStatus` are the
|
|
118
117
|
* failure record spread flat (see the MCP failure vocabulary's `McpFailure`), `error` the
|
|
119
118
|
* neutralized, length-bounded remote text), `skipped` (declared on the spec but this leg produced no
|
|
120
119
|
* status for it — the materialization did not reach it). `source` is the DECLARING side's own label
|
|
@@ -130,6 +129,9 @@ export interface WiringManifestMcpEntry {
|
|
|
130
129
|
delivered?: McpDelivered;
|
|
131
130
|
httpStatus?: number;
|
|
132
131
|
error?: string;
|
|
132
|
+
/** How many of the server's tools the roster the row is read against holds: a run's roster (the valve and the deployment's
|
|
133
|
+
* `toolFaces` overlay applied — a tool either one leaves off is not counted), or, for `probeMcpServers` (no run, so no lists),
|
|
134
|
+
* what its own dial would mount. `0` on `failed` and on `skipped` (no connection, so nothing held). */
|
|
133
135
|
toolCount: number;
|
|
134
136
|
/**
|
|
135
137
|
* The engine's last liveness OBSERVATION about this server as of this leg's materialize — a per-leg
|
|
@@ -180,7 +182,6 @@ export declare function deriveLspSeam(mounted: boolean, diagnosticsLive: boolean
|
|
|
180
182
|
* (`schemaVersion` bumps only on a semantic break of an EXISTING field). The TaskEvent face is the
|
|
181
183
|
* host/operator plane — the manifest never enters model context.
|
|
182
184
|
*/
|
|
183
|
-
export type { WiringManifestHookEntry };
|
|
184
185
|
export interface WiringManifest {
|
|
185
186
|
schemaVersion: 1;
|
|
186
187
|
/** Present on EFFECTIVE (per-leg) manifests only; the static half has no leg. */
|
|
@@ -356,14 +357,16 @@ export interface WiringManifest {
|
|
|
356
357
|
*/
|
|
357
358
|
tools?: import("./tool-roster.js").ToolRoster;
|
|
358
359
|
/**
|
|
359
|
-
* EFFECTIVE half only: the
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
360
|
+
* EFFECTIVE half only: the leg's mods admission — one record per registration of the two seats, in run order: a
|
|
361
|
+
* mounted one with the patterns it actually hung (`events`), the ones it declared observe-only (`observe`) and the
|
|
362
|
+
* judges skipped while it was judged (`skipped`), or a refused one with who refused it and why (`refusedBy`,
|
|
363
|
+
* `reason`). PRESENT IFF the leg has a registration — a deployment that wires none reports nothing here and its
|
|
364
|
+
* manifest (and {@link configFingerprint}) is byte-for-byte what it was. Absence reads as "this leg carries no
|
|
365
|
+
* registration", NOT as "no extension judges this leg's calls": a delegated child can still be screened by an
|
|
366
|
+
* ancestor's chain through the gate's constraint fold. EXCLUDED from {@link configFingerprint}: the task seat is a
|
|
367
|
+
* per-task seat, so one assembly's legs legitimately differ on it.
|
|
365
368
|
*/
|
|
366
|
-
|
|
369
|
+
mods?: readonly ModAdmissionRecord[];
|
|
367
370
|
/**
|
|
368
371
|
* EFFECTIVE half only: the LSP code-intelligence seam. PRESENT IFF a manager seat resolved
|
|
369
372
|
* (`spec.lspManager ?? deps.lspManager`); a deployment that wires none reports nothing (byte-for-byte
|
|
@@ -412,7 +415,7 @@ export interface WiringManifest {
|
|
|
412
415
|
* the engine's seats — the same fact `config.write_protection_target_view_absent` announces once per run
|
|
413
416
|
* when a covered write tool is mounted beside a `"spelling-only"` judge.
|
|
414
417
|
*
|
|
415
|
-
* IN the fingerprint below (unlike `tools`/`lsp`/`
|
|
418
|
+
* IN the fingerprint below (unlike `tools`/`lsp`/`mods`): which view the judge got is an ASSEMBLY fact
|
|
416
419
|
* — it follows the table seat and whether the deployment wired hands at all — so legs of one assembly
|
|
417
420
|
* agree on it, which is exactly the equality the fingerprint advertises.
|
|
418
421
|
*
|
|
@@ -466,7 +469,7 @@ export interface WiringManifest {
|
|
|
466
469
|
* `"on"` — it records (store wired, neither layer declared it off, a filesystem env mounted). `"disabled"` — it does
|
|
467
470
|
* not, whichever layer or missing half made it so (`TaskSpec.fileHistory`, `RunnerDeps.fileHistoryStore: "disabled"`, `RunnerDeps.fileHistoryCapture: "off"`,
|
|
468
471
|
* no store, no filesystem env); the host knows its own deployment seat. ABSENT = an older mint or an external
|
|
469
|
-
* derivation, never a state. Out of {@link configFingerprint}: the request word is a per-task seat (`
|
|
472
|
+
* derivation, never a state. Out of {@link configFingerprint}: the request word is a per-task seat (`mods` reasoning).
|
|
470
473
|
*/
|
|
471
474
|
fileHistory?: "on" | "disabled";
|
|
472
475
|
/** EFFECTIVE half only — a short, non-sensitive fingerprint (sha256 prefix over the canonical
|
|
@@ -544,8 +547,8 @@ export interface WiringFacts {
|
|
|
544
547
|
mcp?: readonly WiringManifestMcpEntry[];
|
|
545
548
|
/** Effective half only — the leg's minted tool roster (see {@link WiringManifest.tools}). */
|
|
546
549
|
tools?: import("./tool-roster.js").ToolRoster;
|
|
547
|
-
/** Effective half only — the
|
|
548
|
-
|
|
550
|
+
/** Effective half only — the leg's mods admission records ({@link WiringManifest.mods}); an empty array and an absent value derive the same thing (no section). */
|
|
551
|
+
mods?: readonly ModAdmissionRecord[];
|
|
549
552
|
/** Effective half only — the LSP seam ({@link WiringManifest.lsp}); absent ⇒ no manager wired. */
|
|
550
553
|
lsp?: {
|
|
551
554
|
mounted: boolean;
|
|
@@ -210,7 +210,7 @@ export function deriveWiringManifest(facts) {
|
|
|
210
210
|
...(facts.half === "effective" && facts.autoMode !== undefined ? { autoMode: readAutoModeFact(facts.autoMode) } : {}),
|
|
211
211
|
...(facts.half === "effective" && facts.mcp !== undefined ? { mcp: facts.mcp.map((e) => ({ ...e })) } : {}),
|
|
212
212
|
...(facts.half === "effective" && facts.tools !== undefined ? { tools: facts.tools } : {}),
|
|
213
|
-
...(facts.half === "effective" && facts.
|
|
213
|
+
...(facts.half === "effective" && facts.mods !== undefined && facts.mods.length > 0 ? { mods: [...facts.mods] } : {}),
|
|
214
214
|
...(facts.half === "effective" && facts.lsp !== undefined ? { lsp: { ...facts.lsp } } : {}),
|
|
215
215
|
...(facts.half === "effective" && facts.hands !== undefined ? { hands: readHandsFact(facts.hands) } : {}),
|
|
216
216
|
...(facts.half === "effective" && facts.permissionMode !== undefined ? { permissionMode: readPermissionModeFact(facts.permissionMode) } : {}),
|
|
@@ -226,7 +226,7 @@ export function deriveWiringManifest(facts) {
|
|
|
226
226
|
: {}),
|
|
227
227
|
};
|
|
228
228
|
if (facts.half === "effective") {
|
|
229
|
-
const { leg: _leg, mcp: _mcp, tools: _tools, lsp: _lsp,
|
|
229
|
+
const { leg: _leg, mcp: _mcp, tools: _tools, lsp: _lsp, mods: _mods, teamRole: _teamRole, peerPresence: _peerPresence, fileHistory: _fileHistory, permissionMode: _permissionMode, ...assembly } = manifest;
|
|
230
230
|
const { provenance: _askSeat, ...askForHash } = assembly.ask;
|
|
231
231
|
const { provenance: _questionSeat, ...questionForHash } = assembly.question;
|
|
232
232
|
manifest.configFingerprint = createHash("sha256")
|
|
@@ -2,8 +2,7 @@ import { renderUserAttachmentView, userAttachmentOf } from "../llm/index.js";
|
|
|
2
2
|
import { normalizeLlmMessageContent } from "../harness/messages.js";
|
|
3
3
|
import { sliceHeadSafe } from "../../core/surrogate-safe-slice.js";
|
|
4
4
|
import { cutEnginePrefix, cutEngineSegments, flattenableUserText } from "../../core/untrusted-text.js";
|
|
5
|
-
import { fileArgPath } from "../../
|
|
6
|
-
import { fileOpAccessOf } from "../../core/tool-registry.js";
|
|
5
|
+
import { fileArgPath, fileOpAccessOf } from "../../core/tool-registry.js";
|
|
7
6
|
export const DURABLE_HISTORY_NAMES = new Map([
|
|
8
7
|
["read", "read"],
|
|
9
8
|
["write", "create"],
|
|
@@ -112,9 +112,10 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
112
112
|
* fail-closed (drop secret-pattern keys, keep PATH/build/locale). `"all"` = full inherit (trusted env);
|
|
113
113
|
* `string[]` = strict allowlist. `shellEnv`/per-exec `env` always pass through. Any other value — an unknown
|
|
114
114
|
* word, a non-string, a list entry that is not a variable name — throws here (`inheritEnvPolicyProblem`'s
|
|
115
|
-
* reason), the same judgment the oracle gate's `inheritEnv` meets. Whatever the policy, the deployment's
|
|
116
|
-
*
|
|
117
|
-
* the
|
|
115
|
+
* reason), the same judgment the oracle gate's `inheritEnv` meets. Whatever the policy, the deployment's own
|
|
116
|
+
* credentials (`declareWithheldEnv`: by name, and by a value equal to a declared or engine-held credential value)
|
|
117
|
+
* are withheld from the inherited part; a list naming a declared name throws here when the declaration came
|
|
118
|
+
* first, and every spawn refuses it (`spawn_error` / `spawn_failed`) whenever it came. */
|
|
118
119
|
inheritEnv?: "all" | "scrub" | string[];
|
|
119
120
|
/** design/105: inject a resident scheduler daemon backend (the shell daemon). Absent ⇒ scheduling INERT. */
|
|
120
121
|
scheduler?: SchedulerCapability;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dirname, isAbsolute, sep } from "node:path";
|
|
2
|
-
import { isUncSpelling } from "../../
|
|
2
|
+
import { isUncSpelling } from "../../core/unc-spelling.js";
|
|
3
3
|
import { err, ok } from "../harness/types.js";
|
|
4
4
|
export function anchorAtLinkDir(linkDir, target, separator) {
|
|
5
5
|
const endsInSeparator = linkDir.endsWith(separator) || (separator === "\\" && linkDir.endsWith("/"));
|
|
@@ -363,7 +363,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
363
363
|
/**
|
|
364
364
|
* roadmap #5 (CC Stop hook): wire (or clear) the stop gate — consulted ONLY when the run would
|
|
365
365
|
* otherwise end (no tool calls, steer + followUp queues dry). Non-empty return = the run
|
|
366
|
-
* continues with those messages injected; empty = the run ends. Policy (the
|
|
366
|
+
* continues with those messages injected; empty = the run ends. Policy (the `classic.Stop` dispatch,
|
|
367
367
|
* consecutive-block cap, reason formatting) lives in the runner; the harness only supplies the
|
|
368
368
|
* drain-point timing.
|
|
369
369
|
*/
|
|
@@ -2,7 +2,7 @@ import { createAssistantMessageEventStream, ensureToolTurnInvariants, snapshotAc
|
|
|
2
2
|
import { finalizeToolOutcome, runAgentLoop } from "../loop/agent-loop.js";
|
|
3
3
|
import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
|
|
4
4
|
import { normalizeEngineSegments } from "../../core/untrusted-text.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
6
6
|
import { isProviderEchoShape } from "../../brain/errors.js";
|
|
7
7
|
import { convertToLlm } from "./messages.js";
|
|
8
8
|
import { readMember, thrownText } from "../../core/thrown-value.js";
|
|
@@ -99,7 +99,7 @@ function dropAuthCarriers(bag) {
|
|
|
99
99
|
return bag;
|
|
100
100
|
const out = {};
|
|
101
101
|
for (const [k, v] of Object.entries(bag)) {
|
|
102
|
-
if (!
|
|
102
|
+
if (!isCredentialHeaderName(k))
|
|
103
103
|
out[k] = v;
|
|
104
104
|
}
|
|
105
105
|
return out;
|
|
@@ -108,7 +108,7 @@ function refuseAuthCarriersInStreamOptions(bag) {
|
|
|
108
108
|
if (!bag)
|
|
109
109
|
return;
|
|
110
110
|
for (const k of Object.keys(bag)) {
|
|
111
|
-
if (
|
|
111
|
+
if (isCredentialHeaderName(k)) {
|
|
112
112
|
throw new Error(`streamOptions.headers must not carry an auth header ("${k}") — the run-static bag is not an auth channel ` +
|
|
113
113
|
`(the route pairing law reads options-borne carriers as per-model credentials, which a run-wide bag is not). ` +
|
|
114
114
|
`Put a deployment credential on the brain config (apiKey / headers, where its URL half is judged), or serve ` +
|
|
@@ -670,13 +670,14 @@ export class AgentHarness {
|
|
|
670
670
|
},
|
|
671
671
|
};
|
|
672
672
|
},
|
|
673
|
-
beforeToolCall: async ({ toolCall, args }, signal) => {
|
|
673
|
+
beforeToolCall: async ({ toolCall, args, readArguments }, signal) => {
|
|
674
674
|
const result = await this.emitHook({
|
|
675
675
|
type: "tool_call",
|
|
676
676
|
toolCallId: toolCall.id,
|
|
677
677
|
toolName: toolCall.name,
|
|
678
678
|
input: args,
|
|
679
679
|
...(signal !== undefined ? { signal } : {}),
|
|
680
|
+
...(readArguments !== undefined ? { readArguments } : {}),
|
|
680
681
|
});
|
|
681
682
|
return result;
|
|
682
683
|
},
|
|
@@ -142,6 +142,8 @@ export declare class FileError extends Error {
|
|
|
142
142
|
}
|
|
143
143
|
/** Stable, backend-independent execution error codes returned by {@link ExecutionEnv.exec}. */
|
|
144
144
|
export type ExecutionErrorCode = "aborted" | "timeout"
|
|
145
|
+
/** Ran-then-cut for SILENCE: no stdout/stderr byte for the env's liveness window ({@link ExecutionError.noOutputSec}) — a hang detector, not the wall-clock budget (`"timeout"`), so an env MUST answer this word for it: the two explain themselves with different numbers. Retryable per idempotency. */
|
|
146
|
+
| "liveness_no_output"
|
|
145
147
|
/** The shell binary/config could not be resolved BEFORE spawning — the command never started. */
|
|
146
148
|
| "shell_unavailable"
|
|
147
149
|
/** CONTRACT (2026-07-13, TB cwd-contamination batch): spawn_error MUST mean the command NEVER STARTED (the
|
|
@@ -187,7 +189,7 @@ export declare class ExecutionError extends Error {
|
|
|
187
189
|
code: ExecutionErrorCode;
|
|
188
190
|
/**
|
|
189
191
|
* TB triple-fake-green report (2026-07-13) — output produced BEFORE the failure, for the
|
|
190
|
-
* ran-then-cut codes (`timeout` / `aborted` / `callback_error`; the last is a command that
|
|
192
|
+
* ran-then-cut codes (`timeout` / `liveness_no_output` / `aborted` / `callback_error`; the last is a command that
|
|
191
193
|
* started and was then killed because a host-side output callback failed — its completion was
|
|
192
194
|
* never observed, but its captured output is real work). CC anchor (2.1.206 BashTask settle): a
|
|
193
195
|
* timed-out command keeps ALL captured stdout/stderr and only APPENDS a "Command timed out after
|
|
@@ -197,11 +199,15 @@ export declare class ExecutionError extends Error {
|
|
|
197
199
|
*/
|
|
198
200
|
partialStdout?: string;
|
|
199
201
|
partialStderr?: string;
|
|
202
|
+
/** `liveness_no_output` only: the silence window (whole seconds) that cut the command — the env's bound, never the requested budget; absent = not stated. */
|
|
203
|
+
noOutputSec?: number;
|
|
200
204
|
constructor(code: ExecutionErrorCode, message: string, cause?: Error, partial?: {
|
|
201
205
|
stdout?: string;
|
|
202
206
|
stderr?: string;
|
|
203
|
-
});
|
|
207
|
+
}, noOutputSec?: number);
|
|
204
208
|
}
|
|
209
|
+
/** A command that RAN and was cut by a time bound — the wall-clock budget (`"timeout"`) or the silence window (`"liveness_no_output"`): one reading for every consumer that recovers the partial output. */
|
|
210
|
+
export declare function isTimeCutCode(code: ExecutionErrorCode): code is "timeout" | "liveness_no_output";
|
|
205
211
|
/** Stable compaction error codes returned by compaction helpers. */
|
|
206
212
|
export type CompactionErrorCode = "aborted" | "summarization_failed" | "invalid_session" | "unknown";
|
|
207
213
|
/** Error returned by compaction helpers. */
|
|
@@ -610,8 +616,8 @@ export interface LeafEntry extends SessionTreeEntryBase {
|
|
|
610
616
|
}
|
|
611
617
|
/**
|
|
612
618
|
* Prompt-epoch pin (stage S3, prompt-assembly protocol §9.2) — a FIRST-CLASS typed entry (not a
|
|
613
|
-
* forgeable generic `custom` entry):
|
|
614
|
-
* at session start (before the first conversation entry) and
|
|
619
|
+
* forgeable generic `custom` entry): the session's prompt identity record and its pinned center layer. Written
|
|
620
|
+
* at session start (before the first conversation entry) and whenever a run's identity moves; every compaction
|
|
615
621
|
* RESTATES the then-current descriptor inside its own `details.promptEpoch` (same-CAS atomicity,
|
|
616
622
|
* bounded-tail recoverable). Fields mirror `PromptEpochDescriptor` (src/prompt-assembly/epoch.ts).
|
|
617
623
|
*/
|
|
@@ -934,10 +940,11 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
|
|
|
934
940
|
* bounded-tail backends. A durable backend that loads only `firstKeptEntryId..leaf` cannot show
|
|
935
941
|
* the branch walk an epoch carrier when a rewind cuts BEFORE the latest compaction's restatement
|
|
936
942
|
* (window: firstKept ≤ cut < compactionEntry) — `Session.getPromptEpoch()` falls back to this
|
|
937
|
-
* method when the loaded branch has no carrier. Implementations return the
|
|
938
|
-
* nearest carrier BELOW the load floor (a `prompt_epoch` entry or a compaction
|
|
939
|
-
*
|
|
940
|
-
*
|
|
943
|
+
* method when the loaded branch has no carrier. Implementations return the record of the
|
|
944
|
+
* nearest carrier BELOW the load floor (a `prompt_epoch` entry or a compaction's `details.promptEpoch`)
|
|
945
|
+
* AS STORED — the session reads it (a retired shape must reach it to be answered `legacy`; a backend that
|
|
946
|
+
* normalized it first would turn a pinned session into an unpinned one) — or undefined when none exists (a
|
|
947
|
+
* genuinely pre-epoch session). File/in-memory backends need not implement it (their walks see the full tree).
|
|
941
948
|
*/
|
|
942
949
|
/** RB-104 (2026-07-25, defect probe): the bounded-window root this storage was woken with (F3), or
|
|
943
950
|
* null/absent for a full-tree load. Optional — a backend that never bounds its wake omits it. Callers
|
|
@@ -945,13 +952,7 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
|
|
|
945
952
|
* from a CORRUPT log (a head whose parent is simply missing); the two look identical byte-wise and
|
|
946
953
|
* must not be treated alike. `BaseSessionStorage` implements it for the bundled backends. */
|
|
947
954
|
getFloorId?(): string | null;
|
|
948
|
-
getEpochAnchor?(): Promise<
|
|
949
|
-
epoch: number;
|
|
950
|
-
artifactDigest: string;
|
|
951
|
-
packId: string;
|
|
952
|
-
assemblyApi: number;
|
|
953
|
-
activatedBy: "session_start" | "compaction" | "legacy_migration";
|
|
954
|
-
} | undefined>;
|
|
955
|
+
getEpochAnchor?(): Promise<unknown>;
|
|
955
956
|
}
|
|
956
957
|
/**
|
|
957
958
|
* Options for `buildContext`/`buildSessionContext` — the read-side window awareness seam.
|
|
@@ -1018,7 +1019,7 @@ export interface Session<TMetadata extends SessionMetadata = SessionMetadata> {
|
|
|
1018
1019
|
* optionality keeps external `Session` implementers compatible. The consumer (`maybeCompact`'s
|
|
1019
1020
|
* epoch restatement) calls it with `?.()` — an implementer without it degrades to the pre-epoch
|
|
1020
1021
|
* path (no restatement), never a crash. */
|
|
1021
|
-
getPromptEpoch?(): Promise<import("../../prompt-assembly/epoch.js").
|
|
1022
|
+
getPromptEpoch?(): Promise<import("../../prompt-assembly/epoch.js").StoredPromptEpoch | undefined>;
|
|
1022
1023
|
/** Persist the git-status announced state as a first-class {@link GitAnnouncementEntry}
|
|
1023
1024
|
* (snapshot semantics; see `Session.appendGitAnnouncement`). OPTIONAL on the interface — same
|
|
1024
1025
|
* external-implementer posture as `getPromptEpoch`; consumers call it with `?.()` and an
|
|
@@ -1184,6 +1185,9 @@ export interface ToolCallEvent {
|
|
|
1184
1185
|
* emits that carry no per-call signal; a subscriber gating a wait on it must then fall back to
|
|
1185
1186
|
* whatever run-level signal it already holds (the historical shape, byte-identical). */
|
|
1186
1187
|
signal?: AbortSignal;
|
|
1188
|
+
/** The loop's reading of this call's arguments ({@link BeforeToolCallContext.readArguments}), handed on verbatim: a
|
|
1189
|
+
* subscriber that rewrites the call reads the rewrite through it before judging it. */
|
|
1190
|
+
readArguments?: (args: unknown) => unknown;
|
|
1187
1191
|
}
|
|
1188
1192
|
export interface ToolResultEvent {
|
|
1189
1193
|
type: "tool_result";
|
|
@@ -33,7 +33,8 @@ export class ExecutionError extends Error {
|
|
|
33
33
|
code;
|
|
34
34
|
partialStdout;
|
|
35
35
|
partialStderr;
|
|
36
|
-
|
|
36
|
+
noOutputSec;
|
|
37
|
+
constructor(code, message, cause, partial, noOutputSec) {
|
|
37
38
|
super(message, cause === undefined ? undefined : { cause });
|
|
38
39
|
this.name = "ExecutionError";
|
|
39
40
|
this.code = code;
|
|
@@ -41,8 +42,13 @@ export class ExecutionError extends Error {
|
|
|
41
42
|
this.partialStdout = partial.stdout;
|
|
42
43
|
if (partial?.stderr !== undefined)
|
|
43
44
|
this.partialStderr = partial.stderr;
|
|
45
|
+
if (noOutputSec !== undefined)
|
|
46
|
+
this.noOutputSec = noOutputSec;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
49
|
+
export function isTimeCutCode(code) {
|
|
50
|
+
return code === "timeout" || code === "liveness_no_output";
|
|
51
|
+
}
|
|
46
52
|
export class CompactionError extends Error {
|
|
47
53
|
code;
|
|
48
54
|
constructor(code, message, cause) {
|
|
@@ -1012,12 +1012,13 @@ export interface RouteCredential {
|
|
|
1012
1012
|
/** The key itself, when the credential rides the apiKey knob. An EMPTY string is a present (per-call)
|
|
1013
1013
|
* credential that fails closed at emit time — presence, not truthiness (the degraded-secret contract). */
|
|
1014
1014
|
apiKey?: string;
|
|
1015
|
-
/** True when the credential rides as
|
|
1016
|
-
*
|
|
1015
|
+
/** True when the credential rides (also) as credential HEADERS (`isCredentialHeaderName`: `authorization`,
|
|
1016
|
+
* `x-api-key`, `api-key`, a gateway's `Helicone-Auth`, …, any case) — alone, or beside the apiKey knob when one
|
|
1017
|
+
* source sets both. The winning bag is named by {@link RouteCredential.carrierBag}. */
|
|
1017
1018
|
headersBorne?: boolean;
|
|
1018
|
-
/** Which header bag carries a headers-borne credential (resolution precedence:
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1019
|
+
/** Which header bag carries a headers-borne credential (resolution precedence: options > model > config, one rank
|
|
1020
|
+
* per source; within the hook's answer (`options`) and within the deployment config (`config`) the knob and the
|
|
1021
|
+
* bag's credential headers are ONE credential — see `resolveRouteCredential`). */
|
|
1021
1022
|
carrierBag?: RouteCarrierBag;
|
|
1022
1023
|
}
|
|
1023
1024
|
/** The deployment half of the pairing judgment: the root the brain sends to when an entry names none —
|
|
@@ -1029,12 +1030,12 @@ export interface RoutePairingConfig {
|
|
|
1029
1030
|
laneDefault?: string;
|
|
1030
1031
|
}
|
|
1031
1032
|
/** How an OK verdict is paired.
|
|
1032
|
-
* - `"per-model"` — per-model credential,
|
|
1033
|
+
* - `"per-model"` — per-model credential, on the origin it is bound to (or not bound yet).
|
|
1033
1034
|
* - `"paired"` — deployment credential on the deployment's own root (declared, or the lane default).
|
|
1034
1035
|
* - `"keyless"` — no credential anywhere; nothing to protect. */
|
|
1035
1036
|
export type RoutePairingPosture = "per-model" | "paired" | "keyless";
|
|
1036
1037
|
/** Machine codes an adjudication refusal carries (minted here, forwarded verbatim by consumers). */
|
|
1037
|
-
export type RouteRefusalCode = "route.credential_mismatch" | "route.credential_missing";
|
|
1038
|
+
export type RouteRefusalCode = "route.credential_mismatch" | "route.credential_missing" | "route.credential_origin_mismatch" | "route.credential_answer_conflict";
|
|
1038
1039
|
/** The structured account of a refusal — the two halves and the fix, every URL a DISPLAY spelling. */
|
|
1039
1040
|
export interface RouteRefusalDetail {
|
|
1040
1041
|
modelId: string;
|
|
@@ -1044,6 +1045,10 @@ export interface RouteRefusalDetail {
|
|
|
1044
1045
|
requestBaseUrl: string;
|
|
1045
1046
|
/** The declared root the credential is paired with (mismatch refusals), rendered. */
|
|
1046
1047
|
configBaseUrl?: string;
|
|
1048
|
+
/** The origin a per-model credential is bound to (`route.credential_origin_mismatch`), rendered. */
|
|
1049
|
+
boundOrigin?: string;
|
|
1050
|
+
/** The origin the refused request would have gone to (`route.credential_origin_mismatch`), rendered. */
|
|
1051
|
+
requestOrigin?: string;
|
|
1047
1052
|
/** One-line configuration fix. */
|
|
1048
1053
|
fixHint: string;
|
|
1049
1054
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import type { AssistantMessage, ToolResultMessage } from "../llm/index.js";
|
|
25
25
|
import { type AgentCoreStreamRuntimeDeps } from "./runtime-deps.js";
|
|
26
|
-
import type { AfterToolCallResult, AgentContext, AgentEvent, AgentLoopConfig, AgentMessage, AgentToolResult, HaltRemainingDirective, StreamFn } from "./types.js";
|
|
26
|
+
import type { AfterToolCallResult, AgentContext, AgentEvent, AgentLoopConfig, AgentMessage, AgentTool, AgentToolCall, AgentToolResult, HaltRemainingDirective, StreamFn } from "./types.js";
|
|
27
27
|
/** Callback used by synchronous loop runners to publish agent lifecycle events. */
|
|
28
28
|
export type AgentEventSink = (event: AgentEvent) => Promise<void> | void;
|
|
29
29
|
/** Named reasons the loop goes around again. Assertable in tests via the trace sink. */
|
|
@@ -159,6 +159,17 @@ export type ExecutedToolCallOutcome = {
|
|
|
159
159
|
result: AgentToolResult<unknown>;
|
|
160
160
|
isError: boolean;
|
|
161
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* THE reading a value gets on its way to becoming a call's arguments: the tool's own preparation (`prepareArguments` —
|
|
164
|
+
* a default filled in, an alias folded), then the schema's coercions ({@link validateToolArguments}). The loop reads the
|
|
165
|
+
* model's call through it before the gate, hands the same reading to the gate (`BeforeToolCallContext.readArguments`)
|
|
166
|
+
* so every rewrite is judged as it will run, and reads the gate's output through the same two steps once more — refusing
|
|
167
|
+
* an output they would move. A preparation that throws throws here too (the value cannot be read: whoever adopts it
|
|
168
|
+
* refuses it, as the loop refuses a model call whose preparation throws). A value that does not VALIDATE is handed back as
|
|
169
|
+
* given: nothing invalid runs (the loop's own reading of the gate's output throws on it), and a judge of it judges bytes
|
|
170
|
+
* that never execute.
|
|
171
|
+
*/
|
|
172
|
+
export declare function readToolCallArguments(tool: AgentTool, toolCall: AgentToolCall, args: unknown): unknown;
|
|
162
173
|
/**
|
|
163
174
|
* How many tool names an unknown-tool miss spells out. A miss is a NAME problem: seeing a couple of dozen
|
|
164
175
|
* real names is what lets a model spot the one it meant, while a full listing grows with the deployment
|