@sema-agent/core 7.60.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 +605 -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 +61 -10
- package/dist/agents/cascade.js +60 -20
- 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-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.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 +30 -40
- package/dist/agents/subagent.js +187 -196
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- 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-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +78 -19
- package/dist/core/checkpoint-store.js +8 -4
- 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 +49 -18
- 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 +2 -1
- 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 +12 -4
- package/dist/core/governance-codes.js +16 -4
- package/dist/core/hooks.d.ts +12 -4
- package/dist/core/hooks.js +11 -4
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +48 -8
- 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 +2 -1
- 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 +220 -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.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/mode-policy.d.ts +8 -8
- package/dist/core/mode-policy.js +7 -5
- package/dist/core/mods/agent-stations.d.ts +39 -4
- package/dist/core/mods/agent-stations.js +59 -10
- 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 +4 -3
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +4 -1
- package/dist/core/mods/kernel/events.js +6 -6
- 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/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 +38 -16
- package/dist/core/mods/stations.js +25 -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 +61 -2
- package/dist/core/own-property-receipt.js +42 -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/remote-env.d.ts +74 -26
- package/dist/core/remote-env.js +20 -0
- 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 +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 +2 -2
- package/dist/core/runner/contracts.d.ts +98 -26
- 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/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/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 +5 -1
- package/dist/core/runner/permission-rule-lanes.js +28 -9
- 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 +4 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -0
- package/dist/core/runner/prepare-config-doors.js +16 -17
- 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 +5 -5
- package/dist/core/runner/prepare-hands-readface.js +4 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -0
- 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 +56 -28
- 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 +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-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.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +2 -2
- 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 +40 -29
- 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 +9 -7
- 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 +27 -14
- package/dist/core/runner/runtask.d.ts +18 -3
- package/dist/core/runner/runtask.js +27 -11
- 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/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/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-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 +3 -2
- package/dist/core/runner/turn-attachments.js +1 -1
- 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 +24 -25
- package/dist/core/secret-env.d.ts +11 -11
- 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 +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 +2 -0
- package/dist/core/session-store.js +5 -7
- 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.js +1 -1
- 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 +30 -0
- package/dist/core/task-event.d.ts +17 -8
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +89 -12
- package/dist/core/task-notification.js +87 -13
- package/dist/core/task-registry-agent.d.ts +5 -43
- package/dist/core/task-registry-agent.js +24 -51
- 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 +15 -112
- package/dist/core/task-registry-shared.js +3 -41
- package/dist/core/task-registry-workflow.js +4 -21
- package/dist/core/task-registry.d.ts +19 -60
- package/dist/core/task-registry.js +19 -106
- package/dist/core/task-result.d.ts +24 -7
- 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 +10 -10
- 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 +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 +2 -3
- 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 +108 -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-spec.d.ts +19 -6
- package/dist/core/trace.d.ts +18 -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 +34 -9
- package/dist/engine/execution-env/node-execution-env.js +213 -21
- 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 +41 -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/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +21 -11
- package/dist/index.js +15 -7
- package/dist/internal/harness-types.d.ts +2 -0
- 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 +11 -17
- package/dist/orchestration/run-workflow-tool.js +19 -42
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +8 -5
- package/dist/stores/file/background-agent-store.js +18 -15
- package/dist/stores/file/checkpoint-store.js +7 -4
- package/dist/stores/file/file-history-store.js +3 -2
- package/dist/stores/file/index.d.ts +5 -3
- package/dist/stores/file/index.js +23 -8
- 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 +16 -3
- package/dist/stores/file/session-store.js +21 -20
- 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/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/search.d.ts +3 -2
- package/dist/tools/fs/search.js +6 -6
- 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 +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 +92 -10
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -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,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>>;
|
|
@@ -1652,5 +1672,19 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1652
1672
|
* contract, see AgentLoopConfig.streamingToolExecution).
|
|
1653
1673
|
*/
|
|
1654
1674
|
streamingToolExecution?: boolean;
|
|
1655
|
-
|
|
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[]>;
|
|
1656
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
|
+
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* the same objects, and a view with no marker is the same array — the same transcript yields the same request bytes.
|
|
14
|
-
*
|
|
15
|
-
* The transcript keeps the images: a later reader of the session sees what was read, and every request built from it
|
|
16
|
-
* — the next turn, a resumed session, a compaction summary — reads the same record and removes the same images.
|
|
17
|
-
*/
|
|
18
|
-
/** The `errorKind` a provider's image refusal carries (`AssistantMessage.errorKind`). */
|
|
19
|
-
export declare const IMAGE_REFUSAL_KIND = "image_unprocessable";
|
|
20
|
-
/** The text that stands in for the `ordinal`-th image (1-based) of a carrier the provider refused an image of. */
|
|
21
|
-
export declare function rejectedImagePlaceholder(ordinal: number): string;
|
|
1
|
+
import { IMAGE_REFUSAL_KIND } from "./media-removed.js";
|
|
2
|
+
export { IMAGE_REFUSAL_KIND };
|
|
3
|
+
/** The `errorKind` a provider's refusal of one tool's input schema carries (`AssistantMessage.errorKind`, beside
|
|
4
|
+
* `refusedTool`). */
|
|
5
|
+
export declare const TOOL_SCHEMA_REFUSAL_KIND = "tool_schema_refused";
|
|
6
|
+
/** The schema a tool whose input schema the provider refused travels with: an object that names no parameter (the
|
|
7
|
+
* reference's replacement, `X5t` (cli309.js:264190)). */
|
|
8
|
+
export declare const REFUSED_TOOL_SCHEMA: Readonly<{
|
|
9
|
+
type: "object";
|
|
10
|
+
}>;
|
|
11
|
+
/** How many tools of one transcript the tool view sends without their schema (the reference's bound, the same coordinate). */
|
|
12
|
+
export declare const REFUSED_TOOL_SCHEMAS_MAX = 8;
|
|
22
13
|
/** Is this message a turn the provider failed because an image in the request could not be processed — the live
|
|
23
14
|
* failure or its persisted record? */
|
|
24
15
|
export declare function isImageRefusal(message: unknown): boolean;
|
|
16
|
+
/** The tool a turn the provider failed over that tool's input schema names (the live failure or its persisted record);
|
|
17
|
+
* undefined for any other message. */
|
|
18
|
+
export declare function refusedToolOf(message: unknown): string | undefined;
|
|
19
|
+
/** Is this message a marker of either part — what leaves the message view? */
|
|
20
|
+
export declare function isRequestPartRefusal(message: unknown): boolean;
|
|
25
21
|
/** One carrier whose images a marker removed: the marker, the carrier (both the view's input objects), how many, and
|
|
26
22
|
* the refusal's own time — the one identity a refusal keeps across its live failure, its persisted record and every
|
|
27
23
|
* rebuilt copy of either (the record is minted with the failure's timestamp). */
|
|
@@ -34,13 +30,27 @@ export interface RejectedImageRemoval {
|
|
|
34
30
|
/** A refusal's identity ({@link RejectedImageRemoval.refusalAt}). */
|
|
35
31
|
export declare function imageRefusalAt(message: unknown): number;
|
|
36
32
|
/**
|
|
37
|
-
* The
|
|
38
|
-
* the images of
|
|
39
|
-
* an image to remove.
|
|
33
|
+
* The message view of `messages` under every refusal marker they hold ({@link isRequestPartRefusal}): each marker removed,
|
|
34
|
+
* and the images of an image marker's carrier replaced. `removals` lists, in order, the carriers emptied — empty when no
|
|
35
|
+
* image marker found an image to remove.
|
|
40
36
|
*/
|
|
41
|
-
export declare function
|
|
37
|
+
export declare function removeRefusedRequestParts<T>(messages: readonly T[]): {
|
|
42
38
|
messages: T[];
|
|
43
39
|
removals: RejectedImageRemoval[];
|
|
44
40
|
};
|
|
45
41
|
/** Does `marker`, standing in `messages`, remove images in their request view — was there a carrier left for it? */
|
|
46
42
|
export declare function imageRefusalRemoves(messages: readonly unknown[], marker: object): boolean;
|
|
43
|
+
/** The tools whose schemas `messages` refused and the tool view replaces: in the order the transcript refused them, each
|
|
44
|
+
* once, external-protocol tools only, at most {@link REFUSED_TOOL_SCHEMAS_MAX}. */
|
|
45
|
+
export declare function refusedToolSchemas(messages: readonly unknown[]): string[];
|
|
46
|
+
/** The tool view of `tools` under `messages`' tool-schema refusals: each refused tool ({@link refusedToolSchemas}) with
|
|
47
|
+
* {@link REFUSED_TOOL_SCHEMA} for its parameters, every other tool the same object; with nothing refused, the same array. */
|
|
48
|
+
export declare function withoutRefusedToolSchemas<T extends {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly parameters: unknown;
|
|
51
|
+
}>(tools: readonly T[] | undefined, messages: readonly unknown[]): T[] | undefined;
|
|
52
|
+
/** Does `marker`, standing in `messages`, change the tool view of `tools` — does it name a mounted tool whose schema no
|
|
53
|
+
* earlier marker already replaced, within the transcript's bound? */
|
|
54
|
+
export declare function toolSchemaRefusalReplaces(messages: readonly unknown[], marker: object, tools: readonly {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
}[] | undefined): boolean;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { protocolOf } from "../../core/protocol-table.js";
|
|
2
|
+
import { IMAGE_REFUSAL_KIND, mediaRemovedPlaceholder } from "./media-removed.js";
|
|
3
|
+
export { IMAGE_REFUSAL_KIND };
|
|
4
|
+
export const TOOL_SCHEMA_REFUSAL_KIND = "tool_schema_refused";
|
|
5
|
+
export const REFUSED_TOOL_SCHEMA = Object.freeze({ type: "object" });
|
|
6
|
+
export const REFUSED_TOOL_SCHEMAS_MAX = 8;
|
|
7
|
+
function refusalKindOf(message) {
|
|
8
|
+
const m = message;
|
|
9
|
+
return m?.role === "assistant" && m.isApiErrorMessage === true ? m.errorKind : undefined;
|
|
4
10
|
}
|
|
5
11
|
export function isImageRefusal(message) {
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
return refusalKindOf(message) === IMAGE_REFUSAL_KIND;
|
|
13
|
+
}
|
|
14
|
+
export function refusedToolOf(message) {
|
|
15
|
+
if (refusalKindOf(message) !== TOOL_SCHEMA_REFUSAL_KIND)
|
|
16
|
+
return undefined;
|
|
17
|
+
const tool = message.refusedTool;
|
|
18
|
+
return typeof tool === "string" && tool.length > 0 ? tool : undefined;
|
|
19
|
+
}
|
|
20
|
+
export function isRequestPartRefusal(message) {
|
|
21
|
+
return isImageRefusal(message) || refusedToolOf(message) !== undefined;
|
|
8
22
|
}
|
|
9
23
|
export function imageRefusalAt(message) {
|
|
10
24
|
const at = message?.timestamp;
|
|
@@ -22,21 +36,23 @@ function imageCount(message) {
|
|
|
22
36
|
}
|
|
23
37
|
function withoutImages(message) {
|
|
24
38
|
let ordinal = 0;
|
|
25
|
-
const content = message.content.map((block) => block?.type === "image" ? { type: "text", text:
|
|
39
|
+
const content = message.content.map((block) => block?.type === "image" ? { type: "text", text: mediaRemovedPlaceholder("rejected_by_provider", "image", ++ordinal) } : block);
|
|
26
40
|
return { ...message, content };
|
|
27
41
|
}
|
|
28
|
-
export function
|
|
29
|
-
if (!messages.some(
|
|
42
|
+
export function removeRefusedRequestParts(messages) {
|
|
43
|
+
if (!messages.some(isRequestPartRefusal))
|
|
30
44
|
return { messages: messages, removals: [] };
|
|
31
45
|
const out = [];
|
|
32
46
|
const carriers = [];
|
|
33
47
|
const removals = [];
|
|
34
48
|
for (const m of messages) {
|
|
35
|
-
if (!
|
|
49
|
+
if (!isRequestPartRefusal(m)) {
|
|
36
50
|
out.push(m);
|
|
37
51
|
carriers.push(undefined);
|
|
38
52
|
continue;
|
|
39
53
|
}
|
|
54
|
+
if (!isImageRefusal(m))
|
|
55
|
+
continue;
|
|
40
56
|
for (let j = out.length - 1; j >= 0; j--) {
|
|
41
57
|
const images = imageCount(out[j]);
|
|
42
58
|
if (images === 0)
|
|
@@ -50,5 +66,38 @@ export function removeRejectedImages(messages) {
|
|
|
50
66
|
return { messages: out, removals };
|
|
51
67
|
}
|
|
52
68
|
export function imageRefusalRemoves(messages, marker) {
|
|
53
|
-
return
|
|
69
|
+
return removeRefusedRequestParts(messages).removals.some((r) => r.marker === marker);
|
|
70
|
+
}
|
|
71
|
+
function schemaReplaceable(tool) {
|
|
72
|
+
return protocolOf(tool) !== undefined;
|
|
73
|
+
}
|
|
74
|
+
export function refusedToolSchemas(messages) {
|
|
75
|
+
const out = [];
|
|
76
|
+
for (const m of messages) {
|
|
77
|
+
const tool = refusedToolOf(m);
|
|
78
|
+
if (tool === undefined || !schemaReplaceable(tool) || out.includes(tool))
|
|
79
|
+
continue;
|
|
80
|
+
if (out.length === REFUSED_TOOL_SCHEMAS_MAX)
|
|
81
|
+
break;
|
|
82
|
+
out.push(tool);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
export function withoutRefusedToolSchemas(tools, messages) {
|
|
87
|
+
if (tools === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
const refused = refusedToolSchemas(messages);
|
|
90
|
+
if (refused.length === 0 || !tools.some((t) => refused.includes(t.name)))
|
|
91
|
+
return tools;
|
|
92
|
+
return tools.map((t) => (refused.includes(t.name) ? { ...t, parameters: { ...REFUSED_TOOL_SCHEMA } } : t));
|
|
93
|
+
}
|
|
94
|
+
export function toolSchemaRefusalReplaces(messages, marker, tools) {
|
|
95
|
+
const tool = refusedToolOf(marker);
|
|
96
|
+
if (tool === undefined || tools?.some((t) => t.name === tool) !== true)
|
|
97
|
+
return false;
|
|
98
|
+
const at = messages.indexOf(marker);
|
|
99
|
+
if (at < 0)
|
|
100
|
+
return false;
|
|
101
|
+
const before = refusedToolSchemas(messages.slice(0, at));
|
|
102
|
+
return !before.includes(tool) && refusedToolSchemas(messages.slice(0, at + 1)).includes(tool);
|
|
54
103
|
}
|