@sema-agent/core 7.55.0 → 7.57.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.
Files changed (502) hide show
  1. package/CHANGELOG.md +1054 -0
  2. package/LICENSE +1 -1
  3. package/dist/agents/cascade.js +1 -1
  4. package/dist/agents/cc-peer-directory.js +1 -0
  5. package/dist/agents/child-model-seat.d.ts +0 -11
  6. package/dist/agents/child-model-seat.js +0 -3
  7. package/dist/agents/list-agents-tool.d.ts +3 -1
  8. package/dist/agents/list-agents-tool.js +7 -7
  9. package/dist/agents/org-delivery-gate.js +3 -4
  10. package/dist/agents/peer-directory.d.ts +22 -4
  11. package/dist/agents/peer-directory.js +24 -2
  12. package/dist/agents/peer-held-queue.d.ts +69 -49
  13. package/dist/agents/peer-held-queue.js +255 -106
  14. package/dist/agents/peer-session-drain.js +65 -45
  15. package/dist/agents/repair-loop.js +2 -2
  16. package/dist/agents/send-message-tool.js +7 -6
  17. package/dist/agents/subagent.d.ts +6 -4
  18. package/dist/agents/subagent.js +72 -68
  19. package/dist/agents/tool-filter.d.ts +7 -5
  20. package/dist/agents/tool-filter.js +12 -9
  21. package/dist/agents/verify.d.ts +3 -2
  22. package/dist/agents/verify.js +3 -3
  23. package/dist/brain/anthropic.js +45 -80
  24. package/dist/brain/media-degrade.d.ts +18 -7
  25. package/dist/brain/media-degrade.js +13 -2
  26. package/dist/brain/model-capability.d.ts +37 -0
  27. package/dist/brain/model-capability.js +34 -0
  28. package/dist/brain/model-presets.d.ts +2 -8
  29. package/dist/brain/model-presets.js +1 -6
  30. package/dist/brain/open-responses.js +23 -34
  31. package/dist/brain/openai.js +25 -96
  32. package/dist/brain/provider-dialect.d.ts +3 -2
  33. package/dist/brain/provider-dialect.js +2 -2
  34. package/dist/brain/reasoning-request.d.ts +96 -0
  35. package/dist/brain/reasoning-request.js +174 -0
  36. package/dist/brain/reasoning.d.ts +11 -11
  37. package/dist/brain/reasoning.js +4 -3
  38. package/dist/brain/request-params.d.ts +13 -4
  39. package/dist/brain/request-params.js +21 -5
  40. package/dist/brain/status-sink.d.ts +20 -0
  41. package/dist/brain/status-sink.js +7 -0
  42. package/dist/brain/stream-engine.d.ts +9 -0
  43. package/dist/brain/stream-engine.js +24 -10
  44. package/dist/brain/stream-shared.d.ts +5 -4
  45. package/dist/brain/stream-shared.js +4 -4
  46. package/dist/core/a2a.d.ts +2 -1
  47. package/dist/core/a2a.js +19 -13
  48. package/dist/core/agent-definition.d.ts +10 -0
  49. package/dist/core/allow-entry.d.ts +23 -23
  50. package/dist/core/allow-entry.js +42 -46
  51. package/dist/core/allow-rule-shadow.d.ts +3 -3
  52. package/dist/core/approval-object.d.ts +21 -5
  53. package/dist/core/approval-object.js +44 -17
  54. package/dist/core/ask-origin.d.ts +66 -20
  55. package/dist/core/ask-origin.js +63 -23
  56. package/dist/core/ask-question.d.ts +51 -8
  57. package/dist/core/ask-question.js +3 -4
  58. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  59. package/dist/core/ask-unresolvable-notice.js +16 -2
  60. package/dist/core/auto-compaction.d.ts +71 -6
  61. package/dist/core/auto-compaction.js +42 -26
  62. package/dist/core/background-agent-store.d.ts +6 -2
  63. package/dist/core/background-agent-store.js +1 -1
  64. package/dist/core/checkpoint-generation.d.ts +53 -0
  65. package/dist/core/checkpoint-generation.js +35 -0
  66. package/dist/core/checkpoint-queries.d.ts +180 -0
  67. package/dist/core/checkpoint-queries.js +272 -0
  68. package/dist/core/checkpoint-requirements.d.ts +19 -1
  69. package/dist/core/checkpoint-requirements.js +6 -0
  70. package/dist/core/checkpoint-store.d.ts +105 -53
  71. package/dist/core/checkpoint-store.js +43 -20
  72. package/dist/core/cross-boundary-taint.d.ts +6 -5
  73. package/dist/core/cross-boundary-taint.js +5 -5
  74. package/dist/core/decision-receipt.d.ts +37 -3
  75. package/dist/core/decision-receipt.js +17 -17
  76. package/dist/core/delegation-not-started.d.ts +6 -0
  77. package/dist/core/delegation-not-started.js +17 -0
  78. package/dist/core/engine-attestation.d.ts +93 -0
  79. package/dist/core/engine-attestation.js +70 -0
  80. package/dist/core/engine-capabilities.d.ts +4 -1
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +32 -12
  83. package/dist/core/engine-notice.js +6 -0
  84. package/dist/core/file-history-store.d.ts +104 -22
  85. package/dist/core/file-history-store.js +37 -19
  86. package/dist/core/gate-fold.d.ts +1 -1
  87. package/dist/core/gate-fold.js +22 -10
  88. package/dist/core/gate-lanes.js +73 -65
  89. package/dist/core/gate-outcome.d.ts +26 -5
  90. package/dist/core/gate-outcome.js +26 -0
  91. package/dist/core/governance-codes.d.ts +5 -1
  92. package/dist/core/governance-codes.js +6 -0
  93. package/dist/core/hooks.d.ts +19 -18
  94. package/dist/core/hooks.js +3 -1
  95. package/dist/core/host-floor.d.ts +128 -0
  96. package/dist/core/host-floor.js +206 -0
  97. package/dist/core/host-target.d.ts +38 -3
  98. package/dist/core/host-target.js +38 -5
  99. package/dist/core/mailbox-store.d.ts +62 -1
  100. package/dist/core/mailbox-store.js +59 -0
  101. package/dist/core/mcp-name-judge.d.ts +46 -0
  102. package/dist/core/mcp-name-judge.js +61 -0
  103. package/dist/core/mcp-probe.d.ts +1 -1
  104. package/dist/core/mcp-probe.js +2 -5
  105. package/dist/core/mcp.d.ts +5 -1
  106. package/dist/core/mcp.js +70 -64
  107. package/dist/core/memory-engine/consolidation-driver.js +4 -3
  108. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  109. package/dist/core/memory-engine/distiller.js +26 -17
  110. package/dist/core/memory-engine/engine.js +4 -4
  111. package/dist/core/memory-engine/layout.d.ts +60 -8
  112. package/dist/core/memory-engine/layout.js +70 -8
  113. package/dist/core/model-seat.d.ts +10 -3
  114. package/dist/core/mods/classic-events.d.ts +67 -0
  115. package/dist/core/mods/classic-events.js +1 -0
  116. package/dist/core/mods/dollar.d.ts +13 -0
  117. package/dist/core/mods/extension-call.d.ts +31 -0
  118. package/dist/core/mods/extension-call.js +43 -0
  119. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  120. package/dist/core/mods/kernel/dispatch.js +140 -69
  121. package/dist/core/mods/kernel/events.d.ts +47 -11
  122. package/dist/core/mods/kernel/events.js +66 -42
  123. package/dist/core/mods/kernel/index.d.ts +4 -4
  124. package/dist/core/mods/kernel/index.js +2 -2
  125. package/dist/core/mods/kernel/receive.d.ts +39 -5
  126. package/dist/core/mods/kernel/receive.js +290 -17
  127. package/dist/core/mods/kernel/registration.d.ts +33 -2
  128. package/dist/core/mods/kernel/registration.js +6 -7
  129. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  130. package/dist/core/mods/kernel/site-rules.js +24 -42
  131. package/dist/core/mods/spec-seats.d.ts +69 -0
  132. package/dist/core/mods/spec-seats.js +114 -0
  133. package/dist/core/mods/stations.d.ts +28 -8
  134. package/dist/core/mods/stations.js +29 -13
  135. package/dist/core/mods/tool-call.d.ts +79 -0
  136. package/dist/core/mods/tool-call.js +152 -0
  137. package/dist/core/namespaced-rule-name.d.ts +32 -38
  138. package/dist/core/namespaced-rule-name.js +29 -36
  139. package/dist/core/parent-spec-seat.d.ts +6 -1
  140. package/dist/core/parent-spec-seat.js +2 -0
  141. package/dist/core/park-selfcheck.js +3 -0
  142. package/dist/core/permission-rule-consent.d.ts +24 -3
  143. package/dist/core/permission-rule-consent.js +136 -41
  144. package/dist/core/permission-rule-model.d.ts +57 -5
  145. package/dist/core/permission-rule-model.js +90 -31
  146. package/dist/core/permission-rule-org.d.ts +6 -2
  147. package/dist/core/permission-rule-org.js +8 -4
  148. package/dist/core/permission-rule-provider.d.ts +5 -2
  149. package/dist/core/permission-rule-provider.js +41 -11
  150. package/dist/core/permission-rule-store.d.ts +3 -2
  151. package/dist/core/permission-rule-store.js +11 -2
  152. package/dist/core/permission-rule-sync.js +3 -2
  153. package/dist/core/permission-rule-syntax.d.ts +5 -4
  154. package/dist/core/permission-rule-syntax.js +2 -2
  155. package/dist/core/permission-rules.d.ts +4 -4
  156. package/dist/core/permission-rules.js +11 -20
  157. package/dist/core/persisted-rule-arms.d.ts +2 -2
  158. package/dist/core/persisted-rule-arms.js +10 -12
  159. package/dist/core/principal-name.d.ts +20 -0
  160. package/dist/core/principal-name.js +22 -0
  161. package/dist/core/prompt-section-seat.js +4 -6
  162. package/dist/core/protocol-http-auth.d.ts +40 -5
  163. package/dist/core/protocol-http-auth.js +168 -4
  164. package/dist/core/protocol-naming.d.ts +20 -0
  165. package/dist/core/protocol-naming.js +20 -3
  166. package/dist/core/read-only-shell.d.ts +20 -5
  167. package/dist/core/read-only-shell.js +29 -14
  168. package/dist/core/remote-env.d.ts +37 -1
  169. package/dist/core/remote-env.js +11 -0
  170. package/dist/core/resume-startup-cause.d.ts +24 -2
  171. package/dist/core/resume-startup-cause.js +20 -1
  172. package/dist/core/retired-keys.d.ts +16 -0
  173. package/dist/core/retired-keys.js +16 -4
  174. package/dist/core/rewrite-rejudge.d.ts +60 -0
  175. package/dist/core/rewrite-rejudge.js +36 -0
  176. package/dist/core/roles.d.ts +28 -1
  177. package/dist/core/roles.js +81 -26
  178. package/dist/core/rule-lane-reads.d.ts +20 -15
  179. package/dist/core/rule-lane-reads.js +45 -17
  180. package/dist/core/rule-owner.d.ts +3 -3
  181. package/dist/core/rule-owner.js +3 -2
  182. package/dist/core/runner/announce-once-ledger.d.ts +14 -0
  183. package/dist/core/runner/announce-once-ledger.js +5 -0
  184. package/dist/core/runner/assemble-result.d.ts +1 -0
  185. package/dist/core/runner/assemble-result.js +1 -1
  186. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  187. package/dist/core/runner/caller-roster.d.ts +16 -4
  188. package/dist/core/runner/caller-roster.js +33 -6
  189. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  190. package/dist/core/runner/capability-withheld-seat.js +24 -0
  191. package/dist/core/runner/classifier-ladder.d.ts +7 -9
  192. package/dist/core/runner/classifier-ladder.js +3 -3
  193. package/dist/core/runner/compact-session.d.ts +10 -0
  194. package/dist/core/runner/compact-session.js +202 -0
  195. package/dist/core/runner/compaction-call-options.d.ts +2 -2
  196. package/dist/core/runner/compaction-seams.d.ts +21 -1
  197. package/dist/core/runner/compaction-seams.js +11 -8
  198. package/dist/core/runner/construction-doors.js +3 -0
  199. package/dist/core/runner/contracts.d.ts +50 -40
  200. package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
  201. package/dist/core/runner/cross-boundary-lane.js +40 -27
  202. package/dist/core/runner/denial-limit-arms.d.ts +2 -2
  203. package/dist/core/runner/denial-limit-arms.js +1 -1
  204. package/dist/core/runner/derived-route-fallback.d.ts +13 -0
  205. package/dist/core/runner/derived-route-fallback.js +6 -0
  206. package/dist/core/runner/env-capability-census.d.ts +3 -2
  207. package/dist/core/runner/env-capability-census.js +9 -3
  208. package/dist/core/runner/file-history-request.d.ts +18 -0
  209. package/dist/core/runner/file-history-request.js +21 -13
  210. package/dist/core/runner/file-history-restore.d.ts +45 -0
  211. package/dist/core/runner/file-history-restore.js +46 -0
  212. package/dist/core/runner/gate-exit.d.ts +3 -3
  213. package/dist/core/runner/gate-exit.js +4 -3
  214. package/dist/core/runner/image.d.ts +7 -17
  215. package/dist/core/runner/image.js +9 -60
  216. package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
  217. package/dist/core/runner/permission-rule-lanes.js +39 -17
  218. package/dist/core/runner/person-path-rows.d.ts +12 -9
  219. package/dist/core/runner/person-path-rows.js +18 -7
  220. package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
  221. package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
  222. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  223. package/dist/core/runner/prepare-ask-lane.js +5 -2
  224. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  225. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  226. package/dist/core/runner/prepare-config-doors.d.ts +35 -38
  227. package/dist/core/runner/prepare-config-doors.js +46 -28
  228. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  229. package/dist/core/runner/prepare-defer-classify.js +7 -8
  230. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  231. package/dist/core/runner/prepare-file-history.js +7 -39
  232. package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
  233. package/dist/core/runner/prepare-gate-stations.js +10 -1
  234. package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
  235. package/dist/core/runner/prepare-hands-readface.js +17 -14
  236. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  237. package/dist/core/runner/prepare-inherited-gate.js +5 -3
  238. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  239. package/dist/core/runner/prepare-park-ask.d.ts +2 -0
  240. package/dist/core/runner/prepare-park-ask.js +7 -7
  241. package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
  242. package/dist/core/runner/prepare-policy-chain.js +67 -76
  243. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  244. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  245. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  246. package/dist/core/runner/prepare-prompt-inputs.js +3 -5
  247. package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
  248. package/dist/core/runner/prepare-protocol-tools.js +3 -3
  249. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  250. package/dist/core/runner/prepare-safety-scan.js +0 -17
  251. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  252. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  253. package/dist/core/runner/prepare-task.d.ts +5 -2
  254. package/dist/core/runner/prepare-task.js +48 -43
  255. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
  256. package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
  257. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  258. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  259. package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
  260. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  261. package/dist/core/runner/resume-admission.js +1 -1
  262. package/dist/core/runner/resume-apply.js +11 -12
  263. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  264. package/dist/core/runner/resume-claim.d.ts +4 -2
  265. package/dist/core/runner/resume-claim.js +15 -8
  266. package/dist/core/runner/retired-runner-deps.js +1 -0
  267. package/dist/core/runner/rewind-files.d.ts +12 -0
  268. package/dist/core/runner/rewind-files.js +90 -0
  269. package/dist/core/runner/run-attachment-seats.js +2 -1
  270. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  271. package/dist/core/runner/run-brain-sinks.js +4 -2
  272. package/dist/core/runner/run-harness-handlers.js +12 -4
  273. package/dist/core/runner/run-leg.d.ts +1 -1
  274. package/dist/core/runner/run-leg.js +40 -39
  275. package/dist/core/runner/run-notification-lane.d.ts +2 -0
  276. package/dist/core/runner/run-notification-lane.js +2 -2
  277. package/dist/core/runner/run-recovery-lanes.js +3 -4
  278. package/dist/core/runner/run-settle-and-teardown.js +7 -12
  279. package/dist/core/runner/run-terminal-adoption.js +3 -4
  280. package/dist/core/runner/run-turn-boundary.js +4 -15
  281. package/dist/core/runner/runtask.d.ts +10 -0
  282. package/dist/core/runner/runtask.js +35 -42
  283. package/dist/core/runner/send-message-continuation.js +1 -1
  284. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  285. package/dist/core/runner/session-read-file-states.js +28 -0
  286. package/dist/core/runner/session-rule-policy.js +4 -3
  287. package/dist/core/runner/session-verb-doors.d.ts +28 -0
  288. package/dist/core/runner/session-verb-doors.js +48 -0
  289. package/dist/core/runner/session-write-ledger.d.ts +30 -0
  290. package/dist/core/runner/session-write-ledger.js +101 -0
  291. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  292. package/dist/core/runner/shell-env-withheld.js +51 -0
  293. package/dist/core/runner/skills-seat.js +6 -2
  294. package/dist/core/runner/stream-settle-backstop.js +12 -15
  295. package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
  296. package/dist/core/runner/sub-agent-deny-lists.js +25 -17
  297. package/dist/core/runner/synthetic-tools.d.ts +6 -0
  298. package/dist/core/runner/synthetic-tools.js +4 -1
  299. package/dist/core/runner/teardown-bounded.d.ts +1 -0
  300. package/dist/core/runner/teardown-bounded.js +1 -0
  301. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  302. package/dist/core/runner/tool-disclosure.js +1 -3
  303. package/dist/core/runner/tool-end-body.d.ts +1 -1
  304. package/dist/core/runner/tool-end-body.js +10 -9
  305. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  306. package/dist/core/runner/tool-not-executed.js +11 -0
  307. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  308. package/dist/core/runner/tool-occurrence.js +7 -0
  309. package/dist/core/runner/turn-attachments.d.ts +33 -15
  310. package/dist/core/runner/turn-attachments.js +62 -37
  311. package/dist/core/runner-deps.d.ts +7 -7
  312. package/dist/core/safety-axis-vocab.d.ts +6 -4
  313. package/dist/core/safety-axis-vocab.js +6 -5
  314. package/dist/core/safety-merge-corpus.js +11 -3
  315. package/dist/core/secret-env.d.ts +30 -3
  316. package/dist/core/secret-env.js +47 -8
  317. package/dist/core/select-model.js +3 -3
  318. package/dist/core/session-policy-store.d.ts +32 -15
  319. package/dist/core/session-policy-store.js +156 -36
  320. package/dist/core/session-store.d.ts +29 -10
  321. package/dist/core/session-store.js +51 -19
  322. package/dist/core/session.d.ts +82 -16
  323. package/dist/core/session.js +53 -0
  324. package/dist/core/shell-read-silence.d.ts +11 -12
  325. package/dist/core/shell-read-silence.js +9 -5
  326. package/dist/core/shell-run-candidates.js +3 -1
  327. package/dist/core/shell-wrapper-projection.d.ts +1 -1
  328. package/dist/core/shell-wrapper-projection.js +1 -1
  329. package/dist/core/shell-wrapper-table.d.ts +14 -7
  330. package/dist/core/shell-wrapper-table.js +5 -4
  331. package/dist/core/side-query.js +10 -1
  332. package/dist/core/skill-grant.d.ts +7 -2
  333. package/dist/core/skill-grant.js +5 -0
  334. package/dist/core/skills-directory.js +6 -2
  335. package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
  336. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  337. package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
  338. package/dist/core/store-contracts/file-history-store-contract.js +40 -1
  339. package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
  340. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  341. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  342. package/dist/core/store-contracts/session-repo-contract.js +51 -0
  343. package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
  344. package/dist/core/store-contracts/session-store-contract.js +150 -14
  345. package/dist/core/stub-env.d.ts +2 -0
  346. package/dist/core/stub-env.js +1 -0
  347. package/dist/core/synthetic-read-verdict.js +3 -3
  348. package/dist/core/task-event.d.ts +32 -4
  349. package/dist/core/task-notification.d.ts +16 -12
  350. package/dist/core/task-registry-agent.d.ts +8 -4
  351. package/dist/core/task-registry-agent.js +14 -8
  352. package/dist/core/task-registry-shared.d.ts +35 -6
  353. package/dist/core/task-registry-shared.js +11 -0
  354. package/dist/core/task-registry.d.ts +10 -1
  355. package/dist/core/task-registry.js +12 -2
  356. package/dist/core/task-result.d.ts +18 -0
  357. package/dist/core/task-spec.d.ts +18 -13
  358. package/dist/core/tighten-task-spec.js +2 -1
  359. package/dist/core/tool-catalog-entries.d.ts +23 -0
  360. package/dist/core/tool-catalog-entries.js +14 -2
  361. package/dist/core/tool-check-reading.d.ts +11 -0
  362. package/dist/core/tool-check-reading.js +11 -6
  363. package/dist/core/tool-model-gate.d.ts +2 -2
  364. package/dist/core/tool-name-aliases.d.ts +48 -18
  365. package/dist/core/tool-name-aliases.js +36 -19
  366. package/dist/core/tool-name-readings.d.ts +6 -32
  367. package/dist/core/tool-name-readings.js +2 -9
  368. package/dist/core/tool-policy.d.ts +78 -204
  369. package/dist/core/tool-policy.js +152 -204
  370. package/dist/core/tool-result-store.js +3 -0
  371. package/dist/core/tool-roster.d.ts +14 -19
  372. package/dist/core/tool-roster.js +11 -44
  373. package/dist/core/tool-spec-members.js +7 -2
  374. package/dist/core/tool-spec.d.ts +19 -11
  375. package/dist/core/tools.js +49 -9
  376. package/dist/core/trace.d.ts +6 -3
  377. package/dist/core/trace.js +2 -1
  378. package/dist/core/types.d.ts +1 -1
  379. package/dist/core/untrusted-egress.d.ts +20 -0
  380. package/dist/core/untrusted-egress.js +77 -3
  381. package/dist/core/user-attachment.d.ts +8 -1
  382. package/dist/core/user-attachment.js +64 -4
  383. package/dist/core/wiring-manifest.d.ts +9 -0
  384. package/dist/core/wiring-manifest.js +1 -0
  385. package/dist/core/workflow-journal-store.js +1 -1
  386. package/dist/engine/compaction/compaction.js +3 -2
  387. package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
  388. package/dist/engine/execution-env/node-execution-env.js +11 -2
  389. package/dist/engine/harness/agent-harness.d.ts +32 -6
  390. package/dist/engine/harness/agent-harness.js +65 -9
  391. package/dist/engine/harness/types.d.ts +29 -2
  392. package/dist/engine/llm/types.d.ts +28 -11
  393. package/dist/engine/loop/agent-loop.d.ts +23 -4
  394. package/dist/engine/loop/agent-loop.js +42 -30
  395. package/dist/engine/loop/types.d.ts +16 -6
  396. package/dist/engine/session/memory-repo.d.ts +9 -2
  397. package/dist/engine/session/memory-repo.js +11 -1
  398. package/dist/engine/session/repo-utils.d.ts +6 -5
  399. package/dist/engine/session/repo-utils.js +14 -6
  400. package/dist/index.d.ts +34 -17
  401. package/dist/index.js +22 -11
  402. package/dist/internal/harness-types.d.ts +1 -1
  403. package/dist/internal/harness.d.ts +2 -1
  404. package/dist/internal/harness.js +1 -0
  405. package/dist/internal/llm.d.ts +1 -1
  406. package/dist/orchestration/run-workflow-tool.d.ts +6 -4
  407. package/dist/orchestration/run-workflow-tool.js +5 -3
  408. package/dist/orchestration/workflow.d.ts +3 -0
  409. package/dist/orchestration/workflow.js +36 -18
  410. package/dist/primitives/credential-ref.d.ts +89 -0
  411. package/dist/primitives/credential-ref.js +125 -0
  412. package/dist/primitives/index.d.ts +2 -0
  413. package/dist/primitives/index.js +1 -0
  414. package/dist/prompt-assembly/artifact.d.ts +2 -2
  415. package/dist/prompt-assembly/artifact.js +5 -3
  416. package/dist/prompt-assembly/assemble.d.ts +3 -2
  417. package/dist/prompt-assembly/assemble.js +1 -1
  418. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  419. package/dist/prompt-assembly/catalog/schema.js +34 -2
  420. package/dist/prompt-assembly/catalog/sections.js +0 -1
  421. package/dist/prompt-assembly/composer.d.ts +3 -1
  422. package/dist/prompt-assembly/composer.js +1 -1
  423. package/dist/prompt-assembly/event-registry.js +1 -0
  424. package/dist/prompt-assembly/overlay.js +3 -3
  425. package/dist/prompt-assembly/renderers.d.ts +1 -1
  426. package/dist/prompt-assembly/renderers.js +0 -3
  427. package/dist/prompt-assembly/role-base.d.ts +15 -0
  428. package/dist/prompt-assembly/role-base.js +9 -0
  429. package/dist/prompt-assembly/select.d.ts +39 -14
  430. package/dist/prompt-assembly/select.js +47 -16
  431. package/dist/prompt-assembly/sugar.d.ts +17 -11
  432. package/dist/prompt-assembly/sugar.js +8 -3
  433. package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
  434. package/dist/prompt-assembly/tool-catalog.js +114 -4
  435. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  436. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  437. package/dist/prompt-assembly/types.d.ts +0 -7
  438. package/dist/scenarios/full-body.d.ts +11 -11
  439. package/dist/scenarios/full-body.js +4 -3
  440. package/dist/shell/lex.js +10 -1
  441. package/dist/stores/file/adoption/adopt.js +4 -3
  442. package/dist/stores/file/adoption/marker.js +3 -2
  443. package/dist/stores/file/checkpoint-store.d.ts +21 -4
  444. package/dist/stores/file/checkpoint-store.js +38 -7
  445. package/dist/stores/file/file-history-store.js +18 -11
  446. package/dist/stores/file/index.js +2 -1
  447. package/dist/stores/file/mailbox-store.d.ts +2 -1
  448. package/dist/stores/file/mailbox-store.js +26 -1
  449. package/dist/stores/file/permission-rule-adopt.js +4 -3
  450. package/dist/stores/file/permission-rule-store.js +11 -5
  451. package/dist/stores/file/session-store.d.ts +29 -6
  452. package/dist/stores/file/session-store.js +42 -50
  453. package/dist/tools/artifact/artifact-tool.js +3 -2
  454. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  455. package/dist/tools/fs/bash-program-position.js +56 -9
  456. package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
  457. package/dist/tools/fs/bash-readonly-classifier.js +5 -10
  458. package/dist/tools/fs/fs-bash.js +15 -8
  459. package/dist/tools/fs/fs-glob.d.ts +86 -0
  460. package/dist/tools/fs/fs-glob.js +226 -0
  461. package/dist/tools/fs/fs-read.js +14 -14
  462. package/dist/tools/fs/fs-search-tools.js +7 -7
  463. package/dist/tools/fs/pattern-kill-guard.d.ts +23 -0
  464. package/dist/tools/fs/pattern-kill-guard.js +429 -0
  465. package/dist/tools/fs/pdf.d.ts +9 -6
  466. package/dist/tools/fs/pdf.js +3 -3
  467. package/dist/tools/fs/program-read-model.d.ts +57 -7
  468. package/dist/tools/fs/program-read-model.js +11 -1
  469. package/dist/tools/fs/program-read-model.rows.js +78 -21
  470. package/dist/tools/fs/read-deny-home.js +3 -2
  471. package/dist/tools/fs/removal-targets.d.ts +17 -7
  472. package/dist/tools/fs/removal-targets.js +47 -20
  473. package/dist/tools/fs/search.d.ts +10 -0
  474. package/dist/tools/fs/search.js +20 -26
  475. package/dist/tools/fs/shell-read-argv.js +89 -12
  476. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  477. package/dist/tools/fs/shell-read-bindings.js +41 -0
  478. package/dist/tools/fs/shell-read-check.d.ts +10 -0
  479. package/dist/tools/fs/shell-read-check.js +13 -20
  480. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  481. package/dist/tools/fs/shell-read-environment.js +3 -2
  482. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  483. package/dist/tools/fs/shell-read-establish.js +19 -20
  484. package/dist/tools/fs/shell-read-identity.d.ts +12 -9
  485. package/dist/tools/fs/shell-read-identity.js +9 -4
  486. package/dist/tools/fs/shell-read-plan.js +24 -16
  487. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  488. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  489. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  490. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  491. package/dist/tools/fs/shell-reentry-text.js +40 -2
  492. package/dist/tools/todo.js +63 -63
  493. package/dist/tools/web.d.ts +19 -14
  494. package/dist/tools/web.js +46 -61
  495. package/package.json +1 -1
  496. package/test/export-surface.snapshot.json +221 -7
  497. package/wire-changes/core-stores-sql@7.57.0.json +29 -0
  498. package/wire-changes/core@7.56.0.json +3891 -0
  499. package/wire-changes/core@7.57.0.json +1487 -0
  500. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  501. package/wire-changes/mods-kernel@7.57.0.json +29 -0
  502. package/wire-changes/primitives@7.57.0.json +245 -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 { deploymentSubagentSystemPrompt, runnerRoleMap } from "../agents/child-model-seat.js";
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.systemPrompt === undefined && def.systemPrompt !== undefined)
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 perType = createAllowDenyPolicy({ ...(def.allowTools ? { allow: def.allowTools } : {}), ...(def.denyTools ? { deny: deniedToolNamesOf(`workflow agentType "${def.name}"`, def.denyTools) } : {}) });
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.systemPrompt === undefined) {
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 statedPersona = deploymentSubagentSystemPrompt(roles);
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) => opts.parkedResume?.find((d) => d.token === 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, { ...attemptInternals, ...(drive.inheritedGate !== undefined ? { inheritedGate: drive.inheritedGate } : {}) });
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 was consumed (${withoutToken(errText(err), drive.token)}); the park stands.`);
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, { ...runInternals, ...(d.inheritedGate !== undefined ? { inheritedGate: d.inheritedGate } : {}) });
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 was consumed (${withoutToken(errText(err), drive.token)}); the park stands.`);
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);
@@ -0,0 +1,89 @@
1
+ /**
2
+ * The credential reference: how a declaration names a credential without carrying one. This module says which references
3
+ * exist and whether a value is one, so the engine's door, an acceptance gate, a settings validator and an admin form read
4
+ * one closed set through one function. It resolves nothing, reads no environment and holds no state.
5
+ * Zero dependencies: no builtin, no import, so the same file runs in Node and in a browser.
6
+ */
7
+ /** The closed set of kinds. A value whose `kind` is not in it is refused, never guessed at. */
8
+ export declare const CREDENTIAL_REF_KINDS: readonly ["env", "vault", "handle", "assertion"];
9
+ export type CredentialRefKind = (typeof CREDENTIAL_REF_KINDS)[number];
10
+ /**
11
+ * A reference, by kind. `env` names variables of the resolver's environment (header name → variable name for an http
12
+ * peer, child variable → variable name for a stdio peer; the maps have no prototype); `vault` names a stored entry;
13
+ * `handle` is an opaque id the deployment minted; `assertion` names the audience a short-lived assertion is requested for.
14
+ */
15
+ export type CredentialRef = {
16
+ readonly kind: "env";
17
+ readonly headers?: Readonly<Record<string, string>>;
18
+ readonly env?: Readonly<Record<string, string>>;
19
+ } | {
20
+ readonly kind: "vault";
21
+ readonly entry: string;
22
+ } | {
23
+ readonly kind: "handle";
24
+ readonly id: string;
25
+ } | {
26
+ readonly kind: "assertion";
27
+ readonly audience: string;
28
+ };
29
+ /** What an acceptance gate may do with a reference that arrives on the request surface (the deployment may write any kind). */
30
+ export type CredentialRefRequestAdmission = "refused" | "own_entry";
31
+ type TrustRow = {
32
+ readonly request: CredentialRefRequestAdmission;
33
+ };
34
+ /**
35
+ * Where each kind may come from. `refused`: a request surface may not carry it (an environment name would read any
36
+ * variable of the resolver's process, a handle names someone else's credential, an assertion is minted by the deployment);
37
+ * `own_entry`: only for an entry that belongs to the submitting principal. A row per kind and nothing else (no prototype);
38
+ * look a kind up only after `readCredentialRef` accepted the value. A shape for a gate to read; it authenticates nothing.
39
+ */
40
+ export declare const CREDENTIAL_REF_TRUST: Readonly<Record<CredentialRefKind, TrustRow>>;
41
+ /** The longest text member (entry, id, audience, header name, variable name) a reference may carry, in UTF-16 code units. */
42
+ export declare const CREDENTIAL_REF_TEXT_MAX = 2048;
43
+ /** The most entries one name map (`headers`, `env`) of an `env` reference may hold. */
44
+ export declare const CREDENTIAL_REF_MAP_MAX = 64;
45
+ /** Why a value is not a reference; each reason is its own exit. */
46
+ export declare const CREDENTIAL_REF_PROBLEM_REASONS: readonly ["not_a_record", "unknown_kind", "missing_field", "extra_field", "bad_value"];
47
+ export type CredentialRefProblemReason = (typeof CREDENTIAL_REF_PROBLEM_REASONS)[number];
48
+ /**
49
+ * The first fault found, in this order: not an ordinary record; `kind` missing, not text or outside the set; a member the
50
+ * kind does not have; a member it needs (for `env`, one of `headers` and `env`, written `headers|env`); a member of the
51
+ * wrong form. A `kind` or `field` read off the caller's value is untrusted text, cut to 64 characters with unsafe
52
+ * characters replaced; fence it before rendering it where markup is interpreted.
53
+ */
54
+ export type CredentialRefProblem = {
55
+ readonly reason: "not_a_record";
56
+ } | {
57
+ readonly reason: "unknown_kind";
58
+ readonly kind: string;
59
+ } | {
60
+ readonly reason: "missing_field";
61
+ readonly kind?: CredentialRefKind;
62
+ readonly field: string;
63
+ } | {
64
+ readonly reason: "extra_field";
65
+ readonly kind: CredentialRefKind;
66
+ readonly field: string;
67
+ } | {
68
+ readonly reason: "bad_value";
69
+ readonly kind?: CredentialRefKind;
70
+ readonly field: string;
71
+ };
72
+ export type CredentialRefReading = {
73
+ readonly ok: true;
74
+ readonly ref: CredentialRef;
75
+ } | {
76
+ readonly ok: false;
77
+ readonly problem: CredentialRefProblem;
78
+ };
79
+ /**
80
+ * The one reader of a credential reference: a fresh frozen copy that the caller's later writes cannot reach (forward the
81
+ * copy, never the value read), or the first problem. Nothing inside it throws: a value whose members cannot be read (a
82
+ * revoked or throwing Proxy) is `not_a_record`, or the `bad_value` of the map that holds it. A getter is refused and never
83
+ * called, no prototype is read for a member, and a Proxy's own traps (on the value, its maps or its prototype) are the
84
+ * caller's code and run as for any property read. Text is compared as written: nothing is normalised, and visually
85
+ * confusable text is not judged. With no stack left a valid value may be refused (any reason), never an invalid one
86
+ * accepted, and the call itself may throw a `RangeError` before it is entered.
87
+ */
88
+ export declare function readCredentialRef(value: unknown): CredentialRefReading;
89
+ export {};
@@ -0,0 +1,125 @@
1
+ export const CREDENTIAL_REF_KINDS = Object.freeze(["env", "vault", "handle", "assertion"]);
2
+ export const CREDENTIAL_REF_TRUST = trustTable();
3
+ function trustTable() {
4
+ const rows = Object.create(null);
5
+ rows.env = Object.freeze({ request: "refused" });
6
+ rows.vault = Object.freeze({ request: "own_entry" });
7
+ rows.handle = Object.freeze({ request: "refused" });
8
+ rows.assertion = Object.freeze({ request: "refused" });
9
+ return Object.freeze(rows);
10
+ }
11
+ export const CREDENTIAL_REF_TEXT_MAX = 2048;
12
+ export const CREDENTIAL_REF_MAP_MAX = 64;
13
+ export const CREDENTIAL_REF_PROBLEM_REASONS = Object.freeze(["not_a_record", "unknown_kind", "missing_field", "extra_field", "bad_value"]);
14
+ const MEMBERS = {
15
+ env: ["headers", "env"],
16
+ vault: ["entry"],
17
+ handle: ["id"],
18
+ assertion: ["audience"],
19
+ };
20
+ const TEXT_MEMBER = { vault: "entry", handle: "id", assertion: "audience" };
21
+ const HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
22
+ const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
23
+ const ECHO_MAX = 64;
24
+ const UNSAFE = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{DI}\p{NChar}\p{Co}\ud800-\udfff]/u;
25
+ const UNSAFE_ALL = new RegExp(UNSAFE.source, "gu");
26
+ const ABSENT = Object.freeze({ found: "absent" });
27
+ const ACCESSOR = Object.freeze({ found: "accessor" });
28
+ const NOT_A_RECORD = Object.freeze({ ok: false, problem: Object.freeze({ reason: "not_a_record" }) });
29
+ function isRecord(value) {
30
+ if (typeof value !== "object" || value === null || Array.isArray(value))
31
+ return false;
32
+ const proto = Object.getPrototypeOf(value);
33
+ return proto === null || Object.getPrototypeOf(proto) === null;
34
+ }
35
+ function member(record, key) {
36
+ const descriptor = Object.getOwnPropertyDescriptor(record, key);
37
+ if (descriptor === undefined || descriptor.enumerable !== true)
38
+ return ABSENT;
39
+ return Object.hasOwn(descriptor, "value") ? { found: "value", value: descriptor.value } : ACCESSOR;
40
+ }
41
+ const echo = (text) => text.slice(0, ECHO_MAX).replace(UNSAFE_ALL, "?");
42
+ const refused = (problem) => Object.freeze({ ok: false, problem: Object.freeze(problem) });
43
+ const accepted = (ref) => Object.freeze({ ok: true, ref });
44
+ const isText = (value) => typeof value === "string" && value.length > 0 && value.length <= CREDENTIAL_REF_TEXT_MAX && !UNSAFE.test(value) && value === value.trim();
45
+ const isName = (value, form) => value.length <= CREDENTIAL_REF_TEXT_MAX && form.test(value);
46
+ function nameMap(value, keyForm, foldCase) {
47
+ try {
48
+ if (!isRecord(value))
49
+ return undefined;
50
+ const names = Object.keys(value);
51
+ if (names.length === 0 || names.length > CREDENTIAL_REF_MAP_MAX)
52
+ return undefined;
53
+ const out = Object.create(null);
54
+ const folded = new Set();
55
+ for (const name of names) {
56
+ const found = member(value, name);
57
+ if (found.found !== "value" || typeof found.value !== "string")
58
+ return undefined;
59
+ if (!isName(name, keyForm) || !isName(found.value, ENV_NAME))
60
+ return undefined;
61
+ if (foldCase) {
62
+ const key = name.toLowerCase();
63
+ if (folded.has(key))
64
+ return undefined;
65
+ folded.add(key);
66
+ }
67
+ out[name] = found.value;
68
+ }
69
+ return Object.freeze(out);
70
+ }
71
+ catch {
72
+ return undefined;
73
+ }
74
+ }
75
+ const mapOf = (found, keyForm, foldCase) => (found.found === "value" ? nameMap(found.value, keyForm, foldCase) : undefined);
76
+ function envRef(record) {
77
+ const given = { headers: member(record, "headers"), env: member(record, "env") };
78
+ if (given.headers.found === "absent" && given.env.found === "absent")
79
+ return refused({ reason: "missing_field", kind: "env", field: "headers|env" });
80
+ const headers = mapOf(given.headers, HEADER_NAME, true);
81
+ if (given.headers.found !== "absent" && headers === undefined)
82
+ return refused({ reason: "bad_value", kind: "env", field: "headers" });
83
+ const env = mapOf(given.env, ENV_NAME, false);
84
+ if (given.env.found !== "absent" && env === undefined)
85
+ return refused({ reason: "bad_value", kind: "env", field: "env" });
86
+ return accepted(Object.freeze({ kind: "env", ...(headers === undefined ? {} : { headers }), ...(env === undefined ? {} : { env }) }));
87
+ }
88
+ function read(value) {
89
+ if (!isRecord(value))
90
+ return NOT_A_RECORD;
91
+ const named = member(value, "kind");
92
+ if (named.found === "absent")
93
+ return refused({ reason: "missing_field", field: "kind" });
94
+ if (named.found !== "value" || typeof named.value !== "string")
95
+ return refused({ reason: "bad_value", field: "kind" });
96
+ const text = named.value;
97
+ const kind = CREDENTIAL_REF_KINDS.find((k) => k === text);
98
+ if (kind === undefined)
99
+ return refused({ reason: "unknown_kind", kind: echo(text) });
100
+ for (const key of Object.keys(value)) {
101
+ if (key !== "kind" && !MEMBERS[kind].includes(key))
102
+ return refused({ reason: "extra_field", kind, field: echo(key) });
103
+ }
104
+ if (kind === "env")
105
+ return envRef(value);
106
+ const field = TEXT_MEMBER[kind];
107
+ const found = member(value, field);
108
+ if (found.found === "absent")
109
+ return refused({ reason: "missing_field", kind, field });
110
+ if (found.found !== "value" || !isText(found.value))
111
+ return refused({ reason: "bad_value", kind, field });
112
+ if (kind === "vault")
113
+ return accepted(Object.freeze({ kind, entry: found.value }));
114
+ if (kind === "handle")
115
+ return accepted(Object.freeze({ kind, id: found.value }));
116
+ return accepted(Object.freeze({ kind, audience: found.value }));
117
+ }
118
+ export function readCredentialRef(value) {
119
+ try {
120
+ return read(value);
121
+ }
122
+ catch {
123
+ return NOT_A_RECORD;
124
+ }
125
+ }
@@ -0,0 +1,2 @@
1
+ /** The package entry of `@sema-agent/primitives`; core reads the same modules directly. */
2
+ export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, type CredentialRef, type CredentialRefKind, type CredentialRefRequestAdmission, type CredentialRefProblem, type CredentialRefProblemReason, type CredentialRefReading, } from "./credential-ref.js";
@@ -0,0 +1 @@
1
+ export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, } from "./credential-ref.js";
@@ -1,4 +1,4 @@
1
- import { type OverlayOp, type PromptTrait } from "./catalog/schema.js";
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 PromptTrait[];
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: PROMPT_TRAITS.filter((t) => traits.has(t)),
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 (!isWordOf(PROMPT_TRAITS, tr))
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 — the reference's capability names, spelled
49
- * as the reference spells them, so an anchor upgrade can be diffed mechanically. The producer
50
- * ({@link import("../select.js").promptTraitsOf}) yields exactly these two today; a name joins this set when a
51
- * producer can yield it, never before.
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 PromptTrait[];
64
- readonly noneOf?: readonly PromptTrait[];
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. A binding is a
95
- * deployment's own vocabulary (scenario names the engine cannot know), so no catalog variant can name one — the type
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", "model-guidance", "mcp-instructions", "reminder-mark", "environment", "memory"];
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(["lean_prompt", "fable_5_mitigations"]);
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", "model-guidance", "mcp-instructions", "reminder-mark", "environment", "memory"]);
60
+ export const RENDERER_IDS = Object.freeze(["role-base", "mcp-instructions", "reminder-mark", "environment", "memory"]);