@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
|
@@ -43,6 +43,7 @@ export async function prepareToolDisclosureMount(input) {
|
|
|
43
43
|
const activeTools = new Set();
|
|
44
44
|
const fpRef = {};
|
|
45
45
|
const turnSnapshotRef = {};
|
|
46
|
+
const toolTableViewRef = {};
|
|
46
47
|
let harnessTools = tools;
|
|
47
48
|
let toolSearchMounted;
|
|
48
49
|
const failedMcpServers = onceLedger.mcpFailuresToAnnounce(mcp.statuses);
|
|
@@ -222,6 +223,7 @@ export async function prepareToolDisclosureMount(input) {
|
|
|
222
223
|
: {}),
|
|
223
224
|
onActivationCommitted: publishCensus,
|
|
224
225
|
serializeActivation,
|
|
226
|
+
inView: (name) => toolTableViewRef.current?.shows(name) !== false,
|
|
225
227
|
});
|
|
226
228
|
harnessTools = buildToolList(activeTools);
|
|
227
229
|
publishCensus();
|
|
@@ -237,5 +239,5 @@ export async function prepareToolDisclosureMount(input) {
|
|
|
237
239
|
turnSnapshotRef.current?.refreshTools(toolsToFingerprintInputs(list));
|
|
238
240
|
};
|
|
239
241
|
}
|
|
240
|
-
return { activeTools, fpRef, turnSnapshotRef, harnessTools, toolsDeltaRef, mcpUnavailable, toolMaterializeStatic, deferDirectCall, staticFaceForRef, listingRideRef, ...(toolSearchMounted !== undefined ? { toolSearch: toolSearchMounted } : {}), ...(toolDisclosureSeat !== undefined ? { toolDisclosureSeat } : {}) };
|
|
242
|
+
return { activeTools, fpRef, turnSnapshotRef, harnessTools, toolsDeltaRef, mcpUnavailable, toolMaterializeStatic, deferDirectCall, staticFaceForRef, listingRideRef, toolTableViewRef, ...(toolSearchMounted !== undefined ? { toolSearch: toolSearchMounted } : {}), ...(toolDisclosureSeat !== undefined ? { toolDisclosureSeat } : {}) };
|
|
241
243
|
}
|
|
@@ -147,6 +147,9 @@ export interface PrepareWiringManifestInput {
|
|
|
147
147
|
* themselves are written later, by the harness receipt sink, the compaction commit beat and the
|
|
148
148
|
* drain's own passes. */
|
|
149
149
|
frameSettlement: import("../frame-settlement.js").FrameSettlement;
|
|
150
|
+
/** borrowed-readonly — the leg's receiving station (bound to the leg's bus by the orchestrator, after this phase): the
|
|
151
|
+
* drain's pull face hands each record it reads to it. */
|
|
152
|
+
receiveSeat: import("../task-notification.js").FrameReceiver;
|
|
150
153
|
/** borrowed-readonly — the session-box drain's mount verdict (prepare-task's one judgment): present ⇒ this leg drains its own box. */
|
|
151
154
|
sessionBox: SessionBoxBinding | undefined;
|
|
152
155
|
/** borrowed-readonly, read late — the memory session's one-way pollution face (absent with no memory session). The drain marks
|
|
@@ -120,7 +120,7 @@ function announceDurableGateUnavailable(args) {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
export function prepareWiringManifest(input) {
|
|
123
|
-
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, sessionBox, harness, pausedRef, askSeat, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin } = input;
|
|
123
|
+
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, harness, pausedRef, askSeat, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin } = input;
|
|
124
124
|
const onAsk = askSeat.value;
|
|
125
125
|
const handWriteTools = toolRoster.entries.filter((e) => e.mountedBy === "hands" && (e.effect === "write" || e.effect === "idempotent")).map((e) => e.name);
|
|
126
126
|
const hasEffectAwareGate = policyLayers.length > 0 || chainJudges(standingModBus);
|
|
@@ -253,6 +253,7 @@ export function prepareWiringManifest(input) {
|
|
|
253
253
|
ownTokens: () => internals?.peerSelfRef?.current.ownTokens ?? [],
|
|
254
254
|
refs: peerLaneRefs,
|
|
255
255
|
settlement: frameSettlement,
|
|
256
|
+
receive: receiveSeat,
|
|
256
257
|
selfName: () => internals?.explicitAgentName,
|
|
257
258
|
parked: () => pausedRef.current !== undefined,
|
|
258
259
|
markExternalContent: (reason) => memoryPollution?.()?.markPolluted(reason, "observed"),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PlacementTarget } from "../remote-env.js";
|
|
1
2
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
2
3
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
3
4
|
import type { PrepareResume, RunInternals } from "./contracts.js";
|
|
@@ -32,6 +33,8 @@ export interface PrepareWorkspaceRestoreInput {
|
|
|
32
33
|
/** borrowed-readonly — where a delegated child landed against where it was asked (the execution-env phase's one
|
|
33
34
|
* judgment), reported beside the root it resolved; absent on a leg no delegation caller placed. */
|
|
34
35
|
placement?: import("./contracts.js").ChildPlacement | undefined;
|
|
36
|
+
/** borrowed-readonly — the fence the execution-env phase minted this leg under (absent when unfenced): the receipt reads it. */
|
|
37
|
+
placementFence: PlacementTarget | undefined;
|
|
35
38
|
/** borrowed-readonly — prepare's abort seat; only `.signal` is read (kept as the object so the
|
|
36
39
|
* moved body's `abortController.signal` spelling stays verbatim). */
|
|
37
40
|
abortController: {
|
|
@@ -55,6 +58,8 @@ export interface PrepareWorkspaceRestoreResult {
|
|
|
55
58
|
/** owned — the leg's ONE remoteness reading: its paths name locations in a remote / non-host env (read by the
|
|
56
59
|
* observation sink below and the leg's `workspace_changed` frame alike). */
|
|
57
60
|
remote: boolean;
|
|
61
|
+
/** owned — the target this leg's env reported at the settle point: the fence of every leg it hands work to (absent: none). */
|
|
62
|
+
ownTarget: PlacementTarget | undefined;
|
|
58
63
|
}
|
|
59
64
|
/** The B-4 phase body — the workspace-restore slice, verbatim (see the module header for the contract). */
|
|
60
65
|
export declare function prepareWorkspaceRestore(input: PrepareWorkspaceRestoreInput): Promise<PrepareWorkspaceRestoreResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { declaredSuspend, frozenHandleCopy, isRemoteExecutionEnv, missingRestoreSurface, pathsAreHostLocal } from "../remote-env.js";
|
|
1
|
+
import { declaredSuspend, frozenHandleCopy, isRemoteExecutionEnv, missingRestoreSurface, pathsAreHostLocal, placementHonored, placementTargetOf } from "../remote-env.js";
|
|
2
|
+
import { settleOwnTarget } from "./placement-fence.js";
|
|
2
3
|
import { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
3
4
|
import { rebaseWorkspacePathAcross } from "./workspace-path.js";
|
|
4
5
|
export { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
@@ -20,10 +21,11 @@ export async function prepareWorkspaceRestore(input) {
|
|
|
20
21
|
if (resumedHandle.provider !== handle.provider) {
|
|
21
22
|
failResume(`resume workspace identity mismatch: the checkpoint records provider "${handle.provider}" but the resumed env reports "${resumedHandle.provider}" — refusing to continue a workspace on a different backend (wire the factory to rebuild the checkpointed lane and re-resume)`);
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const reported = placementTargetOf(resumedHandle);
|
|
25
|
+
if (!placementHonored(input.placementFence, reported)) {
|
|
26
|
+
failResume(reported?.deviceId === undefined
|
|
27
|
+
? `resume workspace identity mismatch: the placement fence names deviceId "${input.placementFence?.deviceId}" but the resumed env reports none — a device-bound workspace cannot be verified on a handle that does not state its device (absence is not a match)`
|
|
28
|
+
: `resume workspace identity mismatch: the placement fence names deviceId "${input.placementFence?.deviceId}" but the resumed env reports "${reported.deviceId}" — refusing to continue on a different physical device`);
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
31
|
if (ownedEnv === undefined || !isRemoteExecutionEnv(ownedEnv)) {
|
|
@@ -109,6 +111,7 @@ export async function prepareWorkspaceRestore(input) {
|
|
|
109
111
|
}
|
|
110
112
|
const workspaceEnv = ownedEnv ?? deps.executionEnv;
|
|
111
113
|
const remote = workspaceEnv !== undefined && workspaceEnv !== null && !pathsAreHostLocal(workspaceEnv);
|
|
114
|
+
const ownTarget = settleOwnTarget(workspaceEnv ?? undefined, input.placementFence, resume?.workspaceHandle !== undefined);
|
|
112
115
|
if (internals?.onWorkspaceResolved !== undefined) {
|
|
113
116
|
try {
|
|
114
117
|
internals.onWorkspaceResolved({
|
|
@@ -116,10 +119,11 @@ export async function prepareWorkspaceRestore(input) {
|
|
|
116
119
|
isolated: internals.isolation === "worktree",
|
|
117
120
|
remote,
|
|
118
121
|
...(input.placement !== undefined ? { placement: input.placement } : {}),
|
|
122
|
+
...(ownTarget !== undefined ? { target: ownTarget } : {}),
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
catch {
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
|
-
return { taskRootFinal: taskRootPath, rebaseRestoredPath, remote };
|
|
128
|
+
return { taskRootFinal: taskRootPath, rebaseRestoredPath, remote, ownTarget };
|
|
125
129
|
}
|
|
@@ -44,7 +44,7 @@ export declare function settleReadRootGrant(screen: ReadRootGrantScreen | undefi
|
|
|
44
44
|
toolCallId: string;
|
|
45
45
|
sessionId: string;
|
|
46
46
|
runId: string;
|
|
47
|
-
taskId
|
|
47
|
+
taskId: string;
|
|
48
48
|
onNotice: RunnerDeps["onNotice"];
|
|
49
49
|
signal?: AbortSignal;
|
|
50
50
|
}): Promise<void> | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { legNoticeTaskId } from "../mods/stations.js";
|
|
1
2
|
import { deliverEngineNotice } from "../types.js";
|
|
2
3
|
import { READ_ROOT_CANDIDATE_DIR_MAX } from "../read-root-candidate.js";
|
|
3
4
|
import { DEFAULT_GATE_AWAIT_TIMEOUT_MS } from "../gate-bounded-await.js";
|
|
@@ -24,7 +25,7 @@ export function readRootGrantOver(seats) {
|
|
|
24
25
|
export function settleReadRootGrant(screen, grant, at) {
|
|
25
26
|
if (screen === undefined)
|
|
26
27
|
return undefined;
|
|
27
|
-
const ids = { toolName: at.toolName, toolCallId: at.toolCallId, sessionId: at.sessionId, runId: at.runId, ...(at
|
|
28
|
+
const ids = { toolName: at.toolName, toolCallId: at.toolCallId, sessionId: at.sessionId, runId: at.runId, ...legNoticeTaskId(at) };
|
|
28
29
|
const reject = (reason, offered, requested, why) => deliverEngineNotice(at.onNotice, {
|
|
29
30
|
code: "approval.read_root_grant_rejected",
|
|
30
31
|
message: `the approval for "${at.toolName}" asked to add a read directory, and nothing was added: ${why}. The approval's own verdict is unchanged.`,
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* The same seat shape the tool gate's fold uses to enter its lanes (gate-fold.ts `afterFold`).
|
|
12
12
|
*/
|
|
13
13
|
import { type Checkpoint, type CheckpointStore, type CheckpointToken, type PendingSteerEntry, type ResumeOutcome } from "../checkpoint-store.js";
|
|
14
|
-
import type { InheritedGate, ResumeTaskConfig, RunInternals, RunnerDepsSeat } from "./contracts.js";
|
|
14
|
+
import type { InheritedGate, ResumeTaskConfig, RunInternals, RunnerDepsSeat, SuspendReap } from "./contracts.js";
|
|
15
15
|
import type { SessionStore } from "../session.js";
|
|
16
16
|
/** What the admission rung was called with. */
|
|
17
17
|
export interface ResumeAdmissionInput<R> {
|
|
@@ -31,8 +31,10 @@ export interface ResumeAdmissionInput<R> {
|
|
|
31
31
|
runner: RunnerDepsSeat;
|
|
32
32
|
/** borrowed-readonly — the Runner's session store, fixed at its construction (unlike its deps): the retention capability door judges it. */
|
|
33
33
|
sessions: SessionStore;
|
|
34
|
-
/** borrowed-
|
|
35
|
-
parentConstraintRegistry:
|
|
34
|
+
/** borrowed-mutable — the Runner's same-process parked-constraint registry; read for this token, and evicted for it only by the expired-row duty. */
|
|
35
|
+
parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>;
|
|
36
|
+
/** borrowed-mutable — the Runner's suspended-env reap handles: a row the confirm reads `expired` has its duty run here (its record taken). */
|
|
37
|
+
suspendedEnvReaps: Map<CheckpointToken, SuspendReap>;
|
|
36
38
|
/** borrowed-readonly — the rung after admission, entered in this rung's last continuation with what it admitted. */
|
|
37
39
|
next: (admitted: ResumeAdmissionResult) => Promise<R>;
|
|
38
40
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CheckpointError, judgeParkedSteerRepeat, readPendingSteerQueue, refuseRetiredModeSeed, resolveCheckpointStore, validatePendingSteer } from "../checkpoint-store.js";
|
|
2
2
|
import { assertResumeConfigRecord, checkpointStoreSeat, refuseResumeDoors } from "./prepare-config-doors.js";
|
|
3
|
+
import { compositionLegRecord } from "./checkpoint-scope.js";
|
|
3
4
|
import { asResumeConfigRefusal } from "../mode-policy.js";
|
|
5
|
+
import { runExpiredDuty } from "./expire-settle.js";
|
|
4
6
|
import { describeSuppliedValue } from "./decide-continuation.js";
|
|
5
7
|
import { detachSkillLists } from "../skill-grant.js";
|
|
8
|
+
import { readCallerSpec } from "../task-spec-members.js";
|
|
6
9
|
import { isGateKind, PAUSE_REGISTRY } from "../pause-registry.js";
|
|
7
10
|
const DECIDE_ENTRY_BY_RESUME_GATE = {
|
|
8
11
|
policy_ask: "a `policy_ask` outcome (decision allow/deny bound to the pending tool call)",
|
|
@@ -12,14 +15,18 @@ const DECIDE_ENTRY_BY_RESUME_GATE = {
|
|
|
12
15
|
task_done: undefined,
|
|
13
16
|
};
|
|
14
17
|
export async function resumeAdmission(input) {
|
|
15
|
-
const { token, outcome, taskConfig, runner, sessions, parentConstraintRegistry } = input;
|
|
18
|
+
const { token, outcome, taskConfig, runner, sessions, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
16
19
|
let internals = input.internals;
|
|
17
20
|
if (outcome === null || typeof outcome !== "object") {
|
|
18
21
|
throw new CheckpointError("checkpoint.invalid_outcome", `resume outcome must be an object naming its gate (got ${outcome === null ? "null" : typeof outcome})`, { field: "outcome" });
|
|
19
22
|
}
|
|
20
23
|
asResumeConfigRefusal("taskConfig", () => assertResumeConfigRecord(taskConfig));
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const configRead = readCallerSpec(taskConfig);
|
|
25
|
+
asResumeConfigRefusal("taskConfig", () => { if (configRead.refusal !== undefined)
|
|
26
|
+
throw configRead.refusal; });
|
|
27
|
+
let config = { ...configRead.spec, ...(Array.isArray(configRead.spec.skills) ? { skills: detachSkillLists(configRead.spec.skills) } : {}) };
|
|
28
|
+
const snapshot = internals !== undefined ? { ...internals } : undefined;
|
|
29
|
+
internals = snapshot?.compositionLeg !== undefined ? { ...snapshot, compositionLeg: compositionLegRecord(snapshot.compositionLeg) } : snapshot;
|
|
23
30
|
const store = asResumeConfigRefusal(checkpointStoreSeat(config), () => resolveCheckpointStore(config, runner.deps));
|
|
24
31
|
if (!store) {
|
|
25
32
|
throw new CheckpointError("checkpoint.not_found", "no CheckpointStore wired — cannot resume (set RunnerDeps.checkpointStore or taskConfig.checkpointStore)");
|
|
@@ -33,6 +40,13 @@ export async function resumeAdmission(input) {
|
|
|
33
40
|
if (live?.status === "pending") {
|
|
34
41
|
throw new CheckpointError("checkpoint.reopened_concurrently", "checkpoint changed concurrently (a resolve/reopen cycle landed between this resume's read of the row and its state check) — nothing was validated or executed; re-resume against the current state");
|
|
35
42
|
}
|
|
43
|
+
if (live?.status === "expired") {
|
|
44
|
+
await runExpiredDuty({
|
|
45
|
+
token, parentConstraintRegistry, suspendedEnvReaps,
|
|
46
|
+
destroyLabel: "expired-row env destroy (resume refused)",
|
|
47
|
+
onDestroyError: (err, sessionId) => runner.deps.onError?.(err, { phase: "config", sessionId }),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
36
50
|
throw new CheckpointError("checkpoint.already_resolved", `checkpoint is ${describeSuppliedValue(live?.status ?? cp.status)} — the token is consumed, so this resume was neither validated nor executed (idempotent); a different outcome cannot redeem it`);
|
|
37
51
|
}
|
|
38
52
|
if ((internals?.inheritedGate?.parentConstraints?.length ?? 0) === 0) {
|
|
@@ -3,6 +3,8 @@ import { CheckpointError, remainingBudgetMicroUsd } from "../checkpoint-store.js
|
|
|
3
3
|
import { chainPolicyOnLeg, chainTopAnchors } from "./child-tree.js";
|
|
4
4
|
import { mintHookInvocationIdentity } from "../hooks.js";
|
|
5
5
|
import { admitLegMods, classicEventBase, failedHandlerClause, screenUserPrompt } from "../mods/stations.js";
|
|
6
|
+
import { legTaskIdOf } from "../leg-identity.js";
|
|
7
|
+
import { restoreRowTaskId } from "./checkpoint-scope.js";
|
|
6
8
|
import { checkToolPolicyProjection, policyCannotAnswer, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
7
9
|
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
8
10
|
import { skillGrantBindingMembers } from "../skill-grant.js";
|
|
@@ -31,7 +33,7 @@ export async function resumeApply(input) {
|
|
|
31
33
|
const screenedMessage = wakeMessage;
|
|
32
34
|
const identity = mintHookInvocationIdentity({
|
|
33
35
|
sessionId: cp.sessionId,
|
|
34
|
-
taskId: config
|
|
36
|
+
taskId: legTaskIdOf(config, restoreRowTaskId(internals, cp.state.rowTaskId), cp.sessionId),
|
|
35
37
|
legKind: "resume",
|
|
36
38
|
isDelegatedChild: effectiveDelegationFacts(internals, cp.state.isDelegatedChild).isDelegatedChild,
|
|
37
39
|
...(internals?.insideFork === true ? { insideFork: true } : {}),
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* — the post-consume hook fires on the tick the win was read — and returns what that rung returns.
|
|
10
10
|
*/
|
|
11
11
|
import { type Checkpoint, type CheckpointStore, type CheckpointToken } from "../checkpoint-store.js";
|
|
12
|
-
import type { InheritedGate, InstallingPhaseResult, ResumeRun } from "./contracts.js";
|
|
12
|
+
import type { InheritedGate, InstallingPhaseResult, ResumeRun, SuspendReap } from "./contracts.js";
|
|
13
|
+
import type { LocalClaims } from "./local-claims.js";
|
|
13
14
|
export interface ResumeClaimInput<R> {
|
|
14
15
|
/** borrowed-readonly — the checkpoint token being claimed. */
|
|
15
16
|
token: CheckpointToken;
|
|
@@ -21,10 +22,14 @@ export interface ResumeClaimInput<R> {
|
|
|
21
22
|
outcomeForStore: ResumeRun["outcome"];
|
|
22
23
|
/** borrowed-readonly — the deployment's claim holder the resume acts under (`RunInternals.holder`), carried into the CAS. */
|
|
23
24
|
holder?: string | undefined;
|
|
24
|
-
/** borrowed-mutable — the Runner's same-Runner
|
|
25
|
-
locallyClaimedTokens:
|
|
25
|
+
/** borrowed-mutable — the Runner's same-Runner claims: this attempt opens its own with the resolve, closes it on a loss or a throw. */
|
|
26
|
+
locallyClaimedTokens: LocalClaims;
|
|
26
27
|
/** borrowed-mutable — the Runner's parked-constraint registry: a terminally consumed token's entry is evicted. */
|
|
27
28
|
parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>;
|
|
29
|
+
/** borrowed-mutable — the Runner's suspended-env reap handles: a loss to an `expired` row runs that row's duty (its record taken). */
|
|
30
|
+
suspendedEnvReaps: Map<CheckpointToken, SuspendReap>;
|
|
31
|
+
/** borrowed-readonly — where the expired duty's bounded destroy failure is said (the Runner's `onError`); never thrown. */
|
|
32
|
+
onDestroyError: (err: unknown, sessionId: string) => void;
|
|
28
33
|
/** borrowed-readonly — the driver's post-claim rung, entered in this rung's last continuation. */
|
|
29
34
|
next: (claimed: ResumeClaimResult) => Promise<R>;
|
|
30
35
|
}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
2
2
|
import { checkpointRevOf } from "../checkpoint-generation.js";
|
|
3
|
+
import { runExpiredDuty } from "./expire-settle.js";
|
|
3
4
|
export async function resumeClaim(input) {
|
|
4
|
-
const { token, cp, store, outcomeForStore, holder, locallyClaimedTokens, parentConstraintRegistry } = input;
|
|
5
|
+
const { token, cp, store, outcomeForStore, holder, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps, onDestroyError } = input;
|
|
5
6
|
const expect = { rev: checkpointRevOf(cp), ...(holder !== undefined ? { holder } : {}) };
|
|
6
|
-
locallyClaimedTokens.
|
|
7
|
+
locallyClaimedTokens.open(token);
|
|
7
8
|
let won, loss;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
try {
|
|
10
|
+
if (store.claimTerminal !== undefined) {
|
|
11
|
+
const claim = await store.claimTerminal(token, cp.scope, { kind: "resolve", outcome: outcomeForStore, expect });
|
|
12
|
+
won = claim.claimed;
|
|
13
|
+
if (!claim.claimed)
|
|
14
|
+
loss = { status: claim.current.status, rev: claim.current.status === "absent" ? undefined : claim.current.rev, sameRow: true };
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
won = await store.resolve(token, cp.scope, outcomeForStore, expect);
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
catch (casErr) {
|
|
21
|
+
locallyClaimedTokens.close(token);
|
|
22
|
+
throw casErr;
|
|
16
23
|
}
|
|
17
24
|
if (!won)
|
|
18
|
-
locallyClaimedTokens.
|
|
25
|
+
locallyClaimedTokens.close(token);
|
|
19
26
|
if (!won) {
|
|
20
27
|
if (loss === undefined) {
|
|
21
28
|
const row = await store.get(token);
|
|
@@ -27,8 +34,17 @@ export async function resumeClaim(input) {
|
|
|
27
34
|
}
|
|
28
35
|
throw new CheckpointError("checkpoint.reopened_concurrently", "checkpoint changed concurrently (its revision advanced via a resolve/reopen cycle since this resume validated) — not executed; re-resume against the current state");
|
|
29
36
|
}
|
|
30
|
-
|
|
37
|
+
if (loss.status === "expired")
|
|
38
|
+
await runExpiredDuty({ token, parentConstraintRegistry, suspendedEnvReaps, destroyLabel: "expired-row env destroy (resume lost)", onDestroyError });
|
|
39
|
+
else
|
|
40
|
+
parentConstraintRegistry.delete(token);
|
|
31
41
|
throw new CheckpointError("checkpoint.already_resolved", "checkpoint already resolved or expired — not re-executed (idempotent)");
|
|
32
42
|
}
|
|
33
|
-
|
|
43
|
+
try {
|
|
44
|
+
return await input.next({});
|
|
45
|
+
}
|
|
46
|
+
catch (handoffErr) {
|
|
47
|
+
locallyClaimedTokens.close(token);
|
|
48
|
+
throw handoffErr;
|
|
49
|
+
}
|
|
34
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The resume ladder's INTERNALS-AND-CONFIG rung (E7), verbatim from `Runner.resumeStream`:
|
|
3
|
-
* the inherited constraints' retired-member door, the principal and
|
|
3
|
+
* the inherited constraints' retired-member door, the principal, placement and composition-leg identity-continuity rungs,
|
|
4
4
|
* and the governance-window ENTRANCE check for a row that still owes a delivery.
|
|
5
5
|
*
|
|
6
6
|
* Synchronous by construction, with the ladder's ONE await at this rung handed back instead of taken: the
|
|
@@ -16,7 +16,7 @@ export interface ResumeInternalsAndConfigInput {
|
|
|
16
16
|
cp: Checkpoint;
|
|
17
17
|
/** borrowed-readonly — the config snapshot (`principal`). */
|
|
18
18
|
config: ResumeTaskConfig;
|
|
19
|
-
/** borrowed-readonly — the internals snapshot (`placementRoot`). */
|
|
19
|
+
/** borrowed-readonly — the internals snapshot (`placementRoot`, `compositionLeg`). */
|
|
20
20
|
internals: RunInternals | undefined;
|
|
21
21
|
/** borrowed-readonly — the ONE read of the outcome discriminant (a bare resource_limit continue owes nothing). */
|
|
22
22
|
outcomeGate: ResumeOutcome["gate"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CheckpointError, readPendingSteerQueue } from "../checkpoint-store.js";
|
|
2
2
|
import { asResumeConfigRefusal } from "../mode-policy.js";
|
|
3
3
|
import { GLOBAL_USAGE_KEY, resolveUsageWindows, usageRetryAfterMs } from "../usage-window-store.js";
|
|
4
|
-
import { placementValueOrAbsent } from "./checkpoint-scope.js";
|
|
4
|
+
import { compositionLegRecord, placementValueOrAbsent, sameCompositionLeg } from "./checkpoint-scope.js";
|
|
5
5
|
import { assertNoRetiredInheritedConstraints } from "./retired-runner-deps.js";
|
|
6
6
|
export function resumeInternalsAndConfig(input) {
|
|
7
7
|
const { cp, config, internals, outcomeGate, runner } = input;
|
|
@@ -25,6 +25,15 @@ export function resumeInternalsAndConfig(input) {
|
|
|
25
25
|
"refused pre-CAS (the checkpoint stays pending): re-resume with the recorded root, or omit internals.placementRoot to inherit it");
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
{
|
|
29
|
+
const recordedLeg = compositionLegRecord(cp.state.compositionLeg);
|
|
30
|
+
const suppliedLeg = compositionLegRecord(internals?.compositionLeg);
|
|
31
|
+
if (recordedLeg !== undefined && suppliedLeg !== undefined && !sameCompositionLeg(recordedLeg, suppliedLeg)) {
|
|
32
|
+
throw new CheckpointError("resume.composition_mismatch", `the resume supplied composition leg ${JSON.stringify(suppliedLeg)} but this checkpoint was parked as ${JSON.stringify(recordedLeg)} — ` +
|
|
33
|
+
"continuing would run the leg as another composition's leg or file its next card under another host session; " +
|
|
34
|
+
"refused pre-CAS (the checkpoint stays pending): re-resume with the recorded value, or omit internals.compositionLeg to inherit it");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
28
37
|
const owesDelivery = outcomeGate !== "resource_limit" ||
|
|
29
38
|
readPendingSteerQueue(cp.state).length > 0 ||
|
|
30
39
|
(cp.state.runningBackgroundTasks?.length ?? 0) > 0;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type Checkpoint, type CheckpointStore, type CheckpointToken } from "../checkpoint-store.js";
|
|
13
13
|
import type { InheritedGate, InstallingPhaseResult, RunnerDepsSeat, SuspendReap } from "./contracts.js";
|
|
14
|
+
import type { LocalClaims } from "./local-claims.js";
|
|
14
15
|
export interface ResumePreflightInput<R> {
|
|
15
16
|
/** borrowed-readonly — the checkpoint token (handed to the deployment and to the settling CAS). */
|
|
16
17
|
token: CheckpointToken;
|
|
@@ -25,8 +26,8 @@ export interface ResumePreflightInput<R> {
|
|
|
25
26
|
/** borrowed-readonly — the Runner's deployment deps, read LIVE through the Runner (reads `resumePreflight`, `resumePreflightTimeoutMs`, `onError` (after the seat's await too) and is the seat's owner); the one home of why it is a
|
|
26
27
|
* seat and not a captured object is {@link RunnerDepsSeat}. */
|
|
27
28
|
runner: RunnerDepsSeat;
|
|
28
|
-
/** borrowed-mutable — the Runner's same-Runner
|
|
29
|
-
locallyClaimedTokens:
|
|
29
|
+
/** borrowed-mutable — the Runner's same-Runner claims: the terminal arm's expire attempt opens and closes its own. */
|
|
30
|
+
locallyClaimedTokens: LocalClaims;
|
|
30
31
|
/** borrowed-mutable — the Runner's parked-constraint registry: the token's entry is evicted when the terminal arm wins. */
|
|
31
32
|
parentConstraintRegistry: Map<CheckpointToken, NonNullable<InheritedGate["parentConstraints"]>>;
|
|
32
33
|
/** borrowed-mutable — the Runner's suspended-env reap handles: the winning terminal arm takes and destroys this token's. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
2
2
|
import { MAX_TIMER_MS } from "../mods/kernel/index.js";
|
|
3
|
-
import { frozenHandleCopy
|
|
3
|
+
import { frozenHandleCopy } from "../remote-env.js";
|
|
4
4
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
5
5
|
import { describeSuppliedValue } from "./decide-continuation.js";
|
|
6
|
-
import {
|
|
6
|
+
import { expireRowWithDuty } from "./expire-settle.js";
|
|
7
7
|
import { asThrownError } from "../thrown-value.js";
|
|
8
8
|
async function boundedPreflight(timeoutMs, signal, call) {
|
|
9
9
|
const controller = new AbortController();
|
|
@@ -97,37 +97,24 @@ export async function resumePreflight(input) {
|
|
|
97
97
|
const readableMessage = typeof suppliedMessage === "string" && suppliedMessage !== "" ? suppliedMessage : undefined;
|
|
98
98
|
const said = readableMessage !== undefined ? `: ${inlineUntrusted(readableMessage)}` : " (no readable verdict — fail-closed)";
|
|
99
99
|
if (disposition === "terminal" && readableMessage !== undefined) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
const settled = await expireRowWithDuty({
|
|
101
|
+
token, scope: cp.scope, store, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps,
|
|
102
|
+
destroyLabel: "terminal-preflight env destroy",
|
|
103
|
+
onDestroyError: (envErr, sessionId) => {
|
|
104
|
+
try {
|
|
105
|
+
runner.deps.onError?.(envErr, { phase: "config", sessionId });
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
});
|
|
109
111
|
if (!settled) {
|
|
110
|
-
locallyClaimedTokens.delete(token);
|
|
111
112
|
const live = await store.get(token);
|
|
112
113
|
if (live?.status === "pending") {
|
|
113
114
|
throw new CheckpointError("resume.preflight_rejected", `the deployment's resumePreflight ruled this resume PERMANENTLY blocked${said}, but the row moved under this refusal (a concurrent resolve/reopen cycle) — nothing was settled here; the row is pending again, re-resume against the current state (the preflight screens every attempt)`);
|
|
114
115
|
}
|
|
115
116
|
throw new CheckpointError("resume.preflight_rejected", `the deployment's resumePreflight ruled this resume PERMANENTLY blocked${said} — a concurrent actor had already settled the row (${describeSuppliedValue(live?.status ?? "consumed")}); nothing was settled by this refusal`);
|
|
116
117
|
}
|
|
117
|
-
parentConstraintRegistry.delete(token);
|
|
118
|
-
const terminalReap = suspendedEnvReaps.get(token);
|
|
119
|
-
suspendedEnvReaps.delete(token);
|
|
120
|
-
locallyClaimedTokens.delete(token);
|
|
121
|
-
if (terminalReap?.env !== undefined && hasDestroy(terminalReap.env)) {
|
|
122
|
-
const terminalEnv = terminalReap.env;
|
|
123
|
-
await settleTeardownLeg(() => terminalEnv.destroy(), "terminal-preflight env destroy", (envErr) => {
|
|
124
|
-
try {
|
|
125
|
-
runner.deps.onError?.(envErr, { phase: "config", sessionId: terminalReap.sessionId });
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
118
|
try {
|
|
132
119
|
runner.deps.onError?.(new Error(`resumePreflight ruled this row PERMANENTLY blocked${said} — the row was settled terminally (expired) by this refusal's single-shot CAS (token no longer redeemable)`), { phase: "hook", sessionId: cp.sessionId });
|
|
133
120
|
}
|
|
@@ -6,6 +6,8 @@ const RETIRED_RUNNER_DEPS_KEYS = {
|
|
|
6
6
|
builtinWorkflows: "the engine ships no built-in named workflows — the Workflow tool's `{name}` resolves only `RunnerDeps.workflowScriptStore`; register any named workflow there",
|
|
7
7
|
graderEnvFactory: "the grader env reaches the repair loop as `RepairLoopConfig.graderEnv`, minted by the trusted control plane (`assertOracleIsolation` / `GraderEnv` unchanged)",
|
|
8
8
|
mcpImageResizer: "one image processor seat serves every image of a run: `RunnerDeps.imageProcessor` (an `ImageDownsampler`, or `false` for none; absent detects sharp once per process) — the MCP result, the Read tool, PDF pages, Bash data URIs, any tool's result, task images and attachments all pass the one admission with it",
|
|
9
|
+
mediaByteCapBytes: "the request's media budget is `RunnerDeps.mediaBudgetBase64Chars`, in base64 characters (the unit a provider counts; 0 or Infinity: none, else a whole number of at least twice `IMAGE_ADMISSION.request.hysteresisBase64Chars`)",
|
|
10
|
+
onMediaStripped: "the media a request leaves out is told to the person as the `context.media_removed` notice (reason `media_budget`, once per block per session) and to the operator as the `context.media_removed` trace frame (one per request)",
|
|
9
11
|
"hands.readImageDownsampler": "one image processor seat serves every image of a run: `RunnerDeps.imageProcessor` (an `ImageDownsampler`, or `false` for none; absent detects sharp once per process) — the Read tool's images ride it with every other carrier's",
|
|
10
12
|
"hands.readCyberReminder": "a Read result carries only the reminders about that read (an empty file, an offset past the end, a file already in context) — no standing content-safety tail, so there is nothing to switch; a deployment that wants that sentence states it in its own `appendSystemPrompt`",
|
|
11
13
|
promptProvider: "a deployment changes prompt text through overlays: register a `prompt.compose` handler on `RunnerDeps.mods` answering `{ overlays }` (role base `replace`, a brand line `add` to the role band, a behavior or scenario `add`, a core-behavior `replace` / `append` / `drop`), choose the role base per task with `TaskSpec.promptRole`, and dispose of an MCP server's instructions with a `prompt.section` registration answering `{ text }` / `{ text: null }`",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GIT_STATUS_ECHO_PREVIEW } from "./git-status-frame.js";
|
|
2
2
|
import { wrapGitFrame } from "./git-leg-delivery.js";
|
|
3
|
+
import { appendAdmittedRow } from "../row-admission.js";
|
|
3
4
|
import { thrownText } from "../thrown-value.js";
|
|
4
5
|
export function runGitLane(input) {
|
|
5
6
|
const { prepared, queue, rs, ident, onMessageUpdate, onMessageEnd, onToolStart, onToolEnd, onTurnEnd, onTurnBoundary, runner } = input;
|
|
@@ -14,7 +15,7 @@ export function runGitLane(input) {
|
|
|
14
15
|
: { kind: frame.kind, body: frame.body, hash: frame.hash };
|
|
15
16
|
const wrapped = wrapGitFrame(use.body, prepared.reminderMark);
|
|
16
17
|
try {
|
|
17
|
-
const entryId = await prepared.session
|
|
18
|
+
const entryId = await appendAdmittedRow(prepared.admitRows, prepared.session, {
|
|
18
19
|
role: "user",
|
|
19
20
|
content: [{ type: "text", text: wrapped }],
|
|
20
21
|
timestamp: Date.now(),
|
|
@@ -28,8 +28,8 @@ export function createHarnessHandlers(input) {
|
|
|
28
28
|
const toolTurnIncompleteSeat = createToolTurnIncompleteSeat(deps.runnerHooks.onNotice, { sessionId: prepared.sessionId, runId: prepared.runId });
|
|
29
29
|
const finishReasonSeat = createFinishReasonSeat(deps.runnerHooks.onNotice, { sessionId: prepared.sessionId, runId: prepared.runId });
|
|
30
30
|
const withheldShellEnvSeat = createWithheldShellEnvSeat(prepared, deps.runnerHooks.onNotice);
|
|
31
|
-
const { spec, queue, internals, ident, pushContent, emitCommitted, startedToolCallIds, toolStartAt, toolProgress, writeFamilyOf, toolLabels, postToolBatchArmed, batchArgs, internalsNotifier,
|
|
32
|
-
const frames = { push: (f) => pushContent({ ...f, ...ident() }), structured: prepared.structuredProjector,
|
|
31
|
+
const { spec, queue, internals, ident, pushContent, emitCommitted, startedToolCallIds, toolStartAt, toolProgress, writeFamilyOf, toolLabels, postToolBatchArmed, batchArgs, internalsNotifier, mediaBudgetBase64Chars } = deps;
|
|
32
|
+
const frames = { push: (f) => pushContent({ ...f, ...ident() }), structured: prepared.structuredProjector, mediaBudgetBase64Chars };
|
|
33
33
|
const startOf = (e) => {
|
|
34
34
|
const label = toolLabels.get(e.toolName);
|
|
35
35
|
return { toolCallId: e.toolCallId, spelledName: e.toolName, wireName: rosterToolName(prepared.toolRosterDeltas.current, e.toolName), ...(label !== undefined ? { label } : {}), args: e.args, ...requesterOf(prepared.modBus, e.toolCallId) };
|
|
@@ -7,7 +7,7 @@ import type { Stats } from "./assemble-result.js";
|
|
|
7
7
|
import { type CallerStopGate } from "./caller-stop-gate.js";
|
|
8
8
|
import type { CaptureOptOutRef, LiveHandle, ManualCompactRef, McpRedialRef, NotificationLaneBindings, NotifyRef, Prepared, RunInternals, RunnerDepsSeat, TaskIdRef } from "./contracts.js";
|
|
9
9
|
export interface RunIdentityWiringInput {
|
|
10
|
-
/** borrowed-readonly — the task spec: the
|
|
10
|
+
/** borrowed-readonly — the task spec: the memory / notification seats it names, its principal and its signal. */
|
|
11
11
|
spec: TaskSpec;
|
|
12
12
|
/** borrowed-mutable — the run's event queue: the manifest, roster-delta, task_started, compaction_outcome and
|
|
13
13
|
* redelivered task_notification frames. */
|
|
@@ -49,7 +49,7 @@ export interface RunIdentityWiringInput {
|
|
|
49
49
|
runner: RunnerDepsSeat;
|
|
50
50
|
}
|
|
51
51
|
export interface RunIdentityWiringResult {
|
|
52
|
-
/** The
|
|
52
|
+
/** The leg's task id (`Prepared.taskId`, minted once at prepare) — one source, shared with `ident()`. */
|
|
53
53
|
runSourceTaskId: string;
|
|
54
54
|
/** The spawning tool call's id when this task runs AS A SUB-AGENT; undefined on a top-level run. */
|
|
55
55
|
parentToolCallId: string | undefined;
|
|
@@ -3,10 +3,12 @@ import { createSafeNotifier, observeThenableRejection } from "../safe-notify.js"
|
|
|
3
3
|
import { forwardSafely } from "./forward-sink.js";
|
|
4
4
|
import { emitsChildRowFrames, taskStartedFrame } from "../delegation-frames.js";
|
|
5
5
|
import { recordFrameReceipt, toolResultReceiptKey } from "../frame-settlement.js";
|
|
6
|
+
import { createReceivingChain } from "../mods/session-receive.js";
|
|
6
7
|
import { discloseDroppedPending, renderTaskNotificationXml, taskNotificationDedupKey } from "../task-notification.js";
|
|
7
8
|
import { buildAppliedHumanInputEvent } from "../human-input-projection.js";
|
|
8
9
|
import { announceAcceptance, nextHumanInputSeq } from "./steer-admission.js";
|
|
9
10
|
import { deliverDelegationLifecycle, deliverEngineNotice, parentLegIds, parkedInputIdsOf, undrainedUserInputNotices } from "../types.js";
|
|
11
|
+
import { droppedInputsDisclosure } from "../input-author.js";
|
|
10
12
|
import { mintCallerStopGate } from "./caller-stop-gate.js";
|
|
11
13
|
export function runIdentityWiring(input) {
|
|
12
14
|
const { spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, mcpRedialRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, notificationLane, pendingSessionNotifications, runner } = input;
|
|
@@ -16,7 +18,7 @@ export function runIdentityWiring(input) {
|
|
|
16
18
|
taskIdRef.effectiveMemoryScopes = prepared.effectiveMemoryScopes;
|
|
17
19
|
if (taskIdRef)
|
|
18
20
|
taskIdRef.editedFiles = prepared.editedFilesSnapshot;
|
|
19
|
-
const runSourceTaskId =
|
|
21
|
+
const runSourceTaskId = prepared.taskId;
|
|
20
22
|
const parentToolCallId = internals?.parentToolCallId;
|
|
21
23
|
const ident = () => parentToolCallId !== undefined ? { eventId: uuidv7(), parentToolCallId, sourceTaskId: runSourceTaskId } : { eventId: uuidv7() };
|
|
22
24
|
notificationLane.ident = ident;
|
|
@@ -71,10 +73,11 @@ export function runIdentityWiring(input) {
|
|
|
71
73
|
undrainedUserAtEnd = { steer: counts.steer, followUp: counts.followUp, ...(inputIds !== undefined ? { inputIds } : {}) };
|
|
72
74
|
return;
|
|
73
75
|
}
|
|
74
|
-
for (const notice of undrainedUserInputNotices({ ...counts, ...(inputIds !== undefined ? { inputIds } : {}) },
|
|
76
|
+
for (const notice of undrainedUserInputNotices({ ...counts, ...(inputIds !== undefined ? { inputIds } : {}) }, prepared.taskId, prepared.sessionId, prepared.runId, parentLegIds(internals))) {
|
|
75
77
|
deliverEngineNotice(runner.deps.onNotice, notice);
|
|
76
78
|
}
|
|
77
79
|
};
|
|
80
|
+
prepared.harness.onUndrainedOtherInputs = (authors) => runner.deps.onError?.(droppedInputsDisclosure(authors), { phase: "degraded", sessionId: prepared.sessionId, classification: "undelivered-input-dropped" });
|
|
78
81
|
prepared.harness.onEngineNoteConsumed = (p) => {
|
|
79
82
|
const payload = p;
|
|
80
83
|
const peer = payload?.peer;
|
|
@@ -117,17 +120,23 @@ export function runIdentityWiring(input) {
|
|
|
117
120
|
catch {
|
|
118
121
|
}
|
|
119
122
|
{
|
|
123
|
+
const receiving = createReceivingChain(() => prepared.receiveSeat);
|
|
120
124
|
const pendingIdle = pendingSessionNotifications.drain(prepared.sessionId);
|
|
121
125
|
if (pendingIdle !== undefined) {
|
|
122
126
|
for (const payload of discloseDroppedPending(pendingIdle, prepared.taskReadHandleOf, () => prepared.listBackgroundTasks({ settled: true }))) {
|
|
123
127
|
const parkedPriority = pendingIdle.priorities?.get(payload);
|
|
124
128
|
deliveredAtTurnOpen.add(taskNotificationDedupKey(payload));
|
|
125
129
|
queue.push({ type: "task_notification", notification: payload, ...(parkedPriority !== undefined ? { priority: parkedPriority } : {}), ...ident() });
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
const handOver = (shown) => {
|
|
131
|
+
void prepared.harness.nextTurn(renderTaskNotificationXml(shown), { provenance: "engine-note", enginePayload: payload }).catch(() => {
|
|
132
|
+
pendingSessionNotifications.pend(prepared.sessionId, payload, parkedPriority);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
receiving.pass(payload, { handOver, fault: () => pendingSessionNotifications.pend(prepared.sessionId, payload, parkedPriority) });
|
|
129
136
|
}
|
|
130
137
|
}
|
|
138
|
+
if (receiving.settled !== undefined)
|
|
139
|
+
prepared.turnOpenRedelivery.current = receiving.settled;
|
|
131
140
|
}
|
|
132
141
|
const loopLatch = { ended: false, userInterrupted: false, userHalted: false, callerStop: mintCallerStopGate(spec.signal) };
|
|
133
142
|
onReady({ harness: prepared.harness, abortController: prepared.abortController, loop: loopLatch, reminderMark: prepared.reminderMark, sessionId: prepared.sessionId, runId: prepared.runId, hookIdentity: prepared.hookIdentity, modBus: prepared.modBus, permissionMode: prepared.permissionMode });
|
|
@@ -40,8 +40,8 @@ export interface RunLegInput<R> {
|
|
|
40
40
|
rs: RunState;
|
|
41
41
|
/** borrowed-readonly — the API-boundary attribution snapshot of the objective's actor (the objective leg's speaker envelope). */
|
|
42
42
|
entryActor: ActorAssertion | undefined;
|
|
43
|
-
/** borrowed-readonly — `RunInternals.
|
|
44
|
-
|
|
43
|
+
/** borrowed-readonly — `RunInternals.objectiveAuthor` as the trusted channel gave it: who wrote the objective, read at its seat. */
|
|
44
|
+
objectiveAuthor: unknown;
|
|
45
45
|
/** borrowed-readonly — the effective walltime window (undefined = unbounded): `<= 0` refuses the first turn. */
|
|
46
46
|
effectiveTimeoutMs: number | undefined;
|
|
47
47
|
/** borrowed-mutable — the hard walltime timer: claimed (`fired`) and cleared by the exhausted arms and the finally. */
|
|
@@ -84,7 +84,7 @@ export interface RunLegInput<R> {
|
|
|
84
84
|
unsubBoundary: () => void;
|
|
85
85
|
/** borrowed-readonly — the git lane's harness-event release, called third. */
|
|
86
86
|
unsub: () => void;
|
|
87
|
-
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`onError`, `hooks`, `onNotice`, `
|
|
87
|
+
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`onError`, `hooks`, `onNotice`, `mediaBudgetBase64Chars`; the resumed
|
|
88
88
|
* decision's resolver files its execution record's word through `onNotice` too); the one home of why it is a seat and not a
|
|
89
89
|
* captured object is {@link RunnerDepsSeat}. */
|
|
90
90
|
runner: RunnerDepsSeat;
|