@arbidocs/blocks 0.5.193 → 0.5.195

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