@bastani/atomic 0.9.11-alpha.6 → 0.9.11-alpha.8

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 (452) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +3 -5
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/mcp/sampling-handler.ts +1 -5
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +1 -0
  9. package/dist/builtin/workflows/README.md +1 -1
  10. package/dist/builtin/workflows/package.json +1 -1
  11. package/dist/builtin/workflows/skills/impeccable/SKILL.md +33 -129
  12. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +11 -3
  13. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +26 -0
  14. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +35 -0
  15. package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
  16. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +72 -189
  17. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +10 -9
  18. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
  19. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +19 -108
  20. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +59 -253
  21. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +51 -222
  22. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +45 -0
  23. package/dist/builtin/workflows/skills/impeccable/reference/craft.md +3 -121
  24. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +28 -20
  25. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +97 -0
  26. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +23 -0
  27. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +32 -0
  28. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
  29. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +47 -279
  30. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  31. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +53 -0
  32. package/dist/builtin/workflows/skills/impeccable/reference/document.md +60 -73
  33. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -12
  34. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +17 -4
  35. package/dist/builtin/workflows/skills/impeccable/reference/init.md +64 -163
  36. package/dist/builtin/workflows/skills/impeccable/reference/ios.md +1 -1
  37. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +52 -153
  38. package/dist/builtin/workflows/skills/impeccable/reference/live.md +44 -32
  39. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +105 -0
  40. package/dist/builtin/workflows/skills/impeccable/reference/{product.md → operate.md} +6 -5
  41. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +4 -4
  42. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -4
  43. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +68 -212
  44. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
  45. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +18 -0
  46. package/dist/builtin/workflows/skills/impeccable/reference/shape.md +38 -144
  47. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +48 -269
  48. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +38 -0
  49. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +1 -1
  50. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +584 -0
  51. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +117 -9
  52. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +486 -59
  53. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +16 -45
  54. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
  55. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +143 -26
  56. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +181 -12
  57. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +3187 -182
  58. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
  59. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +282 -70
  60. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +183 -15
  61. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +22 -7
  62. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +7 -1
  63. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +16 -2
  64. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +155 -42
  65. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2988 -155
  66. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +11 -0
  67. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +336 -0
  68. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +232 -0
  69. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +90 -10
  70. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +410 -78
  71. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +25 -8
  72. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +93 -0
  73. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +165 -0
  74. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +329 -0
  75. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +20 -5
  76. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +16 -8
  77. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +1 -0
  78. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +455 -0
  79. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +169 -0
  80. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +457 -0
  81. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +151 -0
  82. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +33 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +146 -0
  84. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +10 -1
  85. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +15 -0
  86. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +149 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +14 -0
  88. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +109 -32
  89. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +105 -0
  90. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +105 -0
  91. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +8 -6
  92. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
  93. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +208 -68
  94. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +563 -112
  95. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
  96. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +198 -13
  97. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +24 -6
  98. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
  99. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +44 -14
  100. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +398 -33
  101. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +9 -5
  102. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +81 -67
  103. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +7 -2
  104. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +76 -81
  105. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +2 -2
  106. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +890 -0
  107. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +74 -0
  108. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +1 -24
  109. package/dist/builtin/workflows/src/extension/index.bundle.mjs +232 -50
  110. package/dist/builtin/workflows/src/extension/workflow-model-catalog.ts +26 -0
  111. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -2
  112. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +23 -9
  113. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
  114. package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +20 -5
  115. package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +10 -0
  116. package/dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts +86 -0
  117. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +6 -2
  118. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +24 -18
  119. package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +8 -0
  120. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +3 -3
  121. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +2 -2
  122. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +16 -0
  123. package/dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts +121 -0
  124. package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +42 -0
  125. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +16 -0
  126. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +4 -0
  127. package/dist/cli/list-models.d.ts +2 -2
  128. package/dist/cli/list-models.d.ts.map +1 -1
  129. package/dist/cli/list-models.js +5 -5
  130. package/dist/cli/list-models.js.map +1 -1
  131. package/dist/core/agent-session-accessors.js +1 -1
  132. package/dist/core/agent-session-accessors.js.map +1 -1
  133. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  134. package/dist/core/agent-session-auto-compaction.js +2 -5
  135. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  136. package/dist/core/agent-session-compaction.js +1 -1
  137. package/dist/core/agent-session-compaction.js.map +1 -1
  138. package/dist/core/agent-session-extension-bindings.js +5 -5
  139. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  140. package/dist/core/agent-session-methods.d.ts +4 -4
  141. package/dist/core/agent-session-methods.d.ts.map +1 -1
  142. package/dist/core/agent-session-methods.js.map +1 -1
  143. package/dist/core/agent-session-models.d.ts +1 -1
  144. package/dist/core/agent-session-models.d.ts.map +1 -1
  145. package/dist/core/agent-session-models.js +18 -14
  146. package/dist/core/agent-session-models.js.map +1 -1
  147. package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
  148. package/dist/core/agent-session-post-tool-compaction.js +2 -4
  149. package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
  150. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  151. package/dist/core/agent-session-prompt.js +3 -7
  152. package/dist/core/agent-session-prompt.js.map +1 -1
  153. package/dist/core/agent-session-retry.js +1 -1
  154. package/dist/core/agent-session-retry.js.map +1 -1
  155. package/dist/core/agent-session-runtime-auth.d.ts +3 -3
  156. package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
  157. package/dist/core/agent-session-runtime-auth.js +4 -14
  158. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  159. package/dist/core/agent-session-runtime.d.ts +1 -1
  160. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  161. package/dist/core/agent-session-runtime.js +3 -3
  162. package/dist/core/agent-session-runtime.js.map +1 -1
  163. package/dist/core/agent-session-services.d.ts +3 -8
  164. package/dist/core/agent-session-services.d.ts.map +1 -1
  165. package/dist/core/agent-session-services.js +16 -23
  166. package/dist/core/agent-session-services.js.map +1 -1
  167. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  168. package/dist/core/agent-session-tool-registry.js +2 -1
  169. package/dist/core/agent-session-tool-registry.js.map +1 -1
  170. package/dist/core/agent-session-types.d.ts +2 -2
  171. package/dist/core/agent-session-types.d.ts.map +1 -1
  172. package/dist/core/agent-session-types.js.map +1 -1
  173. package/dist/core/agent-session.d.ts +2 -2
  174. package/dist/core/agent-session.d.ts.map +1 -1
  175. package/dist/core/agent-session.js +1 -1
  176. package/dist/core/agent-session.js.map +1 -1
  177. package/dist/core/auth-storage-backends.d.ts +1 -0
  178. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  179. package/dist/core/auth-storage-backends.js +18 -4
  180. package/dist/core/auth-storage-backends.js.map +1 -1
  181. package/dist/core/auth-storage.d.ts +12 -139
  182. package/dist/core/auth-storage.d.ts.map +1 -1
  183. package/dist/core/auth-storage.js +68 -374
  184. package/dist/core/auth-storage.js.map +1 -1
  185. package/dist/core/copilot-env-routing.d.ts +36 -0
  186. package/dist/core/copilot-env-routing.d.ts.map +1 -0
  187. package/dist/core/copilot-env-routing.js +94 -0
  188. package/dist/core/copilot-env-routing.js.map +1 -0
  189. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  190. package/dist/core/extensions/loader-virtual-modules.js +10 -2
  191. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  192. package/dist/core/extensions/provider-types.d.ts +0 -40
  193. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  194. package/dist/core/extensions/provider-types.js.map +1 -1
  195. package/dist/core/fallback-models.d.ts +4 -4
  196. package/dist/core/fallback-models.d.ts.map +1 -1
  197. package/dist/core/fallback-models.js +3 -3
  198. package/dist/core/fallback-models.js.map +1 -1
  199. package/dist/core/model-config.d.ts +542 -0
  200. package/dist/core/model-config.d.ts.map +1 -0
  201. package/dist/core/{model-registry-schemas.js → model-config.js} +85 -34
  202. package/dist/core/model-config.js.map +1 -0
  203. package/dist/core/model-registry.d.ts +25 -85
  204. package/dist/core/model-registry.d.ts.map +1 -1
  205. package/dist/core/model-registry.js +65 -388
  206. package/dist/core/model-registry.js.map +1 -1
  207. package/dist/core/model-resolver-cli.d.ts +2 -2
  208. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  209. package/dist/core/model-resolver-cli.js +2 -2
  210. package/dist/core/model-resolver-cli.js.map +1 -1
  211. package/dist/core/model-resolver-initial.d.ts +4 -4
  212. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  213. package/dist/core/model-resolver-initial.js +17 -17
  214. package/dist/core/model-resolver-initial.js.map +1 -1
  215. package/dist/core/model-resolver-scope.d.ts +3 -3
  216. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  217. package/dist/core/model-resolver-scope.js +4 -4
  218. package/dist/core/model-resolver-scope.js.map +1 -1
  219. package/dist/core/model-runtime-auth.d.ts +7 -0
  220. package/dist/core/model-runtime-auth.d.ts.map +1 -0
  221. package/dist/core/model-runtime-auth.js +14 -0
  222. package/dist/core/model-runtime-auth.js.map +1 -0
  223. package/dist/core/model-runtime-providers.d.ts +6 -0
  224. package/dist/core/model-runtime-providers.d.ts.map +1 -0
  225. package/dist/core/model-runtime-providers.js +22 -0
  226. package/dist/core/model-runtime-providers.js.map +1 -0
  227. package/dist/core/model-runtime-restoration.d.ts +6 -0
  228. package/dist/core/model-runtime-restoration.d.ts.map +1 -0
  229. package/dist/core/model-runtime-restoration.js +21 -0
  230. package/dist/core/model-runtime-restoration.js.map +1 -0
  231. package/dist/core/model-runtime-snapshot.d.ts +16 -0
  232. package/dist/core/model-runtime-snapshot.d.ts.map +1 -0
  233. package/dist/core/model-runtime-snapshot.js +52 -0
  234. package/dist/core/model-runtime-snapshot.js.map +1 -0
  235. package/dist/core/model-runtime-streaming.d.ts +17 -0
  236. package/dist/core/model-runtime-streaming.d.ts.map +1 -0
  237. package/dist/core/model-runtime-streaming.js +66 -0
  238. package/dist/core/model-runtime-streaming.js.map +1 -0
  239. package/dist/core/model-runtime-types.d.ts +21 -0
  240. package/dist/core/model-runtime-types.d.ts.map +1 -0
  241. package/dist/core/model-runtime-types.js +2 -0
  242. package/dist/core/model-runtime-types.js.map +1 -0
  243. package/dist/core/model-runtime.d.ts +50 -29
  244. package/dist/core/model-runtime.d.ts.map +1 -1
  245. package/dist/core/model-runtime.js +330 -90
  246. package/dist/core/model-runtime.js.map +1 -1
  247. package/dist/core/models-store.d.ts +2 -10
  248. package/dist/core/models-store.d.ts.map +1 -1
  249. package/dist/core/models-store.js +2 -29
  250. package/dist/core/models-store.js.map +1 -1
  251. package/dist/core/oauth-login.d.ts +24 -0
  252. package/dist/core/oauth-login.d.ts.map +1 -0
  253. package/dist/core/oauth-login.js +87 -0
  254. package/dist/core/oauth-login.js.map +1 -0
  255. package/dist/core/oauth-provider-metadata.d.ts +5 -0
  256. package/dist/core/oauth-provider-metadata.d.ts.map +1 -0
  257. package/dist/core/oauth-provider-metadata.js +19 -0
  258. package/dist/core/oauth-provider-metadata.js.map +1 -0
  259. package/dist/core/provider-composer-internal.d.ts +53 -0
  260. package/dist/core/provider-composer-internal.d.ts.map +1 -0
  261. package/dist/core/provider-composer-internal.js +273 -0
  262. package/dist/core/provider-composer-internal.js.map +1 -0
  263. package/dist/core/provider-composer.d.ts +16 -0
  264. package/dist/core/provider-composer.d.ts.map +1 -0
  265. package/dist/core/provider-composer.js +108 -0
  266. package/dist/core/provider-composer.js.map +1 -0
  267. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  268. package/dist/core/remote-catalog-provider.js +74 -122
  269. package/dist/core/remote-catalog-provider.js.map +1 -1
  270. package/dist/core/resolve-config-value.d.ts +8 -7
  271. package/dist/core/resolve-config-value.d.ts.map +1 -1
  272. package/dist/core/resolve-config-value.js +26 -23
  273. package/dist/core/resolve-config-value.js.map +1 -1
  274. package/dist/core/runtime-credentials.d.ts +16 -0
  275. package/dist/core/runtime-credentials.d.ts.map +1 -0
  276. package/dist/core/runtime-credentials.js +42 -0
  277. package/dist/core/runtime-credentials.js.map +1 -0
  278. package/dist/core/sdk-types.d.ts +1 -7
  279. package/dist/core/sdk-types.d.ts.map +1 -1
  280. package/dist/core/sdk-types.js.map +1 -1
  281. package/dist/core/sdk.d.ts.map +1 -1
  282. package/dist/core/sdk.js +27 -28
  283. package/dist/core/sdk.js.map +1 -1
  284. package/dist/extensions/llama/index.js +1 -1
  285. package/dist/extensions/llama/index.js.map +1 -1
  286. package/dist/extensions/llama/provider.d.ts +2 -4
  287. package/dist/extensions/llama/provider.d.ts.map +1 -1
  288. package/dist/extensions/llama/provider.js +25 -17
  289. package/dist/extensions/llama/provider.js.map +1 -1
  290. package/dist/index.d.ts +2 -3
  291. package/dist/index.d.ts.map +1 -1
  292. package/dist/index.js +3 -4
  293. package/dist/index.js.map +1 -1
  294. package/dist/main-runtime-api-key.d.ts +6 -0
  295. package/dist/main-runtime-api-key.d.ts.map +1 -0
  296. package/dist/main-runtime-api-key.js +6 -0
  297. package/dist/main-runtime-api-key.js.map +1 -0
  298. package/dist/main-session-options.d.ts +2 -2
  299. package/dist/main-session-options.d.ts.map +1 -1
  300. package/dist/main-session-options.js +3 -3
  301. package/dist/main-session-options.js.map +1 -1
  302. package/dist/main.d.ts.map +1 -1
  303. package/dist/main.js +9 -11
  304. package/dist/main.js.map +1 -1
  305. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  306. package/dist/modes/interactive/components/chat-session-host-actions.js +2 -14
  307. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  308. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  309. package/dist/modes/interactive/components/chat-session-host-events.js +9 -0
  310. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  311. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +25 -0
  312. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/chat-session-host-runtime.js +53 -0
  314. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  315. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -0
  316. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  317. package/dist/modes/interactive/components/chat-session-host.js +22 -1
  318. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  319. package/dist/modes/interactive/components/footer.js +1 -1
  320. package/dist/modes/interactive/components/footer.js.map +1 -1
  321. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  322. package/dist/modes/interactive/components/login-dialog.js +1 -3
  323. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  324. package/dist/modes/interactive/components/model-selector.d.ts +4 -3
  325. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/model-selector.js +56 -73
  327. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  328. package/dist/modes/interactive/components/oauth-selector.d.ts +4 -3
  329. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  330. package/dist/modes/interactive/components/oauth-selector.js +15 -24
  331. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  332. package/dist/modes/interactive/interactive-agent-events.js +10 -4
  333. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  334. package/dist/modes/interactive/interactive-auth-login.js +20 -31
  335. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  336. package/dist/modes/interactive/interactive-auth-routing.d.ts +1 -1
  337. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
  338. package/dist/modes/interactive/interactive-auth-routing.js +21 -47
  339. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  340. package/dist/modes/interactive/interactive-autocomplete.js +3 -3
  341. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  342. package/dist/modes/interactive/interactive-deferred-startup.js +8 -8
  343. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  344. package/dist/modes/interactive/interactive-extension-runtime.js +2 -1
  345. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  346. package/dist/modes/interactive/interactive-model-catalog-startup.js +2 -2
  347. package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
  348. package/dist/modes/interactive/interactive-model-routing.js +11 -11
  349. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  350. package/dist/modes/interactive/interactive-render-chat.js +1 -1
  351. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  352. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  353. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  354. package/dist/modes/interactive/interactive-startup.js +1 -1
  355. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  356. package/dist/modes/interactive-engine/isolated-auth.d.ts +2 -2
  357. package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
  358. package/dist/modes/interactive-engine/isolated-auth.js +4 -3
  359. package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
  360. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  361. package/dist/modes/interactive-engine/isolated-runtime.js +4 -3
  362. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  363. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +0 -1
  364. package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
  365. package/dist/modes/interactive-engine/remote-model-catalog.js +11 -50
  366. package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
  367. package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
  368. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  369. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  370. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  371. package/dist/modes/rpc/rpc-command-handler.js +26 -19
  372. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  373. package/dist/modes/rpc/rpc-oauth-client.d.ts +1 -1
  374. package/dist/modes/rpc/rpc-oauth-client.d.ts.map +1 -1
  375. package/dist/modes/rpc/rpc-oauth-client.js +1 -1
  376. package/dist/modes/rpc/rpc-oauth-client.js.map +1 -1
  377. package/dist/modes/rpc/rpc-oauth-interaction.d.ts +1 -1
  378. package/dist/modes/rpc/rpc-oauth-interaction.d.ts.map +1 -1
  379. package/dist/modes/rpc/rpc-oauth-interaction.js +1 -1
  380. package/dist/modes/rpc/rpc-oauth-interaction.js.map +1 -1
  381. package/dist/modes/rpc/rpc-provider-auth.d.ts +4 -5
  382. package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
  383. package/dist/modes/rpc/rpc-provider-auth.js +19 -66
  384. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  385. package/dist/modes/rpc/rpc-session-binding.js +1 -1
  386. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  387. package/dist/modes/rpc/rpc-types.d.ts +7 -4
  388. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  389. package/dist/modes/rpc/rpc-types.js.map +1 -1
  390. package/dist/package-manager-cli.d.ts.map +1 -1
  391. package/dist/package-manager-cli.js +5 -7
  392. package/dist/package-manager-cli.js.map +1 -1
  393. package/docs/changelog.mdx +1 -1
  394. package/docs/custom-provider.md +1 -1
  395. package/docs/models.md +4 -6
  396. package/docs/providers.md +13 -0
  397. package/docs/quickstart.md +2 -1
  398. package/docs/sdk.md +32 -49
  399. package/docs/tui.md +7 -2
  400. package/docs/workflows.md +4 -4
  401. package/examples/sdk/02-custom-model.ts +8 -10
  402. package/examples/sdk/09-api-keys-and-oauth.ts +17 -23
  403. package/examples/sdk/12-full-control.ts +9 -11
  404. package/examples/sdk/README.md +17 -21
  405. package/npm-shrinkwrap.json +23 -23
  406. package/package.json +2 -2
  407. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +0 -108
  408. package/dist/builtin/workflows/skills/impeccable/reference/codex.md +0 -105
  409. package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -189
  410. package/dist/core/model-registry-auth.d.ts +0 -10
  411. package/dist/core/model-registry-auth.d.ts.map +0 -1
  412. package/dist/core/model-registry-auth.js +0 -98
  413. package/dist/core/model-registry-auth.js.map +0 -1
  414. package/dist/core/model-registry-builtins.d.ts +0 -8
  415. package/dist/core/model-registry-builtins.d.ts.map +0 -1
  416. package/dist/core/model-registry-builtins.js +0 -104
  417. package/dist/core/model-registry-builtins.js.map +0 -1
  418. package/dist/core/model-registry-custom-loader.d.ts +0 -3
  419. package/dist/core/model-registry-custom-loader.d.ts.map +0 -1
  420. package/dist/core/model-registry-custom-loader.js +0 -255
  421. package/dist/core/model-registry-custom-loader.js.map +0 -1
  422. package/dist/core/model-registry-dynamic.d.ts +0 -7
  423. package/dist/core/model-registry-dynamic.d.ts.map +0 -1
  424. package/dist/core/model-registry-dynamic.js +0 -189
  425. package/dist/core/model-registry-dynamic.js.map +0 -1
  426. package/dist/core/model-registry-extension-refresh.d.ts +0 -23
  427. package/dist/core/model-registry-extension-refresh.d.ts.map +0 -1
  428. package/dist/core/model-registry-extension-refresh.js +0 -32
  429. package/dist/core/model-registry-extension-refresh.js.map +0 -1
  430. package/dist/core/model-registry-loader.d.ts +0 -5
  431. package/dist/core/model-registry-loader.d.ts.map +0 -1
  432. package/dist/core/model-registry-loader.js +0 -29
  433. package/dist/core/model-registry-loader.js.map +0 -1
  434. package/dist/core/model-registry-schemas.d.ts +0 -1399
  435. package/dist/core/model-registry-schemas.d.ts.map +0 -1
  436. package/dist/core/model-registry-schemas.js.map +0 -1
  437. package/dist/core/model-registry-types.d.ts +0 -91
  438. package/dist/core/model-registry-types.d.ts.map +0 -1
  439. package/dist/core/model-registry-types.js +0 -2
  440. package/dist/core/model-registry-types.js.map +0 -1
  441. package/dist/core/model-registry-validation.d.ts +0 -7
  442. package/dist/core/model-registry-validation.d.ts.map +0 -1
  443. package/dist/core/model-registry-validation.js +0 -12
  444. package/dist/core/model-registry-validation.js.map +0 -1
  445. package/dist/core/oauth-compat.d.ts +0 -17
  446. package/dist/core/oauth-compat.d.ts.map +0 -1
  447. package/dist/core/oauth-compat.js +0 -2
  448. package/dist/core/oauth-compat.js.map +0 -1
  449. package/dist/core/oauth-provider-bridge.d.ts +0 -63
  450. package/dist/core/oauth-provider-bridge.d.ts.map +0 -1
  451. package/dist/core/oauth-provider-bridge.js +0 -232
  452. package/dist/core/oauth-provider-bridge.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath, pathToFileURL } from 'node:url';
5
+ import { resolveProjectRoot } from './context.mjs';
6
+ import {
7
+ listSurfaceBriefs,
8
+ resolveSurfaceBrief,
9
+ surfaceBriefPathForTarget,
10
+ writeSurfaceBrief,
11
+ } from './lib/surface-briefs.mjs';
12
+
13
+ function summary(brief, projectRoot) {
14
+ return {
15
+ slug: brief.slug,
16
+ path: path.relative(projectRoot, brief.path).split(path.sep).join('/'),
17
+ primaryTarget: brief.primaryTarget,
18
+ relatedTargets: brief.relatedTargets,
19
+ };
20
+ }
21
+
22
+ function main(argv) {
23
+ const [command, target, bodyFile, ...relatedTargets] = argv;
24
+ const projectRoot = resolveProjectRoot(process.cwd(), target ? { targetPath: target } : {});
25
+ if (command === 'path') {
26
+ const filePath = surfaceBriefPathForTarget(target, { projectRoot });
27
+ if (!filePath) throw new Error('surface brief path requires a concrete target');
28
+ process.stdout.write(`${path.relative(process.cwd(), filePath) || filePath}\n`);
29
+ return;
30
+ }
31
+ if (command === 'list') {
32
+ process.stdout.write(`${JSON.stringify(listSurfaceBriefs(projectRoot).map((brief) => summary(brief, projectRoot)), null, 2)}\n`);
33
+ return;
34
+ }
35
+ if (command === 'read') {
36
+ const result = resolveSurfaceBrief(projectRoot, target || null);
37
+ if (result.brief) {
38
+ process.stdout.write(result.brief.text);
39
+ return;
40
+ }
41
+ if (result.candidates.length) process.stderr.write(`${JSON.stringify(result.candidates.map((brief) => summary(brief, projectRoot)), null, 2)}\n`);
42
+ process.exit(2);
43
+ }
44
+ if (command === 'write') {
45
+ if (!target || !bodyFile) throw new Error('usage: surface-brief.mjs write <primary-target> <body-file>');
46
+ const filePath = writeSurfaceBrief({
47
+ projectRoot,
48
+ primaryTarget: target,
49
+ relatedTargets,
50
+ body: fs.readFileSync(bodyFile, 'utf-8'),
51
+ });
52
+ process.stdout.write(`${path.relative(process.cwd(), filePath) || filePath}\n`);
53
+ return;
54
+ }
55
+ throw new Error('usage: surface-brief.mjs <path|list|read|write> [target] [body-file] [related-target ...]');
56
+ }
57
+
58
+ function isMainModule() {
59
+ if (!process.argv[1]) return false;
60
+ try {
61
+ return fs.realpathSync(fileURLToPath(import.meta.url)) === fs.realpathSync(process.argv[1]);
62
+ } catch {
63
+ return import.meta.url === pathToFileURL(process.argv[1]).href;
64
+ }
65
+ }
66
+
67
+ if (isMainModule()) {
68
+ try {
69
+ main(process.argv.slice(2));
70
+ } catch (error) {
71
+ process.stderr.write(`${error?.message || error}\n`);
72
+ process.exit(1);
73
+ }
74
+ }
@@ -1,12 +1,9 @@
1
- import type { CreateAgentSessionOptions } from "@bastani/atomic";
2
1
  import type { StageAdapters } from "../runs/foreground/stage-runner.js";
3
2
  import type { SessionManager } from "../shared/persistence-restore.js";
4
3
  import type { RunSnapshot } from "../shared/store-types.js";
5
4
  import type {
6
5
  WorkflowExecutionPolicy,
7
6
  WorkflowMcpPort,
8
- WorkflowModelCatalogPort,
9
- WorkflowModelInfo,
10
7
  WorkflowPersistencePort,
11
8
  WorkflowRuntimeConfig,
12
9
  } from "../shared/types.js";
@@ -43,6 +40,7 @@ import {
43
40
  workflowReloadDiagnostics,
44
41
  type WorkflowReloadReport,
45
42
  } from "./workflow-reload-report.js";
43
+ import { workflowModelCatalogFromContext } from "./workflow-model-catalog.js";
46
44
 
47
45
  export interface WorkflowExtensionRuntimeState {
48
46
  persistenceRef: { current: WorkflowPersistencePort | undefined };
@@ -171,27 +169,6 @@ export function createWorkflowExtensionRuntimeState(
171
169
  },
172
170
  };
173
171
 
174
- function workflowModelCatalogFromContext(ctx?: PiModelContext): WorkflowModelCatalogPort | undefined {
175
- if (ctx?.modelRegistry === undefined && ctx?.model === undefined) return undefined;
176
- return {
177
- listModels: async (): Promise<readonly WorkflowModelInfo[]> => {
178
- const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
179
- return available.map((model) => ({
180
- provider: String(model.provider),
181
- id: model.id,
182
- fullId: `${String(model.provider)}/${model.id}`,
183
- model: model as NonNullable<CreateAgentSessionOptions["model"]>,
184
- }));
185
- },
186
- ...(ctx.model !== undefined
187
- ? {
188
- currentModel: ctx.model as NonNullable<CreateAgentSessionOptions["model"]>,
189
- preferredProvider: String(ctx.model.provider),
190
- }
191
- : {}),
192
- };
193
- }
194
-
195
172
  function runtimeForContext(ctx?: PiModelContext): ExtensionRuntime {
196
173
  const models = workflowModelCatalogFromContext(ctx);
197
174
  if (models === undefined) return runtimeProxy;
@@ -41452,16 +41452,95 @@ function isTerminalStageChatState(status) {
41452
41452
  return isTerminalOrNonStreamingStageChatStatus(status);
41453
41453
  }
41454
41454
 
41455
+ // dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts
41456
+ function subscribeStageChatDeliveryActivity(ctx) {
41457
+ const handle = ctx.handle;
41458
+ if (!handle?.subscribeDeliveryActivity)
41459
+ return null;
41460
+ return handle.subscribeDeliveryActivity((event) => {
41461
+ applyStageChatDeliveryActivityEvent(ctx, event);
41462
+ });
41463
+ }
41464
+ function applyStageChatDeliveryActivityEvent(ctx, event) {
41465
+ if (event.type === "delivery_start") {
41466
+ ctx.terminalLifecycleFenced = false;
41467
+ ctx.deliveryLifecycles.set(event.deliveryId, ctx.chatHost.beginExternalPromptLifecycle());
41468
+ return;
41469
+ }
41470
+ if (!ctx.deliveryLifecycles.has(event.deliveryId))
41471
+ return;
41472
+ const generation = ctx.deliveryLifecycles.get(event.deliveryId);
41473
+ ctx.deliveryLifecycles.delete(event.deliveryId);
41474
+ if (!ownsStageChatLifecycleGeneration(ctx, generation)) {
41475
+ ctx.chatHost.settleExternalPromptLifecycle(generation);
41476
+ }
41477
+ if (!hasActiveStageChatDelivery(ctx) && isStageChatContextTerminal(ctx)) {
41478
+ ctx.terminalLifecycleFenced = true;
41479
+ }
41480
+ }
41481
+ function ownsStageChatLifecycleGeneration(ctx, generation) {
41482
+ for (const active of ctx.deliveryLifecycles.values()) {
41483
+ if (active === generation)
41484
+ return true;
41485
+ }
41486
+ return false;
41487
+ }
41488
+ function hasActiveStageChatDelivery(ctx) {
41489
+ return ctx.deliveryLifecycles.size > 0;
41490
+ }
41491
+ function isStageChatContextTerminal(ctx) {
41492
+ return isTerminalStageChatState(ctx.lastObservedRunStatus) || isTerminalStageChatState(ctx.lastObservedStageStatus);
41493
+ }
41494
+ function reconcileStageChatDeliveryLifecycle(ctx) {
41495
+ if (!hasActiveStageChatDelivery(ctx))
41496
+ return;
41497
+ if (ctx.chatHost.isStreaming() && ctx.chatHost.hasAnimationTick())
41498
+ return;
41499
+ const generation = ctx.chatHost.reassertExternalPromptLifecycle();
41500
+ for (const deliveryId of [...ctx.deliveryLifecycles.keys()]) {
41501
+ ctx.deliveryLifecycles.set(deliveryId, generation);
41502
+ }
41503
+ }
41504
+ function invalidateStageChatDeliveryLifecycles(ctx) {
41505
+ ctx.deliveryLifecycles.clear();
41506
+ ctx.terminalLifecycleFenced = true;
41507
+ }
41508
+
41455
41509
  // dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts
41456
41510
  function applyStageChatLiveHandleEvent(ctx, event) {
41511
+ const staleTerminalStart = isStaleTerminalLifecycleStart(ctx, event);
41457
41512
  ctx.chatHost.applyAgentEvent(event);
41513
+ if (staleTerminalStart) {
41514
+ retainTerminalCleanup(ctx);
41515
+ return;
41516
+ }
41517
+ if (isCompactionEndEvent(event))
41518
+ reconcileStageChatDeliveryLifecycle(ctx);
41458
41519
  if (!shouldCleanupAfterLiveEvent(ctx, event))
41459
41520
  return;
41521
+ retainTerminalCleanup(ctx);
41522
+ }
41523
+ function retainTerminalCleanup(ctx) {
41460
41524
  const hadAnimationTick = ctx.chatHost.hasAnimationTick();
41461
41525
  ctx.chatHost.clearBusyForTerminalWorkflowStage();
41462
41526
  if (hadAnimationTick !== ctx.chatHost.hasAnimationTick())
41463
41527
  ctx.requestRender?.();
41464
41528
  }
41529
+ function isStaleTerminalLifecycleStart(ctx, event) {
41530
+ if (!ctx.terminalLifecycleFenced)
41531
+ return false;
41532
+ const type = String(event.type ?? "");
41533
+ if (type !== "agent_start" && type !== "turn_start")
41534
+ return false;
41535
+ if (hasActiveStageChatDelivery(ctx))
41536
+ return false;
41537
+ if (ctx.chatHost.isStreaming())
41538
+ return false;
41539
+ return isCurrentRunOrStageTerminal(ctx);
41540
+ }
41541
+ function isCompactionEndEvent(event) {
41542
+ return String(event.type ?? "") === "compaction_end";
41543
+ }
41465
41544
  function shouldCleanupAfterLiveEvent(ctx, event) {
41466
41545
  if (!isToolExecutionLiveEvent(event))
41467
41546
  return false;
@@ -41550,8 +41629,11 @@ function initializeStageChatView(ctx, opts) {
41550
41629
  ctx.lastObservedStageStatus = undefined;
41551
41630
  ctx.lastObservedRunStatus = undefined;
41552
41631
  ctx.seenNoticeIds = new Set;
41632
+ ctx.deliveryLifecycles = new Map;
41633
+ ctx.terminalLifecycleFenced = false;
41553
41634
  ctx._unsubscribeStore = null;
41554
41635
  ctx._unsubscribeHandle = null;
41636
+ ctx._unsubscribeDeliveryActivity = null;
41555
41637
  ctx._unsubscribeFooterData = null;
41556
41638
  ctx._unregisterStageUiHost = null;
41557
41639
  installFocusHold(ctx);
@@ -41581,6 +41663,7 @@ function initializeStageChatView(ctx, opts) {
41581
41663
  ctx._unsubscribeStore = ctx.store.subscribe(() => handleStoreUpdate(ctx));
41582
41664
  ctx._unsubscribeFooterData = ctx.footerData?.onBranchChange(() => ctx.requestRender?.()) ?? null;
41583
41665
  if (ctx.handle) {
41666
+ ctx._unsubscribeDeliveryActivity = subscribeStageChatDeliveryActivity(ctx);
41584
41667
  ctx._unsubscribeHandle = ctx.handle.subscribe((event) => applyStageChatLiveHandleEvent(ctx, event));
41585
41668
  }
41586
41669
  ctx.chatHost.syncAnimationTick();
@@ -41693,6 +41776,7 @@ function handleStoreUpdate(ctx) {
41693
41776
  }
41694
41777
  if (isTerminalStageChatTransition(ctx.lastObservedStageStatus, currentStageStatus) || isTerminalStageChatTransition(ctx.lastObservedRunStatus, currentRunStatus)) {
41695
41778
  ctx.chatHost.clearBusyForTerminalWorkflowStage();
41779
+ invalidateStageChatDeliveryLifecycles(ctx);
41696
41780
  changed = true;
41697
41781
  }
41698
41782
  ctx.lastObservedRunStatus = currentRunStatus;
@@ -41918,6 +42002,9 @@ function disposeStageChatView(ctx) {
41918
42002
  ctx._unsubscribeStore = null;
41919
42003
  ctx._unsubscribeHandle?.();
41920
42004
  ctx._unsubscribeHandle = null;
42005
+ ctx._unsubscribeDeliveryActivity?.();
42006
+ ctx._unsubscribeDeliveryActivity = null;
42007
+ ctx.deliveryLifecycles.clear();
41921
42008
  ctx._unsubscribeFooterData?.();
41922
42009
  ctx._unsubscribeFooterData = null;
41923
42010
  releaseMountedCustomUi(ctx);
@@ -48440,7 +48527,7 @@ function asAgentSession(activeSession) {
48440
48527
  if (!activeSession)
48441
48528
  return;
48442
48529
  const candidate = activeSession;
48443
- if (candidate.state !== undefined && candidate.sessionManager !== undefined && candidate.modelRegistry !== undefined && typeof candidate.getContextUsage === "function") {
48530
+ if (candidate.state !== undefined && candidate.sessionManager !== undefined && candidate.modelRuntime !== undefined && typeof candidate.getContextUsage === "function") {
48444
48531
  return candidate;
48445
48532
  }
48446
48533
  return;
@@ -48550,8 +48637,8 @@ function buildStageSessionOptions(input) {
48550
48637
  options.context = undefined;
48551
48638
  options.forkFromSessionFile = undefined;
48552
48639
  }
48553
- if (input.sharedModelRegistry !== undefined && options.modelRegistry === undefined) {
48554
- options.modelRegistry = input.sharedModelRegistry;
48640
+ if (input.sharedModelRuntime !== undefined && options.modelRuntime === undefined) {
48641
+ options.modelRuntime = input.sharedModelRuntime;
48555
48642
  }
48556
48643
  return Object.keys(options).length === 0 ? undefined : options;
48557
48644
  }
@@ -48600,7 +48687,7 @@ function coordinatedPromptOwnershipObserver(turn) {
48600
48687
  function unsupportedContentError() {
48601
48688
  return new Error("atomic-workflows: this stage session adapter does not support non-string sendUserMessage content; provide a runtime sendUserMessage implementation for text/image blocks.");
48602
48689
  }
48603
- async function sendStageUserMessage(activeSession, content, options, beforeDelivery, promptStarted, admission) {
48690
+ async function sendStageUserMessage(activeSession, content, options, beforeDelivery, promptStarted, admission, activity) {
48604
48691
  const streaming = activeSession.isStreaming || admission?.isOwned(activeSession) === true;
48605
48692
  const deliverAs = streaming ? options?.deliverAs ?? "followUp" : options?.deliverAs;
48606
48693
  if (activeSession.sendUserMessage !== undefined) {
@@ -48608,6 +48695,7 @@ async function sendStageUserMessage(activeSession, content, options, beforeDeliv
48608
48695
  let reportedAction;
48609
48696
  const ownership2 = streaming ? undefined : admission === undefined ? createLocalPromptOwnershipObserver(activeSession, promptStarted) : coordinatedPromptOwnershipObserver(admission.startTurn(activeSession, promptStarted ?? (() => {})));
48610
48697
  ownership2?.arm();
48698
+ const deliveryId2 = streaming ? undefined : activity?.start();
48611
48699
  try {
48612
48700
  const delivery = activeSession.sendUserMessage(content, {
48613
48701
  ...deliverAs === undefined ? {} : { deliverAs },
@@ -48628,6 +48716,7 @@ async function sendStageUserMessage(activeSession, content, options, beforeDeliv
48628
48716
  throw error;
48629
48717
  } finally {
48630
48718
  ownership2?.dispose();
48719
+ activity?.settle(deliveryId2);
48631
48720
  }
48632
48721
  }
48633
48722
  if (typeof content !== "string")
@@ -48642,6 +48731,7 @@ async function sendStageUserMessage(activeSession, content, options, beforeDeliv
48642
48731
  }
48643
48732
  const ownership = admission === undefined ? createLocalPromptOwnershipObserver(activeSession, promptStarted) : coordinatedPromptOwnershipObserver(admission.startTurn(activeSession, promptStarted ?? (() => {})));
48644
48733
  ownership.arm();
48734
+ const deliveryId = activity?.start();
48645
48735
  try {
48646
48736
  const turn = activeSession.prompt(content);
48647
48737
  ownership.observeStreaming();
@@ -48653,6 +48743,7 @@ async function sendStageUserMessage(activeSession, content, options, beforeDeliv
48653
48743
  throw error;
48654
48744
  } finally {
48655
48745
  ownership.dispose();
48746
+ activity?.settle(deliveryId);
48656
48747
  }
48657
48748
  }
48658
48749
 
@@ -48839,6 +48930,52 @@ class StageMessageAdmission {
48839
48930
  }
48840
48931
  }
48841
48932
 
48933
+ // dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts
48934
+ class StageDeliveryActivity {
48935
+ listeners = new Set;
48936
+ active = new Set;
48937
+ nextDeliveryId = 0;
48938
+ subscribe(listener) {
48939
+ this.listeners.add(listener);
48940
+ for (const deliveryId of [...this.active]) {
48941
+ if (!this.listeners.has(listener))
48942
+ break;
48943
+ listener({ type: "delivery_start", deliveryId });
48944
+ }
48945
+ return () => {
48946
+ this.listeners.delete(listener);
48947
+ };
48948
+ }
48949
+ start() {
48950
+ const deliveryId = ++this.nextDeliveryId;
48951
+ this.active.add(deliveryId);
48952
+ this.emit({ type: "delivery_start", deliveryId });
48953
+ return deliveryId;
48954
+ }
48955
+ async runWithLease(operation) {
48956
+ const deliveryId = this.start();
48957
+ try {
48958
+ return await operation();
48959
+ } finally {
48960
+ this.settle(deliveryId);
48961
+ }
48962
+ }
48963
+ settle(deliveryId) {
48964
+ if (deliveryId === undefined || !this.active.delete(deliveryId))
48965
+ return;
48966
+ this.emit({ type: "delivery_settled", deliveryId });
48967
+ }
48968
+ dispose() {
48969
+ for (const deliveryId of [...this.active])
48970
+ this.settle(deliveryId);
48971
+ this.listeners.clear();
48972
+ }
48973
+ emit(event) {
48974
+ for (const listener of [...this.listeners])
48975
+ listener(event);
48976
+ }
48977
+ }
48978
+
48842
48979
  // dist/builtin/workflows/src/runs/foreground/stage-runner-unresolved-overflow.ts
48843
48980
  function unresolvedContextOverflowMessage(event) {
48844
48981
  if (event === null || typeof event !== "object")
@@ -49095,7 +49232,7 @@ class StageSessionController {
49095
49232
  candidatesPromise;
49096
49233
  activeCandidateIndex;
49097
49234
  selectedModel;
49098
- sharedModelRegistry;
49235
+ sharedModelRuntime;
49099
49236
  sharedOrchestrationContext;
49100
49237
  resumeCurrentSession = false;
49101
49238
  modelAttempts = [];
@@ -49105,6 +49242,7 @@ class StageSessionController {
49105
49242
  sessionSettingsManager;
49106
49243
  replacement = new StageSessionReplacement;
49107
49244
  messageAdmission = new StageMessageAdmission;
49245
+ deliveryActivity = new StageDeliveryActivity;
49108
49246
  constructor(opts, meta, effectiveStageOptions, structuredOutputCapture) {
49109
49247
  this.opts = opts;
49110
49248
  this.meta = meta;
@@ -49168,16 +49306,24 @@ class StageSessionController {
49168
49306
  await session.closeWorkflowStageGeneration?.();
49169
49307
  return session;
49170
49308
  }
49171
- async sendUserMessage(content, options, beforeDelivery) {
49309
+ async sendUserMessage(content, options, beforeDelivery, preparation) {
49172
49310
  return this.messageAdmission.run(async (release) => {
49173
- const pausedDelivery = this.pauseControl.deferRunnerOwnedDelivery(() => this.sendUserMessage(content, options, beforeDelivery));
49311
+ const pausedDelivery = this.pauseControl.deferRunnerOwnedDelivery(() => this.sendUserMessage(content, options, beforeDelivery, preparation));
49174
49312
  if (pausedDelivery !== undefined) {
49175
49313
  release();
49176
49314
  return pausedDelivery;
49177
49315
  }
49178
- return sendStageUserMessage(await this.ensureSession("prompt"), content, options, beforeDelivery, release, this.messageAdmission);
49316
+ preparation?.beforePreparation?.();
49317
+ const sessionFile = preparation?.sessionFile;
49318
+ const deliver = async (activity) => sendStageUserMessage(sessionFile === undefined ? await this.ensureSession("prompt") : await this.ensureSessionFromFile(sessionFile, "prompt"), content, options, beforeDelivery, release, this.messageAdmission, activity);
49319
+ if (this.session === undefined || sessionFile !== undefined)
49320
+ return this.deliveryActivity.runWithLease(() => deliver());
49321
+ return deliver(this.deliveryActivity);
49179
49322
  });
49180
49323
  }
49324
+ subscribeDeliveryActivity(listener) {
49325
+ return this.deliveryActivity.subscribe(listener);
49326
+ }
49181
49327
  sealGeneration() {
49182
49328
  this.generationSealed = true;
49183
49329
  this.sharedOrchestrationContext?.messageAdmission?.boundary.seal();
@@ -49252,6 +49398,7 @@ class StageSessionController {
49252
49398
  this.unsubscribeTerminateWatcher = undefined;
49253
49399
  this.terminatingToolCallIds.clear();
49254
49400
  this.messageAdmission.dispose();
49401
+ this.deliveryActivity.dispose();
49255
49402
  await this.replacement.dispose();
49256
49403
  await disposeStageSession(this.session);
49257
49404
  }
@@ -49339,7 +49486,7 @@ class StageSessionController {
49339
49486
  candidate,
49340
49487
  restoreSavedModel: resumeOptions?.restoreSavedModel,
49341
49488
  reattachSessionFile: this.reattachSessionFile,
49342
- sharedModelRegistry: this.sharedModelRegistry
49489
+ sharedModelRuntime: this.sharedModelRuntime
49343
49490
  });
49344
49491
  const created = this.opts.adapters.agentSession ? await this.opts.adapters.agentSession.create(stripWorkflowOnlyOptions2(stageOptions, this.opts.defaultSessionDir, this.meta), {
49345
49492
  ...this.meta,
@@ -49358,10 +49505,10 @@ class StageSessionController {
49358
49505
  result.session.sealWorkflowStageGeneration?.();
49359
49506
  this.replacement.adopt(result.session);
49360
49507
  this.session = result.session;
49361
- if (this.sharedModelRegistry === undefined) {
49508
+ if (this.sharedModelRuntime === undefined) {
49362
49509
  const withRegistry = result.session;
49363
- if (withRegistry.modelRegistry !== undefined)
49364
- this.sharedModelRegistry = withRegistry.modelRegistry;
49510
+ if (withRegistry.modelRuntime !== undefined)
49511
+ this.sharedModelRuntime = withRegistry.modelRuntime;
49365
49512
  }
49366
49513
  this.sessionSettingsManager = result.settingsManager ?? result.session.settingsManager;
49367
49514
  if (this.pendingThinkingLevel !== undefined)
@@ -49739,8 +49886,8 @@ function createStageContext(opts) {
49739
49886
  async sendUserMessage(text, options) {
49740
49887
  await controller.sendUserMessage(text, options);
49741
49888
  },
49742
- async __sendUserMessage(text, options, beforeDelivery) {
49743
- return controller.sendUserMessage(text, options, beforeDelivery);
49889
+ async __sendUserMessage(text, options, beforeDelivery, preparation) {
49890
+ return controller.sendUserMessage(text, options, beforeDelivery, preparation);
49744
49891
  },
49745
49892
  async steer(text) {
49746
49893
  await (await controller.ensureSession()).steer(text);
@@ -49751,6 +49898,9 @@ function createStageContext(opts) {
49751
49898
  subscribe(listener) {
49752
49899
  return controller.subscribe(listener);
49753
49900
  },
49901
+ __subscribeDeliveryActivity(listener) {
49902
+ return controller.subscribeDeliveryActivity(listener);
49903
+ },
49754
49904
  get sessionFile() {
49755
49905
  return controller.currentSession?.sessionFile;
49756
49906
  },
@@ -51274,6 +51424,7 @@ function createReplayStageContext(input) {
51274
51424
  steer: async () => rejectReplayMutation("steer"),
51275
51425
  followUp: async () => rejectReplayMutation("follow up"),
51276
51426
  subscribe: () => () => {},
51427
+ __subscribeDeliveryActivity: () => () => {},
51277
51428
  get sessionFile() {
51278
51429
  return replaySource.sessionFile;
51279
51430
  },
@@ -51371,18 +51522,28 @@ class StageToolExecutionBuffer {
51371
51522
 
51372
51523
  // dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts
51373
51524
  function createStageControlHandle(runtime) {
51374
- const ensureMessagingSession = async () => {
51525
+ const messagePreparation = () => {
51375
51526
  const meta = runtime.innerCtx.__sessionMeta();
51376
- if (meta.sessionId !== undefined || meta.sessionFile !== undefined)
51377
- return;
51527
+ if (meta.sessionId !== undefined || meta.sessionFile !== undefined) {
51528
+ return { beforePreparation: runtime.throwIfStageMutationBlocked };
51529
+ }
51378
51530
  if (runtime.stageSnapshot.sessionFile !== undefined) {
51379
- await runtime.innerCtx.__ensureSessionFromFile(runtime.stageSnapshot.sessionFile);
51380
- runtime.captureStageSessionMeta();
51381
- return;
51531
+ return {
51532
+ sessionFile: runtime.stageSnapshot.sessionFile,
51533
+ beforePreparation: runtime.throwIfStageMutationBlocked
51534
+ };
51382
51535
  }
51383
51536
  if (isTerminalStage(runtime.stageSnapshot)) {
51384
51537
  throw new Error(`atomic-workflows: cannot message stage "${runtime.name}" because no retained session metadata is available.`);
51385
51538
  }
51539
+ return { beforePreparation: runtime.throwIfStageMutationBlocked };
51540
+ };
51541
+ const ensureMessagingSession = async () => {
51542
+ const sessionFile = messagePreparation().sessionFile;
51543
+ if (sessionFile === undefined)
51544
+ return;
51545
+ await runtime.innerCtx.__ensureSessionFromFile(sessionFile);
51546
+ runtime.captureStageSessionMeta();
51386
51547
  };
51387
51548
  const toolExecutions = new StageToolExecutionBuffer;
51388
51549
  const unsubscribeToolExecutions = runtime.innerCtx.subscribe((event) => toolExecutions.record(event));
@@ -51423,14 +51584,13 @@ function createStageControlHandle(runtime) {
51423
51584
  },
51424
51585
  async sendUserMessage(text, options, beforeDelivery) {
51425
51586
  runtime.throwIfStageMutationBlocked();
51426
- await ensureMessagingSession();
51427
- runtime.throwIfStageMutationBlocked();
51587
+ const preparation = messagePreparation();
51428
51588
  const admitDelivery = () => {
51429
51589
  runtime.throwIfStageMutationBlocked();
51430
51590
  beforeDelivery?.();
51431
51591
  };
51432
51592
  try {
51433
- const action = await runtime.innerCtx.__sendUserMessage(text, options, admitDelivery);
51593
+ const action = await runtime.innerCtx.__sendUserMessage(text, options, admitDelivery, preparation);
51434
51594
  if (action === "steer" || action === "followUp") {
51435
51595
  runtime.state.resumeContinuationPending = "queued-user-message";
51436
51596
  }
@@ -51441,10 +51601,10 @@ function createStageControlHandle(runtime) {
51441
51601
  },
51442
51602
  async prompt(text) {
51443
51603
  runtime.throwIfStageMutationBlocked();
51444
- await ensureMessagingSession();
51604
+ const preparation = messagePreparation();
51445
51605
  let action;
51446
51606
  try {
51447
- action = await runtime.innerCtx.__sendUserMessage(text, undefined, runtime.throwIfStageMutationBlocked);
51607
+ action = await runtime.innerCtx.__sendUserMessage(text, undefined, runtime.throwIfStageMutationBlocked, preparation);
51448
51608
  } finally {
51449
51609
  runtime.captureStageSessionMeta();
51450
51610
  }
@@ -51540,6 +51700,9 @@ function createStageControlHandle(runtime) {
51540
51700
  subscribe(listener) {
51541
51701
  return runtime.innerCtx.subscribe(listener);
51542
51702
  },
51703
+ subscribeDeliveryActivity(listener) {
51704
+ return runtime.innerCtx.__subscribeDeliveryActivity(listener);
51705
+ },
51543
51706
  async dispose() {
51544
51707
  unsubscribeToolExecutions();
51545
51708
  toolExecutions.clear();
@@ -61765,11 +61928,19 @@ function createPostMortemStageHandle(runId, stage, sessionFile, adapters, cwd, d
61765
61928
  ...defaultSessionDir !== undefined ? { defaultSessionDir } : {}
61766
61929
  });
61767
61930
  let disposed = false;
61768
- const ensureAttached = async () => {
61931
+ const throwIfClosed = () => {
61769
61932
  if (disposed)
61770
61933
  throw new Error(`Post-mortem stage chat "${stage.name}" is closed.`);
61771
- if (context.__sessionMeta().sessionFile === undefined) {
61772
- await context.__ensureSessionFromFile(sessionFile);
61934
+ };
61935
+ const messagePreparation = () => ({
61936
+ ...context.__sessionMeta().sessionFile === undefined ? { sessionFile } : {},
61937
+ beforePreparation: throwIfClosed
61938
+ });
61939
+ const ensureAttached = async () => {
61940
+ throwIfClosed();
61941
+ const sessionFileToRestore = messagePreparation().sessionFile;
61942
+ if (sessionFileToRestore !== undefined) {
61943
+ await context.__ensureSessionFromFile(sessionFileToRestore);
61773
61944
  }
61774
61945
  };
61775
61946
  return {
@@ -61799,8 +61970,13 @@ function createPostMortemStageHandle(runId, stage, sessionFile, adapters, cwd, d
61799
61970
  await ensureAttached();
61800
61971
  },
61801
61972
  async sendUserMessage(text, options, beforeDelivery) {
61802
- await ensureAttached();
61803
- return context.__sendUserMessage(text, options, beforeDelivery);
61973
+ throwIfClosed();
61974
+ const preparation = messagePreparation();
61975
+ const admitDelivery = () => {
61976
+ throwIfClosed();
61977
+ beforeDelivery?.();
61978
+ };
61979
+ return context.__sendUserMessage(text, options, admitDelivery, preparation);
61804
61980
  },
61805
61981
  async prompt(text) {
61806
61982
  await ensureAttached();
@@ -61823,6 +61999,9 @@ function createPostMortemStageHandle(runId, stage, sessionFile, adapters, cwd, d
61823
61999
  subscribe(listener) {
61824
62000
  return context.subscribe(listener);
61825
62001
  },
62002
+ subscribeDeliveryActivity(listener) {
62003
+ return context.__subscribeDeliveryActivity(listener);
62004
+ },
61826
62005
  async dispose() {
61827
62006
  if (disposed)
61828
62007
  return;
@@ -68529,6 +68708,27 @@ function workflowReloadDiagnostics(configDiagnostics, discoveryDiagnostics) {
68529
68708
  ];
68530
68709
  }
68531
68710
 
68711
+ // dist/builtin/workflows/src/extension/workflow-model-catalog.ts
68712
+ function workflowModelCatalogFromContext(ctx) {
68713
+ if (ctx?.modelRegistry === undefined && ctx?.model === undefined)
68714
+ return;
68715
+ return {
68716
+ listModels: async () => {
68717
+ const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
68718
+ return available.map((model) => ({
68719
+ provider: String(model.provider),
68720
+ id: model.id,
68721
+ fullId: `${String(model.provider)}/${model.id}`,
68722
+ model
68723
+ }));
68724
+ },
68725
+ ...ctx.model !== undefined ? {
68726
+ currentModel: ctx.model,
68727
+ preferredProvider: String(ctx.model.provider)
68728
+ } : {}
68729
+ };
68730
+ }
68731
+
68532
68732
  // dist/builtin/workflows/src/extension/extension-runtime-state.ts
68533
68733
  function createWorkflowExtensionRuntimeState(pi, adapters, resolveCwd = () => pi.sessionManager?.getCwd?.() ?? process.cwd()) {
68534
68734
  const persistenceRef = { current: makePersistencePort(pi, WORKFLOW_CONFIG_DEFAULTS.persistRuns) };
@@ -68639,25 +68839,6 @@ function createWorkflowExtensionRuntimeState(pi, adapters, resolveCwd = () => pi
68639
68839
  return open(workflowIdOrPrefix, catalog);
68640
68840
  }
68641
68841
  };
68642
- function workflowModelCatalogFromContext(ctx) {
68643
- if (ctx?.modelRegistry === undefined && ctx?.model === undefined)
68644
- return;
68645
- return {
68646
- listModels: async () => {
68647
- const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
68648
- return available.map((model) => ({
68649
- provider: String(model.provider),
68650
- id: model.id,
68651
- fullId: `${String(model.provider)}/${model.id}`,
68652
- model
68653
- }));
68654
- },
68655
- ...ctx.model !== undefined ? {
68656
- currentModel: ctx.model,
68657
- preferredProvider: String(ctx.model.provider)
68658
- } : {}
68659
- };
68660
- }
68661
68842
  function runtimeForContext(ctx) {
68662
68843
  const models = workflowModelCatalogFromContext(ctx);
68663
68844
  if (models === undefined)
@@ -72054,7 +72235,7 @@ var WorkflowParametersSchema = Type21.Object({
72054
72235
  }, { additionalProperties: false });
72055
72236
 
72056
72237
  // dist/builtin/workflows/src/extension/workflow-prompts.ts
72057
- var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.";
72238
+ var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.";
72058
72239
  var DEFAULT_PROMPT_GUIDANCE = [
72059
72240
  `**Workflows**: Treat workflows as the default execution path for any non-trivial task and for any request that has inherent structure plus an objective you can make verifiable. Use the \`workflow\` tool for existing named workflows; when the task needs a graph that is not installed, author a custom TypeScript \`workflow({...})\` inline with normal coding tools, reload workflow resources, and run it.
72060
72241
  - Workflow fit check: prefer a workflow for implementation, build, debug/diagnosis, bug-fix, migration, new-feature, scoped multi-file, or docs/code changes with validation; and whenever there are multiple steps, dependencies, handoffs, uncertainty, review/validation needs, long-running work, measurable done criteria, or an outcome that needs evidence.
@@ -72089,6 +72270,7 @@ var DEFAULT_PROMPT_GUIDANCE = [
72089
72270
  - For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
72090
72271
  `**Workflow authoring and handoffs**:
72091
72272
  - When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
72273
+ - After creating and reloading a newly authored custom workflow, close the loop by stating the folder containing the workflow file just written, for example \`.atomic/workflows/\`, in this shape: \`Custom workflow created. You can inspect its code at: <workflow-folder-path>\`. Do this only for newly created custom workflows, never builtin or pre-existing workflows.
72092
72274
  - When creating or editing a workflow that pins an explicit stage \`model\` or \`fallbackModels\`, consult \`packages/coding-agent/docs/models/model-selection.md\` for role-based recommendations, then call \`workflow({ action: "models" })\` to see the models actually present in the user's configured catalog. Use only the catalog's returned \`fullId\` values as model strings, and append a thinking suffix only when that exact level appears in the entry's \`availableThinkingLevels\`; treat an absent or empty \`availableThinkingLevels\` as no suffix support rather than inferring one. If a guide-recommended model for the role is unavailable, try another guide-recommended model that is present in the catalog. If no recommendation intersects with the catalog, leave the stage unpinned rather than inventing a substitute, and mention the limitation, asking the user only if the workflow requires an explicit model choice. If the catalog is empty, continue with unpinned stages, state that no configured models were returned, and do not fabricate model IDs. Do not inspect or infer credentials, environment variables, auth files, token validity, entitlements, or the reason a model is absent; \`isCurrent\` marks the active selection, not a quality recommendation.
72093
72275
  - Consult docs/workflows.md and its starter patterns (Classify-and-act, Fan-out-and-synthesize, Adversarial verification, Generate-and-filter, Tournament, and Loop until done) when designing a stage graph.
72094
72276
  - Treat workflow composition as a first-class authoring option. Before duplicating stages, inspect reusable workflow modules and builtin exports; import their definitions and invoke them with \`ctx.workflow(...)\`, mapping typed inputs and consuming only declared outputs. Nested workflows can themselves import children, so combine small reusable graphs into a richer parent while respecting \`maxDepth\`.