@sema-agent/core 7.59.0 → 7.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1169 -0
- package/README.md +2 -2
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +4 -3
- package/dist/agents/agent-transcript-tool.js +4 -2
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -1
- package/dist/agents/inherited-tool-pool.d.ts +28 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +16 -3
- package/dist/agents/roster-store.d.ts +2 -2
- package/dist/agents/roster-store.js +8 -3
- package/dist/agents/send-message-tool.d.ts +14 -27
- package/dist/agents/send-message-tool.js +47 -54
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +52 -28
- package/dist/agents/subagent.js +276 -246
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +61 -23
- package/dist/core/allow-entry.js +134 -39
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +66 -17
- package/dist/core/background-agent-store.d.ts +17 -6
- package/dist/core/background-agent-store.js +15 -13
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +86 -32
- package/dist/core/checkpoint-store.js +10 -5
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/context-settings.js +3 -5
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +5 -6
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +106 -32
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +15 -0
- package/dist/core/frame-settlement.js +10 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +9 -6
- package/dist/core/gate-lanes.js +46 -12
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +19 -3
- package/dist/core/governance-codes.js +27 -3
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +51 -60
- package/dist/core/hooks.js +131 -78
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +145 -52
- package/dist/core/image-admission.js +202 -47
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +55 -3
- package/dist/core/locked-config.js +84 -51
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +83 -16
- package/dist/core/mcp-failure.js +67 -30
- package/dist/core/mcp-host-seat.d.ts +131 -0
- package/dist/core/mcp-host-seat.js +305 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +9 -4
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +39 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +23 -55
- package/dist/core/mcp.js +172 -156
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +68 -13
- package/dist/core/memory-engine/sync-client.js +147 -18
- package/dist/core/memory-engine/sync-report.d.ts +106 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +13 -3
- package/dist/core/mode-policy.d.ts +15 -7
- package/dist/core/mode-policy.js +18 -6
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +100 -0
- package/dist/core/mods/agent-stations.js +154 -0
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +9 -4
- package/dist/core/mods/kernel/dispatch.js +8 -8
- package/dist/core/mods/kernel/events.d.ts +13 -4
- package/dist/core/mods/kernel/events.js +14 -10
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +89 -75
- package/dist/core/mods/stations.js +57 -53
- package/dist/core/mods/tool-call.d.ts +12 -4
- package/dist/core/mods/tool-call.js +32 -16
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +62 -0
- package/dist/core/own-property-receipt.js +43 -0
- package/dist/core/park-selfcheck.js +12 -10
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +66 -11
- package/dist/core/peer-seat.js +199 -42
- package/dist/core/permission-rule-consent.d.ts +21 -26
- package/dist/core/permission-rule-consent.js +22 -3
- package/dist/core/permission-rule-model.d.ts +38 -13
- package/dist/core/permission-rule-model.js +54 -16
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +218 -122
- package/dist/core/remote-env.js +133 -14
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +8 -3
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -8
- package/dist/core/runner/assemble-result.js +12 -8
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +7 -2
- package/dist/core/runner/contracts.d.ts +158 -65
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +4 -4
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +29 -10
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
- package/dist/core/runner/prepare-boundary-parks.js +4 -4
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +30 -26
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
- package/dist/core/runner/prepare-delegation-surface.js +7 -8
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
- package/dist/core/runner/prepare-gate-stations.js +10 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
- package/dist/core/runner/prepare-hands-readface.js +19 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +12 -5
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +8 -7
- package/dist/core/runner/prepare-park-ask.js +6 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
- package/dist/core/runner/prepare-policy-chain.js +131 -128
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
- package/dist/core/runner/prepare-prompt-inputs.js +4 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
- package/dist/core/runner/prepare-suspend-saga.js +21 -13
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +84 -42
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +12 -8
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +6 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +3 -2
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +5 -3
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +15 -6
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +65 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +36 -12
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +14 -8
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +37 -19
- package/dist/core/runner/runtask.d.ts +25 -7
- package/dist/core/runner/runtask.js +46 -22
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -4
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +6 -7
- package/dist/core/runner/turn-attachments.js +4 -17
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +55 -43
- package/dist/core/secret-env.d.ts +14 -13
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +10 -3
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +5 -2
- package/dist/core/session-store.js +53 -16
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/task-event.d.ts +35 -10
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +172 -12
- package/dist/core/task-notification.js +209 -12
- package/dist/core/task-registry-agent.d.ts +23 -55
- package/dist/core/task-registry-agent.js +41 -56
- package/dist/core/task-registry-monitor.d.ts +8 -1
- package/dist/core/task-registry-monitor.js +43 -61
- package/dist/core/task-registry-shared.d.ts +52 -114
- package/dist/core/task-registry-shared.js +24 -48
- package/dist/core/task-registry-workflow.js +5 -22
- package/dist/core/task-registry.d.ts +64 -90
- package/dist/core/task-registry.js +73 -119
- package/dist/core/task-result.d.ts +27 -19
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +13 -16
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +3 -6
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +6 -4
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +23 -28
- package/dist/core/tool-name-aliases.js +63 -7
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +113 -22
- package/dist/core/tool-policy.js +85 -15
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +111 -5
- package/dist/core/tool-result-store.js +52 -12
- package/dist/core/tool-spec.d.ts +39 -10
- package/dist/core/trace.d.ts +18 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +40 -27
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
- package/dist/engine/execution-env/node-execution-env.js +224 -21
- package/dist/engine/harness/agent-harness.d.ts +66 -19
- package/dist/engine/harness/agent-harness.js +98 -27
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +151 -34
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +18 -13
- package/dist/engine/loop/agent-loop.js +173 -32
- package/dist/engine/loop/types.d.ts +21 -5
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +41 -23
- package/dist/index.js +29 -16
- package/dist/internal/harness-types.d.ts +3 -1
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +20 -20
- package/dist/orchestration/run-workflow-tool.js +63 -56
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +8 -0
- package/dist/orchestration/workflow.js +33 -9
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +19 -14
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +24 -16
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +4 -1
- package/dist/stores/file/index.d.ts +9 -6
- package/dist/stores/file/index.js +33 -9
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +43 -21
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +4 -1
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +4 -1
- package/dist/stores/file/session-store.d.ts +17 -4
- package/dist/stores/file/session-store.js +22 -19
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +31 -2
- package/dist/stores/file/tool-result-store.js +129 -7
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +4 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -13
- package/dist/stores/file/workflow-journal-store.js +4 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
- package/dist/tools/fs/fs-bash-background-text.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +11 -22
- package/dist/tools/fs/fs-bash.js +58 -154
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +34 -27
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +39 -16
- package/dist/tools/fs/fs-shared.js +25 -6
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +15 -9
- package/dist/tools/fs/index.js +12 -18
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +57 -6
- package/dist/tools/fs/read-floor.js +241 -2
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +6 -5
- package/dist/tools/fs/search.js +10 -10
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +12 -10
- package/dist/tools/monitor.js +22 -13
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +8 -3
- package/test/export-surface.snapshot.json +166 -30
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createAssistantMessageEventStream, ensureToolTurnInvariants, findToolByName, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
|
-
import { imageRefusalAt, isImageRefusal,
|
|
3
|
-
import { finalizeToolOutcome, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
|
|
2
|
+
import { imageRefusalAt, isImageRefusal, removeRefusedRequestParts } from "../llm/rejected-images.js";
|
|
3
|
+
import { finalizeToolOutcome, findUnansweredToolBatch, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
|
|
4
4
|
import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
|
|
5
5
|
import { normalizeEngineSegments } from "../../core/untrusted-text.js";
|
|
6
6
|
import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
7
7
|
import { isRunOrigin } from "../../core/run-origin.js";
|
|
8
|
+
import { countsAsOperator, readInputAuthor } from "../../core/input-author.js";
|
|
8
9
|
import { isProviderEchoShape } from "../../brain/errors.js";
|
|
9
10
|
import { convertToLlm } from "./messages.js";
|
|
10
11
|
import { readMember, thrownText } from "../../core/thrown-value.js";
|
|
@@ -47,6 +48,10 @@ function createTrailingMessage(seed) {
|
|
|
47
48
|
}
|
|
48
49
|
const engineNotePayloads = new WeakMap();
|
|
49
50
|
const engineAuthoredInjections = new WeakSet();
|
|
51
|
+
const inputAuthors = new WeakMap();
|
|
52
|
+
function isOperatorInput(m) {
|
|
53
|
+
return !engineAuthoredInjections.has(m) && countsAsOperator(readInputAuthor(inputAuthors.get(m)));
|
|
54
|
+
}
|
|
50
55
|
function isEngineAdvisory(m) {
|
|
51
56
|
return engineAuthoredInjections.has(m) && !engineNotePayloads.has(m);
|
|
52
57
|
}
|
|
@@ -59,7 +64,7 @@ function isEngineAuthoredInjection(options) {
|
|
|
59
64
|
return false;
|
|
60
65
|
if (options.engineMinted === true || options.enginePayload !== undefined)
|
|
61
66
|
return true;
|
|
62
|
-
return options.provenance === "engine-note" && options.
|
|
67
|
+
return options.provenance === "engine-note" && options.author === undefined;
|
|
63
68
|
}
|
|
64
69
|
const ENGINE_NOTE_STEER_BACKLOG_CAP = 50;
|
|
65
70
|
function createFailureMessage(model, error, aborted) {
|
|
@@ -196,6 +201,7 @@ function normalizeHarnessError(error, fallbackCode) {
|
|
|
196
201
|
function normalizeHookError(error) {
|
|
197
202
|
return normalizeHarnessError(error, "hook");
|
|
198
203
|
}
|
|
204
|
+
const PORT_PARKED_REFUSAL = "$.session.append: refused: the leg parked durably — the conversation it resumes is its checkpoint's";
|
|
199
205
|
export class AgentHarness {
|
|
200
206
|
env;
|
|
201
207
|
session;
|
|
@@ -210,7 +216,7 @@ export class AgentHarness {
|
|
|
210
216
|
boundaryStopConsumed;
|
|
211
217
|
lastPublishedSeat;
|
|
212
218
|
seatCutSources = new WeakMap();
|
|
213
|
-
|
|
219
|
+
endedOnPriorAnswer = false;
|
|
214
220
|
promptReceipt;
|
|
215
221
|
turnCutConsumed;
|
|
216
222
|
committedEntryIds = new WeakMap();
|
|
@@ -220,21 +226,25 @@ export class AgentHarness {
|
|
|
220
226
|
runAbortController;
|
|
221
227
|
runPromise;
|
|
222
228
|
pendingSessionWrites = [];
|
|
229
|
+
parkCaptureInFlight;
|
|
230
|
+
parkedPortClosed = false;
|
|
223
231
|
model;
|
|
224
232
|
modelRef;
|
|
225
233
|
thinkingLevel;
|
|
226
234
|
onUndrainedEngineNotes;
|
|
227
235
|
onToolTurnRepaired;
|
|
228
236
|
onImagesRemoved;
|
|
237
|
+
onToolSchemaRefused;
|
|
229
238
|
priorImageRefusals;
|
|
230
239
|
runHistory;
|
|
231
240
|
onUndrainedUserInputs;
|
|
241
|
+
onUndrainedOtherInputs;
|
|
232
242
|
onEngineNoteConsumed;
|
|
233
243
|
onUserInputConsumed;
|
|
234
244
|
onFrameCommitted;
|
|
235
245
|
engineInjectionsHeld;
|
|
236
246
|
imageRefusalView(messages) {
|
|
237
|
-
const view =
|
|
247
|
+
const view = removeRefusedRequestParts(messages);
|
|
238
248
|
const met = view.removals.filter((r) => this.priorImageRefusals?.has(r.refusalAt) !== true);
|
|
239
249
|
if (met.length > 0) {
|
|
240
250
|
try {
|
|
@@ -280,10 +290,10 @@ export class AgentHarness {
|
|
|
280
290
|
}
|
|
281
291
|
}
|
|
282
292
|
pendingUserInputFramesByLane() {
|
|
283
|
-
const inFlight = (lane) => this.drainedPendingInjection.filter((m) =>
|
|
293
|
+
const inFlight = (lane) => this.drainedPendingInjection.filter((m) => isOperatorInput(m) && drainedFromLane.get(m) === lane);
|
|
284
294
|
return {
|
|
285
|
-
steer: [...inFlight("steer"), ...this.steerQueue.filter((m) =>
|
|
286
|
-
followUp: [...inFlight("followUp"), ...this.followUpQueue.filter((m) =>
|
|
295
|
+
steer: [...inFlight("steer"), ...this.steerQueue.filter((m) => isOperatorInput(m))],
|
|
296
|
+
followUp: [...inFlight("followUp"), ...this.followUpQueue.filter((m) => isOperatorInput(m))],
|
|
287
297
|
};
|
|
288
298
|
}
|
|
289
299
|
pendingUserInputsByLane() {
|
|
@@ -309,6 +319,14 @@ export class AgentHarness {
|
|
|
309
319
|
catch {
|
|
310
320
|
}
|
|
311
321
|
}
|
|
322
|
+
const others = [this.drainedPendingInjection, this.steerQueue, this.followUpQueue].flatMap((q) => q.flatMap((m) => (engineAuthoredInjections.has(m) || isOperatorInput(m) ? [] : [inputAuthors.get(m)])));
|
|
323
|
+
if (others.length > 0 && this.onUndrainedOtherInputs) {
|
|
324
|
+
try {
|
|
325
|
+
this.onUndrainedOtherInputs(others);
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
}
|
|
329
|
+
}
|
|
312
330
|
return counts;
|
|
313
331
|
}
|
|
314
332
|
systemPrompt;
|
|
@@ -326,10 +344,11 @@ export class AgentHarness {
|
|
|
326
344
|
stallTimeoutsPerCall;
|
|
327
345
|
abortResultDetails;
|
|
328
346
|
executeTool;
|
|
347
|
+
admitRows;
|
|
329
348
|
activeRun;
|
|
330
349
|
loopTrace;
|
|
331
350
|
onToolInputValidationFault;
|
|
332
|
-
|
|
351
|
+
toolResultMedia;
|
|
333
352
|
resilience;
|
|
334
353
|
maxToolConcurrency;
|
|
335
354
|
streamingToolExecution;
|
|
@@ -364,9 +383,15 @@ export class AgentHarness {
|
|
|
364
383
|
this.stallTimeoutsPerCall = options.stallTimeoutsPerCall;
|
|
365
384
|
this.abortResultDetails = options.abortResultDetails;
|
|
366
385
|
this.executeTool = options.executeTool;
|
|
386
|
+
this.admitRows = options.admitRows ?? (async (rows) => rows);
|
|
387
|
+
this.pendingSessionWrites = (options.heldWrites ?? []).map((message) => ({ type: "message", message }));
|
|
367
388
|
this.loopTrace = options.loopTrace;
|
|
368
389
|
this.onToolInputValidationFault = options.onToolInputValidationFault;
|
|
369
|
-
this.
|
|
390
|
+
this.toolResultMedia = {
|
|
391
|
+
...(options.imageProcessor !== undefined ? { imageProcessor: options.imageProcessor } : {}),
|
|
392
|
+
...(options.onToolMediaRefused !== undefined ? { onToolMediaRefused: options.onToolMediaRefused } : {}),
|
|
393
|
+
...(options.onImageUnprocessed !== undefined ? { onImageUnprocessed: options.onImageUnprocessed } : {}),
|
|
394
|
+
};
|
|
370
395
|
this.resilience = options.resilience;
|
|
371
396
|
this.maxToolConcurrency = options.maxToolConcurrency;
|
|
372
397
|
this.streamingToolExecution = options.streamingToolExecution;
|
|
@@ -685,7 +710,8 @@ export class AgentHarness {
|
|
|
685
710
|
...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
|
|
686
711
|
...(this.executeTool !== undefined ? { executeTool: this.executeTool } : {}),
|
|
687
712
|
...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
|
|
688
|
-
|
|
713
|
+
onToolSchemaRefused: (refusal) => this.onToolSchemaRefused?.(refusal),
|
|
714
|
+
...this.toolResultMedia,
|
|
689
715
|
...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
|
|
690
716
|
...(this.maxToolConcurrency !== undefined ? { maxToolConcurrency: this.maxToolConcurrency } : {}),
|
|
691
717
|
...(this.streamingToolExecution === true && (this.getHandlers("tool_call")?.size ?? 0) === 0
|
|
@@ -816,8 +842,7 @@ export class AgentHarness {
|
|
|
816
842
|
if (this.runAbortController?.signal.aborted) {
|
|
817
843
|
return;
|
|
818
844
|
}
|
|
819
|
-
|
|
820
|
-
const write = this.pendingSessionWrites[0];
|
|
845
|
+
for (let write = this.pendingSessionWrites[0]; write !== undefined; write = this.pendingSessionWrites[0]) {
|
|
821
846
|
if (write.type === "message") {
|
|
822
847
|
await this.session.appendMessage(write.message);
|
|
823
848
|
}
|
|
@@ -831,7 +856,9 @@ export class AgentHarness {
|
|
|
831
856
|
const unreachable = write;
|
|
832
857
|
throw new AgentHarnessError("invalid_argument", `flushPendingSessionWrites: unhandled queued write type ${unreachable.type}`);
|
|
833
858
|
}
|
|
834
|
-
this.pendingSessionWrites.
|
|
859
|
+
const at = this.pendingSessionWrites.indexOf(write);
|
|
860
|
+
if (at >= 0)
|
|
861
|
+
this.pendingSessionWrites.splice(at, 1);
|
|
835
862
|
}
|
|
836
863
|
}
|
|
837
864
|
async recordApiFailure(failure) {
|
|
@@ -839,6 +866,7 @@ export class AgentHarness {
|
|
|
839
866
|
const apiErrorStatus = readMember(failure, "apiErrorStatus");
|
|
840
867
|
const requestId = readMember(failure, "requestId");
|
|
841
868
|
const errorKind = readMember(failure, "errorKind");
|
|
869
|
+
const refusedTool = readMember(failure, "refusedTool");
|
|
842
870
|
const raw = typeof errorMessage === "string" ? errorMessage.trim() : undefined;
|
|
843
871
|
const detail = raw !== undefined && raw.length > API_FAILURE_RECORD_MAX_CHARS
|
|
844
872
|
? `${raw.slice(0, API_FAILURE_RECORD_MAX_CHARS)}… (truncated)`
|
|
@@ -857,9 +885,11 @@ export class AgentHarness {
|
|
|
857
885
|
stopReason: "error",
|
|
858
886
|
...(typeof errorMessage === "string" ? { errorMessage } : {}),
|
|
859
887
|
...(errorKind === "length_empty" || errorKind === "degenerate" || errorKind === "input_too_long" || errorKind === "image_unprocessable" ? { errorKind } : {}),
|
|
888
|
+
...(errorKind === "tool_schema_refused" && typeof refusedTool === "string" ? { errorKind, refusedTool } : {}),
|
|
860
889
|
timestamp: failure.timestamp,
|
|
861
890
|
};
|
|
862
891
|
try {
|
|
892
|
+
await this.admitRows([record]);
|
|
863
893
|
await this.session.appendMessage(record);
|
|
864
894
|
}
|
|
865
895
|
catch {
|
|
@@ -869,6 +899,7 @@ export class AgentHarness {
|
|
|
869
899
|
if (event.type === "message_end") {
|
|
870
900
|
let entryId;
|
|
871
901
|
if (!isEmptyFailureAssistant(event.message)) {
|
|
902
|
+
await this.admitRows([event.message]);
|
|
872
903
|
entryId = await this.session.appendMessage(event.message);
|
|
873
904
|
this.committedEntryIds.set(event.message, entryId);
|
|
874
905
|
this.settleInjectedFrame(event.message, entryId);
|
|
@@ -999,11 +1030,12 @@ export class AgentHarness {
|
|
|
999
1030
|
...(options.settleUnansweredToolCalls.halt !== undefined ? { halt: options.settleUnansweredToolCalls.halt } : {}),
|
|
1000
1031
|
report: (outcome) => {
|
|
1001
1032
|
if (outcome.aborted)
|
|
1002
|
-
this.
|
|
1033
|
+
this.endedOnPriorAnswer = true;
|
|
1003
1034
|
},
|
|
1004
1035
|
},
|
|
1005
1036
|
}
|
|
1006
1037
|
: {}),
|
|
1038
|
+
...(options?.endsAwaitingUser === true ? { endsAwaitingUser: true } : {}),
|
|
1007
1039
|
});
|
|
1008
1040
|
}
|
|
1009
1041
|
catch (error) {
|
|
@@ -1027,8 +1059,13 @@ export class AgentHarness {
|
|
|
1027
1059
|
}
|
|
1028
1060
|
if (this.stopRequested || abortController.signal.aborted)
|
|
1029
1061
|
return undefined;
|
|
1030
|
-
if (this.
|
|
1031
|
-
|
|
1062
|
+
if (this.endedOnPriorAnswer || options?.endsAwaitingUser === true) {
|
|
1063
|
+
const prior = turnState.messages.findLast((m) => m.role === "assistant");
|
|
1064
|
+
if (prior !== undefined)
|
|
1065
|
+
return this.answeredFrom(prior, [prior]);
|
|
1066
|
+
if (options?.endsAwaitingUser === true)
|
|
1067
|
+
return undefined;
|
|
1068
|
+
}
|
|
1032
1069
|
throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
|
|
1033
1070
|
}
|
|
1034
1071
|
finally {
|
|
@@ -1047,7 +1084,7 @@ export class AgentHarness {
|
|
|
1047
1084
|
if (this.phase !== "idle") {
|
|
1048
1085
|
throw new AgentHarnessError("busy", "AgentHarness is busy");
|
|
1049
1086
|
}
|
|
1050
|
-
this.
|
|
1087
|
+
this.endedOnPriorAnswer = false;
|
|
1051
1088
|
this.stopRequestSources.clear();
|
|
1052
1089
|
this.boundaryStopConsumed = undefined;
|
|
1053
1090
|
this.turnCutConsumed = undefined;
|
|
@@ -1070,7 +1107,8 @@ export class AgentHarness {
|
|
|
1070
1107
|
this.runAbortController = abortController;
|
|
1071
1108
|
const finishRunPromise = this.startRunPromise();
|
|
1072
1109
|
try {
|
|
1073
|
-
await this.
|
|
1110
|
+
if (this.pendingSessionWrites.length > 0 && findUnansweredToolBatch((await this.session.buildContext()).messages) === undefined)
|
|
1111
|
+
await this.flushPendingSessionWrites();
|
|
1074
1112
|
const turnState = await this.createTurnState();
|
|
1075
1113
|
return await this.executeTurn(turnState, text, options, abortController);
|
|
1076
1114
|
}
|
|
@@ -1105,6 +1143,8 @@ export class AgentHarness {
|
|
|
1105
1143
|
engineNotePayloads.set(m, options.enginePayload);
|
|
1106
1144
|
if (isEngineAuthoredInjection(options))
|
|
1107
1145
|
engineAuthoredInjections.add(m);
|
|
1146
|
+
if (options?.author !== undefined)
|
|
1147
|
+
inputAuthors.set(m, options.author);
|
|
1108
1148
|
if (options?.parkRecord !== undefined)
|
|
1109
1149
|
userInputParkRecords.set(m, options.parkRecord);
|
|
1110
1150
|
if (options?.immediate === true)
|
|
@@ -1281,9 +1321,16 @@ export class AgentHarness {
|
|
|
1281
1321
|
async nextTurn(text, options) {
|
|
1282
1322
|
await this.enqueueInjection(this.nextTurnQueue, text, options);
|
|
1283
1323
|
}
|
|
1284
|
-
async appendMessage(message) {
|
|
1324
|
+
async appendMessage(message, raising) {
|
|
1325
|
+
const kept = await this.admitRows([message], raising);
|
|
1326
|
+
if (!kept.includes(message))
|
|
1327
|
+
return;
|
|
1328
|
+
while (this.parkCaptureInFlight !== undefined)
|
|
1329
|
+
await this.parkCaptureInFlight;
|
|
1330
|
+
if (this.parkedPortClosed)
|
|
1331
|
+
throw new AgentHarnessError("invalid_state", PORT_PARKED_REFUSAL);
|
|
1285
1332
|
try {
|
|
1286
|
-
if (this.phase === "idle") {
|
|
1333
|
+
if (this.phase === "idle" && this.pendingSessionWrites.length === 0) {
|
|
1287
1334
|
await this.session.appendMessage(message);
|
|
1288
1335
|
}
|
|
1289
1336
|
else {
|
|
@@ -1307,7 +1354,7 @@ export class AgentHarness {
|
|
|
1307
1354
|
return patch;
|
|
1308
1355
|
}
|
|
1309
1356
|
finalizeToolCall(toolCall, args, executed) {
|
|
1310
|
-
return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError), this.
|
|
1357
|
+
return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError), this.toolResultMedia);
|
|
1311
1358
|
}
|
|
1312
1359
|
async callTool(toolCall, signal, admit) {
|
|
1313
1360
|
const run = this.activeRun;
|
|
@@ -1445,12 +1492,39 @@ export class AgentHarness {
|
|
|
1445
1492
|
throw normalizeHarnessError(error, "session");
|
|
1446
1493
|
}
|
|
1447
1494
|
}
|
|
1495
|
+
parkCapture() {
|
|
1496
|
+
if (this.parkCaptureInFlight !== undefined)
|
|
1497
|
+
throw new AgentHarnessError("invalid_state", "a park's capture of the held rows is already in progress");
|
|
1498
|
+
const rows = this.pendingSessionWrites.flatMap((write) => (write.type === "message" ? [write.message] : []));
|
|
1499
|
+
let release = () => undefined;
|
|
1500
|
+
this.parkCaptureInFlight = new Promise((resolve) => (release = resolve));
|
|
1501
|
+
let settled = false;
|
|
1502
|
+
return {
|
|
1503
|
+
rows,
|
|
1504
|
+
settle: (outcome) => {
|
|
1505
|
+
if (settled)
|
|
1506
|
+
return;
|
|
1507
|
+
settled = true;
|
|
1508
|
+
if (outcome === "committed") {
|
|
1509
|
+
const taken = new Set(rows);
|
|
1510
|
+
this.pendingSessionWrites = this.pendingSessionWrites.filter((write) => write.type !== "message" || !taken.has(write.message));
|
|
1511
|
+
}
|
|
1512
|
+
if (outcome !== "absent")
|
|
1513
|
+
this.parkedPortClosed = true;
|
|
1514
|
+
this.parkCaptureInFlight = undefined;
|
|
1515
|
+
release();
|
|
1516
|
+
},
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
heldSessionWrites() {
|
|
1520
|
+
return [...this.pendingSessionWrites];
|
|
1521
|
+
}
|
|
1448
1522
|
readParkableUserInputs() {
|
|
1449
1523
|
const out = [];
|
|
1450
1524
|
for (const q of [this.drainedPendingInjection, this.steerQueue, this.followUpQueue]) {
|
|
1451
1525
|
for (const m of q) {
|
|
1452
1526
|
const record = userInputParkRecords.get(m);
|
|
1453
|
-
if (record !== undefined)
|
|
1527
|
+
if (record !== undefined && isOperatorInput(m))
|
|
1454
1528
|
out.push(record);
|
|
1455
1529
|
}
|
|
1456
1530
|
}
|
|
@@ -1497,10 +1571,7 @@ export class AgentHarness {
|
|
|
1497
1571
|
errors.push(toError(error));
|
|
1498
1572
|
}
|
|
1499
1573
|
this.sweepUndrainedEngineNotes([this.drainedPendingInjection, this.nextTurnQueue, this.steerQueue, this.followUpQueue]);
|
|
1500
|
-
const
|
|
1501
|
-
const inFlightOf = (lane) => this.drainedPendingInjection.filter((m) => userAuthored(m) && drainedFromLane.get(m) === lane);
|
|
1502
|
-
const undrainedSteer = [...inFlightOf("steer"), ...this.steerQueue.filter(userAuthored)];
|
|
1503
|
-
const undrainedFollowUp = [...inFlightOf("followUp"), ...this.followUpQueue.filter(userAuthored)];
|
|
1574
|
+
const { steer: undrainedSteer, followUp: undrainedFollowUp } = this.pendingUserInputFramesByLane();
|
|
1504
1575
|
try {
|
|
1505
1576
|
await this.emitOwn({ type: "abort", undrainedSteer, undrainedFollowUp });
|
|
1506
1577
|
}
|
|
@@ -26,7 +26,8 @@ export declare const NORMALIZED_CONTENT_PREFIX = "[invalid content block normali
|
|
|
26
26
|
* `convertToLlm` (provider leg) and `serializeConversation` (compaction leg) — one helper, two mouths.
|
|
27
27
|
*/
|
|
28
28
|
export declare function normalizeLlmMessageContent<T extends Message>(message: T): T;
|
|
29
|
-
/** Convert harness transcript messages into the LLM-facing message sequence. A provider's
|
|
30
|
-
* record) removes the images it refused ({@link
|
|
31
|
-
* the request leg applies it earlier, where its view starts, so there this
|
|
29
|
+
/** Convert harness transcript messages into the LLM-facing message sequence. A provider's refusal of part of a request
|
|
30
|
+
* (live or its record) leaves the view, and an image refusal removes the images it refused ({@link removeRefusedRequestParts})
|
|
31
|
+
* for every leg — provider and compaction alike; the request leg applies it earlier, where its view starts, so there this
|
|
32
|
+
* pass is the identity. */
|
|
32
33
|
export declare function convertToLlm(messages: AgentMessage[]): Message[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isSyntheticApiErrorMessage } from "./types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { removeRefusedRequestParts } from "../llm/rejected-images.js";
|
|
3
3
|
import { parseSessionTimestampMs, requireSessionTimestampMs } from "../session/timestamps.js";
|
|
4
4
|
export function asAgentMessage(message) {
|
|
5
5
|
return message;
|
|
@@ -108,7 +108,7 @@ export function normalizeLlmMessageContent(message) {
|
|
|
108
108
|
return changed ? { ...message, content: blocks } : message;
|
|
109
109
|
}
|
|
110
110
|
export function convertToLlm(messages) {
|
|
111
|
-
return
|
|
111
|
+
return removeRefusedRequestParts(messages)
|
|
112
112
|
.messages.map((m) => {
|
|
113
113
|
const message = m;
|
|
114
114
|
switch (message.role) {
|
|
@@ -108,7 +108,13 @@ export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not
|
|
|
108
108
|
/** A name this filesystem cannot hold (POSIX `ENAMETOOLONG` for a path component past `NAME_MAX`) — nothing can be there, and
|
|
109
109
|
* a program that opens it fails the same way: an absence as conclusive as `not_found`. A path past `PATH_MAX` whose
|
|
110
110
|
* components are short is not this word (such a file may exist, reached from a directory below it). */
|
|
111
|
-
| "name_too_long"
|
|
111
|
+
| "name_too_long"
|
|
112
|
+
/** A symbolic-link chain that loops (POSIX `ELOOP`: a link that points at itself, a cycle of links, a chain past the platform's
|
|
113
|
+
* follow limit) — nothing can be opened through it, but it is NOT an absence: the entries exist and the path resolves to
|
|
114
|
+
* nothing. The word says "this path leads to no directory": a probe that asks whether a directory is usable reads it as
|
|
115
|
+
* unusable (as `not_found` / `not_directory`), while a judge that must vouch for where a path lands reads it as unresolved
|
|
116
|
+
* (as the catch-all `unknown`), never as "nothing is there". */
|
|
117
|
+
| "symlink_loop" | "invalid" | "not_supported"
|
|
112
118
|
/** Exclusive create refused because the path already exists ({@link FileSystem.writeFileExclusive},
|
|
113
119
|
* POSIX `O_EXCL` shape). Discriminable so a caller can distinguish "lost the create race" from a
|
|
114
120
|
* write failure and give honest guidance instead of overwriting. */
|
|
@@ -202,7 +208,7 @@ export declare class ExecutionError extends Error {
|
|
|
202
208
|
* never observed, but its captured output is real work). Reference behavior (BashTask settle): a
|
|
203
209
|
* timed-out command keeps ALL captured stdout/stderr and only APPENDS a "Command timed out after
|
|
204
210
|
* X" line — discarding 600s of build logs forces the model to rerun blind. Optional: envs that
|
|
205
|
-
* cannot capture partial output
|
|
211
|
+
* cannot capture partial output omit these (absent = not captured, never "not produced"); never-started codes
|
|
206
212
|
* (spawn_error/shell_unavailable) have no output by definition.
|
|
207
213
|
*/
|
|
208
214
|
partialStdout?: string;
|
|
@@ -340,14 +346,28 @@ export interface ExecutionEnvExecOptions {
|
|
|
340
346
|
* behavior. Envs without detach support ignore this (opt-in, backward compatible).
|
|
341
347
|
*/
|
|
342
348
|
autoBackgroundOnTimeout?: boolean;
|
|
343
|
-
/** VENDORED EDIT (the byte floor) — the read-deny table
|
|
349
|
+
/** VENDORED EDIT (the byte floor) — the read-deny table this start judges with ({@link ReadFloor}): a call's own pinned table, else the run's; every start a run makes carries it, whether or not its output reaches the model.
|
|
350
|
+
* What its processes OPEN is the environment's to keep ({@link ExecutionEnvCapabilities.keepsReadFloor}). Absent ⇔ the table holds no row, or the start is no run's (`runExecGate`, the oracle's isolation probe). */
|
|
344
351
|
readFloor?: ReadFloor;
|
|
345
352
|
}
|
|
346
|
-
/** The read-deny table one command start carries ({@link ExecutionEnvExecOptions.readFloor}); what an environment keeps of it is INTEGRATION-CORE §11.1.
|
|
353
|
+
/** The read-deny table one command start carries ({@link ExecutionEnvExecOptions.readFloor}); what an environment keeps of it is INTEGRATION-CORE §11.1.
|
|
354
|
+
* Path semantics: a path is judged as spelled, never resolved (a hard link is another path; a symbolic link is resolved where the environment opens it). Pinned at the start: a floor with an `id` judges with that start's table for its processes' life. Exec is no read: a `#!` line's bytes, a self-printing binary (KNOWN-LIMITS KL-3190-a). */
|
|
347
355
|
export interface ReadFloor {
|
|
356
|
+
/** The compiled table this floor stands on (`ReadDenyMatcher.id`): one `id` ⇒ one judgment of every path, so a relay may keep what it derived by it; absent ⇒ no one compiled table (hand-built, or a band's placement in flight) — derive per start. */
|
|
357
|
+
readonly id?: string;
|
|
348
358
|
readonly rows: readonly string[];
|
|
349
359
|
/** The row denying an absolute path in this environment's namespace, or `null`: the read station's own judgment. Never throws. */
|
|
350
360
|
denies(absolutePath: string): string | null;
|
|
361
|
+
/** The floor as an OS confinement profile (`"seatbelt"`: `sandbox-exec -p`), from the table `denies` judges with; a row the
|
|
362
|
+
* dialect cannot express answers `{ ok: false, row, reason }` and the start is refused, never run looser. Never throws. */
|
|
363
|
+
confinement(dialect: "seatbelt"): {
|
|
364
|
+
readonly ok: true;
|
|
365
|
+
readonly profile: string;
|
|
366
|
+
} | {
|
|
367
|
+
readonly ok: false;
|
|
368
|
+
readonly row: string;
|
|
369
|
+
readonly reason: string;
|
|
370
|
+
};
|
|
351
371
|
}
|
|
352
372
|
/**
|
|
353
373
|
* Filesystem capability used by the harness.
|
|
@@ -377,7 +397,8 @@ export interface FileSystem {
|
|
|
377
397
|
/** Create or overwrite a file, creating parent directories when supported. Implementation note
|
|
378
398
|
* (RB-221): the Node env replaces the file as a WHOLE (same-directory staging + fsync +
|
|
379
399
|
* rename; `aborted` ⇒ target untouched), falling back to an in-place rewrite where rename cannot
|
|
380
|
-
* apply (cross-device, symlink chains, non-regular targets, read-only parent dir)
|
|
400
|
+
* apply (cross-device, symlink chains, non-regular targets, read-only parent dir) — a fallback judges
|
|
401
|
+
* the signal once, before its first byte, so `aborted` never describes a truncated file. Atomicity is an
|
|
381
402
|
* implementation quality, NOT an interface-level contract — a remote/transport env may only have a
|
|
382
403
|
* plain in-place write. */
|
|
383
404
|
writeFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
@@ -490,8 +511,114 @@ export interface Shell {
|
|
|
490
511
|
/** Release shell resources. Must be best-effort and must not throw or reject. */
|
|
491
512
|
cleanup(): Promise<void>;
|
|
492
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* #2891 — what an execution environment can do and where its actions land: the ONE place each of these questions is
|
|
516
|
+
* answered, declared by the ADAPTER on every environment ({@link ExecutionEnv.capabilities}), local or remote.
|
|
517
|
+
*
|
|
518
|
+
* Every key is REQUIRED and has no default reading: for each one, either answer an absent value could be given is
|
|
519
|
+
* wrong for some environment, so an adapter states it. A value that is absent, not a boolean, or cannot be received (a
|
|
520
|
+
* throwing getter, a Proxy — a JS adapter's block) — and a member outside the eight keys — is announced once per run at
|
|
521
|
+
* the admission point (`config.execution_env_capability_invalid`, `detail.key` naming it, or `capabilities` for a block
|
|
522
|
+
* that is no object or cannot be received), and each reader takes that key's SAFE side, written beside the readers
|
|
523
|
+
* (`UNDECLARED_CAPABILITY_READING`, `src/core/remote-env.ts`). Every key is read through its one reader there.
|
|
524
|
+
*
|
|
525
|
+
* What an INTERFACE answers is a different question: whether a group of methods can be called (the remote seam's
|
|
526
|
+
* lifecycle, a background shell, a scheduler, an optional filesystem method). Implementing a group of methods never
|
|
527
|
+
* declares a capability, and a capability never stands in for a method.
|
|
528
|
+
*
|
|
529
|
+
* The block is a constant of the adapter: the engine receives it ONCE per environment object (at its first read, a
|
|
530
|
+
* run's admission point) into a frozen copy every reader reads; a later change by the host is never read.
|
|
531
|
+
*/
|
|
532
|
+
export interface ExecutionEnvCapabilities {
|
|
533
|
+
/** True iff the commands run inside a sandbox that IS the security boundary (container, microVM, pod); false for
|
|
534
|
+
* a real target (the engine's own host, an SSH host, a device). Every consumer of a `true` here RELAXES something
|
|
535
|
+
* (autonomy, a policy tier, a containment leg the sandbox is then answerable for), so only the boolean `true`
|
|
536
|
+
* counts. Undeclared ⇒ `false`. Read through `isIsolated`. */
|
|
537
|
+
readonly isolation: boolean;
|
|
538
|
+
/** True iff the environment can be snapshot (`suspendVM`) and restored; false for one that cannot (a local
|
|
539
|
+
* process, an SSH host, a device).
|
|
540
|
+
*
|
|
541
|
+
* ⚠️ LOAD-BEARING INVARIANT: `suspendable: false` on a remote environment also asserts the workspace is
|
|
542
|
+
* EXTERNALLY DURABLE — it persists on the target across the environment object's lifetime (true for SSH hosts and
|
|
543
|
+
* devices). The durable-park-only suspend degrade rests on this: it skips `suspendVM` and trusts the factory to
|
|
544
|
+
* reconnect to the SAME workspace on resume. An adapter for a non-suspendable EPHEMERAL backend (a snapshot-less
|
|
545
|
+
* container torn down with its transport) must NOT be modeled as `suspendable: false` remote — it would silently
|
|
546
|
+
* take the park-only branch and resume onto a fresh empty workspace. Model such a backend as a per-task
|
|
547
|
+
* environment without durable suspend instead (the human gate refuses it), or split this key before building one.
|
|
548
|
+
* Undeclared ⇒ neither suspendable nor parkable. Read through `declaredSuspend` (three states) and `isSuspendable`
|
|
549
|
+
* (a declared `true` with the remote interface and its restore surface). */
|
|
550
|
+
readonly suspendable: boolean;
|
|
551
|
+
/** True iff the commands this environment runs are processes on a table that holds THIS process — the table the
|
|
552
|
+
* engine itself and the processes above it are on, so a kill the model writes there can reach them. `true` for an
|
|
553
|
+
* environment that spawns the commands as this process's own descendants (`NodeExecutionEnv`, a host lane) and for
|
|
554
|
+
* one whose commands run in a PID namespace that contains this process's (the host of the container the engine
|
|
555
|
+
* runs in); `false` only for one whose commands run where this process is not: another machine (SSH host, device,
|
|
556
|
+
* cloud sandbox) or a PID namespace this process is not in (a sandbox container, a pod). Not {@link isolation}: a
|
|
557
|
+
* non-isolated SSH host is a real machine and still another table. The self-preservation guard of the Bash tool
|
|
558
|
+
* asks its question exactly when this is `true`, and does not ask where it is `false`.
|
|
559
|
+
*
|
|
560
|
+
* What a `true` buys is the guard's question exactly as a `NodeExecutionEnv` gets it, limits included: on this
|
|
561
|
+
* process's own table, of the platform's `pgrep`, with the kill's words as written, from this process's own
|
|
562
|
+
* working directory. It is put as for this process's descendants, so for commands on the same table that are not
|
|
563
|
+
* (SSH to `localhost`) BSD's `pgrep` leaves its OWN caller's ancestors out where the real kill would not, and from
|
|
564
|
+
* an enclosing namespace the question sees only this process's namespace, not the ancestors above it.
|
|
565
|
+
*
|
|
566
|
+
* Undeclared ⇒ the guard refuses every pattern kill that needs the question on this environment (`pkill -P $$`
|
|
567
|
+
* runs), naming this declaration. Read through `processTableOf`. */
|
|
568
|
+
readonly sharesProcessTable: boolean;
|
|
569
|
+
/** True iff this environment's {@link FileSystem.canonicalPath} is the AUTHORITY on where a path lands — it
|
|
570
|
+
* answers for the very filesystem the commands run on, so a failure to answer is a failure of the resolver rather
|
|
571
|
+
* than a namespace it cannot see into. A `true` makes the read boundary's execute-time recheck REFUSE a chain its
|
|
572
|
+
* resolver cannot answer at all instead of passing the written spelling through; `false` keeps the lexical
|
|
573
|
+
* verdict for a chain the resolver answers `not_supported` (no file face). A resolver that FAILS (any other
|
|
574
|
+
* non-answer) is a failure either way. `NodeExecutionEnv` declares `true` (its resolver always answers `/`, so the
|
|
575
|
+
* arm has no case to fire on); an environment with no path resolution surface declares `false`. Undeclared ⇒
|
|
576
|
+
* `true` (silence refuses). Read through `canonicalPathIsAuthoritative`. */
|
|
577
|
+
readonly canonicalPathAuthoritative: boolean;
|
|
578
|
+
/** True iff a path this environment names is the same file on the ENGINE HOST's filesystem — the engine may
|
|
579
|
+
* present this environment's cwd as a host path (the workflow workspace observer's `worktreeDir`) and record
|
|
580
|
+
* host-path receipts for it. `true` for `NodeExecutionEnv` and for a host lane that drives the engine's own
|
|
581
|
+
* machine; `false` for an environment whose paths never map onto the host (an in-memory environment, a sandbox
|
|
582
|
+
* or container the host does not mount at the same paths, another machine). Undeclared ⇒ `false`. Read through
|
|
583
|
+
* `pathsAreHostLocal`. */
|
|
584
|
+
readonly hostLocalPaths: boolean;
|
|
585
|
+
/** True iff content produced by THIS environment (every FileSystem / Shell result — stdout, file bytes, listings,
|
|
586
|
+
* names) originates from a target OUTSIDE the deployment's trust boundary (a personal device, an unmanaged host).
|
|
587
|
+
* `true` feeds three existing channels, no new vocabulary:
|
|
588
|
+
* - memory: the run's hand-tool results are treated as external-class content — the session mark
|
|
589
|
+
* (`memory.session_polluted`) and the origin carriage at harvest, via the same fold `execIsExternalContent`
|
|
590
|
+
* upgrades through (this key ORs into that fold for the run);
|
|
591
|
+
* - env facts / prompt renderer: one declarative line disclosing the execution locus and trust posture;
|
|
592
|
+
* - audit: TaskResult / checkpoint carry it implicitly through `WorkspaceHandle{provider, deviceId}`.
|
|
593
|
+
* Suspend / resume: the run-level fold is PRESENCE-persisted on the checkpoint (`CheckpointState.externalContentTarget`,
|
|
594
|
+
* monotonic) and resume joins persisted OR live declaration — a run minted under a declaring adapter never
|
|
595
|
+
* silently downgrades on an undeclaring or older one. ONE declaration, two readers: the content-class fold above
|
|
596
|
+
* (no gate, policy or roster reads that fold) and the cross-boundary taint (it arms the run tree's taint bit; a
|
|
597
|
+
* call's `env` leg is judged by whether the environment THAT CALL reaches declares this, never by the
|
|
598
|
+
* fold). ORTHOGONAL to {@link isolation}: an SSH environment to an organization-managed build host can be
|
|
599
|
+
* non-isolated and still declare `false`. Undeclared ⇒ each consumer's safe side: the content fold reads it as outside,
|
|
600
|
+
* and a call that reaches the environment owes what reaching the target and what leaving it both owe. Read through
|
|
601
|
+
* `targetIsExternal` (three states). */
|
|
602
|
+
readonly externalContentTarget: boolean;
|
|
603
|
+
/** True iff the filesystem and shell faces reach a target. `false` only for a placeholder whose every operation
|
|
604
|
+
* refuses (each filesystem operation `not_supported`, every `exec` `shell_unavailable` — `StubExecutionEnv`, the
|
|
605
|
+
* environment of a run without hands). Undeclared ⇒ no shell face mounts, and the project marker is still read
|
|
606
|
+
* through it, never past its read limits. Read through `performsIo` (three states). */
|
|
607
|
+
readonly io: boolean;
|
|
608
|
+
/** True iff this environment keeps the byte floor a command start carries ({@link ExecutionEnvExecOptions.readFloor}):
|
|
609
|
+
* every path its `denies` answers non-null for stays unreadable to every program the command runs, judged where the
|
|
610
|
+
* environment itself resolves the path — or the environment refuses a start whose whole table it cannot keep
|
|
611
|
+
* (`spawn_error`, naming the row) rather than run with fewer rows (INTEGRATION-CORE §11.1). `false` for an
|
|
612
|
+
* environment that cannot confine a process (`NodeExecutionEnv`, a host lane, an SSH host, a device): a run whose
|
|
613
|
+
* read-deny table is non-empty on such an environment is announced (`config.read_deny_floor_unkept`), or refused
|
|
614
|
+
* at prepare when the deployment sets `RunnerDeps.readDenyFloorRequired`. `StubExecutionEnv` declares `true`:
|
|
615
|
+
* it refuses every start, so no byte can be read through it. Undeclared ⇒ `false`. Read through `keepsReadFloor`. */
|
|
616
|
+
readonly keepsReadFloor: boolean;
|
|
617
|
+
}
|
|
493
618
|
/** Filesystem and process execution environment used by the harness. */
|
|
494
619
|
export interface ExecutionEnv extends FileSystem, Shell {
|
|
620
|
+
/** What this environment can do and where its actions land — {@link ExecutionEnvCapabilities}, every key required. */
|
|
621
|
+
readonly capabilities: ExecutionEnvCapabilities;
|
|
495
622
|
/**
|
|
496
623
|
* design/164 件四 — the environment's PLATFORM LIFETIME in milliseconds: how long this sandbox/VM is
|
|
497
624
|
* allowed to exist before the platform reclaims it, counted from {@link lifetimeStartedAt}. Declared by
|
|
@@ -522,34 +649,6 @@ export interface ExecutionEnv extends FileSystem, Shell {
|
|
|
522
649
|
* mechanism exists to prevent.
|
|
523
650
|
*/
|
|
524
651
|
readonly lifetimeStartedAt?: number;
|
|
525
|
-
/**
|
|
526
|
-
* #211 (design/199 seam) — does this environment's path NAMESPACE live on the CONTROL-PLANE HOST's
|
|
527
|
-
* filesystem? Declared by the ADAPTER: `false` for a virtual/sandboxed env whose paths never map
|
|
528
|
-
* onto the host (an in-memory env, a container the host cannot mount) — consumers that record
|
|
529
|
-
* host-path receipts (the workflow workspace observer's `worktreeDir`) then refuse to present this
|
|
530
|
-
* env's cwd as a host path. Omitted ⇒ the historical structural inference stays in force
|
|
531
|
-
* (isRemoteExecutionEnv shape detection; a plain NodeExecutionEnv is host-local). `true` is a
|
|
532
|
-
* harmless explicit spelling of the local default.
|
|
533
|
-
*/
|
|
534
|
-
readonly hostLocalPaths?: boolean;
|
|
535
|
-
/**
|
|
536
|
-
* design/380 O9 — declared by the ADAPTER: content produced by THIS env (every FileSystem/Shell
|
|
537
|
-
* result — stdout, file bytes, listings, names) originates from a target OUTSIDE the deployment's
|
|
538
|
-
* trust boundary (a personal device, an unmanaged host). Omitted ⇒ historic behavior (trusted-side
|
|
539
|
-
* results). `true` feeds three EXISTING channels, no new vocabulary:
|
|
540
|
-
* - memory: the run's hand-tool results are treated as external-class content — the session mark
|
|
541
|
-
* (`memory.session_polluted`) + the design/336 origin carriage at harvest, via the same fold
|
|
542
|
-
* `execIsExternalContent` upgrades through (this flag ORs into that fold for the run);
|
|
543
|
-
* - env facts / prompt renderer: one declarative line disclosing the execution locus + trust posture;
|
|
544
|
-
* - audit: TaskResult/checkpoint carry it implicitly through WorkspaceHandle{provider, deviceId}.
|
|
545
|
-
* Suspend/resume: the run-level fold is PRESENCE-persisted on the checkpoint
|
|
546
|
-
* (`CheckpointState.externalContentTarget`, monotonic) and resume joins persisted OR live
|
|
547
|
-
* declaration — a run minted under a declaring adapter never silently downgrades on an
|
|
548
|
-
* undeclared/older one. ONE declaration, two readers: the content-class fold above (the design/378 red line binds that fold — no gate/policy/roster reads it) and the
|
|
549
|
-
* cross-boundary taint (it arms the run tree's taint bit; a call's `env` leg is judged by whether the env it reaches declares this flag AT THAT MOMENT, never by the fold).
|
|
550
|
-
* ORTHOGONAL to `capabilities.isolation` — an SSH env to an organization-managed build host can be non-isolated yet omit this flag.
|
|
551
|
-
*/
|
|
552
|
-
readonly externalContentTarget?: boolean;
|
|
553
652
|
/**
|
|
554
653
|
* #644 — declared by the ADAPTER: the HOME DIRECTORY of the user this environment runs as, as an absolute
|
|
555
654
|
* path in the environment's own namespace. The base a `~/`-relative permission rule (`Edit(~/.ssh/**)`)
|
|
@@ -1552,6 +1651,10 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1552
1651
|
/** Loop-config pass-through — see `AgentLoopConfig.onToolMediaRefused` (the tool-result seat's account of the media it
|
|
1553
1652
|
* refused); the harness's own finalization of a resumed approved call reports through the same sink. */
|
|
1554
1653
|
onToolMediaRefused?: import("../loop/types.js").AgentLoopConfig["onToolMediaRefused"];
|
|
1654
|
+
/** Loop-config pass-through — see `AgentLoopConfig.imageProcessor` (the tool-result seat's processor). */
|
|
1655
|
+
imageProcessor?: import("../loop/types.js").AgentLoopConfig["imageProcessor"];
|
|
1656
|
+
/** Loop-config pass-through — see `AgentLoopConfig.onImageUnprocessed` (an image that goes on unprocessed over the soft target). */
|
|
1657
|
+
onImageUnprocessed?: import("../loop/types.js").AgentLoopConfig["onImageUnprocessed"];
|
|
1555
1658
|
/**
|
|
1556
1659
|
* design/131 (拍): per-task resilience intent flags, forwarded to every provider
|
|
1557
1660
|
* call (`StreamOptions.resilience`) so the deployment's decorator stack (degrading / failover /
|
|
@@ -1569,5 +1672,19 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1569
1672
|
* contract, see AgentLoopConfig.streamingToolExecution).
|
|
1570
1673
|
*/
|
|
1571
1674
|
streamingToolExecution?: boolean;
|
|
1572
|
-
|
|
1675
|
+
/** The one seat every row passes at each harness commit point (a row the loop ends, an API failure's record, a row handed
|
|
1676
|
+
* to {@link AgentHarness.appendMessage}), before the live context and the store; absent ⇒ every row passes as made. */
|
|
1677
|
+
admitRows?: RowAdmission;
|
|
1678
|
+
/** The rows a parked leg's port held when its checkpoint was taken (`Checkpoint.heldRows`): the queue's first entries, written
|
|
1679
|
+
* at the transcript's first legal point (the prompt start, or — while the branch ends in a batch with unanswered calls — that
|
|
1680
|
+
* batch's settlement boundary), never through the admission seat again. Absent ⇒ the queue starts empty. */
|
|
1681
|
+
heldWrites?: readonly AgentMessage[];
|
|
1682
|
+
}
|
|
1683
|
+
/** A row its caller raises itself: a token the admitting seat minted and knows by identity; the harness hands it on unread. */
|
|
1684
|
+
export interface RowRaising {
|
|
1685
|
+
readonly door: "note";
|
|
1686
|
+
}
|
|
1687
|
+
/** The admission seat ({@link AgentHarnessOptions.admitRows}): the rows to keep, in order — every row handed in, except a
|
|
1688
|
+
* raised one its raiser's handlers refused. A rewrite is made in place, on the row itself. */
|
|
1689
|
+
export type RowAdmission = (rows: readonly AgentMessage[], raising?: RowRaising) => Promise<readonly AgentMessage[]>;
|
|
1573
1690
|
export type { AgentHarness } from "./agent-harness.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one wording of a media block that left the model's view of a request while the transcript keeps it. A block leaves
|
|
3
|
+
* for one of two reasons ({@link MEDIA_REMOVED_REASONS}): the provider refused the request because an image in it could
|
|
4
|
+
* not be processed (`engine/llm/rejected-images.ts`), or the request's media budget had no room left for it (the request
|
|
5
|
+
* trim, `core/media-byte-cap.ts`). Either way the block's slot holds the line {@link mediaRemovedPlaceholder} writes, and
|
|
6
|
+
* the person hears it under the one code `context.media_removed`, whose `detail.reason` is the same word.
|
|
7
|
+
*/
|
|
8
|
+
/** The `errorKind` a provider's image refusal carries (`AssistantMessage.errorKind`). */
|
|
9
|
+
export declare const IMAGE_REFUSAL_KIND = "image_unprocessable";
|
|
10
|
+
/** Why a media block left the request view — `context.media_removed` `detail.reason`, closed. */
|
|
11
|
+
export declare const MEDIA_REMOVED_REASONS: readonly ["rejected_by_provider", "media_budget"];
|
|
12
|
+
export type MediaRemovedReason = (typeof MEDIA_REMOVED_REASONS)[number];
|
|
13
|
+
/** The text that stands in for the `ordinal`-th (1-based) block of its `type` in its message, removed for `reason`. */
|
|
14
|
+
export declare function mediaRemovedPlaceholder(reason: MediaRemovedReason, type: "image" | "document", ordinal: number): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const IMAGE_REFUSAL_KIND = "image_unprocessable";
|
|
2
|
+
export const MEDIA_REMOVED_REASONS = Object.freeze(["rejected_by_provider", "media_budget"]);
|
|
3
|
+
const WHY = Object.freeze({
|
|
4
|
+
rejected_by_provider: `rejected by provider: ${IMAGE_REFUSAL_KIND}`,
|
|
5
|
+
media_budget: "over the request media budget — re-read the file if you still need to see it",
|
|
6
|
+
});
|
|
7
|
+
export function mediaRemovedPlaceholder(reason, type, ordinal) {
|
|
8
|
+
return `[${type} ${ordinal} removed: ${WHY[reason]}]`;
|
|
9
|
+
}
|