@sema-agent/core 7.58.0 → 7.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
package/dist/core/tool-spec.d.ts
CHANGED
|
@@ -192,7 +192,9 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
192
192
|
* runtime tracking of what the child actually did is involved (that is the v2 ticket). `authored`
|
|
193
193
|
* marks the entries minted from a definition a caller wrote on a tool a deployment mounted (not the
|
|
194
194
|
* engine's built-ins, the general-purpose alias, fork, or the engine's nested copy of the tool for a
|
|
195
|
-
* delegated child); prepare's deny-name check judges only those.
|
|
195
|
+
* delegated child); prepare's deny-name check judges only those. `servers` are the MCP servers the definition declares itself
|
|
196
|
+
* (`AgentDefinition.mcp`): part of the child's universe for both readers, and its `allowTools` is the list the child's own layer is
|
|
197
|
+
* minted from (the written one, admitting every tool of those servers).
|
|
196
198
|
*/
|
|
197
199
|
agentToolFaces?: ReadonlyArray<{
|
|
198
200
|
name: string;
|
|
@@ -200,6 +202,10 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
200
202
|
denyTools?: readonly string[];
|
|
201
203
|
canRedelegate?: boolean;
|
|
202
204
|
authored?: true;
|
|
205
|
+
servers?: ReadonlyArray<{
|
|
206
|
+
name: string;
|
|
207
|
+
contentOrigin?: import("./types.js").ToolContentOrigin;
|
|
208
|
+
}>;
|
|
203
209
|
}>;
|
|
204
210
|
/**
|
|
205
211
|
* The tool-level `denyTools` list of the delegation tool (`SubagentToolOptions.denyTools`, applied when no agent definition is
|
|
@@ -740,9 +746,9 @@ export interface ToolExecuteContext {
|
|
|
740
746
|
* is rejected — this seat never widens, it only reopens the documented re-supply channel to
|
|
741
747
|
* the parked-decide lane). Absent ⇒ exactly the previous behavior.
|
|
742
748
|
*
|
|
743
|
-
* One entry kind is NOT a policy the deployment authored: a
|
|
744
|
-
*
|
|
745
|
-
*
|
|
749
|
+
* One entry kind is NOT a policy the deployment authored: a mods-wired parent contributes a
|
|
750
|
+
* SCREENING entry (issue #33), its installation. Rebuild it as `{ installation: await
|
|
751
|
+
* admitModChain(…), hookEnv, …regime }` over the same registrations and the same installed env,
|
|
746
752
|
* or the chain handed back here will be short and rejected on the count check. A face that only
|
|
747
753
|
* observes should be declared `{ observe: true }` instead, and then never enters the chain
|
|
748
754
|
* at all; a park under a screening entry announces the requirement on `onError`
|
|
@@ -1318,6 +1324,10 @@ export interface ToolExecuteContext {
|
|
|
1318
1324
|
onTaskNotification?: (n: import("./task-notification.js").TaskNotificationPayload, opts?: {
|
|
1319
1325
|
priority?: import("./task-notification.js").SystemInjectionPriority;
|
|
1320
1326
|
}) => unknown;
|
|
1327
|
+
/** Where a background task's result is stored when its completion notification ({@link onTaskNotification}) carries
|
|
1328
|
+
* less than the whole of it — the run's offload store, read back with `ReadToolResult`. Present exactly when the run
|
|
1329
|
+
* has one; absent ⇒ a cut notification says the full text is not readable from this session. TRUSTED, run-scoped. */
|
|
1330
|
+
taskArtifacts?: import("./tool-result-store.js").TaskArtifactSeat;
|
|
1321
1331
|
/**
|
|
1322
1332
|
* design/99 (nested-subagent live observability): the host run's OPT-IN display sink — a deployment sets it (via
|
|
1323
1333
|
* `RunInternals.onForwardEvent`) to receive a SUBAGENT's live `task_progress` ticks that otherwise stay in the
|
|
@@ -1384,6 +1394,12 @@ export interface ToolExecuteContext {
|
|
|
1384
1394
|
forkAccess?: {
|
|
1385
1395
|
denied: "task" | "principal";
|
|
1386
1396
|
};
|
|
1397
|
+
/**
|
|
1398
|
+
* The delegating leg's two agent stations over its mods bus — `agent.offer` (the offered set the delegation reads at
|
|
1399
|
+
* dispatch) and `agent.spawn` (raised before a subagent is let start). Runner-filled; never a model argument. Absent
|
|
1400
|
+
* outside a Runner: no station is raised and every type is offered.
|
|
1401
|
+
*/
|
|
1402
|
+
agentStations?: import("./mods/agent-stations.js").AgentStations;
|
|
1387
1403
|
/**
|
|
1388
1404
|
* design/80 D-B — the general "a tool yields to a HUMAN review gate" primitive. A tool calls this to request
|
|
1389
1405
|
* that, at the next SAFE turn boundary, the engine pause with a durable `plan_review` checkpoint
|
|
@@ -1392,7 +1408,9 @@ export interface ToolExecuteContext {
|
|
|
1392
1408
|
* only when the deployment can actually pause (a `checkpointStore` is wired); otherwise the request is a silent
|
|
1393
1409
|
* no-op (read-only/headless degrade). The first-party `present_plan` tool (CC `ExitPlanMode` parity) is a thin
|
|
1394
1410
|
* caller of this; any tool may use it to gate a high-blast step on human review. Idempotent within a batch (the
|
|
1395
|
-
* first request wins; the suspend fires once at the boundary). The Runner fills it; not a tool arg.
|
|
1411
|
+
* first request wins; the suspend fires once at the boundary). The Runner fills it; not a tool arg. The Runner
|
|
1412
|
+
* binds the id of the calling tool call to the request (a tool cannot name another call): the parked `plan_review`
|
|
1413
|
+
* row and the paused cause carry it as `requestedByCallId` — which call asked for the pause.
|
|
1396
1414
|
*/
|
|
1397
1415
|
requestReview?: (opts?: {
|
|
1398
1416
|
reason?: string;
|
package/dist/core/trace.d.ts
CHANGED
|
@@ -64,7 +64,6 @@ export interface PromptManifestSection {
|
|
|
64
64
|
* metadata-only rule). Field meanings: see the `stats.mechanisms` JSDoc in core/types.ts.
|
|
65
65
|
*/
|
|
66
66
|
export interface TraceMechanismsSummary {
|
|
67
|
-
finalVerifyInjected?: true;
|
|
68
67
|
finalVerifyInjections?: number;
|
|
69
68
|
attachmentsInjected?: number;
|
|
70
69
|
/** design/164: how many LIMIT-APPROACH frames were injected this run (0..2). */
|
package/dist/core/types.d.ts
CHANGED
|
@@ -18,18 +18,18 @@ export type { PermissionMode } from "./ask-origin.js";
|
|
|
18
18
|
export type { ToolEffect, ToolContentOrigin, ReversibilityVerdict, ReadRootGrantCandidate, ToolSpec, ToolReturn, NestedUsage, NestedUsageAccum, ToolExecuteContext } from "./tool-spec.js";
|
|
19
19
|
export type { BeforeWriteRequest, BeforeWriteResult, BeforeWriteHook, TrackEditRequest, TrackEditResult, TrackFileEditHook, FileEditedNotice, FileEditedHook, HandsBandOptions } from "./hands-band.js";
|
|
20
20
|
export type { AgentDefinition, SkillSpec } from "./agent-definition.js";
|
|
21
|
-
export type { McpServerSpec, A2aServerSpec, McpElicitRequest, McpElicitResponse, OnElicit, McpRevocationLedger, McpMountIdentity, DeclarationFault, DeclarationPathRule, DeclarationRead, ToolAxesRead, ToolAxesSurface } from "./mcp-server-spec.js";
|
|
22
|
-
export { DECLARATION_PATH_RULES, NO_DECLARATION_PATH_RULES, dataKind, declarationFaultOf, declarerWord, perToolEmptyName, perToolEntryRefusal,
|
|
21
|
+
export type { McpServerSpec, A2aServerSpec, McpElicitRequest, McpElicitResponse, OnElicit, McpRevocationLedger, McpMountIdentity, McpTransportKind, DeclarationFault, DeclarationPathRule, DeclarationRead, ToolAxesRead, ToolAxesSurface } from "./mcp-server-spec.js";
|
|
22
|
+
export { DECLARATION_ENTRY_WORDS, DECLARATION_PATH_RULES, MCP_TRANSPORT_KINDS, NO_DECLARATION_PATH_RULES, TOOL_AXIS_WORDS, callerText, dataKind, declarationFaultOf, declarationPath, declarerWord, perToolEmptyName, perToolEntryRefusal, readMcpToolAxes, readToolAxes, receiveDeclaration, receivePerToolDeclaration, toolAxesRefusal, transportKindOf } from "./mcp-server-spec.js";
|
|
23
23
|
export type { TaskLimits } from "./task-limits.js";
|
|
24
24
|
export type { TaskStatus, RemoteEnvFailureNote, EffectiveMemoryScopes, TaskResult, HumanReviewGateRow } from "./task-result.js";
|
|
25
25
|
export type { TerminalCause, PausedCause } from "./terminal-cause.js";
|
|
26
|
-
export type { TaskEventIdentity, BrainStatusPhase, BrainRetryErrClass, BrainStatus, ToolActivity, HumanInputSource, HumanInputDelivery, DelegationTaskType, TaskEvent, HumanInputEvent, HumanInputAttachment, CompactOutcome, ExtensionRequester, RewriteAuthor, ToolInputRewrite } from "./task-event.js";
|
|
26
|
+
export type { TaskEventIdentity, BrainStatusPhase, BrainStatusSeat, BrainRetryErrClass, BrainStatus, ToolActivity, HumanInputSource, HumanInputDelivery, DelegationTaskType, TaskEvent, HumanInputEvent, HumanInputAttachment, CompactOutcome, ExtensionRequester, RewriteAuthor, ToolInputRewrite } from "./task-event.js";
|
|
27
27
|
export type { TaskStream } from "./task-stream.js";
|
|
28
28
|
export type { WorkflowGovernanceBaseline, RuntimeCaps, AutoModeDenySource } from "./runtime-caps.js";
|
|
29
29
|
export { AUTO_MODE_DENY_SOURCES, isAutoModeDenySource } from "./runtime-caps.js";
|
|
30
30
|
export type { BackgroundChildEvent, BackgroundChildRow, DelegationLifecycleEvent } from "./delegation-frames.js";
|
|
31
31
|
export { __resetMalformedDelegationSeatAnnouncement, backgroundChildTerminal, deliverDelegationLifecycle, emitsChildRowFrames, taskStartedFrame } from "./delegation-frames.js";
|
|
32
32
|
export type { ProjectMemoryLoad, ResumePreflightInfo, ResumePreflightVerdict, RunnerDeps } from "./runner-deps.js";
|
|
33
|
-
export type { ApprovalCarryRefusal, EngineNotice, OwedUserInputAccount, UserInputUndrainedCause } from "./engine-notice.js";
|
|
34
|
-
export { __resetMalformedNoticeSeatAnnouncement, deliverEngineNotice, owedUserInputCounts, parentLegIds, settleOwedUserInput, undrainedUserInputNotices, USER_INPUT_UNDRAINED_CAUSES, USER_INPUT_UNDRAINED_FAMILIES } from "./engine-notice.js";
|
|
33
|
+
export type { ApprovalCarryRefusal, EngineNotice, HeldUserInputs, OwedInputIds, OwedUserInputAccount, UserInputUndrainedCause } from "./engine-notice.js";
|
|
34
|
+
export { __resetMalformedNoticeSeatAnnouncement, deliverEngineNotice, owedUserInputCounts, owedUserInputIds, parentLegIds, parkedInputIdsOf, settleOwedUserInput, undrainedUserInputNotices, USER_INPUT_UNDRAINED_CAUSES, USER_INPUT_UNDRAINED_FAMILIES } from "./engine-notice.js";
|
|
35
35
|
export type { AgentTool, Model, StreamFn, ThinkingLevel, ToolInputValidationContext, ToolInputVerdict };
|
package/dist/core/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MODEL_ROLES } from "./model-seat.js";
|
|
2
|
-
export { DECLARATION_PATH_RULES, NO_DECLARATION_PATH_RULES, dataKind, declarationFaultOf, declarerWord, perToolEmptyName, perToolEntryRefusal,
|
|
2
|
+
export { DECLARATION_ENTRY_WORDS, DECLARATION_PATH_RULES, MCP_TRANSPORT_KINDS, NO_DECLARATION_PATH_RULES, TOOL_AXIS_WORDS, callerText, dataKind, declarationFaultOf, declarationPath, declarerWord, perToolEmptyName, perToolEntryRefusal, readMcpToolAxes, readToolAxes, receiveDeclaration, receivePerToolDeclaration, toolAxesRefusal, transportKindOf } from "./mcp-server-spec.js";
|
|
3
3
|
export { AUTO_MODE_DENY_SOURCES, isAutoModeDenySource } from "./runtime-caps.js";
|
|
4
4
|
export { __resetMalformedDelegationSeatAnnouncement, backgroundChildTerminal, deliverDelegationLifecycle, emitsChildRowFrames, taskStartedFrame } from "./delegation-frames.js";
|
|
5
|
-
export { __resetMalformedNoticeSeatAnnouncement, deliverEngineNotice, owedUserInputCounts, parentLegIds, settleOwedUserInput, undrainedUserInputNotices, USER_INPUT_UNDRAINED_CAUSES, USER_INPUT_UNDRAINED_FAMILIES } from "./engine-notice.js";
|
|
5
|
+
export { __resetMalformedNoticeSeatAnnouncement, deliverEngineNotice, owedUserInputCounts, owedUserInputIds, parentLegIds, parkedInputIdsOf, settleOwedUserInput, undrainedUserInputNotices, USER_INPUT_UNDRAINED_CAUSES, USER_INPUT_UNDRAINED_FAMILIES } from "./engine-notice.js";
|
|
@@ -229,7 +229,7 @@ export const ENGINE_ENVELOPES = Object.freeze([
|
|
|
229
229
|
{
|
|
230
230
|
tag: "example",
|
|
231
231
|
kind: "not-an-envelope",
|
|
232
|
-
mint: "engine/compaction SUMMARIZATION_PROMPT (
|
|
232
|
+
mint: "engine/compaction SUMMARIZATION_PROMPT (the output skeleton shown to the summarizer, captured from an early reference build)",
|
|
233
233
|
guard: "no untrusted bytes reach it: the block is a CONSTANT that frames placeholder text (`[Concept 1]`), it wraps nothing, and it is never emitted back — the summarizer's own answer is read through the `<summary>` envelope, not this one",
|
|
234
234
|
fenced: false,
|
|
235
235
|
disclosed: false,
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import type { ImageContent, TextContent, UserAttachmentSupply, UserMessageAttachment } from "../internal/llm.js";
|
|
26
26
|
import type { HumanInputAttachment } from "./task-event.js";
|
|
27
27
|
import { type ModelFileReader } from "../tools/fs/fs-read.js";
|
|
28
|
+
import { type ImageDownsampler } from "./image-downsample.js";
|
|
28
29
|
import type { SyntheticReadJudge } from "./synthetic-read-verdict.js";
|
|
29
30
|
import { type ReminderDisclosureCounts } from "./reminder-disclosure.js";
|
|
30
31
|
import { type AgentMessage } from "../internal/harness.js";
|
|
@@ -115,10 +116,11 @@ export interface UserAttachmentDeclaration {
|
|
|
115
116
|
/** The UserPromptSubmit hook's view of the declarations. */
|
|
116
117
|
export declare function userAttachmentDeclarations(screened: readonly ScreenedUserAttachment[]): readonly UserAttachmentDeclaration[];
|
|
117
118
|
/**
|
|
118
|
-
* The host images' byte admission — the one function an image the Read tool serves passes
|
|
119
|
-
* run on the captured values before any attachment is read or delivered. Throws
|
|
119
|
+
* The host images' byte admission — the one function an image the Read tool serves passes, with the run's processor.
|
|
120
|
+
* Asynchronous (it decodes), run on the captured values before any attachment is read or delivered. Throws
|
|
121
|
+
* `config.user_attachment_invalid`.
|
|
120
122
|
*/
|
|
121
|
-
export declare function admitUserAttachmentImages(screened: readonly ScreenedUserAttachment[]): Promise<ReadonlyMap<number, ImageContent>>;
|
|
123
|
+
export declare function admitUserAttachmentImages(screened: readonly ScreenedUserAttachment[], processor: ImageDownsampler | "none"): Promise<ReadonlyMap<number, ImageContent>>;
|
|
122
124
|
/** The transmission an attachment frame is (the read-state entry its delivery records carries it): when the frame leaves
|
|
123
125
|
* the request — a trim drops it — the entry retires with it. One spelling for the mint and every remover. */
|
|
124
126
|
export declare function attachmentTransmissionId(a: Pick<UserMessageAttachment, "inputId" | "ordinal">): string;
|
|
@@ -171,8 +173,11 @@ export interface AttachmentWindowInput {
|
|
|
171
173
|
}
|
|
172
174
|
/** The objective lane's read: once the UserPromptSubmit hook let the objective through (a blocked objective reads
|
|
173
175
|
* nothing), and before the pre-call gate, which prices the frames (`chars`). Refuses the whole objective when the frames
|
|
174
|
-
* and the objective cannot ride one request ({@link refuseFramesOverWindow}). Commits nothing.
|
|
175
|
-
|
|
176
|
+
* and the objective cannot ride one request ({@link refuseFramesOverWindow}). Commits nothing. `imageSeat` is the run's
|
|
177
|
+
* image processor seat (`RunnerDeps.imageProcessor`): the host images are admitted with it (a path's image is read by the
|
|
178
|
+
* reader, with the same seat), and the first image of the frames sent unprocessed over the soft target is told to
|
|
179
|
+
* `prepared.imageUnprocessed`. */
|
|
180
|
+
export declare function readObjectiveAttachments(prepared: Pick<import("./runner/contracts.js").Prepared, "userAttachments" | "modelFileReader" | "syntheticReadVerdict" | "cwdRef" | "reminderMark" | "reminderDisclosureCounts" | "abortController" | "harness" | "modBus" | "hookIdentity" | "imageUnprocessed">, inputId: string, blocked: boolean, window: AttachmentWindowInput, imageSeat: ImageDownsampler | false | undefined): Promise<{
|
|
176
181
|
frames: MintedAttachmentFrame[];
|
|
177
182
|
chars: number;
|
|
178
183
|
}>;
|
|
@@ -3,7 +3,8 @@ import { READ_OUTCOMES } from "../tools/fs/fs-read.js";
|
|
|
3
3
|
import { renderDirectoryListing } from "../tools/fs/dir-entries.js";
|
|
4
4
|
import { MAX_READ_OUTPUT_CHARS } from "../tools/fs/fs-shared.js";
|
|
5
5
|
import { normalizeFileText } from "../tools/fs/encoding.js";
|
|
6
|
-
import { ADMITTED_IMAGE_MIME_TYPES, admitImageBytes } from "./image-admission.js";
|
|
6
|
+
import { ADMITTED_IMAGE_MIME_TYPES, admitImageBytes, firstUnprocessedOverTarget, IMAGE_ADMISSION, unprocessedSizeClause } from "./image-admission.js";
|
|
7
|
+
import { resolveImageProcessor } from "./image-downsample.js";
|
|
7
8
|
import { PDF_MAX_PAGES_PER_READ } from "../tools/fs/pdf.js";
|
|
8
9
|
import { MARKED_BLOCK_AFTER_DATA, mintSystemReminder } from "./reminder-mint.js";
|
|
9
10
|
import { commitReminderDisclosureEffects, planReminderDisclosure } from "./reminder-disclosure.js";
|
|
@@ -151,12 +152,12 @@ function declarationOf(a, ordinal) {
|
|
|
151
152
|
? { ordinal, supply: a.supply, path: a.path }
|
|
152
153
|
: { ordinal, supply: a.supply, name: a.name, bytes: a.supply === "content_text" ? Buffer.byteLength(a.text, "utf8") : Buffer.from(a.data, "base64").byteLength };
|
|
153
154
|
}
|
|
154
|
-
export async function admitUserAttachmentImages(screened) {
|
|
155
|
+
export async function admitUserAttachmentImages(screened, processor) {
|
|
155
156
|
const out = new Map();
|
|
156
157
|
for (const [i, a] of screened.entries()) {
|
|
157
158
|
if (a.supply !== "content_image")
|
|
158
159
|
continue;
|
|
159
|
-
const admitted = await admitImageBytes(Buffer.from(a.data, "base64"), a.mimeType,
|
|
160
|
+
const admitted = await admitImageBytes(Buffer.from(a.data, "base64"), a.mimeType, processor);
|
|
160
161
|
if (admitted.ok) {
|
|
161
162
|
out.set(i + 1, admitted.block);
|
|
162
163
|
continue;
|
|
@@ -166,11 +167,14 @@ export async function admitUserAttachmentImages(screened) {
|
|
|
166
167
|
case "mime_unsupported":
|
|
167
168
|
throw userAttachmentRefusal(memberRef(imageAt, "mimeType"), `must be one of ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}.`);
|
|
168
169
|
case "magic_mismatch":
|
|
169
|
-
throw userAttachmentRefusal(memberRef(imageAt, "data"), `does not
|
|
170
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `does not open with a valid ${a.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.`);
|
|
170
171
|
case "raw_too_large":
|
|
171
172
|
throw userAttachmentRefusal(memberRef(imageAt, "data"), `${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
|
|
173
|
+
case "dimensions_unreadable":
|
|
174
|
+
case "dimensions_too_large":
|
|
175
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `refused rather than sent: ${unprocessedSizeClause(admitted)}.`);
|
|
172
176
|
case "base64_too_large":
|
|
173
|
-
throw userAttachmentRefusal(memberRef(imageAt, "data"), `base64 of ${admitted.base64.length} characters, over the API's
|
|
177
|
+
throw userAttachmentRefusal(memberRef(imageAt, "data"), `base64 of ${admitted.base64.length} characters, over the API's ${IMAGE_ADMISSION.hard.imageBase64Chars}-character image limit — shrink the image first.`);
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
return out;
|
|
@@ -485,15 +489,16 @@ function refuseFramesOverWindow(frames, model, window) {
|
|
|
485
489
|
const n = frames.length;
|
|
486
490
|
throw userAttachmentRefusal(SEAT_REF, `the ${n} ${n === 1 ? "attachment" : "attachments"} and the objective come to about ${tokens} tokens, over the ${budget} tokens one request can hold on this model — to send it the engine would have to drop the objective or some of the attachments. Nothing was sent; attach fewer or smaller parts.`);
|
|
487
491
|
}
|
|
488
|
-
export async function readObjectiveAttachments(prepared, inputId, blocked, window) {
|
|
492
|
+
export async function readObjectiveAttachments(prepared, inputId, blocked, window, imageSeat) {
|
|
489
493
|
if (blocked || prepared.userAttachments === undefined)
|
|
490
494
|
return { frames: [], chars: 0 };
|
|
495
|
+
const processor = await resolveImageProcessor(imageSeat);
|
|
491
496
|
const frames = await readUserAttachments({
|
|
492
497
|
screened: prepared.userAttachments,
|
|
493
498
|
inputId,
|
|
494
499
|
reader: prepared.modelFileReader,
|
|
495
500
|
judge: prepared.syntheticReadVerdict,
|
|
496
|
-
images: await admitUserAttachmentImages(prepared.userAttachments),
|
|
501
|
+
images: await admitUserAttachmentImages(prepared.userAttachments, processor),
|
|
497
502
|
cwd: prepared.cwdRef?.current,
|
|
498
503
|
mark: prepared.reminderMark,
|
|
499
504
|
counts: prepared.reminderDisclosureCounts,
|
|
@@ -501,6 +506,9 @@ export async function readObjectiveAttachments(prepared, inputId, blocked, windo
|
|
|
501
506
|
mentions: { bus: prepared.modBus, ...(agentIdOf(prepared.hookIdentity) !== undefined ? { agentId: agentIdOf(prepared.hookIdentity) } : {}) },
|
|
502
507
|
});
|
|
503
508
|
refuseFramesOverWindow(frames, prepared.harness.getModel(), window);
|
|
509
|
+
const unprocessed = firstUnprocessedOverTarget(frames.flatMap((f) => f.seed.content), processor);
|
|
510
|
+
if (unprocessed !== undefined)
|
|
511
|
+
prepared.imageUnprocessed(unprocessed);
|
|
504
512
|
return { frames, chars: frames.reduce((n, f) => n + f.seed.content.reduce((m, b) => m + (b.type === "text" ? b.text.length : 0), 0), 0) };
|
|
505
513
|
}
|
|
506
514
|
export const COMPACTION_RESTORE_PROBE_FACE = "compaction-restore";
|
|
@@ -24,7 +24,7 @@ import { type PermissionMode } from "./ask-origin.js";
|
|
|
24
24
|
import type { RunnerDeps, TaskSpec } from "./types.js";
|
|
25
25
|
import { type StoreDurability } from "./checkpoint-store.js";
|
|
26
26
|
import type { ModAdmissionRecord } from "./mods/kernel/index.js";
|
|
27
|
-
import type { McpDelivered, McpFailureKind, McpServerLiveness } from "./mcp-failure.js";
|
|
27
|
+
import type { McpAuthorization, McpDelivered, McpFailureKind, McpServerLiveness } from "./mcp-failure.js";
|
|
28
28
|
import type { WriteProtectionTargetView } from "./write-protect.js";
|
|
29
29
|
import type { OnAsk } from "./tool-policy.js";
|
|
30
30
|
import { type RunOrigin } from "./run-origin.js";
|
|
@@ -114,8 +114,8 @@ export interface AutoModeArmFact {
|
|
|
114
114
|
* One declared MCP server's materialization result for THIS leg — the per-server connection-state
|
|
115
115
|
* read face on {@link WiringManifest.mcp}. `status` is the connect-time verdict of this leg's
|
|
116
116
|
* materialize (a snapshot, never a heartbeat — the same semantics as `MaterializedMcp.statuses`,
|
|
117
|
-
* which it is projected from): `connected` (tools listed; `toolCount` = see the field), `failed` (the connect or the tool listing threw — `errorCode`/`delivered`/`httpStatus` are the
|
|
118
|
-
* failure record spread flat (see the MCP failure vocabulary's `McpFailure`), `error` the
|
|
117
|
+
* which it is projected from): `connected` (tools listed; `toolCount` = see the field), `failed` (the connect or the tool listing threw — `errorCode`/`delivered`/`httpStatus`/`authorization` are the
|
|
118
|
+
* failure record spread flat (see the MCP failure vocabulary's `McpFailure` and `failureFields`), `error` the
|
|
119
119
|
* neutralized, length-bounded remote text), `skipped` (declared on the spec but this leg produced no
|
|
120
120
|
* status for it — the materialization did not reach it). `source` is the DECLARING side's own label
|
|
121
121
|
* (`McpServerSpec.source`: plugin / user / project / local, or anything the deployment writes),
|
|
@@ -129,6 +129,9 @@ export interface WiringManifestMcpEntry {
|
|
|
129
129
|
errorCode?: McpFailureKind;
|
|
130
130
|
delivered?: McpDelivered;
|
|
131
131
|
httpStatus?: number;
|
|
132
|
+
/** The `unauthorized` failure's authorization fact (`McpAuthorization`): present iff `errorCode === "unauthorized"`, copied whole
|
|
133
|
+
* from the status record (`authorizeUrl` the deployment seat's, `resourceMetadataUrl` the endpoint's own UNTRUSTED claim). */
|
|
134
|
+
authorization?: McpAuthorization;
|
|
132
135
|
error?: string;
|
|
133
136
|
/** How many of the server's tools the roster the row is read against holds: a run's roster (the valve and the deployment's
|
|
134
137
|
* `toolFaces` overlay applied — a tool either one leaves off is not counted), or, for `probeMcpServers` (no run, so no lists),
|
|
@@ -583,10 +583,36 @@ function createSummarizationOptions(model, maxTokens, apiKey, headers, signal, t
|
|
|
583
583
|
return options;
|
|
584
584
|
}
|
|
585
585
|
async function completeSummarization(model, context, options, streamFn, runtime) {
|
|
586
|
-
|
|
587
|
-
|
|
586
|
+
const call = async () => streamFn ? (await streamFn(model, context, options)).result() : await resolveAgentCoreCompleteFn(runtime)(model, context, options);
|
|
587
|
+
const signal = options.signal;
|
|
588
|
+
if (signal === undefined)
|
|
589
|
+
return await call();
|
|
590
|
+
if (signal.aborted)
|
|
591
|
+
return summaryCallAborted(model);
|
|
592
|
+
let release = () => undefined;
|
|
593
|
+
const cut = new Promise((resolve) => {
|
|
594
|
+
const onAbort = () => resolve(summaryCallAborted(model));
|
|
595
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
596
|
+
release = () => signal.removeEventListener("abort", onAbort);
|
|
597
|
+
});
|
|
598
|
+
try {
|
|
599
|
+
return await Promise.race([cut, call()]);
|
|
600
|
+
}
|
|
601
|
+
finally {
|
|
602
|
+
release();
|
|
588
603
|
}
|
|
589
|
-
|
|
604
|
+
}
|
|
605
|
+
function summaryCallAborted(model) {
|
|
606
|
+
return {
|
|
607
|
+
role: "assistant",
|
|
608
|
+
content: [],
|
|
609
|
+
api: model.api,
|
|
610
|
+
provider: model.provider,
|
|
611
|
+
model: model.id,
|
|
612
|
+
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 0, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
613
|
+
stopReason: "aborted",
|
|
614
|
+
timestamp: Date.now(),
|
|
615
|
+
};
|
|
590
616
|
}
|
|
591
617
|
const SUMMARY_REASONING_FLOOR = 2048;
|
|
592
618
|
const SUMMARY_MAX_ESCALATIONS = 2;
|
|
@@ -2,7 +2,7 @@ import { type FileHandle } from "node:fs/promises";
|
|
|
2
2
|
import { type BoundFileObject, type ExecResult, type ExecutionEnv, ExecutionError, type ExecutionEnvExecOptions, FileError, type FileInfo, type Result } from "../harness/types.js";
|
|
3
3
|
import { type SecretEnvFinding } from "../../core/secret-env.js";
|
|
4
4
|
import type { EngineNotice } from "../../core/engine-notice.js";
|
|
5
|
-
import type { SymlinkChain } from "../harness/types.js";
|
|
5
|
+
import type { ExecutionEnvCapabilities, SymlinkChain } from "../harness/types.js";
|
|
6
6
|
import type { BackgroundHardKillOutcome, BackgroundShellCapability, BackgroundShellId, BackgroundPoll, BackgroundSpawnOptions } from "../../core/background-shell.js";
|
|
7
7
|
import { BackgroundShellError } from "../../core/background-shell.js";
|
|
8
8
|
import type { SchedulerCapability, ScheduledIntent, SchedulerContext, ScheduledTaskId, ScheduledTaskSummary } from "../../core/scheduler.js";
|
|
@@ -82,6 +82,9 @@ export declare function openSpoolPair(base: string): {
|
|
|
82
82
|
};
|
|
83
83
|
export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCapability, SchedulerCapability {
|
|
84
84
|
cwd: string;
|
|
85
|
+
/** `ExecutionEnv.capabilities`: the engine's own host — commands are this process's children on its own disk, not
|
|
86
|
+
* contained, not snapshotable; its resolver always answers; it does not keep the byte floor (no process confinement). */
|
|
87
|
+
readonly capabilities: ExecutionEnvCapabilities;
|
|
85
88
|
/** `ExecutionEnv.homeDir` = the `HOME` the shell child receives (its `~`/`$HOME`/`${HOME}` all expand to it), read LIVE off the same `shellEnv`-over-`inheritEnv` merge each exec gets; ABSENT when the
|
|
86
89
|
* child gets none (an allowlist that withholds it: `~` then falls back to passwd while `$HOME` is empty — two values, no single home, home-relative operands stay fail-closed). Residual: a per-exec `env.HOME` override. */
|
|
87
90
|
get homeDir(): string | undefined;
|
|
@@ -93,8 +96,8 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
93
96
|
get withheldEnv(): readonly SecretEnvFinding[];
|
|
94
97
|
/** The environment the next shell child would receive, for a READ (the scrub seat is the reader's collector or a
|
|
95
98
|
* no-op: a read announces nothing). `undefined` when no child would be spawned at all — the policy is refused against
|
|
96
|
-
* the own credentials declared since construction, and every spawn throws that reason — so
|
|
97
|
-
* gets none", never a throw. */
|
|
99
|
+
* the own credentials declared since construction, or `shellEnv` is no grant, and every spawn throws that reason — so
|
|
100
|
+
* a reader sees "the child gets none", never a throw. Composed once: the refusal is the composition's own. */
|
|
98
101
|
private childEnvForRead;
|
|
99
102
|
private shellPath?;
|
|
100
103
|
private shellEnv?;
|
|
@@ -118,7 +121,8 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
118
121
|
shellEnv?: NodeJS.ProcessEnv;
|
|
119
122
|
/** VENDORED EDIT (D1, security): how much of `process.env` the shell child inherits. Default `"scrub"` =
|
|
120
123
|
* fail-closed (drop secret-pattern keys, keep PATH/build/locale). `"all"` = full inherit (trusted env);
|
|
121
|
-
* `string[]` = strict allowlist. `shellEnv`/per-exec `env` always pass through
|
|
124
|
+
* `string[]` = strict allowlist. `shellEnv`/per-exec `env` always pass through (`hostChildEnv`'s grants: one that is
|
|
125
|
+
* not a map of variable names to strings throws here and at the spawn). Any other value — an unknown
|
|
122
126
|
* word, a non-string, a list entry that is not a variable name — throws here (`inheritEnvPolicyProblem`'s
|
|
123
127
|
* reason), the same judgment the oracle gate's `inheritEnv` meets. Whatever the policy, the deployment's own
|
|
124
128
|
* credentials (`declareWithheldEnv`: by name, and by a value equal to a declared or engine-held credential value)
|
|
@@ -171,7 +175,9 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
171
175
|
* (Esc during a large Write — ctx.signal reaches here directly), ENOSPC, or a crash left the target as
|
|
172
176
|
* a torn prefix of the NEW content with the original unrecoverable. Post-fix contract: the target is
|
|
173
177
|
* either fully old or fully new; `aborted` means it was never touched. Known semantic change (same as
|
|
174
|
-
* CC): rename breaks a hard link — the other link keeps the old content.
|
|
178
|
+
* CC): rename breaks a hard link — the other link keeps the old content. The replacement is a new inode made
|
|
179
|
+
* by the writing process: its owner is the writer and its group follows the new-file rule, so the target's
|
|
180
|
+
* group bits can land on another group; no fchown (KL-3120-b). */
|
|
175
181
|
writeFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
176
182
|
/** RB-221: the historical single-step in-place overwrite — kept for targets where
|
|
177
183
|
* staging+rename would change node identity (symlink chains, non-regular files) and as the
|
|
@@ -7,7 +7,7 @@ import { dirname, isAbsolute, join, sep } from "node:path";
|
|
|
7
7
|
import { createInterface } from "node:readline";
|
|
8
8
|
import { ExecutionError, err, FileError, ok, toError, } from "../harness/types.js";
|
|
9
9
|
import { killProcessTree, shutdownDebug } from "./kill-tree.js";
|
|
10
|
-
import { __resetSecretEnvScrubNoticeAnnouncement, announceSecretEnvScrub,
|
|
10
|
+
import { __resetSecretEnvScrubNoticeAnnouncement, announceSecretEnvScrub, hostChildEnv, hostChildEnvProblem, inheritedHostEnv } from "../../core/secret-env.js";
|
|
11
11
|
import { physicalPathOfAsync } from "../../core/physical-path.js";
|
|
12
12
|
import { posixModeBitsMeaningful } from "../../core/posix-mode-face.js";
|
|
13
13
|
import { anchorAtLinkDir, walkSymlinkChain } from "./symlink-chain.js";
|
|
@@ -15,6 +15,16 @@ import { RollingTailBuffer, markTruncated, newStreamCursorState, sliceStreamIncr
|
|
|
15
15
|
import { BackgroundShellError } from "../../core/background-shell.js";
|
|
16
16
|
import { SchedulerError } from "../../core/scheduler.js";
|
|
17
17
|
const MAX_TIMER_TIMEOUT_MS = 2_147_000_000;
|
|
18
|
+
const NODE_ENV_CAPABILITIES = Object.freeze({
|
|
19
|
+
isolation: false,
|
|
20
|
+
suspendable: false,
|
|
21
|
+
sharesProcessTable: true,
|
|
22
|
+
canonicalPathAuthoritative: true,
|
|
23
|
+
hostLocalPaths: true,
|
|
24
|
+
externalContentTarget: false,
|
|
25
|
+
io: true,
|
|
26
|
+
keepsReadFloor: false,
|
|
27
|
+
});
|
|
18
28
|
function resolvePath(cwd, path) {
|
|
19
29
|
if (isAbsolute(path))
|
|
20
30
|
return path;
|
|
@@ -248,9 +258,7 @@ export function __resetSecretScrubAnnouncement() {
|
|
|
248
258
|
__resetSecretEnvScrubNoticeAnnouncement();
|
|
249
259
|
}
|
|
250
260
|
function getShellEnv(inheritEnv, baseEnv, extraEnv, onScrub, onNotice) {
|
|
251
|
-
const
|
|
252
|
-
const inherited = inheritedHostEnv(inheritEnv, scrubbed);
|
|
253
|
-
const findings = scrubbed.filter((f) => baseEnv?.[f.key] === undefined && extraEnv?.[f.key] === undefined);
|
|
261
|
+
const { env, withheld: findings } = hostChildEnv(inheritEnv, baseEnv, extraEnv);
|
|
254
262
|
if (findings.length > 0) {
|
|
255
263
|
if (typeof onScrub === "function") {
|
|
256
264
|
try {
|
|
@@ -275,11 +283,7 @@ function getShellEnv(inheritEnv, baseEnv, extraEnv, onScrub, onNotice) {
|
|
|
275
283
|
announceSecretEnvScrub(onNotice, findings);
|
|
276
284
|
}
|
|
277
285
|
}
|
|
278
|
-
return
|
|
279
|
-
...inherited,
|
|
280
|
-
...baseEnv,
|
|
281
|
-
...extraEnv,
|
|
282
|
-
};
|
|
286
|
+
return env;
|
|
283
287
|
}
|
|
284
288
|
const EXIT_SETTLE_DRAIN_MS = 500;
|
|
285
289
|
const EXEC_SPOOL_PUMP_MS = 200;
|
|
@@ -320,6 +324,7 @@ export function openSpoolPair(base) {
|
|
|
320
324
|
}
|
|
321
325
|
export class NodeExecutionEnv {
|
|
322
326
|
cwd;
|
|
327
|
+
capabilities = NODE_ENV_CAPABILITIES;
|
|
323
328
|
get homeDir() {
|
|
324
329
|
return this.childEnvForRead()?.HOME;
|
|
325
330
|
}
|
|
@@ -333,9 +338,12 @@ export class NodeExecutionEnv {
|
|
|
333
338
|
return withheld;
|
|
334
339
|
}
|
|
335
340
|
childEnvForRead(collect = () => { }) {
|
|
336
|
-
|
|
341
|
+
try {
|
|
342
|
+
return getShellEnv(this.inheritEnv, this.shellEnv, undefined, collect);
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
337
345
|
return undefined;
|
|
338
|
-
|
|
346
|
+
}
|
|
339
347
|
}
|
|
340
348
|
shellPath;
|
|
341
349
|
shellEnv;
|
|
@@ -353,7 +361,7 @@ export class NodeExecutionEnv {
|
|
|
353
361
|
this.cwd = options.cwd;
|
|
354
362
|
this.shellPath = options.shellPath;
|
|
355
363
|
this.shellEnv = options.shellEnv;
|
|
356
|
-
const inheritEnvProblem =
|
|
364
|
+
const inheritEnvProblem = hostChildEnvProblem(options.inheritEnv, options.shellEnv);
|
|
357
365
|
if (inheritEnvProblem !== undefined)
|
|
358
366
|
throw new Error(`NodeExecutionEnv: ${inheritEnvProblem}`);
|
|
359
367
|
this.inheritEnv = Array.isArray(options.inheritEnv) ? [...options.inheritEnv] : (options.inheritEnv ?? "scrub");
|
|
@@ -889,7 +897,7 @@ export class NodeExecutionEnv {
|
|
|
889
897
|
const tmp = `${target}.tmp.${process.pid}.${randomUUID().replace(/-/g, "").slice(0, 12)}`;
|
|
890
898
|
let tmpDurable = false;
|
|
891
899
|
try {
|
|
892
|
-
const handle = await open(tmp, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0));
|
|
900
|
+
const handle = await open(tmp, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), existingMode === undefined ? 0o666 : 0o600);
|
|
893
901
|
try {
|
|
894
902
|
await handle.writeFile(content, { signal: abortSignal });
|
|
895
903
|
if (existingMode !== undefined) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActorAssertion, AssistantMessage, ImageContent, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
|
|
2
2
|
import { type ToolTurnRepair } from "../llm/index.js";
|
|
3
|
+
import { type RejectedImageRemoval } from "../llm/rejected-images.js";
|
|
3
4
|
import { runToolCall, type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
|
|
4
5
|
import type { HaltRemainingDirective } from "../loop/types.js";
|
|
5
6
|
import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
@@ -214,6 +215,13 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
214
215
|
* with every request view that needed one (the transcript is never rewritten, so a broken turn is repaired, and
|
|
215
216
|
* reported, on each request; the sink owns its dedup). Advisory: a throwing sink never breaks the request. */
|
|
216
217
|
onToolTurnRepaired?: (repairs: readonly ToolTurnRepair[]) => void;
|
|
218
|
+
/** Runner-set sink for the images a provider refused in THIS run ({@link removeRejectedImages}) — a refusal recorded
|
|
219
|
+
* before the run began is not reported. Every request re-reads the transcript, so the sink owns its dedup (by
|
|
220
|
+
* `refusalAt`). Advisory: a throwing sink never breaks the request. */
|
|
221
|
+
onImagesRemoved?: (removals: readonly RejectedImageRemoval[]) => void;
|
|
222
|
+
/** The image refusals standing in the transcript when the current run began, by their identity
|
|
223
|
+
* ({@link RejectedImageRemoval.refusalAt}): the run that met them announced them. */
|
|
224
|
+
private priorImageRefusals?;
|
|
217
225
|
/** The assistant messages standing in the transcript when the current run began — what the request view reads as
|
|
218
226
|
* "before this run" (a message is the run's own unless it is in here). */
|
|
219
227
|
private runHistory?;
|
|
@@ -222,10 +230,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
222
230
|
* hands ENGINE payloads back for redelivery; user inputs have no redelivery semantics (a steer
|
|
223
231
|
* aimed at a finished run must not silently fire at the next one), so their loss is ANNOUNCED
|
|
224
232
|
* instead — the runner surfaces it as an operator notice, closing the "accepted then silently
|
|
225
|
-
* dropped" window the #257 contract could only document.
|
|
233
|
+
* dropped" window the #257 contract could only document. The second argument hands over the OPAQUE park records of the
|
|
234
|
+
* counted inputs that carried one, per lane in service order — the order the queue would serve them, so an
|
|
235
|
+
* `immediate`-class input leads the ones accepted before it (never interpreted here; the runner reads which input each
|
|
236
|
+
* is) — a lane's list shorter than its count means some counted input had none. */
|
|
226
237
|
onUndrainedUserInputs?: (counts: {
|
|
227
238
|
steer: number;
|
|
228
239
|
followUp: number;
|
|
240
|
+
}, parkRecords?: {
|
|
241
|
+
steer: readonly unknown[];
|
|
242
|
+
followUp: readonly unknown[];
|
|
229
243
|
}) => void;
|
|
230
244
|
/** design/176 — runner-set sink fired at the CONSUMPTION boundary, once per engine-note payload,
|
|
231
245
|
* in consumption order (steer/followUp drain and the turn-open nextTurn splice — the two points
|
|
@@ -262,6 +276,9 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
262
276
|
* minted it. */
|
|
263
277
|
engineInjectionsHeld?: () => boolean;
|
|
264
278
|
/** The provider boundary's tool-turn law: the repaired view goes to the brain, the repairs to the runner's sink. */
|
|
279
|
+
/** The request view of `messages` under the provider's image refusals they hold ({@link removeRejectedImages}), and
|
|
280
|
+
* the removals this run met handed to {@link onImagesRemoved}. */
|
|
281
|
+
private imageRefusalView;
|
|
265
282
|
private holdToolTurnLaw;
|
|
266
283
|
/** RB-30 R2 belt-and-braces: runner-callable idempotent recovery for exit paths that reach
|
|
267
284
|
* neither agent_end nor abort() (a pre-prompt throw after prepare). Swept entries are removed,
|
|
@@ -281,6 +298,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
281
298
|
* frames are excluded, and the IN-FLIGHT slot counts (a frame spliced out of a queue and never injected
|
|
282
299
|
* is as pending as one that never left it).
|
|
283
300
|
*/
|
|
301
|
+
private pendingUserInputFramesByLane;
|
|
284
302
|
private pendingUserInputsByLane;
|
|
285
303
|
/**
|
|
286
304
|
* Is a PERSON's input waiting for this run's NEXT TURN BOUNDARY? The live read face over
|
|
@@ -321,7 +339,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
321
339
|
private activeRun?;
|
|
322
340
|
private loopTrace?;
|
|
323
341
|
private onToolInputValidationFault?;
|
|
324
|
-
private
|
|
342
|
+
private toolResultMedia;
|
|
325
343
|
private resilience?;
|
|
326
344
|
private maxToolConcurrency?;
|
|
327
345
|
private streamingToolExecution?;
|
|
@@ -637,11 +655,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
637
655
|
* on a checkpoint, so their live frames leave the queues (identity-matched on the sidecar). Dropping
|
|
638
656
|
* them here is what keeps the terminal `#259` account honest — a migrated instruction is not "accepted
|
|
639
657
|
* then lost", and one this is never called for (a failed commit) still gets its loud undrained notice.
|
|
640
|
-
* Returns the per-lane drop counts so the caller can subtract them from an account already taken
|
|
658
|
+
* Returns the per-lane drop counts so the caller can subtract them from an account already taken, and the dropped
|
|
659
|
+
* records themselves per lane (opaque, in the order the queues held them) so it can subtract by identity too.
|
|
641
660
|
*/
|
|
642
661
|
dropParkedUserInputs(records: readonly unknown[]): {
|
|
643
662
|
steer: number;
|
|
644
663
|
followUp: number;
|
|
664
|
+
records: {
|
|
665
|
+
steer: unknown[];
|
|
666
|
+
followUp: unknown[];
|
|
667
|
+
};
|
|
645
668
|
};
|
|
646
669
|
/**
|
|
647
670
|
* backlog #389 (`control_request:"interrupt"`) — an interrupt does
|