@sema-agent/core 7.58.0 → 7.60.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 +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
package/dist/core/mcp-probe.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import { snapshotMcpEntries } from "./locked-config.js";
|
|
3
3
|
import { classifyMcpFailure, livenessOf } from "./mcp-failure.js";
|
|
4
|
+
import { transportKindOf } from "./mcp-server-spec.js";
|
|
5
|
+
import { receivePeerSeat } from "./peer-seat.js";
|
|
6
|
+
import { compileHostFloor } from "./host-floor.js";
|
|
4
7
|
import { MCP_ENV_MS_MAX, materializeMcpTools } from "./mcp.js";
|
|
5
8
|
import { refuseCollidingMcpServerNames } from "./mcp-name-judge.js";
|
|
6
9
|
import { mcpManifestEntries } from "./runner/prepare-wiring-manifest.js";
|
|
@@ -55,7 +58,7 @@ async function raceDial(dial, ms, signal) {
|
|
|
55
58
|
}
|
|
56
59
|
function stoppedWaitingStatus(entry, ms) {
|
|
57
60
|
const condition = new McpError(ErrorCode.RequestTimeout, `the probe stopped waiting for this server's connect and initial tool listing after ${ms} ms`);
|
|
58
|
-
const { kind, delivered } = classifyMcpFailure(condition, { phase: "connect", transport: entry
|
|
61
|
+
const { kind, delivered } = classifyMcpFailure(condition, { phase: "connect", transport: transportKindOf(entry) });
|
|
59
62
|
const liveness = livenessOf(kind, Date.now());
|
|
60
63
|
return { name: entry.name, status: "failed", errorCode: kind, delivered, error: condition.message, ...(liveness !== undefined ? { liveness } : {}) };
|
|
61
64
|
}
|
|
@@ -64,7 +67,9 @@ export async function probeMcpServers(specs, opts = {}) {
|
|
|
64
67
|
const timeoutMs = wholeInRange("timeoutMs", opts.timeoutMs, 1, MCP_ENV_MS_MAX);
|
|
65
68
|
const concurrency = wholeInRange("concurrency", opts.concurrency, 1, Number.MAX_SAFE_INTEGER) ?? 1;
|
|
66
69
|
const onElicit = opts.onElicit ?? DECLINE_EVERY_ELICITATION;
|
|
70
|
+
const hostFloor = compileHostFloor(opts.hostFloor);
|
|
67
71
|
const signal = opts.signal;
|
|
72
|
+
const peerSeat = receivePeerSeat(opts.peerSeat, "probeMcpServers peerSeat");
|
|
68
73
|
refuseCollidingMcpServerNames(declared.map((e) => e.name));
|
|
69
74
|
const statuses = [];
|
|
70
75
|
const servers = new Array(declared.length);
|
|
@@ -74,7 +79,7 @@ export async function probeMcpServers(specs, opts = {}) {
|
|
|
74
79
|
const entry = declared[i];
|
|
75
80
|
const started = performance.now();
|
|
76
81
|
const elapsed = () => Math.round(performance.now() - started);
|
|
77
|
-
const dial = materializeMcpTools([entry], opts.principal, onElicit, undefined, undefined, undefined, undefined, undefined, undefined, undefined,
|
|
82
|
+
const dial = materializeMcpTools([entry], opts.principal, onElicit, undefined, undefined, undefined, undefined, undefined, undefined, undefined, hostFloor, peerSeat);
|
|
78
83
|
const verdict = await raceDial(dial, timeoutMs, signal);
|
|
79
84
|
if (verdict.kind === "settled") {
|
|
80
85
|
const found = verdict.handle.statuses.find((s) => s.name === entry.name);
|
|
@@ -13,7 +13,16 @@
|
|
|
13
13
|
* replacement, so a late 404 never closes a connection other calls have moved to.
|
|
14
14
|
*/
|
|
15
15
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
16
|
-
import type
|
|
16
|
+
import { type McpAuthorization, type McpExchangeOutcome, type McpFailure, type McpFailureSite } from "./mcp-failure.js";
|
|
17
|
+
/**
|
|
18
|
+
* One request failure, read once and told to the server's two writers: its reach ({@link ServerHealth.observe}) always, and — when
|
|
19
|
+
* `answer` (this failure is the request's answer: the lane sends nothing again) — the authorization the user owes
|
|
20
|
+
* ({@link ServerHealth.owed}). Returns the record.
|
|
21
|
+
*/
|
|
22
|
+
export declare function observedFailure(err: unknown, site: McpFailureSite, health: ServerHealth | undefined, answer: boolean): McpFailure;
|
|
23
|
+
/** A tool call's FINAL failure (the translated error, whose `details` is the record the one reading stamped) tells the server's
|
|
24
|
+
* announcer what the user owes — the call lane's one announcement, made once its attempts are over. */
|
|
25
|
+
export declare function owedByAnswer(err: unknown, health: ServerHealth): void;
|
|
17
26
|
/** Mutable per-server liveness flag, shared between a server's tool closures and its transport-close hook.
|
|
18
27
|
* `pendingElicitations` (RB-199 FO-1 codex review): a live count of in-flight `onElicit` waits on THIS
|
|
19
28
|
* server — the idle watchdog ({@link armMcpIdleWatchdog}) reads it before aborting a call (incremented when the wait starts,
|
|
@@ -37,6 +46,9 @@ export interface ServerHealth {
|
|
|
37
46
|
* outage either, and the in-flight calls it fails belong to a connection we chose to replace.
|
|
38
47
|
*/
|
|
39
48
|
observe?: (outcome: McpExchangeOutcome) => void;
|
|
49
|
+
/** The other thing a request can learn: its ANSWER was a refusal as `unauthorized`, so the user owes this authorization — the
|
|
50
|
+
* materialization's once-per-server announcer, filled by the merge stage beside `observe` (the same lifecycle silence applies). */
|
|
51
|
+
owed?: (authorization: McpAuthorization) => void;
|
|
40
52
|
pendingElicitations: number;
|
|
41
53
|
/** Stamped on EVERY
|
|
42
54
|
* elicitation close (finally, unconditional — not just when the count returns to 0). Closes a race
|
|
@@ -156,6 +168,15 @@ export declare class Resendable {
|
|
|
156
168
|
* {@link McpListingRefusal} answer only a call that was never sent.
|
|
157
169
|
*/
|
|
158
170
|
export declare function callThroughLink<R extends object>(link: McpServerLink, name: string, gate: string, signal: AbortSignal | undefined, send: (on: McpLiveConnection, resent: boolean) => Promise<R | Resendable>, gone: () => never): Promise<R | McpListingRefusal>;
|
|
171
|
+
/** What judges a call a refusal turned away: the live connection's listing, the operator's revocation list, the declaration a tool was mounted with. */
|
|
172
|
+
export type RefusalJudge = "listing" | "revocation" | "declaration";
|
|
173
|
+
/**
|
|
174
|
+
* THE closing sentence of an MCP call refused before it was sent: what the refusal covers (this call) and what judges a later call,
|
|
175
|
+
* never how that call will come out — a host's re-dial, refresh or un-revoke lands between two calls, and the call after it is
|
|
176
|
+
* judged against what it took. The listing's refusal, a revoked server's four outlets and the task-required one end with it; no
|
|
177
|
+
* site words it again. (A server whose transport is gone has its own text, `throwDeadServer`.)
|
|
178
|
+
*/
|
|
179
|
+
export declare function refusalScope(judge: RefusalJudge): string;
|
|
159
180
|
/** The answer to a call {@link reach} refused before it was sent: the pre-send refusal record (`delivered: "no"`; `code` beside `error`, as the revocation refusal's). */
|
|
160
181
|
export declare function listingRefusal(refusal: McpListingRefusal, remoteName: string, server: string): {
|
|
161
182
|
content: Array<{
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import { readMcpFailure } from "./mcp-failure.js";
|
|
1
2
|
import { UNPROVEN_GATE } from "./mcp-listing-drift.js";
|
|
3
|
+
import { readMember } from "./thrown-value.js";
|
|
2
4
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
5
|
+
export function observedFailure(err, site, health, answer) {
|
|
6
|
+
const { failure, exchange } = readMcpFailure(err, site);
|
|
7
|
+
health?.observe?.(exchange);
|
|
8
|
+
if (answer && failure.authorization !== undefined)
|
|
9
|
+
health?.owed?.(failure.authorization);
|
|
10
|
+
return failure;
|
|
11
|
+
}
|
|
12
|
+
export function owedByAnswer(err, health) {
|
|
13
|
+
const details = readMember(err, "details");
|
|
14
|
+
const a = readMember(details, "code") === "unauthorized" ? readMember(details, "authorization") : undefined;
|
|
15
|
+
if (typeof a === "object" && a !== null)
|
|
16
|
+
health.owed?.(a);
|
|
17
|
+
}
|
|
3
18
|
export const IDLE_WATCHDOG_ABORT_REASON = Symbol("mcp-idle-watchdog-abort");
|
|
4
19
|
export function armMcpIdleWatchdog(health, idleMs, outerSignal) {
|
|
5
20
|
const idleController = new AbortController();
|
|
@@ -89,11 +104,20 @@ export async function callThroughLink(link, name, gate, signal, send, gone) {
|
|
|
89
104
|
throw again.error;
|
|
90
105
|
return again;
|
|
91
106
|
}
|
|
107
|
+
const REFUSAL_JUDGES = {
|
|
108
|
+
listing: { rule: "each later call to this tool is checked again against the connection's latest listing", standing: "" },
|
|
109
|
+
revocation: { rule: "each later call to this server is checked again against the operator's current revocation list", standing: "This server stays on this run's tool roster. " },
|
|
110
|
+
declaration: { rule: "each later call to this tool is judged by the declaration of the listing it was mounted from, until a refresh or reconnect of the server mints the tool anew", standing: "" },
|
|
111
|
+
};
|
|
112
|
+
export function refusalScope(judge) {
|
|
113
|
+
const j = REFUSAL_JUDGES[judge];
|
|
114
|
+
return `${j.standing}This refusal is for this call only: ${j.rule}.`;
|
|
115
|
+
}
|
|
92
116
|
export function listingRefusal(refusal, remoteName, server) {
|
|
93
117
|
const changed = refusal === "changed";
|
|
94
118
|
const code = changed ? "mcp.tool_declaration_changed" : "mcp.tool_listing_unreached";
|
|
95
119
|
return {
|
|
96
|
-
content: [{ type: "text", text: `The call to tool ${inlineUntrusted(remoteName)} was refused before it was sent: MCP server "${inlineUntrusted(server)}" ${changed ? "no longer declares this tool the way it was mounted (its safety declaration changed, or a complete listing no longer lists it)" : "has not listed this tool since it was reconnected (the re-listing stopped before it reached the tool), so whether the server still declares it the way it was mounted is unknown"}. The server did not execute it.
|
|
120
|
+
content: [{ type: "text", text: `The call to tool ${inlineUntrusted(remoteName)} was refused before it was sent: MCP server "${inlineUntrusted(server)}" ${changed ? "no longer declares this tool the way it was mounted (its safety declaration changed, or a complete listing no longer lists it)" : "has not listed this tool since it was reconnected (the re-listing stopped before it reached the tool), so whether the server still declares it the way it was mounted is unknown"}. The server did not execute it. ${refusalScope("listing")}` }],
|
|
97
121
|
details: { error: code, code, delivered: "no", server },
|
|
98
122
|
terminate: false,
|
|
99
123
|
isError: true,
|
|
@@ -21,13 +21,19 @@ export interface McpServerSpec {
|
|
|
21
21
|
* carries — an http request's credential headers, a stdio child's environment — are answered per send by the deployment's
|
|
22
22
|
* peer seat ({@link RunnerDeps.peerSeat}). A `credentials` reference with no seat wired refuses the entry
|
|
23
23
|
* (`config.peer_seat_missing`); a declaration carrying the retired value members `headers` / `env` is refused at every
|
|
24
|
-
* entrance (`config.credential_in_declaration`).
|
|
24
|
+
* entrance (`config.credential_in_declaration`). `host`: the host supplies the pipe itself — the leg's host seat of this
|
|
25
|
+
* declaration's `name` (`RunInternals.mcpHostSeats`, mcp-host-seat.ts) carries every request; the transport has no member beyond
|
|
26
|
+
* its kind (a host seat carries its own pieces, so a reference or a principal header has nothing to ride), and a server mounted
|
|
27
|
+
* this way cannot opt in to {@link elicitation} — both refused at every entrance (`config.invalid_argument`). It never enters
|
|
28
|
+
* the run tree's connection pool: its pipe is the leg's own.
|
|
25
29
|
*/
|
|
26
30
|
transport: {
|
|
27
31
|
kind: "stdio";
|
|
28
32
|
command: string;
|
|
29
33
|
args?: string[];
|
|
30
34
|
credentials?: CredentialRef;
|
|
35
|
+
} | {
|
|
36
|
+
kind: "host";
|
|
31
37
|
} | {
|
|
32
38
|
kind: "http";
|
|
33
39
|
url: string;
|
|
@@ -199,6 +205,12 @@ export interface McpServerSpec {
|
|
|
199
205
|
*/
|
|
200
206
|
sessionMetaKey?: string;
|
|
201
207
|
}
|
|
208
|
+
/** The transport kinds a declaration names, one list: the dial reads a kind against it, so a word outside it is no kind at all. */
|
|
209
|
+
export declare const MCP_TRANSPORT_KINDS: readonly ["stdio", "http", "host"];
|
|
210
|
+
export type McpTransportKind = McpServerSpec["transport"]["kind"];
|
|
211
|
+
/** The one reading of a declaration's transport kind: a word of {@link MCP_TRANSPORT_KINDS}, or `undefined` for anything else (no transport,
|
|
212
|
+
* not a record, a word outside the list, a member that throws) — total, so a reader never fails on a declaration the dial would refuse. */
|
|
213
|
+
export declare function transportKindOf(spec: McpServerSpec): McpTransportKind | undefined;
|
|
202
214
|
type ToolAxes = NonNullable<McpServerSpec["toolAxes"]>;
|
|
203
215
|
/**
|
|
204
216
|
* The surfaces that declare `toolAxes`, which {@link readToolAxes} names its reading by: an MCP server's keys are the server's
|
|
@@ -218,10 +230,23 @@ export type ToolAxesRead = {
|
|
|
218
230
|
ok: false;
|
|
219
231
|
problem: string;
|
|
220
232
|
};
|
|
221
|
-
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
|
|
233
|
+
/**
|
|
234
|
+
* THE one shape text the caller wrote takes in a judge's sentence — a value, or a key the caller chose (a tool or skill name, the name of
|
|
235
|
+
* a member the declaration does not have, a `_meta` key): the redaction mark and its length, never the text. A caller's text can be
|
|
236
|
+
* anything a deployment put in the wrong field, a credential included, and the sentence travels to logs, panels and probes. A value that
|
|
237
|
+
* is no string is named by its kind ({@link dataKind}). Everything else a judge's sentence says is the engine's own: where (the
|
|
238
|
+
* declaration's member names, a list index), why (the closed vocabulary, a kind, a count and its bound) and whose (the declarer's name,
|
|
239
|
+
* the entry's published identity, which the engine already mints into every tool name it mounts).
|
|
240
|
+
*/
|
|
241
|
+
export declare function callerText(value: unknown): string;
|
|
242
|
+
/**
|
|
243
|
+
* Where in a declaration a sentence points, from `base`: a list index in brackets, a member name after a dot — the declaration's own
|
|
244
|
+
* member names (`words`, the engine's words) as written, any other key in the caller's-text shape ({@link callerText}). Bounded: no key is
|
|
245
|
+
* added once the path runs past 120 characters, and a path cut short ends in the truncation mark, so a deep declaration never makes a long
|
|
246
|
+
* sentence. Every judge of a declaration renders its paths here.
|
|
247
|
+
*/
|
|
248
|
+
export declare function declarationPath(path: readonly (string | number)[], words: ReadonlySet<string>, base?: string): string;
|
|
249
|
+
export declare const DECLARATION_ENTRY_WORDS: ReadonlySet<string>;
|
|
225
250
|
/** The kind of a value that is plain data, for a sentence that names what was declared without carrying it. */
|
|
226
251
|
export declare function dataKind(value: unknown): string;
|
|
227
252
|
/**
|
|
@@ -303,12 +328,16 @@ type PerToolDeclarationRead = {
|
|
|
303
328
|
};
|
|
304
329
|
/**
|
|
305
330
|
* A per-tool declaration's receipt: {@link receiveDeclaration} (plain data held to the engine's one depth, every own member read once,
|
|
306
|
-
* lists of names, no `__proto__`), then the copy must be a record of names. A refusal
|
|
307
|
-
* reading stopped
|
|
331
|
+
* lists of names, no `__proto__`), then the copy must be a record of names. A refusal points at the tool (or skill) and the member where
|
|
332
|
+
* reading stopped in the engine's words — the declaration's member names (`words`), a list index — and shows the caller's own keys and
|
|
333
|
+
* values in the one caller's-text shape ({@link callerText}). `unit` is what the keys are called (`tool` / `skill`).
|
|
308
334
|
*/
|
|
309
|
-
export declare function receivePerToolDeclaration(declared: unknown, field: PerToolDeclaration, unit: string): PerToolDeclarationRead;
|
|
310
|
-
/** The sentence for one tool's (or skill's) declaration that does not fit: `detail` says which member and why.
|
|
335
|
+
export declare function receivePerToolDeclaration(declared: unknown, field: PerToolDeclaration, unit: string, words: ReadonlySet<string>): PerToolDeclarationRead;
|
|
336
|
+
/** The sentence for one tool's (or skill's) declaration that does not fit: `detail` says which member and why. The tool's name is the
|
|
337
|
+
* caller's text ({@link callerText}). */
|
|
311
338
|
export declare function perToolEntryRefusal(field: PerToolDeclaration, unit: string, key: string, detail: string): string;
|
|
339
|
+
/** The member names of one tool's axes ({@link TOOL_AXIS_MEMBERS}): the words a `toolAxes` refusal's member path spells. */
|
|
340
|
+
export declare const TOOL_AXIS_WORDS: ReadonlySet<string>;
|
|
312
341
|
/** The sentence for a per-tool declaration that names a tool (or skill) with an empty name. */
|
|
313
342
|
export declare function perToolEmptyName(field: PerToolDeclaration, unit: string): string;
|
|
314
343
|
/**
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { SAFETY_AXIS_VOCABULARY } from "./safety-axis-vocab.js";
|
|
2
2
|
import { INLINE_TRUNCATION_MARK, inlineUntrusted } from "./untrusted-text.js";
|
|
3
|
+
import { REDACTION_MARK } from "./redaction-marks.js";
|
|
3
4
|
import { DECLARATION_RECEIPT_MODE } from "./own-property-receipt.js";
|
|
4
5
|
import { isPlainRecord, receive } from "./mods/kernel/receive.js";
|
|
5
6
|
import { MODS_VALUE_DEPTH } from "./mods/kernel/site-rules.js";
|
|
7
|
+
export const MCP_TRANSPORT_KINDS = Object.freeze(["stdio", "http", "host"]);
|
|
8
|
+
const transportKindsLockstep = true;
|
|
9
|
+
void transportKindsLockstep;
|
|
10
|
+
export function transportKindOf(spec) {
|
|
11
|
+
try {
|
|
12
|
+
const transport = spec.transport;
|
|
13
|
+
const kind = (typeof transport === "object" && transport !== null) || typeof transport === "function" ? Reflect.get(transport, "kind") : undefined;
|
|
14
|
+
return MCP_TRANSPORT_KINDS.find((known) => known === kind);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
6
20
|
const TOOL_AXES_SURFACES = {
|
|
7
21
|
mcp: { key: "tool", declarer: "MCP server" },
|
|
8
22
|
a2a: { key: "skill", declarer: "A2A peer" },
|
|
@@ -27,25 +41,44 @@ const irreversibilityPolesLockstep = true;
|
|
|
27
41
|
void irreversibilityPolesLockstep;
|
|
28
42
|
const toolAxesDeclarationsAreOne = true;
|
|
29
43
|
void toolAxesDeclarationsAreOne;
|
|
30
|
-
export function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function memberNames(path) {
|
|
41
|
-
let rendered = "";
|
|
42
|
-
for (const [index, name] of path.entries()) {
|
|
43
|
-
if (rendered.length > 120)
|
|
44
|
+
export function callerText(value) {
|
|
45
|
+
if (typeof value !== "string")
|
|
46
|
+
return dataKind(value);
|
|
47
|
+
const length = [...value].length;
|
|
48
|
+
return `${REDACTION_MARK} (${length} character${length === 1 ? "" : "s"})`;
|
|
49
|
+
}
|
|
50
|
+
export function declarationPath(path, words, base = "") {
|
|
51
|
+
let rendered = base;
|
|
52
|
+
for (const key of path) {
|
|
53
|
+
if (rendered.length > 120 + base.length)
|
|
44
54
|
return `${rendered}${INLINE_TRUNCATION_MARK}`;
|
|
45
|
-
|
|
55
|
+
const name = typeof key === "number" ? `[${key}]` : words.has(key) ? key : callerText(key);
|
|
56
|
+
rendered += typeof key === "number" || rendered === "" ? name : `.${name}`;
|
|
46
57
|
}
|
|
47
58
|
return rendered;
|
|
48
59
|
}
|
|
60
|
+
const DECLARATION_ENTRY_MEMBERS = {
|
|
61
|
+
name: true,
|
|
62
|
+
source: true,
|
|
63
|
+
transport: true,
|
|
64
|
+
allowTools: true,
|
|
65
|
+
elicitation: true,
|
|
66
|
+
toolAxes: true,
|
|
67
|
+
toolFaces: true,
|
|
68
|
+
contentOrigin: true,
|
|
69
|
+
fingerprint: true,
|
|
70
|
+
startupTimeoutMs: true,
|
|
71
|
+
sessionMetaKey: true,
|
|
72
|
+
kind: true,
|
|
73
|
+
command: true,
|
|
74
|
+
args: true,
|
|
75
|
+
url: true,
|
|
76
|
+
credentials: true,
|
|
77
|
+
principalHeader: true,
|
|
78
|
+
cardUrl: true,
|
|
79
|
+
allowSkills: true,
|
|
80
|
+
};
|
|
81
|
+
export const DECLARATION_ENTRY_WORDS = new Set(Object.keys(DECLARATION_ENTRY_MEMBERS));
|
|
49
82
|
export function dataKind(value) {
|
|
50
83
|
return value === null ? "null" : value === undefined ? "undefined" : Array.isArray(value) ? "an array" : typeof value === "object" ? "a record" : `a ${typeof value}`;
|
|
51
84
|
}
|
|
@@ -162,12 +195,12 @@ function readToolAxisEntry(raw) {
|
|
|
162
195
|
const listed = Object.keys(raw);
|
|
163
196
|
const unknown = listed.find((member) => !TOOL_AXIS_MEMBER_NAMES.includes(member));
|
|
164
197
|
if (unknown !== undefined)
|
|
165
|
-
return `unknown member ${
|
|
198
|
+
return `an unknown member ${callerText(unknown)} (the members are ${TOOL_AXIS_MEMBER_NAMES.join(", ")})`;
|
|
166
199
|
const declared = Object.create(null);
|
|
167
200
|
for (const member of TOOL_AXIS_MEMBER_NAMES) {
|
|
168
201
|
const value = raw[member];
|
|
169
202
|
if (value !== undefined && !listed.includes(member))
|
|
170
|
-
return `member ${
|
|
203
|
+
return `member "${member}" is a hidden member: its name answers a value the declaration does not list as its own`;
|
|
171
204
|
declared[member] = value;
|
|
172
205
|
}
|
|
173
206
|
const { effect, egress, irreversibility, boundaryFlow } = declared;
|
|
@@ -192,13 +225,13 @@ const PER_TOOL_DECLARATIONS = {
|
|
|
192
225
|
toolAxes: { plural: "axes", singular: "axis" },
|
|
193
226
|
toolFaces: { plural: "faces", singular: "face" },
|
|
194
227
|
};
|
|
195
|
-
export function receivePerToolDeclaration(declared, field, unit) {
|
|
228
|
+
export function receivePerToolDeclaration(declared, field, unit, words) {
|
|
196
229
|
const received = receiveDeclaration(declared, NO_DECLARATION_PATH_RULES);
|
|
197
230
|
if (!received.ok) {
|
|
198
231
|
const [key, ...member] = received.fault.path;
|
|
199
232
|
if (key === undefined)
|
|
200
233
|
return { ok: false, problem: `${field} cannot be read: ${received.fault.problem}` };
|
|
201
|
-
const where = member.length > 0 ? `member ${
|
|
234
|
+
const where = member.length > 0 ? `member ${declarationPath(member, words)}: ` : "";
|
|
202
235
|
return { ok: false, problem: perToolEntryRefusal(field, unit, String(key), `${where}${received.fault.problem}`) };
|
|
203
236
|
}
|
|
204
237
|
const perTool = received.value;
|
|
@@ -207,8 +240,9 @@ export function receivePerToolDeclaration(declared, field, unit) {
|
|
|
207
240
|
return { ok: true, perTool };
|
|
208
241
|
}
|
|
209
242
|
export function perToolEntryRefusal(field, unit, key, detail) {
|
|
210
|
-
return `the ${PER_TOOL_DECLARATIONS[field].plural} declared for ${unit} ${
|
|
243
|
+
return `the ${PER_TOOL_DECLARATIONS[field].plural} declared for the ${unit} ${callerText(key)} do not fit: ${detail}`;
|
|
211
244
|
}
|
|
245
|
+
export const TOOL_AXIS_WORDS = new Set(TOOL_AXIS_MEMBER_NAMES);
|
|
212
246
|
export function perToolEmptyName(field, unit) {
|
|
213
247
|
return `${field} has an empty ${unit} name`;
|
|
214
248
|
}
|
|
@@ -216,7 +250,7 @@ export function readToolAxes(declared, at) {
|
|
|
216
250
|
const unit = toolAxesSurfaceOf(at).key;
|
|
217
251
|
if (declared === undefined)
|
|
218
252
|
return { ok: true };
|
|
219
|
-
const received = receivePerToolDeclaration(declared, "toolAxes", unit);
|
|
253
|
+
const received = receivePerToolDeclaration(declared, "toolAxes", unit, TOOL_AXIS_WORDS);
|
|
220
254
|
if (!received.ok)
|
|
221
255
|
return { ok: false, problem: received.problem };
|
|
222
256
|
const entries = [];
|
package/dist/core/mcp.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { type CredentialEchoSite } from "./credential-echo.js";
|
|
1
2
|
import { type PeerSeat } from "./peer-seat.js";
|
|
2
3
|
import { type McpInstructionsEntry, type PromptSectionDisposer } from "./prompt-section-seat.js";
|
|
3
4
|
import { McpConnectionPool } from "./mcp-connection-pool.js";
|
|
4
|
-
import { type McpDelivered, type McpFailureKind, type McpServerLiveness } from "./mcp-failure.js";
|
|
5
|
+
import { type McpAuthorization, type McpDelivered, type McpFailureKind, type McpServerLiveness } from "./mcp-failure.js";
|
|
5
6
|
import type { AgentTool } from "../internal/harness-types.js";
|
|
6
7
|
import type { ImageContent, TextContent } from "../internal/llm.js";
|
|
7
|
-
import { type
|
|
8
|
+
import { type ImageDownsampler } from "./image-downsample.js";
|
|
8
9
|
import type { McpServerSpec, OnElicit, ToolEffect } from "./types.js";
|
|
9
|
-
import type
|
|
10
|
+
import { type McpRevocationLedger } from "./mcp-server-spec.js";
|
|
11
|
+
import { type McpHostSeat } from "./mcp-host-seat.js";
|
|
10
12
|
import { type HostFloor } from "./host-floor.js";
|
|
11
13
|
import { type ReminderDisclosureCounts } from "./reminder-disclosure.js";
|
|
12
14
|
import { type McpLegMetaReader } from "./mcp-call-meta.js";
|
|
@@ -312,8 +314,8 @@ export interface McpReconnectResult {
|
|
|
312
314
|
* what the run handle's verb forwards to `onError(phase:"mcp")`. One production, two drains. */
|
|
313
315
|
warnings?: string[];
|
|
314
316
|
/** The NEW connect-time status record (also swapped into {@link MaterializedMcp.statuses}), present
|
|
315
|
-
* whenever the dial was attempted: a consumer keys its next action off `errorCode` / `
|
|
316
|
-
* (
|
|
317
|
+
* whenever the dial was attempted: a consumer keys its next action off `errorCode` / `authorization`
|
|
318
|
+
* (an `unauthorized` is the user's authorization door, a `spawn_failed` a missing binary), not off {@link reason}. */
|
|
317
319
|
status?: McpServerStatus;
|
|
318
320
|
/** The re-dial's own `tools/list` walk did not finish — {@link McpRefreshResult.listingIncomplete}
|
|
319
321
|
* minus the retention arm: a re-dial has no previous listing on this connection to retain from. */
|
|
@@ -334,13 +336,16 @@ export interface McpServerStatus {
|
|
|
334
336
|
};
|
|
335
337
|
toolNames?: string[];
|
|
336
338
|
error?: string;
|
|
337
|
-
/** Present iff `status === "failed"` — the connect-time failure record, spread flat
|
|
338
|
-
* as `errorCode`, {@link McpFailure.delivered} as `delivered`,
|
|
339
|
-
* `
|
|
339
|
+
/** Present iff `status === "failed"` — the connect-time failure record, spread flat ({@link import("./mcp-failure.js").failureFields}):
|
|
340
|
+
* {@link McpFailure.kind} as `errorCode`, {@link McpFailure.delivered} as `delivered`, `httpStatus` when the kind is `http_status`,
|
|
341
|
+
* `authorization` when it is `unauthorized`. A consumer keys an action off THESE (an `unauthorized` is the user's authorization door,
|
|
340
342
|
* a `spawn_failed` is a missing binary) instead of parsing the neutralized `error` text. */
|
|
341
343
|
errorCode?: McpFailureKind;
|
|
342
344
|
delivered?: McpDelivered;
|
|
343
345
|
httpStatus?: number;
|
|
346
|
+
/** {@link McpFailure.authorization}: why the principal must authorize this server and where — present iff `errorCode === "unauthorized"`.
|
|
347
|
+
* `authorizeUrl` is the deployment seat's (TRUSTED); `resourceMetadataUrl` is the endpoint's own claim (UNTRUSTED, like `error`). */
|
|
348
|
+
authorization?: McpAuthorization;
|
|
344
349
|
/**
|
|
345
350
|
* Set to `true` once core OBSERVES this server's transport close during the task; absent
|
|
346
351
|
* otherwise (never `false`: absence means "no close was observed", which is not the same as "alive").
|
|
@@ -500,7 +505,14 @@ interface McpContentItem {
|
|
|
500
505
|
blob?: string;
|
|
501
506
|
};
|
|
502
507
|
}
|
|
503
|
-
|
|
508
|
+
/**
|
|
509
|
+
* Exported for unit testing (not part of the public package index). ASYNC since design/116 W5: an oversized
|
|
510
|
+
* image and any audio/binary blob are now spilled to disk (see {@link blobToTextBlock} /
|
|
511
|
+
* {@link boundedImageBlock}) instead of being inlined or dropped. `serverName` (when known) attributes the
|
|
512
|
+
* spilled files + labels, mirroring CC's `transformResultContent(resultContent, serverName)`. `imageProcessor` is the run's
|
|
513
|
+
* one processor seat (`RunnerDeps.imageProcessor`), read through `resolveImageProcessor`.
|
|
514
|
+
*/
|
|
515
|
+
export declare function mapContent(content: Array<McpContentItem>, serverName?: string, imageProcessor?: ImageDownsampler | false): Promise<Array<TextContent | ImageContent>>;
|
|
504
516
|
/**
|
|
505
517
|
* Connect to each MCP server, list its tools, and wrap them as AgentTools.
|
|
506
518
|
* Tools are namespaced `mcp__<server>__<tool>` (CC parity) to avoid collisions. The model sees each
|
|
@@ -597,7 +609,7 @@ export declare function normalizeMcpToolSchema(schema: unknown): McpSchemaNormal
|
|
|
597
609
|
*/
|
|
598
610
|
export declare function mcpToolSchemaAdvisory(schema: unknown): string | undefined;
|
|
599
611
|
export declare function mcpToolSchemaProblem(schema: unknown): string | undefined;
|
|
600
|
-
export declare function materializeMcpTools(specs: McpServerSpec[], principal?: string, onElicit?: OnElicit,
|
|
612
|
+
export declare function materializeMcpTools(specs: McpServerSpec[], principal?: string, onElicit?: OnElicit, imageProcessor?: ImageDownsampler | false, // the one image processor seat (`RunnerDeps.imageProcessor`): a processor, `false` (none), absent = auto-detected sharp
|
|
601
613
|
reminderDisclosure?: {
|
|
602
614
|
reminderMark?: string;
|
|
603
615
|
counts?: ReminderDisclosureCounts;
|
|
@@ -606,10 +618,13 @@ reminderDisclosure?: {
|
|
|
606
618
|
}, poolOpts?: {
|
|
607
619
|
pool: McpConnectionPool;
|
|
608
620
|
ownsPool?: boolean;
|
|
609
|
-
}, promptSections?: PromptSectionDisposer, dialable?: (spec: McpServerSpec) => boolean, signal?: AbortSignal, hostFloor?: HostFloor, peerSeat?: PeerSeat):
|
|
621
|
+
}, promptSections?: PromptSectionDisposer, dialable?: (spec: McpServerSpec) => boolean, signal?: AbortSignal, hostFloor?: HostFloor, peerSeat?: PeerSeat, // `RunnerDeps.peerSeat` (peer-seat.ts): what each request carries; absent ⇒ nothing, and a declared `credentials` refuses that dial
|
|
622
|
+
onAuthorizationRequired?: (server: string, authorization: McpAuthorization) => void, // once per server: what a refusal owes the user (the runner's notice)
|
|
623
|
+
hostSeats?: ReadonlyMap<string, McpHostSeat>, // the leg's host seats by declaration name (mcp-host-seat.ts): a `{ kind: "host" }` server dials through its seat; absent ⇒ such a server is refused at its dial
|
|
624
|
+
onCredentialEchoed?: (server: string, where: CredentialEchoSite) => void): Promise<MaterializedMcp>;
|
|
610
625
|
/** The runner's materialization of one leg (not index-exported): every minted tool's `tools/call` reads the leg's request-meta seat
|
|
611
626
|
* (`mcp-call-meta.ts`) — the request meta's only source, written only by the `tool.call` station with what its judge passed. */
|
|
612
|
-
export declare function materializeLegMcpTools(seat: McpLegMetaReader | undefined, ...[specs, principal, onElicit,
|
|
627
|
+
export declare function materializeLegMcpTools(seat: McpLegMetaReader | undefined, ...[specs, principal, onElicit, imageProcessor, reminderDisclosure, mcpRevocations, poolOpts, promptSections, dialable, signal, hostFloor, peerSeat, onAuthorizationRequired, hostSeats, onCredentialEchoed]: Parameters<typeof materializeMcpTools>): Promise<MaterializedMcp>;
|
|
613
628
|
/**
|
|
614
629
|
* Fold the caller's AUTHORITATIVE per-tool override (design F: caller = trust root) over the server-hint axis.
|
|
615
630
|
* Unlike server hints, the caller may RAISE or LOWER any axis: `effect` sets the repeat-safety class (lower to
|