@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,5 +1,4 @@
|
|
|
1
1
|
import type { MaybeCompactOptions } from "../auto-compaction.js";
|
|
2
|
-
import type { TaskSpec } from "../types.js";
|
|
3
2
|
import type { Prepared, RunnerDepsSeat } from "./contracts.js";
|
|
4
3
|
/**
|
|
5
4
|
* The cost-optimization compaction options threaded into BOTH `maybeCompact` call
|
|
@@ -13,27 +12,14 @@ import type { Prepared, RunnerDepsSeat } from "./contracts.js";
|
|
|
13
12
|
* function itself always returns an object.
|
|
14
13
|
*/
|
|
15
14
|
export declare function seamCCompactionOptions(runner: RunnerDepsSeat, prepared: Prepared): Pick<MaybeCompactOptions, "summaryProvider" | "onCompaction" | "maxConsecutiveProviderReuse" | "consecutiveProviderReuse" | "onCommitted">;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
export declare function compactionHookOptions(runner: RunnerDepsSeat,
|
|
24
|
-
/** The leg's identity envelope, spread onto both compaction contexts by the wrappers
|
|
25
|
-
* below (the compaction module builds its contexts below the runner and cannot know the leg;
|
|
26
|
-
* the wrapper is the runner's seam). Every runner call site supplies `prepared.hookIdentity`;
|
|
27
|
-
* optional only so a context built without a leg stays honestly identity-less. */
|
|
28
|
-
identity?: import("../hooks.js").HookInvocationIdentity,
|
|
29
|
-
/** The leg's already-validated seat bound (`Prepared.hookTimeoutMs`) and its abort signal. Optional
|
|
30
|
-
* for the same reason `identity` is — a wrapper built without a prepared leg still works, on the
|
|
31
|
-
* default bound and with no signal. The signal is what keeps a hung compaction hook from holding a
|
|
32
|
-
* CANCELLED run's turn boundary for the whole deadline (the seat's post-abort grace). */
|
|
33
|
-
seatBound?: {
|
|
34
|
-
timeoutMs: number;
|
|
35
|
-
signal?: AbortSignal;
|
|
36
|
-
}): Pick<MaybeCompactOptions, "trigger" | "preCompact" | "postCompact">;
|
|
15
|
+
/** The pre/postCompact stations threaded into maybeCompact: `classic.PreCompact` and `classic.PostCompact` raised on the
|
|
16
|
+
* leg's bus (a station is wired only when a handler hangs on its event). Their failure and abort columns are the
|
|
17
|
+
* bus's — a handler that throws or runs past its budget is skipped and reported, so a failed gate is "no block, no
|
|
18
|
+
* instructions" and the compaction that was already deemed necessary proceeds. A `block` answered under a "forced"
|
|
19
|
+
* trigger is reported as ignored (maybeCompact enforces the ignore — blocking a compaction the provider/trim layer
|
|
20
|
+
* already demanded would kill the run). `signal` is the pass's abort (absent ⇒ each handler's own budget is the
|
|
21
|
+
* whole bound). */
|
|
22
|
+
export declare function compactionHookOptions(runner: RunnerDepsSeat, prepared: Pick<Prepared, "modBus" | "hookIdentity" | "sessionId">, trigger: "auto" | "manual" | "forced", signal: AbortSignal | undefined): Pick<MaybeCompactOptions, "trigger" | "preCompact" | "postCompact">;
|
|
37
23
|
/** Fold a finished compaction's `reused` flag into the run-scoped consecutive-reuse
|
|
38
24
|
* counter: a reused (provider) summary increments it, a real (LLM) summary resets it to 0. A no-op
|
|
39
25
|
* compaction (`compacted:false`) leaves the counter untouched. No-op when no provider is wired. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { asThrownError } from "../thrown-value.js";
|
|
1
|
+
import { classicEventBase, dispatchClassic, observeClassic, stringMembersAnswer, stringMembersOf } from "../mods/stations.js";
|
|
3
2
|
export function seamCCompactionOptions(runner, prepared) {
|
|
4
3
|
return {
|
|
5
4
|
...(runner.deps.summaryProvider
|
|
@@ -17,66 +16,42 @@ export function seamCCompactionOptions(runner, prepared) {
|
|
|
17
16
|
},
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
export function compactionHookOptions(runner,
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
export function compactionHookOptions(runner, prepared, trigger, signal) {
|
|
20
|
+
const bus = prepared.modBus;
|
|
21
|
+
const base = classicEventBase(prepared.hookIdentity);
|
|
22
|
+
const report = (err) => {
|
|
23
|
+
try {
|
|
24
|
+
runner.deps.onError?.(err, { phase: "hook", sessionId: prepared.sessionId });
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
}
|
|
28
|
+
};
|
|
27
29
|
return {
|
|
28
30
|
trigger,
|
|
29
|
-
...(
|
|
31
|
+
...(bus.hasHandlers("classic.PreCompact")
|
|
30
32
|
? {
|
|
31
|
-
preCompact: async (
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
runner.deps.onError?.(err, { phase: "hook", sessionId });
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
try {
|
|
41
|
-
const seat = await runHookSeat("preCompact", { timeoutMs: seatMs, ...(seatSignal !== undefined ? { signal: seatSignal } : {}) }, (sig) => pre.call(hooks, { ...ctx, signal: sig }));
|
|
42
|
-
if (seat.expired) {
|
|
43
|
-
report(hookSeatExpiredError("preCompact", seatMs, seat.cause, `the "${ctx.trigger}" compaction PROCEEDED unblocked and with no additional instructions`));
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
const r = seat.value;
|
|
47
|
-
if (r?.block && ctx.trigger === "forced") {
|
|
48
|
-
report(new Error(`a preCompact callback blocked a "forced" compaction — ignored (PTL/trim-pressure compaction is not optional): ${r.block}`));
|
|
49
|
-
}
|
|
50
|
-
return r;
|
|
51
|
-
}
|
|
52
|
-
catch (err) {
|
|
53
|
-
report(asThrownError(err));
|
|
33
|
+
preCompact: async (ctx) => {
|
|
34
|
+
const outcome = await dispatchClassic(bus, "classic.PreCompact", { ...base, trigger: ctx.trigger, ...(ctx.customInstructions !== undefined ? { customInstructions: ctx.customInstructions } : {}) }, { ...(signal !== undefined ? { signal } : {}), checkAnswer: stringMembersAnswer("classic.PreCompact", ["block", "additionalInstructions"]) });
|
|
35
|
+
if (outcome?.kind !== "answered")
|
|
54
36
|
return undefined;
|
|
37
|
+
const r = stringMembersOf(outcome.answer, ["block", "additionalInstructions"]);
|
|
38
|
+
if (r.block && ctx.trigger === "forced") {
|
|
39
|
+
report(new Error(`a preCompact handler blocked a "forced" compaction — ignored (PTL/trim-pressure compaction is not optional): ${r.block}`));
|
|
55
40
|
}
|
|
41
|
+
return r;
|
|
56
42
|
},
|
|
57
43
|
}
|
|
58
44
|
: {}),
|
|
59
|
-
...(
|
|
45
|
+
...(bus.hasHandlers("classic.PostCompact")
|
|
60
46
|
? {
|
|
61
|
-
postCompact:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
try {
|
|
74
|
-
runner.deps.onError?.(asThrownError(err), { phase: "hook", sessionId });
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
47
|
+
postCompact: (ctx) => observeClassic(bus, "classic.PostCompact", {
|
|
48
|
+
...base,
|
|
49
|
+
trigger: ctx.trigger,
|
|
50
|
+
summary: ctx.summary,
|
|
51
|
+
...(ctx.tokensBefore !== undefined ? { tokensBefore: ctx.tokensBefore } : {}),
|
|
52
|
+
...(ctx.tokensAfter !== undefined ? { tokensAfter: ctx.tokensAfter } : {}),
|
|
53
|
+
...(ctx.freedTokens !== undefined ? { freedTokens: ctx.freedTokens } : {}),
|
|
54
|
+
}, signal),
|
|
80
55
|
}
|
|
81
56
|
: {}),
|
|
82
57
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { checkedAgentConfigDir } from "../agent-config-dir.js";
|
|
2
2
|
import { checkedMediaByteCap } from "../media-byte-cap.js";
|
|
3
|
-
import { receiveOwnProperties, refuseProxy } from "../own-property-receipt.js";
|
|
3
|
+
import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-property-receipt.js";
|
|
4
4
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
5
5
|
import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
|
|
6
|
+
import { holdOwnCredentialValues } from "../secret-env.js";
|
|
6
7
|
export function retainRunnerDeps(deps) {
|
|
7
8
|
const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
|
|
8
9
|
refuseProxy(deps, words);
|
|
@@ -14,5 +15,14 @@ export function retainRunnerDeps(deps) {
|
|
|
14
15
|
if (Object.hasOwn(retained, seat))
|
|
15
16
|
Object.defineProperty(retained, seat, { value: copyReadDenySeat(Reflect.get(retained, seat)), enumerable: true, writable: true, configurable: true });
|
|
16
17
|
}
|
|
18
|
+
let consolidationKey;
|
|
19
|
+
try {
|
|
20
|
+
const chat = retained.memoryConsolidationDriver?.chat;
|
|
21
|
+
consolidationKey = typeof chat === "object" && chat !== null ? Reflect.get(chat, "apiKey") : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw receiptRefusal("RunnerDeps.memoryConsolidationDriver.chat threw while its apiKey was read at new Runner — refused (the thrown value is not repeated)");
|
|
25
|
+
}
|
|
26
|
+
holdOwnCredentialValues([typeof consolidationKey === "string" ? consolidationKey : undefined], retained.onNotice);
|
|
17
27
|
return retained;
|
|
18
28
|
}
|
|
@@ -36,7 +36,9 @@ import type { CacheBreakDetector, ToolFingerprintInput } from "../cache-break-de
|
|
|
36
36
|
import type { Checkpoint, CheckpointState, CheckpointStore, CheckpointToken, PendingSteerEntry, PlatformLimitReason, ReopenReason, ResourceLedger, ResourceLimitReason, ResumeOutcome, SerializedCheckpointState } from "../checkpoint-store.js";
|
|
37
37
|
import type { ExecutionOutcomeRecordWord } from "../checkpoint-execution-record.js";
|
|
38
38
|
import type { ClearedProjectionLedger, MicroCompactMachine, OccurrenceIndex } from "../context-edit.js";
|
|
39
|
-
import type {
|
|
39
|
+
import type { ModBus } from "../mods/kernel/index.js";
|
|
40
|
+
import type { LegModBus, LegMods, ModChainLink } from "../mods/stations.js";
|
|
41
|
+
import type { HookInvocationIdentity, OrgGateVerdict, PermissionDeniedPayload, PostToolBatchCall, ToolGateInput } from "../hooks.js";
|
|
40
42
|
import type { MaterializedMcp } from "../mcp.js";
|
|
41
43
|
import type { MemoryEngine } from "../memory-engine/engine.js";
|
|
42
44
|
import type { ResolvedSkillListingBudget } from "../skill-listing-budget.js";
|
|
@@ -62,6 +64,7 @@ import type { SessionReadFileStates } from "./session-read-file-states.js";
|
|
|
62
64
|
import type { LegModeCeiling, SessionModeSeats } from "./session-mode-seats.js";
|
|
63
65
|
import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools.js";
|
|
64
66
|
import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
|
|
67
|
+
import type { SideCallBook } from "./side-call-account.js";
|
|
65
68
|
import type { cacheFamilyOf } from "./usage-accounting.js";
|
|
66
69
|
/**
|
|
67
70
|
* The frozen task-start copies of the caller's tool-face control arrays, as the config-doors phase takes them (synchronously,
|
|
@@ -99,6 +102,14 @@ export interface ToolFaceSnapshot {
|
|
|
99
102
|
*/
|
|
100
103
|
export interface AnnounceOnceSink {
|
|
101
104
|
onError: NonNullable<RunnerDeps["onError"]>;
|
|
105
|
+
/**
|
|
106
|
+
* The same operator sink for a fact about the DEPLOYMENT rather than the conversation (a built-in tool pair that
|
|
107
|
+
* declines to mount because of the deployment's own selector or roster): deduplicated per RUNNER by
|
|
108
|
+
* `(code, text)` instead of per session, because a serving layer that opens a fresh session per request would
|
|
109
|
+
* otherwise repeat a standing configuration fact on every request. Independent of the session record — it
|
|
110
|
+
* writes nothing to the transcript. Same signature as `RunnerDeps.onError`.
|
|
111
|
+
*/
|
|
112
|
+
onErrorOncePerRunner: NonNullable<RunnerDeps["onError"]>;
|
|
102
113
|
}
|
|
103
114
|
/** Static per-tool irreversibility tier, resolved at prepare time by the safety scan. */
|
|
104
115
|
export type IrreversibilityTier = Map<string, "never" | "maybe" | "always">;
|
|
@@ -524,6 +535,8 @@ export interface Prepared {
|
|
|
524
535
|
* leg always knows its identity.
|
|
525
536
|
*/
|
|
526
537
|
hookIdentity: HookInvocationIdentity;
|
|
538
|
+
/** The leg's mods bus: one per leg, admitted at this leg's prepare (both seats, `plugin.register` run once for this leg). Every classic station raises its event on it; its `records` are the manifest's `mods[]`. */
|
|
539
|
+
modBus: ModBus;
|
|
527
540
|
/**
|
|
528
541
|
* This session's DURABLE box, present iff this leg mounted the session-box drain (a top-level leg
|
|
529
542
|
* over a cross-process-safe mailbox with a grammatical session id). The notification lane binds it
|
|
@@ -566,38 +579,18 @@ export interface Prepared {
|
|
|
566
579
|
peerBoundaryRound?: (o: {
|
|
567
580
|
continues: boolean;
|
|
568
581
|
}) => Promise<void>;
|
|
569
|
-
/**
|
|
570
|
-
* The per-invocation TIME BOUND every hook seat of this leg runs under (`Hooks.timeoutMs`, already
|
|
571
|
-
* validated — a garbage value was refused to the default and disclosed ONCE, here, rather than on
|
|
572
|
-
* every tool call). Published for the same reason `hookIdentity` is: the seats live in two files, and
|
|
573
|
-
* a number each station re-derived would be two answers to one wiring question — including two
|
|
574
|
-
* chances to re-refuse the same bad value.
|
|
575
|
-
*/
|
|
576
|
-
hookTimeoutMs: number;
|
|
582
|
+
/** The composition manifest (v3) the `prompt.assembled` frame reports (`trace.ts`, the same member types). */
|
|
577
583
|
promptManifest: {
|
|
578
|
-
|
|
584
|
+
identity: import("../trace.js").PromptManifestIdentity;
|
|
585
|
+
selectors: import("../trace.js").PromptManifestSelectors;
|
|
579
586
|
blocks: Array<{
|
|
580
587
|
id: string;
|
|
581
588
|
chars: number;
|
|
582
589
|
hash: string;
|
|
583
590
|
}>;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
* `stableBlocks` lane, owner "deployment") as an UNSALTED full sha256 of the section text —
|
|
588
|
-
* the center-publish ↔ manifest end-to-end reconciliation anchor. Core-native sections (env
|
|
589
|
-
* facts, memory tail, user role text) stay salted-only: a plain hash of a short guessable
|
|
590
|
-
* block is a dictionary-preimage surface for trace readers ([E]). */
|
|
591
|
-
sections?: Array<{
|
|
592
|
-
id: string;
|
|
593
|
-
slot: string;
|
|
594
|
-
carrier: string;
|
|
595
|
-
cadence: string;
|
|
596
|
-
cacheClass: string;
|
|
597
|
-
chars: number;
|
|
598
|
-
hash: string;
|
|
599
|
-
contentHash?: string;
|
|
600
|
-
}>;
|
|
591
|
+
sections: import("../trace.js").PromptManifestSection[];
|
|
592
|
+
/** Each overlay the composition superseded; absent when none was. */
|
|
593
|
+
superseded?: import("../../prompt-assembly/overlay.js").SupersededOverlay[];
|
|
601
594
|
/** S2 (additive): the mounted tools plane — contract identity, durable-replay aliases,
|
|
602
595
|
* presentation-invariant shape digest and full wire digest per tool (initial mount face). */
|
|
603
596
|
tools?: ToolManifestRow[];
|
|
@@ -615,26 +608,18 @@ export interface Prepared {
|
|
|
615
608
|
* seat chose it. Absent when nothing is deferred (there is no disclosure to describe). */
|
|
616
609
|
toolDisclosure?: ToolDisclosureManifest;
|
|
617
610
|
};
|
|
618
|
-
/** This run's
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
|
|
611
|
+
/** This run's prompt identity inputs and its pinned center layer's provenance, threaded to every compaction-boundary
|
|
612
|
+
* epoch selection so a boundary restates the same identity the prepare-time record names. Replaced by a committed
|
|
613
|
+
* compaction-boundary center change. */
|
|
614
|
+
promptIdentity: import("../../prompt-assembly/epoch.js").RunPromptIdentity;
|
|
622
615
|
/** The LIVE nine-element identity face (refreshed by deferred materialization and
|
|
623
616
|
* the deferred-materialization adoption swap); the manifest holds the prepare-time initial copy. */
|
|
624
617
|
turnSnapshot?: import("../../prompt-assembly/turn-snapshot.js").TurnPromptSnapshot;
|
|
625
|
-
/** The compaction-boundary center-
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
|
|
630
|
-
centerCompactionCandidate?: () => {
|
|
631
|
-
centerArtifactDigest?: string;
|
|
632
|
-
sourceRevision?: string;
|
|
633
|
-
clear?: true;
|
|
634
|
-
declaredSections: import("../../prompt-assembly/epoch.js").EpochDeclaredSections;
|
|
635
|
-
overheadTokensAfter: number;
|
|
636
|
-
apply: (committedArtifactDigest?: string) => void;
|
|
637
|
-
} | undefined;
|
|
618
|
+
/** The compaction-boundary center-layer seam (undefined = no source wired, or a child run — a child composes its
|
|
619
|
+
* parent's layer). Returns the maybeCompact `centerAdoption` fragment or undefined; `apply` runs post-CAS only
|
|
620
|
+
* (auto-compaction owns the ordering). Both `promptIdentity` and `promptOverheadTokens` on THIS object are mutated by
|
|
621
|
+
* a successful change (read them at call time, never capture early). */
|
|
622
|
+
centerCompactionCandidate?: () => NonNullable<import("../auto-compaction.js").MaybeCompactOptions["centerAdoption"]> | undefined;
|
|
638
623
|
/** Deferred-tool disclosure: the monotonic set of activated deferred-tool names. Empty
|
|
639
624
|
* (and no `tool_search` injected) when nothing is deferred. Mutated by BOTH disclosure lanes across
|
|
640
625
|
* the run — the injected `tool_search` and the direct-call placeholder lane (default ON) —
|
|
@@ -924,6 +909,12 @@ export interface Prepared {
|
|
|
924
909
|
walltimeMs: number;
|
|
925
910
|
};
|
|
926
911
|
};
|
|
912
|
+
/** The cell the run body binds with the leg's side-call door once `stats` exists; a lane built at prepare (the
|
|
913
|
+
* permission classifier) books its replies through it. A lane that books before the run body bound it is an
|
|
914
|
+
* engine defect and throws. */
|
|
915
|
+
sideCallBookRef: {
|
|
916
|
+
book?: SideCallBook;
|
|
917
|
+
};
|
|
927
918
|
/** The per-task human-review accumulator (synchronous `resolveAsk` waits this leg + the carried
|
|
928
919
|
* prior-leg burden seeded from the resumed checkpoint). The run loop ADDS the durable-resume latency
|
|
929
920
|
* (`now() − cp.suspendedAt`) on a resume, then surfaces it as `stats.humanReview` at assembly (omitted when
|
|
@@ -1323,6 +1314,9 @@ export interface PrepareResume {
|
|
|
1323
1314
|
/** The decision this resume carries (the gate word and, for a review, approve / edit / reject) — read by the mode seed
|
|
1324
1315
|
* (`modeRequestAfterResume`: an approved or edited `plan_review` exits a recorded plan to its pre-plan word). Absent on a prepare that resumes nothing. */
|
|
1325
1316
|
outcome?: ResumeRun["outcome"];
|
|
1317
|
+
/** The leg's mods bus, when the resume entrance already admitted it (a wake message's screen raises
|
|
1318
|
+
* `classic.UserPromptSubmit` before this leg prepares): prepare adopts it instead of admitting a second time. */
|
|
1319
|
+
legMods?: LegMods;
|
|
1326
1320
|
/** How many times this task already suspended (the resumed checkpoint's
|
|
1327
1321
|
* `suspendCount`). The next suspend mints `priorSuspendCount + 1`; past `maxSuspends` it fails
|
|
1328
1322
|
* (`suspend.loop`) instead of re-suspending. Absent/0 ⇒ no prior suspends. */
|
|
@@ -1544,24 +1538,23 @@ export interface InheritedGate extends InheritedAutoModeFace {
|
|
|
1544
1538
|
};
|
|
1545
1539
|
};
|
|
1546
1540
|
/**
|
|
1547
|
-
* Set
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
*
|
|
1553
|
-
*
|
|
1554
|
-
* face already on the chain, and a descendant substitutes a pass-through for the entry naming the
|
|
1555
|
-
* very callback its own gate will run. A per-task face (`TaskSpec.hooks`) is a different function in
|
|
1556
|
-
* the descendant (or absent), so it folds and travels.
|
|
1541
|
+
* Set by the constraint mint's caller on an entry whose `policy` is the folded form of an ancestor's
|
|
1542
|
+
* `classic.PreToolUse` chain (`createPreToolUseConstraintPolicy`): the chain that leg's admission MOUNTED, as the
|
|
1543
|
+
* entry declares it. It is read for ONE thing — a declaration that this entry carries a chain: beside a policy the
|
|
1544
|
+
* mint did not make, a declared judging `tool.check` handler is refused (`config.mods_invalid`; the guard has no bus to
|
|
1545
|
+
* be raised on), and such an entry is never treated as a caller policy (it licenses no ask grant). It is NEVER the
|
|
1546
|
+
* entry's identity: the chain an entry stands for is read off the bus its policy was minted over (that bus's admission
|
|
1547
|
+
* recorded it), so a host may hand any list here (`[]` included, or none) without moving what is judged.
|
|
1557
1548
|
*
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1549
|
+
* The identity (`sameInstallation`) is that chain plus the context the entry's questions are settled in — the frozen
|
|
1550
|
+
* approver, the two durable mandates, the environment, the classifier instance — and it is the CONSERVATIVE test:
|
|
1551
|
+
* two chains over the same registrations in a different order, or a re-built registration object, compare unequal,
|
|
1552
|
+
* and a bus no engine admission mounted is no leg's installation. Chain assembly does not re-append a leg already on
|
|
1553
|
+
* the chain; a descendant's own gate stands in for an entry only when that identity holds under no mandate (the
|
|
1554
|
+
* pass-through of its `classic.PreToolUse`, the skip of its `tool.check`); any other entry is judged on both events
|
|
1555
|
+
* under its own context — judged twice rather than skipped, never toward a missed one.
|
|
1563
1556
|
*/
|
|
1564
|
-
|
|
1557
|
+
mods?: readonly ModChainLink[];
|
|
1565
1558
|
/**
|
|
1566
1559
|
* The environment this screening face was installed against — the source of the `HookEnvCapabilities`
|
|
1567
1560
|
* handed to it, compared BY REFERENCE, `undefined` when the installation had no env face. Part of the
|
|
@@ -1646,14 +1639,21 @@ export interface RunInternals {
|
|
|
1646
1639
|
*/
|
|
1647
1640
|
toolCeiling?: readonly import("../tool-face.js").ToolSelectorLayer[];
|
|
1648
1641
|
/** Set by the delegation lane when the spawning run's prepare judged this leg's own tool lists (its spec's `allowTools` /
|
|
1649
|
-
* `excludeTools` — a definition's or the delegation tool's)
|
|
1650
|
-
* bound to exactly those lists. A prepare whose own lists digest to it does not judge them again
|
|
1651
|
-
*
|
|
1652
|
-
* workflow agent, a team member, a host's direct `runTask`), or lists that digest differently ⇒ the leg judges its own lists. */
|
|
1642
|
+
* `excludeTools` — a definition's or the delegation tool's) against a pool it could list: their digest (`toolListsDigest`), the
|
|
1643
|
+
* evidence bound to exactly those lists. A prepare whose own lists digest to it does not judge them again, and its rows record it
|
|
1644
|
+
* (`CheckpointState.toolListsJudged`) so a resume that hands no internals keeps the judgment. Absent (a delegation tool whose pool
|
|
1645
|
+
* cannot be listed, a workflow agent, a team member, a host's direct `runTask`), or lists that digest differently ⇒ the leg judges its own lists. */
|
|
1653
1646
|
toolListsJudged?: string;
|
|
1654
|
-
/** Set by the delegation lane: whose lists this leg's own are
|
|
1655
|
-
*
|
|
1656
|
-
|
|
1647
|
+
/** Set by the delegation lane: whose lists this leg's own are — the delegation tool that spawned it (its declared name, its mounted one), the
|
|
1648
|
+
* agent definition it was spawned as (absent ⇒ the tool's tool-level list) and `lists`, the digest of exactly the lists it wrote. A refusal
|
|
1649
|
+
* at the leg's prepare names that list (`delegationListWhere`), and the tool's name is a name of this leg's lineage: its own lists are
|
|
1650
|
+
* asked of a universe that carries it. Held only for the lists it wrote ({@link boundOwnToolLists}): other lists are the host's own
|
|
1651
|
+
* `TaskSpec` seats. Absent ⇒ no delegation tool behind the leg's own `TaskSpec` seats. */
|
|
1652
|
+
ownToolLists?: {
|
|
1653
|
+
readonly toolName: string;
|
|
1654
|
+
readonly definition?: string;
|
|
1655
|
+
readonly lists: string;
|
|
1656
|
+
};
|
|
1657
1657
|
/** Set only on an observer sidecar's legs: the leg kind whose protocol is the observer's report tool. */
|
|
1658
1658
|
observerLeg?: true;
|
|
1659
1659
|
/** The live repair bundle from a `runRepairLoop` attempt in flight (attemptCount>0). Serialized onto a
|
|
@@ -2647,6 +2647,8 @@ export interface ResumeRun {
|
|
|
2647
2647
|
* §4.3-3 reserves for the cross-process parked leg). Present only when a wake message passed a
|
|
2648
2648
|
* screen that supplied context. */
|
|
2649
2649
|
wakeMessageHookContext?: string;
|
|
2650
|
+
/** The resumed leg's bus when the wake-message screen admitted it before the claim — prepare adopts it. */
|
|
2651
|
+
legMods?: LegMods;
|
|
2650
2652
|
/** Compensation hook: called iff the resumed run fails with `resume.env_failed` (post-CAS
|
|
2651
2653
|
* workspace `resumeVM` failed) OR `resume.tool_unavailable` (P-7: the approved tool vanished) — in both
|
|
2652
2654
|
* the CAS already consumed the checkpoint but the pending action never ran. `resumeStream` supplies a
|
|
@@ -2695,11 +2697,12 @@ export interface SuspendReap {
|
|
|
2695
2697
|
export interface TurnBoundaryDeps {
|
|
2696
2698
|
spec: TaskSpec;
|
|
2697
2699
|
queue: PushQueue<TaskEvent>;
|
|
2698
|
-
/** The run loop's own latch — read for `userHalted` (the
|
|
2699
|
-
*
|
|
2700
|
-
*
|
|
2700
|
+
/** The run loop's own latch — read for `userHalted` (the `TaskStream.halt()` verb sets the harness stop latch directly,
|
|
2701
|
+
* not through the ctx primitive `Prepared.stopRequestedRef` mirrors: a halted boundary has no next request either, so
|
|
2702
|
+
* the bundle is not collected there) and for `callerStop`, the gate the boundary's compaction pass admits on and carries. */
|
|
2701
2703
|
loopLatch: {
|
|
2702
2704
|
readonly userHalted: boolean;
|
|
2705
|
+
readonly callerStop: import("./caller-stop-gate.js").CallerStopGate;
|
|
2703
2706
|
};
|
|
2704
2707
|
manualCompactRef: {
|
|
2705
2708
|
requested: boolean;
|
|
@@ -2722,9 +2725,8 @@ export interface TurnBoundaryDeps {
|
|
|
2722
2725
|
parentToolCallId?: string;
|
|
2723
2726
|
sourceTaskId?: string;
|
|
2724
2727
|
};
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
}, ctx?: import("../hooks.js").PostToolBatchContext) => PostToolBatchResult | undefined | Promise<PostToolBatchResult | undefined>) | undefined;
|
|
2728
|
+
/** Whether a handler hangs on `classic.PostToolBatch` (the batch is collected only then). */
|
|
2729
|
+
postToolBatchArmed: boolean;
|
|
2728
2730
|
batchArgs: Map<string, unknown> | undefined;
|
|
2729
2731
|
compactionBrain: Brain;
|
|
2730
2732
|
withinTaskCompaction: () => boolean;
|
|
@@ -2784,9 +2786,8 @@ export interface HarnessHandlersDeps {
|
|
|
2784
2786
|
toolProgress: ToolProgressLane;
|
|
2785
2787
|
writeFamilyOf: (name: string) => WriteFamily | undefined;
|
|
2786
2788
|
toolLabels: Map<string, string>;
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
}, ctx?: import("../hooks.js").PostToolBatchContext) => PostToolBatchResult | undefined | Promise<PostToolBatchResult | undefined>) | undefined;
|
|
2789
|
+
/** Whether a handler hangs on `classic.PostToolBatch` (the batch is collected only then). */
|
|
2790
|
+
postToolBatchArmed: boolean;
|
|
2790
2791
|
batchArgs: Map<string, unknown> | undefined;
|
|
2791
2792
|
runnerHooks: {
|
|
2792
2793
|
onError: RunnerDeps["onError"];
|
|
@@ -2841,10 +2842,9 @@ export interface RunnerSelfSeat {
|
|
|
2841
2842
|
* against the catalog in force): prepare hands its leg a call-time reader over it, because this is the one seat a
|
|
2842
2843
|
* running leg re-reads (geometry, not route — see `context-settings.ts`). */
|
|
2843
2844
|
contextOverlayOf?(ref: import("../model-seat.js").ModelRef | undefined): import("../context-settings.js").ContextWindowOverlay | undefined;
|
|
2844
|
-
/** The deployment-level gating baseline (deps toolPolicy
|
|
2845
|
+
/** The deployment-level gating baseline (deps toolPolicy) as a delegate wrapper — for assemblers that compose with it. */
|
|
2845
2846
|
readonly gateBaseline: {
|
|
2846
2847
|
toolPolicy?: RunnerDeps["toolPolicy"];
|
|
2847
|
-
hooks?: RunnerDeps["hooks"];
|
|
2848
2848
|
};
|
|
2849
2849
|
/** Whether a child task THIS runner runs can be placed in a tree other than the caller's (an explicit cwd, a worktree):
|
|
2850
2850
|
* true only when its deps carry an `executionEnvFactory` (live read — `swapDeps` replaces the deps). The delegation tool asks
|
|
@@ -2883,10 +2883,10 @@ export type PrepareTaskFn = (spec: TaskSpec, deps: RunnerDeps, sessions: Session
|
|
|
2883
2883
|
*/
|
|
2884
2884
|
export interface InstallingPhaseResult {
|
|
2885
2885
|
}
|
|
2886
|
-
/** The live-task handle `runLocked` publishes once the harness exists: the harness + abort
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
2889
|
-
* engine-minted run id, and the
|
|
2886
|
+
/** The live-task handle `runLocked` publishes once the harness exists: the harness + abort controller, the loop latch
|
|
2887
|
+
* (`ended` flips when the single `harness.prompt` settles; `userInterrupted` / `userHalted` are the interrupt and halt
|
|
2888
|
+
* verbs' attribution seats; `callerStop` is the run's caller-stop gate the three stop verbs trip), the run's reminder
|
|
2889
|
+
* mark, its session and engine-minted run id, and the bus + identity envelope the steer entrance screen runs on. */
|
|
2890
2890
|
export interface LiveHandle {
|
|
2891
2891
|
harness: AgentHarness;
|
|
2892
2892
|
abortController: AbortController;
|
|
@@ -2894,13 +2894,15 @@ export interface LiveHandle {
|
|
|
2894
2894
|
ended: boolean;
|
|
2895
2895
|
userInterrupted: boolean;
|
|
2896
2896
|
userHalted: boolean;
|
|
2897
|
+
callerStop: import("./caller-stop-gate.js").CallerStopGate;
|
|
2897
2898
|
};
|
|
2898
2899
|
reminderMark: string;
|
|
2899
2900
|
sessionId: string;
|
|
2900
2901
|
/** The run body's engine-minted run id, so the stream-layer verbs can name the run their disclosures are about. */
|
|
2901
2902
|
runId: string;
|
|
2902
|
-
hookTimeoutMs: number;
|
|
2903
2903
|
hookIdentity: HookInvocationIdentity;
|
|
2904
|
+
/** The leg's mods bus (the steer entrance raises `classic.UserPromptSubmit` on it). */
|
|
2905
|
+
modBus: LegModBus;
|
|
2904
2906
|
/** The leg's live permission-mode seat (`TaskStream.setPermissionMode` steers it). */
|
|
2905
2907
|
permissionMode: PermissionModeController;
|
|
2906
2908
|
}
|
|
@@ -2936,6 +2938,7 @@ export interface ManualCompactRef {
|
|
|
2936
2938
|
*/
|
|
2937
2939
|
export type EndOfTaskCompaction = {
|
|
2938
2940
|
compacted: boolean;
|
|
2941
|
+
pass?: string;
|
|
2939
2942
|
tokensBefore?: number;
|
|
2940
2943
|
freedTokens?: number;
|
|
2941
2944
|
triggerTokens?: number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { runWithCredentialOriginRefusals } from "../../brain/status-sink.js";
|
|
2
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
|
+
export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId }) {
|
|
4
|
+
const announced = new Set();
|
|
5
|
+
return (fn) => runWithCredentialOriginRefusals(({ modelId, boundOrigin, requestOrigin }) => {
|
|
6
|
+
const key = `${modelId}\u0000${boundOrigin}\u0000${requestOrigin}`;
|
|
7
|
+
if (announced.has(key))
|
|
8
|
+
return;
|
|
9
|
+
announced.add(key);
|
|
10
|
+
deliverEngineNotice(onNotice, {
|
|
11
|
+
code: "route.credential_origin_mismatch",
|
|
12
|
+
message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin}, the host it was ` +
|
|
13
|
+
`first sent to, and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
|
|
14
|
+
`the deployment has to give the model a credential for ${requestOrigin} (or point it back at ${boundOrigin}). ` +
|
|
15
|
+
`Said once per run for this model and these two hosts.`,
|
|
16
|
+
detail: { modelId, boundOrigin, requestOrigin, sessionId, runId },
|
|
17
|
+
});
|
|
18
|
+
}, fn);
|
|
19
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NoticeSeatInput } from "./notice-seat-input.js";
|
|
2
2
|
/** Where the announcement goes and whom it is attributed to — the same triple as the sibling `route.*` seats. */
|
|
3
|
-
export
|
|
4
|
-
onNotice: ((notice: EngineNotice) => void) | undefined;
|
|
5
|
-
sessionId: string;
|
|
6
|
-
runId: string;
|
|
7
|
-
}
|
|
3
|
+
export type ExtraBodyDroppedSeatInput = NoticeSeatInput;
|
|
8
4
|
export declare function createExtraBodyDroppedScope({ onNotice, sessionId, runId }: ExtraBodyDroppedSeatInput): <T>(fn: () => Promise<T>) => Promise<T>;
|