@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
|
@@ -6,16 +6,26 @@
|
|
|
6
6
|
* `assemble-result.ts`'s (`terminalCauseOf`); this module only reads.
|
|
7
7
|
*/
|
|
8
8
|
import { type AssistantMessage, type ModelOutputInvalid } from "../../internal/llm.js";
|
|
9
|
+
import type { LoopTerminalReason } from "../../internal/harness-types.js";
|
|
9
10
|
import { type RequestRoute } from "../../brain/request-route.js";
|
|
10
11
|
import type { TerminalCause } from "../types.js";
|
|
11
|
-
import type
|
|
12
|
+
import { type TerminalFailureDetail } from "../terminal-cause.js";
|
|
12
13
|
type ProviderRejected = Extract<TerminalFailureDetail, {
|
|
13
14
|
kind: "provider_rejected";
|
|
14
15
|
}>;
|
|
16
|
+
/** The failure a loop exit word names ({@link LOOP_EXIT_FAILURE}), by own-row membership; `undefined` for every other word and for no word. */
|
|
17
|
+
export declare function loopExitFailureOf(reason: LoopTerminalReason | undefined): {
|
|
18
|
+
readonly code: string;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
} | undefined;
|
|
15
21
|
/** The terminal message's provider-condition verdict, as the refusal account carries it: each member read once and
|
|
16
22
|
* admitted only as a word of its closed set (a host Brain mints this message too); the reset instant only beside a
|
|
17
23
|
* condition. Absent members stay absent. */
|
|
18
24
|
export declare function providerVerdictOf(final: AssistantMessage): Pick<ProviderRejected, "providerCondition" | "providerConditionSource" | "providerResetAtMs">;
|
|
25
|
+
/** The part of the request the terminal message's refusal named, from the message's `errorKind` and `refusedTool` as the
|
|
26
|
+
* terminal read them (each once): the kind admitted only as a word of `REFUSED_REQUEST_PARTS`, a tool-schema refusal only
|
|
27
|
+
* with its tool (a non-empty string), else no account. */
|
|
28
|
+
export declare function refusedPartOf(errorKind: unknown, refusedTool: unknown): Pick<ProviderRejected, "errorKind" | "tool">;
|
|
19
29
|
/** The terminal message's request route (`apiErrorRoute`), admitted as a shape some request carries
|
|
20
30
|
* (`ROUTE_CREDENTIAL_PAIRING`); anything else is no route. */
|
|
21
31
|
export declare function requestRouteOfMessage(final: AssistantMessage): RequestRoute | undefined;
|
|
@@ -2,11 +2,23 @@ import { MODEL_OUTPUT_INVALID_CAUSES } from "../../internal/llm.js";
|
|
|
2
2
|
import { isProviderEchoShape } from "../../brain/errors.js";
|
|
3
3
|
import { isProviderCondition, isProviderConditionSource } from "../../brain/provider-dialect.js";
|
|
4
4
|
import { admittedRequestRoute } from "../../brain/request-route.js";
|
|
5
|
+
import { REFUSED_REQUEST_PARTS } from "../terminal-cause.js";
|
|
5
6
|
import { readMember } from "../thrown-value.js";
|
|
6
7
|
import { egressText } from "../untrusted-egress.js";
|
|
7
8
|
import { REDACTION_MARK } from "../redaction-marks.js";
|
|
8
9
|
import { isSensitiveName, looksLikeCredentialValue } from "../secret-env.js";
|
|
9
10
|
import { isSensitiveRecordKey } from "../credential-vocabulary.js";
|
|
11
|
+
const LOOP_EXIT_FAILURE = {
|
|
12
|
+
completed: undefined,
|
|
13
|
+
aborted_before_stream: undefined,
|
|
14
|
+
assistant_error: undefined,
|
|
15
|
+
stop_requested: undefined,
|
|
16
|
+
malformed_tool_use_exhausted: { code: "model.malformed_tool_use_exhausted", message: "The model's tool call could not be parsed (retry also failed)." },
|
|
17
|
+
truncated_output_exhausted: { code: "model.truncated_output_exhausted", message: "The model's response exceeded the output token maximum (continuing also failed)." },
|
|
18
|
+
};
|
|
19
|
+
export function loopExitFailureOf(reason) {
|
|
20
|
+
return reason !== undefined && Object.hasOwn(LOOP_EXIT_FAILURE, reason) ? LOOP_EXIT_FAILURE[reason] : undefined;
|
|
21
|
+
}
|
|
10
22
|
export function providerVerdictOf(final) {
|
|
11
23
|
const condition = readMember(final, "providerCondition");
|
|
12
24
|
const source = readMember(final, "providerConditionSource");
|
|
@@ -15,6 +27,14 @@ export function providerVerdictOf(final) {
|
|
|
15
27
|
const resetAtMs = readMember(final, "providerResetAtMs");
|
|
16
28
|
return { providerCondition: condition, providerConditionSource: source, ...(typeof resetAtMs === "number" && Number.isFinite(resetAtMs) ? { providerResetAtMs: resetAtMs } : {}) };
|
|
17
29
|
}
|
|
30
|
+
const REFUSED_REQUEST_PART_SET = new Set(REFUSED_REQUEST_PARTS);
|
|
31
|
+
export function refusedPartOf(errorKind, refusedTool) {
|
|
32
|
+
if (!REFUSED_REQUEST_PART_SET.has(errorKind))
|
|
33
|
+
return {};
|
|
34
|
+
if (errorKind !== "tool_schema_refused")
|
|
35
|
+
return { errorKind: errorKind };
|
|
36
|
+
return typeof refusedTool === "string" && refusedTool.length > 0 ? { errorKind, tool: refusedTool } : {};
|
|
37
|
+
}
|
|
18
38
|
export function requestRouteOfMessage(final) {
|
|
19
39
|
return admittedRequestRoute(readMember(final, "apiErrorRoute"));
|
|
20
40
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CheckpointGate, CheckpointToken } from "../checkpoint-store.js";
|
|
2
2
|
import type { TaskResult, TaskStatus, TerminalCause } from "../types.js";
|
|
3
|
+
/** The words of a failed terminal's `unstartedRow` — read off the cause itself, so the two never drift. */
|
|
4
|
+
type UnstartedRowOutcome = NonNullable<Extract<TerminalCause, {
|
|
5
|
+
kind: "failed";
|
|
6
|
+
}>["unstartedRow"]>;
|
|
3
7
|
/** The plane words a {@link TerminalCause} reads as — one derivation, called by the faces that speak
|
|
4
8
|
* them. The paused arm's `status` is its gate kind's registry row (`suspended` for an approval,
|
|
5
9
|
* a resource slice or a platform pause; `needs_review` for a plan or dry-run review, which also
|
|
@@ -17,6 +21,8 @@ export declare function terminalProjection(terminal: TerminalCause): {
|
|
|
17
21
|
/**
|
|
18
22
|
* A compensation that changes WHY a settled result ended (a resume leg's approval reopened / could not
|
|
19
23
|
* be reopened) amends the CAUSE — the one record there is. The code fills only an empty seat (the leg's
|
|
20
|
-
* own terminal code, when it had one, still names the ending); the message is extended, not replaced
|
|
24
|
+
* own terminal code, when it had one, still names the ending); the message is extended, not replaced;
|
|
25
|
+
* the row's outcome is stated on its own member (`unstartedRow`), whatever the code says.
|
|
21
26
|
*/
|
|
22
|
-
export declare function amendTerminal(result: TaskResult, code: string, message: (prior: string | undefined) => string): void;
|
|
27
|
+
export declare function amendTerminal(result: TaskResult, code: string, unstartedRow: UnstartedRowOutcome, message: (prior: string | undefined) => string): void;
|
|
28
|
+
export {};
|
|
@@ -20,9 +20,9 @@ export function terminalProjection(terminal) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export function amendTerminal(result, code, message) {
|
|
23
|
+
export function amendTerminal(result, code, unstartedRow, message) {
|
|
24
24
|
const t = result.terminal;
|
|
25
25
|
if (t.kind !== "failed")
|
|
26
26
|
return;
|
|
27
|
-
result.terminal = { ...t, code: t.code ?? code, message: message(t.message) };
|
|
27
|
+
result.terminal = { ...t, code: t.code ?? code, message: message(t.message), unstartedRow };
|
|
28
28
|
}
|
|
@@ -258,4 +258,7 @@ export declare function createToolSearchTool(opts: {
|
|
|
258
258
|
* and every "full schemas are loaded" claim about the tools block is dropped as false. Absent ⇒
|
|
259
259
|
* the swap posture (activation rewrites the tools block; prior wording, unchanged). */
|
|
260
260
|
staticSchemaFor?: (name: string) => TSchema | undefined;
|
|
261
|
+
/** Whether the model is shown this tool. A tool its view leaves out is outside this search, and it is never answered
|
|
262
|
+
* "already available" either: what the model is not shown it cannot find here. Absent ⇒ every tool is shown. */
|
|
263
|
+
inView?: (name: string) => boolean;
|
|
261
264
|
}): AgentTool;
|
|
@@ -234,7 +234,9 @@ export function extractDiscoveredToolNames(messages, registry) {
|
|
|
234
234
|
return [...names];
|
|
235
235
|
}
|
|
236
236
|
export function createToolSearchTool(opts) {
|
|
237
|
-
const {
|
|
237
|
+
const { active, rematerialize, listingRide, staticSchemaFor, isMounted, inView } = opts;
|
|
238
|
+
const shownRegistry = () => inView === undefined ? opts.registry : new Map([...opts.registry].filter(([n]) => inView(n)));
|
|
239
|
+
const shownMounted = () => inView === undefined ? opts.mountedNames?.() : new Set([...(opts.mountedNames?.() ?? [])].filter((n) => inView(n)));
|
|
238
240
|
const directCallEnabled = opts.directCallEnabled !== false;
|
|
239
241
|
const activationPosture = directCallEnabled
|
|
240
242
|
? (staticSchemaFor !== undefined
|
|
@@ -285,11 +287,12 @@ export function createToolSearchTool(opts) {
|
|
|
285
287
|
`selection in \`query\` instead: {"query":"select:ToolA,ToolB"}. Nothing was activated.`);
|
|
286
288
|
}
|
|
287
289
|
const args = (raw ?? {});
|
|
290
|
+
const registry = shownRegistry();
|
|
288
291
|
const resolved = resolveToolSearchDetailed(args, registry);
|
|
289
292
|
const missing = resolved.missing;
|
|
290
293
|
const withdrawn = isMounted === undefined ? [] : resolved.matched.filter((n) => !isMounted(n));
|
|
291
294
|
const matched = isMounted === undefined ? resolved.matched : resolved.matched.filter((n) => isMounted(n));
|
|
292
|
-
const mounted =
|
|
295
|
+
const mounted = shownMounted() ?? new Set();
|
|
293
296
|
const missCallable = missing.filter((n) => mounted.has(n));
|
|
294
297
|
const missUnknown = missing.filter((n) => !mounted.has(n));
|
|
295
298
|
const callableNote = missCallable.length > 0
|
|
@@ -33,7 +33,7 @@ export declare function batchResponseDigest(result: unknown): string | undefined
|
|
|
33
33
|
* Also the one place the gate outcome reaches a frame — see the parameter. */
|
|
34
34
|
export declare function toolEndBodyFrom(result: unknown, isError: boolean,
|
|
35
35
|
/** The leg's card projector (never a module default: the engine set alone drops every declared caller card unannounced) and media budget. */
|
|
36
|
-
leg: Pick<OccurrenceFrames, "structured" | "
|
|
36
|
+
leg: Pick<OccurrenceFrames, "structured" | "mediaBudgetBase64Chars">,
|
|
37
37
|
/** The gate's record of the pass that admitted or refused this call, supplied by the CALLER of this
|
|
38
38
|
* projection — the end projection ({@link emitSettled}) reads it off the call's occurrence (its latest gate
|
|
39
39
|
* record). Deliberately a parameter and never derived from `result`: a tool's own `details`
|
|
@@ -66,8 +66,8 @@ export type OccurrenceFrame = Omit<Extract<TaskEvent, {
|
|
|
66
66
|
export interface OccurrenceFrames {
|
|
67
67
|
push(frame: OccurrenceFrame): void;
|
|
68
68
|
structured: StructuredProjector;
|
|
69
|
-
/** `RunnerDeps.
|
|
70
|
-
|
|
69
|
+
/** `RunnerDeps.mediaBudgetBase64Chars` as given — the request trim's budget, read through the same `requestMediaBudget`; required, so no site reads a second one. */
|
|
70
|
+
mediaBudgetBase64Chars: number | undefined;
|
|
71
71
|
}
|
|
72
72
|
/** The START projection: the call's occurrence opens and its start frame goes out. Every leg that announces a call
|
|
73
73
|
* comes through here (the live loop's `tool_execution_start`, the resumed leg's approved call). */
|
|
@@ -36,7 +36,7 @@ export function batchResponseDigest(result) {
|
|
|
36
36
|
: text;
|
|
37
37
|
}
|
|
38
38
|
export function toolEndBodyFrom(result, isError, leg, gate, gatedCallIdOfRun) {
|
|
39
|
-
const o = toolOutputFrom(result, leg.
|
|
39
|
+
const o = toolOutputFrom(result, leg.mediaBudgetBase64Chars);
|
|
40
40
|
const st = leg.structured(result);
|
|
41
41
|
const det = isError ? result?.details : undefined;
|
|
42
42
|
const card = isPlainRecord(det) ? det : undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `tool_end` output/structured projection, verbatim from
|
|
3
3
|
* `runtask.ts`'s runLocked R4 phase. Pure functions over the harness `AgentToolResult`: zero closure
|
|
4
|
-
* state, zero runtask coupling — the module-level inputs are the text cap below and the shared media budget
|
|
5
|
-
* (`
|
|
4
|
+
* state, zero runtask coupling — the module-level inputs are the text cap below and the shared media budget reading
|
|
5
|
+
* (`requestMediaBudget`); the leg hands in its own `mediaBudgetBase64Chars`.
|
|
6
6
|
*/
|
|
7
7
|
/** A block's own size in characters — the ONE counter `tool_end.totalChars` adds up over a tool result's blocks (a
|
|
8
8
|
* consumer that re-renders a result sums the same function): a text block its text plus whatever else it carries at
|
|
@@ -14,7 +14,7 @@ type ToolOutput = {
|
|
|
14
14
|
truncated: boolean;
|
|
15
15
|
totalChars?: number;
|
|
16
16
|
};
|
|
17
|
-
export declare const toolOutputFrom: (result: unknown,
|
|
17
|
+
export declare const toolOutputFrom: (result: unknown, mediaBudgetBase64Chars: number | undefined) => ToolOutput | undefined;
|
|
18
18
|
/** The `tool_end.structured` projection over a harness tool result: the CC card when `details.type` names a card
|
|
19
19
|
* the leg admits, else undefined. Minted per leg by {@link createStructuredProjector}; every body projection takes it
|
|
20
20
|
* as a parameter — there is no module-level card set to fall back to. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isTextBlock, renderContentBlock } from "../../internal/llm.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requestMediaBudget } from "../image-admission.js";
|
|
3
|
+
import { isMediaBlock, mediaBlockDescriptor, omittedMediaDescriptor } from "../media-byte-cap.js";
|
|
3
4
|
import { engineCardTypes } from "../tool-registry.js";
|
|
4
5
|
import { readMember } from "../thrown-value.js";
|
|
5
6
|
const MAX_TOOL_END_OUTPUT_CHARS = 16384;
|
|
@@ -45,7 +46,7 @@ const fitMedia = (media, budget) => {
|
|
|
45
46
|
}
|
|
46
47
|
return { blocks, degraded };
|
|
47
48
|
};
|
|
48
|
-
const project = (content,
|
|
49
|
+
const project = (content, mediaBudgetBase64Chars) => {
|
|
49
50
|
if (!Array.isArray(content)) {
|
|
50
51
|
const s = typeof content === "string" ? content : (JSON.stringify(content) ?? "");
|
|
51
52
|
if (s.length <= MAX_TOOL_END_OUTPUT_CHARS)
|
|
@@ -54,19 +55,19 @@ const project = (content, mediaByteCapBytes) => {
|
|
|
54
55
|
}
|
|
55
56
|
const media = content.map(isMediaBlock);
|
|
56
57
|
const text = boundTextLane(content, content.flatMap((_, i) => (media[i] ? [] : [i])));
|
|
57
|
-
const limit =
|
|
58
|
+
const limit = requestMediaBudget(mediaBudgetBase64Chars);
|
|
58
59
|
const textBytes = [...text.forms.values()].reduce((n, f) => n + wireBytes(f), 0);
|
|
59
|
-
const fit = fitMedia(content.filter((_, i) => media[i]), limit
|
|
60
|
+
const fit = fitMedia(content.filter((_, i) => media[i]), limit - SUMMARY_RESERVE - textBytes);
|
|
60
61
|
if (!text.cut && !fit.degraded)
|
|
61
62
|
return { output: content, truncated: false };
|
|
62
63
|
let next = 0;
|
|
63
64
|
const output = content.flatMap((_, i) => (media[i] ? (fit.blocks[next++] ?? []) : text.forms.has(i) ? [text.forms.get(i)] : []));
|
|
64
65
|
return { output, truncated: true, totalChars: content.reduce((n, b) => n + toolOutputBlockChars(b), 0) };
|
|
65
66
|
};
|
|
66
|
-
export const toolOutputFrom = (result,
|
|
67
|
+
export const toolOutputFrom = (result, mediaBudgetBase64Chars) => {
|
|
67
68
|
try {
|
|
68
69
|
const content = result !== null && typeof result === "object" ? result.content : result;
|
|
69
|
-
return content === undefined ? undefined : project(content,
|
|
70
|
+
return content === undefined ? undefined : project(content, mediaBudgetBase64Chars);
|
|
70
71
|
}
|
|
71
72
|
catch {
|
|
72
73
|
return { output: "[unserializable tool output]", truncated: true };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model's VIEW of the leg's tool table — the tools one request shows it.
|
|
3
|
+
*
|
|
4
|
+
* ONE rule: a tool whose every call the run's deny rules refuse is not shown. The reference removes a tool a whole-tool deny
|
|
5
|
+
* rule names from the tool pool before the model sees it (built-in and protocol tools alike; a deny wins, no allow is
|
|
6
|
+
* consulted). Here every face that can refuse a model's call answers by its own whole-tool reading, the one its refusal of a
|
|
7
|
+
* call already takes: the leg's effective policy (the fold the gate runs — the caller policy, the session and ancestor rules,
|
|
8
|
+
* the inherited parent policies; {@link ToolPolicy.wholeToolRefusals}), and the stored rules — the person's persisted rows and
|
|
9
|
+
* the org's rows, over one read of the store (`PermissionRuleLanes.wholeToolRefusals`). Only a WHOLE-TOOL rule speaks here: a
|
|
10
|
+
* rule about some calls of a tool (a command, a path, a value) leaves the tool shown, and its calls meet the gate.
|
|
11
|
+
*
|
|
12
|
+
* Read once per request, every reading side by side, each settled by the fold's own law ({@link toolPolicyWholeToolRefusals}):
|
|
13
|
+
* one that cannot answer (it throws, it does not answer in time) refuses nothing here, and the readings beside it stand — its
|
|
14
|
+
* calls still meet the gate, which is where a refusal is decided. The leg's tools stay
|
|
15
|
+
* mounted: a call the model makes anyway (a name it learned elsewhere) meets the gate and its rule's refusal. The view and
|
|
16
|
+
* the gate never decide the same question: the view says what the model is shown, the gate whether a call runs.
|
|
17
|
+
*/
|
|
18
|
+
import type { Context, StreamFn } from "../../internal/llm.js";
|
|
19
|
+
import type { TurnPromptSnapshot } from "../../prompt-assembly/turn-snapshot.js";
|
|
20
|
+
import { type ToolFingerprintInput } from "../cache-break-detector.js";
|
|
21
|
+
import { type ToolRoster } from "../tool-roster.js";
|
|
22
|
+
import { type ToolPolicy } from "../tool-policy.js";
|
|
23
|
+
/** The faces the view reads, the roster whose face the gate stamps on a call of a tool, and the leg's prefix seats (the
|
|
24
|
+
* cache-break fingerprint and the turn snapshot name the tools ACTUALLY sent). */
|
|
25
|
+
export interface ToolTableViewFaces {
|
|
26
|
+
readonly policy: Pick<ToolPolicy, "wholeToolRefusals"> | undefined;
|
|
27
|
+
/** The stored rules — the person's rows and the org's, one read of the store for both. */
|
|
28
|
+
readonly stored: Pick<ToolPolicy, "wholeToolRefusals"> | undefined;
|
|
29
|
+
readonly roster: {
|
|
30
|
+
readonly current: ToolRoster | undefined;
|
|
31
|
+
};
|
|
32
|
+
readonly fpRef: {
|
|
33
|
+
current?: {
|
|
34
|
+
systemPrompt: string;
|
|
35
|
+
tools: ToolFingerprintInput[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly turnSnapshotRef: {
|
|
39
|
+
current?: TurnPromptSnapshot;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ToolTableView {
|
|
43
|
+
/** The request `context` as the model is shown it: its tools block without the tools the faces refuse whole (the same
|
|
44
|
+
* object when none is) — over one read of every face. */
|
|
45
|
+
request(context: Context, signal?: AbortSignal): Promise<Context>;
|
|
46
|
+
/** Whether the last request showed the tool (before any request: every tool) — the search space of a lane that answers the
|
|
47
|
+
* model about tools between requests (ToolSearch: a tool the model is not shown is no tool it can find). */
|
|
48
|
+
shows(toolName: string): boolean;
|
|
49
|
+
}
|
|
50
|
+
/** The leg's view — `undefined` when no face reads a whole-tool rule (every request then shows the tools block as built). */
|
|
51
|
+
export declare function createToolTableView(faces: ToolTableViewFaces): ToolTableView | undefined;
|
|
52
|
+
/** A request stream that rides the view: its tools block shows what {@link ToolTableView.request} shows. A leg whose view is
|
|
53
|
+
* not seated yet rides unchanged. */
|
|
54
|
+
export declare function streamShowingView(seat: {
|
|
55
|
+
readonly current?: ToolTableView;
|
|
56
|
+
}, stream: StreamFn): StreamFn;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { toolsToFingerprintInputs } from "../cache-break-detector.js";
|
|
2
|
+
import { callFaceSeat, toolCallFaceOf } from "../tool-roster.js";
|
|
3
|
+
import { toolPolicyWholeToolRefusals } from "../tool-policy.js";
|
|
4
|
+
export function createToolTableView(faces) {
|
|
5
|
+
const read = toolPolicyWholeToolRefusals([faces.policy, faces.stored]);
|
|
6
|
+
if (read === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
let refused = () => false;
|
|
9
|
+
let hidOne = false;
|
|
10
|
+
return {
|
|
11
|
+
async request(context, signal) {
|
|
12
|
+
const tools = context.tools;
|
|
13
|
+
if (tools === undefined || tools.length === 0)
|
|
14
|
+
return context;
|
|
15
|
+
const refuses = await read(signal);
|
|
16
|
+
const answers = new Map();
|
|
17
|
+
const judged = (toolName) => {
|
|
18
|
+
const known = answers.get(toolName);
|
|
19
|
+
if (known !== undefined)
|
|
20
|
+
return known;
|
|
21
|
+
const answer = refuses({ toolName, ...callFaceSeat(toolCallFaceOf(faces.roster.current, toolName)) });
|
|
22
|
+
answers.set(toolName, answer);
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
25
|
+
refused = judged;
|
|
26
|
+
const shown = tools.filter((t) => !judged(t.name));
|
|
27
|
+
const hides = shown.length < tools.length;
|
|
28
|
+
if (hides || hidOne) {
|
|
29
|
+
const inputs = toolsToFingerprintInputs(shown);
|
|
30
|
+
const fingerprint = faces.fpRef.current;
|
|
31
|
+
if (fingerprint !== undefined && !sameNames(fingerprint.tools, shown))
|
|
32
|
+
fingerprint.tools = inputs;
|
|
33
|
+
faces.turnSnapshotRef.current?.refreshTools(inputs);
|
|
34
|
+
}
|
|
35
|
+
hidOne = hides;
|
|
36
|
+
return hides ? { ...context, tools: shown } : context;
|
|
37
|
+
},
|
|
38
|
+
shows: (toolName) => !refused(toolName),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function sameNames(a, b) {
|
|
42
|
+
return a.length === b.length && a.every((t, i) => t.name === b[i].name);
|
|
43
|
+
}
|
|
44
|
+
export function streamShowingView(seat, stream) {
|
|
45
|
+
return (model, context, options) => {
|
|
46
|
+
const view = seat.current;
|
|
47
|
+
if (view === undefined || context.tools === undefined || context.tools.length === 0)
|
|
48
|
+
return stream(model, context, options);
|
|
49
|
+
return view.request(context, options?.signal).then((shown) => stream(model, shown, options));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -975,9 +975,10 @@ export declare function commitSkillsListing(state: AttachmentState, entries: Rea
|
|
|
975
975
|
* neither lane it rides has a cap above this one: the stable system-prompt lane has none, and the
|
|
976
976
|
* `mcp_instructions` attachment is intact-class (the bundle cap never clips it), so this bound IS the
|
|
977
977
|
* producer's promise — without it a single server could pin an arbitrarily large blob into the cached
|
|
978
|
-
* prompt prefix or into one boundary frame.
|
|
978
|
+
* prompt prefix or into one boundary frame. The number is the reference's own, the same as the tool-description cap in
|
|
979
|
+
* `mcp.ts` ((cli309.js:274179) "MCP server instructions from 2,048 to 4,096 characters").
|
|
979
980
|
*/
|
|
980
|
-
export declare const MCP_INSTRUCTIONS_MAX_CHARS
|
|
981
|
+
export declare const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
|
|
981
982
|
/**
|
|
982
983
|
* The ONE way MCP server-provided instruction text becomes model-facing, used by BOTH the
|
|
983
984
|
* stable system-prompt lane (prepare-task's `# MCP Server Instructions` block) and
|
|
@@ -684,7 +684,7 @@ export function renderSkillsListingDelta(state, entries, budget) {
|
|
|
684
684
|
export function commitSkillsListing(state, entries) {
|
|
685
685
|
state.announcedSkills = new Map(entries.map((e) => [e.name, e.description]));
|
|
686
686
|
}
|
|
687
|
-
export const MCP_INSTRUCTIONS_MAX_CHARS =
|
|
687
|
+
export const MCP_INSTRUCTIONS_MAX_CHARS = 4096;
|
|
688
688
|
export function fenceMcpServerInstructions(server, text) {
|
|
689
689
|
const fence = delimitUntrustedWithClip(`MCP server "${server}" instructions`, text, MCP_INSTRUCTIONS_MAX_CHARS);
|
|
690
690
|
return fence.clipped ? `${fence.text}\n${MCP_INSTRUCTIONS_TRUNCATION_NOTE}` : fence.text;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Runner.voidVerifierPause` — the verb that voids a verification gate's VERIFIER card: the card a verifier leg parks records
|
|
3
|
+
* `CheckpointState.compositionLeg` with entry `verify`, and that recorded leg is what this verb reads, the same member a host
|
|
4
|
+
* reads to tell a verifier's card from one its own run's resume reaches. One reading, one seat: a card that records no leg, or
|
|
5
|
+
* another entry's, is refused before anything is settled (`resume.composition_mismatch`), so the verb never voids a card the
|
|
6
|
+
* gate did not mint.
|
|
7
|
+
*
|
|
8
|
+
* Voiding = the settle every in-Runner terminal settle makes (`expireRowWithDuty`: the single-shot `expire` CAS — the row ends
|
|
9
|
+
* `expired` exactly as an expiry leaves it — with the duty its win carries: the parked-constraint entry evicted, the paused env
|
|
10
|
+
* this process holds destroyed) plus the one thing an expiry alone leaves behind: the verifier session's PIN, taken at the park
|
|
11
|
+
* mint, is released here — the same end state the resumed run's terminal leaves (unpinned, not released: the transcript stays
|
|
12
|
+
* the session store's to evict). Only the CAS winner unpins; a card another settler already took (a resume won, the reaper or
|
|
13
|
+
* an earlier void expired it) answers `false` and its winner owns the unpin. An unpin that throws or does not settle is said on
|
|
14
|
+
* `onError` and thrown (`checkpoint.void_unpin_failed`): the card IS voided, its session still pinned — never a silent `true`.
|
|
15
|
+
*/
|
|
16
|
+
import { type CheckpointToken } from "../checkpoint-store.js";
|
|
17
|
+
import type { SessionStore } from "../session.js";
|
|
18
|
+
import type { InheritedGate, RunnerDepsSeat, SuspendReap } from "./contracts.js";
|
|
19
|
+
import type { LocalClaims } from "./local-claims.js";
|
|
20
|
+
export interface VoidVerifierPauseInput {
|
|
21
|
+
/** borrowed-readonly — the verifier card's token (`VerificationOutcome.verifierPause.checkpointToken`). */
|
|
22
|
+
token: CheckpointToken;
|
|
23
|
+
/** borrowed-readonly — the Runner's deployment deps, read LIVE (the checkpoint store; `onError` for the bounded legs). */
|
|
24
|
+
runner: RunnerDepsSeat;
|
|
25
|
+
/** borrowed-readonly — the Runner's session store: the card's session is unpinned on a win. */
|
|
26
|
+
sessions: SessionStore;
|
|
27
|
+
/** borrowed-mutable — the Runner's same-Runner claims (this void's attempt opens and closes its own), parked-constraint registry and suspended-env reap handles. */
|
|
28
|
+
locallyClaimedTokens: LocalClaims;
|
|
29
|
+
parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>;
|
|
30
|
+
suspendedEnvReaps: Map<CheckpointToken, SuspendReap>;
|
|
31
|
+
}
|
|
32
|
+
/** Void the verifier card `token` names: `true` = this call voided it and unpinned its session, `false` = already settled (throws `checkpoint.void_unpin_failed` when voided but not unpinned). */
|
|
33
|
+
export declare function voidVerifierPause(input: VoidVerifierPauseInput): Promise<boolean>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CheckpointError, resolveCheckpointStore } from "../checkpoint-store.js";
|
|
2
|
+
import { compositionLegRecord } from "./checkpoint-scope.js";
|
|
3
|
+
import { expireRowWithDuty } from "./expire-settle.js";
|
|
4
|
+
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
5
|
+
export async function voidVerifierPause(input) {
|
|
6
|
+
const { token, runner, sessions, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
7
|
+
const store = resolveCheckpointStore({}, runner.deps);
|
|
8
|
+
if (store === undefined)
|
|
9
|
+
throw new CheckpointError("checkpoint.not_found", "no CheckpointStore wired (RunnerDeps.checkpointStore) — there is no verifier card to void");
|
|
10
|
+
const cp = await store.get(token);
|
|
11
|
+
if (cp === null)
|
|
12
|
+
throw new CheckpointError("checkpoint.not_found", "no checkpoint row for this token — nothing was voided");
|
|
13
|
+
const leg = compositionLegRecord(cp.state.compositionLeg);
|
|
14
|
+
if (leg?.entry !== "verify") {
|
|
15
|
+
throw new CheckpointError("resume.composition_mismatch", `this card was not parked by a verification gate's verifier leg (it records ${leg === undefined ? "no composition leg" : `a ${leg.entry} leg`}) — ` +
|
|
16
|
+
"voidVerifierPause voids only a verifier's own card; nothing was settled and the row is as it was");
|
|
17
|
+
}
|
|
18
|
+
const report = (err, sessionId) => {
|
|
19
|
+
try {
|
|
20
|
+
runner.deps.onError?.(err, { phase: "config", sessionId });
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const won = await expireRowWithDuty({
|
|
26
|
+
token, scope: cp.scope, store, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps,
|
|
27
|
+
destroyLabel: "voided verifier pause env destroy",
|
|
28
|
+
onDestroyError: report,
|
|
29
|
+
});
|
|
30
|
+
if (!won)
|
|
31
|
+
return false;
|
|
32
|
+
let unpinErr;
|
|
33
|
+
await settleTeardownLeg(() => sessions.unpin?.(cp.sessionId), "sessions.unpin (voided verifier pause)", (err) => {
|
|
34
|
+
unpinErr = err;
|
|
35
|
+
report(err, cp.sessionId);
|
|
36
|
+
});
|
|
37
|
+
if (unpinErr !== undefined) {
|
|
38
|
+
throw new CheckpointError("checkpoint.void_unpin_failed", `the verifier card was voided (the row is expired) but its session's pin was not released: ${unpinErr.message} — the session stays pinned until it is unpinned`);
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
@@ -71,7 +71,7 @@ export interface ResumePreflightInfo {
|
|
|
71
71
|
* the resume entry's identity-continuity rung already refused a contradicting supplied principal
|
|
72
72
|
* before this hook runs, so a present value IS the resumed leg's identity. */
|
|
73
73
|
principal?: string;
|
|
74
|
-
/** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (as
|
|
74
|
+
/** provider / deviceId / mountPath — the placement facts: the row handle's one frozen copy (as the restore's `priorHandle`). */
|
|
75
75
|
workspaceHandle?: Readonly<import("./remote-env.js").WorkspaceHandle>;
|
|
76
76
|
gateKind: import("./checkpoint-store.js").CheckpointGate["kind"];
|
|
77
77
|
}
|
|
@@ -284,7 +284,7 @@ export interface RunnerDeps {
|
|
|
284
284
|
* tool that is ITSELF classified polluting still marks pre-call.
|
|
285
285
|
* ACCEPTED COST (the deployment's to own, stated as mechanism, not as absence of risk): under
|
|
286
286
|
* `"attested-only"` a BACKGROUND child's real external contact does not mark this session — its
|
|
287
|
-
* content re-enters through the
|
|
287
|
+
* content re-enters through the task-notification injection, a stored result read back by ref, or the
|
|
288
288
|
* AgentTranscript step summaries, none of which carries an attestation — and a foreground child
|
|
289
289
|
* that ended abnormally (crash/salvage) is likewise not marked on its face alone (the chain still
|
|
290
290
|
* records `incomplete`). Already-marked sessions are never retroactively cleaned; the key only
|
|
@@ -464,6 +464,12 @@ export interface RunnerDeps {
|
|
|
464
464
|
* deployment default cannot override a load-bearing containment wall) — TaskSpec.readFace's own
|
|
465
465
|
* "open" there is the genuine per-task contradiction, and that one still refuses loudly (#123).
|
|
466
466
|
*
|
|
467
|
+
* `RunnerDeps` is one Runner's deployment statement: a run resolves its read face from the deployment seat of the Runner that
|
|
468
|
+
* runs it, two lanes that need two read faces are two Runners (they may share a session store, a governance seat and a notice
|
|
469
|
+
* port), and a delegated child takes the deployment statement of the Runner its `Agent` tool is bound to
|
|
470
|
+
* (`createSubagentTool({ runner })`) — the parent's `roots` still reaches it through the restricting clamp, so the stricter side
|
|
471
|
+
* wins.
|
|
472
|
+
*
|
|
467
473
|
* A LIVE seat: `Runner.swapDeps({ readFace })` replaces it without a restart (the same natural
|
|
468
474
|
* snapshot the model catalog has — a leg reads the seat at its prepare and keeps that reading; every
|
|
469
475
|
* later prepare reads the new declaration; announced as `config.read_face_swapped`). A host whose
|
|
@@ -636,9 +642,10 @@ export interface RunnerDeps {
|
|
|
636
642
|
* deployment's), and a call it clears is attributed to it (`decisionReason: "deployment_rule"`). Lives for the Runner —
|
|
637
643
|
* read once at construction: a value that is not a list of strings refuses construction (`config.invalid_permission_rules`,
|
|
638
644
|
* with its issues), and the entries that read as nothing are announced once, when the Runner is built
|
|
639
|
-
* (`permission.allowed_tool_not_granted`, `detail.entries[].source: "deployment"`).
|
|
645
|
+
* (`permission.allowed_tool_not_granted`, `detail.entries[].source: "deployment"`). A member may carry its rule set's anchors
|
|
646
|
+
* (`{ rule, pathBases }`), read as the request's list reads them.
|
|
640
647
|
*/
|
|
641
|
-
allowedTools?: readonly
|
|
648
|
+
allowedTools?: readonly import("./allow-entry.js").AllowListEntry[];
|
|
642
649
|
/**
|
|
643
650
|
* design/182 §9 — DECLARE that this deployment drives cloud sync (`syncPermissionRules`) for the
|
|
644
651
|
* wired rule store. Purely a disclosure input: it is reported as `permissionRules.syncWired` on the
|
|
@@ -902,7 +909,7 @@ export interface RunnerDeps {
|
|
|
902
909
|
* history (opt-in; in-process runs are still subscribable without it). */
|
|
903
910
|
workflowRunStore?: import("./workflow-run-store.js").WorkflowRunStore;
|
|
904
911
|
/** design/151 S1a — the durable background-agent execution ledger (the `workflowRunStore` twin for
|
|
905
|
-
* `a*` rows): registrations write restart-surviving rows, and the auto-mounted
|
|
912
|
+
* `a*` rows): registrations write restart-surviving rows, and the auto-mounted TaskStop and the host task poll
|
|
906
913
|
* fall back to it on a live-registry miss (terminal snapshots / honest cross-instance reads, behind
|
|
907
914
|
* the fail-closed §3.1c predicate). Opt-in; absent ⇒ the in-memory-only pre-151 lifecycle. A
|
|
908
915
|
* deployment that composes its own Agent tool MUST pass the SAME instance as
|
|
@@ -910,7 +917,7 @@ export interface RunnerDeps {
|
|
|
910
917
|
* verify the pairing (the Agent tool is deployment-composed), and a half-wired deployment is a
|
|
911
918
|
* SILENT degrade: reader-only ⇒ no rows ever exist; writer-only ⇒ the auto-mounted fallbacks
|
|
912
919
|
* here never see them (RB-37). Third consumer: delegated
|
|
913
|
-
* CHILDREN's auto-mounted
|
|
920
|
+
* CHILDREN's auto-mounted TaskStop/AgentTranscript read THIS deps too (prepare-task
|
|
914
921
|
* wires them from the child's runner) — a sub-runner with different deps splits the read face. */
|
|
915
922
|
backgroundAgentStore?: import("./background-agent-store.js").BackgroundAgentStore;
|
|
916
923
|
/** design/151 §7 S3c — the durable SendMessage mailbox (delivery-ladder third rung): a message to a
|
|
@@ -928,8 +935,8 @@ export interface RunnerDeps {
|
|
|
928
935
|
* `DELEGATION_MAX_PER_SESSION_DEFAULT`). Key = `(scope, rootSessionId)`, full depth (grandchildren
|
|
929
936
|
* share the tree's pool). `maxConcurrent` bounds the tree's RUNNING children of every local lane:
|
|
930
937
|
* running/pending a* handles in this process's registry PLUS the synchronous and forked children in
|
|
931
|
-
* flight in this process (parked
|
|
932
|
-
*
|
|
938
|
+
* flight in this process (parked burns no slot; a CONTINUATION — a revival or a wake — counts but is
|
|
939
|
+
* never refused, so the count can pass the cap); `maxCumulativePerSession` bounds the RETAINED-WINDOW cumulative count
|
|
933
940
|
* (registry-retained + store-retained rows, plus those same in-flight local children — a reaped row
|
|
934
941
|
* returns its quota, and a synchronous child retains nothing so it leaves the window when it
|
|
935
942
|
* settles; deliberately NOT CC's lifetime-monotonic session counter, which would require a
|
|
@@ -1464,23 +1471,15 @@ export interface RunnerDeps {
|
|
|
1464
1471
|
*/
|
|
1465
1472
|
cacheBreakDetection?: boolean;
|
|
1466
1473
|
/**
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1474
|
-
*/
|
|
1475
|
-
|
|
1476
|
-
/** Optional telemetry fired when {@link mediaByteCapBytes} strips media in a request (CC's
|
|
1477
|
-
* `tengu_media_byte_cap_stripped` fields). Pure observability — no effect on the request. */
|
|
1478
|
-
onMediaStripped?: (info: {
|
|
1479
|
-
totalBytes: number;
|
|
1480
|
-
limitBytes: number;
|
|
1481
|
-
removedCount: number;
|
|
1482
|
-
removedBytes: number;
|
|
1483
|
-
}) => void;
|
|
1474
|
+
* The request's media budget, in base64 characters (the unit a provider counts; CC `tengu_media_byte_cap`): the media
|
|
1475
|
+
* blocks a conversation holds accumulate across turns, and past the budget a request leaves the OLDEST out (each slot a
|
|
1476
|
+
* line saying so; the person hears it once per block per session, `context.media_removed` with reason `media_budget`) —
|
|
1477
|
+
* request-only, the session keeps every block. The same budget bounds the media of one `tool_end.output`; both readers
|
|
1478
|
+
* read it through `requestMediaBudget`. Absent ⇒ `IMAGE_ADMISSION.request.budgetBase64Chars`; `0` or `Infinity` ⇒ no
|
|
1479
|
+
* budget (the media-block count limit still holds). Else a whole number no smaller than twice
|
|
1480
|
+
* `IMAGE_ADMISSION.request.hysteresisBase64Chars`; anything else is refused at `new Runner` (`config.invalid_argument`).
|
|
1481
|
+
*/
|
|
1482
|
+
mediaBudgetBase64Chars?: number;
|
|
1484
1483
|
/**
|
|
1485
1484
|
* Deferred-tool disclosure policy (design/36). Two rules govern deferral. ① The caller's list is
|
|
1486
1485
|
* literal: {@link TaskSpec.deferTools} names defer on every request, `ToolSpec.alwaysLoad` /
|