@hotmeshio/long-tail 0.4.22 → 0.4.23

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/api/dba.d.ts +2 -1
  2. package/build/api/dba.js +3 -2
  3. package/build/api/exports.d.ts +1 -0
  4. package/build/api/exports.js +1 -1
  5. package/build/api/maintenance.d.ts +1 -0
  6. package/build/api/maintenance.js +3 -3
  7. package/build/api/workflows/discovery.js +5 -2
  8. package/build/modules/maintenance.js +1 -0
  9. package/build/routes/controlplane.js +40 -29
  10. package/build/routes/dba.js +13 -2
  11. package/build/routes/exports.js +6 -0
  12. package/build/routes/maintenance.js +1 -0
  13. package/build/services/controlplane/index.js +7 -5
  14. package/build/services/dba.d.ts +3 -1
  15. package/build/services/dba.js +5 -4
  16. package/build/services/export/index.d.ts +2 -2
  17. package/build/services/export/index.js +16 -10
  18. package/build/services/maintenance/index.js +7 -4
  19. package/build/services/pipelines/queries.js +5 -2
  20. package/build/services/pipelines/sql.d.ts +0 -1
  21. package/build/services/pipelines/sql.js +1 -3
  22. package/build/system/mcp-servers/admin/controlplane.js +1 -1
  23. package/build/system/mcp-servers/admin/maintenance.js +1 -0
  24. package/build/system/mcp-servers/admin/pipelines.js +4 -4
  25. package/build/system/mcp-servers/admin/schemas.d.ts +31 -25
  26. package/build/system/mcp-servers/admin/schemas.js +9 -7
  27. package/build/types/maintenance.d.ts +2 -0
  28. package/dashboard/dist/assets/{AdminDashboard-BwUGcCxQ.js → AdminDashboard-CgJC8ZZF.js} +2 -2
  29. package/dashboard/dist/assets/{AdminDashboard-BwUGcCxQ.js.map → AdminDashboard-CgJC8ZZF.js.map} +1 -1
  30. package/dashboard/dist/assets/{AgentConfigPage-DgrYzLwq.js → AgentConfigPage-Bjl2Lsvo.js} +2 -2
  31. package/dashboard/dist/assets/{AgentConfigPage-DgrYzLwq.js.map → AgentConfigPage-Bjl2Lsvo.js.map} +1 -1
  32. package/dashboard/dist/assets/{AgentDetailPage-XJpl7wfJ.js → AgentDetailPage-D5dHrfaM.js} +2 -2
  33. package/dashboard/dist/assets/{AgentDetailPage-XJpl7wfJ.js.map → AgentDetailPage-D5dHrfaM.js.map} +1 -1
  34. package/dashboard/dist/assets/{AgentsPage-CGpVG6r8.js → AgentsPage-Mom3N1Av.js} +2 -2
  35. package/dashboard/dist/assets/{AgentsPage-CGpVG6r8.js.map → AgentsPage-Mom3N1Av.js.map} +1 -1
  36. package/dashboard/dist/assets/{AvailableEscalationsPage-DR1e0TQZ.js → AvailableEscalationsPage-B2ZAb41C.js} +2 -2
  37. package/dashboard/dist/assets/{AvailableEscalationsPage-DR1e0TQZ.js.map → AvailableEscalationsPage-B2ZAb41C.js.map} +1 -1
  38. package/dashboard/dist/assets/{BotPicker-BKtjl6IL.js → BotPicker-dCvnjynP.js} +2 -2
  39. package/dashboard/dist/assets/{BotPicker-BKtjl6IL.js.map → BotPicker-dCvnjynP.js.map} +1 -1
  40. package/dashboard/dist/assets/{CapabilitiesPage-kCB8fyOj.js → CapabilitiesPage-CK2fJ9Sy.js} +2 -2
  41. package/dashboard/dist/assets/{CapabilitiesPage-kCB8fyOj.js.map → CapabilitiesPage-CK2fJ9Sy.js.map} +1 -1
  42. package/dashboard/dist/assets/{CollapsibleSection-C3tU61hB.js → CollapsibleSection-bW0UZN9b.js} +2 -2
  43. package/dashboard/dist/assets/{CollapsibleSection-C3tU61hB.js.map → CollapsibleSection-bW0UZN9b.js.map} +1 -1
  44. package/dashboard/dist/assets/{CredentialsPage-Dt4nJs_B.js → CredentialsPage-DVOK3aaR.js} +2 -2
  45. package/dashboard/dist/assets/{CredentialsPage-Dt4nJs_B.js.map → CredentialsPage-DVOK3aaR.js.map} +1 -1
  46. package/dashboard/dist/assets/{CronLabel-BdE6mHyA.js → CronLabel-Cv5em7OP.js} +2 -2
  47. package/dashboard/dist/assets/{CronLabel-BdE6mHyA.js.map → CronLabel-Cv5em7OP.js.map} +1 -1
  48. package/dashboard/dist/assets/{CustomDurationPicker-B_Yxfb-u.js → CustomDurationPicker-Dy4NBqhZ.js} +2 -2
  49. package/dashboard/dist/assets/{CustomDurationPicker-B_Yxfb-u.js.map → CustomDurationPicker-Dy4NBqhZ.js.map} +1 -1
  50. package/dashboard/dist/assets/{ElapsedCell-tcGx5PFI.js → ElapsedCell-TQqWaVRq.js} +2 -2
  51. package/dashboard/dist/assets/{ElapsedCell-tcGx5PFI.js.map → ElapsedCell-TQqWaVRq.js.map} +1 -1
  52. package/dashboard/dist/assets/{EscalationsOverview-1KO5dXzk.js → EscalationsOverview-Cv5UvuHI.js} +2 -2
  53. package/dashboard/dist/assets/{EscalationsOverview-1KO5dXzk.js.map → EscalationsOverview-Cv5UvuHI.js.map} +1 -1
  54. package/dashboard/dist/assets/{EventTable-DnpsQ6Ew.js → EventTable-Doky6fCO.js} +2 -2
  55. package/dashboard/dist/assets/{EventTable-DnpsQ6Ew.js.map → EventTable-Doky6fCO.js.map} +1 -1
  56. package/dashboard/dist/assets/HomePage-CzvVyTq4.js +2 -0
  57. package/dashboard/dist/assets/HomePage-CzvVyTq4.js.map +1 -0
  58. package/dashboard/dist/assets/{ListToolbar-jrVba7QN.js → ListToolbar-Cfec9gz_.js} +2 -2
  59. package/dashboard/dist/assets/{ListToolbar-jrVba7QN.js.map → ListToolbar-Cfec9gz_.js.map} +1 -1
  60. package/dashboard/dist/assets/McpOverview-BN4GsBGI.js +2 -0
  61. package/dashboard/dist/assets/McpOverview-BN4GsBGI.js.map +1 -0
  62. package/dashboard/dist/assets/McpQueryDetailPage-lCW668WQ.js +5 -0
  63. package/dashboard/dist/assets/McpQueryDetailPage-lCW668WQ.js.map +1 -0
  64. package/dashboard/dist/assets/{McpQueryPage-WZfTY43_.js → McpQueryPage-BK5L2PqJ.js} +2 -2
  65. package/dashboard/dist/assets/{McpQueryPage-WZfTY43_.js.map → McpQueryPage-BK5L2PqJ.js.map} +1 -1
  66. package/dashboard/dist/assets/McpRunDetailPage-CQOeYqxa.js +2 -0
  67. package/dashboard/dist/assets/McpRunDetailPage-CQOeYqxa.js.map +1 -0
  68. package/dashboard/dist/assets/McpRunsPage-QsXid9Xe.js +2 -0
  69. package/dashboard/dist/assets/McpRunsPage-QsXid9Xe.js.map +1 -0
  70. package/dashboard/dist/assets/{OperatorDashboard-Cy7ySMXj.js → OperatorDashboard-CZQSINho.js} +2 -2
  71. package/dashboard/dist/assets/{OperatorDashboard-Cy7ySMXj.js.map → OperatorDashboard-CZQSINho.js.map} +1 -1
  72. package/dashboard/dist/assets/{ProcessDetailPage-DYIfvWyc.js → ProcessDetailPage-DUCOOvOK.js} +2 -2
  73. package/dashboard/dist/assets/{ProcessDetailPage-DYIfvWyc.js.map → ProcessDetailPage-DUCOOvOK.js.map} +1 -1
  74. package/dashboard/dist/assets/{ProcessesListPage-DR1RGaMl.js → ProcessesListPage-CXvSLTIM.js} +2 -2
  75. package/dashboard/dist/assets/{ProcessesListPage-DR1RGaMl.js.map → ProcessesListPage-CXvSLTIM.js.map} +1 -1
  76. package/dashboard/dist/assets/RolesPage-DlQR0Iz_.js +2 -0
  77. package/dashboard/dist/assets/RolesPage-DlQR0Iz_.js.map +1 -0
  78. package/dashboard/dist/assets/{RunAsSelector-B-ksMoEj.js → RunAsSelector-DP-jxsv6.js} +2 -2
  79. package/dashboard/dist/assets/{RunAsSelector-B-ksMoEj.js.map → RunAsSelector-DP-jxsv6.js.map} +1 -1
  80. package/dashboard/dist/assets/{SwimlaneTimeline-Cr_K5qpu.js → SwimlaneTimeline-BmASA0nN.js} +2 -2
  81. package/dashboard/dist/assets/{SwimlaneTimeline-Cr_K5qpu.js.map → SwimlaneTimeline-BmASA0nN.js.map} +1 -1
  82. package/dashboard/dist/assets/{TaskDetailPage-BO5p7AEe.js → TaskDetailPage-CRowpkeZ.js} +2 -2
  83. package/dashboard/dist/assets/{TaskDetailPage-BO5p7AEe.js.map → TaskDetailPage-CRowpkeZ.js.map} +1 -1
  84. package/dashboard/dist/assets/{TasksListPage-BRg-uFtF.js → TasksListPage-uJ6z37J-.js} +2 -2
  85. package/dashboard/dist/assets/{TasksListPage-BRg-uFtF.js.map → TasksListPage-uJ6z37J-.js.map} +1 -1
  86. package/dashboard/dist/assets/TimeAgo-BxwngK1D.js +2 -0
  87. package/dashboard/dist/assets/{TimeAgo-BSzN6rAH.js.map → TimeAgo-BxwngK1D.js.map} +1 -1
  88. package/dashboard/dist/assets/{TimestampCell-DL6zMNEQ.js → TimestampCell-CDmichOM.js} +2 -2
  89. package/dashboard/dist/assets/{TimestampCell-DL6zMNEQ.js.map → TimestampCell-CDmichOM.js.map} +1 -1
  90. package/dashboard/dist/assets/ToolTestPanel-xjTn8sU8.js +2 -0
  91. package/dashboard/dist/assets/ToolTestPanel-xjTn8sU8.js.map +1 -0
  92. package/dashboard/dist/assets/{TopicDetailPage-D7gCsPKB.js → TopicDetailPage-Dm0hDlS8.js} +2 -2
  93. package/dashboard/dist/assets/{TopicDetailPage-D7gCsPKB.js.map → TopicDetailPage-Dm0hDlS8.js.map} +1 -1
  94. package/dashboard/dist/assets/{TopicsPage-B3Aa8Haz.js → TopicsPage-letISGGD.js} +2 -2
  95. package/dashboard/dist/assets/{TopicsPage-B3Aa8Haz.js.map → TopicsPage-letISGGD.js.map} +1 -1
  96. package/dashboard/dist/assets/{UserName-BjHIJWgh.js → UserName-W6_Iz2Qb.js} +2 -2
  97. package/dashboard/dist/assets/{UserName-BjHIJWgh.js.map → UserName-W6_Iz2Qb.js.map} +1 -1
  98. package/dashboard/dist/assets/{WorkflowExecutionPage-BQ7AYlQA.js → WorkflowExecutionPage-Cfx-xlRT.js} +2 -2
  99. package/dashboard/dist/assets/{WorkflowExecutionPage-BQ7AYlQA.js.map → WorkflowExecutionPage-Cfx-xlRT.js.map} +1 -1
  100. package/dashboard/dist/assets/WorkflowsDashboard-DC4XHMWt.js +2 -0
  101. package/dashboard/dist/assets/WorkflowsDashboard-DC4XHMWt.js.map +1 -0
  102. package/dashboard/dist/assets/{WorkflowsOverview-B4DUcVxs.js → WorkflowsOverview-GefO_yn0.js} +2 -2
  103. package/dashboard/dist/assets/{WorkflowsOverview-B4DUcVxs.js.map → WorkflowsOverview-GefO_yn0.js.map} +1 -1
  104. package/dashboard/dist/assets/YamlWorkflowsPage-CMsrFooO.js +2 -0
  105. package/dashboard/dist/assets/YamlWorkflowsPage-CMsrFooO.js.map +1 -0
  106. package/dashboard/dist/assets/{agents-CkvQDr9b.js → agents-BI5OeN84.js} +2 -2
  107. package/dashboard/dist/assets/{agents-CkvQDr9b.js.map → agents-BI5OeN84.js.map} +1 -1
  108. package/dashboard/dist/assets/{bots-CzuMCVgU.js → bots-1UzUCsrR.js} +2 -2
  109. package/dashboard/dist/assets/{bots-CzuMCVgU.js.map → bots-1UzUCsrR.js.map} +1 -1
  110. package/dashboard/dist/assets/capabilities-BUbl-ojp.js +2 -0
  111. package/dashboard/dist/assets/{capabilities-CbGmS0ty.js.map → capabilities-BUbl-ojp.js.map} +1 -1
  112. package/dashboard/dist/assets/{controlplane-DGvwkuYx.js → controlplane-DTFrH_vN.js} +2 -2
  113. package/dashboard/dist/assets/{controlplane-DGvwkuYx.js.map → controlplane-DTFrH_vN.js.map} +1 -1
  114. package/dashboard/dist/assets/{escalation-B7ysVToF.js → escalation-BQhCt4W0.js} +2 -2
  115. package/dashboard/dist/assets/{escalation-B7ysVToF.js.map → escalation-BQhCt4W0.js.map} +1 -1
  116. package/dashboard/dist/assets/{escalation-columns-CHQEJU1j.js → escalation-columns-J20k5CcY.js} +2 -2
  117. package/dashboard/dist/assets/{escalation-columns-CHQEJU1j.js.map → escalation-columns-J20k5CcY.js.map} +1 -1
  118. package/dashboard/dist/assets/{helpers-BFOjXa4r.js → helpers-ge6Eu90Y.js} +2 -2
  119. package/dashboard/dist/assets/{helpers-BFOjXa4r.js.map → helpers-ge6Eu90Y.js.map} +1 -1
  120. package/dashboard/dist/assets/index-C-mbURj-.js +2 -0
  121. package/dashboard/dist/assets/index-C-mbURj-.js.map +1 -0
  122. package/dashboard/dist/assets/{index-BduDiGcw.js → index-C45DvtAZ.js} +2 -2
  123. package/dashboard/dist/assets/{index-BduDiGcw.js.map → index-C45DvtAZ.js.map} +1 -1
  124. package/dashboard/dist/assets/{index-B9_1AZaG.js → index-C9ClHiiW.js} +2 -2
  125. package/dashboard/dist/assets/{index-B9_1AZaG.js.map → index-C9ClHiiW.js.map} +1 -1
  126. package/dashboard/dist/assets/index-CLUYzdwz.js +2 -0
  127. package/dashboard/dist/assets/{index-DQHmfTPo.js.map → index-CLUYzdwz.js.map} +1 -1
  128. package/dashboard/dist/assets/{index-l_8R6U4r.js → index-CVGgSoda.js} +2 -2
  129. package/dashboard/dist/assets/{index-l_8R6U4r.js.map → index-CVGgSoda.js.map} +1 -1
  130. package/dashboard/dist/assets/{index-_BRA9uFL.js → index-CWEOhAiK.js} +3 -3
  131. package/dashboard/dist/assets/{index-_BRA9uFL.js.map → index-CWEOhAiK.js.map} +1 -1
  132. package/dashboard/dist/assets/{index-BFaDxPxA.js → index-CWlP6vHG.js} +2 -2
  133. package/dashboard/dist/assets/{index-BFaDxPxA.js.map → index-CWlP6vHG.js.map} +1 -1
  134. package/dashboard/dist/assets/index-DasoTRjT.js +2 -0
  135. package/dashboard/dist/assets/{index-BeLphL59.js.map → index-DasoTRjT.js.map} +1 -1
  136. package/dashboard/dist/assets/{index-CvOGgvzP.js → index-FhasoOjO.js} +2 -2
  137. package/dashboard/dist/assets/{index-CvOGgvzP.js.map → index-FhasoOjO.js.map} +1 -1
  138. package/dashboard/dist/assets/{index-a98qWLB-.js → index-WQQJ_cp7.js} +2 -2
  139. package/dashboard/dist/assets/{index-a98qWLB-.js.map → index-WQQJ_cp7.js.map} +1 -1
  140. package/dashboard/dist/assets/{index-CbrMW-gM.js → index-hAZiac0C.js} +2 -2
  141. package/dashboard/dist/assets/{index-CbrMW-gM.js.map → index-hAZiac0C.js.map} +1 -1
  142. package/dashboard/dist/assets/{index-v0OQpgXS.js → index-si70YcIP.js} +2 -2
  143. package/dashboard/dist/assets/{index-v0OQpgXS.js.map → index-si70YcIP.js.map} +1 -1
  144. package/dashboard/dist/assets/{index-CRiBkHPb.js → index-vgxjge70.js} +2 -2
  145. package/dashboard/dist/assets/{index-CRiBkHPb.js.map → index-vgxjge70.js.map} +1 -1
  146. package/dashboard/dist/assets/{knowledge-BlF8UMrk.js → knowledge-D9Tuh-o-.js} +2 -2
  147. package/dashboard/dist/assets/{knowledge-BlF8UMrk.js.map → knowledge-D9Tuh-o-.js.map} +1 -1
  148. package/dashboard/dist/assets/{mcp-MtXuky8q.js → mcp-BO8QnWyk.js} +2 -2
  149. package/dashboard/dist/assets/{mcp-MtXuky8q.js.map → mcp-BO8QnWyk.js.map} +1 -1
  150. package/dashboard/dist/assets/{mcp-query-DQ-J1Q0K.js → mcp-query-WLtQtr51.js} +2 -2
  151. package/dashboard/dist/assets/{mcp-query-DQ-J1Q0K.js.map → mcp-query-WLtQtr51.js.map} +1 -1
  152. package/dashboard/dist/assets/pipelines-BAVf9xud.js +2 -0
  153. package/dashboard/dist/assets/pipelines-BAVf9xud.js.map +1 -0
  154. package/dashboard/dist/assets/{roles-D-LhJ82d.js → roles-mGO2-2hA.js} +2 -2
  155. package/dashboard/dist/assets/{roles-D-LhJ82d.js.map → roles-mGO2-2hA.js.map} +1 -1
  156. package/dashboard/dist/assets/{tasks-BrP_8uEN.js → tasks-JVRVCx0f.js} +2 -2
  157. package/dashboard/dist/assets/{tasks-BrP_8uEN.js.map → tasks-JVRVCx0f.js.map} +1 -1
  158. package/dashboard/dist/assets/{topics-DUk-zX5D.js → topics-BLVnahd7.js} +2 -2
  159. package/dashboard/dist/assets/{topics-DUk-zX5D.js.map → topics-BLVnahd7.js.map} +1 -1
  160. package/dashboard/dist/assets/{useEventHooks-XNNzwADV.js → useEventHooks-BwjAi0Qq.js} +2 -2
  161. package/dashboard/dist/assets/{useEventHooks-XNNzwADV.js.map → useEventHooks-BwjAi0Qq.js.map} +1 -1
  162. package/dashboard/dist/assets/useNamespace-DkHmXddZ.js +2 -0
  163. package/dashboard/dist/assets/useNamespace-DkHmXddZ.js.map +1 -0
  164. package/dashboard/dist/assets/{useYamlActivityEvents-DANQ5jIY.js → useYamlActivityEvents-CsaR5dWj.js} +2 -2
  165. package/dashboard/dist/assets/{useYamlActivityEvents-DANQ5jIY.js.map → useYamlActivityEvents-CsaR5dWj.js.map} +1 -1
  166. package/dashboard/dist/assets/{users-vj0JgOkA.js → users-BvizpAkV.js} +2 -2
  167. package/dashboard/dist/assets/{users-vj0JgOkA.js.map → users-BvizpAkV.js.map} +1 -1
  168. package/dashboard/dist/assets/{workflows-CmqgGPzI.js → workflows-CyEYa01a.js} +2 -2
  169. package/dashboard/dist/assets/{workflows-CmqgGPzI.js.map → workflows-CyEYa01a.js.map} +1 -1
  170. package/dashboard/dist/assets/{yaml-workflows-DNFyjBXH.js → yaml-workflows-i3GzrEme.js} +2 -2
  171. package/dashboard/dist/assets/{yaml-workflows-DNFyjBXH.js.map → yaml-workflows-i3GzrEme.js.map} +1 -1
  172. package/dashboard/dist/index.html +1 -1
  173. package/docs/api/http/controlplane.md +6 -4
  174. package/docs/api/http/dba.md +1 -0
  175. package/docs/api/http/exports.md +26 -0
  176. package/docs/api/http/maintenance.md +1 -0
  177. package/docs/api/mcp/admin.md +7 -7
  178. package/docs/api/sdk/controlplane.md +4 -4
  179. package/package.json +1 -1
  180. package/dashboard/dist/assets/HomePage-B2Jgo1J1.js +0 -2
  181. package/dashboard/dist/assets/HomePage-B2Jgo1J1.js.map +0 -1
  182. package/dashboard/dist/assets/McpOverview-BzyxJyc9.js +0 -2
  183. package/dashboard/dist/assets/McpOverview-BzyxJyc9.js.map +0 -1
  184. package/dashboard/dist/assets/McpQueryDetailPage-DXNseeKl.js +0 -5
  185. package/dashboard/dist/assets/McpQueryDetailPage-DXNseeKl.js.map +0 -1
  186. package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js +0 -2
  187. package/dashboard/dist/assets/McpRunDetailPage-DKZp-p7S.js.map +0 -1
  188. package/dashboard/dist/assets/McpRunsPage-SXyiwc0d.js +0 -2
  189. package/dashboard/dist/assets/McpRunsPage-SXyiwc0d.js.map +0 -1
  190. package/dashboard/dist/assets/RolesPage-pMERxj15.js +0 -2
  191. package/dashboard/dist/assets/RolesPage-pMERxj15.js.map +0 -1
  192. package/dashboard/dist/assets/TimeAgo-BSzN6rAH.js +0 -2
  193. package/dashboard/dist/assets/ToolTestPanel-fLzNp79U.js +0 -2
  194. package/dashboard/dist/assets/ToolTestPanel-fLzNp79U.js.map +0 -1
  195. package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js +0 -2
  196. package/dashboard/dist/assets/WorkflowsDashboard-D-G8Xudz.js.map +0 -1
  197. package/dashboard/dist/assets/YamlWorkflowsPage-CnTNOku0.js +0 -2
  198. package/dashboard/dist/assets/YamlWorkflowsPage-CnTNOku0.js.map +0 -1
  199. package/dashboard/dist/assets/capabilities-CbGmS0ty.js +0 -2
  200. package/dashboard/dist/assets/index-BeLphL59.js +0 -2
  201. package/dashboard/dist/assets/index-DDlrQeTj.js +0 -2
  202. package/dashboard/dist/assets/index-DDlrQeTj.js.map +0 -1
  203. package/dashboard/dist/assets/index-DQHmfTPo.js +0 -2
  204. package/dashboard/dist/assets/namespaces-DtsT_GoV.js +0 -2
  205. package/dashboard/dist/assets/namespaces-DtsT_GoV.js.map +0 -1
  206. package/dashboard/dist/assets/pipelines-BjlCm9VH.js +0 -2
  207. package/dashboard/dist/assets/pipelines-BjlCm9VH.js.map +0 -1
@@ -391,6 +391,7 @@ export declare const addEscalationChainSchema: z.ZodObject<{
391
391
  target_role: string;
392
392
  }>;
393
393
  export declare const pruneSchema: z.ZodObject<{
394
+ app_id: z.ZodString;
394
395
  expire: z.ZodDefault<z.ZodOptional<z.ZodString>>;
395
396
  jobs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
396
397
  streams: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -400,9 +401,11 @@ export declare const pruneSchema: z.ZodObject<{
400
401
  streams: boolean;
401
402
  jobs: boolean;
402
403
  expire: string;
404
+ app_id: string;
403
405
  prune_transient: boolean;
404
406
  entities?: string[] | undefined;
405
407
  }, {
408
+ app_id: string;
406
409
  streams?: boolean | undefined;
407
410
  jobs?: boolean | undefined;
408
411
  expire?: string | undefined;
@@ -444,19 +447,19 @@ export declare const createAgentSchema: z.ZodObject<{
444
447
  }, "strip", z.ZodTypeAny, {
445
448
  id: string;
446
449
  status?: string | undefined;
450
+ rules?: string[] | undefined;
447
451
  description?: string | undefined;
448
452
  knowledge_domain?: string | undefined;
449
453
  goals?: string[] | undefined;
450
- rules?: string[] | undefined;
451
454
  schedules?: any[] | undefined;
452
455
  subscriptions?: any[] | undefined;
453
456
  }, {
454
457
  id: string;
455
458
  status?: string | undefined;
459
+ rules?: string[] | undefined;
456
460
  description?: string | undefined;
457
461
  knowledge_domain?: string | undefined;
458
462
  goals?: string[] | undefined;
459
- rules?: string[] | undefined;
460
463
  schedules?: any[] | undefined;
461
464
  subscriptions?: any[] | undefined;
462
465
  }>;
@@ -470,17 +473,17 @@ export declare const updateAgentSchema: z.ZodObject<{
470
473
  }, "strip", z.ZodTypeAny, {
471
474
  id: string;
472
475
  status?: string | undefined;
476
+ rules?: string[] | undefined;
473
477
  description?: string | undefined;
474
478
  knowledge_domain?: string | undefined;
475
479
  goals?: string[] | undefined;
476
- rules?: string[] | undefined;
477
480
  }, {
478
481
  id: string;
479
482
  status?: string | undefined;
483
+ rules?: string[] | undefined;
480
484
  description?: string | undefined;
481
485
  knowledge_domain?: string | undefined;
482
486
  goals?: string[] | undefined;
483
- rules?: string[] | undefined;
484
487
  }>;
485
488
  export declare const deleteAgentSchema: z.ZodObject<{
486
489
  id: z.ZodString;
@@ -630,44 +633,44 @@ export declare const revokeBotKeySchema: z.ZodObject<{
630
633
  }>;
631
634
  export declare const listAppsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
632
635
  export declare const rollCallSchema: z.ZodObject<{
633
- app_id: z.ZodOptional<z.ZodString>;
636
+ app_id: z.ZodString;
634
637
  delay: z.ZodOptional<z.ZodNumber>;
635
638
  }, "strip", z.ZodTypeAny, {
636
- app_id?: string | undefined;
639
+ app_id: string;
637
640
  delay?: number | undefined;
638
641
  }, {
639
- app_id?: string | undefined;
642
+ app_id: string;
640
643
  delay?: number | undefined;
641
644
  }>;
642
645
  export declare const applyThrottleSchema: z.ZodObject<{
643
- appId: z.ZodOptional<z.ZodString>;
646
+ appId: z.ZodString;
644
647
  throttle: z.ZodNumber;
645
648
  topic: z.ZodOptional<z.ZodString>;
646
649
  guid: z.ZodOptional<z.ZodString>;
647
650
  scope: z.ZodOptional<z.ZodString>;
648
651
  }, "strip", z.ZodTypeAny, {
652
+ appId: string;
649
653
  throttle: number;
650
- appId?: string | undefined;
651
654
  topic?: string | undefined;
652
655
  guid?: string | undefined;
653
656
  scope?: string | undefined;
654
657
  }, {
658
+ appId: string;
655
659
  throttle: number;
656
- appId?: string | undefined;
657
660
  topic?: string | undefined;
658
661
  guid?: string | undefined;
659
662
  scope?: string | undefined;
660
663
  }>;
661
664
  export declare const getStreamStatsSchema: z.ZodObject<{
662
- app_id: z.ZodOptional<z.ZodString>;
665
+ app_id: z.ZodString;
663
666
  duration: z.ZodOptional<z.ZodString>;
664
667
  stream: z.ZodOptional<z.ZodString>;
665
668
  }, "strip", z.ZodTypeAny, {
666
- app_id?: string | undefined;
669
+ app_id: string;
667
670
  duration?: string | undefined;
668
671
  stream?: string | undefined;
669
672
  }, {
670
- app_id?: string | undefined;
673
+ app_id: string;
671
674
  duration?: string | undefined;
672
675
  stream?: string | undefined;
673
676
  }>;
@@ -715,14 +718,14 @@ export declare const listStreamMessagesSchema: z.ZodObject<{
715
718
  aid?: string | undefined;
716
719
  }>;
717
720
  export declare const listPipelineEntitiesSchema: z.ZodObject<{
718
- app_id: z.ZodOptional<z.ZodString>;
721
+ app_id: z.ZodString;
719
722
  }, "strip", z.ZodTypeAny, {
720
- app_id?: string | undefined;
723
+ app_id: string;
721
724
  }, {
722
- app_id?: string | undefined;
725
+ app_id: string;
723
726
  }>;
724
727
  export declare const listPipelineJobsSchema: z.ZodObject<{
725
- app_id: z.ZodOptional<z.ZodString>;
728
+ app_id: z.ZodString;
726
729
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
727
730
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
728
731
  entity: z.ZodOptional<z.ZodString>;
@@ -731,17 +734,17 @@ export declare const listPipelineJobsSchema: z.ZodObject<{
731
734
  sort_by: z.ZodOptional<z.ZodString>;
732
735
  order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
733
736
  }, "strip", z.ZodTypeAny, {
737
+ app_id: string;
734
738
  limit: number;
735
739
  offset: number;
736
740
  status?: string | undefined;
737
- app_id?: string | undefined;
738
741
  entity?: string | undefined;
739
742
  search?: string | undefined;
740
743
  sort_by?: string | undefined;
741
744
  order?: "asc" | "desc" | undefined;
742
745
  }, {
746
+ app_id: string;
743
747
  status?: string | undefined;
744
- app_id?: string | undefined;
745
748
  entity?: string | undefined;
746
749
  search?: string | undefined;
747
750
  limit?: number | undefined;
@@ -751,26 +754,26 @@ export declare const listPipelineJobsSchema: z.ZodObject<{
751
754
  }>;
752
755
  export declare const getJobExecutionSchema: z.ZodObject<{
753
756
  job_id: z.ZodString;
754
- app_id: z.ZodOptional<z.ZodString>;
757
+ app_id: z.ZodString;
755
758
  }, "strip", z.ZodTypeAny, {
759
+ app_id: string;
756
760
  job_id: string;
757
- app_id?: string | undefined;
758
761
  }, {
762
+ app_id: string;
759
763
  job_id: string;
760
- app_id?: string | undefined;
761
764
  }>;
762
765
  export declare const interruptJobSchema: z.ZodObject<{
763
766
  job_id: z.ZodString;
764
767
  topic: z.ZodString;
765
- app_id: z.ZodOptional<z.ZodString>;
768
+ app_id: z.ZodString;
766
769
  }, "strip", z.ZodTypeAny, {
770
+ app_id: string;
767
771
  job_id: string;
768
772
  topic: string;
769
- app_id?: string | undefined;
770
773
  }, {
774
+ app_id: string;
771
775
  job_id: string;
772
776
  topic: string;
773
- app_id?: string | undefined;
774
777
  }>;
775
778
  export declare const listTopicsSchema: z.ZodObject<{
776
779
  category: z.ZodOptional<z.ZodString>;
@@ -948,6 +951,7 @@ export declare const updatePrioritySchema: z.ZodObject<{
948
951
  }>;
949
952
  export declare const getSettingsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
950
953
  export declare const listExportJobsSchema: z.ZodObject<{
954
+ app_id: z.ZodString;
951
955
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
952
956
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
953
957
  entity: z.ZodOptional<z.ZodString>;
@@ -957,6 +961,7 @@ export declare const listExportJobsSchema: z.ZodObject<{
957
961
  order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
958
962
  registered: z.ZodOptional<z.ZodString>;
959
963
  }, "strip", z.ZodTypeAny, {
964
+ app_id: string;
960
965
  limit: number;
961
966
  offset: number;
962
967
  status?: string | undefined;
@@ -966,6 +971,7 @@ export declare const listExportJobsSchema: z.ZodObject<{
966
971
  sort_by?: string | undefined;
967
972
  order?: "asc" | "desc" | undefined;
968
973
  }, {
974
+ app_id: string;
969
975
  status?: string | undefined;
970
976
  registered?: string | undefined;
971
977
  entity?: string | undefined;
@@ -170,6 +170,7 @@ exports.addEscalationChainSchema = zod_1.z.object({
170
170
  });
171
171
  // ── maintenance (routes/dba.ts) ─────────────────────────────────────────────
172
172
  exports.pruneSchema = zod_1.z.object({
173
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
173
174
  expire: zod_1.z.string().optional().default('7 days').describe('Retention period (PostgreSQL interval)'),
174
175
  jobs: zod_1.z.boolean().optional().default(true).describe('Hard-delete expired jobs'),
175
176
  streams: zod_1.z.boolean().optional().default(true).describe('Hard-delete expired streams'),
@@ -263,18 +264,18 @@ exports.revokeBotKeySchema = zod_1.z.object({
263
264
  // ── control plane (routes/controlplane.ts) ──────────────────────────────────
264
265
  exports.listAppsSchema = zod_1.z.object({});
265
266
  exports.rollCallSchema = zod_1.z.object({
266
- app_id: zod_1.z.string().optional().describe('Namespace to query'),
267
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
267
268
  delay: zod_1.z.number().int().optional().describe('Delay in ms before roll call'),
268
269
  });
269
270
  exports.applyThrottleSchema = zod_1.z.object({
270
- appId: zod_1.z.string().optional().describe('Namespace to throttle'),
271
+ appId: zod_1.z.string().describe('HotMesh application namespace (required)'),
271
272
  throttle: zod_1.z.number().int().describe('Throttle value (messages per second)'),
272
273
  topic: zod_1.z.string().optional().describe('Topic to throttle'),
273
274
  guid: zod_1.z.string().optional().describe('Specific GUID to throttle'),
274
275
  scope: zod_1.z.string().optional().describe('Throttle scope'),
275
276
  });
276
277
  exports.getStreamStatsSchema = zod_1.z.object({
277
- app_id: zod_1.z.string().optional().describe('Namespace to query'),
278
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
278
279
  duration: zod_1.z.string().optional().describe('Stats duration window'),
279
280
  stream: zod_1.z.string().optional().describe('Specific stream name'),
280
281
  });
@@ -295,10 +296,10 @@ exports.listStreamMessagesSchema = zod_1.z.object({
295
296
  });
296
297
  // ── pipelines (routes/pipelines.ts) ─────────────────────────────────────────
297
298
  exports.listPipelineEntitiesSchema = zod_1.z.object({
298
- app_id: zod_1.z.string().optional().describe('Namespace to query'),
299
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
299
300
  });
300
301
  exports.listPipelineJobsSchema = zod_1.z.object({
301
- app_id: zod_1.z.string().optional().describe('Namespace to query'),
302
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
302
303
  limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
303
304
  offset: zod_1.z.number().int().min(0).optional().default(0),
304
305
  entity: zod_1.z.string().optional().describe('Filter by entity type'),
@@ -309,12 +310,12 @@ exports.listPipelineJobsSchema = zod_1.z.object({
309
310
  });
310
311
  exports.getJobExecutionSchema = zod_1.z.object({
311
312
  job_id: zod_1.z.string().describe('Job ID to retrieve'),
312
- app_id: zod_1.z.string().optional().describe('Namespace'),
313
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
313
314
  });
314
315
  exports.interruptJobSchema = zod_1.z.object({
315
316
  job_id: zod_1.z.string().describe('Job ID to interrupt'),
316
317
  topic: zod_1.z.string().describe('Topic of the job'),
317
- app_id: zod_1.z.string().optional().describe('Namespace'),
318
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
318
319
  });
319
320
  // ── topics (routes/topics.ts) ───────────────────────────────────────────────
320
321
  exports.listTopicsSchema = zod_1.z.object({
@@ -388,6 +389,7 @@ exports.updatePrioritySchema = zod_1.z.object({
388
389
  exports.getSettingsSchema = zod_1.z.object({});
389
390
  // ── exports (routes/exports.ts) ─────────────────────────────────────────────
390
391
  exports.listExportJobsSchema = zod_1.z.object({
392
+ app_id: zod_1.z.string().describe('HotMesh application namespace (required)'),
391
393
  limit: zod_1.z.number().int().min(1).max(100).optional().default(25),
392
394
  offset: zod_1.z.number().int().min(0).optional().default(0),
393
395
  entity: zod_1.z.string().optional().describe('Filter by entity type'),
@@ -17,6 +17,8 @@ export interface LTMaintenanceRule {
17
17
  * Full maintenance configuration: schedule + ordered rules.
18
18
  */
19
19
  export interface LTMaintenanceConfig {
20
+ /** HotMesh application namespace to prune */
21
+ appId: string;
20
22
  /** Cron expression or ms-compatible interval, e.g. '0 2 * * *' or '1 day' */
21
23
  schedule: string;
22
24
  /** Rules executed sequentially each cycle */
@@ -1,2 +1,2 @@
1
- import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-BrP_8uEN.js";import{r as m}from"./index-_BRA9uFL.js";import{f as c}from"./useEventHooks-XNNzwADV.js";import{u}from"./mcp-MtXuky8q.js";import{P as d}from"./PageHeaderWithStats-yD_PTbOl.js";import"./vendor-react-CXumBFUA.js";import"./vendor-icons-Doy0g69_.js";function j(){var a;c();const{data:s}=n({limit:1}),{data:e}=m({status:"pending",limit:1}),{data:t}=u(),r=((a=t==null?void 0:t.servers)==null?void 0:a.filter(i=>i.status==="connected").length)??0,l=t?`${r}/${t.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(s==null?void 0:s.total)??"—"},{label:"Pending Escalations",value:(e==null?void 0:e.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:l},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{j as AdminDashboard};
2
- //# sourceMappingURL=AdminDashboard-BwUGcCxQ.js.map
1
+ import{j as o}from"./vendor-query-B2UbickB.js";import{c as n}from"./tasks-JVRVCx0f.js";import{r as m}from"./index-CWEOhAiK.js";import{f as c}from"./useEventHooks-BwjAi0Qq.js";import{u}from"./mcp-BO8QnWyk.js";import{P as d}from"./PageHeaderWithStats-yD_PTbOl.js";import"./vendor-react-CXumBFUA.js";import"./vendor-icons-Doy0g69_.js";function j(){var a;c();const{data:s}=n({limit:1}),{data:e}=m({status:"pending",limit:1}),{data:t}=u(),r=((a=t==null?void 0:t.servers)==null?void 0:a.filter(i=>i.status==="connected").length)??0,l=t?`${r}/${t.total}`:"—";return o.jsx("div",{children:o.jsx(d,{title:"Admin",stats:[{label:"Tasks",value:(s==null?void 0:s.total)??"—"},{label:"Pending Escalations",value:(e==null?void 0:e.total)??"—",dotClass:"bg-status-pending"},{label:"MCP Servers",value:l},{label:"System",value:"Healthy",dotClass:"bg-status-success"}]})})}export{j as AdminDashboard};
2
+ //# sourceMappingURL=AdminDashboard-CgJC8ZZF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminDashboard-BwUGcCxQ.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":"4UAMO,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-CgJC8ZZF.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":"4UAMO,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 v}from"./vendor-query-B2UbickB.js";import{a as re,d as le,b as oe}from"./agents-CkvQDr9b.js";import{E as ce,C as de,u as pe,a as xe,b as ue,c as me}from"./CronLabel-BdE6mHyA.js";import{d as he,u as fe}from"./index-_BRA9uFL.js";import{P as ve}from"./PageHeader-BuJpMxyu.js";import{B as O,e as U,i as be,R as Y,n as L,t as Z,aa as G,a as V,aL as ee,$ as ye}from"./vendor-icons-Doy0g69_.js";import{e as ge}from"./knowledge-BlF8UMrk.js";import{R as te}from"./RunAsSelector-B-ksMoEj.js";import{u as je}from"./workflows-CmqgGPzI.js";import{u as we}from"./yaml-workflows-DNFyjBXH.js";import{u as se}from"./capabilities-CbGmS0ty.js";import{u as Ne}from"./topics-DUk-zX5D.js";import{W as Q}from"./WorkflowPill-Z-zHRKOK.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CXumBFUA.js";import"./BotPicker-BKtjl6IL.js";import"./bots-CzuMCVgU.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Se={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},qe={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var o,x,u;const r=(x=(o=s.behaviors)==null?void 0:o.schedules)!=null&&x.length?s.behaviors.schedules.map(n=>({cron:n.cron||"",reaction_type:n.reaction_type||"durable",workflow_type:n.workflow_type||"",pipeline_id:n.pipeline_id||"",server_id:n.server_id||"",tool_name:n.tool_name||"",envelope:n.envelope?JSON.stringify(n.envelope,null,2):"{}",execute_as:n.execute_as||""})):(u=s.behaviors)!=null&&u.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(n=>({id:n.id,topic:n.topic,filter:n.filter?JSON.stringify(n.filter,null,2):"",reaction_type:n.reaction_type,workflow_type:n.workflow_type??"",pipeline_id:n.pipeline_id??"",mcp_prompt:n.mcp_prompt??"",server_id:n.server_id??"",tool_name:n.tool_name??"",input_mapping:JSON.stringify(n.input_mapping??{},null,2),execute_as:n.execute_as??"",enabled:n.enabled})),schedules:r}}function Ae(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:B(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 Oe(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?B(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:B(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function B(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function $e(s,a,r,o){let x;try{x=JSON.parse(s)}catch{x={}}const u=o.includes(a),n=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!u&&n){const{[a]:p,...c}=x;return JSON.stringify(c,null,2)}let h=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(h=p)}catch{}return JSON.stringify({...x,[a]:h},null,2)}const S="section-header mt-[3em] first:mt-0",E="label",_="hint",R="input",M="input-json w-full";function Ee({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-[12px] 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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:R}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:R}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function Pe({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-[12px] 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(O,{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:E,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:`${R} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:`${R} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ie({form:s,set:a}){const{data:r}=ge(),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-[12px] 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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:R,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:E,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(U,{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-[10px] text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(he,{date:x.latest})})]},x.domain))})]})]})}function We({serverId:s,toolName:a,onChange:r}){const{data:o}=se(),x=v.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[u,n]=v.useState(!1),[h,p]=v.useState(""),c=v.useRef(null),f=v.useRef(null);v.useEffect(()=>{if(!u)return;function t(i){f.current&&!f.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const l=a?`${a}`:"",d=u?h:l,y=v.useMemo(()=>{const t=(u?h:"").toLowerCase();return t?x.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):x},[x,h,u]),m=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:f,className:"relative",children:[e.jsx("input",{ref:c,type:"text",value:d,onFocus:()=>{n(!0),p(l)},onChange:t=>{const i=t.target.value;p(i),i||r("",""),u||n(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!u&&(m==null?void 0:m.description)&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-1 italic",children:m.description}),u&&y.length>0&&e.jsx("div",{className:"absolute z-50 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),n(!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-[11px] 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-[9px] font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(be,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),u&&y.length===0&&h&&e.jsx("div",{className:"absolute z-50 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-[11px] text-text-quaternary",children:['No capabilities match "',h,'"']})})]})}const Te={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Le=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:o,pipelineId:x,onPipelineIdChange:u,serverId:n,toolName:h,onCapabilityChange:p,mcpPrompt:c,onMcpPromptChange:f,availableTypes:l=[...Le]}){const{data:d}=je(),y=(d??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=we({status:"active"}),t=((m==null?void 0:m.workflows)??[]).map(i=>({id:i.id,name:i.graph_topic||i.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:l.map(i=>{const b=s===i;return e.jsx("button",{type:"button",onClick:()=>a(i),className:`px-3 py-1.5 text-[11px] font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Te[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:i=>o(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:i=>u(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(We,{serverId:n,toolName:h,onChange:p})]}),s==="mcp_query"&&f&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:c??"",onChange:i=>f(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Me={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",file:"bg-orange-400/15 text-orange-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Je({form:s,set:a}){const{data:r}=Ne({limit:200}),{data:o}=se(),x=(r==null?void 0:r.topics)??[],u=v.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[n,h]=v.useState(0),p=(t,i,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[i]:b},a("subscriptions",g)},c=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),h(s.subscriptions.length)},f=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&h(Math.max(0,s.subscriptions.length-2))},l=s.subscriptions,d=l[n],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,m=d?x.find(t=>t.topic===d.topic):void 0;return l.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-[12px] 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(O,{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(Y,{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-[11px] 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:c,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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-[12px] 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(O,{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:[l.map((t,i)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${n===i?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>h(i),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-1.5 h-1.5 rounded-full shrink-0 ${y(t)?"bg-emerald-400":"bg-zinc-500"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] 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 v}from"./vendor-query-B2UbickB.js";import{a as re,d as le,b as oe}from"./agents-BI5OeN84.js";import{E as ce,C as de,u as pe,a as xe,b as ue,c as me}from"./CronLabel-Cv5em7OP.js";import{c as he,u as fe}from"./index-CWEOhAiK.js";import{P as ve}from"./PageHeader-BuJpMxyu.js";import{B as O,e as U,i as be,R as Y,n as L,t as Z,aa as G,a as V,aL as ee,$ as ye}from"./vendor-icons-Doy0g69_.js";import{e as ge}from"./knowledge-D9Tuh-o-.js";import{R as te}from"./RunAsSelector-DP-jxsv6.js";import{u as je}from"./workflows-CyEYa01a.js";import{u as we}from"./yaml-workflows-i3GzrEme.js";import{u as se}from"./capabilities-BUbl-ojp.js";import{u as Ne}from"./topics-BLVnahd7.js";import{W as Q}from"./WorkflowPill-Z-zHRKOK.js";import{e as _e,c as ke,f as Ce}from"./vendor-react-CXumBFUA.js";import"./BotPicker-dCvnjynP.js";import"./bots-1UzUCsrR.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Se={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},qe={cron:"0 * * * *",reaction_type:"durable",workflow_type:"",pipeline_id:"",server_id:"",tool_name:"",envelope:"{}",execute_as:""};function Re(s,a){var o,x,u;const r=(x=(o=s.behaviors)==null?void 0:o.schedules)!=null&&x.length?s.behaviors.schedules.map(n=>({cron:n.cron||"",reaction_type:n.reaction_type||"durable",workflow_type:n.workflow_type||"",pipeline_id:n.pipeline_id||"",server_id:n.server_id||"",tool_name:n.tool_name||"",envelope:n.envelope?JSON.stringify(n.envelope,null,2):"{}",execute_as:n.execute_as||""})):(u=s.behaviors)!=null&&u.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(n=>({id:n.id,topic:n.topic,filter:n.filter?JSON.stringify(n.filter,null,2):"",reaction_type:n.reaction_type,workflow_type:n.workflow_type??"",pipeline_id:n.pipeline_id??"",mcp_prompt:n.mcp_prompt??"",server_id:n.server_id??"",tool_name:n.tool_name??"",input_mapping:JSON.stringify(n.input_mapping??{},null,2),execute_as:n.execute_as??"",enabled:n.enabled})),schedules:r}}function Ae(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:B(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 Oe(s){return s.subscriptions.map(a=>({id:a.id,topic:a.topic,filter:a.filter?B(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:B(a.input_mapping)??{},execute_as:a.execute_as||void 0,enabled:a.enabled}))}function B(s){if(s.trim())try{return JSON.parse(s)}catch{return}}function $e(s,a,r,o){let x;try{x=JSON.parse(s)}catch{x={}}const u=o.includes(a),n=r===""||r===void 0||r===null||Array.isArray(r)&&r.length===0||r==="[]";if(!u&&n){const{[a]:p,...c}=x;return JSON.stringify(c,null,2)}let h=r;if(typeof r=="string")try{const p=JSON.parse(r);Array.isArray(p)&&(h=p)}catch{}return JSON.stringify({...x,[a]:h},null,2)}const S="section-header mt-[3em] first:mt-0",E="label",_="hint",R="input",M="input-json w-full";function Ee({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-[12px] 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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,children:"Name *"}),e.jsx("input",{type:"text",value:s.name,onChange:r=>a("name",r.target.value),placeholder:"health-monitor",className:R}),e.jsx("p",{className:_,children:"Lowercase, kebab-case. This appears everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:R}),e.jsx("p",{className:_,children:"One sentence that explains what this automation does."})]})]})}function Pe({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-[12px] 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(O,{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:E,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:`${R} resize-none`}),e.jsx("p",{className:_,children:"Primary motivation. What the automation is trying to achieve."})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:`${R} resize-none`}),e.jsx("p",{className:_,children:"Guardrails. What it must never do, even when goals suggest it should."})]})]})]})}function Ie({form:s,set:a}){const{data:r}=ge(),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-[12px] 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(O,{className:"w-3 h-3",strokeWidth:1.5})})]}),e.jsxs("div",{children:[e.jsx("label",{className:E,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:R,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:E,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(U,{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-[10px] text-text-quaternary",children:[x.count," entries"]}),e.jsx("span",{className:"text-[9px] text-text-quaternary",children:e.jsx(he,{date:x.latest})})]},x.domain))})]})]})}function We({serverId:s,toolName:a,onChange:r}){const{data:o}=se(),x=v.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[u,n]=v.useState(!1),[h,p]=v.useState(""),c=v.useRef(null),f=v.useRef(null);v.useEffect(()=>{if(!u)return;function t(i){f.current&&!f.current.contains(i.target)&&n(!1)}return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[u]);const l=a?`${a}`:"",d=u?h:l,y=v.useMemo(()=>{const t=(u?h:"").toLowerCase();return t?x.filter(i=>i.name.toLowerCase().includes(t)||i.serverName.toLowerCase().includes(t)||(i.description??"").toLowerCase().includes(t)):x},[x,h,u]),m=a?x.find(t=>t.serverId===s&&t.name===a):void 0;return e.jsxs("div",{ref:f,className:"relative",children:[e.jsx("input",{ref:c,type:"text",value:d,onFocus:()=>{n(!0),p(l)},onChange:t=>{const i=t.target.value;p(i),i||r("",""),u||n(!0)},placeholder:"Search capabilities...",className:"input font-mono text-sm w-full"}),!u&&(m==null?void 0:m.description)&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-1 italic",children:m.description}),u&&y.length>0&&e.jsx("div",{className:"absolute z-50 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),n(!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-[11px] 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-[9px] font-medium shrink-0 bg-accent/10 text-accent",children:[e.jsx(be,{className:"w-2 h-2",strokeWidth:1.5}),t.serverName]}),t.description&&e.jsx("span",{className:"text-[10px] text-text-quaternary truncate",children:t.description})]},`${t.serverId}:${t.name}`))}),u&&y.length===0&&h&&e.jsx("div",{className:"absolute z-50 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-[11px] text-text-quaternary",children:['No capabilities match "',h,'"']})})]})}const Te={durable:"Workflow",pipeline:"Pipeline",capability:"Capability",mcp_query:"MCP Query"},Le=["durable","pipeline","capability","mcp_query"];function ae({reactionType:s,onReactionTypeChange:a,workflowType:r,onWorkflowTypeChange:o,pipelineId:x,onPipelineIdChange:u,serverId:n,toolName:h,onCapabilityChange:p,mcpPrompt:c,onMcpPromptChange:f,availableTypes:l=[...Le]}){const{data:d}=je(),y=(d??[]).filter(i=>i.invocable).map(i=>i.workflow_type),{data:m}=we({status:"active"}),t=((m==null?void 0:m.workflows)??[]).map(i=>({id:i.id,name:i.graph_topic||i.id}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-1",children:l.map(i=>{const b=s===i;return e.jsx("button",{type:"button",onClick:()=>a(i),className:`px-3 py-1.5 text-[11px] font-medium rounded-md transition-colors ${b?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:Te[i]},i)})}),s==="durable"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Workflow *"}),e.jsxs("select",{value:r,onChange:i=>o(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select workflow..."}),y.map(i=>e.jsx("option",{value:i,children:i},i))]})]}),s==="pipeline"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Pipeline *"}),e.jsxs("select",{value:x,onChange:i=>u(i.target.value),className:"input",children:[e.jsx("option",{value:"",children:"Select pipeline..."}),t.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]}),s==="capability"&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Capability *"}),e.jsx(We,{serverId:n,toolName:h,onChange:p})]}),s==="mcp_query"&&f&&e.jsxs("div",{children:[e.jsx("label",{className:"label",children:"Prompt *"}),e.jsx("textarea",{value:c??"",onChange:i=>f(i.target.value),placeholder:"Analyze the error and suggest remediation...",rows:3,className:"input resize-none"})]})]})}const Me={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",file:"bg-orange-400/15 text-orange-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"};function Je({form:s,set:a}){const{data:r}=Ne({limit:200}),{data:o}=se(),x=(r==null?void 0:r.topics)??[],u=v.useMemo(()=>{var t;return((t=o==null?void 0:o.categories)==null?void 0:t.flatMap(i=>i.tools))??[]},[o]),[n,h]=v.useState(0),p=(t,i,b)=>{const g=[...s.subscriptions];g[t]={...g[t],[i]:b},a("subscriptions",g)},c=()=>{a("subscriptions",[...s.subscriptions,{...Se}]),h(s.subscriptions.length)},f=t=>{a("subscriptions",s.subscriptions.filter((i,b)=>b!==t)),n>=s.subscriptions.length-1&&h(Math.max(0,s.subscriptions.length-2))},l=s.subscriptions,d=l[n],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,m=d?x.find(t=>t.topic===d.topic):void 0;return l.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-[12px] 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(O,{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(Y,{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-[11px] 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:c,className:"flex items-center gap-2 text-xs text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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-[12px] 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(O,{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:[l.map((t,i)=>e.jsxs("div",{className:`group/sub flex items-center rounded-md transition-colors ${n===i?"bg-accent/10 text-accent":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsxs("button",{onClick:()=>h(i),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-1.5 h-1.5 rounded-full shrink-0 ${y(t)?"bg-emerald-400":"bg-zinc-500"}`}),e.jsx("span",{className:"text-[11px] font-mono truncate",children:t.topic||"new subscription"})]}),e.jsxs("span",{className:"text-[9px] 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.`)&&f(i)},className:"opacity-0 group-hover/sub:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},i)),e.jsxs("button",{onClick:c,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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(ze,{value:d.topic,onChange:t=>p(n,"topic",t),topics:x}),(m==null?void 0:m.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-[10px] text-text-quaternary mb-1 uppercase tracking-wider font-medium",children:"Payload Schema"}),e.jsx("pre",{className:"text-[11px] font-mono text-text-secondary whitespace-pre-wrap overflow-x-auto max-h-40",children:JSON.stringify(m.payload_schema.properties??m.payload_schema,null,2)}),m.description&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-2 italic",children:m.description})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:d.reaction_type,onReactionTypeChange:t=>p(n,"reaction_type",t),workflowType:d.workflow_type,onWorkflowTypeChange:t=>p(n,"workflow_type",t),pipelineId:d.pipeline_id,onPipelineIdChange:t=>p(n,"pipeline_id",t),serverId:d.server_id,toolName:d.tool_name,onCapabilityChange:(t,i)=>{var A;const b=[...s.subscriptions],g={...b[n],server_id:t,tool_name:i},k=u.find(w=>w.serverId===t&&w.name===i),$=(A=k==null?void 0:k.inputSchema)==null?void 0:A.properties;if($&&i){const w={};for(const P of Object.keys($))P.startsWith("_")||(w[P]=`{event.data.${P}}`);g.input_mapping=JSON.stringify(w,null,2)}b[n]=g,a("subscriptions",b)},mcpPrompt:d.mcp_prompt,onMcpPromptChange:t=>p(n,"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(n,"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(n,"filter",t.target.value),placeholder:'{"extension": "png"}',className:`${R} 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(n,"filter",t.value),className:"px-2 py-0.5 text-[10px] 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(Fe,{tool:u.find(t=>t.serverId===d.server_id&&t.name===d.tool_name),value:d.input_mapping,onChange:t=>p(n,"input_mapping",t),eventSchema:m==null?void 0:m.payload_schema}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{value:d.input_mapping,onChange:t=>p(n,"input_mapping",t.target.value),rows:10,className:M,placeholder:`{
4
4
  "data": {
@@ -13,4 +13,4 @@ This takes effect when you save.`)&&f(i)},className:"opacity-0 group-hover/sub:o
13
13
  This takes effect when you save.`)&&n(f)},className:"opacity-0 group-hover/sched:opacity-100 px-2 text-text-quaternary hover:text-red-400 transition-all",title:"Remove",children:e.jsx(Z,{className:"w-3 h-3"})})]},f)),e.jsxs("button",{onClick:u,className:"w-full flex items-center gap-1.5 px-3 py-2 text-[11px] text-accent hover:text-accent-hover transition-colors",children:[e.jsx(L,{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:c=>x(r,"cron",c.target.value),placeholder:"0 * * * *",className:`${R} font-mono`}),p.cron&&e.jsx("p",{className:"text-[11px] text-accent/80 mt-1",children:z(p.cron)}),e.jsx("div",{className:"flex gap-3 mt-2 overflow-x-auto",children:Be.map(c=>e.jsx("button",{type:"button",onClick:()=>x(r,"cron",c),className:`text-[10px] font-mono whitespace-nowrap transition-colors ${p.cron===c?"text-accent font-medium":"text-accent/50 hover:text-accent"}`,children:z(c)},c))})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"Run this reaction"}),e.jsx(ae,{reactionType:p.reaction_type,onReactionTypeChange:c=>x(r,"reaction_type",c),workflowType:p.workflow_type,onWorkflowTypeChange:c=>x(r,"workflow_type",c),pipelineId:p.pipeline_id,onPipelineIdChange:c=>x(r,"pipeline_id",c),serverId:p.server_id,toolName:p.tool_name,onCapabilityChange:(c,f)=>{x(r,"server_id",c),x(r,"tool_name",f)},availableTypes:["durable","pipeline","capability"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:S,children:"As identity"}),e.jsx(te,{selected:p.execute_as,onChange:c=>x(r,"execute_as",c)}),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:c=>x(r,"envelope",c.target.value),rows:10,className:M,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-[10px] text-text-quaternary w-20 shrink-0",children:s}),e.jsx("span",{className:"text-xs text-text-primary",children:a})]})}function Ye({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-rose-400",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:U,color:"text-emerald-400",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:Y,color:"text-cyan-400",title:`Subscriptions (${s.subscriptions.length})`,children:s.subscriptions.length===0?e.jsx("span",{className:"text-[11px] 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(ce,{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-[10px]",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:a.reaction_type})]})]},r))})}),e.jsx(W,{icon:G,color:"text-amber-400",title:`Schedules (${s.schedules.length})`,children:s.schedules.length===0?e.jsx("span",{className:"text-[11px] 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(de,{cron:a.cron})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"text-text-quaternary text-[10px]",children:"→"}),a.workflow_type?e.jsx(Q,{type:a.workflow_type}):e.jsx("span",{className:"text-[11px] text-text-quaternary",children:"no workflow"})]})]},r))})})]}),e.jsx("div",{className:"border-l-2 border-emerald-400/30 pl-3 py-2 mt-6",children:e.jsx("p",{className:"text-[11px] text-text-tertiary leading-relaxed",children:"After saving, subscriptions and schedules activate immediately. You can pause the automation anytime."})})]})}const Ge=[{id:1,label:"Identity",icon:V},{id:2,label:"Motivation",icon:ee},{id:3,label:"Knowledge",icon:U},{id:4,label:"Subscriptions",icon:Y},{id:5,label:"Schedules",icon:G},{id:6,label:"Review",icon:ye}];function dt(){var H;const{id:s}=_e(),a=!s,r=ke(),{data:o}=fe(),u=!!((H=o==null?void 0:o.ai)!=null&&H.enabled)?"Agent":"Automation",{data:n,isLoading:h}=re(a?null:s),{data:p}=pe(a?null:s),c=le(),f=oe(),l=xe(),d=ue(),y=me(),[m,t]=v.useState(X),[i,b]=v.useState(!1),[g,k]=v.useState(""),[$,A]=Ce(),w=parseInt($.get("step")||"1",10),P=v.useCallback(j=>{A(N=>{const q=new URLSearchParams(N);return q.set("step",String(j)),q},{replace:!0})},[A]);v.useEffect(()=>{if(!i){if(a){t(X),b(!0);return}n&&p&&(t(Re(n,p.subscriptions??[])),b(!0))}},[n,p,a,i]);const I=(j,N)=>t(q=>({...q,[j]:N})),ne=async()=>{k("");try{const j=Ae(m);let N=s;a?N=(await c.mutateAsync(j)).id:await f.mutateAsync({id:s,...j});const q=Oe(m),ie=(p==null?void 0:p.subscriptions)??[],J=new Set(ie.map(C=>C.id));for(const C of q)if(C.id&&J.has(C.id)){const{id:F,...D}=C;await d.mutateAsync({agentId:N,subId:F,...D}),J.delete(F)}else{const{id:F,...D}=C;await l.mutateAsync({agentId:N,...D})}for(const C of J)await y.mutateAsync({agentId:N,subId:C});r(`/agents/${N}`)}catch(j){k(j.message)}};if(!a&&h)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=c.isPending||f.isPending;return e.jsxs("div",{children:[e.jsx(ve,{title:a?`New ${u}`:`${u}: ${(n==null?void 0:n.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:Ge.map(j=>{const N=j.icon,q=w===j.id;return e.jsxs("button",{onClick:()=>P(j.id),className:`w-full flex items-center gap-2.5 px-3 py-2 rounded-md text-left transition-colors ${q?"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:ne,disabled:!m.name.trim()||K,className:"w-full btn-primary text-xs disabled:opacity-50",children:K?"Saving...":a?`Create ${u}`:"Save"}),e.jsx("button",{onClick:()=>r(a?"/agents":`/agents/${s}`),className:"w-full btn-ghost text-xs",children:"Cancel"})]}),g&&e.jsx("p",{className:"text-xs text-status-error mt-3",children:g})]}),e.jsxs("div",{className:"flex-1 min-w-0 pt-2",children:[w===1&&e.jsx(Ee,{form:m,set:I}),w===2&&e.jsx(Pe,{form:m,set:I}),w===3&&e.jsx(Ie,{form:m,set:I}),w===4&&e.jsx(Je,{form:m,set:I}),w===5&&e.jsx(Ue,{form:m,set:I}),w===6&&e.jsx(Ye,{form:m})]})]})]})}export{dt as AgentConfigPage};
16
- //# sourceMappingURL=AgentConfigPage-DgrYzLwq.js.map
16
+ //# sourceMappingURL=AgentConfigPage-Bjl2Lsvo.js.map