@sema-agent/core 7.58.0 → 7.60.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 +1340 -0
- package/README.md +6 -4
- 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 +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- 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 +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- 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 +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- 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 +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- 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/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -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 +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -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 +3 -3
- package/dist/core/compliance.js +1 -1
- 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 +4 -5
- 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 +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- 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 +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- 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/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- 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 +3 -2
- package/dist/core/memory-engine/index.js +2 -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 +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- 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 +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- 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 +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- 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/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- 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 +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- 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 +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -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/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- 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/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- 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/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- 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 +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- 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/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/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- 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.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -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 +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- 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 +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- 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 +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- 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 +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- 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 +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- 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-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- 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 +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- 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/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- 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-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- 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/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- 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 +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -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/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- 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 +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- 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 +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- 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/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- 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.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- 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/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- 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 +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- 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 +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- 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 +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- 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 +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- 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 +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- 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 +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
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();
|
|
@@ -43,8 +45,7 @@ export function isRemoteExecutionEnv(env) {
|
|
|
43
45
|
typeof e.execStream === "function" &&
|
|
44
46
|
typeof e.suspendVM === "function" &&
|
|
45
47
|
typeof e.destroy === "function" &&
|
|
46
|
-
|
|
47
|
-
e.capabilities !== null);
|
|
48
|
+
capabilityReceiptOf(env).blockIsObject);
|
|
48
49
|
}
|
|
49
50
|
export function missingRestoreSurface(env) {
|
|
50
51
|
const e = env;
|
|
@@ -55,26 +56,124 @@ export function missingRestoreSurface(env) {
|
|
|
55
56
|
missing.push("postResumeInit");
|
|
56
57
|
return missing;
|
|
57
58
|
}
|
|
59
|
+
export const UNDECLARED_CAPABILITY_READING = {
|
|
60
|
+
isolation: {
|
|
61
|
+
reads: false,
|
|
62
|
+
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",
|
|
63
|
+
},
|
|
64
|
+
suspendable: {
|
|
65
|
+
reads: "undeclared",
|
|
66
|
+
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",
|
|
67
|
+
},
|
|
68
|
+
sharesProcessTable: {
|
|
69
|
+
reads: "undeclared",
|
|
70
|
+
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)",
|
|
71
|
+
},
|
|
72
|
+
canonicalPathAuthoritative: {
|
|
73
|
+
reads: true,
|
|
74
|
+
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",
|
|
75
|
+
},
|
|
76
|
+
hostLocalPaths: {
|
|
77
|
+
reads: "undeclared",
|
|
78
|
+
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)",
|
|
79
|
+
},
|
|
80
|
+
externalContentTarget: {
|
|
81
|
+
reads: "undeclared",
|
|
82
|
+
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)",
|
|
83
|
+
},
|
|
84
|
+
io: {
|
|
85
|
+
reads: "undeclared",
|
|
86
|
+
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",
|
|
87
|
+
},
|
|
88
|
+
keepsReadFloor: {
|
|
89
|
+
reads: false,
|
|
90
|
+
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`",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
export const CAPABILITY_KEYS = Object.keys(UNDECLARED_CAPABILITY_READING);
|
|
94
|
+
const CAPABILITY_RECEIPT_MODE = Object.freeze({ accessors: "call-once", depth: 2, others: "copy", contain: true, freeze: true, isProxy: (v) => types.isProxy(v) });
|
|
95
|
+
const CAPABILITY_KEY_SET = new Set(CAPABILITY_KEYS);
|
|
96
|
+
const RECEIVED_CAPABILITIES = new WeakMap();
|
|
97
|
+
const typeWord = (v) => (v === null ? "null" : typeof v);
|
|
98
|
+
const blockRefused = (valueType, blockIsObject) => Object.freeze({ declared: Object.freeze({}), blockIsObject, findings: Object.freeze([Object.freeze({ key: "capabilities", valueType, expected: "object" })]) });
|
|
99
|
+
function receiveCapabilities(env) {
|
|
100
|
+
let block;
|
|
101
|
+
try {
|
|
102
|
+
block = Reflect.get(env, "capabilities");
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return blockRefused("unreadable", false);
|
|
106
|
+
}
|
|
107
|
+
if (block === undefined) {
|
|
108
|
+
return Object.freeze({ declared: Object.freeze({}), blockIsObject: false, findings: Object.freeze(CAPABILITY_KEYS.map((key) => Object.freeze({ key, valueType: "undefined", expected: "boolean" }))) });
|
|
109
|
+
}
|
|
110
|
+
if (typeof block !== "object" || block === null)
|
|
111
|
+
return blockRefused(typeWord(block), false);
|
|
112
|
+
const received = receive(block, CAPABILITY_RECEIPT_MODE);
|
|
113
|
+
if (!received.ok)
|
|
114
|
+
return blockRefused("unreadable", true);
|
|
115
|
+
const members = received.value;
|
|
116
|
+
const unreadable = new Set((received.faults ?? []).map((f) => f.path[0]).filter((k) => k !== undefined));
|
|
117
|
+
const declared = {};
|
|
118
|
+
const findings = [];
|
|
119
|
+
for (const key of CAPABILITY_KEYS) {
|
|
120
|
+
const value = members[key];
|
|
121
|
+
if (typeof value === "boolean")
|
|
122
|
+
declared[key] = value;
|
|
123
|
+
else
|
|
124
|
+
findings.push(Object.freeze({ key, valueType: unreadable.has(key) ? "unreadable" : typeWord(value), expected: "boolean" }));
|
|
125
|
+
}
|
|
126
|
+
for (const key of [...Object.keys(members), ...unreadable]) {
|
|
127
|
+
if (!CAPABILITY_KEY_SET.has(key) && !findings.some((f) => f.key === key))
|
|
128
|
+
findings.push(Object.freeze({ key, valueType: unreadable.has(key) ? "unreadable" : typeWord(members[key]), expected: "absent" }));
|
|
129
|
+
}
|
|
130
|
+
return Object.freeze({ declared: Object.freeze(declared), blockIsObject: true, findings: Object.freeze(findings) });
|
|
131
|
+
}
|
|
132
|
+
export function capabilityReceiptOf(env) {
|
|
133
|
+
const holder = env;
|
|
134
|
+
if ((typeof holder !== "object" && typeof holder !== "function") || holder === null)
|
|
135
|
+
return blockRefused(typeWord(holder), false);
|
|
136
|
+
const prior = RECEIVED_CAPABILITIES.get(holder);
|
|
137
|
+
if (prior !== undefined)
|
|
138
|
+
return prior;
|
|
139
|
+
const receipt = receiveCapabilities(holder);
|
|
140
|
+
RECEIVED_CAPABILITIES.set(holder, receipt);
|
|
141
|
+
return receipt;
|
|
142
|
+
}
|
|
143
|
+
function declaredCapability(env, key) {
|
|
144
|
+
return capabilityReceiptOf(env).declared[key];
|
|
145
|
+
}
|
|
146
|
+
export function declaredSuspend(env) {
|
|
147
|
+
return declaredCapability(env, "suspendable") ?? UNDECLARED_CAPABILITY_READING.suspendable.reads;
|
|
148
|
+
}
|
|
58
149
|
export function isSuspendable(env) {
|
|
59
|
-
return
|
|
150
|
+
return declaredSuspend(env) === true && isRemoteExecutionEnv(env) && missingRestoreSurface(env).length === 0;
|
|
60
151
|
}
|
|
61
152
|
export function isIsolated(env) {
|
|
62
|
-
return
|
|
153
|
+
return declaredCapability(env, "isolation") ?? UNDECLARED_CAPABILITY_READING.isolation.reads;
|
|
63
154
|
}
|
|
64
155
|
export function boundaryIsTheSandbox(env) {
|
|
65
156
|
return isIsolated(env);
|
|
66
157
|
}
|
|
67
158
|
export function canonicalPathIsAuthoritative(env) {
|
|
68
|
-
return
|
|
159
|
+
return declaredCapability(env, "canonicalPathAuthoritative") ?? UNDECLARED_CAPABILITY_READING.canonicalPathAuthoritative.reads;
|
|
69
160
|
}
|
|
70
161
|
export function processTableOf(env) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
162
|
+
const declared = declaredCapability(env, "sharesProcessTable");
|
|
163
|
+
return declared === true ? "this" : declared === false ? "other" : UNDECLARED_CAPABILITY_READING.sharesProcessTable.reads;
|
|
164
|
+
}
|
|
165
|
+
export function declaredHostLocalPaths(env) {
|
|
166
|
+
return declaredCapability(env, "hostLocalPaths") ?? UNDECLARED_CAPABILITY_READING.hostLocalPaths.reads;
|
|
167
|
+
}
|
|
168
|
+
export function pathsAreHostLocal(env) {
|
|
169
|
+
return declaredHostLocalPaths(env) === true;
|
|
170
|
+
}
|
|
171
|
+
export function targetIsExternal(env) {
|
|
172
|
+
return declaredCapability(env, "externalContentTarget") ?? UNDECLARED_CAPABILITY_READING.externalContentTarget.reads;
|
|
173
|
+
}
|
|
174
|
+
export function performsIo(env) {
|
|
175
|
+
return declaredCapability(env, "io") ?? UNDECLARED_CAPABILITY_READING.io.reads;
|
|
176
|
+
}
|
|
177
|
+
export function keepsReadFloor(env) {
|
|
178
|
+
return declaredCapability(env, "keepsReadFloor") ?? UNDECLARED_CAPABILITY_READING.keepsReadFloor.reads;
|
|
80
179
|
}
|
|
@@ -12,6 +12,7 @@ const CAUSE_OF_CODE = new Map([
|
|
|
12
12
|
["checkpoint.config_refused", "configuration"],
|
|
13
13
|
["resume.parent_constraint_missing", "configuration"],
|
|
14
14
|
["resume.parent_constraint_mismatch", "configuration"],
|
|
15
|
+
["revive.policy_floor_unreadable", "configuration"],
|
|
15
16
|
["checkpoint.gate_mismatch", "decision_rejected"],
|
|
16
17
|
["checkpoint.invalid_outcome", "decision_rejected"],
|
|
17
18
|
["resume.constraint_rejected", "decision_rejected"],
|
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).`);
|
|
@@ -35,8 +35,13 @@ export declare const RETIRED_HOOKS_REPLACEMENT = "the callback seats are `mods`
|
|
|
35
35
|
/** The RETIRED `TaskSpec` keys, each with the sentence that names its replacement — the table the spec door reads
|
|
36
36
|
* ({@link assertNoRetiredKeys} with 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 door 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 door reading these rows would read the caller's `skills` 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,18 +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
|
-
|
|
71
|
-
|
|
73
|
+
readonly extension?: string;
|
|
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`. */
|
|
72
80
|
export declare function screenRewrite(screening: PreToolUseScreening, req: {
|
|
73
81
|
readonly face?: object | undefined;
|
|
74
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" };
|
|
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" };
|
|
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,6 +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
|
+
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;
|
|
8
23
|
/**
|
|
9
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
|
|
10
25
|
* reference, are refused by `config.unknown_role` with `detail { field: seat, reason }` — `seat` names where the caller wrote the word
|
|
@@ -43,6 +58,27 @@ export declare function resolveModelDisplayLabel(ref: string): string;
|
|
|
43
58
|
* `resolveModel("best")` refuses like any unknown ref.
|
|
44
59
|
*/
|
|
45
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
|
+
};
|
|
46
82
|
/**
|
|
47
83
|
* The words a catalog word stands in for under the tier layer, nearest first — what {@link expandTiers}
|
|
48
84
|
* recorded for a key IT wrote: the tier words its resolution passed through and the binding's own catalog
|
|
@@ -117,7 +153,35 @@ export declare function roleSpecNamesModel(spec: RoleSpec | undefined): boolean;
|
|
|
117
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
|
|
118
154
|
* maps, so an entry no task of this leg selects still refuses loudly.
|
|
119
155
|
*/
|
|
120
|
-
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;
|
|
157
|
+
/** A role seat whose word the catalog does not hold: the role, the seat as the refusal names it, the word written there. */
|
|
158
|
+
export interface UnheldRoleSeat {
|
|
159
|
+
role: ModelRole;
|
|
160
|
+
seat: string;
|
|
161
|
+
word: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The ONE test of "this seat names a word the deployment's catalog does not declare": the word a role entry writes — the string
|
|
165
|
+
* itself, or the `model` member of a config record — when it is a string and no key of the catalog answers it. A Model object, a
|
|
166
|
+
* `select`, a preset-only record and an absent seat name no word. Total: it reads, never judges the shape (a value that is no binding
|
|
167
|
+
* is the screen's refusal, `screenRoleMap`).
|
|
168
|
+
*/
|
|
169
|
+
export declare function unheldSeatWord(spec: unknown, models: Record<string, Model> | undefined): string | undefined;
|
|
170
|
+
/** Every role seat of the merged maps (deployment and task) that names a word the catalog does not hold, in vocabulary order — the facts
|
|
171
|
+
* {@link seatRead} stands in for. `default` is never listed (it refuses) and neither is `classifier` unless asked (it says it itself). */
|
|
172
|
+
export declare function unheldRoleSeats(spec: {
|
|
173
|
+
roles?: ModelRoles;
|
|
174
|
+
}, deps: {
|
|
175
|
+
models?: Record<string, Model>;
|
|
176
|
+
roles?: ModelRoles;
|
|
177
|
+
}, only?: readonly ModelRole[]): UnheldRoleSeat[];
|
|
178
|
+
/** The refusal of an unheld seat — the seat's own `config.unknown_role` / `unknown_model_ref`, for the place where a chain ends with no model. */
|
|
179
|
+
export declare function unheldSeatRefusal(u: UnheldRoleSeat): Error;
|
|
180
|
+
/** The refusal for a chain of roles that supplied no model while one of its seats was written but not held — that seat's own
|
|
181
|
+
* `config.unknown_role`; `undefined` when no seat of the chain is unheld (the caller's own "no seat" refusal stands). */
|
|
182
|
+
export declare function unheldChainRefusal(chain: readonly ModelRole[], models: Record<string, Model> | undefined, roles: ModelRoles | undefined): Error | undefined;
|
|
183
|
+
/** The roles a role falls back to when its seat supplies nothing, nearest first (what {@link unheldRoleSeats} says it stands in for). */
|
|
184
|
+
export declare function roleFallbackChain(role: ModelRole): readonly ModelRole[];
|
|
121
185
|
export interface ResolvedRole {
|
|
122
186
|
model: Model;
|
|
123
187
|
/**
|
|
@@ -156,7 +220,8 @@ export declare function presetRoleBaseOf(spec: {
|
|
|
156
220
|
/**
|
|
157
221
|
* Resolve the model (and default thinking) for a task. Explicit `spec.model` wins; otherwise walk the
|
|
158
222
|
* `modelRole`'s fallback chain over the merged roles (task overrides runner) and use the first role
|
|
159
|
-
* that supplies a model.
|
|
223
|
+
* that supplies a model. A seat on that chain whose word the catalog does not hold supplies none ({@link seatRead}); when the whole
|
|
224
|
+
* chain supplies none, the first such seat's own refusal is the answer. Throws a helpful error if nothing resolves.
|
|
160
225
|
*
|
|
161
226
|
* @contract roles.side_channels_deployment_only — an engine SIDE CHANNEL (the auto-mode classifier,
|
|
162
227
|
* the compaction/summarize lane, memory consolidation, next-prompt suggestion) resolves here with a
|
|
@@ -179,7 +244,8 @@ export declare function resolveTaskModel(spec: {
|
|
|
179
244
|
/**
|
|
180
245
|
* Resolve a role's model **only if that exact role key is configured** (no fallback chain). Used for
|
|
181
246
|
* the `summarize` compaction model: override only when a summarize-specific model is set, otherwise
|
|
182
|
-
* let the caller fall back to the main model (unchanged behavior).
|
|
247
|
+
* let the caller fall back to the main model (unchanged behavior). A seat naming a word the catalog does not hold is "not set" here,
|
|
248
|
+
* as in the walk ({@link seatRead}); a caller that needs a model asks {@link unheldRoleSeats} for the refusal when it gets none.
|
|
183
249
|
*/
|
|
184
250
|
export declare function roleModelIfSet(role: ModelRole, spec: {
|
|
185
251
|
roles?: ModelRoles;
|