@sema-agent/core 7.60.0 → 7.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +605 -0
- package/README.md +2 -2
- package/dist/agents/agent-transcript-tool.d.ts +2 -2
- package/dist/agents/agent-transcript-tool.js +1 -1
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/inherited-tool-pool.d.ts +5 -3
- package/dist/agents/inherited-tool-pool.js +2 -2
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.js +3 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +7 -4
- package/dist/agents/send-message-tool.d.ts +8 -10
- package/dist/agents/send-message-tool.js +43 -23
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +30 -40
- package/dist/agents/subagent.js +187 -196
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +59 -23
- package/dist/core/allow-entry.js +131 -38
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode.js +3 -5
- package/dist/core/background-agent-store.d.ts +7 -5
- package/dist/core/background-agent-store.js +12 -11
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +78 -19
- package/dist/core/checkpoint-store.js +8 -4
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/context-settings.js +3 -5
- package/dist/core/cross-boundary-taint.d.ts +1 -1
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +49 -18
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +10 -0
- package/dist/core/frame-settlement.js +6 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +2 -1
- package/dist/core/gate-lanes.js +7 -4
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +12 -4
- package/dist/core/governance-codes.js +16 -4
- package/dist/core/hooks.d.ts +12 -4
- package/dist/core/hooks.js +11 -4
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +48 -8
- package/dist/core/image-admission.js +35 -4
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +2 -1
- package/dist/core/locked-config.js +5 -3
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +76 -15
- package/dist/core/mcp-failure.js +60 -33
- package/dist/core/mcp-host-seat.d.ts +92 -53
- package/dist/core/mcp-host-seat.js +220 -46
- package/dist/core/mcp-probe.js +2 -2
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +6 -49
- package/dist/core/mcp.js +115 -111
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/sync-client.d.ts +39 -18
- package/dist/core/memory-engine/sync-client.js +72 -14
- package/dist/core/memory-engine/sync-report.d.ts +7 -4
- package/dist/core/memory-engine/sync.d.ts +9 -1
- package/dist/core/mode-policy.d.ts +8 -8
- package/dist/core/mode-policy.js +7 -5
- package/dist/core/mods/agent-stations.d.ts +39 -4
- package/dist/core/mods/agent-stations.js +59 -10
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +4 -3
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +4 -1
- package/dist/core/mods/kernel/events.js +6 -6
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +38 -16
- package/dist/core/mods/stations.js +25 -11
- package/dist/core/mods/tool-call.d.ts +2 -0
- package/dist/core/mods/tool-call.js +4 -4
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +61 -2
- package/dist/core/own-property-receipt.js +42 -2
- package/dist/core/park-selfcheck.js +4 -2
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +3 -3
- package/dist/core/peer-seat.js +20 -8
- package/dist/core/permission-rule-consent.d.ts +21 -5
- package/dist/core/permission-rule-consent.js +21 -1
- package/dist/core/permission-rule-model.d.ts +34 -11
- package/dist/core/permission-rule-model.js +47 -10
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/remote-env.d.ts +74 -26
- package/dist/core/remote-env.js +20 -0
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retired-keys.d.ts +4 -4
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -3
- package/dist/core/runner/assemble-result.js +12 -7
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +2 -2
- package/dist/core/runner/contracts.d.ts +98 -26
- package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/git-status-frame.d.ts +3 -3
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +28 -9
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +4 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -0
- package/dist/core/runner/prepare-config-doors.js +16 -17
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -9
- package/dist/core/runner/prepare-delegation-surface.js +4 -5
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +19 -14
- package/dist/core/runner/prepare-gate-stations.js +6 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -5
- package/dist/core/runner/prepare-hands-readface.js +4 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -0
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +5 -2
- package/dist/core/runner/prepare-park-ask.js +4 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
- package/dist/core/runner/prepare-policy-chain.js +16 -25
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
- package/dist/core/runner/prepare-prompt-inputs.js +3 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -7
- package/dist/core/runner/prepare-suspend-saga.js +17 -7
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +56 -28
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -1
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +10 -6
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +2 -2
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +14 -5
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +40 -29
- package/dist/core/runner/run-notification-lane.js +20 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +9 -7
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +27 -14
- package/dist/core/runner/runtask.d.ts +18 -3
- package/dist/core/runner/runtask.js +27 -11
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -2
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +1 -1
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +24 -25
- package/dist/core/secret-env.d.ts +11 -11
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +1 -1
- package/dist/core/session-policy-store.js +5 -2
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +2 -0
- package/dist/core/session-store.js +5 -7
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
- package/dist/core/task-event.d.ts +17 -8
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +89 -12
- package/dist/core/task-notification.js +87 -13
- package/dist/core/task-registry-agent.d.ts +5 -43
- package/dist/core/task-registry-agent.js +24 -51
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-monitor.js +15 -60
- package/dist/core/task-registry-shared.d.ts +15 -112
- package/dist/core/task-registry-shared.js +3 -41
- package/dist/core/task-registry-workflow.js +4 -21
- package/dist/core/task-registry.d.ts +19 -60
- package/dist/core/task-registry.js +19 -106
- package/dist/core/task-result.d.ts +24 -7
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +10 -10
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +2 -5
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.js +3 -2
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +5 -29
- package/dist/core/tool-name-aliases.js +9 -5
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +108 -18
- package/dist/core/tool-policy.js +84 -14
- package/dist/core/tool-result-store.d.ts +23 -0
- package/dist/core/tool-result-store.js +3 -2
- package/dist/core/tool-spec.d.ts +19 -6
- package/dist/core/trace.d.ts +18 -1
- package/dist/core/user-attachment.js +26 -21
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +34 -9
- package/dist/engine/execution-env/node-execution-env.js +213 -21
- package/dist/engine/harness/agent-harness.d.ts +65 -18
- package/dist/engine/harness/agent-harness.js +90 -23
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +41 -7
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +6 -1
- package/dist/engine/loop/agent-loop.js +20 -11
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +21 -11
- package/dist/index.js +15 -7
- package/dist/internal/harness-types.d.ts +2 -0
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +11 -17
- package/dist/orchestration/run-workflow-tool.js +19 -42
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +8 -5
- package/dist/stores/file/background-agent-store.js +18 -15
- package/dist/stores/file/checkpoint-store.js +7 -4
- package/dist/stores/file/file-history-store.js +3 -2
- package/dist/stores/file/index.d.ts +5 -3
- package/dist/stores/file/index.js +23 -8
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.js +42 -22
- package/dist/stores/file/memory-store.js +3 -2
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.js +3 -2
- package/dist/stores/file/session-store.d.ts +16 -3
- package/dist/stores/file/session-store.js +21 -20
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/tool-result-store.js +57 -3
- package/dist/stores/file/usage-window-store.js +3 -2
- package/dist/stores/file/workflow-journal-store.d.ts +0 -2
- package/dist/stores/file/workflow-journal-store.js +3 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
- package/dist/tools/fs/fs-bash-background-text.js +6 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -18
- package/dist/tools/fs/fs-bash.js +37 -124
- package/dist/tools/fs/fs-pdf.js +8 -6
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-shared.d.ts +28 -3
- package/dist/tools/fs/fs-shared.js +15 -0
- package/dist/tools/fs/index.d.ts +1 -1
- package/dist/tools/fs/index.js +4 -14
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +13 -5
- package/dist/tools/fs/read-floor.js +206 -2
- package/dist/tools/fs/search.d.ts +3 -2
- package/dist/tools/fs/search.js +6 -6
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +8 -7
- package/dist/tools/monitor.js +12 -10
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +92 -10
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
|
@@ -4,7 +4,7 @@ import { egressText } from "./untrusted-egress.js";
|
|
|
4
4
|
import { PEER_MESSAGE_NOTICE } from "../agents/peer-admission.js";
|
|
5
5
|
import { buildCrossSessionEnvelope, CROSS_PRINCIPAL_MESSAGE_NOTICE, CROSS_SESSION_MESSAGE_NOTICE, neutralizePeerBody } from "../agents/cross-session-envelope.js";
|
|
6
6
|
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(["completed", "failed", "killed", "cancelled"]);
|
|
7
|
-
export const NOTIFICATION_INJECTION_OUTCOMES = Object.freeze(["queued", "parked", "parked_durably", "dropped_duplicate"]);
|
|
7
|
+
export const NOTIFICATION_INJECTION_OUTCOMES = Object.freeze(["queued", "parked", "parked_durably", "dropped_duplicate", "refused"]);
|
|
8
8
|
export function isNotificationInjectionOutcome(value) {
|
|
9
9
|
return typeof value === "string" && NOTIFICATION_INJECTION_OUTCOMES.includes(value);
|
|
10
10
|
}
|
|
@@ -95,6 +95,8 @@ export function renderCrossSessionNoticeLine(notice) {
|
|
|
95
95
|
}
|
|
96
96
|
export const RESUPPLIED_FRAME_PREAMBLE = "[Re-supplied] You were shown this message once before; the compaction that replaced older context with a summary did not keep it, so the engine is handing it over again. It is the SAME message, not a new one \u2014 act on it once.";
|
|
97
97
|
export function renderTaskNotificationXml(n) {
|
|
98
|
+
if (n.received !== undefined)
|
|
99
|
+
return n.received.text;
|
|
98
100
|
const body = renderTaskNotificationCarrier(n);
|
|
99
101
|
return n.resupplied === true ? `${RESUPPLIED_FRAME_PREAMBLE}\n\n${body}` : body;
|
|
100
102
|
}
|
|
@@ -183,22 +185,30 @@ function cutReportReading(artifact) {
|
|
|
183
185
|
case "stored":
|
|
184
186
|
return `read the full text with ReadToolResult (ref "${artifact.ref}")`;
|
|
185
187
|
case "unconfirmed":
|
|
186
|
-
return "the full text could not be stored (the write failed or went unconfirmed), so no ref can read it back — ask the agent for it via SendMessage
|
|
188
|
+
return "the full text could not be stored (the write failed or went unconfirmed), so no ref can read it back and it is not readable in this session — ask the agent for it via SendMessage";
|
|
187
189
|
case "no_store":
|
|
188
|
-
return "the full text is not stored behind a ref (no offload store) — ask the agent for it via SendMessage
|
|
190
|
+
return "the full text is not stored behind a ref (no offload store), so it is not readable in this session — ask the agent for it via SendMessage";
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
|
-
export
|
|
193
|
+
export const SHORT_REPORT_UNSTORED = "a background task's report could not be stored (the write failed or went unconfirmed): its completion frame carried the whole report, but its task row keeps no read handle for a later list";
|
|
194
|
+
export async function completionResultField(result, persist, record, notifier) {
|
|
192
195
|
if (!result)
|
|
193
196
|
return undefined;
|
|
194
197
|
const report = egressText("same-principal", result);
|
|
195
|
-
if (report.length <= COMPLETION_REPORT_MAX)
|
|
198
|
+
if (report.length <= COMPLETION_REPORT_MAX) {
|
|
199
|
+
void notifier.notifyAsync(async () => {
|
|
200
|
+
const artifact = await persist(report);
|
|
201
|
+
if (artifact.kind === "unconfirmed")
|
|
202
|
+
throw new Error(SHORT_REPORT_UNSTORED);
|
|
203
|
+
if (artifact.kind === "stored")
|
|
204
|
+
record(artifact.ref);
|
|
205
|
+
}, "completionResultField.shortReportWrite");
|
|
196
206
|
return { text: report };
|
|
207
|
+
}
|
|
197
208
|
const artifact = await persist(report);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
209
|
+
if (artifact.kind === "stored")
|
|
210
|
+
record(artifact.ref);
|
|
211
|
+
return { text: `${report.slice(0, COMPLETION_REPORT_MAX)}\n[result truncated: ${report.length} chars total — ${cutReportReading(artifact)}]` };
|
|
202
212
|
}
|
|
203
213
|
export const ENGINE_FRAME_CODEC_VERSION = 1;
|
|
204
214
|
export const ENGINE_FRAME_TASK_TYPES = Object.freeze(["background_agent", "monitor", "workflow"]);
|
|
@@ -293,6 +303,9 @@ export function isTerminalTaskNotification(n) {
|
|
|
293
303
|
export function resolveCompletionSink(callSink, mountSink) {
|
|
294
304
|
return callSink ?? mountSink;
|
|
295
305
|
}
|
|
306
|
+
export function admitsBackgroundLaunch(sink, deploymentChannel = false) {
|
|
307
|
+
return sink !== undefined || deploymentChannel;
|
|
308
|
+
}
|
|
296
309
|
export class DeliveryObligations {
|
|
297
310
|
owed = new Map();
|
|
298
311
|
counted = new Set();
|
|
@@ -460,7 +473,63 @@ export class PendingSessionNotifications {
|
|
|
460
473
|
sessionBoxFor(sessionId) {
|
|
461
474
|
return this.sessionBoxes.get(sessionId);
|
|
462
475
|
}
|
|
463
|
-
|
|
476
|
+
settleBoxDebts(sessionId, signal) {
|
|
477
|
+
const owed = this.sessions.get(sessionId)?.boxDebts;
|
|
478
|
+
if (owed === undefined || owed.size === 0)
|
|
479
|
+
return undefined;
|
|
480
|
+
const debts = [...owed];
|
|
481
|
+
return (async () => {
|
|
482
|
+
for (const [copy, debt] of debts) {
|
|
483
|
+
if (signal?.aborted === true)
|
|
484
|
+
return;
|
|
485
|
+
await this.settleBoxDebt(sessionId, copy, debt);
|
|
486
|
+
}
|
|
487
|
+
})();
|
|
488
|
+
}
|
|
489
|
+
keepBackOwing(sessionId, s) {
|
|
490
|
+
const debts = s.boxDebts;
|
|
491
|
+
const owing = debts === undefined ? [] : s.items.filter((n) => debts.has(n));
|
|
492
|
+
if (owing.length === 0)
|
|
493
|
+
return s;
|
|
494
|
+
const tiers = new Map();
|
|
495
|
+
for (const n of owing) {
|
|
496
|
+
const p = s.priorities?.get(n);
|
|
497
|
+
if (p !== undefined)
|
|
498
|
+
tiers.set(n, p);
|
|
499
|
+
}
|
|
500
|
+
this.sessions.set(sessionId, { items: owing, dropped: new Map(), keys: new Set(owing.map((n) => taskNotificationDedupKey(n))), priorities: tiers, boxDebts: debts });
|
|
501
|
+
const rest = s.items.filter((n) => !debts.has(n));
|
|
502
|
+
return rest.length === 0 && s.dropped.size === 0 ? undefined : { ...s, items: rest };
|
|
503
|
+
}
|
|
504
|
+
async settleBoxDebt(sessionId, copy, debt) {
|
|
505
|
+
let answered = false;
|
|
506
|
+
try {
|
|
507
|
+
await debt.box.mailbox.append(debt.box.scope, debt.box.handle, debt.record);
|
|
508
|
+
answered = true;
|
|
509
|
+
}
|
|
510
|
+
catch (e) {
|
|
511
|
+
try {
|
|
512
|
+
debt.box.onError?.(e);
|
|
513
|
+
}
|
|
514
|
+
catch {
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const s = this.sessions.get(sessionId);
|
|
518
|
+
if (s?.boxDebts?.get(copy) !== debt)
|
|
519
|
+
return;
|
|
520
|
+
s.boxDebts.delete(copy);
|
|
521
|
+
const at = s.items.indexOf(copy);
|
|
522
|
+
if (!answered || at === -1)
|
|
523
|
+
return;
|
|
524
|
+
s.items.splice(at, 1);
|
|
525
|
+
const key = taskNotificationDedupKey(copy);
|
|
526
|
+
s.keys.delete(key);
|
|
527
|
+
s.priorities?.delete(copy);
|
|
528
|
+
this.noteDurablePark(sessionId, key);
|
|
529
|
+
if (s.items.length === 0 && s.dropped.size === 0)
|
|
530
|
+
this.sessions.delete(sessionId);
|
|
531
|
+
}
|
|
532
|
+
pend(sessionId, n, priority, debt) {
|
|
464
533
|
let s = this.sessions.get(sessionId);
|
|
465
534
|
if (s === undefined) {
|
|
466
535
|
if (this.sessions.size >= MAX_PENDING_SESSIONS) {
|
|
@@ -492,6 +561,8 @@ export class PendingSessionNotifications {
|
|
|
492
561
|
s.items.push(n);
|
|
493
562
|
if (priority !== undefined)
|
|
494
563
|
s.priorities?.set(n, priority);
|
|
564
|
+
if (debt !== undefined)
|
|
565
|
+
(s.boxDebts ??= new Map()).set(n, debt);
|
|
495
566
|
const lane = taskNotificationLaneKey(n);
|
|
496
567
|
let mine = 0;
|
|
497
568
|
for (const i of s.items)
|
|
@@ -504,9 +575,11 @@ export class PendingSessionNotifications {
|
|
|
504
575
|
}
|
|
505
576
|
drain(sessionId) {
|
|
506
577
|
this.routed.delete(sessionId);
|
|
507
|
-
const
|
|
508
|
-
if (
|
|
578
|
+
const parked = this.sessions.get(sessionId);
|
|
579
|
+
if (parked !== undefined)
|
|
509
580
|
this.sessions.delete(sessionId);
|
|
581
|
+
const s = parked !== undefined ? this.keepBackOwing(sessionId, parked) : undefined;
|
|
582
|
+
if (s !== undefined) {
|
|
510
583
|
const rank = (n) => {
|
|
511
584
|
const p = s.priorities?.get(n);
|
|
512
585
|
return p === "now" ? 0 : p === "next" ? 1 : 2;
|
|
@@ -630,7 +703,7 @@ export function routeOrParkNotification(store, sessionId, payload, priority, onD
|
|
|
630
703
|
});
|
|
631
704
|
const settled = appended.then(() => onDisposition?.("parked_durably"), () => {
|
|
632
705
|
store.forgetDurablePark(sessionId, dedupKey);
|
|
633
|
-
store.pend(sessionId, payload, priority);
|
|
706
|
+
store.pend(sessionId, payload, priority, { box, record });
|
|
634
707
|
onDisposition?.("parked");
|
|
635
708
|
});
|
|
636
709
|
DurableAppendObligations.current()?.track(settled);
|
|
@@ -668,6 +741,7 @@ function evictOldest(s, match) {
|
|
|
668
741
|
const victim = s.items.splice(idx, 1)[0];
|
|
669
742
|
s.keys.delete(taskNotificationDedupKey(victim));
|
|
670
743
|
s.priorities?.delete(victim);
|
|
744
|
+
s.boxDebts?.delete(victim);
|
|
671
745
|
const laneKey = taskNotificationLaneKey(victim);
|
|
672
746
|
const prior = s.dropped.get(laneKey);
|
|
673
747
|
s.dropped.set(laneKey, { count: (prior?.count ?? 0) + 1, taskType: victim.task_type, taskId: victim.task_id });
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type BackgroundAgentRecord, type BackgroundAgentStore } from "./background-agent-store.js";
|
|
2
2
|
import { type StopSource, type TaskAccess, type TaskRetrievalStatus, type UnifiedTaskOutput, type UnifiedTaskResult, type BackgroundAgentTaskHandle, type RegisteredTaskHandle, type DurableAgentCore, type ParkedClaimTicket, type RegisterBackgroundAgentInput } from "./task-registry-shared.js";
|
|
3
|
-
import { type ToolResultStore } from "./tool-result-store.js";
|
|
4
3
|
import { type AgentState } from "./agent-state.js";
|
|
5
4
|
import type { CheckpointSeat } from "./checkpoint-seat.js";
|
|
6
5
|
/**
|
|
@@ -447,7 +446,7 @@ export declare function deliverToRunningAgentLane(core: DurableAgentCore, id: st
|
|
|
447
446
|
disposition: "queued" | "parked" | "pending";
|
|
448
447
|
} | {
|
|
449
448
|
ok: false;
|
|
450
|
-
reason: "not_found" | "not_running" | "no_channel" | "queue_full";
|
|
449
|
+
reason: "not_found" | "not_running" | "no_channel" | "queue_full" | "refused";
|
|
451
450
|
}>;
|
|
452
451
|
/** CC `ugo`/`rxo` (206:575227-575243 = 220:467937-467951): `id (label)` rows for a not-found footer —
|
|
453
452
|
* running bg agents the CALLER can address (canAccess scopes; CC's self/observer exclusions have no
|
|
@@ -469,8 +468,8 @@ export declare function runningBackgroundAgentLabelsLane(core: DurableAgentCore,
|
|
|
469
468
|
* rows. CC filters `!n.has(i.id)` — a NAMED agent is deliberately NOT repeated here, because
|
|
470
469
|
* its addressable form is the name, not the id. The pre-RB-332 sema code merged both legs
|
|
471
470
|
* into one list and justified it with "named has no counterpart", a claim [c209-D] retired
|
|
472
|
-
* when the explicit `name` field landed. The id stays in these rows because
|
|
473
|
-
*
|
|
471
|
+
* when the explicit `name` field landed. The id stays in these rows because the task faces
|
|
472
|
+
* resolve exact ids: an agent nobody named is the one a retry can reach by its id alone.
|
|
474
473
|
* CC's `YEd` "Running teammates:" leg has no sema counterpart (no teammate registry on this face) and is
|
|
475
474
|
* honestly absent rather than faked.
|
|
476
475
|
*/
|
|
@@ -478,8 +477,8 @@ export declare function runningAgentFooterLane(core: DurableAgentCore, access: T
|
|
|
478
477
|
named: string[];
|
|
479
478
|
background: string[];
|
|
480
479
|
};
|
|
481
|
-
/** The not-found TAIL both task faces share (CC `rxo`, appended by `uMs` for TaskStop
|
|
482
|
-
*
|
|
480
|
+
/** The not-found TAIL both task faces share (CC `rxo`, appended by `uMs` for TaskStop;
|
|
481
|
+
* the host poll's not-found carries the same tail). Empty string when the caller has nothing running. */
|
|
483
482
|
export declare function notFoundRunningAgentsTail(footer: {
|
|
484
483
|
named: string[];
|
|
485
484
|
background: string[];
|
|
@@ -535,44 +534,7 @@ export declare function serveDurableAgentRowLane(row: BackgroundAgentRecord,
|
|
|
535
534
|
* {@link import("./agent-state.js").agentStateSourceOfRecord}(row)): rendered as the `state:` line and
|
|
536
535
|
* carried as `details.agentState`. Absent ⇒ neither appears (a serving layer that does not read it). */
|
|
537
536
|
agentState?: AgentState): UnifiedTaskResult;
|
|
538
|
-
/**
|
|
539
|
-
* design/158 S1 (RB-205-B 半) — spill the FULL text behind a CLIPPED background_agent result to the
|
|
540
|
-
* offload store, and append a ref-disclosure so the middle `clipTaskOutput` drops is not gone for good.
|
|
541
|
-
* `RegisterBackgroundAgentInput` deliberately carries no `outputFile` (ref-not-path is the design/158
|
|
542
|
-
* §2.4 divergence — TOC/TOB compatible, unlike a local path), so this is the only pageback this lane
|
|
543
|
-
* gets; it reuses the SAME vocabulary as the offload face (design/108: {@link OFFLOAD_TOOL_NAME},
|
|
544
|
-
* {@link buildToolResultRef} — RB-273's single mint point) instead of inventing a parallel one.
|
|
545
|
-
*
|
|
546
|
-
* Lazy: only writes on the FIRST poll whose clip actually cut something (`clipped !== full`) — a short
|
|
547
|
-
* result never touches the store, matching design/158 §2.1 ("spill is a fidelity layer, not a new
|
|
548
|
-
* source of truth"). Idempotent PER REVIVE CYCLE: the ref folds in `handle.reviveCycle` (a revive clears
|
|
549
|
-
* `handle.spillRef` — see {@link reviveBackgroundAgentLane} — but `handle.id` itself does NOT change
|
|
550
|
-
* across a revive, so without the cycle in the ref, cycle 2's spill would mint the SAME ref string as
|
|
551
|
-
* cycle 1's and the store's write-once contract would silently keep cycle 1's STALE text under a ref
|
|
552
|
-
* now disclosed as cycle 2's current result). Caching the minted ref on the handle (rather than just
|
|
553
|
-
* re-deriving+re-`put`ting every poll and trusting the store's own write-once no-op) keeps the disclosed
|
|
554
|
-
* ref byte-stable across polls and avoids a redundant round-trip to a durable backend on every poll.
|
|
555
|
-
*
|
|
556
|
-
* No store configured (a deployment that never wired a `toolResultStore`) ⇒ returns `clipped` UNCHANGED
|
|
557
|
-
* — the legal degrade design/158 §2.2 calls for, byte-identical to pre-S1 behavior.
|
|
558
|
-
*
|
|
559
|
-
* Backlog #169 — a FAILING `put` (throwing or rejecting; the store contract admits both dialects) is
|
|
560
|
-
* NOT fatal to the poll: the clipped text is still served, with {@link AGENT_SPILL_FAILED_NOTE} in
|
|
561
|
-
* place of the ref disclosure (advertising a ref nobody can read back would be a false promise), and
|
|
562
|
-
* `handle.spillFailed` latches so later polls of the same cycle repeat the honest note instead of
|
|
563
|
-
* retrying the write — see the catch below for why latch-not-retry. Same "store failure is never
|
|
564
|
-
* fatal" posture as the monitor/offload/budget/compaction write sites. A put that settles AFTER a
|
|
565
|
-
* revive (stale cycle) is generation-guarded: it answers its own caller honestly but never writes
|
|
566
|
-
* spill state onto the new cycle (see `mintCycle` below).
|
|
567
|
-
*/
|
|
568
|
-
export declare function spillClippedAgentResult(handle: BackgroundAgentTaskHandle, full: string, clipped: string, store: ToolResultStore | undefined, sessionId: string | undefined): Promise<string>;
|
|
569
537
|
export declare function pollBackgroundAgentLane(handle: BackgroundAgentTaskHandle, deadline?: number, signal?: AbortSignal,
|
|
570
|
-
/** design/158 S1 — the offload store a clipped result's full text spills to (see
|
|
571
|
-
* {@link spillClippedAgentResult}). Absent ⇒ legal degrade, byte-identical to pre-S1 output. */
|
|
572
|
-
store?: ToolResultStore,
|
|
573
|
-
/** design/158 S1 — the caller's session id, folded into the minted ref for global uniqueness (same
|
|
574
|
-
* role `sessionId` plays at every other {@link buildToolResultRef} call site). */
|
|
575
|
-
sessionId?: string,
|
|
576
538
|
/** The run's checkpoint seat — the store a parked row's approval card is read from
|
|
577
539
|
* ({@link import("./agent-state.js").readAgentState}). Absent ⇒ a parked row reads `approval unreadable`. */
|
|
578
540
|
checkpointSeat?: CheckpointSeat): Promise<UnifiedTaskResult>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { receiveRetentionPolicy } from "./retention-policy.js";
|
|
3
3
|
import { uuidv7 } from "../internal/harness.js";
|
|
4
|
-
import { canAccessAgentRecord, BackgroundAgentStoreError, clearRevivedRowTerminalPayload, REVIVED_ROW_CLEARED_FIELDS, STALE_RUNNING_REAP_ATTRIBUTION, } from "./background-agent-store.js";
|
|
4
|
+
import { BACKGROUND_AGENT_REAP_KNOBS, canAccessAgentRecord, BackgroundAgentStoreError, clearRevivedRowTerminalPayload, REVIVED_ROW_CLEARED_FIELDS, STALE_RUNNING_REAP_ATTRIBUTION, } from "./background-agent-store.js";
|
|
5
5
|
import { shutdownDebug } from "./shutdown-debug.js";
|
|
6
6
|
import { delimitUntrusted } from "./untrusted-text.js";
|
|
7
7
|
import { boundedRedactedSummary } from "./untrusted-egress.js";
|
|
8
|
-
import { mintCompletionId, commitCompletionIdIfEmpty, clipTaskOutput, assertOwnership, sleepPollStep, alreadyTerminalStopNote, canAccess, normalizeAgentName, engineAgentName, chosenAgentName,
|
|
9
|
-
import { buildToolResultRef, OFFLOAD_TOOL_NAME, toolResultProvenanceOf } from "./tool-result-store.js";
|
|
8
|
+
import { mintCompletionId, commitCompletionIdIfEmpty, clipTaskOutput, assertOwnership, sleepPollStep, alreadyTerminalStopNote, canAccess, normalizeAgentName, engineAgentName, chosenAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, } from "./task-registry-shared.js";
|
|
10
9
|
import { thrownLabel } from "./thrown-value.js";
|
|
10
|
+
import { closestName } from "./closest-name.js";
|
|
11
11
|
import { agentStateSourceOfHandle, agentStateSummary, readAgentState } from "./agent-state.js";
|
|
12
12
|
export function activeDelegationHandlesLane(core, scope, rootSessionId) {
|
|
13
13
|
const out = [];
|
|
@@ -183,24 +183,24 @@ export function endDurableClaimLane(core, id) {
|
|
|
183
183
|
core.claimingHandles.delete(id);
|
|
184
184
|
}
|
|
185
185
|
export async function reapDurableAgentsLane(core, scope, deps, policy) {
|
|
186
|
-
|
|
187
|
-
const now =
|
|
188
|
-
if (
|
|
189
|
-
await deps.store.reap(scope, now, { staleRunningMaxAgeMs:
|
|
186
|
+
const knobs = receiveRetentionPolicy("reapDurableAgents", policy, BACKGROUND_AGENT_REAP_KNOBS, ["now"]);
|
|
187
|
+
const now = knobs.now ?? Date.now();
|
|
188
|
+
if (knobs.staleRunningMaxAgeMs !== undefined) {
|
|
189
|
+
await deps.store.reap(scope, now, { staleRunningMaxAgeMs: knobs.staleRunningMaxAgeMs });
|
|
190
190
|
}
|
|
191
|
-
if (
|
|
191
|
+
if (knobs.maxAgeMs === undefined && knobs.keep === undefined)
|
|
192
192
|
return { rowsReaped: 0, sessionsReleased: 0, skippedNoSessions: 0, orphanPlacedReleased: 0 };
|
|
193
193
|
const terminal = (await deps.store.listByScope(scope)).filter((r) => r.status !== "running" && r.status !== "parked");
|
|
194
194
|
terminal.sort((a, b) => b.spawnedAt - a.spawnedAt);
|
|
195
195
|
const doomed = new Map();
|
|
196
|
-
if (
|
|
196
|
+
if (knobs.maxAgeMs !== undefined) {
|
|
197
197
|
for (const r of terminal) {
|
|
198
|
-
if ((r.settledAt ?? r.spawnedAt) < now -
|
|
198
|
+
if ((r.settledAt ?? r.spawnedAt) < now - knobs.maxAgeMs)
|
|
199
199
|
doomed.set(r.handle, r);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
if (
|
|
203
|
-
for (const r of terminal.slice(Math.max(0,
|
|
202
|
+
if (knobs.keep !== undefined) {
|
|
203
|
+
for (const r of terminal.slice(Math.max(0, knobs.keep)))
|
|
204
204
|
doomed.set(r.handle, r);
|
|
205
205
|
}
|
|
206
206
|
let rowsReaped = 0;
|
|
@@ -265,10 +265,10 @@ export async function reapDurableAgentsLane(core, scope, deps, policy) {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
let orphanPlacedReleased = 0;
|
|
268
|
-
if (
|
|
268
|
+
if (knobs.maxAgeMs !== undefined && deps.sessions !== undefined && typeof deps.sessions.listPlaced === "function") {
|
|
269
269
|
let placed = [];
|
|
270
270
|
try {
|
|
271
|
-
placed = await deps.sessions.listPlaced("subagent", { olderThanMs:
|
|
271
|
+
placed = await deps.sessions.listPlaced("subagent", { olderThanMs: knobs.maxAgeMs, scope });
|
|
272
272
|
}
|
|
273
273
|
catch {
|
|
274
274
|
placed = [];
|
|
@@ -1107,8 +1107,6 @@ export async function reviveBackgroundAgentLane(core, id, access, abort) {
|
|
|
1107
1107
|
handle.abort = abort;
|
|
1108
1108
|
handle.result = undefined;
|
|
1109
1109
|
handle.resultFull = undefined;
|
|
1110
|
-
handle.spillRef = undefined;
|
|
1111
|
-
handle.spillFailed = undefined;
|
|
1112
1110
|
handle.artifactRef = undefined;
|
|
1113
1111
|
handle.error = undefined;
|
|
1114
1112
|
handle.errorCode = undefined;
|
|
@@ -1261,6 +1259,9 @@ export async function deliverToRunningAgentLane(core, id, access, notification,
|
|
|
1261
1259
|
if (d === "parked" || d === "parked_durably") {
|
|
1262
1260
|
result = handle.retainedContinuation === true ? { ok: true, disposition: "parked" } : { ok: false, reason: "not_running" };
|
|
1263
1261
|
}
|
|
1262
|
+
else if (d === "refused") {
|
|
1263
|
+
result = { ok: false, reason: "refused" };
|
|
1264
|
+
}
|
|
1264
1265
|
else {
|
|
1265
1266
|
result = { ok: true, disposition: "queued" };
|
|
1266
1267
|
}
|
|
@@ -1323,7 +1324,7 @@ export function serveDurableAgentRowLane(row, agentState) {
|
|
|
1323
1324
|
const stateLine = agentState !== undefined ? `state: ${agentStateSummary(agentState)}\n` : "";
|
|
1324
1325
|
if (row.status === "parked") {
|
|
1325
1326
|
return {
|
|
1326
|
-
content: delimitUntrusted(`
|
|
1327
|
+
content: delimitUntrusted(`task ${row.handle}`, `status: parked
|
|
1327
1328
|
${stateLine}The agent is durably suspended, waiting for an approval decision. It resumes when the pending approval is decided (durable approval inbox), or lands failed if the approval expires.`),
|
|
1328
1329
|
details: buildAgentPollDetails({
|
|
1329
1330
|
taskId: row.handle,
|
|
@@ -1342,7 +1343,7 @@ ${stateLine}${row.error ? `error: ${row.error}${kindClause}
|
|
|
1342
1343
|
` : ""}${row.finalOutput ? `--- result${row.resultIsPartial ? " (partial — produced before the task was stopped)" : ""} ---
|
|
1343
1344
|
${clipTaskOutput(row.finalOutputFull ?? row.finalOutput)}` : "(no result text)"}`;
|
|
1344
1345
|
return {
|
|
1345
|
-
content: delimitUntrusted(`
|
|
1346
|
+
content: delimitUntrusted(`task ${row.handle}`, body),
|
|
1346
1347
|
details: buildAgentPollDetails({
|
|
1347
1348
|
taskId: row.handle,
|
|
1348
1349
|
status: row.status,
|
|
@@ -1360,35 +1361,7 @@ ${clipTaskOutput(row.finalOutputFull ?? row.finalOutput)}` : "(no result text)"}
|
|
|
1360
1361
|
...(row.status === "failed" ? { isError: true } : {}),
|
|
1361
1362
|
};
|
|
1362
1363
|
}
|
|
1363
|
-
|
|
1364
|
-
export async function spillClippedAgentResult(handle, full, clipped, store, sessionId) {
|
|
1365
|
-
if (clipped === full)
|
|
1366
|
-
return clipped;
|
|
1367
|
-
if (store === undefined)
|
|
1368
|
-
return clipped;
|
|
1369
|
-
const disclose = (ref) => `${clipped}\n\n[full output persisted — call ${OFFLOAD_TOOL_NAME} with ref "${ref}" to read it back.]`;
|
|
1370
|
-
if (handle.spillRef !== undefined)
|
|
1371
|
-
return disclose(handle.spillRef);
|
|
1372
|
-
if (handle.spillFailed === true)
|
|
1373
|
-
return `${clipped}${AGENT_SPILL_FAILED_NOTE}`;
|
|
1374
|
-
const mintCycle = handle.reviveCycle ?? 0;
|
|
1375
|
-
const ref = buildToolResultRef(sessionId ?? "no-session", handle.id, `c${mintCycle}`);
|
|
1376
|
-
try {
|
|
1377
|
-
await store.put(ref, full, sessionId === undefined ? undefined : toolResultProvenanceOf(sessionId));
|
|
1378
|
-
}
|
|
1379
|
-
catch {
|
|
1380
|
-
if ((handle.reviveCycle ?? 0) === mintCycle) {
|
|
1381
|
-
if (handle.spillRef !== undefined)
|
|
1382
|
-
return disclose(handle.spillRef);
|
|
1383
|
-
handle.spillFailed = true;
|
|
1384
|
-
}
|
|
1385
|
-
return `${clipped}${AGENT_SPILL_FAILED_NOTE}`;
|
|
1386
|
-
}
|
|
1387
|
-
if ((handle.reviveCycle ?? 0) === mintCycle)
|
|
1388
|
-
handle.spillRef = ref;
|
|
1389
|
-
return disclose(ref);
|
|
1390
|
-
}
|
|
1391
|
-
export async function pollBackgroundAgentLane(handle, deadline, signal, store, sessionId, checkpointSeat) {
|
|
1364
|
+
export async function pollBackgroundAgentLane(handle, deadline, signal, checkpointSeat) {
|
|
1392
1365
|
while (handle.status === "running" && deadline !== undefined && Date.now() < deadline && !signal?.aborted) {
|
|
1393
1366
|
await sleepPollStep(deadline, signal);
|
|
1394
1367
|
}
|
|
@@ -1399,7 +1372,7 @@ export async function pollBackgroundAgentLane(handle, deadline, signal, store, s
|
|
|
1399
1372
|
const parkedSeq = handle.cycleSeq;
|
|
1400
1373
|
const agentState = await readAgentState(parkedSource, checkpointSeat, Date.now());
|
|
1401
1374
|
return {
|
|
1402
|
-
content: delimitUntrusted(`
|
|
1375
|
+
content: delimitUntrusted(`task ${handle.id}`, `status: parked
|
|
1403
1376
|
state: ${agentStateSummary(agentState)}
|
|
1404
1377
|
The agent is durably suspended, waiting for an approval decision. It resumes when the pending approval is decided (durable approval inbox), or lands failed if the approval expires.`),
|
|
1405
1378
|
details: buildAgentPollDetails({
|
|
@@ -1428,7 +1401,7 @@ The agent is durably suspended, waiting for an approval decision. It resumes whe
|
|
|
1428
1401
|
const stateRead = readAgentState(agentStateSourceOfHandle({ status: snap.status, updatedAt: snap.updatedAt }), checkpointSeat, Date.now());
|
|
1429
1402
|
const agentState = stateRead instanceof Promise ? await stateRead : stateRead;
|
|
1430
1403
|
const fullResult = snap.result ? (handle.resultFull ?? snap.result) : undefined;
|
|
1431
|
-
const resultText = fullResult !== undefined ?
|
|
1404
|
+
const resultText = fullResult !== undefined ? clipTaskOutput(fullResult, handle.outputFile) : undefined;
|
|
1432
1405
|
const kindClause = snap.status === "failed" && snap.errorKind !== undefined && snap.errorRetryable !== undefined
|
|
1433
1406
|
? ` (error_kind: ${snap.errorKind}, retryable: ${snap.errorRetryable}${snap.errorRetryAfterMs !== undefined ? `, retry_after_ms: ${snap.errorRetryAfterMs}` : ""})`
|
|
1434
1407
|
: "";
|
|
@@ -1441,7 +1414,7 @@ ${stateLine}${snap.error ? `error: ${snap.error}${kindClause}
|
|
|
1441
1414
|
` : ""}${snap.result ? `--- result${snap.resultIsPartial ? " (partial — produced before the task was stopped)" : ""} ---
|
|
1442
1415
|
${resultText}` : "(no result text)"}`;
|
|
1443
1416
|
return {
|
|
1444
|
-
content: delimitUntrusted(`
|
|
1417
|
+
content: delimitUntrusted(`task ${handle.id}`, body),
|
|
1445
1418
|
details: buildAgentPollDetails({
|
|
1446
1419
|
taskId: handle.id,
|
|
1447
1420
|
status: snap.status,
|
|
@@ -26,7 +26,7 @@ export declare function emitMonitorEventLane(handle: MonitorTaskHandle, n: TaskN
|
|
|
26
26
|
* plus the three monitor-only exits: watcher-enforced timeout, event-storm auto-stop, and the
|
|
27
27
|
* line→batched-event emission path. All time reads go through the INJECTED clock (design/87). */
|
|
28
28
|
export declare function startMonitorWatcherLane(core: RegistryCore, id: string): void;
|
|
29
|
-
/** design/135 G2:
|
|
29
|
+
/** design/135 G2: the host poll over a monitor — a RE-READABLE spool snapshot (the watcher owns the env
|
|
30
30
|
* cursor, exactly the bash G2b spool posture): repeated polls return the same accumulated output. */
|
|
31
31
|
export declare function pollMonitorLane(handle: MonitorTaskHandle, filter: string | undefined, deadline?: number, signal?: AbortSignal): Promise<UnifiedTaskResult>;
|
|
32
32
|
export declare function stopMonitorLane(core: RegistryCore, handle: MonitorTaskHandle): Promise<UnifiedTaskResult>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { delimitUntrusted } from "./untrusted-text.js";
|
|
2
2
|
import { envDeclaresRetain, retainsBackgroundProcesses } from "./background-shell.js";
|
|
3
|
-
import { assertOwnership, defaultMonitorTimers, MONITOR_MAX_TIMEOUT_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_BATCH_WINDOW_MS, MONITOR_MAX_BATCHES_PER_MINUTE, MONITOR_STORM_BURST, MONITOR_STORM_KILL_AFTER_MS, MONITOR_LINE_BUF_CAP,
|
|
4
|
-
import { buildToolResultRef, OFFLOAD_TOOL_NAME, toolResultProvenanceOf } from "./tool-result-store.js";
|
|
3
|
+
import { assertOwnership, defaultMonitorTimers, MONITOR_MAX_TIMEOUT_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_BATCH_WINDOW_MS, MONITOR_MAX_BATCHES_PER_MINUTE, MONITOR_STORM_BURST, MONITOR_STORM_KILL_AFTER_MS, MONITOR_LINE_BUF_CAP, TASK_OUTPUT_MAX_CHARS, mintCompletionId, clipMonitorEvent, clipMonitorLine, terminalTaskSummary, accountDroppedBytes, renderSpoolBody, SPOOL_REPLAY, rollSpoolText, statusFromBackground, droppedGapNote, firstDropNote, alreadyTerminalStopNote, clipTaskOutput, sleepPollStep, } from "./task-registry-shared.js";
|
|
5
4
|
import { thrownText } from "./thrown-value.js";
|
|
6
5
|
export function registerMonitorLane(core, input) {
|
|
7
6
|
assertOwnership(input, "registerMonitor");
|
|
@@ -42,8 +41,6 @@ export function registerMonitorLane(core, input) {
|
|
|
42
41
|
...(timeoutMs !== undefined ? { timeoutMs, deadlineAt: timers.now() + timeoutMs } : {}),
|
|
43
42
|
timers,
|
|
44
43
|
...(input.onEvent !== undefined ? { onEvent: input.onEvent } : {}),
|
|
45
|
-
...(input.toolResultStore !== undefined ? { toolResultStore: input.toolResultStore } : {}),
|
|
46
|
-
...(input.sessionId !== undefined ? { spillSessionId: input.sessionId } : {}),
|
|
47
44
|
...(retainsBackgroundProcesses({ env: envDeclaresRetain(input.env), task: input.retainBackgroundProcesses === true }) ? { retained: true } : {}),
|
|
48
45
|
...(input.retainBackgroundProcesses !== undefined ? { retainStatedAtLaunch: true } : {}),
|
|
49
46
|
};
|
|
@@ -57,60 +54,12 @@ export function registerMonitorLane(core, input) {
|
|
|
57
54
|
}
|
|
58
55
|
return id;
|
|
59
56
|
}
|
|
60
|
-
function spillRolledMonitorChunk(handle, stream, dropped) {
|
|
61
|
-
const store = handle.toolResultStore;
|
|
62
|
-
if (store === undefined)
|
|
63
|
-
return;
|
|
64
|
-
const used = handle.spillCharsUsed ?? 0;
|
|
65
|
-
if (used >= MONITOR_SPILL_CAP_CHARS) {
|
|
66
|
-
handle.spillCapped = true;
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const n = stream === "out" ? (handle.spillSegCount ?? 0) : (handle.spillErrSegCount ?? 0);
|
|
70
|
-
const ref = buildToolResultRef(handle.spillSessionId ?? "no-session", handle.id, `${stream}_seg${n}`);
|
|
71
|
-
handle.spillCharsUsed = used + dropped.length;
|
|
72
|
-
if (stream === "out")
|
|
73
|
-
handle.spillSegCount = n + 1;
|
|
74
|
-
else
|
|
75
|
-
handle.spillErrSegCount = n + 1;
|
|
76
|
-
try {
|
|
77
|
-
const provenance = handle.spillSessionId === undefined ? undefined : toolResultProvenanceOf(handle.spillSessionId);
|
|
78
|
-
void Promise.resolve(store.put(ref, dropped, provenance)).catch(() => {
|
|
79
|
-
handle.spillFailed = true;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
handle.spillFailed = true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function monitorSpillNote(handle) {
|
|
87
|
-
const outN = handle.spillSegCount ?? 0;
|
|
88
|
-
const errN = handle.spillErrSegCount ?? 0;
|
|
89
|
-
if (outN === 0 && errN === 0)
|
|
90
|
-
return "";
|
|
91
|
-
const sid = handle.spillSessionId ?? "no-session";
|
|
92
|
-
const segLabel = (stream, n) => {
|
|
93
|
-
const first = buildToolResultRef(sid, handle.id, `${stream}_seg0`);
|
|
94
|
-
return n <= 1 ? `ref "${first}"` : `refs "${first}" .. "${buildToolResultRef(sid, handle.id, `${stream}_seg${n - 1}`)}"`;
|
|
95
|
-
};
|
|
96
|
-
const clauses = [];
|
|
97
|
-
if (outN > 0)
|
|
98
|
-
clauses.push(`stdout ${segLabel("out", outN)}`);
|
|
99
|
-
if (errN > 0)
|
|
100
|
-
clauses.push(`stderr ${segLabel("err", errN)}`);
|
|
101
|
-
const coverage = handle.spillFailed === true
|
|
102
|
-
? " — a write failed partway through; the ref chain may be INCOMPLETE, read what is there"
|
|
103
|
-
: handle.spillCapped === true
|
|
104
|
-
? ` — spill cap (${MONITOR_SPILL_CAP_CHARS} chars) reached; earlier segments retained, later rolls were not spilled`
|
|
105
|
-
: "";
|
|
106
|
-
return `; spilled to ${clauses.join(", ")} (read back via ${OFFLOAD_TOOL_NAME})${coverage}`;
|
|
107
|
-
}
|
|
108
57
|
export function absorbMonitorPollLane(handle, v) {
|
|
109
58
|
const spool = handle.spool;
|
|
110
59
|
accountDroppedBytes(spool, v);
|
|
111
60
|
const ROLL_CAP = 2 * TASK_OUTPUT_MAX_CHARS;
|
|
112
|
-
spool.stdout = rollSpoolText(spool, spool.stdout + v.stdout, ROLL_CAP
|
|
113
|
-
spool.stderr = rollSpoolText(spool, spool.stderr + v.stderr, ROLL_CAP
|
|
61
|
+
spool.stdout = rollSpoolText(spool, spool.stdout + v.stdout, ROLL_CAP);
|
|
62
|
+
spool.stderr = rollSpoolText(spool, spool.stderr + v.stderr, ROLL_CAP);
|
|
114
63
|
handle.lineBuf += v.stdout;
|
|
115
64
|
if (handle.lineBuf.length > MONITOR_LINE_BUF_CAP)
|
|
116
65
|
handle.lineBuf = handle.lineBuf.slice(-MONITOR_LINE_BUF_CAP);
|
|
@@ -275,7 +224,7 @@ export function startMonitorWatcherLane(core, id) {
|
|
|
275
224
|
handle.status = "killed";
|
|
276
225
|
handle.stoppedBy = handle.stopSource ?? "system";
|
|
277
226
|
return terminal("killed", `auto-stopped: too much output (${suppressed} event batch(es) suppressed over ${overloadSecs}s of sustained overload; sustained budget is ${handle.maxBatchesPerMinute} batches/minute). ` +
|
|
278
|
-
`The process was killed; its full output
|
|
227
|
+
`The process was killed; ${monitorOutputReading(handle, "its full output")}. Restart it with a quieter command (filter its output) if you still need the watch.`, pendingFinalLines(lines));
|
|
279
228
|
}
|
|
280
229
|
if ((handle.suppressedBatches ?? 0) > 0) {
|
|
281
230
|
const suppressed = handle.suppressedBatches;
|
|
@@ -290,7 +239,7 @@ export function startMonitorWatcherLane(core, id) {
|
|
|
290
239
|
...(handle.toolUseId !== undefined ? { toolUseId: handle.toolUseId } : {}),
|
|
291
240
|
status: "event",
|
|
292
241
|
seq: handle.seq,
|
|
293
|
-
summary: `${(handle.description ?? "monitor").slice(0, 200)} — ${suppressed} event batch(es) suppressed (output rate too high); the suppressed output
|
|
242
|
+
summary: `${(handle.description ?? "monitor").slice(0, 200)} — ${suppressed} event batch(es) suppressed (output rate too high); ${monitorOutputReading(handle, "the suppressed output")}`,
|
|
294
243
|
result: note,
|
|
295
244
|
});
|
|
296
245
|
}
|
|
@@ -331,7 +280,7 @@ export async function pollMonitorLane(handle, filter, deadline, signal) {
|
|
|
331
280
|
}
|
|
332
281
|
catch {
|
|
333
282
|
return {
|
|
334
|
-
content: `Error (
|
|
283
|
+
content: `Error (task poll): invalid filter regex: ${filter}`,
|
|
335
284
|
details: { task_id: handle.id, type: "monitor", status: handle.status, retrieval_status: "not_ready" },
|
|
336
285
|
isError: true,
|
|
337
286
|
};
|
|
@@ -348,11 +297,10 @@ export async function pollMonitorLane(handle, filter, deadline, signal) {
|
|
|
348
297
|
running,
|
|
349
298
|
handleStatus: handle.status,
|
|
350
299
|
shape,
|
|
351
|
-
rolledExtraClause: monitorSpillNote(handle),
|
|
352
300
|
drainNote: spool.drainFailed === true ? "[!] the final output drain at stop failed — the tail of the output may be missing\n" : "",
|
|
353
301
|
});
|
|
354
302
|
return {
|
|
355
|
-
content: delimitUntrusted(`
|
|
303
|
+
content: delimitUntrusted(`task ${handle.id}`, body),
|
|
356
304
|
details: {
|
|
357
305
|
task_id: handle.id,
|
|
358
306
|
type: "monitor",
|
|
@@ -375,7 +323,14 @@ function consumePendingSuppressionNote(handle) {
|
|
|
375
323
|
if (suppressed <= 0)
|
|
376
324
|
return "";
|
|
377
325
|
handle.suppressedBatches = 0;
|
|
378
|
-
return ` [${suppressed} event batch(es) suppressed before the watch ended — output rate was too high; the suppressed output
|
|
326
|
+
return ` [${suppressed} event batch(es) suppressed before the watch ended — output rate was too high; ${monitorOutputReading(handle, "the suppressed output")}.]`;
|
|
327
|
+
}
|
|
328
|
+
function monitorOutputReading(handle, what) {
|
|
329
|
+
if (handle.outputFile === undefined)
|
|
330
|
+
return `${what} was not kept (no output file could be created for this watch)`;
|
|
331
|
+
return handle.spool.mirrorFailed === true
|
|
332
|
+
? `${what} is only partly in its output file (${handle.outputFile} — an append failed, so it is not the whole output)`
|
|
333
|
+
: `${what} is in its output file (${handle.outputFile} — Read it)`;
|
|
379
334
|
}
|
|
380
335
|
function explicitStopTerminalNote(handle, alreadyGone) {
|
|
381
336
|
const label = (handle.description ?? "monitor").slice(0, 200);
|