@hotmeshio/long-tail 0.9.2 → 0.9.3

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 (160) hide show
  1. package/dashboard/dist/assets/{AdminDashboard-JobmypiO.js → AdminDashboard-BONGlQva.js} +2 -2
  2. package/dashboard/dist/assets/{AdminDashboard-JobmypiO.js.map → AdminDashboard-BONGlQva.js.map} +1 -1
  3. package/dashboard/dist/assets/{AgentConfigPage-D_HuaRN9.js → AgentConfigPage-C_NJ4-pr.js} +2 -2
  4. package/dashboard/dist/assets/{AgentConfigPage-D_HuaRN9.js.map → AgentConfigPage-C_NJ4-pr.js.map} +1 -1
  5. package/dashboard/dist/assets/{AgentDetailPage-Cj22NZLI.js → AgentDetailPage-MSCS6bFD.js} +2 -2
  6. package/dashboard/dist/assets/{AgentDetailPage-Cj22NZLI.js.map → AgentDetailPage-MSCS6bFD.js.map} +1 -1
  7. package/dashboard/dist/assets/{AgentsPage-DTKto-gL.js → AgentsPage-PfSvedS-.js} +2 -2
  8. package/dashboard/dist/assets/{AgentsPage-DTKto-gL.js.map → AgentsPage-PfSvedS-.js.map} +1 -1
  9. package/dashboard/dist/assets/{AvailableEscalationsPage-CUvrKkgS.js → AvailableEscalationsPage-DBeBLNWW.js} +2 -2
  10. package/dashboard/dist/assets/{AvailableEscalationsPage-CUvrKkgS.js.map → AvailableEscalationsPage-DBeBLNWW.js.map} +1 -1
  11. package/dashboard/dist/assets/{BotPicker-AwKouk26.js → BotPicker-DmCdoim8.js} +2 -2
  12. package/dashboard/dist/assets/{BotPicker-AwKouk26.js.map → BotPicker-DmCdoim8.js.map} +1 -1
  13. package/dashboard/dist/assets/{CapabilitiesPage-1ZMO_0UU.js → CapabilitiesPage-DVf4zIMZ.js} +2 -2
  14. package/dashboard/dist/assets/{CapabilitiesPage-1ZMO_0UU.js.map → CapabilitiesPage-DVf4zIMZ.js.map} +1 -1
  15. package/dashboard/dist/assets/{CollapsibleSection-D6kUTrq4.js → CollapsibleSection-7ACdYUZy.js} +2 -2
  16. package/dashboard/dist/assets/{CollapsibleSection-D6kUTrq4.js.map → CollapsibleSection-7ACdYUZy.js.map} +1 -1
  17. package/dashboard/dist/assets/{CountdownTimer-Bj9YbInO.js → CountdownTimer-Gbp6RHav.js} +2 -2
  18. package/dashboard/dist/assets/{CountdownTimer-Bj9YbInO.js.map → CountdownTimer-Gbp6RHav.js.map} +1 -1
  19. package/dashboard/dist/assets/{CredentialsPage-D5H_kyRL.js → CredentialsPage-JWCUgQMi.js} +2 -2
  20. package/dashboard/dist/assets/{CredentialsPage-D5H_kyRL.js.map → CredentialsPage-JWCUgQMi.js.map} +1 -1
  21. package/dashboard/dist/assets/{CronLabel-DvmJ0EFz.js → CronLabel-9GtrGEDe.js} +2 -2
  22. package/dashboard/dist/assets/{CronLabel-DvmJ0EFz.js.map → CronLabel-9GtrGEDe.js.map} +1 -1
  23. package/dashboard/dist/assets/{CustomDurationPicker-DT_g8Hr4.js → CustomDurationPicker-xNJMIvjL.js} +2 -2
  24. package/dashboard/dist/assets/{CustomDurationPicker-DT_g8Hr4.js.map → CustomDurationPicker-xNJMIvjL.js.map} +1 -1
  25. package/dashboard/dist/assets/{ElapsedCell-7_8YpC3D.js → ElapsedCell-rRiChKDm.js} +2 -2
  26. package/dashboard/dist/assets/{ElapsedCell-7_8YpC3D.js.map → ElapsedCell-rRiChKDm.js.map} +1 -1
  27. package/dashboard/dist/assets/{EscalationListSchemaPage-ClFRLeKV.js → EscalationListSchemaPage-B7PHz5CB.js} +2 -2
  28. package/dashboard/dist/assets/{EscalationListSchemaPage-ClFRLeKV.js.map → EscalationListSchemaPage-B7PHz5CB.js.map} +1 -1
  29. package/dashboard/dist/assets/{EscalationSchemaPage-BcYcj-b8.js → EscalationSchemaPage-_CbayTDk.js} +2 -2
  30. package/dashboard/dist/assets/{EscalationSchemaPage-BcYcj-b8.js.map → EscalationSchemaPage-_CbayTDk.js.map} +1 -1
  31. package/dashboard/dist/assets/{EscalationsOverview-uHb8ni_5.js → EscalationsOverview-C5bVdGf2.js} +2 -2
  32. package/dashboard/dist/assets/{EscalationsOverview-uHb8ni_5.js.map → EscalationsOverview-C5bVdGf2.js.map} +1 -1
  33. package/dashboard/dist/assets/{EventTable-CkdWqmEL.js → EventTable-DGaRYVnB.js} +2 -2
  34. package/dashboard/dist/assets/{EventTable-CkdWqmEL.js.map → EventTable-DGaRYVnB.js.map} +1 -1
  35. package/dashboard/dist/assets/{GraphInvokePage-C6sfPjSc.js → GraphInvokePage-R6_p2Sy7.js} +2 -2
  36. package/dashboard/dist/assets/{GraphInvokePage-C6sfPjSc.js.map → GraphInvokePage-R6_p2Sy7.js.map} +1 -1
  37. package/dashboard/dist/assets/{HomePage-CUHZxihq.js → HomePage-DHxtqRkD.js} +2 -2
  38. package/dashboard/dist/assets/{HomePage-CUHZxihq.js.map → HomePage-DHxtqRkD.js.map} +1 -1
  39. package/dashboard/dist/assets/{ListToolbar-nWxpujpH.js → ListToolbar-BhXp7clK.js} +2 -2
  40. package/dashboard/dist/assets/{ListToolbar-nWxpujpH.js.map → ListToolbar-BhXp7clK.js.map} +1 -1
  41. package/dashboard/dist/assets/{McpOverview-DXrkDkU-.js → McpOverview-COgIIWkK.js} +2 -2
  42. package/dashboard/dist/assets/{McpOverview-DXrkDkU-.js.map → McpOverview-COgIIWkK.js.map} +1 -1
  43. package/dashboard/dist/assets/{McpQueryDetailPage-CnLYE26v.js → McpQueryDetailPage-4LEqQZax.js} +2 -2
  44. package/dashboard/dist/assets/{McpQueryDetailPage-CnLYE26v.js.map → McpQueryDetailPage-4LEqQZax.js.map} +1 -1
  45. package/dashboard/dist/assets/{McpQueryPage-oE9eWAus.js → McpQueryPage-DWAcSqF-.js} +2 -2
  46. package/dashboard/dist/assets/{McpQueryPage-oE9eWAus.js.map → McpQueryPage-DWAcSqF-.js.map} +1 -1
  47. package/dashboard/dist/assets/{McpRunDetailPage-B7e6AVl1.js → McpRunDetailPage-BNjhOPLp.js} +2 -2
  48. package/dashboard/dist/assets/{McpRunDetailPage-B7e6AVl1.js.map → McpRunDetailPage-BNjhOPLp.js.map} +1 -1
  49. package/dashboard/dist/assets/{McpRunsPage-Bx5DiGk7.js → McpRunsPage-DAjYKqqt.js} +2 -2
  50. package/dashboard/dist/assets/{McpRunsPage-Bx5DiGk7.js.map → McpRunsPage-DAjYKqqt.js.map} +1 -1
  51. package/dashboard/dist/assets/{OperationsPage-BmG3qzdR.js → OperationsPage-5RkfIbtT.js} +2 -2
  52. package/dashboard/dist/assets/{OperationsPage-BmG3qzdR.js.map → OperationsPage-5RkfIbtT.js.map} +1 -1
  53. package/dashboard/dist/assets/{OperatorDashboard-r6hQ57eO.js → OperatorDashboard-B-2dIbj4.js} +2 -2
  54. package/dashboard/dist/assets/{OperatorDashboard-r6hQ57eO.js.map → OperatorDashboard-B-2dIbj4.js.map} +1 -1
  55. package/dashboard/dist/assets/{ProcessDetailPage-C3gE4OHq.js → ProcessDetailPage-Bx7sF-vV.js} +2 -2
  56. package/dashboard/dist/assets/{ProcessDetailPage-C3gE4OHq.js.map → ProcessDetailPage-Bx7sF-vV.js.map} +1 -1
  57. package/dashboard/dist/assets/{ProcessesListPage-DSsIGmBB.js → ProcessesListPage-Dsfc-DX_.js} +2 -2
  58. package/dashboard/dist/assets/{ProcessesListPage-DSsIGmBB.js.map → ProcessesListPage-Dsfc-DX_.js.map} +1 -1
  59. package/dashboard/dist/assets/{RoleDetailPage-DiFISbnq.js → RoleDetailPage-DF-ov9E9.js} +2 -2
  60. package/dashboard/dist/assets/{RoleDetailPage-DiFISbnq.js.map → RoleDetailPage-DF-ov9E9.js.map} +1 -1
  61. package/dashboard/dist/assets/{RolesPage-CE5fui18.js → RolesPage-DIlde9bw.js} +2 -2
  62. package/dashboard/dist/assets/{RolesPage-CE5fui18.js.map → RolesPage-DIlde9bw.js.map} +1 -1
  63. package/dashboard/dist/assets/{RunAsSelector-Ct8NNadu.js → RunAsSelector-DOYUYXcD.js} +2 -2
  64. package/dashboard/dist/assets/{RunAsSelector-Ct8NNadu.js.map → RunAsSelector-DOYUYXcD.js.map} +1 -1
  65. package/dashboard/dist/assets/{StickyPagination-BfgBtP_B.js → StickyPagination-BwXLmDc-.js} +2 -2
  66. package/dashboard/dist/assets/{StickyPagination-BfgBtP_B.js.map → StickyPagination-BwXLmDc-.js.map} +1 -1
  67. package/dashboard/dist/assets/{StreamMessageDetail-2rwp7Ynx.js → StreamMessageDetail-CCez20kE.js} +2 -2
  68. package/dashboard/dist/assets/{StreamMessageDetail-2rwp7Ynx.js.map → StreamMessageDetail-CCez20kE.js.map} +1 -1
  69. package/dashboard/dist/assets/{SwimlaneTimeline-BwWyYBCo.js → SwimlaneTimeline-hcWBunXb.js} +2 -2
  70. package/dashboard/dist/assets/{SwimlaneTimeline-BwWyYBCo.js.map → SwimlaneTimeline-hcWBunXb.js.map} +1 -1
  71. package/dashboard/dist/assets/{TaskDetailPage-BUKHu2oD.js → TaskDetailPage-CIarmoAk.js} +2 -2
  72. package/dashboard/dist/assets/{TaskDetailPage-BUKHu2oD.js.map → TaskDetailPage-CIarmoAk.js.map} +1 -1
  73. package/dashboard/dist/assets/{TasksListPage-C_PwExQC.js → TasksListPage-CFqMwhLE.js} +2 -2
  74. package/dashboard/dist/assets/{TasksListPage-C_PwExQC.js.map → TasksListPage-CFqMwhLE.js.map} +1 -1
  75. package/dashboard/dist/assets/{TimeAgo-Bagm-L2o.js → TimeAgo-CuI-66Kw.js} +2 -2
  76. package/dashboard/dist/assets/{TimeAgo-Bagm-L2o.js.map → TimeAgo-CuI-66Kw.js.map} +1 -1
  77. package/dashboard/dist/assets/{TimestampCell-BwDo7knq.js → TimestampCell-BI3Uptj8.js} +2 -2
  78. package/dashboard/dist/assets/{TimestampCell-BwDo7knq.js.map → TimestampCell-BI3Uptj8.js.map} +1 -1
  79. package/dashboard/dist/assets/{ToolTestPanel-CVZ2M1yv.js → ToolTestPanel-QwGyWRfG.js} +2 -2
  80. package/dashboard/dist/assets/{ToolTestPanel-CVZ2M1yv.js.map → ToolTestPanel-QwGyWRfG.js.map} +1 -1
  81. package/dashboard/dist/assets/{TopicDetailPage-DKAvbkxD.js → TopicDetailPage-CGCiqQGf.js} +2 -2
  82. package/dashboard/dist/assets/{TopicDetailPage-DKAvbkxD.js.map → TopicDetailPage-CGCiqQGf.js.map} +1 -1
  83. package/dashboard/dist/assets/{TopicsPage-BZknsApe.js → TopicsPage-Bk8-inSO.js} +2 -2
  84. package/dashboard/dist/assets/{TopicsPage-BZknsApe.js.map → TopicsPage-Bk8-inSO.js.map} +1 -1
  85. package/dashboard/dist/assets/{UserName-ByDxLHPZ.js → UserName-BOaihCFP.js} +2 -2
  86. package/dashboard/dist/assets/{UserName-ByDxLHPZ.js.map → UserName-BOaihCFP.js.map} +1 -1
  87. package/dashboard/dist/assets/{WorkflowExecutionPage-DrwKB2x8.js → WorkflowExecutionPage-CE0QzhIt.js} +2 -2
  88. package/dashboard/dist/assets/{WorkflowExecutionPage-DrwKB2x8.js.map → WorkflowExecutionPage-CE0QzhIt.js.map} +1 -1
  89. package/dashboard/dist/assets/{WorkflowsDashboard-DEq9fkhl.js → WorkflowsDashboard-wgWRZOnB.js} +2 -2
  90. package/dashboard/dist/assets/{WorkflowsDashboard-DEq9fkhl.js.map → WorkflowsDashboard-wgWRZOnB.js.map} +1 -1
  91. package/dashboard/dist/assets/{WorkflowsOverview-l-0KYP7Y.js → WorkflowsOverview-CLyitES7.js} +2 -2
  92. package/dashboard/dist/assets/{WorkflowsOverview-l-0KYP7Y.js.map → WorkflowsOverview-CLyitES7.js.map} +1 -1
  93. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BgimL3VT.js → YamlWorkflowDetailPage-pP2i1ptj.js} +2 -2
  94. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BgimL3VT.js.map → YamlWorkflowDetailPage-pP2i1ptj.js.map} +1 -1
  95. package/dashboard/dist/assets/{YamlWorkflowsPage-CabXXA9r.js → YamlWorkflowsPage-BwQSMfYw.js} +2 -2
  96. package/dashboard/dist/assets/{YamlWorkflowsPage-CabXXA9r.js.map → YamlWorkflowsPage-BwQSMfYw.js.map} +1 -1
  97. package/dashboard/dist/assets/{agents-D_L6lV0f.js → agents-CRtBacrZ.js} +2 -2
  98. package/dashboard/dist/assets/{agents-D_L6lV0f.js.map → agents-CRtBacrZ.js.map} +1 -1
  99. package/dashboard/dist/assets/{bots-wdZz1nJw.js → bots-FjzeqLzA.js} +2 -2
  100. package/dashboard/dist/assets/{bots-wdZz1nJw.js.map → bots-FjzeqLzA.js.map} +1 -1
  101. package/dashboard/dist/assets/{capabilities-C35_V8eu.js → capabilities-CB0y1ZCx.js} +2 -2
  102. package/dashboard/dist/assets/{capabilities-C35_V8eu.js.map → capabilities-CB0y1ZCx.js.map} +1 -1
  103. package/dashboard/dist/assets/{controlplane-kR2P6zYv.js → controlplane-ZJtfQopv.js} +2 -2
  104. package/dashboard/dist/assets/{controlplane-kR2P6zYv.js.map → controlplane-ZJtfQopv.js.map} +1 -1
  105. package/dashboard/dist/assets/{escalation-columns-BVj16HuR.js → escalation-columns-735GLlEN.js} +2 -2
  106. package/dashboard/dist/assets/{escalation-columns-BVj16HuR.js.map → escalation-columns-735GLlEN.js.map} +1 -1
  107. package/dashboard/dist/assets/{index-CJFA7aLp.js → index-AUrwksY_.js} +2 -2
  108. package/dashboard/dist/assets/{index-CJFA7aLp.js.map → index-AUrwksY_.js.map} +1 -1
  109. package/dashboard/dist/assets/{index-C75E0-Wd.js → index-BH0BQHF-.js} +2 -2
  110. package/dashboard/dist/assets/{index-C75E0-Wd.js.map → index-BH0BQHF-.js.map} +1 -1
  111. package/dashboard/dist/assets/{index-DIrYjyRG.js → index-BTrN5iqE.js} +3 -3
  112. package/dashboard/dist/assets/{index-DIrYjyRG.js.map → index-BTrN5iqE.js.map} +1 -1
  113. package/dashboard/dist/assets/{index-wZzl3bcK.js → index-B_pZXTTp.js} +2 -2
  114. package/dashboard/dist/assets/{index-wZzl3bcK.js.map → index-B_pZXTTp.js.map} +1 -1
  115. package/dashboard/dist/assets/{index-BMQopgAx.js → index-Bho1kYrO.js} +2 -2
  116. package/dashboard/dist/assets/{index-BMQopgAx.js.map → index-Bho1kYrO.js.map} +1 -1
  117. package/dashboard/dist/assets/{index-1WCiN-pF.js → index-CzYOxahh.js} +2 -2
  118. package/dashboard/dist/assets/{index-1WCiN-pF.js.map → index-CzYOxahh.js.map} +1 -1
  119. package/dashboard/dist/assets/{index-B4zWCfQr.js → index-D4z4fzW5.js} +2 -2
  120. package/dashboard/dist/assets/{index-B4zWCfQr.js.map → index-D4z4fzW5.js.map} +1 -1
  121. package/dashboard/dist/assets/{index-BZfX_ziz.js → index-DiCp9bmR.js} +2 -2
  122. package/dashboard/dist/assets/{index-BZfX_ziz.js.map → index-DiCp9bmR.js.map} +1 -1
  123. package/dashboard/dist/assets/{index-BmbO85oT.js → index-DlrsXckY.js} +2 -2
  124. package/dashboard/dist/assets/{index-BmbO85oT.js.map → index-DlrsXckY.js.map} +1 -1
  125. package/dashboard/dist/assets/{index-so192yXP.js → index-DpGeD89g.js} +3 -3
  126. package/dashboard/dist/assets/{index-so192yXP.js.map → index-DpGeD89g.js.map} +1 -1
  127. package/dashboard/dist/assets/{index-xBNf5aFb.js → index-DzIB5CaR.js} +2 -2
  128. package/dashboard/dist/assets/{index-xBNf5aFb.js.map → index-DzIB5CaR.js.map} +1 -1
  129. package/dashboard/dist/assets/{index-BfDn7j4K.js → index-GRckVBX1.js} +2 -2
  130. package/dashboard/dist/assets/{index-BfDn7j4K.js.map → index-GRckVBX1.js.map} +1 -1
  131. package/dashboard/dist/assets/{index-QOTnrFd1.js → index-iEn58vjL.js} +2 -2
  132. package/dashboard/dist/assets/{index-QOTnrFd1.js.map → index-iEn58vjL.js.map} +1 -1
  133. package/dashboard/dist/assets/{knowledge-DDt599ea.js → knowledge-Bw51BCX9.js} +2 -2
  134. package/dashboard/dist/assets/{knowledge-DDt599ea.js.map → knowledge-Bw51BCX9.js.map} +1 -1
  135. package/dashboard/dist/assets/{mcp-BPXRXEje.js → mcp-D4KRVy2a.js} +2 -2
  136. package/dashboard/dist/assets/{mcp-BPXRXEje.js.map → mcp-D4KRVy2a.js.map} +1 -1
  137. package/dashboard/dist/assets/{mcp-query-HUZuboi-.js → mcp-query-0Zo3GwTv.js} +2 -2
  138. package/dashboard/dist/assets/{mcp-query-HUZuboi-.js.map → mcp-query-0Zo3GwTv.js.map} +1 -1
  139. package/dashboard/dist/assets/{pipelines-CH8q3ok_.js → pipelines-B8sOpeCD.js} +2 -2
  140. package/dashboard/dist/assets/{pipelines-CH8q3ok_.js.map → pipelines-B8sOpeCD.js.map} +1 -1
  141. package/dashboard/dist/assets/{roles-B7rzw8wD.js → roles-Bs6hUrQJ.js} +2 -2
  142. package/dashboard/dist/assets/{roles-B7rzw8wD.js.map → roles-Bs6hUrQJ.js.map} +1 -1
  143. package/dashboard/dist/assets/{tasks-j-mVt2EA.js → tasks-KDV3bflF.js} +2 -2
  144. package/dashboard/dist/assets/{tasks-j-mVt2EA.js.map → tasks-KDV3bflF.js.map} +1 -1
  145. package/dashboard/dist/assets/{topics-DATyaYWW.js → topics-BS_n738l.js} +2 -2
  146. package/dashboard/dist/assets/{topics-DATyaYWW.js.map → topics-BS_n738l.js.map} +1 -1
  147. package/dashboard/dist/assets/{useEventHooks-CwIAhqJk.js → useEventHooks-RbAigCWV.js} +2 -2
  148. package/dashboard/dist/assets/{useEventHooks-CwIAhqJk.js.map → useEventHooks-RbAigCWV.js.map} +1 -1
  149. package/dashboard/dist/assets/{useNamespace-hV7rcAfa.js → useNamespace-ChDZWKAd.js} +2 -2
  150. package/dashboard/dist/assets/{useNamespace-hV7rcAfa.js.map → useNamespace-ChDZWKAd.js.map} +1 -1
  151. package/dashboard/dist/assets/{useYamlActivityEvents-Dwuuu3F0.js → useYamlActivityEvents-6xNaRNAc.js} +2 -2
  152. package/dashboard/dist/assets/{useYamlActivityEvents-Dwuuu3F0.js.map → useYamlActivityEvents-6xNaRNAc.js.map} +1 -1
  153. package/dashboard/dist/assets/{users-DS9yeHe4.js → users-BPt2YERY.js} +2 -2
  154. package/dashboard/dist/assets/{users-DS9yeHe4.js.map → users-BPt2YERY.js.map} +1 -1
  155. package/dashboard/dist/assets/{workflows-FF8WUHaC.js → workflows-BaSjfNsd.js} +2 -2
  156. package/dashboard/dist/assets/{workflows-FF8WUHaC.js.map → workflows-BaSjfNsd.js.map} +1 -1
  157. package/dashboard/dist/assets/{yaml-workflows-y-eo6Rwj.js → yaml-workflows-Be3rM5i2.js} +2 -2
  158. package/dashboard/dist/assets/{yaml-workflows-y-eo6Rwj.js.map → yaml-workflows-Be3rM5i2.js.map} +1 -1
  159. package/dashboard/dist/index.html +1 -1
  160. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{d as z,h as U,u as H,i as K,b as V}from"./workflows-FF8WUHaC.js";import{F as X,b as Y,a as G}from"./FilterBar-DDIn8TOs.js";import{C as O}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as D}from"./RolePill-ColM_ynA.js";import{W as Z}from"./WorkflowPill-BXmmLR0t.js";import{P as ee}from"./PageHeader-Ji1AtA4f.js";import{t as te,ap as I,ar as $,av as se,P as L,aw as re,ax as W,y as ne,U as T,X as oe,i as ae,V as ie,C as le}from"./vendor-icons-BX2Vih4L.js";import{c as Q,e as ce,f as de}from"./vendor-react-CXumBFUA.js";import{u as ue}from"./roles-B7rzw8wD.js";import{B as me}from"./BotPicker-AwKouk26.js";import{N as xe}from"./NamespacePill-BlhSWa5S.js";import"./index-so192yXP.js";import"./Modal-CSrxpXeM.js";import"./bots-wdZz1nJw.js";function pe({tier:t}){return t==="certified"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-status-success",children:[e.jsx($,{className:"w-3 h-3"}),"Certified"]}):t==="registered"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary",children:[e.jsx(ne,{className:"w-3 h-3"}),"Registered"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary",children:[e.jsx(I,{className:"w-3 h-3"}),"Durable"]})}function Ue(){const t=Q(),{data:o,isLoading:u}=z(),x=U(),[c,g]=m.useState(""),[s,v]=m.useState(null),[j,k]=m.useState(null),l=o??[],f=m.useMemo(()=>[...new Set(l.map(a=>a.task_queue).filter(Boolean))].sort(),[l]),i=m.useMemo(()=>{const a=c.toLowerCase().trim();return(s?[s]:f).map(p=>({queue:p,workflows:l.filter(b=>{var h;return b.task_queue===p&&(!a||b.workflow_type.toLowerCase().includes(a)||((h=b.description)==null?void 0:h.toLowerCase().includes(a)))})})).filter(p=>p.workflows.length>0)},[l,f,c,s]),d=m.useMemo(()=>{const a=c.toLowerCase().trim();return s?[]:l.filter(w=>{var p;return!w.task_queue&&(!a||w.workflow_type.toLowerCase().includes(a)||((p=w.description)==null?void 0:p.toLowerCase().includes(a)))})},[l,c,s]),r=a=>{a.registered?t(`/workflows/registry/${encodeURIComponent(a.workflow_type)}`):t(`/workflows/registry/new?workflow_type=${encodeURIComponent(a.workflow_type)}&task_queue=${encodeURIComponent(a.task_queue??"")}`)},C=()=>{j&&x.mutate(j,{onSuccess:()=>k(null)})};return e.jsxs("div",{children:[e.jsx(ee,{title:"Registered Workflows",docsHash:"#docs:dashboard.md:workflow-registry",actions:e.jsx("button",{onClick:()=>t("/workflows/registry/new"),className:"btn-primary text-xs",children:"Register Workflow"})}),!u&&f.length>0&&e.jsxs(X,{children:[e.jsx(Y,{label:"Queue",value:s??"",onChange:a=>v(a||null),options:f.map(a=>({value:a,label:a}))}),e.jsx(G,{label:"Search",value:c,onChange:g,placeholder:`${l.length} workflows…`})]}),u?e.jsx(he,{}):i.length===0&&d.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:c||s?"No workflows match your filter.":"No workflows discovered yet."}):e.jsxs("div",{className:"space-y-10",children:[i.map(({queue:a,workflows:w})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(te,{className:"w-3 h-3 text-accent",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:a}),e.jsx("span",{className:"text-xs text-text-quaternary",children:w.length})]}),e.jsx(E,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:w.map(p=>e.jsx(F,{wf:p,onRowClick:r,onDelete:k,onNavigate:t},p.workflow_type))})]},a)),d.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(I,{className:"w-3 h-3 text-text-quaternary",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:"No Queue"}),e.jsx("span",{className:"text-xs text-text-quaternary",children:d.length})]}),e.jsx(E,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:d.map(a=>e.jsx(F,{wf:a,onRowClick:r,onDelete:k,onNavigate:t},a.workflow_type))})]})]}),e.jsx(O,{open:!!j,onClose:()=>k(null),onConfirm:C,title:"Unregister Workflow",description:e.jsxs(e.Fragment,{children:["Delete the registration for"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:j}),"? This removes its invocation settings, certification, and interceptor treatment; the workflow keeps running as a plain durable workflow. To demote certified → registered instead, open the workflow and uncheck Certify — that keeps every setting."]}),isPending:x.isPending,error:x.error})]})}const J="grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6";function E(){return e.jsxs("div",{className:`${J} px-3 pb-2 pt-1`,children:[e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Workflow"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Tier"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Access"}),e.jsx("span",{})]})}function F({wf:t,onRowClick:o,onDelete:u,onNavigate:x}){const c=t.roles??[],g=t.invocation_roles??[];return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(t),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&o(t)},className:`group ${J} py-2 px-3 -mx-3 rounded-md cursor-pointer transition-colors items-center`,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(Z,{type:t.workflow_type,size:"md",variant:t.tier==="certified"?"certified":t.tier==="registered"?"registered":"durable"}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-[10px] text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description})]}),e.jsx("div",{children:e.jsx(pe,{tier:t.tier??"durable"})}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap",children:[c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Escalation roles",children:e.jsx($,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),c.map(s=>e.jsx(D,{role:s},`e-${s}`))]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Invocation roles",children:e.jsx(se,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),g.map(s=>e.jsx(D,{role:s},`i-${s}`))]}),c.length===0&&g.length===0&&e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.invocable&&e.jsx("button",{title:"Invoke workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/start?type=${encodeURIComponent(t.workflow_type)}&mode=now`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(L,{className:"w-3.5 h-3.5"})}),t.tier==="durable"&&e.jsx("button",{title:"Configure workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/registry/new?workflow_type=${encodeURIComponent(t.workflow_type)}&task_queue=${encodeURIComponent(t.task_queue??"")}`)},className:"text-text-quaternary hover:text-status-info transition-colors",children:e.jsx(I,{className:"w-3.5 h-3.5"})}),t.tier==="registered"&&e.jsx("button",{title:"Certify workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/registry/${encodeURIComponent(t.workflow_type)}`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(re,{className:"w-3.5 h-3.5"})}),t.registered&&e.jsx("button",{title:"Unregister workflow",onClick:s=>{s.stopPropagation(),u(t.workflow_type)},className:"text-text-quaternary hover:text-status-warning transition-colors",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]})]})}function he(){return e.jsx("div",{className:"animate-pulse space-y-8 mt-4",children:[1,2].map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-36 mb-4"}),e.jsx("div",{className:"space-y-4",children:[1,2,3].map(o=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]},o))})]},t))})}function fe({selected:t,onChange:o,single:u,placeholder:x}){const{data:c}=ue(),g=(c==null?void 0:c.roles)??[],[s,v]=m.useState(!1),j=m.useRef(null);m.useEffect(()=>{const i=d=>{j.current&&!j.current.contains(d.target)&&v(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]);const k=i=>{u?(o(t.includes(i)?[]:[i]),v(!1)):o(t.includes(i)?t.filter(d=>d!==i):[...t,i])},l=i=>{o(t.filter(d=>d!==i))},f=x??(u?"Select role...":"Add roles...");return e.jsxs("div",{ref:j,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>v(!s),className:"flex flex-wrap items-center gap-1.5 w-full min-h-[34px] px-2 py-1.5 bg-surface-sunken border border-surface-border rounded-md text-left cursor-pointer hover:border-accent/40 transition-colors focus:ring-1 focus:ring-accent focus:outline-none",children:[t.length===0&&e.jsx("span",{className:"text-xs text-text-tertiary",children:f}),t.map(i=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-[11px]",children:[e.jsx(T,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),i,e.jsx("span",{role:"button",onClick:d=>{d.stopPropagation(),l(i)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(oe,{className:"w-2.5 h-2.5"})})]},i)),e.jsx(ae,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${s?"rotate-180":""}`})]}),s&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:g.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No roles defined"}):g.map(i=>{const d=t.includes(i);return e.jsxs("button",{type:"button",onClick:()=>k(i),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${d?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(T,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:i}),d&&e.jsx(ie,{className:"w-3 h-3 shrink-0"})]},i)})})]})}function S(t){return t.split(",").map(o=>o.trim()).filter(Boolean)}const R={workflow_type:"",description:"",task_queue:"",default_role:"reviewer",invocable:!1,roles:"",invocation_roles:"",consumes:"",envelope_schema:"",resolver_schema:"",cron_schedule:"",execute_as:"",certified:!1};function we(t){const o=(t.roles??[]).join(", "),u=(t.consumes??[]).join(", ");return{workflow_type:t.workflow_type,description:t.description??"",task_queue:t.task_queue??"",default_role:t.default_role,invocable:t.invocable,roles:o,invocation_roles:(t.invocation_roles??[]).join(", "),consumes:u,envelope_schema:t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):"",resolver_schema:t.resolver_schema?JSON.stringify(t.resolver_schema,null,2):"",cron_schedule:t.cron_schedule??"",execute_as:t.execute_as??"",certified:t.certified}}function q(t){if(!t.trim())return!0;try{return JSON.parse(t),!0}catch{return!1}}function P({icon:t,color:o,children:u}){return e.jsxs("div",{className:"flex items-center gap-2 mb-4 pb-2 border-b border-surface-border",children:[e.jsx(t,{className:`w-4 h-4 ${o}`,strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:u})]})}function _({label:t,hint:o,children:u}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"label",children:t}),u,o&&e.jsx("p",{className:"hint",children:o})]})}const ge="input-json w-full";function je(t){return S(t)}function ve(t){return t.join(", ")}const ke=new Set(["mcpQuery","mcpDeterministic","mcpQueryRouter","mcpTriage","mcpTriageRouter","mcpTriageDeterministic","insightQuery"]);function Oe(){const{workflowType:t}=ce(),o=!t,u=Q(),[x]=de(),{data:c,isLoading:g}=H(),s=K(),v=U(),[j,k]=m.useState(!1),l=(c==null?void 0:c.find(n=>n.workflow_type===t))??null,{data:f}=V({limit:500}),i=m.useMemo(()=>{const n=new Set((c??[]).map(N=>N.workflow_type));return[...new Set(((f==null?void 0:f.jobs)??[]).map(N=>N.entity))].filter(N=>!n.has(N)&&!ke.has(N)).sort()},[c,f]),d=m.useMemo(()=>{if(!o)return R;const n=x.get("workflow_type")??"",y=x.get("task_queue")??"";return n||y?{...R,workflow_type:n,task_queue:y}:R},[o,x]),[r,C]=m.useState(d),[a,w]=m.useState(""),[p,b]=m.useState(!1),h=m.useCallback((n,y)=>C(N=>({...N,[n]:y})),[]);m.useEffect(()=>{if(!p){if(o){C(d),b(!0);return}l&&(C(we(l)),b(!0))}},[l,o,p,d]);const M=()=>{if(!r.workflow_type.trim())return;w("");let n=null,y=null;try{r.envelope_schema.trim()&&(n=JSON.parse(r.envelope_schema))}catch{w("Invalid JSON in Envelope Schema");return}try{r.resolver_schema.trim()&&(y=JSON.parse(r.resolver_schema))}catch{w("Invalid JSON in Resolver Schema");return}s.mutate({workflow_type:r.workflow_type.trim(),description:r.description.trim()||null,task_queue:r.task_queue.trim()||null,default_role:r.default_role.trim()||"reviewer",invocable:r.invocable,certified:r.certified,roles:S(r.roles),invocation_roles:S(r.invocation_roles),consumes:S(r.consumes),envelope_schema:n,resolver_schema:y,cron_schedule:r.cron_schedule.trim()||null,execute_as:r.execute_as.trim()||null},{onSuccess:()=>u("/workflows/registry")})};if(g)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});if(!o&&!l)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Config not found."});const A=!!r.workflow_type.trim()&&q(r.envelope_schema)&&q(r.resolver_schema),B=o&&!r.workflow_type&&i.length>0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-light font-mono text-text-primary",children:o?"New Workflow":(l==null?void 0:l.workflow_type)??""}),l&&e.jsx("div",{className:"flex items-center gap-2 mt-2",children:e.jsx(xe,{namespace:"durable"})})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("button",{onClick:()=>u("/workflows/registry"),className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:M,disabled:!A||s.isPending,className:"btn-primary text-xs",children:s.isPending?"Saving…":o?"Register":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10",children:[e.jsxs("div",{children:[e.jsx(P,{icon:le,color:"text-accent",children:"Identity"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(_,{label:"Workflow Type",hint:"Register a workflow to configure invocation and HITL escalation routing.",children:B?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-text-secondary",children:"Select a durable workflow to register:"}),e.jsx("div",{className:"grid gap-1",children:i.map(n=>e.jsx("button",{onClick:()=>h("workflow_type",n),className:"flex items-center gap-2 px-3 py-2 text-left text-xs font-mono rounded-md border border-surface-border hover:border-accent/50 hover:bg-accent/[0.04] transition-colors",children:n},n))}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"or"}),e.jsx("input",{type:"text",onChange:n=>h("workflow_type",n.target.value),placeholder:"Enter type manually",className:"input font-mono flex-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:r.workflow_type,onChange:n=>h("workflow_type",n.target.value),disabled:!o,placeholder:"reviewContent",className:"input font-mono w-full"}),o&&r.workflow_type&&i.length>0&&e.jsx("button",{onClick:()=>h("workflow_type",""),className:"text-[10px] text-accent hover:underline mt-1",children:"Choose from durable workflows"})]})}),e.jsx(_,{label:"Description",children:e.jsx("input",{type:"text",value:r.description,onChange:n=>h("description",n.target.value),placeholder:"Describe what this workflow does",className:"input text-xs w-full"})}),e.jsx(_,{label:"Task Queue",hint:"Durable task queue this workflow listens on.",children:e.jsx("input",{type:"text",value:r.task_queue,onChange:n=>h("task_queue",n.target.value),placeholder:"lt-review",className:"input font-mono w-full"})})]})]}),e.jsxs("div",{children:[e.jsx(P,{icon:L,color:"text-accent",children:"Invocation"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:r.invocable,onChange:n=>h("invocable",n.target.checked),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-primary font-medium",children:"Invocable"})]}),e.jsx("p",{className:"hint",children:"Allow this workflow to be started from the dashboard or API."})]}),r.invocable?e.jsxs(e.Fragment,{children:[e.jsx(_,{label:"Run As",hint:"Bot identity to run under. Default runs as the invoking user.",children:e.jsx(me,{selected:r.execute_as,onChange:n=>h("execute_as",n)})}),e.jsx(_,{label:"Invocation Roles",hint:"Only users with these roles can start this workflow. Empty = all authenticated users.",children:e.jsx(fe,{selected:je(r.invocation_roles),onChange:n=>h("invocation_roles",ve(n)),placeholder:"Select roles…"})}),e.jsxs(_,{label:"Envelope Schema",hint:e.jsxs(e.Fragment,{children:["Pre-fills the JSON editor when invoking. Include ",e.jsx("code",{className:"font-mono",children:"data"})," (input) and optional ",e.jsx("code",{className:"font-mono",children:"metadata"}),"."]}),children:[e.jsx("textarea",{value:r.envelope_schema,onChange:n=>h("envelope_schema",n.target.value),placeholder:`{
1
+ import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{d as z,h as U,u as H,i as K,b as V}from"./workflows-BaSjfNsd.js";import{F as X,b as Y,a as G}from"./FilterBar-DDIn8TOs.js";import{C as O}from"./ConfirmDeleteModal-D9_1b4MW.js";import{R as D}from"./RolePill-ColM_ynA.js";import{W as Z}from"./WorkflowPill-BXmmLR0t.js";import{P as ee}from"./PageHeader-Ji1AtA4f.js";import{t as te,ap as I,ar as $,av as se,P as L,aw as re,ax as W,y as ne,U as T,X as oe,i as ae,V as ie,C as le}from"./vendor-icons-BX2Vih4L.js";import{c as Q,e as ce,f as de}from"./vendor-react-CXumBFUA.js";import{u as ue}from"./roles-Bs6hUrQJ.js";import{B as me}from"./BotPicker-DmCdoim8.js";import{N as xe}from"./NamespacePill-BlhSWa5S.js";import"./index-DpGeD89g.js";import"./Modal-CSrxpXeM.js";import"./bots-FjzeqLzA.js";function pe({tier:t}){return t==="certified"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-status-success",children:[e.jsx($,{className:"w-3 h-3"}),"Certified"]}):t==="registered"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary",children:[e.jsx(ne,{className:"w-3 h-3"}),"Registered"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary",children:[e.jsx(I,{className:"w-3 h-3"}),"Durable"]})}function Ue(){const t=Q(),{data:o,isLoading:u}=z(),x=U(),[c,g]=m.useState(""),[s,v]=m.useState(null),[j,k]=m.useState(null),l=o??[],f=m.useMemo(()=>[...new Set(l.map(a=>a.task_queue).filter(Boolean))].sort(),[l]),i=m.useMemo(()=>{const a=c.toLowerCase().trim();return(s?[s]:f).map(p=>({queue:p,workflows:l.filter(b=>{var h;return b.task_queue===p&&(!a||b.workflow_type.toLowerCase().includes(a)||((h=b.description)==null?void 0:h.toLowerCase().includes(a)))})})).filter(p=>p.workflows.length>0)},[l,f,c,s]),d=m.useMemo(()=>{const a=c.toLowerCase().trim();return s?[]:l.filter(w=>{var p;return!w.task_queue&&(!a||w.workflow_type.toLowerCase().includes(a)||((p=w.description)==null?void 0:p.toLowerCase().includes(a)))})},[l,c,s]),r=a=>{a.registered?t(`/workflows/registry/${encodeURIComponent(a.workflow_type)}`):t(`/workflows/registry/new?workflow_type=${encodeURIComponent(a.workflow_type)}&task_queue=${encodeURIComponent(a.task_queue??"")}`)},C=()=>{j&&x.mutate(j,{onSuccess:()=>k(null)})};return e.jsxs("div",{children:[e.jsx(ee,{title:"Registered Workflows",docsHash:"#docs:dashboard.md:workflow-registry",actions:e.jsx("button",{onClick:()=>t("/workflows/registry/new"),className:"btn-primary text-xs",children:"Register Workflow"})}),!u&&f.length>0&&e.jsxs(X,{children:[e.jsx(Y,{label:"Queue",value:s??"",onChange:a=>v(a||null),options:f.map(a=>({value:a,label:a}))}),e.jsx(G,{label:"Search",value:c,onChange:g,placeholder:`${l.length} workflows…`})]}),u?e.jsx(he,{}):i.length===0&&d.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:c||s?"No workflows match your filter.":"No workflows discovered yet."}):e.jsxs("div",{className:"space-y-10",children:[i.map(({queue:a,workflows:w})=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(te,{className:"w-3 h-3 text-accent",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:a}),e.jsx("span",{className:"text-xs text-text-quaternary",children:w.length})]}),e.jsx(E,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:w.map(p=>e.jsx(F,{wf:p,onRowClick:r,onDelete:k,onNavigate:t},p.workflow_type))})]},a)),d.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border",children:[e.jsx(I,{className:"w-3 h-3 text-text-quaternary",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:"No Queue"}),e.jsx("span",{className:"text-xs text-text-quaternary",children:d.length})]}),e.jsx(E,{}),e.jsx("div",{className:"divide-y divide-surface-border/30",children:d.map(a=>e.jsx(F,{wf:a,onRowClick:r,onDelete:k,onNavigate:t},a.workflow_type))})]})]}),e.jsx(O,{open:!!j,onClose:()=>k(null),onConfirm:C,title:"Unregister Workflow",description:e.jsxs(e.Fragment,{children:["Delete the registration for"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:j}),"? This removes its invocation settings, certification, and interceptor treatment; the workflow keeps running as a plain durable workflow. To demote certified → registered instead, open the workflow and uncheck Certify — that keeps every setting."]}),isPending:x.isPending,error:x.error})]})}const J="grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6";function E(){return e.jsxs("div",{className:`${J} px-3 pb-2 pt-1`,children:[e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Workflow"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Tier"}),e.jsx("span",{className:"text-[10px] font-medium text-text-quaternary",children:"Access"}),e.jsx("span",{})]})}function F({wf:t,onRowClick:o,onDelete:u,onNavigate:x}){const c=t.roles??[],g=t.invocation_roles??[];return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>o(t),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&o(t)},className:`group ${J} py-2 px-3 -mx-3 rounded-md cursor-pointer transition-colors items-center`,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(Z,{type:t.workflow_type,size:"md",variant:t.tier==="certified"?"certified":t.tier==="registered"?"registered":"durable"}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-[10px] text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description})]}),e.jsx("div",{children:e.jsx(pe,{tier:t.tier??"durable"})}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap",children:[c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Escalation roles",children:e.jsx($,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),c.map(s=>e.jsx(D,{role:s},`e-${s}`))]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{title:"Invocation roles",children:e.jsx(se,{className:"w-3 h-3 text-text-quaternary shrink-0"})}),g.map(s=>e.jsx(D,{role:s},`i-${s}`))]}),c.length===0&&g.length===0&&e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.invocable&&e.jsx("button",{title:"Invoke workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/start?type=${encodeURIComponent(t.workflow_type)}&mode=now`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(L,{className:"w-3.5 h-3.5"})}),t.tier==="durable"&&e.jsx("button",{title:"Configure workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/registry/new?workflow_type=${encodeURIComponent(t.workflow_type)}&task_queue=${encodeURIComponent(t.task_queue??"")}`)},className:"text-text-quaternary hover:text-status-info transition-colors",children:e.jsx(I,{className:"w-3.5 h-3.5"})}),t.tier==="registered"&&e.jsx("button",{title:"Certify workflow",onClick:s=>{s.stopPropagation(),x(`/workflows/registry/${encodeURIComponent(t.workflow_type)}`)},className:"text-text-quaternary hover:text-status-success transition-colors",children:e.jsx(re,{className:"w-3.5 h-3.5"})}),t.registered&&e.jsx("button",{title:"Unregister workflow",onClick:s=>{s.stopPropagation(),u(t.workflow_type)},className:"text-text-quaternary hover:text-status-warning transition-colors",children:e.jsx(W,{className:"w-3.5 h-3.5"})})]})]})}function he(){return e.jsx("div",{className:"animate-pulse space-y-8 mt-4",children:[1,2].map(t=>e.jsxs("div",{children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-36 mb-4"}),e.jsx("div",{className:"space-y-4",children:[1,2,3].map(o=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]},o))})]},t))})}function fe({selected:t,onChange:o,single:u,placeholder:x}){const{data:c}=ue(),g=(c==null?void 0:c.roles)??[],[s,v]=m.useState(!1),j=m.useRef(null);m.useEffect(()=>{const i=d=>{j.current&&!j.current.contains(d.target)&&v(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]);const k=i=>{u?(o(t.includes(i)?[]:[i]),v(!1)):o(t.includes(i)?t.filter(d=>d!==i):[...t,i])},l=i=>{o(t.filter(d=>d!==i))},f=x??(u?"Select role...":"Add roles...");return e.jsxs("div",{ref:j,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>v(!s),className:"flex flex-wrap items-center gap-1.5 w-full min-h-[34px] px-2 py-1.5 bg-surface-sunken border border-surface-border rounded-md text-left cursor-pointer hover:border-accent/40 transition-colors focus:ring-1 focus:ring-accent focus:outline-none",children:[t.length===0&&e.jsx("span",{className:"text-xs text-text-tertiary",children:f}),t.map(i=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-[11px]",children:[e.jsx(T,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),i,e.jsx("span",{role:"button",onClick:d=>{d.stopPropagation(),l(i)},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(oe,{className:"w-2.5 h-2.5"})})]},i)),e.jsx(ae,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${s?"rotate-180":""}`})]}),s&&e.jsx("div",{className:"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:g.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No roles defined"}):g.map(i=>{const d=t.includes(i);return e.jsxs("button",{type:"button",onClick:()=>k(i),className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${d?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(T,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsx("span",{className:"flex-1",children:i}),d&&e.jsx(ie,{className:"w-3 h-3 shrink-0"})]},i)})})]})}function S(t){return t.split(",").map(o=>o.trim()).filter(Boolean)}const R={workflow_type:"",description:"",task_queue:"",default_role:"reviewer",invocable:!1,roles:"",invocation_roles:"",consumes:"",envelope_schema:"",resolver_schema:"",cron_schedule:"",execute_as:"",certified:!1};function we(t){const o=(t.roles??[]).join(", "),u=(t.consumes??[]).join(", ");return{workflow_type:t.workflow_type,description:t.description??"",task_queue:t.task_queue??"",default_role:t.default_role,invocable:t.invocable,roles:o,invocation_roles:(t.invocation_roles??[]).join(", "),consumes:u,envelope_schema:t.envelope_schema?JSON.stringify(t.envelope_schema,null,2):"",resolver_schema:t.resolver_schema?JSON.stringify(t.resolver_schema,null,2):"",cron_schedule:t.cron_schedule??"",execute_as:t.execute_as??"",certified:t.certified}}function q(t){if(!t.trim())return!0;try{return JSON.parse(t),!0}catch{return!1}}function P({icon:t,color:o,children:u}){return e.jsxs("div",{className:"flex items-center gap-2 mb-4 pb-2 border-b border-surface-border",children:[e.jsx(t,{className:`w-4 h-4 ${o}`,strokeWidth:1.5}),e.jsx("h2",{className:"section-h2",children:u})]})}function _({label:t,hint:o,children:u}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"label",children:t}),u,o&&e.jsx("p",{className:"hint",children:o})]})}const ge="input-json w-full";function je(t){return S(t)}function ve(t){return t.join(", ")}const ke=new Set(["mcpQuery","mcpDeterministic","mcpQueryRouter","mcpTriage","mcpTriageRouter","mcpTriageDeterministic","insightQuery"]);function Oe(){const{workflowType:t}=ce(),o=!t,u=Q(),[x]=de(),{data:c,isLoading:g}=H(),s=K(),v=U(),[j,k]=m.useState(!1),l=(c==null?void 0:c.find(n=>n.workflow_type===t))??null,{data:f}=V({limit:500}),i=m.useMemo(()=>{const n=new Set((c??[]).map(N=>N.workflow_type));return[...new Set(((f==null?void 0:f.jobs)??[]).map(N=>N.entity))].filter(N=>!n.has(N)&&!ke.has(N)).sort()},[c,f]),d=m.useMemo(()=>{if(!o)return R;const n=x.get("workflow_type")??"",y=x.get("task_queue")??"";return n||y?{...R,workflow_type:n,task_queue:y}:R},[o,x]),[r,C]=m.useState(d),[a,w]=m.useState(""),[p,b]=m.useState(!1),h=m.useCallback((n,y)=>C(N=>({...N,[n]:y})),[]);m.useEffect(()=>{if(!p){if(o){C(d),b(!0);return}l&&(C(we(l)),b(!0))}},[l,o,p,d]);const M=()=>{if(!r.workflow_type.trim())return;w("");let n=null,y=null;try{r.envelope_schema.trim()&&(n=JSON.parse(r.envelope_schema))}catch{w("Invalid JSON in Envelope Schema");return}try{r.resolver_schema.trim()&&(y=JSON.parse(r.resolver_schema))}catch{w("Invalid JSON in Resolver Schema");return}s.mutate({workflow_type:r.workflow_type.trim(),description:r.description.trim()||null,task_queue:r.task_queue.trim()||null,default_role:r.default_role.trim()||"reviewer",invocable:r.invocable,certified:r.certified,roles:S(r.roles),invocation_roles:S(r.invocation_roles),consumes:S(r.consumes),envelope_schema:n,resolver_schema:y,cron_schedule:r.cron_schedule.trim()||null,execute_as:r.execute_as.trim()||null},{onSuccess:()=>u("/workflows/registry")})};if(g)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});if(!o&&!l)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Config not found."});const A=!!r.workflow_type.trim()&&q(r.envelope_schema)&&q(r.resolver_schema),B=o&&!r.workflow_type&&i.length>0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-light font-mono text-text-primary",children:o?"New Workflow":(l==null?void 0:l.workflow_type)??""}),l&&e.jsx("div",{className:"flex items-center gap-2 mt-2",children:e.jsx(xe,{namespace:"durable"})})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("button",{onClick:()=>u("/workflows/registry"),className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:M,disabled:!A||s.isPending,className:"btn-primary text-xs",children:s.isPending?"Saving…":o?"Register":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10",children:[e.jsxs("div",{children:[e.jsx(P,{icon:le,color:"text-accent",children:"Identity"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx(_,{label:"Workflow Type",hint:"Register a workflow to configure invocation and HITL escalation routing.",children:B?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-text-secondary",children:"Select a durable workflow to register:"}),e.jsx("div",{className:"grid gap-1",children:i.map(n=>e.jsx("button",{onClick:()=>h("workflow_type",n),className:"flex items-center gap-2 px-3 py-2 text-left text-xs font-mono rounded-md border border-surface-border hover:border-accent/50 hover:bg-accent/[0.04] transition-colors",children:n},n))}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"or"}),e.jsx("input",{type:"text",onChange:n=>h("workflow_type",n.target.value),placeholder:"Enter type manually",className:"input font-mono flex-1"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:r.workflow_type,onChange:n=>h("workflow_type",n.target.value),disabled:!o,placeholder:"reviewContent",className:"input font-mono w-full"}),o&&r.workflow_type&&i.length>0&&e.jsx("button",{onClick:()=>h("workflow_type",""),className:"text-[10px] text-accent hover:underline mt-1",children:"Choose from durable workflows"})]})}),e.jsx(_,{label:"Description",children:e.jsx("input",{type:"text",value:r.description,onChange:n=>h("description",n.target.value),placeholder:"Describe what this workflow does",className:"input text-xs w-full"})}),e.jsx(_,{label:"Task Queue",hint:"Durable task queue this workflow listens on.",children:e.jsx("input",{type:"text",value:r.task_queue,onChange:n=>h("task_queue",n.target.value),placeholder:"lt-review",className:"input font-mono w-full"})})]})]}),e.jsxs("div",{children:[e.jsx(P,{icon:L,color:"text-accent",children:"Invocation"}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:r.invocable,onChange:n=>h("invocable",n.target.checked),className:"w-4 h-4 rounded border-border accent-accent"}),e.jsx("span",{className:"text-xs text-text-primary font-medium",children:"Invocable"})]}),e.jsx("p",{className:"hint",children:"Allow this workflow to be started from the dashboard or API."})]}),r.invocable?e.jsxs(e.Fragment,{children:[e.jsx(_,{label:"Run As",hint:"Bot identity to run under. Default runs as the invoking user.",children:e.jsx(me,{selected:r.execute_as,onChange:n=>h("execute_as",n)})}),e.jsx(_,{label:"Invocation Roles",hint:"Only users with these roles can start this workflow. Empty = all authenticated users.",children:e.jsx(fe,{selected:je(r.invocation_roles),onChange:n=>h("invocation_roles",ve(n)),placeholder:"Select roles…"})}),e.jsxs(_,{label:"Envelope Schema",hint:e.jsxs(e.Fragment,{children:["Pre-fills the JSON editor when invoking. Include ",e.jsx("code",{className:"font-mono",children:"data"})," (input) and optional ",e.jsx("code",{className:"font-mono",children:"metadata"}),"."]}),children:[e.jsx("textarea",{value:r.envelope_schema,onChange:n=>h("envelope_schema",n.target.value),placeholder:`{
2
2
  "data": {},
3
3
  "metadata": {}
4
4
  }`,className:ge,rows:8,spellCheck:!1}),r.envelope_schema.trim()&&!q(r.envelope_schema)&&e.jsx("p",{className:"text-[10px] text-status-error mt-1",children:"Invalid JSON"})]})]}):e.jsxs("p",{className:"text-[11px] text-text-tertiary py-2",children:["Enable ",e.jsx("span",{className:"font-medium text-text-secondary",children:"Invocable"})," to configure invocation roles and an input template."]})]})]}),l&&e.jsxs("div",{children:[e.jsx(P,{icon:W,color:"text-text-tertiary",children:"Registration"}),e.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 text-[11px] text-status-warning hover:underline",title:"Delete this registration — the workflow returns to plain durable",children:[e.jsx(W,{className:"w-3 h-3"})," Unregister workflow"]})]})]}),(a||s.error)&&e.jsx("p",{className:"text-xs text-status-error mt-8",children:a||s.error.message}),e.jsx(O,{open:j,onClose:()=>k(!1),onConfirm:()=>v.mutate(l.workflow_type,{onSuccess:()=>u("/workflows/registry")}),title:"Unregister Workflow",description:e.jsxs(e.Fragment,{children:["Delete the registration for"," ",e.jsx("span",{className:"font-mono font-medium text-text-primary",children:l==null?void 0:l.workflow_type}),"? This removes its invocation settings, certification, and interceptor treatment; the workflow keeps running as a plain durable workflow. Escalation schemas versioned on roles are untouched."]}),isPending:v.isPending,error:v.error})]})}export{Oe as WorkflowConfigDetailPage,Ue as WorkflowConfigsPage};
5
- //# sourceMappingURL=index-xBNf5aFb.js.map
5
+ //# sourceMappingURL=index-DzIB5CaR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-xBNf5aFb.js","sources":["../../src/pages/workflows/registry/WorkflowConfigsPage.tsx","../../src/components/common/form/RolePicker.tsx","../../src/lib/parse.ts","../../src/pages/workflows/registry/config-form-types.ts","../../src/pages/workflows/registry/WorkflowConfigDetailPage.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n useDiscoveredWorkflows,\n useDeleteWorkflowConfig,\n} from '../../../api/workflows';\nimport {\n Server,\n ShieldCheck, ShieldPlus, ShieldOff, Settings, Wrench, Play, UserCheck,\n} from 'lucide-react';\nimport { FilterBar, FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { ConfirmDeleteModal } from '../../../components/common/modal/ConfirmDeleteModal';\nimport { RolePill } from '../../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport type { DiscoveredWorkflow } from '../../../api/types';\n\n// ── Tier badge ─────────────────────────────────────────────────────────────────\n\nfunction TierBadge({ tier }: { tier: string }) {\n if (tier === 'certified')\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-status-success\"><ShieldCheck className=\"w-3 h-3\" />Certified</span>;\n if (tier === 'registered')\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary\"><Settings className=\"w-3 h-3\" />Registered</span>;\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary\"><Wrench className=\"w-3 h-3\" />Durable</span>;\n}\n\n// ── Page ──────────────────────────────────────────────────────────────────────\n\nexport function WorkflowConfigsPage() {\n const navigate = useNavigate();\n const { data, isLoading } = useDiscoveredWorkflows();\n const deleteConfig = useDeleteWorkflowConfig();\n\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n const [confirmDelete, setConfirmDelete] = useState<string | null>(null);\n\n const allWorkflows: DiscoveredWorkflow[] = data ?? [];\n\n const queues = useMemo(\n () => [...new Set(allWorkflows.map((w) => w.task_queue).filter(Boolean) as string[])].sort(),\n [allWorkflows],\n );\n\n const grouped = useMemo(() => {\n const q = search.toLowerCase().trim();\n const targetQueues = activeQueue ? [activeQueue] : queues;\n return targetQueues\n .map((queue) => ({\n queue,\n workflows: allWorkflows.filter(\n (w) =>\n w.task_queue === queue &&\n (!q ||\n w.workflow_type.toLowerCase().includes(q) ||\n w.description?.toLowerCase().includes(q)),\n ),\n }))\n .filter((g) => g.workflows.length > 0);\n }, [allWorkflows, queues, search, activeQueue]);\n\n // Workflows with no queue\n const ungrouped = useMemo(() => {\n const q = search.toLowerCase().trim();\n if (activeQueue) return [];\n return allWorkflows.filter(\n (w) =>\n !w.task_queue &&\n (!q || w.workflow_type.toLowerCase().includes(q) || w.description?.toLowerCase().includes(q)),\n );\n }, [allWorkflows, search, activeQueue]);\n\n const handleRowClick = (row: DiscoveredWorkflow) => {\n if (row.registered) {\n navigate(`/workflows/registry/${encodeURIComponent(row.workflow_type)}`);\n } else {\n navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.workflow_type)}&task_queue=${encodeURIComponent(row.task_queue ?? '')}`);\n }\n };\n\n const handleDelete = () => {\n if (!confirmDelete) return;\n deleteConfig.mutate(confirmDelete, { onSuccess: () => setConfirmDelete(null) });\n };\n\n return (\n <div>\n <PageHeader\n title=\"Registered Workflows\"\n docsHash=\"#docs:dashboard.md:workflow-registry\"\n actions={\n <button onClick={() => navigate('/workflows/registry/new')} className=\"btn-primary text-xs\">\n Register Workflow\n </button>\n }\n />\n\n {/* Sticky filter bar: queue select + search */}\n {!isLoading && queues.length > 0 && (\n <FilterBar>\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${allWorkflows.length} workflows…`}\n />\n </FilterBar>\n )}\n\n {/* Content */}\n {isLoading ? (\n <LoadingSkeleton />\n ) : grouped.length === 0 && ungrouped.length === 0 ? (\n <p className=\"text-sm text-text-tertiary mt-8\">\n {search || activeQueue ? 'No workflows match your filter.' : 'No workflows discovered yet.'}\n </p>\n ) : (\n <div className=\"space-y-10\">\n {grouped.map(({ queue, workflows }) => (\n <div key={queue}>\n <div className=\"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border\">\n <Server className=\"w-3 h-3 text-accent\" strokeWidth={1.5} />\n <h2 className=\"section-h2\">{queue}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <WorkflowTableHeader />\n <div className=\"divide-y divide-surface-border/30\">\n {workflows.map((wf) => (\n <WorkflowRow\n key={wf.workflow_type}\n wf={wf}\n onRowClick={handleRowClick}\n onDelete={setConfirmDelete}\n onNavigate={navigate}\n />\n ))}\n </div>\n </div>\n ))}\n\n {ungrouped.length > 0 && (\n <div>\n <div className=\"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border\">\n <Wrench className=\"w-3 h-3 text-text-quaternary\" strokeWidth={1.5} />\n <h2 className=\"section-h2\">No Queue</h2>\n <span className=\"text-xs text-text-quaternary\">{ungrouped.length}</span>\n </div>\n <WorkflowTableHeader />\n <div className=\"divide-y divide-surface-border/30\">\n {ungrouped.map((wf) => (\n <WorkflowRow\n key={wf.workflow_type}\n wf={wf}\n onRowClick={handleRowClick}\n onDelete={setConfirmDelete}\n onNavigate={navigate}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n )}\n\n <ConfirmDeleteModal\n open={!!confirmDelete}\n onClose={() => setConfirmDelete(null)}\n onConfirm={handleDelete}\n title=\"Unregister Workflow\"\n description={\n <>\n Delete the registration for{' '}\n <span className=\"font-mono font-medium text-text-primary\">{confirmDelete}</span>? This\n removes its invocation settings, certification, and interceptor treatment; the workflow\n keeps running as a plain durable workflow. To demote certified → registered instead,\n open the workflow and uncheck Certify — that keeps every setting.\n </>\n }\n isPending={deleteConfig.isPending}\n error={deleteConfig.error as Error | null}\n />\n </div>\n );\n}\n\n// ── Column layout ─────────────────────────────────────────────────────────────\n// [Workflow 1fr] [Tier 7rem] [Access 13rem] [Actions 4.5rem]\nconst ROW_GRID = 'grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6';\n\nfunction WorkflowTableHeader() {\n return (\n <div className={`${ROW_GRID} px-3 pb-2 pt-1`}>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Workflow</span>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Tier</span>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Access</span>\n <span />\n </div>\n );\n}\n\n// ── Workflow row ───────────────────────────────────────────────────────────────\n\nfunction WorkflowRow({\n wf,\n onRowClick,\n onDelete,\n onNavigate,\n}: {\n wf: DiscoveredWorkflow;\n onRowClick: (wf: DiscoveredWorkflow) => void;\n onDelete: (type: string) => void;\n onNavigate: (path: string) => void;\n}) {\n const escRoles = wf.roles ?? [];\n const invokeRoles = wf.invocation_roles ?? [];\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => onRowClick(wf)}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onRowClick(wf); }}\n className={`group ${ROW_GRID} py-2 px-3 -mx-3 rounded-md cursor-pointer transition-colors items-center`}\n >\n {/* Col 1: Workflow name + description, single line */}\n <div className=\"flex items-center gap-3 min-w-0\">\n <WorkflowPill\n type={wf.workflow_type}\n size=\"md\"\n variant={wf.tier === 'certified' ? 'certified' : wf.tier === 'registered' ? 'registered' : 'durable'}\n />\n {wf.description && (\n <p className=\"flex-1 min-w-0 truncate text-[10px] text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {wf.description}\n </p>\n )}\n </div>\n\n {/* Col 2: Tier */}\n <div>\n <TierBadge tier={wf.tier ?? 'durable'} />\n </div>\n\n {/* Col 3: Access — escalation + invocation roles, single line */}\n <div className=\"flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap\">\n {escRoles.length > 0 && (\n <>\n <span title=\"Escalation roles\"><ShieldCheck className=\"w-3 h-3 text-text-quaternary shrink-0\" /></span>\n {escRoles.map((r) => <RolePill key={`e-${r}`} role={r} />)}\n </>\n )}\n {invokeRoles.length > 0 && (\n <>\n <span title=\"Invocation roles\"><UserCheck className=\"w-3 h-3 text-text-quaternary shrink-0\" /></span>\n {invokeRoles.map((r) => <RolePill key={`i-${r}`} role={r} />)}\n </>\n )}\n {escRoles.length === 0 && invokeRoles.length === 0 && (\n <span className=\"text-xs text-text-quaternary\">—</span>\n )}\n </div>\n\n {/* Col 4: Actions — revealed on hover */}\n <div className=\"flex items-center justify-end gap-2.5 opacity-0 group-hover:opacity-100 transition-opacity\">\n {wf.invocable && (\n <button\n title=\"Invoke workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/start?type=${encodeURIComponent(wf.workflow_type)}&mode=now`); }}\n className=\"text-text-quaternary hover:text-status-success transition-colors\"\n >\n <Play className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.tier === 'durable' && (\n <button\n title=\"Configure workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(wf.workflow_type)}&task_queue=${encodeURIComponent(wf.task_queue ?? '')}`); }}\n className=\"text-text-quaternary hover:text-status-info transition-colors\"\n >\n <Wrench className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.tier === 'registered' && (\n <button\n title=\"Certify workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/registry/${encodeURIComponent(wf.workflow_type)}`); }}\n className=\"text-text-quaternary hover:text-status-success transition-colors\"\n >\n <ShieldPlus className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.registered && (\n <button\n title=\"Unregister workflow\"\n onClick={(e) => { e.stopPropagation(); onDelete(wf.workflow_type); }}\n className=\"text-text-quaternary hover:text-status-warning transition-colors\"\n >\n <ShieldOff className=\"w-3.5 h-3.5\" />\n </button>\n )}\n </div>\n </div>\n );\n}\n\n// ── Loading skeleton ───────────────────────────────────────────────────────────\n\nfunction LoadingSkeleton() {\n return (\n <div className=\"animate-pulse space-y-8 mt-4\">\n {[1, 2].map((i) => (\n <div key={i}>\n <div className=\"h-4 bg-surface-sunken rounded w-36 mb-4\" />\n <div className=\"space-y-4\">\n {[1, 2, 3].map((j) => (\n <div key={j} className=\"space-y-1.5\">\n <div className=\"h-3 bg-surface-sunken rounded w-48\" />\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n","import { useState, useRef, useEffect } from 'react';\nimport { User, X, ChevronDown, Check } from 'lucide-react';\nimport { useRoles } from '../../../api/roles';\n\ninterface RolePickerProps {\n selected: string[];\n onChange: (roles: string[]) => void;\n /** Only allow one selection */\n single?: boolean;\n placeholder?: string;\n}\n\nexport function RolePicker({ selected, onChange, single, placeholder }: RolePickerProps) {\n const { data } = useRoles();\n const allRoles = data?.roles ?? [];\n const [open, setOpen] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, []);\n\n const toggle = (role: string) => {\n if (single) {\n onChange(selected.includes(role) ? [] : [role]);\n setOpen(false);\n } else {\n onChange(\n selected.includes(role)\n ? selected.filter((r) => r !== role)\n : [...selected, role],\n );\n }\n };\n\n const remove = (role: string) => {\n onChange(selected.filter((r) => r !== role));\n };\n\n const placeholderText = placeholder ?? (single ? 'Select role...' : 'Add roles...');\n\n return (\n <div ref={ref} className=\"relative\">\n {/* Selected pills + trigger */}\n <button\n type=\"button\"\n onClick={() => setOpen(!open)}\n className=\"flex flex-wrap items-center gap-1.5 w-full min-h-[34px] px-2 py-1.5 bg-surface-sunken border border-surface-border rounded-md text-left cursor-pointer hover:border-accent/40 transition-colors focus:ring-1 focus:ring-accent focus:outline-none\"\n >\n {selected.length === 0 && (\n <span className=\"text-xs text-text-tertiary\">{placeholderText}</span>\n )}\n {selected.map((role) => (\n <span\n key={role}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-[11px]\"\n >\n <User className=\"w-2.5 h-2.5 shrink-0 text-accent/75\" />\n {role}\n <span\n role=\"button\"\n onClick={(e) => { e.stopPropagation(); remove(role); }}\n className=\"ml-0.5 hover:text-status-error transition-colors\"\n >\n <X className=\"w-2.5 h-2.5\" />\n </span>\n </span>\n ))}\n <ChevronDown className={`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${open ? 'rotate-180' : ''}`} />\n </button>\n\n {/* Dropdown */}\n {open && (\n <div className=\"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto\">\n {allRoles.length === 0 ? (\n <p className=\"px-3 py-2 text-xs text-text-tertiary\">No roles defined</p>\n ) : (\n allRoles.map((role) => {\n const isSelected = selected.includes(role);\n return (\n <button\n key={role}\n type=\"button\"\n onClick={() => toggle(role)}\n className={`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${\n isSelected\n ? 'bg-accent/[0.06] text-accent'\n : 'text-text-primary hover:bg-surface-sunken'\n }`}\n >\n <User className=\"w-3 h-3 shrink-0 text-accent/60\" />\n <span className=\"flex-1\">{role}</span>\n {isSelected && <Check className=\"w-3 h-3 shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n )}\n </div>\n );\n}\n","export function splitCsv(s: string): string[] {\n return s\n .split(',')\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\nexport function safeParseJson<T = unknown>(\n json: string,\n): { ok: true; data: T } | { ok: false; error: string } {\n try {\n return { ok: true, data: JSON.parse(json) as T };\n } catch (e: unknown) {\n const message = e instanceof Error ? e.message : 'Invalid JSON';\n return { ok: false, error: message };\n }\n}\n","import type { LTWorkflowConfig } from '../../../api/types';\n\nexport interface ConfigFormState {\n workflow_type: string;\n description: string;\n task_queue: string;\n default_role: string;\n invocable: boolean;\n roles: string;\n invocation_roles: string;\n consumes: string;\n envelope_schema: string;\n resolver_schema: string;\n cron_schedule: string;\n execute_as: string;\n /**\n * Explicit HITL certification, persisted on the registration. Unchecking\n * demotes certified → registered on save and keeps roles/consumes intact.\n */\n certified: boolean;\n}\n\nexport const EMPTY_FORM: ConfigFormState = {\n workflow_type: '',\n description: '',\n task_queue: '',\n default_role: 'reviewer',\n invocable: false,\n roles: '',\n invocation_roles: '',\n consumes: '',\n envelope_schema: '',\n resolver_schema: '',\n cron_schedule: '',\n execute_as: '',\n certified: false,\n};\n\nexport function configToForm(c: LTWorkflowConfig): ConfigFormState {\n const roles = (c.roles ?? []).join(', ');\n const consumes = (c.consumes ?? []).join(', ');\n return {\n workflow_type: c.workflow_type,\n description: c.description ?? '',\n task_queue: c.task_queue ?? '',\n default_role: c.default_role,\n invocable: c.invocable,\n roles,\n invocation_roles: (c.invocation_roles ?? []).join(', '),\n consumes,\n envelope_schema: c.envelope_schema ? JSON.stringify(c.envelope_schema, null, 2) : '',\n resolver_schema: c.resolver_schema ? JSON.stringify(c.resolver_schema, null, 2) : '',\n cron_schedule: c.cron_schedule ?? '',\n execute_as: c.execute_as ?? '',\n certified: c.certified,\n };\n}\n\nexport const STEP_LABELS = ['Identity', 'Invocation', 'Advanced'];\n\nexport function jsonValid(v: string): boolean {\n if (!v.trim()) return true;\n try { JSON.parse(v); return true; } catch { return false; }\n}\n\nexport function isStepValid(step: number, form: ConfigFormState): boolean {\n if (step === 1) return !!form.workflow_type.trim();\n if (step === 2) return jsonValid(form.envelope_schema);\n if (step === 3) return jsonValid(form.resolver_schema);\n return true;\n}\n\nexport const labelCls = 'label';\nexport const hintCls = 'hint';\nexport const jsonCls = 'input-json w-full';\n\nexport const DEFAULT_ENVELOPE = '{\\n \"data\": {},\\n \"metadata\": {}\\n}';\n","import { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useParams, useNavigate, useSearchParams } from 'react-router-dom';\nimport {\n Code2, Play, ShieldOff,\n} from 'lucide-react';\nimport { useWorkflowConfigs, useUpsertWorkflowConfig, useDeleteWorkflowConfig, useJobs } from '../../../api/workflows';\nimport { ConfirmDeleteModal } from '../../../components/common/modal/ConfirmDeleteModal';\nimport { RolePicker } from '../../../components/common/form/RolePicker';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport { splitCsv } from '../../../lib/parse';\nimport { EMPTY_FORM, configToForm, jsonValid } from './config-form-types';\nimport type { ConfigFormState } from './config-form-types';\n\n// ── Local helpers ─────────────────────────────────────────────────────────────\n\nfunction SectionHeader({ icon: Icon, color, children }: { icon: React.ElementType; color: string; children: React.ReactNode }) {\n return (\n <div className=\"flex items-center gap-2 mb-4 pb-2 border-b border-surface-border\">\n <Icon className={`w-4 h-4 ${color}`} strokeWidth={1.5} />\n <h2 className=\"section-h2\">{children}</h2>\n </div>\n );\n}\n\nfunction Field({ label, hint, children }: { label: string; hint?: React.ReactNode; children: React.ReactNode }) {\n return (\n <div className=\"space-y-1.5\">\n <label className=\"label\">{label}</label>\n {children}\n {hint && <p className=\"hint\">{hint}</p>}\n </div>\n );\n}\n\nconst jsonCls = 'input-json w-full';\n\nfunction csvToArray(csv: string): string[] { return splitCsv(csv); }\nfunction arrayToCsv(arr: string[]): string { return arr.join(', '); }\n\nconst SYSTEM_WORKFLOWS = new Set([\n 'mcpQuery', 'mcpDeterministic', 'mcpQueryRouter', 'mcpTriage',\n 'mcpTriageRouter', 'mcpTriageDeterministic', 'insightQuery',\n]);\n\n// ── Page ─────────────────────────────────────────────────────────────────────\n\nexport function WorkflowConfigDetailPage() {\n const { workflowType } = useParams<{ workflowType: string }>();\n const isNew = !workflowType;\n const navigate = useNavigate();\n const [searchParams] = useSearchParams();\n const { data: configs, isLoading } = useWorkflowConfigs();\n const upsert = useUpsertWorkflowConfig();\n const deleteConfig = useDeleteWorkflowConfig();\n const [confirmUnregister, setConfirmUnregister] = useState(false);\n\n const editing = configs?.find((c) => c.workflow_type === workflowType) ?? null;\n\n const { data: jobsData } = useJobs({ limit: 500 });\n const unregisteredTypes = useMemo(() => {\n const registeredSet = new Set((configs ?? []).map((c) => c.workflow_type));\n const allEntities = new Set((jobsData?.jobs ?? []).map((j: any) => j.entity));\n return [...allEntities]\n .filter((e: string) => !registeredSet.has(e) && !SYSTEM_WORKFLOWS.has(e))\n .sort();\n }, [configs, jobsData]);\n\n const prefillForm = useMemo((): ConfigFormState => {\n if (!isNew) return EMPTY_FORM;\n const prefillType = searchParams.get('workflow_type') ?? '';\n const prefillQueue = searchParams.get('task_queue') ?? '';\n return prefillType || prefillQueue\n ? { ...EMPTY_FORM, workflow_type: prefillType, task_queue: prefillQueue }\n : EMPTY_FORM;\n }, [isNew, searchParams]);\n\n const [form, setForm] = useState<ConfigFormState>(prefillForm);\n const [schemaError, setSchemaError] = useState('');\n const [initialized, setInitialized] = useState(false);\n\n const set = useCallback(\n (field: keyof ConfigFormState, value: string | boolean) =>\n setForm((f) => ({ ...f, [field]: value })),\n [],\n );\n\n useEffect(() => {\n if (initialized) return;\n if (isNew) { setForm(prefillForm); setInitialized(true); return; }\n if (editing) { setForm(configToForm(editing)); setInitialized(true); }\n }, [editing, isNew, initialized, prefillForm]);\n\n const handleSave = () => {\n if (!form.workflow_type.trim()) return;\n setSchemaError('');\n\n let envelope_schema: Record<string, unknown> | null = null;\n let resolver_schema: Record<string, unknown> | null = null;\n try {\n if (form.envelope_schema.trim()) envelope_schema = JSON.parse(form.envelope_schema);\n } catch { setSchemaError('Invalid JSON in Envelope Schema'); return; }\n try {\n if (form.resolver_schema.trim()) resolver_schema = JSON.parse(form.resolver_schema);\n } catch { setSchemaError('Invalid JSON in Resolver Schema'); return; }\n\n upsert.mutate(\n {\n workflow_type: form.workflow_type.trim(),\n description: form.description.trim() || null,\n task_queue: form.task_queue.trim() || null,\n default_role: form.default_role.trim() || 'reviewer',\n invocable: form.invocable,\n certified: form.certified,\n roles: splitCsv(form.roles),\n invocation_roles: splitCsv(form.invocation_roles),\n consumes: splitCsv(form.consumes),\n envelope_schema,\n resolver_schema,\n cron_schedule: form.cron_schedule.trim() || null,\n execute_as: form.execute_as.trim() || null,\n },\n { onSuccess: () => navigate('/workflows/registry') },\n );\n };\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-64\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n if (!isNew && !editing) {\n return <p className=\"text-sm text-text-secondary\">Config not found.</p>;\n }\n\n const canSave = !!form.workflow_type.trim() && jsonValid(form.envelope_schema) && jsonValid(form.resolver_schema);\n const showPickList = isNew && !form.workflow_type && unregisteredTypes.length > 0;\n\n return (\n <div>\n {/* Hero */}\n <div className=\"flex items-start justify-between mb-8\">\n <div>\n <h1 className=\"text-3xl font-light font-mono text-text-primary\">\n {isNew ? 'New Workflow' : editing?.workflow_type ?? ''}\n </h1>\n {editing && (\n <div className=\"flex items-center gap-2 mt-2\">\n <NamespacePill namespace=\"durable\" />\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-3 mt-1\">\n <button onClick={() => navigate('/workflows/registry')} className=\"btn-ghost text-xs\">\n Cancel\n </button>\n <button\n onClick={handleSave}\n disabled={!canSave || upsert.isPending}\n className=\"btn-primary text-xs\"\n >\n {upsert.isPending ? 'Saving…' : isNew ? 'Register' : 'Save'}\n </button>\n </div>\n </div>\n\n {/* Three-column form */}\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10\">\n\n {/* ── Identity ─────────────────────────────────────────────────── */}\n <div>\n <SectionHeader icon={Code2} color=\"text-accent\">Identity</SectionHeader>\n <div className=\"space-y-5\">\n <Field\n label=\"Workflow Type\"\n hint=\"Register a workflow to configure invocation and HITL escalation routing.\"\n >\n {showPickList ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs text-text-secondary\">Select a durable workflow to register:</p>\n <div className=\"grid gap-1\">\n {(unregisteredTypes as string[]).map((type) => (\n <button\n key={type}\n onClick={() => set('workflow_type', type)}\n className=\"flex items-center gap-2 px-3 py-2 text-left text-xs font-mono rounded-md border border-surface-border hover:border-accent/50 hover:bg-accent/[0.04] transition-colors\"\n >\n {type}\n </button>\n ))}\n </div>\n <div className=\"flex items-center gap-2 pt-1\">\n <span className=\"text-[10px] text-text-tertiary\">or</span>\n <input\n type=\"text\"\n onChange={(e) => set('workflow_type', e.target.value)}\n placeholder=\"Enter type manually\"\n className=\"input font-mono flex-1\"\n />\n </div>\n </div>\n ) : (\n <>\n <input\n type=\"text\"\n value={form.workflow_type}\n onChange={(e) => set('workflow_type', e.target.value)}\n disabled={!isNew}\n placeholder=\"reviewContent\"\n className=\"input font-mono w-full\"\n />\n {isNew && form.workflow_type && unregisteredTypes.length > 0 && (\n <button\n onClick={() => set('workflow_type', '')}\n className=\"text-[10px] text-accent hover:underline mt-1\"\n >\n Choose from durable workflows\n </button>\n )}\n </>\n )}\n </Field>\n\n <Field label=\"Description\">\n <input\n type=\"text\"\n value={form.description}\n onChange={(e) => set('description', e.target.value)}\n placeholder=\"Describe what this workflow does\"\n className=\"input text-xs w-full\"\n />\n </Field>\n\n <Field label=\"Task Queue\" hint=\"Durable task queue this workflow listens on.\">\n <input\n type=\"text\"\n value={form.task_queue}\n onChange={(e) => set('task_queue', e.target.value)}\n placeholder=\"lt-review\"\n className=\"input font-mono w-full\"\n />\n </Field>\n </div>\n </div>\n\n {/* ── Invocation ───────────────────────────────────────────────── */}\n <div>\n <SectionHeader icon={Play} color=\"text-accent\">Invocation</SectionHeader>\n <div className=\"space-y-5\">\n <div className=\"space-y-1\">\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={form.invocable}\n onChange={(e) => set('invocable', e.target.checked)}\n className=\"w-4 h-4 rounded border-border accent-accent\"\n />\n <span className=\"text-xs text-text-primary font-medium\">Invocable</span>\n </label>\n <p className=\"hint\">Allow this workflow to be started from the dashboard or API.</p>\n </div>\n\n {form.invocable ? (\n <>\n <Field label=\"Run As\" hint=\"Bot identity to run under. Default runs as the invoking user.\">\n <BotPicker selected={form.execute_as} onChange={(id) => set('execute_as', id)} />\n </Field>\n\n <Field label=\"Invocation Roles\" hint=\"Only users with these roles can start this workflow. Empty = all authenticated users.\">\n <RolePicker\n selected={csvToArray(form.invocation_roles)}\n onChange={(roles) => set('invocation_roles', arrayToCsv(roles))}\n placeholder=\"Select roles…\"\n />\n </Field>\n\n <Field label=\"Envelope Schema\" hint={<>Pre-fills the JSON editor when invoking. Include <code className=\"font-mono\">data</code> (input) and optional <code className=\"font-mono\">metadata</code>.</>}>\n <textarea\n value={form.envelope_schema}\n onChange={(e) => set('envelope_schema', e.target.value)}\n placeholder={'{\\n \"data\": {},\\n \"metadata\": {}\\n}'}\n className={jsonCls}\n rows={8}\n spellCheck={false}\n />\n {form.envelope_schema.trim() && !jsonValid(form.envelope_schema) && (\n <p className=\"text-[10px] text-status-error mt-1\">Invalid JSON</p>\n )}\n </Field>\n </>\n ) : (\n <p className=\"text-[11px] text-text-tertiary py-2\">\n Enable <span className=\"font-medium text-text-secondary\">Invocable</span> to configure invocation roles and an input template.\n </p>\n )}\n </div>\n </div>\n\n {/* Escalation & resolution config is ROLE-owned now — a workflow no longer\n declares a resolver schema or a certification tier here. The escalation\n surface (form_schema + resolver_schema, versioned) lives on the target\n role. This section is intentionally hidden from the workflow view. */}\n {editing && (\n <div>\n <SectionHeader icon={ShieldOff} color=\"text-text-tertiary\">Registration</SectionHeader>\n <button\n onClick={() => setConfirmUnregister(true)}\n className=\"flex items-center gap-1.5 text-[11px] text-status-warning hover:underline\"\n title=\"Delete this registration — the workflow returns to plain durable\"\n >\n <ShieldOff className=\"w-3 h-3\" /> Unregister workflow\n </button>\n </div>\n )}\n </div>\n\n {(schemaError || upsert.error) && (\n <p className=\"text-xs text-status-error mt-8\">\n {schemaError || (upsert.error as Error).message}\n </p>\n )}\n\n <ConfirmDeleteModal\n open={confirmUnregister}\n onClose={() => setConfirmUnregister(false)}\n onConfirm={() =>\n deleteConfig.mutate(editing!.workflow_type, {\n onSuccess: () => navigate('/workflows/registry'),\n })\n }\n title=\"Unregister Workflow\"\n description={\n <>\n Delete the registration for{' '}\n <span className=\"font-mono font-medium text-text-primary\">{editing?.workflow_type}</span>?\n This removes its invocation settings, certification, and interceptor treatment; the\n workflow keeps running as a plain durable workflow. Escalation schemas versioned on\n roles are untouched.\n </>\n }\n isPending={deleteConfig.isPending}\n error={deleteConfig.error as Error | null}\n />\n </div>\n );\n}\n"],"names":["TierBadge","tier","jsxs","jsx","ShieldCheck","Settings","Wrench","WorkflowConfigsPage","navigate","useNavigate","data","isLoading","useDiscoveredWorkflows","deleteConfig","useDeleteWorkflowConfig","search","setSearch","useState","activeQueue","setActiveQueue","confirmDelete","setConfirmDelete","allWorkflows","queues","useMemo","w","grouped","q","queue","_a","g","ungrouped","handleRowClick","row","handleDelete","PageHeader","FilterBar","FilterSelect","v","FilterInput","LoadingSkeleton","workflows","Server","WorkflowTableHeader","wf","WorkflowRow","ConfirmDeleteModal","Fragment","ROW_GRID","onRowClick","onDelete","onNavigate","escRoles","invokeRoles","e","WorkflowPill","r","RolePill","UserCheck","Play","ShieldPlus","ShieldOff","i","j","RolePicker","selected","onChange","single","placeholder","useRoles","allRoles","open","setOpen","ref","useRef","useEffect","handler","toggle","role","remove","placeholderText","User","X","ChevronDown","isSelected","Check","splitCsv","s","EMPTY_FORM","configToForm","c","roles","consumes","jsonValid","SectionHeader","Icon","color","children","Field","label","hint","jsonCls","csvToArray","csv","arrayToCsv","arr","SYSTEM_WORKFLOWS","WorkflowConfigDetailPage","workflowType","useParams","isNew","searchParams","useSearchParams","configs","useWorkflowConfigs","upsert","useUpsertWorkflowConfig","confirmUnregister","setConfirmUnregister","editing","jobsData","useJobs","unregisteredTypes","registeredSet","prefillForm","prefillType","prefillQueue","form","setForm","schemaError","setSchemaError","initialized","setInitialized","set","useCallback","field","value","f","handleSave","envelope_schema","resolver_schema","canSave","showPickList","NamespacePill","Code2","type","BotPicker","id"],"mappings":"8xBAmBA,SAASA,GAAU,CAAE,KAAAC,GAA0B,CAC7C,OAAIA,IAAS,YACJC,EAAAA,KAAC,OAAA,CAAK,UAAU,6EAA6E,SAAA,CAAAC,EAAAA,IAACC,EAAA,CAAY,UAAU,SAAA,CAAU,EAAE,WAAA,EAAS,EAC9IH,IAAS,aACJC,EAAAA,KAAC,OAAA,CAAK,UAAU,6EAA6E,SAAA,CAAAC,EAAAA,IAACE,GAAA,CAAS,UAAU,SAAA,CAAU,EAAE,YAAA,EAAU,EACzIH,EAAAA,KAAC,OAAA,CAAK,UAAU,8EAA8E,SAAA,CAAAC,EAAAA,IAACG,EAAA,CAAO,UAAU,SAAA,CAAU,EAAE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1C,UAAW,IAAM/G,EAAS,qBAAqB,CAAA,CAChD,EAEH,MAAM,sBACN,YACEN,EAAAA,KAAA6C,WAAA,CAAE,SAAA,CAAA,8BAC4B,IAC5B5C,EAAAA,IAAC,OAAA,CAAK,UAAU,0CAA2C,0BAAS,cAAc,EAAO,gMAAA,EAI3F,EAEF,UAAWU,EAAa,UACxB,MAAOA,EAAa,KAAA,CAAA,CACtB,EACF,CAEJ"}
1
+ {"version":3,"file":"index-DzIB5CaR.js","sources":["../../src/pages/workflows/registry/WorkflowConfigsPage.tsx","../../src/components/common/form/RolePicker.tsx","../../src/lib/parse.ts","../../src/pages/workflows/registry/config-form-types.ts","../../src/pages/workflows/registry/WorkflowConfigDetailPage.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport {\n useDiscoveredWorkflows,\n useDeleteWorkflowConfig,\n} from '../../../api/workflows';\nimport {\n Server,\n ShieldCheck, ShieldPlus, ShieldOff, Settings, Wrench, Play, UserCheck,\n} from 'lucide-react';\nimport { FilterBar, FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { ConfirmDeleteModal } from '../../../components/common/modal/ConfirmDeleteModal';\nimport { RolePill } from '../../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport type { DiscoveredWorkflow } from '../../../api/types';\n\n// ── Tier badge ─────────────────────────────────────────────────────────────────\n\nfunction TierBadge({ tier }: { tier: string }) {\n if (tier === 'certified')\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-status-success\"><ShieldCheck className=\"w-3 h-3\" />Certified</span>;\n if (tier === 'registered')\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-text-secondary\"><Settings className=\"w-3 h-3\" />Registered</span>;\n return <span className=\"inline-flex items-center gap-1 text-[10px] font-medium text-text-quaternary\"><Wrench className=\"w-3 h-3\" />Durable</span>;\n}\n\n// ── Page ──────────────────────────────────────────────────────────────────────\n\nexport function WorkflowConfigsPage() {\n const navigate = useNavigate();\n const { data, isLoading } = useDiscoveredWorkflows();\n const deleteConfig = useDeleteWorkflowConfig();\n\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n const [confirmDelete, setConfirmDelete] = useState<string | null>(null);\n\n const allWorkflows: DiscoveredWorkflow[] = data ?? [];\n\n const queues = useMemo(\n () => [...new Set(allWorkflows.map((w) => w.task_queue).filter(Boolean) as string[])].sort(),\n [allWorkflows],\n );\n\n const grouped = useMemo(() => {\n const q = search.toLowerCase().trim();\n const targetQueues = activeQueue ? [activeQueue] : queues;\n return targetQueues\n .map((queue) => ({\n queue,\n workflows: allWorkflows.filter(\n (w) =>\n w.task_queue === queue &&\n (!q ||\n w.workflow_type.toLowerCase().includes(q) ||\n w.description?.toLowerCase().includes(q)),\n ),\n }))\n .filter((g) => g.workflows.length > 0);\n }, [allWorkflows, queues, search, activeQueue]);\n\n // Workflows with no queue\n const ungrouped = useMemo(() => {\n const q = search.toLowerCase().trim();\n if (activeQueue) return [];\n return allWorkflows.filter(\n (w) =>\n !w.task_queue &&\n (!q || w.workflow_type.toLowerCase().includes(q) || w.description?.toLowerCase().includes(q)),\n );\n }, [allWorkflows, search, activeQueue]);\n\n const handleRowClick = (row: DiscoveredWorkflow) => {\n if (row.registered) {\n navigate(`/workflows/registry/${encodeURIComponent(row.workflow_type)}`);\n } else {\n navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.workflow_type)}&task_queue=${encodeURIComponent(row.task_queue ?? '')}`);\n }\n };\n\n const handleDelete = () => {\n if (!confirmDelete) return;\n deleteConfig.mutate(confirmDelete, { onSuccess: () => setConfirmDelete(null) });\n };\n\n return (\n <div>\n <PageHeader\n title=\"Registered Workflows\"\n docsHash=\"#docs:dashboard.md:workflow-registry\"\n actions={\n <button onClick={() => navigate('/workflows/registry/new')} className=\"btn-primary text-xs\">\n Register Workflow\n </button>\n }\n />\n\n {/* Sticky filter bar: queue select + search */}\n {!isLoading && queues.length > 0 && (\n <FilterBar>\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${allWorkflows.length} workflows…`}\n />\n </FilterBar>\n )}\n\n {/* Content */}\n {isLoading ? (\n <LoadingSkeleton />\n ) : grouped.length === 0 && ungrouped.length === 0 ? (\n <p className=\"text-sm text-text-tertiary mt-8\">\n {search || activeQueue ? 'No workflows match your filter.' : 'No workflows discovered yet.'}\n </p>\n ) : (\n <div className=\"space-y-10\">\n {grouped.map(({ queue, workflows }) => (\n <div key={queue}>\n <div className=\"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border\">\n <Server className=\"w-3 h-3 text-accent\" strokeWidth={1.5} />\n <h2 className=\"section-h2\">{queue}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <WorkflowTableHeader />\n <div className=\"divide-y divide-surface-border/30\">\n {workflows.map((wf) => (\n <WorkflowRow\n key={wf.workflow_type}\n wf={wf}\n onRowClick={handleRowClick}\n onDelete={setConfirmDelete}\n onNavigate={navigate}\n />\n ))}\n </div>\n </div>\n ))}\n\n {ungrouped.length > 0 && (\n <div>\n <div className=\"sticky top-[60px] z-10 bg-surface flex items-center gap-2 py-2 mb-2 border-b border-surface-border\">\n <Wrench className=\"w-3 h-3 text-text-quaternary\" strokeWidth={1.5} />\n <h2 className=\"section-h2\">No Queue</h2>\n <span className=\"text-xs text-text-quaternary\">{ungrouped.length}</span>\n </div>\n <WorkflowTableHeader />\n <div className=\"divide-y divide-surface-border/30\">\n {ungrouped.map((wf) => (\n <WorkflowRow\n key={wf.workflow_type}\n wf={wf}\n onRowClick={handleRowClick}\n onDelete={setConfirmDelete}\n onNavigate={navigate}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n )}\n\n <ConfirmDeleteModal\n open={!!confirmDelete}\n onClose={() => setConfirmDelete(null)}\n onConfirm={handleDelete}\n title=\"Unregister Workflow\"\n description={\n <>\n Delete the registration for{' '}\n <span className=\"font-mono font-medium text-text-primary\">{confirmDelete}</span>? This\n removes its invocation settings, certification, and interceptor treatment; the workflow\n keeps running as a plain durable workflow. To demote certified → registered instead,\n open the workflow and uncheck Certify — that keeps every setting.\n </>\n }\n isPending={deleteConfig.isPending}\n error={deleteConfig.error as Error | null}\n />\n </div>\n );\n}\n\n// ── Column layout ─────────────────────────────────────────────────────────────\n// [Workflow 1fr] [Tier 7rem] [Access 13rem] [Actions 4.5rem]\nconst ROW_GRID = 'grid grid-cols-[minmax(0,1fr)_7rem_13rem_4.5rem] gap-x-6';\n\nfunction WorkflowTableHeader() {\n return (\n <div className={`${ROW_GRID} px-3 pb-2 pt-1`}>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Workflow</span>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Tier</span>\n <span className=\"text-[10px] font-medium text-text-quaternary\">Access</span>\n <span />\n </div>\n );\n}\n\n// ── Workflow row ───────────────────────────────────────────────────────────────\n\nfunction WorkflowRow({\n wf,\n onRowClick,\n onDelete,\n onNavigate,\n}: {\n wf: DiscoveredWorkflow;\n onRowClick: (wf: DiscoveredWorkflow) => void;\n onDelete: (type: string) => void;\n onNavigate: (path: string) => void;\n}) {\n const escRoles = wf.roles ?? [];\n const invokeRoles = wf.invocation_roles ?? [];\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={() => onRowClick(wf)}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onRowClick(wf); }}\n className={`group ${ROW_GRID} py-2 px-3 -mx-3 rounded-md cursor-pointer transition-colors items-center`}\n >\n {/* Col 1: Workflow name + description, single line */}\n <div className=\"flex items-center gap-3 min-w-0\">\n <WorkflowPill\n type={wf.workflow_type}\n size=\"md\"\n variant={wf.tier === 'certified' ? 'certified' : wf.tier === 'registered' ? 'registered' : 'durable'}\n />\n {wf.description && (\n <p className=\"flex-1 min-w-0 truncate text-[10px] text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {wf.description}\n </p>\n )}\n </div>\n\n {/* Col 2: Tier */}\n <div>\n <TierBadge tier={wf.tier ?? 'durable'} />\n </div>\n\n {/* Col 3: Access — escalation + invocation roles, single line */}\n <div className=\"flex items-center gap-1.5 min-w-0 overflow-hidden whitespace-nowrap\">\n {escRoles.length > 0 && (\n <>\n <span title=\"Escalation roles\"><ShieldCheck className=\"w-3 h-3 text-text-quaternary shrink-0\" /></span>\n {escRoles.map((r) => <RolePill key={`e-${r}`} role={r} />)}\n </>\n )}\n {invokeRoles.length > 0 && (\n <>\n <span title=\"Invocation roles\"><UserCheck className=\"w-3 h-3 text-text-quaternary shrink-0\" /></span>\n {invokeRoles.map((r) => <RolePill key={`i-${r}`} role={r} />)}\n </>\n )}\n {escRoles.length === 0 && invokeRoles.length === 0 && (\n <span className=\"text-xs text-text-quaternary\">—</span>\n )}\n </div>\n\n {/* Col 4: Actions — revealed on hover */}\n <div className=\"flex items-center justify-end gap-2.5 opacity-0 group-hover:opacity-100 transition-opacity\">\n {wf.invocable && (\n <button\n title=\"Invoke workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/start?type=${encodeURIComponent(wf.workflow_type)}&mode=now`); }}\n className=\"text-text-quaternary hover:text-status-success transition-colors\"\n >\n <Play className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.tier === 'durable' && (\n <button\n title=\"Configure workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(wf.workflow_type)}&task_queue=${encodeURIComponent(wf.task_queue ?? '')}`); }}\n className=\"text-text-quaternary hover:text-status-info transition-colors\"\n >\n <Wrench className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.tier === 'registered' && (\n <button\n title=\"Certify workflow\"\n onClick={(e) => { e.stopPropagation(); onNavigate(`/workflows/registry/${encodeURIComponent(wf.workflow_type)}`); }}\n className=\"text-text-quaternary hover:text-status-success transition-colors\"\n >\n <ShieldPlus className=\"w-3.5 h-3.5\" />\n </button>\n )}\n {wf.registered && (\n <button\n title=\"Unregister workflow\"\n onClick={(e) => { e.stopPropagation(); onDelete(wf.workflow_type); }}\n className=\"text-text-quaternary hover:text-status-warning transition-colors\"\n >\n <ShieldOff className=\"w-3.5 h-3.5\" />\n </button>\n )}\n </div>\n </div>\n );\n}\n\n// ── Loading skeleton ───────────────────────────────────────────────────────────\n\nfunction LoadingSkeleton() {\n return (\n <div className=\"animate-pulse space-y-8 mt-4\">\n {[1, 2].map((i) => (\n <div key={i}>\n <div className=\"h-4 bg-surface-sunken rounded w-36 mb-4\" />\n <div className=\"space-y-4\">\n {[1, 2, 3].map((j) => (\n <div key={j} className=\"space-y-1.5\">\n <div className=\"h-3 bg-surface-sunken rounded w-48\" />\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n","import { useState, useRef, useEffect } from 'react';\nimport { User, X, ChevronDown, Check } from 'lucide-react';\nimport { useRoles } from '../../../api/roles';\n\ninterface RolePickerProps {\n selected: string[];\n onChange: (roles: string[]) => void;\n /** Only allow one selection */\n single?: boolean;\n placeholder?: string;\n}\n\nexport function RolePicker({ selected, onChange, single, placeholder }: RolePickerProps) {\n const { data } = useRoles();\n const allRoles = data?.roles ?? [];\n const [open, setOpen] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, []);\n\n const toggle = (role: string) => {\n if (single) {\n onChange(selected.includes(role) ? [] : [role]);\n setOpen(false);\n } else {\n onChange(\n selected.includes(role)\n ? selected.filter((r) => r !== role)\n : [...selected, role],\n );\n }\n };\n\n const remove = (role: string) => {\n onChange(selected.filter((r) => r !== role));\n };\n\n const placeholderText = placeholder ?? (single ? 'Select role...' : 'Add roles...');\n\n return (\n <div ref={ref} className=\"relative\">\n {/* Selected pills + trigger */}\n <button\n type=\"button\"\n onClick={() => setOpen(!open)}\n className=\"flex flex-wrap items-center gap-1.5 w-full min-h-[34px] px-2 py-1.5 bg-surface-sunken border border-surface-border rounded-md text-left cursor-pointer hover:border-accent/40 transition-colors focus:ring-1 focus:ring-accent focus:outline-none\"\n >\n {selected.length === 0 && (\n <span className=\"text-xs text-text-tertiary\">{placeholderText}</span>\n )}\n {selected.map((role) => (\n <span\n key={role}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-[11px]\"\n >\n <User className=\"w-2.5 h-2.5 shrink-0 text-accent/75\" />\n {role}\n <span\n role=\"button\"\n onClick={(e) => { e.stopPropagation(); remove(role); }}\n className=\"ml-0.5 hover:text-status-error transition-colors\"\n >\n <X className=\"w-2.5 h-2.5\" />\n </span>\n </span>\n ))}\n <ChevronDown className={`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${open ? 'rotate-180' : ''}`} />\n </button>\n\n {/* Dropdown */}\n {open && (\n <div className=\"absolute z-20 mt-1 w-full bg-white border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto\">\n {allRoles.length === 0 ? (\n <p className=\"px-3 py-2 text-xs text-text-tertiary\">No roles defined</p>\n ) : (\n allRoles.map((role) => {\n const isSelected = selected.includes(role);\n return (\n <button\n key={role}\n type=\"button\"\n onClick={() => toggle(role)}\n className={`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${\n isSelected\n ? 'bg-accent/[0.06] text-accent'\n : 'text-text-primary hover:bg-surface-sunken'\n }`}\n >\n <User className=\"w-3 h-3 shrink-0 text-accent/60\" />\n <span className=\"flex-1\">{role}</span>\n {isSelected && <Check className=\"w-3 h-3 shrink-0\" />}\n </button>\n );\n })\n )}\n </div>\n )}\n </div>\n );\n}\n","export function splitCsv(s: string): string[] {\n return s\n .split(',')\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\nexport function safeParseJson<T = unknown>(\n json: string,\n): { ok: true; data: T } | { ok: false; error: string } {\n try {\n return { ok: true, data: JSON.parse(json) as T };\n } catch (e: unknown) {\n const message = e instanceof Error ? e.message : 'Invalid JSON';\n return { ok: false, error: message };\n }\n}\n","import type { LTWorkflowConfig } from '../../../api/types';\n\nexport interface ConfigFormState {\n workflow_type: string;\n description: string;\n task_queue: string;\n default_role: string;\n invocable: boolean;\n roles: string;\n invocation_roles: string;\n consumes: string;\n envelope_schema: string;\n resolver_schema: string;\n cron_schedule: string;\n execute_as: string;\n /**\n * Explicit HITL certification, persisted on the registration. Unchecking\n * demotes certified → registered on save and keeps roles/consumes intact.\n */\n certified: boolean;\n}\n\nexport const EMPTY_FORM: ConfigFormState = {\n workflow_type: '',\n description: '',\n task_queue: '',\n default_role: 'reviewer',\n invocable: false,\n roles: '',\n invocation_roles: '',\n consumes: '',\n envelope_schema: '',\n resolver_schema: '',\n cron_schedule: '',\n execute_as: '',\n certified: false,\n};\n\nexport function configToForm(c: LTWorkflowConfig): ConfigFormState {\n const roles = (c.roles ?? []).join(', ');\n const consumes = (c.consumes ?? []).join(', ');\n return {\n workflow_type: c.workflow_type,\n description: c.description ?? '',\n task_queue: c.task_queue ?? '',\n default_role: c.default_role,\n invocable: c.invocable,\n roles,\n invocation_roles: (c.invocation_roles ?? []).join(', '),\n consumes,\n envelope_schema: c.envelope_schema ? JSON.stringify(c.envelope_schema, null, 2) : '',\n resolver_schema: c.resolver_schema ? JSON.stringify(c.resolver_schema, null, 2) : '',\n cron_schedule: c.cron_schedule ?? '',\n execute_as: c.execute_as ?? '',\n certified: c.certified,\n };\n}\n\nexport const STEP_LABELS = ['Identity', 'Invocation', 'Advanced'];\n\nexport function jsonValid(v: string): boolean {\n if (!v.trim()) return true;\n try { JSON.parse(v); return true; } catch { return false; }\n}\n\nexport function isStepValid(step: number, form: ConfigFormState): boolean {\n if (step === 1) return !!form.workflow_type.trim();\n if (step === 2) return jsonValid(form.envelope_schema);\n if (step === 3) return jsonValid(form.resolver_schema);\n return true;\n}\n\nexport const labelCls = 'label';\nexport const hintCls = 'hint';\nexport const jsonCls = 'input-json w-full';\n\nexport const DEFAULT_ENVELOPE = '{\\n \"data\": {},\\n \"metadata\": {}\\n}';\n","import { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useParams, useNavigate, useSearchParams } from 'react-router-dom';\nimport {\n Code2, Play, ShieldOff,\n} from 'lucide-react';\nimport { useWorkflowConfigs, useUpsertWorkflowConfig, useDeleteWorkflowConfig, useJobs } from '../../../api/workflows';\nimport { ConfirmDeleteModal } from '../../../components/common/modal/ConfirmDeleteModal';\nimport { RolePicker } from '../../../components/common/form/RolePicker';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport { splitCsv } from '../../../lib/parse';\nimport { EMPTY_FORM, configToForm, jsonValid } from './config-form-types';\nimport type { ConfigFormState } from './config-form-types';\n\n// ── Local helpers ─────────────────────────────────────────────────────────────\n\nfunction SectionHeader({ icon: Icon, color, children }: { icon: React.ElementType; color: string; children: React.ReactNode }) {\n return (\n <div className=\"flex items-center gap-2 mb-4 pb-2 border-b border-surface-border\">\n <Icon className={`w-4 h-4 ${color}`} strokeWidth={1.5} />\n <h2 className=\"section-h2\">{children}</h2>\n </div>\n );\n}\n\nfunction Field({ label, hint, children }: { label: string; hint?: React.ReactNode; children: React.ReactNode }) {\n return (\n <div className=\"space-y-1.5\">\n <label className=\"label\">{label}</label>\n {children}\n {hint && <p className=\"hint\">{hint}</p>}\n </div>\n );\n}\n\nconst jsonCls = 'input-json w-full';\n\nfunction csvToArray(csv: string): string[] { return splitCsv(csv); }\nfunction arrayToCsv(arr: string[]): string { return arr.join(', '); }\n\nconst SYSTEM_WORKFLOWS = new Set([\n 'mcpQuery', 'mcpDeterministic', 'mcpQueryRouter', 'mcpTriage',\n 'mcpTriageRouter', 'mcpTriageDeterministic', 'insightQuery',\n]);\n\n// ── Page ─────────────────────────────────────────────────────────────────────\n\nexport function WorkflowConfigDetailPage() {\n const { workflowType } = useParams<{ workflowType: string }>();\n const isNew = !workflowType;\n const navigate = useNavigate();\n const [searchParams] = useSearchParams();\n const { data: configs, isLoading } = useWorkflowConfigs();\n const upsert = useUpsertWorkflowConfig();\n const deleteConfig = useDeleteWorkflowConfig();\n const [confirmUnregister, setConfirmUnregister] = useState(false);\n\n const editing = configs?.find((c) => c.workflow_type === workflowType) ?? null;\n\n const { data: jobsData } = useJobs({ limit: 500 });\n const unregisteredTypes = useMemo(() => {\n const registeredSet = new Set((configs ?? []).map((c) => c.workflow_type));\n const allEntities = new Set((jobsData?.jobs ?? []).map((j: any) => j.entity));\n return [...allEntities]\n .filter((e: string) => !registeredSet.has(e) && !SYSTEM_WORKFLOWS.has(e))\n .sort();\n }, [configs, jobsData]);\n\n const prefillForm = useMemo((): ConfigFormState => {\n if (!isNew) return EMPTY_FORM;\n const prefillType = searchParams.get('workflow_type') ?? '';\n const prefillQueue = searchParams.get('task_queue') ?? '';\n return prefillType || prefillQueue\n ? { ...EMPTY_FORM, workflow_type: prefillType, task_queue: prefillQueue }\n : EMPTY_FORM;\n }, [isNew, searchParams]);\n\n const [form, setForm] = useState<ConfigFormState>(prefillForm);\n const [schemaError, setSchemaError] = useState('');\n const [initialized, setInitialized] = useState(false);\n\n const set = useCallback(\n (field: keyof ConfigFormState, value: string | boolean) =>\n setForm((f) => ({ ...f, [field]: value })),\n [],\n );\n\n useEffect(() => {\n if (initialized) return;\n if (isNew) { setForm(prefillForm); setInitialized(true); return; }\n if (editing) { setForm(configToForm(editing)); setInitialized(true); }\n }, [editing, isNew, initialized, prefillForm]);\n\n const handleSave = () => {\n if (!form.workflow_type.trim()) return;\n setSchemaError('');\n\n let envelope_schema: Record<string, unknown> | null = null;\n let resolver_schema: Record<string, unknown> | null = null;\n try {\n if (form.envelope_schema.trim()) envelope_schema = JSON.parse(form.envelope_schema);\n } catch { setSchemaError('Invalid JSON in Envelope Schema'); return; }\n try {\n if (form.resolver_schema.trim()) resolver_schema = JSON.parse(form.resolver_schema);\n } catch { setSchemaError('Invalid JSON in Resolver Schema'); return; }\n\n upsert.mutate(\n {\n workflow_type: form.workflow_type.trim(),\n description: form.description.trim() || null,\n task_queue: form.task_queue.trim() || null,\n default_role: form.default_role.trim() || 'reviewer',\n invocable: form.invocable,\n certified: form.certified,\n roles: splitCsv(form.roles),\n invocation_roles: splitCsv(form.invocation_roles),\n consumes: splitCsv(form.consumes),\n envelope_schema,\n resolver_schema,\n cron_schedule: form.cron_schedule.trim() || null,\n execute_as: form.execute_as.trim() || null,\n },\n { onSuccess: () => navigate('/workflows/registry') },\n );\n };\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-64\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n if (!isNew && !editing) {\n return <p className=\"text-sm text-text-secondary\">Config not found.</p>;\n }\n\n const canSave = !!form.workflow_type.trim() && jsonValid(form.envelope_schema) && jsonValid(form.resolver_schema);\n const showPickList = isNew && !form.workflow_type && unregisteredTypes.length > 0;\n\n return (\n <div>\n {/* Hero */}\n <div className=\"flex items-start justify-between mb-8\">\n <div>\n <h1 className=\"text-3xl font-light font-mono text-text-primary\">\n {isNew ? 'New Workflow' : editing?.workflow_type ?? ''}\n </h1>\n {editing && (\n <div className=\"flex items-center gap-2 mt-2\">\n <NamespacePill namespace=\"durable\" />\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-3 mt-1\">\n <button onClick={() => navigate('/workflows/registry')} className=\"btn-ghost text-xs\">\n Cancel\n </button>\n <button\n onClick={handleSave}\n disabled={!canSave || upsert.isPending}\n className=\"btn-primary text-xs\"\n >\n {upsert.isPending ? 'Saving…' : isNew ? 'Register' : 'Save'}\n </button>\n </div>\n </div>\n\n {/* Three-column form */}\n <div className=\"grid grid-cols-1 lg:grid-cols-3 gap-x-14 gap-y-10\">\n\n {/* ── Identity ─────────────────────────────────────────────────── */}\n <div>\n <SectionHeader icon={Code2} color=\"text-accent\">Identity</SectionHeader>\n <div className=\"space-y-5\">\n <Field\n label=\"Workflow Type\"\n hint=\"Register a workflow to configure invocation and HITL escalation routing.\"\n >\n {showPickList ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs text-text-secondary\">Select a durable workflow to register:</p>\n <div className=\"grid gap-1\">\n {(unregisteredTypes as string[]).map((type) => (\n <button\n key={type}\n onClick={() => set('workflow_type', type)}\n className=\"flex items-center gap-2 px-3 py-2 text-left text-xs font-mono rounded-md border border-surface-border hover:border-accent/50 hover:bg-accent/[0.04] transition-colors\"\n >\n {type}\n </button>\n ))}\n </div>\n <div className=\"flex items-center gap-2 pt-1\">\n <span className=\"text-[10px] text-text-tertiary\">or</span>\n <input\n type=\"text\"\n onChange={(e) => set('workflow_type', e.target.value)}\n placeholder=\"Enter type manually\"\n className=\"input font-mono flex-1\"\n />\n </div>\n </div>\n ) : (\n <>\n <input\n type=\"text\"\n value={form.workflow_type}\n onChange={(e) => set('workflow_type', e.target.value)}\n disabled={!isNew}\n placeholder=\"reviewContent\"\n className=\"input font-mono w-full\"\n />\n {isNew && form.workflow_type && unregisteredTypes.length > 0 && (\n <button\n onClick={() => set('workflow_type', '')}\n className=\"text-[10px] text-accent hover:underline mt-1\"\n >\n Choose from durable workflows\n </button>\n )}\n </>\n )}\n </Field>\n\n <Field label=\"Description\">\n <input\n type=\"text\"\n value={form.description}\n onChange={(e) => set('description', e.target.value)}\n placeholder=\"Describe what this workflow does\"\n className=\"input text-xs w-full\"\n />\n </Field>\n\n <Field label=\"Task Queue\" hint=\"Durable task queue this workflow listens on.\">\n <input\n type=\"text\"\n value={form.task_queue}\n onChange={(e) => set('task_queue', e.target.value)}\n placeholder=\"lt-review\"\n className=\"input font-mono w-full\"\n />\n </Field>\n </div>\n </div>\n\n {/* ── Invocation ───────────────────────────────────────────────── */}\n <div>\n <SectionHeader icon={Play} color=\"text-accent\">Invocation</SectionHeader>\n <div className=\"space-y-5\">\n <div className=\"space-y-1\">\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={form.invocable}\n onChange={(e) => set('invocable', e.target.checked)}\n className=\"w-4 h-4 rounded border-border accent-accent\"\n />\n <span className=\"text-xs text-text-primary font-medium\">Invocable</span>\n </label>\n <p className=\"hint\">Allow this workflow to be started from the dashboard or API.</p>\n </div>\n\n {form.invocable ? (\n <>\n <Field label=\"Run As\" hint=\"Bot identity to run under. Default runs as the invoking user.\">\n <BotPicker selected={form.execute_as} onChange={(id) => set('execute_as', id)} />\n </Field>\n\n <Field label=\"Invocation Roles\" hint=\"Only users with these roles can start this workflow. Empty = all authenticated users.\">\n <RolePicker\n selected={csvToArray(form.invocation_roles)}\n onChange={(roles) => set('invocation_roles', arrayToCsv(roles))}\n placeholder=\"Select roles…\"\n />\n </Field>\n\n <Field label=\"Envelope Schema\" hint={<>Pre-fills the JSON editor when invoking. Include <code className=\"font-mono\">data</code> (input) and optional <code className=\"font-mono\">metadata</code>.</>}>\n <textarea\n value={form.envelope_schema}\n onChange={(e) => set('envelope_schema', e.target.value)}\n placeholder={'{\\n \"data\": {},\\n \"metadata\": {}\\n}'}\n className={jsonCls}\n rows={8}\n spellCheck={false}\n />\n {form.envelope_schema.trim() && !jsonValid(form.envelope_schema) && (\n <p className=\"text-[10px] text-status-error mt-1\">Invalid JSON</p>\n )}\n </Field>\n </>\n ) : (\n <p className=\"text-[11px] text-text-tertiary py-2\">\n Enable <span className=\"font-medium text-text-secondary\">Invocable</span> to configure invocation roles and an input template.\n </p>\n )}\n </div>\n </div>\n\n {/* Escalation & resolution config is ROLE-owned now — a workflow no longer\n declares a resolver schema or a certification tier here. The escalation\n surface (form_schema + resolver_schema, versioned) lives on the target\n role. This section is intentionally hidden from the workflow view. */}\n {editing && (\n <div>\n <SectionHeader icon={ShieldOff} color=\"text-text-tertiary\">Registration</SectionHeader>\n <button\n onClick={() => setConfirmUnregister(true)}\n className=\"flex items-center gap-1.5 text-[11px] text-status-warning hover:underline\"\n title=\"Delete this registration — the workflow returns to plain durable\"\n >\n <ShieldOff className=\"w-3 h-3\" /> Unregister workflow\n </button>\n </div>\n )}\n </div>\n\n {(schemaError || upsert.error) && (\n <p className=\"text-xs text-status-error mt-8\">\n {schemaError || (upsert.error as Error).message}\n </p>\n )}\n\n <ConfirmDeleteModal\n open={confirmUnregister}\n onClose={() => setConfirmUnregister(false)}\n onConfirm={() =>\n deleteConfig.mutate(editing!.workflow_type, {\n onSuccess: () => navigate('/workflows/registry'),\n })\n }\n title=\"Unregister Workflow\"\n description={\n <>\n Delete the registration for{' '}\n <span className=\"font-mono font-medium text-text-primary\">{editing?.workflow_type}</span>?\n This removes its invocation settings, certification, and interceptor treatment; the\n workflow keeps running as a plain durable workflow. Escalation schemas versioned on\n roles are untouched.\n </>\n }\n isPending={deleteConfig.isPending}\n error={deleteConfig.error as Error | null}\n />\n </div>\n );\n}\n"],"names":["TierBadge","tier","jsxs","jsx","ShieldCheck","Settings","Wrench","WorkflowConfigsPage","navigate","useNavigate","data","isLoading","useDiscoveredWorkflows","deleteConfig","useDeleteWorkflowConfig","search","setSearch","useState","activeQueue","setActiveQueue","confirmDelete","setConfirmDelete","allWorkflows","queues","useMemo","w","grouped","q","queue","_a","g","ungrouped","handleRowClick","row","handleDelete","PageHeader","FilterBar","FilterSelect","v","FilterInput","LoadingSkeleton","workflows","Server","WorkflowTableHeader","wf","WorkflowRow","ConfirmDeleteModal","Fragment","ROW_GRID","onRowClick","onDelete","onNavigate","escRoles","invokeRoles","e","WorkflowPill","r","RolePill","UserCheck","Play","ShieldPlus","ShieldOff","i","j","RolePicker","selected","onChange","single","placeholder","useRoles","allRoles","open","setOpen","ref","useRef","useEffect","handler","toggle","role","remove","placeholderText","User","X","ChevronDown","isSelected","Check","splitCsv","s","EMPTY_FORM","configToForm","c","roles","consumes","jsonValid","SectionHeader","Icon","color","children","Field","label","hint","jsonCls","csvToArray","csv","arrayToCsv","arr","SYSTEM_WORKFLOWS","WorkflowConfigDetailPage","workflowType","useParams","isNew","searchParams","useSearchParams","configs","useWorkflowConfigs","upsert","useUpsertWorkflowConfig","confirmUnregister","setConfirmUnregister","editing","jobsData","useJobs","unregisteredTypes","registeredSet","prefillForm","prefillType","prefillQueue","form","setForm","schemaError","setSchemaError","initialized","setInitialized","set","useCallback","field","value","f","handleSave","envelope_schema","resolver_schema","canSave","showPickList","NamespacePill","Code2","type","BotPicker","id"],"mappings":"8xBAmBA,SAASA,GAAU,CAAE,KAAAC,GAA0B,CAC7C,OAAIA,IAAS,YACJC,EAAAA,KAAC,OAAA,CAAK,UAAU,6EAA6E,SAAA,CAAAC,EAAAA,IAACC,EAAA,CAAY,UAAU,SAAA,CAAU,EAAE,WAAA,EAAS,EAC9IH,IAAS,aACJC,EAAAA,KAAC,OAAA,CAAK,UAAU,6EAA6E,SAAA,CAAAC,EAAAA,IAACE,GAAA,CAAS,UAAU,SAAA,CAAU,EAAE,YAAA,EAAU,EACzIH,EAAAA,KAAC,OAAA,CAAK,UAAU,8EAA8E,SAAA,CAAAC,EAAAA,IAACG,EAAA,CAAO,UAAU,SAAA,CAAU,EAAE,SAAA,EAAO,CAC5I,CAIO,SAASC,IAAsB,CACpC,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAAC,EAAM,UAAAC,CAAA,EAAcC,EAAA,EACtBC,EAAeC,EAAA,EAEf,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAE,EACjC,CAACC,EAAaC,CAAc,EAAIF,EAAAA,SAAwB,IAAI,EAC5D,CAACG,EAAeC,CAAgB,EAAIJ,EAAAA,SAAwB,IAAI,EAEhEK,EAAqCZ,GAAQ,CAAA,EAE7Ca,EAASC,EAAAA,QACb,IAAM,CAAC,GAAG,IAAI,IAAIF,EAAa,IAAKG,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,EAAK,eAAe,GAC7D5H,EAAAA,IAAC,IAAA,CAAE,UAAU,qCAAqC,SAAA,cAAA,CAAY,CAAA,CAAA,CAElE,CAAA,CAAA,CACF,EAEAD,EAAAA,KAAC,IAAA,CAAE,UAAU,sCAAsC,SAAA,CAAA,UAC1CC,EAAAA,IAAC,OAAA,CAAK,UAAU,kCAAkC,SAAA,YAAS,EAAO,uDAAA,CAAA,CAC3E,CAAA,CAAA,CAEJ,CAAA,EACF,EAMCoH,UACE,MAAA,CACC,SAAA,CAAApH,MAAC2F,EAAA,CAAc,KAAMjC,EAAW,MAAM,qBAAqB,SAAA,eAAY,EACvE3D,EAAAA,KAAC,SAAA,CACC,QAAS,IAAMoH,EAAqB,EAAI,EACxC,UAAU,4EACV,MAAM,mEAEN,SAAA,CAAAnH,EAAAA,IAAC0D,EAAA,CAAU,UAAU,SAAA,CAAU,EAAE,sBAAA,CAAA,CAAA,CACnC,CAAA,CACF,CAAA,EAEJ,GAEEoE,GAAed,EAAO,QACtBhH,EAAAA,IAAC,IAAA,CAAE,UAAU,iCACV,SAAA8H,GAAgBd,EAAO,MAAgB,OAAA,CAC1C,EAGFhH,EAAAA,IAAC2C,EAAA,CACC,KAAMuE,EACN,QAAS,IAAMC,EAAqB,EAAK,EACzC,UAAW,IACTzG,EAAa,OAAO0G,EAAS,cAAe,CAC1C,UAAW,IAAM/G,EAAS,qBAAqB,CAAA,CAChD,EAEH,MAAM,sBACN,YACEN,EAAAA,KAAA6C,WAAA,CAAE,SAAA,CAAA,8BAC4B,IAC5B5C,EAAAA,IAAC,OAAA,CAAK,UAAU,0CAA2C,0BAAS,cAAc,EAAO,gMAAA,EAI3F,EAEF,UAAWU,EAAa,UACxB,MAAOA,EAAa,KAAA,CAAA,CACtB,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{a as n,j as t}from"./vendor-query-B2UbickB.js";import{g as h}from"./workflows-FF8WUHaC.js";import{D as g}from"./DataTable-Byn3oyT9.js";import{F as y,b as j}from"./FilterBar-DDIn8TOs.js";import{R as q,a as u}from"./RowActions-BA9L9djf.js";import{u as C}from"./useFilterParams-x-Dg0Vgz.js";import{P as R}from"./PageHeader-Ji1AtA4f.js";import{T as b}from"./TaskQueuePill-CY1ZSwWu.js";import{W as _}from"./WorkflowPill-BXmmLR0t.js";import{ar as v,au as N,l as I}from"./vendor-icons-BX2Vih4L.js";import{c as P}from"./vendor-react-CXumBFUA.js";import"./index-so192yXP.js";import"./EmptyState-BcsfPq9T.js";function H(){const r=P(),{data:c,isLoading:m}=h(),{filters:s,setFilter:i}=C({filters:{search:"",queue:""}}),[a,p]=n.useState(s.search);n.useEffect(()=>{if(a===s.search)return;const e=setTimeout(()=>i("search",a),300);return()=>clearTimeout(e)},[a,i,s.search]);const o=c??[],d=n.useMemo(()=>[...new Set(o.map(e=>e.task_queue).filter(Boolean))].sort(),[o]),f=n.useMemo(()=>{let e=o;if(s.search){const l=s.search.toLowerCase();e=e.filter(w=>w.name.toLowerCase().includes(l))}return s.queue&&(e=e.filter(l=>l.task_queue===s.queue)),e},[o,s]),k=[{key:"name",label:"Workflow",render:e=>t.jsx(_,{type:e.name})},{key:"task_queue",label:"Queue",render:e=>t.jsx(b,{queue:e.task_queue}),className:"whitespace-nowrap"},{key:"registered",label:"Status",render:e=>e.registered?t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent/10 text-accent",children:[t.jsx(v,{className:"w-3 h-3"}),"Certified"]}):t.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-surface-sunken text-text-tertiary",children:"Durable"}),className:"whitespace-nowrap"},{key:"actions",label:"",render:e=>t.jsx(q,{children:e.registered?t.jsx(u,{icon:N,title:"View config",onClick:()=>r(`/workflows/registry/${encodeURIComponent(e.name)}`)}):t.jsx(u,{icon:I,title:"Register workflow",onClick:()=>r(`/workflows/registry/new?workflow_type=${encodeURIComponent(e.name)}&task_queue=${encodeURIComponent(e.task_queue)}`)})}),className:"w-16 text-right"}],x=e=>{e.registered?r(`/workflows/registry/${encodeURIComponent(e.name)}`):r(`/workflows/registry/new?workflow_type=${encodeURIComponent(e.name)}&task_queue=${encodeURIComponent(e.task_queue)}`)};return t.jsxs("div",{children:[t.jsx(R,{title:"Workers",docsHash:"#docs:dashboard.md:task-queues"}),t.jsxs(y,{children:[t.jsx("input",{type:"text",placeholder:"Search workers...",value:a,onChange:e=>p(e.target.value),className:"input text-[11px] py-1 px-2 w-56"}),t.jsx(j,{label:"Queue",value:s.queue,onChange:e=>i("queue",e),options:d.map(e=>({value:e,label:e}))})]}),t.jsx(g,{columns:k,data:f,keyFn:e=>e.name,onRowClick:x,isLoading:m,emptyMessage:"No active workers"})]})}export{H as WorkersPage};
2
- //# sourceMappingURL=index-BfDn7j4K.js.map
1
+ import{a as n,j as t}from"./vendor-query-B2UbickB.js";import{g as h}from"./workflows-BaSjfNsd.js";import{D as g}from"./DataTable-Byn3oyT9.js";import{F as y,b as j}from"./FilterBar-DDIn8TOs.js";import{R as q,a as u}from"./RowActions-BA9L9djf.js";import{u as C}from"./useFilterParams-x-Dg0Vgz.js";import{P as R}from"./PageHeader-Ji1AtA4f.js";import{T as b}from"./TaskQueuePill-CY1ZSwWu.js";import{W as _}from"./WorkflowPill-BXmmLR0t.js";import{ar as v,au as N,l as I}from"./vendor-icons-BX2Vih4L.js";import{c as P}from"./vendor-react-CXumBFUA.js";import"./index-DpGeD89g.js";import"./EmptyState-BcsfPq9T.js";function H(){const r=P(),{data:c,isLoading:m}=h(),{filters:s,setFilter:i}=C({filters:{search:"",queue:""}}),[a,p]=n.useState(s.search);n.useEffect(()=>{if(a===s.search)return;const e=setTimeout(()=>i("search",a),300);return()=>clearTimeout(e)},[a,i,s.search]);const o=c??[],d=n.useMemo(()=>[...new Set(o.map(e=>e.task_queue).filter(Boolean))].sort(),[o]),f=n.useMemo(()=>{let e=o;if(s.search){const l=s.search.toLowerCase();e=e.filter(w=>w.name.toLowerCase().includes(l))}return s.queue&&(e=e.filter(l=>l.task_queue===s.queue)),e},[o,s]),k=[{key:"name",label:"Workflow",render:e=>t.jsx(_,{type:e.name})},{key:"task_queue",label:"Queue",render:e=>t.jsx(b,{queue:e.task_queue}),className:"whitespace-nowrap"},{key:"registered",label:"Status",render:e=>e.registered?t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent/10 text-accent",children:[t.jsx(v,{className:"w-3 h-3"}),"Certified"]}):t.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-surface-sunken text-text-tertiary",children:"Durable"}),className:"whitespace-nowrap"},{key:"actions",label:"",render:e=>t.jsx(q,{children:e.registered?t.jsx(u,{icon:N,title:"View config",onClick:()=>r(`/workflows/registry/${encodeURIComponent(e.name)}`)}):t.jsx(u,{icon:I,title:"Register workflow",onClick:()=>r(`/workflows/registry/new?workflow_type=${encodeURIComponent(e.name)}&task_queue=${encodeURIComponent(e.task_queue)}`)})}),className:"w-16 text-right"}],x=e=>{e.registered?r(`/workflows/registry/${encodeURIComponent(e.name)}`):r(`/workflows/registry/new?workflow_type=${encodeURIComponent(e.name)}&task_queue=${encodeURIComponent(e.task_queue)}`)};return t.jsxs("div",{children:[t.jsx(R,{title:"Workers",docsHash:"#docs:dashboard.md:task-queues"}),t.jsxs(y,{children:[t.jsx("input",{type:"text",placeholder:"Search workers...",value:a,onChange:e=>p(e.target.value),className:"input text-[11px] py-1 px-2 w-56"}),t.jsx(j,{label:"Queue",value:s.queue,onChange:e=>i("queue",e),options:d.map(e=>({value:e,label:e}))})]}),t.jsx(g,{columns:k,data:f,keyFn:e=>e.name,onRowClick:x,isLoading:m,emptyMessage:"No active workers"})]})}export{H as WorkersPage};
2
+ //# sourceMappingURL=index-GRckVBX1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BfDn7j4K.js","sources":["../../src/pages/workflows/workers/WorkersPage.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Plus, Eye, ShieldCheck } from 'lucide-react';\nimport { useActiveWorkers } from '../../../api/workflows';\nimport { DataTable, type Column } from '../../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect } from '../../../components/common/data/FilterBar';\nimport { RowAction, RowActionGroup } from '../../../components/common/layout/RowActions';\nimport { useFilterParams } from '../../../hooks/useFilterParams';\nimport type { ActiveWorker } from '../../../api/types';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { TaskQueuePill } from '../../../components/common/display/TaskQueuePill';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\n\n// ── Page ──────────────────────────────────────────────────────────────────────\n\nexport function WorkersPage() {\n const navigate = useNavigate();\n const { data, isLoading } = useActiveWorkers();\n const { filters, setFilter } = useFilterParams({\n filters: { search: '', queue: '' },\n });\n\n const [searchInput, setSearchInput] = useState(filters.search);\n\n useEffect(() => {\n if (searchInput === filters.search) return;\n const timer = setTimeout(() => setFilter('search', searchInput), 300);\n return () => clearTimeout(timer);\n }, [searchInput, setFilter, filters.search]);\n\n const allWorkers = data ?? [];\n\n const queues = useMemo(\n () => [...new Set(allWorkers.map((w) => w.task_queue).filter(Boolean))].sort(),\n [allWorkers],\n );\n\n const workers = useMemo(() => {\n let result = allWorkers;\n if (filters.search) {\n const q = filters.search.toLowerCase();\n result = result.filter((w) => w.name.toLowerCase().includes(q));\n }\n if (filters.queue) result = result.filter((w) => w.task_queue === filters.queue);\n return result;\n }, [allWorkers, filters]);\n\n const columns: Column<ActiveWorker>[] = [\n {\n key: 'name',\n label: 'Workflow',\n render: (row) => <WorkflowPill type={row.name} />,\n },\n {\n key: 'task_queue',\n label: 'Queue',\n render: (row) => <TaskQueuePill queue={row.task_queue} />,\n className: 'whitespace-nowrap',\n },\n {\n key: 'registered',\n label: 'Status',\n render: (row) => row.registered\n ? <span className=\"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent/10 text-accent\"><ShieldCheck className=\"w-3 h-3\" />Certified</span>\n : <span className=\"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-surface-sunken text-text-tertiary\">Durable</span>,\n className: 'whitespace-nowrap',\n },\n {\n key: 'actions',\n label: '',\n render: (row) => (\n <RowActionGroup>\n {row.registered ? (\n <RowAction\n icon={Eye}\n title=\"View config\"\n onClick={() => navigate(`/workflows/registry/${encodeURIComponent(row.name)}`)}\n />\n ) : (\n <RowAction\n icon={Plus}\n title=\"Register workflow\"\n onClick={() => navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.name)}&task_queue=${encodeURIComponent(row.task_queue)}`)}\n />\n )}\n </RowActionGroup>\n ),\n className: 'w-16 text-right',\n },\n ];\n\n const handleRowClick = (row: ActiveWorker) => {\n if (row.registered) {\n navigate(`/workflows/registry/${encodeURIComponent(row.name)}`);\n } else {\n navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.name)}&task_queue=${encodeURIComponent(row.task_queue)}`);\n }\n };\n\n return (\n <div>\n <PageHeader title=\"Workers\" docsHash=\"#docs:dashboard.md:task-queues\" />\n\n <FilterBar>\n <input\n type=\"text\"\n placeholder=\"Search workers...\"\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n className=\"input text-[11px] py-1 px-2 w-56\"\n />\n <FilterSelect\n label=\"Queue\"\n value={filters.queue}\n onChange={(v) => setFilter('queue', v)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n </FilterBar>\n\n <DataTable\n columns={columns}\n data={workers}\n keyFn={(row) => row.name}\n onRowClick={handleRowClick}\n isLoading={isLoading}\n emptyMessage=\"No active workers\"\n />\n </div>\n );\n}\n"],"names":["WorkersPage","navigate","useNavigate","data","isLoading","useActiveWorkers","filters","setFilter","useFilterParams","searchInput","setSearchInput","useState","useEffect","timer","allWorkers","queues","useMemo","w","workers","result","q","columns","row","WorkflowPill","TaskQueuePill","jsxs","jsx","ShieldCheck","RowActionGroup","RowAction","Eye","Plus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G,MAAOA,GAAI,CAAA,CAAA,CACrD,EACF,EAEAM,EAAAA,IAACW,EAAA,CACC,QAAAhB,EACA,KAAMH,EACN,MAAQI,GAAQA,EAAI,KACpB,WAAYU,EACZ,UAAA5B,EACA,aAAa,mBAAA,CAAA,CACf,EACF,CAEJ"}
1
+ {"version":3,"file":"index-GRckVBX1.js","sources":["../../src/pages/workflows/workers/WorkersPage.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Plus, Eye, ShieldCheck } from 'lucide-react';\nimport { useActiveWorkers } from '../../../api/workflows';\nimport { DataTable, type Column } from '../../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect } from '../../../components/common/data/FilterBar';\nimport { RowAction, RowActionGroup } from '../../../components/common/layout/RowActions';\nimport { useFilterParams } from '../../../hooks/useFilterParams';\nimport type { ActiveWorker } from '../../../api/types';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { TaskQueuePill } from '../../../components/common/display/TaskQueuePill';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\n\n// ── Page ──────────────────────────────────────────────────────────────────────\n\nexport function WorkersPage() {\n const navigate = useNavigate();\n const { data, isLoading } = useActiveWorkers();\n const { filters, setFilter } = useFilterParams({\n filters: { search: '', queue: '' },\n });\n\n const [searchInput, setSearchInput] = useState(filters.search);\n\n useEffect(() => {\n if (searchInput === filters.search) return;\n const timer = setTimeout(() => setFilter('search', searchInput), 300);\n return () => clearTimeout(timer);\n }, [searchInput, setFilter, filters.search]);\n\n const allWorkers = data ?? [];\n\n const queues = useMemo(\n () => [...new Set(allWorkers.map((w) => w.task_queue).filter(Boolean))].sort(),\n [allWorkers],\n );\n\n const workers = useMemo(() => {\n let result = allWorkers;\n if (filters.search) {\n const q = filters.search.toLowerCase();\n result = result.filter((w) => w.name.toLowerCase().includes(q));\n }\n if (filters.queue) result = result.filter((w) => w.task_queue === filters.queue);\n return result;\n }, [allWorkers, filters]);\n\n const columns: Column<ActiveWorker>[] = [\n {\n key: 'name',\n label: 'Workflow',\n render: (row) => <WorkflowPill type={row.name} />,\n },\n {\n key: 'task_queue',\n label: 'Queue',\n render: (row) => <TaskQueuePill queue={row.task_queue} />,\n className: 'whitespace-nowrap',\n },\n {\n key: 'registered',\n label: 'Status',\n render: (row) => row.registered\n ? <span className=\"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-accent/10 text-accent\"><ShieldCheck className=\"w-3 h-3\" />Certified</span>\n : <span className=\"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-surface-sunken text-text-tertiary\">Durable</span>,\n className: 'whitespace-nowrap',\n },\n {\n key: 'actions',\n label: '',\n render: (row) => (\n <RowActionGroup>\n {row.registered ? (\n <RowAction\n icon={Eye}\n title=\"View config\"\n onClick={() => navigate(`/workflows/registry/${encodeURIComponent(row.name)}`)}\n />\n ) : (\n <RowAction\n icon={Plus}\n title=\"Register workflow\"\n onClick={() => navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.name)}&task_queue=${encodeURIComponent(row.task_queue)}`)}\n />\n )}\n </RowActionGroup>\n ),\n className: 'w-16 text-right',\n },\n ];\n\n const handleRowClick = (row: ActiveWorker) => {\n if (row.registered) {\n navigate(`/workflows/registry/${encodeURIComponent(row.name)}`);\n } else {\n navigate(`/workflows/registry/new?workflow_type=${encodeURIComponent(row.name)}&task_queue=${encodeURIComponent(row.task_queue)}`);\n }\n };\n\n return (\n <div>\n <PageHeader title=\"Workers\" docsHash=\"#docs:dashboard.md:task-queues\" />\n\n <FilterBar>\n <input\n type=\"text\"\n placeholder=\"Search workers...\"\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n className=\"input text-[11px] py-1 px-2 w-56\"\n />\n <FilterSelect\n label=\"Queue\"\n value={filters.queue}\n onChange={(v) => setFilter('queue', v)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n </FilterBar>\n\n <DataTable\n columns={columns}\n data={workers}\n keyFn={(row) => row.name}\n onRowClick={handleRowClick}\n isLoading={isLoading}\n emptyMessage=\"No active workers\"\n />\n </div>\n );\n}\n"],"names":["WorkersPage","navigate","useNavigate","data","isLoading","useActiveWorkers","filters","setFilter","useFilterParams","searchInput","setSearchInput","useState","useEffect","timer","allWorkers","queues","useMemo","w","workers","result","q","columns","row","WorkflowPill","TaskQueuePill","jsxs","jsx","ShieldCheck","RowActionGroup","RowAction","Eye","Plus","handleRowClick","PageHeader","FilterBar","FilterSelect","v","DataTable"],"mappings":"8lBAeO,SAASA,GAAc,CAC5B,MAAMC,EAAWC,EAAA,EACX,CAAE,KAAAC,EAAM,UAAAC,CAAA,EAAcC,EAAA,EACtB,CAAE,QAAAC,EAAS,UAAAC,CAAA,EAAcC,EAAgB,CAC7C,QAAS,CAAE,OAAQ,GAAI,MAAO,EAAA,CAAG,CAClC,EAEK,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAASL,EAAQ,MAAM,EAE7DM,EAAAA,UAAU,IAAM,CACd,GAAIH,IAAgBH,EAAQ,OAAQ,OACpC,MAAMO,EAAQ,WAAW,IAAMN,EAAU,SAAUE,CAAW,EAAG,GAAG,EACpE,MAAO,IAAM,aAAaI,CAAK,CACjC,EAAG,CAACJ,EAAaF,EAAWD,EAAQ,MAAM,CAAC,EAE3C,MAAMQ,EAAaX,GAAQ,CAAA,EAErBY,EAASC,EAAAA,QACb,IAAM,CAAC,GAAG,IAAI,IAAIF,EAAW,IAAKG,GAAMA,EAAE,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAA,EACxE,CAACH,CAAU,CAAA,EAGPI,EAAUF,EAAAA,QAAQ,IAAM,CAC5B,IAAIG,EAASL,EACb,GAAIR,EAAQ,OAAQ,CAClB,MAAMc,EAAId,EAAQ,OAAO,YAAA,EACzBa,EAASA,EAAO,OAAQ,GAAM,EAAE,KAAK,YAAA,EAAc,SAASC,CAAC,CAAC,CAChE,CACA,OAAId,EAAQ,QAAOa,EAASA,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AAR,EAAAA,IAAC,QAAA,CACC,KAAK,OACL,YAAY,oBACZ,MAAOjB,EACP,SAAW,GAAMC,EAAe,EAAE,OAAO,KAAK,EAC9C,UAAU,kCAAA,CAAA,EAEZgB,EAAAA,IAACS,EAAA,CACC,MAAM,QACN,MAAO7B,EAAQ,MACf,SAAW8B,GAAM7B,EAAU,QAAS6B,CAAC,EACrC,QAASrB,EAAO,IAAKK,IAAO,CAAE,MAAOA,EAAG,MAAOA,GAAI,CAAA,CAAA,CACrD,EACF,EAEAM,EAAAA,IAACW,EAAA,CACC,QAAAhB,EACA,KAAMH,EACN,MAAQI,GAAQA,EAAI,KACpB,WAAYU,EACZ,UAAA5B,EACA,aAAa,mBAAA,CAAA,CACf,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as oe}from"./PageHeader-Ji1AtA4f.js";import{F as le,a as ce}from"./FilterBar-DDIn8TOs.js";import{L as de}from"./ListToolbar-nWxpujpH.js";import{S as xe}from"./StickyPagination-BfgBtP_B.js";import{E as Y}from"./EmptyState-BcsfPq9T.js";import{D as me}from"./DropZone-wJqP4zA4.js";import{T as _}from"./TimeAgo-Bagm-L2o.js";import{u as ue,a as pe,b as ne,c as he,d as fe,e as ie,f as ge}from"./knowledge-DDt599ea.js";import{T as je}from"./TagInput-By0E_Jym.js";import{p as ye,X as be,l as Z,e as X,o as ee,D as te,aW as se}from"./vendor-icons-BX2Vih4L.js";import{a as Ne,f as ve}from"./vendor-react-CXumBFUA.js";import"./index-so192yXP.js";function we(a){return a==null?"":typeof a=="string"?a:JSON.stringify(a,null,2)}function ae(a){const r=a.trim();if(!r)return{value:"",looksLikeJson:!1,parsedOk:!1};const o=r.startsWith("{")||r.startsWith("[");try{return{value:JSON.parse(r),looksLikeJson:o,parsedOk:!0}}catch{return{value:r,looksLikeJson:o,parsedOk:!1}}}function re(a){if(typeof a=="string"){const r=a.trim();return!(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))}return typeof a=="number"||typeof a=="boolean"||a===null}function q({value:a,onChange:r,onKeyDown:o,placeholder:l,mono:d}){const x=i.useRef(null);return i.useEffect(()=>{x.current&&(x.current.style.height="auto",x.current.style.height=`${x.current.scrollHeight}px`,x.current.focus())},[a]),e.jsx("textarea",{ref:x,value:a,onChange:y=>r(y.target.value),onKeyDown:o,placeholder:l,rows:1,className:`w-full bg-transparent text-xs text-text-primary resize-none outline-none p-0 ${d?"font-mono":""}`,style:{minHeight:"1.5em"}})}function ke({domain:a,entryKey:r,onDeleted:o}){const{data:l,isLoading:d,refetch:x}=ue(a,r),y=pe(),m=ne(),F=he(),k=fe(),[S,O]=i.useState(!1),[u,f]=i.useState(null),[C,g]=i.useState(""),[j,E]=i.useState(""),[P,n]=i.useState(""),[A,J]=i.useState(null),[$,L]=i.useState(null),[K,b]=i.useState(!1),N=l==null?void 0:l.data,R=N?Object.entries(N):[],H=i.useMemo(()=>{const t=j.trim().toLowerCase();return t?R.filter(([h])=>h.toLowerCase().includes(t)):R},[R,j]),G=i.useCallback((t,h)=>h==="field"?t:we(N==null?void 0:N[t]),[N]),z=u?C!==G(u.field,u.column):!1;function M(t,h){f({field:t,column:h}),g(G(t,h)),J(null)}function T(){f(null),g("")}function s(){L("Invalid JSON — saved as text"),setTimeout(()=>L(null),4e3)}async function c(){if(!u||!N)return;const{field:t,column:h}=u;if(h==="value"){const{value:w,looksLikeJson:D,parsedOk:I}=ae(C);D&&!I&&s(),await F.mutateAsync({domain:a,key:r,path:t,value:w})}else{const w=C.trim();if(!w||w===t){T();return}const D=N[t];await k.mutateAsync({domain:a,key:r,path:t}),await F.mutateAsync({domain:a,key:r,path:w,value:D})}f(null),g(""),x()}async function v(t){await k.mutateAsync({domain:a,key:r,path:t}),J(null),f(null),x()}async function p(t){await m.mutateAsync({domain:a,key:r,data:N||{},tags:t,replace:!0}),x()}async function B(){const t=j.trim();if(!t)return;const{value:h,looksLikeJson:w,parsedOk:D}=ae(P);w&&!D&&s();const I={...N,[t]:h||""};await m.mutateAsync({domain:a,key:r,data:I}),E(""),n(""),x()}function U(t){t.key==="Escape"?T():t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),c())}function Q(t){t.key==="Escape"?(E(""),n("")):t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),B())}return d?e.jsxs("div",{className:"animate-pulse space-y-3 mt-4",children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),e.jsx("div",{className:"h-48 bg-surface-sunken rounded"})]}):!l||l.found===!1?e.jsx("p",{className:"text-sm text-text-tertiary mt-4",children:"Entry not found."}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"flex items-center gap-4 min-h-[28px]",children:K?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{tags:l.tags||[],onChange:t=>{p(t)},placeholder:"Add tag...",compact:!0}),e.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-text-tertiary hover:text-text-secondary shrink-0",children:"Done"})]}):e.jsx("div",{className:"flex items-center gap-1 cursor-text group",onClick:()=>b(!0),title:"Click to edit tags",children:l.tags&&l.tags.length>0?l.tags.map(t=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-accent/10 text-accent",children:t},t)):e.jsx("span",{className:"text-[10px] text-text-tertiary/40 italic group-hover:text-text-tertiary",children:"add tags..."})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:e.jsx(_,{date:l.updated_at})}),S?e.jsxs("span",{className:"flex items-center gap-2 text-[10px]",children:[e.jsx("span",{className:"text-status-error",children:"Delete entry?"}),e.jsx("button",{onClick:async()=>{try{await y.mutateAsync({domain:a,key:r}),o()}catch{}},className:"font-medium text-status-error hover:text-status-error/80",disabled:y.isPending,children:y.isPending?"Deleting...":"Yes"}),e.jsx("button",{onClick:()=>O(!1),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):e.jsx("button",{onClick:()=>O(!0),className:"text-text-tertiary/50 hover:text-status-error transition-colors",title:"Delete entry",children:e.jsx(ye,{className:"w-3.5 h-3.5"})})]})]}),$&&e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2 px-1",children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full dot-ring bg-status-warning animate-pulse"}),e.jsx("span",{className:"text-xs text-status-warning",children:$})]}),e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{className:"sticky top-0 z-10 bg-surface",children:[e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary border-b border-surface-border",children:[e.jsx("th",{className:"px-3 py-2 font-medium w-[200px] border-r border-surface-border",children:"Field"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Value"})]}),e.jsxs("tr",{className:"border-b border-surface-border bg-surface",children:[e.jsx("td",{className:"px-3 py-2 align-top border-r border-surface-border",children:e.jsx("input",{value:j,onChange:t=>E(t.target.value),onKeyDown:Q,placeholder:R.length?"add or filter...":"new field",className:"w-full bg-transparent text-xs text-text-primary placeholder:text-text-tertiary/40 placeholder:italic outline-none p-0"})}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(q,{value:P,onChange:n,onKeyDown:Q,placeholder:"value"}),j.trim()&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:B,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:()=>{E(""),n("")},className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]})]})]}),e.jsx("tbody",{children:H.map(([t,h])=>{const w=(u==null?void 0:u.field)===t&&u.column==="field",D=(u==null?void 0:u.field)===t&&u.column==="value",I=w||D,W=A===t;return e.jsxs("tr",{className:`border-b border-surface-border ${W?"bg-status-error/10":I?"":"hover:bg-surface-hover/30"}`,children:[e.jsx("td",{className:`px-3 py-2 align-top border-r cursor-text ${W?"bg-transparent border-r-transparent":w?"border-r-surface-border bg-accent/5 border-l-2 border-l-accent":"border-r-surface-border"}`,onClick:()=>!w&&!W&&M(t,"field"),children:w?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:g,onKeyDown:U,placeholder:"field name"}),z&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:c,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:T,className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]}):e.jsx("span",{className:"text-xs font-medium text-text-secondary break-all",children:t})}),e.jsx("td",{className:`px-3 py-2 align-top cursor-text ${W?"bg-transparent":D?"bg-accent/5 border-l-2 border-l-accent":""}`,onClick:()=>!D&&!W&&M(t,"value"),children:W?e.jsxs("span",{className:"flex items-center justify-end gap-2 text-[10px]",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium",children:t}),"?"]}),e.jsx("button",{onClick:V=>{V.stopPropagation(),v(t)},className:"font-medium text-status-error hover:text-status-error/80",disabled:m.isPending,children:m.isPending?"...":"Yes"}),e.jsx("button",{onClick:V=>{V.stopPropagation(),J(null)},className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):D?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:g,onKeyDown:U,placeholder:"value (string or JSON)",mono:!re(h)}),e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[z&&e.jsx("button",{onClick:c,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:T,className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:V=>{V.stopPropagation(),J(t)},className:"text-[10px] text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):re(h)?e.jsx("p",{className:"text-xs text-text-primary break-words whitespace-pre-wrap",children:String(h)}):e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap break-words",children:typeof h=="string"?h:JSON.stringify(h,null,2)})})]},t)})})]})]})}function Se({open:a,onClose:r,onCreated:o,prefillData:l,prefillDomain:d}){const{data:x}=ie(),y=ne(),[m,F]=i.useState(d||""),[k,S]=i.useState(""),[O,u]=i.useState(l?JSON.stringify(l,null,2):"{}"),[f,C]=i.useState(""),[g,j]=i.useState(""),E=((x==null?void 0:x.domains)??[]).map(n=>n.domain);if(i.useEffect(()=>{a&&(u(l?JSON.stringify(l,null,2):"{}"),F(d||""),S(""),C(""),j(""))},[a,l,d]),!a)return null;const P=async()=>{if(j(""),!m.trim()){j("Domain is required");return}if(!k.trim()){j("Key is required");return}let n;try{if(n=JSON.parse(O),typeof n!="object"||Array.isArray(n))throw new Error}catch{j("Data must be a valid JSON object");return}try{await y.mutateAsync({domain:m.trim(),key:k.trim(),data:n,tags:f?f.split(",").map(A=>A.trim()).filter(Boolean):[]}),o==null||o(m.trim(),k.trim()),r()}catch(A){j(A.message)}};return Ne.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:r}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 overflow-y-auto",children:e.jsxs("div",{className:"bg-surface-raised border border-surface-border rounded-lg shadow-lg w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-surface-border",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"New Knowledge Entry"}),e.jsx("button",{onClick:r,className:"text-text-tertiary hover:text-text-primary",children:e.jsx(be,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Domain"}),e.jsx("input",{type:"text",list:"domain-list",value:m,onChange:n=>F(n.target.value),placeholder:"e.g., screenshots, config, emails",className:"input text-xs w-full"}),e.jsx("datalist",{id:"domain-list",children:E.map(n=>e.jsx("option",{value:n},n))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Key"}),e.jsx("input",{type:"text",value:k,onChange:n=>S(n.target.value),placeholder:"e.g., homepage, user-profile, report-2026",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Data (JSON)"}),e.jsx("textarea",{value:O,onChange:n=>u(n.target.value),rows:8,className:"input-json w-full max-h-[30vh]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tags (comma-separated)"}),e.jsx("input",{type:"text",value:f,onChange:n=>C(n.target.value),placeholder:"e.g., important, review, 401k",className:"input text-xs w-full"})]}),g&&e.jsx("p",{className:"text-xs text-status-error",children:g})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-surface-border",children:[e.jsx("button",{onClick:r,className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:P,disabled:y.isPending,className:"btn-primary text-xs",children:y.isPending?"Creating...":"Create Entry"})]})]})})]}),document.body)}const Ce=50;function ze(){var z,M,T;const[a,r]=ve(),o=a.get("domain")||"",l=a.get("key")||"",[d,x]=i.useState(""),[y,m]=i.useState(""),[F,k]=i.useState(1),[S,O]=i.useState(Ce),[u,f]=i.useState(!1),[C,g]=i.useState(),j=i.useCallback(s=>{console.debug("[Knowledge] drop received:",s.map(p=>({name:p.name,type:p.type,size:p.size})));const c=s.find(p=>p.name.endsWith(".json")||p.type==="application/json");if(!c){console.warn("[Knowledge] no JSON file found in dropped files");return}console.debug("[Knowledge] reading:",c.name);const v=new FileReader;v.onload=()=>{try{const p=JSON.parse(v.result);typeof p=="object"&&!Array.isArray(p)?(console.debug("[Knowledge] parsed object with keys:",Object.keys(p)),g(p),f(!0)):console.warn("[Knowledge] JSON is not a plain object, got:",Array.isArray(p)?"array":typeof p)}catch(p){console.warn("[Knowledge] JSON parse failed:",p)}},v.readAsText(c)},[]);i.useEffect(()=>{const s=setTimeout(()=>{m(d),k(1)},300);return()=>clearTimeout(s)},[d]);const E=(F-1)*S,P=ie(),n=ge(o,{search:y||void 0,limit:S,offset:E}),A=((z=P.data)==null?void 0:z.domains)??[],J=((M=n.data)==null?void 0:M.entries)??[],$=((T=n.data)==null?void 0:T.total)??0,L=i.useMemo(()=>{if(!d)return A;const s=d.toLowerCase();return A.filter(c=>c.domain.toLowerCase().includes(s))},[A,d]);function K(s,c){x(""),m(""),k(1);const v={};s&&(v.domain=s),c&&(v.key=c),r(v)}const b=l?"entry":o?"entries":"domains",N=b==="entries"?n.isLoading:b==="domains"?P.isLoading:!1,R=Math.ceil((b==="entries"?$:L.length)/S),H=o?`/knowledge/entries?domain=${encodeURIComponent(o)}&limit=${S}&offset=${E}${y?`&search=${encodeURIComponent(y)}`:""}`:void 0;return e.jsxs(me,{onDrop:j,label:"Drop a JSON file to create an entry",accept:".json,application/json",children:[e.jsxs("div",{children:[e.jsx(oe,{title:"Knowledge",docsHash:"#docs:dashboard.md:knowledge",actions:e.jsxs("button",{onClick:()=>{g(void 0),f(!0)},className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(Z,{className:"w-3.5 h-3.5"}),"New Entry"]})}),e.jsxs("nav",{className:"flex items-center gap-1 text-sm mb-6 min-h-[28px]",children:[e.jsxs("button",{onClick:()=>K(""),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${b==="domains"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(X,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),e.jsx("span",{children:"All Domains"})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("button",{onClick:()=>K(o),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${b==="entries"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(te,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),o]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("span",{className:"flex items-center gap-1.5 px-1.5 py-0.5 text-text-primary font-medium",children:[e.jsx(se,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),l]})]})]}),b==="entry"?e.jsx(ke,{domain:o,entryKey:l,onDeleted:()=>K(o)}):e.jsxs(e.Fragment,{children:[e.jsx(le,{actions:e.jsx(de,{onRefresh:()=>b==="entries"?n.refetch():P.refetch(),isFetching:b==="entries"?n.isFetching:P.isFetching,apiPath:b==="entries"?H:"/knowledge/domains"}),children:e.jsx(ce,{label:"Search",value:d,onChange:x,placeholder:o?"Filter by key or tag...":"Filter by domain..."})}),N?e.jsx("div",{className:"animate-pulse space-y-2 mt-4",children:Array.from({length:6}).map((s,c)=>e.jsx("div",{className:"h-10 bg-surface-sunken rounded"},c))}):b==="domains"?L.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{g(void 0),f(!0)},children:e.jsx(Y,{icon:X,title:d?"No matching domains":"No knowledge yet",description:d?void 0:"Create your first entry or drop a JSON file"})}):e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium",children:"Domain"}),e.jsx("th",{className:"pb-2 font-medium w-24 text-right",children:"Entries"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-40 text-right",children:"Latest"})]})}),e.jsx("tbody",{children:L.map(s=>e.jsxs("tr",{onClick:()=>K(s.domain),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(te,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors",children:s.domain})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.count}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(_,{date:s.latest})})]},s.domain))})]}):J.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{g(void 0),f(!0)},children:e.jsx(Y,{icon:Z,title:d?"No matching entries":"No entries in this domain",description:d?void 0:"Add an entry or drop a JSON file"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium w-[200px]",children:"Key"}),e.jsx("th",{className:"pb-2 font-medium",children:"Tags"}),e.jsx("th",{className:"pb-2 font-medium w-16 text-right",children:"Fields"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-32 text-right",children:"Updated"})]})}),e.jsx("tbody",{children:J.map(s=>{var c;return e.jsxs("tr",{onClick:()=>K(o,s.key),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2 w-[200px]",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(se,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors truncate max-w-[160px]",title:s.key,children:s.key})]})}),e.jsx("td",{className:"py-2",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c=s.tags)==null?void 0:c.slice(0,5).map(v=>e.jsx("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] font-medium bg-accent/10 text-accent",children:v},v)),s.tags&&s.tags.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",s.tags.length-5]})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.data?Object.keys(s.data).length:0}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(_,{date:s.updated_at})})]},s.key)})})]}),e.jsx(xe,{page:F,totalPages:R,onPageChange:k,total:$,pageSize:S,onPageSizeChange:O})]})]})]}),e.jsx(Se,{open:u,onClose:()=>{f(!1),g(void 0)},onCreated:(s,c)=>{r({domain:s,key:c}),P.refetch()},prefillData:C,prefillDomain:o||void 0})]})}export{ze as KnowledgePage};
2
- //# sourceMappingURL=index-QOTnrFd1.js.map
1
+ import{a as i,j as e}from"./vendor-query-B2UbickB.js";import{P as oe}from"./PageHeader-Ji1AtA4f.js";import{F as le,a as ce}from"./FilterBar-DDIn8TOs.js";import{L as de}from"./ListToolbar-BhXp7clK.js";import{S as xe}from"./StickyPagination-BwXLmDc-.js";import{E as Y}from"./EmptyState-BcsfPq9T.js";import{D as me}from"./DropZone-wJqP4zA4.js";import{T as _}from"./TimeAgo-CuI-66Kw.js";import{u as ue,a as pe,b as ne,c as he,d as fe,e as ie,f as ge}from"./knowledge-Bw51BCX9.js";import{T as je}from"./TagInput-By0E_Jym.js";import{p as ye,X as be,l as Z,e as X,o as ee,D as te,aW as se}from"./vendor-icons-BX2Vih4L.js";import{a as Ne,f as ve}from"./vendor-react-CXumBFUA.js";import"./index-DpGeD89g.js";function we(a){return a==null?"":typeof a=="string"?a:JSON.stringify(a,null,2)}function ae(a){const r=a.trim();if(!r)return{value:"",looksLikeJson:!1,parsedOk:!1};const o=r.startsWith("{")||r.startsWith("[");try{return{value:JSON.parse(r),looksLikeJson:o,parsedOk:!0}}catch{return{value:r,looksLikeJson:o,parsedOk:!1}}}function re(a){if(typeof a=="string"){const r=a.trim();return!(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))}return typeof a=="number"||typeof a=="boolean"||a===null}function q({value:a,onChange:r,onKeyDown:o,placeholder:l,mono:d}){const x=i.useRef(null);return i.useEffect(()=>{x.current&&(x.current.style.height="auto",x.current.style.height=`${x.current.scrollHeight}px`,x.current.focus())},[a]),e.jsx("textarea",{ref:x,value:a,onChange:y=>r(y.target.value),onKeyDown:o,placeholder:l,rows:1,className:`w-full bg-transparent text-xs text-text-primary resize-none outline-none p-0 ${d?"font-mono":""}`,style:{minHeight:"1.5em"}})}function ke({domain:a,entryKey:r,onDeleted:o}){const{data:l,isLoading:d,refetch:x}=ue(a,r),y=pe(),m=ne(),F=he(),k=fe(),[S,O]=i.useState(!1),[u,f]=i.useState(null),[C,g]=i.useState(""),[j,E]=i.useState(""),[P,n]=i.useState(""),[A,J]=i.useState(null),[$,L]=i.useState(null),[K,b]=i.useState(!1),N=l==null?void 0:l.data,R=N?Object.entries(N):[],H=i.useMemo(()=>{const t=j.trim().toLowerCase();return t?R.filter(([h])=>h.toLowerCase().includes(t)):R},[R,j]),G=i.useCallback((t,h)=>h==="field"?t:we(N==null?void 0:N[t]),[N]),z=u?C!==G(u.field,u.column):!1;function M(t,h){f({field:t,column:h}),g(G(t,h)),J(null)}function T(){f(null),g("")}function s(){L("Invalid JSON — saved as text"),setTimeout(()=>L(null),4e3)}async function c(){if(!u||!N)return;const{field:t,column:h}=u;if(h==="value"){const{value:w,looksLikeJson:D,parsedOk:I}=ae(C);D&&!I&&s(),await F.mutateAsync({domain:a,key:r,path:t,value:w})}else{const w=C.trim();if(!w||w===t){T();return}const D=N[t];await k.mutateAsync({domain:a,key:r,path:t}),await F.mutateAsync({domain:a,key:r,path:w,value:D})}f(null),g(""),x()}async function v(t){await k.mutateAsync({domain:a,key:r,path:t}),J(null),f(null),x()}async function p(t){await m.mutateAsync({domain:a,key:r,data:N||{},tags:t,replace:!0}),x()}async function B(){const t=j.trim();if(!t)return;const{value:h,looksLikeJson:w,parsedOk:D}=ae(P);w&&!D&&s();const I={...N,[t]:h||""};await m.mutateAsync({domain:a,key:r,data:I}),E(""),n(""),x()}function U(t){t.key==="Escape"?T():t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),c())}function Q(t){t.key==="Escape"?(E(""),n("")):t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),B())}return d?e.jsxs("div",{className:"animate-pulse space-y-3 mt-4",children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),e.jsx("div",{className:"h-48 bg-surface-sunken rounded"})]}):!l||l.found===!1?e.jsx("p",{className:"text-sm text-text-tertiary mt-4",children:"Entry not found."}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"flex items-center gap-4 min-h-[28px]",children:K?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{tags:l.tags||[],onChange:t=>{p(t)},placeholder:"Add tag...",compact:!0}),e.jsx("button",{onClick:()=>b(!1),className:"text-[10px] text-text-tertiary hover:text-text-secondary shrink-0",children:"Done"})]}):e.jsx("div",{className:"flex items-center gap-1 cursor-text group",onClick:()=>b(!0),title:"Click to edit tags",children:l.tags&&l.tags.length>0?l.tags.map(t=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-accent/10 text-accent",children:t},t)):e.jsx("span",{className:"text-[10px] text-text-tertiary/40 italic group-hover:text-text-tertiary",children:"add tags..."})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:e.jsx(_,{date:l.updated_at})}),S?e.jsxs("span",{className:"flex items-center gap-2 text-[10px]",children:[e.jsx("span",{className:"text-status-error",children:"Delete entry?"}),e.jsx("button",{onClick:async()=>{try{await y.mutateAsync({domain:a,key:r}),o()}catch{}},className:"font-medium text-status-error hover:text-status-error/80",disabled:y.isPending,children:y.isPending?"Deleting...":"Yes"}),e.jsx("button",{onClick:()=>O(!1),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):e.jsx("button",{onClick:()=>O(!0),className:"text-text-tertiary/50 hover:text-status-error transition-colors",title:"Delete entry",children:e.jsx(ye,{className:"w-3.5 h-3.5"})})]})]}),$&&e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2 px-1",children:[e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full dot-ring bg-status-warning animate-pulse"}),e.jsx("span",{className:"text-xs text-status-warning",children:$})]}),e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{className:"sticky top-0 z-10 bg-surface",children:[e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary border-b border-surface-border",children:[e.jsx("th",{className:"px-3 py-2 font-medium w-[200px] border-r border-surface-border",children:"Field"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Value"})]}),e.jsxs("tr",{className:"border-b border-surface-border bg-surface",children:[e.jsx("td",{className:"px-3 py-2 align-top border-r border-surface-border",children:e.jsx("input",{value:j,onChange:t=>E(t.target.value),onKeyDown:Q,placeholder:R.length?"add or filter...":"new field",className:"w-full bg-transparent text-xs text-text-primary placeholder:text-text-tertiary/40 placeholder:italic outline-none p-0"})}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(q,{value:P,onChange:n,onKeyDown:Q,placeholder:"value"}),j.trim()&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:B,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:()=>{E(""),n("")},className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]})]})]}),e.jsx("tbody",{children:H.map(([t,h])=>{const w=(u==null?void 0:u.field)===t&&u.column==="field",D=(u==null?void 0:u.field)===t&&u.column==="value",I=w||D,W=A===t;return e.jsxs("tr",{className:`border-b border-surface-border ${W?"bg-status-error/10":I?"":"hover:bg-surface-hover/30"}`,children:[e.jsx("td",{className:`px-3 py-2 align-top border-r cursor-text ${W?"bg-transparent border-r-transparent":w?"border-r-surface-border bg-accent/5 border-l-2 border-l-accent":"border-r-surface-border"}`,onClick:()=>!w&&!W&&M(t,"field"),children:w?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:g,onKeyDown:U,placeholder:"field name"}),z&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:c,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:T,className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]}):e.jsx("span",{className:"text-xs font-medium text-text-secondary break-all",children:t})}),e.jsx("td",{className:`px-3 py-2 align-top cursor-text ${W?"bg-transparent":D?"bg-accent/5 border-l-2 border-l-accent":""}`,onClick:()=>!D&&!W&&M(t,"value"),children:W?e.jsxs("span",{className:"flex items-center justify-end gap-2 text-[10px]",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium",children:t}),"?"]}),e.jsx("button",{onClick:V=>{V.stopPropagation(),v(t)},className:"font-medium text-status-error hover:text-status-error/80",disabled:m.isPending,children:m.isPending?"...":"Yes"}),e.jsx("button",{onClick:V=>{V.stopPropagation(),J(null)},className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):D?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:g,onKeyDown:U,placeholder:"value (string or JSON)",mono:!re(h)}),e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[z&&e.jsx("button",{onClick:c,className:"text-[10px] font-medium text-accent hover:text-accent-hover",disabled:m.isPending,children:m.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:T,className:"text-[10px] text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:V=>{V.stopPropagation(),J(t)},className:"text-[10px] text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):re(h)?e.jsx("p",{className:"text-xs text-text-primary break-words whitespace-pre-wrap",children:String(h)}):e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap break-words",children:typeof h=="string"?h:JSON.stringify(h,null,2)})})]},t)})})]})]})}function Se({open:a,onClose:r,onCreated:o,prefillData:l,prefillDomain:d}){const{data:x}=ie(),y=ne(),[m,F]=i.useState(d||""),[k,S]=i.useState(""),[O,u]=i.useState(l?JSON.stringify(l,null,2):"{}"),[f,C]=i.useState(""),[g,j]=i.useState(""),E=((x==null?void 0:x.domains)??[]).map(n=>n.domain);if(i.useEffect(()=>{a&&(u(l?JSON.stringify(l,null,2):"{}"),F(d||""),S(""),C(""),j(""))},[a,l,d]),!a)return null;const P=async()=>{if(j(""),!m.trim()){j("Domain is required");return}if(!k.trim()){j("Key is required");return}let n;try{if(n=JSON.parse(O),typeof n!="object"||Array.isArray(n))throw new Error}catch{j("Data must be a valid JSON object");return}try{await y.mutateAsync({domain:m.trim(),key:k.trim(),data:n,tags:f?f.split(",").map(A=>A.trim()).filter(Boolean):[]}),o==null||o(m.trim(),k.trim()),r()}catch(A){j(A.message)}};return Ne.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:r}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 overflow-y-auto",children:e.jsxs("div",{className:"bg-surface-raised border border-surface-border rounded-lg shadow-lg w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-surface-border",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"New Knowledge Entry"}),e.jsx("button",{onClick:r,className:"text-text-tertiary hover:text-text-primary",children:e.jsx(be,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Domain"}),e.jsx("input",{type:"text",list:"domain-list",value:m,onChange:n=>F(n.target.value),placeholder:"e.g., screenshots, config, emails",className:"input text-xs w-full"}),e.jsx("datalist",{id:"domain-list",children:E.map(n=>e.jsx("option",{value:n},n))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Key"}),e.jsx("input",{type:"text",value:k,onChange:n=>S(n.target.value),placeholder:"e.g., homepage, user-profile, report-2026",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Data (JSON)"}),e.jsx("textarea",{value:O,onChange:n=>u(n.target.value),rows:8,className:"input-json w-full max-h-[30vh]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tags (comma-separated)"}),e.jsx("input",{type:"text",value:f,onChange:n=>C(n.target.value),placeholder:"e.g., important, review, 401k",className:"input text-xs w-full"})]}),g&&e.jsx("p",{className:"text-xs text-status-error",children:g})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-surface-border",children:[e.jsx("button",{onClick:r,className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:P,disabled:y.isPending,className:"btn-primary text-xs",children:y.isPending?"Creating...":"Create Entry"})]})]})})]}),document.body)}const Ce=50;function ze(){var z,M,T;const[a,r]=ve(),o=a.get("domain")||"",l=a.get("key")||"",[d,x]=i.useState(""),[y,m]=i.useState(""),[F,k]=i.useState(1),[S,O]=i.useState(Ce),[u,f]=i.useState(!1),[C,g]=i.useState(),j=i.useCallback(s=>{console.debug("[Knowledge] drop received:",s.map(p=>({name:p.name,type:p.type,size:p.size})));const c=s.find(p=>p.name.endsWith(".json")||p.type==="application/json");if(!c){console.warn("[Knowledge] no JSON file found in dropped files");return}console.debug("[Knowledge] reading:",c.name);const v=new FileReader;v.onload=()=>{try{const p=JSON.parse(v.result);typeof p=="object"&&!Array.isArray(p)?(console.debug("[Knowledge] parsed object with keys:",Object.keys(p)),g(p),f(!0)):console.warn("[Knowledge] JSON is not a plain object, got:",Array.isArray(p)?"array":typeof p)}catch(p){console.warn("[Knowledge] JSON parse failed:",p)}},v.readAsText(c)},[]);i.useEffect(()=>{const s=setTimeout(()=>{m(d),k(1)},300);return()=>clearTimeout(s)},[d]);const E=(F-1)*S,P=ie(),n=ge(o,{search:y||void 0,limit:S,offset:E}),A=((z=P.data)==null?void 0:z.domains)??[],J=((M=n.data)==null?void 0:M.entries)??[],$=((T=n.data)==null?void 0:T.total)??0,L=i.useMemo(()=>{if(!d)return A;const s=d.toLowerCase();return A.filter(c=>c.domain.toLowerCase().includes(s))},[A,d]);function K(s,c){x(""),m(""),k(1);const v={};s&&(v.domain=s),c&&(v.key=c),r(v)}const b=l?"entry":o?"entries":"domains",N=b==="entries"?n.isLoading:b==="domains"?P.isLoading:!1,R=Math.ceil((b==="entries"?$:L.length)/S),H=o?`/knowledge/entries?domain=${encodeURIComponent(o)}&limit=${S}&offset=${E}${y?`&search=${encodeURIComponent(y)}`:""}`:void 0;return e.jsxs(me,{onDrop:j,label:"Drop a JSON file to create an entry",accept:".json,application/json",children:[e.jsxs("div",{children:[e.jsx(oe,{title:"Knowledge",docsHash:"#docs:dashboard.md:knowledge",actions:e.jsxs("button",{onClick:()=>{g(void 0),f(!0)},className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(Z,{className:"w-3.5 h-3.5"}),"New Entry"]})}),e.jsxs("nav",{className:"flex items-center gap-1 text-sm mb-6 min-h-[28px]",children:[e.jsxs("button",{onClick:()=>K(""),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${b==="domains"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(X,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),e.jsx("span",{children:"All Domains"})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("button",{onClick:()=>K(o),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${b==="entries"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(te,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),o]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("span",{className:"flex items-center gap-1.5 px-1.5 py-0.5 text-text-primary font-medium",children:[e.jsx(se,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),l]})]})]}),b==="entry"?e.jsx(ke,{domain:o,entryKey:l,onDeleted:()=>K(o)}):e.jsxs(e.Fragment,{children:[e.jsx(le,{actions:e.jsx(de,{onRefresh:()=>b==="entries"?n.refetch():P.refetch(),isFetching:b==="entries"?n.isFetching:P.isFetching,apiPath:b==="entries"?H:"/knowledge/domains"}),children:e.jsx(ce,{label:"Search",value:d,onChange:x,placeholder:o?"Filter by key or tag...":"Filter by domain..."})}),N?e.jsx("div",{className:"animate-pulse space-y-2 mt-4",children:Array.from({length:6}).map((s,c)=>e.jsx("div",{className:"h-10 bg-surface-sunken rounded"},c))}):b==="domains"?L.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{g(void 0),f(!0)},children:e.jsx(Y,{icon:X,title:d?"No matching domains":"No knowledge yet",description:d?void 0:"Create your first entry or drop a JSON file"})}):e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium",children:"Domain"}),e.jsx("th",{className:"pb-2 font-medium w-24 text-right",children:"Entries"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-40 text-right",children:"Latest"})]})}),e.jsx("tbody",{children:L.map(s=>e.jsxs("tr",{onClick:()=>K(s.domain),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(te,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors",children:s.domain})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.count}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(_,{date:s.latest})})]},s.domain))})]}):J.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{g(void 0),f(!0)},children:e.jsx(Y,{icon:Z,title:d?"No matching entries":"No entries in this domain",description:d?void 0:"Add an entry or drop a JSON file"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[10px] uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium w-[200px]",children:"Key"}),e.jsx("th",{className:"pb-2 font-medium",children:"Tags"}),e.jsx("th",{className:"pb-2 font-medium w-16 text-right",children:"Fields"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-32 text-right",children:"Updated"})]})}),e.jsx("tbody",{children:J.map(s=>{var c;return e.jsxs("tr",{onClick:()=>K(o,s.key),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2 w-[200px]",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(se,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors truncate max-w-[160px]",title:s.key,children:s.key})]})}),e.jsx("td",{className:"py-2",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c=s.tags)==null?void 0:c.slice(0,5).map(v=>e.jsx("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] font-medium bg-accent/10 text-accent",children:v},v)),s.tags&&s.tags.length>5&&e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:["+",s.tags.length-5]})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.data?Object.keys(s.data).length:0}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(_,{date:s.updated_at})})]},s.key)})})]}),e.jsx(xe,{page:F,totalPages:R,onPageChange:k,total:$,pageSize:S,onPageSizeChange:O})]})]})]}),e.jsx(Se,{open:u,onClose:()=>{f(!1),g(void 0)},onCreated:(s,c)=>{r({domain:s,key:c}),P.refetch()},prefillData:C,prefillDomain:o||void 0})]})}export{ze as KnowledgePage};
2
+ //# sourceMappingURL=index-iEn58vjL.js.map