@sema-agent/core 7.67.3 → 7.68.1
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 +1537 -0
- package/README.md +18 -9
- package/README.zh-CN.md +16 -8
- package/dist/agents/agent-definition.d.ts +1 -1
- package/dist/agents/agent-definition.js +4 -1
- package/dist/agents/cascade.d.ts +2 -2
- package/dist/agents/cascade.js +3 -1
- package/dist/agents/cumulative-stats.d.ts +2 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/list-agents-tool.d.ts +30 -0
- package/dist/agents/list-agents-tool.js +45 -3
- package/dist/agents/peer-admission.d.ts +2 -2
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +1 -0
- package/dist/agents/repair-loop.js +3 -1
- package/dist/agents/retain-ledger.d.ts +61 -8
- package/dist/agents/retain-ledger.js +25 -3
- package/dist/agents/roster-store.d.ts +4 -2
- package/dist/agents/send-message-tool.d.ts +1 -1
- package/dist/agents/send-message-tool.js +20 -15
- package/dist/agents/subagent-steps.js +2 -10
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +106 -76
- package/dist/agents/tool-filter.d.ts +20 -11
- package/dist/agents/tool-filter.js +8 -4
- package/dist/agents/verify.d.ts +3 -1
- package/dist/agents/verify.js +2 -0
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/open-responses.js +3 -1
- package/dist/brain/openai.js +3 -1
- package/dist/brain/reasoning-request.d.ts +73 -19
- package/dist/brain/reasoning-request.js +164 -72
- package/dist/brain/reasoning-stamp.d.ts +26 -0
- package/dist/brain/reasoning-stamp.js +10 -0
- package/dist/brain/reasoning.d.ts +95 -162
- package/dist/brain/reasoning.js +31 -86
- package/dist/brain/route-adjudicator.d.ts +9 -7
- package/dist/brain/route-adjudicator.js +12 -10
- package/dist/brain/status-sink.d.ts +19 -64
- package/dist/brain/status-sink.js +5 -21
- package/dist/brain/stream-engine.d.ts +11 -2
- package/dist/brain/stream-engine.js +10 -0
- package/dist/core/a2a.d.ts +17 -5
- package/dist/core/a2a.js +11 -3
- package/dist/core/allow-entry.d.ts +35 -15
- package/dist/core/allow-entry.js +47 -60
- package/dist/core/ask-headline.d.ts +68 -0
- package/dist/core/ask-headline.js +23 -0
- package/dist/core/ask-origin.d.ts +36 -8
- package/dist/core/ask-origin.js +17 -10
- package/dist/core/ask-question.d.ts +34 -7
- package/dist/core/ask-question.js +10 -1
- package/dist/core/ask-unresolvable-notice.d.ts +7 -0
- package/dist/core/ask-unresolvable-notice.js +9 -3
- package/dist/core/auto-strip.d.ts +53 -0
- package/dist/core/auto-strip.js +76 -0
- package/dist/core/background-agent-store.d.ts +45 -5
- package/dist/core/background-agent-store.js +69 -15
- package/dist/core/background-shell.d.ts +2 -2
- package/dist/core/caller-text.js +2 -2
- package/dist/core/canonical-json.d.ts +13 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +66 -20
- package/dist/core/checkpoint-features.js +12 -1
- package/dist/core/checkpoint-generation.d.ts +1 -1
- package/dist/core/checkpoint-queries.d.ts +1 -1
- package/dist/core/checkpoint-queries.js +4 -1
- package/dist/core/checkpoint-requirements.d.ts +45 -2
- package/dist/core/checkpoint-requirements.js +16 -6
- package/dist/core/checkpoint-row-verdict.d.ts +1 -0
- package/dist/core/checkpoint-row-verdict.js +4 -0
- package/dist/core/checkpoint-store.d.ts +66 -38
- package/dist/core/checkpoint-store.js +15 -6
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +1 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/delegation-frames.d.ts +9 -12
- package/dist/core/delegation-frames.js +9 -8
- package/dist/core/engine-capabilities.d.ts +21 -8
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +147 -34
- package/dist/core/engine-notice.js +27 -16
- package/dist/core/engine-storage-backend.d.ts +2 -1
- package/dist/core/env-budget.js +3 -3
- package/dist/core/env-knob-announce.d.ts +10 -10
- package/dist/core/env-knob-announce.js +3 -6
- package/dist/core/file-history-store.d.ts +29 -4
- package/dist/core/file-history-store.js +13 -0
- package/dist/core/frame-settlement.d.ts +2 -1
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.js +56 -49
- package/dist/core/governance-codes.d.ts +39 -3
- package/dist/core/governance-codes.js +61 -3
- package/dist/core/hooks.d.ts +29 -11
- package/dist/core/hooks.js +5 -2
- package/dist/core/human-input-projection.js +3 -3
- package/dist/core/input-author.d.ts +17 -3
- package/dist/core/input-author.js +15 -3
- package/dist/core/leg-identity.d.ts +10 -28
- package/dist/core/leg-identity.js +1 -21
- package/dist/core/lsp.d.ts +18 -13
- package/dist/core/lsp.js +30 -22
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mailbox-store.js +4 -4
- package/dist/core/mcp-connection-pool.d.ts +93 -4
- package/dist/core/mcp-connection-pool.js +104 -1
- package/dist/core/mcp-failure.d.ts +38 -12
- package/dist/core/mcp-failure.js +9 -13
- package/dist/core/mcp-probe.d.ts +4 -3
- package/dist/core/mcp-server-link.d.ts +4 -2
- package/dist/core/mcp-server-link.js +4 -5
- package/dist/core/mcp-server-spec.d.ts +3 -3
- package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
- package/dist/core/mcp-server-unavailable-notice.js +18 -4
- package/dist/core/mcp.d.ts +40 -6
- package/dist/core/mcp.js +39 -13
- package/dist/core/memory-engine/content-origin.js +2 -2
- package/dist/core/memory-engine/control-objects.d.ts +2 -4
- package/dist/core/memory-engine/control-objects.js +2 -10
- package/dist/core/memory-engine/delegation-settlement.js +6 -1
- package/dist/core/memory-engine/dual-root.js +3 -0
- package/dist/core/memory-engine/engine.d.ts +6 -4
- package/dist/core/memory-engine/engine.js +32 -29
- package/dist/core/memory-engine/file-backend.d.ts +20 -5
- package/dist/core/memory-engine/file-backend.js +21 -31
- package/dist/core/memory-engine/frontmatter.d.ts +2 -0
- package/dist/core/memory-engine/frontmatter.js +4 -0
- package/dist/core/memory-engine/layout.d.ts +114 -20
- package/dist/core/memory-engine/layout.js +340 -22
- package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
- package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
- package/dist/core/memory-engine/mount-failed-notice.js +43 -10
- package/dist/core/memory-engine/sync-client.js +4 -5
- package/dist/core/model-fallbacks.d.ts +5 -1
- package/dist/core/model-fallbacks.js +3 -3
- package/dist/core/model-receipt.d.ts +2 -1
- package/dist/core/model-receipt.js +12 -1
- package/dist/core/mods/kernel/dispatch.d.ts +2 -2
- package/dist/core/mods/kernel/dispatch.js +14 -6
- package/dist/core/mods/kernel/events.d.ts +8 -5
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/registration.d.ts +9 -0
- package/dist/core/mods/package.js +1 -1
- package/dist/core/mods/session-append.d.ts +4 -2
- package/dist/core/mods/session-append.js +3 -0
- package/dist/core/mods/stations.d.ts +7 -11
- package/dist/core/mods/stations.js +4 -7
- package/dist/core/mods/tool-call.d.ts +10 -8
- package/dist/core/mods/tool-call.js +15 -18
- package/dist/core/mounted-mcp.d.ts +0 -4
- package/dist/core/mounted-mcp.js +1 -1
- package/dist/core/park-noun.d.ts +24 -0
- package/dist/core/park-noun.js +21 -0
- package/dist/core/park-resumability.d.ts +60 -0
- package/dist/core/park-resumability.js +30 -0
- package/dist/core/permission-rule-provider.d.ts +24 -2
- package/dist/core/permission-rule-provider.js +11 -8
- package/dist/core/permission-rule-store.d.ts +8 -1
- package/dist/core/permission-rule-store.js +2 -3
- package/dist/core/permission-rules.d.ts +2 -1
- package/dist/core/permission-rules.js +8 -4
- package/dist/core/persisted-rule-arms.d.ts +3 -0
- package/dist/core/persisted-rule-arms.js +2 -1
- package/dist/core/present-plan-tool.d.ts +47 -3
- package/dist/core/present-plan-tool.js +62 -4
- package/dist/core/principal-name.d.ts +1 -1
- package/dist/core/principal-name.js +5 -5
- package/dist/core/process-identity.js +10 -5
- package/dist/core/protocol-http-auth.d.ts +20 -14
- package/dist/core/protocol-http-auth.js +70 -50
- package/dist/core/read-only-shell.js +9 -5
- package/dist/core/redaction-marks.d.ts +4 -26
- package/dist/core/redaction-marks.js +9 -21
- package/dist/core/remote-env.d.ts +43 -16
- package/dist/core/remote-env.js +1 -1
- package/dist/core/request-copy-projection.d.ts +1 -1
- package/dist/core/request-copy-projection.js +40 -50
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +35 -18
- package/dist/core/resume-startup-cause.js +13 -10
- package/dist/core/retention.d.ts +167 -25
- package/dist/core/retention.js +100 -20
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +11 -5
- package/dist/core/rule-lane-reads.d.ts +3 -0
- package/dist/core/rule-lane-reads.js +5 -1
- package/dist/core/rule-store-fault.d.ts +70 -0
- package/dist/core/rule-store-fault.js +102 -0
- package/dist/core/runner/advertised-writable-dirs.js +16 -31
- package/dist/core/runner/announce-once-ledger.d.ts +19 -2
- package/dist/core/runner/announce-once-ledger.js +24 -2
- package/dist/core/runner/assemble-result.d.ts +6 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/auto-strip-notice.d.ts +36 -0
- package/dist/core/runner/auto-strip-notice.js +59 -0
- package/dist/core/runner/branch-window.d.ts +3 -0
- package/dist/core/runner/branch-window.js +37 -0
- package/dist/core/runner/caller-roster.d.ts +8 -3
- package/dist/core/runner/capability-withheld-seat.js +3 -9
- package/dist/core/runner/clock-and-limits.d.ts +22 -1
- package/dist/core/runner/clock-and-limits.js +30 -0
- package/dist/core/runner/contracts.d.ts +58 -35
- package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
- package/dist/core/runner/credential-refusal-seat.js +47 -0
- package/dist/core/runner/cross-boundary-lane.js +6 -4
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/file-history-restore.d.ts +53 -2
- package/dist/core/runner/file-history-restore.js +29 -10
- package/dist/core/runner/forward-sink.d.ts +14 -1
- package/dist/core/runner/forward-sink.js +14 -12
- package/dist/core/runner/gate-exit.d.ts +8 -7
- package/dist/core/runner/gate-exit.js +13 -13
- package/dist/core/runner/git-status-frame.js +2 -4
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/main-call-account.d.ts +3 -1
- package/dist/core/runner/main-call-account.js +5 -3
- package/dist/core/runner/mcp-redial.d.ts +2 -5
- package/dist/core/runner/mcp-redial.js +2 -2
- package/dist/core/runner/nested-memory-content.d.ts +7 -1
- package/dist/core/runner/nested-memory-content.js +73 -13
- package/dist/core/runner/nested-memory-lane.d.ts +44 -19
- package/dist/core/runner/nested-memory-lane.js +152 -76
- package/dist/core/runner/park-commit.js +3 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
- package/dist/core/runner/permission-rule-lanes.js +29 -3
- package/dist/core/runner/person-path-rows.d.ts +3 -11
- package/dist/core/runner/person-path-rows.js +21 -24
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +20 -14
- package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
- package/dist/core/runner/prepare-ask-lane.js +6 -5
- package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
- package/dist/core/runner/prepare-boundary-parks.js +27 -24
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -24
- package/dist/core/runner/prepare-config-doors.js +58 -41
- package/dist/core/runner/prepare-context-lane.d.ts +2 -2
- package/dist/core/runner/prepare-context-lane.js +3 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
- package/dist/core/runner/prepare-defer-classify.js +1 -1
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +3 -2
- package/dist/core/runner/prepare-file-history.d.ts +62 -26
- package/dist/core/runner/prepare-file-history.js +117 -46
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
- package/dist/core/runner/prepare-gate-stations.js +6 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
- package/dist/core/runner/prepare-hands-readface.js +8 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +6 -6
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +10 -3
- package/dist/core/runner/prepare-park-ask.js +7 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
- package/dist/core/runner/prepare-policy-chain.js +18 -13
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +5 -3
- package/dist/core/runner/prepare-prompt-assembly.js +2 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
- package/dist/core/runner/prepare-protocol-tools.js +7 -7
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-run-refs.d.ts +7 -2
- package/dist/core/runner/prepare-run-refs.js +8 -7
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
- package/dist/core/runner/prepare-suspend-saga.js +4 -3
- package/dist/core/runner/prepare-task.js +66 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
- package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +1 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
- package/dist/core/runner/prepare-wiring-manifest.js +14 -6
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
- package/dist/core/runner/prepare-workspace-restore.js +15 -6
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/restore-seat.d.ts +41 -0
- package/dist/core/runner/restore-seat.js +38 -0
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +4 -3
- package/dist/core/runner/resume-checkpoint-screen.js +2 -1
- package/dist/core/runner/resume-internals-and-config.js +2 -1
- package/dist/core/runner/resume-preflight.js +2 -1
- package/dist/core/runner/rewind-files.js +22 -6
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
- package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
- package/dist/core/runner/run-brain-sinks.d.ts +3 -6
- package/dist/core/runner/run-brain-sinks.js +6 -6
- package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.js +20 -12
- package/dist/core/runner/run-leg.js +31 -72
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -4
- package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
- package/dist/core/runner/run-reasoning-seat.js +13 -18
- package/dist/core/runner/run-settle-and-teardown.js +13 -9
- package/dist/core/runner/run-terminal-adoption.js +4 -8
- package/dist/core/runner/run-turn-boundary.js +6 -3
- package/dist/core/runner/runtask.d.ts +9 -4
- package/dist/core/runner/runtask.js +29 -22
- package/dist/core/runner/session-rule-policy.d.ts +11 -1
- package/dist/core/runner/shell-env-withheld.js +2 -7
- package/dist/core/runner/side-call-account.d.ts +5 -6
- package/dist/core/runner/side-call-account.js +2 -2
- package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
- package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
- package/dist/core/runner/stream-settle-backstop.js +4 -6
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +4 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
- package/dist/core/runner/sub-agent-deny-lists.js +7 -4
- package/dist/core/runner/teardown-bounded.d.ts +7 -0
- package/dist/core/runner/teardown-bounded.js +7 -0
- package/dist/core/runner/terminal-account.js +41 -13
- package/dist/core/runner/terminal-projection.d.ts +1 -5
- package/dist/core/runner/tool-end-body.d.ts +9 -3
- package/dist/core/runner/tool-end-body.js +6 -3
- package/dist/core/runner/tool-output-projection.d.ts +13 -4
- package/dist/core/runner/tool-output-projection.js +10 -14
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +12 -5
- package/dist/core/runner-deps.d.ts +6 -6
- package/dist/core/runtime-caps.d.ts +2 -1
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +13 -15
- package/dist/core/session-checkout.d.ts +115 -15
- package/dist/core/session-checkout.js +435 -136
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.js +1 -0
- package/dist/core/session-store.js +2 -0
- package/dist/core/session.d.ts +11 -1
- package/dist/core/shell-run-candidates.d.ts +1 -0
- package/dist/core/shell-run-candidates.js +1 -1
- package/dist/core/shutdown-debug.d.ts +6 -5
- package/dist/core/shutdown-debug.js +5 -1
- package/dist/core/skill-grant.js +4 -1
- package/dist/core/skills-directory.js +5 -3
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
- package/dist/core/store-contracts/file-history-store-contract.js +26 -2
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
- package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/task-list-store-contract.js +28 -1
- package/dist/core/task-event.d.ts +48 -27
- package/dist/core/task-notification.d.ts +15 -9
- package/dist/core/task-notification.js +12 -0
- package/dist/core/task-registry-agent.d.ts +24 -22
- package/dist/core/task-registry-agent.js +65 -46
- package/dist/core/task-registry-shared.d.ts +17 -5
- package/dist/core/task-registry.d.ts +17 -6
- package/dist/core/task-registry.js +6 -1
- package/dist/core/task-result.d.ts +71 -25
- package/dist/core/task-spec-members.d.ts +0 -1
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +60 -52
- package/dist/core/task-stream.d.ts +45 -12
- package/dist/core/terminal-cause.d.ts +45 -8
- package/dist/core/terminal-cause.js +5 -0
- package/dist/core/tool-card-bound.d.ts +32 -0
- package/dist/core/tool-card-bound.js +33 -0
- package/dist/core/tool-catalog-entries.d.ts +9 -0
- package/dist/core/tool-catalog-entries.js +48 -0
- package/dist/core/tool-errors.d.ts +4 -3
- package/dist/core/tool-face.d.ts +3 -3
- package/dist/core/tool-mount-facts.d.ts +3 -2
- package/dist/core/tool-mount-facts.js +1 -1
- package/dist/core/tool-mount-static.js +7 -5
- package/dist/core/tool-policy.d.ts +21 -19
- package/dist/core/tool-policy.js +5 -6
- package/dist/core/tool-registry.d.ts +3 -1
- package/dist/core/tool-registry.js +15 -1
- package/dist/core/tool-result-store.d.ts +9 -3
- package/dist/core/tool-result-store.js +14 -1
- package/dist/core/tool-roster.d.ts +18 -0
- package/dist/core/tool-roster.js +30 -1
- package/dist/core/tool-spec.d.ts +17 -8
- package/dist/core/trace.d.ts +35 -31
- package/dist/core/types.d.ts +2 -2
- package/dist/core/untrusted-egress.d.ts +10 -9
- package/dist/core/untrusted-egress.js +9 -9
- package/dist/core/untrusted-text.d.ts +0 -18
- package/dist/core/untrusted-text.js +7 -3
- package/dist/core/user-attachment.d.ts +9 -6
- package/dist/core/user-attachment.js +12 -10
- package/dist/core/user-row-origin.d.ts +44 -25
- package/dist/core/user-row-origin.js +30 -20
- package/dist/core/wiring-manifest.d.ts +26 -7
- package/dist/core/wiring-manifest.js +14 -11
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
- package/dist/engine/execution-env/node-execution-env.js +127 -67
- package/dist/engine/harness/agent-harness.d.ts +4 -5
- package/dist/engine/harness/agent-harness.js +2 -7
- package/dist/engine/harness/types.d.ts +51 -19
- package/dist/engine/harness/types.js +28 -1
- package/dist/engine/llm/types.d.ts +26 -14
- package/dist/engine/llm/types.js +2 -2
- package/dist/engine/loop/agent-loop.d.ts +2 -2
- package/dist/engine/loop/agent-loop.js +51 -275
- package/dist/engine/loop/types.d.ts +0 -18
- package/dist/engine/session/import-validate.d.ts +3 -0
- package/dist/engine/session/import-validate.js +34 -2
- package/dist/engine/session/repo-utils.d.ts +42 -4
- package/dist/engine/session/repo-utils.js +33 -5
- package/dist/engine/session/session.d.ts +41 -14
- package/dist/engine/session/session.js +96 -25
- package/dist/index.d.ts +21 -16
- package/dist/index.js +16 -10
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -9
- package/dist/orchestration/run-workflow-tool.js +15 -19
- package/dist/orchestration/workflow-governance.js +13 -21
- package/dist/orchestration/workflow-observe.d.ts +4 -3
- package/dist/orchestration/workflow-primitives.d.ts +1 -1
- package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
- package/dist/orchestration/workflow-record-artifact.js +32 -0
- package/dist/orchestration/workflow-script-store.d.ts +9 -0
- package/dist/orchestration/workflow-script-store.js +20 -1
- package/dist/orchestration/workflow-types.d.ts +33 -3
- package/dist/orchestration/workflow.d.ts +24 -14
- package/dist/orchestration/workflow.js +52 -23
- package/dist/prompt-assembly/artifact.js +4 -8
- package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
- package/dist/prompt-assembly/catalog/engine.js +30 -0
- package/dist/prompt-assembly/catalog/index.d.ts +1 -1
- package/dist/prompt-assembly/catalog/index.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
- package/dist/prompt-assembly/epoch.js +6 -8
- package/dist/prompt-assembly/turn-snapshot.js +8 -9
- package/dist/stores/file/background-agent-store.js +5 -6
- package/dist/stores/file/checkpoint-store.d.ts +0 -4
- package/dist/stores/file/checkpoint-store.js +7 -3
- package/dist/stores/file/file-history-store.d.ts +8 -0
- package/dist/stores/file/file-history-store.js +72 -0
- package/dist/stores/file/fs-atomic.js +17 -12
- package/dist/stores/file/index.js +11 -5
- package/dist/stores/file/mailbox-store.js +13 -4
- package/dist/stores/file/permission-rule-store.js +14 -13
- package/dist/stores/file/shared-ledger.d.ts +4 -0
- package/dist/stores/file/shared-ledger.js +4 -0
- package/dist/stores/file/task-list-store.js +12 -3
- package/dist/stores/file/workflow-run-store.js +1 -0
- package/dist/tools/fs/bash-program-position.d.ts +4 -2
- package/dist/tools/fs/bash-program-position.js +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +1 -1
- package/dist/tools/fs/bound-open.d.ts +97 -0
- package/dist/tools/fs/bound-open.js +103 -0
- package/dist/tools/fs/containment-face.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.d.ts +7 -1
- package/dist/tools/fs/fs-pdf.js +31 -23
- package/dist/tools/fs/fs-read.d.ts +24 -17
- package/dist/tools/fs/fs-read.js +84 -53
- package/dist/tools/fs/fs-shared.d.ts +14 -12
- package/dist/tools/fs/fs-shared.js +5 -4
- package/dist/tools/fs/fs-write.d.ts +2 -2
- package/dist/tools/fs/fs-write.js +20 -12
- package/dist/tools/fs/index.d.ts +4 -4
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +12 -3
- package/dist/tools/fs/pdf.js +22 -9
- package/dist/tools/fs/read-deny-home.d.ts +3 -2
- package/dist/tools/fs/read-deny-home.js +8 -11
- package/dist/tools/fs/safety.d.ts +3 -2
- package/dist/tools/fs/shell-read-check.js +10 -9
- package/dist/tools/monitor.d.ts +6 -5
- package/dist/tools/task-list.d.ts +16 -6
- package/dist/tools/task-list.js +4 -0
- package/dist/tools/web.d.ts +9 -1
- package/dist/tools/web.js +8 -3
- package/dist/tools/worktree.d.ts +7 -5
- package/dist/tools/worktree.js +4 -3
- package/package.json +4 -3
- package/test/export-surface.snapshot.json +93 -7
- package/wire-changes/core-stores-sql@7.68.0.json +39 -0
- package/wire-changes/core-stores-sql@7.68.1.json +39 -0
- package/wire-changes/core@7.68.0.json +4257 -0
- package/wire-changes/core@7.68.1.json +95 -0
- package/wire-changes/mods-kernel@7.68.0.json +129 -0
- package/wire-changes/mods-kernel@7.68.1.json +39 -0
- package/wire-changes/primitives@7.68.0.json +253 -0
- package/wire-changes/primitives@7.68.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.0.json +39 -0
- package/wire-changes/wiki-gate@7.68.1.json +39 -0
- package/dist/core/runner/credential-origin-seat.d.ts +0 -2
- package/dist/core/runner/credential-origin-seat.js +0 -20
|
@@ -4,9 +4,10 @@ import { MARKED_BLOCK_AFTER_DATA, mintSystemReminder, openSystemReminder } from
|
|
|
4
4
|
import { isCleared } from "./context-edit.js";
|
|
5
5
|
import { pathConfinableWriteToolNames } from "./tool-registry.js";
|
|
6
6
|
import { writeTargetPath } from "../tools/fs/safety.js";
|
|
7
|
-
import { seededFileUnchangedReminder } from "../tools/fs/fs-shared.js";
|
|
8
7
|
export const READ_TOOL_NAMES = new Set(["read", "Read", "read_file"]);
|
|
9
8
|
const sha256 = (text) => createHash("sha256").update(text, "utf8").digest("hex");
|
|
9
|
+
const WHOLE_VIEW = "whole";
|
|
10
|
+
const wholeIdentity = (hash) => `w:${hash}`;
|
|
10
11
|
const isRecord = (v) => typeof v === "object" && v !== null;
|
|
11
12
|
const textOf = (content) => {
|
|
12
13
|
if (typeof content === "string")
|
|
@@ -23,18 +24,18 @@ const textOf = (content) => {
|
|
|
23
24
|
return out;
|
|
24
25
|
};
|
|
25
26
|
const RETIRED_READ_STUB = /^\[([\s\S]+): unchanged since you last read it \(lines (\d+)-(\d+) of (\d+)\); content omitted to save context\]$/;
|
|
27
|
+
const SEEDED_BODY = 'This file is already in your context (see "Contents of ';
|
|
28
|
+
const SEEDED_TAIL = '" above) and has not changed on disk. Use that content instead of re-reading.</system-reminder>';
|
|
26
29
|
const BARE_OPEN = openSystemReminder(undefined);
|
|
27
|
-
const [SEEDED_HEAD = "", SEEDED_TAIL = ""] = seededFileUnchangedReminder("\u0000", undefined).split("\u0000");
|
|
28
30
|
function retiredSeededPath(text) {
|
|
29
|
-
const
|
|
30
|
-
const at = text.indexOf(body);
|
|
31
|
+
const at = text.indexOf(SEEDED_BODY);
|
|
31
32
|
if (at <= 0 || !text.endsWith(SEEDED_TAIL))
|
|
32
33
|
return undefined;
|
|
33
34
|
const open = text.slice(0, at);
|
|
34
35
|
const mark = /^ mark="([^"]*)">$/.exec(open.slice(BARE_OPEN.length - 1))?.[1];
|
|
35
36
|
if (open !== BARE_OPEN && (mark === undefined || open !== openSystemReminder(mark)))
|
|
36
37
|
return undefined;
|
|
37
|
-
const path = text.slice(at +
|
|
38
|
+
const path = text.slice(at + SEEDED_BODY.length, text.length - SEEDED_TAIL.length);
|
|
38
39
|
return path.length > 0 ? path : undefined;
|
|
39
40
|
}
|
|
40
41
|
export function isRetiredDedupStub(m) {
|
|
@@ -96,8 +97,9 @@ function mintCopy(m) {
|
|
|
96
97
|
return undefined;
|
|
97
98
|
const view = obs.entry.view;
|
|
98
99
|
const whole = obs.entry.truncated === false;
|
|
99
|
-
const identity = frame.kind === "notebook" ? `nbf:${obs.entry.hash}` : whole ?
|
|
100
|
-
|
|
100
|
+
const identity = frame.kind === "notebook" ? `nbf:${obs.entry.hash}` : whole ? wholeIdentity(obs.entry.hash) : `fr:${obs.entry.hash}:${view?.start ?? 0}-${view?.end ?? 0}`;
|
|
101
|
+
const shown = frame.kind === "notebook" ? "nbf" : whole ? WHOLE_VIEW : `fr:${view?.start ?? 0}-${view?.end ?? 0}`;
|
|
102
|
+
return { carrier: "frame", attachment: frame, identity, view: shown, paths: [frame.label, obs.key] };
|
|
101
103
|
}
|
|
102
104
|
if (m.role !== "toolResult" || m.isError === true || typeof m.toolName !== "string" || !READ_TOOL_NAMES.has(m.toolName))
|
|
103
105
|
return undefined;
|
|
@@ -117,12 +119,12 @@ function mintCopy(m) {
|
|
|
117
119
|
const end = start + numLines - 1;
|
|
118
120
|
const hash = sha256(content);
|
|
119
121
|
const whole = start === 1 && end === total;
|
|
120
|
-
return { carrier: "read", filePath, window: { start, end, total }, identity: whole ?
|
|
122
|
+
return { carrier: "read", filePath, window: { start, end, total }, identity: whole ? wholeIdentity(hash) : `rr:${hash}:${start}-${end}:${total}`, view: whole ? WHOLE_VIEW : `rr:${start}-${end}`, paths: [filePath] };
|
|
121
123
|
}
|
|
122
124
|
if (details.type === "notebook") {
|
|
123
125
|
if (!Array.isArray(file.cells) || file.cells.length === 0)
|
|
124
126
|
return undefined;
|
|
125
|
-
return { carrier: "read", filePath, identity: `nbr:${sha256(JSON.stringify(m.content))}`, paths: [filePath] };
|
|
127
|
+
return { carrier: "read", filePath, identity: `nbr:${sha256(JSON.stringify(m.content))}`, view: "nbr", paths: [filePath] };
|
|
126
128
|
}
|
|
127
129
|
return undefined;
|
|
128
130
|
}
|
|
@@ -148,13 +150,18 @@ function writtenNames(m) {
|
|
|
148
150
|
}
|
|
149
151
|
return out;
|
|
150
152
|
}
|
|
153
|
+
const sameFile = (spelling, key) => spelling === key || baseName(spelling) === baseName(key);
|
|
154
|
+
const holds = (h, spelling) => h.paths.has(spelling) || (h.seed === true && [...h.paths].some((key) => sameFile(spelling, key)));
|
|
151
155
|
class CopyWalk {
|
|
152
156
|
input;
|
|
153
157
|
heads = new Map();
|
|
154
|
-
seedBroken = new Set();
|
|
155
158
|
told = new Set();
|
|
156
159
|
constructor(input) {
|
|
157
160
|
this.input = input;
|
|
161
|
+
for (const [key, hash] of input.seeded ?? []) {
|
|
162
|
+
const identity = wholeIdentity(hash);
|
|
163
|
+
this.heads.set(identity, [...(this.heads.get(identity) ?? []), { paths: new Set([key]), pointer: false, view: WHOLE_VIEW, seed: true }]);
|
|
164
|
+
}
|
|
158
165
|
}
|
|
159
166
|
toldBefore(f) {
|
|
160
167
|
const key = `${f.mtimeMs}\u0000${f.path}`;
|
|
@@ -163,60 +170,43 @@ class CopyWalk {
|
|
|
163
170
|
this.told.add(key);
|
|
164
171
|
return false;
|
|
165
172
|
}
|
|
166
|
-
|
|
167
|
-
if (names.length === 0)
|
|
168
|
-
return;
|
|
169
|
-
const hit = new Set(names);
|
|
173
|
+
end(ends) {
|
|
170
174
|
for (const [identity, list] of this.heads) {
|
|
171
|
-
const kept = list.filter((h) => !
|
|
175
|
+
const kept = list.filter((h) => !ends(h));
|
|
172
176
|
if (kept.length === 0)
|
|
173
177
|
this.heads.delete(identity);
|
|
174
|
-
else
|
|
178
|
+
else if (kept.length < list.length)
|
|
175
179
|
this.heads.set(identity, kept);
|
|
176
180
|
}
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
}
|
|
182
|
+
write(names) {
|
|
183
|
+
if (names.length === 0)
|
|
184
|
+
return;
|
|
185
|
+
const hit = new Set(names);
|
|
186
|
+
this.end((h) => [...h.paths].some((p) => hit.has(baseName(p))));
|
|
179
187
|
}
|
|
180
188
|
decide(d) {
|
|
181
189
|
if ("retired" in d)
|
|
182
190
|
return "pointer";
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
return "seeded";
|
|
186
|
-
for (const key of this.input.seeded?.keys() ?? [])
|
|
187
|
-
if (d.paths.some((p) => sameFile(p, key)) && this.input.seeded?.get(key) !== d.wholeHash)
|
|
188
|
-
this.seedBroken.add(key);
|
|
191
|
+
const standsFor = d.carrier === "frame";
|
|
192
|
+
const pointer = this.input.degraded?.has(d.identity) === true;
|
|
189
193
|
const list = this.heads.get(d.identity) ?? [];
|
|
190
|
-
const head = list.find((h) => d.paths.some((p) => h
|
|
194
|
+
const head = list.find((h) => d.paths.some((p) => holds(h, p)));
|
|
191
195
|
if (head !== undefined) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
196
|
+
if (head.seed !== true)
|
|
197
|
+
for (const p of d.paths)
|
|
198
|
+
head.paths.add(p);
|
|
199
|
+
if (!standsFor)
|
|
200
|
+
return pointer ? "pointer" : "contents";
|
|
201
|
+
return head.seed === true ? "seeded" : head.pointer ? "pointer" : "not_repeated";
|
|
195
202
|
}
|
|
196
|
-
|
|
197
|
-
this.heads.set(d.identity, [...
|
|
203
|
+
this.end((h) => h.view === d.view && d.paths.some((p) => holds(h, p)));
|
|
204
|
+
this.heads.set(d.identity, [...(this.heads.get(d.identity) ?? []), { paths: new Set(d.paths), pointer, view: d.view }]);
|
|
198
205
|
return pointer ? "pointer" : "contents";
|
|
199
206
|
}
|
|
200
207
|
}
|
|
201
|
-
|
|
202
|
-
function seededKeyOf(d, seeded) {
|
|
203
|
-
if (seeded === undefined || d.wholeHash === undefined)
|
|
204
|
-
return undefined;
|
|
205
|
-
for (const [key, hash] of seeded)
|
|
206
|
-
if (hash === d.wholeHash && d.paths.some((p) => sameFile(p, key)))
|
|
207
|
-
return key;
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
|
-
function readSentence(d, rendering, input) {
|
|
211
|
-
const r = d;
|
|
212
|
-
if (rendering === "seeded")
|
|
213
|
-
return seededFileUnchangedReminder(seededKeyOf(d, input.seeded) ?? r.filePath, input.mark);
|
|
208
|
+
function readPointerSentence(r) {
|
|
214
209
|
const w = r.window;
|
|
215
|
-
if (rendering === "not_repeated") {
|
|
216
|
-
return w !== undefined
|
|
217
|
-
? `[${r.filePath}: unchanged since you last read it (lines ${w.start}-${w.end} of ${w.total}); content omitted to save context]`
|
|
218
|
-
: `[${r.filePath}: unchanged since you last read it (the whole notebook); content omitted to save context]`;
|
|
219
|
-
}
|
|
220
210
|
return w !== undefined
|
|
221
211
|
? `[${r.filePath}: lines ${w.start}-${w.end} of ${w.total} — contents not included in this result; read the file again if you need them]`
|
|
222
212
|
: `[${r.filePath}: contents not included in this result; read the file again if you need them]`;
|
|
@@ -277,7 +267,7 @@ function renderOne(m, walk, input) {
|
|
|
277
267
|
const d = deliveryOf(p);
|
|
278
268
|
const rendering = d === undefined ? "contents" : walk.decide(d);
|
|
279
269
|
const own = isRecord(p) && Array.isArray(p.content) ? p.content : [];
|
|
280
|
-
return rendering === "contents" || d
|
|
270
|
+
return rendering === "contents" || d?.carrier !== "read" ? own : [{ type: "text", text: readPointerSentence(d) }];
|
|
281
271
|
});
|
|
282
272
|
if (parts.every((p, i) => segments[i] === (isRecord(p) && Array.isArray(p.content) ? p.content : undefined)))
|
|
283
273
|
return m;
|
|
@@ -292,7 +282,7 @@ function renderOne(m, walk, input) {
|
|
|
292
282
|
return m;
|
|
293
283
|
if (d.carrier === "frame")
|
|
294
284
|
return renderFrame(m, d.attachment, rendering, input);
|
|
295
|
-
return Object.assign({}, m, { content: [{ type: "text", text:
|
|
285
|
+
return Object.assign({}, m, { content: [{ type: "text", text: readPointerSentence(d) }], details: undefined });
|
|
296
286
|
}
|
|
297
287
|
const NOTICE_SEPARATOR_MAX = 2;
|
|
298
288
|
const untoldFilesOf = (n, walk) => n.files.filter((f) => !walk.toldBefore(f));
|
|
@@ -61,7 +61,7 @@ export function resumeConfigVerdictOf(question, seats) {
|
|
|
61
61
|
const supplied = readResumeConfig(question.taskConfig);
|
|
62
62
|
const internals = snapshotResumeInternals(bag);
|
|
63
63
|
resolveResumeStore(supplied, seats.deps);
|
|
64
|
-
const config = refuseResumeDoors(supplied, seats.deps, seats.sessions, internals
|
|
64
|
+
const config = refuseResumeDoors(supplied, seats.deps, seats.sessions, internals);
|
|
65
65
|
refuseRecordedAndMountedToolNames(row, internals, config.tools);
|
|
66
66
|
refuseRetiredInheritedConstraints(internals);
|
|
67
67
|
refuseScopesOffInheritedIsolationScope(row.isolationScope || undefined, config.isolationScope || undefined, config);
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* terminal code — never from its sentence; a code this table does not name reads as ABSENT (not known),
|
|
7
7
|
* which each consumer answers in its own documented way rather than with a guessed cause.
|
|
8
8
|
*
|
|
9
|
-
* · `environment` — the leg's infrastructure failed (the workspace restore, an abort
|
|
10
|
-
* untouched, and a retry replays it;
|
|
9
|
+
* · `environment` — the leg's infrastructure failed (the workspace restore, an abort, an `env.*` refusal of the
|
|
10
|
+
* execution environment): the decision is untouched, and a retry replays it;
|
|
11
11
|
* · `session_gone` — the resumed agent's transcript session is missing;
|
|
12
12
|
* · `transcript_corrupt` — the resumed agent's transcript session is THERE but cannot be read as a session
|
|
13
13
|
* (`corrupt_session`): its log has no header its store wrote, or its entry tree does not hold together — a leaf,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
27
27
|
import type { Checkpoint, CheckpointStore, CheckpointToken } from "./checkpoint-store.js";
|
|
28
|
-
import type { TerminalFailureDetail } from "./terminal-cause.js";
|
|
28
|
+
import type { TerminalFailureDetail, UnstartedRowOutcome } from "./terminal-cause.js";
|
|
29
29
|
/**
|
|
30
30
|
* design/80 D-1: why a consumed checkpoint was {@link import("./checkpoint-store.js").CheckpointStore.reopen | reopened}
|
|
31
31
|
* (resolved → pending). The reason drives re-resume validation (§3 invariant #1): an `env_failed` reopen is a SYSTEM
|
|
@@ -52,7 +52,10 @@ export type ReopenReason = (typeof REOPEN_REASONS)[number];
|
|
|
52
52
|
export declare const RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"];
|
|
53
53
|
export type ResumeStartupCause = (typeof RESUME_STARTUP_CAUSES)[number];
|
|
54
54
|
/** The cause a resume failure's code names; `undefined` when the code is absent or the table does not
|
|
55
|
-
* name it. Every `config.*` code is a configuration door's refusal
|
|
55
|
+
* name it. Every `config.*` code is a configuration door's refusal; every `env.*` code is the execution environment's
|
|
56
|
+
* own (a refusal its adapter answered when the leg established it, or the engine's `env.lifetime_expired`). The
|
|
57
|
+
* terminal code table files the same namespace under `WorkerErrorClass` `config` — that answers which class and what
|
|
58
|
+
* to change; this answers why the resume could not run. */
|
|
56
59
|
export declare function resumeStartupCauseOf(code: string | undefined): ResumeStartupCause | undefined;
|
|
57
60
|
/**
|
|
58
61
|
* The members of a resume refusal's `detail` the parked-resume receipt carries beside its `cause` — the three a
|
|
@@ -86,22 +89,32 @@ export type ReopenReasonTableCoversEveryCause = AssertAllKeysHandled<Exclude<Res
|
|
|
86
89
|
* decision is untouched, and the retry replays it.
|
|
87
90
|
*/
|
|
88
91
|
export declare function reopenReasonOf(cause: ResumeStartupCause | undefined): ReopenReason;
|
|
92
|
+
/** The facts each {@link UnstartedRowOutcome} word carries in the engine's own record — a table over the one word set, total both ways. */
|
|
93
|
+
interface UnstartedRowFacts {
|
|
94
|
+
/** the reason the row was reopened under (pending again) */
|
|
95
|
+
readonly reopened: {
|
|
96
|
+
readonly reason: ReopenReason;
|
|
97
|
+
};
|
|
98
|
+
/** the store's `reopen` answered `false`: the row is no longer the resolved row this leg claimed — missing, expired, its decided
|
|
99
|
+
* action already disposed, or pending again — which the boolean does not say */
|
|
100
|
+
readonly declined: object;
|
|
101
|
+
/** what the reopen threw, when the row does not show it landed: the write may have committed and only its acknowledgement been
|
|
102
|
+
* lost, so the row's state cannot be proven from here */
|
|
103
|
+
readonly unknown: {
|
|
104
|
+
readonly thrown: unknown;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export type UnstartedRowFactsCoverEveryOutcome = AssertAllKeysHandled<Exclude<UnstartedRowOutcome, keyof UnstartedRowFacts> | Exclude<keyof UnstartedRowFacts, UnstartedRowOutcome>>;
|
|
89
108
|
/**
|
|
90
109
|
* What happened to a claimed row whose approved action never started — the one closed outcome every exit of such a leg reports
|
|
91
|
-
* (the thrown-prepare backstop, the returned-leg settle, the post-claim abort)
|
|
92
|
-
*
|
|
93
|
-
* decided action already disposed, or pending again — which the boolean does not say), `unknown` (the reopen threw and the row does not
|
|
94
|
-
* show that it landed: the write may have committed and only its acknowledgement been lost, so the row's state cannot be proven from here).
|
|
110
|
+
* (the thrown-prepare backstop, the returned-leg settle, the post-claim abort), its word ({@link UnstartedRowOutcome}, the one
|
|
111
|
+
* declaration every carrier reads) beside the facts that word carries ({@link UnstartedRowFacts}).
|
|
95
112
|
*/
|
|
96
113
|
export type UnstartedRow = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
} | {
|
|
102
|
-
readonly kind: "unknown";
|
|
103
|
-
readonly thrown: unknown;
|
|
104
|
-
};
|
|
114
|
+
[K in UnstartedRowOutcome]: {
|
|
115
|
+
readonly kind: K;
|
|
116
|
+
} & UnstartedRowFacts[K];
|
|
117
|
+
}[UnstartedRowOutcome];
|
|
105
118
|
/**
|
|
106
119
|
* THE compensation of a claimed leg whose approved action never started: the claim's reversal (`reopen`, bound to the row) asked once,
|
|
107
120
|
* under `reason`, and read into {@link UnstartedRow} — its answer, never a code sniffed off whatever it threw (a store's own error may
|
|
@@ -117,6 +130,10 @@ export declare function compensateUnstarted(reopen: (reason: ReopenReason) => Pr
|
|
|
117
130
|
* reopen having landed. A pending row at the claim's own generation is a read older than the claim, and proves nothing.
|
|
118
131
|
*/
|
|
119
132
|
export declare function claimedRowPendingOf(store: Pick<CheckpointStore, "get">, token: CheckpointToken, claimed: Pick<Checkpoint, "rev">): () => Promise<boolean>;
|
|
120
|
-
/** The sentence for {@link UnstartedRow} — one per outcome, the same on every exit; the exit puts its own lead before it.
|
|
121
|
-
|
|
133
|
+
/** The sentence for {@link UnstartedRow} — one per outcome, the same on every exit; the exit puts its own lead before it. What
|
|
134
|
+
* never started and what the person gave are named by the kind of pause the claimed row was ({@link parkNounOf}): a wake is
|
|
135
|
+
* not an approval. Each says what happened, whether the pause is still waiting, and what to do — `declined` (the engine asked to put
|
|
136
|
+
* the pause back and was told it no longer is the one the resume took) and `unknown` (the attempt failed partway: it may or may not
|
|
137
|
+
* be waiting) differ in the one thing a reader must not do: ask for a new grant while the old one may still be usable. */
|
|
138
|
+
export declare function unstartedRowSentence(row: UnstartedRow, parked: Pick<Checkpoint, "pendingAction"> | undefined): string;
|
|
122
139
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { checkpointRevOf } from "./checkpoint-generation.js";
|
|
2
|
+
import { parkNounOf } from "./park-noun.js";
|
|
2
3
|
import { egressThrownText } from "./untrusted-egress.js";
|
|
3
4
|
export const REOPEN_REASONS = Object.freeze(["env_failed", "tool_unavailable", "constraint_rejected", "config_refused"]);
|
|
4
5
|
export const RESUME_STARTUP_CAUSES = Object.freeze(["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"]);
|
|
@@ -23,7 +24,7 @@ const CAUSE_OF_CODE = new Map([
|
|
|
23
24
|
export function resumeStartupCauseOf(code) {
|
|
24
25
|
if (code === undefined)
|
|
25
26
|
return undefined;
|
|
26
|
-
return CAUSE_OF_CODE.get(code) ?? (code.startsWith("config.") ? "configuration" : undefined);
|
|
27
|
+
return CAUSE_OF_CODE.get(code) ?? (code.startsWith("config.") ? "configuration" : code.startsWith("env.") ? "environment" : undefined);
|
|
27
28
|
}
|
|
28
29
|
export const RESUME_REFUSAL_MEMBERS = Object.freeze(["code", "field", "reason"]);
|
|
29
30
|
export function resumeRefusalDetailOf(account) {
|
|
@@ -64,25 +65,27 @@ export function claimedRowPendingOf(store, token, claimed) {
|
|
|
64
65
|
return row !== null && row.status === "pending" && checkpointRevOf(row) > claimedRev;
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
export function unstartedRowSentence(row) {
|
|
68
|
+
export function unstartedRowSentence(row, parked) {
|
|
69
|
+
const noun = parkNounOf(parked);
|
|
68
70
|
switch (row.kind) {
|
|
69
71
|
case "reopened":
|
|
70
|
-
return reopenedUnstartedSentence(row.reason);
|
|
72
|
+
return reopenedUnstartedSentence(row.reason, noun);
|
|
71
73
|
case "declined":
|
|
72
|
-
return
|
|
74
|
+
return `${noun.started} never started, and ${noun.waiting} could not be put back to waiting: it is no longer the one this resume took (it is gone, has expired, was already used, or is waiting again). Check where it stands now before deciding anything: if it is waiting again, ${noun.again}; if it is gone or already used, carrying on needs a fresh ${noun.grant}`;
|
|
73
75
|
case "unknown":
|
|
74
|
-
return
|
|
76
|
+
return `${noun.started} never started, and putting ${noun.waiting} back to waiting failed partway (${egressThrownText("same-principal", row.thrown)}), so it is not known whether it is waiting now. Check where it stands before deciding anything, and do not ask for a fresh ${noun.grant} until that is known: the old one may still be usable`;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
|
-
function reopenedUnstartedSentence(reason) {
|
|
79
|
+
function reopenedUnstartedSentence(reason, noun) {
|
|
80
|
+
const lead = `${noun.started} never started, so the checkpoint was REOPENED (pending)`;
|
|
78
81
|
switch (reason) {
|
|
79
82
|
case "env_failed":
|
|
80
|
-
return
|
|
83
|
+
return `${lead}: the same ${noun.grant} can be resumed again — ${noun.again}; do not ask for a fresh one`;
|
|
81
84
|
case "config_refused":
|
|
82
|
-
return
|
|
85
|
+
return `${lead}: the deployment's configuration refused the resumed leg, so resuming under the same configuration fails the same way — correct the configuration, then ${noun.again}, or decide afresh`;
|
|
83
86
|
case "tool_unavailable":
|
|
84
|
-
return
|
|
87
|
+
return `${lead}: the tool it needs is not available to the resumed leg, so this ${noun.grant} cannot run — decide afresh`;
|
|
85
88
|
case "constraint_rejected":
|
|
86
|
-
return
|
|
89
|
+
return `${lead}: the decided input was refused, so decide afresh`;
|
|
87
90
|
}
|
|
88
91
|
}
|