@sema-agent/core 7.55.0 → 7.57.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 +1054 -0
- package/LICENSE +1 -1
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +7 -7
- package/dist/agents/org-delivery-gate.js +3 -4
- package/dist/agents/peer-directory.d.ts +22 -4
- package/dist/agents/peer-directory.js +24 -2
- package/dist/agents/peer-held-queue.d.ts +69 -49
- package/dist/agents/peer-held-queue.js +255 -106
- package/dist/agents/peer-session-drain.js +65 -45
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/send-message-tool.js +7 -6
- package/dist/agents/subagent.d.ts +6 -4
- package/dist/agents/subagent.js +72 -68
- package/dist/agents/tool-filter.d.ts +7 -5
- package/dist/agents/tool-filter.js +12 -9
- package/dist/agents/verify.d.ts +3 -2
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +45 -80
- 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 +2 -8
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +23 -34
- package/dist/brain/openai.js +25 -96
- package/dist/brain/provider-dialect.d.ts +3 -2
- package/dist/brain/provider-dialect.js +2 -2
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +11 -11
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +13 -4
- package/dist/brain/request-params.js +21 -5
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.d.ts +9 -0
- package/dist/brain/stream-engine.js +24 -10
- package/dist/brain/stream-shared.d.ts +5 -4
- package/dist/brain/stream-shared.js +4 -4
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/agent-definition.d.ts +10 -0
- package/dist/core/allow-entry.d.ts +23 -23
- package/dist/core/allow-entry.js +42 -46
- package/dist/core/allow-rule-shadow.d.ts +3 -3
- package/dist/core/approval-object.d.ts +21 -5
- package/dist/core/approval-object.js +44 -17
- package/dist/core/ask-origin.d.ts +66 -20
- package/dist/core/ask-origin.js +63 -23
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +3 -4
- 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 +71 -6
- package/dist/core/auto-compaction.js +42 -26
- package/dist/core/background-agent-store.d.ts +6 -2
- package/dist/core/background-agent-store.js +1 -1
- 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 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-store.d.ts +105 -53
- package/dist/core/checkpoint-store.js +43 -20
- package/dist/core/cross-boundary-taint.d.ts +6 -5
- package/dist/core/cross-boundary-taint.js +5 -5
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +17 -17
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- 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 +32 -12
- package/dist/core/engine-notice.js +6 -0
- package/dist/core/file-history-store.d.ts +104 -22
- package/dist/core/file-history-store.js +37 -19
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +22 -10
- package/dist/core/gate-lanes.js +73 -65
- package/dist/core/gate-outcome.d.ts +26 -5
- package/dist/core/gate-outcome.js +26 -0
- package/dist/core/governance-codes.d.ts +5 -1
- package/dist/core/governance-codes.js +6 -0
- package/dist/core/hooks.d.ts +19 -18
- 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 +38 -3
- package/dist/core/host-target.js +38 -5
- package/dist/core/mailbox-store.d.ts +62 -1
- package/dist/core/mailbox-store.js +59 -0
- package/dist/core/mcp-name-judge.d.ts +46 -0
- package/dist/core/mcp-name-judge.js +61 -0
- package/dist/core/mcp-probe.d.ts +1 -1
- package/dist/core/mcp-probe.js +2 -5
- package/dist/core/mcp.d.ts +5 -1
- package/dist/core/mcp.js +70 -64
- package/dist/core/memory-engine/consolidation-driver.js +4 -3
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/distiller.js +26 -17
- 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 +70 -8
- 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 +32 -38
- package/dist/core/namespaced-rule-name.js +29 -36
- package/dist/core/parent-spec-seat.d.ts +6 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +3 -0
- package/dist/core/permission-rule-consent.d.ts +24 -3
- package/dist/core/permission-rule-consent.js +136 -41
- package/dist/core/permission-rule-model.d.ts +57 -5
- package/dist/core/permission-rule-model.js +90 -31
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +8 -4
- package/dist/core/permission-rule-provider.d.ts +5 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +3 -2
- package/dist/core/permission-rule-store.js +11 -2
- package/dist/core/permission-rule-sync.js +3 -2
- 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 +4 -4
- package/dist/core/permission-rules.js +11 -20
- package/dist/core/persisted-rule-arms.d.ts +2 -2
- package/dist/core/persisted-rule-arms.js +10 -12
- 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 +40 -5
- package/dist/core/protocol-http-auth.js +168 -4
- package/dist/core/protocol-naming.d.ts +20 -0
- package/dist/core/protocol-naming.js +20 -3
- package/dist/core/read-only-shell.d.ts +20 -5
- package/dist/core/read-only-shell.js +29 -14
- package/dist/core/remote-env.d.ts +37 -1
- package/dist/core/remote-env.js +11 -0
- package/dist/core/resume-startup-cause.d.ts +24 -2
- package/dist/core/resume-startup-cause.js +20 -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 +28 -1
- package/dist/core/roles.js +81 -26
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-owner.d.ts +3 -3
- package/dist/core/rule-owner.js +3 -2
- package/dist/core/runner/announce-once-ledger.d.ts +14 -0
- package/dist/core/runner/announce-once-ledger.js +5 -0
- package/dist/core/runner/assemble-result.d.ts +1 -0
- 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 +16 -4
- package/dist/core/runner/caller-roster.js +33 -6
- 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 +7 -9
- package/dist/core/runner/classifier-ladder.js +3 -3
- package/dist/core/runner/compact-session.d.ts +10 -0
- package/dist/core/runner/compact-session.js +202 -0
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-seams.d.ts +21 -1
- package/dist/core/runner/compaction-seams.js +11 -8
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +50 -40
- package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
- package/dist/core/runner/cross-boundary-lane.js +40 -27
- package/dist/core/runner/denial-limit-arms.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +13 -0
- package/dist/core/runner/derived-route-fallback.js +6 -0
- package/dist/core/runner/env-capability-census.d.ts +3 -2
- package/dist/core/runner/env-capability-census.js +9 -3
- 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 +3 -3
- package/dist/core/runner/gate-exit.js +4 -3
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
- package/dist/core/runner/permission-rule-lanes.js +39 -17
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +18 -7
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
- package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
- 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 +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +35 -38
- package/dist/core/runner/prepare-config-doors.js +46 -28
- 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-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +7 -39
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
- package/dist/core/runner/prepare-gate-stations.js +10 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
- package/dist/core/runner/prepare-hands-readface.js +17 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +5 -3
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +2 -0
- package/dist/core/runner/prepare-park-ask.js +7 -7
- package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
- package/dist/core/runner/prepare-policy-chain.js +67 -76
- 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 +3 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-safety-scan.js +0 -17
- 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 +5 -2
- package/dist/core/runner/prepare-task.js +48 -43
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
- 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 +6 -2
- 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/retired-runner-deps.js +1 -0
- package/dist/core/runner/rewind-files.d.ts +12 -0
- package/dist/core/runner/rewind-files.js +90 -0
- package/dist/core/runner/run-attachment-seats.js +2 -1
- 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-harness-handlers.js +12 -4
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +40 -39
- package/dist/core/runner/run-notification-lane.d.ts +2 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -4
- package/dist/core/runner/run-settle-and-teardown.js +7 -12
- package/dist/core/runner/run-terminal-adoption.js +3 -4
- package/dist/core/runner/run-turn-boundary.js +4 -15
- package/dist/core/runner/runtask.d.ts +10 -0
- package/dist/core/runner/runtask.js +35 -42
- package/dist/core/runner/send-message-continuation.js +1 -1
- 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.js +4 -3
- package/dist/core/runner/session-verb-doors.d.ts +28 -0
- package/dist/core/runner/session-verb-doors.js +48 -0
- package/dist/core/runner/session-write-ledger.d.ts +30 -0
- package/dist/core/runner/session-write-ledger.js +101 -0
- 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/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +12 -15
- package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
- package/dist/core/runner/sub-agent-deny-lists.js +25 -17
- package/dist/core/runner/synthetic-tools.d.ts +6 -0
- package/dist/core/runner/synthetic-tools.js +4 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -0
- package/dist/core/runner/teardown-bounded.js +1 -0
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +1 -3
- 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-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/turn-attachments.d.ts +33 -15
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +7 -7
- 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 +11 -3
- package/dist/core/secret-env.d.ts +30 -3
- package/dist/core/secret-env.js +47 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/session-policy-store.d.ts +32 -15
- package/dist/core/session-policy-store.js +156 -36
- package/dist/core/session-store.d.ts +29 -10
- package/dist/core/session-store.js +51 -19
- package/dist/core/session.d.ts +82 -16
- package/dist/core/session.js +53 -0
- 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.d.ts +1 -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.js +10 -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/background-agent-store-contract.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
- package/dist/core/store-contracts/file-history-store-contract.js +40 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
- 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-repo-contract.js +51 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/session-store-contract.js +150 -14
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +32 -4
- package/dist/core/task-notification.d.ts +16 -12
- package/dist/core/task-registry-agent.d.ts +8 -4
- package/dist/core/task-registry-agent.js +14 -8
- package/dist/core/task-registry-shared.d.ts +35 -6
- package/dist/core/task-registry-shared.js +11 -0
- package/dist/core/task-registry.d.ts +10 -1
- package/dist/core/task-registry.js +12 -2
- package/dist/core/task-result.d.ts +18 -0
- package/dist/core/task-spec.d.ts +18 -13
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +23 -0
- package/dist/core/tool-catalog-entries.js +14 -2
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-model-gate.d.ts +2 -2
- package/dist/core/tool-name-aliases.d.ts +48 -18
- package/dist/core/tool-name-aliases.js +36 -19
- package/dist/core/tool-name-readings.d.ts +6 -32
- package/dist/core/tool-name-readings.js +2 -9
- package/dist/core/tool-policy.d.ts +78 -204
- package/dist/core/tool-policy.js +152 -204
- package/dist/core/tool-result-store.js +3 -0
- package/dist/core/tool-roster.d.ts +14 -19
- package/dist/core/tool-roster.js +11 -44
- package/dist/core/tool-spec-members.js +7 -2
- package/dist/core/tool-spec.d.ts +19 -11
- package/dist/core/tools.js +49 -9
- package/dist/core/trace.d.ts +6 -3
- package/dist/core/trace.js +2 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +20 -0
- package/dist/core/untrusted-egress.js +77 -3
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/wiring-manifest.d.ts +9 -0
- package/dist/core/wiring-manifest.js +1 -0
- package/dist/core/workflow-journal-store.js +1 -1
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
- package/dist/engine/execution-env/node-execution-env.js +11 -2
- package/dist/engine/harness/agent-harness.d.ts +32 -6
- package/dist/engine/harness/agent-harness.js +65 -9
- package/dist/engine/harness/types.d.ts +29 -2
- package/dist/engine/llm/types.d.ts +28 -11
- package/dist/engine/loop/agent-loop.d.ts +23 -4
- package/dist/engine/loop/agent-loop.js +42 -30
- package/dist/engine/loop/types.d.ts +16 -6
- package/dist/engine/session/memory-repo.d.ts +9 -2
- package/dist/engine/session/memory-repo.js +11 -1
- package/dist/engine/session/repo-utils.d.ts +6 -5
- package/dist/engine/session/repo-utils.js +14 -6
- package/dist/index.d.ts +34 -17
- package/dist/index.js +22 -11
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +6 -4
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +36 -18
- package/dist/primitives/credential-ref.d.ts +89 -0
- package/dist/primitives/credential-ref.js +125 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -0
- 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 +1 -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 +37 -3
- package/dist/prompt-assembly/tool-catalog.js +114 -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/scenarios/full-body.d.ts +11 -11
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.js +4 -3
- package/dist/stores/file/adoption/marker.js +3 -2
- package/dist/stores/file/checkpoint-store.d.ts +21 -4
- package/dist/stores/file/checkpoint-store.js +38 -7
- package/dist/stores/file/file-history-store.js +18 -11
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +2 -1
- package/dist/stores/file/mailbox-store.js +26 -1
- package/dist/stores/file/permission-rule-adopt.js +4 -3
- package/dist/stores/file/permission-rule-store.js +11 -5
- package/dist/stores/file/session-store.d.ts +29 -6
- package/dist/stores/file/session-store.js +42 -50
- package/dist/tools/artifact/artifact-tool.js +3 -2
- 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 +15 -19
- package/dist/tools/fs/bash-readonly-classifier.js +5 -10
- package/dist/tools/fs/fs-bash.js +15 -8
- 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/pattern-kill-guard.d.ts +23 -0
- package/dist/tools/fs/pattern-kill-guard.js +429 -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/removal-targets.d.ts +17 -7
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/search.d.ts +10 -0
- 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.d.ts +10 -0
- package/dist/tools/fs/shell-read-check.js +13 -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-identity.d.ts +12 -9
- package/dist/tools/fs/shell-read-identity.js +9 -4
- 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/todo.js +63 -63
- package/dist/tools/web.d.ts +19 -14
- package/dist/tools/web.js +46 -61
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +221 -7
- package/wire-changes/core-stores-sql@7.57.0.json +29 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/core@7.57.0.json +1487 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/wire-changes/mods-kernel@7.57.0.json +29 -0
- package/wire-changes/primitives@7.57.0.json +245 -0
package/dist/core/allow-entry.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { heldBy } from "./tool-name-readings.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
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";
|
|
5
|
+
import { splitNamespacedName, toolNameFaultOf } 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
8
|
import { callHostTargetOf } from "./host-target.js";
|
|
8
|
-
import {
|
|
9
|
+
import { adjudicatePersistedDomainRules, wholeToolRuleReaches, adjudicatePersistedNameRules, commandCoverageOf, laneToolNamesOf, ruleContentOf, noticeRuleText, parseRuleText, programRunReachOf, ruleToolGrammarOf, commandPatternMayRun } from "./permission-rule-model.js";
|
|
9
10
|
import { pathRuleLaneAnswer } from "./runner/permission-rule-lanes.js";
|
|
10
11
|
import { callTargetReadingOf } from "./effective-path-target.js";
|
|
11
12
|
import { splitShellCompoundSegments } from "../tools/fs/bash-readonly-classifier.js";
|
|
@@ -24,30 +25,12 @@ export function nonListValueLabel(read) {
|
|
|
24
25
|
function ruleRowOf(parsed) {
|
|
25
26
|
return { ...parsed, scope: { kind: "global" }, adds: [{ dot: { actor: "list", counter: 1 }, origin: "user", createdAt: "" }] };
|
|
26
27
|
}
|
|
27
|
-
function mountedSpellingOf(name, roster) {
|
|
28
|
-
const folded = name.toLowerCase();
|
|
29
|
-
for (const mounted of roster)
|
|
30
|
-
if (mounted.toLowerCase() === folded)
|
|
31
|
-
return mounted;
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
export function nearMissSpellingOf(name, roster) {
|
|
35
|
-
if (roster.has(name) || catalogToolNames().has(name) || splitNamespacedName(name) !== undefined)
|
|
36
|
-
return undefined;
|
|
37
|
-
return mountedSpellingOf(name, roster);
|
|
38
|
-
}
|
|
39
28
|
export function rootFacingToolNames(carried) {
|
|
40
29
|
return new Set([...catalogToolNames(), ...carried]);
|
|
41
30
|
}
|
|
42
31
|
function toolNameReading(name, roster, behavior) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
return { kind: "inert", reason: "tool_name", verdict: verdict.kind };
|
|
46
|
-
if (verdict.kind !== "current") {
|
|
47
|
-
return { kind: "inert", reason: "tool_name", verdict: verdict.kind, guidance: verdict.guidance, ...(verdict.currentName !== undefined ? { currentName: verdict.currentName } : {}) };
|
|
48
|
-
}
|
|
49
|
-
const mounted = nearMissSpellingOf(name, roster);
|
|
50
|
-
return mounted === undefined ? undefined : { kind: "inert", reason: "near_miss", currentName: mounted };
|
|
32
|
+
const fault = toolNameFaultOf(name, roster, behavior);
|
|
33
|
+
return fault === undefined ? undefined : { kind: "inert", ...fault };
|
|
51
34
|
}
|
|
52
35
|
export function readRuleEntry(raw, behavior, roster) {
|
|
53
36
|
const inert = (reason) => ({ kind: "inert", reason });
|
|
@@ -58,7 +41,7 @@ export function readRuleEntry(raw, behavior, roster) {
|
|
|
58
41
|
if (parsed === undefined)
|
|
59
42
|
return inert("grammar");
|
|
60
43
|
const name = parsed.toolName;
|
|
61
|
-
if (name === "*")
|
|
44
|
+
if (name === "*" && behavior === "allow")
|
|
62
45
|
return inert("wildcard_all");
|
|
63
46
|
if (roster !== undefined) {
|
|
64
47
|
const stale = toolNameReading(name, roster, behavior);
|
|
@@ -66,14 +49,10 @@ export function readRuleEntry(raw, behavior, roster) {
|
|
|
66
49
|
return stale;
|
|
67
50
|
}
|
|
68
51
|
if (ruleContentOf(parsed) === undefined) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (isNamespacedCoveringRuleName(name))
|
|
74
|
-
return row({ kind: "namespace", pattern: name });
|
|
75
|
-
return row({ kind: "tool", name });
|
|
76
|
-
}
|
|
52
|
+
if (isCoveringRuleName(name, behavior))
|
|
53
|
+
return row({ kind: "covering", pattern: name });
|
|
54
|
+
if (name.includes("*"))
|
|
55
|
+
return inert(splitNamespacedName(name) !== undefined ? "namespace_wildcard" : "grammar");
|
|
77
56
|
return row(isShellFaceToolName(name) ? { kind: "shell", name } : { kind: "tool", name });
|
|
78
57
|
}
|
|
79
58
|
const grammar = ruleToolGrammarOf(name);
|
|
@@ -94,7 +73,7 @@ export function compiledEntryName(compiled) {
|
|
|
94
73
|
case "tool":
|
|
95
74
|
case "shell":
|
|
96
75
|
return compiled.name;
|
|
97
|
-
case "
|
|
76
|
+
case "covering":
|
|
98
77
|
return compiled.pattern;
|
|
99
78
|
default:
|
|
100
79
|
return compiled.rule.tool;
|
|
@@ -104,11 +83,10 @@ function inertReasonOf(code) {
|
|
|
104
83
|
return code === "unsupported.tool" ? "content_unsupported" : "grammar";
|
|
105
84
|
}
|
|
106
85
|
export function compileAllowList(entries, behavior, roster) {
|
|
107
|
-
const voided = behavior === "allow" && entries.some(namesWholeRoster);
|
|
108
86
|
const rows = [];
|
|
109
87
|
const inert = [];
|
|
110
88
|
for (const entry of entries) {
|
|
111
|
-
const read =
|
|
89
|
+
const read = readRuleEntry(entry, behavior, roster);
|
|
112
90
|
if (read.kind === "row")
|
|
113
91
|
rows.push({ entry, compiled: read.compiled });
|
|
114
92
|
else {
|
|
@@ -119,9 +97,6 @@ export function compileAllowList(entries, behavior, roster) {
|
|
|
119
97
|
}
|
|
120
98
|
return { rows, inert };
|
|
121
99
|
}
|
|
122
|
-
function namesWholeRoster(entry) {
|
|
123
|
-
return typeof entry === "string" && entry === entry.trim() && parsePermissionRule(entry).toolName === "*";
|
|
124
|
-
}
|
|
125
100
|
function answersTo(req, has) {
|
|
126
101
|
return heldBy("allowEntry.names", { has }, req);
|
|
127
102
|
}
|
|
@@ -160,7 +135,7 @@ export function autoStripped(compiled, call) {
|
|
|
160
135
|
return call !== undefined && answersTo(call, isShellFaceToolName);
|
|
161
136
|
case "command":
|
|
162
137
|
return compiled.rule.match === "pattern" ? commandPatternMayRun(compiled.rule.command, AUTO_STRIPPED_PROGRAMS) : shellContentStripped(shellRuleContent(compiled.rule));
|
|
163
|
-
case "
|
|
138
|
+
case "covering":
|
|
164
139
|
case "path":
|
|
165
140
|
case "name":
|
|
166
141
|
case "domain":
|
|
@@ -172,12 +147,22 @@ export function autoStripped(compiled, call) {
|
|
|
172
147
|
}
|
|
173
148
|
}
|
|
174
149
|
export function autoStrippedRule(rule, call) {
|
|
175
|
-
|
|
150
|
+
if (rule.behavior !== "allow")
|
|
151
|
+
return false;
|
|
152
|
+
const entry = entryOfRow(rule);
|
|
153
|
+
return entry !== undefined && autoStripped(entry, call);
|
|
154
|
+
}
|
|
155
|
+
function entryOfRow(rule) {
|
|
156
|
+
if (rule.match === "tool")
|
|
157
|
+
return isShellFaceToolName(rule.tool) ? { kind: "shell", name: rule.tool } : { kind: "tool", name: rule.tool };
|
|
158
|
+
const grammar = ruleToolGrammarOf(rule.tool);
|
|
159
|
+
return grammar === undefined ? undefined : { kind: grammar, rule };
|
|
176
160
|
}
|
|
177
161
|
const NO_LEADS = new Map();
|
|
178
162
|
function nameRowReaches(compiled, req) {
|
|
179
|
-
|
|
180
|
-
|
|
163
|
+
if (compiled.kind === "tool" || compiled.kind === "shell")
|
|
164
|
+
return wholeToolRuleReaches(compiled.name, req);
|
|
165
|
+
return compiled.kind === "covering" && answersTo(req, (n) => ruleNameCovers(compiled.pattern, n));
|
|
181
166
|
}
|
|
182
167
|
function commandOf(req) {
|
|
183
168
|
const tool = laneToolNamesOf(req).find((n) => ruleToolGrammarOf(n) === "command");
|
|
@@ -348,6 +333,16 @@ export function allowRuleShadowOf(member, entries) {
|
|
|
348
333
|
const shown = entries.slice(0, SHADOW_ENTRIES_MAX).map((e) => inlineUntrusted(e, SHADOW_ENTRY_MAX_CHARS));
|
|
349
334
|
return { member, entries: shown, ...(entries.length > shown.length ? { omitted: entries.length - shown.length } : {}) };
|
|
350
335
|
}
|
|
336
|
+
export function withAllowRuleShadow(list, shadow) {
|
|
337
|
+
const at = list.findIndex((s) => s.member === shadow.member);
|
|
338
|
+
if (at < 0)
|
|
339
|
+
return [...list, shadow];
|
|
340
|
+
const held = list[at];
|
|
341
|
+
const entries = [...held.entries, ...shadow.entries];
|
|
342
|
+
const shown = entries.slice(0, SHADOW_ENTRIES_MAX);
|
|
343
|
+
const omitted = (held.omitted ?? 0) + (shadow.omitted ?? 0) + (entries.length - shown.length);
|
|
344
|
+
return list.map((s, i) => (i === at ? { member: held.member, entries: shown, ...(omitted > 0 ? { omitted } : {}) } : s));
|
|
345
|
+
}
|
|
351
346
|
const MEMBER_SET = new Set(ALLOW_RULE_MEMBERS);
|
|
352
347
|
export function readAllowRuleShadows(value) {
|
|
353
348
|
try {
|
|
@@ -432,10 +427,11 @@ export function allowRuleShadowSentence(shadows, ask) {
|
|
|
432
427
|
}
|
|
433
428
|
export function cardDisclosureOf(decision, fallbackMessage) {
|
|
434
429
|
const base = decision.message ?? fallbackMessage;
|
|
430
|
+
const outlet = decision.editRewritten !== undefined ? { editRewritten: decision.editRewritten } : {};
|
|
435
431
|
const shadows = readAllowRuleShadows(decision.allowRuleShadowed);
|
|
436
432
|
if (shadows === undefined)
|
|
437
|
-
return { message: base };
|
|
438
|
-
return { message: `${base} (${allowRuleShadowSentence(shadows, decision)})`, allowRuleShadowed: shadows };
|
|
433
|
+
return { message: base, ...outlet };
|
|
434
|
+
return { message: `${base} (${allowRuleShadowSentence(shadows, decision)})`, allowRuleShadowed: shadows, ...outlet };
|
|
439
435
|
}
|
|
440
436
|
export const ALLOWED_TOOL_NOT_GRANTED_CODE = "permission.allowed_tool_not_granted";
|
|
441
437
|
const NOTICE_ENTRIES_SHOWN = 5;
|
|
@@ -486,7 +482,7 @@ export function allowedToolsNotGrantedNotice(inert, sessionId) {
|
|
|
486
482
|
return {
|
|
487
483
|
code: ALLOWED_TOOL_NOT_GRANTED_CODE,
|
|
488
484
|
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` : ""}. ` +
|
|
489
|
-
"
|
|
485
|
+
"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." +
|
|
490
486
|
(refusing ? " Such an entry in a disallowed-tools list keeps its Skill from activating: a refusal that reads as nothing is not dropped." : ""),
|
|
491
487
|
detail: { ...(sessionId !== undefined ? { sessionId } : {}), entries: inert.map((e) => ({ ...e, entry: noticeRuleText(e.entry) })) },
|
|
492
488
|
};
|
|
@@ -8,9 +8,9 @@
|
|
|
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[];
|
|
@@ -1,6 +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 { ReadLanding } from "../tools/fs/shell-read-identity.js";
|
|
4
5
|
import type { ToolCallPathTarget, ToolFamily, ToolHostTarget } from "./tool-face.js";
|
|
5
6
|
import { type ToolRosterEntry } from "./tool-roster.js";
|
|
6
7
|
type ParkedApproval = Extract<PendingAction, {
|
|
@@ -16,6 +17,15 @@ export type ApprovalTargetRole = (typeof APPROVAL_TARGET_ROLES)[number];
|
|
|
16
17
|
export type ApprovalTargets = {
|
|
17
18
|
readonly [R in ApprovalTargetRole]?: string | null;
|
|
18
19
|
};
|
|
20
|
+
/** The row's `targetReads` member: per read candidate the shell read station judged for the parked bytes (its key's
|
|
21
|
+
* digest), where it landed (its settled targets' digest — a pattern lands on a set). A sibling of `targets`, not a key
|
|
22
|
+
* inside it: a reader that knows only the path roles reads an unknown key there as damage and spends the approval, where
|
|
23
|
+
* a member of its own carries its own word and that reader refuses the row unread (`version_newer`). Present exactly when
|
|
24
|
+
* the station judged the parked bytes — `{}` when it found no read candidate: a candidate appearing by the resume is a
|
|
25
|
+
* read the card did not cover. */
|
|
26
|
+
export type ApprovalTargetReads = {
|
|
27
|
+
readonly [candidate: string]: string;
|
|
28
|
+
};
|
|
19
29
|
/** The tool member as the row carries it: every member optional (a row is read, never trusted to be whole). */
|
|
20
30
|
export interface ApprovalTool {
|
|
21
31
|
readonly capabilityId?: string;
|
|
@@ -29,17 +39,21 @@ export interface ApprovalTool {
|
|
|
29
39
|
export interface ApprovalObject {
|
|
30
40
|
/** Absent on a row minted before the identity members (all four absent): such a row binds the tool's name alone. */
|
|
31
41
|
readonly tool?: ApprovalTool;
|
|
32
|
-
/** The row's
|
|
42
|
+
/** The row's two target members as stored — read, validated, by the judge. */
|
|
33
43
|
readonly targets?: unknown;
|
|
44
|
+
readonly targetReads?: unknown;
|
|
34
45
|
readonly grants?: string;
|
|
35
46
|
}
|
|
36
47
|
/** The view of one parked approval's object. */
|
|
37
48
|
export declare function approvalObjectOf(row: ParkedApproval): ApprovalObject;
|
|
38
|
-
/** The
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
49
|
+
/** The TARGETS of a reading — the one mint of both members, for the row and for the live call alike: `targets` per role,
|
|
50
|
+
* the canonical view, or `null` for a view the environment was asked for and did not answer (nothing when no role was read
|
|
51
|
+
* either way, or no reading was taken); `targetReads` per read candidate the shell read station judged, where it landed
|
|
52
|
+
* (nothing when the station judged no candidate of these bytes). The park mints them from the gate's readings of the parked
|
|
53
|
+
* bytes; the execution station reads the bytes that will run the same way. */
|
|
54
|
+
export declare function approvalTargetsOf(reading: CallTargetReading | undefined, reads?: readonly ReadLanding[]): {
|
|
42
55
|
targets?: ApprovalTargets;
|
|
56
|
+
targetReads?: ApprovalTargetReads;
|
|
43
57
|
};
|
|
44
58
|
/** Where a resume judges the object: before the claim (the decided bytes), before the session is touched (the live
|
|
45
59
|
* tool), right before the execution (the tool as mounted then — a host's re-dial can replace it between the two — and the
|
|
@@ -71,6 +85,8 @@ export interface LiveApprovalObject {
|
|
|
71
85
|
readonly skillToolName?: string;
|
|
72
86
|
/** execution: the reading of the bytes that will run, taken at this station (`undefined`: none could be taken). */
|
|
73
87
|
readonly targetReading?: CallTargetReading | undefined;
|
|
88
|
+
/** execution: where this leg's shell read station found those bytes' reads land (`undefined`: it holds no judgment of them). */
|
|
89
|
+
readonly reads?: readonly ReadLanding[] | undefined;
|
|
74
90
|
/** execution: the bytes the decision rewrote the call to, as the tool reads them; absent when it rewrote nothing. When
|
|
75
91
|
* the row's binding does not cover them ({@link licenseCovers}, the one judge of "are these the approved bytes") the
|
|
76
92
|
* person approved bytes whose target the row never recorded, and the targets member is not judged. */
|
|
@@ -5,22 +5,23 @@ 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, hostTarget, targets, boundGrantDigest } = row;
|
|
8
|
+
const { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget, hostTarget, targets, targetReads, boundGrantDigest } = row;
|
|
9
9
|
const carried = [capabilityId, contractId, shapeDigest, implementationRevision].some((m) => m !== undefined);
|
|
10
10
|
return {
|
|
11
11
|
...(carried ? { tool: { capabilityId, contractId, shapeDigest, implementationRevision, family, pathTarget, hostTarget } } : {}),
|
|
12
12
|
...(targets !== undefined ? { targets } : {}),
|
|
13
|
+
...(targetReads !== undefined ? { targetReads } : {}),
|
|
13
14
|
...(boundGrantDigest !== undefined ? { grants: boundGrantDigest } : {}),
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
export function approvalTargetsOf(reading) {
|
|
17
|
+
export function approvalTargetsOf(reading, reads) {
|
|
17
18
|
const targets = {};
|
|
18
19
|
for (const role of APPROVAL_TARGET_ROLES) {
|
|
19
20
|
const view = reading?.[role];
|
|
20
21
|
if (view?.kind === "path" && (view.canonical !== undefined || view.unread === true))
|
|
21
22
|
targets[role] = view.canonical ?? null;
|
|
22
23
|
}
|
|
23
|
-
return Object.keys(targets).length > 0 ? { targets } : {};
|
|
24
|
+
return { ...(Object.keys(targets).length > 0 ? { targets } : {}), ...(reads !== undefined ? { targetReads: Object.fromEntries(reads.map((r) => [r.key, r.landing])) } : {}) };
|
|
24
25
|
}
|
|
25
26
|
export const APPROVAL_STATION_MEMBERS = Object.freeze({
|
|
26
27
|
claim: Object.freeze(["grants"]),
|
|
@@ -52,22 +53,48 @@ function judgeTool(row, live) {
|
|
|
52
53
|
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
54
|
}
|
|
54
55
|
function judgeTargets(row, live) {
|
|
55
|
-
|
|
56
|
-
if (bound === undefined || ("decided" in live && !licenseCovers(row.boundInputHash, live.decided)))
|
|
56
|
+
if ((row.targets === undefined && row.targetReads === undefined) || ("decided" in live && !licenseCovers(row.boundInputHash, live.decided)))
|
|
57
57
|
return undefined;
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
const why = landedElsewhere(row.targets, row.targetReads, live);
|
|
59
|
+
return why === undefined ? undefined : { member: "targets", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, why) };
|
|
60
|
+
}
|
|
61
|
+
const DIGEST = /^[0-9a-f]{64}$/;
|
|
62
|
+
function landedElsewhere(bound, boundReads, live) {
|
|
63
|
+
if (bound !== undefined) {
|
|
64
|
+
const roles = typeof bound === "object" && bound !== null && !Array.isArray(bound) ? Object.entries(bound) : [];
|
|
65
|
+
const whole = roles.length > 0 && roles.every(([k, v]) => APPROVAL_TARGET_ROLES.includes(k) && (v === null || (typeof v === "string" && v.length > 0)));
|
|
66
|
+
if (!whole)
|
|
67
|
+
return "the target member of the approval on its checkpoint row is damaged (not a reading → resolved location record)";
|
|
68
|
+
const now = approvalTargetsOf(live.targetReading).targets ?? {};
|
|
69
|
+
const where = (p) => (p === null ? "did not resolve" : `resolved to ${shown(p)}`);
|
|
70
|
+
for (const [role, was] of roles) {
|
|
71
|
+
const is = now[role];
|
|
72
|
+
if (is === was)
|
|
73
|
+
continue;
|
|
74
|
+
return is === undefined ? `where its target resolves (it ${where(was)} when the card was asked) could not be established on this leg` : `its target ${is === null ? "does not resolve" : `resolves to ${shown(is)}`} now and ${where(was)} when the card was asked`;
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
|
-
|
|
77
|
+
if (boundReads === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
const record = typeof boundReads === "object" && boundReads !== null && !Array.isArray(boundReads);
|
|
80
|
+
const reads = record ? Object.entries(boundReads) : [];
|
|
81
|
+
if (!record || !reads.every(([k, v]) => DIGEST.test(k) && typeof v === "string" && DIGEST.test(v)))
|
|
82
|
+
return "the read member of the approval on its checkpoint row is damaged (not a read → landing record)";
|
|
83
|
+
if (live.reads === undefined)
|
|
84
|
+
return `where its reads land (the read station judged ${reads.length} when the card was asked) could not be established on this leg`;
|
|
85
|
+
const was = new Map(reads);
|
|
86
|
+
const now = new Map(Object.entries(approvalTargetsOf(undefined, live.reads).targetReads ?? {}));
|
|
87
|
+
const named = (key) => live.reads?.find((r) => r.key === key);
|
|
88
|
+
const added = [...now.keys()].find((k) => !was.has(k));
|
|
89
|
+
if (added !== undefined || [...was.keys()].some((k) => !now.has(k)))
|
|
90
|
+
return `this leg reads the command differently than when the card was asked (${added !== undefined ? `${shown(named(added)?.raw ?? "?")} is read now at a place or in a form the card did not cover` : "a read the card covered is not read now"})`;
|
|
91
|
+
const movedKey = [...now.keys()].find((k) => now.get(k) !== was.get(k));
|
|
92
|
+
const moved = movedKey === undefined ? undefined : named(movedKey);
|
|
93
|
+
if (movedKey === undefined)
|
|
94
|
+
return undefined;
|
|
95
|
+
const targets = moved?.targets ?? [];
|
|
96
|
+
const at = targets.length === 0 ? "cannot be placed" : `lands on ${shown(targets[0])}${targets.length > 1 ? ` (and ${targets.length - 1} more)` : ""}`;
|
|
97
|
+
return `its read ${shown(moved?.raw ?? "?")} ${at} now, not where it landed when the card was asked`;
|
|
71
98
|
}
|
|
72
99
|
function judgeGrants(row, live, station) {
|
|
73
100
|
const refusal = parkedSkillApprovalRefusal(row, live.args, live.skills ?? [], live.skillToolName ?? "", station);
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* the ask). Both stay where they are and are consumed beside the origin, not folded into it.
|
|
26
26
|
*/
|
|
27
27
|
import type { PermissionResult } from "./tool-policy.js";
|
|
28
|
+
import { type EngineAttestation } from "./engine-attestation.js";
|
|
28
29
|
import type { ContainmentFace } from "../tools/fs/containment-face.js";
|
|
29
30
|
/**
|
|
30
31
|
* The closed set, in AUTHORITY order — the order {@link askOriginOf} resolves a fold in when several
|
|
@@ -93,6 +94,12 @@ export type AssertAllKeysHandled<T extends never> = T;
|
|
|
93
94
|
* itself. Every member is a plain boolean/word read ONCE by the gate, so the derivation is a pure
|
|
94
95
|
* function that a test can drive arm by arm. */
|
|
95
96
|
export interface AskOriginFacts {
|
|
97
|
+
/** The call these facts are about — the one an engine record on the decision must be bound to for the derivation to read it
|
|
98
|
+
* ({@link import("./engine-attestation.js").attestationOf}): a record handed back for another call reads as absent. */
|
|
99
|
+
readonly call: {
|
|
100
|
+
readonly toolCallId: string;
|
|
101
|
+
readonly toolName: string;
|
|
102
|
+
};
|
|
96
103
|
/** The call is on the reserved question tool. */
|
|
97
104
|
readonly contentQuestion: boolean;
|
|
98
105
|
/** The call is marked unresolvable by an ancestor (see the gate's `isMarkedUnresolvable` seat). */
|
|
@@ -148,7 +155,7 @@ export declare function askOriginOf(decision: Extract<PermissionResult, {
|
|
|
148
155
|
* word, so a site that stamped without it would be a second, quieter answer to one question.
|
|
149
156
|
* The same stamp writes the ask's CLASS members (`askClass` / `classes`, {@link askClassMembersOf} over the
|
|
150
157
|
* `classification` the caller derived from this decision under these facts): the word and the class leave the
|
|
151
|
-
* gate on one object
|
|
158
|
+
* gate on one object. No policy states either (the decision receipt refuses a stamp member).
|
|
152
159
|
*/
|
|
153
160
|
export declare function stampAskOrigin<T extends Extract<PermissionResult, {
|
|
154
161
|
action: "ask";
|
|
@@ -196,8 +203,8 @@ export type RuleOffersAbsence = (typeof RULE_OFFERS_ABSENCES)[number];
|
|
|
196
203
|
* class row's `ruleMayClear` ({@link classifyAsk} — every door below is a class there), read once by the gate's allow layer.
|
|
197
204
|
* · `word` — the DISCLOSED reason ({@link RuleOffersAbsence}), first door wins, in the display order the card has always
|
|
198
205
|
* used (governance, the outranked allow, the hook, the ask rule, the two ancestor doors, then the marks). Display
|
|
199
|
-
* only.
|
|
200
|
-
* task that cannot hold a rule) is decided BEFORE this and is deliberately silent;
|
|
206
|
+
* only. The structural door the offer factory owns (no rule speaks for the call: no lane wired, a
|
|
207
|
+
* task that cannot hold a rule, a call the lane does not judge) is decided BEFORE this and is deliberately silent;
|
|
201
208
|
* · `mandated` — the FACT the ask carries as its own member. Read off the whole mandate set, so which
|
|
202
209
|
* door is DISPLAYED cannot change it: an ask that is both outranked and mandated is mandated;
|
|
203
210
|
* · `mandate` — WHICH table word the bit stands on, only when the MARKS family is its whole reason (no
|
|
@@ -237,10 +244,14 @@ export interface RuleClearanceFacts {
|
|
|
237
244
|
/** The ask is being resolved at an ANCESTOR's frozen approver (the three inherited-lane mint sites
|
|
238
245
|
* pass it literally) — this task's rule lane never adjudicates it. */
|
|
239
246
|
ancestorResolved?: boolean;
|
|
240
|
-
/** The classes of the contributors the policy fold carried under this ask
|
|
241
|
-
*
|
|
242
|
-
|
|
247
|
+
/** The classes of the contributors the policy fold carried under this ask — the decision's engine record's
|
|
248
|
+
* ({@link EngineAttestation.foldedClasses}), filled in by the builder of these facts ({@link withFoldedOf}); a member whose row
|
|
249
|
+
* no rule may clear keeps the question a person's. */
|
|
250
|
+
foldedClasses?: readonly AskClass[];
|
|
243
251
|
}
|
|
252
|
+
/** `facts` with the folded contributors' classes the decision's record carries for its call — the one way a builder of
|
|
253
|
+
* {@link RuleClearanceFacts} fills them (a decision carries no such member: the record is their one carrier). */
|
|
254
|
+
export declare function withFoldedOf<F extends RuleClearanceFacts>(facts: F, record: EngineAttestation | undefined): F;
|
|
244
255
|
/** The ask FACE's mandate members — the bit and its table word, spread at the four mint stations and the
|
|
245
256
|
* park row. The stations hand it the SAME facts object they hand the rule-offer factory, so the card's word
|
|
246
257
|
* and these members are readings of one derivation and cannot drift. The tool SEAT is not re-judged here:
|
|
@@ -265,10 +276,11 @@ export declare function withProbeMandate<D extends Extract<PermissionResult, {
|
|
|
265
276
|
}>>(decision: D, account: string | undefined): D;
|
|
266
277
|
/** The clearance facts of an ask the engine did not construct (a policy's verdict), each member read ONCE into
|
|
267
278
|
* an engine-owned value — for a station that keeps the answer past its own side effects, where the verdict's
|
|
268
|
-
* accessors must not run again. The members a verdict may carry that narrow what may clear it
|
|
279
|
+
* accessors must not run again. The members a verdict may carry that narrow what may clear it, and the folded classes its
|
|
280
|
+
* record carries for `call`. */
|
|
269
281
|
export declare function ownedClearanceFacts(d: Extract<PermissionResult, {
|
|
270
282
|
action: "ask";
|
|
271
|
-
}
|
|
283
|
+
}>, call: AskOriginFacts["call"]): RuleClearanceFacts;
|
|
272
284
|
/**
|
|
273
285
|
* Which origins IMPLY the `requiresRealApproval` bit, and WHERE that implication is verified — the
|
|
274
286
|
* consistency table {@link askOriginOf} reads. An ask of a must-carry origin exists so that no automatic
|
|
@@ -813,16 +825,22 @@ export declare function askClassMembersOf(c: AskClassification): AskClassMembers
|
|
|
813
825
|
* first member in {@link ASK_CLASSES} order. The copy returned is fresh and frozen, never the caller's array. */
|
|
814
826
|
export declare function screenAskClassMembers(askClass: unknown, classes: unknown): AskClassMembers | undefined;
|
|
815
827
|
/**
|
|
816
|
-
* The
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
* `requiresRealApproval` with no explaining class is `policy_rra`; a self-declared
|
|
820
|
-
* class is `operator_forced` (a deployment probe's own mandate, read conservatively). Returns the
|
|
821
|
-
* classes only — an empty set is "nothing but hesitation", which the caller reads as `ordinary`.
|
|
828
|
+
* The OWN half of the class derivation — what ONE ask says about itself through its own members, and the integrity guards
|
|
829
|
+
* its engine record carries for its call (`record`, read by the caller through {@link attestationOf}): the guards are engine
|
|
830
|
+
* findings, never a member, so a policy cannot move a real-approval question into a guard's class. The bare-bit rules are
|
|
831
|
+
* applied over THIS ask's own set: `requiresRealApproval` with no explaining class is `policy_rra`; a self-declared
|
|
832
|
+
* `mandated` with no other class is `operator_forced` (a deployment probe's own mandate, read conservatively). Returns the
|
|
833
|
+
* specific classes only — an empty set is "nothing but hesitation", which the caller reads as `ordinary`.
|
|
822
834
|
*/
|
|
835
|
+
export declare function ownAskClassesOf(d: Extract<PermissionResult, {
|
|
836
|
+
action: "ask";
|
|
837
|
+
}>, record: EngineAttestation | undefined): Set<AskClass>;
|
|
838
|
+
/** The DECISION's classes as the policy fold reads a contributing ask: its own ({@link ownAskClassesOf}) and the classes of the
|
|
839
|
+
* asks a fold already collapsed into it ({@link EngineAttestation.foldedClasses}) — both off its record for `call`, so a
|
|
840
|
+
* fact the fold does not copy is not lost behind the ask that won the slot. */
|
|
823
841
|
export declare function decisionAskClassesOf(d: Extract<PermissionResult, {
|
|
824
842
|
action: "ask";
|
|
825
|
-
}
|
|
843
|
+
}>, call: AskOriginFacts["call"]): Set<AskClass>;
|
|
826
844
|
/** Fold a class set onto one row: `bypassImmune` and `hookAskFloor` by OR (any immune member keeps the ask; any floored
|
|
827
845
|
* member floors a hook's ask), the three permissive switches by AND (one refusing member withholds the lane). An empty
|
|
828
846
|
* set is `ordinary`. The two faces the ask was raised under enter HERE and nowhere else, so every reader of the folded row
|
|
@@ -865,9 +883,36 @@ export declare function dontAskRefusalMessage(input: {
|
|
|
865
883
|
* asked (`approvalReach: "none"`), whatever is wired. Absent in the input reads as `absent` (the posture the function was
|
|
866
884
|
* written for). */
|
|
867
885
|
export type HeadlessApproverSeat = "absent" | "unavailable" | "declared_none";
|
|
886
|
+
/** The kinds of way out a refusal carries as DATA: `approver` — a person who can answer becomes reachable (the sentence's approver clause);
|
|
887
|
+
* `permission_mode` — a mode that releases the ask with nobody answering it (`bypassPermissions`, unless the deployment's caps deny it:
|
|
888
|
+
* a denied bypass folds to `default`). A host renders a kind or leaves it unrendered; the sentence a user reads never teaches the release. */
|
|
889
|
+
export declare const APPROVAL_REMEDY_KINDS: readonly ["approver", "permission_mode"];
|
|
890
|
+
export type ApprovalRemedyKind = (typeof APPROVAL_REMEDY_KINDS)[number];
|
|
891
|
+
/** Membership test for {@link ApprovalRemedyKind} — the word rides a notice detail across process boundaries. */
|
|
892
|
+
export declare function isApprovalRemedyKind(v: unknown): v is ApprovalRemedyKind;
|
|
893
|
+
/** One way out, discriminated by `kind` ({@link APPROVAL_REMEDY_KINDS}). `permission_mode` names the mode (`value`: `bypassPermissions`, the one
|
|
894
|
+
* mode that releases an ask a person did not answer) and where the release is disclosed (`disclosedOn`: the allowed disposition's `released`
|
|
895
|
+
* member on the call's `tool_end.gate`) — the disclosure a host shows beside the offer. */
|
|
896
|
+
export type ApprovalRemedy = {
|
|
897
|
+
readonly kind: "approver";
|
|
898
|
+
} | {
|
|
899
|
+
readonly kind: "permission_mode";
|
|
900
|
+
readonly value: "bypassPermissions";
|
|
901
|
+
readonly disclosedOn: "gate.disposition.released";
|
|
902
|
+
};
|
|
903
|
+
/** One {@link ApprovalRemedy} read from `v`, as a fresh plain object holding only the fields its kind owns — or `undefined` when `v` is not exactly
|
|
904
|
+
* one (a kind outside the closed set, a member missing, a member beyond the kind's own, any field inherited rather than own). Each field is read
|
|
905
|
+
* once; the notice mint copies through this and refuses what it cannot read. */
|
|
906
|
+
export declare function readApprovalRemedy(v: unknown): ApprovalRemedy | undefined;
|
|
907
|
+
/** The headless remedy: `sentence` — the user-facing way out, which names the approver and never offers the bypass release — and `remedies` — every way out as data, the approver first. */
|
|
908
|
+
export interface HeadlessApprovalRemedy {
|
|
909
|
+
readonly sentence: string;
|
|
910
|
+
readonly remedies: readonly ApprovalRemedy[];
|
|
911
|
+
}
|
|
868
912
|
/**
|
|
869
|
-
* The ONE
|
|
870
|
-
* after its refusal: the caller-side change that would have let this call run
|
|
913
|
+
* The ONE answer a headless auto-deny (an ask that reached its final deny because no approver is wired) adds
|
|
914
|
+
* after its refusal: the caller-side change that would have let this call run, as a sentence (`sentence`) and as the
|
|
915
|
+
* ways out in data (`remedies`, {@link ApprovalRemedy}: the approver in every arm). Read off the effective mode, the
|
|
871
916
|
* ask's folded class row and whether the call is a covered write (the mode write gate's own question):
|
|
872
917
|
* · a class no permission mode releases (`bypassImmune`) — only a person can answer it: wire an approver;
|
|
873
918
|
* · the plan mode's own question (`mode`) — leave plan (steer the mode, or approve the plan) or wire an approver;
|
|
@@ -875,11 +920,12 @@ export type HeadlessApproverSeat = "absent" | "unavailable" | "declared_none";
|
|
|
875
920
|
* directories through without asking;
|
|
876
921
|
* · the same ask under `acceptEdits` — the target lies outside the working directories: add its directory to
|
|
877
922
|
* `additionalDirectories`;
|
|
878
|
-
* · any other releasable ask — `bypassPermissions` releases it (disclosed on the call)
|
|
923
|
+
* · any other releasable ask, and a tool that states no permission of its own — `bypassPermissions` releases it (disclosed on the call):
|
|
924
|
+
* the sentence does not say so; `remedies` carries it as a `permission_mode` member for a host that chooses to offer it.
|
|
879
925
|
* Every arm also names the approver, in the clause of the seat's own state ({@link HeadlessApproverSeat}): none wired ⇒
|
|
880
926
|
* wire one; one wired that answered `unavailable` for this ask ⇒ make a person reachable through it (a wired approver is
|
|
881
927
|
* never told to be wired); the run declared nobody can be asked ⇒ run it where a person can be, or park it. The refusal's tool text and the `delegation.ask_unresolvable` notice both carry this sentence —
|
|
882
|
-
* they call this function, neither spells it.
|
|
928
|
+
* they call this function, neither spells it — and the notice carries `remedies` beside it.
|
|
883
929
|
* Under `dontAsk` (the mode answers no ask: {@link dontAskRefusalMessage} carries this arm) the one question is whether an allow
|
|
884
930
|
* rule may clear the ask — the folded row's `ruleMayClear`, the allow layer's own reading: yes ⇒ add an allow rule covering the
|
|
885
931
|
* call, in the tool's rule shape (`ruleShape`, the caller's reading of the call's grammar — never a rule minted for the call), or
|
|
@@ -894,7 +940,7 @@ export declare function headlessApprovalRemedy(input: {
|
|
|
894
940
|
};
|
|
895
941
|
readonly approverSeat?: HeadlessApproverSeat;
|
|
896
942
|
readonly ruleShape?: string;
|
|
897
|
-
}):
|
|
943
|
+
}): HeadlessApprovalRemedy;
|
|
898
944
|
/** The reference implementation's sentence for a `cp` / `mv` the mode will not answer because it carries option
|
|
899
945
|
* words — the approval card's message under `acceptEdits` and the head of the headless remedy. */
|
|
900
946
|
export declare function fileCommandOptionsSentence(program: "cp" | "mv"): string;
|