@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
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { DECLARATION_PATH_RULES, declarationFaultOf, declarerWord, readToolAxes, receiveDeclaration, toolAxesRefusal } from "./mcp-server-spec.js";
|
|
3
|
+
import { isPlainRecord, receive } from "./mods/kernel/receive.js";
|
|
4
|
+
import { CONFIG_RECEIPT_MODE } from "./own-property-receipt.js";
|
|
2
5
|
import { isToolContentOrigin, TOOL_CONTENT_ORIGINS } from "./memory-engine/content-origin.js";
|
|
3
6
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
4
7
|
import { assertNoRetiredToolPolicyKeys } from "./retired-keys.js";
|
|
@@ -8,6 +11,7 @@ export const LOCKED_KEY_REGISTRY = {
|
|
|
8
11
|
compliancePosture: { specFields: [] },
|
|
9
12
|
retentionPolicy: { specFields: [] },
|
|
10
13
|
};
|
|
14
|
+
export const ENTER_AS_IS = (_seat, door) => door();
|
|
11
15
|
function codedError(code, message) {
|
|
12
16
|
const e = new Error(message);
|
|
13
17
|
e.code = code;
|
|
@@ -17,21 +21,74 @@ export function resolveLockedKeys(config) {
|
|
|
17
21
|
if (config === undefined)
|
|
18
22
|
return new Set();
|
|
19
23
|
const keys = new Set();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const listed = declaredLockKeys(config);
|
|
25
|
+
for (let index = 0; index < listed.length; index++) {
|
|
26
|
+
const key = listed[index];
|
|
27
|
+
if (!Object.hasOwn(LOCKED_KEY_REGISTRY, key)) {
|
|
28
|
+
throw lockDeclarationRefusal(`RunnerDeps.lockedConfig.keys[${index}]`, `is ${inlineUntrusted(JSON.stringify(key), 80)}, which is not a member of the locked-key registry (${Object.keys(LOCKED_KEY_REGISTRY).join(", ")})`);
|
|
25
29
|
}
|
|
26
30
|
keys.add(key);
|
|
27
31
|
}
|
|
28
32
|
return keys;
|
|
29
33
|
}
|
|
34
|
+
function declaredLockKeys(config) {
|
|
35
|
+
const received = receiveDeclaration(config);
|
|
36
|
+
if (!received.ok)
|
|
37
|
+
throw lockDeclarationRefusal(memberPath(received.fault.path, "RunnerDeps.lockedConfig"), `cannot be read: ${received.fault.problem}`);
|
|
38
|
+
const copy = received.value;
|
|
39
|
+
if (!isPlainRecord(copy))
|
|
40
|
+
throw lockDeclarationRefusal("RunnerDeps.lockedConfig", `is ${inlineUntrusted(describeDeclared(copy), 80)}, not an object with a \`keys\` list`);
|
|
41
|
+
const keys = Object.hasOwn(copy, "keys") ? copy["keys"] : undefined;
|
|
42
|
+
if (!Array.isArray(keys))
|
|
43
|
+
throw lockDeclarationRefusal("RunnerDeps.lockedConfig.keys", `is ${inlineUntrusted(describeDeclared(keys), 80)}, not a list of locked keys`);
|
|
44
|
+
return keys;
|
|
45
|
+
}
|
|
46
|
+
function lockDeclarationRefusal(member, problem) {
|
|
47
|
+
return codedError("config.locked_registry", `${member} ${problem}. A lock that does not parse must not half-arm — fix the deployment's lock declaration.`);
|
|
48
|
+
}
|
|
30
49
|
export function snapshotMcpEntries(entries) {
|
|
31
|
-
return entries.map((entry) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
return entries.map((entry) => snapshotDeclaredEntry(entry, "mcp"));
|
|
51
|
+
}
|
|
52
|
+
function memberPath(path, base = "") {
|
|
53
|
+
let rendered = base;
|
|
54
|
+
for (const key of path) {
|
|
55
|
+
const name = typeof key === "string" && /^\d+$/.test(key) ? JSON.stringify(key) : String(key);
|
|
56
|
+
rendered += typeof key === "number" ? `[${key}]` : rendered === "" ? name : `.${name}`;
|
|
57
|
+
if (rendered.length > 120 + base.length)
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return rendered;
|
|
61
|
+
}
|
|
62
|
+
function unreadableDeclaration(at, declarer, member, problem) {
|
|
63
|
+
const refusal = codedError("config.invalid_argument", `${declarerWord(at)}${declarer === undefined ? "" : ` ${declarerNameOf(declarer)}`} declares ${inlineUntrusted(member, 80)} the engine cannot read: ${problem}. A declaration the engine cannot read is refused ` +
|
|
64
|
+
`rather than partly applied — what the caller wrote and what the engine runs on would otherwise differ without anyone being told.`);
|
|
65
|
+
if (declarer !== undefined)
|
|
66
|
+
Object.defineProperty(refusal, "declarer", { value: declarer, enumerable: true, writable: false, configurable: false });
|
|
67
|
+
return refusal;
|
|
68
|
+
}
|
|
69
|
+
function ownDataString(holder, key) {
|
|
70
|
+
const slot = Object.getOwnPropertyDescriptor(holder, key);
|
|
71
|
+
const value = slot !== undefined && Object.hasOwn(slot, "value") ? slot.value : undefined;
|
|
72
|
+
return typeof value === "string" ? value : undefined;
|
|
73
|
+
}
|
|
74
|
+
export function refusedDeclarer(refusal) {
|
|
75
|
+
return typeof refusal === "object" && refusal !== null && !types.isProxy(refusal) ? ownDataString(refusal, "declarer") : undefined;
|
|
76
|
+
}
|
|
77
|
+
function capturedName(entry) {
|
|
78
|
+
return typeof entry === "object" && entry !== null && !types.isProxy(entry) ? ownDataString(entry, "name") : undefined;
|
|
79
|
+
}
|
|
80
|
+
function entryFaultRefusal(at, declarer, path, problem) {
|
|
81
|
+
return unreadableDeclaration(at, declarer, path.length === 0 ? "an entry" : memberPath(path), problem);
|
|
82
|
+
}
|
|
83
|
+
export function snapshotDeclaredEntry(entry, at) {
|
|
84
|
+
const declared = entry;
|
|
85
|
+
const declarer = capturedName(declared);
|
|
86
|
+
const received = receiveDeclaration(declared, DECLARATION_PATH_RULES[at]);
|
|
87
|
+
if (!received.ok)
|
|
88
|
+
throw entryFaultRefusal(at, declarer, received.fault.path, received.fault.problem);
|
|
89
|
+
if (!isPlainRecord(received.value))
|
|
90
|
+
throw unreadableDeclaration(at, declarer, "an entry", `it is ${inlineUntrusted(describeDeclared(received.value), 80)}, not an object`);
|
|
91
|
+
return received.value;
|
|
35
92
|
}
|
|
36
93
|
function describeDeclared(value) {
|
|
37
94
|
try {
|
|
@@ -46,58 +103,91 @@ function describeDeclared(value) {
|
|
|
46
103
|
}
|
|
47
104
|
}
|
|
48
105
|
}
|
|
49
|
-
const
|
|
50
|
-
export function judgeEntryToolAxes(copy) {
|
|
106
|
+
const declarerNameOf = (name) => inlineUntrusted(typeof name === "string" ? JSON.stringify(name) : describeDeclared(name), 80);
|
|
107
|
+
export function judgeEntryToolAxes(copy, at) {
|
|
51
108
|
const { toolAxes: declaredAxes, ...rest } = copy;
|
|
52
|
-
const axes =
|
|
53
|
-
if (!axes.ok)
|
|
54
|
-
return {
|
|
55
|
-
ok: false,
|
|
56
|
-
error: codedError("config.invalid_argument", `MCP server ${serverNameOf(copy)} declares toolAxes the engine cannot read: ${inlineUntrusted(axes.problem, 240)}. A per-tool safety-axis declaration is the ` +
|
|
57
|
-
`caller's trust root for the approval gate, so it is refused rather than partly applied — dropping one key or defaulting one word ` +
|
|
58
|
-
`would leave a declaration that reads as in force while it is not.`),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
109
|
+
const axes = readToolAxes(declaredAxes, at);
|
|
110
|
+
if (!axes.ok)
|
|
111
|
+
return { ok: false, error: toolAxesRefusal(at, declarerNameOf(copy.name), axes.problem) };
|
|
61
112
|
if (axes.toolAxes !== undefined) {
|
|
62
113
|
for (const perTool of Object.values(axes.toolAxes))
|
|
63
114
|
Object.freeze(perTool);
|
|
64
115
|
Object.freeze(axes.toolAxes);
|
|
65
116
|
}
|
|
66
|
-
return { ok: true, entry: Object.freeze(axes.toolAxes === undefined ? rest : { ...rest, toolAxes: axes.toolAxes }) };
|
|
117
|
+
return { ok: true, entry: Object.freeze((axes.toolAxes === undefined ? rest : { ...rest, toolAxes: axes.toolAxes })) };
|
|
118
|
+
}
|
|
119
|
+
function declaredEntriesOf(declared, at) {
|
|
120
|
+
const field = at;
|
|
121
|
+
const received = receive(declared, CONFIG_RECEIPT_MODE);
|
|
122
|
+
let problem;
|
|
123
|
+
if (received.ok) {
|
|
124
|
+
const list = received.value;
|
|
125
|
+
if (Array.isArray(list) && list !== declared)
|
|
126
|
+
return Array.from({ length: list.length }, (_, index) => list[index]);
|
|
127
|
+
problem = typeof list === "object" && list !== null ? "it is not an array" : `it is ${inlineUntrusted(describeDeclared(list), 80)}`;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const fault = declarationFaultOf(received.fault);
|
|
131
|
+
if (fault.path.length > 0)
|
|
132
|
+
throw unreadableDeclaration(at, undefined, "an entry", fault.problem);
|
|
133
|
+
problem = fault.problem;
|
|
134
|
+
}
|
|
135
|
+
throw codedError("config.invalid_argument", `TaskSpec.${field} must be a readable array of ${declarerWord(at)} declarations; ${problem}. A list the engine cannot read ` +
|
|
136
|
+
`is refused rather than read as "no entries" — the declared ${declarerWord(at)}s would otherwise be dropped without anyone being told.`);
|
|
67
137
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
138
|
+
function snapshotAndValidateA2aEntries(declared) {
|
|
139
|
+
const entries = declaredEntriesOf(declared, "a2a");
|
|
140
|
+
if (entries.length === 0)
|
|
141
|
+
return undefined;
|
|
142
|
+
return entries.map((entry) => {
|
|
143
|
+
const judged = judgeEntryToolAxes(snapshotDeclaredEntry(entry, "a2a"), "a2a");
|
|
144
|
+
if (!judged.ok)
|
|
145
|
+
throw judged.error;
|
|
146
|
+
return judged.entry;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function snapshotAndValidateMcpEntries(declared) {
|
|
150
|
+
return snapshotMcpEntries(declaredEntriesOf(declared, "mcp")).map((copy) => {
|
|
70
151
|
const declared = copy.contentOrigin;
|
|
71
152
|
if (declared !== undefined && !isToolContentOrigin(declared)) {
|
|
72
|
-
throw codedError("config.mcp_content_class", `MCP server ${
|
|
153
|
+
throw codedError("config.mcp_content_class", `MCP server ${declarerNameOf(copy.name)} declares contentOrigin ` +
|
|
73
154
|
`${inlineUntrusted(describeDeclared(declared), 80)}, which is not one of ` +
|
|
74
155
|
`${TOOL_CONTENT_ORIGINS.map((v) => `"${v}"`).join(" | ")}. The declaration decides whether this server's tools ` +
|
|
75
156
|
`mark the session's memory externally exposed — a value this engine cannot read is refused at the door rather ` +
|
|
76
157
|
`than folded to a class, because folding it would let a deployment believe a declaration is in force while every ` +
|
|
77
158
|
`call keeps writing a one-way durable mark.`);
|
|
78
159
|
}
|
|
79
|
-
const judged = judgeEntryToolAxes(copy);
|
|
160
|
+
const judged = judgeEntryToolAxes(copy, "mcp");
|
|
80
161
|
if (!judged.ok)
|
|
81
162
|
throw judged.error;
|
|
82
163
|
return judged.entry;
|
|
83
164
|
});
|
|
84
165
|
}
|
|
85
|
-
export function preflightLockedConfig(spec, deps) {
|
|
86
|
-
const lockedKeys = resolveLockedKeys(deps.lockedConfig);
|
|
87
|
-
|
|
88
|
-
for (const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
166
|
+
export function preflightLockedConfig(spec, deps, enter = ENTER_AS_IS) {
|
|
167
|
+
const lockedKeys = enter("deps", () => resolveLockedKeys(deps.lockedConfig));
|
|
168
|
+
enter("taskConfig", () => {
|
|
169
|
+
for (const key of lockedKeys) {
|
|
170
|
+
for (const field of LOCKED_KEY_REGISTRY[key].specFields) {
|
|
171
|
+
if (spec[field] !== undefined) {
|
|
172
|
+
throw codedError("config.locked_key", `TaskSpec.${field} is administratively locked by this deployment (locked key "${key}") — ` +
|
|
173
|
+
`the task-supplied value is refused wholesale (locks are config-time; there is no request-time ` +
|
|
174
|
+
`unlock). Remove the field from the task, or change the deployment's lock configuration.`);
|
|
175
|
+
}
|
|
93
176
|
}
|
|
94
177
|
}
|
|
95
|
-
}
|
|
96
|
-
const
|
|
97
|
-
|
|
178
|
+
});
|
|
179
|
+
const toolPolicyLocked = lockedKeys.has("toolPolicy");
|
|
180
|
+
const task = toolPolicyLocked ? {} : { toolPolicy: spec.toolPolicy, basePolicyForResumeEdit: spec.basePolicyForResumeEdit };
|
|
181
|
+
const policies = callerPolicySeats(task, deps, toolPolicyLocked);
|
|
182
|
+
enter(!toolPolicyLocked && task.toolPolicy != null ? "taskConfig" : "deps", () => assertNoRetiredToolPolicyKeys(policies.toolPolicy));
|
|
183
|
+
enter(!toolPolicyLocked && task.basePolicyForResumeEdit != null ? "taskConfig" : "deps", () => assertNoRetiredToolPolicyKeys(policies.basePolicyForResumeEdit));
|
|
184
|
+
const declaredServers = lockedKeys.has("mcp") ? undefined : spec.mcp;
|
|
185
|
+
const mcp = declaredServers === undefined ? undefined : enter("taskConfig", () => snapshotAndValidateMcpEntries(declaredServers));
|
|
186
|
+
const declaredPeers = spec.a2a;
|
|
98
187
|
return {
|
|
99
188
|
lockedKeys,
|
|
100
|
-
mcp
|
|
189
|
+
mcp,
|
|
190
|
+
a2a: declaredPeers === undefined ? undefined : enter("taskConfig", () => snapshotAndValidateA2aEntries(declaredPeers)),
|
|
101
191
|
...policies,
|
|
102
192
|
};
|
|
103
193
|
}
|
|
@@ -107,7 +197,3 @@ export function callerPolicySeats(spec, deps, toolPolicyLocked) {
|
|
|
107
197
|
basePolicyForResumeEdit: toolPolicyLocked ? deps.basePolicyForResumeEdit : (spec.basePolicyForResumeEdit ?? deps.basePolicyForResumeEdit),
|
|
108
198
|
};
|
|
109
199
|
}
|
|
110
|
-
export function assertCallerPoliciesCurrent(policies) {
|
|
111
|
-
assertNoRetiredToolPolicyKeys(policies.toolPolicy);
|
|
112
|
-
assertNoRetiredToolPolicyKeys(policies.basePolicyForResumeEdit);
|
|
113
|
-
}
|
|
@@ -56,8 +56,11 @@ export declare class McpConnectionPool {
|
|
|
56
56
|
* transport object that answers differently to two readers cannot split the dial from its key); every other transport member is read here.
|
|
57
57
|
* The declaration's mount identity (`fingerprint`) is part of the key when declared: the revocation probe is asked with it, so two mounts the
|
|
58
58
|
* host tells apart never share one connection (an undeclared fingerprint leaves the key as it always was).
|
|
59
|
+
* So is the startup bound the dial runs under (`startupMs`, the dial's one reading of {@link mcpStartupTimeoutMs}, threaded like `kind`):
|
|
60
|
+
* a connection is dialled under the declaration of the mount that dials it, so a mount never waits on, or shares, a dial bounded by
|
|
61
|
+
* another mount's clock. No bound in force (none declared, no environment seat) leaves the key as it always was.
|
|
59
62
|
*/
|
|
60
|
-
static keyOf(spec: McpServerSpec, principal: string | undefined, kind: string | undefined): string;
|
|
63
|
+
static keyOf(spec: McpServerSpec, principal: string | undefined, kind: string | undefined, startupMs: number | undefined): string;
|
|
61
64
|
/**
|
|
62
65
|
* Lease the connection for `key`, dialling it with `dial` when none is live. `fresh` replaces the pool's current connection with a new
|
|
63
66
|
* dial (a re-dial): the connection it replaces lives on until its other holders release it. Resolves `undefined` once the pool is
|
|
@@ -4,10 +4,15 @@ export class McpConnectionPool {
|
|
|
4
4
|
dialing = new Map();
|
|
5
5
|
generation = new Map();
|
|
6
6
|
shut = false;
|
|
7
|
-
static keyOf(spec, principal, kind) {
|
|
7
|
+
static keyOf(spec, principal, kind, startupMs) {
|
|
8
8
|
const rest = Object.fromEntries(Object.keys(spec.transport).filter((k) => k !== "kind").map((k) => [k, Reflect.get(spec.transport, k)]));
|
|
9
9
|
const fingerprint = spec.fingerprint;
|
|
10
|
-
|
|
10
|
+
const identity = [spec.name, kind ?? null, rest, principal ?? null];
|
|
11
|
+
if (fingerprint !== undefined)
|
|
12
|
+
identity.push(fingerprint);
|
|
13
|
+
if (startupMs !== undefined)
|
|
14
|
+
identity.push({ startupTimeoutMs: startupMs });
|
|
15
|
+
return canonicalize(identity);
|
|
11
16
|
}
|
|
12
17
|
async acquire(key, dial, opts) {
|
|
13
18
|
if (this.shut)
|
package/dist/core/mcp-probe.d.ts
CHANGED
|
@@ -38,15 +38,17 @@ export interface McpProbeOptions {
|
|
|
38
38
|
* on a real leg — so a server that applies per-user rules answers the probe as it would answer the
|
|
39
39
|
* task. */
|
|
40
40
|
principal?: string;
|
|
41
|
-
/**
|
|
42
|
-
* every env-supplied MCP bound keeps, because a larger delay is silently rewritten to 1 ms).
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
41
|
+
/** An OVERALL ceiling on the VERDICT for each server, in whole milliseconds within `[1, MCP_ENV_MS_MAX]` (the
|
|
42
|
+
* ceiling every env-supplied MCP bound keeps, because a larger delay is silently rewritten to 1 ms). The
|
|
43
|
+
* caller's own choice, and it lives BESIDE the per-phase startup bounds the dial runs under — whichever
|
|
44
|
+
* arrives first decides. When it elapses, THAT server's row reads `failed` with `errorCode: "timeout"` and
|
|
45
|
+
* the walk moves on; nothing throws. It does NOT end the dial — nothing here can — so the transport stays
|
|
46
|
+
* open until the dial lands on its own; see the residue note on {@link probeMcpServers}.
|
|
46
47
|
*
|
|
47
|
-
* Default:
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* Default: none. The probe has no clock of its own: it dials through the entrance a task does, so each
|
|
49
|
+
* startup phase (the handshake, then the initial listing) carries that server's own bound from the one
|
|
50
|
+
* reader ({@link import("./mcp.js").mcpStartupTimeoutMs}: its `startupTimeoutMs`, else env `MCP_TIMEOUT`, else
|
|
51
|
+
* the SDK's 60 000 ms) — exactly what a task allows it. */
|
|
50
52
|
timeoutMs?: number;
|
|
51
53
|
/** Abort the whole probe. The call rejects with the signal's own reason (a bare `abort()` gives an
|
|
52
54
|
* `AbortError`) AFTER every server it had opened is closed — see the residue contract on
|
|
@@ -102,7 +104,8 @@ export interface McpProbeOptions {
|
|
|
102
104
|
* return, and NOT that the call itself is bounded. What bounds it, stated part by part rather than
|
|
103
105
|
* summarised into a number that would be wrong:
|
|
104
106
|
* · a dial has two REQUEST-BUDGET phases, each carrying the startup-phase bound ({@link
|
|
105
|
-
* mcpStartupTimeoutMs}
|
|
107
|
+
* import("./mcp.js").mcpStartupTimeoutMs}: the server's own `startupTimeoutMs`, else env `MCP_TIMEOUT`, else the SDK's
|
|
108
|
+
* 60 000 ms default): the handshake, one
|
|
106
109
|
* request; and the initial tool listing, a PAGINATED WALK whose whole budget is that same number
|
|
107
110
|
* (however many pages it takes — and no request at all when the peer advertises no tools). Two
|
|
108
111
|
* budgets, so twice that, not once;
|
package/dist/core/mcp-probe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { MCP_ENV_MS_MAX, materializeMcpTools
|
|
4
|
+
import { MCP_ENV_MS_MAX, materializeMcpTools } from "./mcp.js";
|
|
5
5
|
import { findNamespacePrefixCollision } from "./protocol-naming.js";
|
|
6
6
|
import { MCP_NAMESPACE } from "./protocol-table.js";
|
|
7
7
|
import { mcpManifestEntries } from "./runner/prepare-wiring-manifest.js";
|
|
@@ -62,7 +62,7 @@ function stoppedWaitingStatus(entry, ms) {
|
|
|
62
62
|
}
|
|
63
63
|
export async function probeMcpServers(specs, opts = {}) {
|
|
64
64
|
const declared = snapshotMcpEntries(specs);
|
|
65
|
-
const timeoutMs = wholeInRange("timeoutMs", opts.timeoutMs, 1, MCP_ENV_MS_MAX)
|
|
65
|
+
const timeoutMs = wholeInRange("timeoutMs", opts.timeoutMs, 1, MCP_ENV_MS_MAX);
|
|
66
66
|
const concurrency = wholeInRange("concurrency", opts.concurrency, 1, Number.MAX_SAFE_INTEGER) ?? 1;
|
|
67
67
|
const onElicit = opts.onElicit ?? DECLINE_EVERY_ELICITATION;
|
|
68
68
|
const signal = opts.signal;
|
|
@@ -128,5 +128,5 @@ export async function probeMcpServers(specs, opts = {}) {
|
|
|
128
128
|
fatal = { cause: abortCause(signal) };
|
|
129
129
|
if (fatal !== undefined)
|
|
130
130
|
throw fatal.cause;
|
|
131
|
-
return { entries: mcpManifestEntries(declared, statuses), servers };
|
|
131
|
+
return { entries: mcpManifestEntries(declared, statuses, servers.flatMap((s) => s?.tools ?? [])), servers };
|
|
132
132
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReceiptFault } from "./mods/kernel/receive.js";
|
|
1
2
|
import type { ToolContentOrigin, ToolEffect } from "./tool-spec.js";
|
|
2
3
|
import type { ToolFamily, ToolPathTarget, ToolRenderHints, ToolRuleFace } from "./tool-face.js";
|
|
3
4
|
/** Definition of an MCP server to connect to for the duration of one task, then discard. */
|
|
@@ -61,7 +62,7 @@ export interface McpServerSpec {
|
|
|
61
62
|
* a read-only tool can return third-party text, and a deployment's own writer brings back nothing
|
|
62
63
|
* external — so vouching on one axis never quietly vouches on the other.
|
|
63
64
|
*
|
|
64
|
-
* THE SHAPE IS JUDGED, NOT TRUSTED: {@link
|
|
65
|
+
* THE SHAPE IS JUDGED, NOT TRUSTED: {@link readToolAxes} is the one reader of this declaration (an A2A peer's `toolAxes` is read by it too). The
|
|
65
66
|
* preparation door runs it on every entry, and a declaration it cannot read refuses the whole prepare
|
|
66
67
|
* (`config.invalid_argument`) — one bad tool refuses the entry, a bad key is never dropped and a bad word
|
|
67
68
|
* never defaults, because a caller's safety axis that silently reads as absent is a trust root that is not
|
|
@@ -148,15 +149,36 @@ export interface McpServerSpec {
|
|
|
148
149
|
* (`config.mcp_fingerprint_invalid`).
|
|
149
150
|
*/
|
|
150
151
|
fingerprint?: string;
|
|
152
|
+
/**
|
|
153
|
+
* THIS server's startup bound, in whole milliseconds: the handshake (connect + initialize) and the initial tool listing each carry it
|
|
154
|
+
* (the listing as one walk, however many pages). One knob, three seats, read by one function in this order — this member, else the
|
|
155
|
+
* process-level `MCP_TIMEOUT`, else the MCP SDK's own 60 000 ms — so a server that hangs at startup is cut on its own clock while its
|
|
156
|
+
* siblings keep the deployment's. It bounds only that startup phase: a call's own timeout (`MCP_TOOL_TIMEOUT`) is untouched.
|
|
157
|
+
*
|
|
158
|
+
* The range is the one every MCP millisecond bound keeps, 1 000 to 2 147 483 647 (a larger delay is silently rewritten to 1 ms by the
|
|
159
|
+
* timer, a smaller one is a unit slip). Unlike the environment seat — a string a process may clamp and announce — a declaration is typed
|
|
160
|
+
* data, so anything else (a string, a fraction, zero, a negative, NaN, `null`, a number outside the range) refuses THIS server at its
|
|
161
|
+
* dial (`config.mcp_startup_timeout_invalid`; siblings mount) rather than being clamped or read as the default.
|
|
162
|
+
*
|
|
163
|
+
* The bound a dial runs under (this member, else the environment seat) is part of a pooled connection's identity: mounts under one
|
|
164
|
+
* bound lease ONE connection, mounts under different bounds dial their own — so a mount is never held by another mount's clock.
|
|
165
|
+
* The no-run probe has no clock of its own: each startup phase carries this same bound (a caller's `timeoutMs` is an overall ceiling beside it).
|
|
166
|
+
*/
|
|
167
|
+
startupTimeoutMs?: number;
|
|
151
168
|
}
|
|
152
169
|
type ToolAxes = NonNullable<McpServerSpec["toolAxes"]>;
|
|
153
170
|
/**
|
|
154
|
-
* {@link
|
|
171
|
+
* The surfaces that declare `toolAxes`, which {@link readToolAxes} names its reading by: an MCP server's keys are the server's
|
|
172
|
+
* remote TOOL names, an A2A peer's keys are the peer's remote SKILL ids.
|
|
173
|
+
*/
|
|
174
|
+
export type ToolAxesSurface = "mcp" | "a2a";
|
|
175
|
+
/**
|
|
176
|
+
* {@link readToolAxes}'s answer. `ok: true` carries the declaration as a PLAIN COPY the reader built from
|
|
155
177
|
* what it judged (never the caller's own object); `toolAxes` is absent when the entry declares nothing — no
|
|
156
178
|
* key at all, or only empty per-tool objects (which the engine reads the same as no declaration). `ok: false`
|
|
157
|
-
* carries one sentence naming the tool and the member that did not fit, never a value.
|
|
179
|
+
* carries one sentence naming the tool (or skill) and the member that did not fit, never a value.
|
|
158
180
|
*/
|
|
159
|
-
export type
|
|
181
|
+
export type ToolAxesRead = {
|
|
160
182
|
ok: true;
|
|
161
183
|
toolAxes?: ToolAxes;
|
|
162
184
|
} | {
|
|
@@ -164,18 +186,82 @@ export type McpToolAxesRead = {
|
|
|
164
186
|
problem: string;
|
|
165
187
|
};
|
|
166
188
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
|
|
189
|
+
* Where a declaration stops being one: the path from the declaration's root — a list index as a number, a member name as a string — and
|
|
190
|
+
* the clause that says what is there ("it contains itself; …"): a kind and a remedy, never a value the declarer wrote.
|
|
191
|
+
*/
|
|
192
|
+
export interface DeclarationFault {
|
|
193
|
+
readonly path: readonly (string | number)[];
|
|
194
|
+
readonly problem: string;
|
|
195
|
+
}
|
|
196
|
+
/** {@link receiveDeclaration}'s answer: the engine's own frozen copy, or where and why the declaration could not be received. */
|
|
197
|
+
export type DeclarationRead = {
|
|
198
|
+
readonly ok: true;
|
|
199
|
+
readonly value: unknown;
|
|
200
|
+
} | {
|
|
201
|
+
readonly ok: false;
|
|
202
|
+
readonly fault: DeclarationFault;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* A receipt's refusal of a declaration (or of the list that carries declarations), said as a declaration refusal says it. The receipt's
|
|
206
|
+
* path does not say which kind of container each name came from, so a segment of digits alone is read as a list index.
|
|
207
|
+
*/
|
|
208
|
+
export declare function declarationFaultOf(fault: ReceiptFault): DeclarationFault;
|
|
209
|
+
/** What a declaration's own type fixes at one path, beyond being plain data: a string there, or a record of names to strings. */
|
|
210
|
+
export interface DeclarationPathRule {
|
|
211
|
+
readonly path: readonly string[];
|
|
212
|
+
readonly holds: "a string" | "names to strings";
|
|
213
|
+
/** The member must be there (a declaration with no value at the path is refused, as one with a value of another kind is). */
|
|
214
|
+
readonly required?: true;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Per surface, every path its declaration's type fixes beyond plain data — the declarer's `name` (a string, always there) and every record
|
|
218
|
+
* the type writes as `Record<string, string>`: an MCP server's `transport.env` (a stdio server's environment) and `transport.headers` (an
|
|
219
|
+
* HTTP server's headers); an A2A peer's `headers`. A path that is not its surface's (an A2A peer's `transport`) is not judged by another
|
|
220
|
+
* surface's row: it is a member the surface does not read.
|
|
221
|
+
*/
|
|
222
|
+
export declare const DECLARATION_PATH_RULES: Readonly<Record<ToolAxesSurface, readonly DeclarationPathRule[]>>;
|
|
223
|
+
/**
|
|
224
|
+
* The one reading of a declaration a caller hands the engine — an MCP server's or an A2A peer's entry (the snapshot), a `toolAxes`
|
|
225
|
+
* record ({@link readToolAxes}), a lock declaration: the engine's one receipt of a caller's object in its declaration mode, so the
|
|
226
|
+
* value is plain data held to the engine's one depth ({@link MODS_VALUE_DEPTH} levels below it) and every own member is read once, then, when the copy is a record, the declaration's own
|
|
227
|
+
* vocabulary over the copy (a list holds names; no member is named `__proto__`; each path `rules` names holds what its rule says — an
|
|
228
|
+
* entry's rules are its surface's {@link DECLARATION_PATH_RULES}). The copy is the answer — the caller's object is never handed on and
|
|
229
|
+
* never read again. A copy that is not a record is answered as it is, for the reader that expected a record to word.
|
|
230
|
+
*/
|
|
231
|
+
export declare function receiveDeclaration(declared: unknown, rules?: readonly DeclarationPathRule[]): DeclarationRead;
|
|
232
|
+
/**
|
|
233
|
+
* The one reader of a raw `toolAxes` declaration — {@link McpServerSpec.toolAxes} and {@link A2aServerSpec.toolAxes} are the same
|
|
234
|
+
* declaration, and the engine's preparation door, its materialization of an MCP server and of an A2A peer, and every host that
|
|
235
|
+
* assembles the field from JSON ask this same function. `at` names the surface the declaration sits on, because that decides what its
|
|
236
|
+
* keys are called in the sentence: `"mcp"` — the server's remote tools; `"a2a"` — the peer's remote skills. Absent ⇒ `{ ok: true }`
|
|
237
|
+
* (nothing declared). Anything else must be an object of per-tool objects whose members are exactly `effect` /
|
|
170
238
|
* `egress` / `irreversibility` with legal values; a declaration of any other shape, an empty tool name, an
|
|
171
239
|
* unknown member, a word outside the vocabulary or a non-boolean `egress` on ANY one tool refuses the whole
|
|
172
240
|
* declaration (`ok: false`) — the good tools are not kept and nothing is defaulted, since a caller axis is
|
|
173
241
|
* two-way (it can vouch a tool down as well as mark it up) and a silently lost half is a trust root that is
|
|
174
242
|
* not in force. The reader judges SHAPE only; whether the axes contradict each other (`egress` over a
|
|
175
|
-
* non-write effect) is the ingestion's own arithmetic. The
|
|
176
|
-
*
|
|
243
|
+
* non-write effect) is the ingestion's own arithmetic. The declaration is read once, as plain data, by {@link receiveDeclaration} — a
|
|
244
|
+
* Proxy, a map, a class instance, a record built on a prototype or in another realm, a getter that throws, a structure that contains
|
|
245
|
+
* itself, a tool named `__proto__` are refusals that say where they sit (never the thrown text), not a throw — and judged on that copy.
|
|
246
|
+
* `at` is the caller's own word, not the declarer's: one outside {@link ToolAxesSurface} throws `config.invalid_argument` naming the
|
|
247
|
+
* surfaces, whatever is declared.
|
|
177
248
|
*/
|
|
178
|
-
export declare function
|
|
249
|
+
export declare function readToolAxes(declared: unknown, at: ToolAxesSurface): ToolAxesRead;
|
|
250
|
+
/** {@link readToolAxes} for an MCP server's declaration — the entry a host that mounts MCP servers asks. */
|
|
251
|
+
export declare function readMcpToolAxes(declared: unknown): ToolAxesRead;
|
|
252
|
+
/**
|
|
253
|
+
* The word a sentence about one declaration of the surface `at` names the declarer by — `MCP server`, `A2A peer`. The same row the
|
|
254
|
+
* `toolAxes` refusal below reads, so every sentence the engine writes about a declaration it cannot read calls the declarer one thing.
|
|
255
|
+
*/
|
|
256
|
+
export declare function declarerWord(at: ToolAxesSurface): string;
|
|
257
|
+
/**
|
|
258
|
+
* The refusal an entry's unreadable `toolAxes` becomes (`config.invalid_argument`), ONE sentence for every surface that declares them:
|
|
259
|
+
* the subject is the surface's declarer word and `name` (already quoted and bounded by the caller: `MCP server "db"`, `A2A peer "agent"`),
|
|
260
|
+
* `problem` is {@link readToolAxes}'s own sentence.
|
|
261
|
+
*/
|
|
262
|
+
export declare function toolAxesRefusal(at: ToolAxesSurface, name: string, problem: string): Error & {
|
|
263
|
+
code: "config.invalid_argument";
|
|
264
|
+
};
|
|
179
265
|
/** The identity of one mount of a declared server, as the host minted it ({@link McpServerSpec.fingerprint}). */
|
|
180
266
|
export interface McpMountIdentity {
|
|
181
267
|
readonly fingerprint: string;
|
|
@@ -226,6 +312,14 @@ export interface A2aServerSpec {
|
|
|
226
312
|
* raise it — e.g. `{ egress: false, effect: "read" }` vouches that a skill only reads. Note that
|
|
227
313
|
* lowering `effect` WITHOUT clearing `egress` is a contradiction prepare-task refuses by design (an
|
|
228
314
|
* external write must be repeat-unsafe).
|
|
315
|
+
*
|
|
316
|
+
* THE SHAPE IS JUDGED, NOT TRUSTED, by the same reader as {@link McpServerSpec.toolAxes} ({@link readToolAxes} with `at: "a2a"`) and
|
|
317
|
+
* with the same disposition: a task's preparation door runs it on every peer of `TaskSpec.a2a`, and a declaration it cannot read
|
|
318
|
+
* refuses the whole prepare (`config.invalid_argument`, subject `A2A peer "<name>"`) before any peer is dialed — one bad skill refuses
|
|
319
|
+
* the task, a bad key is never dropped and a bad word never defaults. The materialization entrance (`materializeA2aTools`, the library
|
|
320
|
+
* entrance) asks it once per peer, when it reads that peer's declaration: there a declaration it cannot read fails THAT peer's dial
|
|
321
|
+
* (never dialed, a warning whose cause is the same refusal), its siblings unaffected; a refresh does not ask again, it dials the copy
|
|
322
|
+
* that was judged (a peer refused at the entrance is refused again by every refresh, from the stored refusal).
|
|
229
323
|
*/
|
|
230
324
|
toolAxes?: Record<string, {
|
|
231
325
|
effect?: ToolEffect;
|