@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PrepareTask's file-history phase, verbatim from the driver: the DV-14 first-touch
|
|
3
|
-
* policy door, the `RunnerDeps.fileHistoryStore` / `fileHistoryCapture` and `TaskSpec.fileHistory` bad-value doors, the
|
|
4
|
-
* split, the restoreFiles / resumeAt / rewindFilesTo combination gates, the run's history coordinates
|
|
3
|
+
* policy door, the `RunnerDeps.fileHistoryStore` / `fileHistoryCapture` and `TaskSpec.fileHistory` bad-value doors, the restoreFiles / resumeAt / rewindFilesTo combination gates, the run's history coordinates
|
|
5
4
|
* (canonical root, recording scope, filesystem identity), the fork carry, the child-scope refusal, the
|
|
6
5
|
* rewind RESTORE itself (anchor translation in "before" mode, the per-file ledger, partial-restore
|
|
7
6
|
* policy), the `trackFileEdit` hook the hands band calls before every mutation lane, and the turn-start
|
|
@@ -32,8 +31,7 @@ export interface PrepareFileHistoryInput {
|
|
|
32
31
|
/** borrowed-readonly — the deployment seats this phase reads: the first-touch failure policy, the history
|
|
33
32
|
* store and its capture switch (all validated HERE, once), the incident sink, and the retired-epoch diagnostic probe. */
|
|
34
33
|
deps: Pick<RunnerDeps, "onError">;
|
|
35
|
-
/** borrowed-readonly — the REBOUND spec's rewind request fields and off-switch word
|
|
36
|
-
* spelling is read off the same object as an unknown key) and the caller's cancel signal for the restore. */
|
|
34
|
+
/** borrowed-readonly — the REBOUND spec's rewind request fields and off-switch word and the caller's cancel signal for the restore. */
|
|
37
35
|
spec: Pick<TaskSpec, "resumeAt" | "restoreFiles" | "acceptPartialRestore" | "signal">;
|
|
38
36
|
/** borrowed-readonly — the request door's resolution ({@link resolveFileHistoryRequest}), judged before the session was
|
|
39
37
|
* acquired: every refusal the request and the deployment's seats decide on their own has already thrown. */
|
|
@@ -125,14 +123,14 @@ export declare function resolveFileHistoryScope(lineage: RunInternals["fileHisto
|
|
|
125
123
|
/**
|
|
126
124
|
* WHICH filesystem an env is a view of — the second coordinate of tree identity for the file-history
|
|
127
125
|
* lineage, read from what the env's MINTER states rather than inferred from a path:
|
|
128
|
-
* ·
|
|
129
|
-
*
|
|
130
|
-
* ·
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
126
|
+
* · an env that DECLARES its paths host-local (`pathsAreHostLocal` — `NodeExecutionEnv`, a host lane) is the
|
|
127
|
+
* control-plane host's filesystem — every such env is one tree, whatever interface it drives it through;
|
|
128
|
+
* · otherwise a remote workspace names itself through its {@link WorkspaceHandle} (provider + sandbox, and
|
|
129
|
+
* the device lane's id when stamped) — two runs on one sandbox share a tree, two sandboxes never do;
|
|
130
|
+
* · anything else — an env declaring `hostLocalPaths: false` with no handle, or one whose declaration is
|
|
131
|
+
* missing or malformed (read as not host-local) — is attested to nothing, so it is its OWN tree: a
|
|
132
|
+
* per-instance token, which still matches when the child literally holds the parent's env object and
|
|
133
|
+
* never matches a fresh per-task mint.
|
|
136
134
|
* A remote handle that cannot be read (an env not yet connected) falls to the per-instance arm for
|
|
137
135
|
* the same reason: unattested is not shared.
|
|
138
136
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isRemoteExecutionEnv } from "../remote-env.js";
|
|
1
|
+
import { isRemoteExecutionEnv, pathsAreHostLocal } from "../remote-env.js";
|
|
3
2
|
import { FILE_HISTORY_ERROR_CODES, FileHistoryStoreError } from "../file-history-store.js";
|
|
4
3
|
import { readMember, thrownText } from "../thrown-value.js";
|
|
5
4
|
import { isGovernanceRetryClass } from "../governance-codes.js";
|
|
@@ -8,13 +7,6 @@ export async function prepareFileHistory(input) {
|
|
|
8
7
|
const { deps, spec, request, internals, executionEnv, taskRootFinal, handsEnabled, sessionId, session, abortController } = input;
|
|
9
8
|
const rewindNotes = [];
|
|
10
9
|
const { onTrackFailure, captureOff, declaredOff, fileHistoryStore, captureStore, rewindTarget, rewindBefore } = request;
|
|
11
|
-
if (spec.rewindFiles === true) {
|
|
12
|
-
try {
|
|
13
|
-
deps.onError?.(new Error(`TaskSpec.rewindFiles (capture sense) is retired and was ignored: per-edited-file first-touch tracking is on whenever RunnerDeps.fileHistoryStore is wired and neither RunnerDeps.fileHistoryCapture nor TaskSpec.fileHistory turns it off, so a per-turn capture request has nothing left to ask for. Drop the field; the restore sense moved to TaskSpec.restoreFiles.`), { phase: "config", sessionId });
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
10
|
if (spec.resumeAt !== undefined && spec.restoreFiles !== true) {
|
|
19
11
|
rewindNotes.push({
|
|
20
12
|
code: "conversation_only",
|
|
@@ -226,6 +218,8 @@ export function resolveFileHistoryScope(lineage, historyRoot, historyFs, session
|
|
|
226
218
|
const envFilesystemTokens = new WeakMap();
|
|
227
219
|
let envFilesystemSeq = 0;
|
|
228
220
|
export function fileHistoryFilesystemIdentity(env) {
|
|
221
|
+
if (pathsAreHostLocal(env))
|
|
222
|
+
return "host";
|
|
229
223
|
if (isRemoteExecutionEnv(env)) {
|
|
230
224
|
try {
|
|
231
225
|
const h = env.workspaceHandle();
|
|
@@ -234,9 +228,6 @@ export function fileHistoryFilesystemIdentity(env) {
|
|
|
234
228
|
catch {
|
|
235
229
|
}
|
|
236
230
|
}
|
|
237
|
-
else if (env.hostLocalPaths === true || (env.hostLocalPaths === undefined && env instanceof NodeExecutionEnv)) {
|
|
238
|
-
return "host";
|
|
239
|
-
}
|
|
240
231
|
let token = envFilesystemTokens.get(env);
|
|
241
232
|
if (token === undefined) {
|
|
242
233
|
token = `instance:${++envFilesystemSeq}`;
|
|
@@ -30,7 +30,7 @@ import type { Arbitration, ToolMarkSource } from "../ask-origin.js";
|
|
|
30
30
|
import { type PermissionModeController } from "../mode-policy.js";
|
|
31
31
|
import type { AutoModeDecider, AutoModeDenialTracker } from "../auto-mode.js";
|
|
32
32
|
import { type ComplianceCapability } from "../compliance.js";
|
|
33
|
-
import type {
|
|
33
|
+
import type { InheritedInstallation, LegModBus } from "../mods/stations.js";
|
|
34
34
|
import { type HookEnvCapabilities, type HookInvocationIdentity } from "../hooks.js";
|
|
35
35
|
import type { ToolPolicy } from "../tool-policy.js";
|
|
36
36
|
import { type GateOutcome } from "../gate-outcome.js";
|
|
@@ -96,8 +96,9 @@ export interface PrepareGateStationsInput {
|
|
|
96
96
|
/** borrowed-readonly — the leg's mods bus: `classic.PreToolUse` presence arms the gate; the screenings and the post-call
|
|
97
97
|
* events are raised on it. */
|
|
98
98
|
modBus: LegModBus;
|
|
99
|
-
/** borrowed-readonly — the inherited installations the gate
|
|
100
|
-
|
|
99
|
+
/** borrowed-readonly — the inherited installations the gate judges its calls on after `modBus` (`classic.PreToolUse` at phase 1,
|
|
100
|
+
* `tool.check` at the verdict read; the policy-chain phase's). */
|
|
101
|
+
inheritedInstallations: readonly InheritedInstallation[];
|
|
101
102
|
/** borrowed-readonly — the egress vocabulary: arming, and the per-call `egress` flag handed to the gate. */
|
|
102
103
|
egressTools: ReadonlySet<string>;
|
|
103
104
|
/** borrowed-readonly — the irreversible vocabulary: arming only. */
|
|
@@ -48,7 +48,7 @@ export function maybeHumanRejectionHalt(input) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
export function prepareGateStations(input) {
|
|
51
|
-
const { askLane, parkAsk, tools, toolRosterDeltas, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, crossBoundaryCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus,
|
|
51
|
+
const { askLane, parkAsk, tools, toolRosterDeltas, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, crossBoundaryCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus, inheritedInstallations } = input;
|
|
52
52
|
const releasesAnnounced = new Map();
|
|
53
53
|
const onModeReleased = (info) => {
|
|
54
54
|
const table = info.readUnestablished === true ? input.readDenyInForce(info.toolCallId) : undefined;
|
|
@@ -78,6 +78,7 @@ export function prepareGateStations(input) {
|
|
|
78
78
|
toolCallGateArmedRef.armed =
|
|
79
79
|
effectivePolicy !== undefined ||
|
|
80
80
|
modBus.hasHandlers("classic.PreToolUse") ||
|
|
81
|
+
inheritedInstallations.length > 0 ||
|
|
81
82
|
egressTools.size > 0 ||
|
|
82
83
|
irreversibleTools.size > 0 ||
|
|
83
84
|
spec.enablePlanMode === true ||
|
|
@@ -117,7 +118,7 @@ export function prepareGateStations(input) {
|
|
|
117
118
|
identity: hookIdentity,
|
|
118
119
|
reminderMark,
|
|
119
120
|
modBus,
|
|
120
|
-
...(
|
|
121
|
+
...(inheritedInstallations.length > 0 ? { inheritedInstallations } : {}),
|
|
121
122
|
observedPermissionMode: () => permissionMode.observed,
|
|
122
123
|
...(handsCwdRef !== undefined ? { trackedCwd: () => handsCwdRef.current } : {}),
|
|
123
124
|
...(stampCallTarget !== undefined ? { stampCallTarget } : {}),
|
|
@@ -251,7 +252,7 @@ export function prepareGateStations(input) {
|
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
|
-
const toolResultStation = createToolResultStation({ modBus, blockedToolCalls, toolRosterDeltas, preToolContexts, abortController, spec, handsCwdRef, hookEnvFace, hookIdentity, permissionMode, reminderMark, frameSettlement });
|
|
255
|
+
const toolResultStation = createToolResultStation({ modBus, blockedToolCalls, toolRosterDeltas, preToolContexts, inheritedScreens: inheritedInstallations.length > 0, abortController, spec, handsCwdRef, hookEnvFace, hookIdentity, permissionMode, reminderMark, frameSettlement });
|
|
255
256
|
if (toolResultStation !== undefined)
|
|
256
257
|
harness.on("tool_result", toolResultStation);
|
|
257
258
|
const approvedCallScreen = createApprovedCallScreen({ modBus, permissionMode, abortController, handsCwdRef, hookEnvFace, hookIdentity, preToolContexts });
|
|
@@ -3,6 +3,7 @@ import { type ReadFileState } from "../../tools/fs/safety.js";
|
|
|
3
3
|
import { type PathTablesFacade, type PersonPathRows, type ReadRootsSeat } from "./person-path-rows.js";
|
|
4
4
|
import type { HeadLeads } from "../path-rule-binding.js";
|
|
5
5
|
import { type ShellReadAdmission, type ShellReadCheck, type ShellReadLandings } from "../../tools/fs/shell-read-check.js";
|
|
6
|
+
import { type ReadFloorSeat } from "../../tools/fs/read-floor.js";
|
|
6
7
|
import type { ShellReadBoundary } from "../../tools/fs/shell-read-judge.js";
|
|
7
8
|
import type { RunnerDeps, ShellGateDoctrine, TaskSpec } from "../types.js";
|
|
8
9
|
import type { Model } from "../../internal/llm.js";
|
|
@@ -55,6 +56,8 @@ export interface PrepareHandsReadFaceInput {
|
|
|
55
56
|
/** borrowed-readonly — the acquired session's id, for error/notice tags and the band's session
|
|
56
57
|
* registration. */
|
|
57
58
|
sessionId: string;
|
|
59
|
+
/** borrowed-readonly — this run's id, carried on the byte-floor notice (once per run). */
|
|
60
|
+
runId: string;
|
|
58
61
|
/** borrowed-readonly — the host task id: trace frames + the band's task-registry owner. */
|
|
59
62
|
hostTaskId: string;
|
|
60
63
|
/** borrowed-readonly — the registry scope (`internals?.registryScope ?? spec.principal ??
|
|
@@ -97,7 +100,7 @@ export interface PrepareHandsReadFaceInput {
|
|
|
97
100
|
* object (R-4: `deps.onError?.()` keeps its receiver; a new deps read must widen this Pick).
|
|
98
101
|
* `readDenyBuiltinTiers`/`readDenyBuiltinExclude` are SNAPSHOTTED before the first await that
|
|
99
102
|
* precedes the toolkit compile (the caller retains these arrays by reference). */
|
|
100
|
-
deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "agentConfigDir" | "readFace" | "writeFace" | "permissionRuleStore" | "hands">;
|
|
103
|
+
deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "agentConfigDir" | "readFace" | "writeFace" | "permissionRuleStore" | "hands" | "imageProcessor">;
|
|
101
104
|
/** borrowed-readonly — the trusted spawn-side seats the band forwards: the finished-command
|
|
102
105
|
* notification lane, the mid-flight detach hub, and the Runner's per-session
|
|
103
106
|
* read-state seats and their restore channel (absent on a standalone prepare ⇒ the transcript-replay rung
|
|
@@ -219,6 +222,9 @@ export interface PrepareHandsReadFaceResult {
|
|
|
219
222
|
/** owned — the same station's pre-spawn ADMISSION, published for the P11 face that spawns a shell command
|
|
220
223
|
* and mounts LATER than the band (`Monitor`): the SAME function the band's shell faces got. ⇔ a real shell. */
|
|
221
224
|
shellReadAdmission: ShellReadAdmission | undefined;
|
|
225
|
+
/** owned — the byte floor's seat over the run's read-deny table (read-floor.ts), for the same LATER face (`Monitor`): the
|
|
226
|
+
* table the band's shell faces carry to the environment on every start. ⇔ a real shell. */
|
|
227
|
+
shellReadFloor: ReadFloorSeat | undefined;
|
|
222
228
|
/** owned — the same station's landings of a judged call (`ShellReadStation.landings`): the park binds them, the resumed leg's execution station compares. ⇔ a real shell. */
|
|
223
229
|
shellReadLandings: ShellReadLandings | undefined;
|
|
224
230
|
/** owned — the file read station's admission (`FileReadStation.admitted`) the band's read tools got, for the read tools mounted later (LSP). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { emitTrace } from "../trace.js";
|
|
2
|
-
import {
|
|
2
|
+
import { performsIo } from "../remote-env.js";
|
|
3
3
|
import { hasBackgroundShell } from "../background-shell.js";
|
|
4
4
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
5
5
|
import { bashReversibilityProbe, activeReadDenyBuiltinTiers, readDenyBuiltinConfigOf, compileReadDeny, createHandsToolkit, deploymentFaceClampNotice, pdfModelCapabilitiesOf, inheritSessionReadFileState, backgroundOutputReadExemption, resolveContainmentFace, seedReadFileStateFromContext, seedReadFileStateFromTranscript, } from "../../tools/fs/index.js";
|
|
@@ -9,6 +9,7 @@ import { carryReadFace } from "../../tools/fs/read-deny-home.js";
|
|
|
9
9
|
import { EMPTY_READ_ROOTS, afterCallTables, denySeatsOf, onPinnedRead, pathTablesCompile, readRootsOver } from "./person-path-rows.js";
|
|
10
10
|
import { createShellOverflowSpoolFence } from "../../tools/fs/fs-shared.js";
|
|
11
11
|
import { createShellReadStation } from "../../tools/fs/shell-read-check.js";
|
|
12
|
+
import { judgeReadFloorKept, readFloorSeat } from "../../tools/fs/read-floor.js";
|
|
12
13
|
import { createFileReadStation } from "../../tools/fs/file-read-check.js";
|
|
13
14
|
import { isShellFaceToolName, predictMountedToolNames, readTargetToolNames } from "../tool-registry.js";
|
|
14
15
|
import { normalizeFileText } from "../../tools/fs/encoding.js";
|
|
@@ -19,7 +20,7 @@ import { sessionSeatAnchorHolds } from "./session-read-file-states.js";
|
|
|
19
20
|
import { rebaseWorkspacePath } from "./workspace-path.js";
|
|
20
21
|
import { RosterBuilder } from "../tool-roster.js";
|
|
21
22
|
import { unionAddOnly } from "../child-clamp-seats.js";
|
|
22
|
-
import { assertStringArraySeat } from "../read-face-seats.js";
|
|
23
|
+
import { assertStringArraySeat, screenReadDenySeat } from "../read-face-seats.js";
|
|
23
24
|
import { modePolicyOf } from "../mode-policy.js";
|
|
24
25
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
25
26
|
const faceClampAnnouncedSinks = { read: new WeakSet(), write: new WeakSet() };
|
|
@@ -86,6 +87,7 @@ export function resolveHandsLessReadFace(input) {
|
|
|
86
87
|
shellReadCheck: undefined,
|
|
87
88
|
shellReadStationArmed: false,
|
|
88
89
|
shellReadAdmission: undefined,
|
|
90
|
+
shellReadFloor: undefined,
|
|
89
91
|
shellReadLandings: undefined,
|
|
90
92
|
readAdmission: undefined,
|
|
91
93
|
resolvedReadFace: undefined,
|
|
@@ -122,6 +124,7 @@ export async function prepareHandsMount(input) {
|
|
|
122
124
|
let rebaseWsPath = (p) => p;
|
|
123
125
|
let backgroundTaskToolsActive = false;
|
|
124
126
|
let shellReadStation;
|
|
127
|
+
let shellReadFloor;
|
|
125
128
|
let shellReadTools = new Set();
|
|
126
129
|
let fileReadStation;
|
|
127
130
|
let resolvedReadFace;
|
|
@@ -188,7 +191,7 @@ export async function prepareHandsMount(input) {
|
|
|
188
191
|
seedReadFileStateFromContext(readFileState, rk.key, f.content);
|
|
189
192
|
}
|
|
190
193
|
};
|
|
191
|
-
const handsIncludeShell =
|
|
194
|
+
const handsIncludeShell = performsIo(executionEnv) === true;
|
|
192
195
|
const handsReadOnly = spec.handsReadOnly === true;
|
|
193
196
|
backgroundTaskToolsActive = handsIncludeShell && !handsReadOnly && hasBackgroundShell(executionEnv);
|
|
194
197
|
const shellFaceHere = [...predictMountedToolNames(new Set(backgroundTaskToolsActive ? ["hands", "backgroundTasks"] : ["hands"]))].filter(isShellFaceToolName);
|
|
@@ -211,7 +214,15 @@ export async function prepareHandsMount(input) {
|
|
|
211
214
|
const readDenyBuiltinCfg = readDenyBuiltinConfigOf({ tiers: deps.readDenyBuiltinTiers, exclude: deps.readDenyBuiltinExclude });
|
|
212
215
|
const canonicalize = async (dirs) => { const out = []; for (const d of dirs)
|
|
213
216
|
await canonicalizeExtraDirs([d], "persistedReadRule", out).catch((err) => deps.onError?.(new Error(`persistedReadRule entry skipped (its lookup threw): ${d}: ${thrownText(err)}`), { phase: "config", sessionId })); return out; };
|
|
214
|
-
const
|
|
217
|
+
const floorRequired = screenReadDenySeat("readDenyFloorRequired", deps.readDenyFloorRequired) === true;
|
|
218
|
+
const floorSaid = { done: false };
|
|
219
|
+
const compileRunTables = pathTablesCompile({ env: executionEnv, additions: readDenyAdditions, builtin: readDenyBuiltinCfg, legRows: input.denyRuleRows, leads: input.headLeads, configRoot: deps.agentConfigDir, canonicalize });
|
|
220
|
+
const judgedRunTables = async (person) => {
|
|
221
|
+
const compiled = await compileRunTables(person);
|
|
222
|
+
judgeReadFloorKept({ env: executionEnv, table: compiled.readDeny, floor: readFloorSeat(compiled.readDeny)?.(undefined), required: floorRequired, onNotice: deps.onNotice, attribution: { sessionId, runId: input.runId }, said: floorSaid });
|
|
223
|
+
return compiled;
|
|
224
|
+
};
|
|
225
|
+
const tables = (pathTables = await input.personRows.attachTables(judgedRunTables));
|
|
215
226
|
readDenyMatcher = tables.readDeny;
|
|
216
227
|
readRoots = readRootsOver({ own: () => [...additionalRootsCanonical, ...additionalReadRootsCanonical], tables, ready: input.personRows.tablesReady, store: () => artifactStoreRef.current,
|
|
217
228
|
onHeld: (entry, store) => emitTrace(deps.tracer, () => ({ kind: "config.additional_directory_skipped", version: 1, taskId: hostTaskId, entry, field: "persistedReadRule", reason: `admits_artifact_store: the local artifact store ${store} lies inside it or it inside the store — the Artifact tool's ledger and stored files stay outside every root the file tools reach`, ts: Date.now() })) });
|
|
@@ -311,6 +322,7 @@ export async function prepareHandsMount(input) {
|
|
|
311
322
|
return { roots: [rootCanonical, ...readRoots.forCall(toolCallId)()], cwd: rootCanonical, ...denySeat, ...writeDenySeat, ...(input.personRows.unreadFor(toolCallId) ? { unreadPartitions: true } : {}), alsoInside: spoolFence };
|
|
312
323
|
};
|
|
313
324
|
shellReadTools = new Set(shellFaceHere);
|
|
325
|
+
shellReadFloor = readFloorSeat(tables.readDeny);
|
|
314
326
|
shellReadStation = createShellReadStation({
|
|
315
327
|
env: executionEnv,
|
|
316
328
|
tools: shellReadTools,
|
|
@@ -364,7 +376,7 @@ export async function prepareHandsMount(input) {
|
|
|
364
376
|
pdfModelCapabilities: pdfModelCapabilitiesOf(model),
|
|
365
377
|
...(deps.hands?.bashReadonlyAllow !== undefined ? { bashReadonlyAllow: deps.hands.bashReadonlyAllow } : {}),
|
|
366
378
|
...(deps.hands?.commitCoAuthor !== undefined ? { commitCoAuthor: deps.hands.commitCoAuthor } : {}),
|
|
367
|
-
...(deps.
|
|
379
|
+
...(deps.imageProcessor !== undefined ? { imageProcessor: deps.imageProcessor } : {}),
|
|
368
380
|
...(deps.hands?.autoBackgroundOnTimeout !== undefined ? { autoBackgroundOnTimeout: deps.hands.autoBackgroundOnTimeout } : {}),
|
|
369
381
|
beforeWrite: async (w) => {
|
|
370
382
|
const deploymentGate = deps.hands?.beforeWrite;
|
|
@@ -388,7 +400,7 @@ export async function prepareHandsMount(input) {
|
|
|
388
400
|
}
|
|
389
401
|
roster.mountAll(band.map((t) => (envHandToolNames.add(t.name), firstPartyOffload(afterCallTables(input.personRows, t)))), { source: "builtin", mountedBy: "hands" });
|
|
390
402
|
const shellFloor = effectiveShellGate;
|
|
391
|
-
if (
|
|
403
|
+
if (handsIncludeShell && spec.handsReadOnly !== true) {
|
|
392
404
|
const installShellSeat = (name) => {
|
|
393
405
|
const tierBefore = irreversibilityTier.get(name);
|
|
394
406
|
const seatOwned = !egressTools.has(name) && tierBefore !== "always" && tierBefore !== "maybe";
|
|
@@ -415,6 +427,7 @@ export async function prepareHandsMount(input) {
|
|
|
415
427
|
shellReadCheck: onPinnedRead(input.personRows, [...(shellReadStation !== undefined ? [{ check: shellReadStation.check, tools: shellReadTools }] : []), ...(fileReadStation !== undefined ? [fileReadStation] : [])]),
|
|
416
428
|
shellReadStationArmed: shellReadStation !== undefined,
|
|
417
429
|
shellReadAdmission: shellReadStation?.admit,
|
|
430
|
+
shellReadFloor,
|
|
418
431
|
shellReadLandings: shellReadStation?.landings,
|
|
419
432
|
readAdmission: fileReadStation?.admitted,
|
|
420
433
|
resolvedReadFace,
|
|
@@ -37,7 +37,6 @@ import type { AutoModeArmingRecipe } from "../auto-mode-arming.js";
|
|
|
37
37
|
import type { AutoModeDecider, AutoModeDenialTracker } from "../auto-mode.js";
|
|
38
38
|
import { type OnQuestion } from "../ask-question.js";
|
|
39
39
|
import { type ParentSpecSeat } from "../parent-spec-seat.js";
|
|
40
|
-
import { type HookEnvCapabilities } from "../hooks.js";
|
|
41
40
|
import { type LegModBus, type ModChainLink } from "../mods/stations.js";
|
|
42
41
|
import { type ChildClampSource } from "../child-clamp-seats.js";
|
|
43
42
|
import type { LockedPreflight } from "../locked-config.js";
|
|
@@ -134,12 +133,12 @@ export interface PrepareInheritedGateInput {
|
|
|
134
133
|
forwardEvent: ((e: TaskEvent) => void) | undefined;
|
|
135
134
|
/** borrowed-readonly — the retain ledger (ctx seat; absent ⇒ no key). */
|
|
136
135
|
subagentRetain: SubagentRetainLedger | undefined;
|
|
136
|
+
/** borrowed-readonly — where a background task's cut result is stored (ctx seat `taskArtifacts`; absent ⇒ no key). */
|
|
137
|
+
taskArtifacts: import("../tool-result-store.js").TaskArtifactSeat | undefined;
|
|
137
138
|
/** borrowed-readonly — the worktree-isolation helper (ctx seat; absent ⇒ no key). */
|
|
138
139
|
worktreeIsolation: SubagentWorktreeIsolation | undefined;
|
|
139
140
|
/** borrowed-readonly — the three run-ref primitives the ctx exposes (plan mode only under `enablePlanMode`). */
|
|
140
|
-
requestReview: (opts?:
|
|
141
|
-
reason?: string;
|
|
142
|
-
}) => void;
|
|
141
|
+
requestReview: (opts?: import("../present-plan-tool.js").ReviewRequest) => void;
|
|
143
142
|
/** borrowed-readonly — see `requestReview`. */
|
|
144
143
|
requestStopAfterTurn: () => void;
|
|
145
144
|
/** borrowed-readonly — see `requestReview`; a steer of the leg's mode seat into `plan`. */
|
|
@@ -163,12 +162,10 @@ export interface PrepareInheritedGateInput {
|
|
|
163
162
|
* `inheritedGateForChildren` (the two mandate tests), at spawn time. */
|
|
164
163
|
runtimeCaps: () => RuntimeCaps | undefined;
|
|
165
164
|
/** borrowed-readonly — what the leg hands its descendants of its mods bus (`LegMods.handedDown`: without the skills' own
|
|
166
|
-
* registrations): the chain assembly
|
|
165
|
+
* registrations): the chain assembly hands it down as this leg's screening installation. */
|
|
167
166
|
modBus: LegModBus;
|
|
168
167
|
/** borrowed-readonly — this leg's chain identity as its admission recorded it (`chainOfBus`) — the installation identity's chain term. */
|
|
169
168
|
ownModChain: readonly ModChainLink[];
|
|
170
|
-
/** borrowed-readonly — LATE-BOUND: the hook-env capability face the screening-face entry's policy resolves paths in. */
|
|
171
|
-
hookEnvFace: () => HookEnvCapabilities | undefined;
|
|
172
169
|
/** borrowed-readonly — LATE-BOUND: the armed classifier (undefined = not armed), read where the chain freezes it onto both
|
|
173
170
|
* entries and where the ctx exposes the spawn-review seat. */
|
|
174
171
|
autoModeDecider: () => AutoModeDecider | undefined;
|
|
@@ -178,6 +175,8 @@ export interface PrepareInheritedGateInput {
|
|
|
178
175
|
autoModeArming: () => AutoModeArmingRecipe | undefined;
|
|
179
176
|
/** borrowed-readonly — LATE-BOUND: the fork-governance verdict (ctx `forkAccess`, present only when denied). */
|
|
180
177
|
agentForkDenial: () => ReturnType<typeof forkGovernanceDenial>;
|
|
178
|
+
/** borrowed-readonly — LATE-BOUND: the leg's agent stations (ctx `agentStations`; bound once the leg's identity is known). */
|
|
179
|
+
agentStations: () => import("../mods/agent-stations.js").AgentStations | undefined;
|
|
181
180
|
/** borrowed-readonly — LATE-BOUND: the observers grant (ctx `observersAllowed`, present only when explicitly granted). */
|
|
182
181
|
observersActive: () => boolean;
|
|
183
182
|
/** borrowed-readonly — LATE-BOUND: the hands mount's resolved read face (undefined until/unless hands mount). */
|
|
@@ -2,11 +2,10 @@ import { principalNameOf } from "../principal-name.js";
|
|
|
2
2
|
import { forkGovernanceDenial, resolveDelegationEntryCaps } from "../../agents/subagent.js";
|
|
3
3
|
import { isLiveQuestionFace } from "../ask-question.js";
|
|
4
4
|
import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
5
|
-
import { createPreToolUseConstraintPolicy } from "../hooks.js";
|
|
6
5
|
import { chainJudges, sameInstallation } from "../mods/stations.js";
|
|
7
6
|
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
8
7
|
import { rowFollowsFloor } from "./session-rule-policy.js";
|
|
9
|
-
import {
|
|
8
|
+
import { performsIo } from "../remote-env.js";
|
|
10
9
|
import { durableMandateSourceOf } from "../tool-policy.js";
|
|
11
10
|
import { chainAnchorRecords } from "./child-tree.js";
|
|
12
11
|
import { deliverEngineNotice } from "../types.js";
|
|
@@ -17,7 +16,7 @@ import { frozenSkillGrants } from "../skill-grant.js";
|
|
|
17
16
|
import { attachRebuiltDenialTrackers, createDenialLimitStop } from "./denial-limit-arms.js";
|
|
18
17
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
19
18
|
export function prepareInheritedGate(input) {
|
|
20
|
-
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
19
|
+
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, taskArtifacts, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
21
20
|
const liveInheritedGate = internals?.inheritedGate;
|
|
22
21
|
const seedInheritedGate = resume?.seed.inheritedGate;
|
|
23
22
|
const inheritedAncestorRules = (() => {
|
|
@@ -41,6 +40,8 @@ export function prepareInheritedGate(input) {
|
|
|
41
40
|
const inheritedShellGate = liveInheritedGate?.shellGate ?? modeSeed.shellGate;
|
|
42
41
|
const askView = askSeat.reach === "none" ? liveInheritedGate?.parentConstraints?.map((pc) => (typeof pc.onAsk === "function" ? ((({ onAsk: _person, ...rest }) => rest)(pc)) : pc)) : liveInheritedGate?.parentConstraints;
|
|
43
42
|
const chainView = askView?.map((pc, position) => {
|
|
43
|
+
if (pc.policy === undefined)
|
|
44
|
+
return pc;
|
|
44
45
|
const policy = pathRuleAnchors.onLeg(pc.policy, position);
|
|
45
46
|
return policy === pc.policy ? pc : { ...pc, policy };
|
|
46
47
|
});
|
|
@@ -138,37 +139,21 @@ export function prepareInheritedGate(input) {
|
|
|
138
139
|
const contentMandate = input.runtimeCaps()?.forceDurableGate === true ||
|
|
139
140
|
(spec.durableApproval !== undefined && !isLiveQuestionFace(frozenOnQuestion));
|
|
140
141
|
const ownInstallation = { chain: input.ownModChain, onAsk: frozenOnAsk, durableMandate, contentMandate, hookEnv: hookEnvSource, decider: autoModeDecider };
|
|
142
|
+
const regime = {
|
|
143
|
+
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
144
|
+
...(durableMandate ? { durableMandate: true } : {}),
|
|
145
|
+
...(contentMandate ? { contentMandate: true } : {}),
|
|
146
|
+
...(autoModeDecider !== undefined
|
|
147
|
+
? { autoMode: { decider: autoModeDecider, ...(autoModeDenialTracking !== undefined ? { denialTracking: autoModeDenialTracking } : {}), ...(autoModeArming !== undefined ? { arming: autoModeArming } : {}), liveMode: legModeCeiling } }
|
|
148
|
+
: {}),
|
|
149
|
+
};
|
|
141
150
|
const hookConstraint = chainJudges(input.modBus) && !(inheritedParentConstraints ?? []).some((pc) => sameInstallation(pc, ownInstallation))
|
|
142
|
-
? [
|
|
143
|
-
{
|
|
144
|
-
policy: createPreToolUseConstraintPolicy(input.modBus, input.hookEnvFace()),
|
|
145
|
-
mods: input.ownModChain,
|
|
146
|
-
...(hookEnvSource !== undefined ? { hookEnv: hookEnvSource } : {}),
|
|
147
|
-
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
148
|
-
...(durableMandate ? { durableMandate: true } : {}),
|
|
149
|
-
...(contentMandate ? { contentMandate: true } : {}),
|
|
150
|
-
...(autoModeDecider !== undefined
|
|
151
|
-
? { autoMode: { decider: autoModeDecider, ...(autoModeDenialTracking !== undefined ? { denialTracking: autoModeDenialTracking } : {}), ...(autoModeArming !== undefined ? { arming: autoModeArming } : {}), liveMode: legModeCeiling } }
|
|
152
|
-
: {}),
|
|
153
|
-
},
|
|
154
|
-
]
|
|
151
|
+
? [{ installation: input.modBus, ...(hookEnvSource !== undefined ? { hookEnv: hookEnvSource } : {}), ...regime }]
|
|
155
152
|
: [];
|
|
156
153
|
const parentConstraints = [
|
|
157
154
|
...(inheritedParentConstraints ?? []),
|
|
158
155
|
...hookConstraint,
|
|
159
|
-
...(ownCallerPolicy !== undefined
|
|
160
|
-
? [
|
|
161
|
-
{
|
|
162
|
-
policy: ownCallerPolicy,
|
|
163
|
-
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
164
|
-
...(durableMandate ? { durableMandate: true } : {}),
|
|
165
|
-
...(contentMandate ? { contentMandate: true } : {}),
|
|
166
|
-
...(autoModeDecider !== undefined
|
|
167
|
-
? { autoMode: { decider: autoModeDecider, ...(autoModeDenialTracking !== undefined ? { denialTracking: autoModeDenialTracking } : {}), ...(autoModeArming !== undefined ? { arming: autoModeArming } : {}), liveMode: legModeCeiling } }
|
|
168
|
-
: {}),
|
|
169
|
-
},
|
|
170
|
-
]
|
|
171
|
-
: []),
|
|
156
|
+
...(ownCallerPolicy !== undefined ? [{ policy: ownCallerPolicy, ...regime }] : []),
|
|
172
157
|
];
|
|
173
158
|
return {
|
|
174
159
|
...(ancestorRules.length > 0 ? { ancestorRules } : {}),
|
|
@@ -192,7 +177,7 @@ export function prepareInheritedGate(input) {
|
|
|
192
177
|
approvalReach: askSeat.reach,
|
|
193
178
|
});
|
|
194
179
|
const fullShellReachable = handsEnabled &&
|
|
195
|
-
|
|
180
|
+
performsIo(executionEnv) === true &&
|
|
196
181
|
spec.handsReadOnly !== true &&
|
|
197
182
|
valveLeaves(spec, toolFaceSnapshot.selector)({ name: "Bash" });
|
|
198
183
|
const { gateStopRef, stopForDenialLimit } = createDenialLimitStop({ sessionId, runId, onNotice: deps.onNotice, abort: abortRun });
|
|
@@ -202,9 +187,11 @@ export function prepareInheritedGate(input) {
|
|
|
202
187
|
const observersActive = input.observersActive();
|
|
203
188
|
const autoModeDecider = input.autoModeDecider();
|
|
204
189
|
const centerAdoption = input.centerAdoption();
|
|
190
|
+
const agentStations = input.agentStations();
|
|
205
191
|
return {
|
|
206
192
|
...ctx,
|
|
207
193
|
delegationEntryCaps: delegationEntryCapsResolved,
|
|
194
|
+
...(agentStations !== undefined ? { agentStations } : {}),
|
|
208
195
|
reportUsage,
|
|
209
196
|
model: harnessRef.current?.getModel(),
|
|
210
197
|
modelRef: harnessRef.current?.getModelRef(),
|
|
@@ -283,6 +270,7 @@ export function prepareInheritedGate(input) {
|
|
|
283
270
|
...(resolvedInteractionPosture !== undefined ? { interactionPosture: resolvedInteractionPosture } : {}),
|
|
284
271
|
...(deps.onBackgroundChildEvent ? { onBackgroundChildEvent: deps.onBackgroundChildEvent } : {}),
|
|
285
272
|
...(internals?.onTaskNotification ? { onTaskNotification: internals.onTaskNotification } : {}),
|
|
273
|
+
...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
|
|
286
274
|
...(forwardEvent ? { forwardEvent } : {}),
|
|
287
275
|
...(internals?.onSubagentSpawn ? { onSubagentSpawn: internals.onSubagentSpawn } : {}),
|
|
288
276
|
...(subagentRetain ? { subagentRetain } : {}),
|
|
@@ -290,7 +278,10 @@ export function prepareInheritedGate(input) {
|
|
|
290
278
|
...(internals?.insideFork === true ? { insideFork: true } : {}),
|
|
291
279
|
...(agentForkDenial !== undefined ? { forkAccess: { denied: agentForkDenial } } : {}),
|
|
292
280
|
...(observersActive ? { observersAllowed: true } : {}),
|
|
293
|
-
requestReview
|
|
281
|
+
requestReview: (opts) => requestReview({
|
|
282
|
+
...(opts?.reason !== undefined ? { reason: opts.reason } : {}),
|
|
283
|
+
...(ctx.reviveClaim === undefined && typeof ctx.toolCallId === "string" && ctx.toolCallId !== "" ? { requestedByCallId: ctx.toolCallId } : {}),
|
|
284
|
+
}),
|
|
294
285
|
requestStopAfterTurn,
|
|
295
286
|
...(spec.enablePlanMode === true ? { enterPlanMode } : {}),
|
|
296
287
|
};
|
|
@@ -131,7 +131,7 @@ export function prepareMemoryEngineSession(input) {
|
|
|
131
131
|
requestedType: typeof requested === "string" ? requested : undefined,
|
|
132
132
|
faces: delegation.faces,
|
|
133
133
|
pool: delegation.pool !== undefined && delegation.inheritsMcp && mountedMcp !== undefined ? [...delegation.pool, ...mountedMcpPoolRows(mountedMcp())] : delegation.pool,
|
|
134
|
-
isPolluting: poolToolPollutes,
|
|
134
|
+
isPolluting: poolToolPollutes, ...(delegation.inheritsMcp && mountedMcp !== undefined ? { inheritedServers: mountedMcp().servers.map((m) => ({ name: m.server.name, ...(m.server.contentOrigin !== undefined ? { contentOrigin: m.server.contentOrigin } : {}) })) } : {}),
|
|
135
135
|
});
|
|
136
136
|
const result = await inner(toolCallId, params, signal, onUpdate);
|
|
137
137
|
const delivery = delegationDeliveryOf(result);
|
|
@@ -96,8 +96,8 @@ export interface PrepareMemoryInput {
|
|
|
96
96
|
captureEntitlement?: CaptureEntitlementInput;
|
|
97
97
|
/**
|
|
98
98
|
* borrowed-readonly — design/383 §2.1b: the carrier-absence verdict, judged by prepare-task from the DECLARED
|
|
99
|
-
* deployment shape:
|
|
100
|
-
*
|
|
99
|
+
* deployment shape: an execution env whose paths are not the host's (`pathsAreHostLocal` false — the per-run
|
|
100
|
+
* sandbox / stateless-replica form, whose control plane does not follow the run) with no
|
|
101
101
|
* {@link RunnerDeps.memoryCaptureRecordStore} supplied. TRUE + a `capture:"off"` declaration ⇒
|
|
102
102
|
* the declaration is refused (`config.memory_capture_unsupported`) — a promise the next resume
|
|
103
103
|
* replica cannot see is a false promise, and a loud refusal beats one.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isAbsolute, sep } from "node:path";
|
|
2
2
|
import { deliverEngineNotice } from "../types.js";
|
|
3
3
|
import { admitMemoryScopes } from "../memory-admission.js";
|
|
4
|
-
import { adoptLegacyRepoDirs, canonicalize, deriveRepoControlPlaneDir, deriveProjectControlDir, deriveProjectMemoryDir, deriveRepoKey, deriveRepoMemoryDir,
|
|
5
|
-
import {
|
|
4
|
+
import { adoptLegacyRepoDirs, canonicalize, deriveRepoControlPlaneDir, deriveProjectControlDir, deriveProjectMemoryDir, deriveRepoKey, deriveRepoMemoryDir, effectiveControlRootOf, isContainedIn, lookupProjectIdHint, recordProjectIdHint, resolveMemoryEngineRoot, transferMemoryAnnouncements } from "../memory-engine/layout.js";
|
|
5
|
+
import { derivePersonalControlDir, derivePersonalMemoryDir, directoryPinOf, memoryPlaneStore, mergeHarvestReports, mergeInjections, needsDualRoots, parsedProjectPlane, scopePlanesOf } from "../memory-engine/dual-root.js";
|
|
6
6
|
import { memoryProjectScopeAbsentNotice, normalizeMemorySpec } from "../memory.js";
|
|
7
7
|
import { deriveSupersededSet } from "../memory-engine/consolidation.js";
|
|
8
8
|
import { shadowNamesOf } from "../memory-engine/shadowing.js";
|
|
@@ -12,7 +12,6 @@ import { readSessionCaptureOptOut } from "../memory-engine/layout.js";
|
|
|
12
12
|
import { sessionIncarnationResolver } from "../memory-engine/session-incarnation.js";
|
|
13
13
|
import { createMemoryEngineTools } from "../memory-engine/tools.js";
|
|
14
14
|
import { assertScopeContractPlacement, parseScopeKey } from "../memory-engine/scope-contract.js";
|
|
15
|
-
import { FileMemoryEngineBackend } from "../memory-engine/file-backend.js";
|
|
16
15
|
import { writableRootOf } from "../memory-engine/types.js";
|
|
17
16
|
import { catalogText } from "../../prompt-assembly/catalog/index.js";
|
|
18
17
|
import { asThrownError, thrownText } from "../thrown-value.js";
|
|
@@ -70,7 +69,7 @@ export async function prepareMemory(input) {
|
|
|
70
69
|
deps.onError?.(new Error(verdict.faultDisclosure), { phase: "config", sessionId });
|
|
71
70
|
}
|
|
72
71
|
if (input.captureCarrierUnsupported === true) {
|
|
73
|
-
const e = new Error(`memory.capture:"off" cannot be honored on this deployment shape: the execution environment
|
|
72
|
+
const e = new Error(`memory.capture:"off" cannot be honored on this deployment shape: the execution environment's paths are not the host's (remote/per-run) ` +
|
|
74
73
|
`and no RunnerDeps.memoryCaptureRecordStore is supplied, so core cannot know the control plane survives to a ` +
|
|
75
74
|
`resume replica — a privacy promise that silently expires at the first resume is refused rather than made. A ` +
|
|
76
75
|
`deployment whose control plane IS durable (a single persistent host using a remote sandbox) opts back in by ` +
|
|
@@ -101,7 +100,7 @@ export async function prepareMemory(input) {
|
|
|
101
100
|
const backend = deps.memoryBackend;
|
|
102
101
|
const lineageTokens = new Map(input.captureForkOrigin !== undefined && input.captureForkOriginIncarnation !== undefined ? [[input.captureForkOrigin, input.captureForkOriginIncarnation]] : []);
|
|
103
102
|
const incarnationOpt = { sessionIncarnation: sessionIncarnationResolver(sessionId, input.sessionIncarnation, lineageTokens) };
|
|
104
|
-
const pinned = backend
|
|
103
|
+
const pinned = directoryPinOf(backend);
|
|
105
104
|
const engineRoot = resolveMemoryEngineRoot(deps.memoryEngineDir);
|
|
106
105
|
const repoRoot = deps.rootPath ?? taskRootPath;
|
|
107
106
|
if (repoRoot) {
|
|
@@ -134,11 +133,10 @@ export async function prepareMemory(input) {
|
|
|
134
133
|
try {
|
|
135
134
|
const oldCtl = deriveRepoControlPlaneDir(engineRoot, repoRoot);
|
|
136
135
|
const newCtl = deriveProjectControlDir(engineRoot, marker.projectId);
|
|
137
|
-
|
|
138
|
-
for (const ann of drained.queue)
|
|
139
|
-
enqueueMemoryAnnouncement(newCtl, ann);
|
|
136
|
+
transferMemoryAnnouncements(oldCtl, newCtl);
|
|
140
137
|
}
|
|
141
|
-
catch {
|
|
138
|
+
catch (err) {
|
|
139
|
+
deps.onError?.(asThrownError(err), { phase: "config", sessionId });
|
|
142
140
|
}
|
|
143
141
|
}
|
|
144
142
|
}
|
|
@@ -151,13 +149,9 @@ export async function prepareMemory(input) {
|
|
|
151
149
|
}
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
|
-
const memoryDir =
|
|
155
|
-
? pinned
|
|
156
|
-
: identityKey !== undefined
|
|
157
|
-
? deriveProjectMemoryDir(engineRoot, identityKey)
|
|
158
|
-
: deriveRepoMemoryDir(engineRoot, repoRoot);
|
|
152
|
+
const memoryDir = pinned ?? (identityKey !== undefined ? deriveProjectMemoryDir(engineRoot, identityKey) : deriveRepoMemoryDir(engineRoot, repoRoot));
|
|
159
153
|
const projectControlDir = identityKey !== undefined ? deriveProjectControlDir(engineRoot, identityKey) : deriveRepoControlPlaneDir(engineRoot, repoRoot);
|
|
160
|
-
const planes = memorySpec.
|
|
154
|
+
const planes = scopePlanesOf(memorySpec.scopes, memorySpec.writeScope, memorySpec.scopeContract);
|
|
161
155
|
const dual = planes !== undefined && needsDualRoots(planes);
|
|
162
156
|
const personalOnly = planes !== undefined && !dual && planes.project.length === 0 && planes.writePlane !== "project" && (planes.personal.length > 0 || planes.writePlane === "personal");
|
|
163
157
|
if (memorySpec.scopeContract === "v2" && !personalOnly) {
|
|
@@ -172,7 +166,6 @@ export async function prepareMemory(input) {
|
|
|
172
166
|
const personalMemoryDir = derivePersonalMemoryDir(engineRoot);
|
|
173
167
|
const personalControlDir = derivePersonalControlDir(engineRoot);
|
|
174
168
|
const captureStoreOpt = (dir, b, configured) => deps.memoryCaptureRecordStore !== undefined ? { captureRecordStore: deps.memoryCaptureRecordStore({ controlDir: effectiveControlRootOf(dir, { pinnedBy: b, controlDir: configured }) }) } : {};
|
|
175
|
-
const choosePersonalBackend = () => typeof pinned === "string" && pinned ? new FileMemoryEngineBackend(personalMemoryDir, { controlDir: personalControlDir }) : backend;
|
|
176
169
|
const createPersonalEngine = (personalBackend) => {
|
|
177
170
|
return {
|
|
178
171
|
engine: new MemoryEngine({ backend: personalBackend, memoryDir: personalMemoryDir, controlDir: personalControlDir, onIncident: onEngineIncident, provenance: input.memoryProvenance, ...captureStoreOpt(personalMemoryDir, personalBackend, personalControlDir), ...incarnationOpt, ...(input.deps.memoryConsolidation !== undefined ? { consolidation: input.deps.memoryConsolidation } : {}) }),
|
|
@@ -336,7 +329,7 @@ export async function prepareMemory(input) {
|
|
|
336
329
|
return {};
|
|
337
330
|
};
|
|
338
331
|
if (dual) {
|
|
339
|
-
const personalBackendChosen =
|
|
332
|
+
const personalBackendChosen = memoryPlaneStore("personal", backend, engineRoot);
|
|
340
333
|
{
|
|
341
334
|
const projCtl = effectiveControlRootOf(memoryDir, { pinnedBy: backend, controlDir: projectControlDir });
|
|
342
335
|
const persCtl = effectiveControlRootOf(personalMemoryDir, { pinnedBy: personalBackendChosen, controlDir: personalControlDir });
|
|
@@ -443,7 +436,7 @@ export async function prepareMemory(input) {
|
|
|
443
436
|
};
|
|
444
437
|
}
|
|
445
438
|
else if (personalOnly) {
|
|
446
|
-
const personal = createPersonalEngine(
|
|
439
|
+
const personal = createPersonalEngine(memoryPlaneStore("personal", backend, engineRoot));
|
|
447
440
|
const personalEngine = personal.engine;
|
|
448
441
|
await armCaptureOptOut(personalEngine);
|
|
449
442
|
const handle = await personalEngine.materialize(memorySpec.scopes, memorySpec.writeScope, { adoptionRestricted: adoptionRestricted || captureOptedOut || captureIndeterminate, sessionId });
|
|
@@ -643,7 +636,7 @@ export async function prepareMemory(input) {
|
|
|
643
636
|
if (verdict.faultDisclosure !== undefined)
|
|
644
637
|
deps.onError?.(new Error(verdict.faultDisclosure), { phase: "config", sessionId });
|
|
645
638
|
if (input.captureCarrierUnsupported === true) {
|
|
646
|
-
const e = new Error(`memory capture opt-out cannot be honored on this deployment shape: the execution environment
|
|
639
|
+
const e = new Error(`memory capture opt-out cannot be honored on this deployment shape: the execution environment's paths are not the host's (remote/per-run) ` +
|
|
647
640
|
`and no RunnerDeps.memoryCaptureRecordStore is supplied — the record would not survive to a resume replica. Nothing was recorded.`);
|
|
648
641
|
e.code = "config.memory_capture_unsupported";
|
|
649
642
|
throw e;
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
* Both closures exist exactly when the ask lane and the saga do (the same predicate) — an absent lane answers two absent
|
|
20
20
|
* closures, so the orchestrator grows no branch.
|
|
21
21
|
*/
|
|
22
|
-
import type { AgentHarness, AgentMessage, AgentTool
|
|
22
|
+
import type { AgentHarness, AgentMessage, AgentTool } from "../../internal/harness.js";
|
|
23
23
|
import { type CallTargetStamp } from "../effective-path-target.js";
|
|
24
24
|
import { type OnQuestion } from "../ask-question.js";
|
|
25
25
|
import { type CheckpointStore } from "../checkpoint-store.js";
|
|
26
|
-
import type
|
|
26
|
+
import { type GrantBindingOf } from "../skill-grant-binding.js";
|
|
27
27
|
import type { SessionStore } from "../session.js";
|
|
28
28
|
import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-policy.js";
|
|
29
29
|
import { type ToolResultStore } from "../tool-result-store.js";
|
|
@@ -110,10 +110,8 @@ export interface PrepareParkAskInput {
|
|
|
110
110
|
exemptRoots: readonly string[];
|
|
111
111
|
/** borrowed-readonly — the run's offload store, or undefined (a volatile store holding results refuses the park). */
|
|
112
112
|
offloadStore: ToolResultStore | undefined;
|
|
113
|
-
/** borrowed-readonly — the per-task
|
|
114
|
-
|
|
115
|
-
/** borrowed-readonly — the restore-incomplete adapter's missing members, or undefined (names the actual gap in the refusal). */
|
|
116
|
-
incompleteSuspendAdapter: readonly ("resumeVM" | "postResumeInit")[] | undefined;
|
|
113
|
+
/** borrowed-readonly — why the per-task env is in neither suspend target, or undefined (the park refuses, naming the gap). */
|
|
114
|
+
suspendTargetGap: string | undefined;
|
|
117
115
|
/** borrowed-readonly — the acquired session; `getLeafId` (the resume point) and `buildContext` (the batch position) are read. */
|
|
118
116
|
session: Pick<Prepared["session"], "getLeafId" | "buildContext">;
|
|
119
117
|
/** borrowed-readonly — the session store; only the optional `pin` is called (best-effort, after commit). */
|