@hotmeshio/long-tail 0.28.2 → 0.28.4

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 (207) hide show
  1. package/build/services/machines/gateway/dispatcher.js +18 -6
  2. package/build/services/machines/gateway/executor.d.ts +6 -1
  3. package/build/services/machines/gateway/executor.js +19 -2
  4. package/build/services/machines/gateway/plan-escalation.js +21 -3
  5. package/build/services/machines/gateway/plan-machine.js +1 -1
  6. package/build/services/machines/gateway/plan-shared.d.ts +8 -0
  7. package/build/services/machines/gateway/plan-shared.js +15 -1
  8. package/build/services/machines/gateway/state.d.ts +4 -0
  9. package/build/services/machines/gateway/state.js +1 -1
  10. package/dashboard/dist/assets/{AdminDashboard-Bm7VG65H.js → AdminDashboard-DRE0hSDS.js} +2 -2
  11. package/dashboard/dist/assets/{AdminDashboard-Bm7VG65H.js.map → AdminDashboard-DRE0hSDS.js.map} +1 -1
  12. package/dashboard/dist/assets/{AgentConfigPage-aJF7Sdbc.js → AgentConfigPage-BuflQGgy.js} +2 -2
  13. package/dashboard/dist/assets/{AgentConfigPage-aJF7Sdbc.js.map → AgentConfigPage-BuflQGgy.js.map} +1 -1
  14. package/dashboard/dist/assets/{AgentDetailPage-GwwghhxT.js → AgentDetailPage-BiL9FB7i.js} +2 -2
  15. package/dashboard/dist/assets/{AgentDetailPage-GwwghhxT.js.map → AgentDetailPage-BiL9FB7i.js.map} +1 -1
  16. package/dashboard/dist/assets/{AgentsPage-DVvCzZyg.js → AgentsPage-C4ZxCNxt.js} +2 -2
  17. package/dashboard/dist/assets/{AgentsPage-DVvCzZyg.js.map → AgentsPage-C4ZxCNxt.js.map} +1 -1
  18. package/dashboard/dist/assets/{AvailableEscalationsPage-Cxmcji_K.js → AvailableEscalationsPage-B5p8QJvI.js} +2 -2
  19. package/dashboard/dist/assets/{AvailableEscalationsPage-Cxmcji_K.js.map → AvailableEscalationsPage-B5p8QJvI.js.map} +1 -1
  20. package/dashboard/dist/assets/{BotPicker-CofRxk4L.js → BotPicker-B7V77PnY.js} +2 -2
  21. package/dashboard/dist/assets/{BotPicker-CofRxk4L.js.map → BotPicker-B7V77PnY.js.map} +1 -1
  22. package/dashboard/dist/assets/{BulkAssignModal-BARWuz4L.js → BulkAssignModal-DcGVMQqm.js} +2 -2
  23. package/dashboard/dist/assets/{BulkAssignModal-BARWuz4L.js.map → BulkAssignModal-DcGVMQqm.js.map} +1 -1
  24. package/dashboard/dist/assets/{CapabilitiesPage-BJAWVNEx.js → CapabilitiesPage-DmbC1pEs.js} +2 -2
  25. package/dashboard/dist/assets/{CapabilitiesPage-BJAWVNEx.js.map → CapabilitiesPage-DmbC1pEs.js.map} +1 -1
  26. package/dashboard/dist/assets/{CollapsibleSection-CtgoaG75.js → CollapsibleSection-C81S1qic.js} +2 -2
  27. package/dashboard/dist/assets/{CollapsibleSection-CtgoaG75.js.map → CollapsibleSection-C81S1qic.js.map} +1 -1
  28. package/dashboard/dist/assets/{ConfirmDeleteModal-BYXXBWs6.js → ConfirmDeleteModal-3RFyWN9Q.js} +2 -2
  29. package/dashboard/dist/assets/{ConfirmDeleteModal-BYXXBWs6.js.map → ConfirmDeleteModal-3RFyWN9Q.js.map} +1 -1
  30. package/dashboard/dist/assets/{ConnectedAppsPage-D0JkzWa7.js → ConnectedAppsPage-B0D2OvTD.js} +2 -2
  31. package/dashboard/dist/assets/{ConnectedAppsPage-D0JkzWa7.js.map → ConnectedAppsPage-B0D2OvTD.js.map} +1 -1
  32. package/dashboard/dist/assets/{CountdownTimer-BcFxdZYN.js → CountdownTimer-iAG28fzG.js} +2 -2
  33. package/dashboard/dist/assets/{CountdownTimer-BcFxdZYN.js.map → CountdownTimer-iAG28fzG.js.map} +1 -1
  34. package/dashboard/dist/assets/{CredentialsPage-DPSY20rV.js → CredentialsPage-DoFwNvFv.js} +2 -2
  35. package/dashboard/dist/assets/{CredentialsPage-DPSY20rV.js.map → CredentialsPage-DoFwNvFv.js.map} +1 -1
  36. package/dashboard/dist/assets/{CronLabel-Dg_Oew_Y.js → CronLabel-C1Bb2wo4.js} +2 -2
  37. package/dashboard/dist/assets/{CronLabel-Dg_Oew_Y.js.map → CronLabel-C1Bb2wo4.js.map} +1 -1
  38. package/dashboard/dist/assets/{ElapsedCell-Dm3G5fK2.js → ElapsedCell-DZs1I1JW.js} +2 -2
  39. package/dashboard/dist/assets/{ElapsedCell-Dm3G5fK2.js.map → ElapsedCell-DZs1I1JW.js.map} +1 -1
  40. package/dashboard/dist/assets/{EntityTimelinePanel-CrEEP04e.js → EntityTimelinePanel-Du1O6Oly.js} +2 -2
  41. package/dashboard/dist/assets/{EntityTimelinePanel-CrEEP04e.js.map → EntityTimelinePanel-Du1O6Oly.js.map} +1 -1
  42. package/dashboard/dist/assets/{EscalationListSchemaPage-wOInXcjs.js → EscalationListSchemaPage-CrpBhC0e.js} +2 -2
  43. package/dashboard/dist/assets/{EscalationListSchemaPage-wOInXcjs.js.map → EscalationListSchemaPage-CrpBhC0e.js.map} +1 -1
  44. package/dashboard/dist/assets/{EscalationSchemaPage-CrIj_g9d.js → EscalationSchemaPage-Co59lcuD.js} +2 -2
  45. package/dashboard/dist/assets/{EscalationSchemaPage-CrIj_g9d.js.map → EscalationSchemaPage-Co59lcuD.js.map} +1 -1
  46. package/dashboard/dist/assets/{EscalationTimeline-CeAsl5IT.js → EscalationTimeline-B_fzNsX5.js} +2 -2
  47. package/dashboard/dist/assets/{EscalationTimeline-CeAsl5IT.js.map → EscalationTimeline-B_fzNsX5.js.map} +1 -1
  48. package/dashboard/dist/assets/{EscalationTitleSelect-D8qpCYiy.js → EscalationTitleSelect-C2Goebjo.js} +2 -2
  49. package/dashboard/dist/assets/{EscalationTitleSelect-D8qpCYiy.js.map → EscalationTitleSelect-C2Goebjo.js.map} +1 -1
  50. package/dashboard/dist/assets/{EscalationsOverview-CvaqVPsr.js → EscalationsOverview-Cgmrl8Zc.js} +2 -2
  51. package/dashboard/dist/assets/{EscalationsOverview-CvaqVPsr.js.map → EscalationsOverview-Cgmrl8Zc.js.map} +1 -1
  52. package/dashboard/dist/assets/{EventTable-Be0JuEl6.js → EventTable-BdEiu3Fv.js} +2 -2
  53. package/dashboard/dist/assets/{EventTable-Be0JuEl6.js.map → EventTable-BdEiu3Fv.js.map} +1 -1
  54. package/dashboard/dist/assets/{FilterBar-BVyAjIgv.js → FilterBar-CzKYBOMC.js} +2 -2
  55. package/dashboard/dist/assets/{FilterBar-BVyAjIgv.js.map → FilterBar-CzKYBOMC.js.map} +1 -1
  56. package/dashboard/dist/assets/{GraphInvokePage-D_QigJeD.js → GraphInvokePage-CcDFhY53.js} +2 -2
  57. package/dashboard/dist/assets/{GraphInvokePage-D_QigJeD.js.map → GraphInvokePage-CcDFhY53.js.map} +1 -1
  58. package/dashboard/dist/assets/{HomePage-C1haeuNy.js → HomePage-Xahqcdu9.js} +2 -2
  59. package/dashboard/dist/assets/{HomePage-C1haeuNy.js.map → HomePage-Xahqcdu9.js.map} +1 -1
  60. package/dashboard/dist/assets/{LinePage-CWD5pv1g.js → LinePage-DKwhGunp.js} +2 -2
  61. package/dashboard/dist/assets/{LinePage-CWD5pv1g.js.map → LinePage-DKwhGunp.js.map} +1 -1
  62. package/dashboard/dist/assets/{LinesPage-NqChsKcO.js → LinesPage-BXZVO4MC.js} +2 -2
  63. package/dashboard/dist/assets/{LinesPage-NqChsKcO.js.map → LinesPage-BXZVO4MC.js.map} +1 -1
  64. package/dashboard/dist/assets/{ListToolbar-BZCNrTh6.js → ListToolbar-orQsOdl_.js} +2 -2
  65. package/dashboard/dist/assets/{ListToolbar-BZCNrTh6.js.map → ListToolbar-orQsOdl_.js.map} +1 -1
  66. package/dashboard/dist/assets/{McpOverview-yJTYnh1z.js → McpOverview-pSnadtSM.js} +2 -2
  67. package/dashboard/dist/assets/{McpOverview-yJTYnh1z.js.map → McpOverview-pSnadtSM.js.map} +1 -1
  68. package/dashboard/dist/assets/{McpQueryDetailPage-ChuLpJ4u.js → McpQueryDetailPage-BCAJ3rKO.js} +2 -2
  69. package/dashboard/dist/assets/{McpQueryDetailPage-ChuLpJ4u.js.map → McpQueryDetailPage-BCAJ3rKO.js.map} +1 -1
  70. package/dashboard/dist/assets/{McpQueryPage-9S-v9soF.js → McpQueryPage-CRyXeRp5.js} +2 -2
  71. package/dashboard/dist/assets/{McpQueryPage-9S-v9soF.js.map → McpQueryPage-CRyXeRp5.js.map} +1 -1
  72. package/dashboard/dist/assets/{McpRunDetailPage-BhrcfxD5.js → McpRunDetailPage-BHppCztI.js} +2 -2
  73. package/dashboard/dist/assets/{McpRunDetailPage-BhrcfxD5.js.map → McpRunDetailPage-BHppCztI.js.map} +1 -1
  74. package/dashboard/dist/assets/{McpRunsPage-C5_i8_Zx.js → McpRunsPage-Cd9yCT-_.js} +2 -2
  75. package/dashboard/dist/assets/{McpRunsPage-C5_i8_Zx.js.map → McpRunsPage-Cd9yCT-_.js.map} +1 -1
  76. package/dashboard/dist/assets/{OperationsPage-C03CeU5P.js → OperationsPage-BtnthZgj.js} +2 -2
  77. package/dashboard/dist/assets/{OperationsPage-C03CeU5P.js.map → OperationsPage-BtnthZgj.js.map} +1 -1
  78. package/dashboard/dist/assets/{OperatorDashboard-BzC134Jt.js → OperatorDashboard-B4_OBhYh.js} +2 -2
  79. package/dashboard/dist/assets/{OperatorDashboard-BzC134Jt.js.map → OperatorDashboard-B4_OBhYh.js.map} +1 -1
  80. package/dashboard/dist/assets/{PersonaDetailPage-D0mY9L6j.js → PersonaDetailPage-BAYjM9qf.js} +2 -2
  81. package/dashboard/dist/assets/{PersonaDetailPage-D0mY9L6j.js.map → PersonaDetailPage-BAYjM9qf.js.map} +1 -1
  82. package/dashboard/dist/assets/{PersonasPage-FFlm5Eug.js → PersonasPage-6HsOp-1y.js} +2 -2
  83. package/dashboard/dist/assets/{PersonasPage-FFlm5Eug.js.map → PersonasPage-6HsOp-1y.js.map} +1 -1
  84. package/dashboard/dist/assets/{PortalPage-Cpc25uO-.js → PortalPage-6OMr7KtJ.js} +2 -2
  85. package/dashboard/dist/assets/{PortalPage-Cpc25uO-.js.map → PortalPage-6OMr7KtJ.js.map} +1 -1
  86. package/dashboard/dist/assets/{ProcessDetailPage-Di2J7KwY.js → ProcessDetailPage-AidH_h7z.js} +2 -2
  87. package/dashboard/dist/assets/{ProcessDetailPage-Di2J7KwY.js.map → ProcessDetailPage-AidH_h7z.js.map} +1 -1
  88. package/dashboard/dist/assets/{ProcessesListPage-BEXwU3Z0.js → ProcessesListPage-BWKoKbXk.js} +2 -2
  89. package/dashboard/dist/assets/{ProcessesListPage-BEXwU3Z0.js.map → ProcessesListPage-BWKoKbXk.js.map} +1 -1
  90. package/dashboard/dist/assets/{ResolverForm-2ks-3jXC.js → ResolverForm-BaSvhLoT.js} +2 -2
  91. package/dashboard/dist/assets/ResolverForm-BaSvhLoT.js.map +1 -0
  92. package/dashboard/dist/assets/{RoleDetailPage-DqoOk0xc.js → RoleDetailPage-D_30TDVh.js} +2 -2
  93. package/dashboard/dist/assets/{RoleDetailPage-DqoOk0xc.js.map → RoleDetailPage-D_30TDVh.js.map} +1 -1
  94. package/dashboard/dist/assets/{RolesPage-CPmo8Srr.js → RolesPage-T2hH_MV5.js} +2 -2
  95. package/dashboard/dist/assets/{RolesPage-CPmo8Srr.js.map → RolesPage-T2hH_MV5.js.map} +1 -1
  96. package/dashboard/dist/assets/{RosterWidget-D2yovCKw.js → RosterWidget-DG6Rcx4P.js} +2 -2
  97. package/dashboard/dist/assets/{RosterWidget-D2yovCKw.js.map → RosterWidget-DG6Rcx4P.js.map} +1 -1
  98. package/dashboard/dist/assets/{RunAsSelector-CMv96On6.js → RunAsSelector-M2h9U6PP.js} +2 -2
  99. package/dashboard/dist/assets/{RunAsSelector-CMv96On6.js.map → RunAsSelector-M2h9U6PP.js.map} +1 -1
  100. package/dashboard/dist/assets/{ScanCodesPage-CA6cTT-M.js → ScanCodesPage-lB_WxoZw.js} +2 -2
  101. package/dashboard/dist/assets/{ScanCodesPage-CA6cTT-M.js.map → ScanCodesPage-lB_WxoZw.js.map} +1 -1
  102. package/dashboard/dist/assets/{ScanSchemeDetailPage-DnctN5-H.js → ScanSchemeDetailPage-C3VLg61H.js} +2 -2
  103. package/dashboard/dist/assets/{ScanSchemeDetailPage-DnctN5-H.js.map → ScanSchemeDetailPage-C3VLg61H.js.map} +1 -1
  104. package/dashboard/dist/assets/{ScanStationPage-Bk8RwkKL.js → ScanStationPage-CVET1_4r.js} +2 -2
  105. package/dashboard/dist/assets/{ScanStationPage-Bk8RwkKL.js.map → ScanStationPage-CVET1_4r.js.map} +1 -1
  106. package/dashboard/dist/assets/{StickyPagination-B0FSuUgs.js → StickyPagination-BdjseWXr.js} +2 -2
  107. package/dashboard/dist/assets/{StickyPagination-B0FSuUgs.js.map → StickyPagination-BdjseWXr.js.map} +1 -1
  108. package/dashboard/dist/assets/{StreamMessageDetail-BwZEvMpP.js → StreamMessageDetail-DJCBxETh.js} +2 -2
  109. package/dashboard/dist/assets/{StreamMessageDetail-BwZEvMpP.js.map → StreamMessageDetail-DJCBxETh.js.map} +1 -1
  110. package/dashboard/dist/assets/{SwimlaneTimeline-BDVQEaMw.js → SwimlaneTimeline-DiXm9jIk.js} +2 -2
  111. package/dashboard/dist/assets/{SwimlaneTimeline-BDVQEaMw.js.map → SwimlaneTimeline-DiXm9jIk.js.map} +1 -1
  112. package/dashboard/dist/assets/{TaskDetailPage-BOlv3iGB.js → TaskDetailPage-m8CQFN4w.js} +2 -2
  113. package/dashboard/dist/assets/{TaskDetailPage-BOlv3iGB.js.map → TaskDetailPage-m8CQFN4w.js.map} +1 -1
  114. package/dashboard/dist/assets/{TasksListPage-e2teY0bD.js → TasksListPage-DHBSUhZC.js} +2 -2
  115. package/dashboard/dist/assets/{TasksListPage-e2teY0bD.js.map → TasksListPage-DHBSUhZC.js.map} +1 -1
  116. package/dashboard/dist/assets/{TimeAgo-Cvkpf_b3.js → TimeAgo-Cq3bKUd-.js} +2 -2
  117. package/dashboard/dist/assets/{TimeAgo-Cvkpf_b3.js.map → TimeAgo-Cq3bKUd-.js.map} +1 -1
  118. package/dashboard/dist/assets/{TimestampCell-B3btAV0N.js → TimestampCell-e5gRR_FY.js} +2 -2
  119. package/dashboard/dist/assets/{TimestampCell-B3btAV0N.js.map → TimestampCell-e5gRR_FY.js.map} +1 -1
  120. package/dashboard/dist/assets/{ToolTestPanel-B03nebR7.js → ToolTestPanel-Bg0ss9oN.js} +2 -2
  121. package/dashboard/dist/assets/{ToolTestPanel-B03nebR7.js.map → ToolTestPanel-Bg0ss9oN.js.map} +1 -1
  122. package/dashboard/dist/assets/{TopicDetailPage-DBRWne3O.js → TopicDetailPage-DhPiCfOO.js} +2 -2
  123. package/dashboard/dist/assets/{TopicDetailPage-DBRWne3O.js.map → TopicDetailPage-DhPiCfOO.js.map} +1 -1
  124. package/dashboard/dist/assets/{TopicsPage-CVe2M9HD.js → TopicsPage-BqZaVv3d.js} +2 -2
  125. package/dashboard/dist/assets/{TopicsPage-CVe2M9HD.js.map → TopicsPage-BqZaVv3d.js.map} +1 -1
  126. package/dashboard/dist/assets/{UserName-B_q_qp6V.js → UserName-C6ZNHHKN.js} +2 -2
  127. package/dashboard/dist/assets/{UserName-B_q_qp6V.js.map → UserName-C6ZNHHKN.js.map} +1 -1
  128. package/dashboard/dist/assets/{WorkflowExecutionPage-Bh_dr9tM.js → WorkflowExecutionPage-BUqIhtcr.js} +2 -2
  129. package/dashboard/dist/assets/{WorkflowExecutionPage-Bh_dr9tM.js.map → WorkflowExecutionPage-BUqIhtcr.js.map} +1 -1
  130. package/dashboard/dist/assets/{WorkflowsDashboard-DA6Mj7qH.js → WorkflowsDashboard-BKxhC_hT.js} +2 -2
  131. package/dashboard/dist/assets/{WorkflowsDashboard-DA6Mj7qH.js.map → WorkflowsDashboard-BKxhC_hT.js.map} +1 -1
  132. package/dashboard/dist/assets/{WorkflowsOverview-B1kBLj-a.js → WorkflowsOverview-018s2q_p.js} +2 -2
  133. package/dashboard/dist/assets/{WorkflowsOverview-B1kBLj-a.js.map → WorkflowsOverview-018s2q_p.js.map} +1 -1
  134. package/dashboard/dist/assets/{YamlWorkflowDetailPage-6GJM8QIX.js → YamlWorkflowDetailPage-C2zcXDr1.js} +2 -2
  135. package/dashboard/dist/assets/{YamlWorkflowDetailPage-6GJM8QIX.js.map → YamlWorkflowDetailPage-C2zcXDr1.js.map} +1 -1
  136. package/dashboard/dist/assets/{YamlWorkflowsPage-Bu811C7f.js → YamlWorkflowsPage-aVcNZNu6.js} +2 -2
  137. package/dashboard/dist/assets/{YamlWorkflowsPage-Bu811C7f.js.map → YamlWorkflowsPage-aVcNZNu6.js.map} +1 -1
  138. package/dashboard/dist/assets/{agents-MPk_GnYz.js → agents-DRaaJUue.js} +2 -2
  139. package/dashboard/dist/assets/{agents-MPk_GnYz.js.map → agents-DRaaJUue.js.map} +1 -1
  140. package/dashboard/dist/assets/{bots-2RihE2Tc.js → bots-C4N90NCj.js} +2 -2
  141. package/dashboard/dist/assets/{bots-2RihE2Tc.js.map → bots-C4N90NCj.js.map} +1 -1
  142. package/dashboard/dist/assets/{capabilities-CC4iwJ1P.js → capabilities-BoRWifSC.js} +2 -2
  143. package/dashboard/dist/assets/{capabilities-CC4iwJ1P.js.map → capabilities-BoRWifSC.js.map} +1 -1
  144. package/dashboard/dist/assets/{controlplane-Bmkic8BH.js → controlplane-DGZAxi7J.js} +2 -2
  145. package/dashboard/dist/assets/{controlplane-Bmkic8BH.js.map → controlplane-DGZAxi7J.js.map} +1 -1
  146. package/dashboard/dist/assets/{escalation-columns-B0lhUUrQ.js → escalation-columns-DJbfsH_m.js} +2 -2
  147. package/dashboard/dist/assets/{escalation-columns-B0lhUUrQ.js.map → escalation-columns-DJbfsH_m.js.map} +1 -1
  148. package/dashboard/dist/assets/{escalation-items-7WFpPo46.js → escalation-items-C8iJZEA8.js} +2 -2
  149. package/dashboard/dist/assets/{escalation-items-7WFpPo46.js.map → escalation-items-C8iJZEA8.js.map} +1 -1
  150. package/dashboard/dist/assets/{index-CvJsvqIc.js → index-3HaFP00M.js} +2 -2
  151. package/dashboard/dist/assets/{index-CvJsvqIc.js.map → index-3HaFP00M.js.map} +1 -1
  152. package/dashboard/dist/assets/{index-CmsmwCyv.js → index-BFxHIfQ_.js} +2 -2
  153. package/dashboard/dist/assets/{index-CmsmwCyv.js.map → index-BFxHIfQ_.js.map} +1 -1
  154. package/dashboard/dist/assets/{index-C2CLfGwL.js → index-BhS9XSy8.js} +2 -2
  155. package/dashboard/dist/assets/{index-C2CLfGwL.js.map → index-BhS9XSy8.js.map} +1 -1
  156. package/dashboard/dist/assets/{index-DSUtfDXx.js → index-BuSUevzO.js} +2 -2
  157. package/dashboard/dist/assets/{index-DSUtfDXx.js.map → index-BuSUevzO.js.map} +1 -1
  158. package/dashboard/dist/assets/{index-Da6ycKyf.js → index-CXXc9sUr.js} +2 -2
  159. package/dashboard/dist/assets/index-CXXc9sUr.js.map +1 -0
  160. package/dashboard/dist/assets/{index-D-ilRyfy.js → index-CeeSFnl-.js} +2 -2
  161. package/dashboard/dist/assets/{index-D-ilRyfy.js.map → index-CeeSFnl-.js.map} +1 -1
  162. package/dashboard/dist/assets/{index-CcArGkzI.js → index-CjjRxpVe.js} +2 -2
  163. package/dashboard/dist/assets/index-CjjRxpVe.js.map +1 -0
  164. package/dashboard/dist/assets/{index-CRWsB7ZC.js → index-CyL-6CAa.js} +2 -2
  165. package/dashboard/dist/assets/{index-CRWsB7ZC.js.map → index-CyL-6CAa.js.map} +1 -1
  166. package/dashboard/dist/assets/{index-C3AeFihz.js → index-DIU89TX3.js} +2 -2
  167. package/dashboard/dist/assets/{index-C3AeFihz.js.map → index-DIU89TX3.js.map} +1 -1
  168. package/dashboard/dist/assets/{index-B_XV1rwu.js → index-DMKLnxt8.js} +2 -2
  169. package/dashboard/dist/assets/{index-B_XV1rwu.js.map → index-DMKLnxt8.js.map} +1 -1
  170. package/dashboard/dist/assets/{index-CTOv3G7a.js → index-DeyA88jq.js} +2 -2
  171. package/dashboard/dist/assets/{index-CTOv3G7a.js.map → index-DeyA88jq.js.map} +1 -1
  172. package/dashboard/dist/assets/{index-CBri8fYM.js → index-DhKGp4QK.js} +2 -2
  173. package/dashboard/dist/assets/{index-CBri8fYM.js.map → index-DhKGp4QK.js.map} +1 -1
  174. package/dashboard/dist/assets/{index-CkMHS-hG.js → index-pzbGpihI.js} +3 -3
  175. package/dashboard/dist/assets/{index-CkMHS-hG.js.map → index-pzbGpihI.js.map} +1 -1
  176. package/dashboard/dist/assets/{knowledge-Bpbg20DC.js → knowledge-BWo3OCJc.js} +2 -2
  177. package/dashboard/dist/assets/{knowledge-Bpbg20DC.js.map → knowledge-BWo3OCJc.js.map} +1 -1
  178. package/dashboard/dist/assets/{machines-BqOZZU-3.js → machines-LEYY_yar.js} +2 -2
  179. package/dashboard/dist/assets/{machines-BqOZZU-3.js.map → machines-LEYY_yar.js.map} +1 -1
  180. package/dashboard/dist/assets/{mcp-CmcUXYce.js → mcp-_0kFRcyT.js} +2 -2
  181. package/dashboard/dist/assets/{mcp-CmcUXYce.js.map → mcp-_0kFRcyT.js.map} +1 -1
  182. package/dashboard/dist/assets/{mcp-query-C8buQxN9.js → mcp-query-BzmN0lc5.js} +2 -2
  183. package/dashboard/dist/assets/{mcp-query-C8buQxN9.js.map → mcp-query-BzmN0lc5.js.map} +1 -1
  184. package/dashboard/dist/assets/{personas-C2n5oDmY.js → personas-kE4PMrgo.js} +2 -2
  185. package/dashboard/dist/assets/{personas-C2n5oDmY.js.map → personas-kE4PMrgo.js.map} +1 -1
  186. package/dashboard/dist/assets/{pipelines-RKpSkFz7.js → pipelines-DYDNaypF.js} +2 -2
  187. package/dashboard/dist/assets/{pipelines-RKpSkFz7.js.map → pipelines-DYDNaypF.js.map} +1 -1
  188. package/dashboard/dist/assets/{tasks-Dab4hExW.js → tasks-ClJ-mbj9.js} +2 -2
  189. package/dashboard/dist/assets/{tasks-Dab4hExW.js.map → tasks-ClJ-mbj9.js.map} +1 -1
  190. package/dashboard/dist/assets/{topics-FTMNP7r3.js → topics-oHX4vbqe.js} +2 -2
  191. package/dashboard/dist/assets/{topics-FTMNP7r3.js.map → topics-oHX4vbqe.js.map} +1 -1
  192. package/dashboard/dist/assets/{useDebouncedValue-B_1u1YIk.js → useDebouncedValue-C97KADrj.js} +2 -2
  193. package/dashboard/dist/assets/{useDebouncedValue-B_1u1YIk.js.map → useDebouncedValue-C97KADrj.js.map} +1 -1
  194. package/dashboard/dist/assets/{useNamespace-HUeAI7Qb.js → useNamespace-Kje0Rn7j.js} +2 -2
  195. package/dashboard/dist/assets/{useNamespace-HUeAI7Qb.js.map → useNamespace-Kje0Rn7j.js.map} +1 -1
  196. package/dashboard/dist/assets/{useYamlActivityEvents-Cax54qHH.js → useYamlActivityEvents-DMz-HKFv.js} +2 -2
  197. package/dashboard/dist/assets/{useYamlActivityEvents-Cax54qHH.js.map → useYamlActivityEvents-DMz-HKFv.js.map} +1 -1
  198. package/dashboard/dist/assets/{validate-DxOaV7QS.js → validate-hUqjWN63.js} +2 -2
  199. package/dashboard/dist/assets/{validate-DxOaV7QS.js.map → validate-hUqjWN63.js.map} +1 -1
  200. package/dashboard/dist/assets/{yaml-workflows-BgY1XHJx.js → yaml-workflows-64vfmKJx.js} +2 -2
  201. package/dashboard/dist/assets/{yaml-workflows-BgY1XHJx.js.map → yaml-workflows-64vfmKJx.js.map} +1 -1
  202. package/dashboard/dist/index.html +1 -1
  203. package/docs/machines.md +2 -2
  204. package/package.json +1 -1
  205. package/dashboard/dist/assets/ResolverForm-2ks-3jXC.js.map +0 -1
  206. package/dashboard/dist/assets/index-CcArGkzI.js.map +0 -1
  207. package/dashboard/dist/assets/index-Da6ycKyf.js.map +0 -1
@@ -164,20 +164,32 @@ class Dispatcher {
164
164
  row.dispatch = state_1.DISPATCH_STATE.ACCEPTED;
165
165
  for (const job of jobs)
166
166
  state.rememberSent(a.machineId, job.jobId, a.rowId);
167
+ // The machine may say a job is ready before the claim below returns: the set it is taken out of is there first, and a ready that came earlier still is already out of it.
168
+ const preparing = a.receivedOnAccept ? jobs.filter((job, i) => replies[i]?.status === protocol_1.REPLY_STATUS.ACCEPTED && replies[i]?.preparing).map((job) => `${a.cmdId}${job.suffix}`) : [];
169
+ if (row && preparing.length) {
170
+ row.awaitingReady = new Set(preparing.filter((cmdId) => !row.readyEarly?.has(cmdId)));
171
+ row.readyEarly = undefined;
172
+ }
167
173
  if (reconciled)
168
174
  log.info(log_1.GATEWAY_LOG.DISPATCH_RECONCILED, { row: a.rowId, machine: a.machineId, jobs: silent.map((j) => j.jobId) });
169
175
  log.info(log_1.GATEWAY_LOG.DISPATCHED, { row: a.rowId, machine: a.machineId, reason: replies.map((r) => r?.reason ?? 'held').join('; ') });
170
- this.check(a.rowId, 'claim', await lt.claim(a.machineId, a.rowId));
176
+ const claiming = lt.claim(a.machineId, a.rowId);
177
+ if (row)
178
+ row.claiming = claiming;
179
+ this.check(a.rowId, 'claim', await claiming);
180
+ if (row)
181
+ row.claiming = undefined;
171
182
  if (!a.receivedOnAccept)
172
183
  return;
173
- const preparing = jobs.filter((job, i) => replies[i]?.status === protocol_1.REPLY_STATUS.ACCEPTED && replies[i]?.preparing).map((job) => `${a.cmdId}${job.suffix}`);
174
- if (!preparing.length) {
184
+ // A ready that came while the claim was out has received the row already.
185
+ const live = state.get(a.rowId);
186
+ if (!live || live.ended)
187
+ return;
188
+ if (!preparing.length || !live.awaitingReady?.size) {
175
189
  await this.received(a);
176
190
  return;
177
191
  }
178
- if (row)
179
- row.awaitingReady = new Set(preparing);
180
- log.info(log_1.GATEWAY_LOG.DISPATCH_PREPARING, { row: a.rowId, machine: a.machineId, jobs: preparing });
192
+ log.info(log_1.GATEWAY_LOG.DISPATCH_PREPARING, { row: a.rowId, machine: a.machineId, jobs: [...live.awaitingReady] });
181
193
  return;
182
194
  }
183
195
  // The handoff may have ended meanwhile: a machine that ran the job anyway reports the arrival.
@@ -57,7 +57,12 @@ export declare class Executor {
57
57
  * carrying the units out of it.
58
58
  */
59
59
  private lateReply;
60
- /** On arrival dispatch, a row that waited for the machine to prepare is received once every job it sent is ready. */
60
+ /**
61
+ * On arrival dispatch, a row that waited for the machine to prepare is
62
+ * received once every job it sent is ready. A ready that comes before the
63
+ * dispatch has recorded what it waits for is kept for it; one that comes
64
+ * while the dispatch's claim is still out waits for that claim.
65
+ */
61
66
  private readyForArrival;
62
67
  /** Add the item; when the row then holds every key the action waits for, resolve it. */
63
68
  private accumulate;
@@ -155,14 +155,31 @@ class Executor {
155
155
  received: false, errorCode: contracts_1.HANDOFF_ERROR.DISPATCH_FAILED, detail: `${m} could not prepare the job: ${a.reason}`, ...(a.code ? { code: a.code } : {}),
156
156
  }));
157
157
  }
158
- /** On arrival dispatch, a row that waited for the machine to prepare is received once every job it sent is ready. */
158
+ /**
159
+ * On arrival dispatch, a row that waited for the machine to prepare is
160
+ * received once every job it sent is ready. A ready that comes before the
161
+ * dispatch has recorded what it waits for is kept for it; one that comes
162
+ * while the dispatch's claim is still out waits for that claim.
163
+ */
159
164
  async readyForArrival(into, m, cmdId) {
160
165
  const { lt, state } = this.d;
161
- if (into.ended || !into.awaitingReady?.has(cmdId))
166
+ if (into.ended)
167
+ return [];
168
+ if (!into.awaitingReady) {
169
+ if (into.dispatch !== state_1.DISPATCH_STATE.ACCEPTED && into.dispatch !== state_1.DISPATCH_STATE.PENDING)
170
+ return [];
171
+ (into.readyEarly ??= new Set()).add(cmdId);
172
+ return [{ verb: 'none', detail: `ready before its dispatch settled; kept` }];
173
+ }
174
+ if (!into.awaitingReady.has(cmdId))
162
175
  return [];
163
176
  into.awaitingReady.delete(cmdId);
164
177
  if (into.awaitingReady.size)
165
178
  return [];
179
+ if (into.claiming)
180
+ await into.claiming;
181
+ if (into.ended)
182
+ return [];
166
183
  const units = into.units.map((u) => u.unitId);
167
184
  const resolved = await lt.resolve(m, into.id, { received: true, receiver: m, units });
168
185
  state.close(into.id);
@@ -131,6 +131,23 @@ function heldUnder(state, machineId, unitId, senderJobId) {
131
131
  const held = state.heldJob(machineId, unitId);
132
132
  return !!held && (!senderJobId || (0, jobs_1.jobOwns)(senderJobId, held));
133
133
  }
134
+ /**
135
+ * Units a new row sends to a machine that already holds them from an earlier
136
+ * attempt (a job that failed to prepare, then a retry) need no second scan:
137
+ * the row is dispatched now, with the arrivals the gateway kept for them.
138
+ */
139
+ function arrivedAlready(state, row, dispatchTtlMs) {
140
+ const m = row.toMachine;
141
+ if (!m || !row.units.length || !row.units.every((u) => state.heldJob(m, u.unitId)))
142
+ return [];
143
+ const arrivals = row.units.map((u) => {
144
+ const before = state.closedFor(u.unitId, (r) => r.toMachine === m && !!r.arrivals?.[u.unitId]);
145
+ return [u.unitId, before?.arrivals?.[u.unitId] ?? { unitId: u.unitId, carrierId: u.carrierId ?? null }];
146
+ });
147
+ row.arrivals = Object.fromEntries(arrivals);
148
+ row.dueAt = Date.now();
149
+ return [(0, pacing_1.dispatchAction)(row, m, dispatchTtlMs)];
150
+ }
134
151
  function planHandoff(state, line, event, facets, dispatchTtlMs) {
135
152
  const id = event.escalationId;
136
153
  if (event.verb === VERB.CREATED || event.verb === VERB.CLAIMED) {
@@ -152,9 +169,10 @@ function planHandoff(state, line, event, facets, dispatchTtlMs) {
152
169
  }
153
170
  if (state.dispatchOnArrival) {
154
171
  const refused = (0, pacing_1.refuseUnfit)(state, line, row);
155
- if (!refused.length)
156
- row.dispatch = state_1.DISPATCH_STATE.ARRIVING;
157
- return refused;
172
+ if (refused.length)
173
+ return refused;
174
+ row.dispatch = state_1.DISPATCH_STATE.ARRIVING;
175
+ return arrivedAlready(state, row, dispatchTtlMs);
158
176
  }
159
177
  const refused = !!(0, pacing_1.softwareRefusal)(state, line, row.toMachine) || !!(0, pacing_1.jobRefusal)(state, row);
160
178
  if (state.holdDispatch || (!refused && (!(0, pacing_1.hasRoom)(state, line, row) || !(0, registration_1.reachable)(state, line, row.toMachine)))) {
@@ -141,7 +141,7 @@ function planJob(state, m, b, at, ttl) {
141
141
  const released = releasedAction(row, m, b);
142
142
  if (b.result === protocol_1.JOB_RESULT.OK)
143
143
  return ack([released]);
144
- return ack([released, ...(0, plan_shared_1.failHandoff)(state, row, m, {
144
+ return ack([(0, plan_shared_1.holdForResolver)(row, m), released, ...(0, plan_shared_1.failHandoff)(state, row, m, {
145
145
  received: false, unitId, errorCode: contracts_1.HANDOFF_ERROR.SENDER_REJECTED, result: b.result, reason: b.reason ?? null,
146
146
  detail: `${m} finished ${unitId}: ${b.result}${b.reason ? ` (${b.reason})` : ''}`,
147
147
  })]);
@@ -18,3 +18,11 @@ export declare function cancelDispatch(state: GatewayState, row: HandoffRow): Ac
18
18
  * claimant may resolve a claimed row); `reportedBy` names who saw the failure.
19
19
  */
20
20
  export declare function failHandoff(state: GatewayState, row: HandoffRow, reporter: Actor, resolution: HandoffResolution): Action[];
21
+ /** Who resolves a failed handoff: the receiver while it holds the claim, otherwise whoever reports. */
22
+ export declare function resolverOf(row: HandoffRow, reporter: Actor): Actor;
23
+ /**
24
+ * The row claimed for its resolver before anything else is written to it. A
25
+ * claimed row refuses every other resolver, so what the machine writes next
26
+ * and the resolution that follows land on a row nobody else can end meanwhile.
27
+ */
28
+ export declare function holdForResolver(row: HandoffRow, reporter: Actor): Action;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cancelJobs = cancelJobs;
4
4
  exports.cancelDispatch = cancelDispatch;
5
5
  exports.failHandoff = failHandoff;
6
+ exports.resolverOf = resolverOf;
7
+ exports.holdForResolver = holdForResolver;
6
8
  const contracts_1 = require("../contracts");
7
9
  const protocol_1 = require("../../../lib/machines/protocol");
8
10
  const jobs_1 = require("./jobs");
@@ -32,7 +34,19 @@ function cancelDispatch(state, row) {
32
34
  * claimant may resolve a claimed row); `reportedBy` names who saw the failure.
33
35
  */
34
36
  function failHandoff(state, row, reporter, resolution) {
35
- const claimant = row.dispatch === state_1.DISPATCH_STATE.ACCEPTED && row.toMachine ? row.toMachine : reporter;
37
+ const claimant = resolverOf(row, reporter);
36
38
  const payload = claimant === reporter ? { ...resolution } : { ...resolution, reportedBy: reporter };
37
39
  return [{ kind: 'resolve', as: claimant, rowId: row.id, payload }, ...cancelDispatch(state, row)];
38
40
  }
41
+ /** Who resolves a failed handoff: the receiver while it holds the claim, otherwise whoever reports. */
42
+ function resolverOf(row, reporter) {
43
+ return row.dispatch === state_1.DISPATCH_STATE.ACCEPTED && row.toMachine ? row.toMachine : reporter;
44
+ }
45
+ /**
46
+ * The row claimed for its resolver before anything else is written to it. A
47
+ * claimed row refuses every other resolver, so what the machine writes next
48
+ * and the resolution that follows land on a row nobody else can end meanwhile.
49
+ */
50
+ function holdForResolver(row, reporter) {
51
+ return { kind: 'claim', as: resolverOf(row, reporter), rowId: row.id };
52
+ }
@@ -37,6 +37,10 @@ export interface HandoffRow extends HandoffFacets {
37
37
  arrivals?: Record<string, Record<string, any>>;
38
38
  /** Dispatch commands accepted as preparing; on arrival dispatch the row is received once each is ready. */
39
39
  awaitingReady?: Set<string>;
40
+ /** Jobs the machine said were ready before the dispatch recorded what it waits for. */
41
+ readyEarly?: Set<string>;
42
+ /** The claim the dispatch has out; a ready that completes the row waits for it. */
43
+ claiming?: Promise<unknown>;
40
44
  /** Lifecycle item keys already on the row (lifecycle.ts). */
41
45
  noted?: string[];
42
46
  /** Parked with a limit on its items, which lifecycle notes must never use up. */
@@ -80,7 +80,7 @@ class GatewayState {
80
80
  this.openRows.set(row.id, existing
81
81
  ? {
82
82
  ...row, dispatch: existing.dispatch, trace: (0, trace_1.mergeTrace)(row.trace, existing.trace), arrivals: existing.arrivals,
83
- dueAt: existing.dueAt, noted: existing.noted ?? row.noted, awaitingReady: existing.awaitingReady,
83
+ dueAt: existing.dueAt, noted: existing.noted ?? row.noted, awaitingReady: existing.awaitingReady, readyEarly: existing.readyEarly, claiming: existing.claiming,
84
84
  }
85
85
  : row);
86
86
  }
@@ -1,2 +1,2 @@
1
- import{j as o}from"./vendor-query-DvWWuNIB.js";import{c as n}from"./tasks-Dab4hExW.js";import{z as m,a9 as c}from"./index-CkMHS-hG.js";import{u}from"./mcp-CmcUXYce.js";import{P as d}from"./PageHeaderWithStats-BEQYYBJv.js";import"./vendor-react-_9U4mKFr.js";import"./vendor-icons-fxBvvHBi.js";function S(){var e;m();const{data:t}=n({limit:1}),{data:a}=c({status:"pending",limit:1}),{data:s}=u(),l=((e=s==null?void 0:s.servers)==null?void 0:e.filter(i=>i.status==="connected").length)??0,r=s?`${l}/${s.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(t==null?void 0:t.total)??"—"},{label:"Pending Escalations",value:(a==null?void 0:a.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:r},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{S as AdminDashboard};
2
- //# sourceMappingURL=AdminDashboard-Bm7VG65H.js.map
1
+ import{j as o}from"./vendor-query-DvWWuNIB.js";import{c as n}from"./tasks-ClJ-mbj9.js";import{z as m,a9 as c}from"./index-pzbGpihI.js";import{u}from"./mcp-_0kFRcyT.js";import{P as d}from"./PageHeaderWithStats-BEQYYBJv.js";import"./vendor-react-_9U4mKFr.js";import"./vendor-icons-fxBvvHBi.js";function S(){var e;m();const{data:t}=n({limit:1}),{data:a}=c({status:"pending",limit:1}),{data:s}=u(),l=((e=s==null?void 0:s.servers)==null?void 0:e.filter(i=>i.status==="connected").length)??0,r=s?`${l}/${s.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(t==null?void 0:t.total)??"—"},{label:"Pending Escalations",value:(a==null?void 0:a.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:r},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{S as AdminDashboard};
2
+ //# sourceMappingURL=AdminDashboard-DRE0hSDS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminDashboard-Bm7VG65H.js","sources":["../../src/pages/admin/AdminDashboard.tsx"],"sourcesContent":["import { useTasks } from '../../api/tasks';\nimport { useEscalations } from '../../api/escalations';\nimport { useEscalationListEvents } from '../../hooks/useEventHooks';\nimport { useMcpServers } from '../../api/mcp';\nimport { PageHeaderWithStats } from '../../components/common/layout/PageHeaderWithStats';\n\nexport function AdminDashboard() {\n useEscalationListEvents();\n const { data: taskData } = useTasks({ limit: 1 });\n const { data: pendingEsc } = useEscalations({ status: 'pending', limit: 1 });\n const { data: mcpData } = useMcpServers();\n\n const connectedServers =\n mcpData?.servers?.filter((s) => s.status === 'connected').length ?? 0;\n const mcpLabel = mcpData ? `${connectedServers}/${mcpData.total}` : '—';\n\n return (\n <div>\n <PageHeaderWithStats\n title=\"Admin\"\n stats={[\n { label: 'Tasks', value: taskData?.total ?? '—' },\n { label: 'Pending Escalations', value: pendingEsc?.total ?? '—', dotClass: 'bg-status-pending' },\n { label: 'MCP Servers', value: mcpLabel },\n { label: 'System', value: 'Healthy', dotClass: 'bg-status-success' },\n ]}\n />\n </div>\n );\n}\n"],"names":["AdminDashboard","useEscalationListEvents","taskData","useTasks","pendingEsc","useEscalations","mcpData","useMcpServers","connectedServers","_a","s","mcpLabel","jsx","PageHeaderWithStats"],"mappings":"oSAMO,SAASA,GAAiB,OAC/BC,EAAA,EACA,KAAM,CAAE,KAAMC,CAAA,EAAaC,EAAS,CAAE,MAAO,EAAG,EAC1C,CAAE,KAAMC,CAAA,EAAeC,EAAe,CAAE,OAAQ,UAAW,MAAO,EAAG,EACrE,CAAE,KAAMC,CAAA,EAAYC,EAAA,EAEpBC,IACJC,EAAAH,GAAA,YAAAA,EAAS,UAAT,YAAAG,EAAkB,OAAQC,GAAMA,EAAE,SAAW,aAAa,SAAU,EAChEC,EAAWL,EAAU,GAAGE,CAAgB,IAAIF,EAAQ,KAAK,GAAK,IAEpE,aACG,MAAA,CACC,SAAAM,EAAAA,IAACC,EAAA,CACC,MAAM,QACN,MAAO,CACL,CAAE,MAAO,QAAS,OAAOX,GAAA,YAAAA,EAAU,QAAS,GAAA,EAC5C,CAAE,MAAO,sBAAuB,OAAOE,GAAA,YAAAA,EAAY,QAAS,IAAK,SAAU,mBAAA,EAC3E,CAAE,MAAO,cAAe,MAAOO,CAAA,EAC/B,CAAE,MAAO,SAAU,MAAO,UAAW,SAAU,mBAAA,CAAoB,CACrE,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"AdminDashboard-DRE0hSDS.js","sources":["../../src/pages/admin/AdminDashboard.tsx"],"sourcesContent":["import { useTasks } from '../../api/tasks';\nimport { useEscalations } from '../../api/escalations';\nimport { useEscalationListEvents } from '../../hooks/useEventHooks';\nimport { useMcpServers } from '../../api/mcp';\nimport { PageHeaderWithStats } from '../../components/common/layout/PageHeaderWithStats';\n\nexport function AdminDashboard() {\n useEscalationListEvents();\n const { data: taskData } = useTasks({ limit: 1 });\n const { data: pendingEsc } = useEscalations({ status: 'pending', limit: 1 });\n const { data: mcpData } = useMcpServers();\n\n const connectedServers =\n mcpData?.servers?.filter((s) => s.status === 'connected').length ?? 0;\n const mcpLabel = mcpData ? `${connectedServers}/${mcpData.total}` : '—';\n\n return (\n <div>\n <PageHeaderWithStats\n title=\"Admin\"\n stats={[\n { label: 'Tasks', value: taskData?.total ?? '—' },\n { label: 'Pending Escalations', value: pendingEsc?.total ?? '—', dotClass: 'bg-status-pending' },\n { label: 'MCP Servers', value: mcpLabel },\n { label: 'System', value: 'Healthy', dotClass: 'bg-status-success' },\n ]}\n />\n </div>\n );\n}\n"],"names":["AdminDashboard","useEscalationListEvents","taskData","useTasks","pendingEsc","useEscalations","mcpData","useMcpServers","connectedServers","_a","s","mcpLabel","jsx","PageHeaderWithStats"],"mappings":"oSAMO,SAASA,GAAiB,OAC/BC,EAAA,EACA,KAAM,CAAE,KAAMC,CAAA,EAAaC,EAAS,CAAE,MAAO,EAAG,EAC1C,CAAE,KAAMC,CAAA,EAAeC,EAAe,CAAE,OAAQ,UAAW,MAAO,EAAG,EACrE,CAAE,KAAMC,CAAA,EAAYC,EAAA,EAEpBC,IACJC,EAAAH,GAAA,YAAAA,EAAS,UAAT,YAAAG,EAAkB,OAAQC,GAAMA,EAAE,SAAW,aAAa,SAAU,EAChEC,EAAWL,EAAU,GAAGE,CAAgB,IAAIF,EAAQ,KAAK,GAAK,IAEpE,aACG,MAAA,CACC,SAAAM,EAAAA,IAACC,EAAA,CACC,MAAM,QACN,MAAO,CACL,CAAE,MAAO,QAAS,OAAOX,GAAA,YAAAA,EAAU,QAAS,GAAA,EAC5C,CAAE,MAAO,sBAAuB,OAAOE,GAAA,YAAAA,EAAY,QAAS,IAAK,SAAU,mBAAA,EAC3E,CAAE,MAAO,cAAe,MAAOO,CAAA,EAC/B,CAAE,MAAO,SAAU,MAAO,UAAW,SAAU,mBAAA,CAAoB,CACrE,CAAA,EAEJ,CAEJ"}
@@ -1,4 +1,4 @@
1
- import{j as e,a as f}from"./vendor-query-DvWWuNIB.js";import{a as ce,d as le,b as oe}from"./agents-MPk_GnYz.js";import{E as de,C as xe,u as pe,a as ue,b as me,c as he}from"./CronLabel-Dg_Oew_Y.js";import{g as fe,a as ve,c as be,y as ye}from"./index-CkMHS-hG.js";import{P as ge}from"./PageHeader-Hx8APPwE.js";import{z as E,q as B,Q as je,R as U,h as M,H as Z,az as G,g as V,bY as ee,ad as we}from"./vendor-icons-fxBvvHBi.js";import{g as Ne}from"./knowledge-Bpbg20DC.js";import{R as te}from"./RunAsSelector-CMv96On6.js";import{u as _e}from"./yaml-workflows-BgY1XHJx.js";import{u as se}from"./capabilities-CC4iwJ1P.js";import{u as ke}from"./topics-FTMNP7r3.js";import{W as Q}from"./WorkflowPill-D7244fKp.js";import{e as Ce,u as Se,f as qe}from"./vendor-react-_9U4mKFr.js";import"./BotPicker-CofRxk4L.js";import"./bots-2RihE2Tc.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Oe={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},Ae={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var o,x,m;const r=(x=(o=s.behaviors)==null?void 0:o.schedules)!=null&&x.length?s.behaviors.schedules.map(i=>({cron:i.cron||"",reaction_type:i.reaction_type||"durable",workflow_type:i.workflow_type||"",pipeline_id:i.pipeline_id||"",server_id:i.server_id||"",tool_name:i.tool_name||"",envelope:i.envelope?JSON.stringify(i.envelope,null,2):"{}",execute_as:i.execute_as||""})):(m=s.behaviors)!=null&&m.cron?[{cron:s.behaviors.cron,reaction_type:"durable",workflow_type:s.workflow_type??"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""}]:[];return{name:s.id,description:s.description??"",goals:s.goals??"",rules:s.rules??"",user_id:s.user_id??"",knowledge_domain:s.knowledge_domain??"",subscriptions:a.map(i=>({id:i.id,topic:i.topic,filter:i.filter?JSON.stringify(i.filter,null,2):"",reaction_type:i.reaction_type,workflow_type:i.workflow_type??"",pipeline_id:i.pipeline_id??"",mcp_prompt:i.mcp_prompt??"",server_id:i.server_id??"",tool_name:i.tool_name??"",input_mapping:JSON.stringify(i.input_mapping??{},null,2),execute_as:i.execute_as??"",enabled:i.enabled})),schedules:r}}function Ee(s){var r;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(o=>({cron:o.cron,reaction_type:o.reaction_type||"durable",workflow_type:o.reaction_type==="pipeline"?void 0:o.workflow_type,pipeline_id:o.reaction_type==="pipeline"?o.pipeline_id:void 0,envelope:Y(o.envelope)??{},execute_as:o.execute_as||void 0})),a.cron=s.schedules[0].cron),{id:s.name,description:s.description||void 0,goals:s.goals||void 0,rules:s.rules||void 0,user_id:s.user_id||void 0,knowledge_domain:s.knowledge_domain||void 0,behaviors:a,workflow_type:((r=s.schedules[0])==null?void 0:r.workflow_type)||void 0,pipeline_id:void 0}}function $e(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?Y(a.filter):void 0,reaction_type:a.reaction_type,workflow_type:a.workflow_type||void 0,pipeline_id:a.pipeline_id||void 0,mcp_prompt:a.mcp_prompt||void 0,server_id:a.server_id||void 0,tool_name:a.tool_name||void 0,input_mapping:Y(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function Y(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function Pe(s,a,r,o){let x;try{x=JSON.parse(s)}catch{x={}}const m=o.includes(a),i=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!m&&i){const{[a]:p,...l}=x;return JSON.stringify(l,null,2)}let u=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(u=p)}catch{}return JSON.stringify({...x,[a]:u},null,2)}const S="section-header mt-[3em] first:mt-0",P="label",_="hint",A="input",L="input-json w-full";function Ie({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:A}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:r=>a("description",r.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:A}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function We({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Goals define what drives the automation. Rules define what constrains it."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:r=>a("goals",r.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${A} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:r=>a("rules",r.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${A} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Te({form:s,set:a}){const{data:r}=Ne(),o=(r==null?void 0:r.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the automation's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:x=>a("knowledge_domain",x.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:A,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:o.map(x=>e.jsx("option",{value:x.domain},x.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),o.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:o.map(x=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",x.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===x.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(B,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:x.domain}),e.jsxs("span",{className:"text-2xs text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-2xs text-text-quaternary",children:e.jsx(fe,{date:x.latest})})]},x.domain))})]})]})}function Me({serverId:s,toolName:a,onChange:r}){const{data:o}=se(),x=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[m,i]=f.useState(!1),[u,p]=f.useState(""),l=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!m)return;function t(n){h.current&&!h.current.contains(n.target)&&i(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[m]);const c=a?`${a}`:"",d=m?u:c,y=f.useMemo(()=>{const t=(m?u:"").toLowerCase();return t?x.filter(n=>n.name.toLowerCase().includes(t)||n.serverName.toLowerCase().includes(t)||(n.description??"").toLowerCase().includes(t)):x},[x,u,m]),v=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:h,className:"relative",children:[e.jsx("input",{ref:l,type:"text",value:d,onFocus:()=>{i(!0),p(c)},onChange:t=>{const n=t.target.value;p(n),n||r("",""),m||i(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!m&&(v==null?void 0:v.description)&&e.jsx("p",{className:"text-2xs text-text-tertiary mt-1 italic",children:v.description}),m&&y.length>0&&e.jsx("div",{className:"absolute z-[100] left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:y.map(t=>e.jsxs("button",{type:"button",onClick:()=>{r(t.serverId,t.name),p(t.name),i(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===t.serverId&&a===t.name?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-2xs font-mono text-text-primary shrink-0",children:t.name}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(je,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-2xs text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),m&&y.length===0&&u&&e.jsx("div",{className:"absolute z-[100] left-0 right-0 mt-1 rounded-md border border-surface-border bg-surface shadow-lg px-3 py-4 text-center",children:e.jsxs("p",{className:"text-2xs text-text-quaternary",children:['No capabilities match "',u,'"']})})]})}const Le={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Je=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:o,pipelineId:x,onPipelineIdChange:m,serverId:i,toolName:u,onCapabilityChange:p,mcpPrompt:l,onMcpPromptChange:h,availableTypes:c=[...Je]}){const{data:d}=ve(),y=(d??[]).filter(n=>n.invocable).map(n=>n.workflow_type),{data:v}=_e({status:"active"}),t=((v==null?void 0:v.workflows)??[]).map(n=>({id:n.id,name:n.graph_topic||n.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:c.map(n=>{const b=s===n;return e.jsx("button",{type:"button",onClick:()=>a(n),className:`px-3 py-1.5 text-2xs font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Le[n]},n)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(n=>e.jsx("option",{value:n,children:n},n))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:n=>m(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(Me,{serverId:i,toolName:u,onChange:p})]}),s==="mcp_query"&&h&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:l??"",onChange:n=>h(n.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Fe={task:"bg-status-active/10 text-status-active",workflow:"bg-accent/15 text-accent",escalation:"bg-status-warning/10 text-status-warning",activity:"bg-status-active/10 text-status-active",knowledge:"bg-accent/10 text-accent",file:"bg-status-draft/10 text-status-draft",agent:"bg-status-success/10 text-status-success",app:"bg-status-error/10 text-status-error",milestone:"bg-accent/10 text-accent"};function De({form:s,set:a}){const{data:r}=ke({limit:200}),{data:o}=se(),x=(r==null?void 0:r.topics)??[],m=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[i,u]=f.useState(0),p=(t,n,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[n]:b},a("subscriptions",g)},l=()=>{a("subscriptions",[...s.subscriptions,{...Oe}]),u(s.subscriptions.length)},h=t=>{a("subscriptions",s.subscriptions.filter((n,b)=>b!==t)),i>=s.subscriptions.length-1&&u(Math.max(0,s.subscriptions.length-2))},c=s.subscriptions,d=c[i],y=t=>t.topic?t.reaction_type==="durable"?!!t.workflow_type:t.reaction_type==="pipeline"?!!t.pipeline_id:t.reaction_type==="mcp_query"?!!t.mcp_prompt:t.reaction_type==="capability"?!!t.server_id&&!!t.tool_name:!1:!1,v=d?x.find(t=>t.topic===d.topic):void 0;return c.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(U,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-2xs text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:l,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[c.map((t,n)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${i===n?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>u(n),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${y(t)?"bg-status-success":"bg-surface-border"}`}),e.jsx("span",{className:"text-2xs font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-2xs text-text-quaternary ml-3",children:["→ ",t.workflow_type||t.tool_name||t.reaction_type]})]}),e.jsx("button",{onClick:b=>{b.stopPropagation(),confirm(`Remove subscription "${t.topic||"new"}"?
1
+ import{j as e,a as f}from"./vendor-query-DvWWuNIB.js";import{a as ce,d as le,b as oe}from"./agents-DRaaJUue.js";import{E as de,C as xe,u as pe,a as ue,b as me,c as he}from"./CronLabel-C1Bb2wo4.js";import{g as fe,a as ve,c as be,y as ye}from"./index-pzbGpihI.js";import{P as ge}from"./PageHeader-Hx8APPwE.js";import{z as E,q as B,Q as je,R as U,h as M,H as Z,az as G,g as V,bY as ee,ad as we}from"./vendor-icons-fxBvvHBi.js";import{g as Ne}from"./knowledge-BWo3OCJc.js";import{R as te}from"./RunAsSelector-M2h9U6PP.js";import{u as _e}from"./yaml-workflows-64vfmKJx.js";import{u as se}from"./capabilities-BoRWifSC.js";import{u as ke}from"./topics-oHX4vbqe.js";import{W as Q}from"./WorkflowPill-D7244fKp.js";import{e as Ce,u as Se,f as qe}from"./vendor-react-_9U4mKFr.js";import"./BotPicker-B7V77PnY.js";import"./bots-C4N90NCj.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Oe={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},Ae={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var o,x,m;const r=(x=(o=s.behaviors)==null?void 0:o.schedules)!=null&&x.length?s.behaviors.schedules.map(i=>({cron:i.cron||"",reaction_type:i.reaction_type||"durable",workflow_type:i.workflow_type||"",pipeline_id:i.pipeline_id||"",server_id:i.server_id||"",tool_name:i.tool_name||"",envelope:i.envelope?JSON.stringify(i.envelope,null,2):"{}",execute_as:i.execute_as||""})):(m=s.behaviors)!=null&&m.cron?[{cron:s.behaviors.cron,reaction_type:"durable",workflow_type:s.workflow_type??"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""}]:[];return{name:s.id,description:s.description??"",goals:s.goals??"",rules:s.rules??"",user_id:s.user_id??"",knowledge_domain:s.knowledge_domain??"",subscriptions:a.map(i=>({id:i.id,topic:i.topic,filter:i.filter?JSON.stringify(i.filter,null,2):"",reaction_type:i.reaction_type,workflow_type:i.workflow_type??"",pipeline_id:i.pipeline_id??"",mcp_prompt:i.mcp_prompt??"",server_id:i.server_id??"",tool_name:i.tool_name??"",input_mapping:JSON.stringify(i.input_mapping??{},null,2),execute_as:i.execute_as??"",enabled:i.enabled})),schedules:r}}function Ee(s){var r;const a={};return s.schedules.length>0&&(a.schedules=s.schedules.map(o=>({cron:o.cron,reaction_type:o.reaction_type||"durable",workflow_type:o.reaction_type==="pipeline"?void 0:o.workflow_type,pipeline_id:o.reaction_type==="pipeline"?o.pipeline_id:void 0,envelope:Y(o.envelope)??{},execute_as:o.execute_as||void 0})),a.cron=s.schedules[0].cron),{id:s.name,description:s.description||void 0,goals:s.goals||void 0,rules:s.rules||void 0,user_id:s.user_id||void 0,knowledge_domain:s.knowledge_domain||void 0,behaviors:a,workflow_type:((r=s.schedules[0])==null?void 0:r.workflow_type)||void 0,pipeline_id:void 0}}function $e(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?Y(a.filter):void 0,reaction_type:a.reaction_type,workflow_type:a.workflow_type||void 0,pipeline_id:a.pipeline_id||void 0,mcp_prompt:a.mcp_prompt||void 0,server_id:a.server_id||void 0,tool_name:a.tool_name||void 0,input_mapping:Y(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function Y(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function Pe(s,a,r,o){let x;try{x=JSON.parse(s)}catch{x={}}const m=o.includes(a),i=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!m&&i){const{[a]:p,...l}=x;return JSON.stringify(l,null,2)}let u=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(u=p)}catch{}return JSON.stringify({...x,[a]:u},null,2)}const S="section-header mt-[3em] first:mt-0",P="label",_="hint",A="input",L="input-json w-full";function Ie({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Give your automation a name and describe what it does. The name appears everywhere — in events, logs, and the dashboard."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:identity"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Identity",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:A}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Description"}),e.jsx("input",{type:"text",value:s.description,onChange:r=>a("description",r.target.value),placeholder:"Watches for workflow failures and captures diagnostics",className:A}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function We({form:s,set:a}){return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Goals define what drives the automation. Rules define what constrains it."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:motivation"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Motivation",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-8",children:[e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Goals"}),e.jsx("textarea",{value:s.goals,onChange:r=>a("goals",r.target.value),placeholder:"Detect failures early, capture diagnostics, alert before cascading",rows:4,className:`${A} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Rules"}),e.jsx("textarea",{value:s.rules,onChange:r=>a("rules",r.target.value),placeholder:"Never auto-restart failed workflows. Always escalate to humans.",rows:4,className:`${A} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Te({form:s,set:a}){const{data:r}=Ne(),o=(r==null?void 0:r.domains)??[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Assign a knowledge domain — the automation's memory. It stores context here over time."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:knowledge"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Knowledge",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Knowledge Domain"}),e.jsx("input",{type:"text",value:s.knowledge_domain,onChange:x=>a("knowledge_domain",x.target.value),placeholder:"e.g., system-health, content-review, vendor-data",className:A,list:"domain-suggestions"}),e.jsx("datalist",{id:"domain-suggestions",children:o.map(x=>e.jsx("option",{value:x.domain},x.domain))}),e.jsx("p",{className:_,children:"Choose an existing domain to share memory, or type a new name to create one."})]}),o.length>0&&e.jsxs("div",{children:[e.jsx("label",{className:P,children:"Existing Domains"}),e.jsx("div",{className:"space-y-0.5 mt-2",children:o.map(x=>e.jsxs("button",{type:"button",onClick:()=>a("knowledge_domain",x.domain),className:`w-full flex items-center gap-3 px-3 py-2 rounded-md text-left transition-colors ${s.knowledge_domain===x.domain?"border-l-2 border-l-accent bg-accent/5":"hover:bg-surface-hover border-l-2 border-l-transparent"}`,children:[e.jsx(B,{className:"w-3.5 h-3.5 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary flex-1",children:x.domain}),e.jsxs("span",{className:"text-2xs text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-2xs text-text-quaternary",children:e.jsx(fe,{date:x.latest})})]},x.domain))})]})]})}function Me({serverId:s,toolName:a,onChange:r}){const{data:o}=se(),x=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[m,i]=f.useState(!1),[u,p]=f.useState(""),l=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{if(!m)return;function t(n){h.current&&!h.current.contains(n.target)&&i(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[m]);const c=a?`${a}`:"",d=m?u:c,y=f.useMemo(()=>{const t=(m?u:"").toLowerCase();return t?x.filter(n=>n.name.toLowerCase().includes(t)||n.serverName.toLowerCase().includes(t)||(n.description??"").toLowerCase().includes(t)):x},[x,u,m]),v=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:h,className:"relative",children:[e.jsx("input",{ref:l,type:"text",value:d,onFocus:()=>{i(!0),p(c)},onChange:t=>{const n=t.target.value;p(n),n||r("",""),m||i(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!m&&(v==null?void 0:v.description)&&e.jsx("p",{className:"text-2xs text-text-tertiary mt-1 italic",children:v.description}),m&&y.length>0&&e.jsx("div",{className:"absolute z-[100] left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:y.map(t=>e.jsxs("button",{type:"button",onClick:()=>{r(t.serverId,t.name),p(t.name),i(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 ${s===t.serverId&&a===t.name?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-2xs font-mono text-text-primary shrink-0",children:t.name}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-2xs font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(je,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-2xs text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),m&&y.length===0&&u&&e.jsx("div",{className:"absolute z-[100] left-0 right-0 mt-1 rounded-md border border-surface-border bg-surface shadow-lg px-3 py-4 text-center",children:e.jsxs("p",{className:"text-2xs text-text-quaternary",children:['No capabilities match "',u,'"']})})]})}const Le={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Je=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:o,pipelineId:x,onPipelineIdChange:m,serverId:i,toolName:u,onCapabilityChange:p,mcpPrompt:l,onMcpPromptChange:h,availableTypes:c=[...Je]}){const{data:d}=ve(),y=(d??[]).filter(n=>n.invocable).map(n=>n.workflow_type),{data:v}=_e({status:"active"}),t=((v==null?void 0:v.workflows)??[]).map(n=>({id:n.id,name:n.graph_topic||n.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:c.map(n=>{const b=s===n;return e.jsx("button",{type:"button",onClick:()=>a(n),className:`px-3 py-1.5 text-2xs font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Le[n]},n)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:n=>o(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(n=>e.jsx("option",{value:n,children:n},n))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:n=>m(n.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(n=>e.jsx("option",{value:n.id,children:n.name},n.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(Me,{serverId:i,toolName:u,onChange:p})]}),s==="mcp_query"&&h&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:l??"",onChange:n=>h(n.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Fe={task:"bg-status-active/10 text-status-active",workflow:"bg-accent/15 text-accent",escalation:"bg-status-warning/10 text-status-warning",activity:"bg-status-active/10 text-status-active",knowledge:"bg-accent/10 text-accent",file:"bg-status-draft/10 text-status-draft",agent:"bg-status-success/10 text-status-success",app:"bg-status-error/10 text-status-error",milestone:"bg-accent/10 text-accent"};function De({form:s,set:a}){const{data:r}=ke({limit:200}),{data:o}=se(),x=(r==null?void 0:r.topics)??[],m=f.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(n=>n.tools))??[]},[o]),[i,u]=f.useState(0),p=(t,n,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[n]:b},a("subscriptions",g)},l=()=>{a("subscriptions",[...s.subscriptions,{...Oe}]),u(s.subscriptions.length)},h=t=>{a("subscriptions",s.subscriptions.filter((n,b)=>b!==t)),i>=s.subscriptions.length-1&&u(Math.max(0,s.subscriptions.length-2))},c=s.subscriptions,d=c[i],y=t=>t.topic?t.reaction_type==="durable"?!!t.workflow_type:t.reaction_type==="pipeline"?!!t.pipeline_id:t.reaction_type==="mcp_query"?!!t.mcp_prompt:t.reaction_type==="capability"?!!t.server_id&&!!t.tool_name:!1:!1,v=d?x.find(t=>t.topic===d.topic):void 0;return c.length===0?e.jsxs("div",{className:"max-w-xl",children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-8",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(U,{className:"w-8 h-8 text-text-quaternary/40 mb-3",strokeWidth:1}),e.jsx("p",{className:"text-sm text-text-tertiary mb-2",children:"No event subscriptions yet"}),e.jsx("p",{className:"text-2xs text-text-quaternary max-w-sm mb-6",children:"Each subscription listens for a topic pattern and runs a workflow when it matches."}),e.jsxs("button",{onClick:l,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3.5 h-3.5"})," Add first subscription"]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"border-l-2 border-accent/30 pl-3 py-1 flex items-start justify-between mb-6",children:[e.jsx("p",{className:"text-xs text-text-secondary italic leading-relaxed",children:"Optional. When a matching event is published, the automation runs the configured workflow with the event payload."}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:agents.md:subscriptions"},className:"text-text-quaternary hover:text-accent transition-colors shrink-0 ml-3",title:"Docs: Subscriptions",children:e.jsx(E,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{className:"flex gap-8",children:[e.jsxs("div",{className:"w-52 shrink-0 space-y-0.5",children:[c.map((t,n)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${i===n?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>u(n),className:"flex-1 text-left px-3 py-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${y(t)?"bg-status-success":"bg-surface-border"}`}),e.jsx("span",{className:"text-2xs font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-2xs text-text-quaternary ml-3",children:["→ ",t.workflow_type||t.tool_name||t.reaction_type]})]}),e.jsx("button",{onClick:b=>{b.stopPropagation(),confirm(`Remove subscription "${t.topic||"new"}"?
2
2
 
3
3
  This takes effect when you save.`)&&h(n)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},n)),e.jsxs("button",{onClick:l,className:"w-full flex items-center gap-1.5 px-3 py-2 text-2xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3 h-3"})," Add"]})]}),d&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"When this event fires"}),e.jsx(Be,{value:d.topic,onChange:t=>p(i,"topic",t),topics:x}),(v==null?void 0:v.payload_schema)&&e.jsxs("div",{className:"mt-3 p-3 rounded-md bg-surface-sunken border border-surface-border",children:[e.jsx("p",{className:"text-2xs text-text-quaternary mb-1 uppercase tracking-wider font-medium",children:"Payload Schema"}),e.jsx("pre",{className:"text-2xs font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40",children:JSON.stringify(v.payload_schema.properties??v.payload_schema,null,2)}),v.description&&e.jsx("p",{className:"text-2xs text-text-tertiary mt-2 italic",children:v.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:d.reaction_type,onReactionTypeChange:t=>p(i,"reaction_type",t),workflowType:d.workflow_type,onWorkflowTypeChange:t=>p(i,"workflow_type",t),pipelineId:d.pipeline_id,onPipelineIdChange:t=>p(i,"pipeline_id",t),serverId:d.server_id,toolName:d.tool_name,onCapabilityChange:(t,n)=>{var $;const b=[...s.subscriptions],g={...b[i],server_id:t,tool_name:n},k=m.find(q=>q.serverId===t&&q.name===n),R=($=k==null?void 0:k.inputSchema)==null?void 0:$.properties;if(R&&n){const q={};for(const w of Object.keys(R))w.startsWith("_")||(q[w]=`{event.data.${w}}`);g.input_mapping=JSON.stringify(q,null,2)}b[i]=g,a("subscriptions",b)},mcpPrompt:d.mcp_prompt,onMcpPromptChange:t=>p(i,"mcp_prompt",t)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:d.execute_as,onChange:t=>p(i,"execute_as",t)}),e.jsx("p",{className:_,children:"Identity used when invoking the workflow."})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"But only if"}),e.jsx("input",{type:"text",value:d.filter,onChange:t=>p(i,"filter",t.target.value),placeholder:'{"extension": "png"}',className:`${A} font-mono text-xs`}),e.jsx("p",{className:_,children:"JSON filter against event.data. Click an operator to insert:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:[{label:"equals",value:'{"key": "val"}'},{label:"not equal",value:'{"key": {"$ne": "val"}}'},{label:"in list",value:'{"key": {"$in": ["a", "b"]}}'},{label:"exists",value:'{"key": {"$exists": true}}'}].map(t=>e.jsx("button",{type:"button",onClick:()=>p(i,"filter",t.value),className:"px-2 py-0.5 text-2xs font-mono rounded bg-accent/8 text-accent hover:bg-accent/15 transition-colors",children:t.label},t.label))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),d.reaction_type==="capability"&&d.tool_name?e.jsx(ze,{tool:m.find(t=>t.serverId===d.server_id&&t.name===d.tool_name),value:d.input_mapping,onChange:t=>p(i,"input_mapping",t),eventSchema:v==null?void 0:v.payload_schema}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:d.input_mapping,onChange:t=>p(i,"input_mapping",t.target.value),rows:10,className:L,placeholder:`{
4
4
  "data": {
@@ -13,4 +13,4 @@ This takes effect when you save.`)&&h(n)},className:"opacity-0 group-hover/sub:o
13
13
  This takes effect when you save.`)&&i(h)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-status-error transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},h)),e.jsxs("button",{onClick:m,className:"w-full flex items-center gap-1.5 px-3 py-2 text-2xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(M,{className:"w-3 h-3"})," Add"]})]}),p&&e.jsxs("div",{className:"flex-1 min-w-0 space-y-12",children:[e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run every"}),e.jsx("input",{type:"text",value:p.cron,onChange:l=>x(r,"cron",l.target.value),placeholder:"0 * * * *",className:`${A} font-mono`}),p.cron&&e.jsx("p",{className:"text-2xs text-accent/80 mt-1",children:z(p.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:Ue.map(l=>e.jsx("button",{type:"button",onClick:()=>x(r,"cron",l),className:`text-2xs font-mono whitespace-nowrap transition-colors ${p.cron===l?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:z(l)},l))})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:p.reaction_type,onReactionTypeChange:l=>x(r,"reaction_type",l),workflowType:p.workflow_type,onWorkflowTypeChange:l=>x(r,"workflow_type",l),pipelineId:p.pipeline_id,onPipelineIdChange:l=>x(r,"pipeline_id",l),serverId:p.server_id,toolName:p.tool_name,onCapabilityChange:(l,h)=>{x(r,"server_id",l),x(r,"tool_name",h)},availableTypes:["durable","pipeline","capability"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:p.execute_as,onChange:l=>x(r,"execute_as",l)}),e.jsx("p",{className:_,children:"Identity used when invoking."})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"With this data"}),e.jsx("textarea",{value:p.envelope,onChange:l=>x(r,"envelope",l.target.value),rows:10,className:L,placeholder:`{
14
14
  "data": { "source": "cron" }
15
15
  }`}),e.jsx("p",{className:_,children:"Static payload passed to the workflow on each invocation."})]})]})]})]})}function W({icon:s,color:a,title:r,children:o}){return e.jsxs("div",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 pb-1.5 border-b border-surface-border/40",children:[e.jsx(s,{className:`w-3.5 h-3.5 ${a}`,strokeWidth:1.5}),e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-widest text-accent/80",children:r})]}),e.jsx("div",{className:"pl-5.5",children:o})]})}function T({label:s,children:a}){return e.jsxs("div",{className:"flex gap-3 py-0.5",children:[e.jsx("span",{className:"text-2xs text-text-quaternary w-20 shrink-0",children:s}),e.jsx("span",{className:"text-xs text-text-primary",children:a})]})}function Ke({form:s}){return e.jsxs("div",{children:[e.jsxs(W,{icon:V,color:"text-accent",title:"Identity",children:[e.jsx(T,{label:"Name",children:s.name||"—"}),s.description&&e.jsx(T,{label:"Description",children:s.description})]}),(s.goals||s.rules)&&e.jsxs(W,{icon:ee,color:"text-accent",title:"Motivation",children:[s.goals&&e.jsx(T,{label:"Goals",children:s.goals}),s.rules&&e.jsx(T,{label:"Rules",children:s.rules})]}),e.jsx(W,{icon:B,color:"text-accent",title:"Knowledge",children:e.jsx(T,{label:"Domain",children:s.knowledge_domain||"None"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-10",children:[e.jsx(W,{icon:U,color:"text-accent",title:`Subscriptions (${s.subscriptions.length})`,children:s.subscriptions.length===0?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:s.subscriptions.map((a,r)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(de,{topic:a.topic||"unset"})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-2xs",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-2xs text-text-quaternary",children:a.reaction_type})]})]},r))})}),e.jsx(W,{icon:G,color:"text-accent",title:`Schedules (${s.schedules.length})`,children:s.schedules.length===0?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"None configured"}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:s.schedules.map((a,r)=>e.jsxs("div",{className:"flex items-center py-1.5",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(xe,{cron:a.cron})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-2xs",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-2xs text-text-quaternary",children:"no workflow"})]})]},r))})})]}),e.jsx("div",{className:"border-l-2 border-status-success/30 pl-3 py-2 mt-6",children:e.jsx("p",{className:"text-2xs text-text-tertiary leading-relaxed",children:"After saving, subscriptions and schedules activate immediately. You can pause the automation anytime."})})]})}const He=[{id:1,label:"Identity",icon:V},{id:2,label:"Motivation",icon:ee},{id:3,label:"Knowledge",icon:B},{id:4,label:"Subscriptions",icon:U},{id:5,label:"Schedules",icon:G},{id:6,label:"Review",icon:we}];function xt(){var H;const{id:s}=Ce(),a=!s,r=Se(),{data:o}=be(),x=ye(),i=(x!==null?x:!!((H=o==null?void 0:o.ai)!=null&&H.enabled))?"Agent":"Automation",{data:u,isLoading:p}=ce(a?null:s),{data:l}=pe(a?null:s),h=le(),c=oe(),d=ue(),y=me(),v=he(),[t,n]=f.useState(X),[b,g]=f.useState(!1),[k,R]=f.useState(""),[$,q]=qe(),w=parseInt($.get("step")||"1",10),ne=f.useCallback(j=>{q(N=>{const O=new URLSearchParams(N);return O.set("step",String(j)),O},{replace:!0})},[q]);f.useEffect(()=>{if(!b){if(a){n(X),g(!0);return}u&&l&&(n(Re(u,l.subscriptions??[])),g(!0))}},[u,l,a,b]);const I=(j,N)=>n(O=>({...O,[j]:N})),ie=async()=>{R("");try{const j=Ee(t);let N=s;a?N=(await h.mutateAsync(j)).id:await c.mutateAsync({id:s,...j});const O=$e(t),re=(l==null?void 0:l.subscriptions)??[],J=new Set(re.map(C=>C.id));for(const C of O)if(C.id&&J.has(C.id)){const{id:F,...D}=C;await y.mutateAsync({agentId:N,subId:F,...D}),J.delete(F)}else{const{id:F,...D}=C;await d.mutateAsync({agentId:N,...D})}for(const C of J)await v.mutateAsync({agentId:N,subId:C});r(`/agents/${N}`)}catch(j){R(j.message)}};if(!a&&p)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-60 bg-surface-sunken rounded"})]});const K=h.isPending||c.isPending;return e.jsxs("div",{children:[e.jsx(ge,{title:a?`New ${i}`:`${i}: ${(u==null?void 0:u.id)??""}`,docsHash:"#docs:agents.md"}),e.jsxs("div",{className:"flex gap-10",children:[e.jsxs("nav",{className:"w-44 shrink-0 sticky top-0 self-start pt-2",children:[e.jsx("div",{className:"space-y-0.5",children:He.map(j=>{const N=j.icon,O=w===j.id;return e.jsxs("button",{onClick:()=>ne(j.id),className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-md text-left transition-colors ${O?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(N,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-xs font-medium",children:j.label})]},j.id)})}),e.jsxs("div",{className:"mt-8 pt-4 border-t border-surface-border space-y-2",children:[e.jsx("button",{onClick:ie,disabled:!t.name.trim()||K,className:"w-full btn-primary text-xs disabled:opacity-50",children:K?"Saving...":a?`Create ${i}`:"Save"}),e.jsx("button",{onClick:()=>r(a?"/agents":`/agents/${s}`),className:"w-full btn-ghost text-xs",children:"Cancel"})]}),k&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:k})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[w===1&&e.jsx(Ie,{form:t,set:I}),w===2&&e.jsx(We,{form:t,set:I}),w===3&&e.jsx(Te,{form:t,set:I}),w===4&&e.jsx(De,{form:t,set:I}),w===5&&e.jsx(Ge,{form:t,set:I}),w===6&&e.jsx(Ke,{form:t})]})]})]})}export{xt as AgentConfigPage};
16
- //# sourceMappingURL=AgentConfigPage-aJF7Sdbc.js.map
16
+ //# sourceMappingURL=AgentConfigPage-BuflQGgy.js.map