@sema-agent/core 7.72.0 → 7.74.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 +565 -0
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +46 -2
- package/dist/agents/list-agents-tool.js +1 -1
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/retain-ledger.js +3 -3
- package/dist/agents/send-message-tool.js +5 -4
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +43 -12
- package/dist/agents/verify.js +23 -8
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.d.ts +42 -1
- package/dist/brain/anthropic.js +68 -13
- package/dist/brain/failover.d.ts +5 -0
- package/dist/brain/failover.js +51 -22
- package/dist/brain/model-lane.d.ts +12 -3
- package/dist/brain/model-lane.js +5 -5
- package/dist/brain/open-responses.js +7 -8
- package/dist/brain/openai.js +31 -24
- package/dist/brain/route-adjudicator.d.ts +33 -4
- package/dist/brain/route-adjudicator.js +49 -12
- package/dist/brain/stream-engine.js +166 -156
- package/dist/brain/stream-shared.d.ts +4 -3
- package/dist/brain/stream-shared.js +2 -2
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/allow-entry.js +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-headline.d.ts +1 -1
- package/dist/core/ask-origin.d.ts +44 -4
- package/dist/core/ask-origin.js +29 -10
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/background-agent-store.d.ts +1 -0
- package/dist/core/background-agent-store.js +49 -8
- package/dist/core/checkpoint-features.d.ts +3 -2
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +9 -3
- package/dist/core/checkpoint-store.d.ts +26 -2
- package/dist/core/checkpoint-store.js +9 -2
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/cron.js +9 -1
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/deployment-shape.d.ts +7 -0
- package/dist/core/deployment-shape.js +19 -0
- package/dist/core/engine-capabilities.d.ts +13 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +41 -28
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/gate-fold.js +5 -4
- package/dist/core/gate-lanes.js +8 -12
- package/dist/core/gate-outcome.d.ts +8 -2
- package/dist/core/gate-outcome.js +10 -3
- package/dist/core/governance-codes.d.ts +14 -2
- package/dist/core/governance-codes.js +22 -6
- package/dist/core/hook-condition.d.ts +37 -0
- package/dist/core/hook-condition.js +567 -0
- package/dist/core/hooks.d.ts +5 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +18 -13
- package/dist/core/memory-engine/scope-contract.js +18 -18
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +25 -6
- package/dist/core/mode-policy.js +33 -8
- package/dist/core/model-seat.d.ts +8 -5
- package/dist/core/model-shell.d.ts +129 -0
- package/dist/core/model-shell.js +249 -0
- package/dist/core/mods/kernel/digest.d.ts +4 -0
- package/dist/core/mods/kernel/digest.js +5 -0
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +15 -6
- package/dist/core/mods/kernel/events.d.ts +21 -5
- package/dist/core/mods/kernel/events.js +19 -10
- package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
- package/dist/core/mods/kernel/hash-mirror.js +55 -0
- package/dist/core/mods/kernel/index.d.ts +1 -0
- package/dist/core/mods/kernel/index.js +1 -0
- package/dist/core/mods/kernel/package-reader.d.ts +48 -0
- package/dist/core/mods/kernel/package-reader.js +149 -0
- package/dist/core/mods/kernel/site-rules.d.ts +4 -0
- package/dist/core/mods/kernel/site-rules.js +13 -0
- package/dist/core/mods/package.d.ts +7 -3
- package/dist/core/mods/package.js +47 -80
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/parent-spec-seat.d.ts +13 -11
- package/dist/core/parent-spec-seat.js +13 -9
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +33 -5
- package/dist/core/permission-rule-org.js +13 -3
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/permission-rules.js +4 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retain-seat.d.ts +42 -0
- package/dist/core/retain-seat.js +76 -0
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rewind-refusal-codes.d.ts +8 -0
- package/dist/core/rewind-refusal-codes.js +12 -0
- package/dist/core/roles.d.ts +2 -2
- package/dist/core/roles.js +15 -1
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/rule-store-fault.d.ts +9 -7
- package/dist/core/rule-store-fault.js +8 -3
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/checkpoint-scope.d.ts +14 -3
- package/dist/core/runner/checkpoint-scope.js +16 -6
- package/dist/core/runner/compact-session.js +1 -1
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/contracts.d.ts +21 -5
- package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
- package/dist/core/runner/cross-boundary-lane.js +4 -0
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/gate-exit.d.ts +7 -0
- package/dist/core/runner/gate-exit.js +2 -1
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/model-lane-seat.d.ts +3 -0
- package/dist/core/runner/model-lane-seat.js +4 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +27 -16
- package/dist/core/runner/person-path-rows.js +93 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +13 -7
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
- package/dist/core/runner/prepare-gate-stations.js +3 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
- package/dist/core/runner/prepare-hands-readface.js +15 -3
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +13 -5
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +42 -30
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +8 -6
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-policy-outcome.js +5 -2
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
- package/dist/core/runner/role-seat-defaulted.js +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
- package/dist/core/runner/run-harness-handlers.js +4 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +5 -2
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +6 -4
- package/dist/core/runner/shell-env-withheld.js +25 -3
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/sub-agent-deny-lists.js +9 -5
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +6 -1
- package/dist/core/runner/terminal-account.js +16 -1
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-not-executed.d.ts +27 -8
- package/dist/core/runner/tool-not-executed.js +22 -11
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner/write-protection-station.d.ts +1 -1
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +17 -10
- package/dist/core/secret-env.d.ts +61 -37
- package/dist/core/secret-env.js +49 -49
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/shell-read-silence.d.ts +40 -2
- package/dist/core/shell-read-silence.js +23 -4
- package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +14 -7
- package/dist/core/task-notification.d.ts +96 -10
- package/dist/core/task-notification.js +135 -6
- package/dist/core/task-registry-agent.d.ts +1 -0
- package/dist/core/task-registry-agent.js +1 -1
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +40 -2
- package/dist/core/task-registry.js +80 -15
- package/dist/core/task-result.d.ts +18 -3
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +19 -3
- package/dist/core/task-spec.d.ts +48 -22
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-gate-phase.d.ts +6 -3
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +8 -4
- package/dist/core/tool-mount-facts.js +7 -2
- package/dist/core/tool-mount-plan.d.ts +3 -1
- package/dist/core/tool-mount-plan.js +10 -3
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +4 -2
- package/dist/core/tool-result-store.d.ts +56 -3
- package/dist/core/tool-result-store.js +219 -25
- package/dist/core/tool-spec.d.ts +9 -2
- package/dist/core/trace.d.ts +3 -3
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +26 -20
- package/dist/core/wiring-manifest.js +7 -3
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
- package/dist/engine/execution-env/node-execution-env.js +227 -13
- package/dist/engine/harness/types.d.ts +49 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +13 -7
- package/dist/engine/llm/validation.d.ts +8 -1
- package/dist/engine/llm/validation.js +31 -2
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +34 -4
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +28 -9
- package/dist/index.js +22 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-primitives.js +10 -1
- package/dist/orchestration/workflow-script-runner.d.ts +2 -2
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +31 -7
- package/dist/orchestration/workflow.js +119 -57
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/shell/lex.d.ts +2 -2
- package/dist/shell/lex.js +1 -1
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/fs/bash-model-shell.d.ts +23 -0
- package/dist/tools/fs/bash-model-shell.js +25 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
- package/dist/tools/fs/bash-readonly-classifier.js +3 -0
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/fs-bash.js +13 -11
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +4 -2
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +134 -22
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +21 -11
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +7 -3
- package/dist/tools/fs/shell-read-plan.js +8 -5
- package/dist/tools/fs/shell-read-word.d.ts +8 -0
- package/dist/tools/fs/shell-read-word.js +13 -4
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/dist/tools/monitor.js +12 -8
- package/dist/tools/scheduler-tools.d.ts +1 -0
- package/dist/tools/scheduler-tools.js +5 -2
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +192 -3
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/core@7.74.0.json +68 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/primitives@7.74.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core-stores-sql@7.74.0.json +143 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/core@7.74.0.json +2210 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/mods-kernel@7.74.0.json +421 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/primitives@7.74.0.json +174 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
- package/wire-changes/wiki-gate@7.74.0.json +145 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { abortBackgroundAgentsAtRunEnd, defaultTaskRegistry, onRunEndAgentsSettled } from "./task-registry.js";
|
|
2
|
+
import { occupantStamp } from "./task-registry-shared.js";
|
|
3
|
+
import { outcomeOfLegacyRow } from "./member-outcome.js";
|
|
4
|
+
export function ledgerRegistryRows(access, sessionId, taskId, occupant) {
|
|
5
|
+
const reach = { ...access, sessionId, ...occupantStamp({ rootSessionIncarnation: occupant }) };
|
|
6
|
+
return defaultTaskRegistry.membersOfTask(reach, taskId).flatMap((r) => memberRowOf(r, reach, taskId) ?? []);
|
|
7
|
+
}
|
|
8
|
+
export function ledgerMemberRow(access, sessionId, taskId, memberId, occupant) {
|
|
9
|
+
const reach = { ...access, sessionId, ...occupantStamp({ rootSessionIncarnation: occupant }) };
|
|
10
|
+
const row = defaultTaskRegistry.runEndReading([memberId], reach, access)[0]?.row;
|
|
11
|
+
return row !== undefined ? memberRowOf(row, reach, taskId) : undefined;
|
|
12
|
+
}
|
|
13
|
+
function memberRowOf(r, reach, taskId) {
|
|
14
|
+
if (r.type !== "background_agent" && r.type !== "workflow")
|
|
15
|
+
return undefined;
|
|
16
|
+
const facts = defaultTaskRegistry.getAccessibleTask(r.task_id, reach);
|
|
17
|
+
return facts?.parentTaskId === taskId ? ledgerRegistryRowOf(r, facts.name) : undefined;
|
|
18
|
+
}
|
|
19
|
+
export function ledgerRegistryRowOf(r, name) {
|
|
20
|
+
const running = r.status === "running" || r.status === "pending";
|
|
21
|
+
const kind = r.type === "workflow" ? "workflow" : "background_agent";
|
|
22
|
+
const minted = r.type === "background_agent" ? defaultTaskRegistry.getAgentOutcome(r.task_id) : undefined;
|
|
23
|
+
const outcome = running ? undefined : (minted ?? outcomeOfLegacyRow(r, kind));
|
|
24
|
+
const ledger = r.type === "workflow" && !running ? defaultTaskRegistry.getWorkflowMembers(r.task_id) : undefined;
|
|
25
|
+
const cycle = r.type === "background_agent" ? (defaultTaskRegistry.backgroundAgentCycleSeq(r.task_id) ?? 1) : 1;
|
|
26
|
+
return {
|
|
27
|
+
taskId: r.task_id,
|
|
28
|
+
kind: r.type,
|
|
29
|
+
...(r.description !== undefined ? { label: r.description } : {}),
|
|
30
|
+
...(name !== undefined ? { name } : {}),
|
|
31
|
+
running,
|
|
32
|
+
cycle,
|
|
33
|
+
...(outcome !== undefined ? { outcome } : {}),
|
|
34
|
+
...(ledger !== undefined ? { members: { coverage: ledger.coverage, counts: ledger.counts } } : {}),
|
|
35
|
+
...(r.toolUseId !== undefined ? { toolUseId: r.toolUseId } : {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const LAST_WORD_REAP_WAIT_MS = 2_000;
|
|
39
|
+
export async function reapTaskAgentsBeforeLastWord(access, source, runEnd) {
|
|
40
|
+
if (source === "user")
|
|
41
|
+
defaultTaskRegistry.markRunEndAgentsStoppedByUser(access, { skipSessionScoped: true });
|
|
42
|
+
if (abortBackgroundAgentsAtRunEnd(defaultTaskRegistry, access, { skipSessionScoped: true }, runEnd) === 0)
|
|
43
|
+
return;
|
|
44
|
+
let off;
|
|
45
|
+
let timer;
|
|
46
|
+
await new Promise((resolve) => {
|
|
47
|
+
off = onRunEndAgentsSettled(defaultTaskRegistry, access, { skipSessionScoped: true }, resolve);
|
|
48
|
+
if (off === undefined)
|
|
49
|
+
return resolve();
|
|
50
|
+
timer = setTimeout(resolve, LAST_WORD_REAP_WAIT_MS);
|
|
51
|
+
});
|
|
52
|
+
off?.();
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
}
|
|
55
|
+
export function bindRunLedgerBook(book, prepared, occupant) {
|
|
56
|
+
if (book.taskId !== undefined && book.taskId !== prepared.taskId)
|
|
57
|
+
throw Object.assign(new Error(`the member ledger book is task "${book.taskId}"'s, but the leg runs as task "${prepared.taskId}"`), { code: "internal.run_ledger_unbound" });
|
|
58
|
+
const taskId = prepared.taskId;
|
|
59
|
+
book.bind(prepared.runId, () => ledgerRegistryRows(prepared.registryAccess, prepared.sessionId, taskId, occupant), (memberId) => ledgerMemberRow(prepared.registryAccess, prepared.sessionId, taskId, memberId, occupant));
|
|
60
|
+
prepared.harness.subscribe((e) => {
|
|
61
|
+
if (e.type === "turn_start")
|
|
62
|
+
return book.turnStarted();
|
|
63
|
+
if (typeof e.toolCallId !== "string")
|
|
64
|
+
return;
|
|
65
|
+
if (e.type === "tool_execution_start")
|
|
66
|
+
book.callStarted(e.toolCallId);
|
|
67
|
+
else if (e.type === "tool_execution_end")
|
|
68
|
+
book.callEnded(e.toolCallId);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { type MemberCoverage, type MemberOutcome, type MemberOutcomeWord } from "./member-outcome.js";
|
|
2
|
+
import { type SubagentActions } from "./actions-digest.js";
|
|
3
|
+
import type { TaskNotificationPayload } from "./task-notification.js";
|
|
4
|
+
/** The ledger's shape version — one, and it stays one while rows only gain members. */
|
|
5
|
+
export declare const RUN_LEDGER_VERSION = 1;
|
|
6
|
+
/** The key a host's result frame carries the ledger under on the wire (its projection of {@link TaskResult.runLedger}); exported so
|
|
7
|
+
* no consumer spells it by hand. */
|
|
8
|
+
export declare const RUN_LEDGER_WIRE_KEY = "_sema_run_ledger";
|
|
9
|
+
/** How long a member's self-report runs on a row (code points), after redaction. */
|
|
10
|
+
export declare const RUN_LEDGER_SELF_REPORT_MAX_CHARS = 400;
|
|
11
|
+
/**
|
|
12
|
+
* What the accepted checks say about a row (derived, one source: the checks the report tool accepted, each covering the reading of
|
|
13
|
+
* the row it was accepted against — a revived row's next cycle is not covered by a check of an earlier one):
|
|
14
|
+
* - `verified` — an accepted "verified" claim is about its reading;
|
|
15
|
+
* - `evidence` — no claim is about it, and an accepted claim cites its reading as evidence (a verification worker): not counted unverified;
|
|
16
|
+
* - `unverified` — it reported completed and neither of the above holds;
|
|
17
|
+
* - `n/a` — it has not completed (still running, or it ended any other way): there is no report of success to check.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RUN_LEDGER_CHECKS: readonly ["verified", "evidence", "unverified", "n/a"];
|
|
20
|
+
export type RunLedgerCheck = (typeof RUN_LEDGER_CHECKS)[number];
|
|
21
|
+
/** One member the run dispatched — see the module head (an open record). */
|
|
22
|
+
export interface RunLedgerRow {
|
|
23
|
+
readonly taskId: string;
|
|
24
|
+
/** What kind of member (`background_agent`, `workflow`, `subagent`); read as a string. */
|
|
25
|
+
readonly kind: string;
|
|
26
|
+
/** What it was dispatched to do — the description the dispatch carried (untrusted, one line, bounded). */
|
|
27
|
+
readonly label: string;
|
|
28
|
+
/** The name it was addressed by, when it has one. */
|
|
29
|
+
readonly name?: string;
|
|
30
|
+
readonly state: "running" | "settled";
|
|
31
|
+
/** The engine's reading of how it ended (absent while it runs). */
|
|
32
|
+
readonly outcome?: MemberOutcome;
|
|
33
|
+
/** Its own last words (untrusted, redacted, one line, bounded) — set beside {@link actions}, never trusted over them. */
|
|
34
|
+
readonly selfReport?: string;
|
|
35
|
+
/** What it did, by the engine's count. */
|
|
36
|
+
readonly actions?: SubagentActions;
|
|
37
|
+
readonly check: RunLedgerCheck;
|
|
38
|
+
/** A `verified` row only: what the latest accepted check about it found — `confirms`, `refutes` or `partial` (derived from the
|
|
39
|
+
* accepted conclusions, never written apart from them). A row a check refuted reads `check: "verified"` with `verdict: "refutes"`,
|
|
40
|
+
* so a reader never takes it for a row found true. */
|
|
41
|
+
readonly verdict?: RunLedgerVerdict;
|
|
42
|
+
/** A workflow row: how its own members ended (coverage and counts), so a failure one level down is counted. */
|
|
43
|
+
readonly members?: {
|
|
44
|
+
readonly coverage: MemberCoverage;
|
|
45
|
+
readonly counts: Readonly<Partial<Record<MemberOutcomeWord, number>>>;
|
|
46
|
+
};
|
|
47
|
+
/** When the run's lane heard it settle (epoch ms) — the instant a check of it must come after. */
|
|
48
|
+
readonly settledAt?: number;
|
|
49
|
+
}
|
|
50
|
+
/** What a verified check found about the row it is about. */
|
|
51
|
+
export type RunLedgerVerdict = "confirms" | "refutes" | "partial";
|
|
52
|
+
/** Why the book took a snapshot: a delivery through the report tool (its call id, when the call carried one), a leg that parked
|
|
53
|
+
* (the run is not over: a resumed leg continues the same book), or the run's end (the final ledger, `final: true`). */
|
|
54
|
+
export type RunLedgerTrigger = {
|
|
55
|
+
readonly kind: "report";
|
|
56
|
+
readonly toolCallId?: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "park";
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "run_end";
|
|
61
|
+
};
|
|
62
|
+
/** One conclusion of an accepted report, as the ledger keeps it. */
|
|
63
|
+
export interface RunLedgerClaim {
|
|
64
|
+
readonly about: string;
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly basis: "verified" | "relayed" | "inferred";
|
|
67
|
+
readonly verdict?: RunLedgerVerdict;
|
|
68
|
+
readonly evidence?: readonly string[];
|
|
69
|
+
}
|
|
70
|
+
/** The last report the run's model delivered through the report tool, as the ledger's plain text carries it. */
|
|
71
|
+
export interface RunLedgerReport {
|
|
72
|
+
readonly status: "normal" | "proactive";
|
|
73
|
+
readonly message: string;
|
|
74
|
+
readonly kind?: "start" | "interim" | "final";
|
|
75
|
+
readonly claims?: readonly RunLedgerClaim[];
|
|
76
|
+
}
|
|
77
|
+
/** See the module head. */
|
|
78
|
+
export interface RunLedger {
|
|
79
|
+
readonly v: typeof RUN_LEDGER_VERSION;
|
|
80
|
+
/** The leg that took this snapshot (`Prepared.runId`, THIS call of the engine) — absent only on a book no run bound (a
|
|
81
|
+
* library-built book). A resumed leg has its own id and continues the parked leg's {@link seq}. */
|
|
82
|
+
readonly runId?: string;
|
|
83
|
+
/** The snapshot's place in its book: 1, 2, 3 … — one more at every snapshot the book takes (each delivery through the report tool,
|
|
84
|
+
* a park, then the run's end), across every leg a park and its resume join, never reused and never by the wall clock. The larger
|
|
85
|
+
* `seq` is the later ledger, whatever order the copies arrive or replay in; the final ledger has the largest. */
|
|
86
|
+
readonly seq: number;
|
|
87
|
+
/** Why this snapshot was taken ({@link RunLedgerTrigger}); `kind: "run_end"` exactly when {@link final}. */
|
|
88
|
+
readonly trigger: RunLedgerTrigger;
|
|
89
|
+
/** The run's last word (its result) — or a snapshot taken while it ran, a parked leg's included. */
|
|
90
|
+
readonly final: boolean;
|
|
91
|
+
/** Rows still running. */
|
|
92
|
+
readonly open: number;
|
|
93
|
+
readonly coverage: MemberCoverage;
|
|
94
|
+
/** How the rows ended, by the holder's word ({@link MemberOutcomeWord}) — the one count the headline and the text speak. */
|
|
95
|
+
readonly counts: Readonly<Partial<Record<MemberOutcomeWord, number>>>;
|
|
96
|
+
/** Members the book listed or heard that its holder no longer hands back (a reclaimed registry row; a resume in another process —
|
|
97
|
+
* a durable store is not read) — counted, never listed as rows; present only when there are some, and then {@link coverage} is `incomplete`. */
|
|
98
|
+
readonly unreadable?: number;
|
|
99
|
+
/** Rows that reported completed with no accepted check about them (rows cited as evidence are not counted). */
|
|
100
|
+
readonly unverified: number;
|
|
101
|
+
/** Verified rows whose check did not confirm them (`verdict` `refutes` or `partial`). */
|
|
102
|
+
readonly contradicted: number;
|
|
103
|
+
/** Structured reports the report tool accepted. */
|
|
104
|
+
readonly reports: number;
|
|
105
|
+
readonly rows: readonly RunLedgerRow[];
|
|
106
|
+
/** The engine's one-line headline, computed from the counts above — never the model's. */
|
|
107
|
+
readonly headline: string;
|
|
108
|
+
/** The ledger in the engine's fixed sentences, for an outlet with no interface of its own. */
|
|
109
|
+
readonly text: string;
|
|
110
|
+
readonly lastReport?: RunLedgerReport;
|
|
111
|
+
/** The launch check's reading, when the run took one. */
|
|
112
|
+
readonly launch?: import("./manager-launch-check.js").ManagerLaunchCheck;
|
|
113
|
+
}
|
|
114
|
+
/** What a delegation tool reports of a member it settled inside its own call (a synchronous agent, a fork). */
|
|
115
|
+
export interface RunLedgerSettledMember {
|
|
116
|
+
readonly taskId: string;
|
|
117
|
+
readonly kind: string;
|
|
118
|
+
readonly label: string;
|
|
119
|
+
readonly name?: string;
|
|
120
|
+
readonly outcome: MemberOutcome;
|
|
121
|
+
readonly selfReport?: string;
|
|
122
|
+
readonly actions?: SubagentActions;
|
|
123
|
+
/** The delegation call it ran inside — the instant it began. */
|
|
124
|
+
readonly toolCallId?: string;
|
|
125
|
+
}
|
|
126
|
+
/** The seat a delegation tool sees on its ctx (`ToolExecuteContext.runLedgerBook`): report an in-call member. */
|
|
127
|
+
export interface RunLedgerSink {
|
|
128
|
+
memberSettled(m: RunLedgerSettledMember): void;
|
|
129
|
+
}
|
|
130
|
+
/** A member row as its holder (the task registry) hands it to a snapshot. */
|
|
131
|
+
export interface RunLedgerRegistryRow {
|
|
132
|
+
readonly taskId: string;
|
|
133
|
+
readonly kind: string;
|
|
134
|
+
readonly label?: string;
|
|
135
|
+
/** The name it was addressed by, when it has one. */
|
|
136
|
+
readonly name?: string;
|
|
137
|
+
readonly running: boolean;
|
|
138
|
+
/** How it ended, by its holder — absent while it runs. */
|
|
139
|
+
readonly outcome?: MemberOutcome;
|
|
140
|
+
/** A workflow row: how its own members ended, by the run's own member ledger (absent while the run runs). */
|
|
141
|
+
readonly members?: RunLedgerRow["members"];
|
|
142
|
+
/** The tool call that dispatched it — the instant a check it ran can have begun. */
|
|
143
|
+
readonly toolUseId?: string;
|
|
144
|
+
/** The holder's cycle number (background agent stop-cycle number; workflow = 1). Absent on a caller that omits it (reads the
|
|
145
|
+
* latest arrived cycle, else 1). */
|
|
146
|
+
readonly cycle?: number;
|
|
147
|
+
}
|
|
148
|
+
/** One report the report tool hands the book to judge and, when it passes, keep. */
|
|
149
|
+
export interface RunLedgerReportInput {
|
|
150
|
+
readonly status: "normal" | "proactive";
|
|
151
|
+
readonly message: string;
|
|
152
|
+
readonly report?: {
|
|
153
|
+
readonly kind?: "start" | "interim" | "final";
|
|
154
|
+
readonly claims?: readonly RunLedgerClaim[];
|
|
155
|
+
};
|
|
156
|
+
/** The report call's own id (it cannot be its own evidence). */
|
|
157
|
+
readonly toolCallId?: string;
|
|
158
|
+
}
|
|
159
|
+
/** The door for `TaskSpec.runLedger`: `true` or absent; any other value refuses loudly (`config.invalid_argument`) — a `false`
|
|
160
|
+
* would read as "declared" to a reader that tests presence, and a word nobody reads must not sit on the spec as if wired. */
|
|
161
|
+
export declare function assertRunLedgerDeclaration(v: unknown): void;
|
|
162
|
+
/** What a resumed leg says when the row it resumes was parked by a leg that kept no ledger and its spec declares one
|
|
163
|
+
* (`TaskResult.runLedgerNotKept`): the task keeps none — whether it keeps one is fixed by its first leg. */
|
|
164
|
+
export declare const RUN_LEDGER_NOT_KEPT_SENTENCE = "This task's first leg kept no member ledger, so this leg keeps none either: whether a task keeps one is fixed when the task starts (declare runLedger on its first leg).";
|
|
165
|
+
/**
|
|
166
|
+
* A leg's ledger identity — see the module head. `resumed`: the row this leg resumes (its book section as the row holds it), absent
|
|
167
|
+
* on a leg that resumes nothing (a first leg; a woken or forked leg, which goes through no park row and keeps a ledger only when its
|
|
168
|
+
* own spec declares one). `rowTaskId`: the registry row a delegation lane runs the leg as, which is its task id.
|
|
169
|
+
* - a resumed row with a section: the section's task id; a spec naming another task id refuses (`config.invalid_argument`);
|
|
170
|
+
* - a resumed row with none: no ledger — and, when the spec declares one, `notKept` (the result says so; no notice code);
|
|
171
|
+
* - a leg that resumes nothing and declares one: the row's id, else the host's task id when it is not the session id, else a
|
|
172
|
+
* minted `rl-…`.
|
|
173
|
+
* Read by the run's lane (the book it mints), by prepare (the spec it rebinds) and before a resume's claim (the refusal): every
|
|
174
|
+
* reader of a resumed leg gets the same answer, since nothing is minted there.
|
|
175
|
+
*/
|
|
176
|
+
export declare function runLedgerIdentityOf(spec: {
|
|
177
|
+
readonly taskId?: string | undefined;
|
|
178
|
+
readonly sessionId?: string | undefined;
|
|
179
|
+
readonly runLedger?: unknown;
|
|
180
|
+
}, resumed: {
|
|
181
|
+
readonly section: unknown;
|
|
182
|
+
} | undefined, rowTaskId: string | undefined): {
|
|
183
|
+
readonly taskId: string;
|
|
184
|
+
readonly parked?: RunLedgerParked;
|
|
185
|
+
} | {
|
|
186
|
+
readonly notKept: string;
|
|
187
|
+
} | undefined;
|
|
188
|
+
/** The book a leg keeps, by {@link runLedgerIdentityOf}: a new one for a first leg, the parked one continued for a resumed leg, none
|
|
189
|
+
* for a leg that keeps no ledger. */
|
|
190
|
+
export declare function runLedgerBookFor(spec: Parameters<typeof runLedgerIdentityOf>[0], resumed: Parameters<typeof runLedgerIdentityOf>[1], rowTaskId: string | undefined, now?: () => number): RunLedgerBook | undefined;
|
|
191
|
+
/** The spec a leg runs under once its ledger identity is read: a leg with a book declares it and runs as its task; any other leg
|
|
192
|
+
* declares none (a resumed row whose leg kept none included). */
|
|
193
|
+
export declare function withRunLedgerTask<S extends {
|
|
194
|
+
readonly taskId?: string | undefined;
|
|
195
|
+
readonly runLedger?: true | undefined;
|
|
196
|
+
}>(spec: S, book: RunLedgerBook | undefined): S;
|
|
197
|
+
/** A synchronous member row held by the book (its only holder), frozen across a park up to its cap. */
|
|
198
|
+
export interface RunLedgerSyncRow {
|
|
199
|
+
readonly taskId: string;
|
|
200
|
+
readonly kind: string;
|
|
201
|
+
readonly label?: string;
|
|
202
|
+
readonly name?: string;
|
|
203
|
+
readonly outcome: MemberOutcome;
|
|
204
|
+
readonly selfReport?: string;
|
|
205
|
+
readonly actions?: SubagentActions;
|
|
206
|
+
readonly settledAt: number;
|
|
207
|
+
readonly order: number;
|
|
208
|
+
readonly call?: string;
|
|
209
|
+
readonly began?: number;
|
|
210
|
+
}
|
|
211
|
+
/** Compact arrival mark of a holder-backed member (background agent or workflow): order metadata only, no selfReport or actions. */
|
|
212
|
+
export interface RunLedgerArrivalMark {
|
|
213
|
+
readonly taskId: string;
|
|
214
|
+
readonly cycle: number;
|
|
215
|
+
readonly order: number;
|
|
216
|
+
readonly settledAt: number;
|
|
217
|
+
readonly began?: number;
|
|
218
|
+
}
|
|
219
|
+
/** One tool call of the run's own leg: wall-clock start, book order, turn start, end order, and whether the id appeared twice. */
|
|
220
|
+
export interface RunLedgerHeardCall {
|
|
221
|
+
at: number;
|
|
222
|
+
started: number;
|
|
223
|
+
readonly turn: number;
|
|
224
|
+
ended?: number;
|
|
225
|
+
duplicate?: true;
|
|
226
|
+
}
|
|
227
|
+
/** An accepted claim as the book keeps it: with the reading `(taskId, cycle)` of each row it names when it was accepted. A check
|
|
228
|
+
* covers that cycle only: a row's later cycle is a reading no accepted check saw. */
|
|
229
|
+
export type RunLedgerKeptClaim = RunLedgerClaim & {
|
|
230
|
+
readonly readings: ReadonlyArray<readonly [taskId: string, cycle: number]>;
|
|
231
|
+
};
|
|
232
|
+
/** Counts of oldest entries dropped per class when a leg parked past its cap (absent when nothing was dropped). */
|
|
233
|
+
export interface RunLedgerTruncated {
|
|
234
|
+
readonly listed?: number;
|
|
235
|
+
readonly syncRows?: number;
|
|
236
|
+
readonly arrivals?: number;
|
|
237
|
+
readonly calls?: number;
|
|
238
|
+
readonly claims?: number;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The book as a parked row carries it (`CheckpointState.runLedger`, reader word `run_ledger`): only the book's own bounded facts —
|
|
242
|
+
* task id, listed member ids, synchronous rows, compact arrival marks, calls, accepted claims, counters, and per-class drop counts.
|
|
243
|
+
* Holder-backed members' pre-park `selfReport` and `actions` are not carried across a park. Read back by {@link readRunLedgerParked}
|
|
244
|
+
* alone — a section that does not read is a damaged row, refused before the claim, never an empty book.
|
|
245
|
+
*/
|
|
246
|
+
export interface RunLedgerParked {
|
|
247
|
+
readonly v: 1;
|
|
248
|
+
readonly taskId: string;
|
|
249
|
+
readonly listed: readonly string[];
|
|
250
|
+
readonly tick: number;
|
|
251
|
+
readonly turn: number;
|
|
252
|
+
readonly seq: number;
|
|
253
|
+
readonly reports: number;
|
|
254
|
+
readonly syncRows: readonly RunLedgerSyncRow[];
|
|
255
|
+
readonly arrivals: readonly RunLedgerArrivalMark[];
|
|
256
|
+
readonly calls: ReadonlyArray<{
|
|
257
|
+
readonly id: string;
|
|
258
|
+
} & RunLedgerHeardCall>;
|
|
259
|
+
readonly claims: readonly RunLedgerKeptClaim[];
|
|
260
|
+
readonly lastReport?: RunLedgerReport;
|
|
261
|
+
readonly truncated?: RunLedgerTruncated;
|
|
262
|
+
}
|
|
263
|
+
/** A parked row's book section, read: the section, or `undefined` when it does not read as one this engine wrote (a damaged row). */
|
|
264
|
+
export declare function readRunLedgerParked(v: unknown): RunLedgerParked | undefined;
|
|
265
|
+
/** The book — see the module head. "Before" and "after" between the book's facts (a row reported, a call started or finished) are
|
|
266
|
+
* read off ONE counter, in the order the book heard them — never the wall clock, which two facts can share. */
|
|
267
|
+
export declare class RunLedgerBook implements RunLedgerSink {
|
|
268
|
+
#private;
|
|
269
|
+
/** The task the book belongs to ({@link runLedgerIdentityOf}) — absent only on a book no leg minted (a library-built book). */
|
|
270
|
+
readonly taskId: string | undefined;
|
|
271
|
+
/** A new book of task `taskId`, or — `parked`, a resumed leg's — the book its parked row froze, continued (its task is the
|
|
272
|
+
* section's; a `taskId` naming another refuses). */
|
|
273
|
+
constructor(now?: () => number, parked?: RunLedgerParked, taskId?: string);
|
|
274
|
+
/** The book as the parking leg's row carries it ({@link RunLedgerParked}) — read when the row is minted; the leg's own `park`
|
|
275
|
+
* snapshot, taken after, is number `seq`. Each class keeps its newest entries up to its cap and counts any cut in `truncated`. */
|
|
276
|
+
parkSection(): RunLedgerParked;
|
|
277
|
+
/** Bind the book to its run: the run's id ({@link RunLedger.runId}) and its holder's reading — every member row of this task, and
|
|
278
|
+
* one by its id (bound once, when the prepared leg is known). */
|
|
279
|
+
bind(runId: string, read: () => readonly RunLedgerRegistryRow[], member?: (taskId: string) => RunLedgerRegistryRow | undefined): void;
|
|
280
|
+
/** The model's next turn began (the harness's `turn_start`): what it reads from here on is everything the book heard so far. */
|
|
281
|
+
turnStarted(): void;
|
|
282
|
+
/** The launch check the run took. */
|
|
283
|
+
setLaunch(launch: import("./manager-launch-check.js").ManagerLaunchCheck): void;
|
|
284
|
+
/** A frame on the run's own lane: a terminal frame of a background agent or a workflow run records its arrival mark for
|
|
285
|
+
* `(taskId, cycle)` and keeps this leg's transient words and actions. It settles nothing: how the member stands is its holder's. */
|
|
286
|
+
observeFrame(n: TaskNotificationPayload, terminal: boolean): void;
|
|
287
|
+
/** {@link RunLedgerSink.memberSettled}: an in-call member (first report wins). */
|
|
288
|
+
memberSettled(m: RunLedgerSettledMember): void;
|
|
289
|
+
/** A tool call of the run's own leg started (the harness's `tool_execution_start`). An id already seen in this book is marked
|
|
290
|
+
* non-unique (refused when cited as evidence); its turn still updates so an endpoint reusing one id as its report call keeps its
|
|
291
|
+
* own turn reading. */
|
|
292
|
+
callStarted(toolCallId: string): void;
|
|
293
|
+
/** A parked tool call resumed after approval (`run-leg.ts`): continues the open call leg 1 already heard without marking it
|
|
294
|
+
* non-unique, keeping the turn that issued it while recording when execution actually began. */
|
|
295
|
+
callResumed(toolCallId: string): void;
|
|
296
|
+
/** A tool call of the run's own leg finished (the harness's `tool_execution_end`) — from here on its result is the model's to read. */
|
|
297
|
+
callEnded(toolCallId: string): void;
|
|
298
|
+
/**
|
|
299
|
+
* Judge a report's conclusions against the book and, when every one passes, keep it. Reads the same {@link #rowNow} view a
|
|
300
|
+
* snapshot reads: a running row has no current reading (refused naming running and its cycle when known); a settled row at
|
|
301
|
+
* cycle N without an arrival mark for `(taskId, N)` is refused; a call id seen more than once is non-unique and refused when
|
|
302
|
+
* cited as evidence; a mark cut at park is refused naming truncation.
|
|
303
|
+
*/
|
|
304
|
+
acceptReport(input: RunLedgerReportInput): {
|
|
305
|
+
ok: true;
|
|
306
|
+
} | {
|
|
307
|
+
ok: false;
|
|
308
|
+
why: string;
|
|
309
|
+
};
|
|
310
|
+
/** The ledger now, taken for `trigger` — `run_end` is the run's last word (`final`), read as the holders stand (nothing a later
|
|
311
|
+
* sweep will do is read ahead). Each call is the next {@link RunLedger.seq}. */
|
|
312
|
+
snapshot(trigger: RunLedgerTrigger): RunLedger;
|
|
313
|
+
}
|
|
314
|
+
/** The ledger over its rows — the run-level reading, the headline and the text, all derived here. */
|
|
315
|
+
export declare function runLedgerOf(rows: readonly RunLedgerRow[], at: {
|
|
316
|
+
runId?: string;
|
|
317
|
+
seq: number;
|
|
318
|
+
trigger: RunLedgerTrigger;
|
|
319
|
+
unreadable?: number;
|
|
320
|
+
reports: number;
|
|
321
|
+
lastReport?: RunLedgerReport;
|
|
322
|
+
launch?: RunLedger["launch"];
|
|
323
|
+
}): RunLedger;
|
|
324
|
+
/**
|
|
325
|
+
* The headline — computed from the ledger's counts, never written by a model: rows still running say the run is not finished;
|
|
326
|
+
* otherwise the coverage, how the rows that did not complete ended (each by its holder's word: `1 killed`, `2 failed`), the members
|
|
327
|
+
* the holder no longer hands back, the rows a check contradicted and the unverified rows. A final ledger with no accepted
|
|
328
|
+
* structured report says so.
|
|
329
|
+
*/
|
|
330
|
+
export declare function runLedgerHeadline(l: Pick<RunLedger, "final" | "open" | "coverage" | "counts" | "unreadable" | "unverified" | "contradicted" | "reports" | "rows">): string;
|
|
331
|
+
/** The ledger in fixed sentences (one line per fact; the untrusted strings already passed their fences). */
|
|
332
|
+
export declare function runLedgerText(l: Omit<RunLedger, "text">): string;
|