@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
|
@@ -29,6 +29,8 @@ export function registerMonitorLane(core, input) {
|
|
|
29
29
|
env: input.env,
|
|
30
30
|
shellId: input.shellId,
|
|
31
31
|
spool: { stdout: "", stderr: "", rolledChars: 0 },
|
|
32
|
+
...(input.outputFile !== undefined ? { outputFile: input.outputFile } : {}),
|
|
33
|
+
...(input.taskArtifacts !== undefined ? { taskArtifacts: input.taskArtifacts } : {}),
|
|
32
34
|
lineBuf: "",
|
|
33
35
|
seq: 0,
|
|
34
36
|
stormTokens: stormBurst,
|
|
@@ -116,6 +118,18 @@ export function absorbMonitorPollLane(handle, v) {
|
|
|
116
118
|
handle.lineBuf = parts.pop() ?? "";
|
|
117
119
|
return parts.filter((l) => l !== "");
|
|
118
120
|
}
|
|
121
|
+
export async function mirrorMonitorPollLane(handle, v) {
|
|
122
|
+
if (handle.outputFile === undefined || (v.stdout.length === 0 && v.stderr.length === 0))
|
|
123
|
+
return;
|
|
124
|
+
try {
|
|
125
|
+
const ap = await handle.env.appendFile(handle.outputFile, v.stdout + v.stderr);
|
|
126
|
+
if (!ap.ok)
|
|
127
|
+
handle.spool.mirrorFailed = true;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
handle.spool.mirrorFailed = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
119
133
|
function consumeStormToken(handle, now) {
|
|
120
134
|
const gained = Math.floor((now - handle.stormRefilledAt) / handle.stormRefillIntervalMs);
|
|
121
135
|
if (gained > 0) {
|
|
@@ -165,6 +179,7 @@ export function startMonitorWatcherLane(core, id) {
|
|
|
165
179
|
...(handle.toolUseId !== undefined ? { toolUseId: handle.toolUseId } : {}),
|
|
166
180
|
status,
|
|
167
181
|
...(status === "killed" && handle.stoppedBy !== undefined ? { stoppedBy: handle.stoppedBy } : {}),
|
|
182
|
+
...(handle.outputFile !== undefined ? { output_file: handle.outputFile } : {}),
|
|
168
183
|
summary: `${terminalTaskSummary("monitor", (handle.description ?? "monitor").slice(0, 200), status, exitCode)} — ${detail}${droppedGapNote(handle.spool)}`,
|
|
169
184
|
...(finalLines.length > 0 ? { lines: finalLines.map(clipMonitorLine), result: clipMonitorEvent(finalLines.map(clipMonitorLine).join("\n")), ...(status === "killed" ? { partial: true } : {}) } : {}),
|
|
170
185
|
...(handle.completionId !== undefined ? { completionId: handle.completionId } : {}),
|
|
@@ -190,6 +205,12 @@ export function startMonitorWatcherLane(core, id) {
|
|
|
190
205
|
return terminal("failed", `monitor lost its process (${r.error.message}); watch ended.${pendingSuppressionNote()}`, pendingFinalLines([]));
|
|
191
206
|
}
|
|
192
207
|
pollFailures = 0;
|
|
208
|
+
const mirrored = mirrorMonitorPollLane(handle, r.value);
|
|
209
|
+
handle.mirrorInFlight = mirrored;
|
|
210
|
+
await mirrored;
|
|
211
|
+
handle.mirrorInFlight = undefined;
|
|
212
|
+
if (core.handles.get(id) !== handle || handle.status !== "running")
|
|
213
|
+
return stop();
|
|
193
214
|
const spool = handle.spool;
|
|
194
215
|
const lines = absorbMonitorPollLane(handle, r.value);
|
|
195
216
|
handle.status = statusFromBackground(r.value.status, r.value.exitCode);
|
|
@@ -367,6 +388,7 @@ function explicitStopTerminalNote(handle, alreadyGone) {
|
|
|
367
388
|
...(handle.toolUseId !== undefined ? { toolUseId: handle.toolUseId } : {}),
|
|
368
389
|
status: "killed",
|
|
369
390
|
...(handle.stoppedBy !== undefined ? { stoppedBy: handle.stoppedBy } : {}),
|
|
391
|
+
...(handle.outputFile !== undefined ? { output_file: handle.outputFile } : {}),
|
|
370
392
|
summary: `${terminalTaskSummary("monitor", label, "killed")} — ${detail}${droppedGapNote(handle.spool)}`,
|
|
371
393
|
...(handle.completionId !== undefined ? { completionId: handle.completionId } : {}),
|
|
372
394
|
});
|
|
@@ -377,11 +399,13 @@ export async function stopMonitorLane(core, handle) {
|
|
|
377
399
|
handle.timers.clearInterval(handle.watcher);
|
|
378
400
|
handle.watcher = undefined;
|
|
379
401
|
}
|
|
402
|
+
let finalIncrement;
|
|
380
403
|
if (wasRunning && handle.tickInFlight !== true) {
|
|
381
404
|
try {
|
|
382
405
|
const drained = await handle.env.pollBackground(handle.shellId);
|
|
383
406
|
if (drained.ok) {
|
|
384
407
|
const lines = absorbMonitorPollLane(handle, drained.value);
|
|
408
|
+
finalIncrement = drained.value;
|
|
385
409
|
const finalLines = handle.lineBuf !== "" ? [...lines, handle.lineBuf] : lines;
|
|
386
410
|
handle.lineBuf = "";
|
|
387
411
|
if (finalLines.length > 0 && handle.status === "running") {
|
|
@@ -407,9 +431,12 @@ export async function stopMonitorLane(core, handle) {
|
|
|
407
431
|
handle.spool.drainFailed = true;
|
|
408
432
|
}
|
|
409
433
|
}
|
|
410
|
-
const drainNote = handle.spool.drainFailed === true ? " (the final output drain failed —
|
|
434
|
+
const drainNote = handle.spool.drainFailed === true ? " (the final output drain failed — the output file may be missing the last window)" : "";
|
|
411
435
|
core.markStopSource(handle.id, "parent");
|
|
412
436
|
const r = await handle.env.killBackground(handle.shellId);
|
|
437
|
+
await handle.mirrorInFlight;
|
|
438
|
+
if (finalIncrement !== undefined)
|
|
439
|
+
await mirrorMonitorPollLane(handle, finalIncrement);
|
|
413
440
|
if (handle.status !== "running") {
|
|
414
441
|
return {
|
|
415
442
|
content: wasRunning ? `Terminated ${handle.id}.${drainNote}${consumePendingSuppressionNote(handle)}` : alreadyTerminalStopNote(handle.id, handle.status),
|
|
@@ -4,7 +4,7 @@ import { type WorkflowRunStore } from "./workflow-run-store.js";
|
|
|
4
4
|
import type { BackgroundAgentRecord, BackgroundAgentStore } from "./background-agent-store.js";
|
|
5
5
|
import type { WorkflowHandle, WorkflowRun } from "../orchestration/workflow.js";
|
|
6
6
|
import type { TaskNotificationPayload } from "./task-notification.js";
|
|
7
|
-
import type { ToolResultStore } from "./tool-result-store.js";
|
|
7
|
+
import type { TaskArtifactSeat, ToolResultStore } from "./tool-result-store.js";
|
|
8
8
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
9
9
|
export type SemaTaskType = "background_bash" | "workflow" | "background_agent" | "monitor";
|
|
10
10
|
/** design/134 §3.3 (R3): WHO initiated a kill — recorded at the initiation site (first-marker-wins),
|
|
@@ -107,10 +107,18 @@ export interface SemaTaskHandle {
|
|
|
107
107
|
createdAt: number;
|
|
108
108
|
updatedAt: number;
|
|
109
109
|
outputFile?: string;
|
|
110
|
+
/** The ref a background agent's or workflow's full result was stored under when its completion frame cut it
|
|
111
|
+
* (`persistTaskArtifact`, recorded by {@link import("./task-registry.js").TaskRegistry.recordArtifactRef}). */
|
|
112
|
+
artifactRef?: string;
|
|
110
113
|
/** P1-3 — see {@link UnifiedTaskOutput.completionId}. Minted fill-once at this task's own settle
|
|
111
114
|
* point ({@link mintCompletionId}); absent until the task reaches a terminal status. */
|
|
112
115
|
completionId?: string;
|
|
113
116
|
}
|
|
117
|
+
/** THE read handle of one background task, as every model-facing list of tasks names it: a command's output file
|
|
118
|
+
* (Read it), or the ref a cut result is stored under (ReadToolResult). `undefined` = nothing to read beyond what its
|
|
119
|
+
* notification carried. One reading — the post-compaction table and a dropped-notification line both call it. A
|
|
120
|
+
* blank path or ref (empty or all whitespace) names nothing, so it reads as no handle. */
|
|
121
|
+
export declare function taskReadHandleText(h: Pick<SemaTaskHandle, "outputFile" | "artifactRef">): string | undefined;
|
|
114
122
|
/** Mint a cross-channel completion correlation id ONCE per
|
|
115
123
|
* handle/record, fill-once (first writer wins): every settle/direct-terminal-flip site calls this
|
|
116
124
|
* instead of writing `completionId` directly, so no matter how many terminal-transition sites a lane
|
|
@@ -178,6 +186,9 @@ export interface BackgroundBashTaskHandle extends SemaTaskHandle {
|
|
|
178
186
|
droppedBytes?: number;
|
|
179
187
|
dropUnknown?: true;
|
|
180
188
|
};
|
|
189
|
+
/** Where the command's retained output is stored when its output file is missing or incomplete — the result-artifact
|
|
190
|
+
* seat the launching call carried (`ToolExecuteContext.taskArtifacts`); absent ⇒ nothing is stored. */
|
|
191
|
+
taskArtifacts?: TaskArtifactSeat;
|
|
181
192
|
watcher?: ReturnType<typeof setInterval>;
|
|
182
193
|
/** design/134 §3.3 (R3 MED, 修类不修点): same attribution pair as the agent handle — see there. */
|
|
183
194
|
stopSource?: StopSource;
|
|
@@ -260,7 +271,9 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
|
|
|
260
271
|
parentSessionId?: string;
|
|
261
272
|
rootSessionId?: string;
|
|
262
273
|
/** design/151 S1a — the child's store session id (transcript/resume anchor), bound once the child
|
|
263
|
-
* session is minted ({@link TaskRegistry.bindBackgroundAgentSession})
|
|
274
|
+
* session is minted ({@link TaskRegistry.bindBackgroundAgentSession}) and removed — together with the
|
|
275
|
+
* durable record's copy — by the successful release of that session
|
|
276
|
+
* ({@link TaskRegistry.releaseDurableTranscriptAnchor}). Read through `childSessionAnchorOf` only. */
|
|
264
277
|
sessionId?: string;
|
|
265
278
|
/** design/151 S1a — the durable write lane (present iff the registration wired a store). */
|
|
266
279
|
durable?: DurableAgentLane;
|
|
@@ -437,7 +450,17 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
|
|
|
437
450
|
drainFailed?: true;
|
|
438
451
|
timedOut?: boolean;
|
|
439
452
|
timeoutSec?: number;
|
|
453
|
+
mirrorFailed?: true;
|
|
440
454
|
};
|
|
455
|
+
/** See {@link BackgroundBashTaskHandle.taskArtifacts} — the same seat, for the watch's retained output. */
|
|
456
|
+
taskArtifacts?: TaskArtifactSeat;
|
|
457
|
+
/** The watch's output file (`createBackgroundOutputFile`, the bash lane's mint): every polled increment, stdout AND
|
|
458
|
+
* stderr, is appended to it — the full record the launch receipt and the terminal frame name, and the one place stderr
|
|
459
|
+
* is read from. Absent = the file could not be created. A failed append is accounted on `spool.mirrorFailed`. */
|
|
460
|
+
outputFile?: string;
|
|
461
|
+
/** The watcher tick's append to {@link outputFile} while it is in flight — a TaskStop that skips its own drain (the tick
|
|
462
|
+
* holds the env cursor) awaits it after the kill, so the terminal frame names a file that holds the tick's bytes. */
|
|
463
|
+
mirrorInFlight?: Promise<void>;
|
|
441
464
|
/** Partial (newline-less) stdout tail awaiting completion — a line becomes an event only once terminated. */
|
|
442
465
|
lineBuf: string;
|
|
443
466
|
/** Per-batch monotonic counter → unique notification dedup keys (see task-notification.ts). */
|
|
@@ -554,6 +577,10 @@ export interface RegisterMonitorInput extends TaskAccess {
|
|
|
554
577
|
/** design/158 S2 (RB-364 半) — the offload store a rolled-off spool middle spills to (see
|
|
555
578
|
* {@link MonitorTaskHandle.toolResultStore}). Absent ⇒ legal degrade, byte-identical rolling. */
|
|
556
579
|
toolResultStore?: ToolResultStore;
|
|
580
|
+
/** The watch's output file (see {@link MonitorTaskHandle.outputFile}); absent when it could not be created. */
|
|
581
|
+
outputFile?: string;
|
|
582
|
+
/** See {@link MonitorTaskHandle.taskArtifacts}. */
|
|
583
|
+
taskArtifacts?: TaskArtifactSeat;
|
|
557
584
|
}
|
|
558
585
|
export interface RegisterWorkflowInput extends TaskAccess {
|
|
559
586
|
runId: string;
|
|
@@ -810,7 +837,15 @@ export declare function assertOwnership(input: TaskAccess, site: string): void;
|
|
|
810
837
|
* (design/136 §2.3 S-1 定谳 posture, now positive-match on every arm). Exported: the run-workflow
|
|
811
838
|
* tool's resume-ownership recheck and a deployment's serving layer apply the SAME predicate. */
|
|
812
839
|
export declare function canAccessWorkflowRun(run: Pick<WorkflowRun, "scope" | "sourceTaskId" | "originatingSessionId">, access: TaskAccess): boolean;
|
|
813
|
-
|
|
840
|
+
/** How much of a run {@link formatWorkflowRun} keeps: the poll reply is display-bounded; the stored record (read back by
|
|
841
|
+
* `ReadToolResult`, which pages) keeps every agent row and every finished agent's output. One projection, two bounds. */
|
|
842
|
+
export interface WorkflowRecordBounds {
|
|
843
|
+
readonly rows: number;
|
|
844
|
+
readonly partialResults: number;
|
|
845
|
+
}
|
|
846
|
+
/** The stored record's bounds: none. */
|
|
847
|
+
export declare const WORKFLOW_RECORD_WHOLE: WorkflowRecordBounds;
|
|
848
|
+
export declare function formatWorkflowRun(run: WorkflowRun, bounds?: WorkflowRecordBounds): UnifiedTaskResult;
|
|
814
849
|
/** design/157 B13 一期定稿(二期细察补充 §「私有成员解法」)——the kernel-面 seam the MON/WF lane free
|
|
815
850
|
* functions call through instead of `this`: exactly the 5 members `startMonitorWatcher`/`stopMonitor`/
|
|
816
851
|
* `registerMonitor`/`registerWorkflow` actually reach into (`this.*` 耦合 grep 逐方法统计,见 B13 档).
|
|
@@ -989,6 +1024,11 @@ export interface RegisterBackgroundAgentInput extends TaskAccess {
|
|
|
989
1024
|
* force at WAKE time; only a spawn that carried a Model OBJECT records that object's id. Same
|
|
990
1025
|
* value and same rule as the roster row's `model` column. */
|
|
991
1026
|
model?: string;
|
|
1027
|
+
/** The tighten-only floor the child is born under — the clamp table's projection of its spawn spec — written onto the
|
|
1028
|
+
* durable row ({@link import("./background-agent-store.js").BackgroundAgentRecord.policyFloor}); `{}` when nothing is
|
|
1029
|
+
* clamped. A row registered without one states no floor and is never revived. A seeded (revival) registration ignores it:
|
|
1030
|
+
* the claimed row keeps the floor it was born with. */
|
|
1031
|
+
policyFloor?: import("./child-clamp-seats.js").ClampValues;
|
|
992
1032
|
toolUseId?: string;
|
|
993
1033
|
abort: AbortController;
|
|
994
1034
|
now?: number;
|
|
@@ -4,6 +4,18 @@ import { delimitUntrusted } from "./untrusted-text.js";
|
|
|
4
4
|
import { boundedRedactedSummary } from "./untrusted-egress.js";
|
|
5
5
|
import { clipWithFilePointer, OUTPUT_BUDGET_MIN_CHARS } from "./tool-errors.js";
|
|
6
6
|
import { resolveEnvBudget } from "./env-budget.js";
|
|
7
|
+
export function taskReadHandleText(h) {
|
|
8
|
+
const file = namedHandle(h.outputFile);
|
|
9
|
+
if (file !== undefined)
|
|
10
|
+
return `output: Read ${file}`;
|
|
11
|
+
const ref = namedHandle(h.artifactRef);
|
|
12
|
+
if (ref !== undefined)
|
|
13
|
+
return `result: ReadToolResult (ref "${ref}")`;
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
function namedHandle(value) {
|
|
17
|
+
return value !== undefined && value.trim() !== "" ? value : undefined;
|
|
18
|
+
}
|
|
7
19
|
export function mintCompletionId(target) {
|
|
8
20
|
if (target.completionId === undefined)
|
|
9
21
|
target.completionId = uuidv7();
|
|
@@ -137,7 +149,7 @@ export function firstDropNote(spool) {
|
|
|
137
149
|
return note;
|
|
138
150
|
}
|
|
139
151
|
export function alreadyTerminalStopNote(id, status) {
|
|
140
|
-
return `${id} already ${status} — nothing to stop;
|
|
152
|
+
return `${id} already ${status} — nothing to stop; its completion notification carries its final state.`;
|
|
141
153
|
}
|
|
142
154
|
export function assertOwnership(input, site) {
|
|
143
155
|
if (input.owner === undefined || input.scope === undefined) {
|
|
@@ -155,6 +167,8 @@ export function canAccessWorkflowRun(run, access) {
|
|
|
155
167
|
}
|
|
156
168
|
const WORKFLOW_PARTIAL_RESULTS_MAX = 5;
|
|
157
169
|
const WORKFLOW_AGENT_ROWS_MAX = 60;
|
|
170
|
+
const WORKFLOW_POLL_BOUNDS = Object.freeze({ rows: WORKFLOW_AGENT_ROWS_MAX, partialResults: WORKFLOW_PARTIAL_RESULTS_MAX });
|
|
171
|
+
export const WORKFLOW_RECORD_WHOLE = Object.freeze({ rows: Number.POSITIVE_INFINITY, partialResults: Number.POSITIVE_INFINITY });
|
|
158
172
|
function workflowAgentRow(a, ordinal) {
|
|
159
173
|
return {
|
|
160
174
|
ordinal,
|
|
@@ -195,16 +209,16 @@ function timeoutInterruptionNote(interruption) {
|
|
|
195
209
|
` Raising the timeout only helps if that approval gets answered.`
|
|
196
210
|
: ""));
|
|
197
211
|
}
|
|
198
|
-
export function formatWorkflowRun(run) {
|
|
212
|
+
export function formatWorkflowRun(run, bounds = WORKFLOW_POLL_BOUNDS) {
|
|
199
213
|
const summary = summarizeWorkflowRun(run);
|
|
200
214
|
const done = run.agents.filter((a) => a.status === "completed" || a.status === "failed").length;
|
|
201
215
|
const failed = run.agents.filter((a) => a.status === "failed").length;
|
|
202
216
|
const allRows = run.agents.map((a, i) => ({ a, i }));
|
|
203
|
-
const overCap = allRows.length >
|
|
217
|
+
const overCap = allRows.length > bounds.rows;
|
|
204
218
|
const keptRows = overCap
|
|
205
219
|
? (() => {
|
|
206
220
|
const urgent = allRows.filter((r) => r.a.status !== "completed");
|
|
207
|
-
const budget = Math.max(0,
|
|
221
|
+
const budget = Math.max(0, bounds.rows - urgent.length);
|
|
208
222
|
const fill = allRows.filter((r) => r.a.status === "completed").slice(0, budget);
|
|
209
223
|
return [...urgent, ...fill].sort((x, y) => x.i - y.i);
|
|
210
224
|
})()
|
|
@@ -245,12 +259,12 @@ export function formatWorkflowRun(run) {
|
|
|
245
259
|
: {}),
|
|
246
260
|
...(finishedAgents.length > 0
|
|
247
261
|
? {
|
|
248
|
-
partial_results: finishedAgents.slice(0,
|
|
262
|
+
partial_results: finishedAgents.slice(0, bounds.partialResults).map((a) => ({
|
|
249
263
|
agent: a.label,
|
|
250
264
|
output: delimitUntrusted(`workflow agent ${a.label} output`, a.output),
|
|
251
265
|
})),
|
|
252
|
-
...(finishedAgents.length >
|
|
253
|
-
? { partial_results_note: `showing ${
|
|
266
|
+
...(finishedAgents.length > bounds.partialResults
|
|
267
|
+
? { partial_results_note: `showing ${bounds.partialResults} of ${finishedAgents.length} completed agent outputs; the full set remains retrievable from the workflow run record (getWorkflowRun / the workflow journal).` }
|
|
254
268
|
: {}),
|
|
255
269
|
}
|
|
256
270
|
: {}),
|
|
@@ -122,7 +122,7 @@ export async function stopWorkflowLane(handle) {
|
|
|
122
122
|
type: "workflow",
|
|
123
123
|
status: handle.status,
|
|
124
124
|
stopped: false,
|
|
125
|
-
note: `workflow already ${handle.status} — nothing to stop;
|
|
125
|
+
note: `workflow already ${handle.status} — nothing to stop; its completion notification carries its final state.`,
|
|
126
126
|
}),
|
|
127
127
|
details: { task_id: handle.id, type: "workflow", status: handle.status, retrieval_status: "success" },
|
|
128
128
|
};
|
|
@@ -5,7 +5,7 @@ import type { BoundaryLegsGiven } from "./cross-boundary-taint.js";
|
|
|
5
5
|
import type { WorkflowRunStore } from "./workflow-run-store.js";
|
|
6
6
|
import { type BackgroundAgentStore } from "./background-agent-store.js";
|
|
7
7
|
import type { TaskNotificationPayload } from "./task-notification.js";
|
|
8
|
-
import type
|
|
8
|
+
import { type TaskArtifactSeat, type ToolResultStore } from "./tool-result-store.js";
|
|
9
9
|
import { type SemaTaskType, type StopSource, type SemaTaskStatus, type TaskRetrievalStatus, type UnifiedTaskOutput, type UnifiedTaskResult, type SemaTaskHandle, type TaskAccess, type BackgroundAgentTaskHandle, type MonitorTimers, type RegisterMonitorInput, type RegisterWorkflowInput, canAccessWorkflowRun, clipTaskOutput, MONITOR_BATCH_WINDOW_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, MONITOR_MAX_BATCHES_PER_MINUTE } from "./task-registry-shared.js";
|
|
10
10
|
export { normalizeAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, engineAgentName, chosenAgentName } from "./task-registry-shared.js";
|
|
11
11
|
export type { ParkedClaimTicket, RegisterBackgroundAgentInput } from "./task-registry-shared.js";
|
|
@@ -48,6 +48,8 @@ export interface RegisterBackgroundBashInput extends TaskAccess {
|
|
|
48
48
|
* STATES the lane: a later run teardown does not re-judge the row. Absent = the launcher does not know the
|
|
49
49
|
* lane; the owning run's teardown supplies it. */
|
|
50
50
|
retainBackgroundProcesses?: boolean;
|
|
51
|
+
/** See {@link BackgroundBashTaskHandle.taskArtifacts}. */
|
|
52
|
+
taskArtifacts?: TaskArtifactSeat;
|
|
51
53
|
}
|
|
52
54
|
/** One row's receipt from {@link TaskRegistry.killAllBackgroundShellsNow} (closed `outcome` set; `retained`
|
|
53
55
|
* present when the row was retained, whatever the outcome). */
|
|
@@ -72,10 +74,6 @@ export interface TaskPollOptions {
|
|
|
72
74
|
timeoutMs?: number;
|
|
73
75
|
/** Abort signal — a blocked wait must stop when the tool call is cancelled. */
|
|
74
76
|
signal?: AbortSignal;
|
|
75
|
-
/** Mirrors {@link import("./types.js").TaskSpec.oneShot} (see {@link TaskToolOptions.oneShot}
|
|
76
|
-
* for the full contract): forwarded to the background_agent lane's still-running poll body so it
|
|
77
|
-
* does not teach "you will be notified" when this run has no later turn to receive one. */
|
|
78
|
-
oneShot?: boolean;
|
|
79
77
|
/** design/158 S1 (RB-205-B 半): the offload store a CLIPPED background_agent result's full text
|
|
80
78
|
* spills to — the disclosure gains a `ReadToolResult` ref instead of the middle staying gone for
|
|
81
79
|
* good (see {@link import("./task-registry-agent.js").spillClippedAgentResult}). Absent (a
|
|
@@ -110,15 +108,6 @@ export interface TaskToolOptions extends TaskAccess {
|
|
|
110
108
|
* `taskNotification` (B17 方案查出的既有假广告). Default true (a direct public-API consumer keeps the
|
|
111
109
|
* historical wording); prepare-task passes the real wiring state. */
|
|
112
110
|
notificationWired?: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Mirrors {@link import("./types.js").TaskSpec.oneShot}: this run has no later turn for an
|
|
115
|
-
* async background notification to land in (a headless `-p` process exits once the turn ends).
|
|
116
|
-
* Threaded into the background_agent lane's non-blocking/blocked-timeout "still running" poll body
|
|
117
|
-
* (see {@link import("./task-registry-agent.js").pollBackgroundAgentLane}), which otherwise taught
|
|
118
|
-
* "you will be notified when it completes" — the same failure form `run_workflow`'s launch note was
|
|
119
|
-
* fixed for (RB-215/run-workflow-tool.ts). Default undefined ⇒ byte-compat (pre-RB-220 wording).
|
|
120
|
-
*/
|
|
121
|
-
oneShot?: boolean;
|
|
122
111
|
/** design/158 S1 (RB-205-B 半): the offload store a CLIPPED background_agent result's full text
|
|
123
112
|
* spills to — see {@link TaskPollOptions.toolResultStore} (forwarded verbatim into `pollTask`).
|
|
124
113
|
* Absent ⇒ legal degrade, byte-identical to pre-S1 output. */
|
|
@@ -127,6 +116,33 @@ export interface TaskToolOptions extends TaskAccess {
|
|
|
127
116
|
* `pollTask`). The first-party mount passes the same seat the Agent tool parks children into. */
|
|
128
117
|
checkpointSeat?: CheckpointSeat;
|
|
129
118
|
}
|
|
119
|
+
/** One row of {@link TaskRegistry.list} (and {@link TaskRegistry.liveTasks}): the DISPLAY projection of a task
|
|
120
|
+
* the caller reaches — never the internal handle. One name for the list, the live reading and the walk behind both. */
|
|
121
|
+
export interface TaskListRow {
|
|
122
|
+
task_id: string;
|
|
123
|
+
type: SemaTaskType;
|
|
124
|
+
status: SemaTaskStatus;
|
|
125
|
+
/** design/129 lifetime flag, surfaced for observability — on resume-leg deployments the
|
|
126
|
+
* canonical taskId==sessionId, so task- and session-scoped rows share an owner KEY VALUE and only this
|
|
127
|
+
* explicit flag tells them apart. Bulk attribution should use {@link TaskRegistry.markStopSourceForOwner}, not a
|
|
128
|
+
* list()-driven loop (the 500-row cap). */
|
|
129
|
+
sessionScoped: boolean;
|
|
130
|
+
/** Present on a shell-lane row (`background_bash` / `monitor`) that THE retain predicate keeps alive
|
|
131
|
+
* past the automatic reaps — the "keeps running" half of an exit listing: the controlled-exit reap and
|
|
132
|
+
* the hard face under `includeRetained: false` leave it running; every other running shell row stops. */
|
|
133
|
+
retained?: true;
|
|
134
|
+
description?: string;
|
|
135
|
+
toolUseId?: string;
|
|
136
|
+
/** The child session a `background_agent` row is anchored to — absent in the startup window before the
|
|
137
|
+
* bind (right after registration, once the child's session id is fixed), present from the bind until a
|
|
138
|
+
* successful release of that session (a terminal row keeps it until that release or the terminal GC),
|
|
139
|
+
* absent on every other task type. Present means "the registry has not released the anchor", not "the
|
|
140
|
+
* session store still holds the session" — the session store answers that. Only this process's
|
|
141
|
+
* handles are listed: a row known only to the durable store of another process is not here. */
|
|
142
|
+
sessionId?: string;
|
|
143
|
+
createdAt: number;
|
|
144
|
+
updatedAt: number;
|
|
145
|
+
}
|
|
130
146
|
/**
|
|
131
147
|
* RB-49 B-3 (2026-07-25): the row-metadata projection `getAccessibleTask` returns. Was spelled out as a
|
|
132
148
|
* hand-written literal in THREE places (this signature, the internal cast below, and the SendMessage
|
|
@@ -225,7 +241,9 @@ export declare class TaskRegistry {
|
|
|
225
241
|
skippedNoSessions: number;
|
|
226
242
|
orphanPlacedReleased: number;
|
|
227
243
|
}>;
|
|
228
|
-
|
|
244
|
+
/** The successful release of child session `sessionId` ends row `id`'s anchor on it — handle and durable
|
|
245
|
+
* record together, and only while the row still names that session (see {@link releaseDurableTranscriptAnchorLane}). */
|
|
246
|
+
releaseDurableTranscriptAnchor(id: string, sessionId: string): void;
|
|
229
247
|
bindBackgroundAgentSession(id: string, sessionId: string): void;
|
|
230
248
|
registerBackgroundAgent(input: RegisterBackgroundAgentInput): string;
|
|
231
249
|
/** #22 — persist this leg's org-memory admission verdict on the durable row (the cross-process
|
|
@@ -400,8 +418,10 @@ export declare class TaskRegistry {
|
|
|
400
418
|
private durableHeartbeatTimer;
|
|
401
419
|
mintTaskId(type: SemaTaskType): string;
|
|
402
420
|
registerBackgroundBash(input: RegisterBackgroundBashInput): string;
|
|
421
|
+
/** {@link commandRecordSink} over this registry's rows, ref book and guarded send. */
|
|
422
|
+
private commandRecordSink;
|
|
403
423
|
/** Background output-file read exemption: true iff `canonicalPath` is EXACTLY the registered output
|
|
404
|
-
* file of a background bash row that (a) the caller can access (same owner/scope/session visibility as
|
|
424
|
+
* file of a background bash or monitor row that (a) the caller can access (same owner/scope/session visibility as
|
|
405
425
|
* a TaskOutput poll — {@link canAccess}) and (b) was registered on the caller's OWN execution env —
|
|
406
426
|
* `env` identity is part of the match, same discipline as {@link runningShellIds}. A canonical path only names a file within ONE env's filesystem
|
|
407
427
|
* namespace: on a shared registry, a row minted on env A must never exempt a same-named outside-root
|
|
@@ -471,6 +491,18 @@ export declare class TaskRegistry {
|
|
|
471
491
|
* every registered task kind, workflow included, carries it the same way. Undefined until the task's
|
|
472
492
|
* own settle point has run ({@link mintCompletionId}), or for an id this registry never held. */
|
|
473
493
|
getCompletionId(id: string): string | undefined;
|
|
494
|
+
/** Record the ref a task's cut result was stored under (`persistTaskArtifact` landed it) — the read handle a
|
|
495
|
+
* later list of tasks names for it. `cycle` = the revive cycle the result belongs to (0 = the spawn cycle; a workflow
|
|
496
|
+
* has only 0): a row revived since (its cycle moved on) or already gone (terminal GC) records nothing. */
|
|
497
|
+
recordArtifactRef(id: string, ref: string, cycle: number): void;
|
|
498
|
+
/** The legs a page-back of `ref` travels (ReadToolResult's per-call reading): a ref holding a background task's result —
|
|
499
|
+
* its origin is part of the ref ({@link taskArtifactOriginOf}), so no row eviction, restart or other store forgets it —
|
|
500
|
+
* travels what a poll of that task travels ({@link boundaryLegsOf}, `"output"` — another tree's agent, a workflow run, a
|
|
501
|
+
* row gone or out of reach are off-target reads); any other ref (offloaded tool output) stays inside the engine. */
|
|
502
|
+
artifactBoundaryLegs(ref: string, access: TaskAccess, tree: object): BoundaryLegsGiven;
|
|
503
|
+
/** The read handle ({@link taskReadHandleText}) of a task `access` reaches — `undefined` for an unknown or unreachable
|
|
504
|
+
* id (the same info-hiding a poll gives) and for a task with nothing to read beyond its notification. */
|
|
505
|
+
readHandleOf(id: string, access: TaskAccess): string | undefined;
|
|
474
506
|
/** Bulk stop-source attribution for one owner — the registry-side primitive that
|
|
475
507
|
* replaces the service's `list()+markStopSource` per-row loop, which had TWO holes: ① `list()` didn't
|
|
476
508
|
* expose `sessionScoped`, so on the resume leg (canonical taskId==sessionId, rebuilt taskConfig without
|
|
@@ -662,28 +694,11 @@ export declare class TaskRegistry {
|
|
|
662
694
|
*/
|
|
663
695
|
list(access: TaskAccess, opts?: {
|
|
664
696
|
limit?: number;
|
|
665
|
-
}):
|
|
666
|
-
task_id: string;
|
|
667
|
-
type: SemaTaskType;
|
|
668
|
-
status: SemaTaskStatus;
|
|
669
|
-
/** design/129 lifetime flag, surfaced for observability — on resume-leg deployments the
|
|
670
|
-
* canonical taskId==sessionId, so task- and session-scoped rows share an owner KEY VALUE and only this
|
|
671
|
-
* explicit flag tells them apart. Bulk attribution should use {@link markStopSourceForOwner}, not a
|
|
672
|
-
* list()-driven loop (the 500-row cap). */
|
|
673
|
-
sessionScoped: boolean;
|
|
674
|
-
/** Present on a shell-lane row (`background_bash` / `monitor`) that THE retain predicate keeps alive
|
|
675
|
-
* past the automatic reaps — the "keeps running" half of an exit listing: the controlled-exit reap and
|
|
676
|
-
* the hard face under `includeRetained: false` leave it running; every other running shell row stops. */
|
|
677
|
-
retained?: true;
|
|
678
|
-
description?: string;
|
|
679
|
-
toolUseId?: string;
|
|
680
|
-
createdAt: number;
|
|
681
|
-
updatedAt: number;
|
|
682
|
-
}>;
|
|
697
|
+
}): TaskListRow[];
|
|
683
698
|
/** The tasks `access` reaches that have not finished (`pending`, `running` or `parked`), newest first — EVERY one, with no display
|
|
684
699
|
* cap ({@link list}'s): the one reading of a leg's live background tasks (its end's {@link owedDeliveries}, the post-compaction
|
|
685
700
|
* listing and the resume's orphan diff, the suspend's snapshot), each consumer projecting its own columns from it. */
|
|
686
|
-
liveTasks(access: TaskAccess):
|
|
701
|
+
liveTasks(access: TaskAccess): TaskListRow[];
|
|
687
702
|
/** Every row `access` reaches, newest first, in {@link list}'s projection — the one walk both readings take. */
|
|
688
703
|
private rowsUnder;
|
|
689
704
|
/** Throttled {@link gc} for hot-path callers (design/115 review B5): prepare-task runs once per task,
|