@sema-agent/core 7.66.1 → 7.67.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 +3483 -0
- package/LICENSE +2 -1
- package/dist/agents/agent-definition.js +2 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/agent-transcript-tool.js +4 -3
- package/dist/agents/builtin-agents.d.ts +10 -7
- package/dist/agents/builtin-agents.js +1 -0
- package/dist/agents/cascade.d.ts +24 -11
- package/dist/agents/cascade.js +21 -9
- package/dist/agents/child-failure.d.ts +30 -0
- package/dist/agents/child-failure.js +25 -1
- package/dist/agents/composition-placement.d.ts +6 -2
- package/dist/agents/composition-placement.js +7 -3
- package/dist/agents/cross-session-envelope.d.ts +10 -1
- package/dist/agents/cross-session-envelope.js +6 -2
- package/dist/agents/cross-session-judge.d.ts +7 -1
- package/dist/agents/cross-session-judge.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +36 -2
- package/dist/agents/cumulative-stats.js +44 -9
- package/dist/agents/delegation-registry-seat.js +2 -3
- package/dist/agents/inherited-tool-pool.d.ts +9 -4
- package/dist/agents/inherited-tool-pool.js +7 -1
- package/dist/agents/leg-label.d.ts +28 -0
- package/dist/agents/leg-label.js +9 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/list-agents-tool.js +4 -4
- package/dist/agents/org-delivery-gate.d.ts +129 -23
- package/dist/agents/org-delivery-gate.js +41 -20
- package/dist/agents/peer-held-queue.d.ts +15 -10
- package/dist/agents/peer-held-queue.js +47 -19
- package/dist/agents/peer-notice-route.js +2 -2
- package/dist/agents/peer-notices.d.ts +13 -2
- package/dist/agents/peer-notices.js +12 -2
- package/dist/agents/peer-session-drain.d.ts +65 -15
- package/dist/agents/peer-session-drain.js +198 -41
- package/dist/agents/read-inbox-tool.d.ts +3 -2
- package/dist/agents/read-inbox-tool.js +7 -5
- package/dist/agents/repair-loop.js +20 -16
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/retain-ledger.js +2 -4
- package/dist/agents/root-session-lane.d.ts +27 -0
- package/dist/agents/root-session-lane.js +57 -0
- package/dist/agents/roster-store.js +1 -2
- package/dist/agents/send-message-tool.js +6 -4
- package/dist/agents/subagent.d.ts +20 -4
- package/dist/agents/subagent.js +218 -183
- package/dist/agents/tool-filter.d.ts +3 -10
- package/dist/agents/tool-filter.js +0 -13
- package/dist/agents/verifier-independence.d.ts +31 -0
- package/dist/agents/verifier-independence.js +23 -0
- package/dist/agents/verify.d.ts +23 -11
- package/dist/agents/verify.js +28 -12
- package/dist/agents/yield-adoption.d.ts +24 -0
- package/dist/agents/yield-adoption.js +84 -0
- package/dist/bench/metrics.d.ts +2 -2
- package/dist/brain/anthropic.d.ts +4 -2
- package/dist/brain/anthropic.js +49 -35
- package/dist/brain/brain-faces.d.ts +11 -0
- package/dist/brain/brain-faces.js +6 -0
- package/dist/brain/cache-retention.d.ts +2 -0
- package/dist/brain/cache-retention.js +9 -0
- package/dist/brain/circuit-breaker.js +51 -26
- package/dist/brain/errors.d.ts +15 -1
- package/dist/brain/errors.js +8 -0
- package/dist/brain/failover.d.ts +6 -0
- package/dist/brain/failover.js +52 -37
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +4 -0
- package/dist/brain/model-capability.d.ts +2 -1
- package/dist/brain/model-lane.d.ts +145 -0
- package/dist/brain/model-lane.js +444 -0
- package/dist/brain/open-responses.js +19 -22
- package/dist/brain/openai.js +23 -22
- package/dist/brain/provider-message.d.ts +9 -0
- package/dist/brain/provider-message.js +18 -0
- package/dist/brain/reasoning-request.d.ts +9 -7
- package/dist/brain/reasoning-request.js +9 -10
- package/dist/brain/reasoning.d.ts +47 -13
- package/dist/brain/reasoning.js +20 -10
- package/dist/brain/route-adjudicator.d.ts +8 -2
- package/dist/brain/route-adjudicator.js +35 -1
- package/dist/brain/route-conformance.js +17 -0
- package/dist/brain/routing.d.ts +2 -0
- package/dist/brain/routing.js +19 -8
- package/dist/brain/status-sink.d.ts +5 -4
- package/dist/brain/status-sink.js +2 -2
- package/dist/brain/stream-engine.js +8 -2
- package/dist/brain/stream-shared.d.ts +12 -0
- package/dist/brain/stream-shared.js +18 -0
- package/dist/brain/timeout.d.ts +28 -0
- package/dist/brain/timeout.js +13 -4
- package/dist/brain/tool-schema-projection.d.ts +2 -0
- package/dist/brain/tool-schema-projection.js +108 -0
- package/dist/brain/usage-reading.d.ts +49 -0
- package/dist/brain/usage-reading.js +44 -0
- package/dist/brain/usage-reasoning.d.ts +38 -0
- package/dist/brain/usage-reasoning.js +9 -0
- package/dist/config/catalog.d.ts +3 -0
- package/dist/config/catalog.js +18 -9
- package/dist/core/a2a.d.ts +22 -4
- package/dist/core/a2a.js +191 -50
- package/dist/core/agent-definition.d.ts +3 -1
- package/dist/core/agent-state.d.ts +29 -16
- package/dist/core/agent-state.js +36 -9
- package/dist/core/allow-entry.d.ts +12 -3
- package/dist/core/allow-entry.js +10 -3
- package/dist/core/approval-display.d.ts +18 -0
- package/dist/core/approval-display.js +26 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/approval-route.d.ts +16 -0
- package/dist/core/approval-route.js +5 -0
- package/dist/core/approval-words.d.ts +43 -0
- package/dist/core/approval-words.js +37 -0
- package/dist/core/ask-origin.d.ts +37 -10
- package/dist/core/ask-origin.js +19 -7
- package/dist/core/ask-question.d.ts +36 -8
- package/dist/core/ask-question.js +24 -9
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/ask-unresolvable-notice.js +3 -2
- package/dist/core/attachment-source.d.ts +50 -0
- package/dist/core/attachment-source.js +46 -0
- package/dist/core/auto-compaction.d.ts +151 -40
- package/dist/core/auto-compaction.js +115 -50
- package/dist/core/auto-mode.d.ts +5 -0
- package/dist/core/auto-mode.js +11 -4
- package/dist/core/background-agent-store.d.ts +151 -23
- package/dist/core/background-agent-store.js +201 -61
- package/dist/core/background-shell.d.ts +4 -1
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.d.ts +49 -25
- package/dist/core/cache-break-detector.js +99 -44
- package/dist/core/caller-text.d.ts +28 -0
- package/dist/core/caller-text.js +12 -0
- package/dist/core/canonical-json.d.ts +5 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +80 -9
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +8 -1
- package/dist/core/checkpoint-generation.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +47 -14
- package/dist/core/checkpoint-queries.js +63 -30
- package/dist/core/checkpoint-requirements.d.ts +36 -3
- package/dist/core/checkpoint-requirements.js +11 -1
- package/dist/core/checkpoint-row-verdict.d.ts +0 -2
- package/dist/core/checkpoint-row-verdict.js +5 -8
- package/dist/core/checkpoint-store.d.ts +166 -41
- package/dist/core/checkpoint-store.js +96 -15
- package/dist/core/child-clamp-seats.d.ts +10 -2
- package/dist/core/child-clamp-seats.js +2 -2
- package/dist/core/classifier-unavailable-arm.d.ts +11 -9
- package/dist/core/classifier-unavailable-arm.js +4 -2
- package/dist/core/command-sandbox-dispatch.d.ts +13 -0
- package/dist/core/command-sandbox-dispatch.js +8 -0
- package/dist/core/command-sandbox.d.ts +231 -0
- package/dist/core/command-sandbox.js +344 -0
- package/dist/core/completion-id.d.ts +21 -0
- package/dist/core/completion-id.js +14 -0
- package/dist/core/config-refusal-codes.d.ts +22 -0
- package/dist/core/config-refusal-codes.js +196 -0
- package/dist/core/context-edit.d.ts +26 -0
- package/dist/core/context-edit.js +4 -2
- package/dist/core/context-guard.d.ts +80 -7
- package/dist/core/context-guard.js +126 -25
- package/dist/core/context-settings.d.ts +32 -0
- package/dist/core/context-settings.js +41 -3
- package/dist/core/contract-faces.d.ts +22 -0
- package/dist/core/contract-faces.js +1 -0
- package/dist/core/credential-echo.d.ts +2 -2
- package/dist/core/credential-echo.js +2 -2
- package/dist/core/cross-boundary-taint.d.ts +10 -8
- package/dist/core/decision-receipt.d.ts +3 -2
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/definition-entry-grammar.d.ts +42 -0
- package/dist/core/definition-entry-grammar.js +15 -0
- package/dist/core/engine-attestation.d.ts +19 -4
- package/dist/core/engine-attestation.js +4 -0
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-contracts/open-face-contract.d.ts +39 -0
- package/dist/core/engine-contracts/open-face-contract.js +57 -0
- package/dist/core/engine-notice.d.ts +161 -33
- package/dist/core/exclusive-temp.d.ts +25 -0
- package/dist/core/exclusive-temp.js +19 -0
- package/dist/core/existing-target.d.ts +112 -0
- package/dist/core/existing-target.js +88 -0
- package/dist/core/file-history-store.d.ts +14 -6
- package/dist/core/gate-lanes.js +8 -3
- package/dist/core/gate-outcome.d.ts +2 -1
- package/dist/core/git-worktree-env.d.ts +92 -1
- package/dist/core/git-worktree-env.js +87 -6
- package/dist/core/governance-codes.d.ts +49 -8
- package/dist/core/governance-codes.js +59 -8
- package/dist/core/hands-band.d.ts +10 -6
- package/dist/core/hooks.d.ts +60 -6
- package/dist/core/hooks.js +10 -2
- package/dist/core/host-floor.d.ts +24 -8
- package/dist/core/host-floor.js +45 -16
- package/dist/core/human-input-projection.d.ts +7 -0
- package/dist/core/human-input-projection.js +11 -3
- package/dist/core/image-admission.d.ts +16 -4
- package/dist/core/image-admission.js +29 -17
- package/dist/core/input-author.d.ts +43 -1
- package/dist/core/input-author.js +19 -0
- package/dist/core/isolation-scope.d.ts +41 -0
- package/dist/core/isolation-scope.js +10 -0
- package/dist/core/json-schema-seats.d.ts +11 -0
- package/dist/core/json-schema-seats.js +5 -0
- package/dist/core/leg-identity.d.ts +53 -5
- package/dist/core/leg-identity.js +32 -1
- package/dist/core/locked-config.d.ts +33 -38
- package/dist/core/locked-config.js +21 -3
- package/dist/core/lsp.js +2 -1
- package/dist/core/mailbox-store.d.ts +111 -18
- package/dist/core/mailbox-store.js +101 -13
- package/dist/core/mcp-call-meta.js +1 -1
- package/dist/core/mcp-connection-pool.d.ts +8 -2
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +6 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-read.d.ts +293 -0
- package/dist/core/mcp-host-read.js +428 -0
- package/dist/core/mcp-server-link.d.ts +28 -6
- package/dist/core/mcp-server-link.js +35 -7
- package/dist/core/mcp-server-spec.d.ts +22 -29
- package/dist/core/mcp-server-spec.js +7 -14
- package/dist/core/mcp-server-unavailable-notice.d.ts +32 -0
- package/dist/core/mcp-server-unavailable-notice.js +15 -0
- package/dist/core/mcp-session-end.d.ts +5 -2
- package/dist/core/mcp-session-end.js +7 -2
- package/dist/core/mcp-tool-meta.d.ts +6 -0
- package/dist/core/mcp-tool-meta.js +1 -0
- package/dist/core/mcp.d.ts +54 -19
- package/dist/core/mcp.js +194 -241
- package/dist/core/memory-engine/committed-shadow-read.d.ts +16 -0
- package/dist/core/memory-engine/committed-shadow-read.js +21 -0
- package/dist/core/memory-engine/consolidation-driver.js +2 -1
- package/dist/core/memory-engine/consolidation.d.ts +3 -3
- package/dist/core/memory-engine/control-objects.d.ts +4 -3
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/delegation-settlement.d.ts +127 -25
- package/dist/core/memory-engine/delegation-settlement.js +145 -18
- package/dist/core/memory-engine/distiller.d.ts +2 -1
- package/dist/core/memory-engine/distiller.js +10 -5
- package/dist/core/memory-engine/dual-root.js +2 -2
- package/dist/core/memory-engine/engine.d.ts +127 -33
- package/dist/core/memory-engine/engine.js +774 -323
- package/dist/core/memory-engine/entry-scan.d.ts +3 -0
- package/dist/core/memory-engine/entry-scan.js +8 -0
- package/dist/core/memory-engine/export-bundle.d.ts +4 -0
- package/dist/core/memory-engine/export-bundle.js +2 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -17
- package/dist/core/memory-engine/file-backend.js +155 -99
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layer-observations.d.ts +7 -1
- package/dist/core/memory-engine/layer-observations.js +6 -0
- package/dist/core/memory-engine/layout.d.ts +88 -26
- package/dist/core/memory-engine/layout.js +105 -29
- package/dist/core/memory-engine/memory-deployment.js +4 -4
- package/dist/core/memory-engine/mount-failed-notice.d.ts +24 -0
- package/dist/core/memory-engine/mount-failed-notice.js +22 -0
- package/dist/core/memory-engine/origin-clearance.d.ts +15 -1
- package/dist/core/memory-engine/origin-clearance.js +30 -10
- package/dist/core/memory-engine/scan.js +1 -1
- package/dist/core/memory-engine/scope-contract.js +4 -3
- package/dist/core/memory-engine/session-write-home.js +13 -1
- package/dist/core/memory-engine/sync-client.d.ts +1 -1
- package/dist/core/memory-engine/sync-client.js +3 -1
- package/dist/core/memory-engine/tools.d.ts +5 -4
- package/dist/core/memory-engine/tools.js +1 -1
- package/dist/core/memory-engine/types.d.ts +18 -1
- package/dist/core/memory-engine/types.js +1 -0
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/memory.js +2 -6
- package/dist/core/mode-policy.d.ts +8 -1
- package/dist/core/mode-policy.js +6 -2
- package/dist/core/model-fallbacks.d.ts +103 -0
- package/dist/core/model-fallbacks.js +79 -0
- package/dist/core/model-receipt.d.ts +15 -3
- package/dist/core/model-receipt.js +22 -1
- package/dist/core/model-seat.d.ts +1 -1
- package/dist/core/mods/classic-events.d.ts +5 -1
- package/dist/core/mods/dollar.d.ts +47 -2
- package/dist/core/mods/dollar.js +28 -5
- package/dist/core/mods/kernel/budget.d.ts +6 -0
- package/dist/core/mods/kernel/budget.js +6 -0
- package/dist/core/mods/kernel/dispatch.d.ts +23 -2
- package/dist/core/mods/kernel/dispatch.js +104 -15
- package/dist/core/mods/kernel/events.d.ts +18 -1
- package/dist/core/mods/kernel/events.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +2 -2
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/receive.d.ts +2 -1
- package/dist/core/mods/lifecycle-stations.d.ts +13 -4
- package/dist/core/mods/lifecycle-stations.js +8 -3
- package/dist/core/mods/message-display.d.ts +81 -0
- package/dist/core/mods/message-display.js +369 -0
- package/dist/core/mods/prompt-submit.d.ts +1 -1
- package/dist/core/mods/prompt-submit.js +5 -2
- package/dist/core/mods/session-append.d.ts +2 -2
- package/dist/core/mods/session-append.js +2 -1
- package/dist/core/mods/session-compact.js +2 -2
- package/dist/core/mods/stations.d.ts +48 -18
- package/dist/core/mods/stations.js +100 -19
- package/dist/core/mods/stop-answers.d.ts +23 -0
- package/dist/core/mods/stop-answers.js +20 -0
- package/dist/core/mounted-mcp.d.ts +48 -8
- package/dist/core/mounted-mcp.js +82 -16
- package/dist/core/namespaced-rule-name.js +2 -1
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/parent-spec-seat.d.ts +20 -1
- package/dist/core/parent-spec-seat.js +13 -3
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/path-identity.js +2 -1
- package/dist/core/peer-seat.d.ts +21 -7
- package/dist/core/peer-seat.js +25 -16
- package/dist/core/permission-rule-consent.js +15 -5
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +43 -23
- package/dist/core/permission-rule-store.d.ts +31 -16
- package/dist/core/permission-rule-store.js +27 -18
- package/dist/core/present-plan-tool.d.ts +6 -1
- package/dist/core/present-plan-tool.js +11 -3
- package/dist/core/pricing.d.ts +8 -6
- package/dist/core/pricing.js +1 -1
- package/dist/core/principal-name.d.ts +13 -0
- package/dist/core/principal-name.js +9 -2
- package/dist/core/process-identity.d.ts +140 -0
- package/dist/core/process-identity.js +215 -0
- package/dist/core/protocol-http-auth.d.ts +28 -6
- package/dist/core/protocol-http-auth.js +22 -5
- package/dist/core/protocol-naming.d.ts +7 -0
- package/dist/core/protocol-naming.js +12 -2
- package/dist/core/protocol-revocation.d.ts +72 -0
- package/dist/core/protocol-revocation.js +98 -0
- package/dist/core/protocol-table.d.ts +4 -4
- package/dist/core/protocol-table.js +3 -2
- package/dist/core/push-queue.d.ts +35 -2
- package/dist/core/push-queue.js +60 -4
- package/dist/core/read-only-shell.d.ts +19 -0
- package/dist/core/read-only-shell.js +38 -11
- package/dist/core/real-approval.d.ts +26 -0
- package/dist/core/real-approval.js +15 -0
- package/dist/core/redaction-marks.d.ts +6 -2
- package/dist/core/redaction-marks.js +3 -0
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +9 -8
- package/dist/core/remote-env.d.ts +31 -15
- package/dist/core/remote-env.js +29 -0
- package/dist/core/request-copy-projection.d.ts +51 -0
- package/dist/core/request-copy-projection.js +410 -0
- package/dist/core/resume-config-judge.d.ts +69 -0
- package/dist/core/resume-config-judge.js +78 -0
- package/dist/core/resume-startup-cause.d.ts +14 -4
- package/dist/core/resume-startup-cause.js +12 -2
- package/dist/core/retention-policy.js +2 -1
- package/dist/core/retention.d.ts +119 -24
- package/dist/core/retention.js +60 -16
- package/dist/core/retired-keys.d.ts +0 -10
- package/dist/core/retired-keys.js +2 -3
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +65 -4
- package/dist/core/row-shape.d.ts +149 -0
- package/dist/core/row-shape.js +184 -0
- package/dist/core/runner/advertised-writable-dirs.js +10 -9
- package/dist/core/runner/advisor-instructions.d.ts +11 -27
- package/dist/core/runner/advisor-instructions.js +18 -20
- package/dist/core/runner/advisor-tool.js +1 -0
- package/dist/core/runner/announce-once-ledger.js +4 -1
- package/dist/core/runner/approval-feedback.d.ts +17 -8
- package/dist/core/runner/approval-feedback.js +18 -13
- package/dist/core/runner/approver-defect-announcer.d.ts +17 -0
- package/dist/core/runner/approver-defect-announcer.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +29 -14
- package/dist/core/runner/assemble-result.js +16 -25
- package/dist/core/runner/cache-hit-account.d.ts +77 -0
- package/dist/core/runner/cache-hit-account.js +46 -0
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/call-hook-stations.js +5 -4
- package/dist/core/runner/changed-files-scan.d.ts +43 -0
- package/dist/core/runner/changed-files-scan.js +34 -0
- package/dist/core/runner/checkpoint-scope.d.ts +33 -9
- package/dist/core/runner/checkpoint-scope.js +27 -1
- package/dist/core/runner/classifier-ladder.d.ts +2 -2
- package/dist/core/runner/classifier-ladder.js +18 -9
- package/dist/core/runner/clock-and-limits.d.ts +15 -4
- package/dist/core/runner/clock-and-limits.js +19 -1
- package/dist/core/runner/compact-session.js +84 -14
- package/dist/core/runner/compaction-call-options.d.ts +2 -29
- package/dist/core/runner/compaction-call-options.js +2 -9
- package/dist/core/runner/compaction-restate.d.ts +18 -2
- package/dist/core/runner/compaction-restate.js +36 -2
- package/dist/core/runner/construction-doors.js +8 -0
- package/dist/core/runner/context-room.d.ts +55 -0
- package/dist/core/runner/context-room.js +71 -0
- package/dist/core/runner/contracts.d.ts +313 -205
- package/dist/core/runner/conversation-segment.d.ts +49 -14
- package/dist/core/runner/conversation-segment.js +92 -19
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -0
- package/dist/core/runner/cross-boundary-lane.js +9 -6
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/deferred-ask.d.ts +62 -0
- package/dist/core/runner/deferred-ask.js +44 -0
- package/dist/core/runner/delegation-owner.d.ts +19 -0
- package/dist/core/runner/delegation-owner.js +27 -1
- package/dist/core/runner/denial-limit-arms.d.ts +10 -6
- package/dist/core/runner/denial-limit-arms.js +13 -7
- package/dist/core/runner/env-capability-census.d.ts +1 -1
- package/dist/core/runner/file-history-request.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +16 -2
- package/dist/core/runner/file-history-restore.js +9 -1
- package/dist/core/runner/gate-exit.d.ts +18 -5
- package/dist/core/runner/gate-exit.js +26 -15
- package/dist/core/runner/git-status-frame.d.ts +26 -8
- package/dist/core/runner/git-status-frame.js +14 -9
- package/dist/core/runner/halt-attribution.d.ts +29 -12
- package/dist/core/runner/halt-attribution.js +38 -11
- package/dist/core/runner/image.js +3 -2
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +4 -4
- package/dist/core/runner/language-frame.d.ts +66 -0
- package/dist/core/runner/language-frame.js +76 -0
- package/dist/core/runner/leg-frame.d.ts +81 -0
- package/dist/core/runner/leg-frame.js +68 -0
- package/dist/core/runner/main-call-account.d.ts +34 -0
- package/dist/core/runner/main-call-account.js +50 -0
- package/dist/core/runner/mcp-redial.d.ts +9 -7
- package/dist/core/runner/mcp-redial.js +20 -21
- package/dist/core/runner/memory-consolidation-driver.d.ts +2 -0
- package/dist/core/runner/memory-consolidation-driver.js +5 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -0
- package/dist/core/runner/messages-omitted-seat.js +21 -0
- package/dist/core/runner/model-fallback-seat.d.ts +20 -0
- package/dist/core/runner/model-fallback-seat.js +43 -0
- package/dist/core/runner/model-lane-seat.d.ts +12 -0
- package/dist/core/runner/model-lane-seat.js +35 -0
- package/dist/core/runner/nested-memory-content.d.ts +33 -0
- package/dist/core/runner/nested-memory-content.js +171 -0
- package/dist/core/runner/nested-memory-lane.d.ts +181 -0
- package/dist/core/runner/nested-memory-lane.js +673 -0
- package/dist/core/runner/park-commit.d.ts +7 -0
- package/dist/core/runner/park-commit.js +3 -0
- package/dist/core/runner/prepare-advisor.d.ts +7 -9
- package/dist/core/runner/prepare-advisor.js +11 -5
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +8 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +21 -3
- package/dist/core/runner/prepare-ask-lane.js +32 -28
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +21 -17
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +10 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +24 -18
- package/dist/core/runner/prepare-config-doors.d.ts +51 -5
- package/dist/core/runner/prepare-config-doors.js +73 -73
- package/dist/core/runner/prepare-context-lane.d.ts +68 -3
- package/dist/core/runner/prepare-context-lane.js +137 -27
- package/dist/core/runner/prepare-defer-classify.d.ts +0 -4
- package/dist/core/runner/prepare-defer-classify.js +9 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +8 -8
- package/dist/core/runner/prepare-delegation-surface.js +72 -64
- package/dist/core/runner/prepare-execution-env.js +1 -9
- package/dist/core/runner/prepare-file-history.d.ts +3 -2
- package/dist/core/runner/prepare-file-history.js +11 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +21 -11
- package/dist/core/runner/prepare-gate-stations.js +13 -13
- package/dist/core/runner/prepare-hands-readface.d.ts +23 -6
- package/dist/core/runner/prepare-hands-readface.js +18 -12
- package/dist/core/runner/prepare-inherited-gate.d.ts +12 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -10
- package/dist/core/runner/prepare-lsp.js +2 -1
- package/dist/core/runner/prepare-memory-engine-session.js +30 -10
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +38 -16
- package/dist/core/runner/prepare-offload-wrappers.d.ts +3 -16
- package/dist/core/runner/prepare-offload-wrappers.js +6 -5
- package/dist/core/runner/prepare-park-ask.d.ts +11 -3
- package/dist/core/runner/prepare-park-ask.js +23 -19
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -3
- package/dist/core/runner/prepare-policy-chain.js +144 -120
- package/dist/core/runner/prepare-project-context.d.ts +15 -53
- package/dist/core/runner/prepare-project-context.js +20 -83
- package/dist/core/runner/prepare-prompt-assembly.d.ts +7 -1
- package/dist/core/runner/prepare-prompt-assembly.js +9 -7
- package/dist/core/runner/prepare-prompt-inputs.d.ts +9 -3
- package/dist/core/runner/prepare-prompt-inputs.js +5 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +46 -27
- package/dist/core/runner/prepare-question-face.d.ts +6 -5
- package/dist/core/runner/prepare-question-face.js +7 -6
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -0
- package/dist/core/runner/prepare-suspend-saga.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +3 -3
- package/dist/core/runner/prepare-task.js +113 -61
- package/dist/core/runner/prepare-tool-disclosure-mount.js +6 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +33 -7
- package/dist/core/runner/prepare-turn-wiring.js +53 -17
- package/dist/core/runner/prepare-wiring-manifest.d.ts +42 -5
- package/dist/core/runner/prepare-wiring-manifest.js +81 -42
- package/dist/core/runner/prepare-workspace-restore.js +3 -2
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/reply-pricing.d.ts +31 -18
- package/dist/core/runner/reply-pricing.js +10 -15
- package/dist/core/runner/resume-admission.js +10 -15
- package/dist/core/runner/resume-apply.js +20 -9
- package/dist/core/runner/resume-checkpoint-screen.js +2 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +12 -9
- package/dist/core/runner/resume-internals-and-config.js +37 -9
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/retired-runner-deps.js +3 -0
- package/dist/core/runner/rewind-files.js +6 -6
- package/dist/core/runner/run-attachment-seats.d.ts +1 -3
- package/dist/core/runner/run-attachment-seats.js +1 -6
- package/dist/core/runner/run-brain-sinks.d.ts +4 -7
- package/dist/core/runner/run-brain-sinks.js +7 -10
- package/dist/core/runner/run-clock-and-content.d.ts +8 -5
- package/dist/core/runner/run-clock-and-content.js +18 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +8 -4
- package/dist/core/runner/run-compaction-machinery.js +4 -19
- package/dist/core/runner/run-git-lane.d.ts +8 -3
- package/dist/core/runner/run-git-lane.js +5 -3
- package/dist/core/runner/run-harness-handlers.d.ts +4 -1
- package/dist/core/runner/run-harness-handlers.js +70 -45
- package/dist/core/runner/run-identity-wiring.d.ts +6 -0
- package/dist/core/runner/run-identity-wiring.js +17 -8
- package/dist/core/runner/run-leg.d.ts +5 -2
- package/dist/core/runner/run-leg.js +156 -71
- package/dist/core/runner/run-notification-lane.d.ts +1 -1
- package/dist/core/runner/run-notification-lane.js +22 -10
- package/dist/core/runner/run-recovery-lanes.js +8 -6
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -0
- package/dist/core/runner/run-settle-and-teardown.js +77 -26
- package/dist/core/runner/run-stop-and-final-verify.js +46 -12
- package/dist/core/runner/run-telemetry-and-budget-seats.js +13 -28
- package/dist/core/runner/run-terminal-adoption.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.js +14 -9
- package/dist/core/runner/run-tool-mount-facts.js +5 -9
- package/dist/core/runner/run-turn-boundary.d.ts +3 -2
- package/dist/core/runner/run-turn-boundary.js +112 -106
- package/dist/core/runner/runtask.d.ts +28 -8
- package/dist/core/runner/runtask.js +132 -41
- package/dist/core/runner/session-file-state-replay.d.ts +5 -3
- package/dist/core/runner/session-file-state-replay.js +10 -3
- package/dist/core/runner/session-rule-policy.d.ts +3 -3
- package/dist/core/runner/session-verb-doors.d.ts +18 -3
- package/dist/core/runner/session-verb-doors.js +38 -6
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +4 -4
- package/dist/core/runner/side-call-account.d.ts +12 -8
- package/dist/core/runner/side-call-account.js +24 -15
- package/dist/core/runner/stream-halt-verbs.js +1 -0
- package/dist/core/runner/stream-mode-verb.js +2 -1
- package/dist/core/runner/stream-settle-backstop.js +4 -1
- package/dist/core/runner/stream-steer-verb.js +35 -19
- package/dist/core/runner/sub-agent-deny-lists.d.ts +47 -11
- package/dist/core/runner/sub-agent-deny-lists.js +140 -39
- package/dist/core/runner/teardown-bounded.d.ts +6 -0
- package/dist/core/runner/teardown-bounded.js +12 -7
- package/dist/core/runner/terminal-account.d.ts +2 -0
- package/dist/core/runner/terminal-account.js +6 -1
- package/dist/core/runner/tool-disclosure.js +2 -1
- package/dist/core/runner/tool-end-body.js +3 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +34 -9
- package/dist/core/runner/tool-occurrence.js +32 -21
- package/dist/core/runner/tool-progress-lane.d.ts +20 -5
- package/dist/core/runner/tool-progress-lane.js +27 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +15 -4
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/turn-attachments.d.ts +44 -71
- package/dist/core/runner/turn-attachments.js +52 -104
- package/dist/core/runner/usage-accounting.d.ts +3 -2
- package/dist/core/runner/usage-accounting.js +3 -2
- package/dist/core/runner/void-verifier-pause.js +1 -1
- package/dist/core/runner-deps.d.ts +42 -158
- package/dist/core/runtime-caps.d.ts +16 -4
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +46 -23
- package/dist/core/sensitive-path-policy.d.ts +8 -0
- package/dist/core/sensitive-path-policy.js +10 -2
- package/dist/core/session-checkout.d.ts +32 -27
- package/dist/core/session-checkout.js +109 -61
- package/dist/core/session-log-transfer.js +2 -1
- package/dist/core/session-policy-store.d.ts +24 -11
- package/dist/core/session-policy-store.js +11 -2
- package/dist/core/session-store.d.ts +16 -2
- package/dist/core/session-store.js +43 -17
- package/dist/core/session.d.ts +31 -3
- package/dist/core/session.js +33 -2
- package/dist/core/shell-run-candidates.d.ts +20 -8
- package/dist/core/shell-run-candidates.js +44 -21
- package/dist/core/side-query.d.ts +17 -5
- package/dist/core/side-query.js +17 -14
- package/dist/core/skill-grant.js +2 -3
- package/dist/core/skills-directory.js +3 -66
- package/dist/core/snapshot-frame-seat.d.ts +8 -0
- package/dist/core/snapshot-frame-seat.js +24 -0
- package/dist/core/steer-replay.d.ts +19 -3
- package/dist/core/steer-replay.js +8 -1
- package/dist/core/store-contracts/background-agent-store-contract.d.ts +17 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +131 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +63 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +213 -3
- package/dist/core/store-contracts/permission-rule-write-contract.js +24 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.d.ts +15 -0
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +288 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +57 -36
- package/dist/core/store-contracts/session-repo-contract.js +130 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/session-store-contract.js +17 -0
- package/dist/core/store-contracts/task-list-store-contract.d.ts +32 -0
- package/dist/core/store-contracts/task-list-store-contract.js +240 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +41 -0
- package/dist/core/stub-env.d.ts +2 -2
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.d.ts +38 -28
- package/dist/core/synthetic-read-verdict.js +19 -28
- package/dist/core/task-event.d.ts +171 -19
- package/dist/core/task-intake.d.ts +26 -0
- package/dist/core/task-intake.js +31 -0
- package/dist/core/task-limits.d.ts +8 -6
- package/dist/core/task-notification.d.ts +88 -8
- package/dist/core/task-notification.js +45 -5
- package/dist/core/task-registry-agent.d.ts +24 -7
- package/dist/core/task-registry-agent.js +51 -28
- package/dist/core/task-registry-monitor.js +16 -14
- package/dist/core/task-registry-shared.d.ts +177 -35
- package/dist/core/task-registry-shared.js +44 -17
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry-yield.d.ts +32 -0
- package/dist/core/task-registry-yield.js +85 -0
- package/dist/core/task-registry.d.ts +88 -10
- package/dist/core/task-registry.js +124 -33
- package/dist/core/task-result.d.ts +115 -31
- package/dist/core/task-spec-members.d.ts +140 -1
- package/dist/core/task-spec-members.js +23 -8
- package/dist/core/task-spec.d.ts +181 -51
- package/dist/core/task-spec.js +1 -1
- package/dist/core/task-stream.d.ts +12 -2
- package/dist/core/terminal-cause.d.ts +12 -4
- package/dist/core/thrown-value.d.ts +49 -7
- package/dist/core/thrown-value.js +38 -2
- package/dist/core/tool-catalog-entries.js +13 -3
- package/dist/core/tool-data-door.d.ts +7 -0
- package/dist/core/tool-data-door.js +13 -0
- package/dist/core/tool-face-lists.d.ts +25 -0
- package/dist/core/tool-face-lists.js +38 -0
- package/dist/core/tool-face-reader.d.ts +0 -10
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-list-grammar.d.ts +103 -0
- package/dist/core/tool-list-grammar.js +130 -0
- package/dist/core/tool-mount-facts.d.ts +47 -0
- package/dist/core/tool-mount-facts.js +50 -0
- package/dist/core/tool-mount-plan.d.ts +196 -0
- package/dist/core/tool-mount-plan.js +404 -0
- package/dist/core/tool-mount-static.d.ts +12 -0
- package/dist/core/tool-mount-static.js +174 -0
- package/dist/core/tool-name-aliases.d.ts +60 -2
- package/dist/core/tool-name-aliases.js +22 -2
- package/dist/core/tool-name-list.d.ts +3 -0
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +246 -51
- package/dist/core/tool-policy.js +165 -71
- package/dist/core/tool-registry.d.ts +4 -11
- package/dist/core/tool-registry.js +0 -3
- package/dist/core/tool-result-bytes.d.ts +94 -0
- package/dist/core/tool-result-bytes.js +34 -0
- package/dist/core/tool-result-store.d.ts +97 -13
- package/dist/core/tool-result-store.js +52 -4
- package/dist/core/tool-roster.d.ts +71 -10
- package/dist/core/tool-roster.js +71 -21
- package/dist/core/tool-search-setting.d.ts +7 -9
- package/dist/core/tool-search-setting.js +23 -7
- package/dist/core/tool-spec.d.ts +32 -2
- package/dist/core/tools.js +6 -20
- package/dist/core/trace.d.ts +63 -11
- package/dist/core/trace.js +19 -0
- package/dist/core/types.d.ts +8 -6
- package/dist/core/types.js +3 -1
- package/dist/core/unmatched-tool-names.d.ts +37 -0
- package/dist/core/unmatched-tool-names.js +18 -0
- package/dist/core/untrusted-egress.d.ts +16 -5
- package/dist/core/untrusted-egress.js +202 -32
- package/dist/core/untrusted-text.d.ts +29 -8
- package/dist/core/untrusted-text.js +6 -3
- package/dist/core/user-attachment.d.ts +129 -35
- package/dist/core/user-attachment.js +124 -57
- package/dist/core/user-row-origin.d.ts +63 -0
- package/dist/core/user-row-origin.js +61 -0
- package/dist/core/wiring-manifest.d.ts +161 -39
- package/dist/core/wiring-manifest.js +42 -6
- package/dist/core/workflow-run-store-contract.d.ts +11 -1
- package/dist/core/workflow-run-store-contract.js +60 -7
- package/dist/core/workflow-run-store.d.ts +61 -12
- package/dist/core/workflow-run-store.js +100 -15
- package/dist/core/workspace-snapshot.d.ts +10 -14
- package/dist/core/workspace-snapshot.js +3 -22
- package/dist/core/write-protect.d.ts +3 -5
- package/dist/core/write-protect.js +2 -4
- package/dist/engine/compaction/compaction.d.ts +3 -0
- package/dist/engine/compaction/compaction.js +4 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +15 -4
- package/dist/engine/execution-env/node-execution-env.js +80 -27
- package/dist/engine/harness/agent-harness.d.ts +143 -27
- package/dist/engine/harness/agent-harness.js +162 -74
- package/dist/engine/harness/types.d.ts +84 -13
- package/dist/engine/harness/types.js +21 -1
- package/dist/engine/llm/tool-turns.d.ts +4 -0
- package/dist/engine/llm/tool-turns.js +7 -2
- package/dist/engine/llm/types.d.ts +111 -24
- package/dist/engine/llm/types.js +69 -5
- package/dist/engine/llm/validation.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +39 -6
- package/dist/engine/loop/agent-loop.js +172 -82
- package/dist/engine/loop/types.d.ts +43 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +5 -3
- package/dist/engine/lsp/node-lsp-manager.js +14 -10
- package/dist/engine/session/import-validate.js +9 -0
- package/dist/engine/session/memory-repo.d.ts +8 -1
- package/dist/engine/session/memory-repo.js +20 -12
- package/dist/engine/session/repo-utils.d.ts +10 -0
- package/dist/engine/session/repo-utils.js +11 -5
- package/dist/engine/session/row-cells.d.ts +32 -0
- package/dist/engine/session/row-cells.js +25 -0
- package/dist/index.d.ts +63 -34
- package/dist/index.js +44 -21
- package/dist/internal/harness.d.ts +8 -6
- package/dist/internal/harness.js +6 -4
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +7 -0
- package/dist/orchestration/governance-baseline-validity.js +33 -9
- package/dist/orchestration/run-workflow-tool.d.ts +2 -0
- package/dist/orchestration/run-workflow-tool.js +25 -12
- package/dist/orchestration/workflow-governance.d.ts +19 -4
- package/dist/orchestration/workflow-governance.js +30 -9
- package/dist/orchestration/workflow-primitives.d.ts +4 -1
- package/dist/orchestration/workflow-primitives.js +2 -2
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +21 -12
- package/dist/orchestration/workflow-types.js +15 -4
- package/dist/orchestration/workflow.d.ts +37 -7
- package/dist/orchestration/workflow.js +81 -35
- package/dist/prompt-assembly/artifact-store.js +6 -9
- package/dist/prompt-assembly/assemble.d.ts +4 -10
- package/dist/prompt-assembly/assemble.js +1 -3
- package/dist/prompt-assembly/catalog/constitution.d.ts +0 -20
- package/dist/prompt-assembly/catalog/constitution.js +2 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +5 -3
- package/dist/prompt-assembly/catalog/engine.d.ts +108 -0
- package/dist/prompt-assembly/catalog/engine.js +19 -0
- package/dist/prompt-assembly/catalog/environment.d.ts +276 -0
- package/dist/prompt-assembly/catalog/environment.js +61 -0
- package/dist/prompt-assembly/catalog/index.d.ts +9 -2
- package/dist/prompt-assembly/catalog/index.js +73 -2
- package/dist/prompt-assembly/catalog/locales/index.d.ts +16 -0
- package/dist/prompt-assembly/catalog/locales/index.js +22 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +124 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +120 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/cowork.js +442 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +15 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +50 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +163 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +148 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.d.ts +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/team.js +246 -0
- package/dist/prompt-assembly/catalog/role.js +3 -6
- package/dist/prompt-assembly/catalog/schema.d.ts +23 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/composer.d.ts +6 -11
- package/dist/prompt-assembly/composer.js +7 -7
- package/dist/prompt-assembly/engine-text.d.ts +9 -0
- package/dist/prompt-assembly/engine-text.js +33 -0
- package/dist/prompt-assembly/event-registry.js +3 -3
- package/dist/prompt-assembly/explain.d.ts +1 -0
- package/dist/prompt-assembly/explain.js +1 -1
- package/dist/prompt-assembly/locale-review.d.ts +13 -0
- package/dist/prompt-assembly/locale-review.js +19 -0
- package/dist/prompt-assembly/overlay.d.ts +7 -3
- package/dist/prompt-assembly/overlay.js +27 -5
- package/dist/prompt-assembly/renderers.d.ts +4 -4
- package/dist/prompt-assembly/renderers.js +26 -17
- package/dist/prompt-assembly/role-base.d.ts +1 -1
- package/dist/prompt-assembly/select.d.ts +26 -5
- package/dist/prompt-assembly/select.js +25 -2
- package/dist/prompt-assembly/slots.d.ts +19 -0
- package/dist/prompt-assembly/slots.js +16 -0
- package/dist/prompt-assembly/sugar.d.ts +4 -7
- package/dist/prompt-assembly/sugar.js +1 -2
- package/dist/prompt-assembly/tool-catalog.d.ts +5 -1
- package/dist/prompt-assembly/tool-catalog.js +5 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +38 -10
- package/dist/prompt-assembly/turn-snapshot.js +43 -13
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/cowork.d.ts +6 -25
- package/dist/prompts/cowork.js +10 -12
- package/dist/prompts/default.d.ts +10 -32
- package/dist/prompts/default.js +37 -63
- package/dist/shell/lex.d.ts +39 -13
- package/dist/shell/lex.js +70 -30
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +35 -61
- package/dist/stores/file/checkpoint-store.d.ts +5 -3
- package/dist/stores/file/checkpoint-store.js +8 -10
- package/dist/stores/file/fs-atomic.d.ts +27 -70
- package/dist/stores/file/fs-atomic.js +52 -148
- package/dist/stores/file/index.d.ts +12 -0
- package/dist/stores/file/index.js +27 -2
- package/dist/stores/file/mailbox-store.d.ts +10 -1
- package/dist/stores/file/mailbox-store.js +40 -12
- package/dist/stores/file/permission-rule-adopt.js +5 -2
- package/dist/stores/file/permission-rule-store.d.ts +81 -20
- package/dist/stores/file/permission-rule-store.js +126 -33
- package/dist/stores/file/session-policy-store.d.ts +2 -2
- package/dist/stores/file/session-store.d.ts +21 -2
- package/dist/stores/file/session-store.js +27 -14
- package/dist/stores/file/task-list-store.js +23 -25
- package/dist/stores/file/tool-result-store.d.ts +45 -7
- package/dist/stores/file/tool-result-store.js +99 -36
- package/dist/stores/file/workflow-run-store.d.ts +1 -0
- package/dist/stores/file/workflow-run-store.js +14 -11
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/artifact/local-stub.js +6 -6
- package/dist/tools/fs/bash-program-position.d.ts +1 -2
- package/dist/tools/fs/bash-readonly-classifier.d.ts +35 -0
- package/dist/tools/fs/bash-readonly-classifier.js +50 -12
- package/dist/tools/fs/env-error-detail.d.ts +1 -0
- package/dist/tools/fs/env-error-detail.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +24 -6
- package/dist/tools/fs/fs-bash.js +73 -25
- package/dist/tools/fs/fs-pdf.js +6 -4
- package/dist/tools/fs/fs-read.d.ts +76 -31
- package/dist/tools/fs/fs-read.js +159 -79
- package/dist/tools/fs/fs-search-tools.d.ts +1 -1
- package/dist/tools/fs/fs-search-tools.js +3 -1
- package/dist/tools/fs/fs-shared.d.ts +59 -63
- package/dist/tools/fs/fs-shared.js +31 -18
- package/dist/tools/fs/fs-write.d.ts +13 -0
- package/dist/tools/fs/fs-write.js +69 -13
- package/dist/tools/fs/index.d.ts +19 -1
- package/dist/tools/fs/index.js +10 -2
- package/dist/tools/fs/pdf.js +10 -9
- package/dist/tools/fs/read-deny.js +4 -10
- package/dist/tools/fs/read-floor.d.ts +5 -4
- package/dist/tools/fs/removal-targets.d.ts +11 -5
- package/dist/tools/fs/removal-targets.js +62 -32
- package/dist/tools/fs/safety.d.ts +26 -19
- package/dist/tools/fs/safety.js +13 -8
- package/dist/tools/fs/search.d.ts +1 -1
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-bindings.d.ts +128 -26
- package/dist/tools/fs/shell-read-bindings.js +667 -139
- package/dist/tools/fs/shell-read-check.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +4 -1
- package/dist/tools/fs/shell-read-judge.js +5 -1
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +21 -19
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +18 -1
- package/dist/tools/fs/shell-read-start.d.ts +6 -6
- package/dist/tools/fs/shell-read-start.js +1 -6
- package/dist/tools/fs/shell-read-word.d.ts +4 -2
- package/dist/tools/fs/shell-read-word.js +7 -6
- package/dist/tools/fs/shell-read-workdir.d.ts +1 -1
- package/dist/tools/fs/shell-reentry-text.d.ts +24 -9
- package/dist/tools/fs/shell-reentry-text.js +50 -20
- package/dist/tools/monitor.d.ts +4 -0
- package/dist/tools/monitor.js +14 -4
- package/dist/tools/scheduler-tools.d.ts +5 -2
- package/dist/tools/scheduler-tools.js +8 -6
- package/dist/tools/task-list.d.ts +49 -20
- package/dist/tools/task-list.js +115 -35
- package/dist/tools/web.d.ts +13 -3
- package/dist/tools/web.js +17 -6
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +24 -25
- package/package.json +10 -3
- package/test/export-surface.snapshot.json +330 -32
- package/wire-changes/core-stores-sql@7.67.0.json +39 -0
- package/wire-changes/core@7.67.0.json +12578 -0
- package/wire-changes/mods-kernel@7.67.0.json +167 -0
- package/wire-changes/primitives@7.67.0.json +325 -0
- package/wire-changes/wiki-gate@7.67.0.json +1636 -0
- package/dist/brain/degrading.d.ts +0 -93
- package/dist/brain/degrading.js +0 -189
- package/dist/core/tool-conformance.d.ts +0 -20
- package/dist/core/tool-conformance.js +0 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MailboxPeerMeta, type MailboxDecisionOutcome, type MailboxDecision } from "../core/mailbox-store.js";
|
|
2
2
|
import type { CrossSessionHoldCause, CrossSessionInboundVerdict } from "./cross-session-judge.js";
|
|
3
|
-
import { type PeerDeliveryReceiptState } from "./peer-notices.js";
|
|
3
|
+
import { type PeerDeliveryReceiptState, type PeerReleaseCause } from "./peer-notices.js";
|
|
4
4
|
/** The `cause` vocabulary of a `peer.inbound_disposition{disposition:"held"}` notice: the parity
|
|
5
5
|
* judge's causes plus the drain-stage gate's TRANSIENT `rate_limited` (a bucket-wait, not a review
|
|
6
6
|
* hold — it never enters the held queue; the drain stops at that seq and re-judges next pass). */
|
|
@@ -53,8 +53,10 @@ export interface PeerHeldQueueSink {
|
|
|
53
53
|
judge: (entry: PeerHeldEntry) => CrossSessionInboundVerdict;
|
|
54
54
|
/** Deliver a deliverable entry into the live run's model context. Absent ⇒ no run is live. Throws ⇒
|
|
55
55
|
* the lane refused the frame. Returns `"deferred"` ⇒ the run is live but this pass's delivery budget
|
|
56
|
-
* is spent: the entry stays deliverable and goes at the next pass's flush (unless the policy refuses it first).
|
|
57
|
-
|
|
56
|
+
* is spent: the entry stays deliverable and goes at the next pass's flush (unless the policy refuses it first).
|
|
57
|
+
* May answer a promise (awaited): a sink that must record something durably before the frame goes out (the
|
|
58
|
+
* session's external-content exposure) answers once that is done, `"deferred"` when it could not be. */
|
|
59
|
+
inject?: (entry: PeerHeldEntry) => void | "deferred" | Promise<void | "deferred">;
|
|
58
60
|
/** Would {@link inject} take this entry NOW (a live pass that holds this box's lease, with budget left)?
|
|
59
61
|
* Asked BEFORE the hand-over move (and before a refusal ends a handed-over card), so a process that cannot
|
|
60
62
|
* deliver never takes a move out of `delivered`. Absent ⇒
|
|
@@ -63,11 +65,13 @@ export interface PeerHeldQueueSink {
|
|
|
63
65
|
/** The receipt to the sender (the binding routes it into the sender's box). Resolves once the receipt is in
|
|
64
66
|
* that box (or has no reader there); rejects when it could not be written. Only {@link PeerHeldQueue.shutdown}
|
|
65
67
|
* waits on it — every other path sends and goes on. */
|
|
66
|
-
receipt: (entry: PeerHeldEntry, state: PeerDeliveryReceiptState) => Promise<void>;
|
|
68
|
+
receipt: (entry: PeerHeldEntry, state: PeerDeliveryReceiptState, releasedBy?: PeerReleaseCause) => Promise<void>;
|
|
67
69
|
/** Does a receipt about this entry reach a sender? A queue-local event (eviction, shutdown, a refused
|
|
68
70
|
* release) is a decision about the record exactly when it does — the sender is told it is final. */
|
|
69
71
|
tellsSender: (entry: PeerHeldEntry) => boolean;
|
|
70
|
-
/** THE decision seat: the store's compare-and-set of this entry's record (`MailboxStore.moveDecision`).
|
|
72
|
+
/** THE decision seat: the store's compare-and-set of this entry's record (`MailboxStore.moveDecision`). The seat names the lease
|
|
73
|
+
* owner its consumer claims the box with, so the store refuses an edge out of `delivered` once the box's lease is another's
|
|
74
|
+
* (answered `delivered`: the card loses the move and the box's holder settles the record). */
|
|
71
75
|
decide: (entry: PeerHeldEntry, expect: MailboxDecision | undefined, next: MailboxDecision) => Promise<MailboxDecisionOutcome>;
|
|
72
76
|
/** Announce an entry entering the queue (or its cause changing on re-judgment). */
|
|
73
77
|
onHeld?: (entry: PeerHeldEntry, heldCount: number, cause: CrossSessionHoldCause, reannounce: boolean) => void;
|
|
@@ -87,9 +91,10 @@ export interface PeerHeldQueueConfig {
|
|
|
87
91
|
export type PeerHeldSettleOutcome = "gone" | "delivered" | "released_pending" | "dropped" | "dropped_by_policy" | "denied" | "expired" | "decided_elsewhere";
|
|
88
92
|
/** What {@link PeerHeldQueue.hold} did with a record the judgment holds: `held` — this call held it
|
|
89
93
|
* (card + hold receipt, `held` / `held_by_policy` by its cause); `adopted` — it was already held (or deliverable) and this queue now shows it
|
|
90
|
-
* without a receipt; `uncarded` — held, but this queue is full and no card it carries can be settled to
|
|
91
|
-
* make room (none would tell its sender)
|
|
92
|
-
*
|
|
94
|
+
* without a receipt; `uncarded` — held, but this queue's capacity for unanswered cards is full and no unanswered card it carries can be settled to
|
|
95
|
+
* make room (none would tell its sender) — the record stays held in its box and shows when a card frees. A record already `approved` or
|
|
96
|
+
* handed over is never `uncarded`: an answered card needs no room; a final word — another consumer settled it; `gone` —
|
|
97
|
+
* no such record any more; `fault` — the store refused the move, or answered a decision word outside the card table (either way reported through `onFault`). */
|
|
93
98
|
export type PeerHoldOutcome = "held" | "adopted" | "uncarded" | "denied" | "expired" | "refused" | "dropped" | "gone" | "fault";
|
|
94
99
|
export interface PeerHeldQueue {
|
|
95
100
|
/** The registry key (scope + box). */
|
|
@@ -104,8 +109,8 @@ export interface PeerHeldQueue {
|
|
|
104
109
|
* Hold a record (CC `v` hold arm). `decision` is the record's decision in the snapshot the caller judged:
|
|
105
110
|
* absent ⇒ the move absent → `held` is taken (its winner sends the hold receipt its cause reads as); `held` / `approved` ⇒
|
|
106
111
|
* the record is already held elsewhere and this queue only shows it (an approved card is not announced).
|
|
107
|
-
* At the cap, settles the oldest held card that tells its sender (it is then a
|
|
108
|
-
* deadline for a hold cause a person could answer.
|
|
112
|
+
* At the cap (of UNANSWERED cards — {@link CARD_CAPACITY}), settles the oldest held card that tells its sender (it is then a
|
|
113
|
+
* decision); an `approved` / handed-over record always gets its card; arms the deadline for a hold cause a person could answer.
|
|
109
114
|
*/
|
|
110
115
|
hold(entry: Omit<PeerHeldEntry, "heldAt" | "decision" | "deadlineAt">, decision?: PeerCardDecision): Promise<PeerHoldOutcome>;
|
|
111
116
|
/** Re-judge every entry against current settings (CC `D`): deliverable ⇒ handed over (or kept with no
|
|
@@ -2,6 +2,13 @@ import { isMailboxDecisionDeliverable, isMailboxDecisionFinal } from "../core/ma
|
|
|
2
2
|
import { sameOccupant } from "../engine/session/repo-utils.js";
|
|
3
3
|
import { PEER_HELD_QUEUE_CAP, PEER_HELD_REVIEW_CAUSES, peerHeldReceiptStateOf } from "./peer-notices.js";
|
|
4
4
|
import { peerSessionBoxHandle } from "./peer-directory.js";
|
|
5
|
+
import { inlineUntrusted } from "../core/untrusted-text.js";
|
|
6
|
+
const CARD_CAPACITY = Object.freeze({
|
|
7
|
+
held: { counts: true, evictable: true },
|
|
8
|
+
approved: { counts: false, evictable: false },
|
|
9
|
+
delivered: { counts: false, evictable: false },
|
|
10
|
+
});
|
|
11
|
+
const cardStateOf = (word) => (typeof word === "string" && Object.hasOwn(CARD_CAPACITY, word) ? word : undefined);
|
|
5
12
|
export const realPeerClock = {
|
|
6
13
|
now: () => Date.now(),
|
|
7
14
|
setTimeout: (fn, ms) => {
|
|
@@ -17,6 +24,7 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
17
24
|
const clock = opts.clock ?? realPeerClock;
|
|
18
25
|
const entries = [];
|
|
19
26
|
const deadlines = new Map();
|
|
27
|
+
const releasedBy = new WeakMap();
|
|
20
28
|
let cfg;
|
|
21
29
|
const cardChains = new Map();
|
|
22
30
|
const onCard = (seq, f) => {
|
|
@@ -55,10 +63,10 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
55
63
|
entries.splice(i, 1);
|
|
56
64
|
clearDeadline(entry);
|
|
57
65
|
};
|
|
58
|
-
const sendReceipt = (sink, entry, state) => {
|
|
66
|
+
const sendReceipt = (sink, entry, state, cause) => {
|
|
59
67
|
let landed;
|
|
60
68
|
try {
|
|
61
|
-
landed = Promise.resolve(sink.receipt(entry, state));
|
|
69
|
+
landed = Promise.resolve(cause === undefined ? sink.receipt(entry, state) : sink.receipt(entry, state, cause));
|
|
62
70
|
}
|
|
63
71
|
catch (e) {
|
|
64
72
|
landed = Promise.reject(e);
|
|
@@ -66,10 +74,10 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
66
74
|
landed.catch(() => undefined);
|
|
67
75
|
return landed;
|
|
68
76
|
};
|
|
69
|
-
const leave = (entry, settlement, reason, receipt) => {
|
|
77
|
+
const leave = (entry, settlement, reason, receipt, cause) => {
|
|
70
78
|
const sink = sinkOrThrow();
|
|
71
79
|
remove(entry);
|
|
72
|
-
const landed = receipt !== undefined ? sendReceipt(sink, entry, receipt) : undefined;
|
|
80
|
+
const landed = receipt !== undefined ? sendReceipt(sink, entry, receipt, cause) : undefined;
|
|
73
81
|
safe(() => sink.onSettled?.(entry, settlement, reason, entries.length));
|
|
74
82
|
return landed;
|
|
75
83
|
};
|
|
@@ -85,24 +93,34 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
85
93
|
}
|
|
86
94
|
if (outcome.ok)
|
|
87
95
|
return "won";
|
|
88
|
-
adoptCurrent(entry, outcome.current);
|
|
89
|
-
|
|
96
|
+
return adoptCurrent(entry, outcome.current) ? "lost" : "fault";
|
|
97
|
+
};
|
|
98
|
+
const unreadableWord = (entry, word) => {
|
|
99
|
+
const sink = sinkOrThrow();
|
|
100
|
+
const quoted = typeof word === "string" ? `"${inlineUntrusted(word, 48)}"` : `a ${word === null ? "null" : typeof word}`;
|
|
101
|
+
safe(() => sink.onFault?.(entry, new Error(`PeerHeldQueue: the store answered ${quoted} for seq ${entry.seq}, a decision word outside the card table — the card is left as it was`)));
|
|
90
102
|
};
|
|
91
103
|
const adoptCurrent = (entry, current) => {
|
|
92
104
|
if (!entries.includes(entry))
|
|
93
|
-
return;
|
|
105
|
+
return true;
|
|
94
106
|
if (current === "gone" || current === "unset") {
|
|
95
107
|
leave(entry, "retired", "superseded", undefined);
|
|
96
|
-
return;
|
|
108
|
+
return true;
|
|
97
109
|
}
|
|
98
110
|
if (isMailboxDecisionFinal(current)) {
|
|
99
111
|
leave(entry, current, "decided_elsewhere", undefined);
|
|
100
|
-
return;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
const state = cardStateOf(current);
|
|
115
|
+
if (state === undefined) {
|
|
116
|
+
unreadableWord(entry, current);
|
|
117
|
+
return false;
|
|
101
118
|
}
|
|
102
|
-
if (isMailboxDecisionDeliverable(
|
|
103
|
-
entry.decision =
|
|
119
|
+
if (isMailboxDecisionDeliverable(state) && entry.decision !== state) {
|
|
120
|
+
entry.decision = state;
|
|
104
121
|
clearDeadline(entry);
|
|
105
122
|
}
|
|
123
|
+
return true;
|
|
106
124
|
};
|
|
107
125
|
const settleLocal = async (entry, settlement, reason) => {
|
|
108
126
|
const sink = sinkOrThrow();
|
|
@@ -165,6 +183,7 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
165
183
|
if (sink.inject === undefined || !mayHandOver(entry))
|
|
166
184
|
return "no_leg";
|
|
167
185
|
if (entry.decision !== "delivered") {
|
|
186
|
+
const from = entry.decision;
|
|
168
187
|
const r = await move(entry, "delivered");
|
|
169
188
|
if (r === "lost")
|
|
170
189
|
return "lost";
|
|
@@ -172,16 +191,18 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
172
191
|
return "no_leg";
|
|
173
192
|
entry.decision = "delivered";
|
|
174
193
|
clearDeadline(entry);
|
|
194
|
+
if (!releasedBy.has(entry))
|
|
195
|
+
releasedBy.set(entry, from === "approved" ? "approved" : "rejudge");
|
|
175
196
|
}
|
|
176
197
|
try {
|
|
177
|
-
if (sink.inject(entry) === "deferred")
|
|
198
|
+
if ((await sink.inject(entry)) === "deferred")
|
|
178
199
|
return "no_leg";
|
|
179
200
|
}
|
|
180
201
|
catch {
|
|
181
202
|
await settleLocal(entry, "dropped", "inject_failed");
|
|
182
|
-
return "dropped";
|
|
203
|
+
return entries.includes(entry) ? "no_leg" : "dropped";
|
|
183
204
|
}
|
|
184
|
-
leave(entry, "delivered", reason, "delivered");
|
|
205
|
+
leave(entry, "delivered", reason, "delivered", releasedBy.get(entry));
|
|
185
206
|
return "delivered";
|
|
186
207
|
};
|
|
187
208
|
const refuseCard = async (entry, reason) => {
|
|
@@ -192,6 +213,8 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
192
213
|
const r = await move(entry, word);
|
|
193
214
|
if (r === "won")
|
|
194
215
|
leave(entry, word, reason, word);
|
|
216
|
+
if (r === "lost" && owed && entries.includes(entry) && entry.decision === "delivered")
|
|
217
|
+
return "waits";
|
|
195
218
|
return r;
|
|
196
219
|
};
|
|
197
220
|
const rejudgeOne = async (entry, reannounce) => {
|
|
@@ -249,12 +272,13 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
249
272
|
}
|
|
250
273
|
return retired;
|
|
251
274
|
};
|
|
252
|
-
const
|
|
253
|
-
|
|
275
|
+
const reviewLoad = () => entries.filter((e) => CARD_CAPACITY[e.decision].counts).length;
|
|
276
|
+
const makeRoom = async (decision) => {
|
|
277
|
+
if (!CARD_CAPACITY[decision].counts || reviewLoad() < cap)
|
|
254
278
|
return true;
|
|
255
279
|
const sink = sinkOrThrow();
|
|
256
280
|
const victim = entries.find((e) => {
|
|
257
|
-
if (e.decision
|
|
281
|
+
if (!CARD_CAPACITY[e.decision].evictable)
|
|
258
282
|
return false;
|
|
259
283
|
try {
|
|
260
284
|
return sink.tellsSender(e);
|
|
@@ -266,7 +290,7 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
266
290
|
if (victim === undefined)
|
|
267
291
|
return false;
|
|
268
292
|
await onCard(victim.seq, async () => (entries.includes(victim) ? settleLocal(victim, "expired", "evicted") : undefined));
|
|
269
|
-
return
|
|
293
|
+
return reviewLoad() < cap;
|
|
270
294
|
};
|
|
271
295
|
const queue = {
|
|
272
296
|
key,
|
|
@@ -313,9 +337,13 @@ export function createPeerHeldQueue(key, opts = {}) {
|
|
|
313
337
|
else
|
|
314
338
|
state = outcome.current;
|
|
315
339
|
}
|
|
340
|
+
if (cardStateOf(state) === undefined) {
|
|
341
|
+
unreadableWord({ ...input, heldAt: clock.now(), decision: "held" }, state);
|
|
342
|
+
return "fault";
|
|
343
|
+
}
|
|
316
344
|
if (entries.some((e) => e.box === input.box && e.seq === input.seq))
|
|
317
345
|
return fresh ? "held" : "adopted";
|
|
318
|
-
if (!(await makeRoom())) {
|
|
346
|
+
if (!(await makeRoom(state))) {
|
|
319
347
|
if (fresh)
|
|
320
348
|
void sendReceipt(sink, { ...input, heldAt: clock.now(), decision: state }, peerHeldReceiptStateOf(input.cause));
|
|
321
349
|
return "uncarded";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAILBOX_TOMBSTONED_RECIPIENT_CODE } from "../core/mailbox-store.js";
|
|
2
2
|
import { peerSessionBoxHandle } from "./peer-directory.js";
|
|
3
|
-
import { peerIdleNoticeLabel, renderCrossSessionDeliveryNotice, renderCrossSessionDroppedNotice, renderCrossSessionIdleNotice } from "./peer-notices.js";
|
|
3
|
+
import { isPeerReleaseCause, peerIdleNoticeLabel, renderCrossSessionDeliveryNotice, renderCrossSessionDroppedNotice, renderCrossSessionIdleNotice } from "./peer-notices.js";
|
|
4
4
|
function noticeMeta(route, to, kind, notice) {
|
|
5
5
|
const modeClass = route.self.modeClass?.();
|
|
6
6
|
return {
|
|
@@ -32,7 +32,7 @@ async function appendNotice(route, to, content, peerMeta, classification) {
|
|
|
32
32
|
}
|
|
33
33
|
export function routePeerDeliveryReceipt(route, to, state, refSeq, detail) {
|
|
34
34
|
const recipient = route.self.name ?? peerSessionBoxHandle(route.self.sessionId);
|
|
35
|
-
const said = state === "refused" && detail !== undefined ? peerIdleNoticeLabel(detail) : undefined;
|
|
35
|
+
const said = state === "refused" && detail !== undefined ? peerIdleNoticeLabel(detail) : state === "delivered" && isPeerReleaseCause(detail) ? detail : undefined;
|
|
36
36
|
const notice = { state, refSeq, recipient, ...(said !== undefined ? { detail: said } : {}) };
|
|
37
37
|
return appendNotice(route, to, renderCrossSessionDeliveryNotice(state, 1, [recipient], said), noticeMeta(route, to, "delivery_notice", notice), "peer-receipt-route");
|
|
38
38
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CrossSessionHoldCause } from "./cross-session-judge.js";
|
|
2
|
-
/** The in-process held buffer's capacity: a hold past this evicts the OLDEST
|
|
3
|
-
*
|
|
2
|
+
/** The in-process held buffer's capacity, counted in cards a person has not answered: a hold past this evicts the OLDEST such
|
|
3
|
+
* entry that tells its sender as `expired` with a receipt (CC `Q=100`); an approved or handed-over card neither counts nor is
|
|
4
|
+
* evicted. Per recipient session. */
|
|
4
5
|
export declare const PEER_HELD_QUEUE_CAP = 100;
|
|
5
6
|
/** An idle subscription's time to live, on BOTH halves (CC `NRt`, 12 h): the target sweeps a
|
|
6
7
|
* subscriber older than this silently; the requester's own timer answers `expired` at the same age. */
|
|
@@ -77,10 +78,20 @@ export declare const PEER_DROP_REASONS: readonly ["rate-limited", "duplicate", "
|
|
|
77
78
|
export type PeerDropReason = (typeof PEER_DROP_REASONS)[number];
|
|
78
79
|
/** CC `ule` — the recipient suffix: unique non-empty labels, at most three named. */
|
|
79
80
|
export declare function peerRecipientSuffix(recipients: readonly string[]): string;
|
|
81
|
+
/**
|
|
82
|
+
* What released a held message to its recipient — the two ways a held card leaves for the live run, and the closed set a
|
|
83
|
+
* `delivered` receipt's `detail` carries: `approved` (a person on the recipient's side said yes) and `rejudge` (the recipient's
|
|
84
|
+
* settings or state moved so that its own policy now delivers the message; no one was asked).
|
|
85
|
+
*/
|
|
86
|
+
export declare const PEER_RELEASE_CAUSES: readonly ["approved", "rejudge"];
|
|
87
|
+
export type PeerReleaseCause = (typeof PEER_RELEASE_CAUSES)[number];
|
|
88
|
+
export declare function isPeerReleaseCause(v: unknown): v is PeerReleaseCause;
|
|
80
89
|
/**
|
|
81
90
|
* CC `y$e` — the model-face delivery receipt for the non-drop states (`held_by_policy` is sema's: CC
|
|
82
91
|
* renders every hold as awaiting approval, whatever its cause). `count` folds several
|
|
83
92
|
* receipts of one state into one line (the requester's drain may fold; a single record renders as 1).
|
|
93
|
+
* `detail` rides two states: on `refused` the label of who refused it there, on `delivered` the {@link PeerReleaseCause}; a
|
|
94
|
+
* `delivered` receipt that names none (an engine that did not say) reads as `approved`, the form that receipt always had.
|
|
84
95
|
*/
|
|
85
96
|
export declare function renderCrossSessionDeliveryNotice(state: Exclude<PeerDeliveryReceiptState, "dropped">, count: number, recipients?: readonly string[], detail?: string): string;
|
|
86
97
|
/** CC `S$e` — the drop reasons, rendered. */
|
|
@@ -36,6 +36,14 @@ export function peerRecipientSuffix(recipients) {
|
|
|
36
36
|
return ` (recipient: ${uniq[0]})`;
|
|
37
37
|
return ` (recipients: ${uniq.slice(0, 3).join(", ")}${uniq.length > 3 ? ", …" : ""})`;
|
|
38
38
|
}
|
|
39
|
+
export const PEER_RELEASE_CAUSES = Object.freeze(["approved", "rejudge"]);
|
|
40
|
+
export function isPeerReleaseCause(v) {
|
|
41
|
+
return typeof v === "string" && PEER_RELEASE_CAUSES.includes(v);
|
|
42
|
+
}
|
|
43
|
+
const PEER_RELEASE_WORDING = Object.freeze({
|
|
44
|
+
approved: ["approved and released to that session", ""],
|
|
45
|
+
rejudge: ["released to that session", " because its own settings or state changed; nobody there approved it"],
|
|
46
|
+
});
|
|
39
47
|
export function renderCrossSessionDeliveryNotice(state, count, recipients = [], detail) {
|
|
40
48
|
const n = Math.max(1, Math.floor(count));
|
|
41
49
|
const P = n === 1 ? "Your message to another session" : `${n} of your messages to another session`;
|
|
@@ -50,8 +58,10 @@ export function renderCrossSessionDeliveryNotice(state, count, recipients = [],
|
|
|
50
58
|
return `[Cross-session delivery notice] ${P} ${J} denied by the recipient user${R}. Not delivered to that session's assistant. Do not wait for a reply; continue, or choose another approach.`;
|
|
51
59
|
case "expired":
|
|
52
60
|
return `[Cross-session delivery notice] ${P} ${J} not approved before expiry${R}. Not delivered to that session's assistant. Do not wait for a reply; continue, or choose another approach.`;
|
|
53
|
-
case "delivered":
|
|
54
|
-
|
|
61
|
+
case "delivered": {
|
|
62
|
+
const [head, tail] = PEER_RELEASE_WORDING[isPeerReleaseCause(detail) ? detail : "approved"];
|
|
63
|
+
return `[Cross-session delivery notice] ${P} ${J} ${head}${R}${tail}.`;
|
|
64
|
+
}
|
|
55
65
|
case "refused": {
|
|
56
66
|
const said = detail !== undefined ? peerIdleNoticeLabel(detail) : undefined;
|
|
57
67
|
return said !== undefined
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type MailboxCrossProcessVerdict, type MailboxStore } from "../core/mailbox-store.js";
|
|
2
|
-
import { type FrameReceiver, type SessionAddress, type SessionBoxBinding, type SystemInjectionPriority, type TaskNotificationPayload } from "../core/task-notification.js";
|
|
2
|
+
import { type FrameReceiver, type SessionAddress, type SessionBoxBinding, type SessionBoxVerdict, type SystemInjectionPriority, type TaskNotificationPayload } from "../core/task-notification.js";
|
|
3
3
|
import type { SessionStore } from "../core/session.js";
|
|
4
4
|
import { type FrameSettlement } from "../core/frame-settlement.js";
|
|
5
|
+
import { type PrincipalInboxAssistantSeat } from "./org-delivery-gate.js";
|
|
5
6
|
import { type EngineNotice, type RunnerDeps } from "../core/types.js";
|
|
6
7
|
import { type PermissionModeClass } from "./cross-session-envelope.js";
|
|
7
8
|
import { type CrossSessionInboundSettingLayers } from "./cross-session-judge.js";
|
|
@@ -44,19 +45,44 @@ export interface PeerDrainLanes {
|
|
|
44
45
|
* binds and declares external content exactly where a principal lane is. `undefined` = no drain on this leg.
|
|
45
46
|
*
|
|
46
47
|
* The principal inbox's consumer is the deployment's one declaration ({@link principalInboxConsumerOf}): `"terminals"` ⇒ a `drain`
|
|
47
|
-
* lane on every leg that drains its own session box; `
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* process), on a leg whose session id is a peer address ({@link isPeerSessionId}: the lane's queue and its host
|
|
51
|
-
* seated by the session's address, as the session box is
|
|
52
|
-
*
|
|
53
|
-
*
|
|
48
|
+
* lane on every leg that drains its own session box; `"assistant"` ⇒ a `pullOnly` lane on the leg the host handed an assistant seat
|
|
49
|
+
* that answers for it ({@link seatAnsweringFor}: `RunInternals.principalInboxAssistant`, whose session id is this leg's own — a seat
|
|
50
|
+
* another leg's internals carried into a session of its own is inert), over a mailbox that declares cross-process safety (the gate
|
|
51
|
+
* appends from another process), on a leg whose session id is a peer address ({@link isPeerSessionId}: the lane's queue and its host
|
|
52
|
+
* approval face are seated by the session's address, as the session box is). Every other leg mints no principal lane. The
|
|
53
|
+
* declaration is read on every leg that could carry the lane — one with a session box, or one over a cross-process mailbox — so a
|
|
54
|
+
* malformed declaration refuses there with its coded refusal. A seat that answers for the leg but finds no lane is refused where the
|
|
55
|
+
* `ReadInbox` mount is judged ({@link principalInboxSeatRefusal}), from this same result.
|
|
54
56
|
*/
|
|
55
57
|
export declare function peerDrainLanesOf(deps: Pick<RunnerDeps, "principalInboxConsumer" | "mailboxStore">, leg: {
|
|
56
58
|
sessionBox: SessionBoxBinding | undefined;
|
|
57
|
-
|
|
59
|
+
assistantSeat: unknown;
|
|
58
60
|
sessionId: string;
|
|
59
61
|
}): PeerDrainLanes | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Where a leg's `ReadInbox` stands: `free` = the tool selector leaves it mounted and no caller tool of the same name shadows it;
|
|
64
|
+
* `excluded` = the selector (`excludeTools` / `allowTools` / `excludeAllTools`) takes it away; `shadowed` = a caller tool in
|
|
65
|
+
* `TaskSpec.tools` carries the name.
|
|
66
|
+
*/
|
|
67
|
+
export type ReadInboxStanding = "free" | "excluded" | "shadowed";
|
|
68
|
+
/**
|
|
69
|
+
* The refusal of a leg the host handed an assistant seat that answers for it, on which the leg cannot read its principal inbox —
|
|
70
|
+
* `undefined` when there is nothing to refuse. Judged where the `ReadInbox` mount is, from the one binding result
|
|
71
|
+
* ({@link peerDrainLanesOf}) the drain binding reads too: the seat says "this leg reads the inbox", so a leg with no `pullOnly`
|
|
72
|
+
* principal lane, or with a lane and no reachable `ReadInbox` (a `pullOnly` lane never hands a letter at a boundary), would end its
|
|
73
|
+
* run having read nothing with nobody told. The sentence names every fact that does not hold: the declaration is not `"assistant"`;
|
|
74
|
+
* the mailbox does not declare cross-process safety (its own verdict's sentence); the session id is outside
|
|
75
|
+
* {@link PEER_SESSION_ID_GRAMMAR}; the host gave no `onTaskNotification` (no drain binds without it); `ReadInbox` is excluded or
|
|
76
|
+
* shadowed. A seat that is not an object with a non-blank string `sessionId` is a malformed host value, refused as such. A seat
|
|
77
|
+
* naming another session is inert ({@link seatAnsweringFor}); a leg handed no seat is not asked.
|
|
78
|
+
*/
|
|
79
|
+
export declare function principalInboxSeatRefusal(deps: Pick<RunnerDeps, "principalInboxConsumer" | "mailboxStore">, leg: {
|
|
80
|
+
assistantSeat: unknown;
|
|
81
|
+
sessionId: string;
|
|
82
|
+
lanes: PeerDrainLanes | undefined;
|
|
83
|
+
notifies: boolean;
|
|
84
|
+
readInbox: ReadInboxStanding;
|
|
85
|
+
}): Error | undefined;
|
|
60
86
|
/** The lane's mount verdict: the mailbox declaration's verdict, or this leg's own address refusal. */
|
|
61
87
|
export type PeerLaneMountVerdict = MailboxCrossProcessVerdict | {
|
|
62
88
|
ok: false;
|
|
@@ -88,7 +114,8 @@ export declare function judgePeerLaneMount(deps: {
|
|
|
88
114
|
* is idle). A DELEGATED CHILD never drains one: its addressable box is its `a*` handle (the tier-3
|
|
89
115
|
* revival lane), and a drain per child on a box nobody writes would cost a lease claim per turn on
|
|
90
116
|
* every background agent. Nor does a leg whose occupant could not be read (`unread`): its address is nobody's, and a drain
|
|
91
|
-
* would have no occupant to hand a record to. `undefined` on every refusal — silently: no host asked for a box here.
|
|
117
|
+
* would have no occupant to hand a record to. `undefined` on every refusal — silently: no host asked for a box here. The box
|
|
118
|
+
* itself is {@link sessionBoxVerdictOf}'s, the one judgment of where a session's box is.
|
|
92
119
|
*/
|
|
93
120
|
export declare function judgeSessionBoxDrain(deps: Pick<RunnerDeps, "mailboxStore" | "onError" | "sessionBoxEngineFrames">, leg: {
|
|
94
121
|
sessionId: string;
|
|
@@ -97,6 +124,17 @@ export declare function judgeSessionBoxDrain(deps: Pick<RunnerDeps, "mailboxStor
|
|
|
97
124
|
unread?: true;
|
|
98
125
|
sessions: Pick<SessionStore, "headOf"> | undefined;
|
|
99
126
|
}): SessionBoxBinding | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Where is session `sessionId`'s durable box at `scope`, on this deployment — or why is there none? Read by the drain mount of the
|
|
129
|
+
* session's own leg ({@link judgeSessionBoxDrain}) and by the Runner's unseated box seat (a frame addressed to a session no leg
|
|
130
|
+
* of which runs on that Runner: the deployment's deps answer for the box the session's legs mount, wherever they run). The
|
|
131
|
+
* refusal words are the mount verdict's: no mailbox, a mailbox or session store not safe across processes, an id outside the grammar.
|
|
132
|
+
*/
|
|
133
|
+
export declare function sessionBoxVerdictOf(deps: Pick<RunnerDeps, "mailboxStore" | "onError" | "sessionBoxEngineFrames">, at: {
|
|
134
|
+
sessionId: string;
|
|
135
|
+
scope: string;
|
|
136
|
+
sessions: Pick<SessionStore, "headOf"> | undefined;
|
|
137
|
+
}): SessionBoxVerdict;
|
|
100
138
|
/** What one pull of the box handed back: the records read (already rendered frames), and what is still waiting. */
|
|
101
139
|
export interface PulledInbox {
|
|
102
140
|
delivered: TaskNotificationPayload[];
|
|
@@ -104,6 +142,9 @@ export interface PulledInbox {
|
|
|
104
142
|
pending: number;
|
|
105
143
|
/** How many of the waiting records their sender marked urgent. */
|
|
106
144
|
urgent: number;
|
|
145
|
+
/** How many principal-inbox letters this pull withdrew because the host's observer did not take them
|
|
146
|
+
* ({@link PrincipalInboxAssistantSeat.onLetters}); they are among `pending`. Absent = none withdrawn. */
|
|
147
|
+
notTaken?: number;
|
|
107
148
|
}
|
|
108
149
|
/** The disposition arms of a `peer.inbound_disposition` notice (closed set; `detail.disposition`).
|
|
109
150
|
* #1036 adds `resupply_exhausted`: a record whose frame a compaction summarized away, was
|
|
@@ -155,14 +196,19 @@ export interface PeerSessionDrainOptions {
|
|
|
155
196
|
* A drain with neither lane is a binding bug and refuses at construction.
|
|
156
197
|
*/
|
|
157
198
|
sessionBox?: false;
|
|
199
|
+
/** The host's observer of the principal letters a pull hands over — the assistant seat's
|
|
200
|
+
* ({@link PrincipalInboxAssistantSeat.onLetters}); only beside a `pullOnly` principal lane, refused at construction otherwise. */
|
|
201
|
+
onLetters?: PrincipalInboxAssistantSeat["onLetters"];
|
|
158
202
|
/**
|
|
159
203
|
* The leg's external-content accounting for the INJECTION path: called whenever a letter
|
|
160
204
|
* from another principal (a record carrying the gate's `fromScope` anchor) is injected into the run, so the
|
|
161
205
|
* session is marked as having taken external content up exactly as a web fetch marks it. The PULL path is
|
|
162
206
|
* accounted by the `ReadInbox` tool's own declared class (its call is the mark), so a pulled letter is not
|
|
163
|
-
* marked twice. Absent ⇒ nothing to mark (no memory session on this leg).
|
|
207
|
+
* marked twice. Absent ⇒ nothing to mark (no memory session on this leg). Awaited BEFORE the letter goes
|
|
208
|
+
* out: it answers once the session's exposure stands durably, and a throw (or a rejected promise) means it
|
|
209
|
+
* could not be recorded — the letter is then not injected and stays owed (judged again next pass).
|
|
164
210
|
*/
|
|
165
|
-
markExternalContent?: (reason: string) => void
|
|
211
|
+
markExternalContent?: (reason: string) => void | Promise<void>;
|
|
166
212
|
/** The run's own notification injector (the task-notification lane; `next` tier). */
|
|
167
213
|
inject: (notification: TaskNotificationPayload, opts?: {
|
|
168
214
|
priority?: SystemInjectionPriority;
|
|
@@ -226,8 +272,9 @@ export interface PeerSessionDrain {
|
|
|
226
272
|
* but the records are RETURNED instead of injected, up to `limit` (default = the pass budget). A
|
|
227
273
|
* record a boundary already handed over is never returned again, and a record returned here is
|
|
228
274
|
* never injected later: one cursor (`settledUpTo`), two readers. Never acks (the next boundary does).
|
|
275
|
+
* `signal` = the call's abort, which the host's letter observer ({@link PeerSessionDrainOptions.onLetters}) races.
|
|
229
276
|
*/
|
|
230
|
-
pull(limit?: number, toolCallId?: string, charBudget?: number): Promise<PulledInbox>;
|
|
277
|
+
pull(limit?: number, toolCallId?: string, charBudget?: number, signal?: AbortSignal): Promise<PulledInbox>;
|
|
231
278
|
/**
|
|
232
279
|
* #1036 — THE TURN BOUNDARY's pass, called by the boundary lane as its tail so it runs AFTER that
|
|
233
280
|
* boundary's compaction (a hook of its own would have been registration-order luck). The settlement
|
|
@@ -270,7 +317,7 @@ export interface PeerLaneRefs {
|
|
|
270
317
|
* that carries no mode fact. Paired with `askEffective` in the one mode-class fold. */
|
|
271
318
|
permissionMode?: () => Parameters<typeof foldPermissionModeClass>[0];
|
|
272
319
|
/** The bound drain's pull face (filled by {@link bindPeerLaneDrain}); the `ReadInbox` tool reads it late. */
|
|
273
|
-
pull?:
|
|
320
|
+
pull?: PeerSessionDrain["pull"];
|
|
274
321
|
/** #1036 — the bound drain's BOUNDARY pass (filled by {@link bindPeerLaneDrain}); the leg's
|
|
275
322
|
* prepared seat copies it out so the turn-boundary lane can tail-call it. */
|
|
276
323
|
boundaryRound?: (o: {
|
|
@@ -394,6 +441,9 @@ export declare function bindPeerLaneDrain(harness: PeerDrainHarness, args: {
|
|
|
394
441
|
parked?: () => boolean;
|
|
395
442
|
lastTurnText?: () => string | undefined;
|
|
396
443
|
/** The leg's external-content mark for an injected letter from another principal ({@link PeerSessionDrainOptions.markExternalContent}). */
|
|
397
|
-
markExternalContent?: (reason: string) => void
|
|
444
|
+
markExternalContent?: (reason: string) => void | Promise<void>;
|
|
445
|
+
/** The assistant seat the host handed the leg (`RunInternals.principalInboxAssistant`, as handed): its letter observer rides the
|
|
446
|
+
* `pullOnly` lane that seat made ({@link PeerSessionDrainOptions.onLetters}). */
|
|
447
|
+
assistantSeat?: unknown;
|
|
398
448
|
}): PeerSessionDrain;
|
|
399
449
|
export {};
|