@hotmeshio/long-tail 0.12.0 → 0.13.0

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 (257) hide show
  1. package/README.md +1 -0
  2. package/build/api/escalations/helpers.js +4 -2
  3. package/build/api/settings.js +3 -0
  4. package/build/services/agent/index.d.ts +11 -0
  5. package/build/services/agent/index.js +32 -0
  6. package/build/services/agent/sql.d.ts +7 -0
  7. package/build/services/agent/sql.js +32 -1
  8. package/build/services/agent/subscription-sql.d.ts +6 -0
  9. package/build/services/agent/subscription-sql.js +32 -1
  10. package/build/services/agent/subscriptions.d.ts +6 -0
  11. package/build/services/agent/subscriptions.js +23 -0
  12. package/build/services/config/index.d.ts +1 -1
  13. package/build/services/config/index.js +2 -1
  14. package/build/services/config/write.d.ts +10 -0
  15. package/build/services/config/write.js +49 -2
  16. package/build/services/domain/seed.d.ts +12 -5
  17. package/build/services/domain/seed.js +25 -6
  18. package/build/services/mcp/db.d.ts +16 -0
  19. package/build/services/mcp/db.js +24 -0
  20. package/build/services/mcp/sql.d.ts +8 -0
  21. package/build/services/mcp/sql.js +24 -1
  22. package/build/services/role/seed.d.ts +21 -0
  23. package/build/services/role/seed.js +113 -0
  24. package/build/services/role/sql.d.ts +8 -0
  25. package/build/services/role/sql.js +24 -1
  26. package/build/services/role/types.d.ts +7 -3
  27. package/build/services/role/types.js +7 -3
  28. package/build/services/topics/index.d.ts +2 -0
  29. package/build/services/topics/index.js +7 -0
  30. package/build/services/topics/sql.d.ts +2 -0
  31. package/build/services/topics/sql.js +5 -1
  32. package/build/services/topics/system-topics.d.ts +3 -2
  33. package/build/services/topics/system-topics.js +4 -3
  34. package/build/services/user/index.d.ts +1 -1
  35. package/build/services/user/index.js +2 -1
  36. package/build/services/user/roles.d.ts +8 -0
  37. package/build/services/user/roles.js +29 -0
  38. package/build/services/user/sql.d.ts +6 -0
  39. package/build/services/user/sql.js +9 -1
  40. package/build/services/user/sso-provision.js +14 -3
  41. package/build/start/apply-report.d.ts +26 -0
  42. package/build/start/apply-report.js +65 -0
  43. package/build/start/config.js +8 -1
  44. package/build/start/workers.js +170 -33
  45. package/build/tsconfig.tsbuildinfo +1 -1
  46. package/build/types/auth.d.ts +27 -1
  47. package/build/types/index.d.ts +1 -1
  48. package/build/types/startup.d.ts +108 -4
  49. package/dashboard/dist/assets/{AdminDashboard-CahUELrr.js → AdminDashboard-D2unnS2b.js} +2 -2
  50. package/dashboard/dist/assets/{AdminDashboard-CahUELrr.js.map → AdminDashboard-D2unnS2b.js.map} +1 -1
  51. package/dashboard/dist/assets/{AgentConfigPage-CkMv-cTV.js → AgentConfigPage-CBkf403g.js} +2 -2
  52. package/dashboard/dist/assets/{AgentConfigPage-CkMv-cTV.js.map → AgentConfigPage-CBkf403g.js.map} +1 -1
  53. package/dashboard/dist/assets/{AgentDetailPage-ZGea3Z4A.js → AgentDetailPage-CAIU3yzo.js} +2 -2
  54. package/dashboard/dist/assets/{AgentDetailPage-ZGea3Z4A.js.map → AgentDetailPage-CAIU3yzo.js.map} +1 -1
  55. package/dashboard/dist/assets/{AgentsPage-BMWSUJGi.js → AgentsPage-qP9fWMyT.js} +2 -2
  56. package/dashboard/dist/assets/{AgentsPage-BMWSUJGi.js.map → AgentsPage-qP9fWMyT.js.map} +1 -1
  57. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js +2 -0
  58. package/dashboard/dist/assets/AvailableEscalationsPage-DvWaiafI.js.map +1 -0
  59. package/dashboard/dist/assets/{BotPicker-DN8tq7pz.js → BotPicker-BN-MKITV.js} +2 -2
  60. package/dashboard/dist/assets/{BotPicker-DN8tq7pz.js.map → BotPicker-BN-MKITV.js.map} +1 -1
  61. package/dashboard/dist/assets/{CapabilitiesPage-EAO3Ae0S.js → CapabilitiesPage-CJfmWokN.js} +2 -2
  62. package/dashboard/dist/assets/{CapabilitiesPage-EAO3Ae0S.js.map → CapabilitiesPage-CJfmWokN.js.map} +1 -1
  63. package/dashboard/dist/assets/{CollapsibleSection-J-RejbjG.js → CollapsibleSection-BvMHlHyt.js} +2 -2
  64. package/dashboard/dist/assets/{CollapsibleSection-J-RejbjG.js.map → CollapsibleSection-BvMHlHyt.js.map} +1 -1
  65. package/dashboard/dist/assets/{CountdownTimer-Dw8N9tmQ.js → CountdownTimer-By4rbMDN.js} +2 -2
  66. package/dashboard/dist/assets/{CountdownTimer-Dw8N9tmQ.js.map → CountdownTimer-By4rbMDN.js.map} +1 -1
  67. package/dashboard/dist/assets/{CredentialsPage-CTurxwRn.js → CredentialsPage-2TvvRwGJ.js} +2 -2
  68. package/dashboard/dist/assets/{CredentialsPage-CTurxwRn.js.map → CredentialsPage-2TvvRwGJ.js.map} +1 -1
  69. package/dashboard/dist/assets/{CronLabel-DZ5TmIQG.js → CronLabel-HxmsDSnV.js} +2 -2
  70. package/dashboard/dist/assets/{CronLabel-DZ5TmIQG.js.map → CronLabel-HxmsDSnV.js.map} +1 -1
  71. package/dashboard/dist/assets/{CustomDurationPicker-BES_FTrm.js → CustomDurationPicker-8Ao-1pKA.js} +2 -2
  72. package/dashboard/dist/assets/{CustomDurationPicker-BES_FTrm.js.map → CustomDurationPicker-8Ao-1pKA.js.map} +1 -1
  73. package/dashboard/dist/assets/{DropZone-BWD9aGOz.js → DropZone-DovkhN2p.js} +2 -2
  74. package/dashboard/dist/assets/{DropZone-BWD9aGOz.js.map → DropZone-DovkhN2p.js.map} +1 -1
  75. package/dashboard/dist/assets/{ElapsedCell-CIGRporU.js → ElapsedCell-BkRu9Xpd.js} +2 -2
  76. package/dashboard/dist/assets/{ElapsedCell-CIGRporU.js.map → ElapsedCell-BkRu9Xpd.js.map} +1 -1
  77. package/dashboard/dist/assets/EntityTimelinePanel--E6hLMCM.js +2 -0
  78. package/dashboard/dist/assets/{EntityTimelinePanel-CKIFsDOB.js.map → EntityTimelinePanel--E6hLMCM.js.map} +1 -1
  79. package/dashboard/dist/assets/{EscalationListSchemaPage-DOrv-quD.js → EscalationListSchemaPage-CdFtqEEX.js} +3 -3
  80. package/dashboard/dist/assets/{EscalationListSchemaPage-DOrv-quD.js.map → EscalationListSchemaPage-CdFtqEEX.js.map} +1 -1
  81. package/dashboard/dist/assets/{EscalationSchemaPage-DAOVAxAM.js → EscalationSchemaPage-BsjS2axz.js} +2 -2
  82. package/dashboard/dist/assets/{EscalationSchemaPage-DAOVAxAM.js.map → EscalationSchemaPage-BsjS2axz.js.map} +1 -1
  83. package/dashboard/dist/assets/{EscalationsOverview-B27sDn5O.js → EscalationsOverview-FL-xteVc.js} +2 -2
  84. package/dashboard/dist/assets/{EscalationsOverview-B27sDn5O.js.map → EscalationsOverview-FL-xteVc.js.map} +1 -1
  85. package/dashboard/dist/assets/{EventTable-Co1d40Qq.js → EventTable-BOcgZ78i.js} +2 -2
  86. package/dashboard/dist/assets/{EventTable-Co1d40Qq.js.map → EventTable-BOcgZ78i.js.map} +1 -1
  87. package/dashboard/dist/assets/{FilterBar-2ZfU21EA.js → FilterBar-DfCiCmm-.js} +2 -2
  88. package/dashboard/dist/assets/{FilterBar-2ZfU21EA.js.map → FilterBar-DfCiCmm-.js.map} +1 -1
  89. package/dashboard/dist/assets/{GraphInvokePage-pdvc9VSv.js → GraphInvokePage-DfVeiN-8.js} +2 -2
  90. package/dashboard/dist/assets/{GraphInvokePage-pdvc9VSv.js.map → GraphInvokePage-DfVeiN-8.js.map} +1 -1
  91. package/dashboard/dist/assets/{HomePage-CLlDsBnw.js → HomePage-C2IhF9WB.js} +2 -2
  92. package/dashboard/dist/assets/{HomePage-CLlDsBnw.js.map → HomePage-C2IhF9WB.js.map} +1 -1
  93. package/dashboard/dist/assets/{ListToolbar-DMremj2e.js → ListToolbar-DA0PTOl5.js} +2 -2
  94. package/dashboard/dist/assets/{ListToolbar-DMremj2e.js.map → ListToolbar-DA0PTOl5.js.map} +1 -1
  95. package/dashboard/dist/assets/{McpOverview-BhztmhoL.js → McpOverview-DstPch5M.js} +2 -2
  96. package/dashboard/dist/assets/{McpOverview-BhztmhoL.js.map → McpOverview-DstPch5M.js.map} +1 -1
  97. package/dashboard/dist/assets/{McpQueryDetailPage-BseZfrhc.js → McpQueryDetailPage-Csv0PKE0.js} +2 -2
  98. package/dashboard/dist/assets/{McpQueryDetailPage-BseZfrhc.js.map → McpQueryDetailPage-Csv0PKE0.js.map} +1 -1
  99. package/dashboard/dist/assets/{McpQueryPage-DMzkble7.js → McpQueryPage-DxmqCkly.js} +2 -2
  100. package/dashboard/dist/assets/{McpQueryPage-DMzkble7.js.map → McpQueryPage-DxmqCkly.js.map} +1 -1
  101. package/dashboard/dist/assets/{McpRunDetailPage-DqaBQAnn.js → McpRunDetailPage-CcJOlp_B.js} +2 -2
  102. package/dashboard/dist/assets/{McpRunDetailPage-DqaBQAnn.js.map → McpRunDetailPage-CcJOlp_B.js.map} +1 -1
  103. package/dashboard/dist/assets/{McpRunsPage-Du8GnHFv.js → McpRunsPage-BZCR043j.js} +2 -2
  104. package/dashboard/dist/assets/{McpRunsPage-Du8GnHFv.js.map → McpRunsPage-BZCR043j.js.map} +1 -1
  105. package/dashboard/dist/assets/{NamespacePill-C09QuOEz.js → NamespacePill-BeifzjUm.js} +2 -2
  106. package/dashboard/dist/assets/{NamespacePill-C09QuOEz.js.map → NamespacePill-BeifzjUm.js.map} +1 -1
  107. package/dashboard/dist/assets/{OperationsPage-CL2feqwS.js → OperationsPage-DMsPXITh.js} +3 -3
  108. package/dashboard/dist/assets/{OperationsPage-CL2feqwS.js.map → OperationsPage-DMsPXITh.js.map} +1 -1
  109. package/dashboard/dist/assets/{OperatorDashboard-BHiGQZN_.js → OperatorDashboard-DSloftQ5.js} +2 -2
  110. package/dashboard/dist/assets/{OperatorDashboard-BHiGQZN_.js.map → OperatorDashboard-DSloftQ5.js.map} +1 -1
  111. package/dashboard/dist/assets/{PageHeader-B7YJxa4o.js → PageHeader-BpeBHqyc.js} +2 -2
  112. package/dashboard/dist/assets/{PageHeader-B7YJxa4o.js.map → PageHeader-BpeBHqyc.js.map} +1 -1
  113. package/dashboard/dist/assets/{PageHeaderWithStats-gT-5ovJh.js → PageHeaderWithStats-JXeUFa_g.js} +2 -2
  114. package/dashboard/dist/assets/{PageHeaderWithStats-gT-5ovJh.js.map → PageHeaderWithStats-JXeUFa_g.js.map} +1 -1
  115. package/dashboard/dist/assets/{PersonaDetailPage-D6GGZgUS.js → PersonaDetailPage-jDVRCLbU.js} +2 -2
  116. package/dashboard/dist/assets/{PersonaDetailPage-D6GGZgUS.js.map → PersonaDetailPage-jDVRCLbU.js.map} +1 -1
  117. package/dashboard/dist/assets/{PersonasPage-BQYCdmAs.js → PersonasPage-DnDDwXoy.js} +2 -2
  118. package/dashboard/dist/assets/{PersonasPage-BQYCdmAs.js.map → PersonasPage-DnDDwXoy.js.map} +1 -1
  119. package/dashboard/dist/assets/{ProcessDetailPage-P45jOLim.js → ProcessDetailPage-CfAUU6q2.js} +2 -2
  120. package/dashboard/dist/assets/{ProcessDetailPage-P45jOLim.js.map → ProcessDetailPage-CfAUU6q2.js.map} +1 -1
  121. package/dashboard/dist/assets/{ProcessesListPage-CgdzgCY6.js → ProcessesListPage-CnAXzaVv.js} +2 -2
  122. package/dashboard/dist/assets/{ProcessesListPage-CgdzgCY6.js.map → ProcessesListPage-CnAXzaVv.js.map} +1 -1
  123. package/dashboard/dist/assets/RoleDetailPage-Dg1p6Qz_.js +8 -0
  124. package/dashboard/dist/assets/RoleDetailPage-Dg1p6Qz_.js.map +1 -0
  125. package/dashboard/dist/assets/{RolePill-CtYI1_k1.js → RolePill-EocCXZh0.js} +2 -2
  126. package/dashboard/dist/assets/{RolePill-CtYI1_k1.js.map → RolePill-EocCXZh0.js.map} +1 -1
  127. package/dashboard/dist/assets/{RolesPage-Ci7_PbPt.js → RolesPage-DeRVQux8.js} +2 -2
  128. package/dashboard/dist/assets/{RolesPage-Ci7_PbPt.js.map → RolesPage-DeRVQux8.js.map} +1 -1
  129. package/dashboard/dist/assets/{RunAsSelector-CB0pV097.js → RunAsSelector-BFNqQGuG.js} +2 -2
  130. package/dashboard/dist/assets/{RunAsSelector-CB0pV097.js.map → RunAsSelector-BFNqQGuG.js.map} +1 -1
  131. package/dashboard/dist/assets/{ScanCodesPage-DpbPhAj1.js → ScanCodesPage-D0GOdk5m.js} +2 -2
  132. package/dashboard/dist/assets/{ScanCodesPage-DpbPhAj1.js.map → ScanCodesPage-D0GOdk5m.js.map} +1 -1
  133. package/dashboard/dist/assets/{ScanSchemeDetailPage-CGnMGlt0.js → ScanSchemeDetailPage-vFqoe_P4.js} +2 -2
  134. package/dashboard/dist/assets/{ScanSchemeDetailPage-CGnMGlt0.js.map → ScanSchemeDetailPage-vFqoe_P4.js.map} +1 -1
  135. package/dashboard/dist/assets/ScanStationPage-DH1ynTX9.js +2 -0
  136. package/dashboard/dist/assets/{ScanStationPage-BTeV7TGy.js.map → ScanStationPage-DH1ynTX9.js.map} +1 -1
  137. package/dashboard/dist/assets/{ScopeBadge-B76rOtA0.js → ScopeBadge-H5dEqeHi.js} +2 -2
  138. package/dashboard/dist/assets/{ScopeBadge-B76rOtA0.js.map → ScopeBadge-H5dEqeHi.js.map} +1 -1
  139. package/dashboard/dist/assets/{StickyPagination-DH-0JEyx.js → StickyPagination-B99hVu95.js} +2 -2
  140. package/dashboard/dist/assets/{StickyPagination-DH-0JEyx.js.map → StickyPagination-B99hVu95.js.map} +1 -1
  141. package/dashboard/dist/assets/{StreamMessageDetail-u-pDrHfS.js → StreamMessageDetail-DcDGISrv.js} +2 -2
  142. package/dashboard/dist/assets/{StreamMessageDetail-u-pDrHfS.js.map → StreamMessageDetail-DcDGISrv.js.map} +1 -1
  143. package/dashboard/dist/assets/{SwimlaneTimeline-vN1N8BGy.js → SwimlaneTimeline-BP3mSQAg.js} +2 -2
  144. package/dashboard/dist/assets/{SwimlaneTimeline-vN1N8BGy.js.map → SwimlaneTimeline-BP3mSQAg.js.map} +1 -1
  145. package/dashboard/dist/assets/{TagInput-BQAPOp17.js → TagInput-Ch5u6iPH.js} +2 -2
  146. package/dashboard/dist/assets/{TagInput-BQAPOp17.js.map → TagInput-Ch5u6iPH.js.map} +1 -1
  147. package/dashboard/dist/assets/{TaskDetailPage-CAQm6avs.js → TaskDetailPage-_XWLJzt-.js} +2 -2
  148. package/dashboard/dist/assets/{TaskDetailPage-CAQm6avs.js.map → TaskDetailPage-_XWLJzt-.js.map} +1 -1
  149. package/dashboard/dist/assets/{TaskQueuePill-C2NImrwl.js → TaskQueuePill-Bz146p-P.js} +2 -2
  150. package/dashboard/dist/assets/{TaskQueuePill-C2NImrwl.js.map → TaskQueuePill-Bz146p-P.js.map} +1 -1
  151. package/dashboard/dist/assets/{TasksListPage-C1bT3DT9.js → TasksListPage-iGriKiO2.js} +2 -2
  152. package/dashboard/dist/assets/{TasksListPage-C1bT3DT9.js.map → TasksListPage-iGriKiO2.js.map} +1 -1
  153. package/dashboard/dist/assets/{TimeAgo-qZxkJ8Am.js → TimeAgo-BO33VeFl.js} +2 -2
  154. package/dashboard/dist/assets/{TimeAgo-qZxkJ8Am.js.map → TimeAgo-BO33VeFl.js.map} +1 -1
  155. package/dashboard/dist/assets/{TimestampCell-CC3dz6FG.js → TimestampCell-KAjX7w35.js} +2 -2
  156. package/dashboard/dist/assets/{TimestampCell-CC3dz6FG.js.map → TimestampCell-KAjX7w35.js.map} +1 -1
  157. package/dashboard/dist/assets/{ToolPill-FOZm67TS.js → ToolPill-sj8OkBB0.js} +2 -2
  158. package/dashboard/dist/assets/{ToolPill-FOZm67TS.js.map → ToolPill-sj8OkBB0.js.map} +1 -1
  159. package/dashboard/dist/assets/{ToolTestPanel-C3sSQUvw.js → ToolTestPanel-BchG2yC6.js} +2 -2
  160. package/dashboard/dist/assets/{ToolTestPanel-C3sSQUvw.js.map → ToolTestPanel-BchG2yC6.js.map} +1 -1
  161. package/dashboard/dist/assets/{TopicDetailPage-ClI0I8Mu.js → TopicDetailPage-BaK8H0o1.js} +2 -2
  162. package/dashboard/dist/assets/{TopicDetailPage-ClI0I8Mu.js.map → TopicDetailPage-BaK8H0o1.js.map} +1 -1
  163. package/dashboard/dist/assets/{TopicsPage-CNf2VZud.js → TopicsPage-DEyvm669.js} +2 -2
  164. package/dashboard/dist/assets/{TopicsPage-CNf2VZud.js.map → TopicsPage-DEyvm669.js.map} +1 -1
  165. package/dashboard/dist/assets/{UserName-BdMHmyL3.js → UserName-BV6SKI9P.js} +2 -2
  166. package/dashboard/dist/assets/{UserName-BdMHmyL3.js.map → UserName-BV6SKI9P.js.map} +1 -1
  167. package/dashboard/dist/assets/{WorkflowExecutionPage-Ba4mYFoW.js → WorkflowExecutionPage-1sKoEFNC.js} +2 -2
  168. package/dashboard/dist/assets/{WorkflowExecutionPage-Ba4mYFoW.js.map → WorkflowExecutionPage-1sKoEFNC.js.map} +1 -1
  169. package/dashboard/dist/assets/{WorkflowPill-C5TEWlfO.js → WorkflowPill-BcA7S3gI.js} +2 -2
  170. package/dashboard/dist/assets/{WorkflowPill-C5TEWlfO.js.map → WorkflowPill-BcA7S3gI.js.map} +1 -1
  171. package/dashboard/dist/assets/{WorkflowsDashboard-ImEm16tX.js → WorkflowsDashboard-YTHDZZOD.js} +2 -2
  172. package/dashboard/dist/assets/{WorkflowsDashboard-ImEm16tX.js.map → WorkflowsDashboard-YTHDZZOD.js.map} +1 -1
  173. package/dashboard/dist/assets/{WorkflowsOverview-BpWyV_tj.js → WorkflowsOverview-ucXPLTtm.js} +2 -2
  174. package/dashboard/dist/assets/{WorkflowsOverview-BpWyV_tj.js.map → WorkflowsOverview-ucXPLTtm.js.map} +1 -1
  175. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BFBlw1YY.js → YamlWorkflowDetailPage-C_RTZKqZ.js} +2 -2
  176. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BFBlw1YY.js.map → YamlWorkflowDetailPage-C_RTZKqZ.js.map} +1 -1
  177. package/dashboard/dist/assets/{YamlWorkflowsPage-C9gxapRg.js → YamlWorkflowsPage-Usid3w2W.js} +2 -2
  178. package/dashboard/dist/assets/{YamlWorkflowsPage-C9gxapRg.js.map → YamlWorkflowsPage-Usid3w2W.js.map} +1 -1
  179. package/dashboard/dist/assets/{agents-BJQtJTiz.js → agents-BTDsRK8e.js} +2 -2
  180. package/dashboard/dist/assets/{agents-BJQtJTiz.js.map → agents-BTDsRK8e.js.map} +1 -1
  181. package/dashboard/dist/assets/{bots-DDlU1gMy.js → bots-DxLrfdfr.js} +2 -2
  182. package/dashboard/dist/assets/{bots-DDlU1gMy.js.map → bots-DxLrfdfr.js.map} +1 -1
  183. package/dashboard/dist/assets/{capabilities-qYrUpdid.js → capabilities-DbTmeW-S.js} +2 -2
  184. package/dashboard/dist/assets/{capabilities-qYrUpdid.js.map → capabilities-DbTmeW-S.js.map} +1 -1
  185. package/dashboard/dist/assets/{controlplane-DnJ1VDTs.js → controlplane-CEBntAL4.js} +2 -2
  186. package/dashboard/dist/assets/{controlplane-DnJ1VDTs.js.map → controlplane-CEBntAL4.js.map} +1 -1
  187. package/dashboard/dist/assets/escalation-columns-Carqdwoh.js +2 -0
  188. package/dashboard/dist/assets/escalation-columns-Carqdwoh.js.map +1 -0
  189. package/dashboard/dist/assets/{index-KotwPxGB.js → index-B2hz0pUh.js} +2 -2
  190. package/dashboard/dist/assets/{index-KotwPxGB.js.map → index-B2hz0pUh.js.map} +1 -1
  191. package/dashboard/dist/assets/{index-04QQsxMp.js → index-B9m7fA3M.js} +2 -2
  192. package/dashboard/dist/assets/{index-04QQsxMp.js.map → index-B9m7fA3M.js.map} +1 -1
  193. package/dashboard/dist/assets/{index-B5q8ksfv.js → index-BhapT-Vl.js} +2 -2
  194. package/dashboard/dist/assets/{index-B5q8ksfv.js.map → index-BhapT-Vl.js.map} +1 -1
  195. package/dashboard/dist/assets/{index-CtAPxA03.js → index-Bqm4zu46.js} +2 -2
  196. package/dashboard/dist/assets/{index-CtAPxA03.js.map → index-Bqm4zu46.js.map} +1 -1
  197. package/dashboard/dist/assets/{index-LiLVAQzB.js → index-C0hSttF5.js} +2 -2
  198. package/dashboard/dist/assets/{index-LiLVAQzB.js.map → index-C0hSttF5.js.map} +1 -1
  199. package/dashboard/dist/assets/{index-DhRdWzz0.js → index-CDkg6iOE.js} +4 -4
  200. package/dashboard/dist/assets/{index-DhRdWzz0.js.map → index-CDkg6iOE.js.map} +1 -1
  201. package/dashboard/dist/assets/{index-D-5F3Bw-.js → index-CVBBkW8V.js} +2 -2
  202. package/dashboard/dist/assets/{index-D-5F3Bw-.js.map → index-CVBBkW8V.js.map} +1 -1
  203. package/dashboard/dist/assets/{index-BUpB9ezn.js → index-CgIBjZta.js} +2 -2
  204. package/dashboard/dist/assets/{index-BUpB9ezn.js.map → index-CgIBjZta.js.map} +1 -1
  205. package/dashboard/dist/assets/{index-C991QfUN.js → index-DBXm49S6.js} +27 -27
  206. package/dashboard/dist/assets/index-DBXm49S6.js.map +1 -0
  207. package/dashboard/dist/assets/{index-BAqQSgxn.js → index-De8iV1y2.js} +2 -2
  208. package/dashboard/dist/assets/{index-BAqQSgxn.js.map → index-De8iV1y2.js.map} +1 -1
  209. package/dashboard/dist/assets/{index-BHbO4F8Z.js → index-DsgjFRvA.js} +2 -2
  210. package/dashboard/dist/assets/{index-BHbO4F8Z.js.map → index-DsgjFRvA.js.map} +1 -1
  211. package/dashboard/dist/assets/{index-CFlmubaP.js → index-kes8V4Xw.js} +2 -2
  212. package/dashboard/dist/assets/{index-CFlmubaP.js.map → index-kes8V4Xw.js.map} +1 -1
  213. package/dashboard/dist/assets/{index-CroJTX8g.js → index-nwLh3CK2.js} +2 -2
  214. package/dashboard/dist/assets/{index-CroJTX8g.js.map → index-nwLh3CK2.js.map} +1 -1
  215. package/dashboard/dist/assets/{knowledge-CnMeg8Rw.js → knowledge-oFYAanUp.js} +2 -2
  216. package/dashboard/dist/assets/{knowledge-CnMeg8Rw.js.map → knowledge-oFYAanUp.js.map} +1 -1
  217. package/dashboard/dist/assets/{mcp-CHPSFv7m.js → mcp-C9Kw4Ow8.js} +2 -2
  218. package/dashboard/dist/assets/{mcp-CHPSFv7m.js.map → mcp-C9Kw4Ow8.js.map} +1 -1
  219. package/dashboard/dist/assets/{mcp-query-C19EGwdN.js → mcp-query-BwzpZ91Z.js} +2 -2
  220. package/dashboard/dist/assets/{mcp-query-C19EGwdN.js.map → mcp-query-BwzpZ91Z.js.map} +1 -1
  221. package/dashboard/dist/assets/{personas-Br1Vo2S3.js → personas-D5ehmtRb.js} +2 -2
  222. package/dashboard/dist/assets/{personas-Br1Vo2S3.js.map → personas-D5ehmtRb.js.map} +1 -1
  223. package/dashboard/dist/assets/{pipelines-QMrFoJZX.js → pipelines-xgPKGEdD.js} +2 -2
  224. package/dashboard/dist/assets/{pipelines-QMrFoJZX.js.map → pipelines-xgPKGEdD.js.map} +1 -1
  225. package/dashboard/dist/assets/{tasks-Doy_7cGX.js → tasks-CLyrl-MU.js} +2 -2
  226. package/dashboard/dist/assets/{tasks-Doy_7cGX.js.map → tasks-CLyrl-MU.js.map} +1 -1
  227. package/dashboard/dist/assets/{topics-BcJS4G09.js → topics-B_gO7CQ0.js} +2 -2
  228. package/dashboard/dist/assets/{topics-BcJS4G09.js.map → topics-B_gO7CQ0.js.map} +1 -1
  229. package/dashboard/dist/assets/{useEventHooks-ldE5o0ok.js → useEventHooks-BdWYm63U.js} +2 -2
  230. package/dashboard/dist/assets/{useEventHooks-ldE5o0ok.js.map → useEventHooks-BdWYm63U.js.map} +1 -1
  231. package/dashboard/dist/assets/{useNamespace-CCu8fZc6.js → useNamespace-C238M4Qn.js} +2 -2
  232. package/dashboard/dist/assets/{useNamespace-CCu8fZc6.js.map → useNamespace-C238M4Qn.js.map} +1 -1
  233. package/dashboard/dist/assets/{useYamlActivityEvents-DDrXwFXX.js → useYamlActivityEvents-B2ryEK4S.js} +2 -2
  234. package/dashboard/dist/assets/{useYamlActivityEvents-DDrXwFXX.js.map → useYamlActivityEvents-B2ryEK4S.js.map} +1 -1
  235. package/dashboard/dist/assets/{users-BvKhSq1i.js → users-BFaTe6Mt.js} +2 -2
  236. package/dashboard/dist/assets/{users-BvKhSq1i.js.map → users-BFaTe6Mt.js.map} +1 -1
  237. package/dashboard/dist/assets/{vendor-icons-Aw7bzBxa.js → vendor-icons-BPsNpK3Y.js} +142 -137
  238. package/dashboard/dist/assets/vendor-icons-BPsNpK3Y.js.map +1 -0
  239. package/dashboard/dist/assets/{workflows-D09ysQF1.js → workflows-DXz7tZxp.js} +2 -2
  240. package/dashboard/dist/assets/{workflows-D09ysQF1.js.map → workflows-DXz7tZxp.js.map} +1 -1
  241. package/dashboard/dist/assets/{yaml-workflows-BFHrxEl4.js → yaml-workflows-u3xuRAnS.js} +2 -2
  242. package/dashboard/dist/assets/{yaml-workflows-BFHrxEl4.js.map → yaml-workflows-u3xuRAnS.js.map} +1 -1
  243. package/dashboard/dist/index.html +2 -2
  244. package/docs/code-owned-configuration.md +131 -0
  245. package/docs/hitl/x-lt-transition.md +13 -0
  246. package/docs/scan-codes.md +24 -0
  247. package/package.json +1 -1
  248. package/dashboard/dist/assets/AvailableEscalationsPage-BjsbfsWW.js +0 -2
  249. package/dashboard/dist/assets/AvailableEscalationsPage-BjsbfsWW.js.map +0 -1
  250. package/dashboard/dist/assets/EntityTimelinePanel-CKIFsDOB.js +0 -2
  251. package/dashboard/dist/assets/RoleDetailPage-Dme2pa9z.js +0 -8
  252. package/dashboard/dist/assets/RoleDetailPage-Dme2pa9z.js.map +0 -1
  253. package/dashboard/dist/assets/ScanStationPage-BTeV7TGy.js +0 -2
  254. package/dashboard/dist/assets/escalation-columns-BCnVWr_n.js +0 -2
  255. package/dashboard/dist/assets/escalation-columns-BCnVWr_n.js.map +0 -1
  256. package/dashboard/dist/assets/index-C991QfUN.js.map +0 -1
  257. package/dashboard/dist/assets/vendor-icons-Aw7bzBxa.js.map +0 -1
@@ -21,8 +21,10 @@ export interface LTWorkerConfig {
21
21
  invocable?: boolean;
22
22
  /**
23
23
  * Certify for HITL escalation — the interceptor wraps the workflow with
24
- * task tracking, escalation handling, and re-run detection. Omitted
25
- * derived from roles/consumes presence (the pre-flag behavior).
24
+ * task tracking, escalation handling, and re-run detection. On the
25
+ * insert-if-absent path an omitted flag is derived from roles/consumes
26
+ * presence (the pre-flag behavior). On the code-owned apply path the flag
27
+ * is explicit-only: omitted registers as NOT certified.
26
28
  */
27
29
  certified?: boolean;
28
30
  /** Roles allowed to invoke this workflow. */
@@ -51,6 +53,12 @@ export interface LTWorkerConfig {
51
53
  cronSchedule?: string;
52
54
  /** Bot identity to run as (proxy invocation). */
53
55
  executeAs?: string;
56
+ /**
57
+ * Per-entry ownership override. `true` → this profile is compared and
58
+ * applied on every boot (code is source of truth); `false` → the DB owns
59
+ * the row after first insert. Omitted → follows `configSource`.
60
+ */
61
+ reset?: boolean;
54
62
  }
55
63
  /**
56
64
  * Inline MCP server profile declared alongside a server factory.
@@ -76,6 +84,14 @@ export interface LTMcpServerConfig {
76
84
  /** Tool only reads data — safe to expose to external MCP consumers without write permission. */
77
85
  read_safe?: boolean;
78
86
  }>;
87
+ /**
88
+ * Per-entry ownership override. `true` → description, tags, category,
89
+ * compile hints, and credential providers are compared and applied on every
90
+ * boot (runtime state — tool manifest, connection status — is never
91
+ * touched); `false` → the DB owns the row after first insert. Omitted →
92
+ * follows `configSource`.
93
+ */
94
+ reset?: boolean;
79
95
  }
80
96
  /**
81
97
  * Declarative agent configuration for startup seeding.
@@ -109,6 +125,13 @@ export interface LTAgentConfig {
109
125
  filter?: Record<string, any>;
110
126
  execute_as?: string;
111
127
  }>;
128
+ /**
129
+ * Per-entry ownership override. `true` → the agent's declared fields and
130
+ * subscriptions are compared and applied on every boot (subscriptions not
131
+ * declared in code are reported, never deleted); `false` → the DB owns the
132
+ * rows after first insert. Omitted → follows `configSource`.
133
+ */
134
+ reset?: boolean;
112
135
  }
113
136
  /**
114
137
  * Declarative topic catalog entry for startup seeding.
@@ -135,6 +158,59 @@ export interface LTTopicConfig {
135
158
  */
136
159
  reset?: boolean;
137
160
  }
161
+ /**
162
+ * Declarative role registration. The role is created if missing and its
163
+ * metadata written through the same versioned write path the dashboard uses:
164
+ * a changed form_schema/metadata_schema pair advances the role's schema
165
+ * version and snapshots the prior shape, so in-flight escalations keep the
166
+ * form they were created against. Only declared fields are written —
167
+ * omitted fields are never touched.
168
+ *
169
+ * Ownership follows `configSource` (overridable per entry with `reset`):
170
+ * code-owned roles are compared and applied on every boot; db-owned roles
171
+ * receive their metadata once at creation and belong to the DB afterward.
172
+ */
173
+ export interface LTRoleConfig {
174
+ role: string;
175
+ title?: string;
176
+ description?: string;
177
+ /** JSON Schema for the escalation resolve form (versioned). */
178
+ form_schema?: Record<string, any>;
179
+ /** JSON Schema for lt_escalations.metadata under this role (versioned with form_schema). */
180
+ metadata_schema?: Record<string, any>;
181
+ /** x-lt-* contract formatting the role-scoped escalation list page (independently versioned). */
182
+ list_schema?: Record<string, any>;
183
+ /** Free-form bag plus the reserved keys (on_cancel, on_timeout, worked_by, kiosk). */
184
+ properties?: Record<string, any>;
185
+ ops_visible?: boolean;
186
+ /** Make this role's sequence the home Pace Board's default segment (single-holder). */
187
+ ops_home_default?: boolean;
188
+ parent_role?: string;
189
+ /** Upstream-input roles from other sequences (replace semantics when declared). */
190
+ upstream_roles?: string[];
191
+ /** Roles this role may escalate to (replace semantics when declared). */
192
+ escalation_targets?: string[];
193
+ /** Pinned-view seeds handed to members: [{ label, url, badge? }]. */
194
+ default_pins?: {
195
+ label: string;
196
+ url: string;
197
+ badge?: boolean;
198
+ }[];
199
+ /** Server-side resolver schema validation for this role. */
200
+ enforce_schema?: boolean;
201
+ sla_minutes?: number;
202
+ target_per_hour?: number;
203
+ worker_count?: number;
204
+ priority_threshold_minutes?: number;
205
+ priority_facet?: string;
206
+ entity_facet?: string;
207
+ entity_state_source?: 'role' | 'subtype';
208
+ /**
209
+ * Per-entry ownership override. `true` → compared and applied on every
210
+ * boot; `false` → db-owned after creation. Omitted → follows `configSource`.
211
+ */
212
+ reset?: boolean;
213
+ }
138
214
  /**
139
215
  * Declarative graph (YAML/DAG) workflow registered at startup — the graph-form
140
216
  * peer of a `workers` entry (which registers a procedural workflow). Hand-author
@@ -158,6 +234,22 @@ export interface LTGraphWorkflowConfig {
158
234
  tags?: string[];
159
235
  }
160
236
  export interface LTStartConfig {
237
+ /**
238
+ * Who owns declared configuration after first boot.
239
+ *
240
+ * - `'db'` (default) — declarations are seeded insert-if-absent; the DB
241
+ * owns each record once it exists, and code/DB drift is warn-logged.
242
+ * - `'code'` — declarations are compared and applied on EVERY boot; code
243
+ * is the source of truth and dashboard edits to declared surfaces are
244
+ * replaced at the next deploy. Records present in the DB but absent from
245
+ * code are reported at boot, never deleted. Versioned role schemas
246
+ * advance (snapshot + increment) when the declared schema differs —
247
+ * version lineage only grows.
248
+ *
249
+ * Every declarable entry (worker config, role, topic, MCP server, agent)
250
+ * accepts a per-entry `reset` override in either direction.
251
+ */
252
+ configSource?: 'code' | 'db';
161
253
  /** PostgreSQL connection. Provide individual fields or a connectionString. */
162
254
  database: {
163
255
  host?: string;
@@ -372,9 +464,14 @@ export interface LTStartConfig {
372
464
  * a few sample workflows so the dashboard has data immediately.
373
465
  */
374
466
  examples?: boolean;
375
- /** Declarative topic catalog entries. Seeded on first boot (insert-if-absent). */
467
+ /**
468
+ * Declarative role registrations — titles, versioned form/list schemas,
469
+ * escalation targets, and ops dials, owned per `configSource`.
470
+ */
471
+ roles?: LTRoleConfig[];
472
+ /** Declarative topic catalog entries, owned per `configSource` / per-entry `reset`. */
376
473
  topics?: LTTopicConfig[];
377
- /** Declarative agent configurations. Seeded on first boot (insert-if-absent). */
474
+ /** Declarative agent configurations, owned per `configSource` / per-entry `reset`. */
378
475
  agents?: LTAgentConfig[];
379
476
  /**
380
477
  * Declarative graph (YAML/DAG) workflows — the graph-form peer of `workers`.
@@ -415,6 +512,13 @@ export interface LTStartConfig {
415
512
  * through the MCP `instructions` index and the `get_domain_context` tool.
416
513
  */
417
514
  domainDictionaryPath?: string;
515
+ /**
516
+ * Ownership override for the domain dictionary. `true` → the file is
517
+ * compared and applied on every boot (a changed document bumps the
518
+ * dictionary version, exactly like a PUT); `false` → the DB owns the
519
+ * document after first insert. Omitted → follows `configSource`.
520
+ */
521
+ domainDictionaryReset?: boolean;
418
522
  /**
419
523
  * Controls which tools are exposed when this instance acts as an MCP server.
420
524
  * All fields are optional — omit the entire object for unrestricted access.
@@ -1,2 +1,2 @@
1
- import{j as o}from"./vendor-query-RUZdMvN6.js";import{c as n}from"./tasks-Doy_7cGX.js";import{M as m}from"./index-C991QfUN.js";import{f as c}from"./useEventHooks-ldE5o0ok.js";import{u}from"./mcp-CHPSFv7m.js";import{P as d}from"./PageHeaderWithStats-gT-5ovJh.js";import"./vendor-react-CdqEC2zv.js";import"./vendor-icons-Aw7bzBxa.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-CahUELrr.js.map
1
+ import{j as o}from"./vendor-query-RUZdMvN6.js";import{c as n}from"./tasks-CLyrl-MU.js";import{O as m}from"./index-DBXm49S6.js";import{f as c}from"./useEventHooks-BdWYm63U.js";import{u}from"./mcp-C9Kw4Ow8.js";import{P as d}from"./PageHeaderWithStats-JXeUFa_g.js";import"./vendor-react-CdqEC2zv.js";import"./vendor-icons-BPsNpK3Y.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-D2unnS2b.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminDashboard-CahUELrr.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-D2unnS2b.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 f}from"./vendor-query-RUZdMvN6.js";import{a as le,d as ce,b as oe}from"./agents-BJQtJTiz.js";import{E as de,C as xe,u as pe,a as ue,b as me,c as he}from"./CronLabel-DZ5TmIQG.js";import{b as fe,u as ve,l as be}from"./index-C991QfUN.js";import{P as ye}from"./PageHeader-B7YJxa4o.js";import{B as E,m as U,A as ge,R as Y,e as M,T as Z,ap as G,d as V,ba as ee,a8 as je}from"./vendor-icons-Aw7bzBxa.js";import{e as we}from"./knowledge-CnMeg8Rw.js";import{R as te}from"./RunAsSelector-CB0pV097.js";import{u as Ne}from"./workflows-D09ysQF1.js";import{u as _e}from"./yaml-workflows-BFHrxEl4.js";import{u as se}from"./capabilities-qYrUpdid.js";import{u as ke}from"./topics-BcJS4G09.js";import{W as Q}from"./WorkflowPill-C5TEWlfO.js";import{e as Ce,u as Se,f as qe}from"./vendor-react-CdqEC2zv.js";import"./BotPicker-DN8tq7pz.js";import"./bots-DDlU1gMy.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Ae={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},Oe={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: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 $e(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 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,...c}=x;return JSON.stringify(c,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",O="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:O}),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:O}),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:`${O} 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:`${O} 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}=we(),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:O,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(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-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(""),c=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 l=a?`${a}`:"",d=m?u:l,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:c,type:"text",value:d,onFocus:()=>{i(!0),p(l)},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(ge,{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:c,onMcpPromptChange:h,availableTypes:l=[...Je]}){const{data:d}=Ne(),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:l.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:c??"",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)},c=()=>{a("subscriptions",[...s.subscriptions,{...Ae}]),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))},l=s.subscriptions,d=l[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 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-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(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-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:c,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:[l.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-RUZdMvN6.js";import{a as le,d as ce,b as oe}from"./agents-BTDsRK8e.js";import{E as de,C as xe,u as pe,a as ue,b as me,c as he}from"./CronLabel-HxmsDSnV.js";import{b as fe,u as ve,l as be}from"./index-DBXm49S6.js";import{P as ye}from"./PageHeader-BpeBHqyc.js";import{B as E,m as U,A as ge,R as Y,e as M,T as Z,ap as G,d as V,bb as ee,a8 as je}from"./vendor-icons-BPsNpK3Y.js";import{e as we}from"./knowledge-oFYAanUp.js";import{R as te}from"./RunAsSelector-BFNqQGuG.js";import{u as Ne}from"./workflows-DXz7tZxp.js";import{u as _e}from"./yaml-workflows-u3xuRAnS.js";import{u as se}from"./capabilities-DbTmeW-S.js";import{u as ke}from"./topics-B_gO7CQ0.js";import{W as Q}from"./WorkflowPill-BcA7S3gI.js";import{e as Ce,u as Se,f as qe}from"./vendor-react-CdqEC2zv.js";import"./BotPicker-BN-MKITV.js";import"./bots-DxLrfdfr.js";const X={name:"",description:"",goals:"",rules:"",user_id:"",knowledge_domain:"",subscriptions:[],schedules:[]},Ae={topic:"",filter:"",reaction_type:"durable",workflow_type:"",pipeline_id:"",mcp_prompt:"",server_id:"",tool_name:"",input_mapping:"{}",execute_as:"",enabled:!0},Oe={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: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 $e(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 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,...c}=x;return JSON.stringify(c,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",O="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:O}),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:O}),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:`${O} 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:`${O} 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}=we(),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:O,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(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-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(""),c=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 l=a?`${a}`:"",d=m?u:l,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:c,type:"text",value:d,onFocus:()=>{i(!0),p(l)},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(ge,{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:c,onMcpPromptChange:h,availableTypes:l=[...Je]}){const{data:d}=Ne(),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:l.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:c??"",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)},c=()=>{a("subscriptions",[...s.subscriptions,{...Ae}]),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))},l=s.subscriptions,d=l[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 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-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(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-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:c,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:[l.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:c,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(Ue,{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:`${O} 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:c=>x(r,"cron",c.target.value),placeholder:"0 * * * *",className:`${O} 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:Ye.map(c=>e.jsx("button",{type:"button",onClick:()=>x(r,"cron",c),className:`text-2xs 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,h)=>{x(r,"server_id",c),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: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: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:U,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:Y,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:U},{id:4,label:"Subscriptions",icon:Y},{id:5,label:"Schedules",icon:G},{id:6,label:"Review",icon:je}];function pt(){var H;const{id:s}=Ce(),a=!s,r=Se(),{data:o}=ve(),x=be(),i=(x!==null?x:!!((H=o==null?void 0:o.ai)!=null&&H.enabled))?"Agent":"Automation",{data:u,isLoading:p}=le(a?null:s),{data:c}=pe(a?null:s),h=ce(),l=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 A=new URLSearchParams(N);return A.set("step",String(j)),A},{replace:!0})},[q]);f.useEffect(()=>{if(!b){if(a){n(X),g(!0);return}u&&c&&(n(Re(u,c.subscriptions??[])),g(!0))}},[u,c,a,b]);const I=(j,N)=>n(A=>({...A,[j]:N})),ie=async()=>{R("");try{const j=Ee(t);let N=s;a?N=(await h.mutateAsync(j)).id:await l.mutateAsync({id:s,...j});const A=$e(t),re=(c==null?void 0:c.subscriptions)??[],J=new Set(re.map(C=>C.id));for(const C of A)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||l.isPending;return e.jsxs("div",{children:[e.jsx(ye,{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,A=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 ${A?"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{pt as AgentConfigPage};
16
- //# sourceMappingURL=AgentConfigPage-CkMv-cTV.js.map
16
+ //# sourceMappingURL=AgentConfigPage-CBkf403g.js.map