@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
|
@@ -284,12 +284,13 @@ function orgStateCopyOf(state) {
|
|
|
284
284
|
function readOrgRow(row, index) {
|
|
285
285
|
const { rule: text, behavior: said } = orgRowPolicyOf(row);
|
|
286
286
|
const behavior = said === "ask" ? "ask" : "deny";
|
|
287
|
-
const unreadable = (code, detail) => ({
|
|
287
|
+
const unreadable = (code, detail, respelling) => ({
|
|
288
288
|
kind: "unreadable",
|
|
289
289
|
index,
|
|
290
290
|
rule: typeof text === "string" ? text : text === undefined ? "<unreadable>" : escapeForDisclosure(text),
|
|
291
291
|
code,
|
|
292
292
|
...(detail !== undefined ? { detail } : {}),
|
|
293
|
+
...(respelling !== undefined ? { respelling } : {}),
|
|
293
294
|
behavior,
|
|
294
295
|
reach: reachOfRowHead(text, behavior),
|
|
295
296
|
});
|
|
@@ -299,8 +300,8 @@ function readOrgRow(row, index) {
|
|
|
299
300
|
return unreadable("invalid.grammar", said === undefined ? "no behavior" : `behavior "${escapeForDisclosure(said)}" is not deny or ask`);
|
|
300
301
|
const parsed = parseRuleText(text, said);
|
|
301
302
|
if ("reject" in parsed)
|
|
302
|
-
return unreadable(parsed.reject.code);
|
|
303
|
-
if (parsed.rule.tool !== COMMAND_RULE_TOOL)
|
|
303
|
+
return unreadable(parsed.reject.code, undefined, parsed.reject.respelling);
|
|
304
|
+
if (parsed.rule.tool !== COMMAND_RULE_TOOL || parsed.rule.match === "tool")
|
|
304
305
|
return unreadable("unsupported.tool");
|
|
305
306
|
return { kind: "read", index, rule: text, behavior: said, parsed: parsed.rule };
|
|
306
307
|
}
|
|
@@ -355,6 +356,9 @@ function readListedOrgRules(rules) {
|
|
|
355
356
|
return reading;
|
|
356
357
|
}
|
|
357
358
|
export function unreadableOrgRowReason(row) {
|
|
359
|
+
if (row.respelling !== undefined) {
|
|
360
|
+
return `row ${row.index} of the organization snapshot, "${escapeForDisclosure(row.rule)}", is not a rule spelling (${row.code}); republish it as "${escapeForDisclosure(row.respelling)}"`;
|
|
361
|
+
}
|
|
358
362
|
return `row ${row.index} of the organization snapshot is not a rule this layer reads (${row.code}${row.detail !== undefined ? `: ${row.detail}` : ""}); republish it in the shell tool's command grammar`;
|
|
359
363
|
}
|
|
360
364
|
export function orgUnreadableClause(reason) {
|
|
@@ -365,7 +369,7 @@ export function describeUnreadableOrgRows(unreadable, revision) {
|
|
|
365
369
|
return undefined;
|
|
366
370
|
const named = unreadable
|
|
367
371
|
.slice(0, DISCLOSED_UNREADABLE_ROWS)
|
|
368
|
-
.map((u) => `row ${u.index} "${escapeForDisclosure(u.rule)}" (${u.code}${u.detail !== undefined ? `: ${u.detail}` : ""})`)
|
|
372
|
+
.map((u) => `row ${u.index} "${escapeForDisclosure(u.rule)}" (${u.code}${u.detail !== undefined ? `: ${u.detail}` : ""}${u.respelling !== undefined ? `; republish it as "${escapeForDisclosure(u.respelling)}"` : ""})`)
|
|
369
373
|
.join(", ");
|
|
370
374
|
const more = unreadable.length - DISCLOSED_UNREADABLE_ROWS;
|
|
371
375
|
return (`the org snapshot${revision !== undefined ? ` (revision ${escapeForDisclosure(revision)})` : ""} is served DEGRADED: ${unreadable.length} row(s) this layer cannot read — ${named}${more > 0 ? ` and ${more} more` : ""}; ` +
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import type { PersistedRule, RuleScope } from "./permission-rule-model.js";
|
|
38
38
|
import { type DurableRulePartitionProvider, type QuarantinedRuleAdd } from "./permission-rule-store.js";
|
|
39
|
-
import type
|
|
39
|
+
import { type RuleOwner } from "./rule-owner.js";
|
|
40
40
|
import { type OrgRulePartitionConfig, type OrgRuleResolution } from "./permission-rule-org.js";
|
|
41
41
|
import type { SessionRulePartition } from "./permission-rule-session.js";
|
|
42
42
|
import type { StoreDurability, StoreFidelity } from "./checkpoint-store.js";
|
|
@@ -146,7 +146,10 @@ export interface PermissionRuleStoreProvider {
|
|
|
146
146
|
* provider: an absent principal resolves to zero personal rules, and a provider that forgot it would hand one person's
|
|
147
147
|
* standing approvals to an anonymous task. The ONE exception is an explicitly declared LOCAL-OWNER deployment, where "no
|
|
148
148
|
* principal" is the typed absence of identity — the machine owner's own bucket (a provider with no such face resolves
|
|
149
|
-
* the anonymous store; {@link createPermissionRuleLanes} refuses that declaration loudly).
|
|
149
|
+
* the anonymous store; {@link createPermissionRuleLanes} refuses that declaration loudly). "No principal" is ABSENCE only —
|
|
150
|
+
* `undefined`, and the empty string the engine has always spelled the same ({@link readPrincipal}). A principal that was provided
|
|
151
|
+
* and is not a name (white space, an invisible or control character) is a bad value and is refused here: read as absence it
|
|
152
|
+
* would be the machine owner's bucket on a local-owner deployment.
|
|
150
153
|
*/
|
|
151
154
|
export declare function ownerStoreOf(provider: PermissionRuleStoreProvider, principal: string | undefined, localOwnerDeclared: boolean): PermissionRuleStore;
|
|
152
155
|
/** What {@link createPermissionRuleStoreProvider} composes. */
|
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
import { escapeForDisclosure } from "./permission-rule-model.js";
|
|
1
|
+
import { escapeForDisclosure, isRuleBehavior, parseRuleText } from "./permission-rule-model.js";
|
|
2
2
|
import { PERMISSION_RULE_WRITER, errText, isValidDurableScope, normalizePersistedRule, sameRuleIdentity, writerOf, } from "./permission-rule-store.js";
|
|
3
|
+
import { readRuleOwner } from "./rule-owner.js";
|
|
4
|
+
import { readPrincipal } from "./principal-name.js";
|
|
3
5
|
import { UNGOVERNED_ORG_RESOLUTION, compileOrgShadowPredicate, createOrgRulePartition } from "./permission-rule-org.js";
|
|
4
6
|
export function ruleSourceOf(scope) {
|
|
5
7
|
return scope.kind === "global" ? "user" : scope.kind;
|
|
6
8
|
}
|
|
7
9
|
export function ownerStoreOf(provider, principal, localOwnerDeclared) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
+
const reading = readPrincipal(principal);
|
|
11
|
+
if (reading.kind === "invalid") {
|
|
12
|
+
throw new Error(`the principal given is not a principal name (got ${reading.fault}) — refusing to resolve a bucket for it; a provided value that names nobody is not "no principal"`);
|
|
13
|
+
}
|
|
14
|
+
if (reading.kind === "name")
|
|
15
|
+
return provider.forPrincipal(reading.name);
|
|
16
|
+
return localOwnerDeclared && provider.forLocalOwner !== undefined ? provider.forLocalOwner() : provider.forPrincipal(undefined);
|
|
10
17
|
}
|
|
11
18
|
function usableSessionId(sessionId) {
|
|
12
19
|
return typeof sessionId === "string" && sessionId !== "" ? sessionId : undefined;
|
|
13
20
|
}
|
|
14
21
|
const EMPTY_DURABLE = { rules: [], tombstones: [], rev: 0 };
|
|
22
|
+
function durableReadOf(settled) {
|
|
23
|
+
if (!settled.ok)
|
|
24
|
+
return settled;
|
|
25
|
+
for (const [kind, rows] of [["rule", settled.v.rules], ["tombstone", settled.v.tombstones]]) {
|
|
26
|
+
const at = rows.findIndex((r) => !isRuleBehavior(r?.behavior));
|
|
27
|
+
if (at < 0)
|
|
28
|
+
continue;
|
|
29
|
+
const row = rows[at];
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
e: new Error(`the persisted rule partition served a ${kind} row (#${at}, ${escapeForDisclosure(row?.rule)}) whose behavior word ${escapeForDisclosure(row?.behavior)} is outside deny/ask/allow — whether it refuses a call is unknown, so the partition is read as one that could not be read`),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return settled;
|
|
36
|
+
}
|
|
15
37
|
export function createPermissionRuleStoreProvider(cfg) {
|
|
16
38
|
if (cfg === null || typeof cfg !== "object") {
|
|
17
39
|
throw new Error("createPermissionRuleStoreProvider takes a config object naming the partitions to compose");
|
|
@@ -61,7 +83,7 @@ class UnifiedPermissionRuleStore {
|
|
|
61
83
|
const disclosures = [];
|
|
62
84
|
const [orgSettled, durableSettled, sessionRows] = await Promise.all([
|
|
63
85
|
this.org !== undefined ? this.org.resolve() : Promise.resolve({ ...UNGOVERNED_ORG_RESOLUTION, rules: [], disclosures: [] }),
|
|
64
|
-
this.durable !== undefined ? this.durable.list().then((v) => ({ ok: true, v }), (e) => ({ ok: false, e })) : Promise.resolve({ ok: true, v: EMPTY_DURABLE }),
|
|
86
|
+
this.durable !== undefined ? this.durable.list().then((v) => durableReadOf({ ok: true, v }), (e) => ({ ok: false, e })) : Promise.resolve({ ok: true, v: EMPTY_DURABLE }),
|
|
65
87
|
this.readSessionRows(usableSessionId(query?.sessionId), disclosures),
|
|
66
88
|
]);
|
|
67
89
|
const orgResolution = orgSettled;
|
|
@@ -106,7 +128,7 @@ class UnifiedPermissionRuleStore {
|
|
|
106
128
|
const served = structuredClone(await this.session.read(sessionId));
|
|
107
129
|
const rows = served.filter((r) => {
|
|
108
130
|
const scope = r?.scope;
|
|
109
|
-
return scope?.kind === "session" && scope.sessionId === sessionId && !("reject" in normalizePersistedRule(r));
|
|
131
|
+
return scope?.kind === "session" && scope.sessionId === sessionId && (!("reject" in normalizePersistedRule(r)) || ((r.behavior === "deny" || r.behavior === "ask") && "reject" in parseRuleText(r.rule, r.behavior)));
|
|
110
132
|
});
|
|
111
133
|
if (rows.length < served.length) {
|
|
112
134
|
disclosures.push(`the session rule partition served ${served.length - rows.length} row(s) that are not canonical session rows of this session — dropped, not adjudicated`);
|
|
@@ -157,8 +179,17 @@ export async function effectivePermissionRules(opts) {
|
|
|
157
179
|
return await resolveOwnerStore(opts).effective(opts.sessionId !== undefined ? { sessionId: opts.sessionId } : undefined);
|
|
158
180
|
}
|
|
159
181
|
export function resolveOwnerStore(opts) {
|
|
160
|
-
|
|
161
|
-
|
|
182
|
+
const owner = opts.owner === undefined ? undefined : readRuleOwner(opts.owner);
|
|
183
|
+
if (opts.owner !== undefined && owner === undefined) {
|
|
184
|
+
throw new Error("the owner given is neither a principal nor the local owner (a principal owner names a principal name) — refusing to resolve a bucket nobody can name");
|
|
185
|
+
}
|
|
186
|
+
const given = readPrincipal(opts.principal);
|
|
187
|
+
if (given.kind === "invalid") {
|
|
188
|
+
throw new Error(`the principal given is not a principal name (got ${given.fault}) — pass a verified principal, the local owner, or neither; a provided value that names nobody is not "no principal"`);
|
|
189
|
+
}
|
|
190
|
+
const principal = given.kind === "name" ? given.name : undefined;
|
|
191
|
+
if (owner?.kind === "local-owner") {
|
|
192
|
+
if (principal !== undefined) {
|
|
162
193
|
throw new Error("pass either a principal or a local-owner, not both — a bucket has one owner");
|
|
163
194
|
}
|
|
164
195
|
const store = opts.provider.forLocalOwner?.();
|
|
@@ -167,9 +198,8 @@ export function resolveOwnerStore(opts) {
|
|
|
167
198
|
}
|
|
168
199
|
return store;
|
|
169
200
|
}
|
|
170
|
-
if (
|
|
171
|
-
throw new Error(`contradictory identity: principal "${escapeForDisclosure(
|
|
201
|
+
if (owner?.kind === "principal" && principal !== undefined && owner.principal !== principal) {
|
|
202
|
+
throw new Error(`contradictory identity: principal "${escapeForDisclosure(principal)}" and owner principal "${escapeForDisclosure(owner.principal)}" disagree`);
|
|
172
203
|
}
|
|
173
|
-
|
|
174
|
-
return opts.provider.forPrincipal(principal);
|
|
204
|
+
return opts.provider.forPrincipal(owner?.kind === "principal" ? owner.principal : principal);
|
|
175
205
|
}
|
|
@@ -45,7 +45,7 @@ import type { PersistedRule, RuleAdd, RuleDot, RuleScope, RuleTombstone } from "
|
|
|
45
45
|
import { type RuleBehavior } from "./permission-rule-model.js";
|
|
46
46
|
import type { RuleSyncDropReason, RuleQuarantineReason } from "./governance-codes.js";
|
|
47
47
|
import type { StoreDurability, StoreFidelity } from "./checkpoint-store.js";
|
|
48
|
-
import type
|
|
48
|
+
import { type RuleOwner } from "./rule-owner.js";
|
|
49
49
|
/** One store read: the rules as persisted, their tombstones, and the revision they were read at. */
|
|
50
50
|
export interface StoredRules {
|
|
51
51
|
/** Rules with their FULL add sets — tombstoned dots already removed by the backend on read. */
|
|
@@ -93,7 +93,8 @@ export interface DurableRulePartition {
|
|
|
93
93
|
/** Declared serialization fidelity, same doctrine as the other store families. */
|
|
94
94
|
readonly fidelity?: StoreFidelity;
|
|
95
95
|
}
|
|
96
|
-
/** Resolves one owner's durable partition. `undefined`
|
|
96
|
+
/** Resolves one owner's durable partition. `undefined` — or anything that is not a principal name
|
|
97
|
+
* (`principalNameOf`: the empty and the blank string included) ⇒ a partition that reports zero rules. This is
|
|
97
98
|
* the BACKEND contract (file, in-memory, an out-of-repo SQL twin); the engine never consumes it
|
|
98
99
|
* directly — `createPermissionRuleStoreProvider({ durable })` composes it into the unified store. */
|
|
99
100
|
export interface DurableRulePartitionProvider {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { canonicalize } from "./canonical-json.js";
|
|
3
3
|
import { escapeForDisclosure, isRuleBehavior, isRuleLive, parseRuleText } from "./permission-rule-model.js";
|
|
4
|
+
import { readRuleOwner } from "./rule-owner.js";
|
|
4
5
|
import { thrownText } from "./thrown-value.js";
|
|
5
6
|
import { validatePath } from "./effective-path-target.js";
|
|
6
7
|
export const PERMISSION_RULES_LATER_GRAMMAR_CODE = "permission_rules.later_grammar";
|
|
@@ -510,6 +511,10 @@ async function readRuleLiveness(store, identity) {
|
|
|
510
511
|
}
|
|
511
512
|
}
|
|
512
513
|
const REMOVE_MAX_ATTEMPTS = 8;
|
|
514
|
+
const NO_TARGET_OWNER = "the principal given is neither a principal name (a string with a visible character, no control or separator character, and no format character but a joiner) nor an owner (a principal owner names a principal name; the local owner is { kind: \"local-owner\" })";
|
|
515
|
+
function persistedRuleTargetOwner(target) {
|
|
516
|
+
return readRuleOwner(typeof target === "string" ? { kind: "principal", principal: target } : target);
|
|
517
|
+
}
|
|
513
518
|
export async function removePersistedRule(opts) {
|
|
514
519
|
const behavior = opts.behavior;
|
|
515
520
|
const rule = opts.rule;
|
|
@@ -519,7 +524,9 @@ export async function removePersistedRule(opts) {
|
|
|
519
524
|
return { status: "failed", error: `removePersistedRule: behavior ${escapeForDisclosure(behavior)} is not one of ${["deny", "ask", "allow"].join("/")} — refusing to name a rule identity nothing can carry`, committed: "no" };
|
|
520
525
|
}
|
|
521
526
|
const identity = { behavior, rule, scope };
|
|
522
|
-
const owner =
|
|
527
|
+
const owner = persistedRuleTargetOwner(target);
|
|
528
|
+
if (owner === undefined)
|
|
529
|
+
return { status: "failed", error: `removePersistedRule: ${NO_TARGET_OWNER} — refusing to remove from a bucket nobody can name`, committed: "no" };
|
|
523
530
|
const provider = opts.provider;
|
|
524
531
|
if (scope?.kind === "session") {
|
|
525
532
|
return {
|
|
@@ -686,7 +693,9 @@ export async function addPersistedRule(opts) {
|
|
|
686
693
|
if ("reject" in parsed)
|
|
687
694
|
return { status: "failed", error: `addPersistedRule: ${parsed.reject.code}: ${parsed.reject.message}`, committed: "no" };
|
|
688
695
|
const identity = { behavior, rule: parsed.rule.rule, scope };
|
|
689
|
-
const owner =
|
|
696
|
+
const owner = persistedRuleTargetOwner(target);
|
|
697
|
+
if (owner === undefined)
|
|
698
|
+
return { status: "failed", error: `addPersistedRule: ${NO_TARGET_OWNER} — refusing to write into a bucket nobody can name`, committed: "no" };
|
|
690
699
|
const provider = opts.provider;
|
|
691
700
|
if (owner.kind === "local-owner" && provider.forLocalOwner === undefined) {
|
|
692
701
|
return { status: "failed", error: "this provider has no local-owner bucket (forLocalOwner is not implemented) — a local-owner rule cannot be added through it", committed: "no" };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { escapeForDisclosure, isRuleBehavior, parseRuleText, RULE_ADD_ORIGINS } from "./permission-rule-model.js";
|
|
2
|
+
import { principalNameOf } from "./principal-name.js";
|
|
2
3
|
import { PERMISSION_RULES_LATER_GRAMMAR_CODE, applyTombstones, errText, isProjectScopeRoot, joinFrontiers, joinRuleStates, normalizePersistedRule, readRuleWriteOutcome, ruleSyncVector, sameRuleIdentity, screenRuleSyncState, writerOf, } from "./permission-rule-store.js";
|
|
3
4
|
import { emitTrace } from "./trace.js";
|
|
4
5
|
import { SESSION_RULES_GRAMMAR, readRuleGrammarStamp } from "./session-policy-store.js";
|
|
@@ -23,8 +24,8 @@ export async function syncPermissionRules(opts) {
|
|
|
23
24
|
throw new Error(`contradictory identity: principal "${escapeForDisclosure(principal)}" and owner principal "${escapeForDisclosure(owner.principal)}" disagree`);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
if (
|
|
27
|
-
throw new Error("syncPermissionRules requires a verified principal — an unauthenticated deployment has no cloud bucket to sync");
|
|
27
|
+
if (principalNameOf(principal) === undefined) {
|
|
28
|
+
throw new Error("syncPermissionRules requires a verified principal — an unauthenticated deployment has no cloud bucket to sync (a blank name, or one holding a control, separator or invisible format character, is not a principal)");
|
|
28
29
|
}
|
|
29
30
|
const traceClock = opts.now ?? Date.now;
|
|
30
31
|
const disclose = (result) => {
|
|
@@ -29,10 +29,11 @@ export declare function lastIndexOfUnescaped(s: string, ch: string): number;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function parsePermissionRule(rule: string): ParsedPermissionRule;
|
|
31
31
|
/**
|
|
32
|
-
* Can a rule name this tool name — is it the rule syntax's name head ({@link RULE_TOOL_NAME})
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* Can a rule name this tool name — is it the rule syntax's name head ({@link RULE_TOOL_NAME}) with no `*` in it? A `*` makes a
|
|
33
|
+
* spelling a glob over names, not a name: a tool whose name held one would be reached by every rule whose glob matches it and
|
|
34
|
+
* could never be named on its own (the reference's mount spelling holds no `*` either). The mount contract for every name a
|
|
35
|
+
* caller tool answers to (its name and each alias), so each one is a name every list can write; a protocol-minted name
|
|
36
|
+
* (`<ns>__<peer>__<tool>`, segments in `[A-Za-z0-9_-]`) is always one.
|
|
36
37
|
*/
|
|
37
38
|
export declare function isNameableToolName(name: string): boolean;
|
|
38
39
|
/**
|
|
@@ -36,9 +36,9 @@ export function parsePermissionRule(rule) {
|
|
|
36
36
|
return { toolName: name.trim() };
|
|
37
37
|
return { toolName: name.trim(), ruleContent: unescapeRuleContent(content) };
|
|
38
38
|
}
|
|
39
|
-
const RULE_TOOL_NAME = /^
|
|
39
|
+
const RULE_TOOL_NAME = /^[A-Za-z0-9_*](?:[A-Za-z0-9_.:*-]*[A-Za-z0-9_*-])?$/;
|
|
40
40
|
export function isNameableToolName(name) {
|
|
41
|
-
return typeof name === "string" && name
|
|
41
|
+
return typeof name === "string" && !name.includes("*") && RULE_TOOL_NAME.test(name);
|
|
42
42
|
}
|
|
43
43
|
export function ruleSpellingOf(rule) {
|
|
44
44
|
if (rule !== rule.trim())
|
|
@@ -90,8 +90,8 @@ export interface PermissionRuleIssue {
|
|
|
90
90
|
/** A rule the rule syntax reads no rule in (`ruleSpellingOf`) whose name is the reason: blanks around the rule, a
|
|
91
91
|
* character outside a tool name's spelling (a variation selector, a filler, a zero-width space), a blank or an invisible
|
|
92
92
|
* character before the `(`, a leading `-`. Refused — the lenient reading would deny a tool under another spelling, or none.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
93
|
+
* (A `*` in a tool name is no such spelling: a deny or ask rule reads it as a glob over the whole name, `*` alone as every
|
|
94
|
+
* tool.) */
|
|
95
95
|
| "invalid.tool_name" | "invalid.param_split" | "invalid.primary_field" | "invalid.cap_exceeded"
|
|
96
96
|
/** An ALLOW rule (any spelling): a policy fold says deny / ask only — "this does not need asking" is the allow
|
|
97
97
|
* layer's (`TaskSpec.allowedTools`, `RunnerDeps.allowedTools`). One issue per allow rule. */
|
|
@@ -206,8 +206,8 @@ export interface PermissionRulePolicyOptions {
|
|
|
206
206
|
*/
|
|
207
207
|
pathBases?: PathRuleBases;
|
|
208
208
|
}
|
|
209
|
-
import {
|
|
210
|
-
export {
|
|
209
|
+
import { isCoveringRuleName, ruleNameCovers, wildcardMatch } from "./namespaced-rule-name.js";
|
|
210
|
+
export { isCoveringRuleName, ruleNameCovers, wildcardMatch };
|
|
211
211
|
/**
|
|
212
212
|
* design/388 A-6/7/8/9 (D-3): the per-tool RULE FACE — the parameters a `Tool(param:pattern)` rule may name
|
|
213
213
|
* (`params`, the SCALAR top-level keys ∪ the path target's aliases), the ones the generic lexical matcher must
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attest } from "./tool-policy.js";
|
|
2
|
-
import { MCP_NAMESPACE
|
|
2
|
+
import { MCP_NAMESPACE } from "./protocol-table.js";
|
|
3
3
|
import { catalogRuleFaceOf, isShellFaceToolName, pathTargetOf } from "./tool-registry.js";
|
|
4
4
|
import { HOST_UNREADABLE_SENTENCE, callHostTargetOf } from "./host-target.js";
|
|
5
5
|
import { indexOfUnescaped, lastIndexOfUnescaped, parsePermissionRule, ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
@@ -36,9 +36,8 @@ export const DEFAULT_CAPS = {
|
|
|
36
36
|
maxStars: 16,
|
|
37
37
|
maxScalarValueChars: DEFAULT_MAX_SCALAR_VALUE_CHARS,
|
|
38
38
|
};
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
export { isNamespacedCoveringRuleName, namespacedRuleNameCovers, wildcardMatch };
|
|
39
|
+
import { isCoveringRuleName, ruleNameCovers, wildcardMatch } from "./namespaced-rule-name.js";
|
|
40
|
+
export { isCoveringRuleName, ruleNameCovers, wildcardMatch };
|
|
42
41
|
const vocabularyOf = (face) => face.params ?? face.primaryParams;
|
|
43
42
|
const carriedPhrase = (face) => {
|
|
44
43
|
const vocabulary = vocabularyOf(face);
|
|
@@ -119,22 +118,13 @@ function compile(rules, caps, primaryFieldGeneric, ruleFaces, pathBases = {}) {
|
|
|
119
118
|
bad(text, why.code, why.message);
|
|
120
119
|
continue;
|
|
121
120
|
}
|
|
122
|
-
if (parsed.toolName === "*") {
|
|
123
|
-
bad(text, "invalid.tool_name", "`*` names no tool — a rule reaches the tool it names, so this one would compile and never match; name the tool", { name: "defaultAction" });
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
121
|
const toolName = parsed.toolName;
|
|
127
122
|
const parenthesised = parsed.ruleContent !== undefined || indexOfUnescaped(text, "(") !== -1;
|
|
128
123
|
if (toolName.startsWith(MCP_NAMESPACE.prefix) && parenthesised) {
|
|
129
124
|
bad(text, "unsupported.mcp_paren", "MCP rules do not support patterns in parentheses (CC parity); a rule names a whole tool (`mcp__<server>__<tool>`) or a whole server (`mcp__<server>`), and what a tool does is declared per tool in the MCP server's spec", { name: "toolAxes" });
|
|
130
125
|
continue;
|
|
131
126
|
}
|
|
132
|
-
|
|
133
|
-
if (wildPeer !== undefined) {
|
|
134
|
-
bad(text, "invalid.tool_name", wildPeer);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
if (parenthesised && isNamespacedCoveringRuleName(toolName, verb)) {
|
|
127
|
+
if (ruleContentOf(parsed) !== undefined && isCoveringRuleName(toolName, verb)) {
|
|
138
128
|
bad(text, "unsupported.covering_paren", `"${toolName}" reaches a SET of tools, and the generic param DSL is keyed by exact tool name — a parenthesised rule on it can never match. ` +
|
|
139
129
|
`Write the parenthesised rule against one exact tool name, or drop the parentheses to keep the covering rule.`);
|
|
140
130
|
continue;
|
|
@@ -142,7 +132,7 @@ function compile(rules, caps, primaryFieldGeneric, ruleFaces, pathBases = {}) {
|
|
|
142
132
|
const entry = byTool.get(toolName) ?? { bare: {}, param: { deny: [], ask: [] }, content: { deny: [], ask: [] } };
|
|
143
133
|
const content = ruleContentOf(parsed);
|
|
144
134
|
if (content === undefined) {
|
|
145
|
-
if (
|
|
135
|
+
if (isCoveringRuleName(toolName, verb)) {
|
|
146
136
|
namespacedCovering[verb].push({ ruleName: toolName, ruleText: text, ...(r.source !== undefined ? { source: r.source } : {}) });
|
|
147
137
|
continue;
|
|
148
138
|
}
|
|
@@ -339,7 +329,8 @@ export function createPermissionRulePolicy(rules, opts) {
|
|
|
339
329
|
for (const r of namespacedCovering[behavior])
|
|
340
330
|
nameSets[behavior].push(r.ruleName);
|
|
341
331
|
}
|
|
342
|
-
const
|
|
332
|
+
const heldFor = (table, req) => heldValues("policy.permissionRules", table, req);
|
|
333
|
+
const coveringHit = (lane, req) => lane.length === 0 ? undefined : heldFor({ get: (name) => lane.find((r) => ruleNameCovers(r.ruleName, name)) }, req)[0];
|
|
343
334
|
const hasCovering = namespacedCovering.deny.length > 0 || namespacedCovering.ask.length > 0;
|
|
344
335
|
const faceRules = {
|
|
345
336
|
deny: [...byTool.values()].flatMap((e) => e.content.deny.filter((r) => r.faces !== undefined)),
|
|
@@ -454,7 +445,7 @@ export function createPermissionRulePolicy(rules, opts) {
|
|
|
454
445
|
requiresRealApproval: true,
|
|
455
446
|
});
|
|
456
447
|
const entryFor = (req) => {
|
|
457
|
-
const entries =
|
|
448
|
+
const entries = heldFor(byTool, req);
|
|
458
449
|
if (entries.length <= 1)
|
|
459
450
|
return entries[0];
|
|
460
451
|
const bare = {};
|
|
@@ -474,12 +465,12 @@ export function createPermissionRulePolicy(rules, opts) {
|
|
|
474
465
|
...(pathSpecs.length > 0 ? { pathRules: (anchors) => boundAt(policyAnchors(pathBases, anchors)).rows } : {}),
|
|
475
466
|
check(req) {
|
|
476
467
|
const entry = entryFor(req);
|
|
477
|
-
const covering = hasCovering
|
|
468
|
+
const covering = hasCovering;
|
|
478
469
|
if (entry?.bare.deny) {
|
|
479
470
|
return { action: "deny", message: ruleDenial(req, entry.bare.deny.ruleText, entry.bare.deny.source) };
|
|
480
471
|
}
|
|
481
472
|
if (covering) {
|
|
482
|
-
const coveringDeny = coveringHit(namespacedCovering.deny, req
|
|
473
|
+
const coveringDeny = coveringHit(namespacedCovering.deny, req);
|
|
483
474
|
if (coveringDeny)
|
|
484
475
|
return { action: "deny", message: ruleDenial(req, coveringDeny.ruleText, coveringDeny.source) };
|
|
485
476
|
}
|
|
@@ -509,7 +500,7 @@ export function createPermissionRulePolicy(rules, opts) {
|
|
|
509
500
|
}
|
|
510
501
|
}
|
|
511
502
|
if (covering) {
|
|
512
|
-
const coveringAsk = coveringHit(namespacedCovering.ask, req
|
|
503
|
+
const coveringAsk = coveringHit(namespacedCovering.ask, req);
|
|
513
504
|
if (coveringAsk)
|
|
514
505
|
return { action: "ask", message: ruleAskMessage(coveringAsk.ruleText, coveringAsk.source), matchedAskRule: coveringAsk.ruleText };
|
|
515
506
|
}
|
|
@@ -44,7 +44,7 @@ export declare function disclosedRuleSet(rules: readonly PersistedRuleHitRule[])
|
|
|
44
44
|
* lane's allow carries: one authority, one word) and the rule text disclosed through the display
|
|
45
45
|
* transform; the STATION attributes the refusal (`tightened: "deny"` ⇒ it writes the pass's refusing
|
|
46
46
|
* layer — the attribution is a station's word and lives in the station file). A path row's hit reports where
|
|
47
|
-
* it met the call; with
|
|
47
|
+
* it met the call; with the face the call's own (`call`, the request the lane read), the deny carries that as its attested `pathDenial`, so every exit that
|
|
48
48
|
* reads the deny (the gate's exit, the approved-edit re-check, a resumed leg's belt) mints the same card from the same fact.
|
|
49
49
|
* · ASK — on an allow, a fresh ask is minted carrying `matchedAskRule` (the marker an explicit `ask`
|
|
50
50
|
* permission rule stamps, so the ask's origin derives as `ask_rule`: the classifier never answers
|
|
@@ -69,7 +69,7 @@ export declare function disclosedRuleSet(rules: readonly PersistedRuleHitRule[])
|
|
|
69
69
|
* resumed-call belt, which vetoes only the call form: a person already answered that call's question.
|
|
70
70
|
* An allow hit (or no hit) returns the decision untouched: the allow arm is the station's.
|
|
71
71
|
*/
|
|
72
|
-
export declare function applyPersistedTightening(decision: PermissionResult, read: PersistedRuleRead | undefined, call
|
|
72
|
+
export declare function applyPersistedTightening(decision: PermissionResult, read: PersistedRuleRead | undefined, call: ToolCallRequest): {
|
|
73
73
|
decision: PermissionResult;
|
|
74
74
|
tightened?: "deny" | "ask" | "unreadable" | "store_unreadable";
|
|
75
75
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { attest } from "./tool-policy.js";
|
|
1
|
+
import { attest, attestationOf } from "./tool-policy.js";
|
|
2
2
|
import { callPathFaceOf } from "./permission-rule-model.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ownAskClassesOf } from "./ask-origin.js";
|
|
4
4
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
5
5
|
export function strongestAnswer(answers) {
|
|
6
6
|
const rank = (a) => (a === undefined ? 0 : "unreadable" in a ? 4 : "behavior" in a ? { deny: 5, ask: 3, allow: 2 }[a.behavior] : 1);
|
|
@@ -20,15 +20,13 @@ export function applyPersistedTightening(decision, read, call) {
|
|
|
20
20
|
? `this call could not be read against the person's standing deny/ask rules (${read.reason}) — whether one of them forbids it is unknown, so it needs a real approval`
|
|
21
21
|
: "the person's standing permission rules could not be read — whether one of them forbids this call is unknown, so it needs a real approval";
|
|
22
22
|
const unreadableCall = callForm ? { ruleUnreadable: "persisted_call" } : {};
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
: {};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
tightened: callForm ? "unreadable" : "store_unreadable",
|
|
31
|
-
};
|
|
23
|
+
const tightened = callForm ? "unreadable" : "store_unreadable";
|
|
24
|
+
if (decision.action === "allow") {
|
|
25
|
+
return { decision: { action: "ask", message, decisionReason: "persisted_rule", requiresRealApproval: true, ...unreadableCall, ...(decision.updatedInput !== undefined ? { updatedInput: decision.updatedInput } : {}) }, tightened };
|
|
26
|
+
}
|
|
27
|
+
const record = attestationOf(decision, call);
|
|
28
|
+
const asked = { ...decision, requiresRealApproval: true, ...unreadableCall, message: `${decision.message !== undefined ? `${decision.message} ` : ""}(${message})` };
|
|
29
|
+
return { decision: ownAskClassesOf(decision, record).has("policy_rra") ? attest(asked, call, { foldedClasses: [...new Set([...(record?.foldedClasses ?? []), "policy_rra"])] }) : asked, tightened };
|
|
32
30
|
}
|
|
33
31
|
const hit = read?.hit;
|
|
34
32
|
if (hit === undefined || hit.behavior === "allow")
|
|
@@ -36,7 +34,7 @@ export function applyPersistedTightening(decision, read, call) {
|
|
|
36
34
|
const shown = disclosedRuleSet(hit.rules);
|
|
37
35
|
if (hit.behavior === "deny") {
|
|
38
36
|
const denied = { action: "deny", message: `a persisted deny rule (${shown}) refuses this call`, decisionReason: "persisted_rule" };
|
|
39
|
-
const attested = hit.denial !== undefined &&
|
|
37
|
+
const attested = hit.denial !== undefined && hit.denial.face === callPathFaceOf(call);
|
|
40
38
|
return { decision: attested ? attest(denied, call, { pathDenial: hit.denial }) : denied, tightened: "deny" };
|
|
41
39
|
}
|
|
42
40
|
if (decision.action === "deny")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function principalNameOf(raw: unknown): string | undefined;
|
|
2
|
+
/** What a value offered as THE principal of a task or of a lookup is — read once, here, so no face decides it on its own. */
|
|
3
|
+
export type PrincipalReading = {
|
|
4
|
+
readonly kind: "name";
|
|
5
|
+
readonly name: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "absent";
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "invalid";
|
|
10
|
+
readonly fault: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A principal offered to a face that tolerates having none: `name` (a principal name), `absent` (no principal — `undefined`, and the
|
|
14
|
+
* empty string, which the task door and the bucket resolvers have always spelled the same), or `invalid` (it was PROVIDED and is not a name). Only absence reaches
|
|
15
|
+
* the unauthenticated floor, or the declared local owner's bucket; an invalid value is a bad value, refused where a principal is taken
|
|
16
|
+
* (never read as absence — a caller who appends one invisible character to a principal must not become the machine owner).
|
|
17
|
+
*/
|
|
18
|
+
export declare function readPrincipal(raw: unknown): PrincipalReading;
|
|
19
|
+
/** Why a value is not a principal name, as a clause for a refusal sentence: the kind of string it is, or the type of the value. */
|
|
20
|
+
export declare function principalNameFault(raw: unknown): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const NOT_IN_A_NAME = /[\p{Cc}\p{Zl}\p{Zp}]|(?![\u200c\u200d])\p{Cf}/u;
|
|
2
|
+
const NOT_VISIBLE = /[\s\p{Cf}]+/gu;
|
|
3
|
+
export function principalNameOf(raw) {
|
|
4
|
+
return typeof raw === "string" && raw.replace(NOT_VISIBLE, "") !== "" && !NOT_IN_A_NAME.test(raw) ? raw : undefined;
|
|
5
|
+
}
|
|
6
|
+
export function readPrincipal(raw) {
|
|
7
|
+
if (raw === undefined || raw === "")
|
|
8
|
+
return { kind: "absent" };
|
|
9
|
+
const name = principalNameOf(raw);
|
|
10
|
+
return name !== undefined ? { kind: "name", name } : { kind: "invalid", fault: principalNameFault(raw) };
|
|
11
|
+
}
|
|
12
|
+
export function principalNameFault(raw) {
|
|
13
|
+
if (typeof raw !== "string")
|
|
14
|
+
return raw === null ? "null" : typeof raw;
|
|
15
|
+
if (raw === "")
|
|
16
|
+
return "an empty string";
|
|
17
|
+
if (raw.trim() === "")
|
|
18
|
+
return "a blank string";
|
|
19
|
+
if (raw.replace(NOT_VISIBLE, "") === "")
|
|
20
|
+
return "a string with no visible character";
|
|
21
|
+
return "a string holding a control, separator or format character";
|
|
22
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { bandOf } from "../prompt-assembly/bands.js";
|
|
2
|
-
import { lockedTextIn
|
|
2
|
+
import { lockedTextIn } from "../prompt-assembly/overlay.js";
|
|
3
|
+
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
3
4
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
4
5
|
import { egressThrownText, extensionWords } from "./untrusted-egress.js";
|
|
5
6
|
export const DISPOSABLE_PROMPT_SECTIONS = Object.freeze(["core/discovery.mcp-instructions"]);
|
|
6
7
|
const DEFECT_MAX = 600;
|
|
7
8
|
function readAnswer(answer, seat) {
|
|
8
|
-
if (
|
|
9
|
+
if (!isPlainRecord(answer))
|
|
9
10
|
return `answered ${answer === null ? "null" : Array.isArray(answer) ? "an array" : typeof answer}; prompt.section takes { text: string | null }`;
|
|
10
|
-
const
|
|
11
|
-
if ("notData" in received)
|
|
12
|
-
return `a prompt.section answer is data (plain objects, arrays, strings, booleans); it holds ${received.notData}`;
|
|
13
|
-
const data = received.value;
|
|
11
|
+
const data = answer;
|
|
14
12
|
const keys = Object.keys(data);
|
|
15
13
|
const stray = keys.filter((k) => k !== "text");
|
|
16
14
|
if (stray.length > 0)
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
* A declaration that breaks the rule is that peer's defect: the resolver throws inside the peer's own dial,
|
|
11
11
|
* so the peer is skipped with a coded warning and its siblings still mount. The MCP transport binds its
|
|
12
12
|
* endpoint by dialing only the declared URL with redirects not followed (`declaredEndpointFetch`); the A2A
|
|
13
|
-
* peer, whose card may name another endpoint, is bound by {@link assertEndpointBound} and by
|
|
14
|
-
* {@link
|
|
13
|
+
* peer, whose card may name another endpoint, is bound by {@link assertEndpointBound} and by its follow law (a request carrying
|
|
14
|
+
* declared headers follows no redirect, {@link carriesDeclaredHeaders}).
|
|
15
15
|
*/
|
|
16
16
|
import type { ProtocolId } from "./protocol-table.js";
|
|
17
|
+
import { type Egress } from "./untrusted-egress.js";
|
|
17
18
|
/** The per-peer HTTP auth declaration every protocol spec carries in the same two fields. */
|
|
18
19
|
export interface ProtocolHttpAuth {
|
|
19
20
|
headers?: Record<string, string>;
|
|
@@ -35,10 +36,44 @@ export declare function resolveProtocolHttpHeaders(protocol: ProtocolId, t: Prot
|
|
|
35
36
|
/** The engine's default request headers under the declared ones: a declared name, in any case, owns that header
|
|
36
37
|
* (the default of the same name is not sent beside it). */
|
|
37
38
|
export declare function underDeclaredHeaders(defaults: Readonly<Record<string, string>>, declared: Record<string, string> | undefined): Record<string, string>;
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Every header VALUE one HTTP peer's requests carry, whatever the header's NAME: each string value of the declaration's static
|
|
41
|
+
* `headers` and the principal the engine sends under `principalHeader`, as declared. The transport knows these; the credential vocabulary
|
|
42
|
+
* can only guess by name. How an endpoint can print one back — edges dropped, its credentials part, percent-encoded — is derived from
|
|
43
|
+
* each value by {@link requestEchoSpellings}, once, and nowhere else.
|
|
44
|
+
* Total: a declaration whose members cannot be read yields what could be read, because it is called on a failure path.
|
|
45
|
+
*/
|
|
46
|
+
export declare function declaredHeaderValues(transport: unknown, principal?: string): readonly string[];
|
|
47
|
+
/**
|
|
48
|
+
* A peer's error text with what the peer was SENT taken out of it. Both kinds of removal are found on the ORIGINAL text (so no marker is
|
|
49
|
+
* rescanned and no replacement can disturb what another one reads) and the ranges they take are merged, one marker per merged range: every
|
|
50
|
+
* occurrence of a declared value in any spelling {@link requestEchoSpellings} derives from it (as declared and as sent, its credentials
|
|
51
|
+
* part, JSON-escaped with or without `\/`, percent-encoded, form-urlencoded, `+` for a space), in any letter case, longest first, and every `Cookie` / `Set-Cookie` member
|
|
52
|
+
* whole — a header line to its end, a record member's string, array or object to its close. The two never disarm each other: a declared
|
|
53
|
+
* value that lies wholly inside a Cookie member's NAME leaves the name (and the member's value is still taken); one that overlaps the name
|
|
54
|
+
* from outside takes its own range and the member's value goes with it. A declared value that is also an ordinary word or number (`en`, `1`,
|
|
55
|
+
* `application/json`) goes wherever it occurs in the remote's words, in any case — a legibility cost, never a leak; the failure's closed
|
|
56
|
+
* fields (code, status, delivery) are not text. A declaration too large for one matcher (tens of thousands of characters, which no header
|
|
57
|
+
* carries) makes the whole text the marker: the pass never throws and never shows what it could not match. A hit that lies wholly inside
|
|
58
|
+
* a marker a pass already wrote (the exact literals, `redactionMarkerSpans`) is no hit, and one that reaches into a marker takes the
|
|
59
|
+
* whole marker with it, so the pass over its own output answers the same text.
|
|
60
|
+
*/
|
|
61
|
+
export declare function scrubRequestEcho(text: string, declared: readonly string[]): string;
|
|
62
|
+
/**
|
|
63
|
+
* THE one form a remote endpoint's words take when the engine carries them in its own words — an MCP server's failure, a model
|
|
64
|
+
* provider's error body, frame or transport failure, a memory distiller seat's failure: what the request was declared with
|
|
65
|
+
* ({@link scrubRequestEcho}: `declared` is required, so no mint reads a remote's words without naming its request), then the credential
|
|
66
|
+
* vocabulary. Words with no declared value in them read exactly as the vocabulary renders them. Where a declared value is there, the
|
|
67
|
+
* values the vocabulary finds in the ORIGINAL words are taken out with it, so neither disarms the other: removing a declared `Bearer`
|
|
68
|
+
* cannot hide the token after it from the vocabulary, and the vocabulary rewriting part of a declared value cannot leave the rest. A
|
|
69
|
+
* caller that bounds the text for display cuts what this returns, never the remote's raw words, so a cut can leave no part of a value.
|
|
70
|
+
* The function is a fixed point (its own output answers the same text). A store, a log or an event lane that receives the result does
|
|
71
|
+
* not redact again: persistence is not an exit, the mint is.
|
|
72
|
+
*/
|
|
73
|
+
export declare function remoteWords(text: string, declared: readonly string[]): Egress<"same-principal">;
|
|
74
|
+
/** Whether a resolved header set carries anything the declaration bound to its endpoints — a request that does follows no redirect (the
|
|
75
|
+
* next hop is not a declared endpoint; A2A's follow law reads this). */
|
|
39
76
|
export declare function carriesDeclaredHeaders(headers: Record<string, string> | undefined): boolean;
|
|
40
|
-
/** A request carrying declared headers does not follow a redirect (the next hop is not a declared endpoint). */
|
|
41
|
-
export declare function redirectPolicy(headers: Record<string, string> | undefined): "manual" | "follow";
|
|
42
77
|
/**
|
|
43
78
|
* Refuse an endpoint a peer advertised (an A2A card's interface URL) when it lies outside every origin the
|
|
44
79
|
* declaration names and the peer's requests carry declared headers: `config.protocol_endpoint_unbound`.
|