@sema-agent/core 7.60.0 → 7.62.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 +917 -0
- package/README.md +2 -2
- package/dist/agents/agent-transcript-tool.d.ts +2 -2
- package/dist/agents/agent-transcript-tool.js +1 -1
- package/dist/agents/cascade.d.ts +71 -12
- package/dist/agents/cascade.js +61 -21
- 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 -0
- package/dist/agents/inherited-tool-pool.d.ts +5 -3
- package/dist/agents/inherited-tool-pool.js +2 -2
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-held-queue.d.ts +27 -4
- package/dist/agents/peer-held-queue.js +81 -36
- 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 +49 -10
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.js +3 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +7 -4
- package/dist/agents/send-message-tool.d.ts +8 -10
- package/dist/agents/send-message-tool.js +43 -23
- 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 +36 -41
- package/dist/agents/subagent.js +245 -200
- package/dist/agents/suspend-guard.d.ts +47 -16
- package/dist/agents/suspend-guard.js +13 -4
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +41 -30
- package/dist/brain/anthropic.js +1 -0
- 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/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +59 -23
- package/dist/core/allow-entry.js +131 -38
- 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.js +3 -5
- package/dist/core/background-agent-store.d.ts +7 -5
- package/dist/core/background-agent-store.js +12 -11
- package/dist/core/checkpoint-features.d.ts +722 -0
- package/dist/core/checkpoint-features.js +98 -0
- package/dist/core/checkpoint-requirements.d.ts +33 -5
- package/dist/core/checkpoint-requirements.js +18 -5
- package/dist/core/checkpoint-row-verdict.d.ts +99 -0
- package/dist/core/checkpoint-row-verdict.js +225 -0
- package/dist/core/checkpoint-store.d.ts +107 -738
- package/dist/core/checkpoint-store.js +45 -143
- 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/context-settings.js +3 -5
- package/dist/core/cross-boundary-taint.d.ts +1 -1
- 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 +68 -21
- package/dist/core/engine-notice.js +9 -2
- 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 +10 -0
- package/dist/core/frame-settlement.js +6 -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 +4 -3
- package/dist/core/gate-lanes.js +7 -4
- 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 +14 -4
- package/dist/core/governance-codes.js +19 -4
- package/dist/core/hooks.d.ts +25 -4
- package/dist/core/hooks.js +11 -4
- package/dist/core/host-floor.js +3 -5
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +47 -7
- package/dist/core/image-admission.js +35 -4
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -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 +4 -3
- package/dist/core/locked-config.js +5 -3
- 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-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +76 -15
- package/dist/core/mcp-failure.js +60 -33
- package/dist/core/mcp-host-seat.d.ts +92 -53
- package/dist/core/mcp-host-seat.js +225 -46
- package/dist/core/mcp-probe.js +2 -2
- 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 +2 -1
- 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 +6 -49
- package/dist/core/mcp.js +115 -111
- 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-engine/consolidation-driver.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- 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/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/sync-client.d.ts +39 -18
- package/dist/core/memory-engine/sync-client.js +72 -14
- package/dist/core/memory-engine/sync-report.d.ts +7 -4
- package/dist/core/memory-engine/sync.d.ts +9 -1
- package/dist/core/memory-vector.d.ts +1 -1
- package/dist/core/memory.d.ts +10 -10
- package/dist/core/mode-policy.d.ts +8 -8
- package/dist/core/mode-policy.js +8 -6
- package/dist/core/mods/agent-stations.d.ts +39 -4
- package/dist/core/mods/agent-stations.js +59 -10
- package/dist/core/mods/classic-events.d.ts +9 -1
- package/dist/core/mods/dollar.d.ts +94 -1
- package/dist/core/mods/dollar.js +13 -1
- 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 +4 -3
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +14 -3
- package/dist/core/mods/kernel/events.js +18 -15
- 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 +36 -4
- package/dist/core/mods/lifecycle-stations.js +44 -9
- package/dist/core/mods/session-append.d.ts +118 -0
- package/dist/core/mods/session-append.js +318 -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 +138 -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 +88 -21
- package/dist/core/mods/stations.js +149 -11
- package/dist/core/mods/tool-call.d.ts +2 -0
- package/dist/core/mods/tool-call.js +4 -4
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +68 -2
- package/dist/core/own-property-receipt.js +45 -2
- package/dist/core/park-selfcheck.js +4 -2
- 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 +3 -3
- package/dist/core/peer-seat.js +20 -8
- package/dist/core/permission-rule-consent.d.ts +21 -5
- package/dist/core/permission-rule-consent.js +21 -1
- package/dist/core/permission-rule-model.d.ts +34 -11
- package/dist/core/permission-rule-model.js +47 -10
- 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/read-root-candidate.js +1 -1
- package/dist/core/remote-env.d.ts +74 -26
- package/dist/core/remote-env.js +20 -0
- package/dist/core/resume-startup-cause.d.ts +5 -4
- 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/retired-keys.d.ts +4 -4
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -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 -3
- package/dist/core/runner/assemble-result.js +12 -7
- 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/compact-session.js +18 -3
- 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 +2 -2
- package/dist/core/runner/contracts.d.ts +116 -34
- package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/delegation-owner.d.ts +43 -0
- package/dist/core/runner/delegation-owner.js +59 -0
- 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/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/git-status-frame.d.ts +3 -3
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
- package/dist/core/runner/lineage-reroot-view.js +108 -0
- 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/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +7 -2
- package/dist/core/runner/permission-rule-lanes.js +28 -9
- package/dist/core/runner/person-path-rows.d.ts +15 -0
- package/dist/core/runner/person-path-rows.js +27 -4
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
- 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 +4 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -1
- package/dist/core/runner/prepare-config-doors.d.ts +6 -6
- package/dist/core/runner/prepare-config-doors.js +19 -21
- 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 +9 -9
- package/dist/core/runner/prepare-delegation-surface.js +4 -5
- 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-gate-stations.d.ts +19 -14
- package/dist/core/runner/prepare-gate-stations.js +6 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +6 -6
- package/dist/core/runner/prepare-hands-readface.js +32 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -0
- package/dist/core/runner/prepare-inherited-gate.js +10 -3
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +5 -2
- package/dist/core/runner/prepare-park-ask.js +4 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
- package/dist/core/runner/prepare-policy-chain.js +16 -25
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
- package/dist/core/runner/prepare-prompt-inputs.js +3 -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 -7
- package/dist/core/runner/prepare-suspend-saga.js +17 -7
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +61 -30
- 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-wiring-manifest.d.ts +3 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -1
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +10 -6
- 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 +8 -6
- package/dist/core/runner/resume-admission.js +23 -6
- package/dist/core/runner/resume-apply.d.ts +4 -0
- package/dist/core/runner/resume-apply.js +14 -5
- package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
- package/dist/core/runner/resume-checkpoint-screen.js +4 -84
- 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 +2 -0
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +6 -2
- package/dist/core/runner/run-harness-handlers.d.ts +2 -0
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +14 -5
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +64 -36
- package/dist/core/runner/run-notification-lane.js +20 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +12 -9
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- 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 +34 -18
- package/dist/core/runner/runtask.d.ts +18 -3
- package/dist/core/runner/runtask.js +33 -17
- 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/steering-preview.d.ts +9 -0
- package/dist/core/runner/steering-preview.js +5 -0
- 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 +16 -7
- 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 -2
- 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.js +2 -0
- 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-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +8 -2
- package/dist/core/runner/turn-attachments.js +2 -2
- 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 +26 -27
- package/dist/core/secret-env.d.ts +19 -16
- package/dist/core/secret-env.js +45 -27
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +1 -1
- package/dist/core/session-policy-store.js +5 -2
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +3 -1
- package/dist/core/session-store.js +10 -8
- package/dist/core/session.d.ts +16 -5
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +8 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +83 -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/session-store-contract.js +22 -8
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
- package/dist/core/task-event.d.ts +24 -9
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +89 -12
- package/dist/core/task-notification.js +89 -14
- package/dist/core/task-registry-agent.d.ts +32 -50
- package/dist/core/task-registry-agent.js +36 -56
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-monitor.js +15 -60
- package/dist/core/task-registry-shared.d.ts +22 -112
- package/dist/core/task-registry-shared.js +3 -41
- package/dist/core/task-registry-workflow.js +5 -21
- package/dist/core/task-registry.d.ts +32 -62
- package/dist/core/task-registry.js +30 -110
- package/dist/core/task-result.d.ts +29 -12
- 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 +11 -11
- 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 +36 -6
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +2 -5
- 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.js +3 -2
- package/dist/core/tool-face.d.ts +8 -5
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-name-aliases.d.ts +5 -29
- package/dist/core/tool-name-aliases.js +9 -5
- 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 +109 -18
- package/dist/core/tool-policy.js +84 -14
- package/dist/core/tool-result-store.d.ts +23 -0
- package/dist/core/tool-result-store.js +3 -2
- package/dist/core/tool-roster.d.ts +4 -4
- package/dist/core/tool-spec.d.ts +23 -6
- package/dist/core/trace.d.ts +18 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.js +1 -1
- package/dist/core/user-attachment.js +26 -21
- 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 -9
- package/dist/engine/execution-env/node-execution-env.js +221 -22
- package/dist/engine/harness/agent-harness.d.ts +65 -18
- package/dist/engine/harness/agent-harness.js +90 -23
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +52 -7
- 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 +6 -1
- package/dist/engine/loop/agent-loop.js +20 -11
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/engine/session/parent-chain-guard.d.ts +3 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.d.ts +18 -3
- package/dist/engine/session/path-to-root.js +15 -1
- package/dist/engine/session/repo-utils.d.ts +12 -1
- package/dist/engine/session/repo-utils.js +41 -0
- package/dist/engine/session/session.js +1 -1
- package/dist/engine/session/storage-base.d.ts +20 -0
- package/dist/engine/session/storage-base.js +28 -9
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +29 -18
- package/dist/index.js +19 -11
- package/dist/internal/harness-types.d.ts +2 -0
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- 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 +14 -17
- package/dist/orchestration/run-workflow-tool.js +43 -50
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +7 -0
- package/dist/orchestration/workflow.js +10 -12
- package/dist/stores/file/background-agent-store.js +18 -15
- package/dist/stores/file/checkpoint-store.d.ts +2 -0
- package/dist/stores/file/checkpoint-store.js +13 -9
- package/dist/stores/file/file-history-store.js +3 -2
- package/dist/stores/file/fs-atomic.d.ts +0 -22
- package/dist/stores/file/fs-atomic.js +0 -17
- package/dist/stores/file/index.d.ts +7 -12
- package/dist/stores/file/index.js +25 -12
- 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.js +42 -22
- package/dist/stores/file/memory-store.js +3 -2
- 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.js +3 -2
- package/dist/stores/file/session-store.d.ts +26 -7
- package/dist/stores/file/session-store.js +59 -35
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/tool-result-store.js +57 -3
- package/dist/stores/file/usage-window-store.js +3 -2
- package/dist/stores/file/workflow-journal-store.d.ts +0 -2
- package/dist/stores/file/workflow-journal-store.js +3 -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/bash-program-position.d.ts +3 -2
- package/dist/tools/fs/bash-program-position.js +7 -7
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
- package/dist/tools/fs/fs-bash-background-text.js +6 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -18
- package/dist/tools/fs/fs-bash.js +37 -124
- package/dist/tools/fs/fs-pdf.js +8 -6
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-shared.d.ts +28 -3
- package/dist/tools/fs/fs-shared.js +15 -0
- package/dist/tools/fs/index.d.ts +1 -1
- package/dist/tools/fs/index.js +4 -14
- 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 +13 -5
- package/dist/tools/fs/read-floor.js +206 -2
- package/dist/tools/fs/removal-targets.js +2 -2
- package/dist/tools/fs/search.d.ts +3 -2
- package/dist/tools/fs/search.js +6 -6
- package/dist/tools/fs/shell-read-argv.d.ts +4 -2
- package/dist/tools/fs/shell-read-argv.js +14 -3
- package/dist/tools/fs/shell-read-bindings.d.ts +18 -2
- package/dist/tools/fs/shell-read-bindings.js +148 -68
- package/dist/tools/fs/shell-read-check.js +20 -4
- package/dist/tools/fs/shell-read-establish.js +25 -9
- package/dist/tools/fs/shell-read-functions.js +2 -2
- 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/fs/shell-read-object-path.d.ts +59 -0
- package/dist/tools/fs/shell-read-object-path.js +119 -0
- package/dist/tools/fs/shell-read-plan.d.ts +8 -0
- package/dist/tools/fs/shell-read-plan.js +47 -30
- package/dist/tools/fs/shell-read-start.d.ts +66 -13
- package/dist/tools/fs/shell-read-start.js +89 -17
- package/dist/tools/fs/shell-read-workdir.d.ts +29 -8
- package/dist/tools/fs/shell-read-workdir.js +31 -8
- package/dist/tools/monitor.d.ts +8 -7
- package/dist/tools/monitor.js +12 -10
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +112 -42
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core-stores-sql@7.62.0.json +30 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/core@7.62.0.json +2181 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/mods-kernel@7.62.0.json +42 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/wire-changes/primitives@7.62.0.json +30 -0
- package/dist/core/consolidate-scope.d.ts +0 -93
- package/dist/core/consolidate-scope.js +0 -98
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
- package/dist/core/runner/memory-consolidation.d.ts +0 -109
- package/dist/core/runner/memory-consolidation.js +0 -251
|
@@ -6,8 +6,9 @@ import type { HaltRemainingDirective } from "../loop/types.js";
|
|
|
6
6
|
import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
7
7
|
import { type EngineSegment } from "../../core/untrusted-text.js";
|
|
8
8
|
import { type RunOrigin } from "../../core/run-origin.js";
|
|
9
|
+
import { type InputAuthor } from "../../core/input-author.js";
|
|
9
10
|
import type { CommittedFrameCarrier } from "../../core/frame-settlement.js";
|
|
10
|
-
import type { AbortResult, AgentHarnessEvent, AgentHarnessEventResultMap, AgentHarnessOptions, AgentHarnessOwnEvent, AgentHarnessResources, AgentHarnessStreamOptions, ExecutionEnv, PromptTemplate, Skill } from "./types.js";
|
|
11
|
+
import type { AbortResult, AgentHarnessEvent, AgentHarnessEventResultMap, AgentHarnessOptions, AgentHarnessOwnEvent, AgentHarnessResources, AgentHarnessStreamOptions, ExecutionEnv, PendingSessionWrite, PromptTemplate, RowRaising, Skill } from "./types.js";
|
|
11
12
|
/** [c209-C] 收口 C1/C2 — engine-provenance metadata a caller can stamp on the user message it
|
|
12
13
|
* mints (see the field docs on {@link UserMessage}). Threaded from `prompt`/`steer`/`followUp`/
|
|
13
14
|
* `nextTurn` options into the persisted message so derived views (auto-mode window, compaction
|
|
@@ -51,6 +52,12 @@ export interface TrailingMessageSeed {
|
|
|
51
52
|
export interface PromptTrailing {
|
|
52
53
|
trailing?: readonly TrailingMessageSeed[];
|
|
53
54
|
}
|
|
55
|
+
/** `prompt()` option: the prompt RECORDS a decision that ended the turn awaiting the user (a person's bare refusal) and
|
|
56
|
+
* owes no model turn — what joins it at turn open (engine notes only) rides along unanswered, the steer / follow-up
|
|
57
|
+
* drain points still continue the run, and an ending with no new answer answers with the last assistant message. */
|
|
58
|
+
export interface PromptEndsAwaitingUser {
|
|
59
|
+
endsAwaitingUser?: true;
|
|
60
|
+
}
|
|
54
61
|
export interface UserMessageProvenance {
|
|
55
62
|
/** Exact char length of the engine-prepended prefix on `text` (first-frame reminders etc.).
|
|
56
63
|
* Sugar for the single segment `[0, chars)` — when `engineSegments` is also supplied, segments win. */
|
|
@@ -65,13 +72,14 @@ export interface UserMessageProvenance {
|
|
|
65
72
|
/** [c209-C] R3: engine-injected note whose content must stay VISIBLE in derived views (diagnostics,
|
|
66
73
|
* task notifications, steering, recall) but never under user authority — see UserMessage.provenance. */
|
|
67
74
|
provenance?: "engine-note";
|
|
68
|
-
/**
|
|
69
|
-
* engine-authored guidance. Rides only WITH `provenance:"engine-note"` (the projection semantics are
|
|
70
|
-
* identical — visible, never `[user]` authority); what it changes is the run-control judgment: the
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* frames — never inferred from text. Metadata only; not
|
|
74
|
-
|
|
75
|
+
/** Who wrote the input this frame's CONTENT is ({@link InputAuthor}) — an input relayed by the engine (a TaskStream steer, the
|
|
76
|
+
* observer's report), not engine-authored guidance. Rides only WITH `provenance:"engine-note"` (the projection semantics are
|
|
77
|
+
* identical — visible, never `[user]` authority); what it changes is the run-control judgment: the human-halt hold below
|
|
78
|
+
* treats an authored frame as input (always passes) while an engine-authored one is held, and only a frame whose author
|
|
79
|
+
* counts as the operator's (`countsAsOperator`) is the person's input — parkable across a pause, on the undelivered-input
|
|
80
|
+
* account. Minter-stated at the single relay seam that mints such frames — never inferred from text. Metadata only; not
|
|
81
|
+
* persisted on the message. */
|
|
82
|
+
author?: InputAuthor;
|
|
75
83
|
/** #1036 — the frame's injection-queue dedup key, persisted on the message it becomes
|
|
76
84
|
* ({@link UserMessage.engineNoteKey}) so a reader of the TRANSCRIPT alone can join an entry back
|
|
77
85
|
* to its frame. Rides only WITH `provenance:"engine-note"`. */
|
|
@@ -155,6 +163,14 @@ export interface HarnessLoopRecovery {
|
|
|
155
163
|
withholdErrorEvents?: boolean;
|
|
156
164
|
};
|
|
157
165
|
}
|
|
166
|
+
/** How a durable park's commit ended, for the rows its gate took off the port ({@link AgentHarness.parkCapture}): the row
|
|
167
|
+
* holds them (`committed`), no row was written (`absent`), or whether one was is unknown (`indeterminate`). */
|
|
168
|
+
type ParkCaptureOutcome = "committed" | "absent" | "indeterminate";
|
|
169
|
+
/** The port's held rows as a park's gate took them, in queue order, and the one call that says how the commit ended. */
|
|
170
|
+
interface ParkCapture {
|
|
171
|
+
readonly rows: readonly AgentMessage[];
|
|
172
|
+
settle(outcome: ParkCaptureOutcome): void;
|
|
173
|
+
}
|
|
158
174
|
export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate extends PromptTemplate = PromptTemplate, TTool extends AgentTool = AgentTool> {
|
|
159
175
|
readonly env: ExecutionEnv;
|
|
160
176
|
private session;
|
|
@@ -179,7 +195,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
179
195
|
* per turn, so identity carries the generation); the loop's cut-consumption report is accepted for THIS seat only. */
|
|
180
196
|
private lastPublishedSeat?;
|
|
181
197
|
private readonly seatCutSources;
|
|
182
|
-
private
|
|
198
|
+
private endedOnPriorAnswer;
|
|
183
199
|
private promptReceipt?;
|
|
184
200
|
private turnCutConsumed?;
|
|
185
201
|
private readonly committedEntryIds;
|
|
@@ -204,6 +220,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
204
220
|
private runAbortController?;
|
|
205
221
|
private runPromise?;
|
|
206
222
|
private pendingSessionWrites;
|
|
223
|
+
/** A park's capture of the port's held rows, from the gate's snapshot until its commit settles: the port waits on it. */
|
|
224
|
+
private parkCaptureInFlight?;
|
|
225
|
+
/** Set when a park's commit took the port's rows, or may have: the port refuses from then on (this leg's conversation goes on from the checkpoint). */
|
|
226
|
+
private parkedPortClosed;
|
|
207
227
|
private model;
|
|
208
228
|
/** The ref that chose {@link model}, moved by the SAME assignment (one value, never two answers). */
|
|
209
229
|
private modelRef;
|
|
@@ -215,10 +235,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
215
235
|
* with every request view that needed one (the transcript is never rewritten, so a broken turn is repaired, and
|
|
216
236
|
* reported, on each request; the sink owns its dedup). Advisory: a throwing sink never breaks the request. */
|
|
217
237
|
onToolTurnRepaired?: (repairs: readonly ToolTurnRepair[]) => void;
|
|
218
|
-
/** Runner-set sink for the images a provider refused in THIS run ({@link
|
|
238
|
+
/** Runner-set sink for the images a provider refused in THIS run ({@link removeRefusedRequestParts}) — a refusal recorded
|
|
219
239
|
* before the run began is not reported. Every request re-reads the transcript, so the sink owns its dedup (by
|
|
220
240
|
* `refusalAt`). Advisory: a throwing sink never breaks the request. */
|
|
221
241
|
onImagesRemoved?: (removals: readonly RejectedImageRemoval[]) => void;
|
|
242
|
+
/** Runner-set sink for a tool whose input schema a provider refused in THIS run, told when the loop re-sends the turn
|
|
243
|
+
* without it (the loop config's `onToolSchemaRefused`). Advisory: a throwing sink never breaks the re-send. */
|
|
244
|
+
onToolSchemaRefused?: (refusal: {
|
|
245
|
+
tool: string;
|
|
246
|
+
refusalAt: number;
|
|
247
|
+
}) => void;
|
|
222
248
|
/** The image refusals standing in the transcript when the current run began, by their identity
|
|
223
249
|
* ({@link RejectedImageRemoval.refusalAt}): the run that met them announced them. */
|
|
224
250
|
private priorImageRefusals?;
|
|
@@ -241,6 +267,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
241
267
|
steer: readonly unknown[];
|
|
242
268
|
followUp: readonly unknown[];
|
|
243
269
|
}) => void;
|
|
270
|
+
/** The same terminal moment's inputs that are NOT the operator's ({@link UserMessageProvenance.author} outside
|
|
271
|
+
* `countsAsOperator`, e.g. an observer's report): never parked and never on the account above, they end with the run;
|
|
272
|
+
* handed over by author, in service order, so the runner can say once that they were dropped. */
|
|
273
|
+
onUndrainedOtherInputs?: (authors: readonly InputAuthor[]) => void;
|
|
244
274
|
/** design/176 — runner-set sink fired at the CONSUMPTION boundary, once per engine-note payload,
|
|
245
275
|
* in consumption order (steer/followUp drain and the turn-open nextTurn splice — the two points
|
|
246
276
|
* where a queued frame actually enters the model's input). The runner uses it to record the
|
|
@@ -276,7 +306,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
276
306
|
* minted it. */
|
|
277
307
|
engineInjectionsHeld?: () => boolean;
|
|
278
308
|
/** 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
|
|
309
|
+
/** The request view of `messages` under the provider's image refusals they hold ({@link removeRefusedRequestParts}), and
|
|
280
310
|
* the removals this run met handed to {@link onImagesRemoved}. */
|
|
281
311
|
private imageRefusalView;
|
|
282
312
|
private holdToolTurnLaw;
|
|
@@ -294,9 +324,9 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
294
324
|
private sweepUndrainedEngineNotes;
|
|
295
325
|
/**
|
|
296
326
|
* How much of a PERSON's input is currently accepted-but-unserved, per lane — the one predicate behind
|
|
297
|
-
* both readers below, so "a person's input is waiting" cannot come to mean two things.
|
|
298
|
-
*
|
|
299
|
-
* is as pending as one that never left it).
|
|
327
|
+
* both readers below, so "a person's input is waiting" cannot come to mean two things. Only the operator's
|
|
328
|
+
* input counts ({@link isOperatorInput}: engine-AUTHORED frames and inputs another author wrote are out), and the
|
|
329
|
+
* IN-FLIGHT slot counts (a frame spliced out of a queue and never injected is as pending as one that never left it).
|
|
300
330
|
*/
|
|
301
331
|
private pendingUserInputFramesByLane;
|
|
302
332
|
private pendingUserInputsByLane;
|
|
@@ -336,6 +366,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
336
366
|
private stallTimeoutsPerCall?;
|
|
337
367
|
private abortResultDetails?;
|
|
338
368
|
private executeTool?;
|
|
369
|
+
private admitRows;
|
|
339
370
|
private activeRun?;
|
|
340
371
|
private loopTrace?;
|
|
341
372
|
private onToolInputValidationFault?;
|
|
@@ -436,7 +467,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
436
467
|
images?: ImageContent[];
|
|
437
468
|
settleUnansweredToolCalls?: TrailingToolBatchOptions;
|
|
438
469
|
onCommitted?: PromptCommittedCallback;
|
|
439
|
-
} & UserMessageProvenance & PromptTrailing): Promise<AssistantMessage | undefined>;
|
|
470
|
+
} & UserMessageProvenance & PromptTrailing & PromptEndsAwaitingUser): Promise<AssistantMessage | undefined>;
|
|
440
471
|
/** R2-③: an empty/whitespace-only injection with no images carries ZERO information — it
|
|
441
472
|
* must not mint a user frame (strict endpoints reject empty user content, and an empty follow-up would
|
|
442
473
|
* pointlessly extend the run by one turn). No-op, not a throw: injection callers are fire-and-
|
|
@@ -577,7 +608,11 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
577
608
|
nextTurn(text: string, options?: {
|
|
578
609
|
images?: ImageContent[];
|
|
579
610
|
} & UserMessageProvenance): Promise<void>;
|
|
580
|
-
|
|
611
|
+
/** The admission seat first (a raised row carries its `raising`; one the seat does not keep is not stored), then the store:
|
|
612
|
+
* at once when no turn runs and nothing is held before it, else queued for the next serialization point. A park's capture
|
|
613
|
+
* in progress is waited out; once a park took (or may have taken) the held rows, the row is refused — no running loop
|
|
614
|
+
* takes it. */
|
|
615
|
+
appendMessage(message: AgentMessage, raising?: RowRaising): Promise<void>;
|
|
581
616
|
/** The loop's `afterToolCall`: one `tool_result` hook emit per executed call (every registered handler, one fold). */
|
|
582
617
|
private afterToolCallHook;
|
|
583
618
|
/**
|
|
@@ -639,6 +674,16 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
639
674
|
* the queue is empty.
|
|
640
675
|
*/
|
|
641
676
|
flushQueuedSessionWrites(): Promise<void>;
|
|
677
|
+
/**
|
|
678
|
+
* A durable park's gate takes the rows the port holds (non-destructive, in queue order) to write them on its checkpoint;
|
|
679
|
+
* until {@link ParkCapture.settle} the port waits. `committed` takes them off the queue (the resumed leg writes them) and
|
|
680
|
+
* closes the port; `indeterminate` closes the port and leaves them queued (this leg's own branch gets them if its
|
|
681
|
+
* transcript is closed again); `absent` changes nothing. Only rows are held at a park: the other queued writes come from
|
|
682
|
+
* turn ends, which flush before any park point.
|
|
683
|
+
*/
|
|
684
|
+
parkCapture(): ParkCapture;
|
|
685
|
+
/** The session writes still held (queue order) — what an interrupted run whose batch stayed open cannot write. */
|
|
686
|
+
heldSessionWrites(): readonly PendingSessionWrite[];
|
|
642
687
|
/**
|
|
643
688
|
* backlog #389 — the accepted-but-undelivered CALLER frames a durable suspend can carry forward,
|
|
644
689
|
* in delivery order (steer before followUp, each queue forward — the order the live loop serves).
|
|
@@ -646,8 +691,9 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
646
691
|
* for a checkpoint that never landed would be lost twice over. {@link dropParkedUserInputs} is the
|
|
647
692
|
* second half, called only once the checkpoint is durably committed.
|
|
648
693
|
*
|
|
649
|
-
* Only frames carrying a park record are returned — engine-authored notes have
|
|
650
|
-
* lane (`onUndrainedEngineNotes` → pend per session) and must not be parked twice
|
|
694
|
+
* Only the operator's frames carrying a park record are returned ({@link isOperatorInput}) — engine-authored notes have
|
|
695
|
+
* their own lossless lane (`onUndrainedEngineNotes` → pend per session) and must not be parked twice, and an input another
|
|
696
|
+
* author wrote is not the person's to carry (it ends with the run, named through `onUndrainedOtherInputs`).
|
|
651
697
|
*/
|
|
652
698
|
readParkableUserInputs(): unknown[];
|
|
653
699
|
/**
|
|
@@ -704,3 +750,4 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
704
750
|
type: TType;
|
|
705
751
|
}>) => Promise<AgentHarnessEventResultMap[TType]> | AgentHarnessEventResultMap[TType]): () => void;
|
|
706
752
|
}
|
|
753
|
+
export {};
|
|
@@ -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,6 +344,7 @@ export class AgentHarness {
|
|
|
326
344
|
stallTimeoutsPerCall;
|
|
327
345
|
abortResultDetails;
|
|
328
346
|
executeTool;
|
|
347
|
+
admitRows;
|
|
329
348
|
activeRun;
|
|
330
349
|
loopTrace;
|
|
331
350
|
onToolInputValidationFault;
|
|
@@ -364,6 +383,8 @@ 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
390
|
this.toolResultMedia = {
|
|
@@ -689,6 +710,7 @@ export class AgentHarness {
|
|
|
689
710
|
...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
|
|
690
711
|
...(this.executeTool !== undefined ? { executeTool: this.executeTool } : {}),
|
|
691
712
|
...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
|
|
713
|
+
onToolSchemaRefused: (refusal) => this.onToolSchemaRefused?.(refusal),
|
|
692
714
|
...this.toolResultMedia,
|
|
693
715
|
...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
|
|
694
716
|
...(this.maxToolConcurrency !== undefined ? { maxToolConcurrency: this.maxToolConcurrency } : {}),
|
|
@@ -820,8 +842,7 @@ export class AgentHarness {
|
|
|
820
842
|
if (this.runAbortController?.signal.aborted) {
|
|
821
843
|
return;
|
|
822
844
|
}
|
|
823
|
-
|
|
824
|
-
const write = this.pendingSessionWrites[0];
|
|
845
|
+
for (let write = this.pendingSessionWrites[0]; write !== undefined; write = this.pendingSessionWrites[0]) {
|
|
825
846
|
if (write.type === "message") {
|
|
826
847
|
await this.session.appendMessage(write.message);
|
|
827
848
|
}
|
|
@@ -835,7 +856,9 @@ export class AgentHarness {
|
|
|
835
856
|
const unreachable = write;
|
|
836
857
|
throw new AgentHarnessError("invalid_argument", `flushPendingSessionWrites: unhandled queued write type ${unreachable.type}`);
|
|
837
858
|
}
|
|
838
|
-
this.pendingSessionWrites.
|
|
859
|
+
const at = this.pendingSessionWrites.indexOf(write);
|
|
860
|
+
if (at >= 0)
|
|
861
|
+
this.pendingSessionWrites.splice(at, 1);
|
|
839
862
|
}
|
|
840
863
|
}
|
|
841
864
|
async recordApiFailure(failure) {
|
|
@@ -843,6 +866,7 @@ export class AgentHarness {
|
|
|
843
866
|
const apiErrorStatus = readMember(failure, "apiErrorStatus");
|
|
844
867
|
const requestId = readMember(failure, "requestId");
|
|
845
868
|
const errorKind = readMember(failure, "errorKind");
|
|
869
|
+
const refusedTool = readMember(failure, "refusedTool");
|
|
846
870
|
const raw = typeof errorMessage === "string" ? errorMessage.trim() : undefined;
|
|
847
871
|
const detail = raw !== undefined && raw.length > API_FAILURE_RECORD_MAX_CHARS
|
|
848
872
|
? `${raw.slice(0, API_FAILURE_RECORD_MAX_CHARS)}… (truncated)`
|
|
@@ -861,9 +885,11 @@ export class AgentHarness {
|
|
|
861
885
|
stopReason: "error",
|
|
862
886
|
...(typeof errorMessage === "string" ? { errorMessage } : {}),
|
|
863
887
|
...(errorKind === "length_empty" || errorKind === "degenerate" || errorKind === "input_too_long" || errorKind === "image_unprocessable" ? { errorKind } : {}),
|
|
888
|
+
...(errorKind === "tool_schema_refused" && typeof refusedTool === "string" ? { errorKind, refusedTool } : {}),
|
|
864
889
|
timestamp: failure.timestamp,
|
|
865
890
|
};
|
|
866
891
|
try {
|
|
892
|
+
await this.admitRows([record]);
|
|
867
893
|
await this.session.appendMessage(record);
|
|
868
894
|
}
|
|
869
895
|
catch {
|
|
@@ -873,6 +899,7 @@ export class AgentHarness {
|
|
|
873
899
|
if (event.type === "message_end") {
|
|
874
900
|
let entryId;
|
|
875
901
|
if (!isEmptyFailureAssistant(event.message)) {
|
|
902
|
+
await this.admitRows([event.message]);
|
|
876
903
|
entryId = await this.session.appendMessage(event.message);
|
|
877
904
|
this.committedEntryIds.set(event.message, entryId);
|
|
878
905
|
this.settleInjectedFrame(event.message, entryId);
|
|
@@ -1003,11 +1030,12 @@ export class AgentHarness {
|
|
|
1003
1030
|
...(options.settleUnansweredToolCalls.halt !== undefined ? { halt: options.settleUnansweredToolCalls.halt } : {}),
|
|
1004
1031
|
report: (outcome) => {
|
|
1005
1032
|
if (outcome.aborted)
|
|
1006
|
-
this.
|
|
1033
|
+
this.endedOnPriorAnswer = true;
|
|
1007
1034
|
},
|
|
1008
1035
|
},
|
|
1009
1036
|
}
|
|
1010
1037
|
: {}),
|
|
1038
|
+
...(options?.endsAwaitingUser === true ? { endsAwaitingUser: true } : {}),
|
|
1011
1039
|
});
|
|
1012
1040
|
}
|
|
1013
1041
|
catch (error) {
|
|
@@ -1031,8 +1059,13 @@ export class AgentHarness {
|
|
|
1031
1059
|
}
|
|
1032
1060
|
if (this.stopRequested || abortController.signal.aborted)
|
|
1033
1061
|
return undefined;
|
|
1034
|
-
if (this.
|
|
1035
|
-
|
|
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
|
+
}
|
|
1036
1069
|
throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
|
|
1037
1070
|
}
|
|
1038
1071
|
finally {
|
|
@@ -1051,7 +1084,7 @@ export class AgentHarness {
|
|
|
1051
1084
|
if (this.phase !== "idle") {
|
|
1052
1085
|
throw new AgentHarnessError("busy", "AgentHarness is busy");
|
|
1053
1086
|
}
|
|
1054
|
-
this.
|
|
1087
|
+
this.endedOnPriorAnswer = false;
|
|
1055
1088
|
this.stopRequestSources.clear();
|
|
1056
1089
|
this.boundaryStopConsumed = undefined;
|
|
1057
1090
|
this.turnCutConsumed = undefined;
|
|
@@ -1074,7 +1107,8 @@ export class AgentHarness {
|
|
|
1074
1107
|
this.runAbortController = abortController;
|
|
1075
1108
|
const finishRunPromise = this.startRunPromise();
|
|
1076
1109
|
try {
|
|
1077
|
-
await this.
|
|
1110
|
+
if (this.pendingSessionWrites.length > 0 && findUnansweredToolBatch((await this.session.buildContext()).messages) === undefined)
|
|
1111
|
+
await this.flushPendingSessionWrites();
|
|
1078
1112
|
const turnState = await this.createTurnState();
|
|
1079
1113
|
return await this.executeTurn(turnState, text, options, abortController);
|
|
1080
1114
|
}
|
|
@@ -1109,6 +1143,8 @@ export class AgentHarness {
|
|
|
1109
1143
|
engineNotePayloads.set(m, options.enginePayload);
|
|
1110
1144
|
if (isEngineAuthoredInjection(options))
|
|
1111
1145
|
engineAuthoredInjections.add(m);
|
|
1146
|
+
if (options?.author !== undefined)
|
|
1147
|
+
inputAuthors.set(m, options.author);
|
|
1112
1148
|
if (options?.parkRecord !== undefined)
|
|
1113
1149
|
userInputParkRecords.set(m, options.parkRecord);
|
|
1114
1150
|
if (options?.immediate === true)
|
|
@@ -1285,9 +1321,16 @@ export class AgentHarness {
|
|
|
1285
1321
|
async nextTurn(text, options) {
|
|
1286
1322
|
await this.enqueueInjection(this.nextTurnQueue, text, options);
|
|
1287
1323
|
}
|
|
1288
|
-
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);
|
|
1289
1332
|
try {
|
|
1290
|
-
if (this.phase === "idle") {
|
|
1333
|
+
if (this.phase === "idle" && this.pendingSessionWrites.length === 0) {
|
|
1291
1334
|
await this.session.appendMessage(message);
|
|
1292
1335
|
}
|
|
1293
1336
|
else {
|
|
@@ -1449,12 +1492,39 @@ export class AgentHarness {
|
|
|
1449
1492
|
throw normalizeHarnessError(error, "session");
|
|
1450
1493
|
}
|
|
1451
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
|
+
}
|
|
1452
1522
|
readParkableUserInputs() {
|
|
1453
1523
|
const out = [];
|
|
1454
1524
|
for (const q of [this.drainedPendingInjection, this.steerQueue, this.followUpQueue]) {
|
|
1455
1525
|
for (const m of q) {
|
|
1456
1526
|
const record = userInputParkRecords.get(m);
|
|
1457
|
-
if (record !== undefined)
|
|
1527
|
+
if (record !== undefined && isOperatorInput(m))
|
|
1458
1528
|
out.push(record);
|
|
1459
1529
|
}
|
|
1460
1530
|
}
|
|
@@ -1501,10 +1571,7 @@ export class AgentHarness {
|
|
|
1501
1571
|
errors.push(toError(error));
|
|
1502
1572
|
}
|
|
1503
1573
|
this.sweepUndrainedEngineNotes([this.drainedPendingInjection, this.nextTurnQueue, this.steerQueue, this.followUpQueue]);
|
|
1504
|
-
const
|
|
1505
|
-
const inFlightOf = (lane) => this.drainedPendingInjection.filter((m) => userAuthored(m) && drainedFromLane.get(m) === lane);
|
|
1506
|
-
const undrainedSteer = [...inFlightOf("steer"), ...this.steerQueue.filter(userAuthored)];
|
|
1507
|
-
const undrainedFollowUp = [...inFlightOf("followUp"), ...this.followUpQueue.filter(userAuthored)];
|
|
1574
|
+
const { steer: undrainedSteer, followUp: undrainedFollowUp } = this.pendingUserInputFramesByLane();
|
|
1508
1575
|
try {
|
|
1509
1576
|
await this.emitOwn({ type: "abort", undrainedSteer, undrainedFollowUp });
|
|
1510
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,15 +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
|
|
344
|
-
*
|
|
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). */
|
|
345
351
|
readFloor?: ReadFloor;
|
|
346
352
|
}
|
|
347
|
-
/** 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). */
|
|
348
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;
|
|
349
358
|
readonly rows: readonly string[];
|
|
350
359
|
/** The row denying an absolute path in this environment's namespace, or `null`: the read station's own judgment. Never throws. */
|
|
351
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
|
+
};
|
|
352
371
|
}
|
|
353
372
|
/**
|
|
354
373
|
* Filesystem capability used by the harness.
|
|
@@ -378,7 +397,8 @@ export interface FileSystem {
|
|
|
378
397
|
/** Create or overwrite a file, creating parent directories when supported. Implementation note
|
|
379
398
|
* (RB-221): the Node env replaces the file as a WHOLE (same-directory staging + fsync +
|
|
380
399
|
* rename; `aborted` ⇒ target untouched), falling back to an in-place rewrite where rename cannot
|
|
381
|
-
* 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
|
|
382
402
|
* implementation quality, NOT an interface-level contract — a remote/transport env may only have a
|
|
383
403
|
* plain in-place write. */
|
|
384
404
|
writeFile(path: string, content: string | Uint8Array, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
@@ -647,6 +667,8 @@ export interface ExecutionEnv extends FileSystem, Shell {
|
|
|
647
667
|
* re-supply — names and rules, never a value. `[]` = none withheld, or none inherited (a shell environment built
|
|
648
668
|
* rather than inherited from this process); `"unknown"` = the adapter cannot say. A read: it announces nothing. */
|
|
649
669
|
readonly withheldEnv: readonly SecretEnvFinding[] | "unknown";
|
|
670
|
+
/** #1726 — the NAMES (never a value) of the environment the shell child receives; omitted ⇒ the adapter cannot say, every name may be there. */
|
|
671
|
+
readonly receivedEnvNames?: readonly string[];
|
|
650
672
|
}
|
|
651
673
|
/** Base fields shared by append-only session tree entries. */
|
|
652
674
|
export interface SessionTreeEntryBase {
|
|
@@ -1076,6 +1098,11 @@ export interface SessionWriteOptions {
|
|
|
1076
1098
|
*/
|
|
1077
1099
|
expectedLeafId?: string | null;
|
|
1078
1100
|
}
|
|
1101
|
+
/** What the replay that loaded a stored log dropped: `dropped` of its `total` records could not be read and are not in the log. */
|
|
1102
|
+
export interface ReplayLoss {
|
|
1103
|
+
readonly dropped: number;
|
|
1104
|
+
readonly total: number;
|
|
1105
|
+
}
|
|
1079
1106
|
export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetadata> {
|
|
1080
1107
|
getMetadata(): Promise<TMetadata>;
|
|
1081
1108
|
getLeafId(): Promise<string | null>;
|
|
@@ -1107,6 +1134,10 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
|
|
|
1107
1134
|
* from a CORRUPT log (a head whose parent is simply missing); the two look identical byte-wise and
|
|
1108
1135
|
* must not be treated alike. `BaseSessionStorage` implements it for the bundled backends. */
|
|
1109
1136
|
getFloorId?(): string | null;
|
|
1137
|
+
/** What the replay that loaded this log dropped, or `undefined` when it dropped nothing (or the backend has no replay to lose from). A run
|
|
1138
|
+
* that continues the session tells the person when it is there. Fixed at the load: a later write does not change it.
|
|
1139
|
+
* `BaseSessionStorage` implements it for the bundled backends. */
|
|
1140
|
+
getReplayLoss?(): ReplayLoss | undefined;
|
|
1110
1141
|
getEpochAnchor?(): Promise<unknown>;
|
|
1111
1142
|
}
|
|
1112
1143
|
/**
|
|
@@ -1652,5 +1683,19 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1652
1683
|
* contract, see AgentLoopConfig.streamingToolExecution).
|
|
1653
1684
|
*/
|
|
1654
1685
|
streamingToolExecution?: boolean;
|
|
1655
|
-
|
|
1686
|
+
/** The one seat every row passes at each harness commit point (a row the loop ends, an API failure's record, a row handed
|
|
1687
|
+
* to {@link AgentHarness.appendMessage}), before the live context and the store; absent ⇒ every row passes as made. */
|
|
1688
|
+
admitRows?: RowAdmission;
|
|
1689
|
+
/** The rows a parked leg's port held when its checkpoint was taken (`Checkpoint.heldRows`): the queue's first entries, written
|
|
1690
|
+
* at the transcript's first legal point (the prompt start, or — while the branch ends in a batch with unanswered calls — that
|
|
1691
|
+
* batch's settlement boundary), never through the admission seat again. Absent ⇒ the queue starts empty. */
|
|
1692
|
+
heldWrites?: readonly AgentMessage[];
|
|
1693
|
+
}
|
|
1694
|
+
/** A row its caller raises itself: a token the admitting seat minted and knows by identity; the harness hands it on unread. */
|
|
1695
|
+
export interface RowRaising {
|
|
1696
|
+
readonly door: "note";
|
|
1697
|
+
}
|
|
1698
|
+
/** The admission seat ({@link AgentHarnessOptions.admitRows}): the rows to keep, in order — every row handed in, except a
|
|
1699
|
+
* raised one its raiser's handlers refused. A rewrite is made in place, on the row itself. */
|
|
1700
|
+
export type RowAdmission = (rows: readonly AgentMessage[], raising?: RowRaising) => Promise<readonly AgentMessage[]>;
|
|
1656
1701
|
export type { AgentHarness } from "./agent-harness.js";
|