@sema-agent/core 7.67.3 → 7.68.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 +1516 -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 +25 -1
- package/dist/core/checkpoint-requirements.js +5 -1
- 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 +6 -0
- package/dist/core/tool-roster.js +18 -0
- 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@7.68.0.json +4257 -0
- package/wire-changes/mods-kernel@7.68.0.json +129 -0
- package/wire-changes/primitives@7.68.0.json +253 -0
- package/wire-changes/wiki-gate@7.68.0.json +39 -0
- package/dist/core/runner/credential-origin-seat.d.ts +0 -2
- package/dist/core/runner/credential-origin-seat.js +0 -20
|
@@ -523,24 +523,19 @@ export type TaskEvent = ({
|
|
|
523
523
|
*/
|
|
524
524
|
output?: unknown;
|
|
525
525
|
/**
|
|
526
|
-
* design/116 (b) — the tool's CC-shaped `toolUseResult` facts
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
* a2a/path_not_in_root/readonly_out_of_root/read_unestablished/advisor), surfaced on the live wire so a CC-faithful shell
|
|
532
|
-
* renders rich cards (red/green diff, stdout panes, file cards) without re-parsing the
|
|
533
|
-
* model-facing string. Absent when the tool carries no card shape or when the serialized card
|
|
534
|
-
* exceeds the size bound (omitted whole; a consumer falls back to `output`).
|
|
526
|
+
* design/116 (b) — the tool's CC-shaped `toolUseResult` facts: `details.type` ∈ the engine's card set (`engineCardTypes()`,
|
|
527
|
+
* derived from the tool catalog) ∪ the leg's caller-declared `renderHints.resultCards`, surfaced on the live wire so a
|
|
528
|
+
* CC-faithful shell renders rich cards (red/green diff, stdout panes, file cards) without re-parsing the model-facing
|
|
529
|
+
* string. Absent when the tool carries no card shape or when the serialized card exceeds the size bound (omitted whole;
|
|
530
|
+
* its skeleton — facts, not a card to render — may ride {@link structuredSkeleton}; the display falls back to `output`).
|
|
535
531
|
* UNTRUSTED RAW like {@link output}: a consumer MUST redact before persisting or forwarding.
|
|
536
532
|
*
|
|
537
|
-
* **The card set is a two-way contract
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* replay mints `type:"edit"` with an `edits[]` array; core mounts no memory tool at all).
|
|
533
|
+
* **The card set is a two-way contract**: every entry has a tool that mints it and every minted card is registered — a
|
|
534
|
+
* consumer switching on `details.type` meets no promise nothing keeps and no card it was never told about.
|
|
535
|
+
*
|
|
536
|
+
* The four **file** cards (`create` / `update` / `edit` / `notebook-edit`) carry `contentSha256` — **NOT a digest of the bytes
|
|
537
|
+
* on disk** (`sha256sum` of the file differs whenever it has a BOM or CRLF endings): the hex sha-256 of the file's TEXT as the
|
|
538
|
+
* engine reads it back after this write (decoded, BOM dropped, CRLF as LF), the value its read-before-write check holds.
|
|
544
539
|
*
|
|
545
540
|
* The **advisor** card (`type:"advisor"`, the advisor tool's every call) carries closed words, numbers and catalog ids
|
|
546
541
|
* only — `outcome` (`reviewed` / `declined` / `unavailable`, and `isError` ⇔ `unavailable`), `model`, `servedModel?`,
|
|
@@ -565,9 +560,7 @@ export type TaskEvent = ({
|
|
|
565
560
|
* Both Agent shapes ride `type:"agent"` and are told apart by `status`: `"async_launched"` is the
|
|
566
561
|
* background launch RECEIPT (task_id / description / prompt), any other value is the completed
|
|
567
562
|
* landing report (`result` / `stats` / `resolvedModel` / `toolStats` / kept `worktreePath` /
|
|
568
|
-
* failure attribution). Branch on `status`, never on which keys happen to be present.
|
|
569
|
-
* 2026-08-05 only the receipt actually arrived — the completed delivery carried no `type` and was
|
|
570
|
-
* dropped by the allowlist, so this paragraph described something a host could not observe.)
|
|
563
|
+
* failure attribution). Branch on `status`, never on which keys happen to be present.
|
|
571
564
|
* A host/shell MUST render from `structured` and MUST NOT parse the model-facing text back into data
|
|
572
565
|
* (trailer wording is model-audience prose and may change without notice); symmetrically, core never
|
|
573
566
|
* strips the trailer from the model face just because the structured face exists — the model still needs
|
|
@@ -575,6 +568,15 @@ export type TaskEvent = ({
|
|
|
575
568
|
* not to scrape it.
|
|
576
569
|
*/
|
|
577
570
|
structured?: unknown;
|
|
571
|
+
/**
|
|
572
|
+
* The SKELETON of a card left off {@link structured} by the size measure (a card with no JSON measures infinite) — never
|
|
573
|
+
* beside it: which of the two is present says whether the card is whole. `type` plus the members its kind declares
|
|
574
|
+
* fixed-length (`CARD_SKELETONS`), as the tool wrote them: a file card keeps its path and `contentSha256`, a caller-declared
|
|
575
|
+
* card `type` alone. Absent when not even that fits or a declared member cannot be read. UNTRUSTED RAW like `structured`.
|
|
576
|
+
*/
|
|
577
|
+
structuredSkeleton?: {
|
|
578
|
+
type: string;
|
|
579
|
+
} & Record<string, unknown>;
|
|
578
580
|
/**
|
|
579
581
|
* Present iff {@link isError} is true AND the harness result's `details` carried a string
|
|
580
582
|
* discriminator — read as `details.code` first, falling back to `details.errorKind` (each must be
|
|
@@ -809,6 +811,13 @@ export type TaskEvent = ({
|
|
|
809
811
|
cacheReadTokens: number;
|
|
810
812
|
cacheWriteTokens: number;
|
|
811
813
|
costMicroUsd: number;
|
|
814
|
+
/** Wall time, in milliseconds, of this turn's model calls, summed — each call from the moment the engine hands the request to
|
|
815
|
+
* the brain to its final message (the `brain.call` row's `ts − callStartedAt`; a failover walk is one call, its abandoned hops'
|
|
816
|
+
* time inside it). A request the loop re-sends in the turn and shows (a refused image sent again without it) counts; one it
|
|
817
|
+
* withholds and retries (a prompt-too-long recovery) is not seen. A call with no stamp adds 0 (a hop a fallback walk left
|
|
818
|
+
* behind, a turn no model answered). Present on every `turn_end` this engine mints. The leg's total, one run's not a
|
|
819
|
+
* session's, is `TaskResult.stats.apiDurationMs` (the reference result's `duration_api_ms`; this per-turn member is ours). */
|
|
820
|
+
apiDurationMs?: number;
|
|
812
821
|
};
|
|
813
822
|
/** TB 尸检 T1-5: set when the turn ended WITHOUT a provider usage frame (e.g. a degenerate-repetition
|
|
814
823
|
* cutoff cancelled the stream before usage arrived) or the brain flagged its frame unknown. Consumers
|
|
@@ -1052,8 +1061,8 @@ export type TaskEvent = ({
|
|
|
1052
1061
|
* `nested_memory` (additive member): an instruction file of a directory the run accessed (or a rule the deployment
|
|
1053
1062
|
* supplied for an accessed path; the family `NESTED_MEMORY_LANE.declaration` names) reached the model — one event per file, at
|
|
1054
1063
|
* the receipt of the frame that carried it; `preview` is the file's path (the rule's name), never its contents.
|
|
1055
|
-
* `project_instructions` (additive member): the same for an instruction file of
|
|
1056
|
-
* instructions, read by the same lane). Either word, a frame that WITHDREW a file delivered earlier (removed since, or
|
|
1064
|
+
* `project_instructions` (additive member): the same for an instruction file of a root's own level — the task root's, or an
|
|
1065
|
+
* additional working directory's under the family's opt-in (the session's instructions, read by the same lane). Either word, a frame that WITHDREW a file delivered earlier (removed since, or
|
|
1057
1066
|
* holding nothing now) echoes with its path and the words `(withdrawn: it no longer applies)`. The retired
|
|
1058
1067
|
* `instructions_change` member was the echo of a deployment-probed hash notice about the session's instruction file;
|
|
1059
1068
|
* the lane now sends the whole changed file, or its withdrawal.
|
|
@@ -1423,10 +1432,10 @@ export type TaskEvent = ({
|
|
|
1423
1432
|
byPath?: true;
|
|
1424
1433
|
};
|
|
1425
1434
|
/** The session's checkout (`TaskSpec.workspace`), one entry per repository, fixed by the session's first leg:
|
|
1426
|
-
* `repository` = the repository's root; `root` =
|
|
1427
|
-
* code starts from. `dir` / `name` / `branch` / `baseRef` (present together) = the session's own tree of that
|
|
1428
|
-
* repository
|
|
1429
|
-
*
|
|
1435
|
+
* `repository` = the repository's root; `root` = the declared root the entry was made for; `baseSha` = the commit the
|
|
1436
|
+
* session's code starts from. `dir` / `name` / `branch` / `baseRef` (present together) = the session's own tree of that
|
|
1437
|
+
* repository, where every declared root in it works (`root` above, `directories` below). `source` = the declared code
|
|
1438
|
+
* source for that repository. ABSENT = the session declared no workspace, or this leg sent `workspace: null`. */
|
|
1430
1439
|
session?: ReadonlyArray<{
|
|
1431
1440
|
repository: string;
|
|
1432
1441
|
root: "taskRoot" | {
|
|
@@ -1449,6 +1458,9 @@ export type TaskEvent = ({
|
|
|
1449
1458
|
isolation?: "worktree";
|
|
1450
1459
|
baseRef?: "fresh" | "head";
|
|
1451
1460
|
name?: string;
|
|
1461
|
+
roots?: ReadonlyArray<"taskRoot" | {
|
|
1462
|
+
directory: string;
|
|
1463
|
+
}>;
|
|
1452
1464
|
sources?: ReadonlyArray<{
|
|
1453
1465
|
root: "taskRoot" | {
|
|
1454
1466
|
directory: string;
|
|
@@ -1458,6 +1470,15 @@ export type TaskEvent = ({
|
|
|
1458
1470
|
ref?: string;
|
|
1459
1471
|
}>;
|
|
1460
1472
|
};
|
|
1473
|
+
/** This leg's additional roots (`additionalDirectories` as `write`, `additionalReadDirectories` as `read`) where each stands:
|
|
1474
|
+
* `at` (canonical) = its place in its repository's session tree, `tree` = that tree's `dir` (present iff so), else where
|
|
1475
|
+
* declared. An entry that cannot be resolved is no root and is not listed. ABSENT = the leg has no additional root. */
|
|
1476
|
+
directories?: ReadonlyArray<{
|
|
1477
|
+
declared: string;
|
|
1478
|
+
at: string;
|
|
1479
|
+
access: "write" | "read";
|
|
1480
|
+
tree?: string;
|
|
1481
|
+
}>;
|
|
1461
1482
|
/** This leg's project identity, decided ONCE at leg start and fixed for the leg: `marker` = the checkout's
|
|
1462
1483
|
* `.sema/project` (a `TaskSpec.projectId`, when given, equals it); `declared` = `TaskSpec.projectId` in a checkout
|
|
1463
1484
|
* that carries no marker. ABSENT = no marker and no declaration, or the marker could not be read (the deployment's
|
|
@@ -1556,8 +1577,8 @@ export interface HumanInputAttachment {
|
|
|
1556
1577
|
* - `"failed"` — the attempt ran and threw (summarizer failure / empty summary / oversized summary;
|
|
1557
1578
|
* `compaction.failed` trace frame + `Runner.onError(phase:"compaction")`), or the §17.4 breaker was
|
|
1558
1579
|
* already open so the request was drained without an attempt (`compaction.failed` frame, no attempt).
|
|
1559
|
-
* - `"mooted"` —
|
|
1560
|
-
*
|
|
1580
|
+
* - `"mooted"` — taken but never served: its caller withdrew it, the run could no longer compact (dying loop: abort / durable suspend /
|
|
1581
|
+
* plan review in flight), or the task settled before any boundary arrived. A request made at {@link TaskStream.inputWindow} `"over"` is refused, not taken.
|
|
1561
1582
|
* - `"noop"` — the attempt ran but there was nothing to compact (no valid cut point / empty history).
|
|
1562
1583
|
* - `"blocked"` — a `preCompact` hook deliberately blocked this compaction (not a failure).
|
|
1563
1584
|
* - `"disabled"` — requested compaction is switched off: the `manualCompact` seat is `false` (the task's
|
|
@@ -74,15 +74,14 @@ export interface TaskNotificationPayload {
|
|
|
74
74
|
* entry. Its SEMANTICS are per-task_type (design/144 §1.1):
|
|
75
75
|
* - `monitor`: the `status:"event"` BATCH counter (design/135 G2) — one per stdout batch window;
|
|
76
76
|
* terminal notifications omit it (one per status, as before).
|
|
77
|
-
* - `background_agent`: the STOP-CYCLE number
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* number. So `seq` present does NOT imply a retain entry exists.
|
|
77
|
+
* - `background_agent`: the STOP-CYCLE number — the row's, as the claim that opened the cycle wrote
|
|
78
|
+
* it. First settle (spawn stop) = 1; every won wake — the retained fast lane, a tier-3 or drain
|
|
79
|
+
* revival, a parked resume's consume flip, in this process or another — writes one past the row's,
|
|
80
|
+
* so the woken run's settle notifies with the next number and one row's numbers never repeat: a
|
|
81
|
+
* stop→wake→stop second-cycle frame is not swallowed by the dedup key, whichever lanes ran the
|
|
82
|
+
* cycles. Always present on a background row's frames (retained or not, fork lane included: the attempt
|
|
83
|
+
* reads it once, when its claim won, so a row collected before its unwind keeps it) and on a synchronously
|
|
84
|
+
* born child's woken cycles (2, 3, … — its first cycle sends no notification).
|
|
86
85
|
* - `external`: caller-supplied verbatim ({@link ExternalNotificationInput.seq}) — the injector's
|
|
87
86
|
* own dedup discriminator across same-task_id+status events.
|
|
88
87
|
* Consumers (server inbox fold / shell render) key `taskId:status[:seq]` — a frame WITHOUT seq keeps
|
|
@@ -204,6 +203,9 @@ export interface TaskNotificationPayload {
|
|
|
204
203
|
recentSteps?: import("../agents/subagent-steps.js").SubagentStep[];
|
|
205
204
|
/** Residual lane D (core half) — files the child mutated with edit counts. Background-agent lane only. */
|
|
206
205
|
editedFiles?: import("../agents/subagent-steps.js").SubagentEditedFile[];
|
|
206
|
+
/** What the child did NOT get done: its `TaskResult.refusedAsks` (asks nobody could answer, refused), rendered by
|
|
207
|
+
* {@link refusedAsksText}. Present only when at least one ask was refused. Background-agent lane only. */
|
|
208
|
+
refusedAsks?: readonly import("./task-result.js").RefusedAsk[];
|
|
207
209
|
/** Residual lane E — `true` when the child can be revived via SendMessage: a live retained session that
|
|
208
210
|
* was not killed, OR a NAMED durable row that no USER stop closed (a parent teardown / reap / host
|
|
209
211
|
* death is what the durable revival lane recovers from). Judged by the revival ladder's own
|
|
@@ -399,6 +401,10 @@ export interface SystemInjection<TPayload = unknown> {
|
|
|
399
401
|
* fire-and-forget producer (no receipt to honor). */
|
|
400
402
|
onDisposition?: (d: NotificationDisposition) => void;
|
|
401
403
|
}
|
|
404
|
+
/** The one text a leg's refused asks read as, wherever a parent reads them (the sub-agent report's `refused_asks:` line, the
|
|
405
|
+
* completion notification's `refused-asks` tag) — read off `TaskResult.refusedAsks` alone: how many, each call's tool and why
|
|
406
|
+
* nobody answered it (the closed cause words), that they did not run, and the ways out the refusals named. */
|
|
407
|
+
export declare function refusedAsksText(refused: readonly import("./task-result.js").RefusedAsk[]): string;
|
|
402
408
|
/** design/373 (adversarial r3, recorded rule): the key deliberately EXCLUDES the injection tier.
|
|
403
409
|
* The key names an EVENT's identity; `priority` is delivery metadata about one submission of it.
|
|
404
410
|
* A repeat under an in-flight key therefore FOLDS regardless of the repeat's tier — the tier of
|
|
@@ -5,6 +5,7 @@ import { egressText } from "./untrusted-egress.js";
|
|
|
5
5
|
import { redactThenCut } from "../agents/subagent-steps.js";
|
|
6
6
|
import { PEER_MESSAGE_NOTICE } from "../agents/peer-admission.js";
|
|
7
7
|
import { buildCrossSessionEnvelope, CROSS_PRINCIPAL_MESSAGE_NOTICE, CROSS_SESSION_MESSAGE_NOTICE, neutralizePeerBody } from "../agents/cross-session-envelope.js";
|
|
8
|
+
import { isAskUnresolvableCause } from "./ask-unresolvable-notice.js";
|
|
8
9
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
9
10
|
import { sameOccupant } from "../engine/session/repo-utils.js";
|
|
10
11
|
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(["completed", "failed", "killed", "cancelled"]);
|
|
@@ -44,6 +45,7 @@ const TASK_NOTIFICATION_TAGS = [
|
|
|
44
45
|
"session-id",
|
|
45
46
|
"recent-steps",
|
|
46
47
|
"edited-files",
|
|
48
|
+
"refused-asks",
|
|
47
49
|
"resumable",
|
|
48
50
|
"agent-name",
|
|
49
51
|
"handback",
|
|
@@ -59,6 +61,12 @@ function renderResidual(n) {
|
|
|
59
61
|
}
|
|
60
62
|
return lines.length > 0 ? lines.join("\n") : undefined;
|
|
61
63
|
}
|
|
64
|
+
export function refusedAsksText(refused) {
|
|
65
|
+
const one = refused.length === 1;
|
|
66
|
+
const items = refused.map((r) => `${inlineUntrusted(r.toolName, 80)} (${r.cause})`).join(", ");
|
|
67
|
+
const remedies = [...new Set(refused.flatMap((r) => (r.remedy !== undefined ? [r.remedy] : [])))];
|
|
68
|
+
return `${refused.length} — ${items}: nobody could answer ${one ? "it" : "them"}, so ${one ? "it was" : "they were"} refused and did not run${remedies.length > 0 ? `; to go on: ${remedies.join(" / ")}` : ""}`;
|
|
69
|
+
}
|
|
62
70
|
function tag(name, value) {
|
|
63
71
|
let shown;
|
|
64
72
|
try {
|
|
@@ -148,6 +156,7 @@ function renderTaskNotificationCarrier(n) {
|
|
|
148
156
|
const residual = renderResidual(n);
|
|
149
157
|
return residual !== undefined ? [tag("recent-steps", residual)] : [];
|
|
150
158
|
})(),
|
|
159
|
+
...(n.refusedAsks !== undefined && n.refusedAsks.length > 0 ? [tag("refused-asks", refusedAsksText(n.refusedAsks))] : []),
|
|
151
160
|
...(n.resumable !== undefined ? [tag("resumable", n.resumable)] : []),
|
|
152
161
|
...(n.compaction !== undefined ? [tag("context", renderCompactionDisclosure(n.compaction))] : []),
|
|
153
162
|
"</task-notification>",
|
|
@@ -297,6 +306,9 @@ function malformedFacet(f) {
|
|
|
297
306
|
const edits = f["editedFiles"];
|
|
298
307
|
if (edits !== undefined && !(Array.isArray(edits) && edits.every((e) => e !== null && typeof e === "object" && typeof e.path === "string" && typeof e.edits === "number")))
|
|
299
308
|
return "editedFiles is not a list of files";
|
|
309
|
+
const refused = f["refusedAsks"];
|
|
310
|
+
if (refused !== undefined && !(Array.isArray(refused) && refused.length > 0 && refused.every((r) => r !== null && typeof r === "object" && typeof r.toolName === "string" && typeof r.toolCallId === "string" && isAskUnresolvableCause(r.cause) && (r.remedy === undefined || typeof r.remedy === "string"))))
|
|
311
|
+
return "refusedAsks is not a non-empty list of refused asks";
|
|
300
312
|
if (f["lines"] !== undefined && !(Array.isArray(f["lines"]) && f["lines"].every((l) => typeof l === "string")))
|
|
301
313
|
return "lines is not a list of strings";
|
|
302
314
|
const c = f["compaction"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BackgroundAgentRecord, type BackgroundAgentStore } from "./background-agent-store.js";
|
|
1
|
+
import { type BackgroundAgentRecord, type BackgroundAgentStore, type ParkedCardStore } from "./background-agent-store.js";
|
|
2
2
|
import { type StopSource, type TaskAccess, type TaskRetrievalStatus, type UnifiedTaskOutput, type UnifiedTaskResult, type BackgroundAgentTaskHandle, type ChildSessionStore, type RegisteredTaskHandle, type DurableAgentCore, type ParkedClaimTicket, type ParkedClaimRollback, type RegisterBackgroundAgentInput, type LandedAgentTerminal } from "./task-registry-shared.js";
|
|
3
3
|
import type { ExtensionRequester } from "./task-event.js";
|
|
4
4
|
import { type AgentState } from "./agent-state.js";
|
|
@@ -162,8 +162,10 @@ export declare function releaseDurableTranscriptAnchorLane(core: DurableAgentCor
|
|
|
162
162
|
* resume anchor; absent at register time because the child session is created after registration).
|
|
163
163
|
* A row already anchored to that session is left as it is (one fact, no second durable write). A row anchored to ANOTHER session
|
|
164
164
|
* is refused: an anchor changes only by its release ({@link releaseDurableTranscriptAnchorLane}) and a fresh bind, never by being
|
|
165
|
-
* written over, so the earlier session is never silently left unowned. An id that is no
|
|
166
|
-
* refused whatever the row holds
|
|
165
|
+
* written over, so the earlier session is never silently left unowned. An id that is no anchor (not a string, empty, or carrying an
|
|
166
|
+
* invisible character anywhere in it) is refused whatever the row holds, and so is a task id that names no background-agent row —
|
|
167
|
+
* nothing is anchored to a row that is not there. Every refusal of the bind is one `config.invalid_argument` mint ({@link bindRefusal}).
|
|
168
|
+
* `store` is the store the child's run holds that session through, bound with the id (the
|
|
167
169
|
* store is process-local; the durable record keeps the id alone). The store is judged where it is read: the transcript read
|
|
168
170
|
* (`$.session.messages`) refuses, naming why, one it cannot read through. */
|
|
169
171
|
export declare function bindBackgroundAgentSessionLane(core: DurableAgentCore, id: string, sessionId: string, store: ChildSessionStore): void;
|
|
@@ -180,7 +182,7 @@ export declare function bindBackgroundAgentSessionLane(core: DurableAgentCore, i
|
|
|
180
182
|
* boundary, so what stands on the row when the write does not land is the PREVIOUS leg's wider
|
|
181
183
|
* verdict — which the next revival then seeds from. Two drop shapes, one message each: a contaminated
|
|
182
184
|
* lane refuses at its front door, and an exhausted flush leaves the value unwritten with the lane
|
|
183
|
-
* still armed. The channel is the same durable-agents
|
|
185
|
+
* still armed. The channel is the same durable-agents notice the lane uses for the contamination
|
|
184
186
|
* itself (that one says writes stopped; this one says WHICH fact stopped with them). The write
|
|
185
187
|
* remains best-effort: no leg faults because its bookkeeping failed.
|
|
186
188
|
*
|
|
@@ -203,7 +205,6 @@ export declare function registerBackgroundAgentLane(core: DurableAgentCore, inpu
|
|
|
203
205
|
*/
|
|
204
206
|
export declare function parkBackgroundAgentLane(core: DurableAgentCore, id: string, park: {
|
|
205
207
|
checkpointToken: string;
|
|
206
|
-
seq?: number;
|
|
207
208
|
resolveStop?: () => Promise<boolean>;
|
|
208
209
|
completionSink?: BackgroundAgentTaskHandle["parkedCompletionSink"];
|
|
209
210
|
}): "parked" | undefined;
|
|
@@ -231,7 +232,7 @@ export declare function parkBackgroundAgentLane(core: DurableAgentCore, id: stri
|
|
|
231
232
|
*/
|
|
232
233
|
export declare function reconcileParkedAgentsLane(core: DurableAgentCore, stores: {
|
|
233
234
|
agentStore: import("./background-agent-store.js").BackgroundAgentStore;
|
|
234
|
-
checkpointStore:
|
|
235
|
+
checkpointStore: ParkedCardStore;
|
|
235
236
|
}, scope: string, now: number, opts?: {
|
|
236
237
|
staleClaimMaxAgeMs?: number;
|
|
237
238
|
}): Promise<{
|
|
@@ -285,12 +286,14 @@ export declare function rollbackParkedClaimLane(core: DurableAgentCore, stores:
|
|
|
285
286
|
* flip's rev bump, read the new epoch as foreign, and contaminate the lane (which would permanently
|
|
286
287
|
* drop finalize/terminal/re-park writes). On a won CAS the lane record/rev swap happens in the
|
|
287
288
|
* SAME chain step and the live handle adopts (running, arbitration dropped — the token is
|
|
288
|
-
* consumed; `parkClaimId` stays visible until finalize). Returns
|
|
289
|
-
*
|
|
289
|
+
* consumed; `parkClaimId` stays visible until finalize). Returns the stop-cycle number the flip WROTE on the row (the
|
|
290
|
+
* resumed cycle's, `nextCycleSeq`) — the caller reads its cycle from the claim that opened it, never from the registry
|
|
291
|
+
* afterwards, where the handle it flipped may already have been replaced — or `undefined` when the row moved
|
|
292
|
+
* (claim/status/token guard lost): the caller aborts the resume.
|
|
290
293
|
*/
|
|
291
294
|
export declare function consumeParkedFlipLane(core: DurableAgentCore, id: string, stores: {
|
|
292
295
|
agentStore: import("./background-agent-store.js").BackgroundAgentStore;
|
|
293
|
-
}, ticket: ParkedClaimTicket): Promise<
|
|
296
|
+
}, ticket: ParkedClaimTicket): Promise<number | undefined>;
|
|
294
297
|
/**
|
|
295
298
|
* design/153 §7.2d (件3c) — attach finalize: the resume's delivery lane is live, the claim is
|
|
296
299
|
* complete — clear `parkClaimId` (handle + durable row) so reconciliation stops seeing an
|
|
@@ -316,8 +319,8 @@ export declare function settleBackgroundAgentLane(core: DurableAgentCore, id: st
|
|
|
316
319
|
errorKind?: string;
|
|
317
320
|
retryAfterMs?: number;
|
|
318
321
|
stoppedBy?: StopSource;
|
|
319
|
-
seq?: number;
|
|
320
322
|
cycle?: number;
|
|
323
|
+
refusedAsks?: readonly import("./task-result.js").RefusedAsk[];
|
|
321
324
|
}): "completed" | "failed" | "killed" | undefined;
|
|
322
325
|
/** Abort every background agent belonging to `access` (parent-task teardown — a finished parent must
|
|
323
326
|
* not leave orphan child runs burning tokens; mirrors clearBackgroundForOwner for bash). */
|
|
@@ -360,24 +363,22 @@ export declare function resolveBackgroundAgentByNameLane(core: DurableAgentCore,
|
|
|
360
363
|
status: "not_found";
|
|
361
364
|
suggestion?: string;
|
|
362
365
|
};
|
|
366
|
+
export declare function claimBackgroundAgentNameLane(core: DurableAgentCore, requested: string, access: TaskAccess): {
|
|
367
|
+
name: string;
|
|
368
|
+
release(): void;
|
|
369
|
+
};
|
|
363
370
|
/** S2b': flip the park-redeemability bit AFTER retention is actually secured
|
|
364
371
|
* (tryRetainChild success) — registration happens before the retain attempt, and session-scope
|
|
365
372
|
* alone does NOT retain the child session, so declaring at register time acknowledged parks that
|
|
366
373
|
* a capacity/pin failure (or plain session-scope) could never drain. No-op on unknown ids. */
|
|
367
374
|
export declare function markRetainedContinuationLane(core: DurableAgentCore, id: string): void;
|
|
368
375
|
/**
|
|
369
|
-
* The stop-cycle
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* PARKED-BORN arm (falsification F1): a parked handle's counter still names the cycle that PARKED —
|
|
376
|
-
* the run this spawn lane is about to drive begins at the consume flip, which installs the bumped
|
|
377
|
-
* value (`flipped.seq = seq + 1`, the §7.2d consume write). Answering the pre-flip number made one
|
|
378
|
-
* resumed run speak two generations (spawn/ticks at n, terminal at n+1), so the parked arm answers
|
|
379
|
-
* the flip's target instead. A resume that loses the consume arbitration never runs, so the answer
|
|
380
|
-
* is never attached to a live cycle it doesn't describe.
|
|
376
|
+
* The row's stop-cycle number as its last WON claim left it: fresh spawn = 1, a seeded registration = the number its
|
|
377
|
+
* claim wrote on the row, a retained wake / a consume flip = the number that claim wrote ({@link nextCycleSeq}). Every
|
|
378
|
+
* reader in this process reads this one number — the spawn lanes thread it into the child's `RunInternals.cycleSeq`,
|
|
379
|
+
* the frames and the completion notification carry it, poll serves it. A parked row answers the cycle that parked: the
|
|
380
|
+
* next number exists only once the consume flip has won, and a drive reads it then. `undefined` for an unknown id or
|
|
381
|
+
* a non-agent row.
|
|
381
382
|
*/
|
|
382
383
|
export declare function backgroundAgentCycleSeqLane(core: DurableAgentCore, id: string): number | undefined;
|
|
383
384
|
/** S2b RB-27② — REVIVE a settled background-agent row for a retained-session RESUME cycle: the
|
|
@@ -429,6 +430,7 @@ export declare function settleRevivedAgentLane(core: DurableAgentCore, id: strin
|
|
|
429
430
|
retryable?: boolean;
|
|
430
431
|
errorKind?: string;
|
|
431
432
|
retryAfterMs?: number;
|
|
433
|
+
refusedAsks?: readonly import("./task-result.js").RefusedAsk[];
|
|
432
434
|
}): "completed" | "failed" | "killed" | undefined;
|
|
433
435
|
/**
|
|
434
436
|
* design/164 — record LIVE ACTIVITY on a running background-agent row (one tool-lifecycle beat).
|