@sema-agent/core 7.55.0 → 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 +513 -0
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +7 -7
- package/dist/agents/peer-directory.d.ts +22 -4
- package/dist/agents/peer-directory.js +24 -2
- package/dist/agents/peer-session-drain.js +2 -2
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/send-message-tool.js +4 -4
- package/dist/agents/subagent.d.ts +6 -4
- package/dist/agents/subagent.js +64 -60
- package/dist/agents/tool-filter.d.ts +7 -5
- package/dist/agents/tool-filter.js +12 -9
- package/dist/agents/verify.d.ts +3 -2
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +30 -73
- 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 +2 -8
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +13 -26
- package/dist/brain/openai.js +14 -87
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +11 -11
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +7 -4
- package/dist/brain/request-params.js +7 -4
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/agent-definition.d.ts +10 -0
- package/dist/core/allow-entry.d.ts +20 -13
- package/dist/core/allow-entry.js +26 -22
- package/dist/core/allow-rule-shadow.d.ts +3 -3
- package/dist/core/ask-origin.d.ts +64 -18
- package/dist/core/ask-origin.js +63 -23
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +3 -4
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -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 +13 -1
- package/dist/core/checkpoint-requirements.js +4 -0
- package/dist/core/checkpoint-store.d.ts +88 -24
- package/dist/core/checkpoint-store.js +24 -9
- package/dist/core/cross-boundary-taint.d.ts +6 -5
- package/dist/core/cross-boundary-taint.js +1 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +17 -17
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- 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 +30 -11
- package/dist/core/file-history-store.d.ts +90 -14
- package/dist/core/file-history-store.js +23 -15
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +22 -10
- package/dist/core/gate-lanes.js +73 -64
- package/dist/core/gate-outcome.d.ts +26 -5
- package/dist/core/gate-outcome.js +26 -0
- package/dist/core/governance-codes.d.ts +5 -1
- package/dist/core/governance-codes.js +6 -0
- package/dist/core/hooks.d.ts +17 -16
- 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 +38 -3
- package/dist/core/host-target.js +38 -5
- package/dist/core/mcp.d.ts +5 -1
- package/dist/core/mcp.js +67 -41
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- 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/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 +32 -38
- package/dist/core/namespaced-rule-name.js +29 -36
- package/dist/core/parent-spec-seat.d.ts +6 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +19 -0
- package/dist/core/permission-rule-consent.js +116 -26
- package/dist/core/permission-rule-model.d.ts +14 -3
- package/dist/core/permission-rule-model.js +39 -24
- 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 +5 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +3 -2
- package/dist/core/permission-rule-store.js +11 -2
- package/dist/core/permission-rule-sync.js +3 -2
- 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 +4 -4
- package/dist/core/permission-rules.js +11 -20
- package/dist/core/persisted-rule-arms.d.ts +2 -2
- package/dist/core/persisted-rule-arms.js +10 -12
- 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/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 +28 -1
- package/dist/core/roles.js +31 -19
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-owner.d.ts +3 -3
- package/dist/core/rule-owner.js +3 -2
- package/dist/core/runner/announce-once-ledger.d.ts +14 -0
- package/dist/core/runner/announce-once-ledger.js +5 -0
- package/dist/core/runner/assemble-result.d.ts +1 -0
- 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 +16 -4
- package/dist/core/runner/caller-roster.js +33 -6
- 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 +7 -9
- package/dist/core/runner/classifier-ladder.js +3 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +28 -25
- package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
- package/dist/core/runner/cross-boundary-lane.js +40 -27
- package/dist/core/runner/denial-limit-arms.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +1 -1
- 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 +3 -3
- package/dist/core/runner/gate-exit.js +4 -3
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/permission-rule-lanes.d.ts +4 -4
- package/dist/core/runner/permission-rule-lanes.js +26 -10
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +18 -7
- 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 +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +29 -38
- package/dist/core/runner/prepare-config-doors.js +42 -25
- 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-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +7 -39
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
- package/dist/core/runner/prepare-gate-stations.js +10 -1
- 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 +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +5 -3
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +5 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
- package/dist/core/runner/prepare-policy-chain.js +65 -72
- 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 +3 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-safety-scan.js +0 -17
- 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 +29 -20
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +20 -16
- 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 +6 -2
- 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/retired-runner-deps.js +1 -0
- 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 -1
- 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-harness-handlers.js +12 -4
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +30 -18
- package/dist/core/runner/run-settle-and-teardown.js +2 -1
- package/dist/core/runner/run-turn-boundary.js +1 -10
- 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.js +4 -3
- 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/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -7
- package/dist/core/runner/synthetic-tools.d.ts +6 -0
- package/dist/core/runner/synthetic-tools.js +4 -1
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +1 -3
- 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-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/turn-attachments.d.ts +33 -15
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +5 -5
- 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 +11 -3
- 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/session-policy-store.d.ts +27 -15
- package/dist/core/session-policy-store.js +156 -36
- package/dist/core/session-store.d.ts +29 -10
- package/dist/core/session-store.js +51 -19
- package/dist/core/session.d.ts +82 -16
- package/dist/core/session.js +53 -0
- 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.js +10 -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 +140 -2
- package/dist/core/store-contracts/file-history-store-contract.js +31 -1
- 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-repo-contract.js +51 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/session-store-contract.js +150 -14
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +32 -4
- package/dist/core/task-notification.d.ts +16 -12
- package/dist/core/task-registry.d.ts +9 -0
- package/dist/core/task-registry.js +11 -1
- package/dist/core/task-result.d.ts +18 -0
- package/dist/core/task-spec.d.ts +18 -13
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +17 -0
- package/dist/core/tool-catalog-entries.js +13 -2
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-model-gate.d.ts +2 -2
- package/dist/core/tool-name-aliases.d.ts +16 -16
- package/dist/core/tool-name-aliases.js +13 -19
- package/dist/core/tool-name-readings.d.ts +5 -35
- package/dist/core/tool-name-readings.js +1 -9
- package/dist/core/tool-policy.d.ts +68 -198
- package/dist/core/tool-policy.js +149 -198
- package/dist/core/tool-result-store.js +3 -0
- package/dist/core/tool-roster.d.ts +14 -19
- package/dist/core/tool-roster.js +11 -44
- package/dist/core/tool-spec-members.js +7 -2
- package/dist/core/tool-spec.d.ts +19 -11
- package/dist/core/tools.js +49 -9
- package/dist/core/trace.d.ts +2 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/wiring-manifest.d.ts +9 -0
- package/dist/core/wiring-manifest.js +1 -0
- package/dist/core/workflow-journal-store.js +1 -1
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
- package/dist/engine/execution-env/node-execution-env.js +11 -2
- package/dist/engine/harness/agent-harness.d.ts +25 -1
- package/dist/engine/harness/agent-harness.js +54 -7
- package/dist/engine/harness/types.d.ts +29 -2
- package/dist/engine/llm/types.d.ts +28 -11
- package/dist/engine/loop/agent-loop.d.ts +22 -0
- package/dist/engine/loop/agent-loop.js +16 -26
- package/dist/engine/loop/types.d.ts +16 -6
- package/dist/engine/session/memory-repo.d.ts +9 -2
- package/dist/engine/session/memory-repo.js +11 -1
- package/dist/engine/session/repo-utils.d.ts +6 -5
- package/dist/engine/session/repo-utils.js +14 -6
- package/dist/index.d.ts +22 -10
- package/dist/index.js +15 -7
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/llm.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +6 -4
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +36 -18
- 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 +1 -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 +37 -3
- package/dist/prompt-assembly/tool-catalog.js +114 -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/scenarios/full-body.d.ts +11 -11
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.js +4 -3
- package/dist/stores/file/adoption/marker.js +3 -2
- package/dist/stores/file/checkpoint-store.d.ts +21 -0
- package/dist/stores/file/checkpoint-store.js +38 -6
- package/dist/stores/file/file-history-store.js +6 -7
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/permission-rule-adopt.js +4 -3
- package/dist/stores/file/permission-rule-store.js +11 -5
- package/dist/stores/file/session-store.d.ts +29 -6
- package/dist/stores/file/session-store.js +42 -50
- package/dist/tools/artifact/artifact-tool.js +3 -2
- 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/fs-bash.js +5 -5
- 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/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/removal-targets.d.ts +17 -7
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/search.d.ts +10 -0
- 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 +6 -19
- 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-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/todo.js +63 -63
- package/dist/tools/web.d.ts +19 -14
- package/dist/tools/web.js +38 -55
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +143 -5
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
|
@@ -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,7 +9,8 @@ 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
16
|
import { callKeyOrdinal, clampRunIdText, oversizeJournalResult, journalOversizeTombstone, readWorkflowJournalEntry, JOURNAL_OVERSIZE_ERROR_CODE, MAX_JOURNAL_RESULT_BYTES, WorkflowJournalIncompatibleError, } from "../core/workflow-journal-store.js";
|
|
@@ -21,6 +22,7 @@ import { boundedRedactedSummary, egressThrownText } from "../core/untrusted-egre
|
|
|
21
22
|
import { delimitUntrusted } from "../core/untrusted-text.js";
|
|
22
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
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 = {
|
|
@@ -525,6 +536,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
525
536
|
}
|
|
526
537
|
const now = opts.now ?? (() => Date.now());
|
|
527
538
|
const scope = opts.scope ?? "default";
|
|
539
|
+
const parkedResume = opts.parkedResume, claimHolder = opts.holder;
|
|
528
540
|
const runId = opts.runId ?? randomUUID();
|
|
529
541
|
if (opts.runId !== undefined && isWorkflowRunActive(opts.runId)) {
|
|
530
542
|
throw new Error(`startWorkflow: runId "${opts.runId}" is already an active workflow run in this process`);
|
|
@@ -870,7 +882,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
870
882
|
const p = parkedLeg;
|
|
871
883
|
return new WorkflowAgentParkedError(p.label, p.paused.terminal.gate.kind, p.paused.terminal.checkpointId);
|
|
872
884
|
};
|
|
873
|
-
const parkedResumeFor = (token) =>
|
|
885
|
+
const parkedResumeFor = (token) => parkedResume?.find((d) => d.token === token);
|
|
874
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) ` +
|
|
875
887
|
(divergence === undefined
|
|
876
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). "
|
|
@@ -949,6 +961,11 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
949
961
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
950
962
|
terminal: { kind: "paused", gate: cp.gate, token: cp.token, ...(cp.checkpointId !== undefined ? { checkpointId: cp.checkpointId } : {}) },
|
|
951
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
|
+
};
|
|
952
969
|
const disposeParkedOrdinal = (truth, ordinal, callKey) => {
|
|
953
970
|
if (truth.key.callKey !== callKey)
|
|
954
971
|
throw parkedCallChangedError(ordinal);
|
|
@@ -965,7 +982,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
965
982
|
code: "workflow.park_not_pending",
|
|
966
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.`,
|
|
967
984
|
},
|
|
968
|
-
result: "",
|
|
985
|
+
result: "", resultEntryIds: [],
|
|
969
986
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
970
987
|
};
|
|
971
988
|
return { kind: "settle", result };
|
|
@@ -1433,6 +1450,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1433
1450
|
objective,
|
|
1434
1451
|
tools: toolNames,
|
|
1435
1452
|
...(systemPrompt !== undefined ? { systemPrompt } : {}),
|
|
1453
|
+
...(runSpec.promptRole !== undefined ? { promptRole: runSpec.promptRole } : {}),
|
|
1436
1454
|
...(schemaText !== undefined ? { outputSchema: schemaText } : {}),
|
|
1437
1455
|
...(imageCount > 0 ? { uninspectedImageAttachments: imageCount } : {}),
|
|
1438
1456
|
...(remoteSources.length > 0 ? { externalCapabilitySources: shownSources } : {}),
|
|
@@ -1749,7 +1767,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1749
1767
|
? runner.runTaskStream(attemptSpec, undefined, attemptInternals)
|
|
1750
1768
|
: await (() => {
|
|
1751
1769
|
const { objective: _o, sessionId: _s, ...resumeConfig } = attemptSpec;
|
|
1752
|
-
return runner.resumeStream(drive.token, drive.outcome, resumeConfig,
|
|
1770
|
+
return runner.resumeStream(drive.token, drive.outcome, resumeConfig, driveInternals(attemptInternals, drive));
|
|
1753
1771
|
})();
|
|
1754
1772
|
for await (const ev of stream) {
|
|
1755
1773
|
if (ev.type === "text_delta" || ev.type === "reasoning_delta")
|
|
@@ -1849,7 +1867,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1849
1867
|
}
|
|
1850
1868
|
catch (err) {
|
|
1851
1869
|
if (drive !== undefined && !finalized && !thrownIs(err, WorkflowAgentParkedError)) {
|
|
1852
|
-
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.`);
|
|
1853
1871
|
release();
|
|
1854
1872
|
return await parkAgentLeg(rec, drive.paused, activityTail, false);
|
|
1855
1873
|
}
|
|
@@ -1893,7 +1911,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1893
1911
|
const journaled = journalAppend(callKey, salvaged ?? {
|
|
1894
1912
|
taskId: callKey,
|
|
1895
1913
|
sessionId: "",
|
|
1896
|
-
result: boundedRedactedSummary(thrownText(err), 500),
|
|
1914
|
+
result: boundedRedactedSummary(thrownText(err), 500), resultEntryIds: [],
|
|
1897
1915
|
terminal: {
|
|
1898
1916
|
kind: "failed",
|
|
1899
1917
|
...(thrownIs(err, WorkflowAgentBlockedError) ? { code: WORKFLOW_SPAWN_BLOCKED_ERROR_CODE } : thrownIs(err, WorkflowBudgetExceededError) ? { code: err.code } : {}),
|
|
@@ -1993,7 +2011,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
1993
2011
|
taskId: callKey,
|
|
1994
2012
|
sessionId: "",
|
|
1995
2013
|
terminal: { kind: "failed", code: refusal.code, message: boundedRedactedSummary(refusal.message, 500) },
|
|
1996
|
-
result: boundedRedactedSummary(refusal.message, 500),
|
|
2014
|
+
result: boundedRedactedSummary(refusal.message, 500), resultEntryIds: [],
|
|
1997
2015
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
1998
2016
|
}).catch(() => undefined);
|
|
1999
2017
|
throw refusal;
|
|
@@ -2052,12 +2070,12 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2052
2070
|
: await workflowDepthStore.run({ depth: depth + 1 }, () => {
|
|
2053
2071
|
const d = drive;
|
|
2054
2072
|
const { objective: _o, sessionId: _s, ...resumeConfig } = runSpec;
|
|
2055
|
-
return runner.resumeStream(d.token, d.outcome, resumeConfig,
|
|
2073
|
+
return runner.resumeStream(d.token, d.outcome, resumeConfig, driveInternals(runInternals, d));
|
|
2056
2074
|
});
|
|
2057
2075
|
}
|
|
2058
2076
|
catch (err) {
|
|
2059
2077
|
if (drive !== undefined && !finalized) {
|
|
2060
|
-
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.`);
|
|
2061
2079
|
releaseLeg();
|
|
2062
2080
|
return await parkAgentLeg(rec, drive.paused, [], false);
|
|
2063
2081
|
}
|
|
@@ -2076,7 +2094,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2076
2094
|
taskId: callKey,
|
|
2077
2095
|
sessionId: "",
|
|
2078
2096
|
terminal: { kind: "failed", code: WORKFLOW_SPAWN_BLOCKED_ERROR_CODE, message: boundedRedactedSummary(refusal.message, 500) },
|
|
2079
|
-
result: boundedRedactedSummary(refusal.message, 500),
|
|
2097
|
+
result: boundedRedactedSummary(refusal.message, 500), resultEntryIds: [],
|
|
2080
2098
|
stats: { turns: 0, tokens: 0, costMicroUsd: 0, usageMissing: true },
|
|
2081
2099
|
}).catch(() => undefined);
|
|
2082
2100
|
}
|
|
@@ -2124,7 +2142,7 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
2124
2142
|
taskId: callKey,
|
|
2125
2143
|
sessionId: "",
|
|
2126
2144
|
terminal: { kind: "failed", message: boundedRedactedSummary(thrownText(err), 500) },
|
|
2127
|
-
result: boundedRedactedSummary(thrownText(err), 500),
|
|
2145
|
+
result: boundedRedactedSummary(thrownText(err), 500), resultEntryIds: [],
|
|
2128
2146
|
stats: { turns: partialSpend?.turns ?? 0, tokens: partialSpend?.tokens ?? 0, costMicroUsd: partialSpend?.costMicroUsd ?? 0 },
|
|
2129
2147
|
}).catch(() => undefined);
|
|
2130
2148
|
bceTerminal(callKey, "failed", thrownText(err), undefined, rec.stats);
|
|
@@ -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" },
|
|
@@ -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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function namesRoleBase(d) {
|
|
2
|
+
return d !== undefined && (d.promptRole !== undefined || d.systemPrompt !== undefined);
|
|
3
|
+
}
|
|
4
|
+
export function roleBaseOf(sources) {
|
|
5
|
+
for (const source of sources)
|
|
6
|
+
if (namesRoleBase(source))
|
|
7
|
+
return source;
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|