@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
|
@@ -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
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* whether an overlay's `when` applies to this run (every source class alike). Four dimensions, each with exactly one
|
|
4
4
|
* writer, so no value ever needs a precedence order:
|
|
5
5
|
*
|
|
6
|
-
* - `traits` —
|
|
7
|
-
*
|
|
6
|
+
* - `traits` — the model's declared traits (`Model.promptTraits`) with the task's one switch on `lean_prompt`
|
|
7
|
+
* (`TaskSpec.promptLean`), bundles expanded: {@link effectiveTraitsOf}. The engine reads no model id to choose text.
|
|
8
8
|
* - `host` — `role` (which role base the run is assembled for; `TaskSpec.promptRole`, absent ⇒ `general`) and
|
|
9
9
|
* `form` (`TaskSpec.promptForm`, which every engine-built child receives through the parent spec seat; absent ⇒
|
|
10
10
|
* `standard`).
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
* fact equal, the binding inside its `anyOf` (or outside its `noneOf`). No disjunction across dimensions.
|
|
16
16
|
*/
|
|
17
17
|
import type { PromptManifestSelectors } from "../core/trace.js";
|
|
18
|
-
import { type CatalogMessage, type FactConjunction, type HostForm, type HostRole, type PromptFactName, type
|
|
18
|
+
import { type CatalogMessage, type FactConjunction, type HostForm, type HostRole, type PromptFactName, type PromptTraitName, type TraitCondition, type Variant, type VariantWhen } from "./catalog/schema.js";
|
|
19
19
|
import type { PromptRuntimeFacts } from "./types.js";
|
|
20
20
|
/** The run's selector values, resolved once per assembly. */
|
|
21
21
|
export interface PromptSelectors {
|
|
22
|
-
readonly traits: ReadonlySet<
|
|
22
|
+
readonly traits: ReadonlySet<PromptTraitName>;
|
|
23
23
|
readonly host: {
|
|
24
24
|
readonly role: HostRole;
|
|
25
25
|
readonly form: HostForm;
|
|
@@ -28,17 +28,29 @@ export interface PromptSelectors {
|
|
|
28
28
|
readonly binding?: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The run's
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* The run's effective traits — the one place a trait set is formed: the model's declared set (exact: nothing is added
|
|
32
|
+
* to what it lists; absent ⇒ `["lean_prompt"]`), then the task's one switch (`promptLean`: `true` adds `lean_prompt`,
|
|
33
|
+
* `false` removes it, absent leaves the model's answer), then each declared bundle's members. The task can move
|
|
34
|
+
* nothing else: a model-family trait stays the model's.
|
|
34
35
|
*/
|
|
35
|
-
export declare function
|
|
36
|
+
export declare function effectiveTraitsOf(declared: readonly PromptTraitName[] | undefined, lean: boolean | undefined): ReadonlySet<PromptTraitName>;
|
|
37
|
+
/**
|
|
38
|
+
* The model door's reading of `Model.promptTraits`: absent, or a list whose every entry is a trait name
|
|
39
|
+
* ({@link isPromptTraitName}). Anything else is refused by name (`config.prompt_trait_unknown`), never read as the
|
|
40
|
+
* default — a model that names a trait the engine cannot read would silently receive another prompt shape.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readModelPromptTraits(model: {
|
|
43
|
+
readonly id?: unknown;
|
|
44
|
+
readonly promptTraits?: unknown;
|
|
45
|
+
}): readonly PromptTraitName[] | undefined;
|
|
36
46
|
/** The predicate facts a condition may test; optional runtime facts read as false when absent. */
|
|
37
47
|
export declare function catalogFactsOf(facts: PromptRuntimeFacts): Readonly<Record<PromptFactName, boolean>>;
|
|
38
48
|
/**
|
|
39
|
-
* The
|
|
40
|
-
*
|
|
41
|
-
*
|
|
49
|
+
* The task seat's two host values as its door judges them (`TaskSpec.promptRole` / `TaskSpec.promptForm`; an
|
|
50
|
+
* engine-built child's spec carries its parent's form through the parent spec seat). The form is the run's; the role
|
|
51
|
+
* word is the task's statement of its role base, the first source of the role-base decision (`roleBaseOf`, the
|
|
52
|
+
* request-body sugar), which gives the run's host role. A value outside the closed set is refused by name
|
|
53
|
+
* (`config.prompt_selector_invalid`), never read as the default.
|
|
42
54
|
*/
|
|
43
55
|
export declare function resolveHost(task: {
|
|
44
56
|
readonly promptRole?: unknown;
|
|
@@ -47,16 +59,29 @@ export declare function resolveHost(task: {
|
|
|
47
59
|
readonly role?: HostRole;
|
|
48
60
|
readonly form?: HostForm;
|
|
49
61
|
};
|
|
50
|
-
/** The
|
|
51
|
-
*
|
|
62
|
+
/** The task's switch on the lean shape as its one writer gave it (`TaskSpec.promptLean`): a boolean or absent; any other
|
|
63
|
+
* value is refused by name (`config.prompt_selector_invalid`), never read as absent. */
|
|
64
|
+
export declare function resolvePromptLean(task: {
|
|
65
|
+
readonly promptLean?: unknown;
|
|
66
|
+
}): boolean | undefined;
|
|
67
|
+
/** A role-base seat's role word as its writer gave it — the one door every seat that may name a role base passes
|
|
68
|
+
* (`TaskSpec.promptRole`, a role preset's `promptRole`, the delegation tool's `promptRole`; `seat` names where it was
|
|
69
|
+
* written): absent, or a word of {@link HOST_ROLES}; anything else is refused by name (`config.prompt_selector_invalid`). */
|
|
70
|
+
export declare function readPromptRole(seat: string, value: unknown): HostRole | undefined;
|
|
71
|
+
/** The run's selectors — their one mint: the facts from the runtime facts, the host from its two writers' values, the
|
|
72
|
+
* binding as the task's door validated it, and the effective traits ({@link effectiveTraitsOf}; absent ⇒ those of a
|
|
73
|
+
* model that declares none, with no task switch). */
|
|
52
74
|
export declare function selectorsOf(facts: PromptRuntimeFacts, host?: {
|
|
53
75
|
readonly role?: HostRole;
|
|
54
76
|
readonly form?: HostForm;
|
|
55
|
-
}, binding?: string): PromptSelectors;
|
|
77
|
+
}, binding?: string, traits?: ReadonlySet<PromptTraitName>): PromptSelectors;
|
|
56
78
|
/** The selectors' plain form (traits sorted): what the manifest shows, the identity's `binding` element digests and the
|
|
57
79
|
* `prompt.compose` event carries — one record. */
|
|
58
80
|
export declare function selectorRecordOf(s: PromptSelectors): PromptManifestSelectors;
|
|
59
81
|
export declare function factsHold(conj: FactConjunction | undefined, facts: Readonly<Record<PromptFactName, boolean>>): boolean;
|
|
82
|
+
/** Whether a trait condition holds over a trait set — every `allOf` present, no `noneOf` present. The one trait reading:
|
|
83
|
+
* a catalog variant's, an overlay's and a tool description variant's condition all go through it. */
|
|
84
|
+
export declare function traitsHold(cond: TraitCondition | undefined, traits: ReadonlySet<PromptTraitName>): boolean;
|
|
60
85
|
/** Whether a `when` holds under the run's selectors. */
|
|
61
86
|
export declare function whenHolds(when: VariantWhen | undefined, s: PromptSelectors): boolean;
|
|
62
87
|
/**
|
|
@@ -1,12 +1,36 @@
|
|
|
1
|
-
import { HOST_ROLES, isHostRole } from "./catalog/schema.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { bundleMembersOf, HOST_ROLES, isHostRole, isPromptTraitName } from "./catalog/schema.js";
|
|
2
|
+
const UNDECLARED_MODEL_TRAITS = Object.freeze(["lean_prompt"]);
|
|
3
|
+
export function effectiveTraitsOf(declared, lean) {
|
|
4
|
+
const traits = new Set(declared ?? UNDECLARED_MODEL_TRAITS);
|
|
5
|
+
if (lean === true)
|
|
5
6
|
traits.add("lean_prompt");
|
|
6
|
-
if (
|
|
7
|
-
traits.
|
|
7
|
+
else if (lean === false)
|
|
8
|
+
traits.delete("lean_prompt");
|
|
9
|
+
for (const name of [...traits])
|
|
10
|
+
for (const member of bundleMembersOf(name))
|
|
11
|
+
traits.add(member);
|
|
8
12
|
return traits;
|
|
9
13
|
}
|
|
14
|
+
export function readModelPromptTraits(model) {
|
|
15
|
+
const raw = model.promptTraits;
|
|
16
|
+
if (raw === undefined)
|
|
17
|
+
return undefined;
|
|
18
|
+
const refuse = (why) => {
|
|
19
|
+
throw Object.assign(new Error(`Model.promptTraits of model ${JSON.stringify(String(model.id)).slice(0, 80)} ${why}; a trait is one of the reference's prompt capability names, a bundle name, or a deployment's own "x-<namespace>-<name>"`), {
|
|
20
|
+
code: "config.prompt_trait_unknown",
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
if (!Array.isArray(raw))
|
|
24
|
+
return refuse(`is ${raw === null ? "null" : typeof raw}, not a list`);
|
|
25
|
+
const out = [];
|
|
26
|
+
const names = raw;
|
|
27
|
+
for (const name of names) {
|
|
28
|
+
if (!isPromptTraitName(name))
|
|
29
|
+
return refuse(`names ${typeof name === "string" ? JSON.stringify(name.slice(0, 64)) : typeof name}, not a trait`);
|
|
30
|
+
out.push(name);
|
|
31
|
+
}
|
|
32
|
+
return Object.freeze(out);
|
|
33
|
+
}
|
|
10
34
|
export function catalogFactsOf(facts) {
|
|
11
35
|
return {
|
|
12
36
|
policyEnabled: facts.policyEnabled,
|
|
@@ -27,18 +51,25 @@ export function catalogFactsOf(facts) {
|
|
|
27
51
|
};
|
|
28
52
|
}
|
|
29
53
|
export function resolveHost(task) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
code: "config.prompt_selector_invalid",
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
const role = task.promptRole === undefined ? undefined : isHostRole(task.promptRole) ? task.promptRole : refuse("promptRole", task.promptRole, HOST_ROLES);
|
|
36
|
-
const form = task.promptForm === undefined ? undefined : task.promptForm === "minimal" ? "minimal" : refuse("promptForm", task.promptForm, ["minimal"]);
|
|
54
|
+
const role = readPromptRole("TaskSpec.promptRole", task.promptRole);
|
|
55
|
+
const form = task.promptForm === undefined ? undefined : task.promptForm === "minimal" ? "minimal" : refuseSelector("TaskSpec.promptForm", task.promptForm, ['"minimal"']);
|
|
37
56
|
return Object.freeze({ ...(role !== undefined ? { role } : {}), ...(form !== undefined ? { form } : {}) });
|
|
38
57
|
}
|
|
39
|
-
export function
|
|
58
|
+
export function resolvePromptLean(task) {
|
|
59
|
+
const v = task.promptLean;
|
|
60
|
+
return v === undefined || v === true || v === false ? v : refuseSelector("TaskSpec.promptLean", v, ["true", "false"]);
|
|
61
|
+
}
|
|
62
|
+
export function readPromptRole(seat, value) {
|
|
63
|
+
return value === undefined ? undefined : isHostRole(value) ? value : refuseSelector(seat, value, HOST_ROLES.map((a) => `"${a}"`));
|
|
64
|
+
}
|
|
65
|
+
function refuseSelector(seat, value, allowed) {
|
|
66
|
+
throw Object.assign(new Error(`${seat} is ${typeof value === "string" ? JSON.stringify(value.slice(0, 64)) : typeof value}; it is one of ${allowed.join(", ")} (or absent)`), {
|
|
67
|
+
code: "config.prompt_selector_invalid",
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function selectorsOf(facts, host = {}, binding, traits = effectiveTraitsOf(undefined, undefined)) {
|
|
40
71
|
return Object.freeze({
|
|
41
|
-
traits
|
|
72
|
+
traits,
|
|
42
73
|
host: Object.freeze({ role: host.role ?? "general", form: host.form ?? "standard" }),
|
|
43
74
|
facts: Object.freeze(catalogFactsOf(facts)),
|
|
44
75
|
...(binding !== undefined ? { binding } : {}),
|
|
@@ -60,7 +91,7 @@ export function factsHold(conj, facts) {
|
|
|
60
91
|
return false;
|
|
61
92
|
return true;
|
|
62
93
|
}
|
|
63
|
-
function traitsHold(cond, traits) {
|
|
94
|
+
export function traitsHold(cond, traits) {
|
|
64
95
|
if (cond === undefined)
|
|
65
96
|
return true;
|
|
66
97
|
return (cond.allOf ?? []).every((t) => traits.has(t)) && !(cond.noneOf ?? []).some((t) => traits.has(t));
|
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The request-body sugar: the one place the task's role-layer prompt inputs are read and turned into overlays of
|
|
3
|
-
* the `task` source class.
|
|
3
|
+
* the `task` source class. Two inputs, one reading each:
|
|
4
4
|
*
|
|
5
|
-
* - the role base —
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* - the role base — the first of three sources that names one decides it ({@link roleBaseOf}): the task (its door-judged
|
|
6
|
+
* `promptRole` and its `systemPrompt`), then the requested model role's preset, then the persona a core spawner hands
|
|
7
|
+
* its child (`internals.defaultSystemPrompt`). The deciding source's word is the run's host role; its text, when it
|
|
8
|
+
* names one, is a `replace` of `core/role.base`, applied after the selector chose the variant;
|
|
9
|
+
* - the appended block — `TaskSpec.appendSystemPrompt` — an `add` to the `task-append` band (entry `core/role.append`);
|
|
10
10
|
*
|
|
11
11
|
* and nothing else reads them for assembly (`gate:sugar-single-site`). The sugar is applied first within its class,
|
|
12
12
|
* the task-seat mods after it. Its one possible violation is locked text: a role-layer input carrying, verbatim,
|
|
13
13
|
* the canonical text of a `constitution` entry is an already-assembled prompt, and the task is refused by name
|
|
14
14
|
* (`prompt.assembled_role_refused`) — never passed through, never silently dropped.
|
|
15
15
|
*/
|
|
16
|
+
import type { HostRole } from "./catalog/schema.js";
|
|
16
17
|
import { type SourcedOverlay } from "./overlay.js";
|
|
18
|
+
import { type RoleBaseDeclaration } from "./role-base.js";
|
|
17
19
|
/** The task's role-layer prompt inputs, as prepare holds them. */
|
|
18
20
|
export interface SugarInputs {
|
|
19
21
|
readonly spec: {
|
|
20
22
|
readonly systemPrompt?: string;
|
|
21
23
|
readonly appendSystemPrompt?: string;
|
|
22
24
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
/** The task seat's role word as its door judged it (`TaskSpec.promptRole`, `resolveHost`). */
|
|
26
|
+
readonly taskRole?: HostRole;
|
|
27
|
+
readonly resolvedRole: RoleBaseDeclaration;
|
|
26
28
|
readonly internals?: {
|
|
27
29
|
readonly defaultSystemPrompt?: string;
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
/** The task
|
|
31
|
-
export
|
|
32
|
+
/** The task class's first overlays (role base, then the appended block) and the run's host role, from ONE decision. */
|
|
33
|
+
export interface RequestBodySugar {
|
|
34
|
+
readonly overlays: readonly SourcedOverlay[];
|
|
35
|
+
readonly hostRole?: HostRole;
|
|
36
|
+
}
|
|
37
|
+
export declare function requestBodySugar(inputs: SugarInputs): RequestBodySugar;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { assembledRoleRefused, lockedTextIn } from "./overlay.js";
|
|
2
|
+
import { roleBaseOf } from "./role-base.js";
|
|
2
3
|
const SUGAR = { source: "task", by: "sugar" };
|
|
3
|
-
export function
|
|
4
|
-
const
|
|
4
|
+
export function requestBodySugar(inputs) {
|
|
5
|
+
const taskText = inputs.spec.systemPrompt;
|
|
6
|
+
const task = { ...(inputs.taskRole !== undefined ? { promptRole: inputs.taskRole } : {}), ...(taskText !== undefined ? { systemPrompt: taskText } : {}) };
|
|
7
|
+
const engineText = inputs.internals?.defaultSystemPrompt;
|
|
8
|
+
const decided = roleBaseOf([task, inputs.resolvedRole, engineText !== undefined ? { systemPrompt: engineText } : undefined]);
|
|
9
|
+
const roleBase = decided?.systemPrompt;
|
|
5
10
|
const append = inputs.spec.appendSystemPrompt;
|
|
6
11
|
const out = [];
|
|
7
12
|
if (roleBase !== undefined) {
|
|
@@ -16,5 +21,5 @@ export function sugarOverlays(inputs) {
|
|
|
16
21
|
throw assembledRoleRefused("the task's appendSystemPrompt", hits);
|
|
17
22
|
out.push({ overlay: Object.freeze({ id: "core/role.append", op: "add", target: "task-append", text: append }), origin: SUGAR });
|
|
18
23
|
}
|
|
19
|
-
return Object.freeze(out);
|
|
24
|
+
return Object.freeze({ overlays: Object.freeze(out), ...(decided?.promptRole !== undefined ? { hostRole: decided.promptRole } : {}) });
|
|
20
25
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { TSchema } from "typebox";
|
|
2
2
|
import type { AgentTool } from "../internal/harness-types.js";
|
|
3
3
|
import type { ProtocolId } from "../core/protocol-table.js";
|
|
4
|
+
import { type PromptTraitName } from "./catalog/schema.js";
|
|
4
5
|
/** The protocol slice comes from the protocol table — adding a protocol extends ProtocolId and this
|
|
5
6
|
* union follows automatically (the origin projection is table-driven, prepare-task). */
|
|
6
7
|
export type ToolOrigin = "core" | "caller" | "synthetic" | ProtocolId;
|
|
8
|
+
/** The origin a declared contract id names: a `core.` id is one of the engine's own contracts, any other id a caller's. The one
|
|
9
|
+
* reading of the prefix — the definition factory labels a descriptor by it, and the caller-tool door refuses a caller entry (a
|
|
10
|
+
* spec's `contract`, a product's descriptor) that claims one the engine did not mint. */
|
|
11
|
+
export declare function contractOriginOf(contractId: string): "core" | "caller";
|
|
12
|
+
export declare function isEngineDescriptor(value: unknown): boolean;
|
|
7
13
|
export interface ToolContractDescriptor {
|
|
8
14
|
/** Stable contract identity, e.g. `core.read@2`. Versioned independently of the wire name. */
|
|
9
15
|
contractId: string;
|
|
@@ -18,7 +24,9 @@ export interface ToolContractDescriptor {
|
|
|
18
24
|
shapeDigest: string;
|
|
19
25
|
/** Full materialized schema digest (incl. descriptions) — the model-visible wire face. */
|
|
20
26
|
wireSchemaDigest: string;
|
|
21
|
-
/** The presentation card in effect
|
|
27
|
+
/** The presentation card in effect ({@link cardIdOf}): `builtin:<wireName>` for a declared contract's card, the
|
|
28
|
+
* undeclared-contract prefix for any other tool's, and `#<variant id>` after it when the mount chose one of the
|
|
29
|
+
* description's variants (`descriptionVariants`) over its unconditional text. */
|
|
22
30
|
cardId: string;
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
@@ -44,6 +52,28 @@ export interface ToolManifestRow {
|
|
|
44
52
|
}
|
|
45
53
|
export declare function computeShapeDigest(schema: TSchema | undefined): string;
|
|
46
54
|
export declare function computeWireSchemaDigest(schema: TSchema | undefined, description: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* The judge of a caller roster's card declarations where the roster enters, every entry the caller handed, mounted or not: the
|
|
57
|
+
* config-door phase (over the snapshot's faces) and a resume's screen before its claim (one function, so a resume's row stays
|
|
58
|
+
* pending). A description variant table the engine cannot read is refused (`config.tool_face_invalid`); an entry still carrying
|
|
59
|
+
* the retired `descriptionClassic` as plain data is refused by name (`config.deps_retired_key`) — the door and the sentence the
|
|
60
|
+
* snapshot gives the key on the LIVE entry under every reading of it (a prototype's getter, a non-enumerable member), so a face
|
|
61
|
+
* never carries one and the resume's screen is where this line fires. What the receipt cannot take without running the caller's
|
|
62
|
+
* code (an accessor, a Proxy, an entry of another prototype, a non-enumerable member) is not judged here: a variant table is
|
|
63
|
+
* judged again at the mount ({@link mountDescriptionVariant}), a retired member by the snapshot — on a resume, after the claim.
|
|
64
|
+
*/
|
|
65
|
+
export declare function assertToolCardDeclarations(tools: unknown): void;
|
|
66
|
+
/**
|
|
67
|
+
* The face a run mounts for a tool under its prompt traits: the first of the tool's description variants whose trait
|
|
68
|
+
* condition holds over the run's traits replaces its description (a shallow copy carrying the chosen variant's id, so the
|
|
69
|
+
* card id reports it); none holds, or the tool declares none, ⇒ the card's unconditional text. A face some run already
|
|
70
|
+
* mounted is judged from its card again, never from the text that run chose. The selection reads traits through the
|
|
71
|
+
* catalog's own trait reading ({@link traitsHold}). A variant the engine cannot read refuses the task by name
|
|
72
|
+
* (`config.tool_face_invalid`) — never mounted as if the tool had one form. One function ({@link descriptionVariantsProblem})
|
|
73
|
+
* judges a table at both places: {@link assertToolCardDeclarations} over the entries the receipt can read as data, and here over
|
|
74
|
+
* every tool the run keeps after the exclusion valve — so a table the door could not read is judged when it is mounted.
|
|
75
|
+
*/
|
|
76
|
+
export declare function mountDescriptionVariant(tool: AgentTool, traits: ReadonlySet<PromptTraitName>): AgentTool;
|
|
47
77
|
export interface AttachContractInput {
|
|
48
78
|
contractId: string;
|
|
49
79
|
implementationRevision: string;
|
|
@@ -51,8 +81,15 @@ export interface AttachContractInput {
|
|
|
51
81
|
aliases?: string[];
|
|
52
82
|
}
|
|
53
83
|
/** Attach a contract descriptor to a materialized tool (factory exit point). Digests are computed
|
|
54
|
-
* from the tool's REAL mounted schema/description, so they always reflect the wire face.
|
|
84
|
+
* from the tool's REAL mounted schema/description, so they always reflect the wire face. A descriptor attached here is the
|
|
85
|
+
* caller's word, whatever its `origin`: it is never the engine's mint ({@link attachEngineToolContract}). */
|
|
55
86
|
export declare function attachToolContract(tool: AgentTool, input: AttachContractInput): void;
|
|
87
|
+
/** The factory's attach for a contract the engine's catalog minted: the descriptor is itself recorded as the engine's mint, frozen
|
|
88
|
+
* (its alias list included), so a roster door can tell a product the engine built from a definition from one a host dressed in a
|
|
89
|
+
* `core.` id. Internal — not exported from the package root. */
|
|
90
|
+
export declare function attachEngineToolContract(tool: AgentTool, input: AttachContractInput): void;
|
|
91
|
+
/** The descriptor `tool` carries, as attached — no shape judgment and no copy. Internal: the caller-roster door reads the claim here. */
|
|
92
|
+
export declare function attachedContractOf(tool: object): ToolContractDescriptor | undefined;
|
|
56
93
|
/**
|
|
57
94
|
* Resolve a tool's descriptor. Undeclared tools get a deterministic legacy descriptor derived from
|
|
58
95
|
* their shape (`legacy:<shapeDigest>`), origin per the mount channel — an external tool NEVER
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import { isPlainRecord, receive } from "../core/mods/kernel/receive.js";
|
|
4
|
+
import { assertNoRetiredKeys, RETIRED_TOOL_SPEC_KEYS } from "../core/retired-keys.js";
|
|
5
|
+
import { isPromptTraitName } from "./catalog/schema.js";
|
|
6
|
+
import { traitsHold } from "./select.js";
|
|
7
|
+
export function contractOriginOf(contractId) {
|
|
8
|
+
return contractId.startsWith("core.") ? "core" : "caller";
|
|
9
|
+
}
|
|
10
|
+
const ENGINE_DESCRIPTORS = new WeakSet();
|
|
11
|
+
export function isEngineDescriptor(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && ENGINE_DESCRIPTORS.has(value);
|
|
13
|
+
}
|
|
2
14
|
const PRESENTATION_KEYWORDS = new Set(["description", "title", "examples", "$id"]);
|
|
3
15
|
const SCHEMA_NAME_MAPS = new Set([
|
|
4
16
|
"properties",
|
|
@@ -45,8 +57,96 @@ export function computeWireSchemaDigest(schema, description) {
|
|
|
45
57
|
return sha(`${canonical(schema ?? null)}\u0000${description}`);
|
|
46
58
|
}
|
|
47
59
|
const TOOL_CONTRACT = Symbol("sema.toolContract");
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
const CARD_VARIANT = Symbol("sema.toolCardVariant");
|
|
61
|
+
function cardIdOf(base, tool) {
|
|
62
|
+
const chosen = tool[CARD_VARIANT];
|
|
63
|
+
return chosen === undefined ? base : `${base}#${chosen.id}`;
|
|
64
|
+
}
|
|
65
|
+
const VARIANT_ID = /^[A-Za-z0-9._-]{1,64}$/;
|
|
66
|
+
function descriptionVariantsProblem(variants) {
|
|
67
|
+
if (variants === undefined)
|
|
68
|
+
return undefined;
|
|
69
|
+
if (!Array.isArray(variants))
|
|
70
|
+
return "is not a list";
|
|
71
|
+
const ids = new Set();
|
|
72
|
+
const table = variants;
|
|
73
|
+
for (const [i, v] of table.entries()) {
|
|
74
|
+
const at = `descriptionVariants[${i}]`;
|
|
75
|
+
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
76
|
+
return `${at} is not an object`;
|
|
77
|
+
const r = v;
|
|
78
|
+
for (const k of Object.keys(r))
|
|
79
|
+
if (k !== "id" && k !== "traits" && k !== "text")
|
|
80
|
+
return `${at} carries ${JSON.stringify(k).slice(0, 40)} (id, traits, text only)`;
|
|
81
|
+
if (typeof r.id !== "string" || !VARIANT_ID.test(r.id))
|
|
82
|
+
return `${at}.id is not 1–64 characters of [A-Za-z0-9._-]`;
|
|
83
|
+
if (ids.has(r.id))
|
|
84
|
+
return `${at}.id ${JSON.stringify(r.id)} repeats an earlier variant's`;
|
|
85
|
+
ids.add(r.id);
|
|
86
|
+
if (typeof r.text !== "string" || r.text.trim() === "")
|
|
87
|
+
return `${at}.text is not a non-blank string`;
|
|
88
|
+
const t = r.traits;
|
|
89
|
+
if (t === null || typeof t !== "object" || Array.isArray(t))
|
|
90
|
+
return `${at}.traits is not an object`;
|
|
91
|
+
const lists = Object.entries(t);
|
|
92
|
+
if (lists.length === 0)
|
|
93
|
+
return `${at}.traits is empty (use \`description\`)`;
|
|
94
|
+
for (const [k, list] of lists) {
|
|
95
|
+
if (k !== "allOf" && k !== "noneOf")
|
|
96
|
+
return `${at}.traits carries ${JSON.stringify(k).slice(0, 40)} (allOf, noneOf only)`;
|
|
97
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
98
|
+
return `${at}.traits.${k} is not a non-empty list`;
|
|
99
|
+
const names = list;
|
|
100
|
+
for (const name of names)
|
|
101
|
+
if (!isPromptTraitName(name))
|
|
102
|
+
return `${at}.traits.${k} names ${typeof name === "string" ? JSON.stringify(name.slice(0, 64)) : typeof name}, not a trait`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
function descriptionVariantsRefusal(toolName, problem) {
|
|
108
|
+
const named = typeof toolName === "string" ? JSON.stringify(toolName.slice(0, 80)) : `(a ${typeof toolName} name)`;
|
|
109
|
+
return Object.assign(new Error(`tool ${named}: its ${problem.startsWith("descriptionVariants") ? problem : `descriptionVariants ${problem}`}`), { code: "config.tool_face_invalid" });
|
|
110
|
+
}
|
|
111
|
+
const ROSTER_CARD_RECEIPT = Object.freeze({ accessors: "refuse", depth: 6, others: "as-is", contain: true, isProxy: (v) => types.isProxy(v) });
|
|
112
|
+
export function assertToolCardDeclarations(tools) {
|
|
113
|
+
const got = receive(tools, ROSTER_CARD_RECEIPT);
|
|
114
|
+
if (!got.ok || !Array.isArray(got.value))
|
|
115
|
+
return;
|
|
116
|
+
const unread = new Set();
|
|
117
|
+
for (const f of got.faults ?? []) {
|
|
118
|
+
const [at, member] = f.path;
|
|
119
|
+
if (at !== undefined && (member === "name" || member === "descriptionVariants" || member === "descriptionClassic"))
|
|
120
|
+
unread.add(at);
|
|
121
|
+
}
|
|
122
|
+
got.value.forEach((t, i) => {
|
|
123
|
+
if (!isPlainRecord(t) || unread.has(String(i)))
|
|
124
|
+
return;
|
|
125
|
+
assertNoRetiredKeys(t, RETIRED_TOOL_SPEC_KEYS, "ToolSpec");
|
|
126
|
+
const problem = descriptionVariantsProblem(t["descriptionVariants"]);
|
|
127
|
+
if (problem !== undefined)
|
|
128
|
+
throw descriptionVariantsRefusal(t["name"], problem);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export function mountDescriptionVariant(tool, traits) {
|
|
132
|
+
const variants = tool.descriptionVariants;
|
|
133
|
+
const problem = descriptionVariantsProblem(variants);
|
|
134
|
+
if (problem !== undefined)
|
|
135
|
+
throw descriptionVariantsRefusal(tool.name, problem);
|
|
136
|
+
const earlier = tool[CARD_VARIANT];
|
|
137
|
+
const unconditional = earlier?.unconditional ?? tool.description;
|
|
138
|
+
const chosen = tool.descriptionVariants?.find((v) => traitsHold(v.traits, traits));
|
|
139
|
+
if (chosen === undefined && earlier === undefined)
|
|
140
|
+
return tool;
|
|
141
|
+
const face = { ...tool, description: chosen?.text ?? unconditional };
|
|
142
|
+
if (chosen !== undefined)
|
|
143
|
+
face[CARD_VARIANT] = Object.freeze({ id: chosen.id, unconditional });
|
|
144
|
+
else
|
|
145
|
+
delete face[CARD_VARIANT];
|
|
146
|
+
return face;
|
|
147
|
+
}
|
|
148
|
+
function descriptorOf(tool, input) {
|
|
149
|
+
return {
|
|
50
150
|
contractId: input.contractId,
|
|
51
151
|
implementationRevision: input.implementationRevision,
|
|
52
152
|
wireName: tool.name,
|
|
@@ -56,8 +156,20 @@ export function attachToolContract(tool, input) {
|
|
|
56
156
|
wireSchemaDigest: computeWireSchemaDigest(tool.parameters, tool.description ?? ""),
|
|
57
157
|
cardId: `builtin:${tool.name}`,
|
|
58
158
|
};
|
|
159
|
+
}
|
|
160
|
+
export function attachToolContract(tool, input) {
|
|
161
|
+
tool[TOOL_CONTRACT] = descriptorOf(tool, input);
|
|
162
|
+
}
|
|
163
|
+
export function attachEngineToolContract(tool, input) {
|
|
164
|
+
const descriptor = descriptorOf(tool, input);
|
|
165
|
+
if (descriptor.aliases !== undefined)
|
|
166
|
+
descriptor.aliases = Object.freeze([...descriptor.aliases]);
|
|
167
|
+
ENGINE_DESCRIPTORS.add(Object.freeze(descriptor));
|
|
59
168
|
tool[TOOL_CONTRACT] = descriptor;
|
|
60
169
|
}
|
|
170
|
+
export function attachedContractOf(tool) {
|
|
171
|
+
return tool[TOOL_CONTRACT];
|
|
172
|
+
}
|
|
61
173
|
export function getToolContract(tool, fallbackOrigin = "caller") {
|
|
62
174
|
const attached = tool[TOOL_CONTRACT];
|
|
63
175
|
if (attached) {
|
|
@@ -71,7 +183,7 @@ export function getToolContract(tool, fallbackOrigin = "caller") {
|
|
|
71
183
|
origin: attached.origin,
|
|
72
184
|
shapeDigest: mountedShape,
|
|
73
185
|
wireSchemaDigest: computeWireSchemaDigest(tool.parameters, tool.description ?? ""),
|
|
74
|
-
cardId: `legacy:${tool.name}`,
|
|
186
|
+
cardId: cardIdOf(`legacy:${tool.name}`, tool),
|
|
75
187
|
};
|
|
76
188
|
}
|
|
77
189
|
return {
|
|
@@ -79,6 +191,7 @@ export function getToolContract(tool, fallbackOrigin = "caller") {
|
|
|
79
191
|
wireName: tool.name,
|
|
80
192
|
shapeDigest: mountedShape,
|
|
81
193
|
wireSchemaDigest: computeWireSchemaDigest(tool.parameters, tool.description ?? ""),
|
|
194
|
+
cardId: cardIdOf(attached.cardId, tool),
|
|
82
195
|
};
|
|
83
196
|
}
|
|
84
197
|
const shapeDigest = computeShapeDigest(tool.parameters);
|
|
@@ -90,7 +203,7 @@ export function getToolContract(tool, fallbackOrigin = "caller") {
|
|
|
90
203
|
origin: fallbackOrigin,
|
|
91
204
|
shapeDigest,
|
|
92
205
|
wireSchemaDigest: computeWireSchemaDigest(tool.parameters, tool.description ?? ""),
|
|
93
|
-
cardId: `legacy:${tool.name}`,
|
|
206
|
+
cardId: cardIdOf(`legacy:${tool.name}`, tool),
|
|
94
207
|
};
|
|
95
208
|
}
|
|
96
209
|
export function hasToolContract(tool) {
|
|
@@ -6,12 +6,9 @@ export interface RawPrefixInputs {
|
|
|
6
6
|
provider: string;
|
|
7
7
|
/** Model id (a switch is a new cache namespace). */
|
|
8
8
|
modelId: string;
|
|
9
|
-
/** The run's prompt identity (`promptIdentityOf`: catalog, renderers, overlay layers, binding
|
|
10
|
-
* `identity.artifact`. */
|
|
9
|
+
/** The run's prompt identity (`promptIdentityOf`: catalog, renderers, overlay layers, binding — the binding element
|
|
10
|
+
* digests the selector values, the prompt traits among them) — the manifest's `identity.artifact`. */
|
|
11
11
|
artifactDigest: string;
|
|
12
|
-
/** Presentation/policy axis: promptProfile + fable mitigations (prose forks on these). */
|
|
13
|
-
promptProfile: string;
|
|
14
|
-
fableMitigations: boolean;
|
|
15
12
|
/** Physical block layout as SERVED (derived from the composed system blocks; single-block default). */
|
|
16
13
|
layoutGroups: ReadonlyArray<{
|
|
17
14
|
groupId: string;
|
|
@@ -47,8 +44,6 @@ export declare const PREFIX_INPUT_CLASSIFICATION: {
|
|
|
47
44
|
readonly provider: "cache-identity";
|
|
48
45
|
readonly modelId: "cache-identity";
|
|
49
46
|
readonly artifactDigest: "cache-identity";
|
|
50
|
-
readonly promptProfile: "cache-identity";
|
|
51
|
-
readonly fableMitigations: "cache-identity";
|
|
52
47
|
readonly layoutGroups: "cache-identity";
|
|
53
48
|
readonly stableSystemText: "cache-identity";
|
|
54
49
|
readonly toolWire: "cache-identity";
|
|
@@ -68,12 +63,11 @@ export interface LoweringRecord {
|
|
|
68
63
|
}
|
|
69
64
|
export declare const LOWERING_VERSION = "sema-lowering@1";
|
|
70
65
|
export declare function loweringRecordFor(api: string): LoweringRecord;
|
|
71
|
-
/** The
|
|
66
|
+
/** The eight identity elements, individually digested (observable without shipping prompt text). */
|
|
72
67
|
export interface CacheIdentityElements {
|
|
73
68
|
provider: string;
|
|
74
69
|
modelId: string;
|
|
75
70
|
artifactDigest: string;
|
|
76
|
-
policyDigest: string;
|
|
77
71
|
layoutDigest: string;
|
|
78
72
|
stableSystemDigest: string;
|
|
79
73
|
toolWireDigest: string;
|
|
@@ -82,7 +76,7 @@ export interface CacheIdentityElements {
|
|
|
82
76
|
}
|
|
83
77
|
export interface TurnPromptSnapshot {
|
|
84
78
|
elements: CacheIdentityElements;
|
|
85
|
-
/** sha256(canonical(elements)) — the ONE
|
|
79
|
+
/** sha256(canonical(elements)) — the ONE eight-element identity value. */
|
|
86
80
|
cacheIdentity: string;
|
|
87
81
|
lowering: LoweringRecord;
|
|
88
82
|
/** invoked after EVERY refresh so the run loop can emit the changed identity
|
|
@@ -4,8 +4,6 @@ export const PREFIX_INPUT_CLASSIFICATION = {
|
|
|
4
4
|
provider: "cache-identity",
|
|
5
5
|
modelId: "cache-identity",
|
|
6
6
|
artifactDigest: "cache-identity",
|
|
7
|
-
promptProfile: "cache-identity",
|
|
8
|
-
fableMitigations: "cache-identity",
|
|
9
7
|
layoutGroups: "cache-identity",
|
|
10
8
|
stableSystemText: "cache-identity",
|
|
11
9
|
toolWire: "cache-identity",
|
|
@@ -53,7 +51,6 @@ export function buildTurnPromptSnapshot(raw, api, promptHasher) {
|
|
|
53
51
|
provider: raw.provider,
|
|
54
52
|
modelId: raw.modelId,
|
|
55
53
|
artifactDigest: raw.artifactDigest,
|
|
56
|
-
policyDigest: sha(canonical({ promptProfile: raw.promptProfile, fableMitigations: raw.fableMitigations })),
|
|
57
54
|
layoutDigest: sha(canonical(raw.layoutGroups)),
|
|
58
55
|
stableSystemDigest: promptSha(raw.stableSystemText),
|
|
59
56
|
toolWireDigest: sha(canonical(raw.toolWire.map((t) => ({ name: t.name, description: t.description, parameters: t.parameters })))),
|
|
@@ -32,11 +32,6 @@ export interface PromptRuntimeFacts {
|
|
|
32
32
|
/** Orchestration is active but the Workflow tool is DEFERRED — the mode section serves the short pointer.
|
|
33
33
|
* Only meaningful when orchestrationEnabled. OPTIONAL — absence reads as false. */
|
|
34
34
|
orchestrationDeferred?: boolean;
|
|
35
|
-
/** The run's resolved prompt profile ("simple" default). It becomes the `lean_prompt` trait; catalog
|
|
36
|
-
* data reads the trait. OPTIONAL — absence reads as "simple". */
|
|
37
|
-
promptProfile?: "simple" | "classic";
|
|
38
|
-
/** The run's model is fable-family. It becomes the `fable_5_mitigations` trait. OPTIONAL — absence = false. */
|
|
39
|
-
fableMitigations?: boolean;
|
|
40
35
|
awarenessEnabled: boolean;
|
|
41
36
|
goalEnabled: boolean;
|
|
42
37
|
worktreeIsolated: boolean;
|
|
@@ -59,8 +54,6 @@ export interface SectionRenderInputs {
|
|
|
59
54
|
environmentBlock?: string;
|
|
60
55
|
/** Pre-rendered volatile memory tail (engine injection + fenced project layer). */
|
|
61
56
|
memoryBlock?: string;
|
|
62
|
-
/** model.promptGuidance joined text, if the model declares any. */
|
|
63
|
-
modelGuidance?: string;
|
|
64
57
|
}
|
|
65
58
|
/** One rendered (admitted, non-empty) section of a composition — the compiled IR unit. */
|
|
66
59
|
export interface CompiledSection {
|