stageflow 0.32.0 → 0.35.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 (335) hide show
  1. package/README.md +4 -3
  2. package/dist/agent/adapterSpill.d.ts +14 -0
  3. package/dist/agent/adapterSpill.js +83 -0
  4. package/dist/agent/agentBackend.d.ts +2 -2
  5. package/dist/agent/agentBackend.js +2 -2
  6. package/dist/agent/claudeAdapter.d.ts +13 -2
  7. package/dist/agent/claudeAdapter.js +50 -6
  8. package/dist/agent/cursorProvider.d.ts +3 -0
  9. package/dist/agent/cursorProvider.js +23 -6
  10. package/dist/agent/fakeAgent.d.ts +3 -3
  11. package/dist/agent/fakeAgent.js +0 -6
  12. package/dist/agent/piAdapter.d.ts +2 -2
  13. package/dist/agent/piAdapter.js +116 -15
  14. package/dist/agent/piIsolatedMcp.d.ts +1 -0
  15. package/dist/agent/piIsolatedMcp.js +19 -1
  16. package/dist/agent/piIsolatedMcpProbe.d.ts +11 -0
  17. package/dist/agent/piIsolatedMcpProbe.js +20 -0
  18. package/dist/agent/port.d.ts +2 -2
  19. package/dist/agent/providerAuth.d.ts +6 -0
  20. package/dist/agent/providerAuth.js +86 -17
  21. package/dist/agent/{resolveAgentPort.d.ts → resolveStagePort.d.ts} +8 -6
  22. package/dist/agent/{resolveAgentPort.js → resolveStagePort.js} +13 -9
  23. package/dist/agent/stageTurnDriver.d.ts +33 -0
  24. package/dist/agent/stageTurnDriver.js +64 -0
  25. package/dist/agent/toolOutputBudget.d.ts +46 -0
  26. package/dist/agent/toolOutputBudget.js +97 -0
  27. package/dist/agent/toolOutputBudgetExtension.d.ts +22 -0
  28. package/dist/agent/toolOutputBudgetExtension.js +141 -0
  29. package/dist/agent/toolOutputSpill.d.ts +34 -0
  30. package/dist/agent/toolOutputSpill.js +85 -0
  31. package/dist/browser/agentBrowserLiveViewRelay.d.ts +41 -0
  32. package/dist/browser/agentBrowserLiveViewRelay.js +801 -0
  33. package/dist/browser/anchor.d.ts +2 -0
  34. package/dist/browser/anchor.js +2 -1
  35. package/dist/browser/auditSink.d.ts +8 -0
  36. package/dist/browser/browserHost.d.ts +29 -0
  37. package/dist/browser/browserSweep.d.ts +4 -1
  38. package/dist/browser/browserSweep.js +7 -0
  39. package/dist/browser/browserTeardown.d.ts +1 -0
  40. package/dist/browser/browserTeardown.js +32 -2
  41. package/dist/browser/containerBrowserEndpoint.d.ts +11 -0
  42. package/dist/browser/containerBrowserEndpoint.js +57 -0
  43. package/dist/browser/containerBrowserHost.d.ts +24 -0
  44. package/dist/browser/containerBrowserHost.js +147 -0
  45. package/dist/browser/dockerSandboxOrchestrator.d.ts +26 -0
  46. package/dist/browser/dockerSandboxOrchestrator.js +142 -0
  47. package/dist/browser/fakeLiveViewRelay.d.ts +15 -0
  48. package/dist/browser/fakeLiveViewRelay.js +94 -0
  49. package/dist/browser/fakeLiveViewSource.d.ts +6 -0
  50. package/dist/browser/fakeLiveViewSource.js +16 -0
  51. package/dist/browser/fakeRemoteBrowserHost.d.ts +2 -1
  52. package/dist/browser/fakeRemoteBrowserHost.js +2 -1
  53. package/dist/browser/fakeSandboxOrchestrator.d.ts +9 -0
  54. package/dist/browser/fakeSandboxOrchestrator.js +44 -0
  55. package/dist/browser/gateHandoff.d.ts +0 -2
  56. package/dist/browser/gateHandoff.js +5 -11
  57. package/dist/browser/hostCapabilities.d.ts +23 -0
  58. package/dist/browser/hostCapabilities.js +23 -0
  59. package/dist/browser/humanLogin.d.ts +2 -2
  60. package/dist/browser/humanLogin.js +11 -2
  61. package/dist/browser/liveViewPersisted.d.ts +11 -0
  62. package/dist/browser/liveViewPersisted.js +22 -0
  63. package/dist/browser/liveViewRelay.d.ts +76 -0
  64. package/dist/browser/liveViewRelay.js +1 -0
  65. package/dist/browser/liveViewSessions.d.ts +25 -0
  66. package/dist/browser/liveViewSessions.js +139 -0
  67. package/dist/browser/liveViewSource.d.ts +25 -0
  68. package/dist/browser/liveViewSource.js +7 -0
  69. package/dist/browser/liveViewTickets.d.ts +46 -0
  70. package/dist/browser/liveViewTickets.js +122 -0
  71. package/dist/browser/localBrowserHost.d.ts +10 -0
  72. package/dist/browser/localBrowserHost.js +53 -7
  73. package/dist/browser/ownerScope.d.ts +10 -0
  74. package/dist/browser/ownerScope.js +6 -0
  75. package/dist/browser/profileStore.d.ts +5 -2
  76. package/dist/browser/profileStore.js +3 -5
  77. package/dist/browser/sandboxOrchestrator.d.ts +60 -0
  78. package/dist/browser/sandboxOrchestrator.js +8 -0
  79. package/dist/browser/sessionApiSandboxOrchestrator.d.ts +34 -0
  80. package/dist/browser/sessionApiSandboxOrchestrator.js +108 -0
  81. package/dist/browser/stageBrowserEnv.d.ts +7 -0
  82. package/dist/browser/stageBrowserEnv.js +53 -15
  83. package/dist/browser/stageHandoff.d.ts +47 -0
  84. package/dist/browser/stageHandoff.js +101 -0
  85. package/dist/browser/stageProfileLock.d.ts +1 -0
  86. package/dist/browser/stageProfileLock.js +1 -3
  87. package/dist/browser/volumeProfileStore.d.ts +7 -0
  88. package/dist/browser/volumeProfileStore.js +35 -0
  89. package/dist/cli/browserCommand.d.ts +3 -1
  90. package/dist/cli/browserCommand.js +25 -20
  91. package/dist/cli/resolveCliProjectRoot.d.ts +7 -0
  92. package/dist/cli/resolveCliProjectRoot.js +27 -0
  93. package/dist/cli/runCommand.d.ts +1 -1
  94. package/dist/cli/runCommand.js +59 -17
  95. package/dist/cli/skillsCommand.d.ts +20 -0
  96. package/dist/cli/skillsCommand.js +74 -31
  97. package/dist/cli/validateCommand.d.ts +1 -1
  98. package/dist/cli/validateCommand.js +22 -4
  99. package/dist/cli.js +4 -4
  100. package/dist/config/browseCatalog.d.ts +2 -0
  101. package/dist/config/browseCatalog.js +6 -0
  102. package/dist/config/catalogRelativePath.d.ts +4 -0
  103. package/dist/config/catalogRelativePath.js +37 -9
  104. package/dist/config/createStage.d.ts +1 -0
  105. package/dist/config/createStage.js +11 -2
  106. package/dist/config/createTask.d.ts +30 -0
  107. package/dist/config/createTask.js +161 -0
  108. package/dist/config/createTrigger.d.ts +15 -0
  109. package/dist/config/createTrigger.js +32 -25
  110. package/dist/config/draftPackage.d.ts +41 -0
  111. package/dist/config/draftPackage.js +216 -23
  112. package/dist/config/ensureCatalogScanRoot.d.ts +2 -1
  113. package/dist/config/ensureCatalogScanRoot.js +6 -2
  114. package/dist/config/findTaskInCatalog.d.ts +33 -0
  115. package/dist/config/findTaskInCatalog.js +69 -0
  116. package/dist/config/hostConfig.d.ts +21 -0
  117. package/dist/config/hostConfig.js +113 -1
  118. package/dist/config/importTask.d.ts +19 -0
  119. package/dist/config/importTask.js +133 -0
  120. package/dist/config/installSkillRequest.d.ts +40 -0
  121. package/dist/config/installSkillRequest.js +286 -0
  122. package/dist/config/listConfig.d.ts +0 -16
  123. package/dist/config/listConfig.js +0 -3
  124. package/dist/config/loadOutcome.d.ts +11 -6
  125. package/dist/config/loadPipeline.js +0 -1
  126. package/dist/config/loadStage.js +2 -0
  127. package/dist/config/loadStageflowManifest.js +4 -1
  128. package/dist/config/loadTask.js +2 -0
  129. package/dist/config/loadTrigger.js +2 -0
  130. package/dist/config/mergePipelineIncludes.js +3 -0
  131. package/dist/config/normalizePipelineStageEntry.js +10 -1
  132. package/dist/config/printTargetYaml.js +0 -1
  133. package/dist/config/publishDraftPackage.d.ts +5 -1
  134. package/dist/config/publishDraftPackage.js +4 -1
  135. package/dist/config/resolveCatalogRoots.d.ts +4 -1
  136. package/dist/config/resolveCatalogRoots.js +18 -1
  137. package/dist/config/skillUsageIndex.d.ts +6 -0
  138. package/dist/config/skillUsageIndex.js +39 -0
  139. package/dist/config/stageBrowser.js +13 -0
  140. package/dist/config/triggerAdapterStatus.d.ts +11 -0
  141. package/dist/config/triggerAdapterStatus.js +90 -0
  142. package/dist/config/triggerCatalog.d.ts +41 -2
  143. package/dist/config/triggerCatalog.js +107 -15
  144. package/dist/config/updateTask.d.ts +30 -0
  145. package/dist/config/updateTask.js +119 -0
  146. package/dist/config/updateTrigger.d.ts +38 -0
  147. package/dist/config/updateTrigger.js +220 -0
  148. package/dist/config/validateCatalog.d.ts +6 -2
  149. package/dist/config/validateCatalog.js +48 -7
  150. package/dist/config/workshopCatalogFilenames.d.ts +37 -0
  151. package/dist/config/workshopCatalogFilenames.js +125 -0
  152. package/dist/config/workshopCatalogRepair.d.ts +7 -0
  153. package/dist/config/workshopCatalogRepair.js +144 -0
  154. package/dist/config/yamlParsePosition.d.ts +4 -0
  155. package/dist/config/yamlParsePosition.js +9 -0
  156. package/dist/hosted/containment.d.ts +3 -0
  157. package/dist/hosted/containment.js +36 -0
  158. package/dist/hosted/errors.d.ts +21 -0
  159. package/dist/hosted/errors.js +30 -0
  160. package/dist/hosted/packageSkills.d.ts +3 -0
  161. package/dist/hosted/packageSkills.js +80 -0
  162. package/dist/hosted/runtime.d.ts +12 -0
  163. package/dist/hosted/runtime.js +596 -0
  164. package/dist/hosted/sequencer.d.ts +28 -0
  165. package/dist/hosted/sequencer.js +129 -0
  166. package/dist/hosted/translate.d.ts +3 -0
  167. package/dist/hosted/translate.js +43 -0
  168. package/dist/hosted/types.d.ts +108 -0
  169. package/dist/hosted/types.js +10 -0
  170. package/dist/index.d.ts +9 -1
  171. package/dist/index.js +6 -0
  172. package/dist/mcp/getStartedTool.js +15 -6
  173. package/dist/mcp/triggerTools.js +2 -8
  174. package/dist/operatorAgent/agentPort.d.ts +11 -0
  175. package/dist/operatorAgent/agentPort.js +12 -0
  176. package/dist/operatorAgent/index.d.ts +1 -0
  177. package/dist/operatorAgent/index.js +1 -0
  178. package/dist/operatorAgent/piModel.js +26 -6
  179. package/dist/operatorAgent/profiles/workshopAuthorPlaybook.d.ts +1 -1
  180. package/dist/operatorAgent/profiles/workshopAuthorPlaybook.js +4 -2
  181. package/dist/operatorAgent/profiles/workshopAuthorTools.js +103 -16
  182. package/dist/package-meta.d.ts +1 -1
  183. package/dist/package-meta.js +1 -1
  184. package/dist/project/ensureProjectRootsFromEnv.d.ts +3 -0
  185. package/dist/project/ensureProjectRootsFromEnv.js +22 -0
  186. package/dist/project/globalHome.d.ts +1 -0
  187. package/dist/project/globalHome.js +18 -0
  188. package/dist/project/workspaceCatalog.d.ts +10 -0
  189. package/dist/project/workspaceCatalog.js +91 -0
  190. package/dist/projection/projectRun.d.ts +0 -1
  191. package/dist/projection/projectRun.js +0 -1
  192. package/dist/runstore/backup.js +14 -4
  193. package/dist/runstore/port.d.ts +11 -1
  194. package/dist/runstore/restore.js +5 -2
  195. package/dist/runstore/sqlite/SqliteRunStore.d.ts +8 -0
  196. package/dist/runstore/sqlite/SqliteRunStore.js +29 -9
  197. package/dist/runstore/sqlite/migrations/012-trigger-fires.d.ts +7 -0
  198. package/dist/runstore/sqlite/migrations/012-trigger-fires.js +18 -0
  199. package/dist/runstore/sqlite/migrations/index.js +2 -0
  200. package/dist/runstore/stageSnapshot.d.ts +3 -1
  201. package/dist/runstore/stageSnapshot.js +19 -0
  202. package/dist/runstore/workspaceLayout.js +27 -0
  203. package/dist/runstore/writeContainedArtifact.d.ts +1 -0
  204. package/dist/runstore/writeContainedArtifact.js +52 -0
  205. package/dist/runtime/containerLimits.d.ts +0 -3
  206. package/dist/runtime/containerLimits.js +0 -5
  207. package/dist/runtime/credentialBinding.d.ts +3 -0
  208. package/dist/runtime/credentialBinding.js +23 -6
  209. package/dist/runtime/emailSource.js +20 -28
  210. package/dist/runtime/githubPollSource.js +20 -28
  211. package/dist/runtime/pipelineRunner.d.ts +4 -4
  212. package/dist/runtime/pipelineScheduler.d.ts +2 -2
  213. package/dist/runtime/pipelineScheduler.js +3 -0
  214. package/dist/runtime/resumeReconstruct.d.ts +2 -2
  215. package/dist/runtime/resumeTimedOut.d.ts +2 -2
  216. package/dist/runtime/runManager.d.ts +18 -2
  217. package/dist/runtime/runManager.js +95 -30
  218. package/dist/runtime/runRetentionSweep.d.ts +0 -2
  219. package/dist/runtime/runRetentionSweep.js +0 -8
  220. package/dist/runtime/runRetryCoordinator.d.ts +2 -2
  221. package/dist/runtime/scheduleSource.js +15 -24
  222. package/dist/runtime/stageAttemptBootstrap.d.ts +2 -2
  223. package/dist/runtime/stageAttemptBootstrap.js +10 -1
  224. package/dist/runtime/stageProcessLauncher.js +2 -2
  225. package/dist/runtime/stageRoots.js +12 -1
  226. package/dist/runtime/stageRunner.d.ts +2 -2
  227. package/dist/runtime/stageRunner.js +8 -2
  228. package/dist/runtime/stageWorker.js +2 -2
  229. package/dist/runtime/triggerPort.d.ts +5 -3
  230. package/dist/runtime/triggerRunner.d.ts +1 -0
  231. package/dist/runtime/triggerRunner.js +27 -20
  232. package/dist/runtime/webhookAccept.d.ts +25 -0
  233. package/dist/runtime/webhookAccept.js +56 -0
  234. package/dist/server/bootstrap.d.ts +7 -2
  235. package/dist/server/bootstrap.js +15 -1
  236. package/dist/server/controlToken.d.ts +1 -1
  237. package/dist/server/controlToken.js +18 -2
  238. package/dist/server/healthSurfaces.d.ts +12 -0
  239. package/dist/server/healthSurfaces.js +27 -6
  240. package/dist/server/http.d.ts +19 -10
  241. package/dist/server/http.js +605 -85
  242. package/dist/server/liveViewPath.d.ts +9 -0
  243. package/dist/server/liveViewPath.js +8 -0
  244. package/dist/server/liveViewRoutes.d.ts +58 -0
  245. package/dist/server/liveViewRoutes.js +565 -0
  246. package/dist/server/mcpHost.d.ts +4 -2
  247. package/dist/server/mcpHost.js +2 -0
  248. package/dist/server/readCatalogFile.d.ts +29 -0
  249. package/dist/server/readCatalogFile.js +215 -0
  250. package/dist/server/triggerRoutes.d.ts +1 -0
  251. package/dist/server/triggerRoutes.js +200 -73
  252. package/dist/tools/readEmail.d.ts +3 -3
  253. package/dist/tools/writeStageArtifact.d.ts +9 -0
  254. package/dist/tools/writeStageArtifact.js +2 -47
  255. package/dist/types/pipeline.d.ts +1 -1
  256. package/dist/types/stage.d.ts +1 -1
  257. package/dist/types/stageflowManifest.d.ts +1 -1
  258. package/dist/ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  259. package/dist/ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  260. package/dist/ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  261. package/dist/ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  262. package/dist/ui/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  263. package/dist/ui/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  264. package/dist/ui/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  265. package/dist/ui/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  266. package/dist/ui/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  267. package/dist/ui/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  268. package/dist/ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  269. package/dist/ui/assets/index-BoFPkKFg.js +256 -0
  270. package/dist/ui/assets/{index-Bv4p1aPK.css → index-CIPbbBUi.css} +1 -1
  271. package/dist/ui/index.html +4 -4
  272. package/dist/workshop/autosave.d.ts +2 -2
  273. package/dist/workshop/autosave.js +4 -6
  274. package/dist/workshop/buildStore.d.ts +2 -0
  275. package/dist/workshop/chatAttachments.d.ts +27 -0
  276. package/dist/workshop/chatAttachments.js +98 -0
  277. package/dist/workshop/chatTurn.d.ts +5 -2
  278. package/dist/workshop/chatTurn.js +22 -18
  279. package/dist/workshop/sessionMutations.d.ts +17 -0
  280. package/dist/workshop/sessionMutations.js +107 -0
  281. package/dist/workshop/sessionStore.d.ts +10 -0
  282. package/dist/workshop/sessionStore.js +52 -0
  283. package/dist/workshop/workshopPin.d.ts +4 -3
  284. package/dist/workshop/workshopPin.js +26 -6
  285. package/dist/workshop/workshopTranscriptTurn.d.ts +8 -0
  286. package/dist/workshop/workshopTranscriptTurn.js +46 -0
  287. package/examples/README.md +1 -1
  288. package/examples/archify-on-pr/README.md +1 -1
  289. package/examples/archify-on-pr/archify-on-pr.pipeline.yaml +0 -1
  290. package/examples/archify-on-pr/author-diagrams.yaml +1 -0
  291. package/examples/conditional-fork/branch-a.yaml +1 -1
  292. package/examples/conditional-fork/decide.yaml +2 -1
  293. package/examples/feature-loop/{implement.yaml → feature-implement.yaml} +1 -1
  294. package/examples/feature-loop/feature-loop.pipeline.yaml +10 -10
  295. package/examples/feature-loop/{plan.yaml → feature-plan.yaml} +1 -1
  296. package/examples/feature-loop/{review.yaml → feature-review.yaml} +1 -1
  297. package/examples/feedback-loop/{implement.yaml → feedback-implement.yaml} +1 -1
  298. package/examples/feedback-loop/feedback-loop-wait-human.pipeline.yaml +9 -9
  299. package/examples/feedback-loop/feedback-loop.pipeline.yaml +9 -9
  300. package/examples/feedback-loop/{plan.yaml → feedback-plan.yaml} +1 -1
  301. package/examples/feedback-loop/{review.yaml → feedback-review.yaml} +1 -1
  302. package/examples/generic-fan-in/{research.yaml → fan-in-research.yaml} +1 -1
  303. package/examples/generic-fan-in/generic-fan-in-accepted.pipeline.yaml +3 -3
  304. package/examples/generic-fan-in/generic-fan-in.pipeline.yaml +3 -3
  305. package/examples/hello-world/{research.yaml → hello-research.yaml} +1 -1
  306. package/examples/hello-world/hello.pipeline.yaml +2 -2
  307. package/examples/mcp-hitl-tour/{review.yaml → mcp-hitl-review.yaml} +1 -1
  308. package/examples/mcp-hitl-tour/mcp-hitl-tour.pipeline.yaml +3 -3
  309. package/examples/oss-issue-contribution/oss-explain-fix.yaml +1 -0
  310. package/examples/oss-issue-contribution/oss-explain-issue.yaml +1 -0
  311. package/examples/oss-issue-contribution/oss-issue-contribution.pipeline.yaml +0 -2
  312. package/examples/stageflow.yaml +6 -0
  313. package/examples/triggers/sample-github-pr.trigger.yaml +12 -0
  314. package/examples/triggers/sample-inbox-email.trigger.yaml +14 -0
  315. package/examples/triggers/sample-manual-hello.trigger.yaml +5 -0
  316. package/examples/triggers/sample-nightly-hello.trigger.yaml +8 -0
  317. package/examples/triggers/sample-signed-webhook.trigger.yaml +11 -0
  318. package/examples/triggers-readiness/README.md +48 -0
  319. package/examples/triggers-readiness/readiness-emit.yaml +18 -0
  320. package/examples/triggers-readiness/readiness.pipeline.yaml +4 -0
  321. package/examples/triggers-readiness/readiness.task.yaml +6 -0
  322. package/examples/triggers-readiness/stageflow.yaml +13 -0
  323. package/examples/triggers-readiness/triggers/readiness-dynamic-manual.trigger.yaml +4 -0
  324. package/examples/triggers-readiness/triggers/readiness-email.trigger.yaml +12 -0
  325. package/examples/triggers-readiness/triggers/readiness-github-pr.trigger.yaml +12 -0
  326. package/examples/triggers-readiness/triggers/readiness-manual.trigger.yaml +5 -0
  327. package/examples/triggers-readiness/triggers/readiness-schedule.trigger.yaml +8 -0
  328. package/examples/triggers-readiness/triggers/readiness-webhook.trigger.yaml +11 -0
  329. package/package.json +9 -1
  330. package/skills/stageflow/references/control-surface.md +1 -1
  331. package/skills/stageflow-author/references/catalog-write-conventions.md +2 -2
  332. package/skills/stageflow-run/SKILL.md +1 -1
  333. package/skills/stageflow-run/references/mcp-call.md +1 -1
  334. package/skills/stageflow-setup/SKILL.md +1 -1
  335. package/dist/ui/assets/index-59cjF0OA.js +0 -133
@@ -0,0 +1,46 @@
1
+ import { mutationSnapshotsFromProposals, } from "./sessionMutations.js";
2
+ export function assistantTranscriptTextFromEvents(events) {
3
+ const parts = [];
4
+ for (const event of events) {
5
+ if (event.type === "message" && event.role === "assistant") {
6
+ parts.push(event.text);
7
+ }
8
+ }
9
+ return parts.join("\n\n").trim();
10
+ }
11
+ export function proposalPayloadsFromEvents(events) {
12
+ const proposals = [];
13
+ for (const event of events) {
14
+ if (event.type === "proposal") {
15
+ proposals.push(event.proposal);
16
+ }
17
+ }
18
+ return proposals;
19
+ }
20
+ export function transcriptMessagesForTurn(userMessage, attachments, events, options) {
21
+ const messages = [
22
+ {
23
+ role: "user",
24
+ text: userMessage,
25
+ ...(attachments.length > 0 ? { attachments: [...attachments] } : {}),
26
+ },
27
+ ];
28
+ for (const event of events) {
29
+ if (event.type === "message" && event.role !== "assistant") {
30
+ messages.push({ role: event.role, text: event.text });
31
+ }
32
+ }
33
+ const assistantText = assistantTranscriptTextFromEvents(events);
34
+ const proposals = proposalPayloadsFromEvents(events);
35
+ const mutations = proposals.length > 0
36
+ ? mutationSnapshotsFromProposals(proposals, options?.autoApply === true)
37
+ : [];
38
+ if (assistantText.length > 0 || mutations.length > 0) {
39
+ messages.push({
40
+ role: "assistant",
41
+ text: assistantText,
42
+ ...(mutations.length > 0 ? { mutations } : {}),
43
+ });
44
+ }
45
+ return messages;
46
+ }
@@ -14,7 +14,7 @@ Upgrading older YAML: [`sf migrate-yaml`](../docs/cli-reference.md#sf-migrate-ya
14
14
 
15
15
  - **Route `if`** — `detect-changes` emits `author_diagrams` and skips `author-diagrams` when the PR diff has no diagram-relevant types
16
16
  - **Multi-type output** — one pipeline authors 1–5 Archify diagram specs (`architecture`, `workflow`, `sequence`, `dataflow`, `lifecycle`)
17
- - **Skill binding** — `skill: archify` on the pipeline stage entry; GHA provisions the skill via `sf skills install`
17
+ - **Skill binding** — `skill: archify` on the stage file; GHA provisions the skill via `sf skills install`
18
18
  - **Deterministic handoff** — agents emit JSON specs; GHA runs `sf envelope get --format handoff` and Archify `deliver` outside the agent
19
19
  - **Real automation** — [`.github/workflows/archify-pr-diagrams.yml`](../.github/workflows/archify-pr-diagrams.yml) posts sticky PR comments with browser-viewable HTML artifacts
20
20
 
@@ -10,7 +10,7 @@ for GHA to deliver as HTML.
10
10
  |------|------|
11
11
  | `archify-on-pr.pipeline.yaml` | detect-changes Route `if` → author-diagrams; `verify` + `on_verify_fail` on detect |
12
12
  | `detect-changes.yaml` | Thin copy/emit from `ci-context.json` → `changes.json` + envelope |
13
- | `author-diagrams.yaml` | Writes `{type}.spec.json` per selected type (skill: archify on pipeline entry) |
13
+ | `author-diagrams.yaml` | Writes `{type}.spec.json` per selected type (`skill: archify` on the stage file) |
14
14
  | `archify-on-pr.task.yaml` | Task bound at run time |
15
15
  | `../../scripts/prepare-ci-context.sh` | Deterministic PR/git context + diagram type selection before `sf run` |
16
16
  | `../../scripts/validate-detect-envelope.mjs` | Verify helper: `changes.json` / envelope match `ci-context.json` |
@@ -16,4 +16,3 @@ stages:
16
16
  include_failed_checks: true
17
17
  - id: author-diagrams
18
18
  uses: ./author-diagrams.yaml
19
- skill: archify
@@ -1,4 +1,5 @@
1
1
  id: author-diagrams
2
+ skill: archify
2
3
  system_prompt: |
3
4
  Author Archify diagram specs for every diagram type selected by detect-changes.
4
5
 
@@ -3,7 +3,7 @@ system_prompt: |
3
3
  You are branch-a. Call emit_stage_envelope exactly once with status success,
4
4
  a short summary that acknowledges branch-a ran, and artifacts []. Do not call
5
5
  ask_operator.
6
- model: anthropic/claude-sonnet-4-5
6
+ model: cursor/composer-2-5
7
7
  io:
8
8
  input:
9
9
  schema:
@@ -29,7 +29,8 @@ io:
29
29
  output:
30
30
  schema:
31
31
  type: object
32
- required: [branch]
32
+ required:
33
+ - branch
33
34
  properties:
34
35
  branch:
35
36
  type: string
@@ -1,4 +1,4 @@
1
- id: implement
1
+ id: feature-implement
2
2
  system_prompt: |
3
3
  You are one sequential implementation clone among others. Work the way
4
4
  a compound-engineering ce-work run would: execute only your assigned
@@ -65,14 +65,14 @@ stages:
65
65
  clone_cap: 8
66
66
  clone_mode: parallel
67
67
  route:
68
- - to: plan
68
+ - to: feature-plan
69
69
  on_verify_fail:
70
70
  mode: repair
71
71
  max_attempts: 3
72
72
  retry_safety: idempotent
73
73
  include_failed_checks: true
74
- - id: plan
75
- uses: ./plan.yaml
74
+ - id: feature-plan
75
+ uses: ./feature-plan.yaml
76
76
  route:
77
77
  - to: align
78
78
  on_verify_fail:
@@ -85,14 +85,14 @@ stages:
85
85
  clone_cap: 8
86
86
  clone_mode: sequential
87
87
  route:
88
- - to: implement
88
+ - to: feature-implement
89
89
  on_verify_fail:
90
90
  mode: repair
91
91
  max_attempts: 3
92
92
  retry_safety: idempotent
93
93
  include_failed_checks: true
94
- - id: implement
95
- uses: ./implement.yaml
94
+ - id: feature-implement
95
+ uses: ./feature-implement.yaml
96
96
  route:
97
97
  - to: verify
98
98
  on_verify_fail:
@@ -103,14 +103,14 @@ stages:
103
103
  - id: verify
104
104
  uses: ./verify.yaml
105
105
  route:
106
- - to: review
106
+ - to: feature-review
107
107
  on_verify_fail:
108
108
  mode: repair
109
109
  max_attempts: 3
110
110
  retry_safety: idempotent
111
111
  include_failed_checks: true
112
- - id: review
113
- uses: ./review.yaml
112
+ - id: feature-review
113
+ uses: ./feature-review.yaml
114
114
  route:
115
115
  - to: address-feedback
116
116
  on_verify_fail:
@@ -123,7 +123,7 @@ stages:
123
123
  route:
124
124
  - to: publish
125
125
  - type: loop
126
- to: review
126
+ to: feature-review
127
127
  max_replays: 2
128
128
  on_max_replays: wait_for_human
129
129
  replay_session: new_session
@@ -1,4 +1,4 @@
1
- id: plan
1
+ id: feature-plan
2
2
  system_prompt: |
3
3
  You are one planning clone among others. Write an implementation-ready
4
4
  plan for only the story in your assignment envelope. Work the way a
@@ -1,4 +1,4 @@
1
- id: review
1
+ id: feature-review
2
2
  system_prompt: |
3
3
  Review the entire implementation as one change — every story's edits
4
4
  together, not per-story. Work the way a compound-engineering
@@ -1,4 +1,4 @@
1
- id: implement
1
+ id: feedback-implement
2
2
  system_prompt: |
3
3
  Produce the work described by the upstream plan envelope.
4
4
  Keep the deliverable short (a brief outline or draft).
@@ -1,23 +1,23 @@
1
1
  id: feedback-loop-wait-human
2
2
  stages:
3
- - id: plan
3
+ - id: feedback-plan
4
4
  entry: true
5
5
  route:
6
- - to: implement
7
- uses: ./plan.yaml
8
- - id: implement
6
+ - to: feedback-implement
7
+ uses: ./feedback-plan.yaml
8
+ - id: feedback-implement
9
9
  route:
10
- - to: review
11
- uses: ./implement.yaml
12
- - id: review
10
+ - to: feedback-review
11
+ uses: ./feedback-implement.yaml
12
+ - id: feedback-review
13
13
  route:
14
14
  - to: submit
15
15
  - type: loop
16
- to: implement
16
+ to: feedback-implement
17
17
  max_replays: 1
18
18
  on_max_replays: wait_for_human
19
19
  replay_session: resume
20
- uses: ./review.yaml
20
+ uses: ./feedback-review.yaml
21
21
  - id: submit
22
22
  uses: ./submit.yaml
23
23
  replay_safe: false
@@ -1,23 +1,23 @@
1
1
  id: feedback-loop
2
2
  stages:
3
- - id: plan
3
+ - id: feedback-plan
4
4
  entry: true
5
5
  route:
6
- - to: implement
7
- uses: ./plan.yaml
8
- - id: implement
6
+ - to: feedback-implement
7
+ uses: ./feedback-plan.yaml
8
+ - id: feedback-implement
9
9
  route:
10
- - to: review
11
- uses: ./implement.yaml
12
- - id: review
10
+ - to: feedback-review
11
+ uses: ./feedback-implement.yaml
12
+ - id: feedback-review
13
13
  route:
14
14
  - to: submit
15
15
  - type: loop
16
- to: implement
16
+ to: feedback-implement
17
17
  max_replays: 2
18
18
  on_max_replays: require_continue
19
19
  replay_session: resume
20
- uses: ./review.yaml
20
+ uses: ./feedback-review.yaml
21
21
  - id: submit
22
22
  uses: ./submit.yaml
23
23
  replay_safe: false
@@ -1,4 +1,4 @@
1
- id: plan
1
+ id: feedback-plan
2
2
  system_prompt: |
3
3
  Create a short plan for the task goal.
4
4
  List the sections you will produce and any open questions.
@@ -1,4 +1,4 @@
1
- id: review
1
+ id: feedback-review
2
2
  system_prompt: |
3
3
  Review the upstream work against the task goal.
4
4
  On success you MUST include feedback_loop in emit_stage_envelope:
@@ -1,4 +1,4 @@
1
- id: research
1
+ id: fan-in-research
2
2
  system_prompt: |
3
3
  You are the research branch of a diamond join. Follow these steps exactly:
4
4
 
@@ -3,14 +3,14 @@ stages:
3
3
  - id: clarify
4
4
  entry: true
5
5
  route:
6
- - to: research
6
+ - to: fan-in-research
7
7
  - to: validation
8
8
  uses: ./clarify.yaml
9
- - id: research
9
+ - id: fan-in-research
10
10
  route:
11
11
  - to: synthesize
12
12
  on: [succeeded, failed, skipped]
13
- uses: ./research.yaml
13
+ uses: ./fan-in-research.yaml
14
14
  - id: validation
15
15
  route:
16
16
  - to: synthesize
@@ -3,13 +3,13 @@ stages:
3
3
  - id: clarify
4
4
  entry: true
5
5
  route:
6
- - to: research
6
+ - to: fan-in-research
7
7
  - to: validation
8
8
  uses: ./clarify.yaml
9
- - id: research
9
+ - id: fan-in-research
10
10
  route:
11
11
  - to: synthesize
12
- uses: ./research.yaml
12
+ uses: ./fan-in-research.yaml
13
13
  - id: validation
14
14
  route:
15
15
  - to: synthesize
@@ -1,4 +1,4 @@
1
- id: research
1
+ id: hello-research
2
2
  system_prompt: |
3
3
  Summarize the task goal for the given topic and list open questions.
4
4
  The topic arrives as task input (and as this stage's io.input payload).
@@ -1,4 +1,4 @@
1
1
  id: hello
2
2
  stages:
3
- - id: research
4
- uses: ./research.yaml
3
+ - id: hello-research
4
+ uses: ./hello-research.yaml
@@ -1,4 +1,4 @@
1
- id: review
1
+ id: mcp-hitl-review
2
2
  system_prompt: |
3
3
  Review brief.md against the task goal.
4
4
  On every success you MUST emit feedback_loop send_back — never continue:
@@ -39,9 +39,9 @@ stages:
39
39
  - id: polish
40
40
  uses: ./polish.yaml
41
41
  route:
42
- - to: review
43
- - id: review
44
- uses: ./review.yaml
42
+ - to: mcp-hitl-review
43
+ - id: mcp-hitl-review
44
+ uses: ./mcp-hitl-review.yaml
45
45
  route:
46
46
  - to: ship
47
47
  - type: loop
@@ -1,4 +1,5 @@
1
1
  id: oss-explain-fix
2
+ skill: ce-explain
2
3
  system_prompt: |
3
4
  Compose fix-explainer.html teaching the operator how the verified working-tree
4
5
  change fixes the issue, grounded in real quoted diff lines. This stage is a
@@ -1,4 +1,5 @@
1
1
  id: oss-explain-issue
2
+ skill: ce-explain
2
3
  system_prompt: |
3
4
  Produce one self-contained teaching artifact, issue-explainer.html, that
4
5
  explains this issue from the real checkout. This stage is a side teaching
@@ -13,7 +13,6 @@ stages:
13
13
  include_failed_checks: true
14
14
  - id: oss-explain-issue
15
15
  uses: ./oss-explain-issue.yaml
16
- skill: ce-explain
17
16
  on_verify_fail:
18
17
  mode: repair
19
18
  max_attempts: 3
@@ -85,7 +84,6 @@ stages:
85
84
  include_failed_checks: true
86
85
  - id: oss-explain-fix
87
86
  uses: ./oss-explain-fix.yaml
88
- skill: ce-explain
89
87
  on_verify_fail:
90
88
  mode: repair
91
89
  max_attempts: 3
@@ -21,6 +21,7 @@ catalog:
21
21
  - mcp-hitl-tour
22
22
  - feature-loop
23
23
  - ship-feature
24
+ - triggers-readiness
24
25
  tasks:
25
26
  - generic-fan-in
26
27
  - stage-mcp
@@ -42,9 +43,14 @@ catalog:
42
43
  - mcp-hitl-tour
43
44
  - feature-loop
44
45
  - ship-feature
46
+ - triggers-readiness
47
+ triggers:
48
+ - triggers
49
+ - triggers-readiness/triggers
45
50
  patterns:
46
51
  pipeline: "*.pipeline.yaml"
47
52
  task: "*.task.yaml"
53
+ trigger: "*.trigger.yaml"
48
54
  exclude:
49
55
  - route-wiring-smoke-test/rejected
50
56
  - stage-mcp/stage-mcp-dead.pipeline.yaml
@@ -0,0 +1,12 @@
1
+ id: sample-github-pr
2
+ pipeline: hello
3
+ task: my-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: github.pull_request
8
+ match:
9
+ action: opened
10
+ config:
11
+ repo: tejasghutukade/software-factory
12
+ secretRef: GITHUB_TOKEN
@@ -0,0 +1,14 @@
1
+ id: sample-inbox-email
2
+ pipeline: hello
3
+ task: my-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: email.message
8
+ match:
9
+ subject: Invoice
10
+ config:
11
+ host: imap.example.com
12
+ port: 993
13
+ user: notifications@example.com
14
+ secretRef: EMAIL_PASSWORD
@@ -0,0 +1,5 @@
1
+ id: sample-manual-hello
2
+ pipeline: hello
3
+ task: my-task
4
+ kind: manual
5
+ enabled: false
@@ -0,0 +1,8 @@
1
+ id: sample-nightly-hello
2
+ pipeline: hello
3
+ task: my-task
4
+ kind: schedule
5
+ enabled: false
6
+ schedule:
7
+ cron: "0 2 * * *"
8
+ timezone: America/New_York
@@ -0,0 +1,11 @@
1
+ id: sample-signed-webhook
2
+ pipeline: hello
3
+ task: my-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: webhook
8
+ config:
9
+ secretRef: WEBHOOK_SECRET
10
+ header: x-hub-signature-256
11
+ scheme: hex
@@ -0,0 +1,48 @@
1
+ # Triggers readiness smoke catalog
2
+
3
+ Self-contained catalog for [Triggers readiness](../../docs/triggers-readiness.md). One trigger per checklist row, all targeting the minimal `readiness` pipeline.
4
+
5
+ | Trigger id | Kind | Default `enabled` | How to test |
6
+ |------------|------|-------------------|-------------|
7
+ | `readiness-manual` | manual | **true** | Triggers → **Fire** (or `sf trigger fire --run readiness-manual` via API id) |
8
+ | `readiness-schedule` | schedule | false | Enable in UI; cron `*/5 * * * *` UTC; needs Host scheduler |
9
+ | `readiness-github-pr` | event (`github.pull_request`) | false | Set `event.config.repo`, enable; needs `GITHUB_TOKEN` on Host |
10
+ | `readiness-webhook` | event (`webhook`) | false | Set `WEBHOOK_SECRET` on Host, enable; `POST /api/triggers/readiness-webhook/webhook` |
11
+ | `readiness-email` | event (`email.message`) | false | Edit IMAP `config`, set `EMAIL_PASSWORD`, enable; restart Host after create |
12
+ | `readiness-dynamic-manual` | manual (no `task`) | false | UI **Fire** disabled; `sf trigger fire readiness-dynamic-manual --task-inline '{"id":"t","goal":"Dynamic smoke"}'` |
13
+
14
+ ## Validate and run pipeline (no trigger)
15
+
16
+ From the repository root:
17
+
18
+ ```bash
19
+ sf validate --strict \
20
+ --pipeline examples/triggers-readiness/readiness.pipeline.yaml \
21
+ --task examples/triggers-readiness/readiness.task.yaml
22
+ sf run \
23
+ --pipeline examples/triggers-readiness/readiness.pipeline.yaml \
24
+ --task examples/triggers-readiness/readiness.task.yaml
25
+ ```
26
+
27
+ ## Docker Compose
28
+
29
+ The image copies this tree to `/opt/stageflow/catalog/triggers-readiness` and registers it via `STAGEFLOW_ENSURE_PROJECT_ROOTS`. After `docker compose up --build -d`, open **Triggers** — you should see six `readiness-*` triggers.
30
+
31
+ Optional `.env` for event triggers:
32
+
33
+ ```bash
34
+ GITHUB_TOKEN=… # readiness-github-pr
35
+ WEBHOOK_SECRET=… # readiness-webhook (use a long random string)
36
+ EMAIL_PASSWORD=… # readiness-email (after you point config at a real mailbox)
37
+ ```
38
+
39
+ Webhook smoke (replace secret and use the trigger id from the console if namespaced):
40
+
41
+ ```bash
42
+ BODY='{"hello":"triggers"}'
43
+ SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | awk '{print $2}')
44
+ curl -sS -X POST "http://127.0.0.1:3847/api/triggers/readiness-webhook/webhook" \
45
+ -H "Content-Type: application/json" \
46
+ -H "x-hub-signature-256: $SIG" \
47
+ -d "$BODY"
48
+ ```
@@ -0,0 +1,18 @@
1
+ id: readiness-emit
2
+ system_prompt: |
3
+ You are a trigger smoke-test stage. Reply with one short acknowledgment, then call emit_stage_envelope once with
4
+ status: success, a non-empty summary, artifacts: [], and payload: { "trigger_test": true }.
5
+ io:
6
+ input:
7
+ schema:
8
+ type: object
9
+ additionalProperties: true
10
+ output:
11
+ schema:
12
+ type: object
13
+ required:
14
+ - trigger_test
15
+ properties:
16
+ trigger_test:
17
+ type: boolean
18
+ additionalProperties: false
@@ -0,0 +1,4 @@
1
+ id: readiness
2
+ stages:
3
+ - id: readiness-emit
4
+ uses: ./readiness-emit.yaml
@@ -0,0 +1,6 @@
1
+ id: readiness-task
2
+ goal: Acknowledge a triggers-readiness smoke run
3
+ context: Fired from the triggers-readiness catalog bundle (Docker or examples/)
4
+ constraints: One stage only; emit a success envelope
5
+ input:
6
+ source: triggers-readiness
@@ -0,0 +1,13 @@
1
+ version: 1
2
+ model: cursor/auto
3
+ catalog:
4
+ pipelines:
5
+ - .
6
+ tasks:
7
+ - .
8
+ triggers:
9
+ - triggers
10
+ patterns:
11
+ pipeline: "*.pipeline.yaml"
12
+ task: "*.task.yaml"
13
+ trigger: "*.trigger.yaml"
@@ -0,0 +1,4 @@
1
+ id: readiness-dynamic-manual
2
+ pipeline: readiness
3
+ kind: manual
4
+ enabled: false
@@ -0,0 +1,12 @@
1
+ id: readiness-email
2
+ pipeline: readiness
3
+ task: readiness-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: email.message
8
+ config:
9
+ host: imap.example.com
10
+ port: 993
11
+ user: notifications@example.com
12
+ secretRef: EMAIL_PASSWORD
@@ -0,0 +1,12 @@
1
+ id: readiness-github-pr
2
+ pipeline: readiness
3
+ task: readiness-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: github.pull_request
8
+ match:
9
+ action: opened
10
+ config:
11
+ repo: tejasghutukade/stageflow
12
+ secretRef: GITHUB_TOKEN
@@ -0,0 +1,5 @@
1
+ id: readiness-manual
2
+ pipeline: readiness
3
+ task: readiness-task
4
+ kind: manual
5
+ enabled: true
@@ -0,0 +1,8 @@
1
+ id: readiness-schedule
2
+ pipeline: readiness
3
+ task: readiness-task
4
+ kind: schedule
5
+ enabled: false
6
+ schedule:
7
+ cron: "*/5 * * * *"
8
+ timezone: UTC
@@ -0,0 +1,11 @@
1
+ id: readiness-webhook
2
+ pipeline: readiness
3
+ task: readiness-task
4
+ kind: event
5
+ enabled: false
6
+ event:
7
+ source: webhook
8
+ config:
9
+ secretRef: WEBHOOK_SECRET
10
+ header: x-hub-signature-256
11
+ scheme: hex
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "stageflow",
3
- "version": "0.32.0",
3
+ "version": "0.35.0",
4
4
  "description": "Stageflow — CLI pipeline runtime for configurable stages on Pi",
5
5
  "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
6
14
  "bin": {
7
15
  "sf": "./dist/cli.js",
8
16
  "stageflow": "./dist/cli.js"