@sema-agent/core 7.51.2 → 7.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const ROUTE_ADJUDICATION_CONFORMANCE_CORPUS = [
|
|
2
2
|
{
|
|
3
3
|
name: "per-model-on-root",
|
|
4
|
-
intent: "a per-model credential
|
|
4
|
+
intent: "a per-model credential not bound yet is servable, on the deployment root",
|
|
5
5
|
model: { id: "m-main", baseUrl: "https://gw.example.com" },
|
|
6
6
|
credential: { source: "per-model", apiKey: "k-main" },
|
|
7
7
|
config: { baseUrl: "https://gw.example.com" },
|
|
@@ -9,7 +9,7 @@ export const ROUTE_ADJUDICATION_CONFORMANCE_CORPUS = [
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
name: "per-model-off-root",
|
|
12
|
-
intent: "a per-model credential
|
|
12
|
+
intent: "a per-model credential not bound yet is servable off the deployment root too (the resolver was asked about THIS entry)",
|
|
13
13
|
model: { id: "m-third", baseUrl: "https://third-party.example.net/v1" },
|
|
14
14
|
credential: { source: "per-model", apiKey: "k-third" },
|
|
15
15
|
config: { baseUrl: "https://gw.example.com" },
|
package/dist/brain/routing.d.ts
CHANGED
|
@@ -5,9 +5,31 @@ export interface RoutingBrainOptions {
|
|
|
5
5
|
/** Brain used when no route matches. If omitted, an unmatched model yields an error. */
|
|
6
6
|
fallback?: Brain;
|
|
7
7
|
}
|
|
8
|
+
/** The two `Model` fields a route can be named by — a catalog entry that carries only a provider word is as good a subject as a whole `Model`. */
|
|
9
|
+
type RouteWords = {
|
|
10
|
+
readonly provider?: string | undefined;
|
|
11
|
+
readonly api?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* THE judge of which line serves a model: the model's route word (`provider`, or `api` when `by` says so) IF the route table
|
|
15
|
+
* has an OWN route under that word, else `undefined` — the fallback (the deployment's gateway) serves it. A word the model
|
|
16
|
+
* carries without a route, and a model with no string word at all, both answer `undefined`: a route that is not mounted is
|
|
17
|
+
* not a line, whatever the model says.
|
|
18
|
+
*
|
|
19
|
+
* `routes` is the route TABLE itself — the very object a host hands {@link createRoutingBrain}, which asks this function for
|
|
20
|
+
* every request — so the judge and the router answer from one reading of one table, whatever its shape. The question is
|
|
21
|
+
* `Object.hasOwn(routes, word)`: it evaluates no entry and lists no keys, so a non-enumerable own route is a route, a lazily
|
|
22
|
+
* keyed table is asked about the one name it is asked about, and a name the table only inherits (`constructor`, `__proto__`)
|
|
23
|
+
* is not a route. The judge never reads a route's value: a route mounted under the word IS the line, and when its value is not
|
|
24
|
+
* a brain the router fails that request on that line (an error terminal naming the route) rather than moving it to the
|
|
25
|
+
* fallback — so the line this answers is the line the request was sent to, either way. A table that cannot answer the question
|
|
26
|
+
* (it is not an object, or its trap throws) throws here, and the router fails the request with an error terminal.
|
|
27
|
+
*/
|
|
28
|
+
export declare function brainLaneOf(model: RouteWords, routes: Readonly<Record<string, unknown>>, by?: NonNullable<RoutingBrainOptions["by"]>): string | undefined;
|
|
8
29
|
/**
|
|
9
30
|
* Route to different brains by a Model field (default `model.provider`). Lets one Runner serve
|
|
10
|
-
* multiple providers/gateways; compose with `createFailoverBrain` for per-route failover.
|
|
31
|
+
* multiple providers/gateways; compose with `createFailoverBrain` for per-route failover. Which route serves a
|
|
32
|
+
* model is {@link brainLaneOf}'s answer.
|
|
11
33
|
*
|
|
12
34
|
* @example
|
|
13
35
|
* createRoutingBrain({
|
|
@@ -16,3 +38,4 @@ export interface RoutingBrainOptions {
|
|
|
16
38
|
* }, { fallback: createOpenAIBrain({ baseUrl: VLLM }) });
|
|
17
39
|
*/
|
|
18
40
|
export declare function createRoutingBrain(routes: Record<string, Brain>, opts?: RoutingBrainOptions): Brain;
|
|
41
|
+
export {};
|
package/dist/brain/routing.js
CHANGED
|
@@ -1,42 +1,77 @@
|
|
|
1
1
|
import { createAssistantMessageEventStream, } from "../internal/llm.js";
|
|
2
2
|
import { ZERO_USAGE } from "./errors.js";
|
|
3
|
-
function errorMessage(
|
|
3
|
+
function errorMessage(who, text) {
|
|
4
4
|
return {
|
|
5
5
|
role: "assistant",
|
|
6
6
|
content: [{ type: "text", text: "" }],
|
|
7
|
-
api:
|
|
8
|
-
provider:
|
|
9
|
-
model:
|
|
7
|
+
api: who.api,
|
|
8
|
+
provider: who.provider,
|
|
9
|
+
model: who.id,
|
|
10
10
|
stopReason: "error",
|
|
11
11
|
errorMessage: text,
|
|
12
12
|
usage: ZERO_USAGE,
|
|
13
13
|
timestamp: Date.now(),
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
const BLANK_IDENTITY = { api: "", provider: "", id: "" };
|
|
17
|
+
function spelled(word) {
|
|
18
|
+
return (typeof word === "object" && word !== null) || typeof word === "function" ? `[${typeof word}]` : String(word);
|
|
19
|
+
}
|
|
20
|
+
function routeKeyOf(model, by) {
|
|
21
|
+
return by === "api" ? model.api : model.provider;
|
|
22
|
+
}
|
|
23
|
+
function isBrain(value) {
|
|
24
|
+
return value !== null && typeof value === "object" && typeof value.stream === "function";
|
|
25
|
+
}
|
|
26
|
+
export function brainLaneOf(model, routes, by = "provider") {
|
|
27
|
+
const word = routeKeyOf(model, by);
|
|
28
|
+
return typeof word === "string" && Object.hasOwn(routes, word) ? word : undefined;
|
|
29
|
+
}
|
|
16
30
|
export function createRoutingBrain(routes, opts = {}) {
|
|
17
31
|
const by = opts.by ?? "provider";
|
|
18
32
|
const resolveTarget = (model) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return matched ?? opts.fallback;
|
|
33
|
+
const lane = brainLaneOf(model, routes, by);
|
|
34
|
+
if (lane === undefined)
|
|
35
|
+
return { target: opts.fallback };
|
|
36
|
+
const routed = routes[lane];
|
|
37
|
+
return isBrain(routed) ? { target: routed } : { broken: `route ${by}="${lane}" is mounted but its value is not a brain` };
|
|
25
38
|
};
|
|
26
39
|
const stream = (model, context, options) => {
|
|
27
|
-
const
|
|
28
|
-
const target = resolveTarget(model);
|
|
29
|
-
if (!target) {
|
|
40
|
+
const reject = (text, named) => {
|
|
30
41
|
const out = createAssistantMessageEventStream();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
reason: "error",
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
try {
|
|
43
|
+
const wordOf = (field) => (field === by && named !== undefined ? named.value : model[field]);
|
|
44
|
+
out.push({ type: "error", reason: "error", error: errorMessage({ api: wordOf("api"), provider: wordOf("provider"), id: wordOf("id") }, text) });
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
out.push({ type: "error", reason: "error", error: errorMessage(BLANK_IDENTITY, `${text} (the model's own words could not be read either)`) });
|
|
48
|
+
}
|
|
36
49
|
return out;
|
|
50
|
+
};
|
|
51
|
+
let word;
|
|
52
|
+
try {
|
|
53
|
+
word = { value: routeKeyOf(model, by) };
|
|
37
54
|
}
|
|
55
|
+
catch {
|
|
56
|
+
return reject(`createRoutingBrain: the model's ${by} could not be read`);
|
|
57
|
+
}
|
|
58
|
+
const named = word.value;
|
|
59
|
+
const asked = { api: named, provider: named };
|
|
60
|
+
let resolved;
|
|
61
|
+
try {
|
|
62
|
+
resolved = resolveTarget(asked);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return reject(`createRoutingBrain: the route table threw while ${by}="${spelled(named)}" was looked up`, word);
|
|
66
|
+
}
|
|
67
|
+
const target = "target" in resolved ? resolved.target : undefined;
|
|
68
|
+
if (!target)
|
|
69
|
+
return reject("broken" in resolved ? `createRoutingBrain: ${resolved.broken}` : `createRoutingBrain: no brain for ${by}="${spelled(named)}"`, word);
|
|
38
70
|
return target.stream(model, context, options);
|
|
39
71
|
};
|
|
40
|
-
const adjudicateRoute = (model, perModelAuth) =>
|
|
72
|
+
const adjudicateRoute = (model, perModelAuth) => {
|
|
73
|
+
const resolved = resolveTarget(model);
|
|
74
|
+
return "target" in resolved ? resolved.target?.adjudicateRoute?.(model, perModelAuth) : undefined;
|
|
75
|
+
};
|
|
41
76
|
return { stream, adjudicateRoute };
|
|
42
77
|
}
|
|
@@ -150,3 +150,21 @@ export declare function runWithExtraBodyDropped<T>(observe: (r: ExtraBodyDropped
|
|
|
150
150
|
/** Report the strip of the request the engine has SELECTED to send, to the active per-run sink, if any (called at the
|
|
151
151
|
* engine's commit points, never from `buildRequest`, which is also built speculatively). */
|
|
152
152
|
export declare function reportExtraBodyDropped(report: ExtraBodyDroppedReport): void;
|
|
153
|
+
/** A request refused because the per-model credential it would carry is bound to another origin: the catalog id it was
|
|
154
|
+
* for and the two origins, each in its DISPLAY spelling. Never a value, never a digest of one. */
|
|
155
|
+
export interface CredentialOriginRefusalReport {
|
|
156
|
+
modelId: string;
|
|
157
|
+
boundOrigin: string;
|
|
158
|
+
requestOrigin: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Run `fn` with a per-run credential-origin refusal sink in scope — the FIFTH brain→runner ALS channel, with the fourth's
|
|
162
|
+
* shape and for its reasons: the WHOLE leg (a refused compaction summary, side query or classifier call is refused for the
|
|
163
|
+
* same reason as a turn), not shielded around the leg's internal calls, not revoked on settlement, no-op outside the scope.
|
|
164
|
+
* The refusal is already decided when it is reported.
|
|
165
|
+
*/
|
|
166
|
+
export declare function runWithCredentialOriginRefusals<T>(observe: (r: CredentialOriginRefusalReport) => void, fn: () => Promise<T>): Promise<T>;
|
|
167
|
+
/** Report a credential-origin refusal to the active per-run sink, if any (called by the request gate's refusal,
|
|
168
|
+
* `routeRefusalError`; a judgment that only advises reports nothing). The
|
|
169
|
+
* observer is the Runner's own seat, whose one delivery is the guarded `deliverEngineNotice` — nothing is swallowed here. */
|
|
170
|
+
export declare function reportCredentialOriginRefusal(report: CredentialOriginRefusalReport): void;
|
|
@@ -68,3 +68,10 @@ export function reportExtraBodyDropped(report) {
|
|
|
68
68
|
catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
const credentialOriginRefusalSinkStore = new AsyncLocalStorage();
|
|
72
|
+
export function runWithCredentialOriginRefusals(observe, fn) {
|
|
73
|
+
return credentialOriginRefusalSinkStore.run({ observe }, fn);
|
|
74
|
+
}
|
|
75
|
+
export function reportCredentialOriginRefusal(report) {
|
|
76
|
+
credentialOriginRefusalSinkStore.getStore()?.observe(report);
|
|
77
|
+
}
|
package/dist/brain/timeout.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { describeRejectedValue } from "../core/tool-search-setting.js";
|
|
1
2
|
export const MAX_TIMER_DELAY_MS = 2_147_483_647;
|
|
2
3
|
export function resolveStallTimeoutMs(value, knob) {
|
|
3
4
|
if (value === undefined)
|
|
4
5
|
return undefined;
|
|
5
6
|
if (!Number.isFinite(value) || value < 0) {
|
|
6
|
-
const e = new Error(`${knob} must be a non-negative finite number of milliseconds (got ${
|
|
7
|
+
const e = new Error(`${knob} must be a non-negative finite number of milliseconds (got ${describeRejectedValue(value)})`);
|
|
7
8
|
e.code = "config.stall_timeout_invalid";
|
|
8
9
|
throw e;
|
|
9
10
|
}
|
|
10
11
|
if (value > MAX_TIMER_DELAY_MS) {
|
|
11
|
-
const e = new Error(`${knob} must not exceed ${MAX_TIMER_DELAY_MS}ms (~24.8 days) — a host timer truncates a larger delay and fires immediately, so this watchdog would abort every call instead of tolerating a long one (got ${
|
|
12
|
+
const e = new Error(`${knob} must not exceed ${MAX_TIMER_DELAY_MS}ms (~24.8 days) — a host timer truncates a larger delay and fires immediately, so this watchdog would abort every call instead of tolerating a long one (got ${describeRejectedValue(value)}). Pass 0 to disable it.`);
|
|
12
13
|
e.code = "config.stall_timeout_invalid";
|
|
13
14
|
throw e;
|
|
14
15
|
}
|
|
@@ -112,12 +113,12 @@ export function resolveBrainCallGuardrailMs(knob) {
|
|
|
112
113
|
if (knob === false || knob === 0)
|
|
113
114
|
return undefined;
|
|
114
115
|
if (typeof knob !== "number" || !Number.isFinite(knob) || knob < 0) {
|
|
115
|
-
const e = new Error(`brainCallGuardrailMs must be a positive number of milliseconds, 0, or false (got ${
|
|
116
|
+
const e = new Error(`brainCallGuardrailMs must be a positive number of milliseconds, 0, or false (got ${describeRejectedValue(knob)})`);
|
|
116
117
|
e.code = "config.brain_call_guardrail_invalid";
|
|
117
118
|
throw e;
|
|
118
119
|
}
|
|
119
120
|
if (knob > MAX_TIMER_DELAY_MS) {
|
|
120
|
-
const e = new Error(`brainCallGuardrailMs must not exceed ${MAX_TIMER_DELAY_MS}ms (~24.8 days) — a host timer truncates a larger delay and fires immediately, so the backstop would abort every model call (got ${
|
|
121
|
+
const e = new Error(`brainCallGuardrailMs must not exceed ${MAX_TIMER_DELAY_MS}ms (~24.8 days) — a host timer truncates a larger delay and fires immediately, so the backstop would abort every model call (got ${describeRejectedValue(knob)}). Pass false or 0 to turn the backstop off.`);
|
|
121
122
|
e.code = "config.brain_call_guardrail_invalid";
|
|
122
123
|
throw e;
|
|
123
124
|
}
|
package/dist/core/a2a.d.ts
CHANGED
|
@@ -69,8 +69,11 @@ export interface MaterializedA2a {
|
|
|
69
69
|
/** One entry per DECLARED peer, in declaration order, ready or failed — the declaration as this materialization read it once. */
|
|
70
70
|
statuses: A2aPeerStatus[];
|
|
71
71
|
/** Re-read one peer's card (or every declared peer) and re-derive its tools. Unlike the MCP refresh
|
|
72
|
-
* this dials nothing new — every A2A call is a fresh request anyway — so a peer
|
|
73
|
-
* prepare time can genuinely recover here.
|
|
72
|
+
* this dials nothing new — every A2A call is a fresh request anyway — so a peer whose card or network
|
|
73
|
+
* failed at prepare time can genuinely recover here. The DECLARATION is not re-read: a refresh works
|
|
74
|
+
* from the copy this materialization took and judged — the members too (`headers`, `allowSkills`,
|
|
75
|
+
* `toolAxes` are copied, not shared) — so a declaration refused then is refused again and a caller
|
|
76
|
+
* rewriting its object afterwards, by replacing a member or by editing one in place, changes nothing. */
|
|
74
77
|
refresh: (peer?: string) => Promise<A2aRefreshResult[]>;
|
|
75
78
|
/**
|
|
76
79
|
* Task teardown. There is no socket to close (every call is its own request), so what this owns is the
|
package/dist/core/a2a.js
CHANGED
|
@@ -5,6 +5,7 @@ import { assertEndpointBound, redirectPolicy, resolveProtocolHttpHeaders, underD
|
|
|
5
5
|
import { describeHttpTransportFailure } from "./mcp-failure.js";
|
|
6
6
|
import { findNamespacePrefixCollision, mintNamespacePrefix, mintNamespacedToolName } from "./protocol-naming.js";
|
|
7
7
|
import { A2A_NAMESPACE } from "./protocol-table.js";
|
|
8
|
+
import { judgeEntryToolAxes, refusedDeclarer, snapshotDeclaredEntry } from "./locked-config.js";
|
|
8
9
|
import { delimitUntrusted, inlineUntrusted } from "./untrusted-text.js";
|
|
9
10
|
import { thrownText } from "./thrown-value.js";
|
|
10
11
|
const A2A_REQUEST_TIMEOUT_MS = 30_000;
|
|
@@ -540,25 +541,39 @@ function buildSkillTool(spec, t, skill, lifecycle) {
|
|
|
540
541
|
},
|
|
541
542
|
};
|
|
542
543
|
}
|
|
543
|
-
|
|
544
|
-
|
|
544
|
+
function declaredPeerOf(declared, index) {
|
|
545
|
+
let snapshot;
|
|
546
|
+
try {
|
|
547
|
+
snapshot = snapshotDeclaredEntry(declared, "a2a");
|
|
548
|
+
}
|
|
549
|
+
catch (err) {
|
|
550
|
+
return { spec: { name: refusedDeclarer(err) ?? `(peer #${index + 1}, name unreadable)` }, refusal: err };
|
|
551
|
+
}
|
|
552
|
+
const judged = judgeEntryToolAxes(snapshot, "a2a");
|
|
553
|
+
return judged.ok ? { spec: judged.entry } : { spec: snapshot, refusal: judged.error };
|
|
554
|
+
}
|
|
555
|
+
async function materializePeer(peer, principal, lifecycle, signal) {
|
|
556
|
+
if ("refusal" in peer)
|
|
557
|
+
throw peer.refusal;
|
|
558
|
+
const { spec } = peer;
|
|
559
|
+
const declaredAxes = spec.toolAxes;
|
|
545
560
|
const headers = resolveProtocolHttpHeaders(A2A_NAMESPACE.id, spec, principal);
|
|
546
561
|
const discovery = { peer: spec.name, endpoint: spec.url, headers };
|
|
547
562
|
const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url);
|
|
548
563
|
assertEndpointBound(A2A_NAMESPACE.id, spec.name, card.endpoint, spec.cardUrl === undefined ? [spec.url] : [spec.url, spec.cardUrl], headers);
|
|
549
564
|
const transport = { peer: spec.name, endpoint: card.endpoint, headers };
|
|
550
565
|
const tools = [];
|
|
551
|
-
const
|
|
566
|
+
const skillAxes = [];
|
|
552
567
|
for (const skill of card.skills) {
|
|
553
568
|
if (spec.allowSkills !== undefined && !spec.allowSkills.includes(skill.id))
|
|
554
569
|
continue;
|
|
555
570
|
const tool = buildSkillTool(spec, transport, skill, lifecycle);
|
|
556
571
|
tools.push(tool);
|
|
557
|
-
|
|
572
|
+
skillAxes.push(a2aAxisFor(tool.name, declaredAxes?.[skill.id]));
|
|
558
573
|
}
|
|
559
574
|
return {
|
|
560
575
|
tools,
|
|
561
|
-
axes,
|
|
576
|
+
axes: skillAxes,
|
|
562
577
|
status: {
|
|
563
578
|
name: spec.name,
|
|
564
579
|
status: "ready",
|
|
@@ -576,8 +591,9 @@ function asPeerWarning(spec, err) {
|
|
|
576
591
|
return warning;
|
|
577
592
|
}
|
|
578
593
|
export async function materializeA2aTools(specs, principal, signal) {
|
|
579
|
-
|
|
580
|
-
|
|
594
|
+
const peers = specs.map((spec, index) => declaredPeerOf(spec, index));
|
|
595
|
+
if (peers.length > 0) {
|
|
596
|
+
const collision = findNamespacePrefixCollision(A2A_NAMESPACE, peers.map((p) => p.spec.name));
|
|
581
597
|
if (collision) {
|
|
582
598
|
const [a, b] = collision.peers;
|
|
583
599
|
const e = new Error(a === b
|
|
@@ -592,9 +608,9 @@ export async function materializeA2aTools(specs, principal, signal) {
|
|
|
592
608
|
const toolAxes = [];
|
|
593
609
|
const warnings = [];
|
|
594
610
|
const statuses = [];
|
|
595
|
-
const settled = await Promise.allSettled(
|
|
596
|
-
for (let i = 0; i <
|
|
597
|
-
const spec =
|
|
611
|
+
const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal)));
|
|
612
|
+
for (let i = 0; i < peers.length; i++) {
|
|
613
|
+
const spec = peers[i].spec;
|
|
598
614
|
const outcome = settled[i];
|
|
599
615
|
if (outcome.status === "fulfilled") {
|
|
600
616
|
tools.push(...outcome.value.tools);
|
|
@@ -613,12 +629,13 @@ export async function materializeA2aTools(specs, principal, signal) {
|
|
|
613
629
|
statuses,
|
|
614
630
|
refresh: async (peer) => {
|
|
615
631
|
const prefixOf = (name) => mintNamespacePrefix(A2A_NAMESPACE, name);
|
|
616
|
-
const targets = peer !== undefined ?
|
|
632
|
+
const targets = peer !== undefined ? peers.filter((p) => p.spec.name === peer) : peers;
|
|
617
633
|
if (peer !== undefined && targets.length === 0) {
|
|
618
634
|
return [{ peer, prefix: prefixOf(peer), status: "failed", toolCount: 0, added: [], removed: [], error: "no peer of that name is declared for this task" }];
|
|
619
635
|
}
|
|
620
636
|
const results = [];
|
|
621
|
-
for (const
|
|
637
|
+
for (const target of targets) {
|
|
638
|
+
const { spec } = target;
|
|
622
639
|
const prefix = prefixOf(spec.name);
|
|
623
640
|
if (lifecycle.disposed) {
|
|
624
641
|
results.push({ peer: spec.name, prefix, status: "disposed", toolCount: 0, added: [], removed: [] });
|
|
@@ -626,7 +643,7 @@ export async function materializeA2aTools(specs, principal, signal) {
|
|
|
626
643
|
}
|
|
627
644
|
const previous = statuses.find((s) => s.name === spec.name)?.toolNames ?? [];
|
|
628
645
|
try {
|
|
629
|
-
const fresh = await materializePeer(
|
|
646
|
+
const fresh = await materializePeer(target, principal, lifecycle, signal);
|
|
630
647
|
const names = fresh.tools.map((t) => t.name);
|
|
631
648
|
results.push({
|
|
632
649
|
peer: spec.name,
|
|
@@ -8,8 +8,9 @@ import { type EngineNotice } from "./engine-notice.js";
|
|
|
8
8
|
/** Why an entry grants (or refuses) nothing — the closed set the start-of-run notice names, for every list. `tool_name`: the
|
|
9
9
|
* entry's tool name is one the name judgment reads as stale against the run's roster (`verdict` says which); `near_miss`: the
|
|
10
10
|
* run mounts no tool of that exact name but mounts one that differs only by case (`currentName` is its spelling);
|
|
11
|
-
* `earlier_grammar`: a session's stored rules are written in an earlier rule grammar, in which the entry named no tool
|
|
12
|
-
* session store's list reading, `compileSessionRuleBucket` — this reader never
|
|
11
|
+
* `earlier_grammar`: a session's stored rules are written in an earlier rule grammar, in which the entry named no tool, or which
|
|
12
|
+
* read an entry this grammar reads as no rule (the session store's list reading, `compileSessionRuleBucket` — this reader never
|
|
13
|
+
* answers it). */
|
|
13
14
|
export declare const ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"];
|
|
14
15
|
export type AllowEntryInertReason = (typeof ALLOW_ENTRY_INERT_REASONS)[number];
|
|
15
16
|
/** The facts beside a reason: for `tool_name` / `near_miss` the judgment's word, the judgment's own one-line sentence when it has
|
|
@@ -21,7 +22,13 @@ export interface AllowEntryInertDetail {
|
|
|
21
22
|
readonly guidance?: string;
|
|
22
23
|
readonly currentName?: string;
|
|
23
24
|
readonly valueType?: string;
|
|
25
|
+
/** Where the spelling of a `near_miss` comes from, when the station that read it reads more than the run's roster
|
|
26
|
+
* ({@link NearMissCarrier}); absent ⇒ the roster the run mounts. A sentence only — never a field of a wire detail. */
|
|
27
|
+
readonly carriedBy?: NearMissCarrier;
|
|
24
28
|
}
|
|
29
|
+
/** Who carries the spelling a near miss reads as another spelling of: the roster the run mounts, a delegation tool's pool, or
|
|
30
|
+
* only the engine's tool catalog (a tool the engine may mount, which this run's roster does not carry). */
|
|
31
|
+
export type NearMissCarrier = "run" | "pool" | "catalog";
|
|
25
32
|
/**
|
|
26
33
|
* How a list member that is not a string is named wherever a list's entries are named (the inert record's `entry`, the Skill
|
|
27
34
|
* card's binding): its TYPE, in a spelling no readable entry can have — a readable entry's name holds no whitespace and a
|
|
@@ -64,6 +71,25 @@ export type CompiledAllowEntry = {
|
|
|
64
71
|
readonly kind: "domain";
|
|
65
72
|
readonly rule: PersistedRule;
|
|
66
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* THE near-miss reading of a tool name the judgment calls current: the spelling the run mounts when the run mounts no tool of this
|
|
76
|
+
* exact name but one that differs from it only by case (`BASH` beside `Bash`), else `undefined`. Two kinds of name are never a near
|
|
77
|
+
* miss, because the roster they would be read against is not the final one: an engine tool's (the engine mounts some of its tools
|
|
78
|
+
* after a list is read) and a protocol tool's (a refresh mounts and unmounts them while the run goes on) — in both the exact
|
|
79
|
+
* spelling can be the right one by the time it matters. Every station that asks "is this name a case twin of a mounted tool" reads
|
|
80
|
+
* this answer: an entry list ({@link readRuleEntry}), a tool policy's name lists (the prepare-time policy-name audit).
|
|
81
|
+
*/
|
|
82
|
+
export declare function nearMissSpellingOf(name: string, roster: ReadonlySet<string>): string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* THE universe a ROOT-facing tool-name list is read against: every name the engine's catalog carries, and the names the reader knows
|
|
85
|
+
* are carried (`carried`). A list is root-facing when it bounds the tools of the run that holds it — the run's own `allowTools` /
|
|
86
|
+
* `excludeTools` (also the ceiling of its children), a tool policy's name lists, a session's stored rules — and its reader is that
|
|
87
|
+
* run (`carried`: its roster, the caller's own tools, and the exact names of the pools its reachable delegation tools declare and can
|
|
88
|
+
* list) or the store that writes the rules (`carried`: the tools its deployment declared). Another spelling of a carried name is
|
|
89
|
+
* always refused there, whatever a delegation tool injects per spawn: the run's own tools are known, and an entry that is a case
|
|
90
|
+
* twin of one of them names the other tool by mistake. A delegation tool's pool that cannot be listed carries nothing here.
|
|
91
|
+
*/
|
|
92
|
+
export declare function rootFacingToolNames(carried: Iterable<string>): Set<string>;
|
|
67
93
|
/** What one rule entry means under one direction ({@link readRuleEntry}): the row the grammar compiles it to, or the reason it
|
|
68
94
|
* reads as nothing with the facts a sentence about it names. */
|
|
69
95
|
export type RuleEntryReading = {
|
|
@@ -87,9 +113,10 @@ export declare function compiledEntryName(compiled: CompiledAllowEntry): string;
|
|
|
87
113
|
/**
|
|
88
114
|
* Compile one list WHOLE through {@link readRuleEntry}: the entries it reads and the ones it reads as nothing (each with its
|
|
89
115
|
* reason and, for a name the roster refuses, the judgment's word and the spelling to write). An allow list holding `*` voids
|
|
90
|
-
* the list (every other entry on it reads as nothing too: the list grants nothing — the safe direction)
|
|
91
|
-
*
|
|
92
|
-
*
|
|
116
|
+
* the list (every other entry on it reads as nothing too: the list grants nothing — the safe direction) — `*` as the lenient
|
|
117
|
+
* rule parser names it ({@link namesWholeRoster}), so an entry the stricter entry grammar refuses (`* (*)`) still voids. A
|
|
118
|
+
* `*` on a deny list reads as nothing by itself and the rest of that list still refuses: a deny list never loses an entry to
|
|
119
|
+
* a wildcard beside it. `roster` as in {@link readRuleEntry}.
|
|
93
120
|
*/
|
|
94
121
|
export declare function compileAllowList(entries: readonly string[], behavior: "allow" | "deny", roster?: ReadonlySet<string>): {
|
|
95
122
|
rows: Array<{
|
|
@@ -136,7 +163,8 @@ export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[],
|
|
|
136
163
|
* segment covered by a row — or, for a `grant` list, read-only by itself); deny: a row whose program run the call performs (the
|
|
137
164
|
* wide tightening reading; a call that cannot be read against the row is refused too). PATH — the persisted path adjudication
|
|
138
165
|
* (allow: the narrow reading, every view of the target inside what the row names; deny: any view reaching it). NAME / DOMAIN —
|
|
139
|
-
* the one predicate of each (the name the call names, the host it fetches)
|
|
166
|
+
* the one predicate of each (the name the call names, the host it fetches); a keyed tool's call naming no value for its key is
|
|
167
|
+
* refused by a deny list's row of the key and granted by no allow row (the persisted walk's reading, `keyedValueAbsentReason`).
|
|
140
168
|
*/
|
|
141
169
|
export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture): readonly R[] | undefined;
|
|
142
170
|
/** The allow rows of a list, as the allow layer reads them in `mode`: the strip applied BEFORE the match (in `auto`). */
|
|
@@ -294,11 +322,16 @@ export type AllowEntryInertNote = ({
|
|
|
294
322
|
} & AllowEntryInert) | ({
|
|
295
323
|
readonly source: AllowEntrySource;
|
|
296
324
|
} & AllowEntryInert);
|
|
325
|
+
/**
|
|
326
|
+
* A list entry spelled so a person reads what the engine read: the entry as a JSON string — quotes, backslashes and the usual
|
|
327
|
+
* escapes — with every character that prints as nothing, or as a space, written as `\uXXXX` (`\u{…}` beyond the BMP) and a
|
|
328
|
+
* run of spaces kept space by space. Uncapped and one-to-one (two entries never share a spelling), so a value that BINDS an
|
|
329
|
+
* entry may hold it ({@link renderListEntry} is this, capped for a sentence).
|
|
330
|
+
*/
|
|
331
|
+
export declare function spelledListEntry(entry: string): string;
|
|
297
332
|
/**
|
|
298
333
|
* THE ONE WRITER of a list entry into a sentence (the start-of-run notice, a skill's refusal and its decisions, a sub-agent
|
|
299
|
-
* list's refusals and advisories):
|
|
300
|
-
* character that prints as nothing, or as a space, written as `\uXXXX` (`\u{…}` beyond the BMP) and a run of spaces kept
|
|
301
|
-
* space by space, so what a person reads is what the engine read. Capped on what is printed.
|
|
334
|
+
* list's refusals and advisories): {@link spelledListEntry}, capped on what is printed.
|
|
302
335
|
*/
|
|
303
336
|
export declare function renderListEntry(entry: string): string;
|
|
304
337
|
/**
|
package/dist/core/allow-entry.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { heldBy } from "./tool-name-readings.js";
|
|
2
|
-
import { isNamespacedCoveringRuleName, namespacedRuleNameCovers
|
|
2
|
+
import { isNamespacedCoveringRuleName, namespacedRuleNameCovers } from "./permission-rules.js";
|
|
3
|
+
import { parsePermissionRule, ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
3
4
|
import { judgeRuleToolName, splitNamespacedName } from "./tool-name-aliases.js";
|
|
4
5
|
import { catalogToolNames, isShellFaceToolName } from "./tool-registry.js";
|
|
5
6
|
import { ALLOW_RULE_MEMBERS } from "./allow-rule-shadow.js";
|
|
6
|
-
import { COMMAND_RULE_TOOL, adjudicatePersistedDomainRules, adjudicatePersistedNameRules, commandCoverageOf, domainRuleSubjectOf, laneToolNamesOf, nameRuleSubjectOf, parseRuleText, programRunReachOf, ruleToolGrammarOf } from "./permission-rule-model.js";
|
|
7
|
+
import { COMMAND_RULE_TOOL, adjudicatePersistedDomainRules, adjudicatePersistedNameRules, commandCoverageOf, domainRuleSubjectOf, laneToolNamesOf, nameRuleSubjectOf, noticeRuleText, parseRuleText, programRunReachOf, ruleToolGrammarOf } from "./permission-rule-model.js";
|
|
7
8
|
import { pathRuleLaneAnswer } from "./runner/permission-rule-lanes.js";
|
|
8
9
|
import { callTargetReadingOf } from "./effective-path-target.js";
|
|
9
10
|
import { splitShellCompoundSegments } from "../tools/fs/bash-readonly-classifier.js";
|
|
@@ -12,6 +13,7 @@ import { inlineUntrusted } from "./untrusted-text.js";
|
|
|
12
13
|
import { valueTypeLabel } from "./tool-name-list.js";
|
|
13
14
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
14
15
|
export const ALLOW_ENTRY_INERT_REASONS = Object.freeze(["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"]);
|
|
16
|
+
const NEAR_MISS_CARRIER = { run: "the mounted spelling is", pool: "a delegation pool carries", catalog: "the engine's tool catalog names" };
|
|
15
17
|
export function nonStringMemberLabel(value) {
|
|
16
18
|
return `<not a string: ${valueTypeLabel(value)}>`;
|
|
17
19
|
}
|
|
@@ -21,7 +23,6 @@ export function nonListValueLabel(read) {
|
|
|
21
23
|
function ruleRowOf(parsed) {
|
|
22
24
|
return { ...parsed, scope: { kind: "global" }, adds: [{ dot: { actor: "list", counter: 1 }, origin: "user", createdAt: "" }] };
|
|
23
25
|
}
|
|
24
|
-
const TOOL_NAME_SPELLING = /^[^\s()\p{Cc}\p{Cf}]+$/u;
|
|
25
26
|
function mountedSpellingOf(name, roster) {
|
|
26
27
|
const folded = name.toLowerCase();
|
|
27
28
|
for (const mounted of roster)
|
|
@@ -29,6 +30,14 @@ function mountedSpellingOf(name, roster) {
|
|
|
29
30
|
return mounted;
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
33
|
+
export function nearMissSpellingOf(name, roster) {
|
|
34
|
+
if (roster.has(name) || catalogToolNames().has(name) || splitNamespacedName(name) !== undefined)
|
|
35
|
+
return undefined;
|
|
36
|
+
return mountedSpellingOf(name, roster);
|
|
37
|
+
}
|
|
38
|
+
export function rootFacingToolNames(carried) {
|
|
39
|
+
return new Set([...catalogToolNames(), ...carried]);
|
|
40
|
+
}
|
|
32
41
|
function toolNameReading(name, roster) {
|
|
33
42
|
const verdict = judgeRuleToolName(name, roster);
|
|
34
43
|
if (verdict.kind === "unprefixed_namespace")
|
|
@@ -36,9 +45,7 @@ function toolNameReading(name, roster) {
|
|
|
36
45
|
if (verdict.kind !== "current") {
|
|
37
46
|
return { kind: "inert", reason: "tool_name", verdict: verdict.kind, guidance: verdict.guidance, ...(verdict.currentName !== undefined ? { currentName: verdict.currentName } : {}) };
|
|
38
47
|
}
|
|
39
|
-
|
|
40
|
-
return undefined;
|
|
41
|
-
const mounted = mountedSpellingOf(name, roster);
|
|
48
|
+
const mounted = nearMissSpellingOf(name, roster);
|
|
42
49
|
return mounted === undefined ? undefined : { kind: "inert", reason: "near_miss", currentName: mounted };
|
|
43
50
|
}
|
|
44
51
|
export function readRuleEntry(raw, behavior, roster) {
|
|
@@ -46,12 +53,10 @@ export function readRuleEntry(raw, behavior, roster) {
|
|
|
46
53
|
const row = (compiled) => ({ kind: "row", compiled });
|
|
47
54
|
if (typeof raw !== "string")
|
|
48
55
|
return { kind: "inert", reason: "grammar", valueType: valueTypeLabel(raw) };
|
|
49
|
-
|
|
56
|
+
const parsed = ruleSpellingOf(raw);
|
|
57
|
+
if (parsed === undefined)
|
|
50
58
|
return inert("grammar");
|
|
51
|
-
const parsed = parsePermissionRule(raw);
|
|
52
59
|
const name = parsed.toolName;
|
|
53
|
-
if (!TOOL_NAME_SPELLING.test(name))
|
|
54
|
-
return inert("grammar");
|
|
55
60
|
if (name === "*")
|
|
56
61
|
return inert("wildcard_all");
|
|
57
62
|
if (roster !== undefined) {
|
|
@@ -98,7 +103,7 @@ function inertReasonOf(code) {
|
|
|
98
103
|
return code === "unsupported.tool" ? "content_unsupported" : "grammar";
|
|
99
104
|
}
|
|
100
105
|
export function compileAllowList(entries, behavior, roster) {
|
|
101
|
-
const voided = behavior === "allow" && entries.some(
|
|
106
|
+
const voided = behavior === "allow" && entries.some(namesWholeRoster);
|
|
102
107
|
const rows = [];
|
|
103
108
|
const inert = [];
|
|
104
109
|
for (const entry of entries) {
|
|
@@ -113,8 +118,8 @@ export function compileAllowList(entries, behavior, roster) {
|
|
|
113
118
|
}
|
|
114
119
|
return { rows, inert };
|
|
115
120
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
121
|
+
function namesWholeRoster(entry) {
|
|
122
|
+
return typeof entry === "string" && entry === entry.trim() && parsePermissionRule(entry).toolName === "*";
|
|
118
123
|
}
|
|
119
124
|
function answersTo(req, has) {
|
|
120
125
|
return heldBy("allowEntry.names", { has }, req);
|
|
@@ -415,11 +420,13 @@ function escapedCodePoint(ch) {
|
|
|
415
420
|
const hex = cp.toString(16).padStart(4, "0");
|
|
416
421
|
return cp > 0xffff ? `\\u{${hex}}` : `\\u${hex}`;
|
|
417
422
|
}
|
|
418
|
-
export function
|
|
419
|
-
|
|
423
|
+
export function spelledListEntry(entry) {
|
|
424
|
+
return JSON.stringify(entry)
|
|
420
425
|
.replace(/ {2,}/g, (run) => "\\u0020".repeat(run.length))
|
|
421
426
|
.replace(UNSEEN_IN_ENTRY, (ch) => (ch === " " ? ch : escapedCodePoint(ch)));
|
|
422
|
-
|
|
427
|
+
}
|
|
428
|
+
export function renderListEntry(entry) {
|
|
429
|
+
return inlineUntrusted(spelledListEntry(entry), ENTRY_RENDER_MAX);
|
|
423
430
|
}
|
|
424
431
|
export function inertEntryPhrase(e) {
|
|
425
432
|
if (e.valueType !== undefined)
|
|
@@ -427,7 +434,7 @@ export function inertEntryPhrase(e) {
|
|
|
427
434
|
const spelling = e.currentName !== undefined ? inlineUntrusted(e.currentName, 120) : undefined;
|
|
428
435
|
const why = (() => {
|
|
429
436
|
if (e.reason === "near_miss")
|
|
430
|
-
return `near_miss:
|
|
437
|
+
return `near_miss: ${NEAR_MISS_CARRIER[e.carriedBy ?? "run"]} "${spelling}"`;
|
|
431
438
|
if (e.reason !== "tool_name" || e.verdict === undefined)
|
|
432
439
|
return e.reason;
|
|
433
440
|
switch (e.verdict) {
|
|
@@ -455,6 +462,6 @@ export function allowedToolsNotGrantedNotice(inert, sessionId) {
|
|
|
455
462
|
message: `${inert.length} allowed-tools entr${inert.length === 1 ? "y grants" : "ies grant"} or refuse${inert.length === 1 ? "s" : ""} nothing — ${shown.join("; ")}${rest > 0 ? `; and ${rest} more` : ""}. ` +
|
|
456
463
|
"A list holding `*` voids the list, `mcp__*` names no server, a rule the grammar refuses (`grammar`) or one on a tool with no such rule form (`content_unsupported`: an allow by path is an `Edit(…)` or `Read(…)` rule) grants nothing, and a tool name must be spelled as the tool is mounted; name the tools (or `mcp__<server>`) instead." +
|
|
457
464
|
(refusing ? " Such an entry in a disallowed-tools list keeps its Skill from activating: a refusal that reads as nothing is not dropped." : ""),
|
|
458
|
-
detail: { ...(sessionId !== undefined ? { sessionId } : {}), entries: inert.map((e) => ({ ...e })) },
|
|
465
|
+
detail: { ...(sessionId !== undefined ? { sessionId } : {}), entries: inert.map((e) => ({ ...e, entry: noticeRuleText(e.entry) })) },
|
|
459
466
|
};
|
|
460
467
|
}
|