@sema-agent/core 7.54.1 → 7.56.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 +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +15 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.js +12 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveModelDisplayLabel } from "../core/roles.js";
|
|
1
|
+
import { presetRoleBaseOf, resolveModelDisplayLabel } from "../core/roles.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { availableParallelism } from "node:os";
|
|
@@ -9,18 +9,20 @@ import { terminalProjection } from "../core/runner/terminal-projection.js";
|
|
|
9
9
|
import { steeringError } from "../core/runner/steer-admission.js";
|
|
10
10
|
import { builtinAgentDefinitions } from "../agents/builtin-agents.js";
|
|
11
11
|
import { GENERAL_PURPOSE_SUBAGENT_TYPE, markerFragment } from "../agents/subagent.js";
|
|
12
|
-
import {
|
|
12
|
+
import { runnerRoleMap } from "../agents/child-model-seat.js";
|
|
13
|
+
import { namesRoleBase } from "../prompt-assembly/role-base.js";
|
|
13
14
|
import { combinePolicies, createAllowDenyPolicy } from "../core/tool-policy.js";
|
|
14
15
|
import { createSafeNotifier } from "../core/safe-notify.js";
|
|
15
|
-
import { callKeyOrdinal, oversizeJournalResult, journalOversizeTombstone, JOURNAL_OVERSIZE_ERROR_CODE, MAX_JOURNAL_RESULT_BYTES } from "../core/workflow-journal-store.js";
|
|
16
|
+
import { callKeyOrdinal, clampRunIdText, oversizeJournalResult, journalOversizeTombstone, readWorkflowJournalEntry, JOURNAL_OVERSIZE_ERROR_CODE, MAX_JOURNAL_RESULT_BYTES, WorkflowJournalIncompatibleError, } from "../core/workflow-journal-store.js";
|
|
16
17
|
import { isWorkflowRunActive, closeWorkflowChannel, markWorkflowActive, publishWorkflowEvent } from "./workflow-observe.js";
|
|
17
18
|
import { isDurablePause } from "../agents/suspend-guard.js";
|
|
18
19
|
import { RUNNING_AGENT_OBSERVE_EVERY_BEATS } from "../config/defaults.js";
|
|
19
20
|
import { boundInputHashOf } from "../core/canonical-json.js";
|
|
20
21
|
import { boundedRedactedSummary, egressThrownText } from "../core/untrusted-egress.js";
|
|
21
22
|
import { delimitUntrusted } from "../core/untrusted-text.js";
|
|
22
|
-
import { OUTPUT_TOOL_NAME } from "../core/
|
|
23
|
+
import { OUTPUT_TOOL_NAME } from "../core/tool-catalog-entries.js";
|
|
23
24
|
import { deniedToolNamesOf, judgeHostToolCeiling } from "../core/runner/sub-agent-deny-lists.js";
|
|
25
|
+
import { namesEveryTool } from "../agents/tool-filter.js";
|
|
24
26
|
import { compileOutputSchema } from "../core/runner/strict-output-schema.js";
|
|
25
27
|
import { WorkflowBudgetExceededError, WorkflowNestingError, WorkflowAgentBlockedError, WorkflowAgentParkedError, WorkflowAgentSchemaError, WorkflowAgentStalledError, WorkflowMaxAgentsError, WORKFLOW_SPAWN_BLOCKED_ERROR_CODE } from "./workflow-types.js";
|
|
26
28
|
import { WorkflowScriptError } from "./workflow-meta.js";
|
|
@@ -104,7 +106,7 @@ export function applyWorkflowAgentType(spec, agentType, registry) {
|
|
|
104
106
|
throw new Error(`agent(): unknown agentType "${agentType}". Known types: ${known}. Pass a registered agent type, or omit agentType for the default workflow subagent.`);
|
|
105
107
|
}
|
|
106
108
|
const out = { ...spec };
|
|
107
|
-
if (out
|
|
109
|
+
if (!namesRoleBase(out) && def.systemPrompt !== undefined)
|
|
108
110
|
out.systemPrompt = def.systemPrompt;
|
|
109
111
|
if (out.model === undefined && def.model !== undefined)
|
|
110
112
|
out.model = def.model;
|
|
@@ -120,7 +122,8 @@ export function applyWorkflowAgentType(spec, agentType, registry) {
|
|
|
120
122
|
if (out.memoryPersistenceCapable === undefined && def.memoryPersistenceCapable !== undefined)
|
|
121
123
|
out.memoryPersistenceCapable = def.memoryPersistenceCapable;
|
|
122
124
|
if (def.allowTools !== undefined || def.denyTools !== undefined) {
|
|
123
|
-
const
|
|
125
|
+
const allow = def.allowTools !== undefined && !def.allowTools.some(namesEveryTool) ? def.allowTools : undefined;
|
|
126
|
+
const perType = createAllowDenyPolicy({ ...(allow ? { allow } : {}), ...(def.denyTools ? { deny: deniedToolNamesOf(`workflow agentType "${def.name}"`, def.denyTools) } : {}) });
|
|
124
127
|
out.toolPolicy = out.toolPolicy ? combinePolicies(out.toolPolicy, perType) : perType;
|
|
125
128
|
}
|
|
126
129
|
return out;
|
|
@@ -132,21 +135,29 @@ export function workflowAgentRegistry(opts) {
|
|
|
132
135
|
return [...deployment, ...builtins];
|
|
133
136
|
}
|
|
134
137
|
function withWorkflowChildPersona(spec, schema) {
|
|
135
|
-
if (spec
|
|
138
|
+
if (!namesRoleBase(spec)) {
|
|
136
139
|
return { ...spec, systemPrompt: schema ? WORKFLOW_SUBAGENT_PROMPT_SCHEMA : WORKFLOW_SUBAGENT_PROMPT };
|
|
137
140
|
}
|
|
138
141
|
const note = schema ? WORKFLOW_SUBAGENT_APPEND_SCHEMA : WORKFLOW_SUBAGENT_APPEND;
|
|
139
142
|
return { ...spec, appendSystemPrompt: spec.appendSystemPrompt ? `${spec.appendSystemPrompt}\n\n${note}` : note };
|
|
140
143
|
}
|
|
141
144
|
function withWorkflowChildSeats(typed, inheritedModelSnap, inheritedThinkingSnap, roles) {
|
|
142
|
-
const
|
|
143
|
-
return {
|
|
145
|
+
const seated = {
|
|
144
146
|
...typed,
|
|
145
|
-
modelRole: typed.modelRole
|
|
147
|
+
modelRole: typed.modelRole === undefined ? "subagent" : typed.modelRole,
|
|
146
148
|
...(typed.model === undefined && inheritedModelSnap !== undefined ? { model: inheritedModelSnap } : {}),
|
|
147
149
|
...(typed.thinking === undefined && inheritedThinkingSnap !== undefined ? { thinking: inheritedThinkingSnap } : {}),
|
|
148
|
-
...(typed.systemPrompt === undefined && statedPersona !== undefined ? { systemPrompt: statedPersona } : {}),
|
|
149
150
|
};
|
|
151
|
+
if (namesRoleBase(seated))
|
|
152
|
+
return seated;
|
|
153
|
+
let preset;
|
|
154
|
+
try {
|
|
155
|
+
preset = presetRoleBaseOf(seated, { roles });
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
preset = undefined;
|
|
159
|
+
}
|
|
160
|
+
return { ...seated, ...preset };
|
|
150
161
|
}
|
|
151
162
|
export function workflowAgentCallKey(ordinal, spec, opts) {
|
|
152
163
|
const identity = {
|
|
@@ -229,17 +240,14 @@ export class WorkflowResultTooLargeError extends Error {
|
|
|
229
240
|
this.name = "WorkflowResultTooLargeError";
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this.ordinal = ordinal;
|
|
241
|
-
this.name = "WorkflowJournalIncompatibleError";
|
|
242
|
-
}
|
|
243
|
+
function judgedJournal(runId, rows) {
|
|
244
|
+
return rows.map((raw) => {
|
|
245
|
+
const read = readWorkflowJournalEntry(raw);
|
|
246
|
+
if (!("corrupt" in read))
|
|
247
|
+
return read.entry;
|
|
248
|
+
const callKey = raw?.callKey;
|
|
249
|
+
throw new WorkflowJournalIncompatibleError(runId, typeof callKey === "string" ? callKeyOrdinal(callKey) : -1, raw);
|
|
250
|
+
});
|
|
243
251
|
}
|
|
244
252
|
export class WorkflowJournalAppendTimeoutError extends Error {
|
|
245
253
|
runId;
|
|
@@ -475,9 +483,6 @@ function createSemaphore(max) {
|
|
|
475
483
|
}),
|
|
476
484
|
};
|
|
477
485
|
}
|
|
478
|
-
function clampRunIdText(raw) {
|
|
479
|
-
return raw.replace(/[^A-Za-z0-9_.:-]/g, "").slice(0, 64);
|
|
480
|
-
}
|
|
481
486
|
const fallbackResumeClaimTables = new WeakMap();
|
|
482
487
|
function fallbackResumeClaimKey(scope, sourceRunId) {
|
|
483
488
|
return JSON.stringify([scope, sourceRunId]);
|
|
@@ -531,6 +536,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
531
536
|
}
|
|
532
537
|
const now = opts.now ?? (() => Date.now());
|
|
533
538
|
const scope = opts.scope ?? "default";
|
|
539
|
+
const parkedResume = opts.parkedResume, claimHolder = opts.holder;
|
|
534
540
|
const runId = opts.runId ?? randomUUID();
|
|
535
541
|
if (opts.runId !== undefined && isWorkflowRunActive(opts.runId)) {
|
|
536
542
|
throw new Error(`startWorkflow: runId "${opts.runId}" is already an active workflow run in this process`);
|
|
@@ -876,7 +882,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
876
882
|
const p = parkedLeg;
|
|
877
883
|
return new WorkflowAgentParkedError(p.label, p.paused.terminal.gate.kind, p.paused.terminal.checkpointId);
|
|
878
884
|
};
|
|
879
|
-
const parkedResumeFor = (token) =>
|
|
885
|
+
const parkedResumeFor = (token) => parkedResume?.find((d) => d.token === token);
|
|
880
886
|
const parkedCallChangedError = (ordinal) => Object.assign(new Error(`workflow resume: ordinal ${ordinal} is PARKED on an approval checkpoint, but the call at that ordinal changed (its call key differs from the journaled one) ` +
|
|
881
887
|
(divergence === undefined
|
|
882
888
|
? "while no earlier call diverged from the record — the difference is in this call's own inputs (the script, its args, or a host input folded into the call identity). "
|
|
@@ -933,7 +939,9 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
933
939
|
if (key.originRunId === opts.resumeFromRunId)
|
|
934
940
|
entry = replayByOrdinal[ordinal];
|
|
935
941
|
else if (journalStore) {
|
|
936
|
-
const loaded = await finalizeWithin(timers, new Promise((resolve) => resolve(journalStore.load(key.originRunId, scope)))
|
|
942
|
+
const loaded = await finalizeWithin(timers, new Promise((resolve) => resolve(journalStore.load(key.originRunId, scope)))
|
|
943
|
+
.then((rows) => ({ entries: judgedJournal(key.originRunId, rows) }))
|
|
944
|
+
.catch((err) => ({ err })), "timeout");
|
|
937
945
|
if (loaded === "timeout" || "err" in loaded) {
|
|
938
946
|
emitRunLog(`resume: the journal of run "${clampRunIdText(key.originRunId)}" (the origin of the park at ordinal ${ordinal}) could not be read (${loaded === "timeout" ? `the load did not settle within ${WORKFLOW_RESUME_CLAIM_FINALIZE_TIMEOUT_MS}ms` : withoutToken(errText(loaded.err), key.token)}).`);
|
|
939
947
|
}
|
|
@@ -953,6 +961,11 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
953
961
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
954
962
|
terminal: { kind: "paused", gate: cp.gate, token: cp.token, ...(cp.checkpointId !== undefined ? { checkpointId: cp.checkpointId } : {}) },
|
|
955
963
|
});
|
|
964
|
+
const driveInternals = (base, drive) => ({ ...base, ...(drive.inheritedGate !== undefined ? { inheritedGate: drive.inheritedGate } : {}), ...(claimHolder !== undefined ? { holder: claimHolder } : {}) });
|
|
965
|
+
const driveRefusalText = (err, drive) => {
|
|
966
|
+
const text = withoutToken(errText(err), drive.token);
|
|
967
|
+
return claimHolder === undefined || claimHolder === "" ? text : text.split(claimHolder).join("<holder>");
|
|
968
|
+
};
|
|
956
969
|
const disposeParkedOrdinal = (truth, ordinal, callKey) => {
|
|
957
970
|
if (truth.key.callKey !== callKey)
|
|
958
971
|
throw parkedCallChangedError(ordinal);
|
|
@@ -969,7 +982,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
969
982
|
code: "workflow.park_not_pending",
|
|
970
983
|
message: `the approval checkpoint this call was parked on is ${truth.status}${truth.checkpointId !== undefined ? ` (checkpoint ${truth.checkpointId})` : ""} — decided, expired or reaped outside this workflow; settled as failed on the resume's acknowledgement. The call did not run.`,
|
|
971
984
|
},
|
|
972
|
-
result: "",
|
|
985
|
+
result: "", resultEntryIds: [],
|
|
973
986
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
974
987
|
};
|
|
975
988
|
return { kind: "settle", result };
|
|
@@ -1437,6 +1450,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1437
1450
|
objective,
|
|
1438
1451
|
tools: toolNames,
|
|
1439
1452
|
...(systemPrompt !== undefined ? { systemPrompt } : {}),
|
|
1453
|
+
...(runSpec.promptRole !== undefined ? { promptRole: runSpec.promptRole } : {}),
|
|
1440
1454
|
...(schemaText !== undefined ? { outputSchema: schemaText } : {}),
|
|
1441
1455
|
...(imageCount > 0 ? { uninspectedImageAttachments: imageCount } : {}),
|
|
1442
1456
|
...(remoteSources.length > 0 ? { externalCapabilitySources: shownSources } : {}),
|
|
@@ -1753,7 +1767,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1753
1767
|
? runner.runTaskStream(attemptSpec, undefined, attemptInternals)
|
|
1754
1768
|
: await (() => {
|
|
1755
1769
|
const { objective: _o, sessionId: _s, ...resumeConfig } = attemptSpec;
|
|
1756
|
-
return runner.resumeStream(drive.token, drive.outcome, resumeConfig,
|
|
1770
|
+
return runner.resumeStream(drive.token, drive.outcome, resumeConfig, driveInternals(attemptInternals, drive));
|
|
1757
1771
|
})();
|
|
1758
1772
|
for await (const ev of stream) {
|
|
1759
1773
|
if (ev.type === "text_delta" || ev.type === "reasoning_delta")
|
|
@@ -1853,7 +1867,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1853
1867
|
}
|
|
1854
1868
|
catch (err) {
|
|
1855
1869
|
if (drive !== undefined && !finalized && !thrownIs(err, WorkflowAgentParkedError)) {
|
|
1856
|
-
emitRunLog(`[park] the parked leg "${label}" could not be driven — the resume was refused before the checkpoint
|
|
1870
|
+
emitRunLog(`[park] the parked leg "${label}" could not be driven — the resume was refused before this run consumed the checkpoint (${driveRefusalText(err, drive)}); the park stands on this run's record.`);
|
|
1857
1871
|
release();
|
|
1858
1872
|
return await parkAgentLeg(rec, drive.paused, activityTail, false);
|
|
1859
1873
|
}
|
|
@@ -1897,7 +1911,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1897
1911
|
const journaled = journalAppend(callKey, salvaged ?? {
|
|
1898
1912
|
taskId: callKey,
|
|
1899
1913
|
sessionId: "",
|
|
1900
|
-
result: boundedRedactedSummary(thrownText(err), 500),
|
|
1914
|
+
result: boundedRedactedSummary(thrownText(err), 500), resultEntryIds: [],
|
|
1901
1915
|
terminal: {
|
|
1902
1916
|
kind: "failed",
|
|
1903
1917
|
...(thrownIs(err, WorkflowAgentBlockedError) ? { code: WORKFLOW_SPAWN_BLOCKED_ERROR_CODE } : thrownIs(err, WorkflowBudgetExceededError) ? { code: err.code } : {}),
|
|
@@ -1997,7 +2011,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1997
2011
|
taskId: callKey,
|
|
1998
2012
|
sessionId: "",
|
|
1999
2013
|
terminal: { kind: "failed", code: refusal.code, message: boundedRedactedSummary(refusal.message, 500) },
|
|
2000
|
-
result: boundedRedactedSummary(refusal.message, 500),
|
|
2014
|
+
result: boundedRedactedSummary(refusal.message, 500), resultEntryIds: [],
|
|
2001
2015
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
2002
2016
|
}).catch(() => undefined);
|
|
2003
2017
|
throw refusal;
|
|
@@ -2056,12 +2070,12 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2056
2070
|
: await workflowDepthStore.run({ depth: depth + 1 }, () => {
|
|
2057
2071
|
const d = drive;
|
|
2058
2072
|
const { objective: _o, sessionId: _s, ...resumeConfig } = runSpec;
|
|
2059
|
-
return runner.resumeStream(d.token, d.outcome, resumeConfig,
|
|
2073
|
+
return runner.resumeStream(d.token, d.outcome, resumeConfig, driveInternals(runInternals, d));
|
|
2060
2074
|
});
|
|
2061
2075
|
}
|
|
2062
2076
|
catch (err) {
|
|
2063
2077
|
if (drive !== undefined && !finalized) {
|
|
2064
|
-
emitRunLog(`[park] the parked leg "${label}" could not be driven — the resume was refused before the checkpoint
|
|
2078
|
+
emitRunLog(`[park] the parked leg "${label}" could not be driven — the resume was refused before this run consumed the checkpoint (${driveRefusalText(err, drive)}); the park stands on this run's record.`);
|
|
2065
2079
|
releaseLeg();
|
|
2066
2080
|
return await parkAgentLeg(rec, drive.paused, [], false);
|
|
2067
2081
|
}
|
|
@@ -2080,7 +2094,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2080
2094
|
taskId: callKey,
|
|
2081
2095
|
sessionId: "",
|
|
2082
2096
|
terminal: { kind: "failed", code: WORKFLOW_SPAWN_BLOCKED_ERROR_CODE, message: boundedRedactedSummary(refusal.message, 500) },
|
|
2083
|
-
result: boundedRedactedSummary(refusal.message, 500),
|
|
2097
|
+
result: boundedRedactedSummary(refusal.message, 500), resultEntryIds: [],
|
|
2084
2098
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
2085
2099
|
}).catch(() => undefined);
|
|
2086
2100
|
}
|
|
@@ -2128,7 +2142,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2128
2142
|
taskId: callKey,
|
|
2129
2143
|
sessionId: "",
|
|
2130
2144
|
terminal: { kind: "failed", message: boundedRedactedSummary(thrownText(err), 500) },
|
|
2131
|
-
result: boundedRedactedSummary(thrownText(err), 500),
|
|
2145
|
+
result: boundedRedactedSummary(thrownText(err), 500), resultEntryIds: [],
|
|
2132
2146
|
stats: { turns: partialSpend?.turns ?? 0, tokens: partialSpend?.tokens ?? 0, costMicroUsd: partialSpend?.costMicroUsd ?? 0 },
|
|
2133
2147
|
}).catch(() => undefined);
|
|
2134
2148
|
bceTerminal(callKey, "failed", thrownText(err), undefined, rec.stats);
|
|
@@ -2299,22 +2313,16 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2299
2313
|
"re-run the whole suffix live, duplicating every side effect. Wait for the holder to reach a terminal " +
|
|
2300
2314
|
"state (or stop it) and resume again.");
|
|
2301
2315
|
}
|
|
2302
|
-
const entries = await journalStore.load(opts.resumeFromRunId, scope);
|
|
2316
|
+
const entries = judgedJournal(opts.resumeFromRunId, await journalStore.load(opts.resumeFromRunId, scope));
|
|
2303
2317
|
for (const e of entries) {
|
|
2304
|
-
const
|
|
2305
|
-
if (parked
|
|
2306
|
-
const
|
|
2307
|
-
if (
|
|
2308
|
-
throw new WorkflowJournalIncompatibleError(
|
|
2318
|
+
const ordinal = callKeyOrdinal(e.callKey);
|
|
2319
|
+
if (e.parked === undefined) {
|
|
2320
|
+
const t = e.result.terminal;
|
|
2321
|
+
if (t === null || typeof t !== "object" || !isTerminalCauseKind(t.kind)) {
|
|
2322
|
+
throw new WorkflowJournalIncompatibleError(opts.resumeFromRunId, ordinal);
|
|
2309
2323
|
}
|
|
2310
|
-
replayByOrdinal[callKeyOrdinal(e.callKey)] = e;
|
|
2311
|
-
continue;
|
|
2312
|
-
}
|
|
2313
|
-
const t = e.result?.terminal;
|
|
2314
|
-
if (t === null || typeof t !== "object" || !isTerminalCauseKind(t.kind)) {
|
|
2315
|
-
throw new WorkflowJournalIncompatibleError(clampRunIdText(opts.resumeFromRunId), callKeyOrdinal(e.callKey));
|
|
2316
2324
|
}
|
|
2317
|
-
replayByOrdinal[
|
|
2325
|
+
replayByOrdinal[ordinal] = e;
|
|
2318
2326
|
}
|
|
2319
2327
|
const fromRunId = clampRunIdText(opts.resumeFromRunId);
|
|
2320
2328
|
let prior = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type OverlayOp, type
|
|
1
|
+
import { type OverlayOp, type PromptTraitName } from "./catalog/schema.js";
|
|
2
2
|
import { type PromptOverlay, type SourcedOverlay } from "./overlay.js";
|
|
3
3
|
/** What an artifact needs from the engine that composes it: the targets it names (each with what kind of target it
|
|
4
4
|
* is), the operations it uses, the traits its `when` conditions read, and the bindings they name. */
|
|
@@ -8,7 +8,7 @@ export interface PromptArtifactRequires {
|
|
|
8
8
|
readonly kind: "message" | "section" | "band";
|
|
9
9
|
}[];
|
|
10
10
|
readonly ops: readonly OverlayOp[];
|
|
11
|
-
readonly traits: readonly
|
|
11
|
+
readonly traits: readonly PromptTraitName[];
|
|
12
12
|
readonly bindings: readonly string[];
|
|
13
13
|
}
|
|
14
14
|
/** Why the artifact exists: an intent sentence (required) and references to the evaluations or goldens behind it. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { isBandId } from "./bands.js";
|
|
3
3
|
import { SEMA_DEFAULT_CATALOG } from "./catalog/index.js";
|
|
4
|
-
import { OVERLAY_OPS, PROMPT_TRAITS, isWordOf } from "./catalog/schema.js";
|
|
4
|
+
import { OVERLAY_OPS, PROMPT_TRAIT_BUNDLES, PROMPT_TRAITS, isPromptTraitName, isWordOf } from "./catalog/schema.js";
|
|
5
5
|
import { canonical } from "./epoch.js";
|
|
6
6
|
import { codePointsOver, sectionOfMessage, validateOverlay } from "./overlay.js";
|
|
7
7
|
export const ARTIFACT_LIMITS = Object.freeze({
|
|
@@ -41,10 +41,12 @@ export function requiresOf(overlays) {
|
|
|
41
41
|
bindings.add(b);
|
|
42
42
|
}
|
|
43
43
|
const byText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
44
|
+
const vocabulary = [...PROMPT_TRAITS, ...Object.keys(PROMPT_TRAIT_BUNDLES)];
|
|
45
|
+
const rank = (t) => (vocabulary.includes(t) ? vocabulary.indexOf(t) : vocabulary.length);
|
|
44
46
|
return {
|
|
45
47
|
targets: [...targets.values()].sort((a, b) => byText(`${a.kind}:${a.id}`, `${b.kind}:${b.id}`)),
|
|
46
48
|
ops: OVERLAY_OPS.filter((op) => ops.has(op)),
|
|
47
|
-
traits:
|
|
49
|
+
traits: [...traits].sort((a, b) => rank(a) - rank(b) || byText(a, b)),
|
|
48
50
|
bindings: [...bindings].sort(byText),
|
|
49
51
|
};
|
|
50
52
|
}
|
|
@@ -59,7 +61,7 @@ export function unmetRequirements(requires) {
|
|
|
59
61
|
if (!isWordOf(OVERLAY_OPS, op))
|
|
60
62
|
unmet.push(`op "${String(op)}"`);
|
|
61
63
|
for (const tr of requires.traits)
|
|
62
|
-
if (!
|
|
64
|
+
if (!isPromptTraitName(tr))
|
|
63
65
|
unmet.push(`trait "${String(tr)}"`);
|
|
64
66
|
return unmet;
|
|
65
67
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* skipped).
|
|
10
10
|
*/
|
|
11
11
|
import type { AgentTool } from "../internal/harness-types.js";
|
|
12
|
-
import type { HostForm, HostRole } from "./catalog/schema.js";
|
|
12
|
+
import type { HostForm, HostRole, PromptTraitName } from "./catalog/schema.js";
|
|
13
13
|
import { type SourcedOverlay, type SupersededOverlay } from "./overlay.js";
|
|
14
14
|
import type { CompiledSection, CompiledSystemBlock, PromptRuntimeFacts } from "./types.js";
|
|
15
15
|
export interface AssembleInputs {
|
|
@@ -26,6 +26,8 @@ export interface AssembleInputs {
|
|
|
26
26
|
};
|
|
27
27
|
/** The run's binding (`TaskSpec.promptBinding`), read by every overlay's `when.binding`. */
|
|
28
28
|
binding?: string;
|
|
29
|
+
/** The run's effective traits (the model's declared set, the task's `promptLean`, bundles expanded). */
|
|
30
|
+
traits: ReadonlySet<PromptTraitName>;
|
|
29
31
|
tools: readonly AgentTool[];
|
|
30
32
|
facts: PromptRuntimeFacts;
|
|
31
33
|
/** The task's working directory (the Cowork role base's `{{workspaceFolder}}`). */
|
|
@@ -36,7 +38,6 @@ export interface AssembleInputs {
|
|
|
36
38
|
buildEnvBlock: (date: string) => string | undefined;
|
|
37
39
|
/** The leg's frozen date — the initial render input. */
|
|
38
40
|
date: string;
|
|
39
|
-
modelGuidance?: string;
|
|
40
41
|
/** Structured warning channel (maps to deps.onError with a phase). */
|
|
41
42
|
onWarn?: (message: string, phase: "prompt-constitution") => void;
|
|
42
43
|
}
|
|
@@ -18,6 +18,7 @@ export function assemblePrompt(inputs) {
|
|
|
18
18
|
catalog: SEMA_DEFAULT_CATALOG,
|
|
19
19
|
...(inputs.host !== undefined ? { host: inputs.host } : {}),
|
|
20
20
|
...(inputs.binding !== undefined ? { binding: inputs.binding } : {}),
|
|
21
|
+
traits: inputs.traits,
|
|
21
22
|
overlays: [...inputs.taskOverlays, ...inputs.centerOverlays, ...inputs.deployOverlays],
|
|
22
23
|
};
|
|
23
24
|
const toolNames = inputs.tools.map((t) => t.name);
|
|
@@ -28,7 +29,6 @@ export function assemblePrompt(inputs) {
|
|
|
28
29
|
mcpInstructionsBlock: inputs.mcpInstructionsBlock,
|
|
29
30
|
environmentBlock: inputs.buildEnvBlock(date),
|
|
30
31
|
memoryBlock: inputs.memoryBlock,
|
|
31
|
-
modelGuidance: inputs.modelGuidance,
|
|
32
32
|
});
|
|
33
33
|
let last = composeCatalog(plan, renderInputs(inputs.date));
|
|
34
34
|
const named = new Set();
|
|
@@ -45,13 +45,39 @@ export interface HostCondition {
|
|
|
45
45
|
readonly form?: HostForm;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* The model-capability traits a variant may be selected on
|
|
49
|
-
* as the reference spells them
|
|
50
|
-
* (
|
|
51
|
-
*
|
|
48
|
+
* The model-capability traits a variant may be selected on: the reference's capability names that gate
|
|
49
|
+
* model-visible text, spelled as the reference spells them so an anchor upgrade diffs mechanically
|
|
50
|
+
* (cli296.js B[7451052,7451700) `fvo` is the reference's whole capability list; its members that gate no text —
|
|
51
|
+
* effort, thinking, context-management, fast-mode, refusal-fallback and org-lock bits — are not prompt traits).
|
|
52
|
+
* A model declares the traits it would light in the reference (`Model.promptTraits`); the engine never derives
|
|
53
|
+
* them from a model id. Order is meaning only for the artifact requirement list (`requiresOf`), which lists the
|
|
54
|
+
* names it needs in this order, so a name is appended here, never inserted.
|
|
52
55
|
*/
|
|
53
|
-
export declare const PROMPT_TRAITS: readonly ["lean_prompt", "fable_5_mitigations"];
|
|
56
|
+
export declare const PROMPT_TRAITS: readonly ["lean_prompt", "fable_5_mitigations", "thrifty_sonic", "turn_updates", "bash_output_audience_note", "silent_turn_reminder", "thinking_display_updates", "quizzical_shore", "lucky_cerf", "amber_astrolabe", "bison_cairn", "larch_cistern", "haiku_5_5_early_stopping_guidance", "elapsed_time_reminder"];
|
|
54
57
|
export type PromptTrait = (typeof PROMPT_TRAITS)[number];
|
|
58
|
+
/**
|
|
59
|
+
* The reference's bundle capabilities and the traits each lights (cli296.js B[10825000,10826100) `t$` — its three
|
|
60
|
+
* member sets). A model may declare a bundle by name; its effective trait set holds the bundle name and every member.
|
|
61
|
+
* No remote switch turns a member off here: a deployment that wants one member off declares the members it wants.
|
|
62
|
+
*/
|
|
63
|
+
export declare const PROMPT_TRAIT_BUNDLES: Readonly<Record<"fable_5_1_prompt_bundle" | "opus_5_prompt_bundle" | "opus_5_5_prompt_bundle", readonly PromptTrait[]>>;
|
|
64
|
+
export type PromptTraitBundle = keyof typeof PROMPT_TRAIT_BUNDLES;
|
|
65
|
+
/** A deployment's own trait: `x-<namespace>-<name>`. The engine checks the spelling and gives it no meaning — an
|
|
66
|
+
* overlay whose `when.traits` names it is what makes it select anything. */
|
|
67
|
+
export type DeploymentPromptTrait = `x-${string}-${string}`;
|
|
68
|
+
/** Every name a model may declare and an overlay's `when.traits` may name. */
|
|
69
|
+
export type PromptTraitName = PromptTrait | PromptTraitBundle | DeploymentPromptTrait;
|
|
70
|
+
/** The names a bundled catalog variant may select on: the reference's (a deployment's own trait has no meaning in
|
|
71
|
+
* the engine's text). */
|
|
72
|
+
export type CatalogPromptTrait = PromptTrait | PromptTraitBundle;
|
|
73
|
+
/** The longest trait name the engine accepts. */
|
|
74
|
+
export declare const PROMPT_TRAIT_NAME_MAX = 64;
|
|
75
|
+
/** Whether a value is a trait name — the one reading the model door (`Model.promptTraits`), the overlay grammar
|
|
76
|
+
* (`when.traits`) and the artifact requirement check share: a reference trait, a bundle, or a deployment's own
|
|
77
|
+
* `x-<namespace>-<name>` of at most {@link PROMPT_TRAIT_NAME_MAX} characters. */
|
|
78
|
+
export declare function isPromptTraitName(v: unknown): v is PromptTraitName;
|
|
79
|
+
/** The members a trait name lights besides itself (a bundle's members; none for any other name). */
|
|
80
|
+
export declare function bundleMembersOf(name: PromptTraitName): readonly PromptTrait[];
|
|
55
81
|
/** The boolean facts a section admit or a variant `when` may test. All but the last are runtime facts the
|
|
56
82
|
* prepare phase produces; `executionEnvironmentDeclared` is derived once from two of them, so no `when`
|
|
57
83
|
* ever needs a disjunction. An optional fact that is absent reads as `false`. */
|
|
@@ -60,8 +86,8 @@ export type PromptFactName = (typeof PROMPT_FACT_NAMES)[number];
|
|
|
60
86
|
/** A conjunction of fact equalities — the whole predicate language. No disjunction, no expressions. */
|
|
61
87
|
export type FactConjunction = Readonly<Partial<Record<PromptFactName, boolean>>>;
|
|
62
88
|
export interface TraitCondition {
|
|
63
|
-
readonly allOf?: readonly
|
|
64
|
-
readonly noneOf?: readonly
|
|
89
|
+
readonly allOf?: readonly PromptTraitName[];
|
|
90
|
+
readonly noneOf?: readonly PromptTraitName[];
|
|
65
91
|
}
|
|
66
92
|
/** How a text relates to the reference. `cc` entries use the byte-span locator grammar the anchor gate resolves
|
|
67
93
|
* (scripts/verify-anchor-claims.mjs): corpus file, byte span, and a backticked identifier that occurs in it. */
|
|
@@ -91,10 +117,15 @@ export interface VariantWhen {
|
|
|
91
117
|
readonly facts?: FactConjunction;
|
|
92
118
|
readonly binding?: BindingCondition;
|
|
93
119
|
}
|
|
94
|
-
/** The condition a BUNDLED catalog variant is chosen on: a {@link VariantWhen} without the binding
|
|
95
|
-
* deployment's own vocabulary (
|
|
96
|
-
* refuses it where the catalog data is written. */
|
|
97
|
-
export type CatalogVariantWhen = Omit<VariantWhen, "binding"
|
|
120
|
+
/** The condition a BUNDLED catalog variant is chosen on: a {@link VariantWhen} without the binding, its traits the
|
|
121
|
+
* reference's. A binding and an `x-` trait are a deployment's own vocabulary (names the engine cannot know), so no
|
|
122
|
+
* catalog variant can name one — the type refuses it where the catalog data is written. */
|
|
123
|
+
export type CatalogVariantWhen = Omit<VariantWhen, "binding" | "traits"> & {
|
|
124
|
+
readonly traits?: {
|
|
125
|
+
readonly allOf?: readonly CatalogPromptTrait[];
|
|
126
|
+
readonly noneOf?: readonly CatalogPromptTrait[];
|
|
127
|
+
};
|
|
128
|
+
};
|
|
98
129
|
export interface CatalogMessage {
|
|
99
130
|
/** `core/<area>.<name>`. */
|
|
100
131
|
readonly id: string;
|
|
@@ -104,7 +135,7 @@ export interface CatalogMessage {
|
|
|
104
135
|
}
|
|
105
136
|
/** The renderers the catalog may place by id — data here, so the catalog checks its sections without loading the
|
|
106
137
|
* renderer code; renderers.ts holds the code and the version table, one row per id (its record type is total). */
|
|
107
|
-
export declare const RENDERER_IDS: readonly ["role-base", "
|
|
138
|
+
export declare const RENDERER_IDS: readonly ["role-base", "mcp-instructions", "reminder-mark", "environment", "memory"];
|
|
108
139
|
export type RendererId = (typeof RENDERER_IDS)[number];
|
|
109
140
|
export type SectionBody = {
|
|
110
141
|
readonly message: string;
|
|
@@ -7,7 +7,39 @@ export function isHostRole(v) {
|
|
|
7
7
|
return isWordOf(HOST_ROLES, v);
|
|
8
8
|
}
|
|
9
9
|
export const HOST_FORMS = Object.freeze(["standard", "minimal"]);
|
|
10
|
-
export const PROMPT_TRAITS = Object.freeze([
|
|
10
|
+
export const PROMPT_TRAITS = Object.freeze([
|
|
11
|
+
"lean_prompt",
|
|
12
|
+
"fable_5_mitigations",
|
|
13
|
+
"thrifty_sonic",
|
|
14
|
+
"turn_updates",
|
|
15
|
+
"bash_output_audience_note",
|
|
16
|
+
"silent_turn_reminder",
|
|
17
|
+
"thinking_display_updates",
|
|
18
|
+
"quizzical_shore",
|
|
19
|
+
"lucky_cerf",
|
|
20
|
+
"amber_astrolabe",
|
|
21
|
+
"bison_cairn",
|
|
22
|
+
"larch_cistern",
|
|
23
|
+
"haiku_5_5_early_stopping_guidance",
|
|
24
|
+
"elapsed_time_reminder",
|
|
25
|
+
]);
|
|
26
|
+
export const PROMPT_TRAIT_BUNDLES = Object.freeze({
|
|
27
|
+
fable_5_1_prompt_bundle: Object.freeze(["turn_updates", "bash_output_audience_note", "silent_turn_reminder", "thinking_display_updates"]),
|
|
28
|
+
opus_5_prompt_bundle: Object.freeze(["bison_cairn", "larch_cistern"]),
|
|
29
|
+
opus_5_5_prompt_bundle: Object.freeze(["silent_turn_reminder", "quizzical_shore"]),
|
|
30
|
+
});
|
|
31
|
+
const DEPLOYMENT_TRAIT = /^x-[a-z0-9]+-[a-z0-9][a-z0-9._-]*$/;
|
|
32
|
+
export const PROMPT_TRAIT_NAME_MAX = 64;
|
|
33
|
+
export function isPromptTraitName(v) {
|
|
34
|
+
if (typeof v !== "string")
|
|
35
|
+
return false;
|
|
36
|
+
if (isWordOf(PROMPT_TRAITS, v) || Object.prototype.hasOwnProperty.call(PROMPT_TRAIT_BUNDLES, v))
|
|
37
|
+
return true;
|
|
38
|
+
return v.length <= PROMPT_TRAIT_NAME_MAX && DEPLOYMENT_TRAIT.test(v);
|
|
39
|
+
}
|
|
40
|
+
export function bundleMembersOf(name) {
|
|
41
|
+
return Object.prototype.hasOwnProperty.call(PROMPT_TRAIT_BUNDLES, name) ? PROMPT_TRAIT_BUNDLES[name] : [];
|
|
42
|
+
}
|
|
11
43
|
export const PROMPT_FACT_NAMES = Object.freeze([
|
|
12
44
|
"policyEnabled",
|
|
13
45
|
"hooksEnabled",
|
|
@@ -25,4 +57,4 @@ export const PROMPT_FACT_NAMES = Object.freeze([
|
|
|
25
57
|
"isSubagent",
|
|
26
58
|
"executionEnvironmentDeclared",
|
|
27
59
|
]);
|
|
28
|
-
export const RENDERER_IDS = Object.freeze(["role-base", "
|
|
60
|
+
export const RENDERER_IDS = Object.freeze(["role-base", "mcp-instructions", "reminder-mark", "environment", "memory"]);
|
|
@@ -90,7 +90,6 @@ export const SECTIONS = [
|
|
|
90
90
|
],
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
-
{ id: "core/behavior.model-guidance", band: "behavior", rank: 450, block: { id: "model.guidance" }, body: { renderer: "model-guidance" } },
|
|
94
93
|
{ id: "core/discovery.mcp-instructions", band: "discovery", rank: 500, block: { id: "mcp.instructions" }, body: { renderer: "mcp-instructions" } },
|
|
95
94
|
{ id: "core/harness.reminder-mark", band: "constitution", rank: 590, block: { id: "harness.reminder-mark" }, body: { renderer: "reminder-mark" } },
|
|
96
95
|
{ id: "core/environment.context", band: "environment", rank: 600, block: { id: "env.context" }, body: { renderer: "environment" } },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HostForm, HostRole, PromptCatalog } from "./catalog/schema.js";
|
|
1
|
+
import type { HostForm, HostRole, PromptCatalog, PromptTraitName } from "./catalog/schema.js";
|
|
2
2
|
import { type SourcedOverlay, type SupersededOverlay } from "./overlay.js";
|
|
3
3
|
import type { CompiledSystemBlock, ComposedPrompt, SectionRenderInputs, SystemLayout } from "./types.js";
|
|
4
4
|
/** What one composition renders: the catalog, the host selector values, and the overlays in application order. */
|
|
@@ -11,6 +11,8 @@ export interface CompositionPlan {
|
|
|
11
11
|
};
|
|
12
12
|
/** The run's binding (`TaskSpec.promptBinding`; absent ⇒ none) — what every overlay's `when.binding` reads. */
|
|
13
13
|
readonly binding?: string;
|
|
14
|
+
/** The run's effective traits (`effectiveTraitsOf`; absent ⇒ those of a model that declares none). */
|
|
15
|
+
readonly traits?: ReadonlySet<PromptTraitName>;
|
|
14
16
|
/** Validated overlays, already in application order (`bundled < task < center < deploy`, then declaration order). */
|
|
15
17
|
readonly overlays?: readonly SourcedOverlay[];
|
|
16
18
|
}
|
|
@@ -91,7 +91,7 @@ function renderAdded(e, fold) {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
export function composeCatalog(plan, inputs) {
|
|
94
|
-
const s = selectorsOf(inputs.facts, plan.host, plan.binding);
|
|
94
|
+
const s = selectorsOf(inputs.facts, plan.host, plan.binding, plan.traits);
|
|
95
95
|
const bases = basesOf(plan.catalog, inputs, s);
|
|
96
96
|
const selectedText = selectedTextOf(plan.catalog, bases);
|
|
97
97
|
const overlayText = (o) => {
|
|
@@ -11,6 +11,7 @@ export const EVENT_PROMPT_REGISTRY = new Map([
|
|
|
11
11
|
{ kind: "total_tokens_reminder", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderTotalTokensReminder" },
|
|
12
12
|
{ kind: "background_tasks", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderBackgroundTasks" },
|
|
13
13
|
{ kind: "tools_delta", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderToolsDelta" },
|
|
14
|
+
{ kind: "mcp_unavailable", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderMcpUnavailable" },
|
|
14
15
|
{ kind: "agent_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderAgentListingDelta" },
|
|
15
16
|
{ kind: "skills_listing", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "on", rendererRef: "turn-attachments.ts#renderSkillsListingDelta" },
|
|
16
17
|
{ kind: "mcp_instructions", carrier: "message.user-prefix", trust: "external", dedupe: "replace-by-key", defaultPolicy: "off", rendererRef: "turn-attachments.ts#renderMcpInstructionsDelta" },
|
|
@@ -20,6 +21,7 @@ export const EVENT_PROMPT_REGISTRY = new Map([
|
|
|
20
21
|
{ kind: "limit_approach_converge", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "run-turn-boundary.ts#limitApproachFrames" },
|
|
21
22
|
{ kind: "limit_approach_deliver", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "run-turn-boundary.ts#limitApproachFrames" },
|
|
22
23
|
{ kind: "final_verification", carrier: "message.user-prefix", trust: "operator", dedupe: "once-per-run", defaultPolicy: "always", rendererRef: "runtask.ts#final-verification" },
|
|
24
|
+
{ kind: "advisor_tool", carrier: "message.user-prefix", trust: "operator", dedupe: "replace-by-key", defaultPolicy: "always", rendererRef: "advisor-instructions.ts#advisorInstructionFrame" },
|
|
23
25
|
].map((e) => [e.kind, e]));
|
|
24
26
|
export function eventDefaultOn(kind) {
|
|
25
27
|
return EVENT_PROMPT_REGISTRY.get(kind)?.defaultPolicy === "on";
|
|
@@ -3,7 +3,7 @@ import { describeFault, isPlainRecord, receive } from "../core/mods/kernel/recei
|
|
|
3
3
|
import { egressText } from "../core/untrusted-egress.js";
|
|
4
4
|
import { bandOf, isBandId } from "./bands.js";
|
|
5
5
|
import { SEMA_DEFAULT_CATALOG, catalogMessage } from "./catalog/index.js";
|
|
6
|
-
import { HOST_FORMS, HOST_ROLES, OVERLAY_OPS, PROMPT_FACT_NAMES, PROMPT_TRAITS, isHostRole, isWordOf, } from "./catalog/schema.js";
|
|
6
|
+
import { HOST_FORMS, HOST_ROLES, OVERLAY_OPS, PROMPT_FACT_NAMES, PROMPT_TRAITS, PROMPT_TRAIT_BUNDLES, isHostRole, isPromptTraitName, isWordOf, } from "./catalog/schema.js";
|
|
7
7
|
import { RENDERERS } from "./renderers.js";
|
|
8
8
|
import { canonicalWhen } from "./select.js";
|
|
9
9
|
export const OVERLAY_SOURCE_ORDER = Object.freeze(["bundled", "task", "center", "deploy"]);
|
|
@@ -116,8 +116,8 @@ function whenViolation(when) {
|
|
|
116
116
|
if (!Array.isArray(list))
|
|
117
117
|
return `"when.traits.${k}" is not an array`;
|
|
118
118
|
for (const name of list)
|
|
119
|
-
if (!
|
|
120
|
-
return `"when.traits.${k}" names ${str(name)}, not a trait (${PROMPT_TRAITS.join(", ")})`;
|
|
119
|
+
if (!isPromptTraitName(name))
|
|
120
|
+
return `"when.traits.${k}" names ${str(name)}, not a trait (${PROMPT_TRAITS.join(", ")}; a bundle: ${Object.keys(PROMPT_TRAIT_BUNDLES).join(", ")}; or a deployment's own "x-<namespace>-<name>")`;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
if (w["host"] !== undefined) {
|
|
@@ -5,7 +5,7 @@ export interface RendererSpec {
|
|
|
5
5
|
readonly id: RendererId;
|
|
6
6
|
readonly version: number;
|
|
7
7
|
readonly stability: "static" | "session" | "leg";
|
|
8
|
-
readonly reads: "
|
|
8
|
+
readonly reads: "facts" | "env" | "memory" | "mcp" | "mark" | "selectors";
|
|
9
9
|
readonly external: boolean;
|
|
10
10
|
/** The catalog messages this renderer's output is (an overlay targets them). */
|
|
11
11
|
readonly messages?: readonly string[];
|
|
@@ -4,7 +4,6 @@ import { catalogMessage } from "./catalog/index.js";
|
|
|
4
4
|
import { selectVariant } from "./select.js";
|
|
5
5
|
export const RENDERERS = {
|
|
6
6
|
"role-base": { id: "role-base", version: 2, stability: "session", reads: "selectors", external: false, messages: ["core/role.base"] },
|
|
7
|
-
"model-guidance": { id: "model-guidance", version: 1, stability: "session", reads: "inputs", external: false },
|
|
8
7
|
"mcp-instructions": { id: "mcp-instructions", version: 1, stability: "session", reads: "mcp", external: true },
|
|
9
8
|
"reminder-mark": { id: "reminder-mark", version: 1, stability: "session", reads: "mark", external: false },
|
|
10
9
|
environment: { id: "environment", version: 2, stability: "leg", reads: "env", external: false },
|
|
@@ -25,8 +24,6 @@ export function runRenderer(id, inputs, selectors) {
|
|
|
25
24
|
const sections = renderCoworkBase({ tools: inputs.toolNames ?? [], workspaceFolder: inputs.workspaceFolder });
|
|
26
25
|
return sections.length === 0 ? undefined : { text: sections.map((s) => s.text).join("\n\n"), variant: v.id };
|
|
27
26
|
}
|
|
28
|
-
case "model-guidance":
|
|
29
|
-
return plain(inputs.modelGuidance);
|
|
30
27
|
case "mcp-instructions":
|
|
31
28
|
return plain(inputs.mcpInstructionsBlock);
|
|
32
29
|
case "reminder-mark":
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The role base's one decision rule (a leaf): of an ordered list of sources — the task, the requested model role's
|
|
3
|
+
* preset, an engine spawner's child persona — the first that names a role base decides it wholly (the sugar's header).
|
|
4
|
+
*/
|
|
5
|
+
import type { HostRole } from "./catalog/schema.js";
|
|
6
|
+
/** A source's statement of the role base — its word (the host role; selects the `core/role.base` variant), its text
|
|
7
|
+
* (replaces that base), or both. `TaskSpec`, a role preset and the delegation tool's options have this shape. */
|
|
8
|
+
export interface RoleBaseDeclaration {
|
|
9
|
+
readonly promptRole?: HostRole;
|
|
10
|
+
readonly systemPrompt?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Whether a source names a role base — the one reading of "this seat has spoken". */
|
|
13
|
+
export declare function namesRoleBase(d: RoleBaseDeclaration | undefined): boolean;
|
|
14
|
+
/** The first source that names a role base, whole; `undefined` ⇒ none did. */
|
|
15
|
+
export declare function roleBaseOf(sources: readonly (RoleBaseDeclaration | undefined)[]): RoleBaseDeclaration | undefined;
|