@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { grantWildcardRefusalOf, readsNameGlob, splitNamespacedName } from "./tool-name-aliases.js";
|
|
1
|
+
import { grantWildcardRefusalOf, peerReadingsOf, readsNameGlob, splitNamespacedName } from "./tool-name-aliases.js";
|
|
2
2
|
export function wildcardMatch(pattern, value) {
|
|
3
3
|
const first = pattern.indexOf("*");
|
|
4
4
|
if (first < 0)
|
|
@@ -28,6 +28,9 @@ function namespacedPeerOf(name) {
|
|
|
28
28
|
return split === undefined || split.peer === "" ? undefined : split;
|
|
29
29
|
}
|
|
30
30
|
export function isCoveringRuleName(name, behavior) {
|
|
31
|
+
return namesASetOfTools(name, behavior) || (readsNameGlob(behavior) && peerReadingsOf(name).length > 0);
|
|
32
|
+
}
|
|
33
|
+
export function namesASetOfTools(name, behavior) {
|
|
31
34
|
if (behavior !== "deny" && behavior !== "ask" && behavior !== "allow") {
|
|
32
35
|
throw new TypeError(`isCoveringRuleName: the list's behavior must be "deny", "ask" or "allow" (got ${typeof behavior === "string" ? JSON.stringify(behavior) : typeof behavior}) — a "*" in a name reads one way on a list that restricts and another on one that grants`);
|
|
33
36
|
}
|
|
@@ -39,19 +42,27 @@ export function isCoveringRuleName(name, behavior) {
|
|
|
39
42
|
export function ruleNameCovers(ruleName, toolName) {
|
|
40
43
|
if (ruleName.includes("*"))
|
|
41
44
|
return wildcardMatch(ruleName, toolName);
|
|
45
|
+
const readings = peerReadingsOf(ruleName);
|
|
46
|
+
if (readings.length > 0) {
|
|
47
|
+
const target = namespacedPeerOf(toolName);
|
|
48
|
+
return target !== undefined && readings.some((r) => r.ns.id === target.ns.id && r.peer === target.peer && (r.tool === undefined || r.tool === target.tool));
|
|
49
|
+
}
|
|
42
50
|
const rule = namespacedPeerOf(ruleName);
|
|
43
51
|
if (rule === undefined || rule.tool !== undefined)
|
|
44
52
|
return false;
|
|
45
53
|
const target = namespacedPeerOf(toolName);
|
|
46
54
|
return target !== undefined && target.ns.id === rule.ns.id && target.peer === rule.peer;
|
|
47
55
|
}
|
|
48
|
-
export function ruleNameReachIntoPeer(ruleName, ns, peer) {
|
|
56
|
+
export function ruleNameReachIntoPeer(ruleName, ns, peer, readsOtherServers = false) {
|
|
49
57
|
if (ruleName.includes("*")) {
|
|
50
58
|
if (ruleName.endsWith("*") && wildcardMatch(ruleName, `${ns.prefix}${peer}__`))
|
|
51
59
|
return "all";
|
|
52
60
|
const rule = namespacedPeerOf(ruleName);
|
|
53
61
|
return rule !== undefined && rule.ns.id === ns.id && rule.peer === peer ? "some" : "none";
|
|
54
62
|
}
|
|
63
|
+
const readings = readsOtherServers ? peerReadingsOf(ruleName).filter((r) => r.ns.id === ns.id && r.peer === peer) : [];
|
|
64
|
+
if (readings.length > 0)
|
|
65
|
+
return readings.some((r) => r.tool === undefined) ? "all" : "some";
|
|
55
66
|
const rule = namespacedPeerOf(ruleName);
|
|
56
67
|
if (rule === undefined || rule.ns.id !== ns.id || rule.peer !== peer)
|
|
57
68
|
return "none";
|
|
@@ -6,7 +6,7 @@ function probeCommand(canonOraclePath) {
|
|
|
6
6
|
return `touch -- ${q}/.oracle-isolation-probe 2>/dev/null`;
|
|
7
7
|
}
|
|
8
8
|
export async function assertOracleIsolation(workerEnv, grader, opts) {
|
|
9
|
-
const isolationClass = isIsolated(grader.env)
|
|
9
|
+
const isolationClass = isIsolated(grader.env) && isRemoteExecutionEnv(grader.env)
|
|
10
10
|
? "out_of_process"
|
|
11
11
|
: "in_process_probe_only";
|
|
12
12
|
if (grader.env === workerEnv) {
|
|
@@ -27,5 +27,8 @@ export declare const CONFIG_RECEIPT_MODE: ReceiptMode;
|
|
|
27
27
|
* itself, a container nested deeper — a shared one measured where it sits each time it is met), every copied container frozen.
|
|
28
28
|
*/
|
|
29
29
|
export declare const DECLARATION_RECEIPT_MODE: ReceiptMode;
|
|
30
|
+
/** The OPTIONS DOOR — a constructor's options bag received by the receipt law, absent ⇒ an empty one: every option the constructor reads
|
|
31
|
+
* is read off this copy, once, and the caller's bag is never read again (a store keeps no hold of it). `owner` names the constructor. */
|
|
32
|
+
export declare function receiveOptions<T extends object>(given: T | undefined, owner: string): T;
|
|
30
33
|
/** Read `given` by the receipt law (module note): the plain copy, every own member taken once from its captured descriptor. */
|
|
31
34
|
export declare function receiveOwnProperties<T extends object>(given: T, words: OwnPropertyReceiptWords): T;
|
|
@@ -12,6 +12,9 @@ export function refuseProxy(given, words) {
|
|
|
12
12
|
}
|
|
13
13
|
export const CONFIG_RECEIPT_MODE = Object.freeze({ accessors: "call-once", depth: 1, others: "as-is", isProxy: (v) => types.isProxy(v) });
|
|
14
14
|
export const DECLARATION_RECEIPT_MODE = Object.freeze({ accessors: "call-once", depth: MODS_VALUE_DEPTH + 1, others: "refuse", freeze: true, isProxy: (v) => types.isProxy(v) });
|
|
15
|
+
export function receiveOptions(given, owner) {
|
|
16
|
+
return given === undefined ? {} : receiveOwnProperties(given, { subject: `${owner} options`, unit: "option", moment: `at new ${owner}` });
|
|
17
|
+
}
|
|
15
18
|
export function receiveOwnProperties(given, words) {
|
|
16
19
|
refuseProxy(given, words);
|
|
17
20
|
if (!isPlainRecord(given)) {
|
|
@@ -14,7 +14,7 @@ import type { EngineDollar } from "./mods/dollar.js";
|
|
|
14
14
|
import type { ToolExecuteContext } from "./tool-spec.js";
|
|
15
15
|
import type { TaskSpec } from "./types.js";
|
|
16
16
|
/** The fields of a spec the seat carries — one `Pick`, shared by the mint's input and the apply's target. */
|
|
17
|
-
export type ParentSpecSeatFields = Pick<TaskSpec, "principal" | "oneShot" | "clientContext" | "onQuestion" | "mods" | "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "memoryPersistenceCapable" | "memory" | "compaction" | "skillListingBudgetFraction" | "skillListingMaxDescChars" | "fileHistory" | "projectMemory" | "promptForm" | "promptBinding" | "advisorModel" | "attachments">;
|
|
17
|
+
export type ParentSpecSeatFields = Pick<TaskSpec, "principal" | "oneShot" | "clientContext" | "onQuestion" | "mods" | "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "memoryPersistenceCapable" | "classifyAllShell" | "memory" | "compaction" | "skillListingBudgetFraction" | "skillListingMaxDescChars" | "fileHistory" | "projectMemory" | "promptForm" | "promptBinding" | "advisorModel" | "attachments">;
|
|
18
18
|
/**
|
|
19
19
|
* The seat a run hands its children. Every member is the parent's own value, frozen at mint (arrays copied and
|
|
20
20
|
* frozen; the facts object copied). Members present iff the parent carries them — an absent member is "nothing to
|
|
@@ -35,6 +35,9 @@ export type ParentSpecSeatFields = Pick<TaskSpec, "principal" | "oneShot" | "cli
|
|
|
35
35
|
* · `envFacts` — the sandbox facts (profile / egress / scratchpad).
|
|
36
36
|
* · `memoryPersistenceCapable` — the deployment's DECLARED persistence statement: `false` is a REMOVAL (floor),
|
|
37
37
|
* `true` a default a child's own declaration may narrow.
|
|
38
|
+
* · `classifyAllShell` — the request's "no shell allow entry clears a call in `auto`" declaration: only `true` travels and
|
|
39
|
+
* it is a REMOVAL (the child's shell allow entries stand down in `auto` as the parent's did; a child's own `false` cannot
|
|
40
|
+
* lift it).
|
|
38
41
|
* · `memory` — the request-level "memory is off" FACT, `{ enabled: false }` and nothing else of the declaration (the clamp
|
|
39
42
|
* table's `memory.enabled` row; present only when the parent stated `enabled: false`): a REMOVAL (floor) that
|
|
40
43
|
* REWRITES the one member on the child's own memory declaration — its scopes and knobs are the child's.
|
|
@@ -75,6 +78,7 @@ export interface ParentSpecSeat {
|
|
|
75
78
|
readonly additionalReadDirectories?: readonly string[];
|
|
76
79
|
readonly envFacts?: TaskSpec["envFacts"];
|
|
77
80
|
readonly memoryPersistenceCapable?: boolean;
|
|
81
|
+
readonly classifyAllShell?: true;
|
|
78
82
|
readonly memory?: {
|
|
79
83
|
readonly enabled: false;
|
|
80
84
|
};
|
|
@@ -96,8 +100,9 @@ export declare function assertParentSpecSeatCurrent(seat: object | undefined): v
|
|
|
96
100
|
export declare function parentSpecSeatOf(spec: Omit<ParentSpecSeatFields, "onQuestion">, frozenOnQuestion: OnQuestion | undefined): ParentSpecSeat;
|
|
97
101
|
/**
|
|
98
102
|
* Apply the seat to a child spec — ONE law for every member, both lanes:
|
|
99
|
-
* a value the child spec already carries WINS; the seat FILLS an unset one; the
|
|
100
|
-
* (`oneShot: true`, `memoryPersistenceCapable: false`, `memory: { enabled: false }`) land
|
|
103
|
+
* a value the child spec already carries WINS; the seat FILLS an unset one; the four REMOVAL values
|
|
104
|
+
* (`oneShot: true`, `memoryPersistenceCapable: false`, `classifyAllShell: true`, `memory: { enabled: false }`) land
|
|
105
|
+
* UNCONDITIONALLY.
|
|
101
106
|
* "Already carries" is the child's own authorship — a deployment baseline, a trusted script, an agent definition's
|
|
102
107
|
* fold (the Task lane folds the definition's `memoryPersistenceCapable` before applying; the workflow lane applies at
|
|
103
108
|
* the launch site AFTER the agentType fold) — so a definition may narrow a parent `true` to `false`, a baseline-pinned
|
|
@@ -18,6 +18,7 @@ export function parentSpecSeatOf(spec, frozenOnQuestion) {
|
|
|
18
18
|
...(spec.additionalReadDirectories !== undefined ? { additionalReadDirectories: Object.freeze([...spec.additionalReadDirectories]) } : {}),
|
|
19
19
|
...(spec.envFacts !== undefined ? { envFacts: Object.freeze({ ...spec.envFacts }) } : {}),
|
|
20
20
|
...(spec.memoryPersistenceCapable !== undefined ? { memoryPersistenceCapable: spec.memoryPersistenceCapable } : {}),
|
|
21
|
+
...(spec.classifyAllShell === true ? { classifyAllShell: true } : {}),
|
|
21
22
|
...(spec.compaction !== undefined ? { compaction: Object.freeze({ ...spec.compaction }) } : {}),
|
|
22
23
|
...(spec.skillListingBudgetFraction !== undefined ? { skillListingBudgetFraction: spec.skillListingBudgetFraction } : {}),
|
|
23
24
|
...(spec.skillListingMaxDescChars !== undefined ? { skillListingMaxDescChars: spec.skillListingMaxDescChars } : {}),
|
|
@@ -54,6 +55,7 @@ export function applyParentSpecSeat(child, seat) {
|
|
|
54
55
|
...fill("advisorModel", seat.advisorModel),
|
|
55
56
|
...fill("attachments", (seat.attachments !== undefined ? { ...seat.attachments } : undefined)),
|
|
56
57
|
...(seat.oneShot === true ? { oneShot: true } : {}),
|
|
58
|
+
...(seat.classifyAllShell === true ? { classifyAllShell: true } : {}),
|
|
57
59
|
...(seat.memoryPersistenceCapable === false ? { memoryPersistenceCapable: false } : fill("memoryPersistenceCapable", seat.memoryPersistenceCapable)),
|
|
58
60
|
};
|
|
59
61
|
return applyClampSeats(landed, clampFieldSeatsOf(seat));
|
|
@@ -81,6 +81,12 @@ function syntheticCheckpoint(scope, fidelity) {
|
|
|
81
81
|
askClass: "denial_limit_fallback",
|
|
82
82
|
classes: ["denial_limit_fallback"],
|
|
83
83
|
engineMounted: true,
|
|
84
|
+
capabilityId: "0123456789abcdef",
|
|
85
|
+
contractId: "core.selfcheck@1",
|
|
86
|
+
shapeDigest: "fedcba9876543210",
|
|
87
|
+
implementationRevision: "1",
|
|
88
|
+
family: "other",
|
|
89
|
+
declarationDigest: "d".repeat(64),
|
|
84
90
|
targets: { protective: "/park-selfcheck/target", declared: null },
|
|
85
91
|
targetReads: { ["0".repeat(64)]: "f".repeat(64) },
|
|
86
92
|
batchToolCallIds: [`${scope}:call`],
|
|
@@ -213,10 +219,11 @@ export async function probeParkRoundTrip(deps, spec = {}) {
|
|
|
213
219
|
return await failed("row_not_faithful", delta);
|
|
214
220
|
if (status !== "pending")
|
|
215
221
|
return await failed("row_not_pending", `the filed row came back with status ${shown(status)} — a park in any other status is one nobody can resolve`);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
{
|
|
223
|
+
const listByScope = store.listByScope;
|
|
224
|
+
if (typeof listByScope !== "function")
|
|
225
|
+
return await failed("row_not_enumerable", "the store implements no listByScope — an inbox enumerating this scope reads nothing");
|
|
226
|
+
const listed = await within(() => listByScope.call(store, scope), "listByScope");
|
|
220
227
|
if ("timedOut" in listed)
|
|
221
228
|
return await failed("row_not_enumerable", listed.timedOut);
|
|
222
229
|
if ("threw" in listed)
|
|
@@ -259,8 +266,7 @@ export async function probeParkRoundTrip(deps, spec = {}) {
|
|
|
259
266
|
: `expire lost an UNCONTENDED CAS and the row reads ${shown(afterStatus)} — the fence that keeps a checkpoint from being both reaped and resumed does not close here`);
|
|
260
267
|
}
|
|
261
268
|
}
|
|
262
|
-
const steps =
|
|
263
|
-
const notExercised = enumerable ? "" : " (this store implements no listByScope, so the inbox enumeration was NOT exercised)";
|
|
269
|
+
const steps = "filed, read back, enumerated and fenced";
|
|
264
270
|
const casNote = fenced ? "" : " (the expire CAS reported a loss while the row closed — consistent with store housekeeping, but a backend that mis-reports CAS wins is not distinguished here)";
|
|
265
271
|
return {
|
|
266
272
|
verdict: "round_trip_ok",
|
|
@@ -268,8 +274,8 @@ export async function probeParkRoundTrip(deps, spec = {}) {
|
|
|
268
274
|
...(fenced ? {} : { casLossObserved: true }),
|
|
269
275
|
scope,
|
|
270
276
|
summary: after === null
|
|
271
|
-
? `the park lane ${steps} a synthetic checkpoint
|
|
272
|
-
: `the park lane ${steps} a synthetic checkpoint
|
|
277
|
+
? `the park lane ${steps} a synthetic checkpoint — the row is no longer present (a deleting backend or its own housekeeping removed it), so nothing resumable remains${casNote}`
|
|
278
|
+
: `the park lane ${steps} a synthetic checkpoint — residual expired row in scope "${scope}"${casNote}`,
|
|
273
279
|
...gapCell,
|
|
274
280
|
};
|
|
275
281
|
}
|
package/dist/core/peer-seat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { StreamableHTTPError } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
1
2
|
import { type CredentialRef } from "@sema-agent/primitives";
|
|
2
|
-
import type
|
|
3
|
+
import { type McpServerSpec, type McpTransportKind } from "./mcp-server-spec.js";
|
|
3
4
|
import type { ProtocolId } from "./protocol-table.js";
|
|
4
5
|
/** Why the seat is asked: the first send of a connection, any later send, or the send after a 401. */
|
|
5
6
|
export type PeerAskCause = "connect" | "request" | "rejected";
|
|
@@ -39,7 +40,7 @@ export interface PeerQuestion {
|
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
41
42
|
* The seat's answer: the pieces to carry (`headers` for an http request and an A2A send, `env` for a stdio child — the member of the
|
|
42
|
-
* other lane is refused; `expiresAt`, epoch
|
|
43
|
+
* other lane is refused; `expiresAt`, a non-negative epoch-millisecond number, is read by a stdio child only; a header value is held to the HTTP request grammar and an env value to what a spawn hands the child unchanged), or that the principal is not authorized here.
|
|
43
44
|
*/
|
|
44
45
|
export type PeerAnswer = {
|
|
45
46
|
readonly kind: "carry";
|
|
@@ -51,10 +52,26 @@ export type PeerAnswer = {
|
|
|
51
52
|
readonly authorizeUrl?: string;
|
|
52
53
|
};
|
|
53
54
|
/**
|
|
54
|
-
* The deployment's peer seat (`RunnerDeps.peerSeat`, TRUSTED)
|
|
55
|
-
*
|
|
55
|
+
* The deployment's peer seat (`RunnerDeps.peerSeat`, TRUSTED): one object, three members, all required.
|
|
56
|
+
* · `answer` — what one send carries. It owes the binding the engine cannot judge: answer only for the reference, principal,
|
|
57
|
+
* protocol and destination (or start command) it was asked about — never one token for every peer.
|
|
58
|
+
* · `hold` / `release` — an engine object started / stopped keeping a declaration that names `ref` (see the module note): called
|
|
59
|
+
* once each per keeper and distinct reference, `release` only for a `hold` that succeeded (it returned, or the promise it returned
|
|
60
|
+
* fulfilled — a release due before then is sent then); the reference is a frozen copy, never a value, never a session. A seat that
|
|
61
|
+
* keeps no state per reference makes both no-ops. A throw or a rejection is reported (`onError`, phase `config`) and changes
|
|
62
|
+
* nothing else: a `hold` that failed is not held and gets no `release`.
|
|
56
63
|
*/
|
|
57
|
-
export
|
|
64
|
+
export interface PeerSeat {
|
|
65
|
+
answer(question: PeerQuestion, signal: AbortSignal): Promise<PeerAnswer>;
|
|
66
|
+
hold(ref: CredentialRef): void;
|
|
67
|
+
release(ref: CredentialRef): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The one reader of a peer seat handed to the engine (`new Runner`, the three library entrances): absent ⇒ `undefined`; else an
|
|
71
|
+
* object whose three members are functions, each read once and kept bound to that object in a frozen copy — or refused
|
|
72
|
+
* (`config.invalid_argument`) naming what does not fit. A function is the form before 7.60.0: refused with the form that replaced it.
|
|
73
|
+
*/
|
|
74
|
+
export declare function receivePeerSeat(raw: unknown, subject: string): PeerSeat | undefined;
|
|
58
75
|
/** Which answer member each transport carries. */
|
|
59
76
|
export declare const PEER_ANSWER_LANES: Readonly<{
|
|
60
77
|
readonly http: "headers";
|
|
@@ -64,11 +81,31 @@ export declare const PEER_ANSWER_LANES: Readonly<{
|
|
|
64
81
|
export type PeerLane = keyof typeof PEER_ANSWER_LANES;
|
|
65
82
|
/** How long one ask may take before the send goes without it (`credential_unavailable`). */
|
|
66
83
|
export declare const PEER_SEAT_WAIT_MS = 30000;
|
|
84
|
+
/** The longest URL an authorization record keeps (the seat's `authorizeUrl`, the endpoint's `resource_metadata`). */
|
|
85
|
+
export declare const AUTHORIZATION_URL_MAX = 2048;
|
|
86
|
+
/**
|
|
87
|
+
* The one URL law of the authorization record (`McpAuthorization`, mcp-failure.ts): an absolute http(s) URL with no user-info, within
|
|
88
|
+
* {@link AUTHORIZATION_URL_MAX} code units, as the URL parser serializes it with every markup-significant character after the host
|
|
89
|
+
* (brackets, parentheses, angle brackets, quotes, backtick, braces, pipe, caret, backslash) percent-encoded — so the text a model or a
|
|
90
|
+
* host renders is one plain link — else
|
|
91
|
+
* `undefined`. A string carrying a control character is refused before parsing (the parser would silently drop a tab or a line break
|
|
92
|
+
* and keep the rest).
|
|
93
|
+
*/
|
|
94
|
+
export declare function authorizationUrlOf(raw: unknown): string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The `Bearer` challenge's auth-params in a `WWW-Authenticate` value (RFC 7235 §4.1: a comma-separated list of challenges, each a
|
|
97
|
+
* scheme and its `name=value` params, a value a token or a quoted string) — names lower-cased, the first of a repeated name kept — or
|
|
98
|
+
* `undefined` when no Bearer challenge is there. A param belongs to the challenge it follows, so `not_error=…`, an `error=` inside a
|
|
99
|
+
* quoted description and another scheme's params are never the Bearer `error`. A malformed character is stepped over.
|
|
100
|
+
*/
|
|
101
|
+
export declare function bearerChallengeParams(header: string | null): ReadonlyMap<string, string> | undefined;
|
|
67
102
|
/** Why a send went without its pieces. */
|
|
68
103
|
export type PeerSeatFailureReason = "threw" | "timed_out" | "answer_invalid" | "unauthorized";
|
|
69
104
|
/**
|
|
70
105
|
* A send the seat did not furnish: nothing was sent. The text names the peer and the reason, never a value and never the seat's own
|
|
71
|
-
* error text (deployment code may put a credential in it); `authorizeUrl` is the seat's own, when it answered `unauthorized
|
|
106
|
+
* error text (deployment code may put a credential in it); `authorizeUrl` is the seat's own, when it answered `unauthorized` (read by
|
|
107
|
+
* {@link authorizationUrlOf}). An MCP failure reads `reason: "unauthorized"` as `unauthorized` (reason `none`), every other reason as
|
|
108
|
+
* `credential_unavailable` (mcp-failure.ts).
|
|
72
109
|
*/
|
|
73
110
|
export declare class PeerSeatFailure extends Error {
|
|
74
111
|
readonly reason: PeerSeatFailureReason;
|
|
@@ -81,6 +118,37 @@ export declare class PeerSeatFailure extends Error {
|
|
|
81
118
|
code?: string;
|
|
82
119
|
});
|
|
83
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* An MCP HTTP request the endpoint refused for its authorization — a 401, or a 403 whose Bearer challenge says `insufficient_scope`
|
|
123
|
+
* (RFC 6750 §3.1) — raised by the one fetch ({@link peerFetch}) in place of the SDK's status error, which keeps no header. It IS the
|
|
124
|
+
* SDK's status error (same class, same `code`), so every structural reader of a status reads it unchanged; it adds what the response
|
|
125
|
+
* said and what the re-ask after a 401 answered:
|
|
126
|
+
* · `reason` — `rejected` (401) or `scope` (403);
|
|
127
|
+
* · `resourceMetadataUrl` — the Bearer challenge's `resource_metadata` ({@link bearerChallengeParams}), the REMOTE's claim, read by
|
|
128
|
+
* {@link authorizationUrlOf};
|
|
129
|
+
* · `authorizeUrl` — the seat's, when it answered the re-ask after a 401 `unauthorized`;
|
|
130
|
+
* · `renewed` — the re-ask after a 401 answered pieces other than the refused send's: a credential this server has not refused yet
|
|
131
|
+
* exists, and a new send carries it (the call layer sends a repeat-safe call again on it). It is NOT "the user owes nothing": a seat
|
|
132
|
+
* that mints a fresh assertion on every ask renews every time, so only a refusal of the credential it renewed to says more.
|
|
133
|
+
* The text is the engine's sentence followed by the response body as the SDK's own error would have carried it (bounded to
|
|
134
|
+
* {@link REFUSAL_BODY_MAX} characters) — REMOTE text, read by every face through the one remote-words reading like any status body.
|
|
135
|
+
*/
|
|
136
|
+
export declare class PeerAuthorizationRefused extends StreamableHTTPError {
|
|
137
|
+
readonly reason: "rejected" | "scope";
|
|
138
|
+
readonly resourceMetadataUrl: string | undefined;
|
|
139
|
+
readonly authorizeUrl: string | undefined;
|
|
140
|
+
readonly renewed: boolean;
|
|
141
|
+
constructor(reason: "rejected" | "scope", facts: {
|
|
142
|
+
resourceMetadataUrl?: string;
|
|
143
|
+
authorizeUrl?: string;
|
|
144
|
+
renewed?: boolean;
|
|
145
|
+
body?: string;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** How much of a refusal's response body its text keeps. */
|
|
149
|
+
export declare const REFUSAL_BODY_MAX = 4096;
|
|
150
|
+
/** Whether a failure is an authorization refusal after which the deployment furnished a fresh credential ({@link PeerAuthorizationRefused.renewed}). */
|
|
151
|
+
export declare function refusedThenRenewed(err: unknown): boolean;
|
|
84
152
|
/** What one send carries, as the engine took it from an answer, and its digest (whether a re-ask changed anything). */
|
|
85
153
|
export interface CarriedPieces {
|
|
86
154
|
readonly headers?: Readonly<Record<string, string>>;
|
|
@@ -88,7 +156,9 @@ export interface CarriedPieces {
|
|
|
88
156
|
readonly expiresAt?: number;
|
|
89
157
|
readonly digest: string;
|
|
90
158
|
}
|
|
91
|
-
/** The seat's answer for `lane`, read once: the pieces, the `unauthorized` answer, or the problem (which member did not fit).
|
|
159
|
+
/** The seat's answer for `lane`, read once: the pieces, the `unauthorized` answer, or the problem (which member did not fit). The
|
|
160
|
+
* answer's members are its OWN members (a member its prototype would supply is not read), and each value is judged by the grammar of
|
|
161
|
+
* the send that will carry it ({@link VALUE_LAW}). */
|
|
92
162
|
export declare function readPeerAnswer(raw: unknown, lane: PeerLane): {
|
|
93
163
|
readonly carry: CarriedPieces;
|
|
94
164
|
} | {
|
|
@@ -98,6 +168,29 @@ export declare function readPeerAnswer(raw: unknown, lane: PeerLane): {
|
|
|
98
168
|
} | {
|
|
99
169
|
readonly problem: string;
|
|
100
170
|
};
|
|
171
|
+
/** Declarations as a keeper holds them: a spec's (or a spec snapshot's) `mcp` and `a2a` lists, read as given. */
|
|
172
|
+
export interface PeerDeclarations {
|
|
173
|
+
readonly mcp?: unknown;
|
|
174
|
+
readonly a2a?: unknown;
|
|
175
|
+
}
|
|
176
|
+
/** One keeper's hold on the references its declarations name (see the module note), taken when it is made. */
|
|
177
|
+
export interface PeerDeclarationHold {
|
|
178
|
+
/** Release every reference this keeper holds, each once. A second call does nothing. */
|
|
179
|
+
release(): void;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A keeper's hold: `seat.hold` once for each distinct reference (by its canonical form) `declared` names, now, and one `seat.release`
|
|
183
|
+
* for each hold that succeeded, at `release`. A hold succeeds when it returns — or, when it returns a promise, when that promise
|
|
184
|
+
* fulfils (a release asked for before then is sent then). No seat ⇒ nothing is held (a declared reference is refused at the door). A
|
|
185
|
+
* seat member that throws or whose promise rejects reaches `onFault` as the engine's own sentence (the seat's error is not repeated:
|
|
186
|
+
* deployment code may put a value in it); a hold that failed is not held and gets no release.
|
|
187
|
+
*/
|
|
188
|
+
export declare function holdPeerDeclarations(seat: PeerSeat | undefined, declared: PeerDeclarations, onFault: (err: Error) => void): PeerDeclarationHold;
|
|
189
|
+
/** What the re-ask after a 401 said: whether it answered other pieces than the refused send carried, and the seat's `authorizeUrl` when it answered `unauthorized`. */
|
|
190
|
+
export interface PeerReask {
|
|
191
|
+
readonly renewed: boolean;
|
|
192
|
+
readonly authorizeUrl?: string;
|
|
193
|
+
}
|
|
101
194
|
/**
|
|
102
195
|
* One connection's (or one A2A peer's) asks of the seat. `next` answers each send: a 401's re-ask answer when one is waiting (carried
|
|
103
196
|
* once), else the seat's answer to this send. `rejected` is the one re-ask after a 401 (concurrent rejections share it); `renewed` says
|
|
@@ -110,13 +203,17 @@ export declare class PeerCarrier {
|
|
|
110
203
|
private readonly principal;
|
|
111
204
|
private readonly lane;
|
|
112
205
|
readonly sent: string[];
|
|
206
|
+
/** Every credential value the seat's answers handed this connection, accepted or refused ({@link answeredCredentialValues}), that the
|
|
207
|
+
* withheld table holds (one that names a secret, `namesASecret`: never a blank one, a placeholder or a short dev key) — the needle a
|
|
208
|
+
* remote's account of itself is read without. */
|
|
209
|
+
readonly credentials: string[];
|
|
113
210
|
/** When the pieces a stdio child was started with stop being good; `undefined` when the answer said nothing. */
|
|
114
211
|
expiresAt: number | undefined;
|
|
115
212
|
renewed: boolean;
|
|
116
213
|
private asked;
|
|
117
214
|
private waiting;
|
|
118
215
|
private rejection;
|
|
119
|
-
constructor(seat: PeerSeat | undefined, identity:
|
|
216
|
+
constructor(seat: PeerSeat | undefined, identity: PeerCarrierIdentity, principal: string | undefined, lane: PeerLane, principalSent: boolean);
|
|
120
217
|
/** The peer as the refusal sentences name it. */
|
|
121
218
|
get label(): string;
|
|
122
219
|
/** The pieces the next send carries (see the class note). A seat failure throws {@link PeerSeatFailure}. */
|
|
@@ -124,11 +221,21 @@ export declare class PeerCarrier {
|
|
|
124
221
|
/** The pieces the latest send carried (`undefined` before the first). */
|
|
125
222
|
last: CarriedPieces | undefined;
|
|
126
223
|
/** A send that carried `carried` was answered 401: ask once more (`rejected`); the next send carries that answer. Never throws —
|
|
127
|
-
* a re-ask that fails leaves `renewed` false, so the 401 is the call's answer, and the next send asks afresh.
|
|
128
|
-
|
|
224
|
+
* a re-ask that fails leaves `renewed` false, so the 401 is the call's answer, and the next send asks afresh. Resolves to what the
|
|
225
|
+
* re-ask said (concurrent rejections share one flight and its answer): whether it renewed, and the seat's `authorizeUrl` when it
|
|
226
|
+
* answered `unauthorized`. */
|
|
227
|
+
rejected(carried: CarriedPieces, signal?: AbortSignal, destination?: string): Promise<PeerReask>;
|
|
129
228
|
/** Whether the pieces a stdio child was started with have stopped being good. */
|
|
130
229
|
expired(now?: number): boolean;
|
|
131
230
|
private ask;
|
|
231
|
+
/**
|
|
232
|
+
* THE one intake of a seat's answer: every credential value it hands ({@link answeredCredentialValues}) is a value the engine now
|
|
233
|
+
* holds — no child spawned on this host inherits a variable holding it — and a credential of this connection's sends
|
|
234
|
+
* ({@link PeerCarrier.credentials}). Asked of the answer as given, before it is judged, and of the judge's copy of an accepted answer
|
|
235
|
+
* (the pieces that are sent). Each value is held on its own, so one that cannot be withheld (the value of a variable every child is
|
|
236
|
+
* handed) does not keep the others out; the answer is then refused, after the rest were held.
|
|
237
|
+
*/
|
|
238
|
+
private holdAnswered;
|
|
132
239
|
private remember;
|
|
133
240
|
}
|
|
134
241
|
/**
|
|
@@ -140,7 +247,9 @@ export declare function carriedHttpHeaders(protocol: ProtocolId, carrier: PeerCa
|
|
|
140
247
|
/**
|
|
141
248
|
* The MCP HTTP transport's `fetch` under the seat: every request the transport makes (the POST, the SSE GET, the DELETE) asks the
|
|
142
249
|
* carrier first, carries what it answered, goes only to the endpoint the declaration named (no redirect is followed — a 3xx is the
|
|
143
|
-
* answer) and, answered 401, has the carrier ask once more for the next send.
|
|
250
|
+
* answer) and, answered 401, has the carrier ask once more for the next send. A refusal of the authorization — 401, or 403 whose
|
|
251
|
+
* challenge says `insufficient_scope` — is raised here as {@link PeerAuthorizationRefused} carrying the challenge, the re-ask's answer
|
|
252
|
+
* and the bounded body (the SDK would raise its status error from the same response with no header kept).
|
|
144
253
|
*/
|
|
145
254
|
export declare function peerFetch(carrier: PeerCarrier, principalHeader: string | undefined, principal: string | undefined): typeof fetch;
|
|
146
255
|
/** The member of a declaration that would carry a value (retired: values come from the seat). */
|
|
@@ -165,8 +274,15 @@ export declare function declaredCredentials(copy: object, at: keyof typeof CREDE
|
|
|
165
274
|
export declare function peerSeatMissing(subject: string, credentials: CredentialRef | undefined, seat: PeerSeat | undefined): (Error & {
|
|
166
275
|
code: string;
|
|
167
276
|
}) | undefined;
|
|
277
|
+
/** A carrier's identity: the peer the seat is asked about, or a server on a host-supplied transport — whose host seat carries its own
|
|
278
|
+
* pieces, so the peer seat is never asked about it (its carrier carries nothing). */
|
|
279
|
+
export type PeerCarrierIdentity = PeerSeatTarget | {
|
|
280
|
+
readonly protocol: "mcp";
|
|
281
|
+
readonly server: string;
|
|
282
|
+
readonly transport: "host";
|
|
283
|
+
};
|
|
168
284
|
/** Who an MCP server is, as the seat is asked about it: its name, the whole start command or endpoint, its reference, its mount identity. */
|
|
169
|
-
export declare function mcpPeerTarget(spec: McpServerSpec, kind:
|
|
285
|
+
export declare function mcpPeerTarget(spec: McpServerSpec, kind: McpTransportKind | undefined): PeerCarrierIdentity;
|
|
170
286
|
/** Whether a failure is the HTTP endpoint answering 401 (the SDK's status error, on the thrown value or its cause chain). Structure only. */
|
|
171
287
|
export declare function answeredUnauthorized(err: unknown): boolean;
|
|
172
288
|
/** A call answered 401 after which the seat's re-ask answered other pieces: its failure as it would have been thrown then. */
|
|
@@ -175,11 +291,12 @@ export declare class Reauthorized {
|
|
|
175
291
|
constructor(error: unknown);
|
|
176
292
|
}
|
|
177
293
|
/**
|
|
178
|
-
* The call layer's one re-send after a 401: `attempt` once; when it answers {@link Reauthorized} and `mayResend`
|
|
179
|
-
* (the revocation probe and `reach`, asked again) holds, once more, carrying what the re-ask answered
|
|
180
|
-
*
|
|
294
|
+
* The call layer's one re-send after a 401: `attempt(false)` once; when it answers {@link Reauthorized} and `mayResend`
|
|
295
|
+
* (the revocation probe and `reach`, asked again) holds, `attempt(true)` once more, carrying what the re-ask answered — the flag says
|
|
296
|
+
* whether this is the last attempt (its refusal is the call's answer). A re-send the seat could not furnish ends with the first
|
|
297
|
+
* attempt's failure, whose delivery verdict stands for the call (one of its attempts was sent).
|
|
181
298
|
*/
|
|
182
|
-
export declare function sentOnceMore<R>(attempt: () => Promise<R | Reauthorized>, mayResend: () => boolean): Promise<R>;
|
|
299
|
+
export declare function sentOnceMore<R>(attempt: (last: boolean) => Promise<R | Reauthorized>, mayResend: () => boolean): Promise<R>;
|
|
183
300
|
export declare function inFlight<T>(client: object, run: () => Promise<T>): Promise<T>;
|
|
184
301
|
export declare function settledInFlight(client: object): Promise<void>;
|
|
185
302
|
export declare function recordCarrier(client: object, carrier: PeerCarrier): void;
|