@sema-agent/core 7.52.0 → 7.54.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 +470 -0
- package/LICENSE +3 -1
- package/README.md +3 -1
- 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/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 -6
- package/dist/agents/peer-session-drain.js +271 -182
- package/dist/agents/read-inbox-tool.d.ts +7 -0
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/send-message-tool.js +3 -4
- package/dist/agents/subagent.d.ts +6 -5
- package/dist/agents/subagent.js +117 -83
- package/dist/agents/tool-filter.d.ts +25 -4
- package/dist/agents/tool-filter.js +13 -3
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/model-presets.js +2 -1
- package/dist/brain/route-adjudicator.d.ts +6 -0
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +33 -14
- package/dist/core/allow-entry.d.ts +3 -1
- package/dist/core/allow-entry.js +3 -2
- package/dist/core/approval-object.d.ts +87 -0
- package/dist/core/approval-object.js +85 -0
- package/dist/core/arg-summary.d.ts +3 -2
- package/dist/core/arg-summary.js +17 -11
- package/dist/core/ask-origin.d.ts +43 -27
- package/dist/core/ask-origin.js +20 -11
- package/dist/core/ask-question.d.ts +0 -1
- package/dist/core/ask-question.js +4 -67
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/auto-compaction.d.ts +106 -50
- package/dist/core/auto-compaction.js +69 -53
- package/dist/core/auto-mode-prompt.d.ts +4 -2
- package/dist/core/auto-mode-prompt.js +4 -3
- package/dist/core/canonical-json.d.ts +69 -0
- package/dist/core/canonical-json.js +130 -8
- package/dist/core/checkpoint-requirements.d.ts +13 -7
- package/dist/core/checkpoint-requirements.js +4 -1
- package/dist/core/checkpoint-store.d.ts +60 -36
- package/dist/core/checkpoint-store.js +7 -6
- package/dist/core/child-clamp-seats.d.ts +45 -6
- package/dist/core/child-clamp-seats.js +56 -4
- package/dist/core/compliance.js +3 -1
- package/dist/core/consolidate-scope.d.ts +1 -1
- package/dist/core/cross-boundary-taint.d.ts +213 -0
- package/dist/core/cross-boundary-taint.js +196 -0
- package/dist/core/decision-receipt.d.ts +44 -1
- package/dist/core/decision-receipt.js +16 -0
- package/dist/core/effective-path-target.d.ts +28 -6
- package/dist/core/effective-path-target.js +28 -2
- package/dist/core/engine-notice.d.ts +47 -4
- package/dist/core/engine-notice.js +17 -1
- package/dist/core/engine-storage-backend.d.ts +73 -0
- package/dist/core/engine-storage-backend.js +1 -0
- package/dist/core/file-history-store.d.ts +6 -2
- package/dist/core/file-history-store.js +1 -0
- package/dist/core/gate-fold.js +13 -4
- package/dist/core/gate-lanes.js +41 -34
- package/dist/core/gate-outcome.d.ts +18 -9
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- 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 +21 -19
- package/dist/core/hooks.js +6 -5
- package/dist/core/locked-config.d.ts +110 -31
- package/dist/core/locked-config.js +155 -42
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mcp-probe.js +1 -1
- package/dist/core/mcp-server-spec.d.ts +152 -17
- package/dist/core/mcp-server-spec.js +223 -40
- package/dist/core/mcp.d.ts +21 -14
- package/dist/core/mcp.js +59 -54
- package/dist/core/memory-engine/engine.d.ts +14 -19
- package/dist/core/memory-engine/engine.js +9 -6
- package/dist/core/memory-engine/export-bundle.d.ts +1 -1
- package/dist/core/memory-engine/export-bundle.js +1 -1
- package/dist/core/memory-engine/file-backend.d.ts +2 -6
- package/dist/core/memory-engine/file-backend.js +1 -12
- package/dist/core/memory.d.ts +3 -3
- package/dist/core/mode-policy.d.ts +16 -26
- package/dist/core/mode-policy.js +5 -18
- package/dist/core/mods/kernel/dispatch.js +13 -15
- package/dist/core/mods/kernel/events.d.ts +9 -6
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +41 -11
- package/dist/core/mods/kernel/receive.js +124 -54
- package/dist/core/mods/kernel/site-rules.d.ts +80 -15
- package/dist/core/mods/kernel/site-rules.js +232 -40
- package/dist/core/mods/stations.d.ts +0 -6
- package/dist/core/mods/stations.js +0 -7
- 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 +3 -1
- package/dist/core/parent-spec-seat.d.ts +12 -15
- package/dist/core/parent-spec-seat.js +14 -6
- package/dist/core/pause-registry.d.ts +35 -1
- package/dist/core/pause-registry.js +10 -0
- package/dist/core/permission-rule-consent.d.ts +18 -5
- package/dist/core/permission-rule-consent.js +13 -8
- package/dist/core/permission-rule-model.d.ts +87 -15
- package/dist/core/permission-rule-model.js +87 -8
- package/dist/core/permission-rule-org.d.ts +200 -33
- package/dist/core/permission-rule-org.js +217 -91
- package/dist/core/permission-rule-session.js +2 -2
- package/dist/core/permission-rule-store.d.ts +8 -0
- package/dist/core/permission-rule-store.js +1 -0
- package/dist/core/permission-rule-sync.js +3 -2
- package/dist/core/permission-rules.d.ts +7 -1
- package/dist/core/permission-rules.js +37 -8
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/read-only-shell.js +30 -9
- package/dist/core/remote-env.d.ts +41 -1
- package/dist/core/remote-env.js +18 -0
- package/dist/core/resume-startup-cause.d.ts +18 -0
- package/dist/core/resume-startup-cause.js +12 -0
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +8 -2
- package/dist/core/retired-keys.js +12 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/approval-feedback.d.ts +46 -0
- package/dist/core/runner/approval-feedback.js +41 -0
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.js +2 -2
- package/dist/core/runner/contracts.d.ts +34 -41
- package/dist/core/runner/cross-boundary-lane.d.ts +87 -0
- package/dist/core/runner/cross-boundary-lane.js +190 -0
- package/dist/core/runner/decide-continuation.d.ts +4 -4
- package/dist/core/runner/decide-continuation.js +3 -1
- package/dist/core/runner/gate-exit.d.ts +32 -12
- package/dist/core/runner/gate-exit.js +77 -34
- package/dist/core/runner/inherited-ask-grants.js +2 -2
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- 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 +5 -3
- package/dist/core/runner/person-path-rows.js +2 -2
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -4
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -3
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +3 -3
- package/dist/core/runner/prepare-config-doors.d.ts +58 -15
- package/dist/core/runner/prepare-config-doors.js +167 -146
- package/dist/core/runner/prepare-context-lane.js +6 -3
- package/dist/core/runner/prepare-defer-classify.js +4 -7
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -4
- package/dist/core/runner/prepare-delegation-surface.js +8 -7
- package/dist/core/runner/prepare-execution-env.d.ts +1 -2
- package/dist/core/runner/prepare-execution-env.js +2 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -0
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -2
- 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 +19 -6
- 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.d.ts +1 -1
- package/dist/core/runner/prepare-park-ask.js +9 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +1 -1
- package/dist/core/runner/prepare-policy-chain.js +14 -19
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +6 -4
- package/dist/core/runner/prepare-prompt-assembly.d.ts +1 -1
- package/dist/core/runner/prepare-prompt-assembly.js +20 -16
- package/dist/core/runner/prepare-prompt-inputs.d.ts +12 -6
- package/dist/core/runner/prepare-prompt-inputs.js +6 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +7 -5
- package/dist/core/runner/prepare-protocol-tools.js +19 -12
- 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.d.ts +7 -2
- package/dist/core/runner/prepare-safety-scan.js +34 -27
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -2
- package/dist/core/runner/prepare-suspend-saga.js +6 -2
- package/dist/core/runner/prepare-task.js +22 -19
- package/dist/core/runner/prepare-turn-wiring.d.ts +10 -5
- package/dist/core/runner/prepare-turn-wiring.js +14 -49
- package/dist/core/runner/prepare-wiring-manifest.d.ts +10 -5
- package/dist/core/runner/prepare-wiring-manifest.js +9 -6
- package/dist/core/runner/prepare-workspace-restore.js +2 -2
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +16 -14
- package/dist/core/runner/resume-apply.js +4 -4
- 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-policy-outcome.d.ts +2 -2
- package/dist/core/runner/resume-policy-outcome.js +18 -15
- package/dist/core/runner/resume-preflight.js +2 -2
- package/dist/core/runner/resume-review-outcome.js +3 -3
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +1 -4
- package/dist/core/runner/run-leg.js +97 -43
- package/dist/core/runner/run-recovery-lanes.js +5 -3
- package/dist/core/runner/run-settle-and-teardown.js +2 -0
- package/dist/core/runner/run-terminal-adoption.js +21 -9
- package/dist/core/runner/run-turn-boundary.js +9 -3
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/session-file-state-replay.d.ts +5 -2
- package/dist/core/runner/session-file-state-replay.js +3 -2
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-steer-verb.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +13 -11
- package/dist/core/runner/sub-agent-deny-lists.js +7 -5
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-face-overlay.d.ts +24 -6
- package/dist/core/runner/tool-face-overlay.js +24 -15
- package/dist/core/runner-deps.d.ts +37 -22
- package/dist/core/session-policy-store.d.ts +19 -0
- package/dist/core/session-policy-store.js +22 -2
- package/dist/core/session-store.d.ts +35 -16
- package/dist/core/session-store.js +20 -12
- package/dist/core/{shell-lexer.d.ts → shell-run-candidates.d.ts} +36 -12
- package/dist/core/{shell-lexer.js → shell-run-candidates.js} +145 -225
- package/dist/core/shell-wrapper-table.d.ts +5 -3
- package/dist/core/shell-wrapper-table.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +49 -0
- package/dist/core/store-contracts/session-store-contract.js +639 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +12 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +5 -2
- package/dist/core/task-event.d.ts +44 -6
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +5 -0
- package/dist/core/task-registry.d.ts +7 -0
- package/dist/core/task-registry.js +17 -0
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +7 -7
- package/dist/core/tighten-task-spec.d.ts +6 -4
- package/dist/core/tighten-task-spec.js +2 -2
- package/dist/core/tool-catalog-entries.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +52 -52
- package/dist/core/tool-face-reader.d.ts +49 -0
- package/dist/core/tool-face-reader.js +94 -0
- package/dist/core/tool-face.d.ts +17 -8
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-policy.d.ts +67 -23
- package/dist/core/tool-policy.js +72 -60
- package/dist/core/tool-roster.d.ts +46 -28
- package/dist/core/tool-roster.js +91 -14
- package/dist/core/tool-spec-members.js +2 -2
- package/dist/core/tool-spec.d.ts +20 -4
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +24 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.d.ts +23 -0
- package/dist/core/untrusted-text.js +10 -10
- package/dist/core/user-attachment.d.ts +56 -2
- package/dist/core/user-attachment.js +139 -56
- package/dist/core/wiring-manifest.d.ts +4 -2
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/harness/agent-harness.js +2 -1
- package/dist/engine/harness/types.d.ts +10 -4
- package/dist/engine/llm/types.d.ts +7 -2
- package/dist/engine/llm/types.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +17 -5
- package/dist/engine/loop/types.d.ts +7 -1
- package/dist/engine/session/repo-utils.d.ts +5 -0
- package/dist/engine/session/repo-utils.js +9 -0
- package/dist/engine/session/storage-base.js +2 -2
- package/dist/index.d.ts +37 -17
- package/dist/index.js +31 -14
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +3 -0
- package/dist/orchestration/run-workflow-tool.js +1 -0
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/prompt-assembly/artifact-store.d.ts +44 -9
- package/dist/prompt-assembly/artifact-store.js +38 -12
- package/dist/prompt-assembly/artifact.d.ts +12 -11
- package/dist/prompt-assembly/artifact.js +52 -21
- package/dist/prompt-assembly/assemble.d.ts +2 -0
- package/dist/prompt-assembly/assemble.js +2 -1
- package/dist/prompt-assembly/catalog/index.js +2 -1
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +19 -2
- package/dist/prompt-assembly/catalog/schema.js +3 -0
- package/dist/prompt-assembly/composer.d.ts +2 -0
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/overlay.d.ts +21 -11
- package/dist/prompt-assembly/overlay.js +57 -19
- package/dist/prompt-assembly/select.d.ts +21 -6
- package/dist/prompt-assembly/select.js +41 -4
- package/dist/prompts/default.d.ts +1 -12
- package/dist/prompts/default.js +0 -3
- package/dist/shell/lex.d.ts +87 -8
- package/dist/shell/lex.js +283 -49
- package/dist/stores/file/index.d.ts +8 -6
- 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 +14 -3
- package/dist/tools/fs/bash-program-position.d.ts +3 -15
- package/dist/tools/fs/bash-program-position.js +3 -10
- package/dist/tools/fs/bash-readonly-classifier.js +2 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-bash.js +72 -101
- package/dist/tools/fs/fs-read.d.ts +12 -0
- package/dist/tools/fs/fs-read.js +10 -9
- package/dist/tools/fs/fs-shared.d.ts +27 -31
- package/dist/tools/fs/fs-shared.js +12 -15
- package/dist/tools/fs/fs-write.js +1 -1
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -4
- package/dist/tools/fs/read-deny.d.ts +16 -3
- package/dist/tools/fs/read-deny.js +12 -9
- package/dist/tools/fs/safety.d.ts +7 -6
- package/dist/tools/fs/shell-read-bindings.d.ts +5 -3
- package/dist/tools/fs/shell-read-bindings.js +15 -16
- package/dist/tools/fs/shell-read-device.js +1 -1
- package/dist/tools/fs/shell-read-plan.js +36 -47
- package/dist/tools/fs/shell-read-word.d.ts +1 -6
- package/dist/tools/fs/shell-read-word.js +2 -20
- package/dist/tools/fs/shell-reentry-text.js +1 -1
- package/dist/tools/web.d.ts +2 -2
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +5651 -5457
- package/wire-changes/core@7.53.0.json +1968 -0
- package/wire-changes/core@7.54.0.json +2870 -0
- package/dist/core/shell-scan.d.ts +0 -60
- package/dist/core/shell-scan.js +0 -183
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The READER of an MCP server's `toolFaces` declaration ({@link McpServerSpec.toolFaces}, the per-tool FACE overlay): `readToolFaces(declared)`,
|
|
3
|
+
* the face-side sibling of `readToolAxes` (`mcp-server-spec.ts`). The engine's preparation door and its MCP materialization entrance ask it
|
|
4
|
+
* (`locked-config.ts`), and a host that assembles the field from JSON (a console's write door, a deployment intake) asks it at its own door:
|
|
5
|
+
* one reading of the declaration, whoever asks and whenever. The mount ({@link applyMcpToolFaces}) then consumes the reader's copy and never
|
|
6
|
+
* the raw object, and judges each face against the materialized schema with the very judge this reader ends in.
|
|
7
|
+
*
|
|
8
|
+
* It sits beside `mcp-server-spec.ts` rather than in the runner directory the mount lives in: it is the declaration's door, not a station of
|
|
9
|
+
* the prepare path, and the public surface is tiered by where a symbol is declared (`readToolAxes` is `advanced` for the same reason).
|
|
10
|
+
*/
|
|
11
|
+
import { type McpServerSpec } from "./mcp-server-spec.js";
|
|
12
|
+
/**
|
|
13
|
+
* {@link readToolFaces}'s answer. `ok: true` hands back a copy of the faces that the reader itself built, plain data and none of the caller's own
|
|
14
|
+
* objects; `faces` is absent when nothing is declared (no key at all, or an empty record). `ok: false` carries one sentence (its detail cut at
|
|
15
|
+
* 240 characters) naming the tool and the member that did not fit. What it may quote of the declaration is its structure and nothing of its content:
|
|
16
|
+
* a tool or member name (quoted, a tool name cut at 80 characters), the word a closed table refuses, a key or a list entry over its bound (its
|
|
17
|
+
* first 40 characters), a key a pattern parameter names, a count and its bound. It never quotes display text (`userFacingName`, `activity`) or
|
|
18
|
+
* the entries of a list that fits. These are the mount's judge's own sentences, the ones it announces at the listing, so the reader and the mount
|
|
19
|
+
* tell one operator one thing; `readToolAxes` refuses in the same sentence shape and names no word because an axis word is never a name the
|
|
20
|
+
* operator needs echoed to find the fault.
|
|
21
|
+
*/
|
|
22
|
+
export type ToolFacesRead = {
|
|
23
|
+
ok: true;
|
|
24
|
+
faces?: NonNullable<McpServerSpec["toolFaces"]>;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
problem: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The one reader of a raw `toolFaces` declaration — {@link McpServerSpec.toolFaces}, the per-tool FACE overlay — and the face-side sibling of
|
|
31
|
+
* `readToolAxes` (the safety axes `effect` / `egress` / `irreversibility` are that declaration's, read once, there). The preparation door asks it
|
|
32
|
+
* for every MCP server of a task (`config.tool_face_invalid` refuses the whole prepare — the code a caller tool's bad face has at the caller door;
|
|
33
|
+
* a declaration the entry's own plain-data receipt refuses first keeps `config.invalid_argument`), `materializeMcpTools` asks it per server (that
|
|
34
|
+
* server's dial fails, the same code), and a host that assembles the field from JSON asks it at its own door and hands the engine what it answered.
|
|
35
|
+
*
|
|
36
|
+
* It judges the declaration alone, which is everything the declaration can say without the tool's schema: the receipt of a plain-data
|
|
37
|
+
* declaration (`receiveDeclaration`: a Proxy, a map, a class instance, a getter that throws, a cycle, a nesting past the engine's one
|
|
38
|
+
* depth, a tool named `__proto__` are refusals that say where they sit), the shape of each face (the members the types have, each of its
|
|
39
|
+
* kind), then the very judge the mount runs (`toolFaceProblem`) minus the checks that need the schema — the five closed words
|
|
40
|
+
* (`family`, `pathTarget.access` / `base` / `absent`, `renderHints.approvalCard`), the bounds, and the cross-member rules (a write path
|
|
41
|
+
* target's `base: "root"` / `absent: "base"`, an inert `patternParam`). The checks that read the schema (a `param` that is a top-level
|
|
42
|
+
* property, the keys an approval card needs, the names a summary or a rule face lists) and the one that reads the minted tool (a result card
|
|
43
|
+
* lives under the tool's own namespace) stay with the listing, where the schema and the tool are known.
|
|
44
|
+
*
|
|
45
|
+
* Any one face that does not fit refuses the WHOLE declaration (`ok: false`): a face is an overlay applied whole or not at all, and a
|
|
46
|
+
* dropped face is a tool mounted without the protection its operator declared. Absent ⇒ `{ ok: true }`. An empty record is no declaration
|
|
47
|
+
* either; an empty face `{}` under a tool name is kept as written. An empty tool name is refused (no tool answers to it).
|
|
48
|
+
*/
|
|
49
|
+
export declare function readToolFaces(declared: unknown): ToolFacesRead;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { dataKind, perToolEmptyName, perToolEntryRefusal, quotedName, receivePerToolDeclaration } from "./mcp-server-spec.js";
|
|
2
|
+
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
3
|
+
import { faceProblem } from "./runner/tool-face-overlay.js";
|
|
4
|
+
import { inlineUntrusted } from "./untrusted-text.js";
|
|
5
|
+
const TOOL_FACE_MEMBERS = { family: true, pathTarget: true, renderHints: true, ruleFace: true };
|
|
6
|
+
const PATH_TARGET_KINDS = { param: "string", aliases: "list", access: "string", skillScopeEligible: "boolean", base: "string", absent: "string", patternParam: "string" };
|
|
7
|
+
const PATH_TARGET_REQUIRED = ["param", "access"];
|
|
8
|
+
const RENDER_HINT_KINDS = { userFacingName: "string", activity: "string", summaryParams: "list", resultCards: "list", approvalCard: "string" };
|
|
9
|
+
const RULE_FACE_KINDS = { primaryParams: "list", params: "list" };
|
|
10
|
+
function kindProblem(label, value, kind) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (kind === "list")
|
|
14
|
+
return Array.isArray(value) && value.every((name) => typeof name === "string") ? undefined : `${label} is ${dataKind(value)}, not a list of strings`;
|
|
15
|
+
return typeof value === kind ? undefined : `${label} is ${dataKind(value)}, not a ${kind}`;
|
|
16
|
+
}
|
|
17
|
+
function membersOf(raw, label, names) {
|
|
18
|
+
if (!isPlainRecord(raw))
|
|
19
|
+
return `${label} is ${dataKind(raw)}, not an object`;
|
|
20
|
+
const unknown = Object.keys(raw).find((member) => !names.includes(member));
|
|
21
|
+
return unknown === undefined ? raw : `${label} has the unknown member ${quotedName(unknown)} (the members are ${names.join(", ")})`;
|
|
22
|
+
}
|
|
23
|
+
function ownMember(record, name) {
|
|
24
|
+
return Object.hasOwn(record, name) ? record[name] : undefined;
|
|
25
|
+
}
|
|
26
|
+
function readMembers(raw, label, kinds, required = []) {
|
|
27
|
+
const record = membersOf(raw, label, Object.keys(kinds));
|
|
28
|
+
if (typeof record === "string")
|
|
29
|
+
return record;
|
|
30
|
+
for (const member of required)
|
|
31
|
+
if (ownMember(record, member) === undefined)
|
|
32
|
+
return `${label}.${member} is missing`;
|
|
33
|
+
const entries = [];
|
|
34
|
+
for (const member of Object.keys(record)) {
|
|
35
|
+
const kind = kinds[member];
|
|
36
|
+
const value = record[member];
|
|
37
|
+
const problem = kindProblem(`${label}.${member}`, value, kind);
|
|
38
|
+
if (problem !== undefined)
|
|
39
|
+
return problem;
|
|
40
|
+
if (value === undefined || (kind === "boolean" && value === false))
|
|
41
|
+
continue;
|
|
42
|
+
entries.push([member, kind === "list" ? [...value] : value]);
|
|
43
|
+
}
|
|
44
|
+
return Object.fromEntries(entries);
|
|
45
|
+
}
|
|
46
|
+
function readOneToolFace(raw) {
|
|
47
|
+
const face = membersOf(raw, "the face", Object.keys(TOOL_FACE_MEMBERS));
|
|
48
|
+
if (typeof face === "string")
|
|
49
|
+
return face;
|
|
50
|
+
const records = { pathTarget: [PATH_TARGET_KINDS, PATH_TARGET_REQUIRED], renderHints: [RENDER_HINT_KINDS, []], ruleFace: [RULE_FACE_KINDS, []] };
|
|
51
|
+
const entries = [];
|
|
52
|
+
for (const member of Object.keys(face)) {
|
|
53
|
+
const value = face[member];
|
|
54
|
+
if (value === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
if (member === "family") {
|
|
57
|
+
const problem = kindProblem("family", value, "string");
|
|
58
|
+
if (problem !== undefined)
|
|
59
|
+
return problem;
|
|
60
|
+
entries.push([member, value]);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const [kinds, required] = records[member];
|
|
64
|
+
const record = readMembers(value, member, kinds, required);
|
|
65
|
+
if (typeof record === "string")
|
|
66
|
+
return record;
|
|
67
|
+
entries.push([member, record]);
|
|
68
|
+
}
|
|
69
|
+
const typed = Object.fromEntries(entries);
|
|
70
|
+
return faceProblem(typed, undefined) ?? typed;
|
|
71
|
+
}
|
|
72
|
+
export function readToolFaces(declared) {
|
|
73
|
+
if (declared === undefined)
|
|
74
|
+
return { ok: true };
|
|
75
|
+
const received = receivePerToolDeclaration(declared, "toolFaces", "tool");
|
|
76
|
+
if (!received.ok)
|
|
77
|
+
return { ok: false, problem: received.problem };
|
|
78
|
+
const entries = [];
|
|
79
|
+
for (const [tool, raw] of Object.entries(received.perTool)) {
|
|
80
|
+
if (tool.length === 0)
|
|
81
|
+
return { ok: false, problem: perToolEmptyName("toolFaces", "tool") };
|
|
82
|
+
let face;
|
|
83
|
+
try {
|
|
84
|
+
face = readOneToolFace(raw);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
face = "a member threw while it was read";
|
|
88
|
+
}
|
|
89
|
+
if (typeof face === "string")
|
|
90
|
+
return { ok: false, problem: perToolEntryRefusal("toolFaces", "tool", tool, inlineUntrusted(face, 240)) };
|
|
91
|
+
entries.push([tool, face]);
|
|
92
|
+
}
|
|
93
|
+
return entries.length > 0 ? { ok: true, faces: Object.fromEntries(entries) } : { ok: true };
|
|
94
|
+
}
|
package/dist/core/tool-face.d.ts
CHANGED
|
@@ -198,6 +198,9 @@ export interface ToolRenderHints {
|
|
|
198
198
|
*/
|
|
199
199
|
export interface ToolFaceDeclaration {
|
|
200
200
|
family: ToolFamily;
|
|
201
|
+
/** The legs every call of the definition travels, or `"per_call"` when the code that dispatches it gives them per call. REQUIRED:
|
|
202
|
+
* a definition that states none does not compile — no default, and no fail-closed reading as outside. */
|
|
203
|
+
boundaryLegs: import("./cross-boundary-taint.js").BoundaryLegsDeclaration;
|
|
201
204
|
effect?: import("./tool-spec.js").ToolEffect;
|
|
202
205
|
egress?: true;
|
|
203
206
|
irreversibility?: "never" | "maybe" | "always";
|
|
@@ -232,6 +235,12 @@ export interface ToolFaceDeclaration {
|
|
|
232
235
|
*/
|
|
233
236
|
export declare const TOOL_LEG_KINDS: readonly ["delegated", "teammate", "goal", "observer", "structured"];
|
|
234
237
|
export type ToolLegKind = (typeof TOOL_LEG_KINDS)[number];
|
|
238
|
+
/**
|
|
239
|
+
* The leg kinds that share their spawner's tool surface: a teammate is handed tools its spawner holds in its own right (the team's mailbox,
|
|
240
|
+
* scheduler and task list), so the layers above the leg decide its protocol rows and the leg's own lists do not. A protocol row that no kind
|
|
241
|
+
* of this table names is the leg's own channel — a finishing or hand-back tool its spawner never held — and no layer decides it.
|
|
242
|
+
*/
|
|
243
|
+
export declare const SPAWNER_SURFACE_LEG_KINDS: readonly ToolLegKind[];
|
|
235
244
|
/**
|
|
236
245
|
* One layer of a tool selector, as data: an allowed-tools list (absent = no allowlist on this layer) and a denied-tools list,
|
|
237
246
|
* each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools`; the
|
|
@@ -244,8 +253,9 @@ export interface ToolSelectorLayer {
|
|
|
244
253
|
/**
|
|
245
254
|
* The compiled tool selector of one run — the one answer to "is this tool available on this run", read at the roster valve
|
|
246
255
|
* and on every later roster change (an MCP refresh or re-dial, the deferred-search lane), and handed down as the ceiling of
|
|
247
|
-
* every run this one spawns (`layers`). A tool is admitted when it is
|
|
248
|
-
*
|
|
256
|
+
* every run this one spawns (`layers`). A tool is admitted when it is the leg's own protocol channel, or when every layer
|
|
257
|
+
* admits it — the layer's allowlist (if any) reaches it and its denylist does not — or, for a protocol tool of a leg that shares
|
|
258
|
+
* its spawner's tool surface ({@link SPAWNER_SURFACE_LEG_KINDS}), when every layer ABOVE the leg's own admits it.
|
|
249
259
|
*/
|
|
250
260
|
export interface ToolSelector {
|
|
251
261
|
readonly layers: readonly ToolSelectorLayer[];
|
|
@@ -280,13 +290,12 @@ export interface ToolCatalogEntry {
|
|
|
280
290
|
face: ToolFaceDeclaration;
|
|
281
291
|
/** A `modelGate` class the default-bundle assembler stamps on this definition's default arm. */
|
|
282
292
|
modelGate?: string;
|
|
283
|
-
/** The leg kinds whose legs rely on this tool as part of their protocol:
|
|
284
|
-
*
|
|
285
|
-
*
|
|
293
|
+
/** The leg kinds whose legs rely on this tool as part of their protocol: the leg's OWN lists do not decide it (an allowlist need not
|
|
294
|
+
* name it), and a denylist of the leg's own that reaches it is a contradiction the run refuses at prepare. Whether the layers ABOVE
|
|
295
|
+
* the leg decide it follows the row's kinds ({@link SPAWNER_SURFACE_LEG_KINDS}): a row some kind of which shares its spawner's tool
|
|
296
|
+
* surface is held exactly when the spawner may hold it; any other row is the leg's own channel, which no layer decides — an inherited
|
|
297
|
+
* deny that reaches it is the same contradiction. */
|
|
286
298
|
protocol?: readonly ToolLegKind[];
|
|
287
|
-
/** A protocol row the leg shares with the run that spawned it (the team task-list family a teammate shares with its leader): on its
|
|
288
|
-
* leg the leg's OWN lists do not decide it, but the ceiling still does — the leg holds it exactly when its spawner may. */
|
|
289
|
-
protocolUnderCeiling?: true;
|
|
290
299
|
}
|
|
291
300
|
/**
|
|
292
301
|
* The band-membership table over the mount tags: a host derives its hand band as the definitions listed under a
|
package/dist/core/tool-face.js
CHANGED
|
@@ -25,6 +25,7 @@ export const RENDER_HINT_MAX_CHARS = 64;
|
|
|
25
25
|
export const RENDER_HINT_ACTIVITY_MAX_CHARS = 32;
|
|
26
26
|
export const RENDER_HINT_MAX_LIST = 16;
|
|
27
27
|
export const TOOL_LEG_KINDS = Object.freeze(["delegated", "teammate", "goal", "observer", "structured"]);
|
|
28
|
+
export const SPAWNER_SURFACE_LEG_KINDS = Object.freeze(["teammate"]);
|
|
28
29
|
export const MOUNT_TAG_IN_HANDS_BAND = {
|
|
29
30
|
hands: true,
|
|
30
31
|
backgroundTasks: true,
|
|
@@ -2,6 +2,7 @@ import { type AskOrigin, type AssertAllKeysHandled } from "./ask-origin.js";
|
|
|
2
2
|
import { type ReadRootGrantScreen } from "./read-root-grant-screen.js";
|
|
3
3
|
import { type Settlement } from "./gate-outcome.js";
|
|
4
4
|
export { policyCannotAnswer, rowDemandsAPerson } from "./real-approval.js";
|
|
5
|
+
import { type BindingFault } from "./canonical-json.js";
|
|
5
6
|
import { type DecisionReason } from "./decision-receipt.js";
|
|
6
7
|
export { isEngineRefusal } from "./decision-receipt.js";
|
|
7
8
|
import { type RemovalGuardSeat } from "../tools/fs/removal-targets.js";
|
|
@@ -236,7 +237,8 @@ export interface EngineAttestation {
|
|
|
236
237
|
readonly origin?: AskOrigin;
|
|
237
238
|
/** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
|
|
238
239
|
readonly classes?: readonly import("./ask-origin.js").AskClass[];
|
|
239
|
-
/** `
|
|
240
|
+
/** `exactBoundInputHashOf` of the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
241
|
+
* args); absent when they have none (outside the bindable domain) — such a record licenses no bytes. */
|
|
240
242
|
readonly inputDigest?: string;
|
|
241
243
|
/** The FORM of a classifier round that did not rule (a classifier deny's cause). */
|
|
242
244
|
readonly classifierCause?: import("./gate-outcome.js").ClassifierDenyCause;
|
|
@@ -249,6 +251,9 @@ export interface EngineAttestation {
|
|
|
249
251
|
/** Where a path deny row refused the call — the row, the view of the target it met, the face the call is on. The gate's
|
|
250
252
|
* exit mints the refusal's card from it; the judge that found the row is its only writer. */
|
|
251
253
|
readonly pathDenial?: import("../tools/fs/safety.js").PathDenialEvidence;
|
|
254
|
+
/** A seat refused the call's arguments because no approval can be bound to them ({@link bindableArgsOf}): the refusal's
|
|
255
|
+
* sentence, carried by the refusal itself — the gate's deny exit reads it (the remedy it gives) instead of judging again. */
|
|
256
|
+
readonly bindingRefusal?: string;
|
|
252
257
|
}
|
|
253
258
|
/** The members a station attests — everything but the call binding. */
|
|
254
259
|
export type AttestationMembers = Omit<EngineAttestation, "toolCallId" | "toolName">;
|
|
@@ -422,6 +427,11 @@ export type PermissionResult = {
|
|
|
422
427
|
* in the one direction the stamp cannot reach (a caller composing its own ask) the claim is
|
|
423
428
|
* tightening-only: it can make an ask outlive a rule, never turn one into an allow. */
|
|
424
429
|
probeMandated?: true;
|
|
430
|
+
/** This ask stands on the call's CROSS-BOUNDARY obligation — a person's confirmation
|
|
431
|
+
* ({@link import("./cross-boundary-taint.js").crossBoundaryObligation}); the station mints it beside `requiresRealApproval`, the
|
|
432
|
+
* decision receipt adds that bit to a policy's or hook's own. Its one carrier: the class (`cross_boundary`), the rule-silence word (`cross_boundary_taint`) and the
|
|
433
|
+
* real-approval bit are all read off this member. Tightening-only: a policy self-declaring it opts its own ask out of automatic answering. */
|
|
434
|
+
crossBoundaryMandated?: true;
|
|
425
435
|
/** This ask is MANDATED — no persisted allow rule and no STANDING ANSWER (a release remembered from an
|
|
426
436
|
* earlier call, at any scope, a session included) may retire it; only an answer produced for THIS call
|
|
427
437
|
* clears it — a person, a hook, a deployment's blanket `onAsk: "allow"` seat, or the live deciders the
|
|
@@ -592,6 +602,37 @@ export interface AskRuleEvidence {
|
|
|
592
602
|
}
|
|
593
603
|
/** The human/model-readable text of a decision. */
|
|
594
604
|
export declare function decisionText(d: PermissionResult): string | undefined;
|
|
605
|
+
/** Does a license (a record's `inputDigest`) cover the bytes that `runs`? The ONE judge — the gate's ledger keeps a settlement for
|
|
606
|
+
* the bytes it licensed by it, and the unstated question asks whether an answer was given for these bytes by it. A license for
|
|
607
|
+
* bytes covers what the tool reads them as ({@link argsReadFrom}: the one recorded step a reading took to `runs`). Compared by
|
|
608
|
+
* the EXACT digest only: bytes outside the bindable domain have none and are covered by no license. */
|
|
609
|
+
export declare function licenseCovers(licensed: string | undefined, runs: unknown): boolean;
|
|
610
|
+
/**
|
|
611
|
+
* THE judge of whether an approval can be bound to arguments, and the arguments it binds — asked wherever an approval is about to
|
|
612
|
+
* be asked or adopted, and nowhere else: the ask resolver (its no-approver arm too) and the approval policy before anyone is asked,
|
|
613
|
+
* the resolver where it adopts a person's edit, the gate's approved-edit loop (an edit any resolver hands back), and — through the
|
|
614
|
+
* same judge and sentence — the durable decide's capture of one before the claim ({@link capturedJsonOf}). Bindable = a record of
|
|
615
|
+
* plain JSON data nested at most 256 levels deep ({@link bindableValueOf}, exactly the values with an exact digest — the SAME reading every
|
|
616
|
+
* license and mint takes), judged on the value as given with nothing of the caller's run (a getter is never called: a value read
|
|
617
|
+
* through one has no fixed bytes). Ok ⇒ the judge's frozen copy, engine-owned (`args` itself when owned already); else the ONE
|
|
618
|
+
* sentence ({@link bindingRefusalOf}).
|
|
619
|
+
*/
|
|
620
|
+
export declare function bindableArgsOf<T>(toolName: string, args: T): {
|
|
621
|
+
ok: true;
|
|
622
|
+
value: T;
|
|
623
|
+
} | {
|
|
624
|
+
ok: false;
|
|
625
|
+
refusal: string;
|
|
626
|
+
};
|
|
627
|
+
/** THE sentence refusing arguments no approval can be bound to, naming what the judge met and where (`args` is what it was given). */
|
|
628
|
+
export declare function bindingRefusalOf(toolName: string, args: unknown, fault: BindingFault): string;
|
|
629
|
+
/** Was the call ANSWERED for the bytes that run — does `d` carry an engine record ({@link attestationOf}) of a settled wait
|
|
630
|
+
* whose license covers `runs`? A person's or the deployment approver's yes over these arguments is; a layer's allow is not,
|
|
631
|
+
* whatever it says about itself, and neither is a yes given for other bytes (a later layer that rewrote them voids it here). */
|
|
632
|
+
export declare function answeredFor(d: PermissionResult, call: {
|
|
633
|
+
toolCallId: string;
|
|
634
|
+
toolName: string;
|
|
635
|
+
}, runs: unknown): boolean;
|
|
595
636
|
/**
|
|
596
637
|
* Gates tool calls before they execute (the production safety layer for "processing/changing data").
|
|
597
638
|
*
|
|
@@ -878,9 +919,10 @@ export declare function constraintChainEntryOfSuppliedLayer(layer: ConstraintCha
|
|
|
878
919
|
* different frozen deny data now digest differently.
|
|
879
920
|
*/
|
|
880
921
|
export declare function constraintChainDigest(chain: readonly ConstraintChainEntry[]): string;
|
|
881
|
-
/** Every member of the decision union
|
|
882
|
-
* The receipt walks it: a contract member not held as an own enumerable data
|
|
883
|
-
* prototype chain holds one (an `undefined` data value spells absence)
|
|
922
|
+
/** Every member of the decision union, read off the member × arm table ({@link DECISION_MEMBER_ARMS}: a member the union gains
|
|
923
|
+
* and the table lacks is a type error there). The receipt walks it: a contract member not held as an own enumerable data
|
|
924
|
+
* property is refused if a descriptor on the prototype chain holds one (an `undefined` data value spells absence), and a
|
|
925
|
+
* present one must sit on an arm its row holds. Not re-exported from `src/index.ts`. */
|
|
884
926
|
export type DecisionMember = PermissionResult extends infer U ? (U extends unknown ? keyof U : never) : never;
|
|
885
927
|
export declare const DECISION_MEMBERS: readonly DecisionMember[];
|
|
886
928
|
/**
|
|
@@ -949,8 +991,10 @@ export type NamedToolPolicy = ToolPolicy & {
|
|
|
949
991
|
* which simply opts out of the audit). */
|
|
950
992
|
export declare function toolPolicyNameSets(p: ToolPolicy | undefined): readonly ToolPolicyNameSets[];
|
|
951
993
|
/**
|
|
952
|
-
* Name-based allow/deny. `deny` always wins. If `allow` is provided, only those tools
|
|
953
|
-
*
|
|
994
|
+
* Name-based allow/deny. `deny` always wins. If `allow` is provided, only those tools may run (everything else denied) — a
|
|
995
|
+
* NARROWING: a tool the list names gets no objection, never consent, so a `passthrough`-seat tool it names still meets the
|
|
996
|
+
* mode's unstated question; consent is an allow entry (`RunnerDeps.allowedTools` / `TaskSpec.allowedTools`). Without
|
|
997
|
+
* `allow`, everything not in `deny` gets no objection. Each entry is read by the rule
|
|
954
998
|
* syntax (`ruleSpellingOf`): a name, or `Tool()` / `Tool(*)` — the bare `Tool`, as every list reader reads them, once however
|
|
955
999
|
* many spellings write it; any other spelling is not a tool name (`onInvalidName`), and neither is the wildcard `*` (`*`,
|
|
956
1000
|
* `*()`, `*(*)`) in `deny`: it names no tool, and the entry would be kept and never match. In `allow` it is one entry no tool
|
|
@@ -975,13 +1019,6 @@ export declare function createAllowDenyPolicy(opts: {
|
|
|
975
1019
|
list: "allow" | "deny";
|
|
976
1020
|
message: string;
|
|
977
1021
|
}) => void;
|
|
978
|
-
/**
|
|
979
|
-
* What an `allow` list HIT means. `"grant"` (default): the deployment named this tool as permitted — a statement
|
|
980
|
-
* (`decisionReason: "rule"`) that satisfies the fold's unstated rule for a passthrough-seat tool. `"narrowing"`: the
|
|
981
|
-
* list only bounds WHICH tools a lane may see (an agent definition's `allowTools`); a hit is scope, not consent, and
|
|
982
|
-
* answers a bare allow — the mode's unstated question still goes to a person. The deny list is unaffected.
|
|
983
|
-
*/
|
|
984
|
-
scope?: "grant" | "narrowing";
|
|
985
1022
|
}): NamedToolPolicy;
|
|
986
1023
|
/**
|
|
987
1024
|
* What `createApprovalPolicy`'s `approve` may resolve to: a boolean, or the `AskOutcome` OBJECT minus the
|
|
@@ -1030,7 +1067,8 @@ export declare function createApprovalPolicy(opts: {
|
|
|
1030
1067
|
approve: (req: ToolCallRequest, signal?: AbortSignal) => ApprovalSeatOutcome | Promise<ApprovalSeatOutcome>;
|
|
1031
1068
|
/** Always-denied tools. */
|
|
1032
1069
|
deny?: string[];
|
|
1033
|
-
/**
|
|
1070
|
+
/** The exceptions to `denyByDefault` (only meaningful with it): tools that get no objection without an approval. A narrowing,
|
|
1071
|
+
* not consent — a `passthrough`-seat tool named here still meets the mode's unstated question; consent is an allow entry. */
|
|
1034
1072
|
autoAllow?: string[];
|
|
1035
1073
|
/** When true, deny anything not in `requireApproval` or `autoAllow`. Default false. */
|
|
1036
1074
|
denyByDefault?: boolean;
|
|
@@ -1050,12 +1088,11 @@ export declare function createApprovalPolicy(opts: {
|
|
|
1050
1088
|
* short-circuit — scanning continues, because a later policy may still `deny` (which outranks ask).
|
|
1051
1089
|
* With no deny, the first `ask` wins; with neither, `allow`.
|
|
1052
1090
|
*
|
|
1053
|
-
* **
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* unstated allow is not a permission — the gate puts the mode's question to it; for every other tool the two forms run alike.
|
|
1091
|
+
* **A layer's allow is no objection, never consent.** What a combined allow carries beyond that is the engine RECORDS its
|
|
1092
|
+
* layers' stations minted (an approver's yes inside a layer, an ancestor classifier's attribution), accumulated per member
|
|
1093
|
+
* group; a yes binds the bytes it was given (its license), so a layer that rewrites the arguments afterwards leaves a yes that
|
|
1094
|
+
* no longer covers what runs. For a tool whose permission seat is `passthrough` the gate puts the mode's question to a
|
|
1095
|
+
* combined allow unless an answer covers the bytes that run ({@link answeredFor}) — the allow layer answers it there.
|
|
1059
1096
|
*
|
|
1060
1097
|
* **Idempotency requirement:** because the fold continues past an `ask` to look for a later `deny`, a
|
|
1061
1098
|
* policy's `check()` can be invoked even after an earlier policy returned `ask`. `check()` MUST be
|
|
@@ -1847,8 +1884,8 @@ export declare function refusalOf<D extends PermissionResult>(deny: D, judged: u
|
|
|
1847
1884
|
/**
|
|
1848
1885
|
* A PreToolUse hook's `ask` folded over a verdict by `deny > ask > allow` — the ONE law for the gate's first screening and for
|
|
1849
1886
|
* an approved edit's re-screen. A deny stands. Over an allow, the hook's own ask, RECONSTRUCTED rather than spread (its message,
|
|
1850
|
-
* its real-approval demand, its rewrite) under the hook provenance the engine stamps. Over an ask, that ask keeps every member,
|
|
1851
|
-
* takes the hook provenance and the hook's real-approval demand, and its message carries the hook's beside its own — a person
|
|
1887
|
+
* its real-approval demand and cross-boundary member, its rewrite) under the hook provenance the engine stamps. Over an ask, that ask keeps every member,
|
|
1888
|
+
* takes the hook provenance and the hook's real-approval demand and cross-boundary member, and its message carries the hook's beside its own — a person
|
|
1852
1889
|
* clearing one ask that stands for two gates sees both reasons.
|
|
1853
1890
|
*/
|
|
1854
1891
|
export declare function foldHookAsk(verdict: Exclude<PermissionResult, {
|
|
@@ -1879,6 +1916,9 @@ export declare function ownArgs<T>(v: T, root?: string): {
|
|
|
1879
1916
|
reason: string;
|
|
1880
1917
|
cause?: unknown;
|
|
1881
1918
|
};
|
|
1919
|
+
/** A call's argument reading (the loop's: the tool's preparation, the schema's coercions) whose every value is engine-owned
|
|
1920
|
+
* like a pass's args ({@link ownArgs}) — the gate's face seat and the resumed call's belt seat read through this one. */
|
|
1921
|
+
export declare function ownedReading(read: (args: unknown) => unknown): (args: unknown) => unknown;
|
|
1882
1922
|
/**
|
|
1883
1923
|
* A label for a value that was THROWN at us, safe to put in a fail-closed refusal. Never coerces: `String(x)`
|
|
1884
1924
|
* throws on a null-prototype object or a untrusted `toString`/`Symbol.toPrimitive`, and the thrower here is
|
|
@@ -1983,10 +2023,14 @@ export type ResolverArmResult = (Extract<ResolvedAsk, {
|
|
|
1983
2023
|
action: "allow";
|
|
1984
2024
|
}> & {
|
|
1985
2025
|
settlement?: Settlement;
|
|
1986
|
-
|
|
2026
|
+
bindingRefusal?: undefined;
|
|
2027
|
+
})
|
|
2028
|
+
/** `bindingRefusal`: the arm refused arguments no approval can be bound to — the record carries the sentence. */
|
|
2029
|
+
| (Extract<ResolvedAsk, {
|
|
1987
2030
|
action: "deny";
|
|
1988
2031
|
}> & {
|
|
1989
2032
|
settlement: Settlement;
|
|
2033
|
+
bindingRefusal?: string;
|
|
1990
2034
|
});
|
|
1991
2035
|
/**
|
|
1992
2036
|
* The DIRECTIONAL format controls, as a closed set (see {@link AskRequest.hasBidiControls}):
|