@sema-agent/core 7.58.0 → 7.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1340 -0
- package/README.md +6 -4
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/cc-peer-directory.js +8 -8
- package/dist/agents/child-model-seat.d.ts +4 -2
- package/dist/agents/child-model-seat.js +9 -4
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/peer-directory.d.ts +9 -0
- package/dist/agents/peer-directory.js +6 -2
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +32 -50
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +150 -112
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +161 -45
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +9 -3
- package/dist/brain/errors.js +7 -1
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +103 -53
- package/dist/brain/provider-dialect.d.ts +11 -0
- package/dist/brain/provider-dialect.js +5 -2
- package/dist/brain/reasoning-request.js +5 -4
- package/dist/brain/reasoning.d.ts +19 -0
- package/dist/brain/reasoning.js +17 -2
- package/dist/brain/request-route.d.ts +4 -1
- package/dist/brain/request-route.js +4 -1
- package/dist/brain/route-adjudicator.d.ts +84 -18
- package/dist/brain/route-adjudicator.js +90 -22
- package/dist/brain/route-conformance.js +1 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.js +84 -49
- package/dist/brain/stream-shared.d.ts +30 -0
- package/dist/brain/stream-shared.js +34 -1
- package/dist/brain/timeout.d.ts +65 -6
- package/dist/brain/timeout.js +111 -11
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/account-row.d.ts +61 -0
- package/dist/core/account-row.js +51 -0
- package/dist/core/advisor-verdict.d.ts +2 -1
- package/dist/core/advisor-verdict.js +1 -1
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +20 -6
- package/dist/core/allow-entry.js +17 -7
- package/dist/core/approval-object.d.ts +29 -15
- package/dist/core/approval-object.js +47 -19
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +26 -4
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +13 -1
- package/dist/core/checkpoint-requirements.js +3 -1
- package/dist/core/checkpoint-store.d.ts +66 -25
- package/dist/core/checkpoint-store.js +22 -9
- package/dist/core/child-clamp-seats.d.ts +29 -0
- package/dist/core/child-clamp-seats.js +56 -1
- package/dist/core/compliance.d.ts +3 -3
- package/dist/core/compliance.js +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/effective-path-target.d.ts +8 -2
- package/dist/core/effective-path-target.js +8 -3
- package/dist/core/engine-notice.d.ts +156 -23
- package/dist/core/engine-notice.js +19 -5
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +8 -6
- package/dist/core/gate-lanes.js +47 -12
- package/dist/core/gate-outcome.d.ts +32 -3
- package/dist/core/gate-outcome.js +19 -1
- package/dist/core/governance-codes.d.ts +17 -1
- package/dist/core/governance-codes.js +25 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +70 -59
- package/dist/core/hooks.js +125 -80
- package/dist/core/image-admission.d.ts +106 -52
- package/dist/core/image-admission.js +184 -56
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +59 -5
- package/dist/core/locked-config.js +82 -50
- package/dist/core/mailbox-store.d.ts +45 -1
- package/dist/core/mailbox-store.js +53 -9
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +122 -20
- package/dist/core/mcp-failure.js +73 -5
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-link.d.ts +22 -1
- package/dist/core/mcp-server-link.js +25 -1
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +27 -12
- package/dist/core/mcp.js +105 -76
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
- package/dist/core/memory-engine/consolidation-driver.js +3 -3
- package/dist/core/memory-engine/consolidation.d.ts +4 -0
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/delegation-settlement.js +5 -12
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +50 -1
- package/dist/core/memory-engine/dual-root.js +44 -1
- package/dist/core/memory-engine/engine.d.ts +67 -14
- package/dist/core/memory-engine/engine.js +384 -212
- package/dist/core/memory-engine/export-bundle.d.ts +23 -0
- package/dist/core/memory-engine/export-bundle.js +23 -4
- package/dist/core/memory-engine/file-backend.d.ts +128 -55
- package/dist/core/memory-engine/file-backend.js +290 -117
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +59 -11
- package/dist/core/memory-engine/layout.js +190 -40
- package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
- package/dist/core/memory-engine/memory-backend-contract.js +39 -2
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +51 -9
- package/dist/core/memory-engine/sync-client.js +107 -13
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +8 -1
- package/dist/core/memory-engine/types.d.ts +6 -0
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +6 -5
- package/dist/core/mods/kernel/events.d.ts +11 -4
- package/dist/core/mods/kernel/events.js +11 -7
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +4 -0
- package/dist/core/mods/kernel/registration.js +3 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +73 -60
- package/dist/core/mods/stations.js +64 -40
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/parent-spec-seat.d.ts +8 -3
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +14 -8
- package/dist/core/peer-seat.d.ts +133 -16
- package/dist/core/peer-seat.js +319 -42
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +11 -6
- package/dist/core/permission-rule-model.d.ts +20 -2
- package/dist/core/permission-rule-model.js +8 -7
- package/dist/core/present-plan-tool.d.ts +11 -3
- package/dist/core/present-plan-tool.js +2 -2
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/resume-startup-cause.js +1 -0
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +13 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +69 -3
- package/dist/core/roles.js +167 -80
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/announce-once-ledger.d.ts +5 -4
- package/dist/core/runner/announce-once-ledger.js +4 -2
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +23 -12
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +82 -57
- package/dist/core/runner/credential-origin-seat.js +4 -3
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
- package/dist/core/runner/cwd-alignment-probe.js +21 -0
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +87 -11
- package/dist/core/runner/gate-exit.js +30 -8
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image-removed-seat.d.ts +12 -0
- package/dist/core/runner/image-removed-seat.js +19 -0
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +5 -5
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
- package/dist/core/runner/prepare-ask-lane.js +2 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +16 -9
- package/dist/core/runner/prepare-context-lane.js +2 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
- package/dist/core/runner/prepare-delegation-surface.js +5 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
- package/dist/core/runner/prepare-hands-readface.js +19 -6
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
- package/dist/core/runner/prepare-inherited-gate.js +22 -31
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +12 -19
- package/dist/core/runner/prepare-park-ask.d.ts +4 -6
- package/dist/core/runner/prepare-park-ask.js +5 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
- package/dist/core/runner/prepare-policy-chain.js +136 -121
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +10 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
- package/dist/core/runner/prepare-prompt-inputs.js +10 -20
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +17 -2
- package/dist/core/runner/prepare-run-refs.d.ts +2 -3
- package/dist/core/runner/prepare-run-refs.js +4 -1
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +44 -28
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/reply-pricing.d.ts +30 -0
- package/dist/core/runner/reply-pricing.js +19 -0
- package/dist/core/runner/resume-admission.js +4 -2
- package/dist/core/runner/resume-apply.js +6 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -5
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
- package/dist/core/runner/role-seat-defaulted.js +40 -0
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +3 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.d.ts +2 -5
- package/dist/core/runner/run-identity-wiring.js +6 -5
- package/dist/core/runner/run-leg.d.ts +2 -0
- package/dist/core/runner/run-leg.js +63 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +14 -6
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
- package/dist/core/runner/run-terminal-adoption.js +9 -3
- package/dist/core/runner/run-turn-boundary.js +89 -77
- package/dist/core/runner/runtask.d.ts +8 -5
- package/dist/core/runner/runtask.js +21 -13
- package/dist/core/runner/side-call-account.d.ts +1 -1
- package/dist/core/runner/side-call-account.js +3 -18
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
- package/dist/core/runner/sub-agent-deny-lists.js +20 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-end-body.js +2 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-occurrence.d.ts +1 -1
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +29 -27
- package/dist/core/runner/turn-attachments.js +27 -42
- package/dist/core/runner-deps.d.ts +32 -19
- package/dist/core/secret-env.d.ts +35 -4
- package/dist/core/secret-env.js +65 -3
- package/dist/core/sensitive-path-policy.js +3 -3
- package/dist/core/session-policy-store.d.ts +12 -3
- package/dist/core/session-policy-store.js +29 -10
- package/dist/core/session-store.d.ts +5 -7
- package/dist/core/session-store.js +50 -11
- package/dist/core/side-query.d.ts +11 -1
- package/dist/core/side-query.js +9 -0
- package/dist/core/skill-grant-binding.d.ts +31 -2
- package/dist/core/skill-grant-binding.js +31 -1
- package/dist/core/skill-grant.d.ts +17 -5
- package/dist/core/skill-grant.js +24 -6
- package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/synthetic-read-verdict.js +2 -1
- package/dist/core/task-event.d.ts +50 -10
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +146 -17
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +19 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +43 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +15 -7
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/terminal-cause.d.ts +10 -0
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.d.ts +1 -0
- package/dist/core/tool-check-reading.js +3 -3
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +21 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-roster.d.ts +112 -5
- package/dist/core/tool-roster.js +42 -1
- package/dist/core/tool-spec.d.ts +23 -5
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +15 -7
- package/dist/core/wiring-manifest.d.ts +6 -3
- package/dist/engine/compaction/compaction.js +29 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
- package/dist/engine/execution-env/node-execution-env.js +21 -13
- package/dist/engine/harness/agent-harness.d.ts +26 -3
- package/dist/engine/harness/agent-harness.js +49 -16
- package/dist/engine/harness/messages.d.ts +3 -1
- package/dist/engine/harness/messages.js +3 -2
- package/dist/engine/harness/types.d.ts +119 -28
- package/dist/engine/llm/rejected-images.d.ts +46 -0
- package/dist/engine/llm/rejected-images.js +54 -0
- package/dist/engine/llm/tool-turns.d.ts +2 -1
- package/dist/engine/llm/types.d.ts +18 -7
- package/dist/engine/loop/agent-loop.d.ts +20 -12
- package/dist/engine/loop/agent-loop.js +205 -36
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/path-to-root.d.ts +38 -0
- package/dist/engine/session/path-to-root.js +39 -0
- package/dist/engine/session/storage-base.js +4 -21
- package/dist/index.d.ts +35 -21
- package/dist/index.js +26 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/llm.d.ts +1 -0
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-observe.d.ts +17 -1
- package/dist/orchestration/workflow-observe.js +20 -0
- package/dist/orchestration/workflow-types.d.ts +32 -7
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +762 -491
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/shell/counting-pass.d.ts +50 -0
- package/dist/shell/counting-pass.js +502 -0
- package/dist/shell/lex.d.ts +4 -2
- package/dist/shell/lex.js +93 -34
- package/dist/shell/shell-words.d.ts +1 -1
- package/dist/shell/shell-words.js +7 -6
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +9 -11
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +14 -4
- package/dist/tools/fs/fs-bash.js +29 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +13 -5
- package/dist/tools/fs/program-read-model.d.ts +13 -0
- package/dist/tools/fs/program-read-model.js +15 -0
- package/dist/tools/fs/program-read-model.rows.js +1 -1
- package/dist/tools/fs/read-deny.d.ts +13 -10
- package/dist/tools/fs/read-deny.js +25 -5
- package/dist/tools/fs/read-floor.d.ts +62 -0
- package/dist/tools/fs/read-floor.js +58 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/fs/shell-read-check.d.ts +1 -1
- package/dist/tools/fs/shell-read-check.js +2 -1
- package/dist/tools/fs/shell-read-judge.d.ts +16 -8
- package/dist/tools/fs/shell-read-judge.js +10 -6
- package/dist/tools/fs/shell-read-plan.d.ts +6 -1
- package/dist/tools/fs/shell-read-plan.js +22 -15
- package/dist/tools/fs/shell-read-start.js +1 -0
- package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
- package/dist/tools/fs/shell-reentry-text.js +25 -3
- package/dist/tools/monitor.d.ts +9 -4
- package/dist/tools/monitor.js +17 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +5 -2
- package/test/export-surface.snapshot.json +161 -21
- package/wire-changes/core-stores-sql@7.59.0.json +29 -0
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.59.0.json +2459 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.59.0.json +29 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.59.0.json +29 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -3,6 +3,7 @@ import { isNotificationInjectionOutcome } from "../core/task-notification.js";
|
|
|
3
3
|
import { defineTool } from "../core/tools.js";
|
|
4
4
|
import { normalizeAgentName, chosenAgentName, DURABLE_AGENT_HANDLE_RE, DURABLE_AGENT_HEARTBEAT_MS } from "../core/task-registry.js";
|
|
5
5
|
import { announceTranscriptIntegrityGapOnce, canAccessAgentRecord, clearRevivedRowTerminalPayload } from "../core/background-agent-store.js";
|
|
6
|
+
import { readClampFloor } from "../core/child-clamp-seats.js";
|
|
6
7
|
import { uuidv7 } from "../internal/harness.js";
|
|
7
8
|
import { MAILBOX_TOMBSTONED_RECIPIENT_CODE, mailboxCrossProcessMountVerdict } from "../core/mailbox-store.js";
|
|
8
9
|
import { peerSendVerdictSeverity } from "./cross-session-judge.js";
|
|
@@ -101,36 +102,13 @@ export function createSendMessageTool(opts) {
|
|
|
101
102
|
const sendMessageParameters = peerLane.active
|
|
102
103
|
? Type.Object({ ...baseParameters.properties, message: Type.Optional(Type.String({ description: `${baseParameters.properties.message.description ?? ""} Optional only for a pure notify_when_idle subscription.`.trim() })), ...notifyWhenIdleParameter })
|
|
103
104
|
: baseParameters;
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const RETRIEVE_NOW = retrievalMounted === false
|
|
107
|
-
? "its result cannot be collected by this run (no TaskOutput is mounted beside this tool) — do not wait for it, and say so in your answer if the result matters"
|
|
108
|
-
: `retrieve its result NOW with TaskOutput(task_id, block: true)${retrievalHedge} rather than ending your turn`;
|
|
109
|
-
const RETRIEVE_LATER = retrievalMounted === false
|
|
110
|
-
? "its result cannot be collected by this run (no TaskOutput is mounted beside this tool)"
|
|
111
|
-
: "retrieve its status and result with TaskOutput(task_id) where mounted";
|
|
112
|
-
const WAIT_NOW = retrievalMounted === false
|
|
113
|
-
? "do not wait for it — this face has no TaskOutput to block on, and"
|
|
114
|
-
: `wait for it NOW with TaskOutput(task_id, block: true)${retrievalHedge} —`;
|
|
115
|
-
const CHECK_LATER = retrievalMounted === false
|
|
116
|
-
? "its completion cannot be checked from this face (no TaskOutput is mounted beside this tool)"
|
|
117
|
-
: "check for its completion with TaskOutput(task_id) where mounted";
|
|
105
|
+
const RETRIEVE_LATER = "retrieve its status and result with TaskOutput(task_id) where mounted";
|
|
106
|
+
const CHECK_LATER = "check for its completion with TaskOutput(task_id) where mounted";
|
|
118
107
|
const capitalize = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
: `its completion is NOT announced on this mount — ${RETRIEVE_LATER}`;
|
|
124
|
-
const AWAIT_COMPLETION = notifyWired
|
|
125
|
-
? "Wait for its completion notification"
|
|
126
|
-
: completionMode === "one_shot"
|
|
127
|
-
? `${capitalize(WAIT_NOW)} this one-shot submission ends with this turn`
|
|
128
|
-
: capitalize(CHECK_LATER);
|
|
129
|
-
const awaitCompletion = notifyWired
|
|
130
|
-
? "wait for its completion notification"
|
|
131
|
-
: completionMode === "one_shot"
|
|
132
|
-
? `${WAIT_NOW} this one-shot submission ends with this turn`
|
|
133
|
-
: CHECK_LATER;
|
|
108
|
+
const notifyWired = opts.notificationWired ?? opts.notify !== undefined;
|
|
109
|
+
const NO_COMPLETION_NOTICE = `its completion is NOT announced on this mount — ${RETRIEVE_LATER}`;
|
|
110
|
+
const AWAIT_COMPLETION = notifyWired ? "Wait for its completion notification" : capitalize(CHECK_LATER);
|
|
111
|
+
const awaitCompletion = notifyWired ? "wait for its completion notification" : CHECK_LATER;
|
|
134
112
|
const sendMessagePins = new Map();
|
|
135
113
|
const pinGuard = (targetId, targetName, rung, to) => {
|
|
136
114
|
if (rung === "other")
|
|
@@ -152,7 +130,7 @@ export function createSendMessageTool(opts) {
|
|
|
152
130
|
}
|
|
153
131
|
return {
|
|
154
132
|
content: `Message not sent: "${inlineUntrusted(to, 120)}" now resolves to a different agent than it did earlier in ` +
|
|
155
|
-
`this run — this name previously resolved to ${pinned.id.slice(0, 64)}, which it no longer reaches
|
|
133
|
+
`this run — this name previously resolved to ${pinned.id.slice(0, 64)}, which it no longer reaches.\n` +
|
|
156
134
|
`It now resolves to ${targetId.slice(0, 64)}. To message that agent, re-send with its task_id: ` +
|
|
157
135
|
`{"to": "${targetId.slice(0, 64)}", …}. To reach the earlier agent, use its task_id ` +
|
|
158
136
|
`${pinned.id.slice(0, 64)} from its spawn result.`,
|
|
@@ -174,13 +152,7 @@ export function createSendMessageTool(opts) {
|
|
|
174
152
|
`send is refused rather than silently redirected — re-send with the task_id of whichever agent you meant. ` +
|
|
175
153
|
(notifyWired
|
|
176
154
|
? `You will be notified automatically when it completes — prefer ending your turn; do not poll. `
|
|
177
|
-
:
|
|
178
|
-
? `This is a ONE-SHOT submission: there is no later turn for a completion notification to land in, so do NOT end your turn expecting one${retrievalMounted === false
|
|
179
|
-
? "; a continued agent's result cannot be collected by this run (no TaskOutput is mounted beside this tool) — say so if the result matters"
|
|
180
|
-
: ` — wait actively with TaskOutput(task_id, block: true)${retrievalHedge} when you need a continued agent's result`}. `
|
|
181
|
-
: `A finished agent is NOT announced on this mount${retrievalMounted === false
|
|
182
|
-
? ", and its result cannot be collected by this run (no TaskOutput is mounted beside this tool) — do not end your turn to wait for a notification that never comes"
|
|
183
|
-
: " — check on it with TaskOutput(task_id) where mounted rather than ending your turn to wait for a notification that never comes"}. `) +
|
|
155
|
+
: `A finished agent is NOT announced on this mount — check on it with TaskOutput(task_id) where mounted rather than ending your turn to wait for a notification that never comes. `) +
|
|
184
156
|
(continuationTier === "full"
|
|
185
157
|
? `Continuing a finished agent works for agents with a durable record — by name or task_id, even across restarts — and for runs that retain sub-agent sessions; when neither covers it you get an honest error and should launch a new agent with the needed context instead.`
|
|
186
158
|
: continuationTier === "rows"
|
|
@@ -389,11 +361,11 @@ export function createSendMessageTool(opts) {
|
|
|
389
361
|
};
|
|
390
362
|
const deliverOverSocket = async (record, peerLabel, modeClass) => {
|
|
391
363
|
if (notifyWhenIdle)
|
|
392
|
-
return peerRefusal("peer_send.invalid_target", `notify_when_idle is only supported for peer sessions that drain this host's mailbox store, and ${peerLabel} is reached over its socket
|
|
364
|
+
return peerRefusal("peer_send.invalid_target", `notify_when_idle is only supported for peer sessions that drain this host's mailbox store, and ${peerLabel} is reached over its socket.`);
|
|
393
365
|
if (opts.peerChannel === undefined)
|
|
394
|
-
return peerRefusal("peer_send.not_reachable", `${peerLabel} does not drain this host's mailbox store (a Claude Code session, or a session of this engine on another store), so a message parked here would never be read, and no socket channel is wired here to reach it (RunnerDeps.peerChannel)
|
|
366
|
+
return peerRefusal("peer_send.not_reachable", `${peerLabel} does not drain this host's mailbox store (a Claude Code session, or a session of this engine on another store), so a message parked here would never be read, and no socket channel is wired here to reach it (RunnerDeps.peerChannel).`);
|
|
395
367
|
if (record.liveness !== "live")
|
|
396
|
-
return peerRefusal("peer_send.not_reachable", `${peerLabel} is reached only over its socket and is not running; nothing holds a message for it while it is down
|
|
368
|
+
return peerRefusal("peer_send.not_reachable", `${peerLabel} is reached only over its socket and is not running; nothing holds a message for it while it is down.`);
|
|
397
369
|
const recipientKey = peerAxisToken(peerScope, "s", record.sessionId);
|
|
398
370
|
const sendVerdict = judgePeerAdmission(peerScope, recipientKey, { senderKey, body: message, prospectiveChain, ownTokens: [recipientKey] }, admissionConfig, undefined, "send");
|
|
399
371
|
if (!sendVerdict.ok)
|
|
@@ -406,7 +378,7 @@ export function createSendMessageTool(opts) {
|
|
|
406
378
|
hopChain: prospectiveChain,
|
|
407
379
|
});
|
|
408
380
|
if (!verdict.ok)
|
|
409
|
-
return peerRefusal(verdict.code, `${peerLabel} could not be reached over its socket — ${verdict.message}.${verdict.code === "peer_send.send_uncertain" ? " It may have arrived: do not resend the same content blindly." : "
|
|
381
|
+
return peerRefusal(verdict.code, `${peerLabel} could not be reached over its socket — ${verdict.message}.${verdict.code === "peer_send.send_uncertain" ? " It may have arrived: do not resend the same content blindly." : ""}`);
|
|
410
382
|
return {
|
|
411
383
|
content: `Message sent to ${peerLabel} over its socket: it does not drain this host's mailbox store, so nothing is parked here, and the socket answers no acknowledgement — the message was written to its socket once and the connection closed cleanly, which is all this receipt confirms (not that its session took it in, nor that its model read it). Continue with your task; do not resend the same content.`,
|
|
412
384
|
details: { type: "send-message", status: "peer_delivered", to, address: peerSessionBoxHandle(record.sessionId), verdict },
|
|
@@ -415,7 +387,7 @@ export function createSendMessageTool(opts) {
|
|
|
415
387
|
const settlePeerResolution = async (r) => {
|
|
416
388
|
switch (r.status) {
|
|
417
389
|
case "directory_fault":
|
|
418
|
-
return peerRefusal("peer_send.other", `the peer-session directory could not be read (${r.message})
|
|
390
|
+
return peerRefusal("peer_send.other", `the peer-session directory could not be read (${r.message}).`);
|
|
419
391
|
case "not_found":
|
|
420
392
|
return undefined;
|
|
421
393
|
case "self":
|
|
@@ -441,17 +413,17 @@ export function createSendMessageTool(opts) {
|
|
|
441
413
|
};
|
|
442
414
|
if (notifyWhenIdle) {
|
|
443
415
|
if (!peerLane.active) {
|
|
444
|
-
return peerRefusal("peer_send.invalid_target", peerLane.reason !== undefined ? `notify_when_idle is only supported for peer sessions of this engine, and the cross-session lane is unavailable on this mount — ${peerLane.reason}
|
|
416
|
+
return peerRefusal("peer_send.invalid_target", peerLane.reason !== undefined ? `notify_when_idle is only supported for peer sessions of this engine, and the cross-session lane is unavailable on this mount — ${peerLane.reason}.` : `notify_when_idle is only supported for peer sessions of this engine, and cross-session addressing is not mounted here (no peer-session directory).`);
|
|
445
417
|
}
|
|
446
418
|
if (senderIsChild) {
|
|
447
|
-
return peerRefusal("peer_send.invalid_target", "notify_when_idle is only available from the main conversation of this session (not from a subagent or teammate).
|
|
419
|
+
return peerRefusal("peer_send.invalid_target", "notify_when_idle is only available from the main conversation of this session (not from a subagent or teammate).");
|
|
448
420
|
}
|
|
449
421
|
const settled = await settlePeerResolution(await resolvePeerTarget());
|
|
450
|
-
return settled ?? peerRefusal("peer_send.invalid_target", `notify_when_idle is only supported for peer sessions of this engine (not teammates, subagents or agents), and no peer session is registered as "${inlineUntrusted(to, 120)}"
|
|
422
|
+
return settled ?? peerRefusal("peer_send.invalid_target", `notify_when_idle is only supported for peer sessions of this engine (not teammates, subagents or agents), and no peer session is registered as "${inlineUntrusted(to, 120)}".`);
|
|
451
423
|
}
|
|
452
424
|
if (parsePeerSessionAddress(to) !== undefined) {
|
|
453
425
|
if (!peerLane.active) {
|
|
454
|
-
return peerRefusal("peer_send.invalid_target", peerLane.reason !== undefined ? `cross-session addressing is unavailable on this mount — ${peerLane.reason}
|
|
426
|
+
return peerRefusal("peer_send.invalid_target", peerLane.reason !== undefined ? `cross-session addressing is unavailable on this mount — ${peerLane.reason}.` : `cross-session addressing is not mounted here (no peer-session directory), so "${inlineUntrusted(to, 120)}" cannot be delivered.`);
|
|
455
427
|
}
|
|
456
428
|
const settled = await settlePeerResolution(await resolvePeerTarget());
|
|
457
429
|
return settled ?? peerRefusal("peer_send.invalid_target", `no session is registered at "${inlineUntrusted(to, 120)}" — nothing was parked (a message is only ever parked for a session that exists or existed).`);
|
|
@@ -488,7 +460,7 @@ export function createSendMessageTool(opts) {
|
|
|
488
460
|
const content = outcome === "parked_durably"
|
|
489
461
|
? `Message parked durably for main (${mainLabel}): it has no run in progress, so the message was appended to its durable session box and is read at the start of its next run (it survives a restart). Continue with your task; do not wait for a reply.`
|
|
490
462
|
: outcome === "parked"
|
|
491
|
-
? `Message parked in process for main (${mainLabel}): it has no run in progress, so the message waits in this process for its next run — a restart of this process
|
|
463
|
+
? `Message parked in process for main (${mainLabel}): it has no run in progress, so the message waits in this process for its next run — this copy does not survive a restart of this process. Continue with your task; do not wait for a reply.`
|
|
492
464
|
: outcome === "dropped_duplicate"
|
|
493
465
|
? `Message not re-sent to main (${mainLabel}): it already delivered this exact message. Continue with your task; do not resend the same content.`
|
|
494
466
|
: `Message sent to main — queued for ${mainLabel} at its next turn boundary (accepted into its lane, not yet read). If that run finishes before reading it, the message may not survive. Continue with your task; do not wait for a reply.`;
|
|
@@ -580,6 +552,14 @@ export function createSendMessageTool(opts) {
|
|
|
580
552
|
}
|
|
581
553
|
if (row.sessionId === undefined)
|
|
582
554
|
return undefined;
|
|
555
|
+
const floorRead = readClampFloor(row.policyFloor);
|
|
556
|
+
if (!floorRead.ok) {
|
|
557
|
+
return {
|
|
558
|
+
content: `Message not sent: ${whoT3} cannot be revived — ${inlineUntrusted(floorRead.why, 400)}, so the restrictions it ran under cannot be held on a new cycle. Launch a new agent with the needed context instead.`,
|
|
559
|
+
details: { error: "revive.policy_floor_unreadable", code: "revive.policy_floor_unreadable", to },
|
|
560
|
+
isError: true,
|
|
561
|
+
};
|
|
562
|
+
}
|
|
583
563
|
const t3RecipientKey = peerAxisToken(scope, "h", handle);
|
|
584
564
|
const t3Verdict = admitFor(t3RecipientKey, [t3RecipientKey, peerAxisToken(scope, "s", row.sessionId)]);
|
|
585
565
|
if (!t3Verdict.ok)
|
|
@@ -628,7 +608,7 @@ export function createSendMessageTool(opts) {
|
|
|
628
608
|
catch (e) {
|
|
629
609
|
await rollbackDrain();
|
|
630
610
|
if (e?.code === "not_found") {
|
|
631
|
-
announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap);
|
|
611
|
+
announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap, continuationTier);
|
|
632
612
|
return queueFullReceipt(`No transcript found for agent ${handle}, so a revival cannot drain the backlog.`);
|
|
633
613
|
}
|
|
634
614
|
return queueFullReceipt(`Its transcript store did not answer (${thrownText(e)}) — this send did not start a backlog drain; a later resend will try again.`);
|
|
@@ -727,7 +707,7 @@ export function createSendMessageTool(opts) {
|
|
|
727
707
|
catch (e) {
|
|
728
708
|
await rollback();
|
|
729
709
|
if (e?.code === "not_found") {
|
|
730
|
-
announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap);
|
|
710
|
+
announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap, continuationTier);
|
|
731
711
|
return {
|
|
732
712
|
content: `Message not sent: no transcript found for agent ${handle} — it cannot be revived. Launch a new agent with the needed context instead.`,
|
|
733
713
|
details: { error: "resume.session_not_found", to },
|
|
@@ -983,7 +963,7 @@ export function createSendMessageTool(opts) {
|
|
|
983
963
|
const stillLive = nowRow !== undefined && (nowRow.status === "running" || nowRow.status === "pending");
|
|
984
964
|
return stillLive
|
|
985
965
|
? {
|
|
986
|
-
content: `Message not sent: ${who} is still starting up (it has not begun reading messages yet)
|
|
966
|
+
content: `Message not sent: ${who} is still starting up (it has not begun reading messages yet). Send again shortly. ${DEDUP_RETRY_NOTE}`,
|
|
987
967
|
details: { error: "settle_race", to },
|
|
988
968
|
isError: true,
|
|
989
969
|
}
|
|
@@ -1066,9 +1046,11 @@ export function createSendMessageTool(opts) {
|
|
|
1066
1046
|
...(row.createdAt !== undefined ? { rowSpawnedAt: row.createdAt } : {}),
|
|
1067
1047
|
...(opts.onNotifyError !== undefined ? { onNotifyError: opts.onNotifyError } : {}),
|
|
1068
1048
|
...(opts.notify ? { currentParentNotify: opts.notify } : {}),
|
|
1049
|
+
...(opts.taskArtifacts !== undefined ? { currentTaskArtifacts: opts.taskArtifacts } : {}),
|
|
1069
1050
|
...(ctx.onQuestion !== undefined && row.sessionScoped !== true ? { currentOnQuestion: ctx.onQuestion } : {}),
|
|
1070
1051
|
currentClamps: clampValuesOf(ctx, ctx.parentSpecSeat),
|
|
1071
1052
|
...(ctx.autoModeReview !== undefined ? { currentAutoModeReview: ctx.autoModeReview } : {}),
|
|
1053
|
+
currentMcpHostSeats: ctx.mountedMcp?.().hostSeats,
|
|
1072
1054
|
});
|
|
1073
1055
|
const fromPrefix = senderIsChild ? `(message from teammate "${senderLabel}")\n` : "";
|
|
1074
1056
|
try {
|
|
@@ -397,6 +397,9 @@ export declare function createSubagentResume(deps: {
|
|
|
397
397
|
currentParentNotify?: (n: TaskNotificationPayload, opts?: {
|
|
398
398
|
priority?: "now" | "next" | "later";
|
|
399
399
|
}) => void;
|
|
400
|
+
/** The RESUMING caller's result store, the pair of `currentParentNotify`: a cut completion is stored where the run that
|
|
401
|
+
* hears it reads (its `ToolExecuteContext.taskArtifacts`). Absent ⇒ the cut says the full text is not readable here. */
|
|
402
|
+
currentTaskArtifacts?: import("../core/tool-result-store.js").TaskArtifactSeat;
|
|
400
403
|
/** The RESUMING caller's live content-ask face (its trusted `ToolExecuteContext.onQuestion`), same
|
|
401
404
|
* reasoning as `currentParentNotify` one line up: the retained snapshot deliberately carries NO
|
|
402
405
|
* question face (the spawn turn's is stripped at freeze time — a per-request lane is torn down with
|
|
@@ -423,6 +426,9 @@ export declare function createSubagentResume(deps: {
|
|
|
423
426
|
currentAutoModeReview?: {
|
|
424
427
|
decider: import("../core/auto-mode.js").AutoModeDecider;
|
|
425
428
|
};
|
|
429
|
+
/** The RESUMING caller's own host seats (its trusted `ToolExecuteContext.mountedMcp` seats), same turn-bound reasoning: the snapshot keeps
|
|
430
|
+
* none, so the resumed cycle's host-transport servers dial through the waker's seats of their names, or fail their dial without one. */
|
|
431
|
+
currentMcpHostSeats?: ReadonlyMap<string, import("../core/mcp-host-seat.js").McpHostSeat> | undefined;
|
|
426
432
|
/** design/176 — present iff this resume is PEER-DRIVEN (the SendMessage carrier): the resume
|
|
427
433
|
* prompt takes the peer-resume trust frame (teammate header + fence label + the per-message
|
|
428
434
|
* discipline block — never the operator-authority wording), and the woken cycle's inbound peer
|
|
@@ -470,6 +476,13 @@ export declare function createSubagentResume(deps: {
|
|
|
470
476
|
/** RB-473 batch 2b — bounded disclosure when a deployment sink throws inside this resume closure's
|
|
471
477
|
* isolation scope (first failure per site; later ones counted only). */
|
|
472
478
|
onNotifyError?: (failure: import("../core/safe-notify.js").SafeNotifyFailure) => void;
|
|
479
|
+
/** The delegation entry gate the child was SPAWNED under — its tree's concurrency pool. A woken
|
|
480
|
+
* cycle is a running agent like any other, so it occupies that pool for exactly its own life:
|
|
481
|
+
* a cycle that revived its registry row is counted by the row (`registered`), one that runs with
|
|
482
|
+
* no row is charged to the pool's local half (`local`). Occupy only — the cap verdicts stay on the
|
|
483
|
+
* spawn door: CC 2.1.309's resume path calls `takeConcurrencySlot` (cli309.js:288053) with no cap read.
|
|
484
|
+
* Absent ⇒ the waker wakes rows only (SendMessage: every launch it makes revives a row, which counts itself). */
|
|
485
|
+
entryGate?: Pick<DelegationEntryGate, "occupy">;
|
|
473
486
|
}): (content: string) => Promise<string>;
|
|
474
487
|
/** Subagent transcript persistence — the RESOLVED delegation entry-caps pair (both members present;
|
|
475
488
|
* see {@link resolveDelegationEntryCaps}). */
|
|
@@ -495,6 +508,36 @@ export declare function delegationEntryLedgerFootprint(registry: object): {
|
|
|
495
508
|
keys: number;
|
|
496
509
|
handles: number;
|
|
497
510
|
};
|
|
511
|
+
/** A refused entry-cap door: the coded reason plus the lane-neutral half of its prose. Each spawn
|
|
512
|
+
* lane owns its own "Sub-agent not started…" head and its own cleanup obligations (worktree,
|
|
513
|
+
* observer, abort listener, settlement row), which is why the gate hands back the reason instead
|
|
514
|
+
* of the finished envelope. */
|
|
515
|
+
interface DelegationEntryRefusal {
|
|
516
|
+
code: "delegation.concurrency_cap" | "delegation.session_cap";
|
|
517
|
+
text: string;
|
|
518
|
+
}
|
|
519
|
+
/** The gate's synchronous verdict. `release` is the local reservation's giveback (a no-op for the
|
|
520
|
+
* registered kind, whose giveback IS its registry row settling). */
|
|
521
|
+
type DelegationEntryAdmission = {
|
|
522
|
+
admitted: true;
|
|
523
|
+
release: () => void;
|
|
524
|
+
} | {
|
|
525
|
+
admitted: false;
|
|
526
|
+
refusal: DelegationEntryRefusal;
|
|
527
|
+
};
|
|
528
|
+
/** Which half of the running count a started child lives in: `registered` = it has a running registry
|
|
529
|
+
* row (the row IS its count), `local` = it runs with no row and is counted by the pool's in-flight map. */
|
|
530
|
+
type DelegationEntryKind = "registered" | "local";
|
|
531
|
+
/** One opened delegation entry gate (see {@link openDelegationEntryGate}). `occupy` is the pool's ONE
|
|
532
|
+
* reservation — every child that starts running is charged through it; `admit` is the spawn door,
|
|
533
|
+
* the two cap verdicts in front of that same reservation. A resume cycle occupies without the
|
|
534
|
+
* verdicts: waking a retained child counts in its tree's pool but is not refused by a full one. */
|
|
535
|
+
interface DelegationEntryGate {
|
|
536
|
+
key: string | undefined;
|
|
537
|
+
admit: (kind: DelegationEntryKind) => DelegationEntryAdmission;
|
|
538
|
+
/** Reserve this pool's slot for a child of `kind`; returns the idempotent giveback. */
|
|
539
|
+
occupy: (kind: DelegationEntryKind) => () => void;
|
|
540
|
+
}
|
|
498
541
|
/**
|
|
499
542
|
* Options for {@link createSubagentTool}.
|
|
500
543
|
*
|
|
@@ -571,14 +614,14 @@ export interface SubagentToolOptions {
|
|
|
571
614
|
* matching the engine chain's `principal ?? "default"`), never implied by omission. */
|
|
572
615
|
scope: string;
|
|
573
616
|
/**
|
|
574
|
-
* Deployment-level completion-push FALLBACK — not an always-on tap.
|
|
617
|
+
* Deployment-level completion-push FALLBACK for a spawn's settle — not an always-on tap. That settle is
|
|
575
618
|
* delivered through `ctx.onTaskNotification ?? background.notify`: inside an engine-driven run
|
|
576
619
|
* the tool-execution context carries the run's own notification injector (the completion lands
|
|
577
|
-
* in the PARENT's live injection queue at its next turn boundary)
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* `RunnerDeps.onBackgroundChildEvent` (the BCE terminal frame)
|
|
620
|
+
* in the PARENT's live injection queue at its next turn boundary) and this sink is not called for it —
|
|
621
|
+
* one completion, one channel. It fires for a settle only WITHOUT an engine notification channel (direct
|
|
622
|
+
* `execute()` harnesses, minimal mounts). An operator resume (`handle.resume`) is launched by no call of a run, so
|
|
623
|
+
* its completion always goes to this sink, engine-driven or not; absent, it is not delivered. An unconditional
|
|
624
|
+
* process-level completion tap is `RunnerDeps.onBackgroundChildEvent` (the BCE terminal frame).
|
|
582
625
|
*/
|
|
583
626
|
notify?: (n: import("../core/task-notification.js").TaskNotificationPayload, opts?: {
|
|
584
627
|
priority?: "now" | "next" | "later";
|
|
@@ -852,18 +895,9 @@ export declare function asyncLaunchedReceipt(p: {
|
|
|
852
895
|
taskId: string;
|
|
853
896
|
/** The lane's own "what is running" opener — the Agent lane and the fork lane say different things. */
|
|
854
897
|
workingLine: string;
|
|
855
|
-
/** Whether a real notification sink is wired (the receipt speaks the RUNTIME sink truth).
|
|
898
|
+
/** Whether a real notification sink is wired (the receipt speaks the RUNTIME sink truth). A one-shot submission needs
|
|
899
|
+
* no wording of its own: its ending waits for the completion its lane is owed (`DeliveryObligations`). */
|
|
856
900
|
notify: boolean;
|
|
857
|
-
/**
|
|
858
|
-
* RB-220 — mirrors {@link import("../core/types.js").ToolExecuteContext.oneShot}: this run has no
|
|
859
|
-
* later turn for an async background notification to land in (a headless `-p` process exits once
|
|
860
|
-
* the turn ends). Checked AHEAD of `notify` below — a one-shot submission is wrong to promise a
|
|
861
|
-
* notification regardless of whether a notify sink happens to be wired, the same failure form
|
|
862
|
-
* `run_workflow`'s launch note was fixed for (RB-215/run-workflow-tool.ts): a model that follows
|
|
863
|
-
* "end your turn and wait" advice in a one-shot process loses the result — the process exits with
|
|
864
|
-
* nothing left alive to receive it. Default undefined ⇒ byte-compat (pre-RB-220 wording).
|
|
865
|
-
*/
|
|
866
|
-
oneShot?: boolean;
|
|
867
901
|
/** Per-call honest notes, rendered one per line between the status line and the closing instruction. */
|
|
868
902
|
notes?: (string | undefined)[];
|
|
869
903
|
}): string;
|