@sema-agent/core 7.58.0 → 7.60.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 +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -16,7 +16,7 @@ import type { WorkflowGovernanceBaseline } from "../core/types.js";
|
|
|
16
16
|
import type { WorkflowRunStore } from "../core/workflow-run-store.js";
|
|
17
17
|
import type { WorkflowJournalStore } from "../core/workflow-journal-store.js";
|
|
18
18
|
import type { TaskRegistry } from "../core/task-registry.js";
|
|
19
|
-
import type
|
|
19
|
+
import { type TaskNotificationPayload } from "../core/task-notification.js";
|
|
20
20
|
import type { WorkflowAgentHandle } from "./workflow.js";
|
|
21
21
|
import type { WorkflowScriptRunner } from "./workflow-script-runner.js";
|
|
22
22
|
import { type NamedWorkflowListing, type WorkflowScriptStore } from "./workflow-script-store.js";
|
|
@@ -204,6 +204,10 @@ export interface RunWorkflowToolDeps {
|
|
|
204
204
|
taskNotification?: (notification: TaskNotificationPayload, opts?: {
|
|
205
205
|
priority?: "now" | "next" | "later";
|
|
206
206
|
}) => void;
|
|
207
|
+
/** Where a finished run's full record (its result and every agent's row) is stored for `ReadToolResult` — the completion
|
|
208
|
+
* notification carries a bounded result and only the rows that did not complete. Absent ⇒ the notification says the
|
|
209
|
+
* record is not readable from this session. */
|
|
210
|
+
taskArtifacts?: import("../core/tool-result-store.js").TaskArtifactSeat;
|
|
207
211
|
/** Runner-owned owner fallback for registry access when the execute context is unavailable. */
|
|
208
212
|
taskOwner?: string;
|
|
209
213
|
/** Hard ceilings. */
|
|
@@ -223,8 +227,7 @@ export interface RunWorkflowToolDeps {
|
|
|
223
227
|
* minted once by the host's prepare and threaded as a MOUNT dep because this auto-mount's execute ctx is minimal
|
|
224
228
|
* (`ctx.parentSpecSeat` wins when a wrapping path provides it). Applied onto every spawned agent at the launch site
|
|
225
229
|
* (`RunWorkflowOptions.parentSpecSeat` → `applyParentSpecSeat`, the Task lane's one law); the tool also reads its
|
|
226
|
-
* `principal` for the registry/notify scope
|
|
227
|
-
* caller has no later turn for a notification to land in, so "end your turn and wait" is wrong for it). */
|
|
230
|
+
* `principal` for the registry/notify scope. */
|
|
228
231
|
parentSpecSeat?: import("../core/parent-spec-seat.js").ParentSpecSeat;
|
|
229
232
|
/** The HOST run's own per-request question face was already stripped by the engine (`RunInternals.questionFaceStripped`
|
|
230
233
|
* of the host leg): the fact inherits onto every agent this workflow spawns (`ctx.questionFaceStripped` wins on a rich-ctx
|
|
@@ -347,6 +350,9 @@ export interface RunWorkflowToolDeps {
|
|
|
347
350
|
autoModeReview?: () => {
|
|
348
351
|
decider: import("../core/auto-mode.js").AutoModeDecider;
|
|
349
352
|
} | undefined;
|
|
353
|
+
/** The HOST leg's agent stations (`agent.spawn` raised for each child before it starts), a call-time getter for the
|
|
354
|
+
* same minimal-ctx reason as `autoModeReview`; `ctx.agentStations` wins when a wrapping path provides it. */
|
|
355
|
+
agentStations?: () => import("../core/mods/agent-stations.js").AgentStations | undefined;
|
|
350
356
|
/** The HOST run's RESOLVED checkpoint seat — the store object the host parks in, else the word `"disabled"`
|
|
351
357
|
* (the same two-state value the delegation ctx carries as `ToolExecuteContext.checkpointStoreForChildren`;
|
|
352
358
|
* `ctx` wins on a rich-ctx mount). Every agent this workflow spawns inherits it verbatim unless its own
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
3
|
import { governanceBaselineError, governanceBaselineProblem } from "./governance-baseline-validity.js";
|
|
4
|
+
import { formatWorkflowRun, WORKFLOW_RECORD_WHOLE } from "../core/task-registry-shared.js";
|
|
5
|
+
import { persistTaskArtifact } from "../core/tool-result-store.js";
|
|
6
|
+
import { oweTerminalDelivery, resolveCompletionSink } from "../core/task-notification.js";
|
|
4
7
|
import { egressText, egressThrownText, boundedRedactedSummary } from "../core/untrusted-egress.js";
|
|
5
8
|
import { withDelegationProvenance } from "../core/tool-policy.js";
|
|
6
9
|
import { LAUNCH_RECEIPT_OWN_WORDS_CLAUSE, launchReceiptNoQuoteClause } from "../agents/launch-receipt-contract.js";
|
|
@@ -53,13 +56,31 @@ function completionSummary(name, run) {
|
|
|
53
56
|
? "; resume found NO journal entries — nothing replayed, the whole script re-ran live"
|
|
54
57
|
: `; resume: replayed ${run.resume.replayed} of ${run.resume.journalEntries} journaled results`;
|
|
55
58
|
return (`workflow${cleanName ? ` "${cleanName}"` : ""} completed${elapsed} — agents ${done}/${run.agents.length} done` +
|
|
56
|
-
`${failed > 0 ? ` (${failed} failed)` : ""}${resumeClause}
|
|
59
|
+
`${failed > 0 ? ` (${failed} failed)` : ""}${resumeClause}`);
|
|
60
|
+
}
|
|
61
|
+
const WORKFLOW_NOTIFY_ROWS_MAX = 5;
|
|
62
|
+
function workflowRecordTeach(run, artifact) {
|
|
63
|
+
const notDone = run.agents.filter((a) => a.status !== "completed");
|
|
64
|
+
const rows = notDone
|
|
65
|
+
.slice(0, WORKFLOW_NOTIFY_ROWS_MAX)
|
|
66
|
+
.map((a) => `${a.label}: ${a.status}${a.errorMessage !== undefined ? ` — ${boundedRedactedSummary(a.errorMessage, 160)}` : ""}`);
|
|
67
|
+
const rowsTeach = notDone.length === 0
|
|
68
|
+
? ""
|
|
69
|
+
: `Agents that did not complete (${notDone.length} of ${run.agents.length}${notDone.length > rows.length ? `, first ${rows.length} shown` : ""}): ${rows.join("; ")}. `;
|
|
70
|
+
const recordTeach = artifact.kind === "stored"
|
|
71
|
+
? `Full record (the result and every agent's row): read it with ReadToolResult (ref "${artifact.ref}") before assuming an empty or unexpected result.`
|
|
72
|
+
: artifact.kind === "unconfirmed"
|
|
73
|
+
? "The full record (the result and every agent's row) could not be stored (the write failed or went unconfirmed), so no ref can read it back; TaskOutput reads it where mounted."
|
|
74
|
+
: "The full record (the result and every agent's row) is not stored behind a ref (no offload store); TaskOutput reads it where mounted.";
|
|
75
|
+
return `${rowsTeach}${recordTeach}`;
|
|
57
76
|
}
|
|
58
77
|
function completionIdFromRejection(err) {
|
|
78
|
+
return workflowRunOfRejection(err)?.completionId;
|
|
79
|
+
}
|
|
80
|
+
function workflowRunOfRejection(err) {
|
|
59
81
|
if (err === null || (typeof err !== "object" && typeof err !== "function"))
|
|
60
82
|
return undefined;
|
|
61
|
-
|
|
62
|
-
return run?.completionId;
|
|
83
|
+
return err.workflowRun;
|
|
63
84
|
}
|
|
64
85
|
function workflowUsageBlock(run) {
|
|
65
86
|
const agents = run.agents;
|
|
@@ -79,19 +100,19 @@ function workflowUsageBlock(run) {
|
|
|
79
100
|
...(run.endedAt !== undefined ? { duration_ms: run.endedAt - run.startedAt } : {}),
|
|
80
101
|
};
|
|
81
102
|
}
|
|
82
|
-
function workflowDiagnostics(runId, journalRef, resumeMiss) {
|
|
103
|
+
function workflowDiagnostics(runId, journalRef, resumeMiss, record) {
|
|
83
104
|
const journalTeach = journalRef === undefined
|
|
84
105
|
? ""
|
|
85
106
|
: journalRef.includes("://")
|
|
86
|
-
? ` Full journal: ${journalRef}.`
|
|
87
|
-
: ` Full journal: ${journalRef} (a deployment data path —
|
|
107
|
+
? ` Full journal (the step log resumeFromRunId replays): ${journalRef}.`
|
|
108
|
+
: ` Full journal (the step log resumeFromRunId replays): ${journalRef} (a deployment data path — it may be outside the paths Read can reach).`;
|
|
88
109
|
const resumeMissTeach = resumeMiss
|
|
89
110
|
? ` NOTE: this was a resume, but the prior run's journal was not usable under this scope — verify the runId and that this deployment wires a journalStore; the results above are from a full live re-run.`
|
|
90
111
|
: "";
|
|
91
|
-
return (
|
|
112
|
+
return ((record ?? "") +
|
|
92
113
|
journalTeach +
|
|
93
114
|
resumeMissTeach +
|
|
94
|
-
` To continue after editing the script: re-invoke with resumeFromRunId: "${runId}" (completed agents replay from the journal; only new/changed calls run).`);
|
|
115
|
+
` To continue after editing the script: re-invoke with resumeFromRunId: "${runId}" (completed agents replay from the journal; only new/changed calls run).`).trimStart();
|
|
95
116
|
}
|
|
96
117
|
const SCRIPT_ERROR_CODES = new Set([
|
|
97
118
|
"workflow.script_error",
|
|
@@ -109,11 +130,11 @@ function failureSummary(err, runId) {
|
|
|
109
130
|
if (code === WORKFLOW_AGENT_PARKED_ERROR_CODE) {
|
|
110
131
|
const msg = typeof e?.message === "string" ? egressText("same-principal", e.message) : "";
|
|
111
132
|
return (`workflow parked (${code}): ${msg.length > 200 ? `${msg.slice(0, 200)}…` : msg} — it did not fail and is not finished` +
|
|
112
|
-
(runId ? `;
|
|
133
|
+
(runId ? `; the diagnostics below name its record (the parked agent's row reads status "parked")` : "") +
|
|
113
134
|
`; do not re-issue the same call — once the approval is decided, the deployment resumes this run${runId ? ` (resumeFromRunId: "${runId}")` : ""} and the script continues from the parked call`);
|
|
114
135
|
}
|
|
115
136
|
const guide = runId
|
|
116
|
-
? `;
|
|
137
|
+
? `; which agents failed is in the diagnostics below; after fixing, re-invoke with resumeFromRunId: "${runId}" (completed agents replay from the journal)`
|
|
117
138
|
: "";
|
|
118
139
|
if (code && SCRIPT_ERROR_CODES.has(code) && typeof e?.message === "string") {
|
|
119
140
|
const msg = egressText("same-principal", e.message);
|
|
@@ -480,6 +501,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
480
501
|
let handle;
|
|
481
502
|
const workflowTaskId = d.taskRegistry?.mintTaskId("workflow");
|
|
482
503
|
const autoModeReview = ctx.autoModeReview ?? d.autoModeReview?.();
|
|
504
|
+
const agentStations = ctx.agentStations ?? d.agentStations?.();
|
|
483
505
|
const centerFromCtx = ctx.centerArtifactDigest !== undefined;
|
|
484
506
|
const parentCenterArtifactDigest = centerFromCtx ? ctx.centerArtifactDigest : d.parentCenterArtifactDigest?.();
|
|
485
507
|
const parentCenterSourceRevision = centerFromCtx ? ctx.centerSourceRevision : d.parentCenterSourceRevision?.();
|
|
@@ -545,6 +567,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
545
567
|
? { inheritedGate: (ctx.inheritedGateForChildren ?? d.inheritedGateForChildren)() }
|
|
546
568
|
: {}),
|
|
547
569
|
...(autoModeReview !== undefined ? { autoModeReview } : {}),
|
|
570
|
+
...(agentStations !== undefined ? { agentStations } : {}),
|
|
548
571
|
}, { workflowDepth: d.workflowDepth, ...((ctx.toolSelector?.layers ?? d.parentToolCeiling) !== undefined ? { toolCeiling: (ctx.toolSelector?.layers ?? d.parentToolCeiling) } : {}) });
|
|
549
572
|
}
|
|
550
573
|
catch (err) {
|
|
@@ -582,6 +605,8 @@ async function mountRunWorkflowTool(d) {
|
|
|
582
605
|
},
|
|
583
606
|
});
|
|
584
607
|
}
|
|
608
|
+
const completionSink = resolveCompletionSink(ctx.onTaskNotification, d.taskNotification);
|
|
609
|
+
oweTerminalDelivery(completionSink, { task_id: runId, task_type: "workflow" });
|
|
585
610
|
{
|
|
586
611
|
let notified = false;
|
|
587
612
|
const fire = (notification) => {
|
|
@@ -589,7 +614,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
589
614
|
return;
|
|
590
615
|
notified = true;
|
|
591
616
|
try {
|
|
592
|
-
|
|
617
|
+
completionSink?.(notification, { priority: "next" });
|
|
593
618
|
}
|
|
594
619
|
catch {
|
|
595
620
|
}
|
|
@@ -613,8 +638,14 @@ async function mountRunWorkflowTool(d) {
|
|
|
613
638
|
}))
|
|
614
639
|
.catch(() => { });
|
|
615
640
|
};
|
|
641
|
+
const recordOf = async (run) => {
|
|
642
|
+
const artifact = await persistTaskArtifact(d.taskArtifacts, runId, formatWorkflowRun(run, WORKFLOW_RECORD_WHOLE).content);
|
|
643
|
+
if (artifact.kind === "stored")
|
|
644
|
+
d.taskRegistry?.recordArtifactRef(runId, artifact.ref, 0);
|
|
645
|
+
return workflowRecordTeach(run, artifact);
|
|
646
|
+
};
|
|
616
647
|
handle.done
|
|
617
|
-
.then((res) => fire({
|
|
648
|
+
.then(async (res) => fire({
|
|
618
649
|
task_id: runId,
|
|
619
650
|
task_type: "workflow",
|
|
620
651
|
...(ctx.toolCallId !== undefined ? { toolUseId: ctx.toolCallId } : {}),
|
|
@@ -622,17 +653,22 @@ async function mountRunWorkflowTool(d) {
|
|
|
622
653
|
summary: completionSummary(meta.name, res.run),
|
|
623
654
|
result: boundedRedactedSummary(res.result, 4000),
|
|
624
655
|
usage: workflowUsageBlock(res.run),
|
|
625
|
-
diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope), res.run.resume?.journalEntries === 0),
|
|
656
|
+
diagnostics: workflowDiagnostics(runId, d.journalStore?.locator?.(runId, res.run.scope), res.run.resume?.journalEntries === 0, await recordOf(res.run).catch(() => "This run's record could not be read.")),
|
|
626
657
|
completionId: res.run.completionId,
|
|
627
|
-
}), (err) =>
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
658
|
+
}), async (err) => {
|
|
659
|
+
const carried = workflowRunOfRejection(err);
|
|
660
|
+
const failedRun = (carried?.id === runId && Array.isArray(carried.agents) ? carried : undefined) ?? (d.store !== undefined ? ((await d.store.get(runId).catch(() => null)) ?? undefined) : undefined);
|
|
661
|
+
const record = failedRun !== undefined ? await recordOf(failedRun).catch(() => "This run's record could not be read.") : "This failure carries no record of the run's agents and no run store holds one.";
|
|
662
|
+
fire({
|
|
663
|
+
task_id: runId,
|
|
664
|
+
task_type: "workflow",
|
|
665
|
+
...(ctx.toolCallId !== undefined ? { toolUseId: ctx.toolCallId } : {}),
|
|
666
|
+
status: "failed",
|
|
667
|
+
summary: failureSummary(err, runId),
|
|
668
|
+
diagnostics: workflowDiagnostics(runId, undefined, undefined, record),
|
|
669
|
+
...(completionIdFromRejection(err) !== undefined ? { completionId: completionIdFromRejection(err) } : {}),
|
|
670
|
+
});
|
|
671
|
+
})
|
|
636
672
|
.catch(() => { });
|
|
637
673
|
}
|
|
638
674
|
return {
|
|
@@ -645,20 +681,14 @@ async function mountRunWorkflowTool(d) {
|
|
|
645
681
|
handling: `${launchReceiptNoQuoteClause(" (the ids above, and scriptPath when present)")} ${LAUNCH_RECEIPT_OWN_WORDS_CLAUSE}`,
|
|
646
682
|
note: (() => {
|
|
647
683
|
const pollExpr = d.taskRegistry ? `TaskOutput({ task_id: "${runId}" })` : undefined;
|
|
648
|
-
const blockingPollExpr = d.taskRegistry ? `TaskOutput({ task_id: "${runId}", block: true })` : undefined;
|
|
649
684
|
const journalRef = d.journalStore?.locator?.(runId, taskScope ?? d.scope ?? "");
|
|
650
685
|
const carries = pollExpr
|
|
651
686
|
? ` A terminal ${pollExpr} reply carries its result AND per-agent rows — read them${journalRef !== undefined ? ` (full journal: ${journalRef})` : ""} before assuming an empty or unexpected result.`
|
|
652
687
|
: "";
|
|
653
|
-
if (parentSpecSeat?.oneShot === true) {
|
|
654
|
-
return blockingPollExpr
|
|
655
|
-
? `This is a ONE-SHOT submission (e.g. headless \`-p\`) — there is no later turn for a background notification to land in, so do NOT end your turn expecting one. Actively wait instead: ${blockingPollExpr}. If it is still running after the wait, wait again (bounded) rather than ending the turn, or write out your best available answer now if you are near your own time budget.${carries}`
|
|
656
|
-
: "This is a one-shot submission (e.g. headless `-p`) and no poll path is available — the workflow's outcome may not be recoverable after this turn ends.";
|
|
657
|
-
}
|
|
658
688
|
if (d.notifier) {
|
|
659
689
|
return `The workflow runs asynchronously. You will be NOTIFIED when it completes (the notification carries the result). End your turn and wait — do not poll unless the user asks for progress.${carries}`;
|
|
660
690
|
}
|
|
661
|
-
if (
|
|
691
|
+
if (completionSink) {
|
|
662
692
|
return `The workflow runs asynchronously. Its completion is injected into THIS session if it is still active; if you have ended your turn and hear nothing, ${pollExpr ? `poll ${pollExpr}` : "there is no poll path wired"}.${carries}`;
|
|
663
693
|
}
|
|
664
694
|
return pollExpr
|
|
@@ -92,7 +92,7 @@ export interface WorkflowAgentSpec extends ScriptClampSeats {
|
|
|
92
92
|
* restricting value, an add-only row through the row's script and entry laws. A row marked inherited-only (its
|
|
93
93
|
* restricting value switches off an operator-side record) is outside this set and is stripped like any other key.
|
|
94
94
|
*/
|
|
95
|
-
export declare const WHITELIST_KEYS: readonly ("
|
|
95
|
+
export declare const WHITELIST_KEYS: readonly ("thinking" | "systemPrompt" | "objective" | "images" | "limits" | ScriptSeat | "modelName")[];
|
|
96
96
|
/**
|
|
97
97
|
* #505 ② — ACCEPTED ALIAS SPELLINGS on the spec: `alias → the {@link WHITELIST_KEYS} member it means`.
|
|
98
98
|
*
|
|
@@ -5,6 +5,7 @@ import { CLAMP_SET, SCRIPT_SEATS } from "../core/child-clamp-seats.js";
|
|
|
5
5
|
import { WorkflowScriptError } from "./workflow-meta.js";
|
|
6
6
|
import { uuidv7 } from "../engine/session/uuid.js";
|
|
7
7
|
import { retiredCheckpointStoreNull } from "../core/checkpoint-store.js";
|
|
8
|
+
import { catalogModel } from "../core/roles.js";
|
|
8
9
|
import { thrownText } from "../core/thrown-value.js";
|
|
9
10
|
export class WorkflowModelNotAllowedError extends Error {
|
|
10
11
|
modelName;
|
|
@@ -98,7 +99,7 @@ export function resolveModelName(name, allowlist, models) {
|
|
|
98
99
|
if (!allowlist.includes(name)) {
|
|
99
100
|
throw new WorkflowModelNotAllowedError(name, `not in the workflow model allowlist [${allowlist.join(", ")}]`);
|
|
100
101
|
}
|
|
101
|
-
const model =
|
|
102
|
+
const model = catalogModel(name, models, "workflowModelAllowlist");
|
|
102
103
|
if (!model) {
|
|
103
104
|
throw new WorkflowModelNotAllowedError(name, "allowed by name but not present in RunnerDeps.models");
|
|
104
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WorkflowRunStore, WorkflowRunSummary } from "../core/workflow-run-store.js";
|
|
2
|
-
import type { WorkflowEvent, WorkflowItemStatus, WorkflowRun, WorkflowRunStatus } from "./workflow.js";
|
|
2
|
+
import type { WorkflowEvent, WorkflowItemStatus, WorkflowParkDelivery, WorkflowParkedResume, WorkflowRun, WorkflowRunStatus } from "./workflow.js";
|
|
3
3
|
/** design/97 S1c: mark a run RUNNING (called by `runWorkflow` before it emits `run_start`).
|
|
4
4
|
* B-3 (BREAKING): carries the run's SCOPE — {@link subscribeWorkflow} gates on it. */
|
|
5
5
|
export declare function markWorkflowActive(runId: string, scope: string): void;
|
|
@@ -8,6 +8,22 @@ export declare function markWorkflowActive(runId: string, scope: string): void;
|
|
|
8
8
|
* close the second's event stream (and best-effort-swallow its store writes). Synchronous, race-free with
|
|
9
9
|
* markWorkflowActive/closeWorkflowChannel (same tick). */
|
|
10
10
|
export declare function isWorkflowRunActive(runId: string): boolean;
|
|
11
|
+
/** #2561: register a running run's park-decision delivery (called by `startWorkflow`; cleared by {@link closeWorkflowChannel}). */
|
|
12
|
+
export declare function registerWorkflowParkDelivery(runId: string, deliver: (decisions: ReadonlyArray<WorkflowParkedResume>) => Promise<WorkflowParkDelivery>): void;
|
|
13
|
+
/**
|
|
14
|
+
* #2561 — hand decisions for a workflow run's PARKED legs to that run while it is still running in this process: the
|
|
15
|
+
* one redemption reading of a parked workflow leg, whichever lane holds the park. A run that is live here takes each
|
|
16
|
+
* decision whose token names a park it is waiting on and drives the parked child on the same record — the call the
|
|
17
|
+
* script is awaiting continues with the child's result, nothing is replayed, no second run is started (the fork guard
|
|
18
|
+
* on `resumeFromRunId` of an active run stays). Every other case answers what the host does instead: `not_active`
|
|
19
|
+
* (no run of that id and scope is running here — the run has ended, or runs in another process: resume it with the
|
|
20
|
+
* decisions once it has ended, `RunWorkflowOptions.parkedResume` + `resumeFromRunId`), `suspending` (the run has
|
|
21
|
+
* suspended on its parks and is ending; `ended` settles at its end — resume it then), `not_armed` (the run holds no
|
|
22
|
+
* checkpoint store to prove a park against). SCOPED like {@link subscribeWorkflow}: a run under another scope answers
|
|
23
|
+
* `not_active`. TRUSTED: decisions are the host's (a person's approval), never a script's or a model's. Each entry is
|
|
24
|
+
* read once; an entry whose `token` is not a non-empty string is refused loudly (`config.invalid_argument`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function redeemWorkflowParks(runId: string, scope: string, decisions: ReadonlyArray<WorkflowParkedResume>): Promise<WorkflowParkDelivery>;
|
|
11
27
|
/**
|
|
12
28
|
* design/97 S1c: fan one {@link WorkflowEvent} to every live subscriber of `runId`. Called by `runWorkflow`
|
|
13
29
|
* for EVERY emitted event. BEST-EFFORT — a `push` never throws (the {@link PushQueue} just buffers), and a
|
|
@@ -7,6 +7,25 @@ export function markWorkflowActive(runId, scope) {
|
|
|
7
7
|
export function isWorkflowRunActive(runId) {
|
|
8
8
|
return activeRuns.has(runId);
|
|
9
9
|
}
|
|
10
|
+
const parkDeliveries = new Map();
|
|
11
|
+
export function registerWorkflowParkDelivery(runId, deliver) {
|
|
12
|
+
parkDeliveries.set(runId, deliver);
|
|
13
|
+
}
|
|
14
|
+
export async function redeemWorkflowParks(runId, scope, decisions) {
|
|
15
|
+
if (!Array.isArray(decisions))
|
|
16
|
+
throw Object.assign(new TypeError("redeemWorkflowParks: decisions must be an array of { token, outcome?, inheritedGate? }"), { code: "config.invalid_argument" });
|
|
17
|
+
const read = decisions.map((entry, at) => {
|
|
18
|
+
const e = entry !== null && typeof entry === "object" ? entry : undefined;
|
|
19
|
+
const token = e?.token, outcome = e?.outcome, inheritedGate = e?.inheritedGate;
|
|
20
|
+
if (typeof token !== "string" || token === "")
|
|
21
|
+
throw Object.assign(new TypeError(`redeemWorkflowParks: decision ${at} names no checkpoint token`), { code: "config.invalid_argument" });
|
|
22
|
+
return { token, ...(outcome !== undefined ? { outcome } : {}), ...(inheritedGate !== undefined ? { inheritedGate } : {}) };
|
|
23
|
+
});
|
|
24
|
+
const deliver = activeRuns.get(runId) === scope ? parkDeliveries.get(runId) : undefined;
|
|
25
|
+
if (deliver === undefined)
|
|
26
|
+
return { kind: "not_active" };
|
|
27
|
+
return deliver(read);
|
|
28
|
+
}
|
|
10
29
|
export function publishWorkflowEvent(runId, event) {
|
|
11
30
|
const subs = channels.get(runId);
|
|
12
31
|
if (!subs)
|
|
@@ -16,6 +35,7 @@ export function publishWorkflowEvent(runId, event) {
|
|
|
16
35
|
}
|
|
17
36
|
export function closeWorkflowChannel(runId) {
|
|
18
37
|
activeRuns.delete(runId);
|
|
38
|
+
parkDeliveries.delete(runId);
|
|
19
39
|
const subs = channels.get(runId);
|
|
20
40
|
if (!subs)
|
|
21
41
|
return;
|
|
@@ -633,13 +633,16 @@ export declare function parkedAgentsOf<A extends Pick<WorkflowAgentRun, "status"
|
|
|
633
633
|
*/
|
|
634
634
|
export declare function runParkedOf(run: Pick<WorkflowRun, "status" | "agents">): boolean;
|
|
635
635
|
/**
|
|
636
|
-
* #642 —
|
|
637
|
-
* under the host's forwarded `durableApproval` (the workflow lane's park family, the background
|
|
638
|
-
* twin)
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
* (
|
|
636
|
+
* #642 / #2561 — the answer of `ctx.agent` / `ctx.agentStream().result()` for a call whose child durably PAUSED at
|
|
637
|
+
* an approval gate under the host's forwarded `durableApproval` (the workflow lane's park family, the background
|
|
638
|
+
* delegation's twin), once the RUN SUSPENDS on it. The wa* row records `status:"parked"` + `parkedCheckpointToken`
|
|
639
|
+
* and the journal records the parked leg at its ordinal the moment the child pauses; the call itself waits — a
|
|
640
|
+
* decision delivered to the live run ({@link import("./workflow-observe.js").redeemWorkflowParks}) drives the child
|
|
641
|
+
* on and the call returns its result instead. The run suspends when every call it still has unanswered is a parked
|
|
642
|
+
* one (nothing but a person can move the script), or when it is cancelled: each waiting call is answered with this
|
|
643
|
+
* error, every later spawn is refused with it, and the run's terminal is the park whatever the script body returns.
|
|
644
|
+
* Nothing after the parked call runs; the script must not retry it (an identical call parks again). A resume of the
|
|
645
|
+
* suspended run (`resumeFromRunId`) with the host's decision for the token drives the parked child on and the script
|
|
643
646
|
* continues from here; without a decision the ordinal re-parks.
|
|
644
647
|
*
|
|
645
648
|
* Carries the non-secret `checkpointId` (display/correlation) and the gate kind — never the token (the resume
|
|
@@ -652,6 +655,28 @@ export declare class WorkflowAgentParkedError extends Error {
|
|
|
652
655
|
readonly code = "workflow.agent_parked";
|
|
653
656
|
constructor(label: string, gateKind: string, checkpointId?: string | undefined);
|
|
654
657
|
}
|
|
658
|
+
/** #2561 — what a live run did with one delivered decision ({@link import("./workflow-observe.js").redeemWorkflowParks}),
|
|
659
|
+
* by the decision's position: `driving` (the parked child is driven on with it, the call continues), `settled` (its
|
|
660
|
+
* checkpoint is no longer pending — the call returns failed, `workflow.park_not_pending`), `kept_parked` (pending,
|
|
661
|
+
* but the entry carries no outcome — an acknowledgement never authorizes a drive), `already_taken` (a decision for
|
|
662
|
+
* this token was accepted earlier in this run), `not_parked_here` (no park of this run waits on the token),
|
|
663
|
+
* `unreadable` (the checkpoint store's word could not be read — the park stands). */
|
|
664
|
+
export type WorkflowParkDeliveryResult = "driving" | "settled" | "kept_parked" | "already_taken" | "not_parked_here" | "unreadable";
|
|
665
|
+
/** #2561 — the answer to a delivery: `live` (the run is running here and took the decisions, per-decision
|
|
666
|
+
* `results`); `suspending` (the run has suspended on its parks and is ending — `ended` settles at its end, after
|
|
667
|
+
* which the host resumes it with the decisions); `not_active` (no run of that id and scope is running in this
|
|
668
|
+
* process); `not_armed` (the run holds no checkpoint store to prove a park against). */
|
|
669
|
+
export type WorkflowParkDelivery = {
|
|
670
|
+
kind: "live";
|
|
671
|
+
results: WorkflowParkDeliveryResult[];
|
|
672
|
+
} | {
|
|
673
|
+
kind: "suspending";
|
|
674
|
+
ended: Promise<void>;
|
|
675
|
+
} | {
|
|
676
|
+
kind: "not_active";
|
|
677
|
+
} | {
|
|
678
|
+
kind: "not_armed";
|
|
679
|
+
};
|
|
655
680
|
/** design/98 §D.6 hard cap: thrown by `ctx.agent` once the workflow has spawned `max` agents (a runaway
|
|
656
681
|
* LLM-authored script is bounded, not trusted — this counts cumulative spawns, so it binds even when the
|
|
657
682
|
* token budget has room left, or when no budget was set at all). */
|
|
@@ -582,6 +582,10 @@ export interface RunWorkflowOptions {
|
|
|
582
582
|
autoModeReview?: {
|
|
583
583
|
decider: import("../core/auto-mode.js").AutoModeDecider;
|
|
584
584
|
};
|
|
585
|
+
/** The host leg's agent stations: each script-spawned child raises `agent.spawn` on the host's bus (as a workflow
|
|
586
|
+
* agent) before it starts — the delegation lane raises it at its own pre-launch point. ABSENT ⇒ nothing is raised.
|
|
587
|
+
* TRUSTED: never a script/model argument. */
|
|
588
|
+
agentStations?: import("../core/mods/agent-stations.js").AgentStations;
|
|
585
589
|
/** F7/B7 (CC pretty.js:446478): PRE-REGISTER the script's `meta.phases` as pending progress groups at run
|
|
586
590
|
* start — the plan is visible before execution; `phase(title)` adopts the matching pending entry. */
|
|
587
591
|
phases?: ReadonlyArray<{
|