@arbidocs/blocks 0.5.194 → 0.5.196

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 (266) hide show
  1. package/dist/{ConnectedCallDock-7GGYYQNK.cjs → ConnectedCallDock-RRTYZERC.cjs} +29 -29
  2. package/dist/{ConnectedCallDock-7GGYYQNK.cjs.map → ConnectedCallDock-RRTYZERC.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs → ConnectedCallRoom-HFVIMBCN.cjs} +22 -22
  4. package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs.map → ConnectedCallRoom-HFVIMBCN.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs → ConnectedNativeDocxComparison-FSJQITYC.cjs} +18 -18
  6. package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs.map → ConnectedNativeDocxComparison-FSJQITYC.cjs.map} +1 -1
  7. package/dist/{ConnectedPresentation-LNDESKYE.cjs → ConnectedPresentation-ZRCLFY43.cjs} +21 -21
  8. package/dist/{ConnectedPresentation-LNDESKYE.cjs.map → ConnectedPresentation-ZRCLFY43.cjs.map} +1 -1
  9. package/dist/{ConnectedProductionSetDialog-SHDI7KP6.cjs → ConnectedProductionSetDialog-KT6BPSRE.cjs} +6 -6
  10. package/dist/{ConnectedProductionSetDialog-SHDI7KP6.cjs.map → ConnectedProductionSetDialog-KT6BPSRE.cjs.map} +1 -1
  11. package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs → ConnectedSlidesTab-WCPQJZ3S.cjs} +18 -18
  12. package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs.map → ConnectedSlidesTab-WCPQJZ3S.cjs.map} +1 -1
  13. package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs → ConnectedStreamedWordArtifact-PJTPIXJU.cjs} +18 -18
  14. package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs.map → ConnectedStreamedWordArtifact-PJTPIXJU.cjs.map} +1 -1
  15. package/dist/{DocumentReviewCard-Q3NKJLSM.cjs → DocumentReviewCard-5LGKZ3QM.cjs} +20 -20
  16. package/dist/{DocumentReviewCard-Q3NKJLSM.cjs.map → DocumentReviewCard-5LGKZ3QM.cjs.map} +1 -1
  17. package/dist/{FilesViewerDialog-W2HPT3JS.cjs → FilesViewerDialog-GICV5UY6.cjs} +53 -51
  18. package/dist/FilesViewerDialog-GICV5UY6.cjs.map +1 -0
  19. package/dist/{WorkspaceTableView-QT63XYII.cjs → WorkspaceTableView-FEP7EXL4.cjs} +11 -11
  20. package/dist/{WorkspaceTableView-QT63XYII.cjs.map → WorkspaceTableView-FEP7EXL4.cjs.map} +1 -1
  21. package/dist/agents/index.cjs +429 -413
  22. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +3 -1
  23. package/dist/agents/tasks/WorkflowThreadStrip.js +29 -0
  24. package/dist/agents/tasks/WorkflowThreadStrip.js.map +2 -2
  25. package/dist/agents/workflows/StepBarFrame.d.ts +11 -1
  26. package/dist/agents/workflows/StepBarFrame.js +40 -2
  27. package/dist/agents/workflows/StepBarFrame.js.map +2 -2
  28. package/dist/agents/workflows/WorkflowOverview.d.ts +78 -0
  29. package/dist/agents/workflows/WorkflowOverview.js +150 -0
  30. package/dist/agents/workflows/WorkflowOverview.js.map +7 -0
  31. package/dist/agents/workflows/WorkflowRunner.d.ts +2 -0
  32. package/dist/agents/workflows/WorkflowRunner.js +22 -0
  33. package/dist/agents/workflows/WorkflowRunner.js.map +2 -2
  34. package/dist/agents/workflows/WorkflowStepBar.d.ts +5 -1
  35. package/dist/agents/workflows/WorkflowStepBar.js +33 -1
  36. package/dist/agents/workflows/WorkflowStepBar.js.map +2 -2
  37. package/dist/agents/workflows/index.d.ts +1 -0
  38. package/dist/agents/workflows/index.js +10 -0
  39. package/dist/agents/workflows/index.js.map +2 -2
  40. package/dist/agents/workflows/planSteps.js +21 -4
  41. package/dist/agents/workflows/planSteps.js.map +2 -2
  42. package/dist/agents/workflows/run.js +2 -1
  43. package/dist/agents/workflows/run.js.map +2 -2
  44. package/dist/agents/workflows/suggest.d.ts +15 -0
  45. package/dist/agents/workflows/suggest.js +51 -0
  46. package/dist/agents/workflows/suggest.js.map +7 -0
  47. package/dist/agents/workflows/types.d.ts +27 -2
  48. package/dist/agents/workflows/types.js.map +1 -1
  49. package/dist/{ai-A5YTWIEC.cjs → ai-BCZZFQUB.cjs} +31 -31
  50. package/dist/ai-BCZZFQUB.cjs.map +1 -0
  51. package/dist/auth/index.cjs +12 -12
  52. package/dist/calls/index.cjs +125 -125
  53. package/dist/chat/index.cjs +77 -77
  54. package/dist/{chunk-KD37PODE.cjs → chunk-2ET34WD5.cjs} +5 -5
  55. package/dist/{chunk-KD37PODE.cjs.map → chunk-2ET34WD5.cjs.map} +1 -1
  56. package/dist/{chunk-XYN3RP5W.cjs → chunk-2FBWSMAX.cjs} +26 -8
  57. package/dist/chunk-2FBWSMAX.cjs.map +1 -0
  58. package/dist/{chunk-LYDSETR7.cjs → chunk-33VS7HH4.cjs} +11 -228
  59. package/dist/chunk-33VS7HH4.cjs.map +1 -0
  60. package/dist/{chunk-5OD6DRG7.cjs → chunk-3P6KGC46.cjs} +3 -3
  61. package/dist/{chunk-5OD6DRG7.cjs.map → chunk-3P6KGC46.cjs.map} +1 -1
  62. package/dist/{chunk-AZUPMHZI.cjs → chunk-3U6XE7SF.cjs} +4 -4
  63. package/dist/{chunk-AZUPMHZI.cjs.map → chunk-3U6XE7SF.cjs.map} +1 -1
  64. package/dist/{chunk-PIJPM5RA.cjs → chunk-3YGSCNXQ.cjs} +6 -6
  65. package/dist/{chunk-PIJPM5RA.cjs.map → chunk-3YGSCNXQ.cjs.map} +1 -1
  66. package/dist/{chunk-J46Y2L26.cjs → chunk-6CJBNRKW.cjs} +4 -4
  67. package/dist/{chunk-J46Y2L26.cjs.map → chunk-6CJBNRKW.cjs.map} +1 -1
  68. package/dist/{chunk-JEUHT7XH.cjs → chunk-6CXTLIGJ.cjs} +6 -6
  69. package/dist/{chunk-JEUHT7XH.cjs.map → chunk-6CXTLIGJ.cjs.map} +1 -1
  70. package/dist/{chunk-HS7TUDEM.cjs → chunk-6HP6SQWC.cjs} +7 -7
  71. package/dist/{chunk-HS7TUDEM.cjs.map → chunk-6HP6SQWC.cjs.map} +1 -1
  72. package/dist/{chunk-VDHBLDQC.cjs → chunk-6N7QT2DH.cjs} +3 -3
  73. package/dist/{chunk-VDHBLDQC.cjs.map → chunk-6N7QT2DH.cjs.map} +1 -1
  74. package/dist/{chunk-VDT7TEAH.cjs → chunk-6ZJBUMNK.cjs} +3 -3
  75. package/dist/{chunk-VDT7TEAH.cjs.map → chunk-6ZJBUMNK.cjs.map} +1 -1
  76. package/dist/{chunk-VJHDCYKE.cjs → chunk-AZHIZRHN.cjs} +13 -13
  77. package/dist/{chunk-VJHDCYKE.cjs.map → chunk-AZHIZRHN.cjs.map} +1 -1
  78. package/dist/{chunk-JSP3WTFF.cjs → chunk-BCVC6PG5.cjs} +114 -114
  79. package/dist/{chunk-JSP3WTFF.cjs.map → chunk-BCVC6PG5.cjs.map} +1 -1
  80. package/dist/{chunk-QDIIOZBP.cjs → chunk-BR3XQ45B.cjs} +446 -147
  81. package/dist/chunk-BR3XQ45B.cjs.map +1 -0
  82. package/dist/{chunk-RNQ3MDTR.cjs → chunk-BXHPV6QF.cjs} +9 -9
  83. package/dist/{chunk-RNQ3MDTR.cjs.map → chunk-BXHPV6QF.cjs.map} +1 -1
  84. package/dist/{chunk-EAH7LFJN.cjs → chunk-CUYELFKB.cjs} +4 -4
  85. package/dist/{chunk-EAH7LFJN.cjs.map → chunk-CUYELFKB.cjs.map} +1 -1
  86. package/dist/{chunk-3EIO4ZH5.cjs → chunk-CZOHXTHJ.cjs} +6 -6
  87. package/dist/{chunk-3EIO4ZH5.cjs.map → chunk-CZOHXTHJ.cjs.map} +1 -1
  88. package/dist/{chunk-XQPJWPWE.cjs → chunk-DJ7LSKBJ.cjs} +3 -3
  89. package/dist/{chunk-XQPJWPWE.cjs.map → chunk-DJ7LSKBJ.cjs.map} +1 -1
  90. package/dist/{chunk-5RUY5THD.cjs → chunk-DRQB5V5C.cjs} +8 -8
  91. package/dist/{chunk-5RUY5THD.cjs.map → chunk-DRQB5V5C.cjs.map} +1 -1
  92. package/dist/chunk-EEKY7VO3.cjs +58 -0
  93. package/dist/chunk-EEKY7VO3.cjs.map +1 -0
  94. package/dist/{chunk-Y3GJBLAI.cjs → chunk-FSTIAEJW.cjs} +10 -9
  95. package/dist/chunk-FSTIAEJW.cjs.map +1 -0
  96. package/dist/{chunk-GWWX3FZ7.cjs → chunk-G3SWFSPS.cjs} +69 -69
  97. package/dist/chunk-G3SWFSPS.cjs.map +1 -0
  98. package/dist/{chunk-633ZCYVN.cjs → chunk-GEVBY536.cjs} +37 -37
  99. package/dist/{chunk-633ZCYVN.cjs.map → chunk-GEVBY536.cjs.map} +1 -1
  100. package/dist/{chunk-EFV52SZ6.cjs → chunk-GY4T4JSC.cjs} +4 -4
  101. package/dist/{chunk-EFV52SZ6.cjs.map → chunk-GY4T4JSC.cjs.map} +1 -1
  102. package/dist/{chunk-HO2AURAQ.cjs → chunk-H4ZKASMT.cjs} +6 -6
  103. package/dist/{chunk-HO2AURAQ.cjs.map → chunk-H4ZKASMT.cjs.map} +1 -1
  104. package/dist/chunk-HYYYXHBK.cjs +393 -0
  105. package/dist/chunk-HYYYXHBK.cjs.map +1 -0
  106. package/dist/{chunk-HH5MKRBL.cjs → chunk-ICZBM35E.cjs} +10 -10
  107. package/dist/{chunk-HH5MKRBL.cjs.map → chunk-ICZBM35E.cjs.map} +1 -1
  108. package/dist/{chunk-GZPNBSRE.cjs → chunk-IIAJVC3L.cjs} +22 -22
  109. package/dist/{chunk-GZPNBSRE.cjs.map → chunk-IIAJVC3L.cjs.map} +1 -1
  110. package/dist/{chunk-ER2MRSLT.cjs → chunk-IRVSCMRW.cjs} +16 -16
  111. package/dist/{chunk-ER2MRSLT.cjs.map → chunk-IRVSCMRW.cjs.map} +1 -1
  112. package/dist/{chunk-7GVKG3G4.cjs → chunk-ISPDSFVM.cjs} +17 -17
  113. package/dist/{chunk-7GVKG3G4.cjs.map → chunk-ISPDSFVM.cjs.map} +1 -1
  114. package/dist/{chunk-KQJUY2OE.cjs → chunk-JGU6YLIA.cjs} +11 -11
  115. package/dist/{chunk-KQJUY2OE.cjs.map → chunk-JGU6YLIA.cjs.map} +1 -1
  116. package/dist/chunk-JOQDJRV2.cjs +25 -0
  117. package/dist/chunk-JOQDJRV2.cjs.map +1 -0
  118. package/dist/{chunk-L3MYUPSH.cjs → chunk-JYDVGZ62.cjs} +5 -5
  119. package/dist/{chunk-L3MYUPSH.cjs.map → chunk-JYDVGZ62.cjs.map} +1 -1
  120. package/dist/{chunk-VD3HI5RF.cjs → chunk-NS7PWOL7.cjs} +3 -3
  121. package/dist/{chunk-VD3HI5RF.cjs.map → chunk-NS7PWOL7.cjs.map} +1 -1
  122. package/dist/{chunk-WHU7ABQE.cjs → chunk-NYNHFDVW.cjs} +18 -18
  123. package/dist/{chunk-WHU7ABQE.cjs.map → chunk-NYNHFDVW.cjs.map} +1 -1
  124. package/dist/{chunk-65NQW4RR.cjs → chunk-PUSCVYTH.cjs} +22 -22
  125. package/dist/{chunk-65NQW4RR.cjs.map → chunk-PUSCVYTH.cjs.map} +1 -1
  126. package/dist/{chunk-M55XUF4L.cjs → chunk-QFSFTO7I.cjs} +7 -7
  127. package/dist/{chunk-M55XUF4L.cjs.map → chunk-QFSFTO7I.cjs.map} +1 -1
  128. package/dist/{chunk-SXC4ZIN4.cjs → chunk-QOTDPA62.cjs} +10 -10
  129. package/dist/{chunk-SXC4ZIN4.cjs.map → chunk-QOTDPA62.cjs.map} +1 -1
  130. package/dist/{chunk-GLNL5AL5.cjs → chunk-RR3QJM2Y.cjs} +87 -87
  131. package/dist/chunk-RR3QJM2Y.cjs.map +1 -0
  132. package/dist/{chunk-ELN3YOXF.cjs → chunk-SLVWSTFY.cjs} +28 -28
  133. package/dist/{chunk-ELN3YOXF.cjs.map → chunk-SLVWSTFY.cjs.map} +1 -1
  134. package/dist/{chunk-A7MGQMOV.cjs → chunk-SOJYSRO4.cjs} +10 -10
  135. package/dist/{chunk-A7MGQMOV.cjs.map → chunk-SOJYSRO4.cjs.map} +1 -1
  136. package/dist/{chunk-KZH6HMJL.cjs → chunk-SVHUSJFP.cjs} +4 -4
  137. package/dist/{chunk-KZH6HMJL.cjs.map → chunk-SVHUSJFP.cjs.map} +1 -1
  138. package/dist/{chunk-WDPHYI7S.cjs → chunk-T7UGI2F2.cjs} +7 -7
  139. package/dist/{chunk-WDPHYI7S.cjs.map → chunk-T7UGI2F2.cjs.map} +1 -1
  140. package/dist/{chunk-5FSULBPE.cjs → chunk-UTDLO73D.cjs} +12 -12
  141. package/dist/{chunk-5FSULBPE.cjs.map → chunk-UTDLO73D.cjs.map} +1 -1
  142. package/dist/{chunk-OHWYQI3B.cjs → chunk-UYFHTF2G.cjs} +27 -27
  143. package/dist/{chunk-OHWYQI3B.cjs.map → chunk-UYFHTF2G.cjs.map} +1 -1
  144. package/dist/chunk-VHC3B3R7.cjs +199 -0
  145. package/dist/chunk-VHC3B3R7.cjs.map +1 -0
  146. package/dist/{chunk-SQCCQU3K.cjs → chunk-VOGIYFNN.cjs} +2 -2
  147. package/dist/chunk-VOGIYFNN.cjs.map +1 -0
  148. package/dist/{chunk-2K5DLB7B.cjs → chunk-VXCZFJU7.cjs} +35 -18
  149. package/dist/chunk-VXCZFJU7.cjs.map +1 -0
  150. package/dist/{chunk-IRDL2EC6.cjs → chunk-W365ZZTM.cjs} +55 -55
  151. package/dist/{chunk-IRDL2EC6.cjs.map → chunk-W365ZZTM.cjs.map} +1 -1
  152. package/dist/{chunk-TLIZD6DV.cjs → chunk-W7TSEN3J.cjs} +6 -6
  153. package/dist/{chunk-TLIZD6DV.cjs.map → chunk-W7TSEN3J.cjs.map} +1 -1
  154. package/dist/{chunk-D4SJT3NG.cjs → chunk-WB5XAM77.cjs} +4 -4
  155. package/dist/{chunk-D4SJT3NG.cjs.map → chunk-WB5XAM77.cjs.map} +1 -1
  156. package/dist/{chunk-QSY2VW7V.cjs → chunk-WXRAU2FF.cjs} +6 -6
  157. package/dist/{chunk-QSY2VW7V.cjs.map → chunk-WXRAU2FF.cjs.map} +1 -1
  158. package/dist/{chunk-LYJFE37D.cjs → chunk-X6TSOKEP.cjs} +3 -3
  159. package/dist/{chunk-LYJFE37D.cjs.map → chunk-X6TSOKEP.cjs.map} +1 -1
  160. package/dist/{chunk-XKXKEVHH.cjs → chunk-XTEGQZM2.cjs} +6 -6
  161. package/dist/{chunk-XKXKEVHH.cjs.map → chunk-XTEGQZM2.cjs.map} +1 -1
  162. package/dist/{chunk-BH322H5B.cjs → chunk-ZLMWMAID.cjs} +6 -6
  163. package/dist/{chunk-BH322H5B.cjs.map → chunk-ZLMWMAID.cjs.map} +1 -1
  164. package/dist/collaboration/index.cjs +13 -13
  165. package/dist/connect/docx.cjs +21 -21
  166. package/dist/connect/index.cjs +1298 -1202
  167. package/dist/connect/index.cjs.map +1 -1
  168. package/dist/connect/viewer.cjs +40 -38
  169. package/dist/connection/ConnectedSignDocumentDialog.d.ts +8 -0
  170. package/dist/connection/ConnectedSignDocumentDialog.js +14 -0
  171. package/dist/connection/ConnectedSignDocumentDialog.js.map +7 -0
  172. package/dist/connection/ConnectedWorkflowBuilder.d.ts +1 -1
  173. package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
  174. package/dist/connection/WorkflowRunnerDialogs.js +2 -2
  175. package/dist/connection/WorkflowRunnerDialogs.js.map +2 -2
  176. package/dist/connection/report-problem/ConnectedReportProblem.js +3 -0
  177. package/dist/connection/report-problem/ConnectedReportProblem.js.map +2 -2
  178. package/dist/connection/report-problem/ReportProblemDialog.d.ts +4 -1
  179. package/dist/connection/report-problem/ReportProblemDialog.js +2 -0
  180. package/dist/connection/report-problem/ReportProblemDialog.js.map +2 -2
  181. package/dist/connection/report-problem/SupportVideoEvidence.d.ts +4 -1
  182. package/dist/connection/report-problem/SupportVideoEvidence.js +54 -0
  183. package/dist/connection/report-problem/SupportVideoEvidence.js.map +2 -2
  184. package/dist/connection/report-problem/useSaveRecordingToWorkspace.d.ts +16 -0
  185. package/dist/connection/report-problem/useSaveRecordingToWorkspace.js +39 -0
  186. package/dist/connection/report-problem/useSaveRecordingToWorkspace.js.map +7 -0
  187. package/dist/connection/useSigningIdentity.d.ts +10 -0
  188. package/dist/connection/useSigningIdentity.js +15 -0
  189. package/dist/connection/useSigningIdentity.js.map +7 -0
  190. package/dist/connection/viewer/ConnectedDocumentViewer.js +2 -2
  191. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  192. package/dist/connection/viewer/ConnectedSharedFileDialog.js +4 -0
  193. package/dist/connection/viewer/ConnectedSharedFileDialog.js.map +2 -2
  194. package/dist/connection/viewer/ConnectedSharedFilesPage.js +4 -0
  195. package/dist/connection/viewer/ConnectedSharedFilesPage.js.map +2 -2
  196. package/dist/dashboards/index.cjs +1 -1
  197. package/dist/document-tools/SignDocumentDialog.d.ts +10 -1
  198. package/dist/document-tools/SignDocumentDialog.js +116 -93
  199. package/dist/document-tools/SignDocumentDialog.js.map +2 -2
  200. package/dist/document-tools/index.cjs +10 -9
  201. package/dist/document-tools/useIdentityGate.d.ts +26 -0
  202. package/dist/document-tools/useIdentityGate.js +55 -0
  203. package/dist/document-tools/useIdentityGate.js.map +7 -0
  204. package/dist/document-tools/viewer/GuidedSigningViewer.d.ts +9 -1
  205. package/dist/document-tools/viewer/GuidedSigningViewer.js +19 -5
  206. package/dist/document-tools/viewer/GuidedSigningViewer.js.map +2 -2
  207. package/dist/document-tools/viewer/SharedFileView.d.ts +5 -1
  208. package/dist/document-tools/viewer/SharedFileView.js +5 -1
  209. package/dist/document-tools/viewer/SharedFileView.js.map +2 -2
  210. package/dist/document-tools/viewer/index.cjs +11 -9
  211. package/dist/document-tools/viewer/index.cjs.map +1 -1
  212. package/dist/embed/index.cjs +47 -47
  213. package/dist/facts/index.cjs +39 -39
  214. package/dist/files/index.cjs +221 -221
  215. package/dist/index.cjs +1783 -1767
  216. package/dist/office/index.cjs +5 -5
  217. package/dist/pages/index.cjs +32 -32
  218. package/dist/record/index.cjs +2 -2
  219. package/dist/record/index.cjs.map +1 -1
  220. package/dist/record/index.js +2 -2
  221. package/dist/record/index.js.map +1 -1
  222. package/dist/record/runs.d.ts +1 -1
  223. package/dist/settings/IdentityVerification.d.ts +2 -0
  224. package/dist/settings/IdentityVerification.js +8 -5
  225. package/dist/settings/IdentityVerification.js.map +2 -2
  226. package/dist/settings/index.cjs +156 -156
  227. package/dist/shell/index.cjs +81 -81
  228. package/dist/studio/index.cjs +31 -31
  229. package/dist/styles.css +1 -1
  230. package/dist/workflow-canvas/StepActionSettings.d.ts +3 -0
  231. package/dist/workflow-canvas/StepActionSettings.js +48 -2
  232. package/dist/workflow-canvas/StepActionSettings.js.map +2 -2
  233. package/dist/workflow-canvas/StepInspector.d.ts +9 -0
  234. package/dist/workflow-canvas/StepInspector.js +18 -1
  235. package/dist/workflow-canvas/StepInspector.js.map +2 -2
  236. package/dist/workflow-canvas/WorkflowBuilder.d.ts +11 -1
  237. package/dist/workflow-canvas/WorkflowBuilder.js +54 -3
  238. package/dist/workflow-canvas/WorkflowBuilder.js.map +2 -2
  239. package/dist/workflow-canvas/WorkflowOutline.d.ts +55 -0
  240. package/dist/workflow-canvas/WorkflowOutline.js +331 -0
  241. package/dist/workflow-canvas/WorkflowOutline.js.map +7 -0
  242. package/dist/workflow-canvas/edit.d.ts +7 -0
  243. package/dist/workflow-canvas/edit.js +22 -1
  244. package/dist/workflow-canvas/edit.js.map +2 -2
  245. package/dist/workflow-canvas/index.cjs +1354 -922
  246. package/dist/workflow-canvas/index.cjs.map +1 -1
  247. package/dist/workflow-canvas/index.d.ts +2 -1
  248. package/dist/workflow-canvas/index.js +10 -0
  249. package/dist/workflow-canvas/index.js.map +2 -2
  250. package/node_modules/@arbidocs/coedit/package.json +1 -1
  251. package/package.json +6 -5
  252. package/record/recording_clock.py +58 -0
  253. package/dist/FilesViewerDialog-W2HPT3JS.cjs.map +0 -1
  254. package/dist/ai-A5YTWIEC.cjs.map +0 -1
  255. package/dist/chunk-2K5DLB7B.cjs.map +0 -1
  256. package/dist/chunk-GLNL5AL5.cjs.map +0 -1
  257. package/dist/chunk-GWWX3FZ7.cjs.map +0 -1
  258. package/dist/chunk-LYDSETR7.cjs.map +0 -1
  259. package/dist/chunk-OUYBYZ7Y.cjs +0 -176
  260. package/dist/chunk-OUYBYZ7Y.cjs.map +0 -1
  261. package/dist/chunk-QDIIOZBP.cjs.map +0 -1
  262. package/dist/chunk-QQMMCXBP.cjs +0 -173
  263. package/dist/chunk-QQMMCXBP.cjs.map +0 -1
  264. package/dist/chunk-SQCCQU3K.cjs.map +0 -1
  265. package/dist/chunk-XYN3RP5W.cjs.map +0 -1
  266. package/dist/chunk-Y3GJBLAI.cjs.map +0 -1
@@ -1,92 +1,94 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkGLNL5AL5_cjs = require('../chunk-GLNL5AL5.cjs');
4
+ var chunkRR3QJM2Y_cjs = require('../chunk-RR3QJM2Y.cjs');
5
5
  require('../chunk-32W2S6DE.cjs');
6
6
  require('../chunk-6OPDKROP.cjs');
7
7
  require('../chunk-KD66CBYO.cjs');
8
- require('../chunk-65NQW4RR.cjs');
9
- require('../chunk-EFV52SZ6.cjs');
10
- var chunkER2MRSLT_cjs = require('../chunk-ER2MRSLT.cjs');
8
+ require('../chunk-PUSCVYTH.cjs');
9
+ require('../chunk-GY4T4JSC.cjs');
10
+ var chunkIRVSCMRW_cjs = require('../chunk-IRVSCMRW.cjs');
11
11
  require('../chunk-AEQT2QQX.cjs');
12
- var chunkAZUPMHZI_cjs = require('../chunk-AZUPMHZI.cjs');
13
- require('../chunk-OUYBYZ7Y.cjs');
14
- require('../chunk-633ZCYVN.cjs');
15
- require('../chunk-LYDSETR7.cjs');
12
+ require('../chunk-X6TSOKEP.cjs');
13
+ require('../chunk-Z574BY3H.cjs');
14
+ require('../chunk-JOQDJRV2.cjs');
15
+ var chunk3U6XE7SF_cjs = require('../chunk-3U6XE7SF.cjs');
16
+ require('../chunk-VHC3B3R7.cjs');
17
+ require('../chunk-EEKY7VO3.cjs');
18
+ require('../chunk-GEVBY536.cjs');
19
+ require('../chunk-33VS7HH4.cjs');
16
20
  require('../chunk-WJIAA6G3.cjs');
17
21
  require('../chunk-JWCVA4LC.cjs');
18
- require('../chunk-QQMMCXBP.cjs');
19
- require('../chunk-EAH7LFJN.cjs');
22
+ require('../chunk-HYYYXHBK.cjs');
23
+ require('../chunk-CUYELFKB.cjs');
20
24
  require('../chunk-223D4727.cjs');
21
25
  require('../chunk-DTMBAFIL.cjs');
22
- var chunkVJHDCYKE_cjs = require('../chunk-VJHDCYKE.cjs');
26
+ var chunkAZHIZRHN_cjs = require('../chunk-AZHIZRHN.cjs');
23
27
  require('../chunk-4ONPEVTP.cjs');
24
28
  require('../chunk-V3KLUWQQ.cjs');
25
29
  var chunkSOT7NPIB_cjs = require('../chunk-SOT7NPIB.cjs');
26
- require('../chunk-3EIO4ZH5.cjs');
30
+ require('../chunk-CZOHXTHJ.cjs');
27
31
  require('../chunk-76S6WTEC.cjs');
32
+ var chunkGD5OYIOV_cjs = require('../chunk-GD5OYIOV.cjs');
33
+ var chunkVWSOHZK2_cjs = require('../chunk-VWSOHZK2.cjs');
28
34
  require('../chunk-V5P5MRSR.cjs');
29
35
  require('../chunk-SNUBQMIS.cjs');
30
36
  require('../chunk-Z3LFF3YT.cjs');
31
37
  var chunkNSD37OF5_cjs = require('../chunk-NSD37OF5.cjs');
32
- require('../chunk-UXGIMOIN.cjs');
33
- require('../chunk-WHU7ABQE.cjs');
34
- require('../chunk-HS7TUDEM.cjs');
35
- require('../chunk-5F4DCIHS.cjs');
38
+ require('../chunk-TMX7YFVM.cjs');
36
39
  require('../chunk-WQMR3O2D.cjs');
37
40
  require('../chunk-NZNBJF3M.cjs');
38
41
  require('../chunk-NWNVWO6L.cjs');
39
42
  require('../chunk-SK6HQ46Q.cjs');
40
- require('../chunk-KQF7POTG.cjs');
41
43
  require('../chunk-HME72RFP.cjs');
42
44
  require('../chunk-HQ6SK34T.cjs');
43
- require('../chunk-75BNMCUX.cjs');
45
+ var chunk3YZKDCWY_cjs = require('../chunk-3YZKDCWY.cjs');
44
46
  require('../chunk-OEJQFPWO.cjs');
45
- var chunkRNQ3MDTR_cjs = require('../chunk-RNQ3MDTR.cjs');
46
- var chunkQDIIOZBP_cjs = require('../chunk-QDIIOZBP.cjs');
47
+ var chunkBXHPV6QF_cjs = require('../chunk-BXHPV6QF.cjs');
48
+ var chunkBR3XQ45B_cjs = require('../chunk-BR3XQ45B.cjs');
47
49
  require('../chunk-CYN66TBO.cjs');
48
- require('../chunk-BH322H5B.cjs');
49
- var chunk2K5DLB7B_cjs = require('../chunk-2K5DLB7B.cjs');
50
+ require('../chunk-ZLMWMAID.cjs');
51
+ var chunkVXCZFJU7_cjs = require('../chunk-VXCZFJU7.cjs');
50
52
  var chunkI4IS6ST6_cjs = require('../chunk-I4IS6ST6.cjs');
51
- var chunkM55XUF4L_cjs = require('../chunk-M55XUF4L.cjs');
53
+ var chunkQFSFTO7I_cjs = require('../chunk-QFSFTO7I.cjs');
52
54
  require('../chunk-EVZH6Z5O.cjs');
53
- require('../chunk-IN6ILI5A.cjs');
54
- var chunkPIJPM5RA_cjs = require('../chunk-PIJPM5RA.cjs');
55
55
  require('../chunk-OYXWQTHF.cjs');
56
56
  require('../chunk-S237ORM3.cjs');
57
57
  require('../chunk-II2OEXHW.cjs');
58
- require('../chunk-FX3K6LNZ.cjs');
59
- require('../chunk-KD37PODE.cjs');
58
+ require('../chunk-2ET34WD5.cjs');
60
59
  require('../chunk-3YEXZX4H.cjs');
61
60
  require('../chunk-4PA6VCCR.cjs');
62
- var chunk5FSULBPE_cjs = require('../chunk-5FSULBPE.cjs');
61
+ var chunkUTDLO73D_cjs = require('../chunk-UTDLO73D.cjs');
63
62
  require('../chunk-AHDJXIUB.cjs');
64
63
  require('../chunk-S3GVFAFB.cjs');
65
64
  require('../chunk-IXCWZ4HC.cjs');
66
- var chunkY3GJBLAI_cjs = require('../chunk-Y3GJBLAI.cjs');
67
- var chunkSQCCQU3K_cjs = require('../chunk-SQCCQU3K.cjs');
68
- var chunkUDSHVNU3_cjs = require('../chunk-UDSHVNU3.cjs');
65
+ require('../chunk-SJSGSHIT.cjs');
69
66
  require('../chunk-DKY67DA6.cjs');
70
67
  require('../chunk-ZQQVXRYZ.cjs');
71
- require('../chunk-IPSHAMO2.cjs');
68
+ require('../chunk-ZW6FPIFC.cjs');
72
69
  require('../chunk-6UZC4XVV.cjs');
73
70
  require('../chunk-ZVEW3JBT.cjs');
74
71
  require('../chunk-M74FWYNL.cjs');
72
+ require('../chunk-ZT5MIFLC.cjs');
75
73
  require('../chunk-QUMUAJ2P.cjs');
76
74
  require('../chunk-VZOOGA47.cjs');
77
- require('../chunk-LYJFE37D.cjs');
78
- require('../chunk-Z574BY3H.cjs');
79
- var chunkGD5OYIOV_cjs = require('../chunk-GD5OYIOV.cjs');
80
- var chunkVWSOHZK2_cjs = require('../chunk-VWSOHZK2.cjs');
81
- require('../chunk-TMX7YFVM.cjs');
82
- var chunk3YZKDCWY_cjs = require('../chunk-3YZKDCWY.cjs');
83
- require('../chunk-SJSGSHIT.cjs');
84
- require('../chunk-ZW6FPIFC.cjs');
75
+ require('../chunk-UXGIMOIN.cjs');
76
+ require('../chunk-NYNHFDVW.cjs');
77
+ require('../chunk-6HP6SQWC.cjs');
78
+ require('../chunk-5F4DCIHS.cjs');
79
+ require('../chunk-KQF7POTG.cjs');
80
+ require('../chunk-75BNMCUX.cjs');
81
+ require('../chunk-IN6ILI5A.cjs');
82
+ var chunk3YGSCNXQ_cjs = require('../chunk-3YGSCNXQ.cjs');
83
+ require('../chunk-FX3K6LNZ.cjs');
84
+ var chunkFSTIAEJW_cjs = require('../chunk-FSTIAEJW.cjs');
85
+ var chunkVOGIYFNN_cjs = require('../chunk-VOGIYFNN.cjs');
86
+ var chunkUDSHVNU3_cjs = require('../chunk-UDSHVNU3.cjs');
87
+ require('../chunk-IPSHAMO2.cjs');
85
88
  var chunkHN56WWBR_cjs = require('../chunk-HN56WWBR.cjs');
86
89
  require('../chunk-K67VMSOX.cjs');
87
90
  require('../chunk-CVPV4I7Z.cjs');
88
91
  require('../chunk-PPCATBOY.cjs');
89
- require('../chunk-ZT5MIFLC.cjs');
90
92
  require('../chunk-LJJJ6CYH.cjs');
91
93
  require('../chunk-PLIF5CUV.cjs');
92
94
  var react = require('react');
@@ -112,11 +114,11 @@ function withSteps(workflow, steps, layout) {
112
114
  const run = workflow.run.kind === "steps" ? workflow.run : { kind: "steps", steps: [] };
113
115
  return {
114
116
  ...workflow,
115
- run: { ...run, steps: chunkY3GJBLAI_cjs.orderSteps(steps), layout: layout ?? run.layout }
117
+ run: { ...run, steps: chunkFSTIAEJW_cjs.orderSteps(steps), layout: layout ?? run.layout }
116
118
  };
117
119
  }
118
120
  var layoutOf = (workflow) => workflow.run.kind === "steps" && workflow.run.layout || {};
119
- var explicit = (steps) => steps.map((s) => ({ ...s, after: chunkY3GJBLAI_cjs.stepDependencies(steps, s.id) }));
121
+ var explicit = (steps) => steps.map((s) => ({ ...s, after: chunkFSTIAEJW_cjs.stepDependencies(steps, s.id) }));
120
122
  function stepIdFor(steps, title) {
121
123
  const base = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "") || "step";
122
124
  const taken = new Set(steps.map((s) => s.id));
@@ -174,7 +176,7 @@ function blankStep(kind, id, title) {
174
176
  }
175
177
  }
176
178
  function addStep(workflow, kind, options = {}) {
177
- const steps = explicit(chunkY3GJBLAI_cjs.workflowSteps(workflow));
179
+ const steps = explicit(chunkFSTIAEJW_cjs.workflowSteps(workflow));
178
180
  const title = options.title ?? DEFAULT_TITLES[kind];
179
181
  const id = stepIdFor(steps, title);
180
182
  const step = { ...blankStep(kind, id, title), after: options.after ? [options.after] : [] };
@@ -182,8 +184,27 @@ function addStep(workflow, kind, options = {}) {
182
184
  if (options.position) layout[id] = options.position;
183
185
  return { workflow: withSteps(workflow, [...steps, step], layout), id };
184
186
  }
187
+ function isLinear(workflow) {
188
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
189
+ return steps.every((s, i) => {
190
+ const deps = chunkFSTIAEJW_cjs.stepDependencies(steps, s.id);
191
+ return i === 0 ? deps.length === 0 : deps.length === 1 && deps[0] === steps[i - 1].id;
192
+ });
193
+ }
194
+ function shiftStep(workflow, id, by) {
195
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
196
+ const i = steps.findIndex((s) => s.id === id);
197
+ const j = i + by;
198
+ if (i < 0 || j < 0 || j >= steps.length || !isLinear(workflow)) return workflow;
199
+ const list = [...steps];
200
+ [list[i], list[j]] = [list[j], list[i]];
201
+ return withSteps(
202
+ workflow,
203
+ list.map((s, k) => ({ ...s, after: k ? [list[k - 1].id] : [] }))
204
+ );
205
+ }
185
206
  function removeStep(workflow, id) {
186
- const steps = explicit(chunkY3GJBLAI_cjs.workflowSteps(workflow));
207
+ const steps = explicit(chunkFSTIAEJW_cjs.workflowSteps(workflow));
187
208
  const removed = steps.find((s) => s.id === id);
188
209
  if (!removed) return workflow;
189
210
  const bridged = steps.filter((s) => s.id !== id).map(
@@ -196,8 +217,8 @@ function removeStep(workflow, id) {
196
217
  return withSteps(workflow, bridged, layout);
197
218
  }
198
219
  function connectSteps(workflow, from, to) {
199
- const steps = explicit(chunkY3GJBLAI_cjs.workflowSteps(workflow));
200
- if (from === to || !steps.some((s) => s.id === from) || chunkY3GJBLAI_cjs.dependsOn(steps, from, to)) {
220
+ const steps = explicit(chunkFSTIAEJW_cjs.workflowSteps(workflow));
221
+ if (from === to || !steps.some((s) => s.id === from) || chunkFSTIAEJW_cjs.dependsOn(steps, from, to)) {
201
222
  return workflow;
202
223
  }
203
224
  return withSteps(
@@ -207,16 +228,16 @@ function connectSteps(workflow, from, to) {
207
228
  )
208
229
  );
209
230
  }
210
- var wouldCycle = (workflow, from, to) => from === to || chunkY3GJBLAI_cjs.dependsOn(chunkY3GJBLAI_cjs.workflowSteps(workflow), from, to);
231
+ var wouldCycle = (workflow, from, to) => from === to || chunkFSTIAEJW_cjs.dependsOn(chunkFSTIAEJW_cjs.workflowSteps(workflow), from, to);
211
232
  function disconnectSteps(workflow, from, to) {
212
- const steps = explicit(chunkY3GJBLAI_cjs.workflowSteps(workflow));
233
+ const steps = explicit(chunkFSTIAEJW_cjs.workflowSteps(workflow));
213
234
  return withSteps(
214
235
  workflow,
215
236
  steps.map((s) => s.id === to ? { ...s, after: (s.after ?? []).filter((d) => d !== from) } : s)
216
237
  );
217
238
  }
218
239
  function updateStep(workflow, id, patch) {
219
- const steps = explicit(chunkY3GJBLAI_cjs.workflowSteps(workflow));
240
+ const steps = explicit(chunkFSTIAEJW_cjs.workflowSteps(workflow));
220
241
  return withSteps(
221
242
  workflow,
222
243
  steps.map(
@@ -230,7 +251,7 @@ var renameIn = (text, from, to) => text.replace(
230
251
  );
231
252
  function renameInput(workflow, from, to) {
232
253
  if (from === to) return workflow;
233
- const steps = chunkY3GJBLAI_cjs.workflowSteps(workflow).map((s) => {
254
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow).map((s) => {
234
255
  if (s.kind === "agent")
235
256
  return {
236
257
  ...s,
@@ -299,16 +320,16 @@ function renameInput(workflow, from, to) {
299
320
  });
300
321
  return withSteps(workflow, steps);
301
322
  }
302
- var renamePerson = (a, from, to) => "input" in a && a.input === from ? { input: to } : a;
323
+ var renamePerson = (a, from, to) => "input" in a && a.input === from ? { ...a, input: to } : a;
303
324
  var renameRef = (r, from, to) => "input" in r && r.input === from ? { input: to } : r;
304
325
  function moveStep(workflow, id, position) {
305
- return withSteps(workflow, chunkY3GJBLAI_cjs.workflowSteps(workflow), { ...layoutOf(workflow), [id]: position });
326
+ return withSteps(workflow, chunkFSTIAEJW_cjs.workflowSteps(workflow), { ...layoutOf(workflow), [id]: position });
306
327
  }
307
328
  var COLUMN = 300;
308
329
  var ROW = 140;
309
330
  function autoLayout(steps) {
310
331
  const layout = {};
311
- chunkY3GJBLAI_cjs.stepLevels(steps).forEach(
332
+ chunkFSTIAEJW_cjs.stepLevels(steps).forEach(
312
333
  (level, x) => level.forEach((s, y) => {
313
334
  layout[s.id] = { x: x * COLUMN, y: (y - (level.length - 1) / 2) * ROW };
314
335
  })
@@ -316,7 +337,7 @@ function autoLayout(steps) {
316
337
  return layout;
317
338
  }
318
339
  function layoutWithDefaults(workflow) {
319
- const auto = autoLayout(chunkY3GJBLAI_cjs.workflowSteps(workflow));
340
+ const auto = autoLayout(chunkFSTIAEJW_cjs.workflowSteps(workflow));
320
341
  return { ...auto, ...layoutOf(workflow) };
321
342
  }
322
343
  var DEFAULT_SIGNALS_EDITOR_LABELS = {
@@ -413,9 +434,9 @@ function SignalsEditor({
413
434
  {
414
435
  className: ui.cn(
415
436
  "space-y-1.5 rounded-md border p-2",
416
- chunk2K5DLB7B_cjs.isIncompleteSignal(signal) ? "border-destructive/50" : "border-border"
437
+ chunkVXCZFJU7_cjs.isIncompleteSignal(signal) ? "border-destructive/50" : "border-border"
417
438
  ),
418
- "data-incomplete": chunk2K5DLB7B_cjs.isIncompleteSignal(signal) || void 0,
439
+ "data-incomplete": chunkVXCZFJU7_cjs.isIncompleteSignal(signal) || void 0,
419
440
  "data-testid": `${testId}-${i}`,
420
441
  children: [
421
442
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -557,6 +578,9 @@ var DEFAULT_STEP_ACTION_SETTINGS_LABELS = {
557
578
  signDocument: "Document to sign",
558
579
  signers: "Signers",
559
580
  addSigner: "Add signer",
581
+ addClientSigner: "Add a client by email",
582
+ clientEmail: "Client email (or {{field}})",
583
+ identityVerification: "ID verification",
560
584
  signMessage: "Message to the signers",
561
585
  expires: "Expires after (hours)",
562
586
  expiresHint: "Unsigned by then, the step fails. Blank: no expiry.",
@@ -808,6 +832,8 @@ function SignSettings({
808
832
  testId
809
833
  }) {
810
834
  const set = (p) => onChange({ ...action, ...p });
835
+ const idFlag = { requireIdentityVerification: true };
836
+ const setSigner = (i, next) => set({ signers: action.signers.map((x, j) => j === i ? next : x) });
811
837
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
812
838
  /* @__PURE__ */ jsxRuntime.jsx(Field, { label: l.signDocument, children: /* @__PURE__ */ jsxRuntime.jsx(
813
839
  DocumentRefPicker,
@@ -821,12 +847,24 @@ function SignSettings({
821
847
  ) }),
822
848
  /* @__PURE__ */ jsxRuntime.jsx(Field, { label: l.signers, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", "data-testid": `${testId}-signers`, children: [
823
849
  action.signers.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
824
- /* @__PURE__ */ jsxRuntime.jsx(
850
+ "email" in s ? /* @__PURE__ */ jsxRuntime.jsx(
851
+ ui.Input,
852
+ {
853
+ value: s.email,
854
+ onChange: (e) => setSigner(i, { ...s, email: e.target.value }),
855
+ placeholder: l.clientEmail,
856
+ "aria-label": `${l.signers} ${i + 1}`,
857
+ className: "h-9 min-w-0 flex-1",
858
+ "data-testid": `${testId}-signer-${i}-email`
859
+ }
860
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
825
861
  AssigneeSelect,
826
862
  {
827
863
  value: s,
828
864
  onChange: (next) => set({
829
- signers: next ? action.signers.map((x, j) => j === i ? next : x) : action.signers.filter((_, j) => j !== i)
865
+ signers: next ? action.signers.map(
866
+ (x, j) => j === i ? { ...next, ...s.requireIdentityVerification ? idFlag : {} } : x
867
+ ) : action.signers.filter((_, j) => j !== i)
830
868
  }),
831
869
  ctx,
832
870
  l,
@@ -834,6 +872,20 @@ function SignSettings({
834
872
  testId: `${testId}-signer-${i}`
835
873
  }
836
874
  ),
875
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex shrink-0 items-center gap-1 text-xs text-muted-foreground", children: [
876
+ /* @__PURE__ */ jsxRuntime.jsx(
877
+ ui.Checkbox,
878
+ {
879
+ checked: !!s.requireIdentityVerification,
880
+ onCheckedChange: (v) => setSigner(i, {
881
+ ...s,
882
+ requireIdentityVerification: v === true ? true : void 0
883
+ }),
884
+ "data-testid": `${testId}-signer-${i}-identity`
885
+ }
886
+ ),
887
+ l.identityVerification
888
+ ] }),
837
889
  /* @__PURE__ */ jsxRuntime.jsx(
838
890
  "button",
839
891
  {
@@ -857,6 +909,21 @@ function SignSettings({
857
909
  l.addSigner
858
910
  ]
859
911
  }
912
+ ),
913
+ /* @__PURE__ */ jsxRuntime.jsxs(
914
+ ui.Button,
915
+ {
916
+ variant: "outline",
917
+ size: "sm",
918
+ className: "ml-1.5",
919
+ onClick: () => set({ signers: [...action.signers, { email: "" }] }),
920
+ "data-testid": `${testId}-add-client-signer`,
921
+ children: [
922
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
923
+ " ",
924
+ l.addClientSigner
925
+ ]
926
+ }
860
927
  )
861
928
  ] }) }),
862
929
  /* @__PURE__ */ jsxRuntime.jsx(Field, { label: l.signMessage, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1303,6 +1370,9 @@ var DEFAULT_STEP_INSPECTOR_LABELS = {
1303
1370
  required: "Required",
1304
1371
  runs: "Runs",
1305
1372
  chooseRun: "Choose a skill or write an instruction\u2026",
1373
+ suggestFrom: "Let the AI fill this in from",
1374
+ suggestFromHint: "That step\u2019s answer ends with a JSON block keyed by the field codes; a person checks the values and continues.",
1375
+ suggestNone: "No one: start blank",
1306
1376
  ownPrompt: "Its own instruction",
1307
1377
  prompt: "Instruction",
1308
1378
  promptHint: "Use {{field}} for an input and {{steps.<id>}} for an earlier step\u2019s answer.",
@@ -1358,7 +1428,7 @@ function StepInspector({
1358
1428
  }) {
1359
1429
  const l = { ...DEFAULT_STEP_INSPECTOR_LABELS, ...labels };
1360
1430
  const ol = { ...DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, ...optionLabels };
1361
- const steps = chunkY3GJBLAI_cjs.workflowSteps(workflow);
1431
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
1362
1432
  const step = steps.find((s) => s.id === stepId);
1363
1433
  const run = workflow.run.kind === "steps" ? workflow.run : void 0;
1364
1434
  if (!step || !run) {
@@ -1385,8 +1455,8 @@ function StepInspector({
1385
1455
  const patch = (p) => onChange(updateStep(workflow, step.id, p));
1386
1456
  const al = { ...DEFAULT_STEP_ACTION_SETTINGS_LABELS, ...actionLabels };
1387
1457
  const ctx = {
1388
- earlier: chunkY3GJBLAI_cjs.upstreamSteps(steps, step.id),
1389
- fields: chunkY3GJBLAI_cjs.runFields(workflow),
1458
+ earlier: chunkFSTIAEJW_cjs.upstreamSteps(steps, step.id),
1459
+ fields: chunkFSTIAEJW_cjs.runFields(workflow),
1390
1460
  people,
1391
1461
  tags,
1392
1462
  documents,
@@ -1408,7 +1478,7 @@ function StepInspector({
1408
1478
  )
1409
1479
  );
1410
1480
  };
1411
- const deps = chunkY3GJBLAI_cjs.stepDependencies(steps, step.id);
1481
+ const deps = chunkFSTIAEJW_cjs.stepDependencies(steps, step.id);
1412
1482
  const titleOf = (id) => steps.find((s) => s.id === id)?.title ?? id;
1413
1483
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", "data-testid": `${testId}-step`, children: [
1414
1484
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
@@ -1464,6 +1534,19 @@ function StepInspector({
1464
1534
  testId
1465
1535
  }
1466
1536
  ),
1537
+ step.kind === "form" && ctx.earlier.some((e) => e.kind === "agent") && /* @__PURE__ */ jsxRuntime.jsx(Field, { label: l.suggestFrom, hint: l.suggestFromHint, children: /* @__PURE__ */ jsxRuntime.jsxs(
1538
+ "select",
1539
+ {
1540
+ className: selectClass2,
1541
+ value: step.suggestFrom ?? "",
1542
+ onChange: (e) => patch({ suggestFrom: e.target.value || void 0 }),
1543
+ "data-testid": `${testId}-suggest-from`,
1544
+ children: [
1545
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.suggestNone }),
1546
+ ctx.earlier.filter((e) => e.kind === "agent").map((e) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: e.id, children: e.title }, e.id))
1547
+ ]
1548
+ }
1549
+ ) }),
1467
1550
  step.kind === "upload" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1468
1551
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
1469
1552
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1489,7 +1572,7 @@ function StepInspector({
1489
1572
  {
1490
1573
  step,
1491
1574
  workflows,
1492
- fields: chunkY3GJBLAI_cjs.runFields(workflow).map((f) => f.name),
1575
+ fields: chunkFSTIAEJW_cjs.runFields(workflow).map((f) => f.name),
1493
1576
  patch,
1494
1577
  l,
1495
1578
  testId
@@ -1560,7 +1643,7 @@ function StepInspector({
1560
1643
  testId: `${testId}-approval`
1561
1644
  }
1562
1645
  ),
1563
- chunkY3GJBLAI_cjs.canAssign(step) && /* @__PURE__ */ jsxRuntime.jsx(AssigneeSettings, { step, patch, ctx, l: al, testId }),
1646
+ chunkFSTIAEJW_cjs.canAssign(step) && /* @__PURE__ */ jsxRuntime.jsx(AssigneeSettings, { step, patch, ctx, l: al, testId }),
1564
1647
  /* @__PURE__ */ jsxRuntime.jsx(
1565
1648
  SignalsEditor,
1566
1649
  {
@@ -1793,889 +1876,1184 @@ function AgentSettings({
1793
1876
  ] });
1794
1877
  }
1795
1878
 
1796
- // src/workflow-canvas/trigger.ts
1797
- var WORKFLOW_SIGNAL_EVENT = "workflow_signal";
1798
- var DEFAULT_WORKFLOW_TRIGGER = {
1799
- start: "manual",
1800
- runAt: "",
1801
- rrule: "",
1802
- timezone: typeof Intl !== "undefined" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "UTC",
1803
- eventKind: "",
1804
- signal: "",
1805
- afterTaskId: "",
1806
- agentId: "",
1807
- access: "ask_each_run"
1808
- };
1809
- function triggerProblem(trigger) {
1810
- if (trigger.start === "once" && !trigger.runAt) return "runAt";
1811
- if (trigger.start === "repeat" && !trigger.rrule.trim()) return "rrule";
1812
- if (trigger.start === "event" && !trigger.eventKind.trim()) return "event";
1813
- if (isSignalTrigger(trigger) && !trigger.signal.trim()) return "signal";
1814
- if (trigger.start === "task" && !trigger.afterTaskId) return "task";
1815
- return null;
1816
- }
1817
- var isSignalTrigger = (trigger) => trigger.start === "event" && trigger.eventKind.trim() === WORKFLOW_SIGNAL_EVENT;
1818
- function eventFilter(trigger) {
1819
- if (trigger.start !== "event") return null;
1820
- if (isSignalTrigger(trigger)) return { signal: trigger.signal.trim() };
1821
- return trigger.eventFilter && Object.keys(trigger.eventFilter).length ? trigger.eventFilter : null;
1879
+ // src/workflow-canvas/viewport.ts
1880
+ var READABLE_ZOOM = 0.7;
1881
+ var DEFAULT_W = 256;
1882
+ var DEFAULT_H = 80;
1883
+ var MARGIN = 48;
1884
+ var sizeOf = (n) => ({
1885
+ w: n.measured?.width ?? DEFAULT_W,
1886
+ h: n.measured?.height ?? DEFAULT_H
1887
+ });
1888
+ function readableViewport(nodes, fittedZoom, frame, {
1889
+ anchor,
1890
+ centre = false,
1891
+ reserveRight = 0
1892
+ } = {}) {
1893
+ if (fittedZoom >= READABLE_ZOOM || !frame.height || nodes.length === 0) return null;
1894
+ const z = READABLE_ZOOM;
1895
+ const at = nodes.find((n) => n.id === anchor) ?? nodes.reduce((a, b) => b.position.x < a.position.x ? b : a);
1896
+ const { w, h } = sizeOf(at);
1897
+ const y = frame.height / 2 - (at.position.y + h / 2) * z;
1898
+ if (centre && at.id === anchor) {
1899
+ const visible = Math.max(0, frame.width - reserveRight);
1900
+ return { x: visible / 2 - (at.position.x + w / 2) * z, y, zoom: z };
1901
+ }
1902
+ return { x: MARGIN - at.position.x * z, y, zoom: z };
1822
1903
  }
1823
- function triggerFields(trigger, clearOthers) {
1824
- const none = clearOthers ? null : void 0;
1825
- const filter = eventFilter(trigger);
1904
+ function revealCenter(node, view, frame, reserveRight = 0) {
1905
+ const { w, h } = sizeOf(node);
1906
+ const { x, y, zoom } = view;
1907
+ const left = node.position.x * zoom + x;
1908
+ const top = node.position.y * zoom + y;
1909
+ const right = frame.width - reserveRight;
1910
+ if (left >= 16 && top >= 16 && left + w * zoom <= right - 16 && top + h * zoom <= frame.height - 16)
1911
+ return null;
1826
1912
  return {
1827
- timezone: trigger.timezone,
1828
- rrule: trigger.start === "repeat" ? trigger.rrule.trim() : none,
1829
- run_at: trigger.start === "once" ? chunkM55XUF4L_cjs.localInputToIso(trigger.runAt) : none,
1830
- event_kind: trigger.start === "event" ? trigger.eventKind.trim() : none,
1831
- // A step signal is `workflow_signal` narrowed to one signal name.
1832
- event_filter: filter ?? none,
1833
- after_conversation_ext_id: trigger.start === "task" ? trigger.afterTaskId : none,
1834
- on_demand: trigger.start === "manual"
1913
+ x: node.position.x + w / 2 + reserveRight / 2 / zoom,
1914
+ y: node.position.y + h / 2
1835
1915
  };
1836
1916
  }
1837
- var authMode = (trigger) => trigger.start === "manual" ? "run_now_temp" : trigger.access === "standing" ? "scheduled_permanent" : "scheduled_require_auth";
1838
- var withoutUndefined = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
1839
- function plan(value, options) {
1840
- return {
1841
- goal: value.workflow.description,
1842
- criteria: [],
1843
- max_passes: 3,
1844
- documents: [],
1845
- steps: chunk2K5DLB7B_cjs.toPlanSteps(value.workflow, options),
1846
- // What a run is started with (checked by the server when one starts).
1847
- inputs: chunk2K5DLB7B_cjs.toPlanInputs(value.workflow.inputs)
1848
- };
1917
+ var DEFAULT_WORKFLOW_CANVAS_LABELS = {
1918
+ ...chunk3YGSCNXQ_cjs.DEFAULT_STEP_KIND_LABELS,
1919
+ redline: "Tracked changes",
1920
+ branch: "Branch",
1921
+ kindHints: {
1922
+ form: "Ask for details",
1923
+ upload: "Collect files",
1924
+ agent: "Run a skill or an instruction",
1925
+ review: "A person approves",
1926
+ sign: "People e-sign a document",
1927
+ email_draft: "Prepare an email to send",
1928
+ tabular_review: "Review documents in a grid",
1929
+ approval: "Submit a request for a decision",
1930
+ create_project: "Open a project from the run"
1931
+ },
1932
+ addNext: "Add the next step",
1933
+ runs: "Runs \u201C{name}\u201D",
1934
+ chooseRun: "Choose a skill or write an instruction",
1935
+ fields: "{count} fields",
1936
+ noFields: "No fields yet",
1937
+ approvedBy: "A person approves",
1938
+ signers: "{count} signers",
1939
+ chooseDocument: "Choose the document to sign",
1940
+ emailTo: "To {to}",
1941
+ noRecipients: "Add a recipient",
1942
+ reviewColumns: "{count} columns",
1943
+ noColumns: "Choose the columns",
1944
+ approvalSummary: "Request: decided on its row",
1945
+ chooseDatabase: "Choose the requests database",
1946
+ assignee: "{name}",
1947
+ remind: "Reminds after {hours}h",
1948
+ emptyTitle: "Start your workflow",
1949
+ emptyHint: "Add the first step: what should happen when it starts?",
1950
+ fitView: "Fit view"
1951
+ };
1952
+ var TRIGGER_NODE = "__trigger";
1953
+ var KINDS = chunk3YGSCNXQ_cjs.WORKFLOW_STEP_KINDS;
1954
+ function AddNext({
1955
+ from,
1956
+ onAdd,
1957
+ l,
1958
+ testId
1959
+ }) {
1960
+ const [open, setOpen] = react.useState(false);
1961
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open, onOpenChange: setOpen, children: [
1962
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1963
+ "button",
1964
+ {
1965
+ type: "button",
1966
+ className: "wf-add nodrag nopan flex size-7 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground",
1967
+ "aria-label": l.addNext,
1968
+ "data-testid": `${testId}-add-after-${from === TRIGGER_NODE ? "trigger" : from}`,
1969
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" })
1970
+ }
1971
+ ) }),
1972
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.PopoverContent, { side: "right", align: "start", className: "w-60 p-1.5", children: [
1973
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 pb-1 pt-0.5 text-xs font-medium text-muted-foreground", children: l.addNext }),
1974
+ KINDS.map((kind) => {
1975
+ const Icon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
1976
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1977
+ "button",
1978
+ {
1979
+ type: "button",
1980
+ onClick: (e) => {
1981
+ e.stopPropagation();
1982
+ setOpen(false);
1983
+ onAdd(from, kind);
1984
+ },
1985
+ className: ui.cn(
1986
+ `wf-kind-${kind}`,
1987
+ "flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-muted"
1988
+ ),
1989
+ "data-testid": `${testId}-add-after-${from === TRIGGER_NODE ? "trigger" : from}-${kind}`,
1990
+ children: [
1991
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-7 shrink-0 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) }),
1992
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
1993
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: l[kind] }),
1994
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: l.kindHints[kind] })
1995
+ ] })
1996
+ ]
1997
+ },
1998
+ kind
1999
+ );
2000
+ })
2001
+ ] })
2002
+ ] });
1849
2003
  }
1850
- function builderToWorkflowRequest(value, workspaceId, options = {}) {
1851
- return withoutUndefined({
1852
- workspace_ext_id: workspaceId,
1853
- name: value.workflow.title,
1854
- description: value.workflow.description,
1855
- active: true,
1856
- shared: false,
1857
- ...triggerFields(value.trigger, false),
1858
- prompt: "",
1859
- skill_ref: null,
1860
- skill_inputs: null,
1861
- agent_ext_id: value.trigger.agentId || null,
1862
- auth_mode: authMode(value.trigger),
1863
- plan: plan(value, options)
1864
- });
2004
+ function PhaseMark({ phase }) {
2005
+ if (phase === "running") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "wf-kind-text size-4 animate-spin" });
2006
+ if (phase === "waiting") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Hourglass, { className: "wf-kind-text size-4" });
2007
+ if (phase === "done") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "wf-kind-text size-4" });
2008
+ if (phase === "failed") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "size-4 text-destructive" });
2009
+ if (phase === "skipped") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MinusCircle, { className: "size-4 text-muted-foreground" });
2010
+ return null;
1865
2011
  }
1866
- function builderToWorkflowUpdate(value, options = {}) {
1867
- return withoutUndefined({
1868
- name: value.workflow.title,
1869
- description: value.workflow.description,
1870
- ...triggerFields(value.trigger, true),
1871
- // The steps are what runs (a classic automation's single prompt or skill becomes its one step).
1872
- prompt: "",
1873
- skill_ref: null,
1874
- skill_inputs: null,
1875
- agent_ext_id: value.trigger.agentId || null,
1876
- auth_mode: authMode(value.trigger),
1877
- plan: plan(value, options)
1878
- });
1879
- }
1880
- function workflowRecordToBuilder(record) {
1881
- const planned = record.plan?.steps ?? [];
1882
- const steps = planned.length ? chunk2K5DLB7B_cjs.fromPlanSteps(planned) : record.prompt || record.skill_ref ? [
2012
+ function StepNode({ data }) {
2013
+ const { step, phase, summary, assignee, icon, l, onAdd, testId } = data;
2014
+ const kind = chunk3YGSCNXQ_cjs.stepKindOf(step);
2015
+ const KindIcon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
2016
+ const redline = step.kind === "agent" && !!step.editDocument;
2017
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2018
+ "div",
1883
2019
  {
1884
- id: "work",
1885
- kind: "agent",
1886
- title: record.name,
1887
- ...record.skill_ref ? { workflow: record.skill_ref } : { run: { kind: "prompt", promptTemplate: record.prompt } }
1888
- }
1889
- ] : [];
1890
- const when = chunkM55XUF4L_cjs.workflowWhen(record);
1891
- return {
1892
- workflow: {
1893
- id: record.external_id,
1894
- title: record.name,
1895
- description: record.description ?? "",
1896
- inputs: chunk2K5DLB7B_cjs.fromPlanInputs(record.plan?.inputs),
1897
- landing: "chat",
1898
- schedulable: false,
1899
- run: { kind: "steps", steps, layout: chunk2K5DLB7B_cjs.layoutFromPlanSteps(planned ?? []) }
1900
- },
1901
- trigger: {
1902
- ...DEFAULT_WORKFLOW_TRIGGER,
1903
- start: when === "now" ? "manual" : when,
1904
- runAt: chunkM55XUF4L_cjs.isoToLocalInput(record.run_at),
1905
- rrule: record.rrule ?? "",
1906
- timezone: record.timezone || DEFAULT_WORKFLOW_TRIGGER.timezone,
1907
- eventKind: record.event_kind ?? "",
1908
- signal: record.event_kind === WORKFLOW_SIGNAL_EVENT && typeof record.event_filter?.signal === "string" ? record.event_filter.signal : "",
1909
- eventFilter: record.event_kind && record.event_kind !== WORKFLOW_SIGNAL_EVENT && record.event_filter ? record.event_filter : void 0,
1910
- afterTaskId: record.after_conversation_ext_id ?? "",
1911
- agentId: record.agent_ext_id ?? "",
1912
- access: record.auth_mode === "scheduled_permanent" ? "standing" : "ask_each_run"
2020
+ className: ui.cn(
2021
+ "wf-node w-64 py-3 pl-4 pr-3 text-left",
2022
+ `wf-kind-${kind}`,
2023
+ phase && `wf-phase-${phase}`
2024
+ ),
2025
+ "data-testid": `${testId}-node-${step.id}`,
2026
+ "data-phase": phase,
2027
+ children: [
2028
+ /* @__PURE__ */ jsxRuntime.jsx(chunkI4IS6ST6_cjs.ChevronShape, {}),
2029
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Left }),
2030
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2.5", children: [
2031
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4", children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}) }),
2032
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
2033
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2034
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-kind-text text-[10px] font-semibold uppercase tracking-wider", children: l[kind] }),
2035
+ /* @__PURE__ */ jsxRuntime.jsx(PhaseMark, { phase })
2036
+ ] }),
2037
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-semibold leading-snug", children: step.title }),
2038
+ summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-snug text-muted-foreground", children: summary }),
2039
+ (redline || step.kind === "agent" && step.branch || assignee) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1.5 flex flex-wrap gap-1", children: [
2040
+ step.kind === "agent" && step.branch && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: [
2041
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GitBranch, { className: "size-3" }),
2042
+ " ",
2043
+ l.branch
2044
+ ] }),
2045
+ redline && /* @__PURE__ */ jsxRuntime.jsxs(
2046
+ "span",
2047
+ {
2048
+ className: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
2049
+ "data-testid": `${testId}-node-${step.id}-redline`,
2050
+ children: [
2051
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FilePenLine, { className: "size-3" }),
2052
+ " ",
2053
+ l.redline
2054
+ ]
2055
+ }
2056
+ ),
2057
+ assignee && /* @__PURE__ */ jsxRuntime.jsxs(
2058
+ "span",
2059
+ {
2060
+ className: "inline-flex max-w-full items-center gap-1 truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
2061
+ title: assignee,
2062
+ "data-testid": `${testId}-node-${step.id}-assignee`,
2063
+ children: [
2064
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserRound, { className: "size-3 shrink-0" }),
2065
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: l.assignee.replace(
2066
+ "{name}",
2067
+ assignee.charAt(0).toUpperCase() + assignee.slice(1)
2068
+ ) })
2069
+ ]
2070
+ }
2071
+ )
2072
+ ] })
2073
+ ] })
2074
+ ] }),
2075
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "source", position: react$1.Position.Right }),
2076
+ onAdd && /* @__PURE__ */ jsxRuntime.jsx(AddNext, { from: step.id, onAdd, l, testId })
2077
+ ]
1913
2078
  }
1914
- };
2079
+ );
1915
2080
  }
1916
- function declaredSignals(records, current) {
1917
- const out = /* @__PURE__ */ new Map();
1918
- const add = (workflow, steps) => {
1919
- for (const step of steps)
1920
- for (const signal of step.signals ?? [])
1921
- if (signal.name && !out.has(signal.name))
1922
- out.set(signal.name, { value: signal.name, label: `${workflow} \u203A ${step.title}` });
1923
- };
1924
- for (const record of records)
1925
- add(record.name, record.plan?.steps ?? []);
1926
- if (current?.run.kind === "steps") add(current.title, current.run.steps);
1927
- return [...out.values()];
2081
+ function TriggerNode({ data }) {
2082
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2083
+ "div",
2084
+ {
2085
+ className: "wf-start wf-kind-start relative w-60 px-4 py-3 text-left",
2086
+ "data-testid": `${data.testId}-node-trigger`,
2087
+ children: [
2088
+ /* @__PURE__ */ jsxRuntime.jsx(chunkI4IS6ST6_cjs.ChevronShape, {}),
2089
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
2090
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-8 shrink-0 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { className: "size-4" }) }),
2091
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
2092
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "wf-kind-text text-[10px] font-semibold uppercase tracking-wider", children: data.title }),
2093
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-semibold", children: data.summary })
2094
+ ] })
2095
+ ] }),
2096
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "source", position: react$1.Position.Right }),
2097
+ data.onAdd && /* @__PURE__ */ jsxRuntime.jsx(AddNext, { from: TRIGGER_NODE, onAdd: data.onAdd, l: data.l, testId: data.testId })
2098
+ ]
2099
+ }
2100
+ );
1928
2101
  }
1929
- var DEFAULT_TRIGGER_INSPECTOR_LABELS = {
1930
- heading: "Start",
1931
- start: "Starts",
1932
- starts: {
1933
- manual: "When someone runs it",
1934
- once: "Once, at a time",
1935
- repeat: "On a schedule",
1936
- event: "When something happens",
1937
- task: "When a task is done"
1938
- },
1939
- runAt: "When",
1940
- event: "Event",
1941
- eventPlaceholder: "Pick an event",
1942
- sender: "From (email address)",
1943
- senderPlaceholder: "x@company.com",
1944
- documentReason: "Kind of new version",
1945
- documentReasonHint: "Starts when someone else saves a new version of a document that already exists. A first upload does not start it.",
1946
- documentReasons: {
1947
- any: "Any new version",
1948
- upload: "Uploaded as a new version",
1949
- edit: "Edited",
1950
- signed: "Signed"
1951
- },
1952
- stepSignals: "When a step signals",
1953
- signal: "Signal",
1954
- signalPlaceholder: "e.g. risk-high",
1955
- signalHint: "Starts as its own thread, linked to the thread whose step raised it, with that run\u2019s inputs.",
1956
- signalSummary: "When a step signals \u201C{signal}\u201D",
1957
- afterTask: "After this task",
1958
- afterTaskPlaceholder: "Pick a task",
1959
- agent: "Runs as",
1960
- access: "Access when nobody is there",
1961
- accessAsk: "Ask me each run",
1962
- accessStanding: "Keep access"
2102
+ var NODE_TYPES = { step: StepNode, trigger: TriggerNode };
2103
+ var firstWords = (text, n = 14) => {
2104
+ const words = text.trim().split(/\s+/);
2105
+ return words.length > n ? `${words.slice(0, n).join(" ")}\u2026` : text.trim();
1963
2106
  };
1964
- function triggerSummary(trigger, options = {}) {
1965
- const l = { ...DEFAULT_TRIGGER_INSPECTOR_LABELS, ...options.labels };
1966
- switch (trigger.start) {
1967
- case "once":
1968
- return trigger.runAt ? new Date(trigger.runAt).toLocaleString() : l.starts.once;
1969
- case "repeat":
1970
- return trigger.rrule ? chunk2K5DLB7B_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
1971
- case "event":
1972
- if (isSignalTrigger(trigger))
1973
- return trigger.signal ? l.signalSummary.replace("{signal}", trigger.signal) : l.stepSignals;
1974
- return trigger.eventKind && options.eventLabel?.(trigger.eventKind) || trigger.eventKind || l.starts.event;
1975
- case "task":
1976
- return trigger.afterTaskId && options.taskLabel?.(trigger.afterTaskId) || l.starts.task;
1977
- default:
1978
- return l.starts.manual;
2107
+ function summaryOf(step, l, workflowTitle) {
2108
+ if (step.description) return step.description;
2109
+ switch (step.kind) {
2110
+ case "agent":
2111
+ if (step.workflow)
2112
+ return l.runs.replace("{name}", workflowTitle?.(step.workflow) ?? step.workflow);
2113
+ if (step.run?.kind === "operation") return void 0;
2114
+ return step.run?.kind === "prompt" && step.run.promptTemplate.trim() ? firstWords(step.run.promptTemplate) : l.chooseRun;
2115
+ case "form":
2116
+ return step.inputs.length ? step.inputs.length === 1 ? step.inputs[0].label : l.fields.replace("{count}", String(step.inputs.length)) : l.noFields;
2117
+ case "upload":
2118
+ return step.hint;
2119
+ case "review":
2120
+ return step.instructions ? firstWords(step.instructions) : l.approvedBy;
2121
+ case "action": {
2122
+ const a = step.action;
2123
+ if (a.type === "sign")
2124
+ return !a.document ? l.chooseDocument : a.signers.length ? l.signers.replace("{count}", String(a.signers.length)) : void 0;
2125
+ if (a.type === "email_draft") {
2126
+ const to = a.to.find((t) => t.trim());
2127
+ return to ? l.emailTo.replace("{to}", to) : l.noRecipients;
2128
+ }
2129
+ if (a.type === "approval") return a.database ? l.approvalSummary : l.chooseDatabase;
2130
+ if (a.type === "create_project") return a.name || void 0;
2131
+ return a.tags.length ? l.reviewColumns.replace("{count}", String(a.tags.length)) : l.noColumns;
2132
+ }
1979
2133
  }
1980
2134
  }
1981
- var selectClass3 = "flex h-9 w-full rounded-md border border-input bg-background px-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
1982
- var STARTS = ["manual", "once", "repeat", "event", "task"];
1983
- function TriggerInspector({
1984
- trigger,
2135
+ function WorkflowCanvas({
2136
+ workflow,
1985
2137
  onChange,
1986
- agents = [],
1987
- eventKinds = [],
1988
- tasks = [],
1989
- signals = [],
2138
+ selected = null,
2139
+ onSelect,
2140
+ focus,
2141
+ onAddAfter,
2142
+ phases,
2143
+ workflowTitle,
2144
+ assigneeOf,
2145
+ trigger,
2146
+ renderIcon,
1990
2147
  labels,
1991
- testId = "trigger-inspector"
2148
+ className,
2149
+ reserveRight = 0,
2150
+ testId = "workflow-canvas"
1992
2151
  }) {
1993
- const l = { ...DEFAULT_TRIGGER_INSPECTOR_LABELS, ...labels };
1994
- const set = (patch) => onChange({ ...trigger, ...patch });
1995
- const events = eventKinds.some((k) => k.value === WORKFLOW_SIGNAL_EVENT) ? eventKinds : [...eventKinds, { value: WORKFLOW_SIGNAL_EVENT, label: l.stepSignals }];
1996
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", "data-testid": testId, children: [
1997
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: l.heading }),
1998
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
1999
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.start }),
2000
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", role: "radiogroup", "aria-label": l.start, children: STARTS.map((start) => /* @__PURE__ */ jsxRuntime.jsx(
2001
- "button",
2002
- {
2003
- type: "button",
2004
- role: "radio",
2005
- "aria-checked": trigger.start === start,
2006
- onClick: () => set({ start }),
2007
- className: ui.cn(
2008
- "rounded-md border px-3 py-2 text-left text-sm transition-colors",
2009
- trigger.start === start ? "border-primary bg-primary/10 text-primary" : "border-border hover:bg-muted/50"
2010
- ),
2011
- "data-testid": `${testId}-start-${start}`,
2012
- children: l.starts[start]
2013
- },
2014
- start
2015
- )) })
2016
- ] }),
2017
- trigger.start === "once" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2018
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.runAt }),
2019
- /* @__PURE__ */ jsxRuntime.jsx(
2020
- ui.Input,
2021
- {
2022
- type: "datetime-local",
2023
- value: trigger.runAt,
2024
- onChange: (e) => set({ runAt: e.target.value }),
2025
- "data-testid": `${testId}-run-at`
2026
- }
2027
- )
2028
- ] }),
2029
- trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkQDIIOZBP_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
2030
- trigger.start === "event" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2031
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.event }),
2032
- /* @__PURE__ */ jsxRuntime.jsxs(
2033
- "select",
2034
- {
2035
- className: selectClass3,
2036
- value: trigger.eventKind,
2037
- onChange: (e) => set({ eventKind: e.target.value, eventFilter: void 0 }),
2038
- "data-testid": `${testId}-event`,
2039
- children: [
2040
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.eventPlaceholder }),
2041
- events.map((k) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: k.value, children: k.label }, k.value))
2042
- ]
2043
- }
2044
- )
2045
- ] }),
2046
- trigger.start === "event" && trigger.eventKind === "mail_document_received" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2047
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-sender`, children: l.sender }),
2048
- /* @__PURE__ */ jsxRuntime.jsx(
2049
- ui.Input,
2050
- {
2051
- id: `${testId}-sender`,
2052
- type: "email",
2053
- value: String(trigger.eventFilter?.sender ?? ""),
2054
- placeholder: l.senderPlaceholder,
2055
- onChange: (e) => {
2056
- const sender = e.target.value.trim().toLowerCase();
2057
- set({ eventFilter: sender ? { sender } : void 0 });
2058
- },
2059
- "data-testid": `${testId}-sender`
2060
- }
2061
- )
2062
- ] }),
2063
- trigger.start === "event" && trigger.eventKind === "document_activity" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2064
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-reason`, children: l.documentReason }),
2065
- /* @__PURE__ */ jsxRuntime.jsxs(
2066
- "select",
2067
- {
2068
- id: `${testId}-reason`,
2069
- className: selectClass3,
2070
- value: String(trigger.eventFilter?.reason ?? ""),
2071
- onChange: (e) => set({ eventFilter: e.target.value ? { reason: e.target.value } : void 0 }),
2072
- "aria-describedby": `${testId}-reason-hint`,
2073
- "data-testid": `${testId}-reason`,
2074
- children: [
2075
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.documentReasons.any }),
2076
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "upload", children: l.documentReasons.upload }),
2077
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "edit", children: l.documentReasons.edit }),
2078
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "signed", children: l.documentReasons.signed })
2079
- ]
2080
- }
2081
- ),
2082
- /* @__PURE__ */ jsxRuntime.jsx(
2083
- "p",
2084
- {
2085
- id: `${testId}-reason-hint`,
2086
- className: "text-xs text-muted-foreground",
2087
- "data-testid": `${testId}-reason-hint`,
2088
- children: l.documentReasonHint
2089
- }
2090
- )
2091
- ] }),
2092
- isSignalTrigger(trigger) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2093
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-signal`, children: l.signal }),
2094
- /* @__PURE__ */ jsxRuntime.jsx(
2095
- ui.Input,
2096
- {
2097
- id: `${testId}-signal`,
2098
- list: `${testId}-signal-options`,
2099
- value: trigger.signal,
2100
- placeholder: l.signalPlaceholder,
2101
- onChange: (e) => set({ signal: e.target.value.trim().toLowerCase() }),
2102
- "data-testid": `${testId}-signal`
2152
+ const l = react.useMemo(() => ({ ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...labels }), [labels]);
2153
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
2154
+ const editable = !!onChange;
2155
+ const built = react.useMemo(() => {
2156
+ const layout = layoutWithDefaults(workflow);
2157
+ const all = chunkFSTIAEJW_cjs.workflowSteps(workflow);
2158
+ const roots = all.filter((s) => chunkFSTIAEJW_cjs.stepDependencies(all, s.id).length === 0);
2159
+ const triggerNode = trigger ? [
2160
+ {
2161
+ id: TRIGGER_NODE,
2162
+ type: "trigger",
2163
+ deletable: false,
2164
+ selected: selected === TRIGGER_NODE,
2165
+ position: layout[TRIGGER_NODE] ?? {
2166
+ x: Math.min(0, ...Object.values(layout).map((p) => p.x)) - 320,
2167
+ y: roots.length ? roots.reduce((sum, s) => sum + (layout[s.id]?.y ?? 0), 0) / roots.length : 0
2168
+ },
2169
+ data: { title: trigger.title, summary: trigger.summary, l, onAdd: onAddAfter, testId }
2170
+ }
2171
+ ] : [];
2172
+ return [
2173
+ ...triggerNode,
2174
+ ...all.map((step) => ({
2175
+ id: step.id,
2176
+ type: "step",
2177
+ position: layout[step.id] ?? { x: 0, y: 0 },
2178
+ selected: step.id === selected,
2179
+ data: {
2180
+ step,
2181
+ phase: phases?.[step.id],
2182
+ summary: summaryOf(step, l, workflowTitle),
2183
+ assignee: assigneeOf?.(step),
2184
+ icon: step.icon && renderIcon ? renderIcon(step.icon) : void 0,
2185
+ l,
2186
+ onAdd: onAddAfter,
2187
+ testId
2103
2188
  }
2104
- ),
2105
- /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: `${testId}-signal-options`, children: signals.map((s) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: s.value, children: s.label }, s.value)) }),
2106
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.signalHint })
2107
- ] }),
2108
- trigger.start === "task" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2109
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.afterTask }),
2110
- /* @__PURE__ */ jsxRuntime.jsxs(
2111
- "select",
2112
- {
2113
- className: selectClass3,
2114
- value: trigger.afterTaskId,
2115
- onChange: (e) => set({ afterTaskId: e.target.value }),
2116
- "data-testid": `${testId}-after-task`,
2117
- children: [
2118
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.afterTaskPlaceholder }),
2119
- tasks.map((t) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: t.value, children: t.label }, t.value))
2120
- ]
2189
+ }))
2190
+ ];
2191
+ }, [
2192
+ workflow,
2193
+ selected,
2194
+ phases,
2195
+ workflowTitle,
2196
+ assigneeOf,
2197
+ trigger,
2198
+ renderIcon,
2199
+ l,
2200
+ onAddAfter,
2201
+ testId
2202
+ ]);
2203
+ const [nodes, setNodes] = react.useState(built);
2204
+ react.useEffect(() => setNodes(built), [built]);
2205
+ const edges = react.useMemo(
2206
+ () => steps.flatMap((s) => {
2207
+ const deps = chunkFSTIAEJW_cjs.stepDependencies(steps, s.id);
2208
+ const from = deps.length ? deps : trigger ? [TRIGGER_NODE] : [];
2209
+ return from.map((d) => ({
2210
+ id: `${d}->${s.id}`,
2211
+ source: d,
2212
+ target: s.id,
2213
+ type: "smoothstep",
2214
+ deletable: d !== TRIGGER_NODE,
2215
+ markerEnd: { type: react$1.MarkerType.ArrowClosed, width: 16, height: 16 },
2216
+ animated: phases?.[s.id] === "running"
2217
+ }));
2218
+ }),
2219
+ [steps, phases, trigger]
2220
+ );
2221
+ const onNodesChange = react.useCallback(
2222
+ (changes) => {
2223
+ setNodes((ns) => react$1.applyNodeChanges(changes, ns));
2224
+ if (!onChange) return;
2225
+ let next = workflow;
2226
+ for (const c of changes) {
2227
+ if (c.type === "position" && c.dragging === false && c.position && c.id !== TRIGGER_NODE) {
2228
+ next = moveStep(next, c.id, c.position);
2121
2229
  }
2122
- )
2123
- ] }),
2124
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2125
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.agent }),
2126
- /* @__PURE__ */ jsxRuntime.jsx(
2127
- chunk5FSULBPE_cjs.AgentSelect,
2230
+ }
2231
+ if (next !== workflow) onChange(next);
2232
+ },
2233
+ [workflow, onChange]
2234
+ );
2235
+ const onConnect = react.useCallback(
2236
+ (c) => {
2237
+ if (!onChange || !c.source || !c.target) return;
2238
+ if (c.source === TRIGGER_NODE) onChange(updateStep(workflow, c.target, { after: [] }));
2239
+ else onChange(connectSteps(workflow, c.source, c.target));
2240
+ },
2241
+ [workflow, onChange]
2242
+ );
2243
+ const frame = react.useRef(null);
2244
+ const flowRef = react.useRef(null);
2245
+ const hasTrigger = !!trigger;
2246
+ const selectedRef = react.useRef(selected);
2247
+ selectedRef.current = selected;
2248
+ const fit = react.useCallback(
2249
+ async (flow, anchorOnSelection, whole = false) => {
2250
+ await flow.fitView({
2251
+ padding: { top: "48px", bottom: "48px", left: "48px", right: `${reserveRight + 48}px` },
2252
+ maxZoom: 1
2253
+ });
2254
+ if (whole) return;
2255
+ const box = frame.current;
2256
+ const picked = anchorOnSelection ? selectedRef.current : null;
2257
+ const view = readableViewport(
2258
+ flow.getNodes(),
2259
+ flow.getZoom(),
2260
+ { width: box?.clientWidth ?? 0, height: box?.clientHeight ?? 0 },
2128
2261
  {
2129
- agents,
2130
- value: trigger.agentId,
2131
- onValueChange: (agentId) => set({ agentId }),
2132
- hideLabel: true,
2133
- testId: `${testId}-agent`
2262
+ anchor: picked ?? (hasTrigger ? TRIGGER_NODE : null),
2263
+ centre: !!picked,
2264
+ reserveRight
2134
2265
  }
2135
- )
2136
- ] }),
2137
- trigger.start !== "manual" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2138
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.access }),
2139
- /* @__PURE__ */ jsxRuntime.jsxs(
2140
- "select",
2141
- {
2142
- className: selectClass3,
2143
- value: trigger.access,
2144
- onChange: (e) => set({ access: e.target.value === "standing" ? "standing" : "ask_each_run" }),
2145
- "data-testid": `${testId}-access`,
2146
- children: [
2147
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "ask_each_run", children: l.accessAsk }),
2148
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "standing", children: l.accessStanding })
2149
- ]
2266
+ );
2267
+ if (view) await flow.setViewport(view);
2268
+ },
2269
+ [reserveRight, hasTrigger]
2270
+ );
2271
+ const onInit = react.useCallback(
2272
+ async (flow) => {
2273
+ flowRef.current = flow;
2274
+ await fit(flow, false);
2275
+ },
2276
+ [fit]
2277
+ );
2278
+ const target = focus ?? selected;
2279
+ const revealed = react.useRef(null);
2280
+ react.useEffect(() => {
2281
+ const flow = flowRef.current;
2282
+ const box = frame.current;
2283
+ const node = target ? flow?.getNode(target) : void 0;
2284
+ const key = `${target}:${reserveRight}`;
2285
+ if (!target) revealed.current = null;
2286
+ if (!flow || !box || !node || revealed.current === key) return;
2287
+ revealed.current = key;
2288
+ const view = flow.getViewport();
2289
+ const centre = revealCenter(
2290
+ node,
2291
+ view,
2292
+ { width: box.clientWidth, height: box.clientHeight },
2293
+ reserveRight
2294
+ );
2295
+ if (centre) void flow.setCenter(centre.x, centre.y, { zoom: view.zoom, duration: 250 });
2296
+ }, [target, nodes, reserveRight]);
2297
+ const onDelete = react.useCallback(
2298
+ ({ nodes: gone, edges: cut }) => {
2299
+ if (!onChange) return;
2300
+ const removed = new Set(gone.map((n) => n.id));
2301
+ let next = gone.reduce((w, n) => removeStep(w, n.id), workflow);
2302
+ for (const e of cut) {
2303
+ if (!removed.has(e.source) && !removed.has(e.target)) {
2304
+ next = disconnectSteps(next, e.source, e.target);
2150
2305
  }
2151
- )
2152
- ] })
2153
- ] });
2154
- }
2155
-
2156
- // src/workflow-canvas/viewport.ts
2157
- var READABLE_ZOOM = 0.7;
2158
- var DEFAULT_W = 256;
2159
- var DEFAULT_H = 80;
2160
- var MARGIN = 48;
2161
- var sizeOf = (n) => ({
2162
- w: n.measured?.width ?? DEFAULT_W,
2163
- h: n.measured?.height ?? DEFAULT_H
2164
- });
2165
- function readableViewport(nodes, fittedZoom, frame, {
2166
- anchor,
2167
- centre = false,
2168
- reserveRight = 0
2169
- } = {}) {
2170
- if (fittedZoom >= READABLE_ZOOM || !frame.height || nodes.length === 0) return null;
2171
- const z = READABLE_ZOOM;
2172
- const at = nodes.find((n) => n.id === anchor) ?? nodes.reduce((a, b) => b.position.x < a.position.x ? b : a);
2173
- const { w, h } = sizeOf(at);
2174
- const y = frame.height / 2 - (at.position.y + h / 2) * z;
2175
- if (centre && at.id === anchor) {
2176
- const visible = Math.max(0, frame.width - reserveRight);
2177
- return { x: visible / 2 - (at.position.x + w / 2) * z, y, zoom: z };
2178
- }
2179
- return { x: MARGIN - at.position.x * z, y, zoom: z };
2180
- }
2181
- function revealCenter(node, view, frame, reserveRight = 0) {
2182
- const { w, h } = sizeOf(node);
2183
- const { x, y, zoom } = view;
2184
- const left = node.position.x * zoom + x;
2185
- const top = node.position.y * zoom + y;
2186
- const right = frame.width - reserveRight;
2187
- if (left >= 16 && top >= 16 && left + w * zoom <= right - 16 && top + h * zoom <= frame.height - 16)
2188
- return null;
2189
- return {
2190
- x: node.position.x + w / 2 + reserveRight / 2 / zoom,
2191
- y: node.position.y + h / 2
2192
- };
2193
- }
2194
- var DEFAULT_WORKFLOW_CANVAS_LABELS = {
2195
- ...chunkPIJPM5RA_cjs.DEFAULT_STEP_KIND_LABELS,
2196
- redline: "Tracked changes",
2197
- branch: "Branch",
2198
- kindHints: {
2199
- form: "Ask for details",
2200
- upload: "Collect files",
2201
- agent: "Run a skill or an instruction",
2202
- review: "A person approves",
2203
- sign: "People e-sign a document",
2204
- email_draft: "Prepare an email to send",
2205
- tabular_review: "Review documents in a grid",
2206
- approval: "Submit a request for a decision",
2207
- create_project: "Open a project from the run"
2208
- },
2209
- addNext: "Add the next step",
2210
- runs: "Runs \u201C{name}\u201D",
2211
- chooseRun: "Choose a skill or write an instruction",
2212
- fields: "{count} fields",
2213
- noFields: "No fields yet",
2214
- approvedBy: "A person approves",
2215
- signers: "{count} signers",
2216
- chooseDocument: "Choose the document to sign",
2217
- emailTo: "To {to}",
2218
- noRecipients: "Add a recipient",
2219
- reviewColumns: "{count} columns",
2220
- noColumns: "Choose the columns",
2221
- approvalSummary: "Request: decided on its row",
2222
- chooseDatabase: "Choose the requests database",
2223
- assignee: "{name}",
2224
- remind: "Reminds after {hours}h",
2225
- emptyTitle: "Start your workflow",
2226
- emptyHint: "Add the first step: what should happen when it starts?",
2227
- fitView: "Fit view"
2228
- };
2229
- var TRIGGER_NODE = "__trigger";
2230
- var KINDS = chunkPIJPM5RA_cjs.WORKFLOW_STEP_KINDS;
2231
- function AddNext({
2232
- from,
2233
- onAdd,
2234
- l,
2235
- testId
2236
- }) {
2237
- const [open, setOpen] = react.useState(false);
2238
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open, onOpenChange: setOpen, children: [
2239
- /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2240
- "button",
2241
- {
2242
- type: "button",
2243
- className: "wf-add nodrag nopan flex size-7 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground",
2244
- "aria-label": l.addNext,
2245
- "data-testid": `${testId}-add-after-${from === TRIGGER_NODE ? "trigger" : from}`,
2246
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" })
2247
2306
  }
2248
- ) }),
2249
- /* @__PURE__ */ jsxRuntime.jsxs(ui.PopoverContent, { side: "right", align: "start", className: "w-60 p-1.5", children: [
2250
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 pb-1 pt-0.5 text-xs font-medium text-muted-foreground", children: l.addNext }),
2251
- KINDS.map((kind) => {
2252
- const Icon = chunkPIJPM5RA_cjs.STEP_KIND_ICONS[kind];
2253
- return /* @__PURE__ */ jsxRuntime.jsxs(
2254
- "button",
2255
- {
2256
- type: "button",
2257
- onClick: (e) => {
2258
- e.stopPropagation();
2259
- setOpen(false);
2260
- onAdd(from, kind);
2261
- },
2262
- className: ui.cn(
2263
- `wf-kind-${kind}`,
2264
- "flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-muted"
2265
- ),
2266
- "data-testid": `${testId}-add-after-${from === TRIGGER_NODE ? "trigger" : from}-${kind}`,
2267
- children: [
2268
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-7 shrink-0 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) }),
2269
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0", children: [
2270
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-sm font-medium", children: l[kind] }),
2271
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-muted-foreground", children: l.kindHints[kind] })
2272
- ] })
2273
- ]
2274
- },
2275
- kind
2276
- );
2277
- })
2278
- ] })
2279
- ] });
2280
- }
2281
- function PhaseMark({ phase }) {
2282
- if (phase === "running") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "wf-kind-text size-4 animate-spin" });
2283
- if (phase === "waiting") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Hourglass, { className: "wf-kind-text size-4" });
2284
- if (phase === "done") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "wf-kind-text size-4" });
2285
- if (phase === "failed") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "size-4 text-destructive" });
2286
- if (phase === "skipped") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MinusCircle, { className: "size-4 text-muted-foreground" });
2287
- return null;
2288
- }
2289
- function StepNode({ data }) {
2290
- const { step, phase, summary, assignee, icon, l, onAdd, testId } = data;
2291
- const kind = chunkPIJPM5RA_cjs.stepKindOf(step);
2292
- const KindIcon = chunkPIJPM5RA_cjs.STEP_KIND_ICONS[kind];
2293
- const redline = step.kind === "agent" && !!step.editDocument;
2307
+ onChange(next);
2308
+ },
2309
+ [workflow, onChange]
2310
+ );
2294
2311
  return /* @__PURE__ */ jsxRuntime.jsxs(
2295
2312
  "div",
2296
2313
  {
2297
2314
  className: ui.cn(
2298
- "wf-node w-64 py-3 pl-4 pr-3 text-left",
2299
- `wf-kind-${kind}`,
2300
- phase && `wf-phase-${phase}`
2315
+ "relative h-[max(560px,calc(100dvh-200px))] w-full overflow-hidden rounded-xl border border-border bg-muted/30",
2316
+ className
2301
2317
  ),
2302
- "data-testid": `${testId}-node-${step.id}`,
2303
- "data-phase": phase,
2318
+ ref: frame,
2319
+ "data-testid": testId,
2304
2320
  children: [
2305
- /* @__PURE__ */ jsxRuntime.jsx(chunkI4IS6ST6_cjs.ChevronShape, {}),
2306
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "target", position: react$1.Position.Left }),
2307
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2.5", children: [
2308
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg]:size-4", children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}) }),
2309
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
2310
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
2311
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-kind-text text-[10px] font-semibold uppercase tracking-wider", children: l[kind] }),
2312
- /* @__PURE__ */ jsxRuntime.jsx(PhaseMark, { phase })
2313
- ] }),
2314
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-semibold leading-snug", children: step.title }),
2315
- summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-snug text-muted-foreground", children: summary }),
2316
- (redline || step.kind === "agent" && step.branch || assignee) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1.5 flex flex-wrap gap-1", children: [
2317
- step.kind === "agent" && step.branch && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground", children: [
2318
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GitBranch, { className: "size-3" }),
2319
- " ",
2320
- l.branch
2321
- ] }),
2322
- redline && /* @__PURE__ */ jsxRuntime.jsxs(
2323
- "span",
2321
+ /* @__PURE__ */ jsxRuntime.jsxs(
2322
+ react$1.ReactFlow,
2323
+ {
2324
+ nodes,
2325
+ edges,
2326
+ nodeTypes: NODE_TYPES,
2327
+ onNodesChange,
2328
+ onConnect,
2329
+ onDelete,
2330
+ isValidConnection: (c) => !!c.source && !!c.target && !wouldCycle(workflow, c.source, c.target),
2331
+ onNodeClick: (_, node) => onSelect?.(node.id),
2332
+ onPaneClick: () => onSelect?.(null),
2333
+ nodesDraggable: editable,
2334
+ nodesConnectable: editable,
2335
+ elementsSelectable: true,
2336
+ deleteKeyCode: editable ? ["Backspace", "Delete"] : null,
2337
+ onInit,
2338
+ minZoom: 0.3,
2339
+ proOptions: { hideAttribution: true },
2340
+ children: [
2341
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Background, { variant: react$1.BackgroundVariant.Dots, gap: 18, size: 1.5 }),
2342
+ /* @__PURE__ */ jsxRuntime.jsx(react$1.Controls, { showInteractive: false, showFitView: false, position: "bottom-left", children: /* @__PURE__ */ jsxRuntime.jsx(
2343
+ react$1.ControlButton,
2344
+ {
2345
+ className: "react-flow__controls-fitview",
2346
+ onClick: () => flowRef.current && void fit(flowRef.current, false, true),
2347
+ title: l.fitView,
2348
+ "aria-label": l.fitView,
2349
+ "data-testid": `${testId}-fit`,
2350
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, {})
2351
+ }
2352
+ ) }),
2353
+ steps.length > 3 && /* @__PURE__ */ jsxRuntime.jsx(
2354
+ react$1.MiniMap,
2355
+ {
2356
+ pannable: true,
2357
+ zoomable: true,
2358
+ position: "bottom-right",
2359
+ className: "wf-minimap !rounded-lg !border !border-border",
2360
+ style: { width: 168, height: 104 },
2361
+ nodeBorderRadius: 8,
2362
+ nodeStrokeWidth: 0
2363
+ }
2364
+ )
2365
+ ]
2366
+ }
2367
+ ),
2368
+ steps.length === 0 && onAddAfter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-16 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
2369
+ "div",
2370
+ {
2371
+ className: "pointer-events-auto rounded-xl border border-dashed border-border bg-card/90 p-5 text-center shadow-sm backdrop-blur",
2372
+ "data-testid": `${testId}-empty`,
2373
+ children: [
2374
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: l.emptyTitle }),
2375
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.emptyHint }),
2376
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 grid grid-cols-2 gap-2", children: KINDS.map((kind) => {
2377
+ const Icon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
2378
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2379
+ "button",
2380
+ {
2381
+ type: "button",
2382
+ onClick: () => onAddAfter(TRIGGER_NODE, kind),
2383
+ className: ui.cn(
2384
+ `wf-kind-${kind}`,
2385
+ "flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-left text-sm hover:bg-muted"
2386
+ ),
2387
+ "data-testid": `${testId}-empty-${kind}`,
2388
+ children: [
2389
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-6 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5" }) }),
2390
+ l[kind]
2391
+ ]
2392
+ },
2393
+ kind
2394
+ );
2395
+ }) })
2396
+ ]
2397
+ }
2398
+ ) })
2399
+ ]
2400
+ }
2401
+ );
2402
+ }
2403
+ var DEFAULT_WORKFLOW_OUTLINE_LABELS = {
2404
+ stepName: "Step name",
2405
+ prompt: "What should the AI do?",
2406
+ promptPlaceholder: "Write the instruction, e.g. \u201CSummarise the engagement letter and list the risks.\u201D",
2407
+ orSkill: "or run a skill",
2408
+ noSkill: "No skill: use the prompt",
2409
+ more: "More",
2410
+ moveUp: "Move up",
2411
+ moveDown: "Move down",
2412
+ addGoal: "Add a goal and checks",
2413
+ goal: "Goal",
2414
+ goalPlaceholder: "What this step must achieve, in a sentence.",
2415
+ criteria: "Must be true (one per line)",
2416
+ criteriaPlaceholder: "Every document on the checklist is present\nWhat is missing is listed by name",
2417
+ less: "Less",
2418
+ remove: "Remove step",
2419
+ addPrompt: "Add a prompt",
2420
+ promptTitle: "Prompt",
2421
+ addOther: "Other step",
2422
+ setUp: "Open More to set this step up.",
2423
+ branched: "Some steps run in parallel. They are listed in order here; change what waits for what in the canvas."
2424
+ };
2425
+ var OTHER_KINDS = chunk3YGSCNXQ_cjs.WORKFLOW_STEP_KINDS.filter((k) => k !== "agent");
2426
+ function WorkflowOutline({
2427
+ workflow,
2428
+ onChange,
2429
+ workflows = [],
2430
+ people,
2431
+ tags,
2432
+ documents,
2433
+ databases,
2434
+ labels,
2435
+ canvasLabels,
2436
+ inspectorLabels,
2437
+ testId = "workflow-outline"
2438
+ }) {
2439
+ const l = { ...DEFAULT_WORKFLOW_OUTLINE_LABELS, ...labels };
2440
+ const cl = { ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...canvasLabels };
2441
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
2442
+ const [more, setMore] = react.useState(null);
2443
+ const [adding, setAdding] = react.useState(false);
2444
+ const branched = !isLinear(workflow);
2445
+ const [goalOpen, setGoalOpen] = react.useState({});
2446
+ const skills = workflows.filter((w) => w.id !== workflow.id);
2447
+ const fields = chunkFSTIAEJW_cjs.runFields(workflow).map((f) => f.name);
2448
+ const append = (kind) => {
2449
+ const added = addStep(workflow, kind, {
2450
+ after: steps.at(-1)?.id,
2451
+ title: kind === "agent" ? l.promptTitle : void 0
2452
+ });
2453
+ const { id } = added;
2454
+ onChange(
2455
+ kind === "agent" ? updateStep(added.workflow, id, { run: { kind: "prompt", promptTemplate: "" } }) : added.workflow
2456
+ );
2457
+ setMore(kind === "agent" ? null : id);
2458
+ };
2459
+ const patch = (id, p) => onChange(updateStep(workflow, id, p));
2460
+ const row = (step, i) => {
2461
+ const kind = step.kind === "action" ? step.action.type : step.kind;
2462
+ const Icon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
2463
+ const open = more === step.id;
2464
+ const tid = `${testId}-${step.id}`;
2465
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2466
+ "li",
2467
+ {
2468
+ className: ui.cn(`wf-kind-${kind}`, "space-y-2 rounded-lg border border-border bg-card p-3"),
2469
+ "data-testid": tid,
2470
+ children: [
2471
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2472
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-7 shrink-0 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) }),
2473
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-4 shrink-0 text-xs tabular-nums text-muted-foreground", children: i + 1 }),
2474
+ /* @__PURE__ */ jsxRuntime.jsx(
2475
+ ui.Input,
2476
+ {
2477
+ value: step.title,
2478
+ onChange: (e) => patch(step.id, { title: e.target.value }),
2479
+ placeholder: l.stepName,
2480
+ "aria-label": l.stepName,
2481
+ className: "h-8 min-w-0 flex-1 font-medium",
2482
+ "data-testid": `${tid}-title`
2483
+ }
2484
+ ),
2485
+ !branched && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2486
+ /* @__PURE__ */ jsxRuntime.jsx(
2487
+ ui.Button,
2324
2488
  {
2325
- className: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
2326
- "data-testid": `${testId}-node-${step.id}-redline`,
2327
- children: [
2328
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FilePenLine, { className: "size-3" }),
2329
- " ",
2330
- l.redline
2331
- ]
2489
+ size: "icon",
2490
+ variant: "ghost",
2491
+ className: "size-7 shrink-0",
2492
+ disabled: i === 0,
2493
+ onClick: () => onChange(shiftStep(workflow, step.id, -1)),
2494
+ "aria-label": l.moveUp,
2495
+ title: l.moveUp,
2496
+ "data-testid": `${tid}-up`,
2497
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "size-4" })
2332
2498
  }
2333
2499
  ),
2334
- assignee && /* @__PURE__ */ jsxRuntime.jsxs(
2335
- "span",
2500
+ /* @__PURE__ */ jsxRuntime.jsx(
2501
+ ui.Button,
2336
2502
  {
2337
- className: "inline-flex max-w-full items-center gap-1 truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
2338
- title: assignee,
2339
- "data-testid": `${testId}-node-${step.id}-assignee`,
2340
- children: [
2341
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserRound, { className: "size-3 shrink-0" }),
2342
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: l.assignee.replace(
2343
- "{name}",
2344
- assignee.charAt(0).toUpperCase() + assignee.slice(1)
2345
- ) })
2346
- ]
2503
+ size: "icon",
2504
+ variant: "ghost",
2505
+ className: "size-7 shrink-0",
2506
+ disabled: i === steps.length - 1,
2507
+ onClick: () => onChange(shiftStep(workflow, step.id, 1)),
2508
+ "aria-label": l.moveDown,
2509
+ title: l.moveDown,
2510
+ "data-testid": `${tid}-down`,
2511
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "size-4" })
2512
+ }
2513
+ )
2514
+ ] }),
2515
+ /* @__PURE__ */ jsxRuntime.jsx(
2516
+ ui.Button,
2517
+ {
2518
+ size: "icon",
2519
+ variant: "ghost",
2520
+ className: "size-7 shrink-0",
2521
+ onClick: () => {
2522
+ onChange(removeStep(workflow, step.id));
2523
+ if (open) setMore(null);
2524
+ },
2525
+ "aria-label": l.remove,
2526
+ title: l.remove,
2527
+ "data-testid": `${tid}-remove`,
2528
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4" })
2529
+ }
2530
+ )
2531
+ ] }),
2532
+ step.kind === "agent" && (step.workflow ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": `${tid}-skill-name`, children: skills.find((w) => w.id === step.workflow)?.title ?? step.workflow }) : /* @__PURE__ */ jsxRuntime.jsx(
2533
+ ui.Textarea,
2534
+ {
2535
+ value: step.run?.kind === "prompt" ? step.run.promptTemplate : "",
2536
+ rows: 3,
2537
+ onChange: (e) => patch(step.id, { run: { kind: "prompt", promptTemplate: e.target.value } }),
2538
+ placeholder: l.promptPlaceholder,
2539
+ "aria-label": l.prompt,
2540
+ "data-testid": `${tid}-prompt`
2541
+ }
2542
+ )),
2543
+ step.kind === "agent" && (step.goal || step.criteria?.length || goalOpen[step.id] ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", "data-testid": `${tid}-goal-box`, children: [
2544
+ /* @__PURE__ */ jsxRuntime.jsx(
2545
+ ui.Textarea,
2546
+ {
2547
+ value: step.goal ?? "",
2548
+ rows: 1,
2549
+ onChange: (e) => patch(step.id, { goal: e.target.value || void 0 }),
2550
+ placeholder: l.goalPlaceholder,
2551
+ "aria-label": l.goal,
2552
+ "data-testid": `${tid}-goal`
2553
+ }
2554
+ ),
2555
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block text-xs text-muted-foreground", children: [
2556
+ l.criteria,
2557
+ /* @__PURE__ */ jsxRuntime.jsx(
2558
+ ui.Textarea,
2559
+ {
2560
+ value: (step.criteria ?? []).join("\n"),
2561
+ rows: 3,
2562
+ onChange: (e) => {
2563
+ const lines = e.target.value.split("\n");
2564
+ patch(step.id, { criteria: e.target.value ? lines : void 0 });
2565
+ },
2566
+ placeholder: l.criteriaPlaceholder,
2567
+ className: "mt-1 text-foreground",
2568
+ "data-testid": `${tid}-criteria`
2347
2569
  }
2348
2570
  )
2349
2571
  ] })
2350
- ] })
2351
- ] }),
2352
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "source", position: react$1.Position.Right }),
2353
- onAdd && /* @__PURE__ */ jsxRuntime.jsx(AddNext, { from: step.id, onAdd, l, testId })
2354
- ]
2355
- }
2356
- );
2572
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
2573
+ "button",
2574
+ {
2575
+ type: "button",
2576
+ onClick: () => setGoalOpen((o) => ({ ...o, [step.id]: true })),
2577
+ className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
2578
+ "data-testid": `${tid}-add-goal`,
2579
+ children: [
2580
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Target, { className: "size-3.5" }),
2581
+ " ",
2582
+ l.addGoal
2583
+ ]
2584
+ }
2585
+ )),
2586
+ step.kind === "agent" && skills.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
2587
+ l.orSkill,
2588
+ /* @__PURE__ */ jsxRuntime.jsxs(
2589
+ "select",
2590
+ {
2591
+ className: "h-8 min-w-0 flex-1 rounded-md border border-input bg-background px-2 text-sm text-foreground",
2592
+ value: step.workflow ?? "",
2593
+ onChange: (e) => {
2594
+ const id = e.target.value;
2595
+ if (!id)
2596
+ patch(step.id, {
2597
+ workflow: void 0,
2598
+ with: void 0,
2599
+ run: { kind: "prompt", promptTemplate: "" }
2600
+ });
2601
+ else
2602
+ patch(step.id, {
2603
+ workflow: id,
2604
+ run: void 0,
2605
+ with: prefillSkillInputs(
2606
+ skills.find((w) => w.id === id),
2607
+ fields,
2608
+ step.with
2609
+ )
2610
+ });
2611
+ },
2612
+ "data-testid": `${tid}-skill`,
2613
+ children: [
2614
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.noSkill }),
2615
+ skills.map((w) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: w.id, children: w.title }, w.id))
2616
+ ]
2617
+ }
2618
+ )
2619
+ ] }),
2620
+ step.kind !== "agent" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.setUp }),
2621
+ /* @__PURE__ */ jsxRuntime.jsxs(
2622
+ "button",
2623
+ {
2624
+ type: "button",
2625
+ onClick: () => setMore(open ? null : step.id),
2626
+ className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
2627
+ "aria-expanded": open,
2628
+ "data-testid": `${tid}-more`,
2629
+ children: [
2630
+ open ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-3.5" }),
2631
+ open ? l.less : l.more
2632
+ ]
2633
+ }
2634
+ ),
2635
+ open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
2636
+ StepInspector,
2637
+ {
2638
+ workflow,
2639
+ stepId: step.id,
2640
+ onChange,
2641
+ onSelect: () => setMore(null),
2642
+ workflows,
2643
+ people,
2644
+ tags,
2645
+ documents,
2646
+ databases,
2647
+ labels: inspectorLabels,
2648
+ testId: `${tid}-inspector`
2649
+ }
2650
+ ) })
2651
+ ]
2652
+ },
2653
+ step.id
2654
+ );
2655
+ };
2656
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-2xl space-y-3", "data-testid": testId, children: [
2657
+ branched && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", "data-testid": `${testId}-branched`, children: l.branched }),
2658
+ /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "space-y-2", children: steps.map(row) }),
2659
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2660
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { size: "sm", onClick: () => append("agent"), "data-testid": `${testId}-add-prompt`, children: [
2661
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
2662
+ " ",
2663
+ l.addPrompt
2664
+ ] }),
2665
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open: adding, onOpenChange: setAdding, children: [
2666
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { size: "sm", variant: "ghost", "data-testid": `${testId}-add-other`, children: [
2667
+ l.addOther,
2668
+ " ",
2669
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "size-4" })
2670
+ ] }) }),
2671
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { align: "start", className: "w-60 p-1.5", children: OTHER_KINDS.map((kind) => {
2672
+ const Icon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
2673
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2674
+ "button",
2675
+ {
2676
+ type: "button",
2677
+ onClick: () => {
2678
+ setAdding(false);
2679
+ append(kind);
2680
+ },
2681
+ className: ui.cn(
2682
+ `wf-kind-${kind}`,
2683
+ "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted"
2684
+ ),
2685
+ "data-testid": `${testId}-add-${kind}`,
2686
+ children: [
2687
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-6 shrink-0 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5" }) }),
2688
+ cl[kind]
2689
+ ]
2690
+ },
2691
+ kind
2692
+ );
2693
+ }) })
2694
+ ] })
2695
+ ] })
2696
+ ] });
2357
2697
  }
2358
- function TriggerNode({ data }) {
2359
- return /* @__PURE__ */ jsxRuntime.jsxs(
2360
- "div",
2698
+
2699
+ // src/workflow-canvas/trigger.ts
2700
+ var WORKFLOW_SIGNAL_EVENT = "workflow_signal";
2701
+ var DEFAULT_WORKFLOW_TRIGGER = {
2702
+ start: "manual",
2703
+ runAt: "",
2704
+ rrule: "",
2705
+ timezone: typeof Intl !== "undefined" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "UTC",
2706
+ eventKind: "",
2707
+ signal: "",
2708
+ afterTaskId: "",
2709
+ agentId: "",
2710
+ access: "ask_each_run"
2711
+ };
2712
+ function triggerProblem(trigger) {
2713
+ if (trigger.start === "once" && !trigger.runAt) return "runAt";
2714
+ if (trigger.start === "repeat" && !trigger.rrule.trim()) return "rrule";
2715
+ if (trigger.start === "event" && !trigger.eventKind.trim()) return "event";
2716
+ if (isSignalTrigger(trigger) && !trigger.signal.trim()) return "signal";
2717
+ if (trigger.start === "task" && !trigger.afterTaskId) return "task";
2718
+ return null;
2719
+ }
2720
+ var isSignalTrigger = (trigger) => trigger.start === "event" && trigger.eventKind.trim() === WORKFLOW_SIGNAL_EVENT;
2721
+ function eventFilter(trigger) {
2722
+ if (trigger.start !== "event") return null;
2723
+ if (isSignalTrigger(trigger)) return { signal: trigger.signal.trim() };
2724
+ return trigger.eventFilter && Object.keys(trigger.eventFilter).length ? trigger.eventFilter : null;
2725
+ }
2726
+ function triggerFields(trigger, clearOthers) {
2727
+ const none = clearOthers ? null : void 0;
2728
+ const filter = eventFilter(trigger);
2729
+ return {
2730
+ timezone: trigger.timezone,
2731
+ rrule: trigger.start === "repeat" ? trigger.rrule.trim() : none,
2732
+ run_at: trigger.start === "once" ? chunkQFSFTO7I_cjs.localInputToIso(trigger.runAt) : none,
2733
+ event_kind: trigger.start === "event" ? trigger.eventKind.trim() : none,
2734
+ // A step signal is `workflow_signal` narrowed to one signal name.
2735
+ event_filter: filter ?? none,
2736
+ after_conversation_ext_id: trigger.start === "task" ? trigger.afterTaskId : none,
2737
+ on_demand: trigger.start === "manual"
2738
+ };
2739
+ }
2740
+ var authMode = (trigger) => trigger.start === "manual" ? "run_now_temp" : trigger.access === "standing" ? "scheduled_permanent" : "scheduled_require_auth";
2741
+ var withoutUndefined = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
2742
+ function plan(value, options) {
2743
+ return {
2744
+ goal: value.workflow.description,
2745
+ criteria: [],
2746
+ max_passes: 3,
2747
+ documents: [],
2748
+ steps: chunkVXCZFJU7_cjs.toPlanSteps(value.workflow, options),
2749
+ // What a run is started with (checked by the server when one starts).
2750
+ inputs: chunkVXCZFJU7_cjs.toPlanInputs(value.workflow.inputs)
2751
+ };
2752
+ }
2753
+ function builderToWorkflowRequest(value, workspaceId, options = {}) {
2754
+ return withoutUndefined({
2755
+ workspace_ext_id: workspaceId,
2756
+ name: value.workflow.title,
2757
+ description: value.workflow.description,
2758
+ active: true,
2759
+ shared: false,
2760
+ ...triggerFields(value.trigger, false),
2761
+ prompt: "",
2762
+ skill_ref: null,
2763
+ skill_inputs: null,
2764
+ agent_ext_id: value.trigger.agentId || null,
2765
+ auth_mode: authMode(value.trigger),
2766
+ plan: plan(value, options)
2767
+ });
2768
+ }
2769
+ function builderToWorkflowUpdate(value, options = {}) {
2770
+ return withoutUndefined({
2771
+ name: value.workflow.title,
2772
+ description: value.workflow.description,
2773
+ ...triggerFields(value.trigger, true),
2774
+ // The steps are what runs (a classic automation's single prompt or skill becomes its one step).
2775
+ prompt: "",
2776
+ skill_ref: null,
2777
+ skill_inputs: null,
2778
+ agent_ext_id: value.trigger.agentId || null,
2779
+ auth_mode: authMode(value.trigger),
2780
+ plan: plan(value, options)
2781
+ });
2782
+ }
2783
+ function workflowRecordToBuilder(record) {
2784
+ const planned = record.plan?.steps ?? [];
2785
+ const steps = planned.length ? chunkVXCZFJU7_cjs.fromPlanSteps(planned) : record.prompt || record.skill_ref ? [
2361
2786
  {
2362
- className: "wf-start wf-kind-start relative w-60 px-4 py-3 text-left",
2363
- "data-testid": `${data.testId}-node-trigger`,
2364
- children: [
2365
- /* @__PURE__ */ jsxRuntime.jsx(chunkI4IS6ST6_cjs.ChevronShape, {}),
2366
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
2367
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-8 shrink-0 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Zap, { className: "size-4" }) }),
2368
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
2369
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "wf-kind-text text-[10px] font-semibold uppercase tracking-wider", children: data.title }),
2370
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-semibold", children: data.summary })
2371
- ] })
2372
- ] }),
2373
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Handle, { type: "source", position: react$1.Position.Right }),
2374
- data.onAdd && /* @__PURE__ */ jsxRuntime.jsx(AddNext, { from: TRIGGER_NODE, onAdd: data.onAdd, l: data.l, testId: data.testId })
2375
- ]
2787
+ id: "work",
2788
+ kind: "agent",
2789
+ title: record.name,
2790
+ ...record.skill_ref ? { workflow: record.skill_ref } : { run: { kind: "prompt", promptTemplate: record.prompt } }
2376
2791
  }
2377
- );
2378
- }
2379
- var NODE_TYPES = { step: StepNode, trigger: TriggerNode };
2380
- var firstWords = (text, n = 14) => {
2381
- const words = text.trim().split(/\s+/);
2382
- return words.length > n ? `${words.slice(0, n).join(" ")}\u2026` : text.trim();
2383
- };
2384
- function summaryOf(step, l, workflowTitle) {
2385
- if (step.description) return step.description;
2386
- switch (step.kind) {
2387
- case "agent":
2388
- if (step.workflow)
2389
- return l.runs.replace("{name}", workflowTitle?.(step.workflow) ?? step.workflow);
2390
- if (step.run?.kind === "operation") return void 0;
2391
- return step.run?.kind === "prompt" && step.run.promptTemplate.trim() ? firstWords(step.run.promptTemplate) : l.chooseRun;
2392
- case "form":
2393
- return step.inputs.length ? step.inputs.length === 1 ? step.inputs[0].label : l.fields.replace("{count}", String(step.inputs.length)) : l.noFields;
2394
- case "upload":
2395
- return step.hint;
2396
- case "review":
2397
- return step.instructions ? firstWords(step.instructions) : l.approvedBy;
2398
- case "action": {
2399
- const a = step.action;
2400
- if (a.type === "sign")
2401
- return !a.document ? l.chooseDocument : a.signers.length ? l.signers.replace("{count}", String(a.signers.length)) : void 0;
2402
- if (a.type === "email_draft") {
2403
- const to = a.to.find((t) => t.trim());
2404
- return to ? l.emailTo.replace("{to}", to) : l.noRecipients;
2405
- }
2406
- if (a.type === "approval") return a.database ? l.approvalSummary : l.chooseDatabase;
2407
- if (a.type === "create_project") return a.name || void 0;
2408
- return a.tags.length ? l.reviewColumns.replace("{count}", String(a.tags.length)) : l.noColumns;
2792
+ ] : [];
2793
+ const when = chunkQFSFTO7I_cjs.workflowWhen(record);
2794
+ return {
2795
+ workflow: {
2796
+ id: record.external_id,
2797
+ title: record.name,
2798
+ description: record.description ?? "",
2799
+ inputs: chunkVXCZFJU7_cjs.fromPlanInputs(record.plan?.inputs),
2800
+ landing: "chat",
2801
+ schedulable: false,
2802
+ run: { kind: "steps", steps, layout: chunkVXCZFJU7_cjs.layoutFromPlanSteps(planned ?? []) }
2803
+ },
2804
+ trigger: {
2805
+ ...DEFAULT_WORKFLOW_TRIGGER,
2806
+ start: when === "now" ? "manual" : when,
2807
+ runAt: chunkQFSFTO7I_cjs.isoToLocalInput(record.run_at),
2808
+ rrule: record.rrule ?? "",
2809
+ timezone: record.timezone || DEFAULT_WORKFLOW_TRIGGER.timezone,
2810
+ eventKind: record.event_kind ?? "",
2811
+ signal: record.event_kind === WORKFLOW_SIGNAL_EVENT && typeof record.event_filter?.signal === "string" ? record.event_filter.signal : "",
2812
+ eventFilter: record.event_kind && record.event_kind !== WORKFLOW_SIGNAL_EVENT && record.event_filter ? record.event_filter : void 0,
2813
+ afterTaskId: record.after_conversation_ext_id ?? "",
2814
+ agentId: record.agent_ext_id ?? "",
2815
+ access: record.auth_mode === "scheduled_permanent" ? "standing" : "ask_each_run"
2409
2816
  }
2817
+ };
2818
+ }
2819
+ function declaredSignals(records, current) {
2820
+ const out = /* @__PURE__ */ new Map();
2821
+ const add = (workflow, steps) => {
2822
+ for (const step of steps)
2823
+ for (const signal of step.signals ?? [])
2824
+ if (signal.name && !out.has(signal.name))
2825
+ out.set(signal.name, { value: signal.name, label: `${workflow} \u203A ${step.title}` });
2826
+ };
2827
+ for (const record of records)
2828
+ add(record.name, record.plan?.steps ?? []);
2829
+ if (current?.run.kind === "steps") add(current.title, current.run.steps);
2830
+ return [...out.values()];
2831
+ }
2832
+ var DEFAULT_TRIGGER_INSPECTOR_LABELS = {
2833
+ heading: "Start",
2834
+ start: "Starts",
2835
+ starts: {
2836
+ manual: "When someone runs it",
2837
+ once: "Once, at a time",
2838
+ repeat: "On a schedule",
2839
+ event: "When something happens",
2840
+ task: "When a task is done"
2841
+ },
2842
+ runAt: "When",
2843
+ event: "Event",
2844
+ eventPlaceholder: "Pick an event",
2845
+ sender: "From (email address)",
2846
+ senderPlaceholder: "x@company.com",
2847
+ documentReason: "Kind of new version",
2848
+ documentReasonHint: "Starts when someone else saves a new version of a document that already exists. A first upload does not start it.",
2849
+ documentReasons: {
2850
+ any: "Any new version",
2851
+ upload: "Uploaded as a new version",
2852
+ edit: "Edited",
2853
+ signed: "Signed"
2854
+ },
2855
+ stepSignals: "When a step signals",
2856
+ signal: "Signal",
2857
+ signalPlaceholder: "e.g. risk-high",
2858
+ signalHint: "Starts as its own thread, linked to the thread whose step raised it, with that run\u2019s inputs.",
2859
+ signalSummary: "When a step signals \u201C{signal}\u201D",
2860
+ afterTask: "After this task",
2861
+ afterTaskPlaceholder: "Pick a task",
2862
+ agent: "Runs as",
2863
+ access: "Access when nobody is there",
2864
+ accessAsk: "Ask me each run",
2865
+ accessStanding: "Keep access"
2866
+ };
2867
+ function triggerSummary(trigger, options = {}) {
2868
+ const l = { ...DEFAULT_TRIGGER_INSPECTOR_LABELS, ...options.labels };
2869
+ switch (trigger.start) {
2870
+ case "once":
2871
+ return trigger.runAt ? new Date(trigger.runAt).toLocaleString() : l.starts.once;
2872
+ case "repeat":
2873
+ return trigger.rrule ? chunkVXCZFJU7_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
2874
+ case "event":
2875
+ if (isSignalTrigger(trigger))
2876
+ return trigger.signal ? l.signalSummary.replace("{signal}", trigger.signal) : l.stepSignals;
2877
+ return trigger.eventKind && options.eventLabel?.(trigger.eventKind) || trigger.eventKind || l.starts.event;
2878
+ case "task":
2879
+ return trigger.afterTaskId && options.taskLabel?.(trigger.afterTaskId) || l.starts.task;
2880
+ default:
2881
+ return l.starts.manual;
2410
2882
  }
2411
2883
  }
2412
- function WorkflowCanvas({
2413
- workflow,
2414
- onChange,
2415
- selected = null,
2416
- onSelect,
2417
- focus,
2418
- onAddAfter,
2419
- phases,
2420
- workflowTitle,
2421
- assigneeOf,
2884
+ var selectClass3 = "flex h-9 w-full rounded-md border border-input bg-background px-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";
2885
+ var STARTS = ["manual", "once", "repeat", "event", "task"];
2886
+ function TriggerInspector({
2422
2887
  trigger,
2423
- renderIcon,
2888
+ onChange,
2889
+ agents = [],
2890
+ eventKinds = [],
2891
+ tasks = [],
2892
+ signals = [],
2424
2893
  labels,
2425
- className,
2426
- reserveRight = 0,
2427
- testId = "workflow-canvas"
2894
+ testId = "trigger-inspector"
2428
2895
  }) {
2429
- const l = react.useMemo(() => ({ ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...labels }), [labels]);
2430
- const steps = chunkY3GJBLAI_cjs.workflowSteps(workflow);
2431
- const editable = !!onChange;
2432
- const built = react.useMemo(() => {
2433
- const layout = layoutWithDefaults(workflow);
2434
- const all = chunkY3GJBLAI_cjs.workflowSteps(workflow);
2435
- const roots = all.filter((s) => chunkY3GJBLAI_cjs.stepDependencies(all, s.id).length === 0);
2436
- const triggerNode = trigger ? [
2437
- {
2438
- id: TRIGGER_NODE,
2439
- type: "trigger",
2440
- deletable: false,
2441
- selected: selected === TRIGGER_NODE,
2442
- position: layout[TRIGGER_NODE] ?? {
2443
- x: Math.min(0, ...Object.values(layout).map((p) => p.x)) - 320,
2444
- y: roots.length ? roots.reduce((sum, s) => sum + (layout[s.id]?.y ?? 0), 0) / roots.length : 0
2896
+ const l = { ...DEFAULT_TRIGGER_INSPECTOR_LABELS, ...labels };
2897
+ const set = (patch) => onChange({ ...trigger, ...patch });
2898
+ const events = eventKinds.some((k) => k.value === WORKFLOW_SIGNAL_EVENT) ? eventKinds : [...eventKinds, { value: WORKFLOW_SIGNAL_EVENT, label: l.stepSignals }];
2899
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", "data-testid": testId, children: [
2900
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: l.heading }),
2901
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2902
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.start }),
2903
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", role: "radiogroup", "aria-label": l.start, children: STARTS.map((start) => /* @__PURE__ */ jsxRuntime.jsx(
2904
+ "button",
2905
+ {
2906
+ type: "button",
2907
+ role: "radio",
2908
+ "aria-checked": trigger.start === start,
2909
+ onClick: () => set({ start }),
2910
+ className: ui.cn(
2911
+ "rounded-md border px-3 py-2 text-left text-sm transition-colors",
2912
+ trigger.start === start ? "border-primary bg-primary/10 text-primary" : "border-border hover:bg-muted/50"
2913
+ ),
2914
+ "data-testid": `${testId}-start-${start}`,
2915
+ children: l.starts[start]
2445
2916
  },
2446
- data: { title: trigger.title, summary: trigger.summary, l, onAdd: onAddAfter, testId }
2447
- }
2448
- ] : [];
2449
- return [
2450
- ...triggerNode,
2451
- ...all.map((step) => ({
2452
- id: step.id,
2453
- type: "step",
2454
- position: layout[step.id] ?? { x: 0, y: 0 },
2455
- selected: step.id === selected,
2456
- data: {
2457
- step,
2458
- phase: phases?.[step.id],
2459
- summary: summaryOf(step, l, workflowTitle),
2460
- assignee: assigneeOf?.(step),
2461
- icon: step.icon && renderIcon ? renderIcon(step.icon) : void 0,
2462
- l,
2463
- onAdd: onAddAfter,
2464
- testId
2917
+ start
2918
+ )) })
2919
+ ] }),
2920
+ trigger.start === "once" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2921
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.runAt }),
2922
+ /* @__PURE__ */ jsxRuntime.jsx(
2923
+ ui.Input,
2924
+ {
2925
+ type: "datetime-local",
2926
+ value: trigger.runAt,
2927
+ onChange: (e) => set({ runAt: e.target.value }),
2928
+ "data-testid": `${testId}-run-at`
2465
2929
  }
2466
- }))
2467
- ];
2468
- }, [
2469
- workflow,
2470
- selected,
2471
- phases,
2472
- workflowTitle,
2473
- assigneeOf,
2474
- trigger,
2475
- renderIcon,
2476
- l,
2477
- onAddAfter,
2478
- testId
2479
- ]);
2480
- const [nodes, setNodes] = react.useState(built);
2481
- react.useEffect(() => setNodes(built), [built]);
2482
- const edges = react.useMemo(
2483
- () => steps.flatMap((s) => {
2484
- const deps = chunkY3GJBLAI_cjs.stepDependencies(steps, s.id);
2485
- const from = deps.length ? deps : trigger ? [TRIGGER_NODE] : [];
2486
- return from.map((d) => ({
2487
- id: `${d}->${s.id}`,
2488
- source: d,
2489
- target: s.id,
2490
- type: "smoothstep",
2491
- deletable: d !== TRIGGER_NODE,
2492
- markerEnd: { type: react$1.MarkerType.ArrowClosed, width: 16, height: 16 },
2493
- animated: phases?.[s.id] === "running"
2494
- }));
2495
- }),
2496
- [steps, phases, trigger]
2497
- );
2498
- const onNodesChange = react.useCallback(
2499
- (changes) => {
2500
- setNodes((ns) => react$1.applyNodeChanges(changes, ns));
2501
- if (!onChange) return;
2502
- let next = workflow;
2503
- for (const c of changes) {
2504
- if (c.type === "position" && c.dragging === false && c.position && c.id !== TRIGGER_NODE) {
2505
- next = moveStep(next, c.id, c.position);
2930
+ )
2931
+ ] }),
2932
+ trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkBR3XQ45B_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
2933
+ trigger.start === "event" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2934
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.event }),
2935
+ /* @__PURE__ */ jsxRuntime.jsxs(
2936
+ "select",
2937
+ {
2938
+ className: selectClass3,
2939
+ value: trigger.eventKind,
2940
+ onChange: (e) => set({ eventKind: e.target.value, eventFilter: void 0 }),
2941
+ "data-testid": `${testId}-event`,
2942
+ children: [
2943
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.eventPlaceholder }),
2944
+ events.map((k) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: k.value, children: k.label }, k.value))
2945
+ ]
2506
2946
  }
2507
- }
2508
- if (next !== workflow) onChange(next);
2509
- },
2510
- [workflow, onChange]
2511
- );
2512
- const onConnect = react.useCallback(
2513
- (c) => {
2514
- if (!onChange || !c.source || !c.target) return;
2515
- if (c.source === TRIGGER_NODE) onChange(updateStep(workflow, c.target, { after: [] }));
2516
- else onChange(connectSteps(workflow, c.source, c.target));
2517
- },
2518
- [workflow, onChange]
2519
- );
2520
- const frame = react.useRef(null);
2521
- const flowRef = react.useRef(null);
2522
- const hasTrigger = !!trigger;
2523
- const selectedRef = react.useRef(selected);
2524
- selectedRef.current = selected;
2525
- const fit = react.useCallback(
2526
- async (flow, anchorOnSelection, whole = false) => {
2527
- await flow.fitView({
2528
- padding: { top: "48px", bottom: "48px", left: "48px", right: `${reserveRight + 48}px` },
2529
- maxZoom: 1
2530
- });
2531
- if (whole) return;
2532
- const box = frame.current;
2533
- const picked = anchorOnSelection ? selectedRef.current : null;
2534
- const view = readableViewport(
2535
- flow.getNodes(),
2536
- flow.getZoom(),
2537
- { width: box?.clientWidth ?? 0, height: box?.clientHeight ?? 0 },
2947
+ )
2948
+ ] }),
2949
+ trigger.start === "event" && trigger.eventKind === "mail_document_received" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2950
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-sender`, children: l.sender }),
2951
+ /* @__PURE__ */ jsxRuntime.jsx(
2952
+ ui.Input,
2953
+ {
2954
+ id: `${testId}-sender`,
2955
+ type: "email",
2956
+ value: String(trigger.eventFilter?.sender ?? ""),
2957
+ placeholder: l.senderPlaceholder,
2958
+ onChange: (e) => {
2959
+ const sender = e.target.value.trim().toLowerCase();
2960
+ set({ eventFilter: sender ? { sender } : void 0 });
2961
+ },
2962
+ "data-testid": `${testId}-sender`
2963
+ }
2964
+ )
2965
+ ] }),
2966
+ trigger.start === "event" && trigger.eventKind === "document_activity" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2967
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-reason`, children: l.documentReason }),
2968
+ /* @__PURE__ */ jsxRuntime.jsxs(
2969
+ "select",
2538
2970
  {
2539
- anchor: picked ?? (hasTrigger ? TRIGGER_NODE : null),
2540
- centre: !!picked,
2541
- reserveRight
2971
+ id: `${testId}-reason`,
2972
+ className: selectClass3,
2973
+ value: String(trigger.eventFilter?.reason ?? ""),
2974
+ onChange: (e) => set({ eventFilter: e.target.value ? { reason: e.target.value } : void 0 }),
2975
+ "aria-describedby": `${testId}-reason-hint`,
2976
+ "data-testid": `${testId}-reason`,
2977
+ children: [
2978
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.documentReasons.any }),
2979
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "upload", children: l.documentReasons.upload }),
2980
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "edit", children: l.documentReasons.edit }),
2981
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "signed", children: l.documentReasons.signed })
2982
+ ]
2542
2983
  }
2543
- );
2544
- if (view) await flow.setViewport(view);
2545
- },
2546
- [reserveRight, hasTrigger]
2547
- );
2548
- const onInit = react.useCallback(
2549
- async (flow) => {
2550
- flowRef.current = flow;
2551
- await fit(flow, false);
2552
- },
2553
- [fit]
2554
- );
2555
- const target = focus ?? selected;
2556
- const revealed = react.useRef(null);
2557
- react.useEffect(() => {
2558
- const flow = flowRef.current;
2559
- const box = frame.current;
2560
- const node = target ? flow?.getNode(target) : void 0;
2561
- const key = `${target}:${reserveRight}`;
2562
- if (!target) revealed.current = null;
2563
- if (!flow || !box || !node || revealed.current === key) return;
2564
- revealed.current = key;
2565
- const view = flow.getViewport();
2566
- const centre = revealCenter(
2567
- node,
2568
- view,
2569
- { width: box.clientWidth, height: box.clientHeight },
2570
- reserveRight
2571
- );
2572
- if (centre) void flow.setCenter(centre.x, centre.y, { zoom: view.zoom, duration: 250 });
2573
- }, [target, nodes, reserveRight]);
2574
- const onDelete = react.useCallback(
2575
- ({ nodes: gone, edges: cut }) => {
2576
- if (!onChange) return;
2577
- const removed = new Set(gone.map((n) => n.id));
2578
- let next = gone.reduce((w, n) => removeStep(w, n.id), workflow);
2579
- for (const e of cut) {
2580
- if (!removed.has(e.source) && !removed.has(e.target)) {
2581
- next = disconnectSteps(next, e.source, e.target);
2984
+ ),
2985
+ /* @__PURE__ */ jsxRuntime.jsx(
2986
+ "p",
2987
+ {
2988
+ id: `${testId}-reason-hint`,
2989
+ className: "text-xs text-muted-foreground",
2990
+ "data-testid": `${testId}-reason-hint`,
2991
+ children: l.documentReasonHint
2992
+ }
2993
+ )
2994
+ ] }),
2995
+ isSignalTrigger(trigger) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2996
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", htmlFor: `${testId}-signal`, children: l.signal }),
2997
+ /* @__PURE__ */ jsxRuntime.jsx(
2998
+ ui.Input,
2999
+ {
3000
+ id: `${testId}-signal`,
3001
+ list: `${testId}-signal-options`,
3002
+ value: trigger.signal,
3003
+ placeholder: l.signalPlaceholder,
3004
+ onChange: (e) => set({ signal: e.target.value.trim().toLowerCase() }),
3005
+ "data-testid": `${testId}-signal`
2582
3006
  }
2583
- }
2584
- onChange(next);
2585
- },
2586
- [workflow, onChange]
2587
- );
2588
- return /* @__PURE__ */ jsxRuntime.jsxs(
2589
- "div",
2590
- {
2591
- className: ui.cn(
2592
- "relative h-[max(560px,calc(100dvh-200px))] w-full overflow-hidden rounded-xl border border-border bg-muted/30",
2593
- className
2594
3007
  ),
2595
- ref: frame,
2596
- "data-testid": testId,
2597
- children: [
2598
- /* @__PURE__ */ jsxRuntime.jsxs(
2599
- react$1.ReactFlow,
2600
- {
2601
- nodes,
2602
- edges,
2603
- nodeTypes: NODE_TYPES,
2604
- onNodesChange,
2605
- onConnect,
2606
- onDelete,
2607
- isValidConnection: (c) => !!c.source && !!c.target && !wouldCycle(workflow, c.source, c.target),
2608
- onNodeClick: (_, node) => onSelect?.(node.id),
2609
- onPaneClick: () => onSelect?.(null),
2610
- nodesDraggable: editable,
2611
- nodesConnectable: editable,
2612
- elementsSelectable: true,
2613
- deleteKeyCode: editable ? ["Backspace", "Delete"] : null,
2614
- onInit,
2615
- minZoom: 0.3,
2616
- proOptions: { hideAttribution: true },
2617
- children: [
2618
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Background, { variant: react$1.BackgroundVariant.Dots, gap: 18, size: 1.5 }),
2619
- /* @__PURE__ */ jsxRuntime.jsx(react$1.Controls, { showInteractive: false, showFitView: false, position: "bottom-left", children: /* @__PURE__ */ jsxRuntime.jsx(
2620
- react$1.ControlButton,
2621
- {
2622
- className: "react-flow__controls-fitview",
2623
- onClick: () => flowRef.current && void fit(flowRef.current, false, true),
2624
- title: l.fitView,
2625
- "aria-label": l.fitView,
2626
- "data-testid": `${testId}-fit`,
2627
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, {})
2628
- }
2629
- ) }),
2630
- steps.length > 3 && /* @__PURE__ */ jsxRuntime.jsx(
2631
- react$1.MiniMap,
2632
- {
2633
- pannable: true,
2634
- zoomable: true,
2635
- position: "bottom-right",
2636
- className: "wf-minimap !rounded-lg !border !border-border",
2637
- style: { width: 168, height: 104 },
2638
- nodeBorderRadius: 8,
2639
- nodeStrokeWidth: 0
2640
- }
2641
- )
2642
- ]
2643
- }
2644
- ),
2645
- steps.length === 0 && onAddAfter && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-16 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
2646
- "div",
2647
- {
2648
- className: "pointer-events-auto rounded-xl border border-dashed border-border bg-card/90 p-5 text-center shadow-sm backdrop-blur",
2649
- "data-testid": `${testId}-empty`,
2650
- children: [
2651
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: l.emptyTitle }),
2652
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.emptyHint }),
2653
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 grid grid-cols-2 gap-2", children: KINDS.map((kind) => {
2654
- const Icon = chunkPIJPM5RA_cjs.STEP_KIND_ICONS[kind];
2655
- return /* @__PURE__ */ jsxRuntime.jsxs(
2656
- "button",
2657
- {
2658
- type: "button",
2659
- onClick: () => onAddAfter(TRIGGER_NODE, kind),
2660
- className: ui.cn(
2661
- `wf-kind-${kind}`,
2662
- "flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-left text-sm hover:bg-muted"
2663
- ),
2664
- "data-testid": `${testId}-empty-${kind}`,
2665
- children: [
2666
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wf-badge flex size-6 items-center justify-center rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5" }) }),
2667
- l[kind]
2668
- ]
2669
- },
2670
- kind
2671
- );
2672
- }) })
2673
- ]
2674
- }
2675
- ) })
2676
- ]
2677
- }
2678
- );
3008
+ /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: `${testId}-signal-options`, children: signals.map((s) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: s.value, children: s.label }, s.value)) }),
3009
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.signalHint })
3010
+ ] }),
3011
+ trigger.start === "task" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3012
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.afterTask }),
3013
+ /* @__PURE__ */ jsxRuntime.jsxs(
3014
+ "select",
3015
+ {
3016
+ className: selectClass3,
3017
+ value: trigger.afterTaskId,
3018
+ onChange: (e) => set({ afterTaskId: e.target.value }),
3019
+ "data-testid": `${testId}-after-task`,
3020
+ children: [
3021
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.afterTaskPlaceholder }),
3022
+ tasks.map((t) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: t.value, children: t.label }, t.value))
3023
+ ]
3024
+ }
3025
+ )
3026
+ ] }),
3027
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3028
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.agent }),
3029
+ /* @__PURE__ */ jsxRuntime.jsx(
3030
+ chunkUTDLO73D_cjs.AgentSelect,
3031
+ {
3032
+ agents,
3033
+ value: trigger.agentId,
3034
+ onValueChange: (agentId) => set({ agentId }),
3035
+ hideLabel: true,
3036
+ testId: `${testId}-agent`
3037
+ }
3038
+ )
3039
+ ] }),
3040
+ trigger.start !== "manual" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3041
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.access }),
3042
+ /* @__PURE__ */ jsxRuntime.jsxs(
3043
+ "select",
3044
+ {
3045
+ className: selectClass3,
3046
+ value: trigger.access,
3047
+ onChange: (e) => set({ access: e.target.value === "standing" ? "standing" : "ask_each_run" }),
3048
+ "data-testid": `${testId}-access`,
3049
+ children: [
3050
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "ask_each_run", children: l.accessAsk }),
3051
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "standing", children: l.accessStanding })
3052
+ ]
3053
+ }
3054
+ )
3055
+ ] })
3056
+ ] });
2679
3057
  }
2680
3058
  var DEFAULT_WORKFLOW_BUILDER_LABELS = {
2681
3059
  addStep: "Add step",
@@ -2683,6 +3061,8 @@ var DEFAULT_WORKFLOW_BUILDER_LABELS = {
2683
3061
  settings: "Workflow settings",
2684
3062
  closePanel: "Close panel",
2685
3063
  design: "Design",
3064
+ outline: "List",
3065
+ canvas: "Canvas",
2686
3066
  preview: "Preview",
2687
3067
  start: "Start",
2688
3068
  previewAnswer: "Preview: the agent would be asked \u2014\n\n{prompt}",
@@ -2704,7 +3084,7 @@ var DEFAULT_WORKFLOW_BUILDER_LABELS = {
2704
3084
  }
2705
3085
  };
2706
3086
  var PANEL_WIDTH = 344;
2707
- var KINDS2 = chunkPIJPM5RA_cjs.WORKFLOW_STEP_KINDS;
3087
+ var KINDS2 = chunk3YGSCNXQ_cjs.WORKFLOW_STEP_KINDS;
2708
3088
  function WorkflowBuilder({
2709
3089
  value,
2710
3090
  onChange,
@@ -2722,6 +3102,8 @@ function WorkflowBuilder({
2722
3102
  actions,
2723
3103
  labels,
2724
3104
  canvasLabels,
3105
+ outlineLabels,
3106
+ designView = "outline",
2725
3107
  inspectorLabels,
2726
3108
  triggerLabels,
2727
3109
  initialMode = "design",
@@ -2737,19 +3119,20 @@ function WorkflowBuilder({
2737
3119
  if (id) setPanelOpen(true);
2738
3120
  };
2739
3121
  const [adding, setAdding] = react.useState(false);
3122
+ const [view, setView] = react.useState(designView);
2740
3123
  const { workflow, trigger } = value;
2741
- const steps = chunkY3GJBLAI_cjs.workflowSteps(workflow);
2742
- const problems = chunkY3GJBLAI_cjs.validateWorkflowGraph(steps);
3124
+ const steps = chunkFSTIAEJW_cjs.workflowSteps(workflow);
3125
+ const problems = chunkFSTIAEJW_cjs.validateWorkflowGraph(steps);
2743
3126
  const canPreview = problems.length === 0 && steps.length > 0;
2744
3127
  const [asked, setMode] = react.useState(initialMode);
2745
3128
  const mode = asked === "preview" && !canPreview ? "design" : asked;
2746
3129
  const fieldsOnTop = workflowFields === "top";
2747
3130
  const showPanel = panelOpen && (!fieldsOnTop || selected !== null);
2748
3131
  const il = { ...DEFAULT_STEP_INSPECTOR_LABELS, ...inspectorLabels };
2749
- const missing = chunkY3GJBLAI_cjs.stepConfigProblems(steps);
3132
+ const missing = chunkFSTIAEJW_cjs.stepConfigProblems(steps);
2750
3133
  const nameOf = (id) => people.find((p) => p.value === id)?.label;
2751
- const fields = chunkY3GJBLAI_cjs.runFields(workflow);
2752
- const assigneeOf = (step) => chunkY3GJBLAI_cjs.canAssign(step) ? chunkY3GJBLAI_cjs.assigneeName(step.assignee, { nameOf, fields }) : void 0;
3134
+ const fields = chunkFSTIAEJW_cjs.runFields(workflow);
3135
+ const assigneeOf = (step) => chunkFSTIAEJW_cjs.canAssign(step) ? chunkFSTIAEJW_cjs.assigneeName(step.assignee, { nameOf, fields }) : void 0;
2753
3136
  const titles = react.useMemo(() => new Map(workflows.map((w) => [w.id, w.title])), [workflows]);
2754
3137
  const setWorkflow = (next) => onChange({ ...value, workflow: next });
2755
3138
  const addAfter = (from, kind) => {
@@ -2835,7 +3218,37 @@ function WorkflowBuilder({
2835
3218
  }
2836
3219
  )
2837
3220
  ] }),
2838
- mode === "design" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3221
+ mode === "design" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex rounded-md border border-border p-0.5", children: [
3222
+ /* @__PURE__ */ jsxRuntime.jsxs(
3223
+ ui.Button,
3224
+ {
3225
+ variant: view === "outline" ? "secondary" : "ghost",
3226
+ size: "sm",
3227
+ onClick: () => setView("outline"),
3228
+ "data-testid": `${testId}-view-outline`,
3229
+ children: [
3230
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "size-4" }),
3231
+ " ",
3232
+ l.outline
3233
+ ]
3234
+ }
3235
+ ),
3236
+ /* @__PURE__ */ jsxRuntime.jsxs(
3237
+ ui.Button,
3238
+ {
3239
+ variant: view === "canvas" ? "secondary" : "ghost",
3240
+ size: "sm",
3241
+ onClick: () => setView("canvas"),
3242
+ "data-testid": `${testId}-view-canvas`,
3243
+ children: [
3244
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Workflow, { className: "size-4" }),
3245
+ " ",
3246
+ l.canvas
3247
+ ]
3248
+ }
3249
+ )
3250
+ ] }),
3251
+ mode === "design" && view === "canvas" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2839
3252
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { open: adding, onOpenChange: setAdding, children: [
2840
3253
  /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { size: "sm", "data-testid": `${testId}-add`, children: [
2841
3254
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
@@ -2843,7 +3256,7 @@ function WorkflowBuilder({
2843
3256
  l.addStep
2844
3257
  ] }) }),
2845
3258
  /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { align: "start", className: "w-64 p-1.5", children: KINDS2.map((kind) => {
2846
- const Icon = chunkPIJPM5RA_cjs.STEP_KIND_ICONS[kind];
3259
+ const Icon = chunk3YGSCNXQ_cjs.STEP_KIND_ICONS[kind];
2847
3260
  const cls = { ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...canvasLabels };
2848
3261
  return /* @__PURE__ */ jsxRuntime.jsxs(
2849
3262
  "button",
@@ -2897,7 +3310,22 @@ function WorkflowBuilder({
2897
3310
  steps.find((s) => s.id === p.step)?.title ?? p.step
2898
3311
  ) }, `m${i}`))
2899
3312
  ] }),
2900
- mode === "design" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3313
+ mode === "design" && view === "outline" ? /* @__PURE__ */ jsxRuntime.jsx(
3314
+ WorkflowOutline,
3315
+ {
3316
+ workflow,
3317
+ onChange: setWorkflow,
3318
+ workflows,
3319
+ people,
3320
+ tags,
3321
+ documents,
3322
+ databases,
3323
+ labels: outlineLabels,
3324
+ canvasLabels,
3325
+ inspectorLabels,
3326
+ testId: `${testId}-outline`
3327
+ }
3328
+ ) : mode === "design" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2901
3329
  /* @__PURE__ */ jsxRuntime.jsx(
2902
3330
  WorkflowCanvas,
2903
3331
  {
@@ -3009,13 +3437,13 @@ function WorkflowPreview({
3009
3437
  renderIcon,
3010
3438
  testId
3011
3439
  }) {
3012
- const run = chunkRNQ3MDTR_cjs.useWorkflowPreview(workflow, {
3440
+ const run = chunkBXHPV6QF_cjs.useWorkflowPreview(workflow, {
3013
3441
  resolveWorkflow: (id) => workflows.find((w) => w.id === id),
3014
3442
  compose,
3015
3443
  answer
3016
3444
  });
3017
3445
  return /* @__PURE__ */ jsxRuntime.jsx(
3018
- chunkQDIIOZBP_cjs.WorkflowRunner,
3446
+ chunkBR3XQ45B_cjs.WorkflowRunner,
3019
3447
  {
3020
3448
  workflow,
3021
3449
  run,
@@ -3086,7 +3514,7 @@ function scheduledTaskBuilderValue() {
3086
3514
  ]
3087
3515
  }
3088
3516
  },
3089
- trigger: { ...value.trigger, start: "repeat", rrule: chunk2K5DLB7B_cjs.buildRRule(chunk2K5DLB7B_cjs.DEFAULT_RECURRENCE) }
3517
+ trigger: { ...value.trigger, start: "repeat", rrule: chunkVXCZFJU7_cjs.buildRRule(chunkVXCZFJU7_cjs.DEFAULT_RECURRENCE) }
3090
3518
  };
3091
3519
  }
3092
3520
  var TITLE_WORDS = 6;
@@ -3172,7 +3600,7 @@ function ConnectedWorkflowBuilder({
3172
3600
  }
3173
3601
  }, [record, loaded]);
3174
3602
  const workflows = react.useMemo(() => {
3175
- const merged = chunkSQCCQU3K_cjs.mergeSkillWorkflows(hostWorkflows, skills.data ?? []);
3603
+ const merged = chunkVOGIYFNN_cjs.mergeSkillWorkflows(hostWorkflows, skills.data ?? []);
3176
3604
  return [...merged.host, ...merged.skills];
3177
3605
  }, [hostWorkflows, skills.data]);
3178
3606
  const agents = (agentsQuery.data ?? []).map((a) => ({
@@ -3181,7 +3609,7 @@ function ConnectedWorkflowBuilder({
3181
3609
  }));
3182
3610
  const tasks = conversations.filter((c) => c.status && c.status !== "done").map((c) => ({ value: c.external_id, label: c.title || l.untitledTask }));
3183
3611
  const options = { resolveWorkflow: (wid) => workflows.find((w) => w.id === wid), compose };
3184
- const problem = triggerProblem(value.trigger) ?? (chunkY3GJBLAI_cjs.validateWorkflowGraph(chunkY3GJBLAI_cjs.workflowSteps(value.workflow)).length || chunkY3GJBLAI_cjs.stepConfigProblems(chunkY3GJBLAI_cjs.workflowSteps(value.workflow)).length ? "graph" : null);
3612
+ const problem = triggerProblem(value.trigger) ?? (chunkFSTIAEJW_cjs.validateWorkflowGraph(chunkFSTIAEJW_cjs.workflowSteps(value.workflow)).length || chunkFSTIAEJW_cjs.stepConfigProblems(chunkFSTIAEJW_cjs.workflowSteps(value.workflow)).length ? "graph" : null);
3185
3613
  const busy = !!pending || create.isPending || update.isPending || run.isPending;
3186
3614
  const save = async () => {
3187
3615
  if (!workspaceId) return void 0;
@@ -3300,7 +3728,7 @@ function ConnectedSavedWorkflowRun({
3300
3728
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": "saved-workflow-run-status", children: saved.isError ? l.failed : l.loading });
3301
3729
  }
3302
3730
  return /* @__PURE__ */ jsxRuntime.jsx(
3303
- chunkGLNL5AL5_cjs.ConnectedWorkflowRunPage,
3731
+ chunkRR3QJM2Y_cjs.ConnectedWorkflowRunPage,
3304
3732
  {
3305
3733
  workflow,
3306
3734
  workspaceId,
@@ -3354,13 +3782,13 @@ function ConnectedWorkflowsPage({
3354
3782
  historyLabels,
3355
3783
  testId = "workflows-page"
3356
3784
  }) {
3357
- const webWorkflows = chunkER2MRSLT_cjs.useNamedWorkflows(chunkM55XUF4L_cjs.WEB_WORKFLOWS);
3785
+ const webWorkflows = chunkIRVSCMRW_cjs.useNamedWorkflows(chunkQFSFTO7I_cjs.WEB_WORKFLOWS);
3358
3786
  const l = { ...DEFAULT_CONNECTED_WORKFLOWS_PAGE_LABELS, ...labels };
3359
3787
  const host = chunk3YZKDCWY_cjs.useHost();
3360
3788
  const config = host.workflows;
3361
3789
  const { openConversation, openFiles } = chunkHN56WWBR_cjs.useBlocksEnvironment();
3362
3790
  const openWorkflow = chunkSOT7NPIB_cjs.useOpenWorkflow();
3363
- const renderPerson = chunkGLNL5AL5_cjs.useRenderTaskPerson();
3791
+ const renderPerson = chunkRR3QJM2Y_cjs.useRenderTaskPerson();
3364
3792
  const refreshDocuments = react$2.useRefreshDocuments();
3365
3793
  const invalidateTags = react$2.useInvalidateTagData();
3366
3794
  const { data: tags = [] } = react$2.useTags();
@@ -3392,7 +3820,7 @@ function ConnectedWorkflowsPage({
3392
3820
  openHistory,
3393
3821
  closeHistoryTab,
3394
3822
  selectHistoryTab
3395
- } = chunkGLNL5AL5_cjs.useWorkflowsPageState({
3823
+ } = chunkRR3QJM2Y_cjs.useWorkflowsPageState({
3396
3824
  historyWorkflowId: requestedHistoryId ?? historyWorkflowId,
3397
3825
  onHistoryWorkflowConsumed: consumeHistory
3398
3826
  });
@@ -3442,14 +3870,14 @@ function ConnectedWorkflowsPage({
3442
3870
  await refreshDocuments(execution.document_ext_ids);
3443
3871
  await invalidateTags();
3444
3872
  const fieldIds = execution.result?.tag_ext_ids ?? runsFor?.action?.tag_ext_ids ?? [];
3445
- chunkAZUPMHZI_cjs.useAiReviewStore.getState().setRun({
3873
+ chunk3U6XE7SF_cjs.useAiReviewStore.getState().setRun({
3446
3874
  docIds: execution.document_ext_ids,
3447
3875
  tags: fieldIds.map((fieldId) => ({
3448
3876
  id: fieldId,
3449
3877
  name: tags.find((tag) => tag.external_id === fieldId)?.name ?? "Review"
3450
3878
  }))
3451
3879
  });
3452
- chunkAZUPMHZI_cjs.useAiReviewStore.getState().setOpen(true);
3880
+ chunk3U6XE7SF_cjs.useAiReviewStore.getState().setOpen(true);
3453
3881
  openFiles(
3454
3882
  execution.label_ext_id ? { filters: { [execution.label_ext_id]: "include" } } : void 0
3455
3883
  );
@@ -3461,7 +3889,7 @@ function ConnectedWorkflowsPage({
3461
3889
  return (
3462
3890
  // The page in the Workflows page's frame: padded, scrolling.
3463
3891
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full min-h-0 w-full overflow-auto p-4 sm:p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
3464
- chunkGLNL5AL5_cjs.ConnectedWorkflowRunPage,
3892
+ chunkRR3QJM2Y_cjs.ConnectedWorkflowRunPage,
3465
3893
  {
3466
3894
  workflow: running.workflow,
3467
3895
  projectFrom: running.projectFrom,
@@ -3575,7 +4003,7 @@ function ConnectedWorkflowsPage({
3575
4003
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-h-0 flex-col", "data-testid": testId, children: [
3576
4004
  pageHeader && /* @__PURE__ */ jsxRuntime.jsx(chunkNSD37OF5_cjs.PageHeader, { ...pageHeader }),
3577
4005
  /* @__PURE__ */ jsxRuntime.jsx(
3578
- chunkVJHDCYKE_cjs.ConnectedWorkflowsTable,
4006
+ chunkAZHIZRHN_cjs.ConnectedWorkflowsTable,
3579
4007
  {
3580
4008
  onOpenTemplate: (id) => openBuilder({ kind: "template", id }),
3581
4009
  onPreviewTemplate: (id) => openBuilder({ kind: "template", id, mode: "preview" }),
@@ -3607,7 +4035,7 @@ function ConnectedWorkflowsPage({
3607
4035
  }
3608
4036
  },
3609
4037
  content: hostTab ? hostTab.content : runsFor ? /* @__PURE__ */ jsxRuntime.jsx(
3610
- chunkGLNL5AL5_cjs.ConnectedWorkflowHistory,
4038
+ chunkRR3QJM2Y_cjs.ConnectedWorkflowHistory,
3611
4039
  {
3612
4040
  inline: true,
3613
4041
  hideHeader: true,
@@ -3632,7 +4060,7 @@ function ConnectedWorkflowsPage({
3632
4060
  ) : void 0,
3633
4061
  automationsOnly: true,
3634
4062
  gridId: "automations-grid-v1",
3635
- describeTrigger: (workflow) => workflow.on_demand ? l.manualTrigger : chunk2K5DLB7B_cjs.describeTrigger(workflow),
4063
+ describeTrigger: (workflow) => workflow.on_demand ? l.manualTrigger : chunkVXCZFJU7_cjs.describeTrigger(workflow),
3636
4064
  formatDate: ui.formatFriendlyDate,
3637
4065
  renderPerson,
3638
4066
  onViewRuns: showHistory,
@@ -3671,7 +4099,7 @@ function ConnectedWorkflowsPage({
3671
4099
  }
3672
4100
  ),
3673
4101
  /* @__PURE__ */ jsxRuntime.jsx(
3674
- chunkGLNL5AL5_cjs.ConnectedTaskComposer,
4102
+ chunkRR3QJM2Y_cjs.ConnectedTaskComposer,
3675
4103
  {
3676
4104
  kind: "workflow",
3677
4105
  saveOnly: true,
@@ -3696,6 +4124,7 @@ exports.DEFAULT_WORKFLOWS_PAGE_TABLE_LABELS = DEFAULT_WORKFLOWS_PAGE_TABLE_LABEL
3696
4124
  exports.DEFAULT_WORKFLOW_BUILDER_LABELS = DEFAULT_WORKFLOW_BUILDER_LABELS;
3697
4125
  exports.DEFAULT_WORKFLOW_CANVAS_LABELS = DEFAULT_WORKFLOW_CANVAS_LABELS;
3698
4126
  exports.DEFAULT_WORKFLOW_EVENT_KINDS = DEFAULT_WORKFLOW_EVENT_KINDS;
4127
+ exports.DEFAULT_WORKFLOW_OUTLINE_LABELS = DEFAULT_WORKFLOW_OUTLINE_LABELS;
3699
4128
  exports.DEFAULT_WORKFLOW_TRIGGER = DEFAULT_WORKFLOW_TRIGGER;
3700
4129
  exports.FieldOptionsEditor = FieldOptionsEditor;
3701
4130
  exports.SignalsEditor = SignalsEditor;
@@ -3705,6 +4134,7 @@ exports.TriggerInspector = TriggerInspector;
3705
4134
  exports.WORKFLOW_SIGNAL_EVENT = WORKFLOW_SIGNAL_EVENT;
3706
4135
  exports.WorkflowBuilder = WorkflowBuilder;
3707
4136
  exports.WorkflowCanvas = WorkflowCanvas;
4137
+ exports.WorkflowOutline = WorkflowOutline;
3708
4138
  exports.addStep = addStep;
3709
4139
  exports.autoLayout = autoLayout;
3710
4140
  exports.builderToWorkflowRequest = builderToWorkflowRequest;
@@ -3712,12 +4142,14 @@ exports.builderToWorkflowUpdate = builderToWorkflowUpdate;
3712
4142
  exports.connectSteps = connectSteps;
3713
4143
  exports.declaredSignals = declaredSignals;
3714
4144
  exports.disconnectSteps = disconnectSteps;
4145
+ exports.isLinear = isLinear;
3715
4146
  exports.isSignalTrigger = isSignalTrigger;
3716
4147
  exports.layoutWithDefaults = layoutWithDefaults;
3717
4148
  exports.moveStep = moveStep;
3718
4149
  exports.newSteppedWorkflow = newSteppedWorkflow;
3719
4150
  exports.newWorkflowBuilderValue = newWorkflowBuilderValue;
3720
4151
  exports.removeStep = removeStep;
4152
+ exports.shiftStep = shiftStep;
3721
4153
  exports.signalConditions = signalConditions;
3722
4154
  exports.signalSlug = signalSlug;
3723
4155
  exports.stepIdFor = stepIdFor;