@sema-agent/core 7.59.0 → 7.61.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 +1169 -0
- package/README.md +2 -2
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +4 -3
- package/dist/agents/agent-transcript-tool.js +4 -2
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -1
- package/dist/agents/inherited-tool-pool.d.ts +28 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +16 -3
- package/dist/agents/roster-store.d.ts +2 -2
- package/dist/agents/roster-store.js +8 -3
- package/dist/agents/send-message-tool.d.ts +14 -27
- package/dist/agents/send-message-tool.js +47 -54
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +52 -28
- package/dist/agents/subagent.js +276 -246
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +61 -23
- package/dist/core/allow-entry.js +134 -39
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +66 -17
- package/dist/core/background-agent-store.d.ts +17 -6
- package/dist/core/background-agent-store.js +15 -13
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +86 -32
- package/dist/core/checkpoint-store.js +10 -5
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/context-settings.js +3 -5
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +5 -6
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +106 -32
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +15 -0
- package/dist/core/frame-settlement.js +10 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +9 -6
- package/dist/core/gate-lanes.js +46 -12
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +19 -3
- package/dist/core/governance-codes.js +27 -3
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +51 -60
- package/dist/core/hooks.js +131 -78
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +145 -52
- package/dist/core/image-admission.js +202 -47
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +55 -3
- package/dist/core/locked-config.js +84 -51
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +83 -16
- package/dist/core/mcp-failure.js +67 -30
- package/dist/core/mcp-host-seat.d.ts +131 -0
- package/dist/core/mcp-host-seat.js +305 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +9 -4
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +39 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +23 -55
- package/dist/core/mcp.js +172 -156
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +68 -13
- package/dist/core/memory-engine/sync-client.js +147 -18
- package/dist/core/memory-engine/sync-report.d.ts +106 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +13 -3
- package/dist/core/mode-policy.d.ts +15 -7
- package/dist/core/mode-policy.js +18 -6
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +100 -0
- package/dist/core/mods/agent-stations.js +154 -0
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +9 -4
- package/dist/core/mods/kernel/dispatch.js +8 -8
- package/dist/core/mods/kernel/events.d.ts +13 -4
- package/dist/core/mods/kernel/events.js +14 -10
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +89 -75
- package/dist/core/mods/stations.js +57 -53
- package/dist/core/mods/tool-call.d.ts +12 -4
- package/dist/core/mods/tool-call.js +32 -16
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +62 -0
- package/dist/core/own-property-receipt.js +43 -0
- package/dist/core/park-selfcheck.js +12 -10
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +66 -11
- package/dist/core/peer-seat.js +199 -42
- package/dist/core/permission-rule-consent.d.ts +21 -26
- package/dist/core/permission-rule-consent.js +22 -3
- package/dist/core/permission-rule-model.d.ts +38 -13
- package/dist/core/permission-rule-model.js +54 -16
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +218 -122
- package/dist/core/remote-env.js +133 -14
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +8 -3
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -8
- package/dist/core/runner/assemble-result.js +12 -8
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +7 -2
- package/dist/core/runner/contracts.d.ts +158 -65
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +4 -4
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +29 -10
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
- package/dist/core/runner/prepare-boundary-parks.js +4 -4
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +30 -26
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
- package/dist/core/runner/prepare-delegation-surface.js +7 -8
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
- package/dist/core/runner/prepare-gate-stations.js +10 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
- package/dist/core/runner/prepare-hands-readface.js +19 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +12 -5
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +8 -7
- package/dist/core/runner/prepare-park-ask.js +6 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
- package/dist/core/runner/prepare-policy-chain.js +131 -128
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
- package/dist/core/runner/prepare-prompt-inputs.js +4 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
- package/dist/core/runner/prepare-suspend-saga.js +21 -13
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +84 -42
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +12 -8
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +6 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +3 -2
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +5 -3
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +15 -6
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +65 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +36 -12
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +14 -8
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +37 -19
- package/dist/core/runner/runtask.d.ts +25 -7
- package/dist/core/runner/runtask.js +46 -22
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -4
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +6 -7
- package/dist/core/runner/turn-attachments.js +4 -17
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +55 -43
- package/dist/core/secret-env.d.ts +14 -13
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +10 -3
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +5 -2
- package/dist/core/session-store.js +53 -16
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/task-event.d.ts +35 -10
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +172 -12
- package/dist/core/task-notification.js +209 -12
- package/dist/core/task-registry-agent.d.ts +23 -55
- package/dist/core/task-registry-agent.js +41 -56
- package/dist/core/task-registry-monitor.d.ts +8 -1
- package/dist/core/task-registry-monitor.js +43 -61
- package/dist/core/task-registry-shared.d.ts +52 -114
- package/dist/core/task-registry-shared.js +24 -48
- package/dist/core/task-registry-workflow.js +5 -22
- package/dist/core/task-registry.d.ts +64 -90
- package/dist/core/task-registry.js +73 -119
- package/dist/core/task-result.d.ts +27 -19
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +13 -16
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +3 -6
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +6 -4
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +23 -28
- package/dist/core/tool-name-aliases.js +63 -7
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +113 -22
- package/dist/core/tool-policy.js +85 -15
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +111 -5
- package/dist/core/tool-result-store.js +52 -12
- package/dist/core/tool-spec.d.ts +39 -10
- package/dist/core/trace.d.ts +18 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +40 -27
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
- package/dist/engine/execution-env/node-execution-env.js +224 -21
- package/dist/engine/harness/agent-harness.d.ts +66 -19
- package/dist/engine/harness/agent-harness.js +98 -27
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +151 -34
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +18 -13
- package/dist/engine/loop/agent-loop.js +173 -32
- package/dist/engine/loop/types.d.ts +21 -5
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +41 -23
- package/dist/index.js +29 -16
- package/dist/internal/harness-types.d.ts +3 -1
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +20 -20
- package/dist/orchestration/run-workflow-tool.js +63 -56
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +8 -0
- package/dist/orchestration/workflow.js +33 -9
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +19 -14
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +24 -16
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +4 -1
- package/dist/stores/file/index.d.ts +9 -6
- package/dist/stores/file/index.js +33 -9
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +43 -21
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +4 -1
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +4 -1
- package/dist/stores/file/session-store.d.ts +17 -4
- package/dist/stores/file/session-store.js +22 -19
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +31 -2
- package/dist/stores/file/tool-result-store.js +129 -7
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +4 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -13
- package/dist/stores/file/workflow-journal-store.js +4 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
- package/dist/tools/fs/fs-bash-background-text.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +11 -22
- package/dist/tools/fs/fs-bash.js +58 -154
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +34 -27
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +39 -16
- package/dist/tools/fs/fs-shared.js +25 -6
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +15 -9
- package/dist/tools/fs/index.js +12 -18
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +57 -6
- package/dist/tools/fs/read-floor.js +241 -2
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +6 -5
- package/dist/tools/fs/search.js +10 -10
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +12 -10
- package/dist/tools/monitor.js +22 -13
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +8 -3
- package/test/export-surface.snapshot.json +166 -30
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
package/dist/core/remote-env.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { receive } from "./mods/kernel/receive.js";
|
|
1
3
|
const WORKSPACE_HANDLE_MEMBER_TABLE = { sandboxId: 1, provider: 1, mountPath: 1, snapshotId: 1, sessionToken: 1, restoreMode: 1, deviceId: 1 };
|
|
2
4
|
export const WORKSPACE_HANDLE_MEMBERS = Object.keys(WORKSPACE_HANDLE_MEMBER_TABLE);
|
|
3
5
|
const FROZEN_COPY_OF = new WeakMap();
|
|
@@ -16,6 +18,26 @@ export function frozenHandleCopy(handle) {
|
|
|
16
18
|
FROZEN_COPY_OF.set(handle, frozen);
|
|
17
19
|
return frozen;
|
|
18
20
|
}
|
|
21
|
+
export function placementTargetOf(handle) {
|
|
22
|
+
const provider = handle.provider;
|
|
23
|
+
const deviceId = handle.deviceId;
|
|
24
|
+
if (typeof provider !== "string" || provider === "")
|
|
25
|
+
return undefined;
|
|
26
|
+
return Object.freeze(typeof deviceId === "string" ? { provider, deviceId } : { provider });
|
|
27
|
+
}
|
|
28
|
+
export function reportedPlacementTarget(env) {
|
|
29
|
+
if (env === undefined || env === null || !isRemoteExecutionEnv(env))
|
|
30
|
+
return undefined;
|
|
31
|
+
try {
|
|
32
|
+
return placementTargetOf(env.workspaceHandle());
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function placementHonored(fence, report) {
|
|
39
|
+
return fence?.deviceId === undefined || report?.deviceId === fence.deviceId;
|
|
40
|
+
}
|
|
19
41
|
export const RETRYABLE_REMOTE_ERROR_CODES = [
|
|
20
42
|
"auth_transient",
|
|
21
43
|
"connect_failed",
|
|
@@ -43,8 +65,7 @@ export function isRemoteExecutionEnv(env) {
|
|
|
43
65
|
typeof e.execStream === "function" &&
|
|
44
66
|
typeof e.suspendVM === "function" &&
|
|
45
67
|
typeof e.destroy === "function" &&
|
|
46
|
-
|
|
47
|
-
e.capabilities !== null);
|
|
68
|
+
capabilityReceiptOf(env).blockIsObject);
|
|
48
69
|
}
|
|
49
70
|
export function missingRestoreSurface(env) {
|
|
50
71
|
const e = env;
|
|
@@ -55,26 +76,124 @@ export function missingRestoreSurface(env) {
|
|
|
55
76
|
missing.push("postResumeInit");
|
|
56
77
|
return missing;
|
|
57
78
|
}
|
|
79
|
+
export const UNDECLARED_CAPABILITY_READING = {
|
|
80
|
+
isolation: {
|
|
81
|
+
reads: false,
|
|
82
|
+
so: "no reader treats the environment as a sandbox: autonomy, the policy tiers and the read boundary's containment legs stay on their checking side",
|
|
83
|
+
},
|
|
84
|
+
suspendable: {
|
|
85
|
+
reads: "undeclared",
|
|
86
|
+
so: "the snapshot reader takes only a declared `true` and the park-only lane only a declared `false`, so the environment is neither snapshot nor parked, and a run on it cannot suspend durably",
|
|
87
|
+
},
|
|
88
|
+
sharesProcessTable: {
|
|
89
|
+
reads: "undeclared",
|
|
90
|
+
so: "whether the commands it runs are processes on this engine's own process table has no default, so the Bash tool refuses every pattern kill that needs the question (`pkill`, `killall`, a `kill` fed by `pgrep`; `pkill -P $$`, the shell's own children, runs) on this environment — declare `true` when its commands run on a table that holds the engine (a host lane, or a PID namespace that contains the engine's), `false` only when they run where the engine is not (another machine, a PID namespace that does not contain it)",
|
|
91
|
+
},
|
|
92
|
+
canonicalPathAuthoritative: {
|
|
93
|
+
reads: true,
|
|
94
|
+
so: "its resolver's silence is read as a failure, so a command chain it cannot answer at all is refused at the read boundary's execute-time recheck instead of passing on its written spelling",
|
|
95
|
+
},
|
|
96
|
+
hostLocalPaths: {
|
|
97
|
+
reads: "undeclared",
|
|
98
|
+
so: "the engine does not treat a path this environment names as the host's own file, and a worktree child on it is refused (its tree can be neither compared nor exempted)",
|
|
99
|
+
},
|
|
100
|
+
externalContentTarget: {
|
|
101
|
+
reads: "undeclared",
|
|
102
|
+
so: "what it produces is treated as content from outside the deployment's trust boundary (the memory session mark), and a call that reaches it owes what reaching the target and what leaving it both owe (the cross-boundary taint)",
|
|
103
|
+
},
|
|
104
|
+
io: {
|
|
105
|
+
reads: "undeclared",
|
|
106
|
+
so: "no shell face mounts on it, and what it names is still read through it (the project marker), never past its own read limits",
|
|
107
|
+
},
|
|
108
|
+
keepsReadFloor: {
|
|
109
|
+
reads: false,
|
|
110
|
+
so: "it is read as not keeping the byte floor, so a run whose read-deny table is non-empty is announced as such (`config.read_deny_floor_unkept`), or refused at prepare when the deployment sets `readDenyFloorRequired`",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export const CAPABILITY_KEYS = Object.keys(UNDECLARED_CAPABILITY_READING);
|
|
114
|
+
const CAPABILITY_RECEIPT_MODE = Object.freeze({ accessors: "call-once", depth: 2, others: "copy", contain: true, freeze: true, isProxy: (v) => types.isProxy(v) });
|
|
115
|
+
const CAPABILITY_KEY_SET = new Set(CAPABILITY_KEYS);
|
|
116
|
+
const RECEIVED_CAPABILITIES = new WeakMap();
|
|
117
|
+
const typeWord = (v) => (v === null ? "null" : typeof v);
|
|
118
|
+
const blockRefused = (valueType, blockIsObject) => Object.freeze({ declared: Object.freeze({}), blockIsObject, findings: Object.freeze([Object.freeze({ key: "capabilities", valueType, expected: "object" })]) });
|
|
119
|
+
function receiveCapabilities(env) {
|
|
120
|
+
let block;
|
|
121
|
+
try {
|
|
122
|
+
block = Reflect.get(env, "capabilities");
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return blockRefused("unreadable", false);
|
|
126
|
+
}
|
|
127
|
+
if (block === undefined) {
|
|
128
|
+
return Object.freeze({ declared: Object.freeze({}), blockIsObject: false, findings: Object.freeze(CAPABILITY_KEYS.map((key) => Object.freeze({ key, valueType: "undefined", expected: "boolean" }))) });
|
|
129
|
+
}
|
|
130
|
+
if (typeof block !== "object" || block === null)
|
|
131
|
+
return blockRefused(typeWord(block), false);
|
|
132
|
+
const received = receive(block, CAPABILITY_RECEIPT_MODE);
|
|
133
|
+
if (!received.ok)
|
|
134
|
+
return blockRefused("unreadable", true);
|
|
135
|
+
const members = received.value;
|
|
136
|
+
const unreadable = new Set((received.faults ?? []).map((f) => f.path[0]).filter((k) => k !== undefined));
|
|
137
|
+
const declared = {};
|
|
138
|
+
const findings = [];
|
|
139
|
+
for (const key of CAPABILITY_KEYS) {
|
|
140
|
+
const value = members[key];
|
|
141
|
+
if (typeof value === "boolean")
|
|
142
|
+
declared[key] = value;
|
|
143
|
+
else
|
|
144
|
+
findings.push(Object.freeze({ key, valueType: unreadable.has(key) ? "unreadable" : typeWord(value), expected: "boolean" }));
|
|
145
|
+
}
|
|
146
|
+
for (const key of [...Object.keys(members), ...unreadable]) {
|
|
147
|
+
if (!CAPABILITY_KEY_SET.has(key) && !findings.some((f) => f.key === key))
|
|
148
|
+
findings.push(Object.freeze({ key, valueType: unreadable.has(key) ? "unreadable" : typeWord(members[key]), expected: "absent" }));
|
|
149
|
+
}
|
|
150
|
+
return Object.freeze({ declared: Object.freeze(declared), blockIsObject: true, findings: Object.freeze(findings) });
|
|
151
|
+
}
|
|
152
|
+
export function capabilityReceiptOf(env) {
|
|
153
|
+
const holder = env;
|
|
154
|
+
if ((typeof holder !== "object" && typeof holder !== "function") || holder === null)
|
|
155
|
+
return blockRefused(typeWord(holder), false);
|
|
156
|
+
const prior = RECEIVED_CAPABILITIES.get(holder);
|
|
157
|
+
if (prior !== undefined)
|
|
158
|
+
return prior;
|
|
159
|
+
const receipt = receiveCapabilities(holder);
|
|
160
|
+
RECEIVED_CAPABILITIES.set(holder, receipt);
|
|
161
|
+
return receipt;
|
|
162
|
+
}
|
|
163
|
+
function declaredCapability(env, key) {
|
|
164
|
+
return capabilityReceiptOf(env).declared[key];
|
|
165
|
+
}
|
|
166
|
+
export function declaredSuspend(env) {
|
|
167
|
+
return declaredCapability(env, "suspendable") ?? UNDECLARED_CAPABILITY_READING.suspendable.reads;
|
|
168
|
+
}
|
|
58
169
|
export function isSuspendable(env) {
|
|
59
|
-
return
|
|
170
|
+
return declaredSuspend(env) === true && isRemoteExecutionEnv(env) && missingRestoreSurface(env).length === 0;
|
|
60
171
|
}
|
|
61
172
|
export function isIsolated(env) {
|
|
62
|
-
return
|
|
173
|
+
return declaredCapability(env, "isolation") ?? UNDECLARED_CAPABILITY_READING.isolation.reads;
|
|
63
174
|
}
|
|
64
175
|
export function boundaryIsTheSandbox(env) {
|
|
65
176
|
return isIsolated(env);
|
|
66
177
|
}
|
|
67
178
|
export function canonicalPathIsAuthoritative(env) {
|
|
68
|
-
return
|
|
179
|
+
return declaredCapability(env, "canonicalPathAuthoritative") ?? UNDECLARED_CAPABILITY_READING.canonicalPathAuthoritative.reads;
|
|
69
180
|
}
|
|
70
181
|
export function processTableOf(env) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
182
|
+
const declared = declaredCapability(env, "sharesProcessTable");
|
|
183
|
+
return declared === true ? "this" : declared === false ? "other" : UNDECLARED_CAPABILITY_READING.sharesProcessTable.reads;
|
|
184
|
+
}
|
|
185
|
+
export function declaredHostLocalPaths(env) {
|
|
186
|
+
return declaredCapability(env, "hostLocalPaths") ?? UNDECLARED_CAPABILITY_READING.hostLocalPaths.reads;
|
|
187
|
+
}
|
|
188
|
+
export function pathsAreHostLocal(env) {
|
|
189
|
+
return declaredHostLocalPaths(env) === true;
|
|
190
|
+
}
|
|
191
|
+
export function targetIsExternal(env) {
|
|
192
|
+
return declaredCapability(env, "externalContentTarget") ?? UNDECLARED_CAPABILITY_READING.externalContentTarget.reads;
|
|
193
|
+
}
|
|
194
|
+
export function performsIo(env) {
|
|
195
|
+
return declaredCapability(env, "io") ?? UNDECLARED_CAPABILITY_READING.io.reads;
|
|
196
|
+
}
|
|
197
|
+
export function keepsReadFloor(env) {
|
|
198
|
+
return declaredCapability(env, "keepsReadFloor") ?? UNDECLARED_CAPABILITY_READING.keepsReadFloor.reads;
|
|
80
199
|
}
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* knob-hygiene #98 — one validator for every RETENTION policy a bundled store accepts.
|
|
3
|
-
*
|
|
4
|
-
* These knobs share a property nothing else in the engine does: they are the only numbers whose job is
|
|
5
|
-
* to DELETE, so an unevaluable one is not merely ignored, it decides. The shapes actually reachable:
|
|
6
|
-
*
|
|
7
|
-
* - `keep` is consumed as `rows.slice(Math.max(0, keep))` / `i >= keep`. `Math.max(0, NaN)` is `NaN`
|
|
8
|
-
* and `slice(NaN)` means `slice(0)` — so a policy whose `keep` arrived as NaN (the ordinary
|
|
9
|
-
* `Number(cfg.keep)` on a missing or misspelled field) deleted EVERY terminal row instead of
|
|
10
|
-
* keeping N of them. A negative `keep` reaches the same place by a different route.
|
|
11
|
-
* - `maxAgeMs` on the roster feeds `now - createdAt <= maxAgeMs`, which is false for NaN — so every
|
|
12
|
-
* row reads as expired, the next write persists the survivors, and the whole roster is gone. A
|
|
13
|
-
* roster row is a durable ADDRESS; losing one turns a live agent unreachable.
|
|
14
|
-
* - the remaining `*MaxAgeMs` arms fail the other way (NaN comparisons are false ⇒ nothing is
|
|
15
|
-
* reaped), which is safe but equally silent: retention that quietly stopped running is how a disk
|
|
16
|
-
* fills up. They are validated for the same reason — an operator deserves the same answer either way.
|
|
17
|
-
*
|
|
18
|
-
* Fail-loud rather than fall back to a default: a retention policy is the deployment saying what it
|
|
19
|
-
* wants kept, and quietly substituting a different policy is exactly the class of silence this sweep
|
|
20
|
-
* exists to remove. Every store passes its options through here BEFORE touching a row, so no
|
|
21
|
-
* implementation can drift from another (the RB-74 / RB-87 / RB-111 history in the store family is
|
|
22
|
-
* three consecutive "fixed one of the two implementations" misses).
|
|
23
|
-
*/
|
|
24
1
|
export interface RetentionPolicyKnobs {
|
|
25
2
|
/** Age bound in ms. */
|
|
26
3
|
maxAgeMs?: number;
|
|
@@ -40,6 +17,30 @@ export interface RetentionPolicyKnobs {
|
|
|
40
17
|
* {@link assertRetentionPolicy}'s "0 or more" wording without telling an operator something false.
|
|
41
18
|
*/
|
|
42
19
|
export declare function refuseRetentionPolicy(label: string, knob: string, value: unknown, requirement: string): never;
|
|
20
|
+
/**
|
|
21
|
+
* The cutoff an age sweep removes entries before — `now - maxAgeMs` — or `undefined` when no age bound was stated
|
|
22
|
+
* (nothing is aged out). A bound that cannot be evaluated is refused, as {@link assertRetentionPolicy} refuses it, and
|
|
23
|
+
* so is a `now` that is not a finite number: either would decide what to delete instead of bounding it. The bound is
|
|
24
|
+
* read once, and the value judged is the value the cutoff is computed from.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ageCutoff(label: string, now: number, opts: {
|
|
27
|
+
maxAgeMs?: number;
|
|
28
|
+
} | undefined): number | undefined;
|
|
29
|
+
/** The family's coded refusal of a retention bag's stray key ({@link receiveMembers}'s one sentence, under the family's code):
|
|
30
|
+
* a misspelled bound (`maxAge` for `maxAgeMs`) reads as "no bound" — nothing is deleted and nothing is said, the silence a
|
|
31
|
+
* retention seam exists to remove. */
|
|
32
|
+
export declare function retentionKnobRefusal(message: string): Error;
|
|
33
|
+
/**
|
|
34
|
+
* The one reading a seam takes of a caller's retention bag: the bag is received by the receipt law with the seam's
|
|
35
|
+
* knobs as the members it takes ({@link receiveMembers}: a plain object, each member read once off its own descriptor,
|
|
36
|
+
* a member it does not take refused by name in the family's code), each knob on the copy is judged by
|
|
37
|
+
* {@link assertRetentionPolicy}, and the frozen copy is handed back — the value a seam judges is the value it then
|
|
38
|
+
* deletes by, and nothing is read from the caller's bag again. A Proxy, an object of another prototype (a bound it
|
|
39
|
+
* would inherit is never read) and a getter that throws are the receipt's refusals (`config.invalid_argument`).
|
|
40
|
+
* Absent bag ⇒ an empty policy (nothing is applied). `beside` names members of the same bag that are not knobs and that
|
|
41
|
+
* the seam reads itself (the joint reap's `now`): taken by the same receipt, handed back on the copy, never judged here.
|
|
42
|
+
*/
|
|
43
|
+
export declare function receiveRetentionPolicy<P extends RetentionPolicyKnobs>(label: string, opts: P | undefined, accepts: readonly (keyof RetentionPolicyKnobs)[], beside?: readonly Exclude<keyof P, keyof RetentionPolicyKnobs | number | symbol>[]): Readonly<Partial<P>>;
|
|
43
44
|
/**
|
|
44
45
|
* Refuse a malformed retention policy at the door. `undefined` on any field keeps its documented
|
|
45
46
|
* meaning — that arm is simply not applied — so a deployment that sets nothing is untouched.
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { receiveMembers } from "./own-property-receipt.js";
|
|
2
|
+
const AGE_KNOBS = ["maxAgeMs", "staleRunningMaxAgeMs"];
|
|
3
|
+
const COUNT_KNOBS = ["keep", "maxEntries"];
|
|
1
4
|
export function refuseRetentionPolicy(label, knob, value, requirement) {
|
|
2
5
|
const e = new Error(`${label}: ${knob} must be ${requirement} (got ${typeof value === "string" ? JSON.stringify(value) : String(value)}) — a retention bound that cannot be evaluated silently decides what to delete instead of bounding it`);
|
|
3
6
|
e.code = "config.retention_policy_invalid";
|
|
@@ -6,16 +9,47 @@ export function refuseRetentionPolicy(label, knob, value, requirement) {
|
|
|
6
9
|
function invalidPolicy(label, knob, value, requirement) {
|
|
7
10
|
refuseRetentionPolicy(label, knob, value, requirement);
|
|
8
11
|
}
|
|
12
|
+
export function ageCutoff(label, now, opts) {
|
|
13
|
+
const { maxAgeMs } = receiveRetentionPolicy(label, opts, ["maxAgeMs"]);
|
|
14
|
+
if (typeof now !== "number" || !Number.isFinite(now))
|
|
15
|
+
refuseRetentionPolicy(label, "now", now, "a finite number of milliseconds");
|
|
16
|
+
return maxAgeMs === undefined ? undefined : now - maxAgeMs;
|
|
17
|
+
}
|
|
18
|
+
export function retentionKnobRefusal(message) {
|
|
19
|
+
const e = new Error(message);
|
|
20
|
+
e.code = "config.retention_policy_invalid";
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
export function receiveRetentionPolicy(label, opts, accepts, beside = []) {
|
|
24
|
+
if (opts === undefined)
|
|
25
|
+
return Object.freeze({});
|
|
26
|
+
if (typeof opts !== "object" || opts === null)
|
|
27
|
+
refuseRetentionPolicy(label, "opts", opts, "an object of retention knobs or absent");
|
|
28
|
+
const got = receiveMembers(opts, { subject: `${label} policy`, unit: "retention knob", moment: "before anything is judged or deleted" }, [...accepts, ...beside], retentionKnobRefusal);
|
|
29
|
+
const held = {};
|
|
30
|
+
for (const knob of accepts) {
|
|
31
|
+
const v = got[knob];
|
|
32
|
+
if (v !== undefined)
|
|
33
|
+
held[knob] = v;
|
|
34
|
+
}
|
|
35
|
+
assertRetentionPolicy(label, held);
|
|
36
|
+
for (const name of beside) {
|
|
37
|
+
const v = got[name];
|
|
38
|
+
if (v !== undefined)
|
|
39
|
+
held[name] = v;
|
|
40
|
+
}
|
|
41
|
+
return Object.freeze(held);
|
|
42
|
+
}
|
|
9
43
|
export function assertRetentionPolicy(label, opts) {
|
|
10
44
|
if (opts === undefined)
|
|
11
45
|
return;
|
|
12
|
-
for (const knob of
|
|
46
|
+
for (const knob of AGE_KNOBS) {
|
|
13
47
|
const v = opts[knob];
|
|
14
48
|
if (v !== undefined && (!Number.isFinite(v) || v < 0)) {
|
|
15
49
|
invalidPolicy(label, knob, v, "a finite, non-negative number of milliseconds");
|
|
16
50
|
}
|
|
17
51
|
}
|
|
18
|
-
for (const knob of
|
|
52
|
+
for (const knob of COUNT_KNOBS) {
|
|
19
53
|
const v = opts[knob];
|
|
20
54
|
if (v !== undefined && (!Number.isInteger(v) || v < 0)) {
|
|
21
55
|
invalidPolicy(label, knob, v, "a whole number of rows, 0 or more");
|
package/dist/core/retention.d.ts
CHANGED
|
@@ -42,7 +42,10 @@ export interface RetentionPolicy {
|
|
|
42
42
|
* WRITES the row, not to the receipt: an implementation records it in the same transaction as the
|
|
43
43
|
* deletion (recording after the delete would leave an unwitnessed delete on a crash), and it is
|
|
44
44
|
* the only side that knows its own op, sweep round, and policy generation. The receipt below is
|
|
45
|
-
* therefore the CALL's three counts, deliberately not an audit row.
|
|
45
|
+
* therefore the CALL's three counts, deliberately not an audit row. Where the deletion and the
|
|
46
|
+
* sweep's context live on two sides — a SQL backend writes the deletion, the deployment holds the op —
|
|
47
|
+
* the deployment writes the audit row through the backend's `audit` transaction hook, inside the
|
|
48
|
+
* deleting transaction, from the receipt it is handed there.
|
|
46
49
|
*/
|
|
47
50
|
export interface ManagedRetentionCapability {
|
|
48
51
|
/** Enumerate the retention domains (tenant/scope keys) this store holds data for. */
|
package/dist/core/retention.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
2
2
|
import { thrownText } from "./thrown-value.js";
|
|
3
|
+
import { CONFIG_RECEIPT_MODE, DECLARATION_RECEIPT_MODE, receiptRefusal, receiveOwnProperties } from "./own-property-receipt.js";
|
|
4
|
+
import { describeFault, receive } from "./mods/kernel/receive.js";
|
|
3
5
|
export function readRetentionDeclaration(name, value) {
|
|
4
6
|
if (value === undefined || value === "none")
|
|
5
7
|
return "none";
|
|
@@ -20,42 +22,65 @@ const RETENTION_EXECUTOR_MEMBERS = Object.keys({
|
|
|
20
22
|
deleteExpiredSessions: true,
|
|
21
23
|
deleteOrphanToolResults: true,
|
|
22
24
|
});
|
|
25
|
+
function faceMember(face, member, owner, refusal) {
|
|
26
|
+
try {
|
|
27
|
+
return face[member];
|
|
28
|
+
}
|
|
29
|
+
catch (cause) {
|
|
30
|
+
throw codedError("config.retention_capability", `${owner}'s ${member} could not be read (${thrownText(cause)}) — ${refusal}.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
23
33
|
function assertRetentionExecutor(executor) {
|
|
24
34
|
if ((typeof executor !== "object" && typeof executor !== "function") || executor === null) {
|
|
25
35
|
throw codedError("config.retention_capability", `the retention executor must be an object implementing ManagedRetentionCapability, or null when the deployment runs none (got ${describeRejectedValue(executor)}).`);
|
|
26
36
|
}
|
|
27
37
|
for (const member of RETENTION_EXECUTOR_MEMBERS) {
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
value = executor[member];
|
|
31
|
-
}
|
|
32
|
-
catch (cause) {
|
|
33
|
-
throw codedError("config.retention_capability", `the retention executor's ${member} could not be read (${thrownText(cause)}) — it is not a ManagedRetentionCapability.`);
|
|
34
|
-
}
|
|
38
|
+
const value = faceMember(executor, member, "the retention executor", "it is not a ManagedRetentionCapability");
|
|
35
39
|
if (typeof value !== "function") {
|
|
36
40
|
throw codedError("config.retention_capability", `the retention executor's ${member} is ${describeRejectedValue(value)}, not a function — it is not a ManagedRetentionCapability.`);
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
44
|
+
function receiveRetentionInput(input, owner) {
|
|
45
|
+
const top = receiveOwnProperties(input, { subject: `${owner}'s input`, unit: "member", moment: `at ${owner}` });
|
|
46
|
+
let policy = top["policy"];
|
|
47
|
+
if (typeof policy === "object" && policy !== null) {
|
|
48
|
+
const got = receive(policy, DECLARATION_RECEIPT_MODE);
|
|
49
|
+
if (!got.ok)
|
|
50
|
+
throw codedError("config.retention_policy", `retentionPolicy could not be read as plain data — ${describeFault(got.fault)}.`);
|
|
51
|
+
policy = got.value;
|
|
52
|
+
}
|
|
53
|
+
const list = receive(top["stores"], CONFIG_RECEIPT_MODE);
|
|
54
|
+
if (!list.ok)
|
|
55
|
+
throw receiptRefusal(`${owner}'s stores could not be read — ${describeFault(list.fault)}`);
|
|
56
|
+
if (!Array.isArray(list.value))
|
|
57
|
+
throw receiptRefusal(`${owner}'s stores must be a list of { name, store } (got ${describeRejectedValue(list.value)})`);
|
|
58
|
+
const stores = list.value.map((item, i) => {
|
|
59
|
+
const got = receiveOwnProperties(item, { subject: `${owner}'s stores[${i}]`, unit: "member", moment: `at ${owner}` });
|
|
60
|
+
return { name: got.name, store: got.store };
|
|
61
|
+
});
|
|
62
|
+
return { policy: policy, locked: top["locked"], stores, ...(Object.hasOwn(top, "executor") ? { executor: top["executor"] } : {}) };
|
|
63
|
+
}
|
|
40
64
|
function readRetentionWords({ policy, stores }) {
|
|
41
65
|
const declared = policy;
|
|
42
66
|
if (declared !== undefined && (typeof declared !== "object" || declared === null || Array.isArray(declared))) {
|
|
43
67
|
throw codedError("config.retention_policy", `retentionPolicy must be an object carrying maxAgeDays (got ${declared === null ? "null" : Array.isArray(declared) ? "an array" : typeof declared}).`);
|
|
44
68
|
}
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
const maxAgeDays = policy?.maxAgeDays;
|
|
70
|
+
if (policy !== undefined && (typeof maxAgeDays !== "number" || !Number.isFinite(maxAgeDays) || maxAgeDays < 0)) {
|
|
71
|
+
throw codedError("config.retention_policy", `retentionPolicy.maxAgeDays must be a finite non-negative number of days (got ${describeRejectedValue(maxAgeDays)}).`);
|
|
47
72
|
}
|
|
48
73
|
return stores
|
|
49
74
|
.filter((s) => s.store !== undefined && s.store !== null)
|
|
50
|
-
.map(({ name, store }) => ({ name, retention: readRetentionDeclaration(name, store
|
|
75
|
+
.map(({ name, store }) => ({ name, retention: readRetentionDeclaration(name, faceMember(store, "retention", `store "${name}"`, "its retention declaration is unreadable")) }));
|
|
51
76
|
}
|
|
52
77
|
export function assertRetentionWords(input) {
|
|
53
|
-
const { policy, locked, stores } = input;
|
|
78
|
+
const { policy, locked, stores } = receiveRetentionInput(input, "assertRetentionWords");
|
|
54
79
|
const words = { policy, locked, stores };
|
|
55
80
|
refuseLockedOverNone(words, readRetentionWords(words));
|
|
56
81
|
}
|
|
57
82
|
export function assertRetentionCapability(input) {
|
|
58
|
-
const { policy, locked, stores, executor } = input;
|
|
83
|
+
const { policy, locked, stores, executor } = receiveRetentionInput(input, "assertRetentionCapability");
|
|
59
84
|
const words = { policy, locked, stores };
|
|
60
85
|
if (executor === undefined) {
|
|
61
86
|
throw codedError("config.retention_capability", `executor is required — the managed-retention executor the deployment runs over these stores' rows (a backend's \`retention\` member), or null when it runs none (got undefined).`);
|
|
@@ -32,11 +32,16 @@ export declare function retiredKeyRefusal(hit: {
|
|
|
32
32
|
* tables (this one and `runner/retired-runner-deps.ts`). The record's callbacks never run, so a deny one carried would pass
|
|
33
33
|
* unseen — the key is refused by name instead. */
|
|
34
34
|
export declare const RETIRED_HOOKS_REPLACEMENT = "the callback seats are `mods` registrations now \u2014 register the extension on `RunnerDeps.mods` (a deployment's) or `TaskSpec.mods` (a task's), hung on the `classic.*` events (`classic.PreToolUse`, `classic.PostToolUse`, `classic.PostToolBatch`, `classic.UserPromptSubmit`, `classic.Stop`, `classic.SubagentStop`, \u2026); a callback that denied is a handler answering `{ action: \"deny\", message }`";
|
|
35
|
-
/** The RETIRED `TaskSpec` keys, each with the sentence that names its replacement — the table the spec
|
|
36
|
-
* ({@link
|
|
35
|
+
/** The RETIRED `TaskSpec` keys, each with the sentence that names its replacement — the table the spec's one read judges
|
|
36
|
+
* (`readCallerSpec`, over the values it took: {@link retiredKeyOf}, owner `TaskSpec`). A caller still writing one of these is refused by name
|
|
37
37
|
* (`config.spec_retired_key`), never read as absence: a mode a caller believes it declared must not silently run
|
|
38
|
-
* as another.
|
|
38
|
+
* as another. Each retired row has ONE reader: a row inside a seat that is read once by its own reader lives in that
|
|
39
|
+
* seat's table ({@link RETIRED_SKILLS_SEAT_KEYS}), so the spec's read never reads into the seat a second time. */
|
|
39
40
|
export declare const RETIRED_TASK_SPEC_KEYS: Readonly<Record<string, string>>;
|
|
41
|
+
/** The RETIRED `TaskSpec.skills` rows — the table the skills seat's one reader (`readSkillsSeat`) judges over its one read of
|
|
42
|
+
* the seat, owner `TaskSpec` (same code, same `TaskSpec.skills[].…` sentence). Kept out of {@link RETIRED_TASK_SPEC_KEYS}:
|
|
43
|
+
* the spec's read judging these rows would read into the caller's `skills` entries before the seat's reader does. */
|
|
44
|
+
export declare const RETIRED_SKILLS_SEAT_KEYS: Readonly<Record<string, string>>;
|
|
40
45
|
/** The RETIRED `ToolSpec` members — a spec still carrying one is refused by name (`config.deps_retired_key`) where the
|
|
41
46
|
* factory reads the spec, never dropped unseen: a description the author wrote for one prompt shape would silently
|
|
42
47
|
* never be shown. */
|
|
@@ -32,9 +32,12 @@ export const RETIRED_TASK_SPEC_KEYS = Object.freeze({
|
|
|
32
32
|
autoModeRequested: 'the permission mode is one key now — write `permissionMode: "auto"`',
|
|
33
33
|
approverPosture: 'a posture never authorized anything; drop the key (the engine renders the posture from the effective mode). Releasing asks is a separate decision: `permissionMode: "bypassPermissions"`',
|
|
34
34
|
"attachments.planModeReminder": "the read-only planning posture is stated whenever the leg's mode is `plan` (first turn, every 5 turns, and an exit frame when it ends) — drop the key",
|
|
35
|
-
"skills[].manifest": "a skill's tools are its `allowedTools` / `disallowedTools` now — an allow-rule and a deny-rule source for the run the skill is activated in, never a fence; move `manifest.allowTools` to `allowedTools`. To fence tools write deny rules (or a delegated agent definition's `allowTools`); to fence write paths use session `allowDirs`",
|
|
36
35
|
promptProvider: "a task changes prompt text through overlays: its role text is `systemPrompt` (it replaces the role base `promptRole` selects), its added block `appendSystemPrompt`, the minimal form `promptForm: \"minimal\"`; anything else is a `prompt.compose` registration on the task's own `mods` answering `{ overlays }` (an already-assembled prompt is refused, never passed through)",
|
|
37
36
|
promptProfile: 'the prompt\'s shape is the `lean_prompt` trait now — write `promptLean: false` for the long (classic) shape, `promptLean: true` (or nothing, on a model that declares `lean_prompt`) for the lean one',
|
|
37
|
+
rewindFiles: "capture needs no request (first-touch tracking is on whenever `RunnerDeps.fileHistoryStore` is wired and neither `RunnerDeps.fileHistoryCapture` nor `TaskSpec.fileHistory` turns it off); to restore files with the conversation write `resumeAt` + `restoreFiles: true`, for a code-only restore `rewindFilesTo` — drop the key",
|
|
38
|
+
});
|
|
39
|
+
export const RETIRED_SKILLS_SEAT_KEYS = Object.freeze({
|
|
40
|
+
"skills[].manifest": "a skill's tools are its `allowedTools` / `disallowedTools` now — an allow-rule and a deny-rule source for the run the skill is activated in, never a fence; move `manifest.allowTools` to `allowedTools`. To fence tools write deny rules (or a delegated agent definition's `allowTools`); to fence write paths use session `allowDirs`",
|
|
38
41
|
});
|
|
39
42
|
export const RETIRED_TOOL_SPEC_KEYS = Object.freeze({
|
|
40
43
|
descriptionClassic: 'a description\'s other forms are `descriptionVariants` now — the long form is `{ id: "classic", traits: { noneOf: ["lean_prompt"] }, text }`, chosen at mount by the run\'s prompt traits',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PreToolUseResult } from "./hooks.js";
|
|
2
2
|
import type { PermissionResult } from "./tool-policy.js";
|
|
3
|
-
import type { PreToolUseScreening } from "./runner/gate-exit.js";
|
|
3
|
+
import type { InheritedScreenRead, PreToolUseScreen, PreToolUseScreening } from "./runner/gate-exit.js";
|
|
4
4
|
import type { RewriteAuthor, ToolInputRewrite } from "./task-event.js";
|
|
5
5
|
/** One gate pass's account of its rewrites: the bytes it took at its entry, and one author per adoption that changed the bytes
|
|
6
6
|
* in hand (written only through {@link noteRewrite}). */
|
|
@@ -57,19 +57,26 @@ export declare function readRejudge(req: {
|
|
|
57
57
|
readonly updatedInput?: unknown;
|
|
58
58
|
} | undefined): RejudgeReading;
|
|
59
59
|
/** What the PreToolUse screening said on its one second look at bytes rewritten after it judged: its verdict on them
|
|
60
|
-
* (`stands` — no opinion, an allow, an ask; never a rewrite
|
|
61
|
-
* (the screening failed, or it handed back yet another form)
|
|
60
|
+
* (`stands` — no opinion, an allow, an ask; never a rewrite — with the context lines and what the inherited installations
|
|
61
|
+
* said), or a refusal — the hook's own deny, the engine's (the screening failed, or it handed back yet another form), or an
|
|
62
|
+
* inherited installation's question refused where it was settled (`settled`). */
|
|
62
63
|
export type ScreeningRejudge = {
|
|
63
64
|
readonly kind: "stands";
|
|
64
65
|
readonly answer: PreToolUseResult | undefined;
|
|
65
66
|
readonly answeredBy?: string;
|
|
67
|
+
readonly contexts: readonly string[];
|
|
68
|
+
readonly inherited?: InheritedScreenRead;
|
|
66
69
|
} | {
|
|
67
70
|
readonly kind: "refused";
|
|
68
71
|
readonly reason: string;
|
|
69
72
|
readonly by: "hook" | "engine";
|
|
70
73
|
readonly extension?: string;
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
readonly judged?: unknown;
|
|
75
|
+
} | Extract<PreToolUseScreen, {
|
|
76
|
+
kind: "settled";
|
|
77
|
+
}>;
|
|
78
|
+
/** The screening's second look at rewritten `bytes` (the gate's fold after a policy rewrite; the approved-edit pass). A refusal
|
|
79
|
+
* names the bytes its judge judged (`judged`) when the screen moved them past `bytes`. */
|
|
73
80
|
export declare function screenRewrite(screening: PreToolUseScreening, req: {
|
|
74
81
|
readonly face?: object | undefined;
|
|
75
82
|
readonly toolName: string;
|
|
@@ -48,18 +48,22 @@ export function readRejudge(req, given, answer) {
|
|
|
48
48
|
return rewrite === undefined || sameBytes(req, given, rewrite) ? { kind: "as_is" } : { kind: "rewritten", form: argsAsTheToolReads(req, rewrite) };
|
|
49
49
|
}
|
|
50
50
|
export async function screenRewrite(screening, req, bytes, subject) {
|
|
51
|
-
const screened = await screening.screen(bytes, subject);
|
|
51
|
+
const screened = await screening.screen(bytes, subject, req);
|
|
52
|
+
const judged = screened.judged !== undefined ? { judged: screened.judged } : {};
|
|
52
53
|
if (screened.kind === "refused")
|
|
53
|
-
return { kind: "refused", reason: screened.reason, by: "engine", ...(screened.extension !== undefined ? { extension: screened.extension } : {}) };
|
|
54
|
+
return { kind: "refused", reason: screened.reason, by: "engine", ...(screened.extension !== undefined ? { extension: screened.extension } : {}), ...judged };
|
|
55
|
+
if (screened.kind === "settled")
|
|
56
|
+
return screened;
|
|
54
57
|
const r = screened.answer;
|
|
55
58
|
if (r?.action === "deny")
|
|
56
|
-
return { kind: "refused", reason: screening.deniedReason(r), by: "hook", ...(screened.answeredBy !== undefined ? { extension: screened.answeredBy } : {}) };
|
|
59
|
+
return { kind: "refused", reason: screening.deniedReason(r), by: "hook", ...(screened.answeredBy !== undefined ? { extension: screened.answeredBy } : {}), ...judged };
|
|
57
60
|
if (readRejudge(req, bytes, r).kind === "rewritten")
|
|
58
61
|
return { kind: "refused", reason: rewriteChasedSentence(req.toolName), by: "engine" };
|
|
62
|
+
const said = { contexts: screened.contexts, ...(screened.answeredBy !== undefined ? { answeredBy: screened.answeredBy } : {}), ...(screened.inherited !== undefined ? { inherited: screened.inherited } : {}) };
|
|
59
63
|
if (r === undefined)
|
|
60
|
-
return { kind: "stands", answer: undefined, ...
|
|
64
|
+
return { kind: "stands", answer: undefined, ...said };
|
|
61
65
|
const { updatedInput: _sameBytes, ...answer } = r;
|
|
62
|
-
return { kind: "stands", answer, ...
|
|
66
|
+
return { kind: "stands", answer, ...said };
|
|
63
67
|
}
|
|
64
68
|
export function outletAsk(standing, toolName, form) {
|
|
65
69
|
const editRewritten = { acceptableForm: form };
|
package/dist/core/roles.d.ts
CHANGED
|
@@ -5,8 +5,21 @@ import { type RoleBaseDeclaration } from "../prompt-assembly/role-base.js";
|
|
|
5
5
|
import { type ModelRef, type ModelRole, type ModelRoles, type RoleSpec } from "./types.js";
|
|
6
6
|
export type { ModelRole, RoleSpec, ModelRoles } from "./types.js";
|
|
7
7
|
export { MODEL_ROLES } from "./types.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export { bindingShown } from "./model-receipt.js";
|
|
9
|
+
/**
|
|
10
|
+
* The catalog's answer for a model word — every read of a catalog's entry: the entry's snapshot from the model door (an entry of a
|
|
11
|
+
* catalog the catalog door received is one already, handed back as itself; an entry of a catalog a caller built is received here, at
|
|
12
|
+
* the read). `seat` names where the word was written; the entry is named as the catalog entry that word resolved to.
|
|
13
|
+
*/
|
|
14
|
+
export declare function catalogModel(ref: string, models: Record<string, Model> | undefined, seat: string, what?: string): Model | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The role receipt — a role map read ONCE per operation (one public entry of this module: a task's resolution, a role's model if set, the
|
|
17
|
+
* preset's role base, the classifier seat, the deployment's subagent tier): the map a plain record whose every member is read once and
|
|
18
|
+
* received ({@link receiveRoleSpec}), the copy frozen. The map stays the caller's between operations (a deployment may change it in place);
|
|
19
|
+
* within one, every reader reads this copy, and an entry that calls back in hands the copy, which is received as itself. `field` names the
|
|
20
|
+
* map (`RunnerDeps.roles` / `TaskSpec.roles`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function receiveRoleMap(roles: ModelRoles | undefined, field: string): ModelRoles | undefined;
|
|
10
23
|
/**
|
|
11
24
|
* Resolve a ModelRef against the catalog (a Model object passes through). A word the catalog does not hold, and a value that is no model
|
|
12
25
|
* reference, are refused by `config.unknown_role` with `detail { field: seat, reason }` — `seat` names where the caller wrote the word
|
|
@@ -45,6 +58,27 @@ export declare function resolveModelDisplayLabel(ref: string): string;
|
|
|
45
58
|
* `resolveModel("best")` refuses like any unknown ref.
|
|
46
59
|
*/
|
|
47
60
|
export declare function expandTiers(models: Record<string, Model> | undefined, tiers: Record<string, ModelRef> | undefined): Record<string, Model> | undefined;
|
|
61
|
+
/** Whether `models` is a catalog the catalog door made ({@link receiveModelCatalog}). */
|
|
62
|
+
export declare function isReceivedCatalog(models: Record<string, Model> | undefined): boolean;
|
|
63
|
+
/** The catalog a deps bag answers with — the catalog door's generation: a Runner's own (received at its construction) as it is, a bag a
|
|
64
|
+
* caller built received here. The one reading of "the catalog these deps name", wherever deps are read outside a Runner's own seat. */
|
|
65
|
+
export declare function catalogOfDeps(deps: {
|
|
66
|
+
models?: Record<string, Model>;
|
|
67
|
+
tiers?: Record<string, ModelRef>;
|
|
68
|
+
}): Record<string, Model> | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The CATALOG DOOR — a catalog generation (a model catalog and the tier bindings over it) received whole, where a Runner takes one: at
|
|
71
|
+
* `new Runner` and at `swapDeps`. The catalog is a plain record read once; every entry with a model behind it is received by the model door
|
|
72
|
+
* now (a catalog entry no task names yet is judged as well as one a task names: a catalog is configuration, and a bad entry is a boot error,
|
|
73
|
+
* not a first-use one); the bindings are a plain record read once, every binding a word or a Model object (received), a binding a catalog
|
|
74
|
+
* key shadows included; THEN the bindings are expanded over the received catalog ({@link expandTiers} — its marks are written on its own
|
|
75
|
+
* output, so they are never lost to a copy) and the result frozen. `field` names the door (`RunnerDeps` / `swapDeps`). Throws the first
|
|
76
|
+
* refusal; nothing is written by the caller before it returns.
|
|
77
|
+
*/
|
|
78
|
+
export declare function receiveModelCatalog(models: Record<string, Model> | undefined, tiers: Record<string, ModelRef> | undefined, field: string): {
|
|
79
|
+
models?: Record<string, Model>;
|
|
80
|
+
tiers?: Record<string, ModelRef>;
|
|
81
|
+
};
|
|
48
82
|
/**
|
|
49
83
|
* The words a catalog word stands in for under the tier layer, nearest first — what {@link expandTiers}
|
|
50
84
|
* recorded for a key IT wrote: the tier words its resolution passed through and the binding's own catalog
|
|
@@ -119,7 +153,7 @@ export declare function roleSpecNamesModel(spec: RoleSpec | undefined): boolean;
|
|
|
119
153
|
* Every entry is judged, read or not: a resume's screen calls it before the claim, and the merge below calls it on both
|
|
120
154
|
* maps, so an entry no task of this leg selects still refuses loudly.
|
|
121
155
|
*/
|
|
122
|
-
export declare function screenRoleMap(roles: ModelRoles | undefined, field: "RunnerDeps.roles" | "TaskSpec.roles"):
|
|
156
|
+
export declare function screenRoleMap(roles: ModelRoles | undefined, field: "RunnerDeps.roles" | "TaskSpec.roles"): ModelRoles | undefined;
|
|
123
157
|
/** A role seat whose word the catalog does not hold: the role, the seat as the refusal names it, the word written there. */
|
|
124
158
|
export interface UnheldRoleSeat {
|
|
125
159
|
role: ModelRole;
|