@hotmeshio/long-tail 0.16.4 → 0.17.1

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 (251) hide show
  1. package/build/api/users.d.ts +31 -1
  2. package/build/api/users.js +54 -1
  3. package/build/bin/ltc.js +7 -0
  4. package/build/lib/cli/commands/users.d.ts +11 -0
  5. package/build/lib/cli/commands/users.js +59 -0
  6. package/build/routes/users.js +26 -0
  7. package/build/sdk/index.d.ts +2 -0
  8. package/build/sdk/index.js +2 -0
  9. package/build/services/user/crud.d.ts +32 -1
  10. package/build/services/user/crud.js +108 -0
  11. package/build/services/user/index.d.ts +2 -2
  12. package/build/services/user/index.js +5 -1
  13. package/build/services/user/sql.d.ts +16 -0
  14. package/build/services/user/sql.js +33 -1
  15. package/build/services/user/types.d.ts +11 -0
  16. package/build/system/mcp-servers/admin/schemas.d.ts +30 -14
  17. package/build/system/mcp-servers/admin/schemas.js +9 -3
  18. package/build/system/mcp-servers/admin/users.js +26 -0
  19. package/build/system/seed/tool-manifests-admin.d.ts +445 -0
  20. package/build/system/seed/tool-manifests-admin.js +1 -0
  21. package/dashboard/dist/assets/AdminDashboard-D-YHIR8w.js +2 -0
  22. package/dashboard/dist/assets/{AdminDashboard-Csq-oxmY.js.map → AdminDashboard-D-YHIR8w.js.map} +1 -1
  23. package/dashboard/dist/assets/{AgentConfigPage-Bnr5zbyJ.js → AgentConfigPage-CG54Ll2A.js} +7 -7
  24. package/dashboard/dist/assets/{AgentConfigPage-Bnr5zbyJ.js.map → AgentConfigPage-CG54Ll2A.js.map} +1 -1
  25. package/dashboard/dist/assets/{AgentDetailPage-DgRu-Fhg.js → AgentDetailPage-rTcofeW4.js} +3 -3
  26. package/dashboard/dist/assets/{AgentDetailPage-DgRu-Fhg.js.map → AgentDetailPage-rTcofeW4.js.map} +1 -1
  27. package/dashboard/dist/assets/AgentsPage-B7PNjrkn.js +2 -0
  28. package/dashboard/dist/assets/{AgentsPage-BuyXKkP3.js.map → AgentsPage-B7PNjrkn.js.map} +1 -1
  29. package/dashboard/dist/assets/AvailableEscalationsPage-CEDwyzlx.js +2 -0
  30. package/dashboard/dist/assets/AvailableEscalationsPage-CEDwyzlx.js.map +1 -0
  31. package/dashboard/dist/assets/{BotPicker-xpPjRnkf.js → BotPicker-cg1qXRF3.js} +2 -2
  32. package/dashboard/dist/assets/{BotPicker-xpPjRnkf.js.map → BotPicker-cg1qXRF3.js.map} +1 -1
  33. package/dashboard/dist/assets/{BulkAssignModal-CQ3k-7rO.js → BulkAssignModal-BDzaHGAb.js} +2 -2
  34. package/dashboard/dist/assets/{BulkAssignModal-CQ3k-7rO.js.map → BulkAssignModal-BDzaHGAb.js.map} +1 -1
  35. package/dashboard/dist/assets/CapabilitiesPage-CswExj9-.js +2 -0
  36. package/dashboard/dist/assets/{CapabilitiesPage-DCkEJ0In.js.map → CapabilitiesPage-CswExj9-.js.map} +1 -1
  37. package/dashboard/dist/assets/{CollapsibleSection-10sJSNNF.js → CollapsibleSection-CpVKfkkq.js} +2 -2
  38. package/dashboard/dist/assets/{CollapsibleSection-10sJSNNF.js.map → CollapsibleSection-CpVKfkkq.js.map} +1 -1
  39. package/dashboard/dist/assets/CountdownTimer-ClJhYGg1.js +2 -0
  40. package/dashboard/dist/assets/{CountdownTimer-BFy9Joxb.js.map → CountdownTimer-ClJhYGg1.js.map} +1 -1
  41. package/dashboard/dist/assets/{CredentialsPage-DIR-fUoF.js → CredentialsPage-DYBp7v8W.js} +2 -2
  42. package/dashboard/dist/assets/{CredentialsPage-DIR-fUoF.js.map → CredentialsPage-DYBp7v8W.js.map} +1 -1
  43. package/dashboard/dist/assets/{CronLabel-C66ASvgE.js → CronLabel-Bd_fipHy.js} +2 -2
  44. package/dashboard/dist/assets/{CronLabel-C66ASvgE.js.map → CronLabel-Bd_fipHy.js.map} +1 -1
  45. package/dashboard/dist/assets/ElapsedCell-B-Wn6Y8B.js +2 -0
  46. package/dashboard/dist/assets/{ElapsedCell-RWvrCHn7.js.map → ElapsedCell-B-Wn6Y8B.js.map} +1 -1
  47. package/dashboard/dist/assets/EntityTimelinePanel-DcgFUbk4.js +2 -0
  48. package/dashboard/dist/assets/{EntityTimelinePanel-CNaYs3nA.js.map → EntityTimelinePanel-DcgFUbk4.js.map} +1 -1
  49. package/dashboard/dist/assets/{EscalationListSchemaPage-BsRQtDDc.js → EscalationListSchemaPage-DpnorXeU.js} +3 -3
  50. package/dashboard/dist/assets/{EscalationListSchemaPage-BsRQtDDc.js.map → EscalationListSchemaPage-DpnorXeU.js.map} +1 -1
  51. package/dashboard/dist/assets/{EscalationSchemaPage-BMYQmwGA.js → EscalationSchemaPage-LPTJJDfP.js} +3 -3
  52. package/dashboard/dist/assets/{EscalationSchemaPage-BMYQmwGA.js.map → EscalationSchemaPage-LPTJJDfP.js.map} +1 -1
  53. package/dashboard/dist/assets/EscalationsOverview-Bq5_ICUt.js +2 -0
  54. package/dashboard/dist/assets/{EscalationsOverview-yv4Yn6zl.js.map → EscalationsOverview-Bq5_ICUt.js.map} +1 -1
  55. package/dashboard/dist/assets/{EventTable-ebZK7vXl.js → EventTable-Cinbdm1u.js} +2 -2
  56. package/dashboard/dist/assets/{EventTable-ebZK7vXl.js.map → EventTable-Cinbdm1u.js.map} +1 -1
  57. package/dashboard/dist/assets/FilterBar-DyojX5m4.js +2 -0
  58. package/dashboard/dist/assets/FilterBar-DyojX5m4.js.map +1 -0
  59. package/dashboard/dist/assets/{GraphInvokePage-BFntNMop.js → GraphInvokePage-Ba5fNcgv.js} +2 -2
  60. package/dashboard/dist/assets/{GraphInvokePage-BFntNMop.js.map → GraphInvokePage-Ba5fNcgv.js.map} +1 -1
  61. package/dashboard/dist/assets/HomePage-DuFXqfz3.js +2 -0
  62. package/dashboard/dist/assets/HomePage-DuFXqfz3.js.map +1 -0
  63. package/dashboard/dist/assets/ListToolbar-GpwHcjkZ.js +2 -0
  64. package/dashboard/dist/assets/{ListToolbar-DlGreUpP.js.map → ListToolbar-GpwHcjkZ.js.map} +1 -1
  65. package/dashboard/dist/assets/{McpOverview-D0G2vACW.js → McpOverview-Bi23-hih.js} +2 -2
  66. package/dashboard/dist/assets/{McpOverview-D0G2vACW.js.map → McpOverview-Bi23-hih.js.map} +1 -1
  67. package/dashboard/dist/assets/{McpQueryDetailPage-LZO04PEB.js → McpQueryDetailPage-FhHSfX9W.js} +4 -4
  68. package/dashboard/dist/assets/{McpQueryDetailPage-LZO04PEB.js.map → McpQueryDetailPage-FhHSfX9W.js.map} +1 -1
  69. package/dashboard/dist/assets/McpQueryPage-czMlM7vR.js +2 -0
  70. package/dashboard/dist/assets/{McpQueryPage-BIwSDHgB.js.map → McpQueryPage-czMlM7vR.js.map} +1 -1
  71. package/dashboard/dist/assets/McpRunDetailPage-BOh2M0Ca.js +2 -0
  72. package/dashboard/dist/assets/McpRunDetailPage-BOh2M0Ca.js.map +1 -0
  73. package/dashboard/dist/assets/McpRunsPage-DfJzbGYM.js +2 -0
  74. package/dashboard/dist/assets/McpRunsPage-DfJzbGYM.js.map +1 -0
  75. package/dashboard/dist/assets/OperationsPage-BS8blKLj.js +3 -0
  76. package/dashboard/dist/assets/OperationsPage-BS8blKLj.js.map +1 -0
  77. package/dashboard/dist/assets/OperatorDashboard-BWtTKrcJ.js +2 -0
  78. package/dashboard/dist/assets/OperatorDashboard-BWtTKrcJ.js.map +1 -0
  79. package/dashboard/dist/assets/{PersonaDetailPage-B48MX4lq.js → PersonaDetailPage-VkhuauBf.js} +2 -2
  80. package/dashboard/dist/assets/{PersonaDetailPage-B48MX4lq.js.map → PersonaDetailPage-VkhuauBf.js.map} +1 -1
  81. package/dashboard/dist/assets/PersonasPage-DRoneLfx.js +2 -0
  82. package/dashboard/dist/assets/PersonasPage-DRoneLfx.js.map +1 -0
  83. package/dashboard/dist/assets/ProcessDetailPage-B5mmkHS0.js +2 -0
  84. package/dashboard/dist/assets/{ProcessDetailPage-Co5oCg31.js.map → ProcessDetailPage-B5mmkHS0.js.map} +1 -1
  85. package/dashboard/dist/assets/ProcessesListPage-BV0e2OfH.js +2 -0
  86. package/dashboard/dist/assets/ProcessesListPage-BV0e2OfH.js.map +1 -0
  87. package/dashboard/dist/assets/{RoleDetailPage-C4UTNx0p.js → RoleDetailPage-eenl_a5Z.js} +2 -2
  88. package/dashboard/dist/assets/{RoleDetailPage-C4UTNx0p.js.map → RoleDetailPage-eenl_a5Z.js.map} +1 -1
  89. package/dashboard/dist/assets/{RolesPage-BXo5RirX.js → RolesPage-BLfJcFf7.js} +2 -2
  90. package/dashboard/dist/assets/{RolesPage-BXo5RirX.js.map → RolesPage-BLfJcFf7.js.map} +1 -1
  91. package/dashboard/dist/assets/{RunAsSelector-BRQiGv2-.js → RunAsSelector-BnLKKs51.js} +2 -2
  92. package/dashboard/dist/assets/{RunAsSelector-BRQiGv2-.js.map → RunAsSelector-BnLKKs51.js.map} +1 -1
  93. package/dashboard/dist/assets/{ScanCodesPage-BUT5wjzC.js → ScanCodesPage-BWIcjnr4.js} +2 -2
  94. package/dashboard/dist/assets/{ScanCodesPage-BUT5wjzC.js.map → ScanCodesPage-BWIcjnr4.js.map} +1 -1
  95. package/dashboard/dist/assets/ScanSchemeDetailPage-sAuU8cZj.js +2 -0
  96. package/dashboard/dist/assets/{ScanSchemeDetailPage-CkzoOyjd.js.map → ScanSchemeDetailPage-sAuU8cZj.js.map} +1 -1
  97. package/dashboard/dist/assets/ScanStationPage-CA_q1uaI.js +2 -0
  98. package/dashboard/dist/assets/{ScanStationPage-DYamACNZ.js.map → ScanStationPage-CA_q1uaI.js.map} +1 -1
  99. package/dashboard/dist/assets/{StickyPagination-B3yiAcrs.js → StickyPagination-sVI21e82.js} +2 -2
  100. package/dashboard/dist/assets/{StickyPagination-B3yiAcrs.js.map → StickyPagination-sVI21e82.js.map} +1 -1
  101. package/dashboard/dist/assets/{StreamMessageDetail-C56PtZSb.js → StreamMessageDetail-Djm_zQAv.js} +2 -2
  102. package/dashboard/dist/assets/{StreamMessageDetail-C56PtZSb.js.map → StreamMessageDetail-Djm_zQAv.js.map} +1 -1
  103. package/dashboard/dist/assets/{SwimlaneTimeline-D64ep5KY.js → SwimlaneTimeline-CwxXRmRQ.js} +2 -2
  104. package/dashboard/dist/assets/{SwimlaneTimeline-D64ep5KY.js.map → SwimlaneTimeline-CwxXRmRQ.js.map} +1 -1
  105. package/dashboard/dist/assets/{TaskDetailPage-C2V7BcgB.js → TaskDetailPage-SiBSTsfp.js} +2 -2
  106. package/dashboard/dist/assets/{TaskDetailPage-C2V7BcgB.js.map → TaskDetailPage-SiBSTsfp.js.map} +1 -1
  107. package/dashboard/dist/assets/{TasksListPage-C4ctoAa0.js → TasksListPage-CBTFz3Bp.js} +2 -2
  108. package/dashboard/dist/assets/{TasksListPage-C4ctoAa0.js.map → TasksListPage-CBTFz3Bp.js.map} +1 -1
  109. package/dashboard/dist/assets/TimeAgo-Ctwwdamz.js +2 -0
  110. package/dashboard/dist/assets/{TimeAgo-BpJ7In27.js.map → TimeAgo-Ctwwdamz.js.map} +1 -1
  111. package/dashboard/dist/assets/{TimestampCell-BKrIaU_R.js → TimestampCell-CI8UrDuQ.js} +2 -2
  112. package/dashboard/dist/assets/{TimestampCell-BKrIaU_R.js.map → TimestampCell-CI8UrDuQ.js.map} +1 -1
  113. package/dashboard/dist/assets/{ToolTestPanel-CdTXWPqn.js → ToolTestPanel-Cf9ZEBF7.js} +2 -2
  114. package/dashboard/dist/assets/{ToolTestPanel-CdTXWPqn.js.map → ToolTestPanel-Cf9ZEBF7.js.map} +1 -1
  115. package/dashboard/dist/assets/{TopicDetailPage-B6tb1RG4.js → TopicDetailPage-BYIOSVNy.js} +3 -3
  116. package/dashboard/dist/assets/{TopicDetailPage-B6tb1RG4.js.map → TopicDetailPage-BYIOSVNy.js.map} +1 -1
  117. package/dashboard/dist/assets/{TopicsPage-DgdOKjwE.js → TopicsPage-C9x4tIEi.js} +2 -2
  118. package/dashboard/dist/assets/{TopicsPage-DgdOKjwE.js.map → TopicsPage-C9x4tIEi.js.map} +1 -1
  119. package/dashboard/dist/assets/{UserName-A-ET2GnX.js → UserName-Ck-eLb-1.js} +2 -2
  120. package/dashboard/dist/assets/{UserName-A-ET2GnX.js.map → UserName-Ck-eLb-1.js.map} +1 -1
  121. package/dashboard/dist/assets/WorkflowExecutionPage-BPxoPK8g.js +2 -0
  122. package/dashboard/dist/assets/{WorkflowExecutionPage-CzhoRsis.js.map → WorkflowExecutionPage-BPxoPK8g.js.map} +1 -1
  123. package/dashboard/dist/assets/WorkflowsDashboard-CDHQUYEr.js +2 -0
  124. package/dashboard/dist/assets/WorkflowsDashboard-CDHQUYEr.js.map +1 -0
  125. package/dashboard/dist/assets/WorkflowsOverview-DGp8J0G2.js +2 -0
  126. package/dashboard/dist/assets/{WorkflowsOverview-B4Bh8MIo.js.map → WorkflowsOverview-DGp8J0G2.js.map} +1 -1
  127. package/dashboard/dist/assets/{YamlWorkflowDetailPage-zRrcxk0e.js → YamlWorkflowDetailPage-B112bGAY.js} +2 -2
  128. package/dashboard/dist/assets/{YamlWorkflowDetailPage-zRrcxk0e.js.map → YamlWorkflowDetailPage-B112bGAY.js.map} +1 -1
  129. package/dashboard/dist/assets/{YamlWorkflowsPage-DMK3ojp3.js → YamlWorkflowsPage-Cw5wddH7.js} +2 -2
  130. package/dashboard/dist/assets/{YamlWorkflowsPage-DMK3ojp3.js.map → YamlWorkflowsPage-Cw5wddH7.js.map} +1 -1
  131. package/dashboard/dist/assets/{agents-B67yyE1z.js → agents-CZ8WIdWH.js} +2 -2
  132. package/dashboard/dist/assets/{agents-B67yyE1z.js.map → agents-CZ8WIdWH.js.map} +1 -1
  133. package/dashboard/dist/assets/{bots-pSLFdOm-.js → bots-Xu3MUuXN.js} +2 -2
  134. package/dashboard/dist/assets/{bots-pSLFdOm-.js.map → bots-Xu3MUuXN.js.map} +1 -1
  135. package/dashboard/dist/assets/capabilities-XJukFiLn.js +2 -0
  136. package/dashboard/dist/assets/{capabilities-B2Dem6zw.js.map → capabilities-XJukFiLn.js.map} +1 -1
  137. package/dashboard/dist/assets/{controlplane-DGdaM9f3.js → controlplane-D8ZQQUAV.js} +2 -2
  138. package/dashboard/dist/assets/{controlplane-DGdaM9f3.js.map → controlplane-D8ZQQUAV.js.map} +1 -1
  139. package/dashboard/dist/assets/escalation-columns-C1GyAMeK.js +2 -0
  140. package/dashboard/dist/assets/{escalation-columns-BM7vp-hY.js.map → escalation-columns-C1GyAMeK.js.map} +1 -1
  141. package/dashboard/dist/assets/index-BEeGFfuP.js +67 -0
  142. package/dashboard/dist/assets/index-BEeGFfuP.js.map +1 -0
  143. package/dashboard/dist/assets/{index-DbLOvfv5.js → index-CHAmwNDI.js} +2 -2
  144. package/dashboard/dist/assets/index-CHAmwNDI.js.map +1 -0
  145. package/dashboard/dist/assets/index-COtlcGK_.js +2 -0
  146. package/dashboard/dist/assets/index-COtlcGK_.js.map +1 -0
  147. package/dashboard/dist/assets/index-CR96SICL.js +2 -0
  148. package/dashboard/dist/assets/index-CR96SICL.js.map +1 -0
  149. package/dashboard/dist/assets/{index-CGoXyPlO.js → index-CRxbF5vt.js} +2 -2
  150. package/dashboard/dist/assets/{index-CGoXyPlO.js.map → index-CRxbF5vt.js.map} +1 -1
  151. package/dashboard/dist/assets/{index-CLq228E2.js → index-CgGR0kM6.js} +3 -3
  152. package/dashboard/dist/assets/{index-CLq228E2.js.map → index-CgGR0kM6.js.map} +1 -1
  153. package/dashboard/dist/assets/{index-Cn__VdSf.js → index-DCaGxwKU.js} +2 -2
  154. package/dashboard/dist/assets/{index-Cn__VdSf.js.map → index-DCaGxwKU.js.map} +1 -1
  155. package/dashboard/dist/assets/{index-DajlugVw.js → index-DFmV19fc.js} +3 -3
  156. package/dashboard/dist/assets/{index-DajlugVw.js.map → index-DFmV19fc.js.map} +1 -1
  157. package/dashboard/dist/assets/{index-Brf_fpE4.js → index-DWhyH1kV.js} +2 -2
  158. package/dashboard/dist/assets/{index-Brf_fpE4.js.map → index-DWhyH1kV.js.map} +1 -1
  159. package/dashboard/dist/assets/{index-CunrdEfT.js → index-DYIy3uT5.js} +2 -2
  160. package/dashboard/dist/assets/{index-CunrdEfT.js.map → index-DYIy3uT5.js.map} +1 -1
  161. package/dashboard/dist/assets/index-D_5_1D7U.js +2 -0
  162. package/dashboard/dist/assets/index-D_5_1D7U.js.map +1 -0
  163. package/dashboard/dist/assets/{index-Cd2RdpOx.js → index-Dc43wixL.js} +2 -2
  164. package/dashboard/dist/assets/{index-Cd2RdpOx.js.map → index-Dc43wixL.js.map} +1 -1
  165. package/dashboard/dist/assets/{index-CKt5YK2z.js → index-DeRM0-Xz.js} +2 -2
  166. package/dashboard/dist/assets/{index-CKt5YK2z.js.map → index-DeRM0-Xz.js.map} +1 -1
  167. package/dashboard/dist/assets/{index-CJV2pWNH.css → index-fUqvRHOe.css} +1 -1
  168. package/dashboard/dist/assets/{knowledge-BExXJ0Ib.js → knowledge-sjJNIdJY.js} +2 -2
  169. package/dashboard/dist/assets/{knowledge-BExXJ0Ib.js.map → knowledge-sjJNIdJY.js.map} +1 -1
  170. package/dashboard/dist/assets/{mcp-D2WA-SHc.js → mcp-CQeu19Jf.js} +2 -2
  171. package/dashboard/dist/assets/{mcp-D2WA-SHc.js.map → mcp-CQeu19Jf.js.map} +1 -1
  172. package/dashboard/dist/assets/{mcp-query-4Tsojk-z.js → mcp-query-B9GuC88j.js} +2 -2
  173. package/dashboard/dist/assets/{mcp-query-4Tsojk-z.js.map → mcp-query-B9GuC88j.js.map} +1 -1
  174. package/dashboard/dist/assets/{personas-Dy_XSYfJ.js → personas-CQr9sXg3.js} +2 -2
  175. package/dashboard/dist/assets/{personas-Dy_XSYfJ.js.map → personas-CQr9sXg3.js.map} +1 -1
  176. package/dashboard/dist/assets/{pipelines-yDHgNtdx.js → pipelines-DzMf-VE7.js} +2 -2
  177. package/dashboard/dist/assets/{pipelines-yDHgNtdx.js.map → pipelines-DzMf-VE7.js.map} +1 -1
  178. package/dashboard/dist/assets/{tasks-CGoPhQyw.js → tasks-QKuXlyLe.js} +2 -2
  179. package/dashboard/dist/assets/{tasks-CGoPhQyw.js.map → tasks-QKuXlyLe.js.map} +1 -1
  180. package/dashboard/dist/assets/{topics-DA1MHDwJ.js → topics-DQAQnGV7.js} +2 -2
  181. package/dashboard/dist/assets/{topics-DA1MHDwJ.js.map → topics-DQAQnGV7.js.map} +1 -1
  182. package/dashboard/dist/assets/useDebouncedValue-DuE9Mj3I.js +2 -0
  183. package/dashboard/dist/assets/useDebouncedValue-DuE9Mj3I.js.map +1 -0
  184. package/dashboard/dist/assets/{useNamespace-BkuU0SeK.js → useNamespace-BTCrNkwo.js} +2 -2
  185. package/dashboard/dist/assets/{useNamespace-BkuU0SeK.js.map → useNamespace-BTCrNkwo.js.map} +1 -1
  186. package/dashboard/dist/assets/{useYamlActivityEvents-XXS3wg6-.js → useYamlActivityEvents-_aa1_rNu.js} +2 -2
  187. package/dashboard/dist/assets/{useYamlActivityEvents-XXS3wg6-.js.map → useYamlActivityEvents-_aa1_rNu.js.map} +1 -1
  188. package/dashboard/dist/assets/users-D-DhFQBy.js +2 -0
  189. package/dashboard/dist/assets/users-D-DhFQBy.js.map +1 -0
  190. package/dashboard/dist/assets/{workflows-5sds1Ko8.js → workflows-CEWX3imM.js} +2 -2
  191. package/dashboard/dist/assets/{workflows-5sds1Ko8.js.map → workflows-CEWX3imM.js.map} +1 -1
  192. package/dashboard/dist/assets/{yaml-workflows-CjNa2u3I.js → yaml-workflows-Bek1Mg86.js} +2 -2
  193. package/dashboard/dist/assets/{yaml-workflows-CjNa2u3I.js.map → yaml-workflows-Bek1Mg86.js.map} +1 -1
  194. package/dashboard/dist/index.html +2 -2
  195. package/docs/api/http/users.md +53 -1
  196. package/docs/api/mcp/admin.md +17 -0
  197. package/docs/api/sdk/users.md +24 -0
  198. package/docs/dashboard.md +19 -1
  199. package/package.json +1 -1
  200. package/dashboard/dist/assets/AdminDashboard-Csq-oxmY.js +0 -2
  201. package/dashboard/dist/assets/AgentsPage-BuyXKkP3.js +0 -2
  202. package/dashboard/dist/assets/AvailableEscalationsPage-BIzTjUMG.js +0 -2
  203. package/dashboard/dist/assets/AvailableEscalationsPage-BIzTjUMG.js.map +0 -1
  204. package/dashboard/dist/assets/CapabilitiesPage-DCkEJ0In.js +0 -2
  205. package/dashboard/dist/assets/CountdownTimer-BFy9Joxb.js +0 -2
  206. package/dashboard/dist/assets/ElapsedCell-RWvrCHn7.js +0 -2
  207. package/dashboard/dist/assets/EntityTimelinePanel-CNaYs3nA.js +0 -2
  208. package/dashboard/dist/assets/EscalationsOverview-yv4Yn6zl.js +0 -2
  209. package/dashboard/dist/assets/FilterBar-D6JDMSHi.js +0 -2
  210. package/dashboard/dist/assets/FilterBar-D6JDMSHi.js.map +0 -1
  211. package/dashboard/dist/assets/HomePage-B24GH9Ga.js +0 -2
  212. package/dashboard/dist/assets/HomePage-B24GH9Ga.js.map +0 -1
  213. package/dashboard/dist/assets/ListToolbar-DlGreUpP.js +0 -2
  214. package/dashboard/dist/assets/McpQueryPage-BIwSDHgB.js +0 -2
  215. package/dashboard/dist/assets/McpRunDetailPage-DjYWJLWh.js +0 -2
  216. package/dashboard/dist/assets/McpRunDetailPage-DjYWJLWh.js.map +0 -1
  217. package/dashboard/dist/assets/McpRunsPage-CTT7B-pf.js +0 -2
  218. package/dashboard/dist/assets/McpRunsPage-CTT7B-pf.js.map +0 -1
  219. package/dashboard/dist/assets/OperationsPage-Dd0WxAwH.js +0 -3
  220. package/dashboard/dist/assets/OperationsPage-Dd0WxAwH.js.map +0 -1
  221. package/dashboard/dist/assets/OperatorDashboard-BfKMaVzV.js +0 -2
  222. package/dashboard/dist/assets/OperatorDashboard-BfKMaVzV.js.map +0 -1
  223. package/dashboard/dist/assets/PersonasPage-dGX6E96g.js +0 -2
  224. package/dashboard/dist/assets/PersonasPage-dGX6E96g.js.map +0 -1
  225. package/dashboard/dist/assets/ProcessDetailPage-Co5oCg31.js +0 -2
  226. package/dashboard/dist/assets/ProcessesListPage-CrB4VAS6.js +0 -2
  227. package/dashboard/dist/assets/ProcessesListPage-CrB4VAS6.js.map +0 -1
  228. package/dashboard/dist/assets/ScanSchemeDetailPage-CkzoOyjd.js +0 -2
  229. package/dashboard/dist/assets/ScanStationPage-DYamACNZ.js +0 -2
  230. package/dashboard/dist/assets/TimeAgo-BpJ7In27.js +0 -2
  231. package/dashboard/dist/assets/WorkflowExecutionPage-CzhoRsis.js +0 -2
  232. package/dashboard/dist/assets/WorkflowsDashboard-B_tCYLei.js +0 -2
  233. package/dashboard/dist/assets/WorkflowsDashboard-B_tCYLei.js.map +0 -1
  234. package/dashboard/dist/assets/WorkflowsOverview-B4Bh8MIo.js +0 -2
  235. package/dashboard/dist/assets/capabilities-B2Dem6zw.js +0 -2
  236. package/dashboard/dist/assets/escalation-columns-BM7vp-hY.js +0 -2
  237. package/dashboard/dist/assets/index-5eRsj758.js +0 -2
  238. package/dashboard/dist/assets/index-5eRsj758.js.map +0 -1
  239. package/dashboard/dist/assets/index-BD6nhSOu.js +0 -2
  240. package/dashboard/dist/assets/index-BD6nhSOu.js.map +0 -1
  241. package/dashboard/dist/assets/index-Baf-tOnA.js +0 -2
  242. package/dashboard/dist/assets/index-Baf-tOnA.js.map +0 -1
  243. package/dashboard/dist/assets/index-DbLOvfv5.js.map +0 -1
  244. package/dashboard/dist/assets/index-zqoZDL5j.js +0 -67
  245. package/dashboard/dist/assets/index-zqoZDL5j.js.map +0 -1
  246. package/dashboard/dist/assets/useDebouncedValue-C4P2jQuh.js +0 -2
  247. package/dashboard/dist/assets/useDebouncedValue-C4P2jQuh.js.map +0 -1
  248. package/dashboard/dist/assets/useEventHooks-onx-Z6IY.js +0 -2
  249. package/dashboard/dist/assets/useEventHooks-onx-Z6IY.js.map +0 -1
  250. package/dashboard/dist/assets/users-B_9mC6D_.js +0 -2
  251. package/dashboard/dist/assets/users-B_9mC6D_.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{a as l,j as e}from"./vendor-query-RUZdMvN6.js";import{d as L,e as A,b as I,c as T,u as U}from"./personas-Dy_XSYfJ.js";import{F as K,a as D}from"./FilterBar-D6JDMSHi.js";import{P as q}from"./PageHeader-CFVw67M6.js";import{R as O}from"./RolePill-Di_5hfvw.js";import{b as F,Y as M}from"./index-zqoZDL5j.js";import{M as H}from"./Modal-BU7No9NH.js";import{u as R}from"./vendor-react-CdqEC2zv.js";import{a as V}from"./users-B_9mC6D_.js";import{u as W}from"./useDebouncedValue-C4P2jQuh.js";import{X as Y,a7 as z}from"./vendor-icons-h-jlRSb9.js";function G({open:s,onClose:u}){const r=R(),t=L(),[o,c]=l.useState(""),[n,a]=l.useState(""),[d,i]=l.useState(""),[f,h]=l.useState(s);s!==f&&(h(s),s&&(c(""),a(""),i(""),t.reset()));const g=()=>{const m=o.trim().toLowerCase();m&&t.mutate({key:m,title:n.trim()||void 0,description:d.trim()||void 0},{onSuccess:()=>{u(),r(`/admin/personas/${encodeURIComponent(m)}`)}})};return e.jsx(H,{open:s,onClose:u,title:"Create Persona",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Key (required)"}),e.jsx("input",{type:"text",value:o,onChange:m=>c(m.target.value),placeholder:"e.g., floor-manager",className:"input text-xs w-full font-mono",onKeyDown:m=>{m.key==="Enter"&&g()}}),e.jsx("p",{className:"text-2xs text-text-tertiary mt-1",children:"Lowercase letters, numbers, hyphens, and underscores only. Stable — it names the persona everywhere."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Title"}),e.jsx("input",{type:"text",value:n,onChange:m=>a(m.target.value),placeholder:"e.g., Floor Manager",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("textarea",{value:d,onChange:m=>i(m.target.value),placeholder:"The day in the life, one paragraph.",rows:3,className:"input text-xs w-full resize-y"})]}),t.error&&e.jsx("p",{className:"text-xs text-status-error",children:t.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:u,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:g,disabled:!o.trim()||t.isPending,className:"btn-primary text-xs",children:t.isPending?"Creating...":"Create"})]})]})})}function X({selected:s,onSelect:u,excludeIds:r=[],placeholder:t="Search users…"}){const[o,c]=l.useState(!1),[n,a]=l.useState(""),d=l.useRef(null),i=W(n,300),f=20,{data:h,isFetching:g}=V({search:i.trim()||void 0,limit:f});l.useEffect(()=>{if(!o)return;function x(v){d.current&&!d.current.contains(v.target)&&c(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const m=l.useMemo(()=>new Set(r),[r]),y=((h==null?void 0:h.users)??[]).filter(x=>!m.has(x.id)),p=(h==null?void 0:h.total)??0,b=p>((h==null?void 0:h.users.length)??0),j=(s==null?void 0:s.label)??"",N=o?n:j;return e.jsxs("div",{ref:d,className:"relative",children:[e.jsx("input",{type:"text",value:N,onFocus:()=>{c(!0),a("")},onChange:x=>{a(x.target.value),x.target.value||u(null),o||c(!0)},placeholder:t,className:"input text-xs w-full min-w-0","aria-label":"User"}),o&&e.jsxs("div",{className:"absolute z-[100] left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg",children:[y.map(x=>{const v=x.display_name||x.external_id;return e.jsxs("button",{type:"button",onClick:()=>{u({id:x.id,label:v}),a(""),c(!1)},className:`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 min-w-0 ${(s==null?void 0:s.id)===x.id?"bg-accent/5":""}`,children:[e.jsx("span",{className:"text-xs text-text-primary truncate",children:v}),x.email&&e.jsx("span",{className:"text-2xs text-text-quaternary truncate",children:x.email})]},x.id)}),y.length===0&&e.jsx("p",{className:"px-3 py-4 text-center text-2xs text-text-quaternary",children:g?"Searching…":n?`No users match "${n}"`:"No users available"}),b&&e.jsxs("p",{className:"px-3 py-1.5 text-2xs text-text-quaternary border-t border-surface-border/60 tabular-nums",children:[y.length," of ",p," — type to narrow"]})]})]})}const S="text-2xs font-semibold uppercase tracking-widest text-text-tertiary";function B({personaKey:s,onClose:u}){const{data:r}=A(s??""),t=I(),o=T(),[c,n]=l.useState(null),a=(r==null?void 0:r.assignees)??[],d=()=>{!r||!c||t.mutate({userId:c.id,key:r.key},{onSuccess:()=>n(null)})};return e.jsxs("div",{className:"h-full overflow-y-auto px-5 pt-4 pb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("p",{className:S,children:"Assignees"}),u&&e.jsx("button",{onClick:u,className:"icon-link",title:"Close","aria-label":"Close",children:e.jsx(Y,{className:"w-4 h-4"})})]}),r?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:r.title||r.key}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-0.5",children:[r.roles.length," role",r.roles.length===1?"":"s"," per assignment"]})]}),a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"Assign a user to compose their whole surface in one step."}):e.jsx("div",{className:"flex flex-col gap-2",children:a.map(i=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate",title:i.external_id,children:i.display_name||i.external_id}),e.jsx("span",{className:"shrink-0 text-2xs text-text-tertiary",children:e.jsx(F,{date:i.assigned_at})}),e.jsx("button",{onClick:()=>o.mutate({userId:i.id,key:r.key}),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Unassign ${i.display_name||i.external_id}`,children:"×"})]},i.id))}),e.jsxs("div",{className:"pt-3 border-t border-surface-border space-y-2",children:[e.jsx("p",{className:S,children:"Assign User"}),e.jsx(X,{selected:c,onSelect:n,excludeIds:a.map(i=>i.id)}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:d,disabled:!c||t.isPending,className:"btn-primary text-xs",children:t.isPending?"...":"Assign"})}),(t.error||o.error)&&e.jsx("p",{className:"text-2xs text-status-error",children:(t.error||o.error).message})]})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a persona to assign users. An assignee joins every linked role at its scope — sidebar pins and forms compose from the roles."})]})}const $="persona-assignees",_="180px 140px 1fr 220px 56px 40px",E="text-text-secondary transition-colors group-hover/row:text-text-primary",P="text-2xs font-semibold uppercase tracking-widest text-text-quaternary",w="py-2",C="py-2.5";function k(s){return s.title?s.title:s.key.replace(/[-_]+/g," ").replace(/\b\w/g,u=>u.toUpperCase())}function J(){return e.jsxs("div",{className:"grid gap-4 px-3 border-b border-surface-border bg-surface",style:{gridTemplateColumns:_},children:[e.jsx("span",{className:`${P} ${w} flex items-center`,children:"Persona"}),e.jsx("span",{className:`${P} ${w} flex items-center`,children:"Key"}),e.jsx("span",{className:`${P} ${w} flex items-center`,children:"Description"}),e.jsx("span",{className:`${P} ${w} flex items-center`,children:"Roles"}),e.jsx("span",{className:`${P} ${w} flex items-center justify-end`,children:"Users"}),e.jsx("span",{className:w})]})}const Q=3;function Z({persona:s,active:u,onClick:r,onConfigure:t}){const o=s.roles??[],c=o.slice(0,Q),n=o.length-c.length;return e.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&r()},className:`grid gap-4 px-3 cursor-pointer group/row transition-colors ${u?"bg-surface-hover/60":"hover:bg-surface-hover/30"}`,style:{gridTemplateColumns:_},children:[e.jsx("span",{className:`flex items-center min-w-0 text-sm truncate ${C} ${E}`,children:k(s)}),e.jsx("span",{className:`flex items-center text-xs font-mono truncate ${C} text-text-tertiary transition-colors group-hover/row:text-text-secondary`,children:s.key}),e.jsx("span",{className:`flex items-center min-w-0 text-xs text-text-tertiary truncate ${C} transition-colors group-hover/row:text-text-secondary`,children:s.description??""}),e.jsxs("div",{className:`flex items-center flex-wrap gap-x-2.5 gap-y-0.5 min-w-0 ${C}`,children:[c.map(a=>e.jsx("span",{className:"min-w-0 truncate text-text-secondary",children:e.jsx(O,{role:a.role,tone:"inherit"})},a.role)),n>0&&e.jsxs("span",{className:"text-2xs text-text-quaternary tabular-nums",children:["+",n]})]}),e.jsx("span",{className:`flex items-center justify-end text-sm tabular-nums ${C} transition-colors ${E}`,children:s.user_count>0?s.user_count:""}),e.jsx("span",{className:`flex items-center justify-end ${C}`,children:e.jsx("button",{onClick:a=>{a.stopPropagation(),t()},className:"text-text-quaternary/70 hover:text-accent transition-colors",title:`Configure ${k(s)}`,"aria-label":`Configure ${k(s)}`,children:e.jsx(z,{className:"w-3.5 h-3.5",strokeWidth:1.5})})})]})}function ue(){const s=R(),{data:u,isLoading:r}=U(),t=M(),[o,c]=l.useState(!1),[n,a]=l.useState(""),[d,i]=l.useState(null),f=(u==null?void 0:u.personas)??[],h=l.useRef(null),g=l.useRef(!1);l.useEffect(()=>{t&&d!==h.current&&(h.current=d,d?t.setPanel(e.jsx(B,{personaKey:d,onClose:()=>i(null)}),{key:$,width:360}):(g.current=!1,t.closePanel($)))},[d,t]),l.useEffect(()=>{if(!(!t||!d)){if(t.open&&t.ownerKey===$){g.current=!0;return}g.current&&(g.current=!1,i(null))}},[t,d]);const m=l.useRef(t);m.current=t,l.useEffect(()=>()=>{var p;h.current&&((p=m.current)==null||p.closePanel($))},[]);const y=l.useMemo(()=>{const p=[...f].sort((j,N)=>k(j).localeCompare(k(N)));if(!n.trim())return p;const b=n.toLowerCase();return p.filter(j=>{var N,x;return j.key.toLowerCase().includes(b)||k(j).toLowerCase().includes(b)||((N=j.description)==null?void 0:N.toLowerCase().includes(b))||((x=j.roles)==null?void 0:x.some(v=>v.role.toLowerCase().includes(b)))})},[f,n]);return e.jsxs("div",{children:[e.jsx(q,{title:"Personas",docsHash:"#docs:dashboard.md:personas",actions:e.jsx("button",{onClick:()=>c(!0),className:"btn-primary text-xs flex items-center gap-1.5",children:"+ Add Persona"})}),!r&&f.length>0&&e.jsxs(K,{children:[e.jsx(D,{label:"Search",value:n,onChange:a,placeholder:`${f.length} personas…`}),n&&y.length!==f.length&&e.jsxs("span",{className:"text-2xs text-text-quaternary tabular-nums shrink-0",children:[y.length," of ",f.length]})]}),e.jsxs("div",{className:"overflow-x-clip",children:[!r&&f.length>0&&y.length>0&&e.jsx("div",{className:"sticky top-[60px] z-10 bg-surface",children:e.jsx(J,{})}),r?e.jsx("div",{className:"animate-pulse space-y-3 mt-6",children:[1,2,3].map(p=>e.jsx("div",{className:"h-10 bg-surface-sunken rounded w-full"},p))}):y.length===0?e.jsx("p",{className:"text-sm text-text-tertiary mt-8",children:n?"Clear the search to see all personas.":"Create a persona to bundle roles into a one-step assignment."}):e.jsx("div",{className:"divide-y divide-surface-border/30",children:y.map(p=>e.jsx(Z,{persona:p,active:p.key===d,onClick:()=>i(p.key),onConfigure:()=>s(`/admin/personas/${encodeURIComponent(p.key)}`)},p.key))})]}),e.jsx(G,{open:o,onClose:()=>c(!1)})]})}export{ue as PersonasPage};
2
- //# sourceMappingURL=PersonasPage-dGX6E96g.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PersonasPage-dGX6E96g.js","sources":["../../src/pages/admin/personas/CreatePersonaModal.tsx","../../src/components/common/form/UserCombobox.tsx","../../src/pages/admin/personas/AssigneesPanel.tsx","../../src/pages/admin/personas/PersonasPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { useCreatePersona } from '../../../api/personas';\nimport { Modal } from '../../../components/common/modal/Modal';\n\nexport function CreatePersonaModal({\n open,\n onClose,\n}: {\n open: boolean;\n onClose: () => void;\n}) {\n const navigate = useNavigate();\n const createPersona = useCreatePersona();\n const [key, setKey] = useState('');\n const [title, setTitle] = useState('');\n const [description, setDescription] = useState('');\n\n const [prevOpen, setPrevOpen] = useState(open);\n if (open !== prevOpen) {\n setPrevOpen(open);\n if (open) {\n setKey('');\n setTitle('');\n setDescription('');\n createPersona.reset();\n }\n }\n\n const handleCreate = () => {\n const trimmed = key.trim().toLowerCase();\n if (!trimmed) return;\n createPersona.mutate(\n {\n key: trimmed,\n title: title.trim() || undefined,\n description: description.trim() || undefined,\n },\n {\n onSuccess: () => {\n onClose();\n // Land on the detail page to link roles right away.\n navigate(`/admin/personas/${encodeURIComponent(trimmed)}`);\n },\n },\n );\n };\n\n return (\n <Modal open={open} onClose={onClose} title=\"Create Persona\">\n <div className=\"space-y-4\">\n <div>\n <label className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Key (required)\n </label>\n <input\n type=\"text\"\n value={key}\n onChange={(e) => setKey(e.target.value)}\n placeholder=\"e.g., floor-manager\"\n className=\"input text-xs w-full font-mono\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleCreate();\n }}\n />\n <p className=\"text-2xs text-text-tertiary mt-1\">\n Lowercase letters, numbers, hyphens, and underscores only. Stable — it names the persona everywhere.\n </p>\n </div>\n\n <div>\n <label className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Title\n </label>\n <input\n type=\"text\"\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n placeholder=\"e.g., Floor Manager\"\n className=\"input text-xs w-full\"\n />\n </div>\n\n <div>\n <label className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">\n Description\n </label>\n <textarea\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"The day in the life, one paragraph.\"\n rows={3}\n className=\"input text-xs w-full resize-y\"\n />\n </div>\n\n {createPersona.error && (\n <p className=\"text-xs text-status-error\">{(createPersona.error as Error).message}</p>\n )}\n\n <div className=\"flex justify-end gap-3 pt-2\">\n <button onClick={onClose} className=\"btn-secondary text-xs\">\n Cancel\n </button>\n <button\n onClick={handleCreate}\n disabled={!key.trim() || createPersona.isPending}\n className=\"btn-primary text-xs\"\n >\n {createPersona.isPending ? 'Creating...' : 'Create'}\n </button>\n </div>\n </div>\n </Modal>\n );\n}\n","import { useState, useRef, useEffect, useMemo } from 'react';\nimport { useUsers } from '../../../api/users';\nimport { useDebouncedValue } from '../../../hooks/useDebouncedValue';\n\nexport interface UserComboboxSelection {\n id: string;\n label: string;\n}\n\n/**\n * Searchable inline combobox for picking a user account. The filter drives the\n * server-side account search (name, email, external_id), so the list stays\n * bounded no matter how many accounts exist; a footer line discloses when more\n * matches remain than the page shows. Styled to match CapabilityCombobox.\n */\nexport function UserCombobox({ selected, onSelect, excludeIds = [], placeholder = 'Search users…' }: {\n selected: UserComboboxSelection | null;\n onSelect: (user: UserComboboxSelection | null) => void;\n /** Accounts to hide from the results (e.g. already assigned). */\n excludeIds?: string[];\n placeholder?: string;\n}) {\n const [open, setOpen] = useState(false);\n const [filter, setFilter] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n\n const debounced = useDebouncedValue(filter, 300);\n const PAGE = 20;\n const { data, isFetching } = useUsers({\n search: debounced.trim() || undefined,\n limit: PAGE,\n });\n\n // Close on outside click\n useEffect(() => {\n if (!open) return;\n function handleClick(e: MouseEvent) {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false);\n }\n }\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [open]);\n\n const excluded = useMemo(() => new Set(excludeIds), [excludeIds]);\n const users = (data?.users ?? []).filter((u) => !excluded.has(u.id));\n const total = data?.total ?? 0;\n const truncated = total > (data?.users.length ?? 0);\n\n const displayValue = selected?.label ?? '';\n const filterText = open ? filter : displayValue;\n\n return (\n <div ref={containerRef} className=\"relative\">\n <input\n type=\"text\"\n value={filterText}\n onFocus={() => { setOpen(true); setFilter(''); }}\n onChange={(e) => {\n setFilter(e.target.value);\n if (!e.target.value) onSelect(null);\n if (!open) setOpen(true);\n }}\n placeholder={placeholder}\n className=\"input text-xs w-full min-w-0\"\n aria-label=\"User\"\n />\n\n {open && (\n <div className=\"absolute z-[100] left-0 right-0 mt-1 max-h-64 overflow-y-auto rounded-md border border-surface-border bg-surface shadow-lg\">\n {users.map((u) => {\n const label = u.display_name || u.external_id;\n return (\n <button\n key={u.id}\n type=\"button\"\n onClick={() => {\n onSelect({ id: u.id, label });\n setFilter('');\n setOpen(false);\n }}\n className={`w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors flex items-center gap-3 min-w-0 ${\n selected?.id === u.id ? 'bg-accent/5' : ''\n }`}\n >\n <span className=\"text-xs text-text-primary truncate\">{label}</span>\n {u.email && (\n <span className=\"text-2xs text-text-quaternary truncate\">{u.email}</span>\n )}\n </button>\n );\n })}\n\n {users.length === 0 && (\n <p className=\"px-3 py-4 text-center text-2xs text-text-quaternary\">\n {isFetching ? 'Searching…' : filter ? `No users match \"${filter}\"` : 'No users available'}\n </p>\n )}\n\n {truncated && (\n <p className=\"px-3 py-1.5 text-2xs text-text-quaternary border-t border-surface-border/60 tabular-nums\">\n {users.length} of {total} — type to narrow\n </p>\n )}\n </div>\n )}\n </div>\n );\n}\n","import { useState } from 'react';\nimport { X } from 'lucide-react';\nimport { usePersona, useAssignPersona, useUnassignPersona } from '../../../api/personas';\nimport { DateValue } from '../../../components/common/display/DateValue';\nimport { UserCombobox, type UserComboboxSelection } from '../../../components/common/form/UserCombobox';\n\nconst SECTION_HDR = 'text-2xs font-semibold uppercase tracking-widest text-text-tertiary';\n\n/**\n * The 90% surface: pick a persona in the list, assign a user, and they get\n * every linked role — pins, list schemas, and forms compose from the roles.\n * Rendered in the global shell right panel (key 'persona-assignees').\n */\nexport function AssigneesPanel({\n personaKey,\n onClose,\n}: {\n personaKey: string | null;\n onClose?: () => void;\n}) {\n const { data: persona } = usePersona(personaKey ?? '');\n const assign = useAssignPersona();\n const unassign = useUnassignPersona();\n const [pendingUser, setPendingUser] = useState<UserComboboxSelection | null>(null);\n\n const assignees = persona?.assignees ?? [];\n\n const handleAssign = () => {\n if (!persona || !pendingUser) return;\n assign.mutate(\n { userId: pendingUser.id, key: persona.key },\n { onSuccess: () => setPendingUser(null) },\n );\n };\n\n return (\n <div className=\"h-full overflow-y-auto px-5 pt-4 pb-6\">\n <div className=\"flex items-center justify-between mb-4\">\n <p className={SECTION_HDR}>Assignees</p>\n {onClose && (\n <button onClick={onClose} className=\"icon-link\" title=\"Close\" aria-label=\"Close\">\n <X className=\"w-4 h-4\" />\n </button>\n )}\n </div>\n\n {!persona ? (\n <p className=\"text-xs text-text-tertiary\">\n Select a persona to assign users. An assignee joins every linked role\n at its scope — sidebar pins and forms compose from the roles.\n </p>\n ) : (\n <div className=\"space-y-4\">\n <div>\n <p className=\"text-sm text-text-primary\">{persona.title || persona.key}</p>\n <p className=\"text-2xs text-text-tertiary mt-0.5\">\n {persona.roles.length} role{persona.roles.length === 1 ? '' : 's'} per assignment\n </p>\n </div>\n\n {assignees.length === 0 ? (\n <p className=\"text-xs text-text-tertiary\">\n Assign a user to compose their whole surface in one step.\n </p>\n ) : (\n <div className=\"flex flex-col gap-2\">\n {assignees.map((a) => (\n <span\n key={a.id}\n className=\"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary\"\n >\n <span className=\"flex-1 min-w-0 truncate\" title={a.external_id}>\n {a.display_name || a.external_id}\n </span>\n <span className=\"shrink-0 text-2xs text-text-tertiary\">\n <DateValue date={a.assigned_at} />\n </span>\n <button\n onClick={() => unassign.mutate({ userId: a.id, key: persona.key })}\n className=\"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1\"\n title={`Unassign ${a.display_name || a.external_id}`}\n >\n &times;\n </button>\n </span>\n ))}\n </div>\n )}\n\n <div className=\"pt-3 border-t border-surface-border space-y-2\">\n <p className={SECTION_HDR}>Assign User</p>\n <UserCombobox\n selected={pendingUser}\n onSelect={setPendingUser}\n excludeIds={assignees.map((a) => a.id)}\n />\n <div className=\"flex justify-end pt-1\">\n <button\n onClick={handleAssign}\n disabled={!pendingUser || assign.isPending}\n className=\"btn-primary text-xs\"\n >\n {assign.isPending ? '...' : 'Assign'}\n </button>\n </div>\n {(assign.error || unassign.error) && (\n <p className=\"text-2xs text-status-error\">\n {((assign.error || unassign.error) as Error).message}\n </p>\n )}\n </div>\n </div>\n )}\n </div>\n );\n}\n","import { useState, useMemo, useEffect, useRef } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Pencil } from 'lucide-react';\nimport { usePersonas } from '../../../api/personas';\nimport { FilterBar, FilterInput } from '../../../components/common/data/FilterBar';\nimport type { LTPersonaRecord } from '../../../api/types';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { RolePill } from '../../../components/common/display/RolePill';\nimport { useShellPanelOptional } from '../../../hooks/useShellPanel';\nimport { CreatePersonaModal } from './CreatePersonaModal';\nimport { AssigneesPanel } from './AssigneesPanel';\n\n// Shell-panel ownership key — the Assignees panel claims/releases this slot.\nconst ASSIGNEES_PANEL_KEY = 'persona-assignees';\n\n// ── Grid columns ──────────────────────────────────────────────────────────────\n// PERSONA(title, 180px) | KEY(140px) | DESCRIPTION(1fr) | ROLES(220px) | USERS(56px) | CONFIGURE(40px)\n// Mirrors the Roles list: display title leads, exact key is the secondary\n// field, the bundle's role pills preview on the right. Clicking a row selects\n// it for the Assignees panel (the 90% path); the pencil opens configuration.\nconst GRID = '180px 140px 1fr 220px 56px 40px';\n\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\nconst HDR = 'text-2xs font-semibold uppercase tracking-widest text-text-quaternary';\nconst CELL_PY = 'py-2';\nconst ROW_PY = 'py-2.5';\n\n/** Title Case fallback derived from the key, same convention as roles. */\nfunction displayPersonaTitle(p: LTPersonaRecord): string {\n if (p.title) return p.title;\n return p.key.replace(/[-_]+/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\nfunction TableHead() {\n return (\n <div\n className=\"grid gap-4 px-3 border-b border-surface-border bg-surface\"\n style={{ gridTemplateColumns: GRID }}\n >\n <span className={`${HDR} ${CELL_PY} flex items-center`}>Persona</span>\n <span className={`${HDR} ${CELL_PY} flex items-center`}>Key</span>\n <span className={`${HDR} ${CELL_PY} flex items-center`}>Description</span>\n <span className={`${HDR} ${CELL_PY} flex items-center`}>Roles</span>\n <span className={`${HDR} ${CELL_PY} flex items-center justify-end`}>Users</span>\n <span className={CELL_PY} />\n </div>\n );\n}\n\nconst ROLE_PREVIEW_LIMIT = 3;\n\nfunction PersonaRow({ persona, active, onClick, onConfigure }: {\n persona: LTPersonaRecord;\n active: boolean;\n onClick: () => void;\n onConfigure: () => void;\n}) {\n const roles = persona.roles ?? [];\n const preview = roles.slice(0, ROLE_PREVIEW_LIMIT);\n const overflow = roles.length - preview.length;\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onClick={onClick}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') onClick(); }}\n className={`grid gap-4 px-3 cursor-pointer group/row transition-colors ${active ? 'bg-surface-hover/60' : 'hover:bg-surface-hover/30'}`}\n style={{ gridTemplateColumns: GRID }}\n >\n <span className={`flex items-center min-w-0 text-sm truncate ${ROW_PY} ${CELL_TEXT}`}>\n {displayPersonaTitle(persona)}\n </span>\n\n <span className={`flex items-center text-xs font-mono truncate ${ROW_PY} text-text-tertiary transition-colors group-hover/row:text-text-secondary`}>\n {persona.key}\n </span>\n\n <span className={`flex items-center min-w-0 text-xs text-text-tertiary truncate ${ROW_PY} transition-colors group-hover/row:text-text-secondary`}>\n {persona.description ?? ''}\n </span>\n\n <div className={`flex items-center flex-wrap gap-x-2.5 gap-y-0.5 min-w-0 ${ROW_PY}`}>\n {preview.map((r) => (\n <span key={r.role} className=\"min-w-0 truncate text-text-secondary\">\n <RolePill role={r.role} tone=\"inherit\" />\n </span>\n ))}\n {overflow > 0 && (\n <span className=\"text-2xs text-text-quaternary tabular-nums\">+{overflow}</span>\n )}\n </div>\n\n <span className={`flex items-center justify-end text-sm tabular-nums ${ROW_PY} transition-colors ${CELL_TEXT}`}>\n {persona.user_count > 0 ? persona.user_count : ''}\n </span>\n\n <span className={`flex items-center justify-end ${ROW_PY}`}>\n <button\n onClick={(e) => { e.stopPropagation(); onConfigure(); }}\n className=\"text-text-quaternary/70 hover:text-accent transition-colors\"\n title={`Configure ${displayPersonaTitle(persona)}`}\n aria-label={`Configure ${displayPersonaTitle(persona)}`}\n >\n <Pencil className=\"w-3.5 h-3.5\" strokeWidth={1.5} />\n </button>\n </span>\n </div>\n );\n}\n\n// ── Page ──────────────────────────────────────────────────────────────────────\n\nexport function PersonasPage() {\n const navigate = useNavigate();\n const { data, isLoading } = usePersonas();\n const shell = useShellPanelOptional();\n const [showCreate, setShowCreate] = useState(false);\n const [search, setSearch] = useState('');\n const [selectedKey, setSelectedKey] = useState<string | null>(null);\n\n const personas = data?.personas ?? [];\n\n // ── Selection ↔ shell panel sync ────────────────────────────────────────────\n // Clicking a row opens the Assignees panel in the shell's right slot; an\n // external close (the panel's X, slot takeover) clears the selection. The\n // applied-key ref guards against re-setting the panel on unrelated renders.\n const appliedKey = useRef<string | null>(null);\n const panelWasOpen = useRef(false);\n useEffect(() => {\n if (!shell) return;\n if (selectedKey === appliedKey.current) return;\n appliedKey.current = selectedKey;\n if (selectedKey) {\n shell.setPanel(\n <AssigneesPanel personaKey={selectedKey} onClose={() => setSelectedKey(null)} />,\n { key: ASSIGNEES_PANEL_KEY, width: 360 },\n );\n } else {\n panelWasOpen.current = false;\n shell.closePanel(ASSIGNEES_PANEL_KEY);\n }\n }, [selectedKey, shell]);\n useEffect(() => {\n if (!shell || !selectedKey) return;\n if (shell.open && shell.ownerKey === ASSIGNEES_PANEL_KEY) {\n panelWasOpen.current = true;\n return;\n }\n if (panelWasOpen.current) {\n panelWasOpen.current = false;\n setSelectedKey(null);\n }\n }, [shell, selectedKey]);\n // Unmount with the panel open releases the slot (keyed — never yanks\n // another claimant's panel).\n const shellRef = useRef(shell);\n shellRef.current = shell;\n useEffect(\n () => () => {\n if (appliedKey.current) shellRef.current?.closePanel(ASSIGNEES_PANEL_KEY);\n },\n [],\n );\n\n const filtered = useMemo(() => {\n const sorted = [...personas].sort((a, b) =>\n displayPersonaTitle(a).localeCompare(displayPersonaTitle(b)),\n );\n if (!search.trim()) return sorted;\n const q = search.toLowerCase();\n return sorted.filter(\n (p) =>\n p.key.toLowerCase().includes(q) ||\n displayPersonaTitle(p).toLowerCase().includes(q) ||\n p.description?.toLowerCase().includes(q) ||\n p.roles?.some((r) => r.role.toLowerCase().includes(q)),\n );\n }, [personas, search]);\n\n return (\n <div>\n <PageHeader\n title=\"Personas\"\n docsHash=\"#docs:dashboard.md:personas\"\n actions={\n <button\n onClick={() => setShowCreate(true)}\n className=\"btn-primary text-xs flex items-center gap-1.5\"\n >\n + Add Persona\n </button>\n }\n />\n\n {/* The standard full-width sticky filter band — above the split. */}\n {!isLoading && personas.length > 0 && (\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${personas.length} personas…`}\n />\n {search && filtered.length !== personas.length && (\n <span className=\"text-2xs text-text-quaternary tabular-nums shrink-0\">\n {filtered.length} of {personas.length}\n </span>\n )}\n </FilterBar>\n )}\n\n {/* The table IS the page — selecting a row opens the Assignees panel in\n the shell's right panel; the row pencil opens the persona's config. */}\n <div className=\"overflow-x-clip\">\n {!isLoading && personas.length > 0 && filtered.length > 0 && (\n <div className=\"sticky top-[60px] z-10 bg-surface\">\n <TableHead />\n </div>\n )}\n\n {isLoading ? (\n <div className=\"animate-pulse space-y-3 mt-6\">\n {[1, 2, 3].map((i) => (\n <div key={i} className=\"h-10 bg-surface-sunken rounded w-full\" />\n ))}\n </div>\n ) : filtered.length === 0 ? (\n <p className=\"text-sm text-text-tertiary mt-8\">\n {search\n ? 'Clear the search to see all personas.'\n : 'Create a persona to bundle roles into a one-step assignment.'}\n </p>\n ) : (\n <div className=\"divide-y divide-surface-border/30\">\n {filtered.map((persona) => (\n <PersonaRow\n key={persona.key}\n persona={persona}\n active={persona.key === selectedKey}\n onClick={() => setSelectedKey(persona.key)}\n onConfigure={() => navigate(`/admin/personas/${encodeURIComponent(persona.key)}`)}\n />\n ))}\n </div>\n )}\n </div>\n\n <CreatePersonaModal open={showCreate} onClose={() => setShowCreate(false)} />\n </div>\n );\n}\n"],"names":["CreatePersonaModal","open","onClose","navigate","useNavigate","createPersona","useCreatePersona","key","setKey","useState","title","setTitle","description","setDescription","prevOpen","setPrevOpen","handleCreate","trimmed","jsx","Modal","jsxs","e","UserCombobox","selected","onSelect","excludeIds","placeholder","setOpen","filter","setFilter","containerRef","useRef","debounced","useDebouncedValue","PAGE","data","isFetching","useUsers","useEffect","handleClick","excluded","useMemo","users","u","total","truncated","displayValue","filterText","label","SECTION_HDR","AssigneesPanel","personaKey","persona","usePersona","assign","useAssignPersona","unassign","useUnassignPersona","pendingUser","setPendingUser","assignees","handleAssign","X","a","DateValue","ASSIGNEES_PANEL_KEY","GRID","CELL_TEXT","HDR","CELL_PY","ROW_PY","displayPersonaTitle","p","c","TableHead","ROLE_PREVIEW_LIMIT","PersonaRow","active","onClick","onConfigure","roles","preview","overflow","r","RolePill","Pencil","PersonasPage","isLoading","usePersonas","shell","useShellPanelOptional","showCreate","setShowCreate","search","setSearch","selectedKey","setSelectedKey","personas","appliedKey","panelWasOpen","shellRef","_a","filtered","sorted","b","q","_b","PageHeader","FilterBar","FilterInput","i"],"mappings":"iiBAKO,SAASA,EAAmB,CACjC,KAAAC,EACA,QAAAC,CACF,EAGG,CACD,MAAMC,EAAWC,EAAA,EACXC,EAAgBC,EAAA,EAChB,CAACC,EAAKC,CAAM,EAAIC,EAAAA,SAAS,EAAE,EAC3B,CAACC,EAAOC,CAAQ,EAAIF,EAAAA,SAAS,EAAE,EAC/B,CAACG,EAAaC,CAAc,EAAIJ,EAAAA,SAAS,EAAE,EAE3C,CAACK,EAAUC,CAAW,EAAIN,EAAAA,SAASR,CAAI,EACzCA,IAASa,IACXC,EAAYd,CAAI,EACZA,IACFO,EAAO,EAAE,EACTG,EAAS,E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AAK4F,SACb,MAAA,CAAY,UAAU,yCAAbA,CAAqD,CAChE,EACH,EACER,EAAS,SAAW,QACrB,IAAA,CAAE,UAAU,kCACV,SAAAT,EACG,wCACA,8DAAA,CACN,QAEC,MAAA,CAAI,UAAU,oCACZ,SAAAS,EAAS,IAAKlD,GACblC,EAAAA,IAAC0D,EAAA,CAEC,QAAAxB,EACA,OAAQA,EAAQ,MAAQ2C,EACxB,QAAS,IAAMC,EAAe5C,EAAQ,GAAG,EACzC,YAAa,IAAMjD,EAAS,mBAAmB,mBAAmBiD,EAAQ,GAAG,CAAC,EAAE,CAAA,EAJ3EA,EAAQ,GAAA,CAMhB,CAAA,CACH,CAAA,EAEJ,EAEAlC,MAAClB,GAAmB,KAAM2F,EAAY,QAAS,IAAMC,EAAc,EAAK,CAAA,CAAG,CAAA,EAC7E,CAEJ"}
@@ -1,2 +0,0 @@
1
- import{a as b,j as e}from"./vendor-query-RUZdMvN6.js";import{a as z}from"./tasks-CGoPhQyw.js";import{a as V}from"./useEventHooks-onx-Z6IY.js";import{D as S,f as L,C as J,u as q,a as G,J as P,S as T}from"./index-zqoZDL5j.js";import{P as K}from"./PageHeaderWithStats-D9tQxILm.js";import{S as W}from"./StatusBadge-BDeUwPtb.js";import{W as Q}from"./WorkflowPill-CN-952iI.js";import{T as y}from"./TimestampCell-BKrIaU_R.js";import{L as D,e as X}from"./vendor-react-CdqEC2zv.js";import{R as Y}from"./RolePill-Di_5hfvw.js";import{U as Z}from"./UserName-A-ET2GnX.js";import"./vendor-icons-h-jlRSb9.js";import"./users-B_9mC6D_.js";const ee="bg-stripes animate-pulse opacity-70";function $(t){switch(t){case"completed":return"text-status-success";case"in_progress":case"pending":return"text-status-warning";case"needs_intervention":return"text-status-error";case"cancelled":return"text-text-tertiary";default:return"text-text-tertiary"}}function I(t){switch(t){case"resolved":return"text-status-success";case"pending":return"text-status-warning";case"cancelled":return"text-text-tertiary";default:return"text-text-tertiary"}}function te(t,a,l){return`${t==="task"?"Task":l?"Notification":"Escalation"} is ${a.replace(/_/g," ")}`}function se(t,a){if(a)return ee;switch(t){case"completed":case"resolved":return"bg-status-success";case"pending":case"in_progress":case"needs_intervention":return"bg-status-warning";case"cancelled":return"bg-status-error";default:return"bg-text-tertiary"}}function ae(t){return t.startsWith("mcp")||t.startsWith("Mcp")}function E(t){return!t.workflow_type}function A(t,a){if(t.length<=a)return t;const l=Math.floor((a-1)/2);return`${t.slice(0,l)}…${t.slice(t.length-l)}`}function ne(t,a){const l=Date.now(),c=new Map,x=[];for(const s of a)s.task_id?(c.has(s.task_id)||c.set(s.task_id,[]),c.get(s.task_id).push(s)):x.push(s);const r=[...t].sort((s,d)=>new Date(s.created_at).getTime()-new Date(d.created_at).getTime()),i=[];for(const s of t)i.push(new Date(s.created_at).getTime()),s.completed_at&&i.push(new Date(s.completed_at).getTime());for(const s of a)i.push(new Date(s.created_at).getTime()),s.resolved_at&&i.push(new Date(s.resolved_at).getTime()),s.claimed_at&&i.push(new Date(s.claimed_at).getTime());if(i.length===0)return{lanes:[],timeMin:0,timeMax:1};const o=Math.min(...i),f=t.some(s=>!s.completed_at)||a.some(s=>!s.resolved_at)?Math.max(l,Math.max(...i)):Math.max(...i),p=f-o||1,m=s=>(s-o)/p*100,h=[];for(const s of r){const d=new Date(s.created_at).getTime(),j=s.completed_at?new Date(s.completed_at).getTime():l,g=!s.completed_at;h.push({kind:"task",id:s.id,label:s.workflow_type,taskId:s.id,startMs:d,endMs:j,startPct:m(d),widthPct:Math.max((j-d)/p*100,.5),durationMs:j-d,isOpen:g,task:s});const v=(c.get(s.id)||[]).sort((n,u)=>new Date(n.created_at).getTime()-new Date(u.created_at).getTime());for(const n of v){const u=new Date(n.created_at).getTime(),N=n.resolved_at?new Date(n.resolved_at).getTime():l,M=!n.resolved_at;let w=null;if(n.claimed_at){const U=new Date(n.claimed_at).getTime(),H=N-u||1;w=(U-u)/H*100}h.push({kind:"escalation",id:n.id,label:n.role,taskId:s.id,startMs:u,endMs:N,startPct:m(u),widthPct:Math.max((N-u)/p*100,.5),durationMs:N-u,isOpen:M,escalation:n,claimPct:w})}}for(const s of x){const d=new Date(s.created_at).getTime(),j=s.resolved_at?new Date(s.resolved_at).getTime():l;let g=null;if(s.claimed_at){const v=new Date(s.claimed_at).getTime(),n=j-d||1;g=(v-d)/n*100}h.push({kind:"escalation",id:s.id,label:s.role,taskId:"",startMs:d,endMs:j,startPct:m(d),widthPct:Math.max((j-d)/p*100,.5),durationMs:j-d,isOpen:!s.resolved_at,escalation:s,claimPct:g})}return{lanes:h,timeMin:o,timeMax:f}}function re(t,a,l,c=500){const[x,r]=b.useState(0),i=b.useRef(null),o=l-a||1;b.useEffect(()=>{if(t===0)return;i.current=null,r(0);let f;const p=m=>{i.current===null&&(i.current=m);const h=m-i.current,s=Math.min(h/c,1),d=1-Math.pow(1-s,3);r(d),s<1&&(f=requestAnimationFrame(p))};return f=requestAnimationFrame(p),()=>cancelAnimationFrame(f)},[t,c]);const k=b.useCallback(f=>{const p=(f.startMs-a)/o,m=(f.endMs-a)/o;if(x<p)return{width:0,opacity:0};const h=m-p||.001,s=Math.min((x-p)/h,1),d=f.widthPct*s,j=Math.min(s/.1,1);return{width:d,opacity:j}},[x,a,o]);return{progress:x,animatedBar:k}}function R({className:t}){return e.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}function B({className:t}){return e.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 00-2.455 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"})})}function O({className:t}){return e.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})})}function F({className:t}){return e.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}function ie({allExpanded:t,onToggleAll:a}){return e.jsxs("div",{className:"flex items-center gap-4 mb-4 flex-wrap",children:[e.jsx("button",{onClick:a,className:"text-2xs text-accent hover:underline",children:t?"Collapse all":"Expand all"}),e.jsxs("div",{className:"flex items-center gap-4 ml-auto",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"Task"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(B,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"AI Task"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(F,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"Escalation"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"Notification"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full dot-ring bg-status-success"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"Done"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full dot-ring bg-status-warning"}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:"Active"})]})]})]})}function oe({ticks:t}){return e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"w-52 shrink-0"}),e.jsx("div",{className:"flex-1 relative h-6 border-b border-surface-border",children:t.map(a=>e.jsx("span",{className:"absolute text-2xs font-mono text-text-tertiary -translate-x-1/2 bottom-1 whitespace-nowrap",style:{left:`${a.pct}%`},children:a.label},a.pct))})]})}function _({label:t,children:a}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:t}),e.jsx("div",{className:"text-xs text-text-primary",children:a})]})}function le({traceId:t,href:a}){const[l,c]=b.useState(!1),x=i=>{i.stopPropagation(),navigator.clipboard.writeText(t),c(!0),setTimeout(()=>c(!1),1500)},r=i=>{i.stopPropagation(),a&&window.open(a,"_blank","noopener,noreferrer")};return e.jsxs("span",{className:"group/trace inline-flex items-center gap-1.5",children:[a&&e.jsx("button",{onClick:r,title:"Open trace",className:"opacity-0 group-hover/trace:opacity-100 transition-opacity p-0.5",children:e.jsx("svg",{className:"w-3 h-3 text-text-tertiary hover:text-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-4.5-4.5h6m0 0v6m0-6L10.5 15"})})}),e.jsx("button",{onClick:x,title:"Copy trace ID",className:"opacity-0 group-hover/trace:opacity-100 transition-opacity p-0.5",children:e.jsx("svg",{className:`w-3 h-3 transition-colors ${l?"text-status-success":"text-text-tertiary hover:text-accent"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:l?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3"})})}),e.jsx("span",{className:"text-2xs text-accent",children:"Trace Details"})]})}function ce({task:t,traceUrl:a}){const l=t.completed_at?new Date(t.completed_at).getTime()-new Date(t.created_at).getTime():Date.now()-new Date(t.created_at).getTime();return e.jsxs("div",{className:"grid grid-cols-[3fr_1fr] gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{status:t.status}),e.jsx(Q,{type:t.workflow_type})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(_,{label:"Started",children:e.jsx(y,{date:t.created_at})}),e.jsx(_,{label:"Completed",children:t.completed_at?e.jsx(y,{date:t.completed_at}):e.jsx("span",{className:"text-text-tertiary italic text-xs",children:"In progress"})}),e.jsx(_,{label:"Duration",children:e.jsx(S,{ms:l,className:"font-mono text-sm"})})]}),t.milestones.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Milestones"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.milestones.map((c,x)=>e.jsxs("span",{className:"px-2 py-0.5 text-2xs font-mono bg-accent-faint/50 rounded text-text-secondary",children:[c.name,": ",String(c.value)]},x))})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsx(D,{to:`/workflows/executions/${encodeURIComponent(t.workflow_id)}`,className:"block text-2xs text-accent hover:underline",children:"Execution Details"}),e.jsx(D,{to:`/workflows/tasks/detail/${t.id}`,className:"block text-2xs text-accent hover:underline",children:"Task Details"}),t.trace_id&&e.jsx(le,{traceId:t.trace_id,href:a?a.replace("{traceId}",t.trace_id):void 0})]})]})}function de({escalation:t}){const a=new Date(t.created_at).getTime(),l=t.claimed_at?new Date(t.claimed_at).getTime()-a:null,c=t.resolved_at?new Date(t.resolved_at).getTime()-a:null;return e.jsxs("div",{className:"grid grid-cols-[3fr_1fr] gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{status:t.status}),e.jsx(Y,{role:t.role}),t.type&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:[t.type,t.subtype?` / ${t.subtype}`:""]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(_,{label:"Created",children:e.jsx(y,{date:t.created_at})}),e.jsx(_,{label:"Claimed",children:t.claimed_at?e.jsxs(e.Fragment,{children:[e.jsx(y,{date:t.claimed_at}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-0.5",children:["after ",e.jsx(S,{ms:l}),t.assigned_to&&e.jsxs(e.Fragment,{children:[" ","by"," ",e.jsx("span",{className:"text-text-secondary font-medium",children:e.jsx(Z,{userId:t.assigned_to})})]})]})]}):e.jsx("span",{className:"text-text-tertiary italic text-xs",children:"Unclaimed"})}),e.jsx(_,{label:"Resolved",children:t.resolved_at?e.jsxs(e.Fragment,{children:[e.jsx(y,{date:t.resolved_at}),e.jsxs("p",{className:"text-2xs text-text-tertiary mt-0.5",children:[e.jsx(S,{ms:c})," total"]})]}):e.jsx("span",{className:"text-text-tertiary italic text-xs",children:"Pending"})})]}),t.description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("p",{className:"text-2xs text-text-secondary leading-relaxed",children:t.description})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[t.workflow_id&&e.jsx(D,{to:`/workflows/executions/${encodeURIComponent(t.workflow_id)}`,className:"block text-2xs text-accent hover:underline",children:"Execution Details"}),e.jsx(D,{to:`/escalations/detail/${t.id}`,className:"block text-2xs text-accent hover:underline",children:"Escalation Details"})]})]})}function xe({lane:t,ticks:a,isExpanded:l,onToggle:c,anim:x,animDone:r,traceUrl:i}){var m,h;const o=t.kind==="task",k=o?t.task.status:t.escalation.status,f=se(k,t.isOpen),p=x.opacity>0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center border-b border-surface-border cursor-pointer hover:bg-surface-sunken/40 transition-colors",onClick:c,children:[e.jsxs("div",{className:`w-52 shrink-0 py-3 pr-4 flex items-center gap-2 ${o?"":"pl-6"}`,style:{opacity:p?1:0,transition:"opacity 0.15s ease-out"},children:[o?ae(t.task.workflow_type)?e.jsx(B,{className:`w-4 h-4 shrink-0 ${$(t.task.status)}`}):e.jsx(R,{className:`w-4 h-4 shrink-0 ${$(t.task.status)}`}):E(t.escalation)?e.jsx(O,{className:`w-4 h-4 shrink-0 ${I(t.escalation.status)}`}):e.jsx(F,{className:`w-4 h-4 shrink-0 ${I(t.escalation.status)}`}),e.jsx("p",{className:"text-xs font-mono text-text-secondary whitespace-nowrap overflow-hidden",title:te(t.kind,o?t.task.status:t.escalation.status,!o&&E(t.escalation)),children:o?A(t.label,24):A(((m=t.escalation)==null?void 0:m.role)??t.label,20)})]}),e.jsxs("div",{className:"flex-1 relative h-10",children:[a.map(s=>e.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-surface-border opacity-30",style:{left:`${s.pct}%`}},s.pct)),e.jsxs("div",{className:`absolute top-2 h-6 rounded-sm ${l?`${f} ring-2 ring-accent ring-offset-1`:`${f} hover:opacity-80`}`,style:{left:`${t.startPct}%`,width:p?`${Math.max(x.width,.3)}%`:"0%",minWidth:p?"4px":"0px",opacity:x.opacity},title:`${t.label} — ${L(t.durationMs)} — ${new Date(t.startMs).toLocaleTimeString()}`,children:[x.width>8&&r&&e.jsx("span",{className:"absolute inset-0 flex items-center px-1.5 text-2xs font-mono text-text-inverse truncate",children:L(t.durationMs)}),t.claimPct!=null&&r&&e.jsx("div",{className:"absolute top-0 bottom-0 w-px border-l border-dashed border-text-inverse/70",style:{left:`${t.claimPct}%`},title:(h=t.escalation)!=null&&h.assigned_to?`Claimed by ${t.escalation.assigned_to}`:"Claimed",children:e.jsx("div",{className:"absolute -top-1 -left-[3px] w-[7px] h-[7px] rounded-full bg-text-inverse border border-status-warning"})})]})]})]}),e.jsx(J,{open:l,children:e.jsx("div",{className:"py-4 px-6 pl-52 border-b border-surface-border bg-surface-sunken/20",children:o&&t.task?e.jsx(ce,{task:t.task,traceUrl:i}):t.escalation?e.jsx(de,{escalation:t.escalation}):null})})]})}function me({tasks:t,escalations:a,traceUrl:l}){const[c,x]=b.useState(new Set),{lanes:r,timeMin:i,timeMax:o}=b.useMemo(()=>ne(t,a),[t,a]),k=o-i||1,{progress:f,animatedBar:p}=re(r.length,i,o);if(r.length===0)return e.jsx("p",{className:"text-sm text-text-tertiary py-8 text-center",children:"No events in this process."});const m=5,h=Array.from({length:m+1},(n,u)=>({pct:u/m*100,label:L(Math.round(u/m*k))})),s=n=>{x(u=>{const N=new Set(u);return N.has(n)?N.delete(n):N.add(n),N})},d=r.map(n=>n.id),j=d.length>0&&d.every(n=>c.has(n)),g=()=>{x(j?new Set:new Set(d))},v=f>=1;return e.jsxs("div",{className:"py-2",children:[e.jsx(ie,{allExpanded:j,onToggleAll:g}),e.jsx(oe,{ticks:h}),r.map(n=>e.jsx(xe,{lane:n,ticks:h,isExpanded:c.has(n.id),onToggle:()=>s(n.id),anim:p(n),animDone:v,traceUrl:l},`${n.kind}-${n.id}`))]})}function C(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function ue(t){return t.length===0?null:[...t].sort((a,l)=>new Date(a.created_at).getTime()-new Date(l.created_at).getTime())[0]}function De(){var j;const{originId:t}=X();V(t);const{data:a,isLoading:l}=z(t??""),{data:c}=q(),x=((j=c==null?void 0:c.telemetry)==null?void 0:j.traceUrl)??null,r=(a==null?void 0:a.tasks)??[],i=(a==null?void 0:a.escalations)??[],o=b.useMemo(()=>ue(r),[r]),k=b.useMemo(()=>C(o==null?void 0:o.envelope),[o]),f=b.useMemo(()=>{if(o!=null&&o.data)return C(o.data);const g=r.filter(v=>v.status==="completed"&&v.data).sort((v,n)=>new Date(n.completed_at).getTime()-new Date(v.completed_at).getTime());return g.length>0?C(g[0].data):null},[o,r]),p=b.useMemo(()=>r.length>0&&r.some(g=>g.status!=="completed"&&g.status!=="cancelled"),[r]),m=b.useMemo(()=>{const g=r.filter(u=>u.status==="completed").length,v=r.filter(u=>u.status==="needs_intervention").length,n=i.filter(u=>u.status==="resolved").length;return{tasks:r.length,completed:g,escalated:v,escalations:i.length,resolved:n}},[r,i]),h=b.useMemo(()=>{if(r.length===0&&i.length===0)return null;const v=[...r.map(w=>w.created_at),...i.map(w=>w.created_at)].sort()[0],n=r.every(w=>w.status==="completed"||w.status==="cancelled"),u=i.every(w=>w.status==="resolved"),N=r.length>0&&n&&u,M=N?[...r.map(w=>w.completed_at),...i.map(w=>w.resolved_at)].filter(Boolean).sort().pop()??null:null;return{startIso:v,endIso:M,isFinished:N,elapsed:G(v,M)}},[r,i]),s=b.useMemo(()=>{const g=[];return h&&g.push({label:h.isFinished?"Completed":"Running",value:h.elapsed,dotClass:h.isFinished?"bg-status-success":"bg-status-pending animate-pulse"}),g.push({label:"Tasks",value:`${m.completed}/${m.tasks}`},{label:"Escalations",value:`${m.resolved}/${m.escalations}`}),g},[h,m]);if(l&&r.length===0)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});const d=k||f||p;return e.jsxs("div",{children:[e.jsx(K,{title:"Process Detail",docsHash:"#docs:dashboard.md:process-detail",subtitle:t,stats:s}),d&&e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-2 gap-8 mb-10",children:[e.jsx("div",{children:k?e.jsx(P,{data:k,label:"Input",defaultMode:"json",defaultCollapsed:!0}):e.jsxs("div",{children:[e.jsx(T,{children:"Input"}),e.jsx("div",{className:"font-mono text-xs bg-surface-sunken rounded-md p-4 text-text-tertiary italic mt-2",children:"Waiting for task..."})]})}),e.jsx("div",{children:f?e.jsx(P,{data:f,label:"Output",defaultMode:"json",defaultCollapsed:!0}):p?e.jsxs("div",{children:[e.jsx(T,{children:"Output"}),e.jsxs("div",{className:"flex items-center gap-2 font-mono text-xs bg-surface-sunken rounded-md p-4 text-text-secondary mt-2",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full dot-ring bg-status-pending animate-pulse"}),"Processing..."]})]}):null})]}),e.jsx(T,{className:"mb-6",children:"Timeline"}),e.jsx(me,{tasks:r,escalations:i,traceUrl:x})]})}export{De as ProcessDetailPage};
2
- //# sourceMappingURL=ProcessDetailPage-Co5oCg31.js.map
@@ -1,2 +0,0 @@
1
- import{j as s}from"./vendor-query-RUZdMvN6.js";import{u as x}from"./tasks-CGoPhQyw.js";import{u as h}from"./workflows-5sds1Ko8.js";import{u as w}from"./useEventHooks-onx-Z6IY.js";import{u as k}from"./useFilterParams-crmlBw_l.js";import{u as y}from"./useDebouncedValue-C4P2jQuh.js";import{b as v}from"./api-path-u2Jf9QXS.js";import{D as _}from"./DataTable-DFPMeqyQ.js";import{T as c}from"./TimestampCell-BKrIaU_R.js";import{S as b}from"./StickyPagination-B3yiAcrs.js";import{F as j,a as P,b as p}from"./FilterBar-D6JDMSHi.js";import{P as S}from"./PageHeader-CFVw67M6.js";import{L as N}from"./ListToolbar-DlGreUpP.js";import{W as C}from"./WorkflowPill-CN-952iI.js";import{u as T}from"./vendor-react-CdqEC2zv.js";import"./index-zqoZDL5j.js";import"./vendor-icons-h-jlRSb9.js";import"./EmptyState-lpUFYfun.js";const F=[{value:"active",label:"Active"},{value:"completed",label:"Completed"},{value:"escalated",label:"Escalated"}],z=[{key:"origin_id",label:"Origin",render:e=>s.jsx("span",{className:"font-mono text-xs",title:e.origin_id,children:e.origin_id.length>40?`${e.origin_id.slice(0,40)}…`:e.origin_id})},{key:"workflow_types",label:"Workflows",render:e=>s.jsx("div",{className:"flex flex-wrap gap-1",children:e.workflow_types.map(a=>s.jsx(C,{type:a},a))})},{key:"task_count",label:"Tasks",render:e=>s.jsx("span",{children:e.task_count}),className:"w-20 text-right"},{key:"completed",label:"Completed",render:e=>e.completed>0?s.jsx("span",{className:"text-status-success",children:e.completed}):s.jsx("span",{className:"text-text-tertiary",children:"0"}),className:"w-24 text-right"},{key:"escalated",label:"Escalated",render:e=>e.escalated>0?s.jsx("span",{className:"text-status-error",children:e.escalated}):s.jsx("span",{className:"text-text-tertiary",children:"0"}),className:"w-24 text-right"},{key:"started_at",label:"Started",render:e=>s.jsx(c,{date:e.started_at}),className:"w-44"},{key:"last_activity",label:"Last Activity",render:e=>s.jsx(c,{date:e.last_activity}),className:"w-44"}];function Q(){w();const e=T(),{filters:a,setFilter:i,pagination:o}=k({filters:{workflow_type:"",status:"",search:""}}),l=y(a.search,300),{data:m}=h(),d=[...new Set((m??[]).map(t=>t.workflow_type))].sort(),{data:r,isLoading:f,refetch:u,isFetching:g}=x({workflow_type:a.workflow_type||void 0,status:a.status||void 0,search:l||void 0,limit:o.pageSize,offset:o.offset}),n=(r==null?void 0:r.total)??0;return s.jsxs("div",{children:[s.jsx(S,{title:"All Processes",docsHash:"#docs:dashboard.md:processes-overview"}),s.jsxs(j,{actions:s.jsx(N,{onRefresh:()=>u(),isFetching:g,apiPath:v("/tasks/processes",{limit:o.pageSize,offset:o.offset,workflow_type:a.workflow_type||void 0,status:a.status||void 0,search:l||void 0})}),children:[s.jsx(P,{label:"Search",value:a.search,onChange:t=>i("search",t),placeholder:"origin, workflow, or trace ID"}),s.jsx(p,{label:"Status",value:a.status,onChange:t=>i("status",t),options:F}),s.jsx(p,{label:"Workflow Type",value:a.workflow_type,onChange:t=>i("workflow_type",t),options:d.map(t=>({value:t,label:t}))})]}),s.jsx(_,{columns:z,data:(r==null?void 0:r.processes)??[],keyFn:t=>t.origin_id,onRowClick:t=>e(`/processes/detail/${encodeURIComponent(t.origin_id)}`),isLoading:f,emptyMessage:"No business processes found"}),s.jsx(b,{page:o.page,totalPages:o.totalPages(n),onPageChange:o.setPage,total:n,pageSize:o.pageSize,onPageSizeChange:o.setPageSize})]})}export{Q as ProcessesListPage};
2
- //# sourceMappingURL=ProcessesListPage-CrB4VAS6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProcessesListPage-CrB4VAS6.js","sources":["../../src/pages/processes/ProcessesListPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { useProcesses, type ProcessSummary } from '../../api/tasks';\nimport { useWorkflowConfigs } from '../../api/workflows';\nimport { useProcessListEvents } from '../../hooks/useEventHooks';\nimport { useFilterParams } from '../../hooks/useFilterParams';\nimport { useDebouncedValue } from '../../hooks/useDebouncedValue';\nimport { buildApiPath } from '../../lib/api-path';\nimport { DataTable, type Column } from '../../components/common/data/DataTable';\nimport { TimestampCell } from '../../components/common/display/TimestampCell';\nimport { StickyPagination } from '../../components/common/data/StickyPagination';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { ListToolbar } from '../../components/common/data/ListToolbar';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\n\nconst STATUS_OPTIONS = [\n { value: 'active', label: 'Active' },\n { value: 'completed', label: 'Completed' },\n { value: 'escalated', label: 'Escalated' },\n];\n\nconst columns: Column<ProcessSummary>[] = [\n {\n key: 'origin_id',\n label: 'Origin',\n render: (row) => (\n <span className=\"font-mono text-xs\" title={row.origin_id}>\n {row.origin_id.length > 40 ? `${row.origin_id.slice(0, 40)}…` : row.origin_id}\n </span>\n ),\n },\n {\n key: 'workflow_types',\n label: 'Workflows',\n render: (row) => (\n <div className=\"flex flex-wrap gap-1\">\n {row.workflow_types.map((wt) => (\n <WorkflowPill key={wt} type={wt} />\n ))}\n </div>\n ),\n },\n {\n key: 'task_count',\n label: 'Tasks',\n render: (row) => <span>{row.task_count}</span>,\n className: 'w-20 text-right',\n },\n {\n key: 'completed',\n label: 'Completed',\n render: (row) =>\n row.completed > 0\n ? <span className=\"text-status-success\">{row.completed}</span>\n : <span className=\"text-text-tertiary\">0</span>,\n className: 'w-24 text-right',\n },\n {\n key: 'escalated',\n label: 'Escalated',\n render: (row) =>\n row.escalated > 0\n ? <span className=\"text-status-error\">{row.escalated}</span>\n : <span className=\"text-text-tertiary\">0</span>,\n className: 'w-24 text-right',\n },\n {\n key: 'started_at',\n label: 'Started',\n render: (row) => <TimestampCell date={row.started_at} />,\n className: 'w-44',\n },\n {\n key: 'last_activity',\n label: 'Last Activity',\n render: (row) => <TimestampCell date={row.last_activity} />,\n className: 'w-44',\n },\n];\n\nexport function ProcessesListPage() {\n useProcessListEvents();\n const navigate = useNavigate();\n const { filters, setFilter, pagination } = useFilterParams({\n filters: { workflow_type: '', status: '', search: '' },\n });\n\n const debouncedSearch = useDebouncedValue(filters.search, 300);\n\n const { data: configs } = useWorkflowConfigs();\n const workflowTypes = [...new Set((configs ?? []).map((c) => c.workflow_type))].sort();\n\n const { data, isLoading, refetch, isFetching } = useProcesses({\n workflow_type: filters.workflow_type || undefined,\n status: filters.status || undefined,\n search: debouncedSearch || undefined,\n limit: pagination.pageSize,\n offset: pagination.offset,\n });\n\n const total = data?.total ?? 0;\n\n return (\n <div>\n <PageHeader title=\"All Processes\" docsHash=\"#docs:dashboard.md:processes-overview\" />\n\n <FilterBar actions={\n <ListToolbar\n onRefresh={() => refetch()}\n isFetching={isFetching}\n apiPath={buildApiPath('/tasks/processes', {\n limit: pagination.pageSize,\n offset: pagination.offset,\n workflow_type: filters.workflow_type || undefined,\n status: filters.status || undefined,\n search: debouncedSearch || undefined,\n })}\n />\n }>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"origin, workflow, or trace ID\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n <FilterSelect\n label=\"Workflow Type\"\n value={filters.workflow_type}\n onChange={(v) => setFilter('workflow_type', v)}\n options={workflowTypes.map((t) => ({ value: t, label: t }))}\n />\n </FilterBar>\n\n <DataTable\n columns={columns}\n data={data?.processes ?? []}\n keyFn={(row) => row.origin_id}\n onRowClick={(row) => navigate(`/processes/detail/${encodeURIComponent(row.origin_id)}`)}\n isLoading={isLoading}\n emptyMessage=\"No business processes found\"\n />\n\n <StickyPagination\n page={pagination.page}\n totalPages={pagination.totalPages(total)}\n onPageChange={pagination.setPage}\n total={total}\n pageSize={pagination.pageSize}\n onPageSizeChange={pagination.setPageSize}\n />\n </div>\n );\n}\n"],"names":["STATUS_OPTIONS","columns","row","jsx","wt","WorkflowPill","TimestampCell","ProcessesListPage","useProcessListEvents","navigate","useNavigate","filters","setFilter","pagination","useFilterParams","debouncedSearch","useDebouncedValue","configs","useWorkflowConfigs","workflowTypes","c","data","isLoading","refetch","isFetching","useProcesses","total","PageHeader","jsxs","FilterBar","ListToolbar","buildApiPath","FilterInput","v","FilterSelect","DataTable","StickyPagination"],"mappings":"syBA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,MAAOvB,EAAQ,cACf,SAAWsB,GAAMrB,EAAU,gBAAiBqB,CAAC,EAC7C,QAASd,EAAc,IAAK,IAAO,CAAE,MAAO,EAAG,MAAO,GAAI,CAAA,CAAA,CAC5D,EACF,EAEAhB,EAAAA,IAACgC,EAAA,CACC,QAAAlC,EACA,MAAMoB,GAAA,YAAAA,EAAM,YAAa,CAAA,EACzB,MAAQnB,GAAQA,EAAI,UACpB,WAAaA,GAAQO,EAAS,qBAAqB,mBAAmBP,EAAI,SAAS,CAAC,EAAE,EACtF,UAAAoB,EACA,aAAa,6BAAA,CAAA,EAGfnB,EAAAA,IAACiC,EAAA,CACC,KAAMvB,EAAW,KACjB,WAAYA,EAAW,WAAWa,CAAK,EACvC,aAAcb,EAAW,QACzB,MAAAa,EACA,SAAUb,EAAW,SACrB,iBAAkBA,EAAW,WAAA,CAAA,CAC/B,EACF,CAEJ"}
@@ -1,2 +0,0 @@
1
- import{j as e,a as g}from"./vendor-query-RUZdMvN6.js";import{_ as d,ar as W,as as B,at as F,I as J,ap as _,au as U,aq as V,av as G}from"./index-zqoZDL5j.js";import{C as Y}from"./ConfirmDeleteModal-CQsJUzEa.js";import{P as K}from"./PageHeader-CFVw67M6.js";import{f as O,T as q,ah as z,ag as Q,j as X,a as M,h as Z}from"./vendor-icons-h-jlRSb9.js";import{e as ee,f as te,u as se}from"./vendor-react-CdqEC2zv.js";import"./Modal-BU7No9NH.js";const ae=[d.SHOW_DETAIL,d.CLAIM,d.CLAIM_SHOW_DETAIL,d.RELEASE,d.RESOLVE,d.ESCALATE,d.CANCEL],ne=()=>({label:"",verb:d.RESOLVE});function le({choices:s,onChange:t}){const x=(o,m)=>t(s.map((c,u)=>u===o?{...c,...m}:c)),l=o=>t(s.filter((m,c)=>c!==o));return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["Choices ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:"The buttons the station screen offers under the item's reality. A code makes a choice double-scannable — scan the item, then the printed action card."}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:s.map((o,m)=>e.jsx(re,{index:m,choice:o,onPatch:c=>x(m,c),onRemove:()=>l(m)},m))}),e.jsxs("button",{type:"button",onClick:()=>t([...s,ne()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover pt-2",children:[e.jsx(O,{className:"w-3.5 h-3.5"})," Add a choice"]})]})}function re({index:s,choice:t,onPatch:x,onRemove:l}){var p;const[o,m]=g.useState(t.params?JSON.stringify(t.params,null,2):""),[c,u]=g.useState(null),i=n=>{if(m(n),!n.trim()){u(null),x({params:void 0});return}try{x({params:JSON.parse(n)}),u(null)}catch{u("Fix the JSON to save these params.")}};return e.jsxs("div",{className:"pt-8 pb-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-widest text-text-tertiary",children:["Choice ",s+1]}),e.jsx("button",{type:"button",onClick:l,className:"icon-link ml-auto",title:"Remove choice",children:e.jsx(q,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[12rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Label ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Button text — what the associate reads."}),e.jsx("input",{value:t.label,onChange:n=>x({label:n.target.value}),className:"input w-full",placeholder:"Collected"})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Runs ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this choice performs."}),e.jsx("select",{value:t.verb,onChange:n=>x({verb:n.target.value}),className:"select",children:ae.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Code"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Short token for double-scan selection."}),e.jsx("input",{value:t.code??"",onChange:n=>x({code:n.target.value||void 0}),className:"input w-[10rem] font-mono",placeholder:"COLLECT"})]}),e.jsxs("label",{className:"block flex-1 min-w-[14rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before running — empty runs on tap."}),e.jsx("input",{value:((p=t.confirm)==null?void 0:p.prompt)??"",onChange:n=>x({confirm:n.target.value?{prompt:n.target.value}:void 0}),className:"input w-full",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!t.requireActingIdentity,onChange:n=>x({requireActingIdentity:n.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This choice runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Params (JSON)"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The verb's parameters — resolverPayload, targetRole, metadata, durationMinutes."}),e.jsx("textarea",{value:o,onChange:n=>i(n.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "resolverPayload": { "outcome": "collected" } }'}),c&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:c})]})]})}const ce={[d.SHOW_DETAIL]:"Show the item",[d.SHOW_LIST]:"Show all matches as a list",[d.CLAIM]:"Claim",[d.CLAIM_SHOW_DETAIL]:"Claim and show the item",[d.RELEASE]:"Release my claim",[d.RESOLVE]:"Resolve with a canned payload",[d.ESCALATE]:"Send to another queue",[d.CANCEL]:"Cancel",[d.PRESENT]:"Show reality + choices"};function oe({index:s,step:t,roleKeys:x,isLast:l,onPatch:o,onMove:m,onRemove:c}){var T,N,A,L,j,I;const[u,i]=g.useState((T=t.params)!=null&&T.resolverPayload?JSON.stringify(t.params.resolverPayload,null,2):""),[p,n]=g.useState(null),b=a=>o({query:{...t.query,...a}}),k=a=>o({params:{...t.params,...a}}),v=a=>{if(i(a),!a.trim()){n(null),k({resolverPayload:void 0});return}try{k({resolverPayload:JSON.parse(a)}),n(null)}catch{n("Fix the JSON to save this payload.")}},y=t.query.roles??[],r=t.verb===d.PRESENT,w=t.verb===d.ESCALATE,C=t.verb===d.RESOLVE||t.verb===d.ESCALATE&&((N=t.params)==null?void 0:N.closeCurrent)==="resolve";return e.jsxs("div",{className:"py-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-quaternary",children:["Step ",s+1]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>m(-1),disabled:s===0,className:"icon-link disabled:opacity-30",title:"Move up",children:e.jsx(z,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:()=>m(1),disabled:l,className:"icon-link disabled:opacity-30",title:"Move down",children:e.jsx(Q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",onClick:c,className:"icon-link",title:"Remove step",children:e.jsx(q,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Look in"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queues the item is expected in — empty means any."}),e.jsx(W,{values:y,options:x,onChange:a=>b({roles:a.length?a:void 0}),addLabel:"Add a queue…",emptyText:"Any queue I can see",ariaLabel:"Add a queue"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Held by"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Narrow to claimed, unclaimed, or my items."}),e.jsxs("select",{value:t.query.availability??"any",onChange:a=>b({availability:a.target.value==="any"?void 0:a.target.value}),className:"select",children:[e.jsx("option",{value:"any",children:"Anyone / unheld"}),e.jsx("option",{value:"available",children:"Unclaimed only"}),e.jsx("option",{value:"claimed",children:"Claimed only"}),e.jsx("option",{value:"mine",children:"Mine only"})]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Then ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The action this step performs on a match."}),e.jsx("select",{value:t.verb,onChange:a=>o({verb:a.target.value,params:void 0,confirm:void 0,choices:void 0,autoSelectSingle:void 0}),className:"select",children:Object.entries(ce).map(([a,P])=>e.jsx("option",{value:a,children:P},a))})]}),w&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Send to ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"The queue the item re-homes to."}),e.jsxs("select",{value:((A=t.params)==null?void 0:A.targetRole)??"",onChange:a=>k({targetRole:a.target.value||void 0}),className:"select font-mono",children:[e.jsx("option",{value:"",disabled:!0,children:"Choose…"}),x.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),w&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Current item"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Close out the located item first."}),e.jsxs("select",{value:((L=t.params)==null?void 0:L.closeCurrent)??"",onChange:a=>k({closeCurrent:a.target.value||void 0}),className:"select",children:[e.jsx("option",{value:"",children:"Leave it open"}),e.jsx("option",{value:"resolve",children:"Resolve it"}),e.jsx("option",{value:"cancel",children:"Cancel it"})]})]}),!r&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Confirmation"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Ask before acting — the prompt shows on the item."}),e.jsx("input",{value:((j=t.confirm)==null?void 0:j.prompt)??"",onChange:a=>o({confirm:a.target.value?{prompt:a.target.value}:void 0}),className:"input w-full min-w-[16rem]",placeholder:"Run without asking"})]}),e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!t.requireActingIdentity,onChange:a=>o({requireActingIdentity:a.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"This step runs only for a badged (or write-capable) user.",children:"Requires acting identity"})]}),r&&((I=t.choices)==null?void 0:I.length)===1&&e.jsxs("label",{className:"flex items-end gap-2 pb-2",children:[e.jsx("input",{type:"checkbox",checked:!!t.autoSelectSingle,onChange:a=>o({autoSelectSingle:a.target.checked||void 0})}),e.jsx("span",{className:"text-xs text-text-secondary",title:"With one choice, the scan runs it directly instead of presenting; a badge is still collected first when required.",children:"Auto-select the single choice"})]})]}),C&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Resolver payload ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsxs("span",{className:"block text-2xs text-text-tertiary mb-1",children:["JSON submitted as the resolution. ","{scan.target}",", ","{scan.category}"," and ","{scan.scannedAt}"," fill in from the scan."]}),e.jsx("textarea",{value:u,onChange:a=>v(a.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:'{ "outcome": "collected", "serial": "{scan.target}" }'}),p&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:p})]}),r&&e.jsx(le,{choices:t.choices??[],onChange:a=>o({choices:a.length?a:void 0,...a.length===1?{}:{autoSelectSingle:void 0}})})]})}const H=()=>({query:{},verb:d.SHOW_DETAIL});function ie({schemeVersion:s,schemeKind:t,category:x,rule:l,codePreview:o,onDeleted:m}){var P,$;const c=B(),u=F(),{data:i}=J(),p=((i==null?void 0:i.roles)??[]).map(h=>h.role),n=t===_.IDENTITY,[b,k]=g.useState((l==null?void 0:l.name)??""),[v,y]=g.useState((l==null?void 0:l.steps)??(n?[]:[H()])),[r,w]=g.useState(((P=l==null?void 0:l.fallback)==null?void 0:P.markdown)??""),[C,T]=g.useState((($=l==null?void 0:l.notPrimed)==null?void 0:$.markdown)??""),[N,A]=g.useState((l==null?void 0:l.enabled)??!0),L=(h,f)=>y(E=>E.map((S,R)=>R===h?{...S,...f}:S)),j=(h,f)=>y(E=>{const S=[...E],R=h+f;return R<0||R>=S.length?E:([S[h],S[R]]=[S[R],S[h]],S)}),I=h=>y(f=>f.filter((E,S)=>S!==h)),a=()=>c.mutate({scheme_version:s,category:x,name:b,steps:n?[]:v,fallback:{markdown:r||void 0},notPrimed:{markdown:C||void 0},enabled:N});return e.jsxs("div",{className:"space-y-8 max-w-form",children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["1 · Friendly name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:n?'Name the badge population — "Associate badge".':'Print this beside the code — "Send Printer to Servicing".'}),e.jsx("input",{value:b,onChange:h=>k(h.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disabled rules report unconfigured."}),e.jsxs("select",{value:N?"enabled":"disabled",onChange:h=>A(h.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{className:"block text-xs text-text-secondary",children:["2 · Conditions and actions ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary",children:'Scanning walks the steps in order — the first query that finds the item runs its action. Put the expected state first and a broad "show the item" last so a misplaced item still reports where it is.'})]}),e.jsx("div",{className:"divide-y divide-surface-border border-y border-surface-border",children:v.map((h,f)=>e.jsx(oe,{index:f,step:h,roleKeys:p,isLast:f===v.length-1,onPatch:E=>L(f,E),onMove:E=>j(f,E),onRemove:()=>I(f)},f))}),e.jsxs("button",{type:"button",onClick:()=>y(h=>[...h,H()]),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(O,{className:"w-3.5 h-3.5"})," Add a step"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:n?"2 · When the badge is unknown":"3 · When nothing matches"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:n?"Markdown shown when a scanned badge matches no user.":"Markdown shown to the scanner operator when no step finds the item."}),e.jsx("textarea",{value:r,onChange:h=>w(h.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:n?"**Badge not recognized.** See your lead to get it registered.":"**Nothing here.** The item this code points at is not in any queue."})]}),!n&&e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"When a badge is required"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Markdown shown when a step or choice needs an acting identity and none is primed."}),e.jsx("textarea",{value:C,onChange:h=>T(h.target.value),rows:3,className:"textarea w-full font-mono text-sm",placeholder:"**Scan your badge** to run this action."})]})]}),c.error&&e.jsx("p",{className:"text-xs text-status-error",children:c.error.message}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:a,disabled:!b||!n&&v.length===0||c.isPending,className:"btn-primary text-xs",children:l?"Save rule":`Create rule ${s}:${x}`}),e.jsx("span",{className:"text-2xs text-text-quaternary font-mono",children:o}),l&&e.jsxs("button",{type:"button",onClick:()=>u.mutate({scheme_version:s,category:x},{onSuccess:m}),className:"ml-auto flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(q,{className:"w-3.5 h-3.5"})," Delete rule"]})]})]})}function xe(s){for(let t=0;t<=9;t++)if(!s.has(String(t)))return String(t);return null}function D({icon:s,label:t,annotation:x,aside:l,children:o}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(s,{className:"w-3 h-3 text-text-tertiary shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:t}),x&&e.jsxs("span",{className:"text-2xs text-text-quaternary truncate",children:["— ",x]})]}),l]}),e.jsx("div",{className:"border-l-2 pl-5 border-surface-border/60",children:o})]})}function Ne(){const{version:s}=ee(),t=Number(s),[x,l]=te(),{data:o,isLoading:m}=U(Number.isInteger(t)?t:null),c=x.get("category"),u=r=>{l(w=>{const C=new URLSearchParams(w);return r?C.set("category",r):C.delete("category"),C})};if(m)return e.jsx("div",{className:"text-sm text-text-tertiary",children:"Loading…"});if(!o)return e.jsxs("div",{className:"text-sm text-text-tertiary",children:["No scheme for version ",s,"."]});const{scheme:i,rules:p}=o,n=new Map(p.map(r=>[r.category,r])),b=c?n.get(c)??null:null,k=xe(new Set(p.map(r=>r.category))),v=i.encoding==="fixed"?"7".repeat(i.target_length??8):"SN-1234",y=r=>i.encoding==="fixed"?`${i.version}${r}${v}`:`${i.version}${i.delimiter}${r}${i.delimiter}${v}`;return e.jsxs("div",{className:"space-y-10",children:[e.jsx(K,{title:i.name}),e.jsxs("p",{className:"text-sm text-text-secondary max-w-form -mt-4",children:["Codes for this scheme start with ",e.jsx("span",{className:"font-mono text-text-primary",children:i.version}),".",i.kind===_.IDENTITY?" Scanning a badge primes who acts next; each slot names the badge and its unknown-badge message.":" Add an action, name it, and configure what a scan does — each action gets its own slot automatically."]}),e.jsx(de,{scheme:i,ruleCount:p.length},i.version),e.jsx(D,{icon:X,label:"Actions",annotation:i.kind===_.IDENTITY?"named badge slots — each carries its unknown-badge message":"what a scan of this scheme does — named, in the order you add them",children:e.jsxs("div",{className:"divide-y divide-surface-border border-y border-surface-border max-w-form",children:[p.map(r=>{const w=c===r.category;return e.jsxs("button",{type:"button",onClick:()=>u(w?null:r.category),className:`w-full flex items-center gap-4 py-3 px-2 text-left transition-colors ${w?"bg-accent/10":"hover:bg-surface-sunken"}`,children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-xs font-mono text-accent border border-surface-border rounded shrink-0",children:r.category}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm text-text-primary truncate",children:r.name}),e.jsx("div",{className:"text-2xs text-text-tertiary font-mono truncate",children:y(r.category)})]})]},r.category)}),e.jsxs("div",{className:"flex items-center gap-4 py-3 px-2",children:[e.jsx("span",{className:"w-9 h-8 flex items-center justify-center text-text-quaternary shrink-0",children:e.jsx(M,{className:"w-4 h-4",strokeWidth:1.5})}),k==null?e.jsx("span",{className:"text-2xs text-text-quaternary",children:"All 10 action slots are in use."}):e.jsxs("button",{type:"button",onClick:()=>u(k),className:"flex items-center gap-1.5 text-sm text-accent hover:text-accent-hover",children:[e.jsx(O,{className:"w-3.5 h-3.5"})," Add an action"]})]})]})}),c&&e.jsx(D,{icon:M,label:b?b.name:"New action",annotation:`this label prints beside the code — e.g. ${y(c)}`,children:e.jsx(ie,{schemeVersion:i.version,schemeKind:i.kind,category:c,rule:b,codePreview:y(c),onDeleted:()=>u(null)},`${i.version}:${c}`)})]})}function de({scheme:s,ruleCount:t}){const x=se(),l=V(),o=G(),[m,c]=g.useState(s.name),[u,i]=g.useState(s.kind),[p,n]=g.useState(s.target_facet),[b,k]=g.useState(s.grant_ttl_seconds??3600),[v,y]=g.useState(s.grant_max_uses??0),[r,w]=g.useState(s.enabled),[C,T]=g.useState(!1),N=u===_.IDENTITY,A=!N||b>=1&&b<=86400,L=m!==s.name||p!==s.target_facet||r!==s.enabled||u!==s.kind||N&&(b!==s.grant_ttl_seconds||v!==s.grant_max_uses);return e.jsxs(D,{icon:Z,label:"Scheme",annotation:`version digit ${s.version}`,aside:e.jsxs("button",{type:"button",onClick:()=>T(!0),className:"flex items-center gap-1 text-xs text-status-error/80 hover:text-status-error",children:[e.jsx(q,{className:"w-3.5 h-3.5"})," Delete scheme"]}),children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4 max-w-form",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Kind ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"A badge — scanning it primes who acts next.":"An item code — scanning it acts on the item."}),e.jsxs("select",{value:u,onChange:j=>i(j.target.value),className:"select",children:[e.jsx("option",{value:_.ACTION,children:"Action"}),e.jsx("option",{value:_.IDENTITY,children:"Identity"})]})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Name ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"Say who the badge identifies.":"Say what the target identifies."}),e.jsx("input",{value:m,onChange:j=>c(j.target.value),className:"input w-full"})]}),e.jsxs("label",{className:"block flex-1 min-w-[16rem]",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Target facet ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:N?"The user-metadata key the badge matches (e.g. badge_id).":"The metadata key the scanned value matches."}),e.jsx("input",{value:p,onChange:j=>n(j.target.value),className:"input w-full font-mono"})]}),N&&e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-xs text-text-secondary mb-1",children:["Grant TTL (seconds) ",e.jsx("span",{className:"text-status-error",children:"*"})]}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"How long a badge scan stays primed (1–86400)."}),e.jsx("input",{type:"number",min:1,max:86400,value:b,onChange:j=>k(Number(j.target.value)),className:"input w-[12rem]"}),!A&&e.jsx("span",{className:"block text-2xs text-status-error mt-1",children:"Enter 1–86400 seconds."})]}),N&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Grant max uses"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"0 = TTL-bound; n = the grant covers n scans."}),e.jsx("input",{type:"number",min:0,value:v,onChange:j=>y(Number(j.target.value)),className:"input w-[12rem]"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs text-text-secondary mb-1",children:"Status"}),e.jsx("span",{className:"block text-2xs text-text-tertiary mb-1",children:"Disable to reject every scan of this version."}),e.jsxs("select",{value:r?"enabled":"disabled",onChange:j=>w(j.target.value==="enabled"),className:"select",children:[e.jsx("option",{value:"enabled",children:"Enabled"}),e.jsx("option",{value:"disabled",children:"Disabled"})]})]}),L&&e.jsx("button",{type:"button",disabled:l.isPending||!m||!p||!A,onClick:()=>l.mutate({version:s.version,name:m,description:s.description,target_facet:p,encoding:s.encoding,delimiter:s.delimiter,target_length:s.target_length,kind:u,grant_ttl_seconds:N?b:null,grant_max_uses:N?v:0,enabled:r}),className:"btn-primary text-xs",children:"Save"})]}),l.error&&e.jsx("p",{className:"text-xs text-status-error mt-2",children:l.error.message}),e.jsx(Y,{open:C,onClose:()=>T(!1),onConfirm:()=>o.mutate(s.version,{onSuccess:()=>x("/admin/scan-codes")}),title:`Delete scheme ${s.version}`,description:t>0?`This deletes "${s.name}" and its ${t} ${t===1?"rule":"rules"}. Codes starting with ${s.version} stop resolving, and labels already printed with them report unconfigured.`:`This deletes "${s.name}". Codes starting with ${s.version} stop resolving.`,isPending:o.isPending,error:o.error})]})}export{Ne as ScanSchemeDetailPage};
2
- //# sourceMappingURL=ScanSchemeDetailPage-CkzoOyjd.js.map
@@ -1,2 +0,0 @@
1
- import{j as e,a as o}from"./vendor-query-RUZdMvN6.js";import{a2 as E,aw as B,ax as L,a0 as A,L as O,ay as R,az as W,aA as C,_ as v}from"./index-zqoZDL5j.js";import{a as _,aV as F,aW as P}from"./vendor-icons-h-jlRSb9.js";import{M as D}from"./Modal-BU7No9NH.js";import{d as V}from"./metadata-display-DHjqWkLG.js";import{a as U,u as $}from"./vendor-react-CdqEC2zv.js";function q({stationName:t}){return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-24",children:[e.jsx(_,{className:"w-10 h-10 text-accent-muted mb-8",strokeWidth:1}),e.jsx("h1",{className:"text-3xl font-light text-text-primary tracking-tight",children:t}),e.jsx("div",{className:"w-16 border-t border-surface-border my-8"}),e.jsx("p",{className:"text-lg text-text-secondary",children:"Scan your badge to begin"}),e.jsx("p",{className:"text-sm text-text-tertiary mt-2",children:"or scan an item"})]})}function H(t){const r=Math.floor(t/60),c=t%60;return`${r}:${String(c).padStart(2,"0")}`}function Y(){const{identity:t,remainingSeconds:r}=E(),[,c]=o.useState(0);return o.useEffect(()=>{if(!(t!=null&&t.expiresAt))return;const a=setInterval(()=>c(f=>f+1),1e3);return()=>clearInterval(a)},[t]),t?e.jsxs("div",{className:"flex items-center gap-2.5 pb-3 mb-6 border-b border-surface-border",children:[e.jsx(F,{className:"w-4 h-4 text-status-success shrink-0",strokeWidth:1.5}),e.jsxs("span",{className:"text-sm font-medium text-text-primary",children:["Hi ",t.displayName]}),t.expiresAt&&e.jsx("span",{className:"ml-auto text-sm font-mono tabular-nums text-text-tertiary",children:H(r())})]}):null}function M(t,r){return!t.withheld||r}function z(t,r,c){return t.find(a=>!!a.code&&a.code===c&&M(a,r))??null}function G(t){return t==null||t===""?"—":typeof t=="boolean"?t?"Yes":"No":typeof t=="object"?JSON.stringify(t):String(t)}function J({label:t,value:r}){return e.jsxs("div",{className:"flex items-baseline gap-4 py-2",children:[e.jsx("span",{className:"w-32 shrink-0 text-2xs uppercase tracking-wide text-text-quaternary",children:t}),e.jsx("span",{className:"text-sm text-text-primary break-words",children:r})]})}function I(){return e.jsx("span",{className:"text-text-quaternary select-none",children:"·"})}function X({response:t,hasActingIdentity:r,selfId:c,busy:a,onExecute:f,onWithheldSelect:n}){var i,m;const{setCodeInterceptor:h}=B(),[x,d]=o.useState(null),l=t.escalation??{},u=t.choices??[],S=l.metadata??{},b=s=>{s.confirm?d(s):f(s)},j=o.useRef({choices:u,hasActingIdentity:r,select:b});j.current={choices:u,hasActingIdentity:r,select:b},o.useEffect(()=>(h(s=>{const p=j.current,T=z(p.choices,p.hasActingIdentity,s);return T?(p.select(T),!0):!1}),()=>h(null)),[h]);const g=l.assigned_to??null,k=g?g===c?"Claimed by you":"Claimed":"Unclaimed",w=g===c?"text-accent":"text-text-secondary",N=[l.type,l.subtype].filter(Boolean).join(" · "),y=V(S);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col max-w-form",children:[e.jsxs("div",{children:[((i=t.rule)==null?void 0:i.name)&&e.jsx("div",{className:"text-2xs font-semibold uppercase tracking-widest text-accent mb-2",children:t.rule.name}),e.jsx("h2",{className:"text-2xl font-medium leading-tight text-text-primary mb-2",children:l.description||N||"Located item"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-text-secondary mb-5",children:[e.jsx("span",{children:String(l.role??"—")}),N&&e.jsxs(e.Fragment,{children:[e.jsx(I,{}),e.jsx("span",{children:N})]}),e.jsx(I,{}),e.jsx("span",{className:w,children:k}),typeof l.created_at=="string"&&e.jsxs(e.Fragment,{children:[e.jsx(I,{}),e.jsx("span",{children:L(l.created_at)})]})]}),y.length>0&&e.jsx("div",{className:"divide-y divide-surface-border border-t border-surface-border",children:y.map(([s,p])=>e.jsx(J,{label:s,value:G(p)},s))})]}),e.jsx("div",{className:"mt-8 space-y-3",children:u.map(s=>{const p=M(s,r);return e.jsx("div",{children:e.jsx("button",{type:"button",disabled:a,onClick:()=>p?b(s):n(s),className:"w-full text-left px-5 py-4 text-lg text-text-primary border border-surface-border rounded hover:bg-surface-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e.jsxs("span",{className:"flex items-baseline gap-3",children:[s.label,s.code&&e.jsx("span",{className:"ml-auto text-2xs font-mono text-text-quaternary",children:s.code})]})})},s.index)})}),x&&e.jsx(D,{open:!0,onClose:()=>d(null),title:x.label,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:(m=x.confirm)==null?void 0:m.prompt}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>d(null),disabled:a,className:"btn-secondary text-xs",children:"No, go back"}),e.jsx("button",{type:"button",onClick:()=>{const s=x;d(null),f(s)},disabled:a,className:"btn-primary text-xs",children:"Yes, continue"})]})]})})]})}function K({choice:t,notPrimedMarkdown:r,primed:c,busy:a,onExecute:f,onCancel:n}){var l;const[h,x]=o.useState(!1),d=o.useRef(!1);return o.useEffect(()=>{if(!c){d.current=!1;return}d.current||(d.current=!0,t.confirm?x(!0):f(t))},[c,t,f]),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-24",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[e.jsx(_,{className:"w-8 h-8 text-text-quaternary",strokeWidth:1}),e.jsx(P,{className:"w-10 h-10 text-accent-muted",strokeWidth:1})]}),e.jsx("h2",{className:"text-2xl font-light text-text-primary tracking-tight",children:"Scan your badge to continue"}),e.jsxs("p",{className:"text-lg text-text-secondary mt-2",children:["to ",t.label]}),r&&e.jsx("div",{className:"text-sm text-text-tertiary mt-6 max-w-prose",children:e.jsx(A,{content:r,compact:!0})}),e.jsx("div",{className:"w-16 border-t border-surface-border my-8"}),e.jsx("button",{type:"button",onClick:n,disabled:a,className:"text-sm text-text-tertiary hover:text-text-secondary hover:underline",children:"Cancel"}),h&&e.jsx(D,{open:!0,onClose:n,title:t.label,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-secondary",children:(l=t.confirm)==null?void 0:l.prompt}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:n,disabled:a,className:"btn-secondary text-xs",children:"No, go back"}),e.jsx("button",{type:"button",onClick:()=>{x(!1),f(t)},disabled:a,className:"btn-primary text-xs",children:"Yes, continue"})]})]})})]})}const Q=8e3,Z=[v.SHOW_DETAIL,v.CLAIM,v.CLAIM_SHOW_DETAIL];function ce(){var y;const t=U(),r=$(),{user:c}=O(),{identity:a,clear:f}=E(),[n,h]=o.useState(null),[x,d]=o.useState(null),[l,u]=o.useState(null),[S,b]=o.useState(!1);o.useEffect(()=>{var s,p;const i=(s=t.state)==null?void 0:s[R];if(!i)return;h(i),u(null);const m=((p=i.choices)==null?void 0:p.length)===1?i.choices[0]:void 0;d(i.autoSelect&&m?{choice:m,returnTo:"idle"}:null),r(t.pathname,{replace:!0,state:null})},[t,r]),o.useEffect(()=>{if(!l)return;const i=setTimeout(()=>u(null),Q);return()=>clearTimeout(i)},[l]);const j=o.useCallback(async i=>{if(!(!(n!=null&&n.rule)||!n.escalation)){b(!0);try{const m=await W({schemeVersion:n.rule.schemeVersion,category:n.rule.category,stepIndex:n.stepIndex??0,choiceIndex:i.index,escalationId:String(n.escalation.id),actingToken:a==null?void 0:a.actingToken});switch(m.outcome){case C.EXECUTED:if(h(null),d(null),Z.includes(i.verb)&&m.escalation){r(`/escalations/detail/${m.escalation.id}`);break}u({at:Date.now(),tone:"text-status-success",text:`${i.label} — done`});break;case C.CONFLICT:h(null),d(null),u({at:Date.now(),tone:"text-status-warning",text:m.error||"The item changed since it was scanned — scan it again."});break;case C.UNCONFIGURED:h(null),d(null),u({at:Date.now(),tone:"text-status-warning",text:m.error||"This choice is no longer configured."});break;case C.NOT_PRIMED:f(),u(null),d(s=>({choice:i,returnTo:(s==null?void 0:s.returnTo)??"choices"}));break;default:u({at:Date.now(),tone:"text-status-error",text:m.error||"The choice did not run."})}}catch(m){u({at:Date.now(),tone:"text-status-error",text:m.message})}finally{b(!1)}}},[n,a,r,f]),g=o.useCallback(i=>{d({choice:i,returnTo:"choices"})},[]),k=o.useCallback(()=>{(x==null?void 0:x.returnTo)==="idle"&&h(null),d(null)},[x]),w=(c==null?void 0:c.displayName)||(c==null?void 0:c.username)||"Scan station",N=!!(n!=null&&n.choices&&n.escalation);return e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsx(Y,{}),x&&n?e.jsx(K,{choice:x.choice,notPrimedMarkdown:(y=n.notPrimed)==null?void 0:y.markdown,primed:!!a,busy:S,onExecute:j,onCancel:k}):N?e.jsx(X,{response:n,hasActingIdentity:!!a,selfId:(a==null?void 0:a.actorId)??(c==null?void 0:c.userId)??null,busy:S,onExecute:j,onWithheldSelect:g},String(n.escalation.id)):e.jsx(q,{stationName:w}),l&&e.jsxs("div",{role:"status",className:"mt-8 pt-3 border-t border-surface-border",children:[e.jsx("span",{className:`text-sm font-medium ${l.tone}`,children:l.text}),l.markdown&&e.jsx("div",{className:"text-sm text-text-secondary mt-1",children:e.jsx(A,{content:l.markdown,compact:!0})})]})]})}export{ce as ScanStationPage};
2
- //# sourceMappingURL=ScanStationPage-DYamACNZ.js.map
@@ -1,2 +0,0 @@
1
- import{j as o}from"./vendor-query-RUZdMvN6.js";import{b as e}from"./index-zqoZDL5j.js";function i({date:r,className:t=""}){return o.jsx(e,{date:r,format:"relative",className:t})}export{i as T};
2
- //# sourceMappingURL=TimeAgo-BpJ7In27.js.map
@@ -1,2 +0,0 @@
1
- import{a as w,j as e}from"./vendor-query-RUZdMvN6.js";import{a as B,f as F}from"./workflows-5sds1Ko8.js";import{h as Q}from"./useEventHooks-onx-Z6IY.js";import{u as J,E as M}from"./EventTable-ebZK7vXl.js";import{b as z,e as H}from"./tasks-CGoPhQyw.js";import{P as d,b,D as K,c as Y,d as q,J as _,h as Z}from"./index-zqoZDL5j.js";import{P as G}from"./PageHeader-CFVw67M6.js";import{S as X}from"./SegmentedTabs-DXNzY05q.js";import{L as ee}from"./ListToolbar-DlGreUpP.js";import{S as te,a as se}from"./StatusBadge-BDeUwPtb.js";import{C as y}from"./CopyableId-4Lqlc5cU.js";import{J as S,ar as ae,K as re,O as ne,Q as le,V as oe,s as ie}from"./vendor-icons-h-jlRSb9.js";import{L as m,e as ce,u as de}from"./vendor-react-CdqEC2zv.js";import{S as xe}from"./SwimlaneTimeline-D64ep5KY.js";import"./FilterBar-D6JDMSHi.js";import"./StreamMessageDetail-C56PtZSb.js";function ue(t){const s=t.lastIndexOf("-");return s<=0?{taskQueue:t,workflowType:t}:{taskQueue:t.substring(0,s),workflowType:t.substring(s+1)}}function me({children:t}){return e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:t})}function E({status:t}){return e.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${se[t]??"bg-status-active"}`,title:t})}function pe({escalations:t}){return e.jsx("div",{children:t.map(s=>e.jsxs(m,{to:`/escalations/detail/${s.id}`,className:"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 py-2 border-b border-surface-border/40 last:border-b-0 group",children:[e.jsx(E,{status:s.status}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-xs font-mono text-text-primary group-hover:text-accent transition-colors truncate",title:s.type,children:s.type}),e.jsx("span",{className:"block text-2xs text-text-tertiary truncate",children:s.role})]}),e.jsx(b,{date:s.created_at,format:"relative",className:"text-2xs text-text-tertiary whitespace-nowrap text-right"})]},s.id))})}function fe({tasks:t}){return e.jsx("div",{children:t.map(s=>e.jsxs(m,{to:`/workflows/tasks/detail/${s.id}`,className:"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 py-2 border-b border-surface-border/40 last:border-b-0 group",children:[e.jsx(E,{status:s.status}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-xs font-mono text-text-primary group-hover:text-accent transition-colors truncate",title:s.workflow_type,children:s.workflow_type}),e.jsx("span",{className:"block text-2xs text-text-tertiary truncate",children:s.lt_type})]}),e.jsx(b,{date:s.created_at,format:"relative",className:"text-2xs text-text-tertiary whitespace-nowrap text-right"})]},s.id))})}function he({execution:t,parentWorkflowId:s,childTasks:a,escalations:n,headerActions:l,open:i}){const u=n.length>0||a.length>0,[x,o]=w.useState(u?"escalations":"details"),{taskQueue:p,workflowType:j}=ue(t.workflow_type),f=[{id:"details",icon:S,label:"Details",content:e.jsxs("dl",{className:"space-y-3.5",children:[e.jsx(d,{label:"Status",children:e.jsx(te,{status:t.status})}),e.jsx(d,{label:"Workflow Type",children:e.jsx(y,{bare:!0,value:j,href:`/workflows/executions?entity=${encodeURIComponent(j)}`})}),e.jsx(d,{label:"Workflow ID",children:e.jsx(y,{bare:!0,value:t.workflow_id})}),s&&e.jsx(d,{label:"Parent",children:e.jsx(y,{bare:!0,value:s,href:`/workflows/executions/${s}`})}),e.jsx(d,{label:"Task Queue",children:e.jsx("span",{className:"font-mono",children:p})}),e.jsx(d,{label:"Start Time",children:t.start_time?e.jsx(b,{date:t.start_time,format:"datetime"}):e.jsx("span",{className:"text-text-tertiary",children:"--"})}),e.jsx(d,{label:"End Time",children:t.close_time?e.jsx(b,{date:t.close_time,format:"datetime"}):e.jsx("span",{className:"text-text-tertiary",children:"--"})}),e.jsx(d,{label:"Duration",children:e.jsx(K,{ms:t.duration_ms,className:"font-mono"})}),e.jsxs(d,{label:"History Size",children:[t.summary.total_events," events"]}),e.jsxs(d,{label:"Activities",children:[t.summary.activities.completed," / ",t.summary.activities.total]})]})},{id:"escalations",icon:ae,label:"Escalations",content:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{children:n.length>0?e.jsx(pe,{escalations:n}):e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"This workflow has not escalated."})}),a.length>0&&e.jsxs("div",{children:[e.jsx(me,{children:"Related Tasks"}),e.jsx(fe,{tasks:a})]})]})}];return e.jsx(Y,{open:i,width:384,className:"h-full",children:e.jsx("div",{className:"h-full pl-6",children:e.jsx(q,{views:f,activeId:x,onViewChange:o,headerActions:l,stickyClassName:"h-full min-h-0",labelInline:!0})})})}function we(t){var n;const s=t.events.find(l=>l.event_type==="workflow_execution_started"),a=(n=s==null?void 0:s.attributes)==null?void 0:n.input;return a&&typeof a=="object"?a:null}function je({execution:t}){const s=we(t),a=t.result,n=(a==null?void 0:a.data)??a??null;return!s&&!n?null:e.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-4 mb-6",children:[s!==null&&e.jsx("div",{children:e.jsx(_,{data:s,label:"Input Envelope"})}),n!==null&&e.jsx("div",{children:e.jsx(_,{data:n,label:"Result"})})]})}const be=["details","timeline","events"],T="lt:workflow-execution:tab";function ve({isRunning:t,hasToolCalls:s,workflowId:a,onAction:n}){const[l,i]=w.useState(!1),u=w.useRef(null);return w.useEffect(()=>{if(!l)return;const x=o=>{u.current&&!u.current.contains(o.target)&&i(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]),e.jsxs("div",{className:"relative",ref:u,children:[e.jsxs("button",{onClick:()=>i(!l),className:"flex items-center gap-0.5 pl-2 pr-1 py-1 rounded-md text-2xs font-medium text-accent hover:text-accent-hover hover:bg-surface-hover transition-colors",title:"Actions",children:["Actions",e.jsx(ie,{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`})]}),l&&e.jsxs("div",{className:"absolute right-0 mt-1 w-44 bg-surface-raised border border-surface-border rounded-md shadow-lg z-[100]",children:[e.jsx("button",{onClick:()=>{n("restart"),i(!1)},className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",children:"Restart Workflow"}),t&&e.jsx("button",{onClick:()=>{n("terminate"),i(!1)},className:"block w-full text-left px-4 py-2 text-xs text-status-error hover:bg-surface-hover",children:"Terminate"}),s&&e.jsx(m,{to:`/mcp/queries/${a}?step=3`,className:"block w-full text-left px-4 py-2 text-xs text-accent hover:bg-surface-hover",onClick:()=>i(!1),children:"Compile into Pipeline"}),e.jsx(m,{to:`/mcp/executions/${encodeURIComponent(a)}?namespace=durable`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"View Pipeline Execution"}),e.jsx(m,{to:`/admin/streams?source=worker&jid=${encodeURIComponent(a)}`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"Worker Messages"}),e.jsx(m,{to:`/admin/streams?source=engine&jid=${encodeURIComponent(a)}`,className:"block w-full text-left px-4 py-2 text-xs text-text-secondary hover:bg-surface-hover",onClick:()=>i(!1),children:"Engine Messages"})]})]})}function Ve(){const{workflowId:t}=ce();Q(t);const s="Workflow Execution",{data:a,isLoading:n,error:l,refetch:i,isFetching:u}=B(t),{data:x}=z(t),{data:o}=H(t),{data:p}=Z(t),j=de(),f=F(),{isCollapsed:C,toggle:I}=J("workflow-execution"),[h,P]=w.useState(()=>{try{const r=localStorage.getItem(T);return r&&be.includes(r)?r:"details"}catch{return"details"}}),R=r=>{P(r);try{localStorage.setItem(T,r)}catch{}},W=r=>{var c;if(r==="terminate")confirm("Are you sure you want to terminate this workflow?")&&f.mutate(t);else if(r==="restart"&&a){const O=a.workflow_id.replace(/-[A-Za-z0-9_-]{20,}$/,""),g=a.events.find(U=>U.event_type==="workflow_execution_started"),N=(c=g==null?void 0:g.attributes)==null?void 0:c.input;N&&sessionStorage.setItem("lt:invoke:prefill",JSON.stringify(N)),j(`/workflows/start?type=${encodeURIComponent(O)}&mode=now`)}};if(n)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-60 bg-surface-sunken rounded"})]});if(l||!a){const r=(l==null?void 0:l.message)??"",c=r.includes("expired")||r.includes("no longer available");return e.jsxs("div",{children:[e.jsx(m,{to:"/workflows/executions",className:"text-xs text-text-tertiary hover:text-text-primary",children:"← Workflows"}),e.jsxs("div",{className:"mt-4 text-center py-8",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:c?"Execution data is no longer available":l?"Unable to load execution":"Execution not found"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:c?"This workflow's underlying job has expired. The task record is preserved, but the execution timeline has been cleaned up.":r||"The workflow could not be resolved."})]})]})}const A=a.status!=="completed"&&a.status!=="failed",v=!C("side-panel"),$=a.parent_workflow_id,L=x&&x.workflow_id===a.workflow_id,k=$||(L?x.parent_workflow_id:null)||null,V=k&&k!==a.workflow_id?k:null,D=a.status==="completed"&&a.events.some(r=>{if(r.event_type!=="activity_task_completed")return!1;const c=r.attributes.activity_type;return c==="callDbTool"||c==="callVisionTool"||c==="callMcpTool"||(c==null?void 0:c.startsWith("mcp_"))});return e.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[e.jsxs("div",{className:"shrink-0 pt-8 pr-page-x",children:[e.jsx(G,{title:s,actions:e.jsx("button",{onClick:()=>I("side-panel"),className:"text-accent/60 hover:text-accent transition-colors",title:v?"Hide side panel":"Show side panel",children:v?e.jsx(re,{className:"w-5 h-5",strokeWidth:1.5}):e.jsx(ne,{className:"w-5 h-5",strokeWidth:1.5})})}),f.error&&e.jsxs("p",{className:"text-xs text-status-error py-2",children:["Terminate failed: ",f.error.message]}),e.jsx("div",{className:"mt-2",children:e.jsx(X,{"aria-label":"Execution section",active:h,onChange:R,tabs:[{key:"details",label:"Details",icon:e.jsx(S,{className:"w-3.5 h-3.5"})},{key:"timeline",label:"Execution Timeline",icon:e.jsx(le,{className:"w-3.5 h-3.5"})},{key:"events",label:"Events",icon:e.jsx(oe,{className:"w-3.5 h-3.5"})}]})})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x pt-6 pb-16 animate-page-in",children:[h==="details"&&e.jsx(je,{execution:a}),h==="timeline"&&e.jsx(xe,{events:a.events,childTasks:o==null?void 0:o.tasks,jid:t,appId:"durable"}),h==="events"&&e.jsx(M,{events:a.events,childTasks:o==null?void 0:o.tasks,jid:t,appId:"durable"})]},h)]}),e.jsx(he,{execution:a,parentWorkflowId:V,childTasks:(o==null?void 0:o.tasks)??[],escalations:(p==null?void 0:p.escalations)??[],headerActions:e.jsxs(e.Fragment,{children:[e.jsx(ee,{onRefresh:()=>i(),isFetching:u,apiPath:`/workflow-states/${t}/execution`}),e.jsx(ve,{isRunning:A,hasToolCalls:D,workflowId:t,onAction:W})]}),open:v})]})}export{Ve as WorkflowExecutionPage};
2
- //# sourceMappingURL=WorkflowExecutionPage-CzhoRsis.js.map
@@ -1,2 +0,0 @@
1
- import{a as d,j as t}from"./vendor-query-RUZdMvN6.js";import{E as z}from"./ElapsedCell-RWvrCHn7.js";import{L as A,b as v}from"./index-zqoZDL5j.js";import{u as E,d as L,b as $}from"./workflows-5sds1Ko8.js";import{u as M}from"./useNamespace-BkuU0SeK.js";import{b as I}from"./useEventHooks-onx-Z6IY.js";import{u as U}from"./useFilterParams-crmlBw_l.js";import{b as H}from"./api-path-u2Jf9QXS.js";import{D as O}from"./DataTable-DFPMeqyQ.js";import{W as B}from"./WorkflowPill-CN-952iI.js";import{P as V}from"./PageHeader-CFVw67M6.js";import{F as G,c as f,b as x}from"./FilterBar-D6JDMSHi.js";import{S as J}from"./StickyPagination-B3yiAcrs.js";import{L as q}from"./ListToolbar-DlGreUpP.js";import{R as K,a as k}from"./RowActions-eYrzgQSj.js";import{H as Q,a0 as X}from"./vendor-icons-h-jlRSb9.js";import{u as Y}from"./vendor-react-CdqEC2zv.js";import"./controlplane-DGdaM9f3.js";import"./EmptyState-lpUFYfun.js";const Z={running:"in_progress",completed:"completed",failed:"failed"},ee={in_progress:"bg-status-active",completed:"bg-status-success",failed:"bg-status-error"},te={running:"text-status-active",completed:"text-status-success",failed:"text-status-error"};function se(p,n,m,l,a){return[{key:"workflow_id",label:"Workflow ID",render:e=>{const o=ee[Z[e.status]??e.status]??"bg-status-pending",r=e.status==="running"?" animate-pulse":"";return t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${o}${r}`,title:e.status}),t.jsx("span",{className:"font-mono text-xs text-text-primary truncate",children:e.workflow_id})]})}},{key:"entity",label:"Type",render:e=>t.jsx(B,{type:e.entity,variant:a.get(e.entity)??"durable",size:"xs"}),className:"w-44 shrink-0"},{key:"created_at",label:"Created",render:e=>t.jsx(v,{date:e.created_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}),className:"w-32",sortable:!0},{key:"updated_at",label:"Updated",render:e=>t.jsx(v,{date:e.updated_at,format:"relative",className:"text-xs text-text-secondary whitespace-nowrap"}),className:"w-32",sortable:!0},{key:"duration",label:"Duration",render:e=>t.jsx(z,{startDate:e.created_at,endDate:e.status==="running"?null:e.updated_at,isLive:e.status==="running"}),className:"w-28"},{key:"actions",label:"",render:e=>t.jsxs(K,{children:[t.jsx(k,{icon:Q,title:`Filter by ${e.entity}`,onClick:()=>p(e.entity)}),t.jsx("button",{onClick:o=>{o.stopPropagation(),n(e.status)},className:"opacity-0 group-hover/row:opacity-100 transition-opacity",title:`Filter by ${e.status}`,children:t.jsx("svg",{className:`w-[18px] h-[18px] ${te[e.status]??"text-text-tertiary"} hover:opacity-70`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:t.jsx("circle",{cx:"12",cy:"12",r:"6"})})}),m&&t.jsx(k,{icon:X,title:"View config",onClick:()=>l(`/workflows/registry/${encodeURIComponent(e.entity)}`)})]}),className:"w-24 text-right"}]}function ke({tier:p="all"}){I();const n=Y(),{isSuperAdmin:m}=A(),{namespace:l}=M(),{filters:a,setFilter:e,pagination:o,sort:r,setSort:j}=U({filters:{search:"",entity:"",status:"",tier:p}}),c=a.tier||"all",g=c==="certified"?"true":c==="durable"?"false":void 0,{data:b}=E(),{data:y}=L(),S=d.useMemo(()=>{const s=new Map;for(const w of y??[])s.set(w.workflow_type,w.tier??"durable");return s},[y]),_=se(s=>e("entity",s),s=>e("status",s),m,n,S),[u,C]=d.useState(a.search);d.useEffect(()=>{if(u===a.search)return;const s=setTimeout(()=>e("search",u),300);return()=>clearTimeout(s)},[u,e,a.search]);const{data:i,isLoading:N,refetch:P,isFetching:T}=$({limit:o.pageSize,offset:o.offset,entity:a.entity||void 0,search:a.search||void 0,status:a.status||void 0,sort_by:r.sort_by||"created_at",order:r.order||"desc",registered:g,namespace:l||void 0}),h=(i==null?void 0:i.total)??0,F=(i==null?void 0:i.jobs)??[],D=d.useMemo(()=>[...new Set((b??[]).map(s=>s.workflow_type))].sort(),[b]),R="Workflow Executions",W=c==="certified"?"No certified workflow executions found":c==="durable"?"No durable workflow executions found":"No workflow executions found";return t.jsxs("div",{children:[t.jsx(V,{title:R,docsHash:"#docs:dashboard.md:procedural-executions"}),t.jsxs(G,{actions:t.jsx(q,{onRefresh:()=>P(),isFetching:T,apiPath:H("/workflow-states/jobs",{limit:o.pageSize,offset:o.offset,entity:a.entity||void 0,search:a.search||void 0,status:a.status||void 0,sort_by:r.sort_by||"created_at",order:r.order||"desc",registered:g,namespace:l||void 0})}),children:[t.jsx("input",{type:"text",placeholder:"Search workflow ID...",value:u,onChange:s=>C(s.target.value),className:"input text-2xs py-1 px-2 w-56"}),t.jsx(f,{}),t.jsx(x,{label:"Type",value:a.entity,onChange:s=>e("entity",s),options:D.map(s=>({value:s,label:s}))}),t.jsx(f,{}),t.jsx(x,{label:"Status",value:a.status,onChange:s=>e("status",s),options:[{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}]}),t.jsx(f,{}),t.jsx(x,{label:"Tier",value:a.tier==="all"?"":a.tier,onChange:s=>e("tier",s||"all"),options:[{value:"certified",label:"Certified"},{value:"durable",label:"Durable"}]})]}),t.jsx(O,{columns:_,data:F,keyFn:s=>s.workflow_id,onRowClick:s=>n(`/workflows/executions/${s.workflow_id}`),isLoading:N,emptyMessage:W,sort:r,onSort:j}),t.jsx(J,{page:o.page,totalPages:o.totalPages(h),onPageChange:o.setPage,total:h,pageSize:o.pageSize,onPageSizeChange:o.setPageSize})]})}export{ke as WorkflowsDashboard};
2
- //# sourceMappingURL=WorkflowsDashboard-B_tCYLei.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WorkflowsDashboard-B_tCYLei.js","sources":["../../src/pages/workflows/WorkflowsDashboard.tsx"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Filter, Settings } from 'lucide-react';\nimport { ElapsedCell } from '../../components/common/display/ElapsedCell';\nimport { DateValue } from '../../components/common/display/DateValue';\nimport { useJobs, useWorkflowConfigs, useDiscoveredWorkflows } from '../../api/workflows';\nimport { useAuth } from '../../hooks/useAuth';\nimport { useNamespace } from '../../hooks/useNamespace';\nimport { useWorkflowListEvents } from '../../hooks/useEventHooks';\nimport { useFilterParams } from '../../hooks/useFilterParams';\nimport { buildApiPath } from '../../lib/api-path';\nimport { DataTable, type Column } from '../../components/common/data/DataTable';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterDivider } from '../../components/common/data/FilterBar';\nimport { StickyPagination } from '../../components/common/data/StickyPagination';\nimport { ListToolbar } from '../../components/common/data/ListToolbar';\nimport { RowAction, RowActionGroup } from '../../components/common/layout/RowActions';\nimport type { LTJob, WorkflowTier } from '../../api/types';\n\nexport type ExecutionsTier = 'all' | 'certified' | 'durable';\n\nconst jobStatusMap: Record<string, string> = {\n running: 'in_progress',\n completed: 'completed',\n failed: 'failed',\n};\n\nconst STATUS_DOT: Record<string, string> = {\n in_progress: 'bg-status-active',\n completed: 'bg-status-success',\n failed: 'bg-status-error',\n};\n\nconst STATUS_COLORS: Record<string, string> = {\n running: 'text-status-active',\n completed: 'text-status-success',\n failed: 'text-status-error',\n};\n\nfunction buildColumns(\n onFilterEntity: (entity: string) => void,\n onFilterStatus: (status: string) => void,\n isSuperAdmin: boolean,\n navigate: (path: string) => void,\n tierMap: Map<string, WorkflowTier>,\n): Column<LTJob>[] {\n return [\n {\n key: 'workflow_id',\n label: 'Workflow ID',\n render: (row) => {\n const dotClass = STATUS_DOT[jobStatusMap[row.status] ?? row.status] ?? 'bg-status-pending';\n const pulseClass = row.status === 'running' ? ' animate-pulse' : '';\n return (\n <div className=\"flex items-center gap-2 min-w-0\">\n <span className={`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${dotClass}${pulseClass}`} title={row.status} />\n <span className=\"font-mono text-xs text-text-primary truncate\">{row.workflow_id}</span>\n </div>\n );\n },\n },\n {\n key: 'entity',\n label: 'Type',\n render: (row) => <WorkflowPill type={row.entity} variant={tierMap.get(row.entity) ?? 'durable'} size=\"xs\" />,\n className: 'w-44 shrink-0',\n },\n {\n key: 'created_at',\n label: 'Created',\n render: (row) => <DateValue date={row.created_at} format=\"relative\" className=\"text-xs text-text-secondary whitespace-nowrap\" />,\n className: 'w-32',\n sortable: true,\n },\n {\n key: 'updated_at',\n label: 'Updated',\n render: (row) => <DateValue date={row.updated_at} format=\"relative\" className=\"text-xs text-text-secondary whitespace-nowrap\" />,\n className: 'w-32',\n sortable: true,\n },\n {\n key: 'duration',\n label: 'Duration',\n render: (row) => (\n <ElapsedCell\n startDate={row.created_at}\n endDate={row.status === 'running' ? null : row.updated_at}\n isLive={row.status === 'running'}\n />\n ),\n className: 'w-28',\n },\n {\n key: 'actions',\n label: '',\n render: (row) => (\n <RowActionGroup>\n <RowAction\n icon={Filter}\n title={`Filter by ${row.entity}`}\n onClick={() => onFilterEntity(row.entity)}\n />\n <button\n onClick={(e) => { e.stopPropagation(); onFilterStatus(row.status); }}\n className=\"opacity-0 group-hover/row:opacity-100 transition-opacity\"\n title={`Filter by ${row.status}`}\n >\n <svg className={`w-[18px] h-[18px] ${STATUS_COLORS[row.status] ?? 'text-text-tertiary'} hover:opacity-70`} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.5}>\n <circle cx=\"12\" cy=\"12\" r=\"6\" />\n </svg>\n </button>\n {isSuperAdmin && (\n <RowAction\n icon={Settings}\n title=\"View config\"\n onClick={() => navigate(`/workflows/registry/${encodeURIComponent(row.entity)}`)}\n />\n )}\n </RowActionGroup>\n ),\n className: 'w-24 text-right',\n },\n ];\n}\n\nexport function WorkflowsDashboard({ tier: initialTier = 'all' }: { tier?: ExecutionsTier }) {\n useWorkflowListEvents();\n const navigate = useNavigate();\n const { isSuperAdmin } = useAuth();\n const { namespace } = useNamespace();\n\n const { filters, setFilter, pagination, sort, setSort } = useFilterParams({\n filters: { search: '', entity: '', status: '', tier: initialTier },\n });\n\n const activeTier = (filters.tier || 'all') as ExecutionsTier;\n\n // Map tier to server-side registered filter\n const registeredFilter = activeTier === 'certified' ? 'true'\n : activeTier === 'durable' ? 'false'\n : undefined;\n\n const { data: configs } = useWorkflowConfigs();\n const { data: discoveredData } = useDiscoveredWorkflows();\n\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const dw of discoveredData ?? []) {\n map.set(dw.workflow_type, dw.tier ?? 'durable');\n }\n return map;\n }, [discoveredData]);\n\n const columns = buildColumns(\n (entity) => setFilter('entity', entity),\n (status) => setFilter('status', status),\n isSuperAdmin,\n navigate,\n tierMap,\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 { data: jobsData, isLoading, refetch, isFetching } = useJobs({\n limit: pagination.pageSize,\n offset: pagination.offset,\n entity: filters.entity || undefined,\n search: filters.search || undefined,\n status: filters.status || undefined,\n sort_by: sort.sort_by || 'created_at',\n order: sort.order || 'desc',\n registered: registeredFilter,\n namespace: namespace || undefined,\n });\n\n const total = jobsData?.total ?? 0;\n const jobs = jobsData?.jobs ?? [];\n\n const entities = useMemo(() => {\n return [...new Set((configs ?? []).map((c) => c.workflow_type))].sort();\n }, [configs]);\n\n const pageTitle = 'Workflow Executions';\n\n const emptyMessage = activeTier === 'certified'\n ? 'No certified workflow executions found'\n : activeTier === 'durable'\n ? 'No durable workflow executions found'\n : 'No workflow executions found';\n\n return (\n <div>\n <PageHeader title={pageTitle} docsHash=\"#docs:dashboard.md:procedural-executions\" />\n\n <FilterBar actions={\n <ListToolbar\n onRefresh={() => refetch()}\n isFetching={isFetching}\n apiPath={buildApiPath('/workflow-states/jobs', {\n limit: pagination.pageSize,\n offset: pagination.offset,\n entity: filters.entity || undefined,\n search: filters.search || undefined,\n status: filters.status || undefined,\n sort_by: sort.sort_by || 'created_at',\n order: sort.order || 'desc',\n registered: registeredFilter,\n namespace: namespace || undefined,\n })}\n />\n }>\n <input\n type=\"text\"\n placeholder=\"Search workflow ID...\"\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n className=\"input text-2xs py-1 px-2 w-56\"\n />\n <FilterDivider />\n <FilterSelect\n label=\"Type\"\n value={filters.entity}\n onChange={(v) => setFilter('entity', v)}\n options={entities.map((e) => ({ value: e, label: e }))}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'running', label: 'Running' },\n { value: 'completed', label: 'Completed' },\n { value: 'failed', label: 'Failed' },\n ]}\n />\n <FilterDivider />\n <FilterSelect\n label=\"Tier\"\n value={filters.tier === 'all' ? '' : filters.tier}\n onChange={(v) => setFilter('tier', v || 'all')}\n options={[\n { value: 'certified', label: 'Certified' },\n { value: 'durable', label: 'Durable' },\n ]}\n />\n </FilterBar>\n\n <DataTable\n columns={columns}\n data={jobs}\n keyFn={(row) => row.workflow_id}\n onRowClick={(row) => navigate(`/workflows/executions/${row.workflow_id}`)}\n isLoading={isLoading}\n emptyMessage={emptyMessage}\n sort={sort}\n onSort={setSort}\n />\n\n <StickyPagination\n page={pagination.page}\n totalPages={pagination.totalPages(total)}\n onPageChange={pagination.setPage}\n total={total}\n pageSize={pagination.pageSize}\n onPageSizeChange={pagination.setPageSize}\n />\n </div>\n );\n}\n"],"names":["jobStatusMap","STATUS_DOT","STATUS_COLORS","buildColumns","onFilterEntity","onFilterStatus","isSuperAdmin","navigate","tierMap","row","dotClass","pulseClass","jsxs","jsx","WorkflowPill","DateValue","ElapsedCell","RowActionGroup","RowAction","Filter","e","Settings","WorkflowsDashboard","initialTier","useWorkflowListEvents","useNavigate","useAuth","namespace","useNamespace","filters","setFilter","pagination","sort","setSort","useFilterParams","activeTier","registeredFilter","configs","useWorkflowConfigs","discoveredData","useDiscoveredWorkflows","useMemo","map","dw","columns","entity","status","searchInput","setSearchInput","useState","useEffect","timer","jobsData","isLoading","refetch","isFetching","useJobs","total","jobs","entities","c","pageTitle","emptyMessage","PageHeader","FilterBar","ListToolbar","buildApiPath","FilterDivider","FilterSelect","v","DataTable","StickyPagination"],"mappings":"04BAsBA,MAAMA,EAAuC,CAC3C,QAAS,cACT,UAAW,YACX,OAAQ,QACV,EAEMC,GAAqC,CACzC,YAAa,mBACb,UAAW,oBACX,OAAQ,iBACV,EAEMC,GAAwC,CAC5C,QAAS,qBACT,UAAW,sBACX,OAAQ,mBACV,EAEA,SAASC,GACPC,EACAC,EACAC,EACAC,EACAC,EACiB,CACjB,MAAO,CACL,CACE,IAAK,cACL,MAAO,cACP,OAASC,GAAQ,CACf,MAAMC,EAAWT,GAAWD,EAAaS,EAAI,MAAM,GAAKA,EAAI,MAAM,GAAK,oBACjEE,EAAaF,EAAI,SAAW,UAAY,iBAAmB,GACjE,OACEG,EAAAA,KAAC,MAAA,CAAI,UAAU,kCACb,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAK,UAAW,8CAA8CH,CAAQ,GAAGC,CAAU,GAAI,MAAOF,EAAI,MAAA,CAAQ,EAC3GI,EAAAA,IAAC,OAAA,CAAK,UAAU,+CAAgD,WAAI,WAAA,CAAY,CAAA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useEventHooks-onx-Z6IY.js";import{P as D}from"./PageHeader-CFVw67M6.js";import{S as h}from"./StatCard-BXQ8dD9Y.js";import{u as w}from"./vendor-react-CdqEC2zv.js";import"./index-zqoZDL5j.js";import"./vendor-icons-h-jlRSb9.js";const v=[{label:"1h",ms:36e5},{label:"24h",ms:864e5},{label:"7d",ms:6048e5},{label:"30d",ms:2592e6}];function T(r){return r<1e3?`${Math.round(r)}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:r<36e5?`${(r/6e4).toFixed(1)}m`:`${(r/36e5).toFixed(1)}h`}function p({value:r,colorClass:o,onClick:f}){return r===0?t.jsx("span",{className:"text-text-tertiary",children:"0"}):t.jsx("button",{onClick:f,className:`${o} hover:underline tabular-nums font-medium`,children:r})}function _(){$();const r=w(),[o,f]=x.useState("24h"),{data:c}=C({limit:500}),{data:g}=k(),b=x.useMemo(()=>{const e=v.find(i=>i.label===o);return Date.now()-e.ms},[o]),n=x.useMemo(()=>((c==null?void 0:c.jobs)??[]).filter(e=>new Date(e.created_at).getTime()>=b),[c==null?void 0:c.jobs,b]),j=x.useMemo(()=>{const e=new Map;for(const a of n){const s=e.get(a.entity)??{total:0,running:0,completed:0,failed:0,durations:[]};if(s.total++,a.status==="running"&&s.running++,a.status==="completed"){s.completed++;const m=new Date(a.updated_at).getTime()-new Date(a.created_at).getTime();m>0&&s.durations.push(m)}a.status==="failed"&&s.failed++,e.set(a.entity,s)}const i=[];for(const[a,s]of e)i.push({type:a,...s,avgDuration:s.durations.length>0?s.durations.reduce((m,N)=>m+N,0)/s.durations.length:null});return i.sort((a,s)=>s.total-a.total)},[n]),u=x.useMemo(()=>({total:n.length,running:n.filter(e=>e.status==="running").length,completed:n.filter(e=>e.status==="completed").length,failed:n.filter(e=>e.status==="failed").length}),[n]),y=(g==null?void 0:g.length)??0,l=(e,i)=>{const a=new URLSearchParams;e&&a.set("entity",e),i&&a.set("status",i);const s=a.toString();r(`/workflows/executions${s?`?${s}`:""}`)},d="pb-2 text-2xs font-semibold uppercase tracking-widest text-text-tertiary";return t.jsxs("div",{children:[t.jsx(D,{title:"Workflows",actions:t.jsxs("span",{className:"text-xs text-text-tertiary",children:[y," certified type",y!==1?"s":""]})}),t.jsx("div",{className:"flex items-center gap-1 mb-6",children:v.map(e=>t.jsx("button",{onClick:()=>f(e.label),className:`px-3 py-1 text-xs rounded-full transition-colors ${o===e.label?"bg-accent text-text-inverse":"text-text-tertiary hover:text-text-primary hover:bg-surface-hover"}`,children:e.label},e.label))}),t.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-8",children:[t.jsx(h,{label:"Total",value:u.total,onClick:()=>l()}),t.jsx(h,{label:"Running",value:u.running,colorClass:"text-status-active",onClick:()=>l(void 0,"running")}),t.jsx(h,{label:"Completed",value:u.completed,colorClass:"text-status-success",onClick:()=>l(void 0,"completed")}),t.jsx(h,{label:"Failed",value:u.failed,colorClass:"text-status-error",onClick:()=>l(void 0,"failed")})]}),j.length>0&&t.jsxs("table",{className:"w-full text-left",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-surface-border",children:[t.jsx("th",{className:d,children:"Type"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Total"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Running"}),t.jsx("th",{className:`${d} text-right w-24`,children:"Completed"}),t.jsx("th",{className:`${d} text-right w-20`,children:"Failed"}),t.jsx("th",{className:`${d} text-right w-28`,children:"Avg Duration"})]})}),t.jsx("tbody",{children:j.map(e=>t.jsxs("tr",{className:"border-b border-surface-border last:border-b-0",children:[t.jsx("td",{className:"py-3 text-sm font-mono text-text-primary",children:t.jsx("button",{onClick:()=>l(e.type),className:"hover:text-accent hover:underline",children:e.type})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.total,colorClass:"text-text-secondary",onClick:()=>l(e.type)})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.running,colorClass:"text-status-active",onClick:()=>l(e.type,"running")})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.completed,colorClass:"text-status-success",onClick:()=>l(e.type,"completed")})}),t.jsx("td",{className:"py-3 text-sm text-right",children:t.jsx(p,{value:e.failed,colorClass:"text-status-error",onClick:()=>l(e.type,"failed")})}),t.jsx("td",{className:"py-3 text-sm font-mono text-text-secondary text-right",children:e.avgDuration!==null?T(e.avgDuration):"—"})]},e.type))})]}),j.length===0&&t.jsx("div",{className:"py-16 text-center",children:t.jsxs("p",{className:"text-sm text-text-tertiary",children:["No workflow activity in the last ",o]})})]})}export{_ as WorkflowsOverview};
2
- //# sourceMappingURL=WorkflowsOverview-B4Bh8MIo.js.map
@@ -1,2 +0,0 @@
1
- import{u as i}from"./vendor-query-RUZdMvN6.js";import{g as e}from"./index-zqoZDL5j.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
2
- //# sourceMappingURL=capabilities-B2Dem6zw.js.map
@@ -1,2 +0,0 @@
1
- import{a as w,j as e}from"./vendor-query-RUZdMvN6.js";import{W as k,X as C,Y as E,m as b}from"./index-zqoZDL5j.js";import{s as P,aq as S,ar as T,as as y,ai as $,aj as L,at as O}from"./vendor-icons-h-jlRSb9.js";import{E as _}from"./EntityTimelinePanel-CNaYs3nA.js";import{F,b as f,c as v,a as R}from"./FilterBar-D6JDMSHi.js";import{P as W}from"./PriorityBadge-BETdj4M-.js";import{R as A}from"./RolePill-Di_5hfvw.js";import{W as I}from"./WorkflowPill-CN-952iI.js";import{C as q,a as B,i as K}from"./CountdownTimer-BFy9Joxb.js";import{L as g}from"./vendor-react-CdqEC2zv.js";function ae({role:t,options:s,onChange:d,emptyLabel:x="All Escalations",locked:p=!1}){var a;const[i,n]=w.useState(!1),o=w.useRef(null);w.useEffect(()=>{if(!i)return;const l=h=>{o.current&&!o.current.contains(h.target)&&n(!1)},u=h=>{h.key==="Escape"&&n(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u)}},[i]);const m=t?((a=s.find(l=>l.value===t))==null?void 0:a.label)??k(t):x,r=l=>`w-full text-left px-3 py-1.5 text-sm flex items-baseline gap-2 transition-colors ${l?"text-accent bg-accent/5":"text-text-primary hover:bg-surface-hover"}`;return p?e.jsx("h1",{className:"heading-1 min-w-0 truncate","data-testid":"escalation-title-locked",children:m}):e.jsxs("div",{ref:o,className:"relative min-w-0",children:[e.jsxs("button",{type:"button",onClick:()=>n(l=>!l),className:"group flex items-center gap-2 min-w-0 heading-1 hover:text-accent transition-colors",children:[e.jsx("span",{className:"truncate",children:m}),e.jsx(P,{className:`w-6 h-6 shrink-0 text-text-tertiary group-hover:text-accent transition-transform ${i?"rotate-180":""}`,strokeWidth:1.5})]}),i&&e.jsxs("div",{className:"absolute z-[100] top-full left-0 mt-2 min-w-[16rem] max-h-80 overflow-y-auto bg-surface-raised border border-surface-border rounded-md shadow-lg py-1",children:[e.jsx("button",{type:"button",onClick:()=>{d(""),n(!1)},className:r(!t),children:x}),s.length>0&&e.jsx("div",{className:"h-px bg-surface-border my-1"}),s.map(l=>e.jsxs("button",{type:"button",onClick:()=>{d(l.value),n(!1)},className:r(t===l.value),children:[e.jsx("span",{className:"truncate",children:l.label}),l.label!==l.value&&e.jsx("span",{className:"text-2xs font-mono text-text-quaternary shrink-0",children:l.value})]},l.value))]})]})}const j="text-text-secondary transition-colors group-hover/row:text-text-primary";function M({row:t}){if(B(t)){const s=t.status==="resolved"?"text-status-success":"text-text-tertiary";return e.jsx(T,{className:`w-3 h-3 shrink-0 ${s}`})}return t.status==="resolved"?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-success",strokeWidth:2.5}):t.status==="cancelled"?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-error",strokeWidth:2.5}):K(t)?e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-warning",strokeWidth:2.5}):e.jsx(y,{className:"w-2.5 h-2.5 shrink-0 text-status-active",strokeWidth:2.5})}function D({metadata:t,role:s,highlightKeys:d}){const[x,p]=w.useState(!1),i=E();if(!t||Object.keys(t).length===0)return e.jsx("span",{className:"text-2xs text-text-tertiary",children:"—"});const n=d??[],o=[...n.filter(a=>a in t),...Object.keys(t).filter(a=>!n.includes(a))],m=x?o:o.slice(0,1),r=o.length-1;return e.jsx("div",{className:"w-full",onClick:a=>a.stopPropagation(),children:e.jsx("div",{className:"space-y-px",children:m.map((a,l)=>{const u=typeof t[a]=="object"&&t[a]!==null?JSON.stringify(t[a]):String(t[a]),h=n.includes(a),N=l===m.length-1;return e.jsxs("div",{className:"group/mrow flex items-center gap-1 min-w-0",children:[e.jsx("span",{className:`shrink-0 w-14 text-2xs font-mono uppercase tracking-wide truncate ${h?"text-accent":"text-text-tertiary"}`,title:a,children:a}),e.jsx("span",{className:`flex-1 min-w-0 text-2xs font-medium truncate ${h?"text-text-primary":"text-text-secondary"}`,title:u,children:u}),e.jsxs("span",{className:"flex items-center gap-px shrink-0 opacity-50 group-hover/mrow:opacity-100 transition-opacity",children:[e.jsx(g,{to:b(a,t[a],s),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Filter ${s}: ${a} = ${u}`,onClick:c=>c.stopPropagation(),children:e.jsx($,{className:"w-3 h-3"})}),e.jsx(g,{to:b(a,t[a]),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Search all: ${a} = ${u}`,onClick:c=>c.stopPropagation(),children:e.jsx(L,{className:"w-3 h-3"})}),i&&typeof t[a]=="string"&&e.jsx("button",{className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Timeline: every station ${u} has moved through`,onClick:c=>{c.stopPropagation(),i.setPanel(e.jsx(_,{facetKey:a,value:t[a],role:s}),{key:"entity-timeline",width:420})},children:e.jsx(O,{className:"w-3 h-3"})})]}),!x&&r>0&&e.jsxs("button",{onClick:c=>{c.stopPropagation(),p(!0)},className:"shrink-0 text-2xs text-text-quaternary hover:text-accent transition-colors font-mono",title:`Show ${r} more fields`,children:["+",r]}),x&&N&&r>0&&e.jsx("button",{onClick:c=>{c.stopPropagation(),p(!1)},className:"shrink-0 text-2xs text-text-quaternary hover:text-accent transition-colors",title:"Show less",children:"↑"})]},a)})})})}function U(t={}){return[{key:"description",label:"Summary",priority:1,render:s=>e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx("span",{className:"shrink-0",children:e.jsx(M,{row:s})}),e.jsx("span",{className:`truncate text-xs ${j}`,children:s.description||s.type})]}),className:"max-w-0"},{key:"role",label:"Role",priority:2,render:s=>e.jsx("span",{className:j,children:e.jsx(A,{role:s.role,size:"md",tone:"inherit"})}),className:"w-44 min-w-[11rem]"},{key:"priority",label:"Pri",priority:2,render:s=>e.jsx("span",{className:j,children:e.jsx(W,{priority:s.priority,size:"sm",tone:"inherit"})}),className:"w-10"},{key:"workflow_type",label:"Workflow",priority:2,showFrom:"split",render:s=>e.jsx(I,{type:s.workflow_type||s.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",priority:2,showFrom:"wall",render:s=>e.jsx(D,{metadata:s.metadata,role:s.role,highlightKeys:t.highlightKeys}),className:"w-80 max-w-[19rem] align-top"},{key:"created_at",label:"Ago",priority:1,render:s=>e.jsx("span",{className:`text-xs tabular-nums ${j}`,title:s.created_at,children:C(s.created_at)}),className:"w-14 whitespace-nowrap"}]}const re=U(),le={key:"expires",label:e.jsx(S,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:t=>t.assigned_until?e.jsx(q,{until:t.assigned_until}):e.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap",priority:1},z=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],H=[{value:"all",label:"All"},{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}];function ne({filters:t,setFilter:s,roles:d,types:x,showStatus:p=!1,showSearch:i=!0,showRole:n=!0,actions:o}){const m=[t.role,t.type,t.priority,t.status&&t.status!=="all"?t.status:"",t.search??""].filter(Boolean).length;return e.jsxs(F,{actions:o,activeFilterCount:m,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Status",value:t.status??"",onChange:r=>s("status",r),options:H}),e.jsx(v,{})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx(f,{label:"Role",value:t.role,onChange:r=>s("role",r),options:d.map(r=>({value:r,label:r}))}),e.jsx(v,{})]}),e.jsx(f,{label:"Priority",value:t.priority,onChange:r=>s("priority",r),options:z}),e.jsx(v,{}),e.jsx(f,{label:"Workflow Type",value:t.type,onChange:r=>s("type",r),options:x.map(r=>({value:r,label:r}))}),i&&e.jsxs(e.Fragment,{children:[e.jsx(v,{}),e.jsx(R,{label:"Search",value:t.search??"",onChange:r=>s("search",r),placeholder:"ID, workflow, origin…"})]})]})}export{ae as E,le as T,ne as a,re as b,U as m};
2
- //# sourceMappingURL=escalation-columns-BM7vp-hY.js.map
@@ -1,2 +0,0 @@
1
- import{a as p,j as e}from"./vendor-query-RUZdMvN6.js";import{H as B,b as T,v as D}from"./index-zqoZDL5j.js";import{b as q,c as H,d as V,e as J,f as W,a as Q}from"./users-B_9mC6D_.js";import{u as E}from"./useFilterParams-crmlBw_l.js";import{D as I}from"./DataTable-DFPMeqyQ.js";import{S as F}from"./StickyPagination-B3yiAcrs.js";import{F as K,a as M,b as $}from"./FilterBar-D6JDMSHi.js";import{C as R}from"./ConfirmDeleteModal-CQsJUzEa.js";import{R as z,a as k}from"./RowActions-eYrzgQSj.js";import{P as O}from"./PageHeader-CFVw67M6.js";import{R as S}from"./RolePill-Di_5hfvw.js";import{M as C}from"./Modal-BU7No9NH.js";import{u as X,a as Y,b as Z,c as ee,d as se,e as te,f as ae,g as le,h as ne}from"./bots-pSLFdOm-.js";import{T as ie}from"./TimeAgo-BpJ7In27.js";import{a8 as re,a9 as ce,aM as oe,T as A,f as de,a7 as L,D as G,U as xe,e as me}from"./vendor-icons-h-jlRSb9.js";import{u as ue,a as pe,b as he,c as je}from"./personas-Dy_XSYfJ.js";import{S as ge}from"./ScopeBadge-CqIIeWjK.js";import{L as ve,f as ye}from"./vendor-react-CdqEC2zv.js";import{S as fe}from"./SegmentedTabs-DXNzY05q.js";import"./EmptyState-lpUFYfun.js";function be({open:l,onClose:r}){const s=q(),[a,i]=p.useState({external_id:"",email:"",display_name:"",password:""}),[x,h]=p.useState(l);l!==x&&(h(l),l&&i({external_id:"",email:"",display_name:"",password:""}));const j=()=>{a.external_id.trim()&&s.mutate({external_id:a.external_id.trim(),email:a.email.trim()||void 0,display_name:a.display_name.trim()||void 0,password:a.password||void 0},{onSuccess:r})},m=(t,u)=>i(d=>({...d,[t]:u}));return e.jsx(C,{open:l,onClose:r,title:"Create User",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"External ID (required)"}),e.jsx("input",{type:"text",value:a.external_id,onChange:t=>m("external_id",t.target.value),placeholder:"e.g., john.doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:a.display_name,onChange:t=>m("display_name",t.target.value),placeholder:"John Doe",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:a.email,onChange:t=>m("email",t.target.value),placeholder:"john@example.com",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Password"}),e.jsx("input",{type:"password",value:a.password,onChange:t=>m("password",t.target.value),placeholder:"Leave blank for no password",className:"input text-xs w-full"})]}),s.error&&e.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:j,disabled:!a.external_id.trim()||s.isPending,className:"btn-primary text-xs",children:s.isPending?"Creating...":"Create"})]})]})})}function Ne({open:l,onClose:r,user:s}){const a=H(),[i,x]=p.useState({display_name:"",email:"",status:"active"}),[h,j]=p.useState(s);s!==h&&(j(s),s&&x({display_name:s.display_name??"",email:s.email??"",status:s.status}));const m=()=>{s&&a.mutate({id:s.id,display_name:i.display_name.trim()||void 0,email:i.email.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(C,{open:l,onClose:r,title:`Edit — ${(s==null?void 0:s.display_name)||(s==null?void 0:s.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:t=>x(u=>({...u,display_name:t.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Email"}),e.jsx("input",{type:"text",value:i.email,onChange:t=>x(u=>({...u,email:t.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:t=>x(u=>({...u,status:t.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),a.error&&e.jsx("p",{className:"text-xs text-status-error",children:a.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:a.isPending,className:"btn-primary text-xs",children:a.isPending?"Saving...":"Save"})]})]})})}function we({open:l,onClose:r}){const s=X(),[a,i]=p.useState({name:"",display_name:"",description:""}),[x,h]=p.useState(l);l!==x&&(h(l),l&&i({name:"",display_name:"",description:""}));const j=()=>{a.name.trim()&&s.mutate({name:a.name.trim(),display_name:a.display_name.trim()||void 0,description:a.description.trim()||void 0},{onSuccess:r})},m=(t,u)=>i(d=>({...d,[t]:u}));return e.jsx(C,{open:l,onClose:r,title:"Create Service Account",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Name (required)"}),e.jsx("input",{type:"text",value:a.name,onChange:t=>m("name",t.target.value.replace(/\s+/g,"-").toLowerCase()),placeholder:"e.g., ci-bot",className:"input text-xs w-full font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:a.display_name,onChange:t=>m("display_name",t.target.value),placeholder:"CI Bot",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:a.description,onChange:t=>m("description",t.target.value),placeholder:"Runs scheduled workflows",className:"input text-xs w-full"})]}),s.error&&e.jsx("p",{className:"text-xs text-status-error",children:s.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:j,disabled:!a.name.trim()||s.isPending,className:"btn-primary text-xs",children:s.isPending?"Creating...":"Create"})]})]})})}function ke({open:l,onClose:r,bot:s}){const a=Y(),[i,x]=p.useState({display_name:"",description:"",status:"active"}),[h,j]=p.useState(s);s!==h&&(j(s),s&&x({display_name:s.display_name??"",description:s.description??"",status:s.status}));const m=()=>{s&&a.mutate({id:s.id,display_name:i.display_name.trim()||void 0,description:i.description.trim()||void 0,status:i.status},{onSuccess:r})};return e.jsx(C,{open:l,onClose:r,title:`Edit — ${(s==null?void 0:s.display_name)||(s==null?void 0:s.external_id)||""}`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Display Name"}),e.jsx("input",{type:"text",value:i.display_name,onChange:t=>x(u=>({...u,display_name:t.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Description"}),e.jsx("input",{type:"text",value:i.description,onChange:t=>x(u=>({...u,description:t.target.value})),className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsxs("select",{value:i.status,onChange:t=>x(u=>({...u,status:t.target.value})),className:"select text-xs w-full",children:[e.jsx("option",{value:"active",children:"Active"}),e.jsx("option",{value:"inactive",children:"Inactive"}),e.jsx("option",{value:"suspended",children:"Suspended"})]})]}),a.error&&e.jsx("p",{className:"text-xs text-status-error",children:a.error.message}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:r,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,disabled:a.isPending,className:"btn-primary text-xs",children:a.isPending?"Saving...":"Save"})]})]})})}function Se({botId:l}){const{data:r}=Z(l),s=ee(),a=se(),[i,x]=p.useState(""),[h,j]=p.useState("read"),[m,t]=p.useState(null),[u,d]=p.useState(!1),[g,o]=p.useState(null),f=(r==null?void 0:r.keys)??[],c={read:{label:"Read only",scopes:["mcp:read"],hint:"Discovery and monitoring — read-safe tools only"},full:{label:"Full access",scopes:["mcp:read","mcp:full"],hint:"All tools — can modify state"}},y=()=>{i.trim()&&s.mutate({botId:l,name:i.trim(),scopes:c[h].scopes},{onSuccess:v=>{t(v.rawKey),x("")}})},b=()=>{m&&(navigator.clipboard.writeText(m),d(!0),setTimeout(()=>d(!1),2e3))},N=()=>{g&&a.mutate({botId:l,keyId:g.id},{onSuccess:()=>o(null)})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"API Keys"}),m&&e.jsxs("div",{className:"mb-3 p-3 bg-status-success/10 border border-status-success/30 rounded-md",children:[e.jsx("p",{className:"text-2xs font-semibold text-status-success mb-1",children:"Key generated — copy now, it won't be shown again"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-2xs font-mono text-text-primary bg-surface-sunken px-2 py-1 rounded flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:m}),e.jsx("button",{onClick:b,className:"text-text-tertiary hover:text-text-primary shrink-0",title:"Copy to clipboard",children:u?e.jsx(re,{className:"w-3.5 h-3.5 text-status-success"}):e.jsx(ce,{className:"w-3.5 h-3.5"})})]})]}),f.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No API keys."}):e.jsx("div",{className:"space-y-1.5 mb-3",children:f.map(v=>e.jsxs("div",{className:"group/key flex items-center justify-between px-2.5 py-1.5 bg-surface-sunken rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(oe,{className:"w-3 h-3 text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-mono",children:v.name}),(v.scopes??[]).map(n=>e.jsx("span",{className:`px-1.5 py-0.5 rounded text-2xs font-mono ${n.includes("full")?"bg-status-warning/15 text-status-warning":"bg-accent/10 text-accent"}`,children:n},n)),v.last_used_at&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["used ",e.jsx(ie,{date:v.last_used_at})]})]}),e.jsx("button",{onClick:()=>o(v),className:"opacity-0 group-hover/key:opacity-100 transition-opacity text-text-tertiary hover:text-status-error",title:"Revoke key",children:e.jsx(A,{className:"w-3 h-3"})})]},v.id))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:i,onChange:v=>x(v.target.value),placeholder:"Key name...",className:"input text-xs font-mono"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex rounded-md border border-surface-border overflow-hidden shrink-0",children:Object.entries(c).map(([v,n])=>e.jsx("button",{type:"button",onClick:()=>j(v),title:n.hint,className:`px-2.5 py-1 text-2xs font-medium transition-colors ${h===v?"bg-accent text-text-inverse":"bg-surface text-text-secondary hover:bg-surface-hover"}`,children:n.label},v))}),e.jsxs("button",{onClick:y,disabled:!i.trim()||s.isPending,className:"btn-primary text-xs inline-flex items-center gap-1 shrink-0",children:[e.jsx(de,{className:"w-3 h-3"}),s.isPending?"...":"Generate"]})]})]}),s.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:s.error.message}),e.jsx(R,{open:!!g,onClose:()=>o(null),onConfirm:N,title:"Revoke API Key",description:e.jsxs(e.Fragment,{children:["Revoke API key"," ",e.jsx("span",{className:"font-medium text-text-primary font-mono",children:g==null?void 0:g.name}),"? This bot will no longer be able to authenticate with this key."]}),isPending:a.isPending,error:a.error})]})}function Ce({bot:l}){const{data:r}=B(),s=te(),a=ae(),[i,x]=p.useState(""),[h,j]=p.useState("member"),m=(r==null?void 0:r.roles)??[],t=l.roles??[],u=p.useMemo(()=>{const o=new Set(t.map(f=>f.role));return m.filter(f=>!o.has(f))},[m,t]),d=()=>{i.trim()&&s.mutate({botId:l.id,role:i.trim(),type:h},{onSuccess:()=>{x(""),j("member")}})},g=o=>{a.mutate({botId:l.id,role:o})};return e.jsxs("div",{children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:"Roles"}),t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary mb-3",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:t.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(S,{role:o.role}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:o.type}),e.jsx("button",{onClick:()=>g(o.role),className:"text-text-tertiary hover:text-status-error transition-colors ml-0.5",title:`Remove ${o.role}`,children:"×"})]},o.role))}),u.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:i,onChange:o=>x(o.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),u.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 items-end",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:h,onChange:o=>j(o.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:d,disabled:!i||s.isPending,className:"btn-primary text-xs",children:s.isPending?"...":"Add Role"})})]})]}),s.error&&e.jsx("p",{className:"text-2xs text-status-error mt-1",children:s.error.message})]})}function _e({bot:l}){return l?e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px] space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary",children:l.display_name||l.external_id}),l.description&&e.jsx("p",{className:"text-xs text-text-tertiary mt-0.5",children:l.description})]}),e.jsx(Se,{botId:l.id}),e.jsx(Ce,{bot:l})]}):e.jsx("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a service account to manage its API keys and roles."})})}const Pe={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"},Re=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}];function Ae({embedded:l=!1}){const{filters:r,setFilter:s,pagination:a}=E({filters:{status:"",search:""}}),i=le(),[x,h]=p.useState(!1),[j,m]=p.useState(null),[t,u]=p.useState(null),[d,g]=p.useState(null),{data:o,isLoading:f}=ne({status:r.status||void 0,search:r.search||void 0,limit:a.pageSize,offset:a.offset}),c=(o==null?void 0:o.total)??0,y=(o==null?void 0:o.bots)??[],b=p.useMemo(()=>t?y.find(n=>n.id===t.id)??t:null,[y,t]),N=[{key:"display_name",label:"Service Account",render:n=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${Pe[n.status]??"bg-status-pending"}`,title:n.status}),e.jsx("span",{className:"text-sm text-text-primary whitespace-nowrap",children:n.display_name||n.external_id})]})},{key:"description",label:"Description",render:n=>e.jsx("span",{className:"block max-w-[32rem] truncate text-xs text-text-tertiary",title:n.description??void 0,children:n.description??""})},{key:"roles",label:"Roles",render:n=>e.jsx("div",{className:"flex gap-1 flex-wrap",children:(n.roles??[]).map(w=>e.jsx(S,{role:w.role},w.role))})},{key:"created_at",label:"Created",render:n=>e.jsx(T,{date:n.created_at}),className:"w-36 whitespace-nowrap"},{key:"actions",label:"",render:n=>e.jsxs(z,{children:[e.jsx(k,{icon:L,title:"Edit service account",onClick:()=>m(n)}),e.jsx(k,{icon:A,title:"Delete service account",onClick:()=>g(n),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}],v=()=>{d&&i.mutate(d.id,{onSuccess:()=>{g(null),(t==null?void 0:t.id)===d.id&&u(null)}})};return e.jsxs("div",{children:[l?e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>h(!0),className:"btn-primary text-xs",children:"Add Service Account"})}):e.jsx(O,{title:"Service Accounts",actions:e.jsx("button",{onClick:()=>h(!0),className:"btn-primary text-xs",children:"Add Service Account"})}),e.jsxs(K,{children:[e.jsx(M,{label:"Search",value:r.search,onChange:n=>s("search",n),placeholder:"name, id, description…"}),e.jsx($,{label:"Status",value:r.status,onChange:n=>s("status",n),options:Re})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(I,{columns:N,data:y,keyFn:n=>n.id,isLoading:f,emptyMessage:"No service accounts yet",onRowClick:n=>u(n),activeRowKey:(b==null?void 0:b.id)??null}),e.jsx(F,{page:a.page,totalPages:a.totalPages(c),onPageChange:a.setPage,total:c,pageSize:a.pageSize,onPageSizeChange:a.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(_e,{bot:b})})]}),e.jsx(we,{open:x,onClose:()=>h(!1)}),e.jsx(ke,{open:!!j,onClose:()=>m(null),bot:j}),e.jsx(R,{open:!!d,onClose:()=>g(null),onConfirm:v,title:"Delete Service Account",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(d==null?void 0:d.display_name)||(d==null?void 0:d.external_id)}),"? This will also revoke all API keys. This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}const P=[{value:"all|all",label:"See all · act on all",read_scope:"all",write_scope:"all"},{value:"all|self",label:"See all · act on self",read_scope:"all",write_scope:"self"},{value:"self|self",label:"See self · act on self",read_scope:"self",write_scope:"self"},{value:"all|none",label:"See all · read-only",read_scope:"all",write_scope:"none"},{value:"self|none",label:"See self · read-only",read_scope:"self",write_scope:"none"}],_="all|all";function U(l){return P.find(r=>r.value===l)??P[0]}function Ue({user:l}){const{data:r}=ue(),{data:s}=pe(l.id),a=he(),i=je(),[x,h]=p.useState(""),j=(s==null?void 0:s.personas)??[],m=p.useMemo(()=>{const t=new Set(j.map(u=>u.key));return((r==null?void 0:r.personas)??[]).filter(u=>!t.has(u.key))},[r,j]);return j.length===0&&m.length===0?null:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Personas"}),j.length>0&&e.jsx("div",{className:"flex flex-col gap-2",children:j.map(t=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx(G,{className:"w-3 h-3 shrink-0 text-text-tertiary","aria-hidden":!0}),e.jsx(ve,{to:`/admin/personas/${encodeURIComponent(t.key)}`,className:"flex-1 min-w-0 truncate transition-colors hover:text-accent",title:t.key,children:t.title||t.key}),e.jsxs("span",{className:"shrink-0 text-2xs text-text-tertiary tabular-nums",children:[t.roles.length," role",t.roles.length===1?"":"s"]}),e.jsx("button",{onClick:()=>i.mutate({userId:l.id,key:t.key}),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Unassign ${t.title||t.key}`,children:"×"})]},t.key))}),m.length>0&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:x,onChange:t=>h(t.target.value),className:"select text-xs w-full min-w-0","aria-label":"Persona",children:[e.jsx("option",{value:"",children:"Assign a persona..."}),m.map(t=>e.jsx("option",{value:t.key,children:t.title||t.key},t.key))]}),e.jsx("button",{onClick:()=>{x&&a.mutate({userId:l.id,key:x},{onSuccess:()=>h("")})},disabled:!x||a.isPending,className:"btn-primary text-xs shrink-0",children:a.isPending?"...":"Assign"})]}),(a.error||i.error)&&e.jsx("p",{className:"text-2xs text-status-error",children:(a.error||i.error).message})]})}function Be({user:l}){const{data:r}=B(),s=V(),a=J(),[i,x]=p.useState(""),[h,j]=p.useState("member"),[m,t]=p.useState(_),u=(r==null?void 0:r.roles)??[],d=(l==null?void 0:l.roles)??[],g=p.useMemo(()=>{const c=new Set(d.map(y=>y.role));return u.filter(y=>!c.has(y))},[u,d]),o=()=>{if(!l||!i.trim())return;const c=U(h==="member"?m:_);s.mutate({userId:l.id,role:i.trim(),type:h,read_scope:c.read_scope,write_scope:c.write_scope},{onSuccess:()=>{x(""),j("member"),t(_)}})},f=c=>{l&&a.mutate({userId:l.id,role:c})};return e.jsxs("div",{className:"border-l border-surface-border pl-6 pt-4 min-h-[300px]",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-4",children:"Role Membership"}),l?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-text-primary",children:l.display_name||l.external_id})}),e.jsx(Ue,{user:l}),e.jsx("p",{className:"text-2xs text-text-tertiary",children:"Member of:"}),d.length===0?e.jsx("p",{className:"text-xs text-text-tertiary",children:"No roles assigned."}):e.jsx("div",{className:"flex flex-col gap-2",children:d.map(c=>e.jsxs("span",{className:"flex items-center gap-2.5 w-full min-w-0 pl-2.5 pr-2 py-1 text-xs bg-surface-sunken rounded-full text-text-secondary",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate",title:c.role,children:e.jsx(S,{role:c.role,tone:"inherit"})}),e.jsx("span",{className:"w-14 shrink-0 text-2xs uppercase tracking-wide text-text-tertiary",children:c.type}),c.type==="member"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-px h-3 bg-surface-border shrink-0","aria-hidden":!0}),e.jsx(ge,{read:c.read_scope,write:c.write_scope,className:"shrink-0"})]}),c.granted_by_persona&&e.jsx("span",{className:"shrink-0",title:`Granted by persona ${c.granted_by_persona}`,children:e.jsx(G,{className:"w-3 h-3 text-text-tertiary","aria-hidden":!0})}),e.jsx("button",{onClick:()=>f(c.role),className:"shrink-0 text-text-tertiary hover:text-status-error transition-colors ml-1",title:`Remove ${c.role}`,children:"×"})]},c.role))}),g.length>0&&e.jsxs("div",{className:"pt-3 border-t border-surface-border space-y-2",children:[e.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:"Add Role"}),e.jsxs("select",{value:i,onChange:c=>x(c.target.value),className:"select text-xs font-mono w-full min-w-0","aria-label":"Role",children:[e.jsx("option",{value:"",children:"Select a role..."}),g.map(c=>e.jsx("option",{value:c,children:c},c))]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Type"}),e.jsxs("select",{value:h,onChange:c=>j(c.target.value),className:"select text-xs w-full min-w-0","aria-label":"Role type",children:[e.jsx("option",{value:"member",children:"member"}),e.jsx("option",{value:"admin",children:"admin"}),e.jsx("option",{value:"superadmin",children:"superadmin"})]})]}),h==="member"&&e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{className:"block text-2xs text-text-tertiary mb-1",children:"Scope"}),e.jsx("select",{value:m,onChange:c=>t(c.target.value),className:"select text-xs w-full min-w-0","aria-label":"Work-surface scope",children:P.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))})]})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{onClick:o,disabled:!i||s.isPending,className:"btn-primary text-xs",children:s.isPending?"...":"Add Role"})}),s.error&&e.jsx("p",{className:"text-2xs text-status-error",children:s.error.message})]})]}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Select a user to manage their roles."})]})}function Te({active:l,onChange:r}){return e.jsx(fe,{"aria-label":"Account kind",active:l,onChange:r,tabs:[{key:"users",label:"User Accounts",icon:e.jsx(xe,{className:"w-3.5 h-3.5"})},{key:"service-accounts",label:"Service Accounts",icon:e.jsx(me,{className:"w-3.5 h-3.5"})}]})}const De=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"suspended",label:"Suspended"}],Ee={active:"bg-status-success",inactive:"bg-text-tertiary",suspended:"bg-status-error"};function as(){const{isBuilder:l}=D(),[r,s]=ye(),a=r.get("tab"),i=l&&a==="service-accounts"?"service-accounts":"users",x=h=>{s(h==="users"?{}:{tab:h})};return e.jsxs("div",{children:[e.jsx(O,{title:"Accounts",docsHash:"#docs:dashboard.md:accounts",actions:l?e.jsx(Te,{active:i,onChange:x}):void 0}),i==="users"?e.jsx(Ie,{}):e.jsx(Ae,{embedded:!0})]})}function Ie(){const{isBuilder:l}=D(),{filters:r,setFilter:s,pagination:a}=E({filters:{status:"",search:""}}),i=W(),[x,h]=p.useState(!1),[j,m]=p.useState(null),[t,u]=p.useState(null),[d,g]=p.useState(null),{data:o,isLoading:f}=Q({status:r.status||void 0,search:r.search||void 0,limit:a.pageSize,offset:a.offset}),c=(o==null?void 0:o.total)??0,y=(o==null?void 0:o.users)??[],b=p.useMemo(()=>t?y.find(n=>n.id===t.id)??t:null,[y,t]),N=[{key:"display_name",label:"User",render:n=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${Ee[n.status]??"bg-status-pending"}`,title:n.status}),e.jsx("span",{className:"text-xs text-text-primary whitespace-nowrap",children:n.display_name||n.external_id})]})},{key:"email",label:"Email",render:n=>n.email?e.jsx("span",{className:"text-xs text-text-secondary whitespace-nowrap",children:n.email}):e.jsx("span",{className:"text-xs text-text-quaternary",children:"—"})},{key:"roles",label:"Roles",render:n=>e.jsx("div",{className:"flex gap-2 flex-wrap",children:(n.roles??[]).map(w=>e.jsx(S,{role:w.role,size:"md"},w.role))})},{key:"created_at",label:"Created",render:n=>e.jsx(T,{date:n.created_at}),className:"w-36 whitespace-nowrap"},...l?[{key:"actions",label:"",render:n=>e.jsxs(z,{children:[e.jsx(k,{icon:L,title:"Edit user",onClick:()=>m(n)}),e.jsx(k,{icon:A,title:"Delete user",onClick:()=>g(n),colorClass:"text-text-tertiary hover:text-status-error"})]}),className:"w-16 text-right"}]:[]],v=()=>{d&&i.mutate(d.id,{onSuccess:()=>g(null)})};return e.jsxs("div",{children:[l&&e.jsx("div",{className:"flex justify-end mb-4",children:e.jsx("button",{onClick:()=>h(!0),className:"btn-primary text-xs",children:"Add User"})}),e.jsxs(K,{children:[e.jsx(M,{label:"Search",value:r.search,onChange:n=>s("search",n),placeholder:"name, email, id…"}),e.jsx($,{label:"Status",value:r.status,onChange:n=>s("status",n),options:De})]}),e.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1fr_360px] gap-6 items-start",children:[e.jsxs("div",{className:"overflow-x-clip",children:[e.jsx(I,{columns:N,data:y,keyFn:n=>n.id,isLoading:f,emptyMessage:"No users found",onRowClick:n=>u(n),activeRowKey:(b==null?void 0:b.id)??null}),e.jsx(F,{page:a.page,totalPages:a.totalPages(c),onPageChange:a.setPage,total:c,pageSize:a.pageSize,onPageSizeChange:a.setPageSize})]}),e.jsx("div",{className:"sticky top-4",children:e.jsx(Be,{user:b})})]}),e.jsx(be,{open:x,onClose:()=>h(!1)}),e.jsx(Ne,{open:!!j,onClose:()=>m(null),user:j}),e.jsx(R,{open:!!d,onClose:()=>g(null),onConfirm:v,title:"Delete User",description:e.jsxs(e.Fragment,{children:["Delete"," ",e.jsx("span",{className:"font-medium text-text-primary",children:(d==null?void 0:d.display_name)||(d==null?void 0:d.external_id)}),"? This action cannot be undone."]}),isPending:i.isPending,error:i.error})]})}export{as as UsersPage};
2
- //# sourceMappingURL=index-5eRsj758.js.map