@sema-agent/core 7.51.2 → 7.53.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 +698 -2
- package/README.md +3 -1
- package/dist/agents/agent-transcript-tool.d.ts +1 -1
- package/dist/agents/cascade.js +4 -0
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/cumulative-stats.d.ts +3 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -5
- package/dist/agents/peer-session-drain.js +271 -180
- package/dist/agents/read-inbox-tool.d.ts +8 -1
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/repair-loop.js +4 -0
- package/dist/agents/send-message-tool.d.ts +11 -16
- package/dist/agents/send-message-tool.js +11 -13
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +105 -76
- package/dist/agents/tool-filter.d.ts +58 -13
- package/dist/agents/tool-filter.js +34 -14
- package/dist/bench/metrics.d.ts +1 -0
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +17 -13
- package/dist/brain/model-presets.d.ts +4 -5
- package/dist/brain/model-presets.js +6 -5
- package/dist/brain/open-responses.js +16 -12
- package/dist/brain/openai.js +16 -12
- package/dist/brain/request-params.d.ts +12 -33
- package/dist/brain/request-params.js +5 -2
- package/dist/brain/request-route.d.ts +9 -8
- package/dist/brain/request-route.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +123 -47
- package/dist/brain/route-adjudicator.js +171 -42
- package/dist/brain/route-conformance.js +2 -2
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/status-sink.d.ts +18 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +30 -13
- package/dist/core/allow-entry.d.ts +42 -9
- package/dist/core/allow-entry.js +25 -18
- package/dist/core/auto-compaction.d.ts +80 -20
- package/dist/core/auto-compaction.js +65 -18
- package/dist/core/auto-promote.d.ts +2 -1
- package/dist/core/auto-promote.js +2 -2
- package/dist/core/caller-tool-name.d.ts +9 -0
- package/dist/core/caller-tool-name.js +13 -0
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +57 -24
- package/dist/core/checkpoint-store.js +3 -3
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/compliance.js +3 -1
- package/dist/core/credential-vocabulary.d.ts +33 -8
- package/dist/core/credential-vocabulary.js +32 -7
- package/dist/core/decision-receipt.d.ts +2 -2
- package/dist/core/delegation-frames.d.ts +9 -2
- package/dist/core/delegation-name.d.ts +18 -0
- package/dist/core/delegation-name.js +47 -0
- package/dist/core/effective-path-target.d.ts +25 -6
- package/dist/core/effective-path-target.js +24 -2
- package/dist/core/engine-capabilities.d.ts +8 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +49 -21
- package/dist/core/frontmatter-fence.d.ts +10 -0
- package/dist/core/frontmatter-fence.js +6 -0
- package/dist/core/gate-fold.js +8 -25
- package/dist/core/gate-lanes.js +358 -274
- package/dist/core/gate-outcome.d.ts +11 -6
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +12 -3
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +283 -739
- package/dist/core/hooks.js +100 -193
- package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
- package/dist/{tools/fs → core}/image-admission.js +24 -6
- package/dist/core/locked-config.d.ts +84 -32
- package/dist/core/locked-config.js +128 -42
- package/dist/core/mcp-connection-pool.d.ts +4 -1
- package/dist/core/mcp-connection-pool.js +7 -2
- package/dist/core/mcp-probe.d.ts +12 -9
- package/dist/core/mcp-probe.js +3 -3
- package/dist/core/mcp-server-spec.d.ts +104 -10
- package/dist/core/mcp-server-spec.js +183 -33
- package/dist/core/mcp.d.ts +31 -20
- package/dist/core/mcp.js +66 -56
- package/dist/core/memory-engine/data-plane.js +5 -1
- package/dist/core/memory-engine/distiller.js +16 -2
- package/dist/core/memory-engine/engine.d.ts +22 -30
- package/dist/core/memory-engine/engine.js +16 -10
- package/dist/core/memory-engine/frontmatter.d.ts +6 -0
- package/dist/core/memory-engine/frontmatter.js +19 -16
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/mode-policy.d.ts +5 -16
- package/dist/core/mode-policy.js +7 -19
- package/dist/core/model-seat.d.ts +4 -1
- package/dist/core/mods/dollar.d.ts +109 -0
- package/dist/core/mods/dollar.js +154 -0
- package/dist/core/mods/host.d.ts +23 -0
- package/dist/core/mods/host.js +21 -0
- package/dist/core/mods/kernel/budget.d.ts +43 -0
- package/dist/core/mods/kernel/budget.js +83 -0
- package/dist/core/mods/kernel/dispatch.d.ts +100 -0
- package/dist/core/mods/kernel/dispatch.js +699 -0
- package/dist/core/mods/kernel/events.d.ts +245 -0
- package/dist/core/mods/kernel/events.js +210 -0
- package/dist/core/mods/kernel/index.d.ts +6 -0
- package/dist/core/mods/kernel/index.js +5 -0
- package/dist/core/mods/kernel/receive.d.ts +94 -0
- package/dist/core/mods/kernel/receive.js +188 -0
- package/dist/core/mods/kernel/registration.d.ts +131 -0
- package/dist/core/mods/kernel/registration.js +102 -0
- package/dist/core/mods/kernel/site-rules.d.ts +149 -0
- package/dist/core/mods/kernel/site-rules.js +296 -0
- package/dist/core/mods/stations.d.ts +344 -0
- package/dist/core/mods/stations.js +437 -0
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +13 -23
- package/dist/core/parent-spec-seat.d.ts +18 -7
- package/dist/core/parent-spec-seat.js +6 -2
- package/dist/core/path-identity.js +2 -1
- package/dist/core/permission-rule-model.d.ts +58 -9
- package/dist/core/permission-rule-model.js +81 -7
- package/dist/core/permission-rule-org.d.ts +163 -33
- package/dist/core/permission-rule-org.js +205 -71
- package/dist/core/permission-rule-syntax.d.ts +15 -0
- package/dist/core/permission-rule-syntax.js +24 -16
- package/dist/core/permission-rules.d.ts +14 -2
- package/dist/core/permission-rules.js +63 -23
- package/dist/core/prompt-section-seat.d.ts +15 -27
- package/dist/core/prompt-section-seat.js +73 -40
- package/dist/core/protocol-http-auth.d.ts +3 -1
- package/dist/core/protocol-http-auth.js +2 -0
- package/dist/core/reminder-mint.d.ts +2 -2
- package/dist/core/remote-env.d.ts +24 -12
- package/dist/core/remote-env.js +1 -0
- package/dist/core/resume-startup-cause.d.ts +16 -1
- package/dist/core/resume-startup-cause.js +4 -1
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +12 -2
- package/dist/core/retired-keys.js +15 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/announce-once-ledger.d.ts +31 -1
- package/dist/core/runner/announce-once-ledger.js +22 -0
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -1
- package/dist/core/runner/call-hook-stations.d.ts +23 -27
- package/dist/core/runner/call-hook-stations.js +58 -42
- package/dist/core/runner/caller-stop-gate.d.ts +25 -0
- package/dist/core/runner/caller-stop-gate.js +7 -0
- package/dist/core/runner/compaction-seams.d.ts +8 -22
- package/dist/core/runner/compaction-seams.js +28 -53
- package/dist/core/runner/construction-doors.js +11 -1
- package/dist/core/runner/contracts.d.ts +86 -83
- package/dist/core/runner/credential-origin-seat.d.ts +2 -0
- package/dist/core/runner/credential-origin-seat.js +19 -0
- package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
- package/dist/core/runner/gate-exit.d.ts +47 -36
- package/dist/core/runner/gate-exit.js +12 -5
- package/dist/core/runner/image.js +1 -2
- package/dist/core/runner/inline-image.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/notice-seat-input.d.ts +11 -0
- package/dist/core/runner/notice-seat-input.js +1 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +3 -1
- package/dist/core/runner/person-path-rows.js +3 -2
- package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
- package/dist/core/runner/prepare-ask-lane.js +6 -15
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
- package/dist/core/runner/prepare-config-doors.d.ts +52 -1
- package/dist/core/runner/prepare-config-doors.js +168 -143
- package/dist/core/runner/prepare-defer-classify.js +7 -11
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +7 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
- package/dist/core/runner/prepare-gate-stations.js +11 -10
- package/dist/core/runner/prepare-hands-readface.d.ts +1 -1
- package/dist/core/runner/prepare-hands-readface.js +2 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
- package/dist/core/runner/prepare-inherited-gate.js +10 -23
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +20 -7
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.js +10 -14
- package/dist/core/runner/prepare-policy-chain.d.ts +17 -15
- package/dist/core/runner/prepare-policy-chain.js +104 -109
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +11 -12
- package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
- package/dist/core/runner/prepare-prompt-assembly.js +138 -101
- package/dist/core/runner/prepare-prompt-inputs.d.ts +28 -23
- package/dist/core/runner/prepare-prompt-inputs.js +11 -10
- package/dist/core/runner/prepare-protocol-tools.d.ts +11 -7
- package/dist/core/runner/prepare-protocol-tools.js +20 -13
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.js +6 -10
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
- package/dist/core/runner/prepare-suspend-saga.js +7 -5
- package/dist/core/runner/prepare-task.js +41 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
- package/dist/core/runner/prepare-turn-wiring.js +29 -27
- package/dist/core/runner/prepare-wiring-manifest.d.ts +13 -9
- package/dist/core/runner/prepare-wiring-manifest.js +14 -11
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +7 -5
- package/dist/core/runner/resume-apply.d.ts +5 -2
- package/dist/core/runner/resume-apply.js +24 -42
- package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
- package/dist/core/runner/resume-checkpoint-screen.js +9 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-preflight.js +38 -16
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +4 -5
- package/dist/core/runner/run-brain-sinks.d.ts +3 -2
- package/dist/core/runner/run-brain-sinks.js +5 -1
- package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
- package/dist/core/runner/run-compaction-machinery.js +7 -33
- package/dist/core/runner/run-harness-handlers.js +4 -2
- package/dist/core/runner/run-identity-wiring.d.ts +3 -1
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +103 -95
- package/dist/core/runner/run-notification-lane.js +1 -0
- package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
- package/dist/core/runner/run-recovery-lanes.js +14 -11
- package/dist/core/runner/run-settle-and-teardown.js +9 -28
- package/dist/core/runner/run-stop-and-final-verify.js +18 -25
- package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
- package/dist/core/runner/run-terminal-adoption.js +34 -22
- package/dist/core/runner/run-tool-mount-facts.js +5 -3
- package/dist/core/runner/run-turn-boundary.js +32 -37
- package/dist/core/runner/runtask.d.ts +6 -7
- package/dist/core/runner/runtask.js +15 -73
- package/dist/core/runner/session-rule-policy.d.ts +5 -5
- package/dist/core/runner/session-rule-policy.js +13 -8
- package/dist/core/runner/side-call-account.d.ts +68 -0
- package/dist/core/runner/side-call-account.js +61 -0
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-halt-verbs.js +12 -17
- package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +20 -38
- package/dist/core/runner/sub-agent-deny-lists.d.ts +124 -23
- package/dist/core/runner/sub-agent-deny-lists.js +230 -71
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-end-body.d.ts +5 -6
- package/dist/core/runner/tool-end-body.js +6 -4
- package/dist/core/runner/tool-not-executed.d.ts +15 -0
- package/dist/core/runner/tool-not-executed.js +30 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -7
- package/dist/core/runner/tool-occurrence.js +5 -5
- package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
- package/dist/core/runner-deps.d.ts +43 -36
- package/dist/core/safety-merge-corpus.js +18 -2
- package/dist/core/secret-env.d.ts +88 -20
- package/dist/core/secret-env.js +192 -38
- package/dist/core/session-policy-store.d.ts +71 -16
- package/dist/core/session-policy-store.js +138 -28
- package/dist/core/session-reconcile.d.ts +4 -0
- package/dist/core/session-reconcile.js +2 -1
- package/dist/core/shell-read-silence.js +3 -32
- package/dist/core/side-query.d.ts +5 -3
- package/dist/core/skill-grant.d.ts +3 -2
- package/dist/core/skill-grant.js +17 -9
- package/dist/core/skills-directory.d.ts +31 -11
- package/dist/core/skills-directory.js +655 -104
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/task-event.d.ts +49 -3
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-result.d.ts +8 -0
- package/dist/core/task-spec.d.ts +20 -19
- package/dist/core/task-stream.d.ts +14 -4
- package/dist/core/tighten-task-spec.d.ts +4 -3
- package/dist/core/tighten-task-spec.js +2 -4
- package/dist/core/tool-check-reading.d.ts +74 -0
- package/dist/core/tool-check-reading.js +80 -0
- package/dist/core/tool-policy.d.ts +62 -18
- package/dist/core/tool-policy.js +86 -15
- package/dist/core/tool-registry.d.ts +20 -0
- package/dist/core/tool-registry.js +4 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +51 -32
- package/dist/core/types.d.ts +2 -2
- package/dist/core/types.js +1 -1
- package/dist/core/unc-spelling.d.ts +10 -0
- package/dist/core/unc-spelling.js +3 -0
- package/dist/core/untrusted-egress.d.ts +8 -0
- package/dist/core/untrusted-egress.js +4 -1
- package/dist/core/untrusted-text.d.ts +16 -0
- package/dist/core/untrusted-text.js +7 -2
- package/dist/core/user-attachment.d.ts +25 -4
- package/dist/core/user-attachment.js +63 -42
- package/dist/core/wiring-manifest.d.ts +18 -15
- package/dist/core/wiring-manifest.js +2 -2
- package/dist/engine/compaction/utils.js +1 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
- package/dist/engine/execution-env/symlink-chain.js +1 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +5 -4
- package/dist/engine/harness/types.d.ts +20 -16
- package/dist/engine/harness/types.js +7 -1
- package/dist/engine/llm/types.d.ts +12 -7
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +18 -6
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.js +3 -10
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/engine/session/session.js +4 -4
- package/dist/index.d.ts +33 -23
- package/dist/index.js +23 -15
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +2 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-spec.d.ts +4 -6
- package/dist/orchestration/run-spec.js +39 -63
- package/dist/orchestration/run-workflow-tool.js +1 -2
- package/dist/orchestration/workflow.d.ts +11 -3
- package/dist/orchestration/workflow.js +11 -2
- package/dist/prompt-assembly/artifact-store.d.ts +72 -56
- package/dist/prompt-assembly/artifact-store.js +60 -52
- package/dist/prompt-assembly/artifact.d.ts +90 -76
- package/dist/prompt-assembly/artifact.js +197 -145
- package/dist/prompt-assembly/assemble.d.ts +36 -29
- package/dist/prompt-assembly/assemble.js +34 -220
- package/dist/prompt-assembly/bands.d.ts +20 -0
- package/dist/prompt-assembly/bands.js +18 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
- package/dist/prompt-assembly/catalog/constitution.js +69 -0
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
- package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
- package/dist/prompt-assembly/catalog/index.d.ts +11 -0
- package/dist/prompt-assembly/catalog/index.js +60 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
- package/dist/prompt-assembly/catalog/modes.js +137 -0
- package/dist/prompt-assembly/catalog/role.d.ts +10 -0
- package/dist/prompt-assembly/catalog/role.js +157 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +138 -0
- package/dist/prompt-assembly/catalog/schema.js +25 -0
- package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
- package/dist/prompt-assembly/catalog/sections.js +98 -0
- package/dist/prompt-assembly/catalog/team.d.ts +4 -0
- package/dist/prompt-assembly/catalog/team.js +258 -0
- package/dist/prompt-assembly/composer.d.ts +26 -28
- package/dist/prompt-assembly/composer.js +124 -46
- package/dist/prompt-assembly/epoch.d.ts +89 -79
- package/dist/prompt-assembly/epoch.js +115 -142
- package/dist/prompt-assembly/explain.d.ts +58 -34
- package/dist/prompt-assembly/explain.js +21 -24
- package/dist/prompt-assembly/overlay.d.ts +137 -0
- package/dist/prompt-assembly/overlay.js +339 -0
- package/dist/prompt-assembly/renderers.d.ts +21 -0
- package/dist/prompt-assembly/renderers.js +39 -0
- package/dist/prompt-assembly/section-usage.d.ts +3 -3
- package/dist/prompt-assembly/section-usage.js +1 -1
- package/dist/prompt-assembly/select.d.ts +71 -0
- package/dist/prompt-assembly/select.js +106 -0
- package/dist/prompt-assembly/sugar.d.ts +31 -0
- package/dist/prompt-assembly/sugar.js +20 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
- package/dist/prompt-assembly/types.d.ts +45 -148
- package/dist/prompts/coordinator.d.ts +2 -21
- package/dist/prompts/coordinator.js +3 -255
- package/dist/prompts/cowork.d.ts +27 -16
- package/dist/prompts/cowork.js +2 -23
- package/dist/prompts/default.d.ts +38 -511
- package/dist/prompts/default.js +20 -288
- package/dist/prompts/supervisor.d.ts +6 -71
- package/dist/prompts/supervisor.js +6 -117
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +4 -3
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
- package/dist/tools/fs/dir-entries.d.ts +4 -2
- package/dist/tools/fs/dir-entries.js +16 -4
- package/dist/tools/fs/fs-bash.d.ts +1 -1
- package/dist/tools/fs/fs-bash.js +22 -11
- package/dist/tools/fs/fs-pdf.js +17 -13
- package/dist/tools/fs/fs-read.js +4 -3
- package/dist/tools/fs/fs-shared.d.ts +1 -10
- package/dist/tools/fs/fs-shared.js +3 -4
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/notebook.js +1 -1
- package/dist/tools/fs/pdf.d.ts +20 -10
- package/dist/tools/fs/pdf.js +19 -10
- package/dist/tools/fs/program-read-model.d.ts +68 -8
- package/dist/tools/fs/program-read-model.js +112 -33
- package/dist/tools/fs/program-read-model.rows.js +30 -10
- package/dist/tools/fs/read-deny-home.d.ts +25 -9
- package/dist/tools/fs/read-deny-home.js +28 -27
- package/dist/tools/fs/read-deny.d.ts +41 -11
- package/dist/tools/fs/read-deny.js +51 -5
- package/dist/tools/fs/safety.d.ts +4 -26
- package/dist/tools/fs/safety.js +10 -32
- package/dist/tools/fs/search.js +15 -10
- package/dist/tools/fs/shell-read-argv.d.ts +3 -2
- package/dist/tools/fs/shell-read-argv.js +118 -38
- package/dist/tools/fs/shell-read-establish.d.ts +5 -5
- package/dist/tools/fs/shell-read-establish.js +11 -61
- package/dist/tools/fs/shell-read-identity.js +6 -3
- package/dist/tools/fs/shell-read-judge.d.ts +13 -15
- package/dist/tools/fs/shell-read-judge.js +18 -4
- package/dist/tools/fs/shell-read-plan.d.ts +2 -2
- package/dist/tools/web.js +1 -1
- package/package.json +13 -1
- package/test/export-surface.snapshot.json +306 -103
- package/wire-changes/core@7.52.0.json +5859 -0
- package/wire-changes/core@7.53.0.json +1946 -0
- package/dist/core/hook-seats.d.ts +0 -66
- package/dist/core/hook-seats.js +0 -37
- package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
- package/dist/prompt-assembly/packs/sema-default.js +0 -147
- package/dist/prompts/simple-sections.d.ts +0 -58
- package/dist/prompts/simple-sections.js +0 -43
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { CheckpointError, readPendingSteerQueue } from "../checkpoint-store.js";
|
|
2
|
+
import { asResumeConfigRefusal } from "../mode-policy.js";
|
|
2
3
|
import { GLOBAL_USAGE_KEY, resolveUsageWindows, usageRetryAfterMs } from "../usage-window-store.js";
|
|
3
4
|
import { placementValueOrAbsent } from "./checkpoint-scope.js";
|
|
4
|
-
import {
|
|
5
|
-
import { resolveMicroCompactKnob } from "./prepare-config-doors.js";
|
|
5
|
+
import { assertNoRetiredInheritedConstraints } from "./retired-runner-deps.js";
|
|
6
6
|
export function resumeInternalsAndConfig(input) {
|
|
7
7
|
const { cp, config, internals, outcomeGate, runner } = input;
|
|
8
8
|
let windowEntrance;
|
|
9
|
-
|
|
10
|
-
resolveMicroCompactKnob(runner.deps.microCompact);
|
|
11
|
-
if (runner.deps.lockedConfig?.keys?.includes("toolPolicy") === true && config.basePolicyForResumeEdit !== undefined) {
|
|
12
|
-
throw new CheckpointError("checkpoint.invalid_outcome", "TaskSpec.basePolicyForResumeEdit is administratively locked by this deployment (locked key \"toolPolicy\") — a task-supplied " +
|
|
13
|
-
"resume-edit policy is refused pre-CAS (the checkpoint stays pending); remove the field or change the deployment's lock configuration");
|
|
14
|
-
}
|
|
9
|
+
asResumeConfigRefusal("deps", () => assertNoRetiredInheritedConstraints(internals));
|
|
15
10
|
let recheckGovernanceWindow;
|
|
16
11
|
{
|
|
17
12
|
const rowPrincipal = cp.principal || undefined;
|
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
2
|
-
import {
|
|
2
|
+
import { MAX_TIMER_MS } from "../mods/kernel/index.js";
|
|
3
3
|
import { hasDestroy } from "../remote-env.js";
|
|
4
4
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
5
5
|
import { describeSuppliedValue } from "./decide-continuation.js";
|
|
6
6
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
7
7
|
import { asThrownError } from "../thrown-value.js";
|
|
8
|
+
async function boundedPreflight(timeoutMs, signal, call) {
|
|
9
|
+
const controller = new AbortController();
|
|
10
|
+
const pending = Promise.resolve(call(controller.signal));
|
|
11
|
+
return await new Promise((resolve, reject) => {
|
|
12
|
+
let settled = false;
|
|
13
|
+
const finish = (act) => {
|
|
14
|
+
if (settled)
|
|
15
|
+
return;
|
|
16
|
+
settled = true;
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
signal?.removeEventListener("abort", onAbort);
|
|
19
|
+
act();
|
|
20
|
+
};
|
|
21
|
+
const expire = (cause) => finish(() => {
|
|
22
|
+
void pending.then(undefined, () => {
|
|
23
|
+
});
|
|
24
|
+
resolve({ expired: true, cause });
|
|
25
|
+
queueMicrotask(() => {
|
|
26
|
+
try {
|
|
27
|
+
controller.abort();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const onAbort = () => expire("aborted");
|
|
34
|
+
const timer = setTimeout(() => expire("timeout"), timeoutMs);
|
|
35
|
+
if (signal?.aborted === true)
|
|
36
|
+
onAbort();
|
|
37
|
+
else
|
|
38
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
39
|
+
pending.then((value) => finish(() => resolve({ expired: false, value })), (err) => finish(() => reject(asThrownError(err))));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
8
42
|
const RESUME_PREFLIGHT_DEFAULT_TIMEOUT_MS = 10_000;
|
|
9
43
|
export async function resumePreflight(input) {
|
|
10
44
|
const { token, cp, resumeSignal, recheckGovernanceWindow, store, runner, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
@@ -13,12 +47,12 @@ export async function resumePreflight(input) {
|
|
|
13
47
|
const rawDeadline = runner.deps.resumePreflightTimeoutMs;
|
|
14
48
|
let preflightTimeoutMs = RESUME_PREFLIGHT_DEFAULT_TIMEOUT_MS;
|
|
15
49
|
if (rawDeadline !== undefined) {
|
|
16
|
-
if (typeof rawDeadline === "number" && Number.isFinite(rawDeadline) && rawDeadline > 0 && rawDeadline <=
|
|
50
|
+
if (typeof rawDeadline === "number" && Number.isFinite(rawDeadline) && rawDeadline > 0 && rawDeadline <= MAX_TIMER_MS) {
|
|
17
51
|
preflightTimeoutMs = rawDeadline;
|
|
18
52
|
}
|
|
19
53
|
else {
|
|
20
54
|
try {
|
|
21
|
-
runner.deps.onError?.(new Error(`RunnerDeps.resumePreflightTimeoutMs is not a positive finite number within the
|
|
55
|
+
runner.deps.onError?.(new Error(`RunnerDeps.resumePreflightTimeoutMs is not a positive finite number within the timer ceiling of ${MAX_TIMER_MS}ms (got ${describeSuppliedValue(rawDeadline)}) — the resume preflight falls back to its own ${RESUME_PREFLIGHT_DEFAULT_TIMEOUT_MS}ms default`), { phase: "config", sessionId: cp.sessionId });
|
|
22
56
|
}
|
|
23
57
|
catch {
|
|
24
58
|
}
|
|
@@ -35,19 +69,7 @@ export async function resumePreflight(input) {
|
|
|
35
69
|
const refusalTail = "; the checkpoint stays pending and the same token is redeemable once the obstacle clears";
|
|
36
70
|
let verdict;
|
|
37
71
|
try {
|
|
38
|
-
const seat = await
|
|
39
|
-
timeoutMs: preflightTimeoutMs,
|
|
40
|
-
...(resumeSignal !== undefined ? { signal: resumeSignal } : {}),
|
|
41
|
-
abortEnds: true,
|
|
42
|
-
onBadTimeout: (badErr) => {
|
|
43
|
-
try {
|
|
44
|
-
runner.deps.onError?.(asThrownError(badErr), { phase: "hook", sessionId: cp.sessionId });
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
owner: runner.deps,
|
|
50
|
-
}, (sig) => preflight(info, sig));
|
|
72
|
+
const seat = await boundedPreflight(preflightTimeoutMs, resumeSignal, (sig) => preflight(info, sig));
|
|
51
73
|
if (seat.expired) {
|
|
52
74
|
if (seat.cause === "aborted")
|
|
53
75
|
throw new CheckpointError("checkpoint.resume_aborted", "the resume was aborted while the deployment's resumePreflight was still screening it — the checkpoint stays pending and is resumable with a live signal");
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { RunnerDeps } from "../types.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RunInternals } from "./contracts.js";
|
|
3
3
|
/** Runs on the caller's own argument at `new Runner` (the only point that still sees an inherited seat — construction then
|
|
4
4
|
* reads every own seat once into the plain copy the Runner keeps, `retainRunnerDeps`), and again in the pre-first-await
|
|
5
5
|
* config-doors phase and pre-CAS on a resume. */
|
|
6
6
|
export declare function assertNoRetiredRunnerDeps(deps: RunnerDeps): void;
|
|
7
|
-
/** The resume ladder's pre-claim door
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
export declare function assertNoRetiredResumeSeats(deps: RunnerDeps, config: ResumeTaskConfig, internals: RunInternals | undefined): void;
|
|
7
|
+
/** The resume ladder's pre-claim door over the inherited constraints a resume is handed: a retired member of one refuses before
|
|
8
|
+
* the claim (a refusal after it would burn the token on a store without `reopen`). The deps' retired seats and the caller
|
|
9
|
+
* policies' retired members are the config-door phase's, which a resume enters before the claim (`refuseResumeDoors`). */
|
|
10
|
+
export declare function assertNoRetiredInheritedConstraints(internals: RunInternals | undefined): void;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { assertNoRetiredKeys, assertNoRetiredToolPolicyKeys } from "../retired-keys.js";
|
|
2
|
-
import { assertCallerPoliciesCurrent, callerPolicySeats } from "../locked-config.js";
|
|
1
|
+
import { assertNoRetiredKeys, assertNoRetiredToolPolicyKeys, RETIRED_HOOKS_REPLACEMENT } from "../retired-keys.js";
|
|
3
2
|
const RETIRED_RUNNER_DEPS_KEYS = {
|
|
3
|
+
hooks: RETIRED_HOOKS_REPLACEMENT,
|
|
4
4
|
legacyRewindBoundaryProbe: "the rewind refusal always names both possibilities (never existed / retired whole-tree era); a deployment that holds that era's table answers the question on its own surface",
|
|
5
5
|
peerAdmission: "the peer lane's knob table is `RunnerDeps.peerLane` (the same fields: admission gate, delivery budgets, listing window)",
|
|
6
6
|
builtinWorkflows: "the engine ships no built-in named workflows — the Workflow tool's `{name}` resolves only `RunnerDeps.workflowScriptStore`; register any named workflow there",
|
|
7
7
|
graderEnvFactory: "the grader env reaches the repair loop as `RepairLoopConfig.graderEnv`, minted by the trusted control plane (`assertOracleIsolation` / `GraderEnv` unchanged)",
|
|
8
8
|
"hands.readCyberReminder": "a Read result carries only the reminders about that read (an empty file, an offset past the end, a file already in context) — no standing content-safety tail, so there is nothing to switch; a deployment that wants that sentence states it in its own `appendSystemPrompt`",
|
|
9
|
+
promptProvider: "a deployment changes prompt text through overlays: register a `prompt.compose` handler on `RunnerDeps.mods` answering `{ overlays }` (role base `replace`, a brand line `add` to the role band, a behavior or scenario `add`, a core-behavior `replace` / `append` / `drop`), choose the role base per task with `TaskSpec.promptRole`, and dispose of an MCP server's instructions with a `prompt.section` registration answering `{ text }` / `{ text: null }`",
|
|
9
10
|
memorySessionIncarnation: "the occupant behind a session id is a cell of the session row now — `SessionMetadata.incarnation` on the metadata `Session.getMetadata()` returns (forks also `forkedFromIncarnation`), with `SessionStore.incarnationOf` for by-id readers; put the token the old seat answered on your sessions instead. A deployment that drops the seat without surfacing the cell loses the axis: records bind by session id alone",
|
|
10
11
|
};
|
|
11
12
|
export function assertNoRetiredRunnerDeps(deps) {
|
|
12
13
|
assertNoRetiredKeys(deps, RETIRED_RUNNER_DEPS_KEYS, "RunnerDeps");
|
|
13
14
|
}
|
|
14
|
-
export function
|
|
15
|
-
assertNoRetiredRunnerDeps(deps);
|
|
16
|
-
assertCallerPoliciesCurrent(callerPolicySeats(config, deps, deps.lockedConfig?.keys?.includes("toolPolicy") === true));
|
|
15
|
+
export function assertNoRetiredInheritedConstraints(internals) {
|
|
17
16
|
for (const constraint of internals?.inheritedGate?.parentConstraints ?? [])
|
|
18
17
|
assertNoRetiredToolPolicyKeys(constraint.policy);
|
|
19
18
|
}
|
|
@@ -18,12 +18,13 @@ export interface RunBrainSinksInput {
|
|
|
18
18
|
};
|
|
19
19
|
/** borrowed-readonly — the reasoning lane's wire-facts consumer, the third sink the composition installs. */
|
|
20
20
|
observeReasoningWireFacts: (facts: ReasoningWireFacts) => void;
|
|
21
|
-
/** borrowed-readonly — the notice sink and the leg's ids; the fourth
|
|
21
|
+
/** borrowed-readonly — the notice sink and the leg's ids; the fourth and fifth sinks' announcers are minted from them. */
|
|
22
22
|
notice: ExtraBodyDroppedSeatInput;
|
|
23
23
|
}
|
|
24
24
|
export interface RunBrainSinksResult {
|
|
25
25
|
/** Compose the three brain ALS sinks around a brain-driving call. */
|
|
26
26
|
withBrainSinks: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
27
|
-
|
|
27
|
+
/** Compose the two leg-wide request sinks (the extraBody strip, the credential-origin refusal) around the whole leg. */
|
|
28
|
+
withLegRequestSinks: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
28
29
|
}
|
|
29
30
|
export declare function runBrainSinks(input: RunBrainSinksInput): RunBrainSinksResult;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { runWithBrainTelemetry, runWithReasoningWireFacts, runWithStatusSink } from "../../brain/status-sink.js";
|
|
2
2
|
import { createExtraBodyDroppedScope } from "./extra-body-dropped-seat.js";
|
|
3
|
+
import { createCredentialOriginRefusalScope } from "./credential-origin-seat.js";
|
|
3
4
|
import { createSafeNotifier, observeThenableRejection } from "../safe-notify.js";
|
|
4
5
|
import { emitTrace } from "../trace.js";
|
|
5
6
|
export function runBrainSinks(input) {
|
|
@@ -60,5 +61,8 @@ export function runBrainSinks(input) {
|
|
|
60
61
|
: { kind: "vision.placeholder", version: 1, taskId: rs.telemetry.taskId, count: t.count, ts: Date.now() });
|
|
61
62
|
};
|
|
62
63
|
const withBrainSinks = (fn) => runWithStatusSink(statusEmit, () => runWithBrainTelemetry(telemetryEmit, () => runWithReasoningWireFacts(observeReasoningWireFacts, fn)));
|
|
63
|
-
|
|
64
|
+
const withExtraBodyDropped = createExtraBodyDroppedScope(notice);
|
|
65
|
+
const withCredentialOriginRefusals = createCredentialOriginRefusalScope(notice);
|
|
66
|
+
const withLegRequestSinks = (fn) => withExtraBodyDropped(() => withCredentialOriginRefusals(fn));
|
|
67
|
+
return { withBrainSinks, withLegRequestSinks };
|
|
64
68
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Model } from "../../internal/llm.js";
|
|
2
2
|
import { type MaybeCompactOptions } from "../auto-compaction.js";
|
|
3
3
|
import { type ModelPricing } from "../pricing.js";
|
|
4
|
-
import type { Brain, TaskSpec } from "../types.js";
|
|
4
|
+
import type { Brain, RunnerDeps, TaskSpec } from "../types.js";
|
|
5
5
|
import type { Stats } from "./assemble-result.js";
|
|
6
6
|
import type { Prepared, RunnerDepsSeat, RunState } from "./contracts.js";
|
|
7
|
+
import { type SideCallBook } from "./side-call-account.js";
|
|
7
8
|
export interface RunCompactionMachineryInput {
|
|
8
9
|
/** borrowed-readonly — the task spec: the compaction settings. */
|
|
9
10
|
spec: TaskSpec;
|
|
@@ -17,6 +18,8 @@ export interface RunCompactionMachineryInput {
|
|
|
17
18
|
stats: Stats;
|
|
18
19
|
/** borrowed-readonly — the telemetry lane's price-table door, consulted for every summarizer table adopted. */
|
|
19
20
|
noteUnevaluablePriceTable: (p: ModelPricing) => void;
|
|
21
|
+
/** borrowed-readonly — the deployment's model catalog: where a degraded side-call reply's serving model is looked up. */
|
|
22
|
+
modelCatalog: RunnerDeps["models"];
|
|
20
23
|
/** borrowed-readonly — the Runner's deployment deps, read LIVE (`brain`, `pricing`, `onError`). */
|
|
21
24
|
runner: RunnerDepsSeat;
|
|
22
25
|
}
|
|
@@ -33,5 +36,8 @@ export interface RunCompactionMachineryResult {
|
|
|
33
36
|
};
|
|
34
37
|
/** The window-safety wiring (per call — a mid-task degrade moves the fallback target). */
|
|
35
38
|
windowSafetyOptions: (mainModel: Model) => Pick<MaybeCompactOptions, "fallbackBudget" | "onWindowSafety">;
|
|
39
|
+
/** The leg's one door onto the run's usage account (the same function `Prepared.sideCallBookRef.book` holds): every
|
|
40
|
+
* model call made beside the main loop is booked through it, once, with its lane. */
|
|
41
|
+
bookSideCall: SideCallBook;
|
|
36
42
|
}
|
|
37
43
|
export declare function runCompactionMachinery(input: RunCompactionMachineryInput): RunCompactionMachineryResult;
|
|
@@ -2,47 +2,21 @@ import { DEFAULT_COMPACTION_SETTINGS } from "../../internal/harness.js";
|
|
|
2
2
|
import { resolveTriggerWindow } from "../context-edit.js";
|
|
3
3
|
import { compactionEnabled, contextOverlayFor } from "../context-settings.js";
|
|
4
4
|
import { sanitizeCompactionSettings } from "../auto-compaction.js";
|
|
5
|
-
import {
|
|
5
|
+
import { modelCostToPricing } from "../pricing.js";
|
|
6
6
|
import { emitTrace } from "../trace.js";
|
|
7
7
|
import { runWithReasoningWireFacts, runWithStatusSink } from "../../brain/status-sink.js";
|
|
8
|
-
import {
|
|
8
|
+
import { sideCallBookOf } from "./side-call-account.js";
|
|
9
9
|
export function runCompactionMachinery(input) {
|
|
10
|
-
const { spec, prepared, rs, stats, noteUnevaluablePriceTable, runner } = input;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
if (!u)
|
|
14
|
-
return;
|
|
15
|
-
if (msg.usageMissing === true)
|
|
16
|
-
stats.usageMissing = true;
|
|
17
|
-
const fam = cacheFamilyOf(m);
|
|
18
|
-
const price = runner.deps.pricing?.[m.id] ?? modelCostToPricing(m.cost);
|
|
19
|
-
const priced = isModelPriced(m, runner.deps.pricing);
|
|
20
|
-
if (!priced)
|
|
21
|
-
rs.telemetry.unpricedSpend = true;
|
|
22
|
-
noteUnevaluablePriceTable(price);
|
|
23
|
-
const { totalInputTokens, uncachedInputTokens, costMicroUsd } = usageCostMicroUsd(fam, u, price);
|
|
24
|
-
stats.tokens += u.totalTokens || 0;
|
|
25
|
-
stats.promptTokens += uncachedInputTokens;
|
|
26
|
-
stats.totalInputTokens += totalInputTokens;
|
|
27
|
-
stats.cachedTokens += u.cacheRead || 0;
|
|
28
|
-
stats.cacheWriteTokens += u.cacheWrite || 0;
|
|
29
|
-
stats.outputTokens += u.output || 0;
|
|
30
|
-
stats.costMicroUsd += costMicroUsd;
|
|
31
|
-
stats.compactionMicroUsd = (stats.compactionMicroUsd ?? 0) + costMicroUsd;
|
|
32
|
-
emitTrace(rs.telemetry.tracer, () => ({
|
|
33
|
-
kind: "brain.call", version: 1, taskId: rs.telemetry.taskId, model: m.id, provider: m.provider,
|
|
34
|
-
promptTokens: uncachedInputTokens, totalInputTokens, completionTokens: u.output || 0,
|
|
35
|
-
cacheRead: u.cacheRead || 0, cacheWrite: u.cacheWrite || 0,
|
|
36
|
-
latencyMs: 0, ...(priced ? { costMicroUsd } : {}), ...(typeof msg?.stopReason === "string" ? { stopReason: msg.stopReason } : {}), ts: Date.now(),
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
10
|
+
const { spec, prepared, rs, stats, noteUnevaluablePriceTable, modelCatalog, runner } = input;
|
|
11
|
+
const bookSideCall = sideCallBookOf(stats, { telemetry: rs.telemetry, pricing: () => runner.deps.pricing, noteUnevaluablePriceTable, catalog: modelCatalog });
|
|
12
|
+
prepared.sideCallBookRef.book = bookSideCall;
|
|
39
13
|
const compactionBrain = {
|
|
40
14
|
stream: runner.deps.brain.stream,
|
|
41
15
|
complete: async (m, c, o) => {
|
|
42
16
|
const msg = await runWithStatusSink(() => { }, async () => await runWithReasoningWireFacts(() => { }, async () => runner.deps.brain.complete
|
|
43
17
|
? await runner.deps.brain.complete(m, c, o)
|
|
44
18
|
: await (await Promise.resolve(runner.deps.brain.stream(m, c, o))).result()));
|
|
45
|
-
|
|
19
|
+
bookSideCall("compaction", m, msg);
|
|
46
20
|
return msg;
|
|
47
21
|
},
|
|
48
22
|
};
|
|
@@ -98,5 +72,5 @@ export function runCompactionMachinery(input) {
|
|
|
98
72
|
}
|
|
99
73
|
},
|
|
100
74
|
});
|
|
101
|
-
return { compactionBrain, withinTaskCompaction, compactionBreaker, windowSafetyOptions };
|
|
75
|
+
return { compactionBrain, withinTaskCompaction, compactionBreaker, windowSafetyOptions, bookSideCall };
|
|
102
76
|
}
|
|
@@ -11,6 +11,7 @@ import { advanceCadenceClock, reduceToolEnd } from "./turn-attachments.js";
|
|
|
11
11
|
import { gatedCallIdOf } from "./park-commit.js";
|
|
12
12
|
import { hasVerifiableStructureSignal } from "./grounding-signal.js";
|
|
13
13
|
import { announceToolCall, batchResponseDigest, emitSettled } from "./tool-end-body.js";
|
|
14
|
+
import { stampRowNotExecuted } from "./tool-not-executed.js";
|
|
14
15
|
import { createResponseModelSeat } from "./response-model-seat.js";
|
|
15
16
|
import { createToolCallIdFoldSeat } from "./tool-call-id-fold-seat.js";
|
|
16
17
|
import { createFinishReasonSeat } from "./finish-reason-seat.js";
|
|
@@ -23,7 +24,7 @@ export function createHarnessHandlers(input) {
|
|
|
23
24
|
const toolCallIdFoldSeat = createToolCallIdFoldSeat(deps.runnerHooks.onNotice, { sessionId: prepared.sessionId, runId: prepared.runId });
|
|
24
25
|
const toolTurnIncompleteSeat = createToolTurnIncompleteSeat(deps.runnerHooks.onNotice, { sessionId: prepared.sessionId, runId: prepared.runId });
|
|
25
26
|
const finishReasonSeat = createFinishReasonSeat(deps.runnerHooks.onNotice, { sessionId: prepared.sessionId, runId: prepared.runId });
|
|
26
|
-
const { spec, queue, internals, ident, pushContent, emitCommitted, startedToolCallIds, toolStartAt, toolProgress, writeFamilyOf, toolLabels,
|
|
27
|
+
const { spec, queue, internals, ident, pushContent, emitCommitted, startedToolCallIds, toolStartAt, toolProgress, writeFamilyOf, toolLabels, postToolBatchArmed, batchArgs, internalsNotifier, mediaByteCapBytes } = deps;
|
|
27
28
|
const frames = { push: (f) => pushContent({ ...f, ...ident() }), structured: prepared.structuredProjector, mediaByteCapBytes };
|
|
28
29
|
const startOf = (e) => {
|
|
29
30
|
const label = toolLabels.get(e.toolName);
|
|
@@ -235,7 +236,7 @@ export function createHarnessHandlers(input) {
|
|
|
235
236
|
if (det !== undefined)
|
|
236
237
|
reduceToolEnd(rs.attach.attachState, det);
|
|
237
238
|
}
|
|
238
|
-
if (
|
|
239
|
+
if (postToolBatchArmed) {
|
|
239
240
|
if (prepared.blockedToolCalls.delete(event.toolCallId) || event.notExecuted === true) {
|
|
240
241
|
batchArgs?.delete(event.toolCallId);
|
|
241
242
|
}
|
|
@@ -266,6 +267,7 @@ export function createHarnessHandlers(input) {
|
|
|
266
267
|
...(event.notExecuted === true ? { notExecuted: true } : {}),
|
|
267
268
|
...(() => { const id = prepared.abortController.signal.aborted ? gatedCallIdOf(prepared) : undefined; return id !== undefined ? { gatedCallIdOfRun: id } : {}; })(),
|
|
268
269
|
}, frames);
|
|
270
|
+
stampRowNotExecuted(event.result, settled.notExecuted === true);
|
|
269
271
|
emitTrace(rs.telemetry.tracer, () => ({
|
|
270
272
|
kind: "tool.call",
|
|
271
273
|
version: 1,
|
|
@@ -4,6 +4,7 @@ import { type NotificationInjectionOutcome, type PendingSessionNotifications, ty
|
|
|
4
4
|
import type { PushQueue } from "../push-queue.js";
|
|
5
5
|
import type { TaskEvent, TaskSpec } from "../types.js";
|
|
6
6
|
import type { Stats } from "./assemble-result.js";
|
|
7
|
+
import { type CallerStopGate } from "./caller-stop-gate.js";
|
|
7
8
|
import type { CaptureOptOutRef, LiveHandle, ManualCompactRef, McpRedialRef, NotificationLaneBindings, NotifyRef, Prepared, RunInternals, RunnerDepsSeat, TaskIdRef } from "./contracts.js";
|
|
8
9
|
export interface RunIdentityWiringInput {
|
|
9
10
|
/** borrowed-readonly — the task spec: the task id and the memory / notification seats it names. */
|
|
@@ -60,11 +61,12 @@ export interface RunIdentityWiringResult {
|
|
|
60
61
|
};
|
|
61
62
|
/** The delegation-lifecycle emission closure both phases share (spawn here, terminal in the driver). */
|
|
62
63
|
emitDelegationLifecycle: (event: import("../types.js").DelegationLifecycleEvent) => void;
|
|
63
|
-
/** The loop-liveness latch
|
|
64
|
+
/** The loop-liveness latch, the two attribution seats (ended / userInterrupted / userHalted) and the caller-stop gate. */
|
|
64
65
|
loopLatch: {
|
|
65
66
|
ended: boolean;
|
|
66
67
|
userInterrupted: boolean;
|
|
67
68
|
userHalted: boolean;
|
|
69
|
+
callerStop: CallerStopGate;
|
|
68
70
|
};
|
|
69
71
|
/** This leg's usage counters, zeroed here; the harness-handlers lane is their writer from the first turn on. */
|
|
70
72
|
stats: Stats;
|
|
@@ -7,6 +7,7 @@ import { discloseDroppedPending, renderTaskNotificationXml, taskNotificationDedu
|
|
|
7
7
|
import { buildAppliedHumanInputEvent } from "../human-input-projection.js";
|
|
8
8
|
import { announceAcceptance, nextHumanInputSeq } from "./steer-admission.js";
|
|
9
9
|
import { deliverDelegationLifecycle, deliverEngineNotice, parentLegIds, undrainedUserInputNotices } from "../types.js";
|
|
10
|
+
import { mintCallerStopGate } from "./caller-stop-gate.js";
|
|
10
11
|
export function runIdentityWiring(input) {
|
|
11
12
|
const { spec, queue, prepared, internals, taskIdRef, onReady, manualCompactRef, notifyRef, captureOptOutRef, mcpRedialRef, injectTaskNotification, deliveredAtTurnOpen, peerInboundChainRef, notificationLane, pendingSessionNotifications, runner } = input;
|
|
12
13
|
notificationLane.harness = prepared.harness;
|
|
@@ -126,8 +127,8 @@ export function runIdentityWiring(input) {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
const loopLatch = { ended: false, userInterrupted: false, userHalted: false };
|
|
130
|
-
onReady({ harness: prepared.harness, abortController: prepared.abortController, loop: loopLatch, reminderMark: prepared.reminderMark, sessionId: prepared.sessionId, runId: prepared.runId,
|
|
130
|
+
const loopLatch = { ended: false, userInterrupted: false, userHalted: false, callerStop: mintCallerStopGate(spec.signal) };
|
|
131
|
+
onReady({ harness: prepared.harness, abortController: prepared.abortController, loop: loopLatch, reminderMark: prepared.reminderMark, sessionId: prepared.sessionId, runId: prepared.runId, hookIdentity: prepared.hookIdentity, modBus: prepared.modBus, permissionMode: prepared.permissionMode });
|
|
131
132
|
const stats = { turns: 0, tokens: 0, toolCalls: 0, promptTokens: 0, totalInputTokens: 0, cachedTokens: 0, cacheWriteTokens: 0, cacheWriteTokensLong: 0, outputTokens: 0, costMicroUsd: 0 };
|
|
132
133
|
return { runSourceTaskId, parentToolCallId, ident, emitDelegationLifecycle, loopLatch, stats, internalsNotifier, undrainedUserAtEnd: { get current() { return undrainedUserAtEnd; } }, userInputLostAtEnd: { get current() { return userInputLostAtEnd; } } };
|
|
133
134
|
}
|