@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
|
@@ -2,7 +2,7 @@ import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
|
2
2
|
import type { AssistantMessage, Message, Model, Usage } from "../../internal/llm.js";
|
|
3
3
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
4
4
|
import { type PermissionResult, type ToolCallRequest } from "../tool-policy.js";
|
|
5
|
-
import type { ClassicEventBase, HookInvocationIdentity, PermissionDeniedPayload, UserPromptSubmitEvent } from "../hooks.js";
|
|
5
|
+
import type { ClassicEventBase, HookEnvCapabilities, HookInvocationIdentity, PermissionDeniedPayload, SubagentStartResult, UserPromptSubmitEvent } from "../hooks.js";
|
|
6
6
|
import type { ClassicEventMap, ClassicEventName } from "./classic-events.js";
|
|
7
7
|
import type { PermissionMode } from "../ask-origin.js";
|
|
8
8
|
import type { RunnerDeps } from "../runner-deps.js";
|
|
@@ -29,12 +29,23 @@ export type LegModBus = Pick<ModBus, "hasHandlers" | "dispatch">;
|
|
|
29
29
|
* and its parent's fleet row use). A top-level leg carries none.
|
|
30
30
|
*/
|
|
31
31
|
export declare function agentIdOf(identity: HookInvocationIdentity | undefined): string | undefined;
|
|
32
|
+
export interface LegEvents {
|
|
33
|
+
/** The person's-prompt screen its objective passes — present when a person wrote the objective. */
|
|
34
|
+
readonly screen?: "classic.UserPromptSubmit";
|
|
35
|
+
/** The event it opens on — present on a delegated leg. */
|
|
36
|
+
readonly start?: "classic.SubagentStart";
|
|
37
|
+
/** The event it raises when it would otherwise end. */
|
|
38
|
+
readonly stop: "classic.Stop" | "classic.SubagentStop";
|
|
39
|
+
}
|
|
32
40
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* leg's
|
|
41
|
+
* Both ends of a leg. The delegation fact alone picks the lifecycle (a child resumed from its checkpoint keeps it): a
|
|
42
|
+
* delegated leg opens on `classic.SubagentStart` and ends on `classic.SubagentStop`, any other on nothing and
|
|
43
|
+
* `classic.Stop`. Who wrote the objective picks the screen: a top-level leg's objective is a person's prompt, and so is
|
|
44
|
+
* a delegated leg's that carries an operator's words (`operatorObjective`, the trusted resume fact) — both pass
|
|
45
|
+
* `classic.UserPromptSubmit`; any other delegated objective is its delegator's (a parent model, a workflow script, a
|
|
46
|
+
* peer) and is judged at the delegator's gate. Not the leg kind: a resumed leg's kind reads `"resume"` whoever it runs as.
|
|
36
47
|
*/
|
|
37
|
-
export declare function
|
|
48
|
+
export declare function legEventsOf(identity: Pick<HookInvocationIdentity, "isDelegatedChild"> | undefined, operatorObjective?: boolean): LegEvents;
|
|
38
49
|
/**
|
|
39
50
|
* The args as a judging handler receives them: the gate pass's own immutable value ({@link ownArgs} — the value itself when
|
|
40
51
|
* the gate already took it, which is every call the gate raises an event over), so the bytes a handler judges are the bytes
|
|
@@ -66,28 +77,25 @@ export declare function sameModChain(a: readonly ModChainLink[], b: readonly Mod
|
|
|
66
77
|
* screening constraint, and what a child's own gate stands in for when it mounted the same.
|
|
67
78
|
*/
|
|
68
79
|
export declare function chainJudges(bus: LegModBus): boolean;
|
|
69
|
-
/** Record what the constraint mint minted `policy` over. */
|
|
70
|
-
export declare function recordScreeningChain(policy: object, chain: LegModBus): void;
|
|
71
|
-
/** The chain a screening constraint was minted over, or `undefined` when the mint did not make this object. */
|
|
72
|
-
export declare function screeningChainOf(policy: object): LegModBus | undefined;
|
|
73
80
|
/** How an inherited installation's question is settled: under the context its installation froze (its approver, its durable
|
|
74
|
-
* mandates, its classifier —
|
|
75
|
-
* allow carrying `updatedInput` is a person's approval of an edit; an ask is one the
|
|
76
|
-
* the park). */
|
|
81
|
+
* mandates, its classifier), never at this leg's approver — whichever event raised it (`classic.PreToolUse` at the gate's phase
|
|
82
|
+
* 1, `tool.check` at its verdict read). An allow carrying `updatedInput` is a person's approval of an edit; an ask is one the
|
|
83
|
+
* settlement floated (the call is marked for the park). */
|
|
77
84
|
export type InstallationAskSettlement = (ask: Extract<PermissionResult, {
|
|
78
85
|
action: "ask";
|
|
79
86
|
}>, call: ToolCallRequest, signal: AbortSignal | undefined) => Promise<PermissionResult>;
|
|
80
|
-
/** An inherited installation as a leg's gate raises
|
|
81
|
-
* judge here,
|
|
82
|
-
|
|
87
|
+
/** An inherited installation as a leg's gate raises its judging events on it (`classic.PreToolUse` at phase 1, `tool.check` at the
|
|
88
|
+
* verdict read): the bus that mounted that chain, which of its handlers judge here, the capability face of the environment it was
|
|
89
|
+
* installed against (the `env` of its `classic.PreToolUse` e), and how its question is settled. */
|
|
90
|
+
export interface InheritedInstallation {
|
|
83
91
|
readonly bus: LegModBus;
|
|
84
92
|
readonly judges: (p: ModParticipant) => boolean;
|
|
93
|
+
readonly env?: HookEnvCapabilities;
|
|
85
94
|
readonly settle: InstallationAskSettlement;
|
|
86
95
|
}
|
|
87
|
-
/** An inherited chain entry as its installation identity reads it
|
|
88
|
-
* the chain), the approver it froze, its two durable mandates, the environment it was installed against, its classifier. */
|
|
96
|
+
/** An inherited chain entry as its installation identity reads it (the installation is absent on a caller-policy entry). */
|
|
89
97
|
export interface InstallationEntry {
|
|
90
|
-
readonly
|
|
98
|
+
readonly installation?: LegModBus;
|
|
91
99
|
readonly onAsk?: unknown;
|
|
92
100
|
readonly durableMandate?: boolean;
|
|
93
101
|
readonly contentMandate?: boolean;
|
|
@@ -107,52 +115,43 @@ export interface LegInstallation {
|
|
|
107
115
|
readonly decider: unknown;
|
|
108
116
|
}
|
|
109
117
|
/**
|
|
110
|
-
* Whether an inherited entry IS a leg's installation — the ONE installation identity
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* context its questions are settled in: the same approver ({@link askApproverIdentity}), the same two durable mandates, the
|
|
114
|
-
* same environment, the same classifier instance. Readers: chain assembly (a leg already on the chain is not appended again)
|
|
115
|
-
* and {@link standsInFor} (the fold's pass-through and the `tool.check` raise).
|
|
118
|
+
* Whether an inherited entry IS a leg's installation — the ONE installation identity: the chain is read off the entry's own
|
|
119
|
+
* installation; a caller-policy entry, or one whose bus no engine admission mounted, is no leg's installation. The rest is
|
|
120
|
+
* the context its questions are settled in ({@link askApproverIdentity}, the two durable mandates, the environment, the classifier).
|
|
116
121
|
*/
|
|
117
122
|
export declare function sameInstallation(pc: InstallationEntry, leg: LegInstallation): boolean;
|
|
118
123
|
/**
|
|
119
124
|
* Whether a leg's own gate stands in for an inherited entry: the leg's chain judges, and the entry is the leg's installation
|
|
120
125
|
* settled with no durable mandate — its phase 1 then judges the call with the same chain, and its questions go to the same
|
|
121
|
-
* approver under no mandate, so the entry adds nothing on either judging event.
|
|
122
|
-
* `classic.PreToolUse` and
|
|
123
|
-
*
|
|
126
|
+
* approver under no mandate, so the entry adds nothing on either judging event. Whether the gate raises the entry's
|
|
127
|
+
* `classic.PreToolUse` and `tool.check` is this one test (an entry it does not hold for is judged under its own context on both:
|
|
128
|
+
* a second judgment, never a lost one).
|
|
124
129
|
*/
|
|
125
130
|
export declare function standsInFor(pc: InstallationEntry, leg: Omit<LegInstallation, "durableMandate" | "contentMandate">, legChainJudges: boolean): boolean;
|
|
126
|
-
/** An inherited screening installation as the carrier check reads it: the bus its policy was minted over (absent when the mint
|
|
127
|
-
* did not make the policy) and the chain the entry declares (its `mods`; absent when it declares none). The declaration is read
|
|
128
|
-
* for one thing — a guard the leg cannot raise ({@link unraisableGuardsOf}); identity is read off the bus ({@link sameInstallation}). */
|
|
129
|
-
export interface ScreeningInstallation {
|
|
130
|
-
readonly bus: LegModBus | undefined;
|
|
131
|
-
readonly chain: readonly ModChainLink[] | undefined;
|
|
132
|
-
}
|
|
133
|
-
/** The screening installations among a chain's entries, in the chain's order: every entry whose policy the mint made or that
|
|
134
|
-
* declares a chain. */
|
|
135
|
-
export declare function screeningInstallationsOf(entries: ReadonlyArray<{
|
|
136
|
-
readonly policy: object;
|
|
137
|
-
readonly mods?: readonly ModChainLink[];
|
|
138
|
-
}>): readonly ScreeningInstallation[];
|
|
139
|
-
/** Why an inherited chain cannot hold its guards, or `undefined`: an entry that names a judging `tool.check` handler beside a
|
|
140
|
-
* policy the mint did not make has no bus to raise that guard on. Read where the chain enters a leg — before a resume's claim
|
|
141
|
-
* and at the leg's prepare — so it is refused, never run without the guard. */
|
|
142
|
-
export declare function unraisableGuardsOf(installations: readonly ScreeningInstallation[]): string | undefined;
|
|
143
131
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
132
|
+
* Why an inherited chain cannot be held, or `undefined`. Every entry is ONE of two kinds — a caller policy (`policy`, folded into
|
|
133
|
+
* the leg's restriction chain) or a screening installation (`installation`, the bus an engine admission mounted: a leg's own, or
|
|
134
|
+
* {@link admitModChain}'s, whose judging events the leg's gate raises). An entry naming both, or neither, or an installation no
|
|
135
|
+
* engine admission mounted has no way to judge the leg's calls. Read where the chain enters a leg — before a resume's claim and
|
|
136
|
+
* at the leg's prepare — so it is refused, never run without the judgment.
|
|
137
|
+
*/
|
|
138
|
+
export declare function chainEntryFault(entries: ReadonlyArray<{
|
|
139
|
+
readonly policy?: object;
|
|
140
|
+
readonly installation?: object;
|
|
141
|
+
}>): string | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* The inherited installations a leg's gate judges its calls on after its own bus — the rule's one home, read by both judging
|
|
144
|
+
* events (`classic.PreToolUse` at phase 1, `tool.check` at the verdict read). Every screening entry is one installation, raised
|
|
145
|
+
* whole in the chain's order, except one the leg's own gate stands in for (`standsIn`, {@link standsInFor}). Raised whole because
|
|
146
|
+
* a handler's answer depends on the chain it sits in (an outer handler may answer without calling `next`, or rule on what an
|
|
147
|
+
* inner one answered), so a registration the leg also mounts in a chain of its own judges again inside the ancestor's chain (a
|
|
148
|
+
* second judgment, never a lost one). Each carries the environment face its installation was installed against (`envOf`) and
|
|
149
|
+
* its entry's settlement of a question (`settleOf`): an installation's `ask`, on either event, goes to the regime it froze.
|
|
150
|
+
* Observe handlers never take part. A chain with a malformed entry is refused (`config.mods_invalid`, {@link chainEntryFault}).
|
|
152
151
|
*/
|
|
153
|
-
export declare function
|
|
154
|
-
readonly
|
|
155
|
-
}>(entries: readonly E[], standsIn: (pc: E) => boolean, settleOf: (pc: E) => InstallationAskSettlement): readonly
|
|
152
|
+
export declare function inheritedInstallations<E extends InstallationEntry & {
|
|
153
|
+
readonly policy?: object;
|
|
154
|
+
}>(entries: readonly E[], standsIn: (pc: E) => boolean, envOf: (pc: E) => HookEnvCapabilities | undefined, settleOf: (pc: E) => InstallationAskSettlement): readonly InheritedInstallation[];
|
|
156
155
|
/** The members every classic `e` of a leg carries: the identity envelope, the delegated leg's `agentId`, the leg's observed mode. */
|
|
157
156
|
export declare function classicEventBase(identity: HookInvocationIdentity | undefined, permissionMode?: PermissionMode): ClassicEventBase;
|
|
158
157
|
/**
|
|
@@ -171,6 +170,7 @@ export declare function dispatchClassic<K extends ClassicEventName>(bus: LegModB
|
|
|
171
170
|
readonly signal?: AbortSignal;
|
|
172
171
|
readonly checkAnswer?: ModAnswerCheck;
|
|
173
172
|
readonly ranks?: ModAnswerRanks;
|
|
173
|
+
readonly participant?: (p: ModParticipant) => boolean;
|
|
174
174
|
}): Promise<ModDispatchOutcome | undefined>;
|
|
175
175
|
/** The answer form of a classic event whose answer is an object of optional string members (`block`, `additionalContext`, …). */
|
|
176
176
|
export declare function stringMembersAnswer(event: string, members: readonly string[]): (answer: unknown) => string | undefined;
|
|
@@ -178,10 +178,16 @@ export declare function stringMembersAnswer(event: string, members: readonly str
|
|
|
178
178
|
export declare function stringMembersOf<M extends string>(answer: unknown, members: readonly M[]): {
|
|
179
179
|
[K in M]?: string;
|
|
180
180
|
};
|
|
181
|
-
/** The clause a fail-closed station puts in its sentence for the handler that failed it: `crashed (extension "x" threw boom)
|
|
181
|
+
/** The clause a fail-closed station puts in its sentence for the handler that failed it: `crashed (extension "x" threw boom)`
|
|
182
|
+
* — what it did, who it is and the bus's reason. */
|
|
182
183
|
export declare function failedHandlerClause(f: Extract<ModDispatchOutcome, {
|
|
183
184
|
kind: "failed";
|
|
184
185
|
}>): string;
|
|
186
|
+
/** The clause without the bus's reason, `crashed (extension "x")`: for a sentence in place of a result the handler saw (its
|
|
187
|
+
* reason may quote that result; the reason is said on the report sink). */
|
|
188
|
+
export declare function failedHandlerName(f: Extract<ModDispatchOutcome, {
|
|
189
|
+
kind: "failed";
|
|
190
|
+
}>): string;
|
|
185
191
|
/**
|
|
186
192
|
* The PermissionDenied station: the leg's `classic.PermissionDenied` handlers, then a host's own raw observer (a host
|
|
187
193
|
* driving the tool gate itself) as one more observe handler of the same event on a bus of its own — so every observer
|
|
@@ -211,6 +217,13 @@ export type PromptScreen = {
|
|
|
211
217
|
* a cancelled screen ends `aborted` at once. A dispatch the engine itself could not run is `failed` too.
|
|
212
218
|
*/
|
|
213
219
|
export declare function screenUserPrompt(bus: LegModBus, e: UserPromptSubmitEvent, signal: AbortSignal | undefined): Promise<PromptScreen | undefined>;
|
|
220
|
+
/**
|
|
221
|
+
* Raise `classic.SubagentStart` as a delegated leg opens on its objective (undefined when no handler hangs on it): the
|
|
222
|
+
* context the chain answers. It never keeps the child from starting — a handler that fails is skipped and reported by
|
|
223
|
+
* the bus, a cancel ends the wait at once (the leg's own cancel then ends the child), and a dispatch the engine itself
|
|
224
|
+
* could not run is no answer.
|
|
225
|
+
*/
|
|
226
|
+
export declare function openSubagent(bus: LegModBus, identity: HookInvocationIdentity, permissionMode: PermissionMode | undefined, signal: AbortSignal | undefined): Promise<SubagentStartResult | undefined>;
|
|
214
227
|
/** The three words a `tool.check` verdict speaks. */
|
|
215
228
|
export declare const TOOL_CHECK_DECISIONS: readonly ["allow", "ask", "deny"];
|
|
216
229
|
export type ToolCheckDecision = (typeof TOOL_CHECK_DECISIONS)[number];
|
|
@@ -353,10 +366,10 @@ export interface LegFacadeInput {
|
|
|
353
366
|
export declare function legFacadeSeats(input: LegFacadeInput): LegFacadeSeats;
|
|
354
367
|
/**
|
|
355
368
|
* A chain admitted outside any leg — what a host rebuilds to re-supply an inherited screening entry on a fresh Runner
|
|
356
|
-
* (a cross-process resume hands back `
|
|
357
|
-
* same admission a leg runs (both seats, `plugin.register`); no leg exists, so its `$` facade is never
|
|
358
|
-
* call throws. Handler failures go to `onError` (absent ⇒ unreported). Its chain identity is recorded as a
|
|
359
|
-
* ({@link chainOfBus}), so an entry
|
|
369
|
+
* (a cross-process resume hands back `{ installation: await admitModChain(…), hookEnv, …regime }` over the same
|
|
370
|
+
* registrations). The same admission a leg runs (both seats, `plugin.register`); no leg exists, so its `$` facade is never
|
|
371
|
+
* bound and a `$` call throws. Handler failures go to `onError` (absent ⇒ unreported). Its chain identity is recorded as a
|
|
372
|
+
* leg's is ({@link chainOfBus}), so an entry carrying it is read by what it mounted.
|
|
360
373
|
*/
|
|
361
374
|
export declare function admitModChain(seats: {
|
|
362
375
|
readonly deployment?: readonly ModRegistration<EngineDollar>[];
|
|
@@ -2,10 +2,9 @@ import { types } from "node:util";
|
|
|
2
2
|
import { resolveModel } from "../roles.js";
|
|
3
3
|
import { brainToRuntime } from "../runtime.js";
|
|
4
4
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
5
|
-
import { inlineUntrusted } from "../untrusted-text.js";
|
|
6
5
|
import { extensionWords } from "../untrusted-egress.js";
|
|
7
6
|
import { askApproverIdentity, describeThrown, ownArgs } from "../tool-policy.js";
|
|
8
|
-
import { admitMods
|
|
7
|
+
import { admitMods } from "./kernel/index.js";
|
|
9
8
|
import { legBusOf } from "./extension-call.js";
|
|
10
9
|
import { validateOverlay } from "../../prompt-assembly/overlay.js";
|
|
11
10
|
import { modsInvalid } from "./kernel/registration.js";
|
|
@@ -20,8 +19,13 @@ export function engineCore() {
|
|
|
20
19
|
export function agentIdOf(identity) {
|
|
21
20
|
return identity?.isDelegatedChild === true ? identity.taskId : undefined;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const PERSON_LEG = Object.freeze({ screen: "classic.UserPromptSubmit", stop: "classic.Stop" });
|
|
23
|
+
const DELEGATED_LEG = Object.freeze({ start: "classic.SubagentStart", stop: "classic.SubagentStop" });
|
|
24
|
+
const OPERATOR_RESUMED_LEG = Object.freeze({ screen: "classic.UserPromptSubmit", start: "classic.SubagentStart", stop: "classic.SubagentStop" });
|
|
25
|
+
export function legEventsOf(identity, operatorObjective = false) {
|
|
26
|
+
if (identity?.isDelegatedChild !== true)
|
|
27
|
+
return PERSON_LEG;
|
|
28
|
+
return operatorObjective ? OPERATOR_RESUMED_LEG : DELEGATED_LEG;
|
|
25
29
|
}
|
|
26
30
|
export function judgedInputOf(args) {
|
|
27
31
|
const owned = ownArgs(args);
|
|
@@ -69,15 +73,8 @@ const judgesCall = (p) => !p.observe;
|
|
|
69
73
|
export function chainJudges(bus) {
|
|
70
74
|
return bus.hasHandlers("classic.PreToolUse", judgesCall) || bus.hasHandlers("tool.check", judgesCall);
|
|
71
75
|
}
|
|
72
|
-
const SCREENING_CHAINS = new WeakMap();
|
|
73
|
-
export function recordScreeningChain(policy, chain) {
|
|
74
|
-
SCREENING_CHAINS.set(policy, chain);
|
|
75
|
-
}
|
|
76
|
-
export function screeningChainOf(policy) {
|
|
77
|
-
return SCREENING_CHAINS.get(policy);
|
|
78
|
-
}
|
|
79
76
|
export function sameInstallation(pc, leg) {
|
|
80
|
-
const bus =
|
|
77
|
+
const bus = pc.installation;
|
|
81
78
|
const chain = bus !== undefined ? chainOfBus(bus) : undefined;
|
|
82
79
|
return (chain !== undefined &&
|
|
83
80
|
sameModChain(chain, leg.chain) &&
|
|
@@ -90,33 +87,31 @@ export function sameInstallation(pc, leg) {
|
|
|
90
87
|
export function standsInFor(pc, leg, legChainJudges) {
|
|
91
88
|
return legChainJudges && sameInstallation(pc, { ...leg, durableMandate: false, contentMandate: false });
|
|
92
89
|
}
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function unraisableGuardsOf(installations) {
|
|
104
|
-
const guards = installations.flatMap((i) => (i.bus !== undefined ? [] : (i.chain ?? []).filter((l) => l.handlers.some(judgesToolCheck)).map((l) => `"${inlineUntrusted(l.registration.name, 80)}"`)));
|
|
105
|
-
return guards.length === 0 ? undefined : `an inherited screening entry names the tool.check guard of ${guards.join(", ")}, but its policy is not one createPreToolUseConstraintPolicy minted, so the guard has no chain to judge this leg's calls on — hand the minted policy back as it is`;
|
|
90
|
+
export function chainEntryFault(entries) {
|
|
91
|
+
for (const [i, pc] of entries.entries()) {
|
|
92
|
+
const policy = pc.policy !== undefined;
|
|
93
|
+
const installation = pc.installation;
|
|
94
|
+
if (policy === (installation !== undefined))
|
|
95
|
+
return `inherited chain entry ${i} carries ${policy ? "both a policy and an installation" : "neither a policy nor an installation"} — an entry is either a caller policy or a screening installation`;
|
|
96
|
+
if (installation !== undefined && chainOfBus(installation) === undefined)
|
|
97
|
+
return `inherited chain entry ${i}'s installation is not a chain an engine admission mounted — rebuild it with admitModChain over the same registrations`;
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
106
100
|
}
|
|
107
101
|
const judges = (p) => judgesCall(p);
|
|
108
|
-
export function
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
throw modsInvalid(
|
|
112
|
-
const
|
|
102
|
+
export function inheritedInstallations(entries, standsIn, envOf, settleOf) {
|
|
103
|
+
const fault = chainEntryFault(entries);
|
|
104
|
+
if (fault !== undefined)
|
|
105
|
+
throw modsInvalid(fault);
|
|
106
|
+
const installations = [];
|
|
113
107
|
for (const pc of entries) {
|
|
114
|
-
const bus =
|
|
115
|
-
if (bus === undefined || standsIn(pc) || !bus
|
|
108
|
+
const bus = pc.installation;
|
|
109
|
+
if (bus === undefined || standsIn(pc) || !chainJudges(bus))
|
|
116
110
|
continue;
|
|
117
|
-
|
|
111
|
+
const env = envOf(pc);
|
|
112
|
+
installations.push(Object.freeze({ bus, judges, ...(env !== undefined ? { env } : {}), settle: settleOf(pc) }));
|
|
118
113
|
}
|
|
119
|
-
return Object.freeze(
|
|
114
|
+
return Object.freeze(installations);
|
|
120
115
|
}
|
|
121
116
|
export function classicEventBase(identity, permissionMode) {
|
|
122
117
|
const agentId = agentIdOf(identity);
|
|
@@ -136,11 +131,12 @@ export async function observeClassic(bus, event, e, signal) {
|
|
|
136
131
|
}
|
|
137
132
|
}
|
|
138
133
|
export async function dispatchClassic(bus, event, e, options) {
|
|
139
|
-
if (!bus.hasHandlers(event))
|
|
134
|
+
if (!bus.hasHandlers(event, options.participant))
|
|
140
135
|
return undefined;
|
|
141
136
|
const check = options.checkAnswer;
|
|
142
137
|
return await bus.dispatch(event, e, {
|
|
143
138
|
bottom: engineCore,
|
|
139
|
+
...(options.participant !== undefined ? { participant: options.participant } : {}),
|
|
144
140
|
...(options.signal !== undefined ? { signal: options.signal } : {}),
|
|
145
141
|
...(check !== undefined ? { checkAnswer: (a, ce, by, below, run) => (a === ENGINE_CORE_ANSWER ? undefined : check(a, ce, by, below, run)) } : {}),
|
|
146
142
|
...(options.ranks !== undefined ? { ranks: options.ranks } : {}),
|
|
@@ -172,13 +168,16 @@ export function stringMembersOf(answer, members) {
|
|
|
172
168
|
return out;
|
|
173
169
|
}
|
|
174
170
|
const FAILURE_CLAUSE = Object.freeze({
|
|
175
|
-
threw: (who,
|
|
176
|
-
timeout: (who,
|
|
177
|
-
violation: (who,
|
|
178
|
-
reentry: (who,
|
|
171
|
+
threw: (who, tail) => `crashed (extension "${who}"${tail})`,
|
|
172
|
+
timeout: (who, tail) => `did not answer (extension "${who}"${tail})`,
|
|
173
|
+
violation: (who, tail) => `gave an answer the station cannot take (extension "${who}"${tail})`,
|
|
174
|
+
reentry: (who, tail) => `was skipped on re-entry and its .catch did not answer (extension "${who}"${tail})`,
|
|
179
175
|
});
|
|
180
176
|
export function failedHandlerClause(f) {
|
|
181
|
-
return FAILURE_CLAUSE[f.cause](extensionWords(f.registration, 80), extensionWords(f.reason, 200));
|
|
177
|
+
return FAILURE_CLAUSE[f.cause](extensionWords(f.registration, 80), ` ${extensionWords(f.reason, 200)}`);
|
|
178
|
+
}
|
|
179
|
+
export function failedHandlerName(f) {
|
|
180
|
+
return FAILURE_CLAUSE[f.cause](extensionWords(f.registration, 80), "");
|
|
182
181
|
}
|
|
183
182
|
export async function observePermissionDenied(input) {
|
|
184
183
|
const { payload, hostObserver } = input;
|
|
@@ -218,6 +217,31 @@ export async function screenUserPrompt(bus, e, signal) {
|
|
|
218
217
|
return outcome;
|
|
219
218
|
return { kind: "answered", ...stringMembersOf(outcome.answer, ["block", "additionalContext"]) };
|
|
220
219
|
}
|
|
220
|
+
const subagentStartMembers = stringMembersAnswer("classic.SubagentStart", ["additionalContext"]);
|
|
221
|
+
function subagentStartAnswer(answer) {
|
|
222
|
+
const refused = subagentStartMembers(answer);
|
|
223
|
+
if (refused !== undefined)
|
|
224
|
+
return refused;
|
|
225
|
+
if (typeof answer === "object" && answer !== null && Reflect.get(answer, "block") !== undefined) {
|
|
226
|
+
return `answered "block"; classic.SubagentStart cannot keep a subagent from starting (it starts all the same) — a deployment refuses the delegating call at classic.PreToolUse`;
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
export async function openSubagent(bus, identity, permissionMode, signal) {
|
|
231
|
+
const e = {
|
|
232
|
+
...classicEventBase(identity, permissionMode),
|
|
233
|
+
agentId: identity.taskId,
|
|
234
|
+
...(identity.agentType !== undefined ? { agentType: identity.agentType } : {}),
|
|
235
|
+
};
|
|
236
|
+
let outcome;
|
|
237
|
+
try {
|
|
238
|
+
outcome = await dispatchClassic(bus, "classic.SubagentStart", e, { ...(signal !== undefined ? { signal } : {}), checkAnswer: subagentStartAnswer });
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
return outcome?.kind === "answered" ? stringMembersOf(outcome.answer, ["additionalContext"]) : undefined;
|
|
244
|
+
}
|
|
221
245
|
export const TOOL_CHECK_DECISIONS = Object.freeze(["allow", "ask", "deny"]);
|
|
222
246
|
const isToolCheckDecision = (v) => TOOL_CHECK_DECISIONS.some((d) => d === v);
|
|
223
247
|
const TOOL_CHECK_RANKS = Object.freeze({
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `tool.call` station: raised on the leg's bus between the gate letting a call go and the tool's body, for every
|
|
3
3
|
* execution of a call (the live loop's lanes through the loop's execution seat, the resumed leg's approved call through
|
|
4
|
-
* the same function). The chain's bottom is the tool's body; the event's failure column is `
|
|
5
|
-
*
|
|
4
|
+
* the same function). The chain's bottom is the tool's body; the event's failure column is `refuse`, so a handler's
|
|
5
|
+
* failure refuses the call while the body has not started and, once it has, WITHHOLDS the body's result: the call ran (its
|
|
6
|
+
* record is a call the gate let go, with no `notExecuted`), and the model is told a hook that checks the result could not
|
|
7
|
+
* hand back its answer instead of the result.
|
|
6
8
|
*
|
|
7
9
|
* `e = { tool, tool_use_id, agentId?, input }` (all four pinned — what the gate judged is what runs; a rewrite belongs to
|
|
8
10
|
* `classic.PreToolUse`) plus the identity envelope; a handler may hand on `requestMeta` too (a record of strings an MCP call carries
|
|
9
11
|
* as `_meta["sema/requestMeta"]`, judged where it is handed on — `mcp-call-meta.ts`). A handler answers:
|
|
10
12
|
* - `next(e)` — the body runs; what came up is `{ result: { content, isError } }`, a frozen view of the real result;
|
|
11
13
|
* - `{ deny: <reason> }` — refused before the body: the call is not executed and the record says an extension refused it
|
|
12
|
-
* (a deny once the body has started
|
|
14
|
+
* (a deny once the body has started cannot stand in place of a call that ran: a violation, and the result is withheld);
|
|
13
15
|
* - `{ result }` — an extension's own result in place of the body (a string, or a list of text blocks), taken only when
|
|
14
16
|
* both facts hold: the gate let this call go without anyone being asked about it (its latest gate record is an allow
|
|
15
17
|
* with no settlement, release or clearance — a person's or a rule's yes is a yes to running the tool), and the body
|
|
16
18
|
* has not started (the kernel's own record). Either missing, the answer is a violation: before the body the call is
|
|
17
|
-
* refused, after it the
|
|
19
|
+
* refused, after it the result is withheld. A taken result is the call's result; the record says the body never ran
|
|
18
20
|
* and names the extension (`tool_end.notExecuted`, `tool_end.answeredBy`).
|
|
19
21
|
* Context for the model is added at `classic.PostToolUse`, not here. Whatever an extension answered in place of the body,
|
|
20
22
|
* the call's post-execution stations stay silent, as for a call the gate blocked.
|
|
@@ -31,6 +33,7 @@ import type { HookInvocationIdentity } from "../hooks.js";
|
|
|
31
33
|
import type { ToolOccurrenceTable } from "../runner/tool-occurrence.js";
|
|
32
34
|
import { type McpRequestMetaSeat } from "../mcp-call-meta.js";
|
|
33
35
|
import { type LegModBus } from "./stations.js";
|
|
36
|
+
import { type FrameSettlement } from "../frame-settlement.js";
|
|
34
37
|
import type { ModBus, ModCallEntry } from "./kernel/index.js";
|
|
35
38
|
/** One execution as the station sees it: the call, the tool that runs (its mounted name), the arguments the gate let go. */
|
|
36
39
|
export interface ToolCallExecution {
|
|
@@ -50,6 +53,9 @@ export interface ToolCallStationInput {
|
|
|
50
53
|
readonly reminderMark?: string;
|
|
51
54
|
/** The leg's request-meta seat: what the chain handed on as `requestMeta` stands under the call's id while its body runs. */
|
|
52
55
|
readonly requestMeta: Pick<McpRequestMetaSeat, "hold">;
|
|
56
|
+
/** The leg's settlement seam: a result this station withholds settles the frames it carried as withheld by the host side
|
|
57
|
+
* (`settleWithheldResult`), so none is owed again through another lane. Absent ⇒ no frame rides a call of this station. */
|
|
58
|
+
readonly frameSettlement?: FrameSettlement;
|
|
53
59
|
}
|
|
54
60
|
/** The station over the leg's bus, or undefined when no handler hangs on `tool.call` (nothing is raised; the body runs). */
|
|
55
61
|
export declare function createToolCallStation(input: ToolCallStationInput): ToolCallStation | undefined;
|
|
@@ -7,8 +7,9 @@ import { readHandedRequestMeta } from "../mcp-call-meta.js";
|
|
|
7
7
|
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
8
8
|
import { isPlainRecord } from "./kernel/receive.js";
|
|
9
9
|
import { NEXT_IN_FLIGHT } from "./kernel/site-rules.js";
|
|
10
|
-
import { classicEventBase, failedHandlerClause, judgedInputOf } from "./stations.js";
|
|
10
|
+
import { classicEventBase, failedHandlerClause, failedHandlerName, judgedInputOf } from "./stations.js";
|
|
11
11
|
import { runExtensionCall } from "./extension-call.js";
|
|
12
|
+
import { settleWithheldResult } from "../frame-settlement.js";
|
|
12
13
|
import { randomUUID } from "node:crypto";
|
|
13
14
|
const FORM = "tool.call takes next(e), { deny: <reason> } or { result } (a string, or a list of text blocks)";
|
|
14
15
|
const denyOf = (a) => isPlainRecord(a) && Object.keys(a).length === 1 && typeof a["deny"] === "string" && a["deny"] !== "" ? a["deny"] : undefined;
|
|
@@ -49,13 +50,18 @@ const RANKS = Object.freeze({ of: (a) => (denyOf(a) !== undefined ? 1 : 0), top:
|
|
|
49
50
|
export function createToolCallStation(input) {
|
|
50
51
|
if (!input.bus.hasHandlers("tool.call"))
|
|
51
52
|
return undefined;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
input.occurrences.
|
|
53
|
+
const stationAnswer = (call, by, text) => {
|
|
54
|
+
const content = [{ type: "text", text: formatHookFeedback(text, input.reminderMark) }];
|
|
55
|
+
if (by !== undefined) {
|
|
56
|
+
if (input.occurrences.get(call.toolCallId) !== undefined) {
|
|
57
|
+
input.occurrences.refuse(call.toolCallId, "hook", by);
|
|
58
|
+
input.occurrences.answeredInPlace(call.toolCallId, by);
|
|
59
|
+
}
|
|
60
|
+
input.blockedToolCalls.add(call.toolCallId);
|
|
56
61
|
}
|
|
57
|
-
input.
|
|
58
|
-
|
|
62
|
+
else if (input.frameSettlement !== undefined)
|
|
63
|
+
settleWithheldResult(input.frameSettlement, call.toolCallId, content);
|
|
64
|
+
return { content, details: {}, isError: true };
|
|
59
65
|
};
|
|
60
66
|
return async (call, run, signal) => {
|
|
61
67
|
const e = { ...classicEventBase(input.identity), tool: call.toolName, tool_use_id: call.toolCallId, input: judgedInputOf(call.args) };
|
|
@@ -83,7 +89,7 @@ export function createToolCallStation(input) {
|
|
|
83
89
|
if (!denied && substituteOf(a) === undefined)
|
|
84
90
|
return FORM;
|
|
85
91
|
if (ran.bottomStarted)
|
|
86
|
-
return `a ${denied ? "deny" : "result"} after the tool started (once the tool runs,
|
|
92
|
+
return `a ${denied ? "deny" : "result"} after the tool started (once the tool runs, nothing answers in its place)`;
|
|
87
93
|
if (denied)
|
|
88
94
|
return below.some((b) => denyOf(b) === undefined) ? "a deny while its next(e) still runs or after it was answered (deny in place of next)" : undefined;
|
|
89
95
|
if (below.includes(NEXT_IN_FLIGHT))
|
|
@@ -97,7 +103,7 @@ export function createToolCallStation(input) {
|
|
|
97
103
|
catch (err) {
|
|
98
104
|
if (body !== undefined)
|
|
99
105
|
return body;
|
|
100
|
-
return
|
|
106
|
+
return stationAnswer(call, ENGINE_ORIGIN.plugin, `the tool.call station could not be raised (${describeThrown(err)}); this call to "${extensionWords(call.toolName, 80)}" was NOT executed (fail-closed)`);
|
|
101
107
|
}
|
|
102
108
|
if (outcome.kind === "aborted") {
|
|
103
109
|
if (body !== undefined)
|
|
@@ -105,7 +111,17 @@ export function createToolCallStation(input) {
|
|
|
105
111
|
return { content: [{ type: "text", text: "Operation aborted" }], details: {}, isError: true };
|
|
106
112
|
}
|
|
107
113
|
if (outcome.kind === "failed") {
|
|
108
|
-
|
|
114
|
+
if (outcome.bottomStarted === true && body !== undefined) {
|
|
115
|
+
try {
|
|
116
|
+
await body;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return body;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (outcome.bottomStarted === true)
|
|
123
|
+
return stationAnswer(call, undefined, `a tool.call extension ${failedHandlerName(outcome)} after this call to "${extensionWords(call.toolName, 80)}" ran: a hook that checks this result could not hand back its answer, so the result is withheld — the call ran (fail-closed)`);
|
|
124
|
+
return stationAnswer(call, outcome.registration, `a tool.call extension ${failedHandlerClause(outcome)} before this call to "${extensionWords(call.toolName, 80)}" ran; the call was NOT executed (fail-closed)`);
|
|
109
125
|
}
|
|
110
126
|
const answer = outcome.answer;
|
|
111
127
|
const ran = typeof answer === "object" && answer !== null ? bodies.get(answer) : undefined;
|
|
@@ -114,10 +130,10 @@ export function createToolCallStation(input) {
|
|
|
114
130
|
const by = outcome.answeredBy ?? ENGINE_ORIGIN.plugin;
|
|
115
131
|
const reason = denyOf(answer);
|
|
116
132
|
if (reason !== undefined)
|
|
117
|
-
return
|
|
133
|
+
return stationAnswer(call, by, `extension "${extensionWords(by, 80)}" refused this call to "${extensionWords(call.toolName, 80)}" before it ran: ${extensionWords(reason, 300)}`);
|
|
118
134
|
const content = substituteOf(answer);
|
|
119
135
|
if (content === undefined)
|
|
120
|
-
return
|
|
136
|
+
return stationAnswer(call, by, `extension "${extensionWords(by, 80)}" answered this call in a form tool.call does not take; the call was NOT executed (fail-closed)`);
|
|
121
137
|
if (input.occurrences.get(call.toolCallId) !== undefined)
|
|
122
138
|
input.occurrences.answeredInPlace(call.toolCallId, by);
|
|
123
139
|
input.blockedToolCalls.add(call.toolCallId);
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import type { McpServerSpec } from "./mcp-server-spec.js";
|
|
11
11
|
import type { ToolContentOrigin } from "./tool-spec.js";
|
|
12
12
|
import type { McpConnectionPool } from "./mcp-connection-pool.js";
|
|
13
|
+
import type { McpHostSeat } from "./mcp-host-seat.js";
|
|
13
14
|
import type { McpInstructionsEntry } from "./prompt-section-seat.js";
|
|
14
15
|
/** The two names a server's `allowTools` carries to let the cross-server resource readers reach its resources (a server whose allowlist omits one is left out of that reader). */
|
|
15
16
|
export declare const MCP_RESOURCE_LIST_ALLOW = "list_resources";
|
|
@@ -18,6 +19,7 @@ export declare const MCP_RESOURCE_READ_ALLOW = "read_resource";
|
|
|
18
19
|
export declare const LIST_MCP_RESOURCES = "ListMcpResourcesTool";
|
|
19
20
|
export declare const READ_MCP_RESOURCE = "ReadMcpResourceTool";
|
|
20
21
|
export declare const READ_MCP_RESOURCE_DIR = "ReadMcpResourceDirTool";
|
|
22
|
+
export declare const MCP_RESOURCE_FACES: readonly string[];
|
|
21
23
|
/** Does the valve (`leaves`: its one predicate) leave at least one of the cross-server resource tools? While it does, a connected server may contribute to them whatever it lists. */
|
|
22
24
|
export declare function resourceFacesLeft(leaves: (tool: {
|
|
23
25
|
readonly name: string;
|
|
@@ -76,6 +78,8 @@ export interface MountedMcp {
|
|
|
76
78
|
readonly aggregate: ReadonlyArray<string>;
|
|
77
79
|
/** The run tree's connection pool: a child that inherits the mount leases its connections from it. */
|
|
78
80
|
readonly pool?: McpConnectionPool;
|
|
81
|
+
/** The run's host seats by declaration name: a child declared a host-transport server (inherited or its definition's own) is handed that server's seat. */
|
|
82
|
+
readonly hostSeats?: ReadonlyMap<string, McpHostSeat>;
|
|
79
83
|
}
|
|
80
84
|
/** A roster entry as far as this reading goes. */
|
|
81
85
|
interface RosterEntry {
|
|
@@ -101,6 +105,7 @@ export declare function mountedMcpOf(input: {
|
|
|
101
105
|
readonly roster: ReadonlyArray<RosterEntry>;
|
|
102
106
|
readonly aggregateNames: ReadonlySet<string>;
|
|
103
107
|
readonly pool?: McpConnectionPool;
|
|
108
|
+
readonly hostSeats?: ReadonlyMap<string, McpHostSeat>;
|
|
104
109
|
}): MountedMcp;
|
|
105
110
|
/**
|
|
106
111
|
* The MCP tools of a mount as pool rows (name and the server's declared content class) — what the memory content-origin face adds to
|
package/dist/core/mounted-mcp.js
CHANGED
|
@@ -5,7 +5,7 @@ export const MCP_RESOURCE_READ_ALLOW = "read_resource";
|
|
|
5
5
|
export const LIST_MCP_RESOURCES = "ListMcpResourcesTool";
|
|
6
6
|
export const READ_MCP_RESOURCE = "ReadMcpResourceTool";
|
|
7
7
|
export const READ_MCP_RESOURCE_DIR = "ReadMcpResourceDirTool";
|
|
8
|
-
const MCP_RESOURCE_FACES = [LIST_MCP_RESOURCES, READ_MCP_RESOURCE, READ_MCP_RESOURCE_DIR];
|
|
8
|
+
export const MCP_RESOURCE_FACES = Object.freeze([LIST_MCP_RESOURCES, READ_MCP_RESOURCE, READ_MCP_RESOURCE_DIR]);
|
|
9
9
|
export function resourceFacesLeft(leaves) {
|
|
10
10
|
return MCP_RESOURCE_FACES.some((name) => leaves({ name }));
|
|
11
11
|
}
|
|
@@ -78,7 +78,7 @@ export function mountedMcpOf(input) {
|
|
|
78
78
|
return { server, tools };
|
|
79
79
|
});
|
|
80
80
|
const aggregate = input.roster.filter((t) => input.aggregateNames.has(t.name)).map((t) => t.name);
|
|
81
|
-
return { servers, aggregate, ...(input.pool !== undefined ? { pool: input.pool } : {}) };
|
|
81
|
+
return { servers, aggregate, ...(input.pool !== undefined ? { pool: input.pool } : {}), ...(input.hostSeats !== undefined ? { hostSeats: input.hostSeats } : {}) };
|
|
82
82
|
}
|
|
83
83
|
export function mountedMcpPoolRows(mounted) {
|
|
84
84
|
return [
|
|
@@ -30,6 +30,12 @@ export declare function wildcardMatch(pattern: string, value: string): boolean;
|
|
|
30
30
|
* that is no behavior word (an array index handed by `filter`, say) is refused loudly, never read as either list.
|
|
31
31
|
*/
|
|
32
32
|
export declare function isCoveringRuleName(name: string, behavior: RuleBehavior): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The part of {@link isCoveringRuleName} that is a fact about the NAME alone: the name reaches a SET of tool names whatever list it
|
|
35
|
+
* is written in (a `*` it reads, or a bare protocol peer). A stored rule names ONE tool, so its grammar asks only this — a tool name
|
|
36
|
+
* that a restricting list also reads as another server's spelling ({@link peerReadingsOf}) is still one tool's name there.
|
|
37
|
+
*/
|
|
38
|
+
export declare function namesASetOfTools(name: string, behavior: RuleBehavior): boolean;
|
|
33
39
|
/**
|
|
34
40
|
* Does a covering rule name ({@link isCoveringRuleName}) cover `toolName`? A name with a `*` is a glob over the WHOLE name
|
|
35
41
|
* ({@link wildcardMatch} — the reference's `p` matcher): `mcp__srv__get_*` reaches `mcp__srv__get_issue`, `mcp__*` every MCP tool,
|
|
@@ -46,4 +52,4 @@ export declare function ruleNameCovers(ruleName: string, toolName: string): bool
|
|
|
46
52
|
* minted under the peer is then matched by the glob up to its last `*`, which takes the rest; a glob that does not end in `*` leaves
|
|
47
53
|
* a tool name it does not match. The one reading of a name against a peer that the tool-name lists take.
|
|
48
54
|
*/
|
|
49
|
-
export declare function ruleNameReachIntoPeer(ruleName: string, ns: ProtocolNamespace, peer: string): "all" | "some" | "none";
|
|
55
|
+
export declare function ruleNameReachIntoPeer(ruleName: string, ns: ProtocolNamespace, peer: string, readsOtherServers?: boolean): "all" | "some" | "none";
|