@sema-agent/core 7.57.0 → 7.59.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 +1161 -0
- package/README.md +6 -4
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +5 -3
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/send-message-tool.js +21 -12
- package/dist/agents/subagent-steps.js +2 -4
- package/dist/agents/subagent.js +33 -34
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +89 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +62 -5
- package/dist/brain/timeout.js +93 -6
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +23 -10
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/allow-entry.d.ts +20 -7
- package/dist/core/allow-entry.js +18 -9
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/ask-origin.d.ts +21 -2
- package/dist/core/ask-origin.js +5 -1
- package/dist/core/auto-compaction.d.ts +4 -0
- package/dist/core/auto-compaction.js +2 -2
- package/dist/core/auto-mode-directive.d.ts +29 -5
- package/dist/core/auto-mode-directive.js +38 -8
- package/dist/core/background-agent-store.d.ts +16 -3
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-store.d.ts +85 -23
- package/dist/core/checkpoint-store.js +31 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/compliance.js +1 -1
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +99 -9
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/fs-write-gate-policy.d.ts +4 -2
- package/dist/core/fs-write-gate-policy.js +7 -3
- package/dist/core/gate-fold.js +7 -4
- package/dist/core/gate-lanes.js +19 -6
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/git-worktree-env.d.ts +53 -11
- package/dist/core/git-worktree-env.js +96 -12
- package/dist/core/governance-codes.d.ts +9 -1
- package/dist/core/governance-codes.js +13 -0
- package/dist/core/hooks.d.ts +35 -4
- package/dist/core/hooks.js +17 -11
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +6 -5
- package/dist/core/image-admission.js +18 -14
- package/dist/core/locked-config.d.ts +20 -3
- package/dist/core/locked-config.js +40 -3
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +66 -0
- package/dist/core/mcp-call-meta.js +103 -0
- package/dist/core/mcp-connection-pool.d.ts +3 -1
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +117 -15
- package/dist/core/mcp-failure.js +71 -3
- package/dist/core/mcp-probe.d.ts +4 -0
- package/dist/core/mcp-probe.js +1 -1
- package/dist/core/mcp-server-link.d.ts +27 -3
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +46 -18
- package/dist/core/mcp-server-spec.js +1 -18
- package/dist/core/mcp.d.ts +16 -20
- package/dist/core/mcp.js +112 -55
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +45 -4
- package/dist/core/memory-engine/scope-contract.js +80 -11
- package/dist/core/memory-engine/sync-client.d.ts +9 -1
- package/dist/core/memory-engine/sync-client.js +31 -8
- package/dist/core/memory-engine/sync.d.ts +5 -0
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +8 -5
- package/dist/core/mode-policy.js +5 -4
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/host.js +1 -1
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +12 -9
- package/dist/core/mods/kernel/events.d.ts +6 -1
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/registration.d.ts +9 -1
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/kernel/site-rules.d.ts +3 -0
- package/dist/core/mods/kernel/site-rules.js +10 -0
- package/dist/core/mods/package.d.ts +23 -0
- package/dist/core/mods/package.js +118 -0
- package/dist/core/mods/stations.d.ts +33 -12
- package/dist/core/mods/stations.js +45 -11
- package/dist/core/mods/tool-call.d.ts +5 -1
- package/dist/core/mods/tool-call.js +13 -4
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +6 -0
- package/dist/core/path-guard-rows.d.ts +20 -0
- package/dist/core/path-guard-rows.js +11 -0
- package/dist/core/peer-seat.d.ts +248 -0
- package/dist/core/peer-seat.js +439 -0
- package/dist/core/permission-rule-consent.js +10 -4
- package/dist/core/permission-rule-model.d.ts +16 -0
- package/dist/core/permission-rule-model.js +1 -1
- package/dist/core/present-plan-tool.d.ts +20 -3
- package/dist/core/present-plan-tool.js +48 -4
- package/dist/core/protocol-http-auth.d.ts +40 -29
- package/dist/core/protocol-http-auth.js +30 -32
- package/dist/core/redaction-marks.d.ts +16 -0
- package/dist/core/redaction-marks.js +16 -0
- package/dist/core/redaction-passes.js +8 -9
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.d.ts +41 -15
- package/dist/core/retention.js +59 -12
- package/dist/core/rewrite-rejudge.d.ts +38 -0
- package/dist/core/rewrite-rejudge.js +42 -2
- package/dist/core/roles.d.ts +34 -2
- package/dist/core/roles.js +43 -4
- package/dist/core/run-origin.d.ts +40 -0
- package/dist/core/run-origin.js +37 -0
- package/dist/core/runner/advertised-writable-dirs.d.ts +57 -38
- package/dist/core/runner/advertised-writable-dirs.js +126 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/call-hook-stations.js +2 -2
- package/dist/core/runner/compaction-restate.d.ts +15 -6
- package/dist/core/runner/compaction-restate.js +28 -2
- package/dist/core/runner/contracts.d.ts +33 -21
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/gate-exit.d.ts +30 -8
- package/dist/core/runner/gate-exit.js +15 -8
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/memory-consolidation-driver.js +3 -3
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +3 -1
- package/dist/core/runner/prepare-config-doors.d.ts +8 -5
- package/dist/core/runner/prepare-config-doors.js +14 -10
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +8 -0
- package/dist/core/runner/prepare-delegation-surface.js +16 -18
- package/dist/core/runner/prepare-gate-stations.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +11 -3
- package/dist/core/runner/prepare-hands-readface.js +9 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +1 -3
- package/dist/core/runner/prepare-inherited-gate.js +14 -27
- package/dist/core/runner/prepare-memory.d.ts +3 -0
- package/dist/core/runner/prepare-memory.js +26 -37
- package/dist/core/runner/prepare-park-ask.d.ts +1 -1
- package/dist/core/runner/prepare-park-ask.js +2 -1
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
- package/dist/core/runner/prepare-policy-chain.js +18 -15
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -1
- package/dist/core/runner/prepare-prompt-inputs.js +8 -19
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +11 -3
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +2 -1
- package/dist/core/runner/prepare-task.js +28 -13
- package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -1
- package/dist/core/runner/prepare-wiring-manifest.js +4 -3
- package/dist/core/runner/prepare-workspace-restore.d.ts +3 -0
- package/dist/core/runner/prepare-workspace-restore.js +4 -4
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +5 -3
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +2 -0
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-brain-sinks.js +2 -0
- package/dist/core/runner/run-harness-handlers.d.ts +3 -4
- package/dist/core/runner/run-harness-handlers.js +1 -8
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -4
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +42 -29
- package/dist/core/runner/run-notification-lane.js +3 -0
- package/dist/core/runner/run-stop-and-final-verify.js +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +77 -70
- package/dist/core/runner/runtask.d.ts +1 -1
- package/dist/core/runner/runtask.js +2 -2
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +10 -0
- package/dist/core/runner/terminal-account.js +3 -3
- package/dist/core/runner/tool-end-body.js +2 -1
- package/dist/core/runner/tool-occurrence.d.ts +5 -2
- package/dist/core/runner/tool-occurrence.js +4 -3
- package/dist/core/runner/turn-attachments.d.ts +26 -22
- package/dist/core/runner/turn-attachments.js +24 -26
- package/dist/core/runner/write-protection-station.d.ts +8 -2
- package/dist/core/runner/write-protection-station.js +2 -0
- package/dist/core/runner-deps.d.ts +3 -3
- package/dist/core/secret-env.d.ts +32 -2
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +9 -10
- package/dist/core/session-log-transfer.d.ts +24 -0
- package/dist/core/session-log-transfer.js +166 -0
- package/dist/core/session-policy-store.d.ts +3 -1
- package/dist/core/session-policy-store.js +13 -9
- package/dist/core/session-store.d.ts +86 -24
- package/dist/core/session-store.js +162 -24
- package/dist/core/session.d.ts +92 -1
- package/dist/core/shell-read-silence.js +1 -0
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +8 -5
- package/dist/core/skill-grant.js +6 -6
- package/dist/core/steer-replay.d.ts +4 -2
- package/dist/core/steer-replay.js +2 -1
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +20 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/session-repo-contract.js +112 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +4 -1
- package/dist/core/store-contracts/session-store-contract.js +236 -2
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +92 -8
- package/dist/core/task-notification.js +16 -10
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +7 -1
- package/dist/core/task-spec.d.ts +49 -1
- package/dist/core/task-stream.d.ts +2 -1
- package/dist/core/terminal-cause.d.ts +11 -1
- package/dist/core/tool-catalog-entries.js +1 -0
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-policy.d.ts +16 -0
- package/dist/core/tool-result-store.d.ts +17 -10
- package/dist/core/tool-result-store.js +3 -1
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +3 -1
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-egress.d.ts +0 -2
- package/dist/core/untrusted-egress.js +10 -14
- package/dist/core/user-attachment.js +1 -1
- package/dist/core/wiring-manifest.d.ts +18 -6
- package/dist/core/wiring-manifest.js +4 -3
- package/dist/core/workspace-snapshot.d.ts +44 -0
- package/dist/core/workspace-snapshot.js +34 -0
- package/dist/core/write-protect.d.ts +43 -3
- package/dist/core/write-protect.js +43 -16
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/node-execution-env.js +24 -23
- package/dist/engine/execution-env/symlink-chain.d.ts +7 -5
- package/dist/engine/harness/agent-harness.d.ts +30 -2
- package/dist/engine/harness/agent-harness.js +43 -12
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +56 -7
- package/dist/engine/harness/types.js +5 -1
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +30 -10
- package/dist/engine/llm/types.js +1 -1
- package/dist/engine/loop/agent-loop.d.ts +8 -0
- package/dist/engine/loop/agent-loop.js +52 -15
- package/dist/engine/loop/types.d.ts +3 -1
- package/dist/engine/session/import-validate.js +3 -0
- package/dist/engine/session/memory-repo.d.ts +17 -9
- package/dist/engine/session/memory-repo.js +44 -34
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/repo-utils.d.ts +22 -4
- package/dist/engine/session/repo-utils.js +49 -1
- package/dist/engine/session/storage-base.d.ts +10 -1
- package/dist/engine/session/storage-base.js +11 -22
- package/dist/index.d.ts +29 -16
- package/dist/index.js +21 -11
- package/dist/internal/harness-types.d.ts +2 -2
- package/dist/internal/harness.d.ts +3 -2
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.js +739 -489
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/index.d.ts +4 -1
- package/dist/stores/file/index.js +4 -1
- package/dist/stores/file/mailbox-store.js +6 -10
- package/dist/stores/file/session-store.d.ts +15 -8
- package/dist/stores/file/session-store.js +28 -13
- package/dist/tools/fs/fs-bash.d.ts +6 -0
- package/dist/tools/fs/fs-bash.js +6 -3
- package/dist/tools/fs/fs-write.d.ts +6 -3
- package/dist/tools/fs/fs-write.js +8 -7
- package/dist/tools/fs/index.d.ts +3 -0
- package/dist/tools/fs/index.js +7 -3
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +19 -0
- package/dist/tools/fs/read-floor.js +23 -0
- package/dist/tools/fs/safety.js +40 -8
- package/dist/tools/fs/search.js +6 -24
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +61 -16
- package/dist/tools/fs/shell-read-establish.js +2 -1
- package/dist/tools/fs/shell-read-identity.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +26 -9
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +2 -0
- package/dist/tools/worktree.d.ts +42 -15
- package/dist/tools/worktree.js +60 -32
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +149 -1
- package/wire-changes/core-stores-sql@7.58.0.json +29 -0
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core@7.58.0.json +2188 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/mods-kernel@7.58.0.json +81 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/primitives@7.58.0.json +29 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/dist/primitives/credential-ref.d.ts +0 -89
- package/dist/primitives/credential-ref.js +0 -125
- package/dist/primitives/index.d.ts +0 -2
- package/dist/primitives/index.js +0 -1
|
@@ -123,13 +123,23 @@ export declare const AUTO_STRIPPED_PROGRAMS: readonly ["python", "python3", "pyt
|
|
|
123
123
|
* Does auto mode strip this allow entry for this call (see the module doc)? Read for every rule-shaped member — a list
|
|
124
124
|
* entry, and a person's stored row through {@link autoStrippedRule}; a hook's allow is not an entry and is never stripped.
|
|
125
125
|
* A stripped entry takes no part in the match (the reference removes it before matching), so it neither clears nor is
|
|
126
|
-
* disclosed.
|
|
126
|
+
* disclosed. `allShell`: the leg declared `TaskSpec.classifyAllShell` — every shell command rule stands down, whatever it
|
|
127
|
+
* names, and no entry of any kind clears a call that answers to the shell (the reference suspends every shell allow rule
|
|
128
|
+
* under that setting without reading its content; a path rule a shell-face tool's declared target reaches is one here).
|
|
127
129
|
*/
|
|
128
|
-
export declare function autoStripped(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined): boolean;
|
|
129
|
-
/**
|
|
130
|
+
export declare function autoStripped(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined, allShell: boolean): boolean;
|
|
131
|
+
/** THE strip as every allow member reads it, per call: only in `auto`, and then {@link autoStripped} under the leg's
|
|
132
|
+
* `classifyAllShell` declaration. The one place the mode is compared for the strip. */
|
|
133
|
+
export declare function strippedInAuto(compiled: CompiledAllowEntry, call: ToolCallRequest | undefined, mode: PermissionMode | undefined, allShell: boolean): boolean;
|
|
134
|
+
/** {@link strippedInAuto} over a person's stored ALLOW row, read as its list twin ({@link entryOfRow}): a row is stripped exactly when
|
|
130
135
|
* the entry spelling the same rule is (a deny / ask row never is; a row no grammar reads has no twin and is not stripped here — the
|
|
131
136
|
* lane reads no allow it cannot parse). */
|
|
132
|
-
export declare function autoStrippedRule(rule: PersistedRule, call: ToolCallRequest): boolean;
|
|
137
|
+
export declare function autoStrippedRule(rule: PersistedRule, call: ToolCallRequest, mode: PermissionMode | undefined, allShell: boolean): boolean;
|
|
138
|
+
/** Does the leg's spec declare that every shell entry is the classifier's in `auto` — the one reading of
|
|
139
|
+
* `TaskSpec.classifyAllShell` (its value is screened at the door: present ⇒ a boolean). */
|
|
140
|
+
export declare function classifiesAllShell(spec: {
|
|
141
|
+
readonly classifyAllShell?: boolean;
|
|
142
|
+
}): boolean;
|
|
133
143
|
/** One row a list matcher reads. */
|
|
134
144
|
export interface AllowEntryRow {
|
|
135
145
|
readonly behavior: "allow" | "deny";
|
|
@@ -138,12 +148,14 @@ export interface AllowEntryRow {
|
|
|
138
148
|
}
|
|
139
149
|
/** The facts a list's content row is judged under: the leg's root and session (which rows apply), the live working
|
|
140
150
|
* directory (where a command's `cd` lands), and the ANCHORS of the list's path rows — the leg the list was installed
|
|
141
|
-
* on (its root and environment home): a path row of a list never moves with a `cd`.
|
|
151
|
+
* on (its root and environment home): a path row of a list never moves with a `cd`. `classifyAllShell`: the leg's
|
|
152
|
+
* declaration ({@link classifiesAllShell}) the auto strip reads ({@link strippedInAuto}); absent ⇒ the leg declared nothing. */
|
|
142
153
|
export interface AllowEntryJudgeContext {
|
|
143
154
|
readonly root: string | undefined;
|
|
144
155
|
readonly sessionId: string | undefined;
|
|
145
156
|
readonly liveCwd: () => string | undefined;
|
|
146
157
|
readonly anchors: PathRuleBases;
|
|
158
|
+
readonly classifyAllShell?: boolean;
|
|
147
159
|
}
|
|
148
160
|
/** For a list whose allow rows admitted no call ({@link judgeAllowEntries}): the first segment of the call's command no command
|
|
149
161
|
* row covers under `posture` — the word a refusal names; `undefined` when the call carries no command or no single segment is
|
|
@@ -165,7 +177,7 @@ export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[],
|
|
|
165
177
|
*/
|
|
166
178
|
export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture): readonly R[] | undefined;
|
|
167
179
|
/** The allow rows of a list, as the allow layer reads them in `mode`: the strip applied BEFORE the match (in `auto`). */
|
|
168
|
-
export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined): readonly R[];
|
|
180
|
+
export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined, allShell: boolean): readonly R[];
|
|
169
181
|
/** The two sources {@link AllowEntryTable} holds (a skill's list is the skill table's). */
|
|
170
182
|
export type AllowEntrySource = "request" | "deployment";
|
|
171
183
|
/** What spoke for a call: the entries it stands on, as the list spells them, and — for entries of the list the run received —
|
|
@@ -285,7 +297,7 @@ export type AccountedClass = "probe";
|
|
|
285
297
|
* Exported (frozen) so a host that renders the card's "why it cannot be cleared" half reads the engine's row, never a copy. */
|
|
286
298
|
export declare const SHADOW_REASON: Readonly<{
|
|
287
299
|
readonly content_question: "the call is the engine's own question to a person";
|
|
288
|
-
readonly hook: "
|
|
300
|
+
readonly hook: "an extension's screening asks about this call (a PreToolUse hook or a tool.check station) — the deployment's own screening is answered by a person";
|
|
289
301
|
readonly ancestor: "the task that delegated this one owns this question";
|
|
290
302
|
readonly dangerous_delete: "this removal targets a protected location (the filesystem root, a top-level directory, a home directory, or a workspace directory or one of its ancestors) — it is cleared by confirming this call, never by an allow rule";
|
|
291
303
|
readonly unverifiable_delete: "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule";
|
|
@@ -301,6 +313,7 @@ export declare const SHADOW_REASON: Readonly<{
|
|
|
301
313
|
readonly operator_forced: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule";
|
|
302
314
|
readonly shell_floor: "this deployment mandates per-call confirmation for shell commands (shellGate: always)";
|
|
303
315
|
readonly target_unresolved: "where this write leads on disk could not be determined (a link on the way could not be examined, or the environment could not resolve the target), so whether it lands on a guarded path is unknown — it is cleared by confirming this call: no standing rule and no automatic decider answers for it, though a wired approver seat can";
|
|
316
|
+
readonly write_protection_on_disk: "this write's target is on the deployment's write-protection table (the agent's own configuration is guarded one look per write) — it is cleared by confirming this call, never by a standing allow rule";
|
|
304
317
|
readonly write_protection: "this write's target is on the deployment's write-protection table (the agent's own configuration is guarded one look per write) — it is cleared by confirming this call, never by a standing allow rule";
|
|
305
318
|
readonly tool_marks_mcp: "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)";
|
|
306
319
|
readonly tool_marks_a2a: "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)";
|
package/dist/core/allow-entry.js
CHANGED
|
@@ -127,30 +127,35 @@ function shellRuleContent(rule) {
|
|
|
127
127
|
const body = "reject" in split ? rule.command : (split.segments[split.segments.length - 1] ?? rule.command).trim();
|
|
128
128
|
return rule.match === "prefix" ? `${body}:*` : rule.match === "wildcard" ? `${body} *` : body;
|
|
129
129
|
}
|
|
130
|
-
export function autoStripped(compiled, call) {
|
|
130
|
+
export function autoStripped(compiled, call, allShell) {
|
|
131
131
|
switch (compiled.kind) {
|
|
132
132
|
case "shell":
|
|
133
133
|
return true;
|
|
134
134
|
case "tool":
|
|
135
|
+
case "covering":
|
|
135
136
|
return call !== undefined && answersTo(call, isShellFaceToolName);
|
|
136
137
|
case "command":
|
|
138
|
+
if (allShell)
|
|
139
|
+
return true;
|
|
137
140
|
return compiled.rule.match === "pattern" ? commandPatternMayRun(compiled.rule.command, AUTO_STRIPPED_PROGRAMS) : shellContentStripped(shellRuleContent(compiled.rule));
|
|
138
|
-
case "covering":
|
|
139
141
|
case "path":
|
|
140
142
|
case "name":
|
|
141
143
|
case "domain":
|
|
142
|
-
return
|
|
144
|
+
return allShell && call !== undefined && answersTo(call, isShellFaceToolName);
|
|
143
145
|
default: {
|
|
144
146
|
const exhaustive = compiled;
|
|
145
147
|
return exhaustive;
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
|
-
export function
|
|
151
|
+
export function strippedInAuto(compiled, call, mode, allShell) {
|
|
152
|
+
return mode === "auto" && autoStripped(compiled, call, allShell);
|
|
153
|
+
}
|
|
154
|
+
export function autoStrippedRule(rule, call, mode, allShell) {
|
|
150
155
|
if (rule.behavior !== "allow")
|
|
151
156
|
return false;
|
|
152
157
|
const entry = entryOfRow(rule);
|
|
153
|
-
return entry !== undefined &&
|
|
158
|
+
return entry !== undefined && strippedInAuto(entry, call, mode, allShell);
|
|
154
159
|
}
|
|
155
160
|
function entryOfRow(rule) {
|
|
156
161
|
if (rule.match === "tool")
|
|
@@ -158,6 +163,9 @@ function entryOfRow(rule) {
|
|
|
158
163
|
const grammar = ruleToolGrammarOf(rule.tool);
|
|
159
164
|
return grammar === undefined ? undefined : { kind: grammar, rule };
|
|
160
165
|
}
|
|
166
|
+
export function classifiesAllShell(spec) {
|
|
167
|
+
return spec.classifyAllShell === true;
|
|
168
|
+
}
|
|
161
169
|
const NO_LEADS = new Map();
|
|
162
170
|
function nameRowReaches(compiled, req) {
|
|
163
171
|
if (compiled.kind === "tool" || compiled.kind === "shell")
|
|
@@ -234,8 +242,8 @@ export function judgeAllowEntries(rows, req, behavior, ctx, posture = "grant") {
|
|
|
234
242
|
}
|
|
235
243
|
return undefined;
|
|
236
244
|
}
|
|
237
|
-
export function allowingRows(rows, req, mode) {
|
|
238
|
-
return
|
|
245
|
+
export function allowingRows(rows, req, mode, allShell) {
|
|
246
|
+
return rows.filter((r) => !strippedInAuto(r.compiled, req, mode, allShell));
|
|
239
247
|
}
|
|
240
248
|
export class AllowEntryTable {
|
|
241
249
|
held = [];
|
|
@@ -270,7 +278,7 @@ export class AllowEntryTable {
|
|
|
270
278
|
lane(ctx) {
|
|
271
279
|
return {
|
|
272
280
|
allowing: (req, mode) => {
|
|
273
|
-
const hit = judgeAllowEntries(allowingRows(this.held, req, mode), req, "allow", ctx);
|
|
281
|
+
const hit = judgeAllowEntries(allowingRows(this.held, req, mode, ctx.classifyAllShell === true), req, "allow", ctx);
|
|
274
282
|
if (hit === undefined)
|
|
275
283
|
return undefined;
|
|
276
284
|
const entries = hit.map((r) => r.entry);
|
|
@@ -368,7 +376,7 @@ export function readAllowRuleShadows(value) {
|
|
|
368
376
|
}
|
|
369
377
|
export const SHADOW_REASON = Object.freeze({
|
|
370
378
|
content_question: "the call is the engine's own question to a person",
|
|
371
|
-
hook: "
|
|
379
|
+
hook: "an extension's screening asks about this call (a PreToolUse hook or a tool.check station) — the deployment's own screening is answered by a person",
|
|
372
380
|
ancestor: "the task that delegated this one owns this question",
|
|
373
381
|
dangerous_delete: "this removal targets a protected location (the filesystem root, a top-level directory, a home directory, or a workspace directory or one of its ancestors) — it is cleared by confirming this call, never by an allow rule",
|
|
374
382
|
unverifiable_delete: "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule",
|
|
@@ -384,6 +392,7 @@ export const SHADOW_REASON = Object.freeze({
|
|
|
384
392
|
operator_forced: "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule",
|
|
385
393
|
shell_floor: MANDATE_DISCLOSURE.operator_always,
|
|
386
394
|
target_unresolved: MANDATE_DISCLOSURE.target_unresolved,
|
|
395
|
+
write_protection_on_disk: MANDATE_DISCLOSURE.write_protection,
|
|
387
396
|
write_protection: MANDATE_DISCLOSURE.write_protection,
|
|
388
397
|
tool_marks_mcp: MANDATE_DISCLOSURE.tool_marks,
|
|
389
398
|
tool_marks_a2a: MANDATE_DISCLOSURE.tool_marks,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PendingAction } from "./checkpoint-store.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type CallTargetReading } from "./effective-path-target.js";
|
|
3
3
|
import { type SkillGrantSource } from "./skill-grant.js";
|
|
4
4
|
import type { ReadLanding } from "../tools/fs/shell-read-identity.js";
|
|
5
5
|
import type { ToolCallPathTarget, ToolFamily, ToolHostTarget } from "./tool-face.js";
|
|
6
|
-
import { type ToolRosterEntry } from "./tool-roster.js";
|
|
6
|
+
import { type RosterFaceMember, type RosterIdentityCarrier, type ToolRosterEntry } from "./tool-roster.js";
|
|
7
|
+
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
7
8
|
type ParkedApproval = Extract<PendingAction, {
|
|
8
9
|
kind: "tool_approval";
|
|
9
10
|
}>;
|
|
@@ -26,19 +27,25 @@ export type ApprovalTargets = {
|
|
|
26
27
|
export type ApprovalTargetReads = {
|
|
27
28
|
readonly [candidate: string]: string;
|
|
28
29
|
};
|
|
29
|
-
/** The tool member
|
|
30
|
+
/** The tool member of a row, read WHOLE: the identity the roster row carried (its four members and the mount site), its face and
|
|
31
|
+
* its declaration's digest, as the park minted them off that row ({@link ROSTER_APPROVAL_BINDING}). The optional members are
|
|
32
|
+
* absent exactly when the roster row had none (no path target, no URL slot, not the engine's mount). */
|
|
30
33
|
export interface ApprovalTool {
|
|
31
|
-
readonly capabilityId
|
|
32
|
-
readonly contractId
|
|
33
|
-
readonly shapeDigest
|
|
34
|
-
readonly implementationRevision
|
|
35
|
-
readonly
|
|
34
|
+
readonly capabilityId: string;
|
|
35
|
+
readonly contractId: string;
|
|
36
|
+
readonly shapeDigest: string;
|
|
37
|
+
readonly implementationRevision: string;
|
|
38
|
+
readonly engineMounted?: true;
|
|
39
|
+
readonly family: ToolFamily;
|
|
36
40
|
readonly pathTarget?: ToolCallPathTarget;
|
|
37
41
|
readonly hostTarget?: ToolHostTarget;
|
|
42
|
+
readonly declarationDigest: string;
|
|
38
43
|
}
|
|
39
44
|
export interface ApprovalObject {
|
|
40
|
-
/**
|
|
41
|
-
readonly tool
|
|
45
|
+
/** The tool member, or the members a whole one would carry that the row lacks or carries out of their shape. */
|
|
46
|
+
readonly tool: ApprovalTool | {
|
|
47
|
+
readonly missing: readonly string[];
|
|
48
|
+
};
|
|
42
49
|
/** The row's two target members as stored — read, validated, by the judge. */
|
|
43
50
|
readonly targets?: unknown;
|
|
44
51
|
readonly targetReads?: unknown;
|
|
@@ -70,9 +77,9 @@ export type ApprovalDisposition = "refuse_pending" | "reopen" | "veto";
|
|
|
70
77
|
export interface ApprovalMismatch {
|
|
71
78
|
readonly member: ApprovalMember;
|
|
72
79
|
readonly disposition: ApprovalDisposition;
|
|
73
|
-
/** The machine word: the reopen codes, `resume.target_moved` on a moved face or target (the vetoed call's
|
|
74
|
-
* `tool_end.errorCode`); absent on a grants veto. */
|
|
75
|
-
readonly code?: "resume.tool_unavailable" | "resume.tool_contract_mismatch" | "resume.target_moved" | "checkpoint.invalid_outcome";
|
|
80
|
+
/** The machine word: the reopen codes, `resume.target_moved` on a moved face, declaration or target (the vetoed call's
|
|
81
|
+
* `tool_end.errorCode`), the claim's refusal codes; absent on a grants veto. */
|
|
82
|
+
readonly code?: "resume.tool_unavailable" | "resume.tool_contract_mismatch" | "resume.target_moved" | "checkpoint.invalid_outcome" | "checkpoint.unsupported_version";
|
|
76
83
|
readonly message: string;
|
|
77
84
|
}
|
|
78
85
|
/** What the station holds of the live call. */
|
|
@@ -92,10 +99,17 @@ export interface LiveApprovalObject {
|
|
|
92
99
|
* person approved bytes whose target the row never recorded, and the targets member is not judged. */
|
|
93
100
|
readonly decided?: unknown;
|
|
94
101
|
}
|
|
102
|
+
declare const IDENTITY_MEMBERS: readonly ["capabilityId", "contractId", "shapeDigest", "implementationRevision", "engineMounted"];
|
|
103
|
+
declare const FACE_MEMBERS: readonly ["family", "pathTarget", "hostTarget"];
|
|
104
|
+
/** The two lists the judge compares are exactly the classification's (`ROSTER_APPROVAL_BINDING`): an identity carrier or a face
|
|
105
|
+
* member the table adds or drops is a compile error here until the judge reads it so (a roster key moved between classes while the
|
|
106
|
+
* carrier set stays the same — `name` beside `capabilityId` — is not). */
|
|
107
|
+
export type IdentityMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterIdentityCarrier, (typeof IDENTITY_MEMBERS)[number]> | Exclude<(typeof IDENTITY_MEMBERS)[number], RosterIdentityCarrier>>;
|
|
108
|
+
export type FaceMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterFaceMember, (typeof FACE_MEMBERS)[number]> | Exclude<(typeof FACE_MEMBERS)[number], RosterFaceMember>>;
|
|
95
109
|
/**
|
|
96
110
|
* THE judge of a parked approval at one station: `"match"`, or the first member the table names for the station that
|
|
97
|
-
* the live call does not match, with its disposition. Absence is read per member: a tool member
|
|
98
|
-
*
|
|
111
|
+
* the live call does not match, with its disposition. Absence is read per member: a tool member is whole or binds no tool
|
|
112
|
+
* (refused before the claim, never read by name or by default); a grants
|
|
99
113
|
* member is judged whenever the call would activate a skill (a row with no digest cannot cover one); a targets member
|
|
100
114
|
* is judged unless the decision rewrote the bytes to ones the row's binding does not cover, and one that is not a whole
|
|
101
115
|
* role → location record is damage.
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { canonicalize } from "./canonical-json.js";
|
|
2
2
|
import { licenseCovers } from "./tool-policy.js";
|
|
3
|
+
import { pathTargetResolutionOf } from "./effective-path-target.js";
|
|
3
4
|
import { parkedSkillApprovalRefusal } from "./skill-grant.js";
|
|
4
|
-
import { toolIdentityOf } from "./tool-roster.js";
|
|
5
|
+
import { engineMountedRow, toolDeclarationDigestOf, toolIdentityOf } from "./tool-roster.js";
|
|
5
6
|
import { inlineUntrusted } from "./untrusted-text.js";
|
|
7
|
+
import { isPlainRecord } from "./mods/kernel/receive.js";
|
|
6
8
|
export const APPROVAL_TARGET_ROLES = Object.freeze(["protective", "declared"]);
|
|
9
|
+
const ALWAYS_MINTED = Object.freeze(["capabilityId", "contractId", "shapeDigest", "implementationRevision", "family", "declarationDigest"]);
|
|
10
|
+
const isString = (v) => typeof v === "string";
|
|
11
|
+
const absentOr = (shape) => (v) => v === undefined || shape(v);
|
|
12
|
+
const isSlot = (v) => isPlainRecord(v) && typeof v["param"] === "string";
|
|
13
|
+
const TOOL_MEMBER_SHAPES = Object.freeze({
|
|
14
|
+
capabilityId: isString, contractId: isString, shapeDigest: isString, implementationRevision: isString, family: isString, declarationDigest: isString,
|
|
15
|
+
engineMounted: absentOr((v) => v === true), pathTarget: absentOr(isSlot), hostTarget: absentOr(isSlot),
|
|
16
|
+
});
|
|
17
|
+
const unreadToolMembers = (row) => Object.keys(TOOL_MEMBER_SHAPES).filter((k) => !TOOL_MEMBER_SHAPES[k](row[k]));
|
|
18
|
+
const wholeTool = (row) => unreadToolMembers(row).length === 0;
|
|
7
19
|
export function approvalObjectOf(row) {
|
|
8
|
-
const {
|
|
9
|
-
const
|
|
20
|
+
const { targets, targetReads, boundGrantDigest } = row;
|
|
21
|
+
const tool = wholeTool(row)
|
|
22
|
+
? { capabilityId: row.capabilityId, contractId: row.contractId, shapeDigest: row.shapeDigest, implementationRevision: row.implementationRevision, ...(row.engineMounted === true ? { engineMounted: true } : {}), family: row.family, ...(row.pathTarget !== undefined ? { pathTarget: row.pathTarget } : {}), ...(row.hostTarget !== undefined ? { hostTarget: row.hostTarget } : {}), declarationDigest: row.declarationDigest }
|
|
23
|
+
: { missing: unreadToolMembers(row) };
|
|
10
24
|
return {
|
|
11
|
-
|
|
25
|
+
tool,
|
|
12
26
|
...(targets !== undefined ? { targets } : {}),
|
|
13
27
|
...(targetReads !== undefined ? { targetReads } : {}),
|
|
14
28
|
...(boundGrantDigest !== undefined ? { grants: boundGrantDigest } : {}),
|
|
@@ -24,33 +38,47 @@ export function approvalTargetsOf(reading, reads) {
|
|
|
24
38
|
return { ...(Object.keys(targets).length > 0 ? { targets } : {}), ...(reads !== undefined ? { targetReads: Object.fromEntries(reads.map((r) => [r.key, r.landing])) } : {}) };
|
|
25
39
|
}
|
|
26
40
|
export const APPROVAL_STATION_MEMBERS = Object.freeze({
|
|
27
|
-
claim: Object.freeze(["grants"]),
|
|
41
|
+
claim: Object.freeze(["tool", "grants"]),
|
|
28
42
|
session: Object.freeze(["tool"]),
|
|
29
43
|
execution: Object.freeze(["tool", "grants", "targets"]),
|
|
30
44
|
});
|
|
31
|
-
const IDENTITY_MEMBERS = Object.freeze(["capabilityId", "contractId", "shapeDigest", "implementationRevision"]);
|
|
45
|
+
const IDENTITY_MEMBERS = Object.freeze(["capabilityId", "contractId", "shapeDigest", "implementationRevision", "engineMounted"]);
|
|
46
|
+
const FACE_MEMBERS = Object.freeze(["family", "pathTarget", "hostTarget"]);
|
|
32
47
|
const shown = (s) => `"${inlineUntrusted(s, 240)}"`;
|
|
33
48
|
const vetoed = (name, why) => `The approved tool call "${name}" was not executed: ${why}, so the approval does not cover it (resume.target_moved). This approval is spent — the call has to be re-issued: its new card shows what it would act on now.`;
|
|
34
|
-
function faceKey(
|
|
35
|
-
const
|
|
36
|
-
|
|
49
|
+
function faceKey(face) {
|
|
50
|
+
const resolved = (k) => {
|
|
51
|
+
const pt = face.pathTarget;
|
|
52
|
+
if (k !== "pathTarget")
|
|
53
|
+
return face[k] ?? null;
|
|
54
|
+
return pt === undefined ? null : { param: pt.param, access: pt.access, aliases: [...(pt.aliases ?? [])], ...pathTargetResolutionOf(pt), patternParam: pt.patternParam ?? null, skillScopeEligible: pt.skillScopeEligible === true };
|
|
55
|
+
};
|
|
56
|
+
return canonicalize(Object.fromEntries(FACE_MEMBERS.map((k) => [k, resolved(k)])));
|
|
37
57
|
}
|
|
38
|
-
function judgeTool(row, live) {
|
|
58
|
+
function judgeTool(row, live, station) {
|
|
59
|
+
const bound = approvalObjectOf(row).tool;
|
|
60
|
+
if ("missing" in bound) {
|
|
61
|
+
const why = `carries no whole record of the tool it was asked for (${bound.missing.join(", ")} missing or not in its shape — a row parked by an engine before it recorded them, a call parked while its tool was off the leg's roster, or a damaged row), so which tool the approval covers cannot be read`;
|
|
62
|
+
if (station !== "claim")
|
|
63
|
+
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, `its checkpoint row ${why}`) };
|
|
64
|
+
return { member: "tool", disposition: "refuse_pending", code: "checkpoint.unsupported_version", message: `this checkpoint's pending approval ${why}, and it is not redeemed; the checkpoint stays pending: deny it so the model can re-issue the call (a row that also predates the ask's origin is refused a deny too), finish a row an earlier engine parked on a worker of that release, or expire it` };
|
|
65
|
+
}
|
|
66
|
+
if (station === "claim")
|
|
67
|
+
return undefined;
|
|
39
68
|
const entry = live.tool;
|
|
40
69
|
if (entry === undefined)
|
|
41
70
|
return { member: "tool", disposition: "reopen", code: "resume.tool_unavailable", message: `the approved tool "${row.toolName}" is no longer available on resume — refusing to continue as if it ran; the checkpoint is reopened for a retry with the tool present` };
|
|
42
|
-
const
|
|
43
|
-
if (bound === undefined)
|
|
44
|
-
return undefined;
|
|
45
|
-
const id = toolIdentityOf(entry);
|
|
71
|
+
const id = { ...toolIdentityOf(entry), engineMounted: engineMountedRow(entry) ? true : undefined };
|
|
46
72
|
const differ = IDENTITY_MEMBERS.filter((k) => bound[k] !== id[k]);
|
|
47
73
|
if (differ.length > 0) {
|
|
48
|
-
|
|
49
|
-
|
|
74
|
+
return { member: "tool", disposition: "reopen", code: "resume.tool_contract_mismatch", message: `the approved tool "${row.toolName}" on this leg is not the tool the approval was minted against (${differ.map((k) => (k === "engineMounted" ? "mount site" : k)).join(", ")} differ) — refusing to execute a replacement wearing the name; the checkpoint is reopened for a retry with the original tool present` };
|
|
75
|
+
}
|
|
76
|
+
if (faceKey(bound) !== faceKey(entry)) {
|
|
77
|
+
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") };
|
|
50
78
|
}
|
|
51
|
-
if (
|
|
79
|
+
if (bound.declarationDigest === toolDeclarationDigestOf(entry))
|
|
52
80
|
return undefined;
|
|
53
|
-
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, "the tool's
|
|
81
|
+
return { member: "tool", disposition: "veto", code: "resume.target_moved", message: vetoed(row.toolName, "the tool's declaration (what it does, reaches and trusts: its effect, egress, irreversibility, content origin, boundary legs, rule face or model gate) changed after the approval") };
|
|
54
82
|
}
|
|
55
83
|
function judgeTargets(row, live) {
|
|
56
84
|
if ((row.targets === undefined && row.targetReads === undefined) || ("decided" in live && !licenseCovers(row.boundInputHash, live.decided)))
|
|
@@ -104,7 +132,7 @@ function judgeGrants(row, live, station) {
|
|
|
104
132
|
}
|
|
105
133
|
export function judgeApprovalObject(row, live, station) {
|
|
106
134
|
for (const member of APPROVAL_STATION_MEMBERS[station]) {
|
|
107
|
-
const miss = member === "tool" ? judgeTool(row, live) : member === "targets" ? judgeTargets(row, live) : judgeGrants(row, live, station === "claim" ? "claim" : "execution");
|
|
135
|
+
const miss = member === "tool" ? judgeTool(row, live, station) : member === "targets" ? judgeTargets(row, live) : judgeGrants(row, live, station === "claim" ? "claim" : "execution");
|
|
108
136
|
if (miss !== undefined)
|
|
109
137
|
return miss;
|
|
110
138
|
}
|
|
@@ -426,6 +426,10 @@ export interface MandateMarks {
|
|
|
426
426
|
* for a shell command's written targets). A GATE fact like the org words: it rides the pass, not the decision, so no
|
|
427
427
|
* layer outside the engine declares it. */
|
|
428
428
|
writeProtected?: boolean;
|
|
429
|
+
/** The same judge's record that a written target met its table only where the path resolves on disk (its real target, a hop
|
|
430
|
+
* of its link chain) — the path as written names no row (`GatePass.writeProtectedOnDisk`; the two writers of
|
|
431
|
+
* `writeProtected`, the reading of each target being one or the other). A GATE fact like `writeProtected`. */
|
|
432
|
+
writeProtectedOnDisk?: boolean;
|
|
429
433
|
/** The gate's record that the READING of a written target could not say where it leads on disk (`GatePass.targetUnresolved`:
|
|
430
434
|
* a target a shell command's program writes, placed, whose destination the read station could not resolve) — a fact of
|
|
431
435
|
* the reading, never a judge's verdict. The write face's twin of `probeUnanswered`. */
|
|
@@ -526,8 +530,13 @@ export type ToolMarkSource = "deployment" | "mcp_annotation" | "a2a_default";
|
|
|
526
530
|
* row ({@link REMOVAL_BREAKER_ROW}).
|
|
527
531
|
* `rule_unreadable` is a rule that may govern the call and cannot be read for it: the organization's snapshot, a partition of
|
|
528
532
|
* the person's store, or this call against a deny / ask row (the lexer's word, a content row, the read station's rows).
|
|
533
|
+
* `write_protection` and `write_protection_on_disk` are the two readings of one table hit, judged per written target and never
|
|
534
|
+
* both for one target: the path AS WRITTEN names a row of the write-protection table (`write_protection` — the classifier may
|
|
535
|
+
* answer it), or only where the path resolves on disk does (`write_protection_on_disk` — its real target, or a link on the way:
|
|
536
|
+
* an innocent spelling the disk carries onto a guarded path, which the auto-mode classifier does not answer). A command
|
|
537
|
+
* writing several targets may carry both.
|
|
529
538
|
*/
|
|
530
|
-
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "unverifiable_delete", "unverifiable_shell_text", "transcript_write", "org_rule", "rule_unreadable", "ask_rule", "denial_limit_fallback", "classifier_no_ruling", "requires_user_interaction", "cross_boundary", "operator_forced", "shell_floor", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "unstated", "ordinary"];
|
|
539
|
+
export declare const ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "unverifiable_delete", "unverifiable_shell_text", "transcript_write", "org_rule", "rule_unreadable", "ask_rule", "denial_limit_fallback", "classifier_no_ruling", "requires_user_interaction", "cross_boundary", "operator_forced", "shell_floor", "target_unresolved", "probe", "write_protection_on_disk", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "unstated", "ordinary"];
|
|
531
540
|
export type AskClass = (typeof ASK_CLASSES)[number];
|
|
532
541
|
/** Membership test for {@link AskClass} — the word crosses the wire on `tool_end.gate.disposition`. */
|
|
533
542
|
export declare function isAskClass(v: unknown): v is AskClass;
|
|
@@ -561,7 +570,10 @@ export interface ModeArbitrationRow {
|
|
|
561
570
|
* rule or a bypass mode clears it, auto mode's classifier answers it, and a sandbox admits nothing on its behalf (the
|
|
562
571
|
* tool's effect lands at a remote peer, outside any containment the leg declares). `hookAskFloor` marks the classes the reference's rule / safety check answers
|
|
563
572
|
* `ask` for — an ask rule, a question the tool needs a person for, a dangerous removal, a protected or unresolvable write
|
|
564
|
-
* target, the session transcript, another's shared artifact.
|
|
573
|
+
* target, the session transcript, another's shared artifact. `write_protection_on_disk` is `write_protection`'s row but for the
|
|
574
|
+
* classifier column: the reference implementation marks a protected-write question its classifier may not answer exactly when
|
|
575
|
+
* the requested path alone is safe and the target's resolution is what reaches the guarded name — every other column of the
|
|
576
|
+
* question is the table's.
|
|
565
577
|
* A row is a class's reading on every face but the ones {@link RELEASED_ON_SHELL_FACE} names: `target_unresolved`'s
|
|
566
578
|
* `bypassImmune` is the file face's (and every other face's) reading, and the shell face reads it released — folded where the
|
|
567
579
|
* ask's row is ({@link foldArbitrationRow}), listed per face by {@link releasableAskClassesFor}.
|
|
@@ -693,6 +705,13 @@ export declare const MODE_ARBITRATION: {
|
|
|
693
705
|
readonly ruleMayClear: false;
|
|
694
706
|
readonly hookAskFloor: false;
|
|
695
707
|
};
|
|
708
|
+
readonly write_protection_on_disk: {
|
|
709
|
+
readonly bypassImmune: false;
|
|
710
|
+
readonly classifierEligible: false;
|
|
711
|
+
readonly sandboxAdmission: true;
|
|
712
|
+
readonly ruleMayClear: false;
|
|
713
|
+
readonly hookAskFloor: true;
|
|
714
|
+
};
|
|
696
715
|
readonly write_protection: {
|
|
697
716
|
readonly bypassImmune: false;
|
|
698
717
|
readonly classifierEligible: true;
|
package/dist/core/ask-origin.js
CHANGED
|
@@ -145,7 +145,7 @@ export function persistedRuleMandateOf(marks) {
|
|
|
145
145
|
const word = irreversibilityMandateOf(marks);
|
|
146
146
|
if (word === "probe_mandate" || word === "probe_unanswered")
|
|
147
147
|
return word;
|
|
148
|
-
if (marks.writeProtected === true)
|
|
148
|
+
if (marks.writeProtected === true || marks.writeProtectedOnDisk === true)
|
|
149
149
|
return "write_protection";
|
|
150
150
|
return marks.egress === true || marks.requiresUserInteraction === true ? "tool_marks" : word;
|
|
151
151
|
}
|
|
@@ -205,6 +205,7 @@ export const ASK_CLASSES = Object.freeze([
|
|
|
205
205
|
"shell_floor",
|
|
206
206
|
"target_unresolved",
|
|
207
207
|
"probe",
|
|
208
|
+
"write_protection_on_disk",
|
|
208
209
|
"write_protection",
|
|
209
210
|
"tool_marks_mcp",
|
|
210
211
|
"tool_marks_a2a",
|
|
@@ -238,6 +239,7 @@ export const MODE_ARBITRATION = {
|
|
|
238
239
|
shell_floor: { bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false },
|
|
239
240
|
target_unresolved: { bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true },
|
|
240
241
|
probe: { bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false },
|
|
242
|
+
write_protection_on_disk: { bypassImmune: false, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true },
|
|
241
243
|
write_protection: { bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true },
|
|
242
244
|
tool_marks_mcp: { bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false },
|
|
243
245
|
tool_marks_a2a: { bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false },
|
|
@@ -369,6 +371,8 @@ export function classifyAsk(d, facts) {
|
|
|
369
371
|
classes.add("target_unresolved");
|
|
370
372
|
if (marks.writeProtected === true)
|
|
371
373
|
classes.add("write_protection");
|
|
374
|
+
if (marks.writeProtectedOnDisk === true)
|
|
375
|
+
classes.add("write_protection_on_disk");
|
|
372
376
|
if (facts.tightened === "unstated")
|
|
373
377
|
classes.add("unstated");
|
|
374
378
|
for (const c of facts.ancestorClasses ?? [])
|
|
@@ -424,6 +424,10 @@ export interface MaybeCompactOptions {
|
|
|
424
424
|
* context may have lost an engine frame the run still needs, and every reader of the new baseline
|
|
425
425
|
* (the next model request first) must see it restated. */
|
|
426
426
|
postureRestate?: () => Promise<void>;
|
|
427
|
+
/** The session plan file's post-compaction reference (`planFileRestateOption`, the runner's `compactionRestateOptions`):
|
|
428
|
+
* where the plan is and what it says, on a leg whose run admitted a plan file that holds one; runs right after
|
|
429
|
+
* `postureRestate`, under the same belt. */
|
|
430
|
+
planFileRestate?: () => Promise<void>;
|
|
427
431
|
/** The advisor tool's instructions' post-compaction restatement on a leg that mounts the tool (the runner's
|
|
428
432
|
* `compactionRestateOptions`): runs right after `postureRestate`, under the same belt, for the same reason. */
|
|
429
433
|
advisorRestate?: () => Promise<void>;
|
|
@@ -470,7 +470,7 @@ export async function maybeCompact(opts) {
|
|
|
470
470
|
const restatedEpoch = identityNow !== undefined ? selectCompactionEpoch(current, identityNow.layers, identityNow.sourceRevision) : undefined;
|
|
471
471
|
const restatedListings = await opts.session.getAnnouncedListing().catch(() => undefined);
|
|
472
472
|
if (opts.signal?.aborted === true) {
|
|
473
|
-
throw Object.assign(new Error("compaction cancelled before commit — the abort signal fired
|
|
473
|
+
throw Object.assign(new Error("compaction cancelled before commit — the abort signal fired after the summary was produced; nothing was persisted"), opts.manualCancelSignal?.aborted === true ? { [COMPACTION_MANUAL_CANCEL_FLAG]: true } : {});
|
|
474
474
|
}
|
|
475
475
|
await opts.session.appendCompaction(summary, firstKeptEntryId, summaryTokensBefore, {
|
|
476
476
|
...(details ?? {}),
|
|
@@ -517,7 +517,7 @@ export async function maybeCompact(opts) {
|
|
|
517
517
|
catch {
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
for (const restate of [opts.postureRestate, opts.advisorRestate]) {
|
|
520
|
+
for (const restate of [opts.postureRestate, opts.planFileRestate, opts.advisorRestate]) {
|
|
521
521
|
if (restate === undefined)
|
|
522
522
|
continue;
|
|
523
523
|
try {
|
|
@@ -29,6 +29,21 @@ export declare const PLAN_MODE_NO_EXIT_SPARSE_DIRECTIVE: string;
|
|
|
29
29
|
* the child answers the request it was given (its final answer goes back to the agent that delegated to it). The
|
|
30
30
|
* reference has no sparse arm for a sub-agent, so a restatement of this row is this body. */
|
|
31
31
|
export declare const PLAN_MODE_CHILD_DIRECTIVE: string;
|
|
32
|
+
/** A frame that names the leg's session plan file: the text before the file, and the text after it. The file goes between
|
|
33
|
+
* them as the seat tells it (`planFileShown`, advertised-writable-dirs.ts — one line, verbatim); the fold recognizes the
|
|
34
|
+
* frame by its two halves. */
|
|
35
|
+
export interface PostureTemplate {
|
|
36
|
+
readonly head: string;
|
|
37
|
+
readonly tail: string;
|
|
38
|
+
}
|
|
39
|
+
/** The planning frame of a leg that keeps its plan in a FILE (`TaskSpec.planFile`, the reference's disk arm): the reference
|
|
40
|
+
* full reminder's disk-arm opening — the edit ban "with the exception of the plan file mentioned below" — and its
|
|
41
|
+
* `## Plan File Info:` section, with the file's existence left to the model (the reference words it two ways off a disk
|
|
42
|
+
* read; this frame names both actions), and the tail adapted to the engine's exit (the plan-exit tool reads the file, a
|
|
43
|
+
* human approves). */
|
|
44
|
+
export declare const PLAN_MODE_FILE_DIRECTIVE: PostureTemplate;
|
|
45
|
+
/** The file arm's sparse restatement — the reference sparse shape with its plan-file clause ("Read-only except plan file"). */
|
|
46
|
+
export declare const PLAN_MODE_FILE_SPARSE_DIRECTIVE: PostureTemplate;
|
|
32
47
|
/** The planning frame's exit — the reference exit renderer's text without its plan-file clause. Names no tool, so
|
|
33
48
|
* one exit retires every planning wording. */
|
|
34
49
|
export declare const PLAN_MODE_EXIT_DIRECTIVE: string;
|
|
@@ -50,6 +65,9 @@ export interface PostureLegFacts {
|
|
|
50
65
|
exitToolMounted: boolean;
|
|
51
66
|
/** This leg runs as a delegated child (every core spawn lane, a fork included). */
|
|
52
67
|
isChildLeg: boolean;
|
|
68
|
+
/** The session plan file the run admitted (`TaskSpec.planFile`), as the seat tells it to the model (`planFileShown`) —
|
|
69
|
+
* absent ⇒ the plan is the plan-exit tool's argument and no frame names a file. */
|
|
70
|
+
planFile?: string;
|
|
53
71
|
}
|
|
54
72
|
/** Every fact a row's `owedBy` reads: the mode facts and the leg's shape. */
|
|
55
73
|
export type PostureFacts = ApprovalPostureFacts & PostureLegFacts;
|
|
@@ -60,8 +78,8 @@ export interface PostureRow {
|
|
|
60
78
|
readonly family: PostureFamily;
|
|
61
79
|
/** Whether the leg's mode facts call for this row. */
|
|
62
80
|
readonly owedBy: (facts: PostureFacts) => boolean;
|
|
63
|
-
/** The frame that states the posture. */
|
|
64
|
-
readonly frame: string;
|
|
81
|
+
/** The frame that states the posture — a fixed text, or a frame that names the leg's plan file ({@link PostureTemplate}). */
|
|
82
|
+
readonly frame: string | PostureTemplate;
|
|
65
83
|
/** The frame that retires it. */
|
|
66
84
|
readonly exit: string;
|
|
67
85
|
/**
|
|
@@ -72,14 +90,17 @@ export interface PostureRow {
|
|
|
72
90
|
readonly cadence?: {
|
|
73
91
|
readonly everyTurns: number;
|
|
74
92
|
readonly fullEvery: number;
|
|
75
|
-
readonly sparse: string;
|
|
93
|
+
readonly sparse: string | PostureTemplate;
|
|
76
94
|
};
|
|
77
95
|
}
|
|
96
|
+
/** A frame's text for this leg: a fixed text as it stands, a template with the leg's plan file between its halves. */
|
|
97
|
+
export declare function postureText(text: string | PostureTemplate, facts: Pick<PostureFacts, "planFile">): string;
|
|
78
98
|
/**
|
|
79
99
|
* Every posture the engine states, in the order the owed row is chosen. `plan` first: it is the mode the leg
|
|
80
100
|
* was put in, and the bypass frame's shell-first instruction would contradict it. Within it the leg's shape picks the
|
|
81
|
-
* wording — a delegated child (the reference's sub-agent variant), else a leg with the plan-exit tool on its roster
|
|
82
|
-
* (the
|
|
101
|
+
* wording — a delegated child (the reference's sub-agent variant), else a leg with the plan-exit tool on its roster and a
|
|
102
|
+
* session plan file (the body that names both), else a leg with the plan-exit tool (the planning body that names it),
|
|
103
|
+
* else the body that names no tool. Then the reference
|
|
83
104
|
* implementation's own arm order for its one posture attachment: bypass (effective `bypassPermissions`, or — outside
|
|
84
105
|
* `dontAsk`, whose mode refuses every ask before any seat could answer — no person answers an ask), then auto (the
|
|
85
106
|
* classifier is armed — a requested auto mode the engine folded back is not stated, because the run is not operating
|
|
@@ -95,6 +116,9 @@ export interface StandingPosture {
|
|
|
95
116
|
readonly statements: number;
|
|
96
117
|
/** Assistant turns since the family's last frame (the cadence's due clock). */
|
|
97
118
|
readonly turnsSince: number;
|
|
119
|
+
/** The plan file the standing frame named, as rendered (a template frame only): a leg whose plan file reads otherwise
|
|
120
|
+
* is owed the full frame again — the frame's row is the same, what it states is not. */
|
|
121
|
+
readonly file?: string;
|
|
98
122
|
}
|
|
99
123
|
/** The standing families of a context, keyed by family, in the order they first stood. */
|
|
100
124
|
export type PostureStanding = ReadonlyMap<PostureFamily, StandingPosture>;
|