@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,6 +1,7 @@
|
|
|
1
1
|
import type { ImageContent } from "../../internal/llm.js";
|
|
2
2
|
import { type HostFloor } from "../host-floor.js";
|
|
3
3
|
import type { ImageInput } from "../types.js";
|
|
4
|
+
import { type ImageDownsampler } from "../image-downsample.js";
|
|
4
5
|
/**
|
|
5
6
|
* The guard of a remote image URL: https only, then the one egress hop judge with the private-network floor (`hopRefusal`,
|
|
6
7
|
* host-floor.ts) — the deployment's host floor (`RunnerDeps.hostFloor`, `floor`) must admit the host, and a private host is
|
|
@@ -8,5 +9,9 @@ import type { ImageInput } from "../types.js";
|
|
|
8
9
|
* `169.254.169.254` or a private box. The host is read literally (no DNS resolution). Throws on a refused URL.
|
|
9
10
|
*/
|
|
10
11
|
export declare function defaultImageUrlGuard(raw: string, floor?: HostFloor): void;
|
|
11
|
-
/** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block
|
|
12
|
-
|
|
12
|
+
/** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block: both arms pass
|
|
13
|
+
* the one byte admission with the run's processor (inline-image.ts) — a fetched body after the URL's own guard and cap. */
|
|
14
|
+
export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined, processor: ImageDownsampler | "none"): Promise<ImageContent>;
|
|
15
|
+
/** The task's images (`TaskSpec.images`), each through {@link toImageContent} with the run's one processor (`seat` =
|
|
16
|
+
* `RunnerDeps.imageProcessor`); the first one sent unprocessed over the soft target is told to `unprocessed`. */
|
|
17
|
+
export declare function toImageContents(images: readonly ImageInput[], floor: HostFloor | undefined, seat: ImageDownsampler | false | undefined, unprocessed: (bytes: number) => void): Promise<ImageContent[]>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { hopRefusal } from "../host-floor.js";
|
|
2
|
-
import {
|
|
2
|
+
import { firstUnprocessedOverTarget, IMAGE_ADMISSION, sniffImageMime } from "../image-admission.js";
|
|
3
|
+
import { resolveImageProcessor } from "../image-downsample.js";
|
|
3
4
|
import { admitInlineImage } from "./inline-image.js";
|
|
4
|
-
function sniffImageMime(bytes) {
|
|
5
|
-
return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
|
|
6
|
-
}
|
|
7
5
|
export function defaultImageUrlGuard(raw, floor) {
|
|
8
6
|
let u;
|
|
9
7
|
try {
|
|
@@ -20,7 +18,7 @@ export function defaultImageUrlGuard(raw, floor) {
|
|
|
20
18
|
throw new Error(`image url not fetched — ${refused}`);
|
|
21
19
|
}
|
|
22
20
|
const IMAGE_FETCH_TIMEOUT_MS = 30_000;
|
|
23
|
-
const IMAGE_MAX_BYTES =
|
|
21
|
+
const IMAGE_MAX_BYTES = IMAGE_ADMISSION.hard.urlBytes;
|
|
24
22
|
async function readImageBodyCapped(res) {
|
|
25
23
|
const reader = res.body?.getReader();
|
|
26
24
|
if (!reader) {
|
|
@@ -67,12 +65,20 @@ async function fetchImageCapped(url) {
|
|
|
67
65
|
}
|
|
68
66
|
return { buf, mimeType: sniffed };
|
|
69
67
|
}
|
|
70
|
-
export async function toImageContent(img, floor) {
|
|
68
|
+
export async function toImageContent(img, floor, processor) {
|
|
71
69
|
if ("url" in img) {
|
|
72
70
|
const url = img.url;
|
|
73
71
|
defaultImageUrlGuard(url, floor);
|
|
74
72
|
const { buf, mimeType } = await fetchImageCapped(url);
|
|
75
|
-
return {
|
|
73
|
+
return admitInlineImage({ data: buf.toString("base64"), mimeType }, processor, "the image fetched from its url");
|
|
76
74
|
}
|
|
77
|
-
return admitInlineImage(img);
|
|
75
|
+
return admitInlineImage(img, processor);
|
|
76
|
+
}
|
|
77
|
+
export async function toImageContents(images, floor, seat, unprocessed) {
|
|
78
|
+
const processor = await resolveImageProcessor(seat);
|
|
79
|
+
const blocks = await Promise.all(images.map((img) => toImageContent(img, floor, processor)));
|
|
80
|
+
const over = firstUnprocessedOverTarget(blocks, processor);
|
|
81
|
+
if (over !== undefined)
|
|
82
|
+
unprocessed(over);
|
|
83
|
+
return blocks;
|
|
78
84
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `TaskSpec.images`
|
|
3
|
-
* (image-admission.ts) — a claimed type the API accepts, within the raw cap, that type's
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The `TaskSpec.images` arms' admission: the same byte admission a file the Read tool serves passes
|
|
3
|
+
* (image-admission.ts), with the run's processor — a claimed type the API accepts, within the raw cap, that type's
|
|
4
|
+
* signature, then the processor (or, with none, a header-stated size within the reject edge), under the provider's
|
|
5
|
+
* base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole request. Like the
|
|
6
|
+
* Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature passes when no processor
|
|
7
|
+
* reads it (KL-1311a-c). The block is built from the bytes that were checked (or the processor made from them).
|
|
8
8
|
*/
|
|
9
9
|
import type { ImageContent } from "../../internal/llm.js";
|
|
10
10
|
import type { ImageInput } from "../types.js";
|
|
11
|
-
|
|
11
|
+
import type { ImageDownsampler } from "../image-downsample.js";
|
|
12
|
+
/** Admit one entry's bytes (`{ data, mimeType }` — inline, or a URL arm's fetched body, `subject` naming which) or throw
|
|
13
|
+
* `config.image_invalid`. */
|
|
12
14
|
export declare function admitInlineImage(img: Extract<ImageInput, {
|
|
13
15
|
data: string;
|
|
14
|
-
}
|
|
16
|
+
}>, processor: ImageDownsampler | "none", subject?: string): Promise<ImageContent>;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
|
|
2
|
-
import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
|
|
1
|
+
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES, IMAGE_ADMISSION, unprocessedSizeClause } from "../image-admission.js";
|
|
3
2
|
function inlineImageRefusal(detail) {
|
|
4
3
|
const e = new Error(`TaskSpec.images: ${detail}`);
|
|
5
4
|
e.code = "config.image_invalid";
|
|
6
5
|
return e;
|
|
7
6
|
}
|
|
8
|
-
export async function admitInlineImage(img) {
|
|
7
|
+
export async function admitInlineImage(img, processor, subject = "an inline image") {
|
|
9
8
|
const data = img.data;
|
|
10
9
|
const mimeType = img.mimeType;
|
|
11
10
|
if (typeof data !== "string" || typeof mimeType !== "string")
|
|
12
|
-
throw inlineImageRefusal(
|
|
13
|
-
const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType,
|
|
11
|
+
throw inlineImageRefusal(`${subject} needs a base64 string \`data\` and a string \`mimeType\`.`);
|
|
12
|
+
const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, processor);
|
|
14
13
|
if (admitted.ok)
|
|
15
14
|
return admitted.block;
|
|
16
15
|
switch (admitted.reason) {
|
|
17
16
|
case "mime_unsupported":
|
|
18
|
-
throw inlineImageRefusal(
|
|
17
|
+
throw inlineImageRefusal(`${subject} declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
|
|
19
18
|
case "magic_mismatch":
|
|
20
|
-
throw inlineImageRefusal(
|
|
19
|
+
throw inlineImageRefusal(`${subject}'s bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
|
|
21
20
|
case "raw_too_large":
|
|
22
|
-
throw inlineImageRefusal(
|
|
21
|
+
throw inlineImageRefusal(`${subject} is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
|
|
22
|
+
case "dimensions_unreadable":
|
|
23
|
+
case "dimensions_too_large":
|
|
24
|
+
throw inlineImageRefusal(`${subject} is refused rather than sent: ${unprocessedSizeClause(admitted)}.`);
|
|
23
25
|
case "base64_too_large":
|
|
24
|
-
throw inlineImageRefusal(
|
|
26
|
+
throw inlineImageRefusal(`${subject}'s base64 is ${admitted.base64.length} chars, over the ${IMAGE_ADMISSION.hard.imageBase64Chars}-char / 5MB API image limit — shrink it before sending.`);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brainToRuntime } from "../runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { catalogOfDeps, roleModelIfSet, unheldChainRefusal } from "../roles.js";
|
|
3
3
|
import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
|
|
4
4
|
import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
|
|
5
5
|
import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
|
|
@@ -26,10 +26,10 @@ export function resolveMemoryConsolidationDriver(deps) {
|
|
|
26
26
|
model = seat.chat.model;
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
const models =
|
|
29
|
+
const models = catalogOfDeps(deps);
|
|
30
30
|
const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
|
|
31
31
|
if (resolved === undefined) {
|
|
32
|
-
throw seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
|
|
32
|
+
throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
|
|
33
33
|
}
|
|
34
34
|
if (isAliasModelId(resolved.id)) {
|
|
35
35
|
throw seatRefusal(`the resolved consolidation model id ${JSON.stringify(resolved.id)} is an alias spelling — an alias can be re-pointed upstream and would move the run with no trace in the archive; bind an explicit id.`);
|
|
@@ -65,7 +65,7 @@ export function resolveMemoryConsolidationDriver(deps) {
|
|
|
65
65
|
export function consolidationSeatResolvable(deps) {
|
|
66
66
|
if (deps.memoryConsolidationDriver?.chat !== undefined)
|
|
67
67
|
return true;
|
|
68
|
-
const models =
|
|
68
|
+
const models = catalogOfDeps(deps);
|
|
69
69
|
return (roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles })) !== undefined;
|
|
70
70
|
}
|
|
71
71
|
export function autoRunConsolidationFromRecommendation(args) {
|
|
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
|
|
|
116
116
|
throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
|
|
117
117
|
}
|
|
118
118
|
if (!consolidationSeatResolvable(deps)) {
|
|
119
|
-
throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
|
|
119
|
+
throw unheldChainRefusal(["consolidate", "summarize"], catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* numbers, and the driver keeps reaching down for the marker its harness stamps. Pure: no engine state; the only clock
|
|
7
7
|
* is the caller's.
|
|
8
8
|
*/
|
|
9
|
-
import type
|
|
9
|
+
import { type CheckpointGate, type CheckpointToken, type PendingAction } from "../checkpoint-store.js";
|
|
10
10
|
import type { WorkspaceHandle } from "../remote-env.js";
|
|
11
11
|
import type { Prepared } from "./contracts.js";
|
|
12
12
|
/** Default resource-checkpoint retention (30 days, the spec's
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { planReviewRequesterOf } from "../checkpoint-store.js";
|
|
1
2
|
export const DEFAULT_RESOURCE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
2
3
|
export const USAGE_WINDOW_REAP_MARGIN_MS = 60 * 60 * 1000;
|
|
3
4
|
export const DEFAULT_UNATTENDED_APPROVAL_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
@@ -16,12 +17,14 @@ export function parkContaminationMarker(refs) {
|
|
|
16
17
|
return { code: "gate.parked", ...(gatedCallId !== undefined ? { gatedCallId } : {}) };
|
|
17
18
|
}
|
|
18
19
|
export function publishCommittedSuspend(refs, token, gate, scope, remoteHandle, checkpointId, pendingAction) {
|
|
20
|
+
const requestedByCallId = pendingAction !== undefined ? planReviewRequesterOf(pendingAction) : undefined;
|
|
19
21
|
const pause = {
|
|
20
22
|
cause: {
|
|
21
23
|
kind: "paused",
|
|
22
24
|
gate,
|
|
23
25
|
token,
|
|
24
26
|
...(checkpointId !== undefined ? { checkpointId } : {}),
|
|
27
|
+
...(requestedByCallId !== undefined ? { requestedByCallId } : {}),
|
|
25
28
|
...(remoteHandle !== undefined ? { restoreMode: remoteHandle.restoreMode === "park_only" ? "park_only" : "snapshot" } : {}),
|
|
26
29
|
},
|
|
27
30
|
scope,
|
|
@@ -123,7 +123,7 @@ export function createPermissionRuleLanes(cfg) {
|
|
|
123
123
|
if (!judged.some(([, g]) => g === "path") && faceRowsSpeakFor(callPathFaceOf(req)))
|
|
124
124
|
judged.push([req.toolName, "path"]);
|
|
125
125
|
const view = await reader.pin(req.toolCallId, req.args);
|
|
126
|
-
const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req);
|
|
126
|
+
const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req, r.behavior);
|
|
127
127
|
if (judged.length === 0 && !view.rules.some(ownRow))
|
|
128
128
|
return view.unreadable !== undefined ? { unreadable: true } : undefined;
|
|
129
129
|
try {
|
|
@@ -7,7 +7,7 @@ import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-polic
|
|
|
7
7
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
8
8
|
import type { CwdRef } from "../../tools/fs/fs-shared.js";
|
|
9
9
|
import type { AskLane, Prepared } from "./contracts.js";
|
|
10
|
-
import type
|
|
10
|
+
import { type GrantBindingOf } from "../skill-grant-binding.js";
|
|
11
11
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
12
12
|
import { type GrantReadRoot } from "./read-root-grant.js";
|
|
13
13
|
import type { createRuleOffersOf } from "./permission-rule-lanes.js";
|
|
@@ -8,6 +8,7 @@ import { failedJudgmentDeny, policyCheckAbortedDeny } from "./policy-throw.js";
|
|
|
8
8
|
import { askMandateMember } from "../ask-origin.js";
|
|
9
9
|
import { approvalCardMemberOf, survivorsByName } from "../tool-roster.js";
|
|
10
10
|
import { toolNameIndex } from "../../internal/llm.js";
|
|
11
|
+
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
11
12
|
import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
|
|
12
13
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
13
14
|
import { requesterOf } from "../mods/extension-call.js";
|
|
@@ -61,7 +62,7 @@ export function prepareAskLane(input) {
|
|
|
61
62
|
const adjudicate = effectivePolicy
|
|
62
63
|
? async (req, callSignal) => {
|
|
63
64
|
const signal = composedCallSignal(callSignal);
|
|
64
|
-
const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots) });
|
|
65
|
+
const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots), ...requestGrantBinding(grantBindingOf, req, req.args) });
|
|
65
66
|
const judged = (async () => {
|
|
66
67
|
const withReading = stampCallTarget?.(stampedReq(), signal);
|
|
67
68
|
return withReading === undefined ? effectivePolicy.check(stampedReq(), signal) : effectivePolicy.check(await withReading, signal);
|
|
@@ -84,8 +84,8 @@ export interface PrepareBoundaryParksInput {
|
|
|
84
84
|
resourceSuspendEligible: boolean;
|
|
85
85
|
/** borrowed-readonly — the wiring-manifest phase's durable-infra predicate: exposes `suspendForPlatformLimit`. */
|
|
86
86
|
durableSuspendInfraReady: boolean;
|
|
87
|
-
/** borrowed-readonly — the
|
|
88
|
-
|
|
87
|
+
/** borrowed-readonly — why the per-task remote env is in neither suspend target, or undefined (the review lane refuses loudly). */
|
|
88
|
+
suspendTargetGap: string | undefined;
|
|
89
89
|
}
|
|
90
90
|
export interface PrepareBoundaryParksResult {
|
|
91
91
|
/** owned — the task-axis resource lane (`Prepared.suspendForResource`), or undefined (no opt-in / no infra / inactive). */
|
|
@@ -4,7 +4,7 @@ import { defaultTaskRegistry } from "../task-registry.js";
|
|
|
4
4
|
import { DEFAULT_RESOURCE_TTL_MS, publishCommittedSuspend, sanitizedTtlMs, USAGE_WINDOW_REAP_MARGIN_MS } from "./park-commit.js";
|
|
5
5
|
import { remoteEnvFailureNote } from "./remote-env-retry.js";
|
|
6
6
|
export function prepareBoundaryParks(input) {
|
|
7
|
-
const { saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady,
|
|
7
|
+
const { saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap } = input;
|
|
8
8
|
if (saga === undefined)
|
|
9
9
|
return { suspendForResource: undefined, suspendForPlatformLimit: undefined, suspendForReview: undefined };
|
|
10
10
|
const { inFlightSpendMicroUsd, serializeCheckpointState, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle } = saga;
|
|
@@ -78,14 +78,14 @@ export function prepareBoundaryParks(input) {
|
|
|
78
78
|
const suspendForResource = resourceSuspendEligible ? mintResourceSuspend : undefined;
|
|
79
79
|
const suspendForPlatformLimit = durableSuspendInfraReady ? mintResourceSuspend : undefined;
|
|
80
80
|
const suspendForReview = checkpointStore
|
|
81
|
-
? async (reason) => {
|
|
81
|
+
? async (reason, requestedByCallId) => {
|
|
82
82
|
if (!checkpointStore)
|
|
83
83
|
return false;
|
|
84
84
|
if (abortController.signal.aborted)
|
|
85
85
|
return false;
|
|
86
|
-
if (
|
|
86
|
+
if (suspendTargetGap !== undefined) {
|
|
87
87
|
try {
|
|
88
|
-
deps.onError?.(new Error(`plan_review park skipped: the per-task execution env
|
|
88
|
+
deps.onError?.(new Error(`plan_review park skipped: the per-task execution env ${suspendTargetGap}, so its workspace could not be restored on resume (the plan-review request was dropped; the run continues without pausing)`), { phase: "config", sessionId });
|
|
89
89
|
}
|
|
90
90
|
catch {
|
|
91
91
|
}
|
|
@@ -133,7 +133,7 @@ export function prepareBoundaryParks(input) {
|
|
|
133
133
|
sessionId,
|
|
134
134
|
leafId,
|
|
135
135
|
gate,
|
|
136
|
-
pendingAction: { kind: "plan_review" },
|
|
136
|
+
pendingAction: { kind: "plan_review", ...(requestedByCallId !== undefined && requestedByCallId !== "" ? { requestedByCallId } : {}) },
|
|
137
137
|
state: serializeCheckpointState(remoteHandle, inFlightSpendMicroUsd()),
|
|
138
138
|
status: "pending",
|
|
139
139
|
createdAt: mintedAt,
|
|
@@ -75,8 +75,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
75
75
|
model: Model;
|
|
76
76
|
/** borrowed-readonly — the run's resolved thinking level, when one is (the Workflow mount's parentThinking fallback). */
|
|
77
77
|
thinking: ThinkingLevel | undefined;
|
|
78
|
-
/** borrowed-readonly — the frozen preflight; only `mcp` (the compliance veto's mcp_servers conflict
|
|
79
|
-
lockedPreflight: Pick<LockedPreflight, "mcp">;
|
|
78
|
+
/** borrowed-readonly — the frozen preflight; only `mcp` and `a2a` (the compliance veto's mcp_servers / a2a_peers conflict checks). */
|
|
79
|
+
lockedPreflight: Pick<LockedPreflight, "mcp" | "a2a">;
|
|
80
80
|
/** borrowed-mutable — the effect collection (`Prepared.toolEffects`): the safety scan's caller entries, then the mounts' writes. */
|
|
81
81
|
toolEffects: Prepared["toolEffects"];
|
|
82
82
|
/** borrowed-readonly — the frozen tool-face snapshot the Workflow mount forwards (exclude / defer / alwaysLoad / restoreGated). */
|
|
@@ -105,10 +105,10 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
105
105
|
offload?: boolean;
|
|
106
106
|
offloadThresholdChars?: number;
|
|
107
107
|
}) => AgentTool;
|
|
108
|
+
/** borrowed-readonly — where a workflow run's full record is stored when its completion carries less (the driver's one mint). */
|
|
109
|
+
taskArtifacts: import("../tool-result-store.js").TaskArtifactSeat | undefined;
|
|
108
110
|
/** borrowed-readonly — the plan-review primitive the ExitPlanMode tool calls. */
|
|
109
|
-
requestReview: (opts?:
|
|
110
|
-
reason?: string;
|
|
111
|
-
}) => void;
|
|
111
|
+
requestReview: (opts?: import("../present-plan-tool.js").ReviewRequest) => void;
|
|
112
112
|
/** borrowed-readonly — the declared session plan file as ExitPlanMode's FILE arm reads it (absent ⇒ the parameter arm). */ planFileSource?: PlanFileSource;
|
|
113
113
|
/** borrowed-readonly — the plan-mode primitive the EnterPlanMode tool calls: a steer of the leg's mode seat into `plan`. */
|
|
114
114
|
enterPlanMode: () => Promise<void>;
|
|
@@ -146,6 +146,8 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
146
146
|
artifact: PromptArtifact;
|
|
147
147
|
sourceRevision?: string;
|
|
148
148
|
} | undefined;
|
|
149
|
+
/** borrowed-readonly — LATE-BOUND: the leg's agent stations; the Workflow mount's getter reads them at ITS call time. */
|
|
150
|
+
agentStations: () => import("../mods/agent-stations.js").AgentStations | undefined;
|
|
149
151
|
}
|
|
150
152
|
export interface PrepareCapsAndWorkflowResult {
|
|
151
153
|
/** owned — THE run's roster BUILDER (the mount array is private to it; `Prepared.tools` is its read face,
|
|
@@ -117,7 +117,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
|
|
|
117
117
|
return { armed: true, reason: "armed" };
|
|
118
118
|
}
|
|
119
119
|
export async function prepareCapsAndWorkflow(input) {
|
|
120
|
-
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
|
|
120
|
+
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
|
|
121
121
|
const roster = new RosterBuilder(toolEffects);
|
|
122
122
|
for (const t of spec.tools ?? []) {
|
|
123
123
|
const mounted = mountCallerTool(t);
|
|
@@ -196,6 +196,8 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
196
196
|
if (complianceDenies.has("mcp_servers") && lockedPreflight.mcp?.length) {
|
|
197
197
|
complianceRefuse("mcp_servers", "TaskSpec.mcp (MCP server materialization)");
|
|
198
198
|
}
|
|
199
|
+
if (complianceDenies.has("a2a_peers") && lockedPreflight.a2a?.length)
|
|
200
|
+
complianceRefuse("a2a_peers", "TaskSpec.a2a (A2A peer materialization)");
|
|
199
201
|
if (complianceDenies.has("workflows") && spec.selfOrchestration === true) {
|
|
200
202
|
complianceRefuse("workflows", "TaskSpec.selfOrchestration (workflow self-orchestration)");
|
|
201
203
|
}
|
|
@@ -236,7 +238,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
236
238
|
const classifierRungs = classifierLadderRungs(am.classifierFallback, classifierModel, model);
|
|
237
239
|
const denialTracking = createAutoModeDenialTracker(am.denialLimit);
|
|
238
240
|
const decider = createAutoModeDecider({
|
|
239
|
-
...(am.timeoutMs !== undefined ? { timeoutMs: am.timeoutMs } : {}),
|
|
241
|
+
...(am.timeoutMs !== undefined ? { timeoutMs: am.timeoutMs } : {}), ...(am.rateLimitBreakAfter !== undefined ? { rateLimitBreakAfter: am.rateLimitBreakAfter } : {}),
|
|
240
242
|
candidates: classifierRungs.map((m) => m.id),
|
|
241
243
|
onClassified: classifierRoundObserver({ tracer: deps.tracer, onNotice: deps.onNotice, taskId: hostTaskId, seatModelId: classifierModel.id, ...(sessionId !== undefined ? { sessionId } : {}), ...(runId !== undefined ? { runId } : {}) }),
|
|
242
244
|
assemble: async (input) => {
|
|
@@ -331,7 +333,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
331
333
|
originatingSessionId: sessionId,
|
|
332
334
|
rootSessionId: internals?.rootSessionId ?? sessionId, ...(internals?.placementRoot !== undefined ? { placementRoot: internals.placementRoot } : {}), crossBoundaryTree: input.crossBoundaryTree,
|
|
333
335
|
taskRegistry: defaultTaskRegistry,
|
|
334
|
-
taskNotification: internals?.onTaskNotification,
|
|
336
|
+
taskNotification: internals?.onTaskNotification, ...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
|
|
335
337
|
taskOwner: hostTaskId,
|
|
336
338
|
limits: deps.workflowLimits,
|
|
337
339
|
sourceTaskId: hostTaskId,
|
|
@@ -362,6 +364,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
362
364
|
return assembleParentCaptureState(co?.optedOut() ?? false, co?.indeterminate() ?? false, ctl, [...(internals?.memoryCaptureAncestors ?? []), { sessionId, ...(ctl !== undefined ? { controlDir: ctl } : {}) }]);
|
|
363
365
|
},
|
|
364
366
|
autoModeReview: () => (autoModeDeciderRef.current !== undefined ? { decider: autoModeDeciderRef.current } : undefined),
|
|
367
|
+
agentStations: input.agentStations,
|
|
365
368
|
workflowDepth: internals?.workflowDepth,
|
|
366
369
|
parentCwd: taskRootFinal,
|
|
367
370
|
parentThinking: () => childThinkingSeat(undefined, deploymentSubagentThinking(runnerSelf.agentCatalog?.roles), harnessRef.current?.getThinkingLevel() ?? thinking).thinking,
|
|
@@ -26,7 +26,7 @@ import { type CrossBoundaryPosture } from "../cross-boundary-taint.js";
|
|
|
26
26
|
import { type HostFloor } from "../host-floor.js";
|
|
27
27
|
import { type CheckpointState } from "../checkpoint-store.js";
|
|
28
28
|
import { runOriginOfLeg, type RunOrigin } from "../run-origin.js";
|
|
29
|
-
import { type ConfigDoorEntry, type LockedPreflight } from "../locked-config.js";
|
|
29
|
+
import { type ConfigDoorEntry, type LockedPreflight, type ReceivedPeerDeclarations } from "../locked-config.js";
|
|
30
30
|
import { type ResolvedRole } from "../roles.js";
|
|
31
31
|
import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
|
|
32
32
|
import type { SessionStore } from "../session.js";
|
|
@@ -133,6 +133,8 @@ export interface PrepareConfigDoorsResult {
|
|
|
133
133
|
* `spec.agents` was set, in which case it is a shallow copy whose `tools` is the
|
|
134
134
|
* withAgents-rebuilt roster. Every later phase (the safety scan above all — T21) must read THIS, never the original input. */
|
|
135
135
|
spec: RosterSpec;
|
|
136
|
+
/** The deps the leg reads from here on: the caller's, with the deployment role map's one receipt in place of the live map. */
|
|
137
|
+
deps: RunnerDeps;
|
|
136
138
|
/** owned — the frozen task-start copies of the caller's tool-face control arrays; the driver compiles the leg's selector
|
|
137
139
|
* from them, and the selector (with the disclosure lists) is the ONLY thing later face reads consult. Frozen-immutable. */
|
|
138
140
|
toolFaceLists: ToolFaceLists;
|
|
@@ -243,6 +245,8 @@ type ConfigValueDoorsResult = Pick<PrepareConfigDoorsResult, "toolFaceLists" | "
|
|
|
243
245
|
};
|
|
244
246
|
skills: TaskSpec["skills"];
|
|
245
247
|
projectMemory: TaskSpec["projectMemory"];
|
|
248
|
+
deploymentRoles: RunnerDeps["roles"];
|
|
249
|
+
taskRoles: TaskSpec["roles"];
|
|
246
250
|
};
|
|
247
251
|
/**
|
|
248
252
|
* The phase's VALUE doors as ONE function with two callers — each judges a declared value against its own vocabulary, reading only the
|
|
@@ -259,6 +263,7 @@ export declare function configValueDoors(input: {
|
|
|
259
263
|
sessions: SessionStore;
|
|
260
264
|
holder?: string | undefined;
|
|
261
265
|
resumedRow?: Parameters<typeof runOriginOfLeg>[1];
|
|
266
|
+
receivedPeers?: ReceivedPeerDeclarations;
|
|
262
267
|
}, enter?: ConfigDoorEntry): ConfigValueDoorsResult;
|
|
263
268
|
/**
|
|
264
269
|
* The doors a RESUMED leg's prepare refuses at, run as one screen BEFORE the claim — prepare's own functions, so a refusal carries
|
|
@@ -29,7 +29,7 @@ import { effectiveTraitsOf, readModelPromptTraits, resolveHost, resolvePromptLea
|
|
|
29
29
|
import { assertNoRetiredKeys, RETIRED_MODEL_KEYS } from "../retired-keys.js";
|
|
30
30
|
import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
|
|
31
31
|
import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
|
|
32
|
-
import { snapshotDefinitionLists } from "../../agents/
|
|
32
|
+
import { snapshotDefinitionLists } from "../../agents/agent-definition.js";
|
|
33
33
|
import { mcpUnavailableOn, TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
34
34
|
import { refuseRetiredMember, rosterFaceOf } from "./caller-roster.js";
|
|
35
35
|
import { assertToolBoundaryLegs } from "../tool-roster.js";
|
|
@@ -183,7 +183,8 @@ export function assertResumeConfigRecord(config) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
186
|
-
const { spec,
|
|
186
|
+
const { spec, resumeLeg, sessions, holder } = input;
|
|
187
|
+
let deps = input.deps;
|
|
187
188
|
enter("deps", () => assertNoRetiredRunnerDeps(deps));
|
|
188
189
|
enter("taskConfig", () => assertPrincipalValue(spec.principal));
|
|
189
190
|
const runOrigin = enter("taskConfig", () => runOriginOfLeg(spec.runOrigin, input.resumedRow));
|
|
@@ -225,8 +226,10 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
225
226
|
: undefined,
|
|
226
227
|
};
|
|
227
228
|
const promptHost = enter("taskConfig", () => resolveHost(spec));
|
|
228
|
-
enter("deps", () => screenRoleMap(deps.roles, "RunnerDeps.roles"));
|
|
229
|
-
|
|
229
|
+
const deploymentRoles = enter("deps", () => screenRoleMap(deps.roles, "RunnerDeps.roles"));
|
|
230
|
+
if (deploymentRoles !== undefined)
|
|
231
|
+
deps = { ...deps, roles: deploymentRoles };
|
|
232
|
+
const taskRoles = enter("taskConfig", () => screenRoleMap(spec.roles, "TaskSpec.roles"));
|
|
230
233
|
const promptBinding = enter("taskConfig", () => resolvePromptBinding(spec));
|
|
231
234
|
const promptLean = enter("taskConfig", () => resolvePromptLean(spec));
|
|
232
235
|
if (spec.resumeAt !== undefined)
|
|
@@ -282,6 +285,8 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
282
285
|
e.code = "config.memory_persistence_invalid";
|
|
283
286
|
throw e;
|
|
284
287
|
});
|
|
288
|
+
if (spec.classifyAllShell !== undefined && typeof spec.classifyAllShell !== "boolean")
|
|
289
|
+
enter("taskConfig", () => { throw limitConfigError("config.invalid_argument", `TaskSpec.classifyAllShell must be a boolean when present (got ${describeRejectedValue(spec.classifyAllShell)}) — true lets no shell allow entry clear a call in auto mode; omit the key for the default.`); });
|
|
285
290
|
if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false)
|
|
286
291
|
enter("taskConfig", () => {
|
|
287
292
|
const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
|
|
@@ -295,7 +300,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
295
300
|
e.code = "config.empty_objective";
|
|
296
301
|
throw e;
|
|
297
302
|
}
|
|
298
|
-
const lockedPreflight = preflightLockedConfig(spec, deps, enter);
|
|
303
|
+
const lockedPreflight = preflightLockedConfig(spec, deps, enter, input.receivedPeers);
|
|
299
304
|
const declaredSkills = spec.skills;
|
|
300
305
|
const skills = declaredSkills === undefined ? undefined : enter("taskConfig", () => readSkillsSeat(declaredSkills));
|
|
301
306
|
enter("deps", () => screenHandsBandOptions(deps.hands));
|
|
@@ -340,7 +345,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
|
|
|
340
345
|
}));
|
|
341
346
|
if (taskStore !== undefined)
|
|
342
347
|
enter("taskConfig", () => assertRetentionWords({ ...retention, stores: [{ name: "checkpointStore", store: taskStore }] }));
|
|
343
|
-
return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin };
|
|
348
|
+
return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, deploymentRoles, taskRoles };
|
|
344
349
|
}
|
|
345
350
|
export function refuseResumeDoors(config, recorded, deps, sessions, holder) {
|
|
346
351
|
asResumeConfigRefusal("taskConfig", () => {
|
|
@@ -357,13 +362,14 @@ export function refuseResumeDoors(config, recorded, deps, sessions, holder) {
|
|
|
357
362
|
return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
|
|
358
363
|
}
|
|
359
364
|
export function prepareConfigDoors(input) {
|
|
360
|
-
const {
|
|
365
|
+
const { sessions, resume, internals } = input;
|
|
361
366
|
assertToolBoundaryLegs(input.spec.tools);
|
|
362
367
|
assertToolCardDeclarations(input.spec.tools);
|
|
363
368
|
let spec = input.spec;
|
|
364
|
-
const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin } = configValueDoors({ spec, deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
|
|
369
|
+
const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, deploymentRoles, taskRoles } = configValueDoors({ spec, deps: input.deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, ...(internals?.receivedPeers !== undefined ? { receivedPeers: internals.receivedPeers } : {}), ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
|
|
365
370
|
const doorRead = (value) => ({ value, enumerable: value !== undefined, writable: false, configurable: false });
|
|
366
|
-
|
|
371
|
+
const deps = deploymentRoles !== undefined ? { ...input.deps, roles: deploymentRoles } : input.deps;
|
|
372
|
+
spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: doorRead(skills), projectMemory: doorRead(projectMemory), runOrigin: doorRead(runOrigin), ...(taskRoles !== undefined ? { roles: doorRead(taskRoles) } : {}) });
|
|
367
373
|
const resolvedInteractionPosture = spec.interactionPosture ?? internals?.parentInteractionPosture ?? deps.interactionPosture;
|
|
368
374
|
const askSeat = resolveAskSeat(spec, deps);
|
|
369
375
|
{
|
|
@@ -490,6 +496,7 @@ export function prepareConfigDoors(input) {
|
|
|
490
496
|
const compModel = resolveCompactionModel(spec, deps, "TaskSpec.compactionModel");
|
|
491
497
|
return {
|
|
492
498
|
spec,
|
|
499
|
+
deps,
|
|
493
500
|
toolFaceLists,
|
|
494
501
|
promptLean,
|
|
495
502
|
promptTraits,
|
|
@@ -12,6 +12,7 @@ import { applyGitFrameGuard } from "./git-status-frame.js";
|
|
|
12
12
|
import { applyContextShrinkToReadFileState } from "../../tools/fs/index.js";
|
|
13
13
|
import { rosterToolName } from "../tool-roster.js";
|
|
14
14
|
import { createToolTurnRepairSeat } from "./tool-turn-repair-seat.js";
|
|
15
|
+
import { createImageRemovedSeat } from "./image-removed-seat.js";
|
|
15
16
|
export function prepareContextLane(input) {
|
|
16
17
|
const { model, deps, sessionId, runId, hostTaskId, offloadStore, toolRosterDeltas, microCompactKnob, harness, batchHaltRef, gitStatusRef, postureFrameRef, requestLossyRef, trimPressureRef, readFileState } = input;
|
|
17
18
|
const toolNameOf = (recorded) => rosterToolName(toolRosterDeltas.current, recorded);
|
|
@@ -29,6 +30,7 @@ export function prepareContextLane(input) {
|
|
|
29
30
|
requestLossyRef.current = true;
|
|
30
31
|
announceRepairs(repairs);
|
|
31
32
|
};
|
|
33
|
+
harness.onImagesRemoved = createImageRemovedSeat((notice) => deps.onNotice?.(notice), { sessionId, runId });
|
|
32
34
|
harness.on("context", async ({ messages, recheck, signal }) => {
|
|
33
35
|
batchHaltRef.current = undefined;
|
|
34
36
|
const pendingProjectionObservations = [];
|
|
@@ -20,6 +20,7 @@ import type { AgentTool, ExecutionEnv, WorkspaceState } from "../../internal/har
|
|
|
20
20
|
import { type PeerLaneRefs } from "../../agents/peer-session-drain.js";
|
|
21
21
|
import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
|
|
22
22
|
import type { ShellReadAdmission } from "../../tools/fs/shell-read-check.js";
|
|
23
|
+
import type { ReadFloorSeat } from "../../tools/fs/read-floor.js";
|
|
23
24
|
import { type WorktreeSessionRef } from "../../tools/worktree.js";
|
|
24
25
|
import type { CwdRef } from "../../tools/fs/index.js";
|
|
25
26
|
import { type ToolResultStore } from "../tool-result-store.js";
|
|
@@ -28,9 +29,9 @@ import type { PrepareResume, RunInternals, RunnerSelfSeat, ToolFaceSnapshot } fr
|
|
|
28
29
|
import { RosterBuilder } from "../tool-roster.js";
|
|
29
30
|
export interface PrepareDelegationSurfaceInput {
|
|
30
31
|
/** borrowed-readonly — the REBOUND spec. Read: `tools` (the shadow checks and the revival spawner's delegation-tool
|
|
31
|
-
* lookup), `
|
|
32
|
-
*
|
|
33
|
-
spec: Pick<TaskSpec, "tools" | "
|
|
32
|
+
* lookup), `retainBackgroundProcesses` (the Monitor receipt), `handsReadOnly` is NOT read here (the hands mount
|
|
33
|
+
* decided the surface). Never mutated. */
|
|
34
|
+
spec: Pick<TaskSpec, "tools" | "retainBackgroundProcesses" | "excludeAllTools">;
|
|
34
35
|
/** borrowed-readonly — the deployment seats the mounts read: `workflowRunStore` / `backgroundAgentStore` / `mailboxStore` (the
|
|
35
36
|
* read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `peerChannel`, `onNotice`,
|
|
36
37
|
* `onBackgroundChildEvent`, `tracer`. */
|
|
@@ -61,6 +62,9 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
61
62
|
backgroundTaskToolsActive: boolean;
|
|
62
63
|
/** borrowed-readonly — this run's shell read station's pre-spawn ADMISSION (declared at the hands phase), for `Monitor`: the only P11 face that spawns a shell command. */
|
|
63
64
|
shellReadAdmission: ShellReadAdmission | undefined;
|
|
65
|
+
/** borrowed-readonly — the byte floor's seat over the run's read-deny table (declared at the hands phase), for `Monitor`:
|
|
66
|
+
* the watched command's start carries the table to the environment, as the band's shell starts do. */
|
|
67
|
+
shellReadFloor: ReadFloorSeat | undefined;
|
|
64
68
|
/** borrowed-readonly — the door's second half: the Workflow tool is on the roster. */
|
|
65
69
|
workflowToolsActive: boolean;
|
|
66
70
|
/** borrowed-readonly — the peer lane's mount verdict for this leg. */
|
|
@@ -95,6 +99,8 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
95
99
|
/** borrowed-readonly — the run's offload store, or undefined when offload is disabled (then no reader mounts and the
|
|
96
100
|
* read/kill faces spill nowhere). */
|
|
97
101
|
offloadStore: ToolResultStore | undefined;
|
|
102
|
+
/** borrowed-readonly — where a cut completion's full result is stored (the driver's one mint over `offloadStore`). */
|
|
103
|
+
taskArtifacts: import("../tool-result-store.js").TaskArtifactSeat | undefined;
|
|
98
104
|
/** borrowed-readonly — the retain ledger the SendMessage mount continues children through (absent ⇒ honest not-retained). */
|
|
99
105
|
subagentRetain: SubagentRetainLedger | undefined;
|
|
100
106
|
/** borrowed-readonly — the caller-tool ctx enrichment: the revival spawner re-enters the delegation tool through it, and
|
|
@@ -13,7 +13,7 @@ import { deliverEngineNotice } from "../types.js";
|
|
|
13
13
|
import { RosterBuilder } from "../tool-roster.js";
|
|
14
14
|
import { sendMessageContinuationSeats } from "./send-message-continuation.js";
|
|
15
15
|
export function prepareDelegationSurface(input) {
|
|
16
|
-
const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
|
|
16
|
+
const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
|
|
17
17
|
let worktreeSessionRef;
|
|
18
18
|
const delegationSurfaceActive = backgroundTaskToolsActive || workflowToolsActive;
|
|
19
19
|
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
@@ -21,7 +21,7 @@ export function prepareDelegationSurface(input) {
|
|
|
21
21
|
if (delegationSurfaceActive || internals?.parentNotify !== undefined || peerLaneActive) {
|
|
22
22
|
if (delegationSurfaceActive) {
|
|
23
23
|
roster.mountAll([
|
|
24
|
-
firstPartyOffload(createTaskOutputTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore, notificationWired: internals?.onTaskNotification !== undefined,
|
|
24
|
+
firstPartyOffload(createTaskOutputTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore, notificationWired: internals?.onTaskNotification !== undefined, toolResultStore: offloadStore, ...(checkpointSeat !== undefined ? { checkpointSeat } : {}) })),
|
|
25
25
|
firstPartyOffload(createTaskStopTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore })),
|
|
26
26
|
], { source: "builtin", mountedBy: "delegation" });
|
|
27
27
|
}
|
|
@@ -36,7 +36,7 @@ export function prepareDelegationSurface(input) {
|
|
|
36
36
|
owner: hostTaskId,
|
|
37
37
|
scope: taskScope,
|
|
38
38
|
...(sessionId !== undefined ? { sessionId } : {}),
|
|
39
|
-
...(internals?.onTaskNotification !== undefined ? { notify: internals.onTaskNotification } : {}), ...(
|
|
39
|
+
...(internals?.onTaskNotification !== undefined ? { notify: internals.onTaskNotification } : {}), ...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
|
|
40
40
|
...(internals?.onSubagentSpawn !== undefined ? { sink: internals.onSubagentSpawn } : {}),
|
|
41
41
|
...(internals?.parentNotify !== undefined
|
|
42
42
|
? { uplink: internals.parentNotify, ...(internals.parentPeerRef !== undefined ? { uplinkRecipient: internals.parentPeerRef } : {}) }
|
|
@@ -93,6 +93,7 @@ export function prepareDelegationSurface(input) {
|
|
|
93
93
|
roster.mount(firstPartyOffload(createMonitorTool(executionEnv, {
|
|
94
94
|
registry: defaultTaskRegistry,
|
|
95
95
|
...(input.shellReadAdmission !== undefined ? { shellReadAdmission: input.shellReadAdmission } : {}),
|
|
96
|
+
...(input.shellReadFloor !== undefined ? { readFloor: input.shellReadFloor } : {}),
|
|
96
97
|
owner: hostTaskId,
|
|
97
98
|
scope: taskScope,
|
|
98
99
|
...(sessionId !== undefined ? { sessionId } : {}),
|
|
@@ -125,6 +126,6 @@ export function prepareDelegationSurface(input) {
|
|
|
125
126
|
roster.mountAll(createWorktreeTools(executionEnv, { repoRoot: taskRootFinal, cwdRef: handsCwdRef, session: worktreeSessionRef }).map((t) => (envHandToolNames.add(t.name), firstPartyOffload(t))), { source: "builtin", mountedBy: "hands" });
|
|
126
127
|
}
|
|
127
128
|
if (offloadStore)
|
|
128
|
-
roster.mount(createReadToolResultTool(offloadStore), { source: "builtin", mountedBy: "optional" });
|
|
129
|
+
roster.mount(createReadToolResultTool(offloadStore, (ref, tree) => defaultTaskRegistry.artifactBoundaryLegs(ref, { owner: hostTaskId, scope: taskScope, sessionId }, tree)), { source: "builtin", mountedBy: "optional" });
|
|
129
130
|
return { delegationSurfaceActive, worktreeSessionRef };
|
|
130
131
|
}
|