@sema-agent/core 7.54.1 → 7.56.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 +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +15 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.js +12 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EditRewritten } from "./rewrite-rejudge.js";
|
|
1
2
|
import { type RuleToolNameVerdict } from "./tool-name-aliases.js";
|
|
2
3
|
import type { ToolCallRequest } from "./tool-policy.js";
|
|
3
4
|
import { type AllowRuleMember, type AllowRuleShadow } from "./allow-rule-shadow.js";
|
|
@@ -46,14 +47,15 @@ export type AllowEntryInert = {
|
|
|
46
47
|
readonly entry: string;
|
|
47
48
|
readonly reason: AllowEntryInertReason;
|
|
48
49
|
} & AllowEntryInertDetail;
|
|
49
|
-
/** One entry the grammar reads (kind closed): a whole non-shell tool; a
|
|
50
|
-
*
|
|
51
|
-
* the
|
|
50
|
+
/** One entry the grammar reads (kind closed): a whole non-shell tool; a covering spelling — a set of tool names
|
|
51
|
+
* ({@link isCoveringRuleName}: a protocol peer, a glob over a protocol name's tool segment, and on a deny list a `*` anywhere in
|
|
52
|
+
* the name, `*` alone every tool); the whole shell tool; and one kind per rule grammar (`ruleToolGrammarOf`) — a shell command
|
|
53
|
+
* rule, a path rule, a name rule, a host rule — each the row the persisted grammar parses, its `behavior` the list's direction. */
|
|
52
54
|
export type CompiledAllowEntry = {
|
|
53
55
|
readonly kind: "tool";
|
|
54
56
|
readonly name: string;
|
|
55
57
|
} | {
|
|
56
|
-
readonly kind: "
|
|
58
|
+
readonly kind: "covering";
|
|
57
59
|
readonly pattern: string;
|
|
58
60
|
} | {
|
|
59
61
|
readonly kind: "shell";
|
|
@@ -108,15 +110,13 @@ export type RuleEntryReading = {
|
|
|
108
110
|
* grammar alone is read — what a resume's pre-claim screen can read before the leg has a roster.
|
|
109
111
|
*/
|
|
110
112
|
export declare function readRuleEntry(raw: unknown, behavior: "allow" | "deny", roster?: ReadonlySet<string>): RuleEntryReading;
|
|
111
|
-
/** The tool name a compiled entry speaks for — its tool, its
|
|
113
|
+
/** The tool name a compiled entry speaks for — its tool, its covering spelling, or its rule's tool (what a name audit reads). */
|
|
112
114
|
export declare function compiledEntryName(compiled: CompiledAllowEntry): string;
|
|
113
115
|
/**
|
|
114
|
-
* Compile one list
|
|
115
|
-
* reason and, for a name the roster refuses, the judgment's word and the spelling to write).
|
|
116
|
-
*
|
|
117
|
-
*
|
|
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}.
|
|
116
|
+
* Compile one list through {@link readRuleEntry}, entry by entry: the entries it reads and the ones it reads as nothing (each
|
|
117
|
+
* with its reason and, for a name the roster refuses, the judgment's word and the spelling to write). No entry changes how
|
|
118
|
+
* another is read: a `*` on an allow list grants nothing by itself (`wildcard_all`) and the entries beside it keep their
|
|
119
|
+
* reading; on a deny list it refuses every tool. `roster` as in {@link readRuleEntry}.
|
|
120
120
|
*/
|
|
121
121
|
export declare function compileAllowList(entries: readonly string[], behavior: "allow" | "deny", roster?: ReadonlySet<string>): {
|
|
122
122
|
rows: Array<{
|
|
@@ -126,7 +126,7 @@ export declare function compileAllowList(entries: readonly string[], behavior: "
|
|
|
126
126
|
inert: AllowEntryInert[];
|
|
127
127
|
};
|
|
128
128
|
/** The programs whose open allow rule the reference implementation drops in auto mode — its interpreter / launcher table
|
|
129
|
-
* plus the shells and the run-anything builtins
|
|
129
|
+
* plus the shells and the run-anything builtins. A program that only reaches the network is not here. */
|
|
130
130
|
export declare const AUTO_STRIPPED_PROGRAMS: readonly ["python", "python3", "python2", "node", "deno", "tsx", "ruby", "perl", "php", "lua", "npx", "bunx", "npm run", "yarn run", "pnpm run", "bun run", "bash", "sh", "ssh", "zsh", "fish", "eval", "exec", "env", "xargs", "sudo"];
|
|
131
131
|
/**
|
|
132
132
|
* Does auto mode strip this allow entry for this call (see the module doc)? Read for every rule-shaped member — a list
|
|
@@ -163,17 +163,23 @@ export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[],
|
|
|
163
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
|
|
164
164
|
* wide tightening reading; a call that cannot be read against the row is refused too). PATH — the persisted path adjudication
|
|
165
165
|
* (allow: the narrow reading, every view of the target inside what the row names; deny: any view reaching it). NAME / DOMAIN —
|
|
166
|
-
* the one predicate of each (the name the call names, the host it
|
|
167
|
-
*
|
|
166
|
+
* the one predicate of each (the name the call names, the host it reaches — a deny row read on the protective reading, an allow
|
|
167
|
+
* row on the tool's own declared slot, `callHostTargetOf`; a mounted name tool's value resolved against the agent types the call's
|
|
168
|
+
* face carries, `nameRuleReach`); a closed-set tool's call naming no value is refused by a deny list's row of the tool and granted
|
|
169
|
+
* by no allow row (the persisted walk's reading, `nameValueAbsentReason`), a mounted tool's call whose face carries no values is
|
|
170
|
+
* refused by a deny list's row of the tool and granted by no allow row, and a call whose host cannot be read is refused by a deny
|
|
171
|
+
* list's host row and granted by no allow row (`adjudicatePersistedDomainRules`).
|
|
168
172
|
*/
|
|
169
173
|
export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture): readonly R[] | undefined;
|
|
170
174
|
/** The allow rows of a list, as the allow layer reads them in `mode`: the strip applied BEFORE the match (in `auto`). */
|
|
171
175
|
export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined): readonly R[];
|
|
172
176
|
/** The two sources {@link AllowEntryTable} holds (a skill's list is the skill table's). */
|
|
173
177
|
export type AllowEntrySource = "request" | "deployment";
|
|
174
|
-
/** What spoke for a call: the entries it stands on, as the list spells them
|
|
178
|
+
/** What spoke for a call: the entries it stands on, as the list spells them, and — for entries of the list the run received —
|
|
179
|
+
* the index of every element of that list that is one of them (a string listed twice has both). */
|
|
175
180
|
export interface AllowEntryHit {
|
|
176
181
|
readonly entries: readonly string[];
|
|
182
|
+
readonly positions?: readonly number[];
|
|
177
183
|
}
|
|
178
184
|
/** The face the gate reads one entry list through. */
|
|
179
185
|
export interface AllowEntryLane {
|
|
@@ -208,9 +214,16 @@ export interface AllowEntryGateSeats {
|
|
|
208
214
|
export declare class AllowEntryTable {
|
|
209
215
|
private held;
|
|
210
216
|
private readonly heldEntries;
|
|
217
|
+
/** Each entry of the list the run RECEIVED for this source, with its indices in that list — what a hit's `positions` read. */
|
|
218
|
+
private receivedAt;
|
|
211
219
|
/** Write a list's rows (a row already held is not held twice). Returns the entries that read as nothing. `roster` as in
|
|
212
|
-
* {@link readRuleEntry}: a list the leg itself wrote is read against it, a carried one (a delegating parent's capture) is not.
|
|
213
|
-
|
|
220
|
+
* {@link readRuleEntry}: a list the leg itself wrote is read against it, a carried one (a delegating parent's capture) is not.
|
|
221
|
+
* `received`: this list is the one the run received for the source (the request's `TaskSpec.allowedTools`, the deployment's
|
|
222
|
+
* `RunnerDeps.allowedTools`), the list a hit's positions are read in; a carried capture is not. */
|
|
223
|
+
seed(entries: readonly string[], reading?: {
|
|
224
|
+
readonly roster?: ReadonlySet<string>;
|
|
225
|
+
readonly received?: true;
|
|
226
|
+
}): readonly AllowEntryInert[];
|
|
214
227
|
/** The entries held, as written (a copy) — what a delegated child is handed. */
|
|
215
228
|
entries(): readonly string[];
|
|
216
229
|
/** Does the table hold a path row — must the leg read each call's target views for it? */
|
|
@@ -245,21 +258,36 @@ export declare function withDeploymentAllowedTools<D extends {
|
|
|
245
258
|
}>(deps: D): D;
|
|
246
259
|
/** The code a list value that is not a list of strings refuses with — the policy compiler's family, with its issues. */
|
|
247
260
|
export declare const INVALID_PERMISSION_RULES_CODE = "config.invalid_permission_rules";
|
|
261
|
+
/** The two seats an allow list is handed over at — the library coordinates the refusal carries as `libraryOption`, each with the
|
|
262
|
+
* words the sentence says instead. */
|
|
263
|
+
declare const ALLOW_LIST_SEATS: {
|
|
264
|
+
readonly "TaskSpec.allowedTools": "the request's allow list";
|
|
265
|
+
readonly "RunnerDeps.allowedTools": "the deployment's allow list";
|
|
266
|
+
};
|
|
267
|
+
type AllowedToolsSeat = keyof typeof ALLOW_LIST_SEATS;
|
|
248
268
|
/**
|
|
249
|
-
* Screen and snapshot one `allowedTools` value (`seat`
|
|
250
|
-
* ⇒ a frozen copy (the one read every later reader takes);
|
|
251
|
-
* {@link INVALID_PERMISSION_RULES_CODE} and an issue per defect — never dropped, never read
|
|
269
|
+
* Screen and snapshot one `allowedTools` value (`seat` is the seat it was handed at; the sentence says it in words, the issues'
|
|
270
|
+
* `libraryOption` names it): absent ⇒ undefined; a list of strings ⇒ a frozen copy (the one read every later reader takes);
|
|
271
|
+
* anything else refuses loudly with {@link INVALID_PERMISSION_RULES_CODE} and an issue per defect — never dropped, never read
|
|
272
|
+
* as "no entries".
|
|
252
273
|
*/
|
|
253
|
-
export declare function screenAllowedToolsValue(value: unknown, seat:
|
|
274
|
+
export declare function screenAllowedToolsValue(value: unknown, seat: AllowedToolsSeat): readonly string[] | undefined;
|
|
254
275
|
/** The disclosure record for one member, minted from the entries it matched: each sanitized (deployment or model-authored
|
|
255
276
|
* text on a human trust boundary) and capped, the rest counted. */
|
|
256
277
|
export declare function allowRuleShadowOf(member: AllowRuleMember, entries: readonly string[]): AllowRuleShadow;
|
|
278
|
+
/** A disclosure list with one more member's record folded in: ONE record per member — a member already disclosed gains the
|
|
279
|
+
* other record's entries after its own (every speaking, in reading order: two shown names that read alike are two speakers),
|
|
280
|
+
* the cap kept and the rest counted; any other member is appended. Records are minted values already ({@link allowRuleShadowOf}). */
|
|
281
|
+
export declare function withAllowRuleShadow(list: readonly AllowRuleShadow[], shadow: AllowRuleShadow): AllowRuleShadow[];
|
|
257
282
|
/** Read a disclosure value off a decision WITHOUT trusting it (a policy's own value, an ancestor's): every record a known
|
|
258
283
|
* member with a list of strings, or nothing — a display member must never throw where a card is minted. */
|
|
259
284
|
export declare function readAllowRuleShadows(value: unknown): readonly AllowRuleShadow[] | undefined;
|
|
260
|
-
/**
|
|
261
|
-
*
|
|
262
|
-
|
|
285
|
+
/** The ask class whose reason is not a row: `probe` is the class of a FINDING about this very call (the read station's, or a
|
|
286
|
+
* probe's), and only the ask's own account of it — its `probeReason` — can say which ({@link allowRuleShadowSentence}). */
|
|
287
|
+
export type AccountedClass = "probe";
|
|
288
|
+
/** Why a matched entry did not clear the ask, by the ask's class — one row per class that has a reason of its own, so a class
|
|
289
|
+
* added later is a compile error here rather than somebody else's reason on the card. Two facts the ask carries are read first,
|
|
290
|
+
* because they name the reason more exactly than a class shared by several: a table word (`mandate` — the exact mark) and the
|
|
263
291
|
* deployment's own authorship (`authoredBy`) — {@link allowRuleShadowSentence} is the reader that applies that order.
|
|
264
292
|
* Exported (frozen) so a host that renders the card's "why it cannot be cleared" half reads the engine's row, never a copy. */
|
|
265
293
|
export declare const SHADOW_REASON: Readonly<{
|
|
@@ -272,26 +300,25 @@ export declare const SHADOW_REASON: Readonly<{
|
|
|
272
300
|
readonly transcript_write: "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule";
|
|
273
301
|
readonly org_rule: "an organization policy rule requires approval for this call";
|
|
274
302
|
readonly rule_unreadable: "a rule that may govern this call cannot currently be read (this deployment's organization policy, a partition of the person's standing rules, or this call against a deny or ask rule), so whether one forbids it is unknown";
|
|
275
|
-
readonly ask_rule:
|
|
303
|
+
readonly ask_rule: "an explicit ask rule matched this call (a person's or the deployment's ask-me-each-time outranks a standing allow rule)";
|
|
276
304
|
readonly denial_limit_fallback: "the auto-mode classifier refused too many calls in a row, so a person decides";
|
|
277
305
|
readonly classifier_no_ruling: "the auto-mode classifier could not judge this call, so a person decides";
|
|
278
306
|
readonly requires_user_interaction: "this tool's server declares that a call must be put to a person";
|
|
279
|
-
readonly cross_boundary:
|
|
307
|
+
readonly cross_boundary: "this run executes on a device outside the deployment's trust boundary and the deployment is multi-tenant, so an org-side write — or, after an off-target read, a call bound for the device — is confirmed by the deployment's approver for this call: no standing allow rule and no automatic lane answers for it, and an allow the configuration gives (a blanket seat or a policy's answer) is refused";
|
|
280
308
|
readonly operator_forced: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule";
|
|
281
|
-
readonly shell_floor:
|
|
282
|
-
readonly target_unresolved:
|
|
283
|
-
readonly
|
|
284
|
-
readonly
|
|
285
|
-
readonly
|
|
286
|
-
readonly tool_marks_a2a: string;
|
|
309
|
+
readonly shell_floor: "this deployment mandates per-call confirmation for shell commands (shellGate: always)";
|
|
310
|
+
readonly target_unresolved: "where this write leads on disk could not be determined (a link on the way could not be examined, or the environment could not resolve the target), so whether it lands on a guarded path is unknown — it is cleared by confirming this call: no standing rule and no automatic decider answers for it, though a wired approver seat can";
|
|
311
|
+
readonly write_protection: "this write's target is on the deployment's write-protection table (the agent's own configuration is guarded one look per write) — it is cleared by confirming this call, never by a standing allow rule";
|
|
312
|
+
readonly tool_marks_mcp: "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)";
|
|
313
|
+
readonly tool_marks_a2a: "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)";
|
|
287
314
|
readonly policy_rra: "the deployment's policy requires a real approval for this call";
|
|
288
315
|
readonly artifact_shared_read: "this read targets another task's shared artifact — it is cleared by confirming this call";
|
|
289
316
|
readonly mode: "the permission mode puts this question to a person";
|
|
290
317
|
readonly unstated: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule";
|
|
291
318
|
readonly ordinary: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule";
|
|
292
319
|
}>;
|
|
293
|
-
/** The fence over the reason table: `never` while every class has a row. */
|
|
294
|
-
export type ShadowReasonTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof SHADOW_REASON>>;
|
|
320
|
+
/** The fence over the reason table: `never` while every class that has a reason of its own has a row. */
|
|
321
|
+
export type ShadowReasonTableCoversEveryClass = AssertAllKeysHandled<Exclude<AskClass, keyof typeof SHADOW_REASON | AccountedClass>>;
|
|
295
322
|
/**
|
|
296
323
|
* The disclosure in the sentence a PERSON reads — rendered where a card or a park row is minted, never onto the decision
|
|
297
324
|
* the classifier reads: "<members> match(es) this call but do(es) not clear the ask — <why>".
|
|
@@ -300,18 +327,23 @@ export declare function allowRuleShadowSentence(shadows: readonly AllowRuleShado
|
|
|
300
327
|
askClass?: AskClass;
|
|
301
328
|
mandate?: PersistedRuleMandate;
|
|
302
329
|
authoredBy?: "deployment";
|
|
330
|
+
probeReason?: string;
|
|
303
331
|
}): string;
|
|
304
|
-
/** The card's
|
|
305
|
-
* sanitized records,
|
|
332
|
+
/** The card's disclosure members off a surviving ask, minted at every station that builds an approval request: the
|
|
333
|
+
* sanitized records, the message with the sentence rendered onto it, and the outlet of a person's rewritten edit (the
|
|
334
|
+
* approved-edit pass's own member, whose form is the bytes the card presents). */
|
|
306
335
|
export declare function cardDisclosureOf(decision: {
|
|
307
336
|
message?: string;
|
|
308
337
|
allowRuleShadowed?: unknown;
|
|
309
338
|
askClass?: AskClass;
|
|
310
339
|
mandate?: PersistedRuleMandate;
|
|
311
340
|
authoredBy?: "deployment";
|
|
341
|
+
probeReason?: string;
|
|
342
|
+
editRewritten?: EditRewritten;
|
|
312
343
|
}, fallbackMessage: string): {
|
|
313
344
|
message: string;
|
|
314
345
|
allowRuleShadowed?: readonly AllowRuleShadow[];
|
|
346
|
+
editRewritten?: EditRewritten;
|
|
315
347
|
};
|
|
316
348
|
/** The notice for list entries that grant (or refuse) nothing — one code for every list. */
|
|
317
349
|
export declare const ALLOWED_TOOL_NOT_GRANTED_CODE = "permission.allowed_tool_not_granted";
|
|
@@ -348,3 +380,4 @@ export declare function inertEntryPhrase(e: AllowEntryInert): string;
|
|
|
348
380
|
* `disallowed-tools` holds such an entry is named as one that does not activate.
|
|
349
381
|
*/
|
|
350
382
|
export declare function allowedToolsNotGrantedNotice(inert: readonly AllowEntryInertNote[], sessionId: string | undefined): EngineNotice;
|
|
383
|
+
export {};
|
package/dist/core/allow-entry.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { heldBy } from "./tool-name-readings.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ruleIssue } from "./permission-rules.js";
|
|
3
|
+
import { isCoveringRuleName, ruleNameCovers } from "./namespaced-rule-name.js";
|
|
4
|
+
import { ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
4
5
|
import { judgeRuleToolName, splitNamespacedName } from "./tool-name-aliases.js";
|
|
5
6
|
import { catalogToolNames, isShellFaceToolName } from "./tool-registry.js";
|
|
6
7
|
import { ALLOW_RULE_MEMBERS } from "./allow-rule-shadow.js";
|
|
7
|
-
import {
|
|
8
|
+
import { callHostTargetOf } from "./host-target.js";
|
|
9
|
+
import { COMMAND_RULE_TOOL, adjudicatePersistedDomainRules, adjudicatePersistedNameRules, commandCoverageOf, laneToolNamesOf, ruleContentOf, noticeRuleText, parseRuleText, programRunReachOf, ruleToolGrammarOf, commandPatternMayRun } from "./permission-rule-model.js";
|
|
8
10
|
import { pathRuleLaneAnswer } from "./runner/permission-rule-lanes.js";
|
|
9
11
|
import { callTargetReadingOf } from "./effective-path-target.js";
|
|
10
12
|
import { splitShellCompoundSegments } from "../tools/fs/bash-readonly-classifier.js";
|
|
11
|
-
import { mandateDisclosureOf } from "./ask-origin.js";
|
|
12
|
-
import { inlineUntrusted } from "./untrusted-text.js";
|
|
13
|
+
import { ASK_RULE_DISCLOSURE, MANDATE_DISCLOSURE, mandateDisclosureOf } from "./ask-origin.js";
|
|
14
|
+
import { inlineUntrusted, isMintableProbeReason } from "./untrusted-text.js";
|
|
13
15
|
import { valueTypeLabel } from "./tool-name-list.js";
|
|
14
16
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
15
17
|
export const ALLOW_ENTRY_INERT_REASONS = Object.freeze(["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"]);
|
|
@@ -38,8 +40,8 @@ export function nearMissSpellingOf(name, roster) {
|
|
|
38
40
|
export function rootFacingToolNames(carried) {
|
|
39
41
|
return new Set([...catalogToolNames(), ...carried]);
|
|
40
42
|
}
|
|
41
|
-
function toolNameReading(name, roster) {
|
|
42
|
-
const verdict = judgeRuleToolName(name, roster);
|
|
43
|
+
function toolNameReading(name, roster, behavior) {
|
|
44
|
+
const verdict = judgeRuleToolName(name, roster, behavior);
|
|
43
45
|
if (verdict.kind === "unprefixed_namespace")
|
|
44
46
|
return { kind: "inert", reason: "tool_name", verdict: verdict.kind };
|
|
45
47
|
if (verdict.kind !== "current") {
|
|
@@ -57,22 +59,18 @@ export function readRuleEntry(raw, behavior, roster) {
|
|
|
57
59
|
if (parsed === undefined)
|
|
58
60
|
return inert("grammar");
|
|
59
61
|
const name = parsed.toolName;
|
|
60
|
-
if (name === "*")
|
|
62
|
+
if (name === "*" && behavior === "allow")
|
|
61
63
|
return inert("wildcard_all");
|
|
62
64
|
if (roster !== undefined) {
|
|
63
|
-
const stale = toolNameReading(name, roster);
|
|
65
|
+
const stale = toolNameReading(name, roster, behavior);
|
|
64
66
|
if (stale !== undefined)
|
|
65
67
|
return stale;
|
|
66
68
|
}
|
|
67
|
-
if (parsed
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (isNamespacedCoveringRuleName(name))
|
|
73
|
-
return row({ kind: "namespace", pattern: name });
|
|
74
|
-
return row({ kind: "tool", name });
|
|
75
|
-
}
|
|
69
|
+
if (ruleContentOf(parsed) === undefined) {
|
|
70
|
+
if (isCoveringRuleName(name, behavior))
|
|
71
|
+
return row({ kind: "covering", pattern: name });
|
|
72
|
+
if (name.includes("*"))
|
|
73
|
+
return inert(splitNamespacedName(name) !== undefined ? "namespace_wildcard" : "grammar");
|
|
76
74
|
return row(isShellFaceToolName(name) ? { kind: "shell", name } : { kind: "tool", name });
|
|
77
75
|
}
|
|
78
76
|
const grammar = ruleToolGrammarOf(name);
|
|
@@ -93,7 +91,7 @@ export function compiledEntryName(compiled) {
|
|
|
93
91
|
case "tool":
|
|
94
92
|
case "shell":
|
|
95
93
|
return compiled.name;
|
|
96
|
-
case "
|
|
94
|
+
case "covering":
|
|
97
95
|
return compiled.pattern;
|
|
98
96
|
default:
|
|
99
97
|
return compiled.rule.tool;
|
|
@@ -103,11 +101,10 @@ function inertReasonOf(code) {
|
|
|
103
101
|
return code === "unsupported.tool" ? "content_unsupported" : "grammar";
|
|
104
102
|
}
|
|
105
103
|
export function compileAllowList(entries, behavior, roster) {
|
|
106
|
-
const voided = behavior === "allow" && entries.some(namesWholeRoster);
|
|
107
104
|
const rows = [];
|
|
108
105
|
const inert = [];
|
|
109
106
|
for (const entry of entries) {
|
|
110
|
-
const read =
|
|
107
|
+
const read = readRuleEntry(entry, behavior, roster);
|
|
111
108
|
if (read.kind === "row")
|
|
112
109
|
rows.push({ entry, compiled: read.compiled });
|
|
113
110
|
else {
|
|
@@ -118,9 +115,6 @@ export function compileAllowList(entries, behavior, roster) {
|
|
|
118
115
|
}
|
|
119
116
|
return { rows, inert };
|
|
120
117
|
}
|
|
121
|
-
function namesWholeRoster(entry) {
|
|
122
|
-
return typeof entry === "string" && entry === entry.trim() && parsePermissionRule(entry).toolName === "*";
|
|
123
|
-
}
|
|
124
118
|
function answersTo(req, has) {
|
|
125
119
|
return heldBy("allowEntry.names", { has }, req);
|
|
126
120
|
}
|
|
@@ -158,8 +152,8 @@ export function autoStripped(compiled, call) {
|
|
|
158
152
|
case "tool":
|
|
159
153
|
return call !== undefined && answersTo(call, isShellFaceToolName);
|
|
160
154
|
case "command":
|
|
161
|
-
return shellContentStripped(shellRuleContent(compiled.rule));
|
|
162
|
-
case "
|
|
155
|
+
return compiled.rule.match === "pattern" ? commandPatternMayRun(compiled.rule.command, AUTO_STRIPPED_PROGRAMS) : shellContentStripped(shellRuleContent(compiled.rule));
|
|
156
|
+
case "covering":
|
|
163
157
|
case "path":
|
|
164
158
|
case "name":
|
|
165
159
|
case "domain":
|
|
@@ -175,7 +169,7 @@ export function autoStrippedRule(rule, call) {
|
|
|
175
169
|
}
|
|
176
170
|
const NO_LEADS = new Map();
|
|
177
171
|
function nameRowReaches(compiled, req) {
|
|
178
|
-
const covers = compiled.kind === "
|
|
172
|
+
const covers = compiled.kind === "covering" ? (n) => ruleNameCovers(compiled.pattern, n) : compiled.kind === "tool" || compiled.kind === "shell" ? (n) => n === compiled.name : undefined;
|
|
179
173
|
return covers !== undefined && answersTo(req, covers);
|
|
180
174
|
}
|
|
181
175
|
function commandOf(req) {
|
|
@@ -240,7 +234,8 @@ export function judgeAllowEntries(rows, req, behavior, ctx, posture = "grant") {
|
|
|
240
234
|
const table = familyRows.map((r) => r.compiled.rule);
|
|
241
235
|
for (const name of laneToolNamesOf(req).filter((n) => ruleToolGrammarOf(n) === grammar)) {
|
|
242
236
|
const at = { tool: name, cwd: ctx.root, ...(ctx.sessionId !== undefined ? { sessionId: ctx.sessionId } : {}) };
|
|
243
|
-
const
|
|
237
|
+
const named = { ...req, toolName: name };
|
|
238
|
+
const verdict = grammar === "name" ? adjudicatePersistedNameRules(table, { ...at, request: req }) : adjudicatePersistedDomainRules(table, { ...at, hosts: { tighten: callHostTargetOf(named, "tighten"), grant: callHostTargetOf(named, "grant") } });
|
|
244
239
|
if (verdict !== undefined && verdict.behavior === behavior)
|
|
245
240
|
return [familyRows.find((r) => r.compiled.rule === verdict.rules[0]) ?? familyRows[0]];
|
|
246
241
|
}
|
|
@@ -253,8 +248,19 @@ export function allowingRows(rows, req, mode) {
|
|
|
253
248
|
export class AllowEntryTable {
|
|
254
249
|
held = [];
|
|
255
250
|
heldEntries = new Set();
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
receivedAt = new Map();
|
|
252
|
+
seed(entries, reading = {}) {
|
|
253
|
+
const { rows, inert } = compileAllowList(entries, "allow", reading.roster);
|
|
254
|
+
if (reading.received === true) {
|
|
255
|
+
this.receivedAt = new Map();
|
|
256
|
+
entries.forEach((e, i) => {
|
|
257
|
+
const at = this.receivedAt.get(e);
|
|
258
|
+
if (at === undefined)
|
|
259
|
+
this.receivedAt.set(e, [i]);
|
|
260
|
+
else
|
|
261
|
+
at.push(i);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
258
264
|
for (const r of rows) {
|
|
259
265
|
if (this.heldEntries.has(r.entry))
|
|
260
266
|
continue;
|
|
@@ -273,15 +279,19 @@ export class AllowEntryTable {
|
|
|
273
279
|
return {
|
|
274
280
|
allowing: (req, mode) => {
|
|
275
281
|
const hit = judgeAllowEntries(allowingRows(this.held, req, mode), req, "allow", ctx);
|
|
276
|
-
|
|
282
|
+
if (hit === undefined)
|
|
283
|
+
return undefined;
|
|
284
|
+
const entries = hit.map((r) => r.entry);
|
|
285
|
+
const positions = entries.flatMap((e) => this.receivedAt.get(e) ?? []).sort((a, b) => a - b);
|
|
286
|
+
return { entries, ...(positions.length > 0 ? { positions } : {}) };
|
|
277
287
|
},
|
|
278
288
|
};
|
|
279
289
|
}
|
|
280
290
|
}
|
|
281
291
|
export function seedAllowEntryTables(tables, lists, roster) {
|
|
282
292
|
tables.request.seed(lists.inherited ?? []);
|
|
283
|
-
const requestInert = tables.request.seed(lists.request ?? [], roster);
|
|
284
|
-
const deploymentInert = tables.deployment.seed(lists.deployment ?? [], roster).filter((e) => e.reason === "tool_name" || e.reason === "near_miss");
|
|
293
|
+
const requestInert = tables.request.seed(lists.request ?? [], { roster, received: true });
|
|
294
|
+
const deploymentInert = tables.deployment.seed(lists.deployment ?? [], { roster, received: true }).filter((e) => e.reason === "tool_name" || e.reason === "near_miss");
|
|
285
295
|
return [
|
|
286
296
|
...lists.skillInert.map((e) => ({ source: "skill", ...e })),
|
|
287
297
|
...requestInert.map((e) => ({ source: "request", ...e })),
|
|
@@ -298,22 +308,27 @@ export function withDeploymentAllowedTools(deps) {
|
|
|
298
308
|
return { ...deps, allowedTools };
|
|
299
309
|
}
|
|
300
310
|
export const INVALID_PERMISSION_RULES_CODE = "config.invalid_permission_rules";
|
|
311
|
+
const ALLOW_LIST_SEATS = {
|
|
312
|
+
"TaskSpec.allowedTools": "the request's allow list",
|
|
313
|
+
"RunnerDeps.allowedTools": "the deployment's allow list",
|
|
314
|
+
};
|
|
301
315
|
export function screenAllowedToolsValue(value, seat) {
|
|
302
316
|
if (value === undefined)
|
|
303
317
|
return undefined;
|
|
318
|
+
const label = ALLOW_LIST_SEATS[seat];
|
|
304
319
|
const issues = [];
|
|
305
320
|
if (!Array.isArray(value)) {
|
|
306
|
-
issues.push(
|
|
321
|
+
issues.push(ruleIssue("", "invalid.entry_type", `${label} must be a list of permission-rule strings (got ${value === null ? "null" : typeof value})`, { name: seat }));
|
|
307
322
|
}
|
|
308
323
|
else {
|
|
309
324
|
const list = value;
|
|
310
325
|
list.forEach((entry, i) => {
|
|
311
326
|
if (typeof entry !== "string")
|
|
312
|
-
issues.push(
|
|
327
|
+
issues.push(ruleIssue("", "invalid.entry_type", `entry ${i} of ${label} must be a permission-rule string (got ${entry === null ? "null" : typeof entry})`, { name: seat }));
|
|
313
328
|
});
|
|
314
329
|
}
|
|
315
330
|
if (issues.length > 0) {
|
|
316
|
-
const e = new Error(`${
|
|
331
|
+
const e = new Error(`${label}: ${issues.length} invalid entr${issues.length === 1 ? "y" : "ies"} — refusing rather than running without them:\n${issues.map((i) => ` [${i.code}] ${i.message}`).join("\n")}`);
|
|
317
332
|
e.code = INVALID_PERMISSION_RULES_CODE;
|
|
318
333
|
e.issues = issues;
|
|
319
334
|
throw e;
|
|
@@ -326,6 +341,16 @@ export function allowRuleShadowOf(member, entries) {
|
|
|
326
341
|
const shown = entries.slice(0, SHADOW_ENTRIES_MAX).map((e) => inlineUntrusted(e, SHADOW_ENTRY_MAX_CHARS));
|
|
327
342
|
return { member, entries: shown, ...(entries.length > shown.length ? { omitted: entries.length - shown.length } : {}) };
|
|
328
343
|
}
|
|
344
|
+
export function withAllowRuleShadow(list, shadow) {
|
|
345
|
+
const at = list.findIndex((s) => s.member === shadow.member);
|
|
346
|
+
if (at < 0)
|
|
347
|
+
return [...list, shadow];
|
|
348
|
+
const held = list[at];
|
|
349
|
+
const entries = [...held.entries, ...shadow.entries];
|
|
350
|
+
const shown = entries.slice(0, SHADOW_ENTRIES_MAX);
|
|
351
|
+
const omitted = (held.omitted ?? 0) + (shadow.omitted ?? 0) + (entries.length - shown.length);
|
|
352
|
+
return list.map((s, i) => (i === at ? { member: held.member, entries: shown, ...(omitted > 0 ? { omitted } : {}) } : s));
|
|
353
|
+
}
|
|
329
354
|
const MEMBER_SET = new Set(ALLOW_RULE_MEMBERS);
|
|
330
355
|
export function readAllowRuleShadows(value) {
|
|
331
356
|
try {
|
|
@@ -359,18 +384,17 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
359
384
|
transcript_write: "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule",
|
|
360
385
|
org_rule: "an organization policy rule requires approval for this call",
|
|
361
386
|
rule_unreadable: "a rule that may govern this call cannot currently be read (this deployment's organization policy, a partition of the person's standing rules, or this call against a deny or ask rule), so whether one forbids it is unknown",
|
|
362
|
-
ask_rule:
|
|
387
|
+
ask_rule: ASK_RULE_DISCLOSURE,
|
|
363
388
|
denial_limit_fallback: "the auto-mode classifier refused too many calls in a row, so a person decides",
|
|
364
389
|
classifier_no_ruling: "the auto-mode classifier could not judge this call, so a person decides",
|
|
365
390
|
requires_user_interaction: "this tool's server declares that a call must be put to a person",
|
|
366
|
-
cross_boundary:
|
|
391
|
+
cross_boundary: MANDATE_DISCLOSURE.cross_boundary_taint,
|
|
367
392
|
operator_forced: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule",
|
|
368
|
-
shell_floor:
|
|
369
|
-
target_unresolved:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
tool_marks_a2a: mandateDisclosureOf("tool_marks"),
|
|
393
|
+
shell_floor: MANDATE_DISCLOSURE.operator_always,
|
|
394
|
+
target_unresolved: MANDATE_DISCLOSURE.target_unresolved,
|
|
395
|
+
write_protection: MANDATE_DISCLOSURE.write_protection,
|
|
396
|
+
tool_marks_mcp: MANDATE_DISCLOSURE.tool_marks,
|
|
397
|
+
tool_marks_a2a: MANDATE_DISCLOSURE.tool_marks,
|
|
374
398
|
policy_rra: "the deployment's policy requires a real approval for this call",
|
|
375
399
|
artifact_shared_read: "this read targets another task's shared artifact — it is cleared by confirming this call",
|
|
376
400
|
mode: "the permission mode puts this question to a person",
|
|
@@ -398,19 +422,24 @@ function memberPhrase(s) {
|
|
|
398
422
|
}
|
|
399
423
|
export function allowRuleShadowSentence(shadows, ask) {
|
|
400
424
|
const one = shadows.length === 1 && (shadows[0].member === "hook" || shadows[0].entries.length + (shadows[0].omitted ?? 0) === 1);
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
425
|
+
const { askClass, mandate, authoredBy, probeReason } = ask;
|
|
426
|
+
const account = typeof probeReason === "string" && probeReason.trim().length > 0 && isMintableProbeReason(probeReason) ? probeReason : undefined;
|
|
427
|
+
const why = mandate !== undefined
|
|
428
|
+
? mandateDisclosureOf(mandate, account)
|
|
429
|
+
: authoredBy === "deployment"
|
|
404
430
|
? "this deployment requires a person's confirmation for this call"
|
|
405
|
-
:
|
|
406
|
-
|
|
431
|
+
: askClass === "probe"
|
|
432
|
+
? account
|
|
433
|
+
: SHADOW_REASON[askClass ?? "ordinary"];
|
|
434
|
+
return `${shadows.map(memberPhrase).join("; ")} ${one ? "matches this call but does not clear the ask" : "match this call but do not clear the ask"}${why !== undefined ? ` — ${why}` : ""}`;
|
|
407
435
|
}
|
|
408
436
|
export function cardDisclosureOf(decision, fallbackMessage) {
|
|
409
437
|
const base = decision.message ?? fallbackMessage;
|
|
438
|
+
const outlet = decision.editRewritten !== undefined ? { editRewritten: decision.editRewritten } : {};
|
|
410
439
|
const shadows = readAllowRuleShadows(decision.allowRuleShadowed);
|
|
411
440
|
if (shadows === undefined)
|
|
412
|
-
return { message: base };
|
|
413
|
-
return { message: `${base} (${allowRuleShadowSentence(shadows, decision)})`, allowRuleShadowed: shadows };
|
|
441
|
+
return { message: base, ...outlet };
|
|
442
|
+
return { message: `${base} (${allowRuleShadowSentence(shadows, decision)})`, allowRuleShadowed: shadows, ...outlet };
|
|
414
443
|
}
|
|
415
444
|
export const ALLOWED_TOOL_NOT_GRANTED_CODE = "permission.allowed_tool_not_granted";
|
|
416
445
|
const NOTICE_ENTRIES_SHOWN = 5;
|
|
@@ -461,7 +490,7 @@ export function allowedToolsNotGrantedNotice(inert, sessionId) {
|
|
|
461
490
|
return {
|
|
462
491
|
code: ALLOWED_TOOL_NOT_GRANTED_CODE,
|
|
463
492
|
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` : ""}. ` +
|
|
464
|
-
"
|
|
493
|
+
"On an allow list a `*` outside a protocol name's tool segment (`*`, `Re*d`, `mcp__*`) names no scope and grants nothing — the entries beside it still grant — and 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; a tool name must be spelled as the tool is mounted; name the tools (or `mcp__<server>`) instead." +
|
|
465
494
|
(refusing ? " Such an entry in a disallowed-tools list keeps its Skill from activating: a refusal that reads as nothing is not dropped." : ""),
|
|
466
495
|
detail: { ...(sessionId !== undefined ? { sessionId } : {}), entries: inert.map((e) => ({ ...e, entry: noticeRuleText(e.entry) })) },
|
|
467
496
|
};
|
|
@@ -8,11 +8,18 @@
|
|
|
8
8
|
* `TaskSpec.allowedTools`. The closed set {@link AllowRuleShadow.member} names. */
|
|
9
9
|
export declare const ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
|
|
10
10
|
export type AllowRuleMember = (typeof ALLOW_RULE_MEMBERS)[number];
|
|
11
|
-
/** One allow-layer member that matched a call and could not clear its ask: the member, and the
|
|
12
|
-
* source spells them (sanitized and capped at the mint;
|
|
13
|
-
* `omitted` counts entries beyond the cap, never dropped silently. */
|
|
11
|
+
/** One allow-layer member that matched a call and could not clear its ask — one record per member: the member, and the
|
|
12
|
+
* entries it matched as their source spells them (sanitized and capped at the mint; the hook member names the registrations
|
|
13
|
+
* that spoke). `omitted` counts entries beyond the cap, never dropped silently. */
|
|
14
14
|
export interface AllowRuleShadow {
|
|
15
15
|
readonly member: AllowRuleMember;
|
|
16
16
|
readonly entries: readonly string[];
|
|
17
17
|
readonly omitted?: number;
|
|
18
18
|
}
|
|
19
|
+
/** The allow-layer member that CLEARED a call's ask (`tool_end.gate.disposition.clearedBy`): the shadow record's shape — the member
|
|
20
|
+
* and the entries it stood on, sanitized and capped by the same mint — plus, for a LIST member (`request`, `deployment`),
|
|
21
|
+
* `positions`: the index of every element of the list the run received that is one of those entries (a string listed twice has
|
|
22
|
+
* both indices), so a host reads which line of its own declaration spoke even where the shown text is capped. */
|
|
23
|
+
export interface AllowRuleClearance extends AllowRuleShadow {
|
|
24
|
+
readonly positions?: readonly number[];
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PendingAction } from "./checkpoint-store.js";
|
|
2
2
|
import type { CallTargetReading } from "./effective-path-target.js";
|
|
3
3
|
import { type SkillGrantSource } from "./skill-grant.js";
|
|
4
|
-
import type { ToolCallPathTarget, ToolFamily } from "./tool-face.js";
|
|
4
|
+
import type { ToolCallPathTarget, ToolFamily, ToolHostTarget } from "./tool-face.js";
|
|
5
5
|
import { type ToolRosterEntry } from "./tool-roster.js";
|
|
6
6
|
type ParkedApproval = Extract<PendingAction, {
|
|
7
7
|
kind: "tool_approval";
|
|
@@ -24,6 +24,7 @@ export interface ApprovalTool {
|
|
|
24
24
|
readonly implementationRevision?: string;
|
|
25
25
|
readonly family?: ToolFamily;
|
|
26
26
|
readonly pathTarget?: ToolCallPathTarget;
|
|
27
|
+
readonly hostTarget?: ToolHostTarget;
|
|
27
28
|
}
|
|
28
29
|
export interface ApprovalObject {
|
|
29
30
|
/** Absent on a row minted before the identity members (all four absent): such a row binds the tool's name alone. */
|
|
@@ -5,10 +5,10 @@ import { toolIdentityOf } from "./tool-roster.js";
|
|
|
5
5
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
6
6
|
export const APPROVAL_TARGET_ROLES = Object.freeze(["protective", "declared"]);
|
|
7
7
|
export function approvalObjectOf(row) {
|
|
8
|
-
const { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget, targets, boundGrantDigest } = row;
|
|
8
|
+
const { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget, hostTarget, targets, boundGrantDigest } = row;
|
|
9
9
|
const carried = [capabilityId, contractId, shapeDigest, implementationRevision].some((m) => m !== undefined);
|
|
10
10
|
return {
|
|
11
|
-
...(carried ? { tool: { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget } } : {}),
|
|
11
|
+
...(carried ? { tool: { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget, hostTarget } } : {}),
|
|
12
12
|
...(targets !== undefined ? { targets } : {}),
|
|
13
13
|
...(boundGrantDigest !== undefined ? { grants: boundGrantDigest } : {}),
|
|
14
14
|
};
|
|
@@ -30,9 +30,9 @@ export const APPROVAL_STATION_MEMBERS = Object.freeze({
|
|
|
30
30
|
const IDENTITY_MEMBERS = Object.freeze(["capabilityId", "contractId", "shapeDigest", "implementationRevision"]);
|
|
31
31
|
const shown = (s) => `"${inlineUntrusted(s, 240)}"`;
|
|
32
32
|
const vetoed = (name, why) => `The approved tool call "${name}" was not executed: ${why}, so the approval does not cover it (resume.target_moved). This approval is spent — the call has to be re-issued: its new card shows what it would act on now.`;
|
|
33
|
-
function faceKey(family, pt) {
|
|
33
|
+
function faceKey(family, pt, ht) {
|
|
34
34
|
const slot = pt === undefined ? null : { param: pt.param, access: pt.access, aliases: [...(pt.aliases ?? [])], base: pt.base ?? "cwd", absent: pt.absent ?? "none", patternParam: pt.patternParam ?? null, skillScopeEligible: pt.skillScopeEligible === true };
|
|
35
|
-
return canonicalize({ family: family ?? null, pathTarget: slot });
|
|
35
|
+
return canonicalize({ family: family ?? null, pathTarget: slot, hostTarget: ht === undefined ? null : { param: ht.param } });
|
|
36
36
|
}
|
|
37
37
|
function judgeTool(row, live) {
|
|
38
38
|
const entry = live.tool;
|
|
@@ -47,9 +47,9 @@ function judgeTool(row, live) {
|
|
|
47
47
|
const named = differ.map((k) => (bound[k] === undefined ? `${k} (missing on the row)` : k)).join(", ");
|
|
48
48
|
return { member: "tool", disposition: "reopen", code: "resume.tool_contract_mismatch", message: `the approved tool "${row.toolName}" on this leg is not the tool the approval was minted against (${named} differ) — refusing to execute a replacement wearing the name; the checkpoint is reopened for a retry with the original tool present` };
|
|
49
49
|
}
|
|
50
|
-
if (faceKey(bound.family, bound.pathTarget) === faceKey(entry.family, entry.pathTarget))
|
|
50
|
+
if (faceKey(bound.family, bound.pathTarget, bound.hostTarget) === faceKey(entry.family, entry.pathTarget, entry.hostTarget))
|
|
51
51
|
return undefined;
|
|
52
|
-
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, "the tool's face (its display family or the path target it declares) changed after the approval") };
|
|
52
|
+
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, "the tool's face (its display family, or the path target or URL slot it declares) changed after the approval") };
|
|
53
53
|
}
|
|
54
54
|
function judgeTargets(row, live) {
|
|
55
55
|
const bound = row.targets;
|