@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7

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 (323) hide show
  1. package/README.md +564 -2
  2. package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
  3. package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
  4. package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
  5. package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
  6. package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
  7. package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
  8. package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
  9. package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
  10. package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
  11. package/dist/DateTimeField-B1qR4ruo.js +51 -0
  12. package/dist/Disclosure-BNKij7-v.js +45 -0
  13. package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
  14. package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
  15. package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
  16. package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
  17. package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
  18. package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
  19. package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
  20. package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
  21. package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
  22. package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
  23. package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
  24. package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
  25. package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
  26. package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
  27. package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
  28. package/dist/FluidGridsMark-CE2blT7K.js +74 -0
  29. package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
  30. package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
  31. package/dist/HistoryPage-BSBISXoj.js +2835 -0
  32. package/dist/Icon-BtQ0HXLh.js +160 -0
  33. package/dist/InsightsPage-D7ybj8N9.js +11245 -0
  34. package/dist/IsolationSetting-vy911E8b.js +1153 -0
  35. package/dist/LibraryParts-DOeNgR8A.js +413 -0
  36. package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
  37. package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
  38. package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
  39. package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
  40. package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
  41. package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
  42. package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
  43. package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
  44. package/dist/NodesPage-O7KeeKtd.js +653 -0
  45. package/dist/OfflineIcon-TwMKYWjA.js +207 -0
  46. package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
  47. package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
  48. package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
  49. package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
  50. package/dist/RunActionsMenu-DodOgIQm.js +59 -0
  51. package/dist/RunnerStatusPill-C1v967iq.js +24 -0
  52. package/dist/RunnersPage-dB0RSdY_.js +1929 -0
  53. package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
  54. package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
  55. package/dist/SearchBox-BGtYjvfs.js +49 -0
  56. package/dist/SequenceEditor-CFiHeHkR.js +497 -0
  57. package/dist/SettingsPage-0CQBNPZV.js +8695 -0
  58. package/dist/StewardPages-DAJhepen.js +47 -0
  59. package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
  60. package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
  61. package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
  62. package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
  63. package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
  64. package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
  65. package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
  66. package/dist/TemplatePreview-cx7-NOeG.js +868 -0
  67. package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
  68. package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
  69. package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
  70. package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
  71. package/dist/TranslationBridge-Da-TPgQm.js +68 -0
  72. package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
  73. package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
  74. package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
  75. package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
  76. package/dist/VariablesPage-ChfGuW22.js +2243 -0
  77. package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
  78. package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
  79. package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
  80. package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
  81. package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
  82. package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
  83. package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
  84. package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
  85. package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
  86. package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
  87. package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
  88. package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
  89. package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
  90. package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
  91. package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
  92. package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
  93. package/dist/WorkflowsList--hR2_8gf.js +4593 -0
  94. package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
  95. package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
  96. package/dist/addonCatalog-CbZS4deh.js +58 -0
  97. package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
  98. package/dist/addons.d.ts +3 -0
  99. package/dist/addons.js +4 -0
  100. package/dist/agent-form-Bfvm32j1.js +83 -0
  101. package/dist/agent-tools.d.ts +3 -0
  102. package/dist/agent-tools.js +5 -0
  103. package/dist/agentTools-CyL7DLOF.js +320 -0
  104. package/dist/ai-usage-BrxDgvdR.js +240 -0
  105. package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
  106. package/dist/api-BKq-nIOZ.js +2286 -0
  107. package/dist/api-Ol7I8NxE.js +8289 -0
  108. package/dist/apollo-type-policies.d.ts +11 -0
  109. package/dist/apollo-type-policies.js +64 -0
  110. package/dist/askAboutBridge-ByYsQams.js +106 -0
  111. package/dist/askQuestions-Cmx7VnMm.js +742 -0
  112. package/dist/assert-rules-lfYEMc99.js +318 -0
  113. package/dist/assistant.d.ts +94 -0
  114. package/dist/assistant.js +99 -0
  115. package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
  116. package/dist/badge-CXfPhoMH.js +26 -0
  117. package/dist/basil.generated-BK-EHbwN.js +10 -0
  118. package/dist/browser-steps-DMpS5TyB.js +533 -0
  119. package/dist/builderTimings-pvGnK1m-.js +510 -0
  120. package/dist/button-DG7y_FVJ.js +48 -0
  121. package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
  122. package/dist/card-Bomy_1UG.js +44 -0
  123. package/dist/catalogGrid-BOrfMgi-.js +41 -0
  124. package/dist/channel-CPyQ1NR1.js +212 -0
  125. package/dist/chips-CvNrYJZa.js +27 -0
  126. package/dist/client-holder-C0M5Cfwl.js +68 -0
  127. package/dist/cn-QqidFIgr.js +10 -0
  128. package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
  129. package/dist/code-editor-field-x_JrY8KR.js +113 -0
  130. package/dist/codec-client-DPuD6mw7.js +515 -0
  131. package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
  132. package/dist/config-DO68jw5k.js +322 -0
  133. package/dist/constants-DgbVc24O.d.ts +296 -0
  134. package/dist/constants-DlRnHBfQ.js +217 -0
  135. package/dist/convert-browser-action-pfecelF7.js +347 -0
  136. package/dist/convert-dialog-B_o22NiJ.js +382 -0
  137. package/dist/create-workflow-first-Azg3JUdX.js +120 -0
  138. package/dist/definition-canvas-Bsda-rDT.js +31 -0
  139. package/dist/dialog-BVd152GS.js +94 -0
  140. package/dist/durable-nodes-BXyYCLxT.js +91 -0
  141. package/dist/duration-CDb7-mT_.js +33 -0
  142. package/dist/edge-mapper-wEAdGVU2.js +4477 -0
  143. package/dist/element-library-DkSlg_VE.js +727 -0
  144. package/dist/entities-I_0kio3q.js +38 -0
  145. package/dist/error-advice-QLr5NCm7.js +65 -0
  146. package/dist/errors-ClKb5sEt.js +188 -0
  147. package/dist/executions.d.ts +3 -0
  148. package/dist/executions.js +5 -0
  149. package/dist/feature-flags-B2qetXKd.js +385 -0
  150. package/dist/field-label-DPZRmE_B.js +153 -0
  151. package/dist/firstWorkflow-C_h0KMB2.js +133 -0
  152. package/dist/flags.d.ts +3 -0
  153. package/dist/flags.js +4 -0
  154. package/dist/flow-builder-DIvLOhz0.js +28038 -0
  155. package/dist/flow-store-holder-CUN7Terz.js +52 -0
  156. package/dist/fluent.generated-CA_e6-4l.js +14 -0
  157. package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
  158. package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
  159. package/dist/global-client-BQPuFrFa.js +433 -0
  160. package/dist/global-operations-BG6YgxrM.js +136 -0
  161. package/dist/graphql-types-UTYtujY9.js +21358 -0
  162. package/dist/history.d.ts +3 -0
  163. package/dist/history.js +4 -0
  164. package/dist/index-AoJAa5vU.d.ts +164958 -0
  165. package/dist/index-DEMT3iAM.d.ts +120 -0
  166. package/dist/index-ROZzNGyY.d.ts +76 -0
  167. package/dist/index.d.ts +20 -0
  168. package/dist/index.js +8123 -0
  169. package/dist/ion.generated-mbajjcAg.js +10 -0
  170. package/dist/label-Lzb8ZXf_.js +29 -0
  171. package/dist/labels-rXd9gYQz.js +1236 -0
  172. package/dist/liveCanvas-D5ytXDp8.js +103 -0
  173. package/dist/logos.generated-X6_0kjVR.js +21 -0
  174. package/dist/logs-panel-Cw0DkG0l.js +468 -0
  175. package/dist/lucide.generated-B6NVd3GT.js +29 -0
  176. package/dist/marksStore-a9oIMMot.js +175 -0
  177. package/dist/mcp-trigger-D0nRdvq5.js +307 -0
  178. package/dist/mdi.generated-D1BV74d6.js +292 -0
  179. package/dist/menus-CU3hDGYl.js +160 -0
  180. package/dist/mynaui.generated-DMWr5cXz.js +66 -0
  181. package/dist/navigation-v2.d.ts +3 -0
  182. package/dist/navigation-v2.js +5 -0
  183. package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
  184. package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
  185. package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
  186. package/dist/node-registry-refresh-s3okf83X.js +27 -0
  187. package/dist/node-role-TMbnkmeP.js +132 -0
  188. package/dist/node-type-icon-BZa8n4iG.js +33 -0
  189. package/dist/nodes.d.ts +3 -0
  190. package/dist/nodes.js +4 -0
  191. package/dist/notesKey-5EaREBGA.js +12 -0
  192. package/dist/observability.d.ts +3 -0
  193. package/dist/observability.js +5 -0
  194. package/dist/offset-pages-zghoClB3.js +55 -0
  195. package/dist/operations-BBmT9ToP.js +663 -0
  196. package/dist/operations-WxRJWeqO.js +3133 -0
  197. package/dist/output-files-Ba8bu5lv.js +196 -0
  198. package/dist/page-operation-DrWuhd6Y.js +129 -0
  199. package/dist/page-twins.d.ts +13 -0
  200. package/dist/page-twins.js +186 -0
  201. package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
  202. package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
  203. package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
  204. package/dist/panels-PfBBAToE.js +346 -0
  205. package/dist/parts-B7fBcw-B.js +346 -0
  206. package/dist/popover-Dms9Vz3j.js +3389 -0
  207. package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
  208. package/dist/proactive.d.ts +66 -0
  209. package/dist/proactive.js +237 -0
  210. package/dist/quick-config-panel-DFd77xho.js +451 -0
  211. package/dist/quota-DeA_CJ2e.js +175 -0
  212. package/dist/quota.d.ts +3 -0
  213. package/dist/quota.js +4 -0
  214. package/dist/read-only-context-Dt9N9SIG.js +18 -0
  215. package/dist/relative-time-Dxt8ZIIu.js +55 -0
  216. package/dist/results-CwK_yDxK.js +325 -0
  217. package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
  218. package/dist/route-data.d.ts +12 -0
  219. package/dist/route-data.js +69 -0
  220. package/dist/route-match-C-0_EnAt.d.ts +5 -0
  221. package/dist/route-match-DMkUICYV.js +41 -0
  222. package/dist/route-preload-C4DlGoCd.js +120 -0
  223. package/dist/run-display-UjLAoYqQ.js +81 -0
  224. package/dist/run-history-arGiHzGU.js +285 -0
  225. package/dist/run-list-links-DJn4Mf1T.js +98 -0
  226. package/dist/run-mode-USmM0-Uo.js +82 -0
  227. package/dist/run-parity-CWXqEJqM.js +144 -0
  228. package/dist/runsQuota-B6SyTbne.js +100 -0
  229. package/dist/runsQuota-DsniKiSg.d.ts +20 -0
  230. package/dist/safe-expression-Cw7-SCsm.js +1251 -0
  231. package/dist/save-status-store-C7nEYpfb.js +631 -0
  232. package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
  233. package/dist/schedule-rules-ggVKRkBH.js +358 -0
  234. package/dist/secrets-Re_wSiE3.js +153 -0
  235. package/dist/settings.d.ts +4 -0
  236. package/dist/settings.js +6 -0
  237. package/dist/shared-DAWGGMSM.js +177 -0
  238. package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
  239. package/dist/solar.generated-CGYuUQAC.js +10 -0
  240. package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
  241. package/dist/start-url-CT6Yz96K.js +24 -0
  242. package/dist/status-CessxGpm.js +55 -0
  243. package/dist/store-icon-OctYp5zP.js +155 -0
  244. package/dist/styles-WGmTnZ2n.js +26 -0
  245. package/dist/styles.css +139 -0
  246. package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
  247. package/dist/template-code-CzN6JWNV.js +191 -0
  248. package/dist/template-graph-DLF9dygU.js +20 -0
  249. package/dist/template-preview-DcIIKOOL.js +32 -0
  250. package/dist/template-price-CdUHZRMF.js +40 -0
  251. package/dist/templates.d.ts +3 -0
  252. package/dist/templates.js +5 -0
  253. package/dist/theme-provider-CntfC4_i.js +23 -0
  254. package/dist/transient-DgZfhDfN.js +57 -0
  255. package/dist/typed-calls-C5tO03wq.js +26 -0
  256. package/dist/ui-script-By74Guk3.js +1094 -0
  257. package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
  258. package/dist/ui-step-fix-8uM2_Hft.js +67 -0
  259. package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
  260. package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
  261. package/dist/ui-target-editor-D2JhB_lD.js +673 -0
  262. package/dist/uiMarkTools-CSznnO1i.js +1054 -0
  263. package/dist/upgradePrompt-BAFBKKW5.js +72 -0
  264. package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
  265. package/dist/use-browser-available-hj8wc3Kb.js +241 -0
  266. package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
  267. package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
  268. package/dist/use-mobile-BTqCUjzS.js +27 -0
  269. package/dist/use-sdk-query-C697xZVv.js +116 -0
  270. package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
  271. package/dist/useActionParam-B2tU2BlY.js +85 -0
  272. package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
  273. package/dist/useBrowserClients-3v95-gSh.js +103 -0
  274. package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
  275. package/dist/useConnections-DsgEJs05.js +439 -0
  276. package/dist/useDebouncedValue-BFekcv6n.js +18 -0
  277. package/dist/useDurableParity-8fnMZmBc.js +1787 -0
  278. package/dist/useEntityTags-D0spL6Ut.js +460 -0
  279. package/dist/useExecutions-2u5nGJJk.js +681 -0
  280. package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
  281. package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
  282. package/dist/useHumanRequests-zlYDp3l1.js +221 -0
  283. package/dist/useNavigationV2-C2WeqN7d.js +29 -0
  284. package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
  285. package/dist/useObservability-BRlQ0tOA.js +285 -0
  286. package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
  287. package/dist/useRunHistory-CXCMUPyf.js +2759 -0
  288. package/dist/useRunLive-D0JvVZT2.js +1060 -0
  289. package/dist/useRunnerList-Dbi59i1K.js +446 -0
  290. package/dist/useRunners-URUc5quU.js +173 -0
  291. package/dist/useRunsPage-DG656UCK.js +2709 -0
  292. package/dist/useVariables-BIelxcWr.js +463 -0
  293. package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
  294. package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
  295. package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
  296. package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
  297. package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
  298. package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
  299. package/dist/utils-fvBb5qOD.js +89 -0
  300. package/dist/webhook-deliveries-AvQujaZy.js +99 -0
  301. package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
  302. package/dist/workflow-builder.d.ts +3 -0
  303. package/dist/workflow-builder.js +8 -0
  304. package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
  305. package/dist/workflow-embed.d.ts +3 -0
  306. package/dist/workflow-embed.js +4 -0
  307. package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
  308. package/dist/workflow-host.d.ts +6 -0
  309. package/dist/workflow-host.js +11 -0
  310. package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
  311. package/dist/workflow-pages.d.ts +3 -0
  312. package/dist/workflow-pages.js +115 -0
  313. package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
  314. package/dist/workflow-preview.d.ts +65 -0
  315. package/dist/workflow-preview.js +4 -0
  316. package/dist/workflow-route.d.ts +33 -0
  317. package/dist/workflow-route.js +4 -0
  318. package/dist/workflow-save-state-D0l-DkLf.js +767 -0
  319. package/dist/workflow-transfer-CQnQC-ke.js +104 -0
  320. package/dist/workflowRouteData-BkfVOc-O.js +169 -0
  321. package/dist/workflows-list.d.ts +10 -0
  322. package/dist/workflows-list.js +5 -0
  323. package/package.json +320 -4
@@ -0,0 +1,1060 @@
1
+ "use client";
2
+ import { r as getFluidGridsClientSafe } from "./client-holder-C0M5Cfwl.js";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { CombinedGraphQLErrors } from "@apollo/client/errors";
5
+
6
+ // src/generated/documents/wspace/WorkflowRunLiveDocument.ts
7
+ const WorkflowRunLiveDocument = {
8
+ "kind": "Document",
9
+ "definitions": [{
10
+ "kind": "OperationDefinition",
11
+ "operation": "subscription",
12
+ "name": {
13
+ "kind": "Name",
14
+ "value": "WorkflowRunLive"
15
+ },
16
+ "variableDefinitions": [{
17
+ "kind": "VariableDefinition",
18
+ "variable": {
19
+ "kind": "Variable",
20
+ "name": {
21
+ "kind": "Name",
22
+ "value": "runId"
23
+ }
24
+ },
25
+ "type": {
26
+ "kind": "NonNullType",
27
+ "type": {
28
+ "kind": "NamedType",
29
+ "name": {
30
+ "kind": "Name",
31
+ "value": "ID"
32
+ }
33
+ }
34
+ },
35
+ "directives": []
36
+ }],
37
+ "directives": [],
38
+ "selectionSet": {
39
+ "kind": "SelectionSet",
40
+ "selections": [{
41
+ "kind": "Field",
42
+ "name": {
43
+ "kind": "Name",
44
+ "value": "workflowRunLive"
45
+ },
46
+ "arguments": [{
47
+ "kind": "Argument",
48
+ "name": {
49
+ "kind": "Name",
50
+ "value": "runId"
51
+ },
52
+ "value": {
53
+ "kind": "Variable",
54
+ "name": {
55
+ "kind": "Name",
56
+ "value": "runId"
57
+ }
58
+ }
59
+ }],
60
+ "directives": [],
61
+ "selectionSet": {
62
+ "kind": "SelectionSet",
63
+ "selections": [
64
+ {
65
+ "kind": "Field",
66
+ "name": {
67
+ "kind": "Name",
68
+ "value": "kind"
69
+ },
70
+ "arguments": [],
71
+ "directives": []
72
+ },
73
+ {
74
+ "kind": "Field",
75
+ "name": {
76
+ "kind": "Name",
77
+ "value": "at"
78
+ },
79
+ "arguments": [],
80
+ "directives": []
81
+ },
82
+ {
83
+ "kind": "Field",
84
+ "name": {
85
+ "kind": "Name",
86
+ "value": "runId"
87
+ },
88
+ "arguments": [],
89
+ "directives": []
90
+ },
91
+ {
92
+ "kind": "Field",
93
+ "name": {
94
+ "kind": "Name",
95
+ "value": "workflowKey"
96
+ },
97
+ "arguments": [],
98
+ "directives": []
99
+ },
100
+ {
101
+ "kind": "Field",
102
+ "name": {
103
+ "kind": "Name",
104
+ "value": "workflowId"
105
+ },
106
+ "arguments": [],
107
+ "directives": []
108
+ },
109
+ {
110
+ "kind": "Field",
111
+ "name": {
112
+ "kind": "Name",
113
+ "value": "runStatus"
114
+ },
115
+ "arguments": [],
116
+ "directives": []
117
+ },
118
+ {
119
+ "kind": "Field",
120
+ "name": {
121
+ "kind": "Name",
122
+ "value": "mode"
123
+ },
124
+ "arguments": [],
125
+ "directives": []
126
+ },
127
+ {
128
+ "kind": "Field",
129
+ "name": {
130
+ "kind": "Name",
131
+ "value": "parentRunId"
132
+ },
133
+ "arguments": [],
134
+ "directives": []
135
+ },
136
+ {
137
+ "kind": "Field",
138
+ "name": {
139
+ "kind": "Name",
140
+ "value": "nodeStateId"
141
+ },
142
+ "arguments": [],
143
+ "directives": []
144
+ },
145
+ {
146
+ "kind": "Field",
147
+ "name": {
148
+ "kind": "Name",
149
+ "value": "nodeId"
150
+ },
151
+ "arguments": [],
152
+ "directives": []
153
+ },
154
+ {
155
+ "kind": "Field",
156
+ "name": {
157
+ "kind": "Name",
158
+ "value": "nodeType"
159
+ },
160
+ "arguments": [],
161
+ "directives": []
162
+ },
163
+ {
164
+ "kind": "Field",
165
+ "name": {
166
+ "kind": "Name",
167
+ "value": "nodeStatus"
168
+ },
169
+ "arguments": [],
170
+ "directives": []
171
+ },
172
+ {
173
+ "kind": "Field",
174
+ "name": {
175
+ "kind": "Name",
176
+ "value": "attemptCount"
177
+ },
178
+ "arguments": [],
179
+ "directives": []
180
+ },
181
+ {
182
+ "kind": "Field",
183
+ "name": {
184
+ "kind": "Name",
185
+ "value": "refetch"
186
+ },
187
+ "arguments": [],
188
+ "directives": []
189
+ }
190
+ ]
191
+ }
192
+ }]
193
+ }
194
+ }]
195
+ };
196
+
197
+ // src/generated/documents/wspace/WorkflowRunsLiveDocument.ts
198
+ const WorkflowRunsLiveDocument = {
199
+ "kind": "Document",
200
+ "definitions": [{
201
+ "kind": "OperationDefinition",
202
+ "operation": "subscription",
203
+ "name": {
204
+ "kind": "Name",
205
+ "value": "WorkflowRunsLive"
206
+ },
207
+ "variableDefinitions": [{
208
+ "kind": "VariableDefinition",
209
+ "variable": {
210
+ "kind": "Variable",
211
+ "name": {
212
+ "kind": "Name",
213
+ "value": "workflowKey"
214
+ }
215
+ },
216
+ "type": {
217
+ "kind": "NamedType",
218
+ "name": {
219
+ "kind": "Name",
220
+ "value": "String"
221
+ }
222
+ },
223
+ "directives": []
224
+ }, {
225
+ "kind": "VariableDefinition",
226
+ "variable": {
227
+ "kind": "Variable",
228
+ "name": {
229
+ "kind": "Name",
230
+ "value": "includeNodeEvents"
231
+ }
232
+ },
233
+ "type": {
234
+ "kind": "NamedType",
235
+ "name": {
236
+ "kind": "Name",
237
+ "value": "Boolean"
238
+ }
239
+ },
240
+ "directives": []
241
+ }],
242
+ "directives": [],
243
+ "selectionSet": {
244
+ "kind": "SelectionSet",
245
+ "selections": [{
246
+ "kind": "Field",
247
+ "name": {
248
+ "kind": "Name",
249
+ "value": "workflowRunsLive"
250
+ },
251
+ "arguments": [{
252
+ "kind": "Argument",
253
+ "name": {
254
+ "kind": "Name",
255
+ "value": "workflowKey"
256
+ },
257
+ "value": {
258
+ "kind": "Variable",
259
+ "name": {
260
+ "kind": "Name",
261
+ "value": "workflowKey"
262
+ }
263
+ }
264
+ }, {
265
+ "kind": "Argument",
266
+ "name": {
267
+ "kind": "Name",
268
+ "value": "includeNodeEvents"
269
+ },
270
+ "value": {
271
+ "kind": "Variable",
272
+ "name": {
273
+ "kind": "Name",
274
+ "value": "includeNodeEvents"
275
+ }
276
+ }
277
+ }],
278
+ "directives": [],
279
+ "selectionSet": {
280
+ "kind": "SelectionSet",
281
+ "selections": [
282
+ {
283
+ "kind": "Field",
284
+ "name": {
285
+ "kind": "Name",
286
+ "value": "kind"
287
+ },
288
+ "arguments": [],
289
+ "directives": []
290
+ },
291
+ {
292
+ "kind": "Field",
293
+ "name": {
294
+ "kind": "Name",
295
+ "value": "at"
296
+ },
297
+ "arguments": [],
298
+ "directives": []
299
+ },
300
+ {
301
+ "kind": "Field",
302
+ "name": {
303
+ "kind": "Name",
304
+ "value": "runId"
305
+ },
306
+ "arguments": [],
307
+ "directives": []
308
+ },
309
+ {
310
+ "kind": "Field",
311
+ "name": {
312
+ "kind": "Name",
313
+ "value": "workflowKey"
314
+ },
315
+ "arguments": [],
316
+ "directives": []
317
+ },
318
+ {
319
+ "kind": "Field",
320
+ "name": {
321
+ "kind": "Name",
322
+ "value": "workflowId"
323
+ },
324
+ "arguments": [],
325
+ "directives": []
326
+ },
327
+ {
328
+ "kind": "Field",
329
+ "name": {
330
+ "kind": "Name",
331
+ "value": "runStatus"
332
+ },
333
+ "arguments": [],
334
+ "directives": []
335
+ },
336
+ {
337
+ "kind": "Field",
338
+ "name": {
339
+ "kind": "Name",
340
+ "value": "mode"
341
+ },
342
+ "arguments": [],
343
+ "directives": []
344
+ },
345
+ {
346
+ "kind": "Field",
347
+ "name": {
348
+ "kind": "Name",
349
+ "value": "parentRunId"
350
+ },
351
+ "arguments": [],
352
+ "directives": []
353
+ },
354
+ {
355
+ "kind": "Field",
356
+ "name": {
357
+ "kind": "Name",
358
+ "value": "nodeStateId"
359
+ },
360
+ "arguments": [],
361
+ "directives": []
362
+ },
363
+ {
364
+ "kind": "Field",
365
+ "name": {
366
+ "kind": "Name",
367
+ "value": "nodeId"
368
+ },
369
+ "arguments": [],
370
+ "directives": []
371
+ },
372
+ {
373
+ "kind": "Field",
374
+ "name": {
375
+ "kind": "Name",
376
+ "value": "nodeType"
377
+ },
378
+ "arguments": [],
379
+ "directives": []
380
+ },
381
+ {
382
+ "kind": "Field",
383
+ "name": {
384
+ "kind": "Name",
385
+ "value": "nodeStatus"
386
+ },
387
+ "arguments": [],
388
+ "directives": []
389
+ },
390
+ {
391
+ "kind": "Field",
392
+ "name": {
393
+ "kind": "Name",
394
+ "value": "attemptCount"
395
+ },
396
+ "arguments": [],
397
+ "directives": []
398
+ },
399
+ {
400
+ "kind": "Field",
401
+ "name": {
402
+ "kind": "Name",
403
+ "value": "refetch"
404
+ },
405
+ "arguments": [],
406
+ "directives": []
407
+ }
408
+ ]
409
+ }
410
+ }]
411
+ }
412
+ }]
413
+ };
414
+
415
+ // src/modules/executions/utils/run-live.ts
416
+ /**
417
+ * Live run updates (BOFF-9742): the pure rules behind the run page's and the
418
+ * Runs list's subscriptions to `workflowRunLive` and `workflowRunsLive`.
419
+ *
420
+ * The streams are an accelerator, never the only path to the data. They carry
421
+ * ids and statuses only, and no history, so the client follows three rules
422
+ * from the service contract:
423
+ *
424
+ * - refetch once after the first HEARTBEAT of every (re)subscription, so
425
+ * nothing written between the page's first read and the stream opening is
426
+ * missed;
427
+ * - refetch on RESYNC (the reader fell behind and events were dropped);
428
+ * - refetch on any event with `refetch: true` (it was reported after it was
429
+ * written and can be older than an event already received).
430
+ *
431
+ * Polling stops only while the stream is `live` (it has delivered and has not
432
+ * gone quiet for longer than the heartbeat allows). A stream that errors,
433
+ * completes, or stalls is `down` and polling resumes until a retry delivers
434
+ * again. UNAVAILABLE (the service's kill switch) and RESOURCE_EXHAUSTED are
435
+ * retried slowly; NOT_FOUND and permission errors are not retried at all.
436
+ */
437
+ /**
438
+ * Turn a delivered event into a {@link RunLiveEvent}. The generated enums are
439
+ * string enums whose values are exactly the SDK's unions, and a template
440
+ * literal of a string enum is the union of its values, so no cast is needed.
441
+ */
442
+ function toRunLiveEvent(raw) {
443
+ return {
444
+ kind: `${raw.kind}`,
445
+ at: raw.at,
446
+ runId: raw.runId,
447
+ workflowKey: raw.workflowKey,
448
+ workflowId: raw.workflowId,
449
+ runStatus: raw.runStatus === null ? null : `${raw.runStatus}`,
450
+ mode: raw.mode === null ? null : `${raw.mode}`,
451
+ parentRunId: raw.parentRunId,
452
+ nodeStateId: raw.nodeStateId,
453
+ nodeId: raw.nodeId,
454
+ nodeType: raw.nodeType,
455
+ nodeStatus: raw.nodeStatus === null ? null : `${raw.nodeStatus}`,
456
+ attemptCount: raw.attemptCount,
457
+ refetch: raw.refetch
458
+ };
459
+ }
460
+ const RUN_EVENTS = /* @__PURE__ */ new Set([
461
+ "RUN_CREATED",
462
+ "RUN_STATUS_CHANGED",
463
+ "RUN_FINISHED",
464
+ "RUN_DELETED"
465
+ ]);
466
+ const NODE_EVENTS = /* @__PURE__ */ new Set([
467
+ "NODE_STARTED",
468
+ "NODE_STATUS_CHANGED",
469
+ "NODE_FINISHED"
470
+ ]);
471
+ /** A run was created, changed status, ended or was deleted. */
472
+ function isRunEvent(event) {
473
+ return RUN_EVENTS.has(event.kind);
474
+ }
475
+ /** One of a run's nodes started, changed status or ended. */
476
+ function isNodeEvent(event) {
477
+ return NODE_EVENTS.has(event.kind);
478
+ }
479
+ const RUN_LIVE_IDLE = {
480
+ status: "off",
481
+ primed: false,
482
+ lastAt: null,
483
+ lastWasHeartbeat: false
484
+ };
485
+ /** The service sends a HEARTBEAT after this long without a delivery. */
486
+ const RUN_LIVE_HEARTBEAT_MS = 25e3;
487
+ /** A heartbeat follows the previous heartbeat's `at` within this slack. */
488
+ const RUN_LIVE_HEARTBEAT_AFTER_HEARTBEAT_MS = 1e3;
489
+ /**
490
+ * A heartbeat follows a change's `at` (when it was written) within this
491
+ * slack: the time the change took to reach the stream.
492
+ */
493
+ const RUN_LIVE_HEARTBEAT_AFTER_CHANGE_MS = 3e3;
494
+ /**
495
+ * Whether a HEARTBEAT on a primed stream is the periodic one rather than the
496
+ * opening signal of a new server-side stream.
497
+ *
498
+ * The SSE link reconnects a dropped connection by itself and re-issues the
499
+ * subscription without telling Apollo, and the service opens every stream
500
+ * with a HEARTBEAT; events written during the gap are only in the database.
501
+ * The service stamps a periodic heartbeat exactly one interval after its
502
+ * previous delivery, in its own clock, so the gap between the two `at`
503
+ * values tells them apart: a reopened stream's heartbeat carries its opening
504
+ * time, which matches that gap only by a sub-second coincidence. Anything
505
+ * else (an unparseable time, a late event's old `at`, a changed interval)
506
+ * counts as an opening, which costs one extra refetch and never a lost event.
507
+ */
508
+ function isPeriodicHeartbeat(gapMs, afterHeartbeat) {
509
+ if (!Number.isFinite(gapMs)) return false;
510
+ return gapMs >= 24500 && gapMs <= 25e3 + (afterHeartbeat ? 1e3 : 3e3);
511
+ }
512
+ /**
513
+ * The stream's health after one signal, and whether the contract requires a
514
+ * refetch. Pure: every timer and transport concern stays in the follower.
515
+ */
516
+ function reduceRunLiveStream(state, signal) {
517
+ switch (signal.type) {
518
+ case "subscribe": return {
519
+ state: {
520
+ ...RUN_LIVE_IDLE,
521
+ status: "connecting"
522
+ },
523
+ mustRefetch: false
524
+ };
525
+ case "failed": return {
526
+ state: {
527
+ ...RUN_LIVE_IDLE,
528
+ status: "down"
529
+ },
530
+ mustRefetch: false
531
+ };
532
+ case "stopped": return {
533
+ state: RUN_LIVE_IDLE,
534
+ mustRefetch: false
535
+ };
536
+ case "event": {
537
+ const { event } = signal;
538
+ const at = Date.parse(event.at);
539
+ const heartbeat = event.kind === "HEARTBEAT";
540
+ const reopened = heartbeat && (state.lastAt === null || !isPeriodicHeartbeat(at - state.lastAt, state.lastWasHeartbeat));
541
+ const mustRefetch = !state.primed || reopened || event.kind === "RESYNC" || event.refetch;
542
+ return {
543
+ state: {
544
+ status: "live",
545
+ primed: true,
546
+ lastAt: Number.isFinite(at) ? at : null,
547
+ lastWasHeartbeat: heartbeat
548
+ },
549
+ mustRefetch
550
+ };
551
+ }
552
+ }
553
+ }
554
+ /** Polling runs unless the stream is delivering. */
555
+ function shouldPoll(status) {
556
+ return status !== "live";
557
+ }
558
+ /**
559
+ * The service sends a HEARTBEAT every 25 s of silence. Two missed heartbeats
560
+ * plus slack means the stream is stuck (a proxy holding the response open, a
561
+ * socket that died without closing): fall back to polling and resubscribe.
562
+ */
563
+ const RUN_LIVE_STALL_MS = 6e4;
564
+ /** Retry delays after a stream fails: 15 s doubling to at most 5 min. */
565
+ const RUN_LIVE_RETRY_BASE_MS = 15e3;
566
+ const RUN_LIVE_RETRY_MAX_MS = 3e5;
567
+ function runLiveRetryDelay(attempt) {
568
+ return Math.min(RUN_LIVE_RETRY_BASE_MS * 2 ** Math.max(0, Math.min(attempt, 10)), RUN_LIVE_RETRY_MAX_MS);
569
+ }
570
+ /** Codes that will not change by retrying: the run is gone or not readable. */
571
+ const PERMANENT_CODES = /* @__PURE__ */ new Set([
572
+ "NOT_FOUND",
573
+ "FORBIDDEN",
574
+ "UNAUTHENTICATED",
575
+ "BAD_USER_INPUT",
576
+ "GRAPHQL_VALIDATION_FAILED"
577
+ ]);
578
+ /** The GraphQL error code a failed subscription answered with, if any. */
579
+ function runLiveErrorCode(error) {
580
+ if (!CombinedGraphQLErrors.is(error)) return null;
581
+ const code = error.errors[0]?.extensions?.code;
582
+ return typeof code === "string" ? code : null;
583
+ }
584
+ /**
585
+ * Whether a failed stream is worth resubscribing to later. Transport failures
586
+ * and UNAVAILABLE (the kill switch) or RESOURCE_EXHAUSTED (too many streams)
587
+ * are; a refusal about the run or the caller is not.
588
+ */
589
+ function isRetryableRunLiveError(error) {
590
+ const code = runLiveErrorCode(error);
591
+ return code === null || !PERMANENT_CODES.has(code);
592
+ }
593
+ const REAL_TIMERS = {
594
+ setTimeout: (fn, ms) => globalThis.setTimeout(fn, ms),
595
+ clearTimeout: (handle) => {
596
+ globalThis.clearTimeout(handle);
597
+ }
598
+ };
599
+ /**
600
+ * At most one call of `run` per `windowMs`. The first request of a quiet
601
+ * period runs at once (the leading edge keeps a lone status change instant);
602
+ * every request inside the window collapses into one trailing call.
603
+ */
604
+ function createRefetchCoalescer(run, windowMs, timers = REAL_TIMERS) {
605
+ let timer = null;
606
+ let pending = false;
607
+ let cancelled = false;
608
+ const openWindow = () => {
609
+ timer = timers.setTimeout(() => {
610
+ timer = null;
611
+ if (cancelled || !pending) return;
612
+ pending = false;
613
+ run();
614
+ openWindow();
615
+ }, windowMs);
616
+ };
617
+ return {
618
+ request: () => {
619
+ if (cancelled) return;
620
+ if (timer !== null) {
621
+ pending = true;
622
+ return;
623
+ }
624
+ run();
625
+ openWindow();
626
+ },
627
+ flush: () => {
628
+ if (cancelled) return;
629
+ if (timer !== null) timers.clearTimeout(timer);
630
+ timer = null;
631
+ pending = false;
632
+ run();
633
+ openWindow();
634
+ },
635
+ drop: () => {
636
+ pending = false;
637
+ if (timer !== null) timers.clearTimeout(timer);
638
+ timer = null;
639
+ },
640
+ cancel: () => {
641
+ cancelled = true;
642
+ pending = false;
643
+ if (timer !== null) timers.clearTimeout(timer);
644
+ timer = null;
645
+ }
646
+ };
647
+ }
648
+ /**
649
+ * While the stream is live the page does not poll, so a read the stream asked
650
+ * for that fails (a gateway blip) would leave the page stale until the next
651
+ * change. This repeats a failed read every `retryMs` until one succeeds; a
652
+ * newer read replaces a pending retry.
653
+ */
654
+ function createRetryingRead(read, retryMs, timers = REAL_TIMERS, maxAttempts = Number.POSITIVE_INFINITY) {
655
+ let timer = null;
656
+ let latest = 0;
657
+ let cancelled = false;
658
+ let failures = 0;
659
+ const clear = () => {
660
+ if (timer !== null) timers.clearTimeout(timer);
661
+ timer = null;
662
+ };
663
+ const run = () => {
664
+ if (cancelled) return;
665
+ clear();
666
+ const ticket = ++latest;
667
+ let outcome;
668
+ try {
669
+ outcome = read();
670
+ } catch {
671
+ outcome = Promise.resolve(false);
672
+ }
673
+ outcome.catch(() => false).then((ok) => {
674
+ if (cancelled || ticket !== latest) return;
675
+ if (ok) {
676
+ failures = 0;
677
+ return;
678
+ }
679
+ failures += 1;
680
+ if (failures >= maxAttempts) return;
681
+ timer = timers.setTimeout(() => {
682
+ timer = null;
683
+ run();
684
+ }, retryMs);
685
+ });
686
+ };
687
+ return {
688
+ run,
689
+ cancel: () => {
690
+ cancelled = true;
691
+ clear();
692
+ }
693
+ };
694
+ }
695
+ /** The run page retries a failed live read this often (its poll interval). */
696
+ const RUN_PAGE_READ_RETRY_MS = 2e3;
697
+ /** The Runs list retries a failed live read this often (its poll interval). */
698
+ const RUNS_LIST_READ_RETRY_MS = 5e3;
699
+ /**
700
+ * The follower reopens its own subscription this often, well inside the
701
+ * gateway's 30-minute stream deadline, so a planned cut never becomes a
702
+ * silent transport reconnect.
703
+ */
704
+ const RUN_LIVE_RENEW_MS = 12e5;
705
+ /**
706
+ * The run page applies statuses in place at once, so its full re-read (times,
707
+ * outputs, progress) can wait a little longer between bursts.
708
+ */
709
+ const RUN_PAGE_REFETCH_WINDOW_MS = 1e3;
710
+ const TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set([
711
+ "COMPLETED",
712
+ "FAILED",
713
+ "CANCELLED",
714
+ "TERMINATED"
715
+ ]);
716
+ /**
717
+ * The run with one event applied in place: the run's status from a run
718
+ * event, a node's status and attempt from a node event about a node state the
719
+ * page already holds. Anything else (a new node state, a late event) is left
720
+ * to the refetch. Returns the same object when nothing changed.
721
+ */
722
+ function applyRunLiveEvent(run, event) {
723
+ if (event.runId !== run.id || event.refetch) return run;
724
+ if (isRunEvent(event)) {
725
+ if (!event.runStatus || event.runStatus === run.status) return run;
726
+ if (TERMINAL_RUN_STATUSES.has(run.status) && event.kind !== "RUN_FINISHED") return run;
727
+ return {
728
+ ...run,
729
+ status: event.runStatus
730
+ };
731
+ }
732
+ if (isNodeEvent(event) && event.nodeStateId && event.nodeStatus) {
733
+ const nodeStates = run.nodeStates;
734
+ if (!nodeStates) return run;
735
+ const index = nodeStates.findIndex((node) => node.id === event.nodeStateId);
736
+ if (index < 0) return run;
737
+ const node = nodeStates[index];
738
+ const attemptCount = event.attemptCount ?? node.attemptCount;
739
+ if (node.status === event.nodeStatus && node.attemptCount === attemptCount) return run;
740
+ const next = nodeStates.slice();
741
+ next[index] = {
742
+ ...node,
743
+ status: event.nodeStatus,
744
+ attemptCount
745
+ };
746
+ return {
747
+ ...run,
748
+ nodeStates: next
749
+ };
750
+ }
751
+ return run;
752
+ }
753
+ /**
754
+ * How the run page re-reads after an event: `now` for the contract's refetch
755
+ * rules and for the run ending (the page stops listening right after), `soon`
756
+ * (coalesced) for any other change of this run, `none` for heartbeats.
757
+ */
758
+ function runPageRefetch(event, mustRefetch) {
759
+ if (mustRefetch || event.kind === "RUN_FINISHED") return "now";
760
+ if (isRunEvent(event) || isNodeEvent(event)) return "soon";
761
+ return "none";
762
+ }
763
+ /**
764
+ * Whether the reads that hang off the run (its asks to people, the action
765
+ * policy decisions, its child runs and their statuses) need a re-read: on the
766
+ * contract's refetch rules and on any change of the run or its nodes. They are
767
+ * coalesced on their own, longer window ({@link RUN_PAGE_SIDE_READS_WINDOW_MS}).
768
+ */
769
+ function runPageSideReads(event, mustRefetch) {
770
+ return mustRefetch || isRunEvent(event) || isNodeEvent(event);
771
+ }
772
+ /** The asks, decisions and child runs are re-read at most this often. */
773
+ const RUN_PAGE_SIDE_READS_WINDOW_MS = 2e3;
774
+ function runsListRefresh(event, mustRefetch, shownRunIds, workflowKey) {
775
+ if (mustRefetch) return "all";
776
+ if (isRunEvent(event)) return !workflowKey || !event.workflowKey || event.workflowKey === workflowKey ? "all" : "workspace-stats";
777
+ if (isNodeEvent(event)) return event.runId && shownRunIds.has(event.runId) ? "all" : "none";
778
+ return "none";
779
+ }
780
+
781
+ // src/modules/executions/hooks/useRunLive.ts
782
+ /**
783
+ * Live run updates (BOFF-9742) for the run page and the Runs list.
784
+ *
785
+ * `workflowRunLive(runId)` and `workflowRunsLive(workflowKey, includeNodeEvents)`
786
+ * travel exactly like `runLogAppended` and `agentTokenDelta`: through the
787
+ * host's Apollo client and whatever subscription link it carries (GraphQL over
788
+ * WebSocket or SSE to the workspace gateway). The rules (when to refetch, when
789
+ * polling stops and resumes) live in `../utils/run-live.ts`; this file only
790
+ * wires them to a client and to React.
791
+ *
792
+ * Each `follow*` function opens the subscription and returns the function that
793
+ * closes it, so a component's effect is a single `return follow…(…)`.
794
+ */
795
+ function subscribeTo(client, request, observer) {
796
+ if (request.kind === "run") return client.subscribe({
797
+ query: WorkflowRunLiveDocument,
798
+ variables: { runId: request.runId },
799
+ fetchPolicy: "no-cache"
800
+ }).subscribe(observer);
801
+ return client.subscribe({
802
+ query: WorkflowRunsLiveDocument,
803
+ variables: {
804
+ workflowKey: request.workflowKey,
805
+ includeNodeEvents: request.includeNodeEvents
806
+ },
807
+ fetchPolicy: "no-cache"
808
+ }).subscribe(observer);
809
+ }
810
+ function eventOf(result) {
811
+ const data = result.data;
812
+ if (!data) return null;
813
+ if ("workflowRunLive" in data) return data.workflowRunLive;
814
+ if ("workflowRunsLive" in data) return data.workflowRunsLive;
815
+ return null;
816
+ }
817
+ /**
818
+ * Follow one live stream, with its health, stall detection and retries.
819
+ *
820
+ * Apollo Client 4 delivers a failed subscription as a result carrying
821
+ * `error` and then completes, so both paths end the attempt. A failed,
822
+ * completed or silent stream reports `down` (the caller polls) and, unless
823
+ * the refusal is permanent (NOT_FOUND, a permission error), is opened again
824
+ * after {@link runLiveRetryDelay}. The stream is also reopened every
825
+ * {@link RUN_LIVE_RENEW_MS}, ahead of the gateway's stream deadline. Every
826
+ * reopening starts unprimed, so its first HEARTBEAT asks for a refetch again;
827
+ * so does a HEARTBEAT that opens a stream the SSE link reconnected on its own
828
+ * (see `isPeriodicHeartbeat`).
829
+ */
830
+ function followRunLive(client, request, { onStatus, onEvent }, timers = REAL_TIMERS) {
831
+ let state = RUN_LIVE_IDLE;
832
+ let stopped = false;
833
+ let current = null;
834
+ let stallTimer = null;
835
+ let renewTimer = null;
836
+ let retryTimer = null;
837
+ let failures = 0;
838
+ /** The current attempt; callbacks of any earlier attempt are ignored. */
839
+ let attempt = 0;
840
+ const signal = (input) => {
841
+ const step = reduceRunLiveStream(state, input);
842
+ const changed = step.state.status !== state.status;
843
+ state = step.state;
844
+ if (changed) onStatus(state.status);
845
+ return step.mustRefetch;
846
+ };
847
+ const clearTimer = (timer) => {
848
+ if (timer !== null) timers.clearTimeout(timer);
849
+ return null;
850
+ };
851
+ const close = () => {
852
+ attempt += 1;
853
+ stallTimer = clearTimer(stallTimer);
854
+ renewTimer = clearTimer(renewTimer);
855
+ const subscription = current;
856
+ current = null;
857
+ subscription?.unsubscribe();
858
+ };
859
+ const fail = (retryable) => {
860
+ close();
861
+ signal({ type: "failed" });
862
+ if (!retryable || stopped) return;
863
+ retryTimer = timers.setTimeout(() => {
864
+ retryTimer = null;
865
+ open();
866
+ }, runLiveRetryDelay(failures));
867
+ failures += 1;
868
+ };
869
+ const armStall = () => {
870
+ stallTimer = clearTimer(stallTimer);
871
+ stallTimer = timers.setTimeout(() => {
872
+ stallTimer = null;
873
+ if (!stopped) fail(true);
874
+ }, RUN_LIVE_STALL_MS);
875
+ };
876
+ function open() {
877
+ if (stopped) return;
878
+ close();
879
+ const id = attempt;
880
+ const isCurrent = () => !stopped && id === attempt;
881
+ const end = (retryable) => {
882
+ if (isCurrent()) fail(retryable);
883
+ };
884
+ signal({ type: "subscribe" });
885
+ armStall();
886
+ renewTimer = timers.setTimeout(() => {
887
+ renewTimer = null;
888
+ if (isCurrent()) open();
889
+ }, RUN_LIVE_RENEW_MS);
890
+ const subscription = subscribeTo(client, request, {
891
+ next: (result) => {
892
+ if (!isCurrent()) return;
893
+ if (result.error) {
894
+ end(isRetryableRunLiveError(result.error));
895
+ return;
896
+ }
897
+ const raw = eventOf(result);
898
+ if (!raw) return;
899
+ failures = 0;
900
+ armStall();
901
+ const event = toRunLiveEvent(raw);
902
+ onEvent(event, signal({
903
+ type: "event",
904
+ event
905
+ }));
906
+ },
907
+ error: (error) => end(isRetryableRunLiveError(error)),
908
+ complete: () => end(true)
909
+ });
910
+ if (isCurrent()) current = subscription;
911
+ else subscription.unsubscribe();
912
+ }
913
+ open();
914
+ return () => {
915
+ stopped = true;
916
+ retryTimer = clearTimer(retryTimer);
917
+ close();
918
+ signal({ type: "stopped" });
919
+ };
920
+ }
921
+ /**
922
+ * The run page's stream: every event is applied in place at once, then the
923
+ * run is re-read (coalesced to one read per {@link RUN_PAGE_REFETCH_WINDOW_MS},
924
+ * immediately for the contract's refetch rules and for the run ending).
925
+ */
926
+ function followRunPage(client, runId, handlers, timers = REAL_TIMERS) {
927
+ const read = createRetryingRead(() => handlers.refetch(), RUN_PAGE_READ_RETRY_MS, timers);
928
+ const run = createRefetchCoalescer(read.run, RUN_PAGE_REFETCH_WINDOW_MS, timers);
929
+ const sideRead = createRetryingRead(() => handlers.refreshSideReads(), RUN_PAGE_READ_RETRY_MS, timers);
930
+ const side = createRefetchCoalescer(sideRead.run, RUN_PAGE_SIDE_READS_WINDOW_MS, timers);
931
+ const stop = followRunLive(client, {
932
+ kind: "run",
933
+ runId
934
+ }, {
935
+ onStatus: handlers.onStatus,
936
+ onEvent: (event, mustRefetch) => {
937
+ handlers.patch(event);
938
+ const how = runPageRefetch(event, mustRefetch);
939
+ if (event.kind === "RUN_FINISHED") {
940
+ run.drop();
941
+ side.drop();
942
+ for (const last of [handlers.refetch, handlers.refreshSideReads]) createRetryingRead(() => last(), RUN_PAGE_READ_RETRY_MS, timers, 5).run();
943
+ return;
944
+ }
945
+ if (how === "now") {
946
+ run.flush();
947
+ side.flush();
948
+ return;
949
+ }
950
+ if (how === "soon") run.request();
951
+ if (runPageSideReads(event, mustRefetch)) side.request();
952
+ }
953
+ }, timers);
954
+ return () => {
955
+ stop();
956
+ run.cancel();
957
+ side.cancel();
958
+ read.cancel();
959
+ sideRead.cancel();
960
+ };
961
+ }
962
+ /**
963
+ * Subscribe the run page to `workflowRunLive` while `enabled`. Returns the
964
+ * stream's health; the page polls unless it is `live`.
965
+ */
966
+ function useRunPageLive(runId, { enabled, patch, refetch, refreshSideReads }) {
967
+ const [status, setStatus] = useState("off");
968
+ const latest = useRef({
969
+ patch,
970
+ refetch,
971
+ refreshSideReads
972
+ });
973
+ useEffect(() => {
974
+ latest.current = {
975
+ patch,
976
+ refetch,
977
+ refreshSideReads
978
+ };
979
+ });
980
+ useEffect(() => {
981
+ const client = getFluidGridsClientSafe();
982
+ if (!runId || !enabled || !client) return void 0;
983
+ return followRunPage(client, runId, {
984
+ onStatus: setStatus,
985
+ patch: (event) => latest.current.patch(event),
986
+ refetch: () => latest.current.refetch(),
987
+ refreshSideReads: () => latest.current.refreshSideReads()
988
+ });
989
+ }, [runId, enabled]);
990
+ return runId && enabled ? status : "off";
991
+ }
992
+ /**
993
+ * The Runs list's stream. It follows the whole workspace even when the list is
994
+ * filtered to one workflow, because the workspace-wide stat numbers stay on
995
+ * screen and polling is off while the stream delivers; `runsListRefresh`
996
+ * decides what each event re-reads. Node events are included so a shown
997
+ * run's progress moves. Re-reads are coalesced to one per
998
+ * {@link RUNS_LIST_REFETCH_WINDOW_MS} and retried until they answer.
999
+ */
1000
+ function followRunsList(client, handlers, timers = REAL_TIMERS) {
1001
+ const readAll = createRetryingRead(() => handlers.refetch(), RUNS_LIST_READ_RETRY_MS, timers);
1002
+ const readStats = createRetryingRead(() => handlers.refetchWorkspaceStats(), RUNS_LIST_READ_RETRY_MS, timers);
1003
+ const all = createRefetchCoalescer(readAll.run, 500, timers);
1004
+ const stats = createRefetchCoalescer(readStats.run, 500, timers);
1005
+ const stop = followRunLive(client, {
1006
+ kind: "runs",
1007
+ workflowKey: null,
1008
+ includeNodeEvents: true
1009
+ }, {
1010
+ onStatus: handlers.onStatus,
1011
+ onEvent: (event, mustRefetch) => {
1012
+ const refresh = runsListRefresh(event, mustRefetch, handlers.shownRunIds(), handlers.workflowKey());
1013
+ if (refresh === "all") all.request();
1014
+ else if (refresh === "workspace-stats") stats.request();
1015
+ }
1016
+ }, timers);
1017
+ return () => {
1018
+ stop();
1019
+ all.cancel();
1020
+ stats.cancel();
1021
+ readAll.cancel();
1022
+ readStats.cancel();
1023
+ };
1024
+ }
1025
+ /**
1026
+ * Subscribe the Runs list to `workflowRunsLive` while `enabled`. Returns the
1027
+ * stream's health; the list polls unless it is `live`. A change of the
1028
+ * workflow filter changes what events re-read, not the subscription.
1029
+ */
1030
+ function useRunsListLive({ enabled, workflowKey, refetch, refetchWorkspaceStats, shownRunIds }) {
1031
+ const [status, setStatus] = useState("off");
1032
+ const latest = useRef({
1033
+ refetch,
1034
+ refetchWorkspaceStats,
1035
+ shownRunIds,
1036
+ workflowKey: workflowKey || null
1037
+ });
1038
+ useEffect(() => {
1039
+ latest.current = {
1040
+ refetch,
1041
+ refetchWorkspaceStats,
1042
+ shownRunIds,
1043
+ workflowKey: workflowKey || null
1044
+ };
1045
+ });
1046
+ useEffect(() => {
1047
+ const client = getFluidGridsClientSafe();
1048
+ if (!enabled || !client) return void 0;
1049
+ return followRunsList(client, {
1050
+ onStatus: setStatus,
1051
+ refetch: () => latest.current.refetch(),
1052
+ refetchWorkspaceStats: () => latest.current.refetchWorkspaceStats(),
1053
+ shownRunIds: () => latest.current.shownRunIds,
1054
+ workflowKey: () => latest.current.workflowKey
1055
+ });
1056
+ }, [enabled]);
1057
+ return enabled ? status : "off";
1058
+ }
1059
+
1060
+ export { applyRunLiveEvent as a, isNodeEvent as c, WorkflowRunsLiveDocument as d, WorkflowRunLiveDocument as f, REAL_TIMERS as i, runPageRefetch as l, useRunPageLive as n, createRefetchCoalescer as o, useRunsListLive as r, createRetryingRead as s, followRunLive as t, shouldPoll as u };