@hotmeshio/long-tail 0.5.12 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +1 -0
  2. package/build/api/escalations/bulk.js +9 -1
  3. package/build/api/escalations/cancel.js +5 -7
  4. package/build/api/escalations/claim.js +18 -15
  5. package/build/api/escalations/create.d.ts +6 -0
  6. package/build/api/escalations/create.js +11 -8
  7. package/build/api/escalations/facets.d.ts +18 -0
  8. package/build/api/escalations/facets.js +115 -0
  9. package/build/api/escalations/helpers.d.ts +70 -1
  10. package/build/api/escalations/helpers.js +101 -7
  11. package/build/api/escalations/index.d.ts +3 -2
  12. package/build/api/escalations/index.js +7 -1
  13. package/build/api/escalations/list.d.ts +21 -2
  14. package/build/api/escalations/list.js +109 -10
  15. package/build/api/escalations/metadata.js +22 -27
  16. package/build/api/escalations/resolve.d.ts +19 -1
  17. package/build/api/escalations/resolve.js +111 -26
  18. package/build/api/escalations/single.js +8 -8
  19. package/build/api/users.d.ts +6 -0
  20. package/build/api/users.js +29 -1
  21. package/build/bin/ltc.js +40 -0
  22. package/build/lib/cli/commands/escalations.d.ts +36 -0
  23. package/build/lib/cli/commands/escalations.js +98 -0
  24. package/build/lib/db/schemas/001_schema.sql +10 -5
  25. package/build/lib/db/schemas/012_lt_tasks_workflow_id_unique.sql +20 -0
  26. package/build/lib/db/schemas/013_role_scope.sql +37 -0
  27. package/build/modules/version.d.ts +10 -5
  28. package/build/modules/version.js +27 -11
  29. package/build/routes/escalations/facets.d.ts +7 -0
  30. package/build/routes/escalations/facets.js +81 -0
  31. package/build/routes/escalations/index.js +3 -0
  32. package/build/routes/escalations/list.js +46 -0
  33. package/build/routes/escalations/resolve.js +22 -4
  34. package/build/routes/users.js +9 -5
  35. package/build/sdk/index.d.ts +33 -2
  36. package/build/sdk/index.js +7 -0
  37. package/build/services/escalation/crud.d.ts +56 -6
  38. package/build/services/escalation/crud.js +102 -31
  39. package/build/services/escalation/facet-sql.d.ts +18 -0
  40. package/build/services/escalation/facet-sql.js +118 -0
  41. package/build/services/escalation/facets.d.ts +45 -0
  42. package/build/services/escalation/facets.js +218 -0
  43. package/build/services/escalation/index.d.ts +1 -0
  44. package/build/services/escalation/index.js +8 -1
  45. package/build/services/escalation/queries.d.ts +45 -0
  46. package/build/services/escalation/queries.js +107 -6
  47. package/build/services/escalation/sql.d.ts +10 -4
  48. package/build/services/escalation/sql.js +36 -8
  49. package/build/services/interceptor/activities/escalation.d.ts +2 -0
  50. package/build/services/interceptor/activities/escalation.js +1 -1
  51. package/build/services/interceptor/lifecycle.js +4 -0
  52. package/build/services/mcp/server-tools.js +10 -4
  53. package/build/services/orchestrator/condition.js +6 -2
  54. package/build/services/role/index.js +2 -3
  55. package/build/services/role/sql.d.ts +8 -0
  56. package/build/services/role/sql.js +17 -1
  57. package/build/services/task/crud.js +22 -14
  58. package/build/services/task/process.js +3 -21
  59. package/build/services/task/sql.d.ts +24 -1
  60. package/build/services/task/sql.js +65 -1
  61. package/build/services/user/crud.d.ts +1 -0
  62. package/build/services/user/crud.js +29 -11
  63. package/build/services/user/index.d.ts +2 -1
  64. package/build/services/user/index.js +12 -1
  65. package/build/services/user/rbac.d.ts +18 -0
  66. package/build/services/user/rbac.js +27 -0
  67. package/build/services/user/roles.d.ts +7 -2
  68. package/build/services/user/roles.js +21 -5
  69. package/build/services/user/scope.d.ts +22 -0
  70. package/build/services/user/scope.js +50 -0
  71. package/build/services/user/seed-admin.js +34 -17
  72. package/build/services/user/sql.d.ts +18 -7
  73. package/build/services/user/sql.js +38 -13
  74. package/build/services/user/sso-provision.js +41 -24
  75. package/build/services/user/types.d.ts +9 -5
  76. package/build/system/mcp-servers/admin/escalations.js +65 -0
  77. package/build/system/mcp-servers/admin/schemas.d.ts +325 -0
  78. package/build/system/mcp-servers/admin/schemas.js +63 -2
  79. package/build/system/mcp-servers/admin/users.js +28 -2
  80. package/build/tsconfig.tsbuildinfo +1 -1
  81. package/build/types/envelope.d.ts +7 -0
  82. package/build/types/facets.d.ts +60 -0
  83. package/build/types/facets.js +10 -0
  84. package/build/types/index.d.ts +2 -1
  85. package/build/types/user.d.ts +11 -0
  86. package/dashboard/dist/assets/AdminDashboard-2CZ8py9X.js +2 -0
  87. package/dashboard/dist/assets/{AdminDashboard-LTiYLuzq.js.map → AdminDashboard-2CZ8py9X.js.map} +1 -1
  88. package/dashboard/dist/assets/{AgentConfigPage-nlOudfpZ.js → AgentConfigPage-D68sodgo.js} +2 -2
  89. package/dashboard/dist/assets/{AgentConfigPage-nlOudfpZ.js.map → AgentConfigPage-D68sodgo.js.map} +1 -1
  90. package/dashboard/dist/assets/{AgentDetailPage-BSUnDvGp.js → AgentDetailPage-BmhuWbKi.js} +2 -2
  91. package/dashboard/dist/assets/{AgentDetailPage-BSUnDvGp.js.map → AgentDetailPage-BmhuWbKi.js.map} +1 -1
  92. package/dashboard/dist/assets/{AgentsPage-DpS0cCYe.js → AgentsPage-C4SKQVeU.js} +2 -2
  93. package/dashboard/dist/assets/{AgentsPage-DpS0cCYe.js.map → AgentsPage-C4SKQVeU.js.map} +1 -1
  94. package/dashboard/dist/assets/AvailableEscalationsPage-9RBEYwkt.js +2 -0
  95. package/dashboard/dist/assets/AvailableEscalationsPage-9RBEYwkt.js.map +1 -0
  96. package/dashboard/dist/assets/{BotPicker-BhKmq7M7.js → BotPicker-D-FvXJOM.js} +2 -2
  97. package/dashboard/dist/assets/{BotPicker-BhKmq7M7.js.map → BotPicker-D-FvXJOM.js.map} +1 -1
  98. package/dashboard/dist/assets/{CapabilitiesPage-DLIleX2L.js → CapabilitiesPage-ByDf6WJr.js} +2 -2
  99. package/dashboard/dist/assets/{CapabilitiesPage-DLIleX2L.js.map → CapabilitiesPage-ByDf6WJr.js.map} +1 -1
  100. package/dashboard/dist/assets/{CollapsibleSection-D7SVwNVk.js → CollapsibleSection-BjGNYEvh.js} +2 -2
  101. package/dashboard/dist/assets/{CollapsibleSection-D7SVwNVk.js.map → CollapsibleSection-BjGNYEvh.js.map} +1 -1
  102. package/dashboard/dist/assets/CopyableId-blg-gZvT.js +2 -0
  103. package/dashboard/dist/assets/CopyableId-blg-gZvT.js.map +1 -0
  104. package/dashboard/dist/assets/{CredentialsPage-fat5Z2U9.js → CredentialsPage-DvCA-wQN.js} +2 -2
  105. package/dashboard/dist/assets/{CredentialsPage-fat5Z2U9.js.map → CredentialsPage-DvCA-wQN.js.map} +1 -1
  106. package/dashboard/dist/assets/{CronLabel-OOP4P2mJ.js → CronLabel-DBMurd_c.js} +2 -2
  107. package/dashboard/dist/assets/{CronLabel-OOP4P2mJ.js.map → CronLabel-DBMurd_c.js.map} +1 -1
  108. package/dashboard/dist/assets/{CustomDurationPicker-COacSAXO.js → CustomDurationPicker-DHflFoEa.js} +2 -2
  109. package/dashboard/dist/assets/{CustomDurationPicker-COacSAXO.js.map → CustomDurationPicker-DHflFoEa.js.map} +1 -1
  110. package/dashboard/dist/assets/{DropZone-Bfw2YLVS.js → DropZone-CUtdp99Z.js} +2 -2
  111. package/dashboard/dist/assets/{DropZone-Bfw2YLVS.js.map → DropZone-CUtdp99Z.js.map} +1 -1
  112. package/dashboard/dist/assets/{ElapsedCell-CkfCD-m7.js → ElapsedCell-CSjcVOpo.js} +2 -2
  113. package/dashboard/dist/assets/{ElapsedCell-CkfCD-m7.js.map → ElapsedCell-CSjcVOpo.js.map} +1 -1
  114. package/dashboard/dist/assets/{EscalationsOverview-BmI8jxlh.js → EscalationsOverview-BUqRNJbK.js} +2 -2
  115. package/dashboard/dist/assets/{EscalationsOverview-BmI8jxlh.js.map → EscalationsOverview-BUqRNJbK.js.map} +1 -1
  116. package/dashboard/dist/assets/{EventTable-CeKfFk3m.js → EventTable-Chz-6XPE.js} +2 -2
  117. package/dashboard/dist/assets/{EventTable-CeKfFk3m.js.map → EventTable-Chz-6XPE.js.map} +1 -1
  118. package/dashboard/dist/assets/{GraphInvokePage-BZBPBCSq.js → GraphInvokePage-BXdgciWg.js} +2 -2
  119. package/dashboard/dist/assets/{GraphInvokePage-BZBPBCSq.js.map → GraphInvokePage-BXdgciWg.js.map} +1 -1
  120. package/dashboard/dist/assets/{HomePage-dM7U2tl6.js → HomePage-CEMxnk0r.js} +2 -2
  121. package/dashboard/dist/assets/{HomePage-dM7U2tl6.js.map → HomePage-CEMxnk0r.js.map} +1 -1
  122. package/dashboard/dist/assets/{ListToolbar-BJaCzAXS.js → ListToolbar-_73JCdbB.js} +2 -2
  123. package/dashboard/dist/assets/{ListToolbar-BJaCzAXS.js.map → ListToolbar-_73JCdbB.js.map} +1 -1
  124. package/dashboard/dist/assets/{McpOverview-CvnDG5OB.js → McpOverview-DfdqxhSz.js} +2 -2
  125. package/dashboard/dist/assets/{McpOverview-CvnDG5OB.js.map → McpOverview-DfdqxhSz.js.map} +1 -1
  126. package/dashboard/dist/assets/{McpQueryDetailPage-DwmSIcIL.js → McpQueryDetailPage-DPAljieY.js} +2 -2
  127. package/dashboard/dist/assets/{McpQueryDetailPage-DwmSIcIL.js.map → McpQueryDetailPage-DPAljieY.js.map} +1 -1
  128. package/dashboard/dist/assets/{McpQueryPage-CU6FMEEk.js → McpQueryPage-D5cSziYS.js} +2 -2
  129. package/dashboard/dist/assets/{McpQueryPage-CU6FMEEk.js.map → McpQueryPage-D5cSziYS.js.map} +1 -1
  130. package/dashboard/dist/assets/{McpRunDetailPage-8a6lsehv.js → McpRunDetailPage-DwNb9wZg.js} +2 -2
  131. package/dashboard/dist/assets/{McpRunDetailPage-8a6lsehv.js.map → McpRunDetailPage-DwNb9wZg.js.map} +1 -1
  132. package/dashboard/dist/assets/{McpRunsPage-CPMYWgm_.js → McpRunsPage-O5H6yStl.js} +2 -2
  133. package/dashboard/dist/assets/{McpRunsPage-CPMYWgm_.js.map → McpRunsPage-O5H6yStl.js.map} +1 -1
  134. package/dashboard/dist/assets/{NamespacePill-D6btr6e8.js → NamespacePill-uW-xOedj.js} +2 -2
  135. package/dashboard/dist/assets/{NamespacePill-D6btr6e8.js.map → NamespacePill-uW-xOedj.js.map} +1 -1
  136. package/dashboard/dist/assets/OperatorDashboard-DYw9Ekv5.js +2 -0
  137. package/dashboard/dist/assets/{OperatorDashboard-g9o7I925.js.map → OperatorDashboard-DYw9Ekv5.js.map} +1 -1
  138. package/dashboard/dist/assets/PageHeader-DVOZjBfL.js +2 -0
  139. package/dashboard/dist/assets/PageHeader-DVOZjBfL.js.map +1 -0
  140. package/dashboard/dist/assets/{PageHeaderWithStats-DJQCZ0FR.js → PageHeaderWithStats-DtTpDHOd.js} +2 -2
  141. package/dashboard/dist/assets/{PageHeaderWithStats-DJQCZ0FR.js.map → PageHeaderWithStats-DtTpDHOd.js.map} +1 -1
  142. package/dashboard/dist/assets/PriorityBadge-B4ykBH7f.js +2 -0
  143. package/dashboard/dist/assets/PriorityBadge-B4ykBH7f.js.map +1 -0
  144. package/dashboard/dist/assets/{ProcessDetailPage-ByyWCs2A.js → ProcessDetailPage-B0Dokcx9.js} +2 -2
  145. package/dashboard/dist/assets/{ProcessDetailPage-ByyWCs2A.js.map → ProcessDetailPage-B0Dokcx9.js.map} +1 -1
  146. package/dashboard/dist/assets/{ProcessesListPage-BTsXds4l.js → ProcessesListPage-Cc87WIjL.js} +2 -2
  147. package/dashboard/dist/assets/{ProcessesListPage-BTsXds4l.js.map → ProcessesListPage-Cc87WIjL.js.map} +1 -1
  148. package/dashboard/dist/assets/RolePill-BaW-30TC.js +2 -0
  149. package/dashboard/dist/assets/RolePill-BaW-30TC.js.map +1 -0
  150. package/dashboard/dist/assets/{RolesPage-B2Kdf-L9.js → RolesPage-cp6PiF08.js} +2 -2
  151. package/dashboard/dist/assets/{RolesPage-B2Kdf-L9.js.map → RolesPage-cp6PiF08.js.map} +1 -1
  152. package/dashboard/dist/assets/RowActions-BA9L9djf.js +2 -0
  153. package/dashboard/dist/assets/RowActions-BA9L9djf.js.map +1 -0
  154. package/dashboard/dist/assets/{RunAsSelector-BzkZXpSX.js → RunAsSelector-2LWkjSnO.js} +2 -2
  155. package/dashboard/dist/assets/{RunAsSelector-BzkZXpSX.js.map → RunAsSelector-2LWkjSnO.js.map} +1 -1
  156. package/dashboard/dist/assets/{StickyPagination-BWhFSr2d.js → StickyPagination-BQEm--kI.js} +2 -2
  157. package/dashboard/dist/assets/{StickyPagination-BWhFSr2d.js.map → StickyPagination-BQEm--kI.js.map} +1 -1
  158. package/dashboard/dist/assets/{StreamMessageDetail-B6ch-6SY.js → StreamMessageDetail-BTtw3GjX.js} +2 -2
  159. package/dashboard/dist/assets/{StreamMessageDetail-B6ch-6SY.js.map → StreamMessageDetail-BTtw3GjX.js.map} +1 -1
  160. package/dashboard/dist/assets/{SwimlaneTimeline-CjvfUkls.js → SwimlaneTimeline-DdXxP4fO.js} +2 -2
  161. package/dashboard/dist/assets/{SwimlaneTimeline-CjvfUkls.js.map → SwimlaneTimeline-DdXxP4fO.js.map} +1 -1
  162. package/dashboard/dist/assets/{TagInput-CZSeyesi.js → TagInput-x9XTuqMb.js} +2 -2
  163. package/dashboard/dist/assets/{TagInput-CZSeyesi.js.map → TagInput-x9XTuqMb.js.map} +1 -1
  164. package/dashboard/dist/assets/{TaskDetailPage-BjHU6opi.js → TaskDetailPage-B8veYG4X.js} +2 -2
  165. package/dashboard/dist/assets/{TaskDetailPage-BjHU6opi.js.map → TaskDetailPage-B8veYG4X.js.map} +1 -1
  166. package/dashboard/dist/assets/{TaskQueuePill-CQrXrSxk.js → TaskQueuePill-DSEQZ-HT.js} +2 -2
  167. package/dashboard/dist/assets/{TaskQueuePill-CQrXrSxk.js.map → TaskQueuePill-DSEQZ-HT.js.map} +1 -1
  168. package/dashboard/dist/assets/{TasksListPage-Bem44zd0.js → TasksListPage-CsN1gZj5.js} +2 -2
  169. package/dashboard/dist/assets/{TasksListPage-Bem44zd0.js.map → TasksListPage-CsN1gZj5.js.map} +1 -1
  170. package/dashboard/dist/assets/{TimeAgo-CUIYqSt_.js → TimeAgo-n182EcLx.js} +2 -2
  171. package/dashboard/dist/assets/{TimeAgo-CUIYqSt_.js.map → TimeAgo-n182EcLx.js.map} +1 -1
  172. package/dashboard/dist/assets/{TimestampCell--tnreI1i.js → TimestampCell-2dlcQAfX.js} +2 -2
  173. package/dashboard/dist/assets/{TimestampCell--tnreI1i.js.map → TimestampCell-2dlcQAfX.js.map} +1 -1
  174. package/dashboard/dist/assets/{ToolPill-O09jsTQM.js → ToolPill-B_e4eT77.js} +2 -2
  175. package/dashboard/dist/assets/{ToolPill-O09jsTQM.js.map → ToolPill-B_e4eT77.js.map} +1 -1
  176. package/dashboard/dist/assets/{ToolTestPanel-OD99H7Pk.js → ToolTestPanel-Bhnncc6M.js} +2 -2
  177. package/dashboard/dist/assets/{ToolTestPanel-OD99H7Pk.js.map → ToolTestPanel-Bhnncc6M.js.map} +1 -1
  178. package/dashboard/dist/assets/{TopicDetailPage-rh_dsTJI.js → TopicDetailPage-29lsNsqI.js} +2 -2
  179. package/dashboard/dist/assets/{TopicDetailPage-rh_dsTJI.js.map → TopicDetailPage-29lsNsqI.js.map} +1 -1
  180. package/dashboard/dist/assets/{TopicsPage-CD_40_v-.js → TopicsPage-KJ7_LAvo.js} +2 -2
  181. package/dashboard/dist/assets/{TopicsPage-CD_40_v-.js.map → TopicsPage-KJ7_LAvo.js.map} +1 -1
  182. package/dashboard/dist/assets/{UserName-C__c8BN0.js → UserName-CMoFi9zb.js} +2 -2
  183. package/dashboard/dist/assets/{UserName-C__c8BN0.js.map → UserName-CMoFi9zb.js.map} +1 -1
  184. package/dashboard/dist/assets/{WorkflowExecutionPage-Bw6QdtUO.js → WorkflowExecutionPage-Cymfx-Bp.js} +2 -2
  185. package/dashboard/dist/assets/{WorkflowExecutionPage-Bw6QdtUO.js.map → WorkflowExecutionPage-Cymfx-Bp.js.map} +1 -1
  186. package/dashboard/dist/assets/{WorkflowPill-CS-IsR0U.js → WorkflowPill-B66_AnaY.js} +2 -2
  187. package/dashboard/dist/assets/{WorkflowPill-CS-IsR0U.js.map → WorkflowPill-B66_AnaY.js.map} +1 -1
  188. package/dashboard/dist/assets/{WorkflowsDashboard-BgI-iOP6.js → WorkflowsDashboard-CqLN8spd.js} +2 -2
  189. package/dashboard/dist/assets/{WorkflowsDashboard-BgI-iOP6.js.map → WorkflowsDashboard-CqLN8spd.js.map} +1 -1
  190. package/dashboard/dist/assets/{WorkflowsOverview-BRc0QbA7.js → WorkflowsOverview-0Rc2WT6q.js} +2 -2
  191. package/dashboard/dist/assets/{WorkflowsOverview-BRc0QbA7.js.map → WorkflowsOverview-0Rc2WT6q.js.map} +1 -1
  192. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DdzspNQR.js → YamlWorkflowDetailPage-CARQ7_LN.js} +2 -2
  193. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DdzspNQR.js.map → YamlWorkflowDetailPage-CARQ7_LN.js.map} +1 -1
  194. package/dashboard/dist/assets/{YamlWorkflowsPage-Djw5ZbgQ.js → YamlWorkflowsPage-B-7sz1nf.js} +2 -2
  195. package/dashboard/dist/assets/{YamlWorkflowsPage-Djw5ZbgQ.js.map → YamlWorkflowsPage-B-7sz1nf.js.map} +1 -1
  196. package/dashboard/dist/assets/{agents-xstNkF6c.js → agents-zM43d5Yf.js} +2 -2
  197. package/dashboard/dist/assets/{agents-xstNkF6c.js.map → agents-zM43d5Yf.js.map} +1 -1
  198. package/dashboard/dist/assets/{bots-BztAI0s_.js → bots-D5BasOGz.js} +2 -2
  199. package/dashboard/dist/assets/{bots-BztAI0s_.js.map → bots-D5BasOGz.js.map} +1 -1
  200. package/dashboard/dist/assets/{capabilities-CEDwtxNL.js → capabilities-BT3PW9CZ.js} +2 -2
  201. package/dashboard/dist/assets/{capabilities-CEDwtxNL.js.map → capabilities-BT3PW9CZ.js.map} +1 -1
  202. package/dashboard/dist/assets/{controlplane-BlGEsRKe.js → controlplane-NpJr49rN.js} +2 -2
  203. package/dashboard/dist/assets/{controlplane-BlGEsRKe.js.map → controlplane-NpJr49rN.js.map} +1 -1
  204. package/dashboard/dist/assets/{escalation-iI4QKlP-.js → escalation-DrzQolPG.js} +2 -2
  205. package/dashboard/dist/assets/{escalation-iI4QKlP-.js.map → escalation-DrzQolPG.js.map} +1 -1
  206. package/dashboard/dist/assets/escalation-columns-QzwmtD60.js +2 -0
  207. package/dashboard/dist/assets/escalation-columns-QzwmtD60.js.map +1 -0
  208. package/dashboard/dist/assets/index-B5w4Gjyk.js +6 -0
  209. package/dashboard/dist/assets/index-B5w4Gjyk.js.map +1 -0
  210. package/dashboard/dist/assets/{index-CMviPjXQ.js → index-BCT4kqGR.js} +2 -2
  211. package/dashboard/dist/assets/{index-CMviPjXQ.js.map → index-BCT4kqGR.js.map} +1 -1
  212. package/dashboard/dist/assets/{index-B7VC0vjf.js → index-C69XvBfg.js} +2 -2
  213. package/dashboard/dist/assets/{index-B7VC0vjf.js.map → index-C69XvBfg.js.map} +1 -1
  214. package/dashboard/dist/assets/index-CHw4Fl0t.css +1 -0
  215. package/dashboard/dist/assets/{index-CUfgt3mV.js → index-C_NwHTMh.js} +2 -2
  216. package/dashboard/dist/assets/{index-CUfgt3mV.js.map → index-C_NwHTMh.js.map} +1 -1
  217. package/dashboard/dist/assets/{index-CAqEy2Db.js → index-Cq0trGqf.js} +2 -2
  218. package/dashboard/dist/assets/{index-CAqEy2Db.js.map → index-Cq0trGqf.js.map} +1 -1
  219. package/dashboard/dist/assets/{index-D1xVY4JR.js → index-DE0r9SEX.js} +22 -22
  220. package/dashboard/dist/assets/index-DE0r9SEX.js.map +1 -0
  221. package/dashboard/dist/assets/{index-DjJ6VCuc.js → index-DH_CiD0W.js} +2 -2
  222. package/dashboard/dist/assets/{index-DjJ6VCuc.js.map → index-DH_CiD0W.js.map} +1 -1
  223. package/dashboard/dist/assets/{index-DzVYjoex.js → index-K23FdS-T.js} +2 -2
  224. package/dashboard/dist/assets/{index-DzVYjoex.js.map → index-K23FdS-T.js.map} +1 -1
  225. package/dashboard/dist/assets/{index-FuhiJuHL.js → index-f6K1UNrn.js} +2 -2
  226. package/dashboard/dist/assets/{index-FuhiJuHL.js.map → index-f6K1UNrn.js.map} +1 -1
  227. package/dashboard/dist/assets/{index-B5qsp8lb.js → index-qr1fndqM.js} +2 -2
  228. package/dashboard/dist/assets/{index-B5qsp8lb.js.map → index-qr1fndqM.js.map} +1 -1
  229. package/dashboard/dist/assets/index-vKTvJ_li.js +2 -0
  230. package/dashboard/dist/assets/index-vKTvJ_li.js.map +1 -0
  231. package/dashboard/dist/assets/{index-BUmnJ4eT.js → index-y-3ODtEE.js} +2 -2
  232. package/dashboard/dist/assets/{index-BUmnJ4eT.js.map → index-y-3ODtEE.js.map} +1 -1
  233. package/dashboard/dist/assets/{index-Dsi5o7dx.js → index-y56Ds-LB.js} +2 -2
  234. package/dashboard/dist/assets/{index-Dsi5o7dx.js.map → index-y56Ds-LB.js.map} +1 -1
  235. package/dashboard/dist/assets/{knowledge-BKg0cr39.js → knowledge-DSSATOTX.js} +2 -2
  236. package/dashboard/dist/assets/{knowledge-BKg0cr39.js.map → knowledge-DSSATOTX.js.map} +1 -1
  237. package/dashboard/dist/assets/{mcp-CVdHpKlz.js → mcp-CfJFVo5k.js} +2 -2
  238. package/dashboard/dist/assets/{mcp-CVdHpKlz.js.map → mcp-CfJFVo5k.js.map} +1 -1
  239. package/dashboard/dist/assets/{mcp-query-CYxZcbwQ.js → mcp-query-DKVx2Q-X.js} +2 -2
  240. package/dashboard/dist/assets/{mcp-query-CYxZcbwQ.js.map → mcp-query-DKVx2Q-X.js.map} +1 -1
  241. package/dashboard/dist/assets/{pipelines-BOEv7P6O.js → pipelines-BSWzE-6M.js} +2 -2
  242. package/dashboard/dist/assets/{pipelines-BOEv7P6O.js.map → pipelines-BSWzE-6M.js.map} +1 -1
  243. package/dashboard/dist/assets/{roles-c5cV2QYQ.js → roles-t9HzhI5N.js} +2 -2
  244. package/dashboard/dist/assets/{roles-c5cV2QYQ.js.map → roles-t9HzhI5N.js.map} +1 -1
  245. package/dashboard/dist/assets/{tasks-JV3BjeEF.js → tasks-B7rUihoH.js} +2 -2
  246. package/dashboard/dist/assets/{tasks-JV3BjeEF.js.map → tasks-B7rUihoH.js.map} +1 -1
  247. package/dashboard/dist/assets/{topics-BDaPnhnQ.js → topics-PC2fEiyD.js} +2 -2
  248. package/dashboard/dist/assets/{topics-BDaPnhnQ.js.map → topics-PC2fEiyD.js.map} +1 -1
  249. package/dashboard/dist/assets/{useEventHooks-a7Dnh8G4.js → useEventHooks-DK9mw1cI.js} +2 -2
  250. package/dashboard/dist/assets/{useEventHooks-a7Dnh8G4.js.map → useEventHooks-DK9mw1cI.js.map} +1 -1
  251. package/dashboard/dist/assets/{useNamespace-BSwEV0e9.js → useNamespace-3IjtUtAw.js} +2 -2
  252. package/dashboard/dist/assets/{useNamespace-BSwEV0e9.js.map → useNamespace-3IjtUtAw.js.map} +1 -1
  253. package/dashboard/dist/assets/{useYamlActivityEvents-BuqvL-cn.js → useYamlActivityEvents-uxukp3gO.js} +2 -2
  254. package/dashboard/dist/assets/{useYamlActivityEvents-BuqvL-cn.js.map → useYamlActivityEvents-uxukp3gO.js.map} +1 -1
  255. package/dashboard/dist/assets/users-CC4B5Fm5.js +2 -0
  256. package/dashboard/dist/assets/users-CC4B5Fm5.js.map +1 -0
  257. package/dashboard/dist/assets/{vendor-icons-D5ycKPA2.js → vendor-icons-Dy5Jpknf.js} +2 -2
  258. package/dashboard/dist/assets/{vendor-icons-D5ycKPA2.js.map → vendor-icons-Dy5Jpknf.js.map} +1 -1
  259. package/dashboard/dist/assets/{workflows-DF-9Voyi.js → workflows-S7MF1nNk.js} +2 -2
  260. package/dashboard/dist/assets/{workflows-DF-9Voyi.js.map → workflows-S7MF1nNk.js.map} +1 -1
  261. package/dashboard/dist/assets/{yaml-workflows-2roKaSSK.js → yaml-workflows-WfdaMHNn.js} +2 -2
  262. package/dashboard/dist/assets/{yaml-workflows-2roKaSSK.js.map → yaml-workflows-WfdaMHNn.js.map} +1 -1
  263. package/dashboard/dist/index.html +3 -3
  264. package/docs/api/http/escalations.md +131 -10
  265. package/docs/api/http/roles.md +44 -9
  266. package/docs/api/http/users.md +15 -6
  267. package/docs/api/mcp/admin.md +8 -2
  268. package/docs/api/mcp/human-queue.md +34 -2
  269. package/docs/api/sdk/escalations.md +155 -2
  270. package/docs/api/sdk/roles.md +11 -0
  271. package/docs/api/sdk/users.md +26 -1
  272. package/docs/auth.md +1 -1
  273. package/docs/dashboard.md +5 -4
  274. package/docs/data.md +9 -2
  275. package/docs/faceted-routing.md +221 -0
  276. package/docs/hitl-guide.md +50 -0
  277. package/docs/iam.md +31 -0
  278. package/docs/mcp.md +8 -0
  279. package/package.json +2 -2
  280. package/dashboard/dist/assets/AdminDashboard-LTiYLuzq.js +0 -2
  281. package/dashboard/dist/assets/AvailableEscalationsPage-BEylRqjP.js +0 -2
  282. package/dashboard/dist/assets/AvailableEscalationsPage-BEylRqjP.js.map +0 -1
  283. package/dashboard/dist/assets/CopyableId-DaT0ZRHg.js +0 -2
  284. package/dashboard/dist/assets/CopyableId-DaT0ZRHg.js.map +0 -1
  285. package/dashboard/dist/assets/OperatorDashboard-g9o7I925.js +0 -2
  286. package/dashboard/dist/assets/PageHeader-Dk2Pe44Q.js +0 -2
  287. package/dashboard/dist/assets/PageHeader-Dk2Pe44Q.js.map +0 -1
  288. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js +0 -2
  289. package/dashboard/dist/assets/PriorityBadge-DfQY9St9.js.map +0 -1
  290. package/dashboard/dist/assets/RolePill-Du-aNnjR.js +0 -2
  291. package/dashboard/dist/assets/RolePill-Du-aNnjR.js.map +0 -1
  292. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js +0 -2
  293. package/dashboard/dist/assets/RowActions-Dg-Fsm5O.js.map +0 -1
  294. package/dashboard/dist/assets/escalation-columns-nVYVt7Gl.js +0 -2
  295. package/dashboard/dist/assets/escalation-columns-nVYVt7Gl.js.map +0 -1
  296. package/dashboard/dist/assets/index-CP0JEQhZ.js +0 -6
  297. package/dashboard/dist/assets/index-CP0JEQhZ.js.map +0 -1
  298. package/dashboard/dist/assets/index-ClvYSNZd.css +0 -1
  299. package/dashboard/dist/assets/index-D1xVY4JR.js.map +0 -1
  300. package/dashboard/dist/assets/index-DPLy-jwO.js +0 -2
  301. package/dashboard/dist/assets/index-DPLy-jwO.js.map +0 -1
  302. package/dashboard/dist/assets/users-Pn85K_3C.js +0 -2
  303. package/dashboard/dist/assets/users-Pn85K_3C.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-2roKaSSK.js";import{u}from"./index-D1xVY4JR.js";import{u as f}from"./useFilterParams-x-Dg0Vgz.js";import{P as p}from"./PageHeader-Dk2Pe44Q.js";import{F as g,a as b,b as j}from"./FilterBar-Ck4K4rzu.js";import{E as d}from"./EmptyState-BcsfPq9T.js";import{T as w}from"./ToolPill-O09jsTQM.js";import{N as v}from"./NamespacePill-D6btr6e8.js";import{S as y}from"./StatusBadge-Bl3FXVmF.js";import{b as N,W as k}from"./vendor-icons-D5ycKPA2.js";import{c as F}from"./vendor-react-CXumBFUA.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:s,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:s.status||void 0,search:s.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((t,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(b,{label:"Search",value:s.search,onChange:t=>l("search",t),placeholder:"Flow or namespace…"}),e.jsx(j,{label:"Status",value:s.status,onChange:t=>l("status",t),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(d,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(d,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${t.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(w,{name:t.graph_topic,size:"md"}),t.description&&e.jsx("p",{className:"text-[11px] leading-snug text-text-quaternary mt-0.5",children:t.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:t.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap",children:["v",t.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:t.status})})]},t.id))})]})]})}export{O as YamlWorkflowsPage};
2
- //# sourceMappingURL=YamlWorkflowsPage-Djw5ZbgQ.js.map
1
+ import{j as e}from"./vendor-query-B2UbickB.js";import{u as h}from"./yaml-workflows-WfdaMHNn.js";import{u}from"./index-DE0r9SEX.js";import{u as f}from"./useFilterParams-x-Dg0Vgz.js";import{P as p}from"./PageHeader-DVOZjBfL.js";import{F as g,a as b,b as j}from"./FilterBar-Ck4K4rzu.js";import{E as d}from"./EmptyState-BcsfPq9T.js";import{T as w}from"./ToolPill-B_e4eT77.js";import{N as v}from"./NamespacePill-uW-xOedj.js";import{S as y}from"./StatusBadge-Bl3FXVmF.js";import{b as N,W as k}from"./vendor-icons-Dy5Jpknf.js";import{c as F}from"./vendor-react-CXumBFUA.js";function O(){var c;const a=F(),{data:r}=u(),o=!!((c=r==null?void 0:r.ai)!=null&&c.enabled),{filters:s,setFilter:l}=f({filters:{status:"",search:""}}),{data:i,isLoading:m}=h({status:s.status||void 0,search:s.search||void 0,limit:200,offset:0}),n=(i==null?void 0:i.workflows)??[];return m?e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools"}),e.jsx("div",{className:"animate-pulse space-y-0",children:Array.from({length:4}).map((t,x)=>e.jsx("div",{className:"h-14 border-b last:border-b-0 px-6 flex items-center",children:e.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})},x))})]}):e.jsxs("div",{children:[e.jsx(p,{title:"Configure",docsHash:"#docs:dashboard.md:mcp-pipeline-tools",actions:o?e.jsx("button",{onClick:()=>a("/mcp/queries/new"),className:"btn-primary text-xs",children:"Design Flow"}):void 0}),e.jsxs("p",{className:"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed",children:["The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each flow is a graph the router discovers and runs on demand. Open one to inspect or run it",o?", or design a new one from a description.":"."]}),e.jsxs(g,{children:[e.jsx(b,{label:"Search",value:s.search,onChange:t=>l("search",t),placeholder:"Flow or namespace…"}),e.jsx(j,{label:"Status",value:s.status,onChange:t=>l("status",t),options:[{value:"draft",label:"Draft"},{value:"deployed",label:"Deployed"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]})]}),n.length===0?o?e.jsx("div",{className:"cursor-pointer",onClick:()=>a("/mcp/queries/new"),children:e.jsx(d,{icon:N,title:"No graph flows yet",description:"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config."})}):e.jsx(d,{icon:k,title:"No graph flows yet",description:"Register graph flows at startup with the graphWorkflows config — see the docs for an example."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Flow"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40",children:"Namespace"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20",children:"Version"}),e.jsx("th",{className:"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28",children:"Status"})]})}),e.jsx("tbody",{children:n.map(t=>e.jsxs("tr",{onClick:()=>a(`/mcp/workflows/${t.id}`),className:"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer",children:[e.jsxs("td",{className:"px-6 py-2.5",children:[e.jsx(w,{name:t.graph_topic,size:"md"}),t.description&&e.jsx("p",{className:"text-[11px] leading-snug text-text-quaternary mt-0.5",children:t.description})]}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(v,{namespace:t.app_id})}),e.jsxs("td",{className:"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap",children:["v",t.content_version]}),e.jsx("td",{className:"px-4 py-2.5 whitespace-nowrap",children:e.jsx(y,{status:t.status})})]},t.id))})]})]})}export{O as YamlWorkflowsPage};
2
+ //# sourceMappingURL=YamlWorkflowsPage-B-7sz1nf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"YamlWorkflowsPage-Djw5ZbgQ.js","sources":["../../src/pages/workflows/YamlWorkflowsPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { Wand2, Workflow } from 'lucide-react';\nimport { useYamlWorkflows } from '../../api/yaml-workflows';\nimport { useSettings } from '../../api/settings';\nimport { useFilterParams } from '../../hooks/useFilterParams';\n\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { EmptyState } from '../../components/common/display/EmptyState';\nimport { ToolPill } from '../../components/common/display/ToolPill';\nimport { NamespacePill } from '../../components/common/display/NamespacePill';\nimport { StatusBadge } from '../../components/common/display/StatusBadge';\n\n// ── Page: Graph › Configure ─────────────────────────────────────────────────\n\nexport function YamlWorkflowsPage() {\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const { filters, setFilter } = useFilterParams({\n filters: { status: '', search: '' },\n });\n\n const { data, isLoading } = useYamlWorkflows({\n status: (filters.status || undefined) as any,\n search: filters.search || undefined,\n limit: 200,\n offset: 0,\n });\n\n const flows = data?.workflows ?? [];\n\n if (isLoading) {\n return (\n <div>\n <PageHeader title=\"Configure\" docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\" />\n <div className=\"animate-pulse space-y-0\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"h-14 border-b last:border-b-0 px-6 flex items-center\">\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader\n title=\"Configure\"\n docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\"\n actions={\n aiEnabled ? (\n <button onClick={() => navigate('/mcp/queries/new')} className=\"btn-primary text-xs\">\n Design Flow\n </button>\n ) : undefined\n }\n />\n\n <p className=\"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed\">\n The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each\n flow is a graph the router discovers and runs on demand. Open one to inspect or run it\n {aiEnabled ? ', or design a new one from a description.' : '.'}\n </p>\n\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"Flow or namespace…\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'draft', label: 'Draft' },\n { value: 'deployed', label: 'Deployed' },\n { value: 'active', label: 'Active' },\n { value: 'archived', label: 'Archived' },\n ]}\n />\n </FilterBar>\n\n {flows.length === 0 ? (\n aiEnabled ? (\n <div className=\"cursor-pointer\" onClick={() => navigate('/mcp/queries/new')}>\n <EmptyState\n icon={Wand2}\n title=\"No graph flows yet\"\n description=\"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config.\"\n />\n </div>\n ) : (\n <EmptyState\n icon={Workflow}\n title=\"No graph flows yet\"\n description=\"Register graph flows at startup with the graphWorkflows config — see the docs for an example.\"\n />\n )\n ) : (\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b\">\n <th className=\"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary\">\n Flow\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40\">\n Namespace\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20\">\n Version\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28\">\n Status\n </th>\n </tr>\n </thead>\n <tbody>\n {flows.map((flow) => (\n <tr\n key={flow.id}\n onClick={() => navigate(`/mcp/workflows/${flow.id}`)}\n className=\"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer\"\n >\n <td className=\"px-6 py-2.5\">\n <ToolPill name={flow.graph_topic} size=\"md\" />\n {flow.description && (\n <p className=\"text-[11px] leading-snug text-text-quaternary mt-0.5\">{flow.description}</p>\n )}\n </td>\n <td className=\"px-4 py-2.5\">\n <NamespacePill namespace={flow.app_id} />\n </td>\n <td className=\"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap\">\n v{flow.content_version}\n </td>\n <td className=\"px-4 py-2.5 whitespace-nowrap\">\n <StatusBadge status={flow.status} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </div>\n );\n}\n"],"names":["YamlWorkflowsPage","navigate","useNavigate","settings","useSettings","aiEnabled","_a","filters","setFilter","useFilterParams","data","isLoading","useYamlWorkflows","flows","jsx","PageHeader","_","i","jsxs","FilterBar","FilterInput","v","FilterSelect","EmptyState","Wand2","Workflow","flow","ToolPill","NamespacePill","StatusBadge"],"mappings":"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"}
1
+ {"version":3,"file":"YamlWorkflowsPage-B-7sz1nf.js","sources":["../../src/pages/workflows/YamlWorkflowsPage.tsx"],"sourcesContent":["import { useNavigate } from 'react-router-dom';\nimport { Wand2, Workflow } from 'lucide-react';\nimport { useYamlWorkflows } from '../../api/yaml-workflows';\nimport { useSettings } from '../../api/settings';\nimport { useFilterParams } from '../../hooks/useFilterParams';\n\nimport { PageHeader } from '../../components/common/layout/PageHeader';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { EmptyState } from '../../components/common/display/EmptyState';\nimport { ToolPill } from '../../components/common/display/ToolPill';\nimport { NamespacePill } from '../../components/common/display/NamespacePill';\nimport { StatusBadge } from '../../components/common/display/StatusBadge';\n\n// ── Page: Graph › Configure ─────────────────────────────────────────────────\n\nexport function YamlWorkflowsPage() {\n const navigate = useNavigate();\n const { data: settings } = useSettings();\n const aiEnabled = !!settings?.ai?.enabled;\n const { filters, setFilter } = useFilterParams({\n filters: { status: '', search: '' },\n });\n\n const { data, isLoading } = useYamlWorkflows({\n status: (filters.status || undefined) as any,\n search: filters.search || undefined,\n limit: 200,\n offset: 0,\n });\n\n const flows = data?.workflows ?? [];\n\n if (isLoading) {\n return (\n <div>\n <PageHeader title=\"Configure\" docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\" />\n <div className=\"animate-pulse space-y-0\">\n {Array.from({ length: 4 }).map((_, i) => (\n <div key={i} className=\"h-14 border-b last:border-b-0 px-6 flex items-center\">\n <div className=\"h-3 bg-surface-sunken rounded w-full\" />\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n return (\n <div>\n <PageHeader\n title=\"Configure\"\n docsHash=\"#docs:dashboard.md:mcp-pipeline-tools\"\n actions={\n aiEnabled ? (\n <button onClick={() => navigate('/mcp/queries/new')} className=\"btn-primary text-xs\">\n Design Flow\n </button>\n ) : undefined\n }\n />\n\n <p className=\"text-sm text-text-secondary mb-6 max-w-2xl leading-relaxed\">\n The compiled form of a durable workflow — the same guarantees at roughly 3× the speed. Each\n flow is a graph the router discovers and runs on demand. Open one to inspect or run it\n {aiEnabled ? ', or design a new one from a description.' : '.'}\n </p>\n\n <FilterBar>\n <FilterInput\n label=\"Search\"\n value={filters.search}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"Flow or namespace…\"\n />\n <FilterSelect\n label=\"Status\"\n value={filters.status}\n onChange={(v) => setFilter('status', v)}\n options={[\n { value: 'draft', label: 'Draft' },\n { value: 'deployed', label: 'Deployed' },\n { value: 'active', label: 'Active' },\n { value: 'archived', label: 'Archived' },\n ]}\n />\n </FilterBar>\n\n {flows.length === 0 ? (\n aiEnabled ? (\n <div className=\"cursor-pointer\" onClick={() => navigate('/mcp/queries/new')}>\n <EmptyState\n icon={Wand2}\n title=\"No graph flows yet\"\n description=\"Open the Designer to compile your first flow from a description, or register flows at startup with the graphWorkflows config.\"\n />\n </div>\n ) : (\n <EmptyState\n icon={Workflow}\n title=\"No graph flows yet\"\n description=\"Register graph flows at startup with the graphWorkflows config — see the docs for an example.\"\n />\n )\n ) : (\n <table className=\"w-full\">\n <thead>\n <tr className=\"border-b\">\n <th className=\"px-6 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary\">\n Flow\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-40\">\n Namespace\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-20\">\n Version\n </th>\n <th className=\"px-4 py-3 text-left text-[10px] font-semibold uppercase tracking-widest text-text-tertiary w-28\">\n Status\n </th>\n </tr>\n </thead>\n <tbody>\n {flows.map((flow) => (\n <tr\n key={flow.id}\n onClick={() => navigate(`/mcp/workflows/${flow.id}`)}\n className=\"border-b border-surface-border/50 hover:bg-surface-hover/40 transition-colors duration-100 cursor-pointer\"\n >\n <td className=\"px-6 py-2.5\">\n <ToolPill name={flow.graph_topic} size=\"md\" />\n {flow.description && (\n <p className=\"text-[11px] leading-snug text-text-quaternary mt-0.5\">{flow.description}</p>\n )}\n </td>\n <td className=\"px-4 py-2.5\">\n <NamespacePill namespace={flow.app_id} />\n </td>\n <td className=\"px-4 py-2.5 text-[10px] text-text-quaternary font-mono whitespace-nowrap\">\n v{flow.content_version}\n </td>\n <td className=\"px-4 py-2.5 whitespace-nowrap\">\n <StatusBadge status={flow.status} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n )}\n </div>\n );\n}\n"],"names":["YamlWorkflowsPage","navigate","useNavigate","settings","useSettings","aiEnabled","_a","filters","setFilter","useFilterParams","data","isLoading","useYamlWorkflows","flows","jsx","PageHeader","_","i","jsxs","FilterBar","FilterInput","v","FilterSelect","EmptyState","Wand2","Workflow","flow","ToolPill","NamespacePill","StatusBadge"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-D1xVY4JR.js";function g(e={}){const n=new URLSearchParams;e.status&&n.set("status",e.status),e.knowledge_domain&&n.set("knowledge_domain",e.knowledge_domain),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const s=n.toString();return o({queryKey:["agents",e],queryFn:()=>t(`/agents${s?`?${s}`:""}`)})}function y(e){return o({queryKey:["agents",e],queryFn:()=>t(`/agents/${e}`),enabled:!!e})}function c(){const e=u();return a({mutationFn:n=>t("/agents",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function m(){const e=u();return a({mutationFn:({id:n,...s})=>t(`/agents/${n}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function d(){const e=u();return a({mutationFn:n=>t(`/agents/${n}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}export{y as a,m as b,d as c,c as d,g as u};
2
- //# sourceMappingURL=agents-xstNkF6c.js.map
1
+ import{u as o,b as u,c as a}from"./vendor-query-B2UbickB.js";import{d as t}from"./index-DE0r9SEX.js";function g(e={}){const n=new URLSearchParams;e.status&&n.set("status",e.status),e.knowledge_domain&&n.set("knowledge_domain",e.knowledge_domain),e.limit!=null&&n.set("limit",String(e.limit)),e.offset!=null&&n.set("offset",String(e.offset));const s=n.toString();return o({queryKey:["agents",e],queryFn:()=>t(`/agents${s?`?${s}`:""}`)})}function y(e){return o({queryKey:["agents",e],queryFn:()=>t(`/agents/${e}`),enabled:!!e})}function c(){const e=u();return a({mutationFn:n=>t("/agents",{method:"POST",body:JSON.stringify(n)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function m(){const e=u();return a({mutationFn:({id:n,...s})=>t(`/agents/${n}`,{method:"PUT",body:JSON.stringify(s)}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}function d(){const e=u();return a({mutationFn:n=>t(`/agents/${n}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["agents"]})}})}export{y as a,m as b,d as c,c as d,g as u};
2
+ //# sourceMappingURL=agents-zM43d5Yf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-xstNkF6c.js","sources":["../../src/api/agents.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface AgentCapability {\n serverId: string;\n toolNames?: string[];\n}\n\nexport interface AgentTrigger {\n event: string;\n filter?: Record<string, any>;\n}\n\nexport interface AgentSchedule {\n cron: string;\n workflow_type: string;\n envelope?: Record<string, any>;\n execute_as?: string;\n}\n\nexport interface AgentBehaviors {\n cron?: string;\n triggers?: AgentTrigger[];\n schedules?: AgentSchedule[];\n escalationRules?: Record<string, any>;\n}\n\nexport interface Agent {\n /** Agent identifier — human-readable kebab-case name (e.g. 'content-triage') */\n id: string;\n description?: string;\n status: 'inactive' | 'active' | 'paused' | 'error';\n user_id?: string;\n knowledge_domain?: string;\n capabilities: AgentCapability[];\n behaviors: AgentBehaviors;\n goals?: string;\n rules?: string;\n workflow_type?: string;\n pipeline_id?: string;\n metadata: Record<string, any>;\n last_run_at?: string;\n subscription_count?: number;\n sub_topics?: string[];\n created_at: string;\n updated_at: string;\n stats?: {\n knowledge_count: number;\n escalation_count: number;\n last_execution_at?: string;\n };\n}\n\ninterface AgentListResponse {\n agents: Agent[];\n total: number;\n}\n\ninterface AgentFilters {\n status?: string;\n knowledge_domain?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useAgents(filters: AgentFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.knowledge_domain) params.set('knowledge_domain', filters.knowledge_domain);\n if (filters.limit != null) params.set('limit', String(filters.limit));\n if (filters.offset != null) params.set('offset', String(filters.offset));\n const qs = params.toString();\n\n return useQuery<AgentListResponse>({\n queryKey: ['agents', filters],\n queryFn: () => apiFetch(`/agents${qs ? `?${qs}` : ''}`),\n });\n}\n\nexport function useAgent(id: string | null) {\n return useQuery<Agent>({\n queryKey: ['agents', id],\n queryFn: () => apiFetch(`/agents/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, Partial<Agent> & { id: string }>({\n mutationFn: (body) =>\n apiFetch('/agents', {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useUpdateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, { id: string } & Partial<Agent>>({\n mutationFn: ({ id, ...body }) =>\n apiFetch(`/agents/${id}`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useDeleteAgent() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean }, Error, string>({\n mutationFn: (id) =>\n apiFetch(`/agents/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n"],"names":["useAgents","filters","params","qs","useQuery","apiFetch","useAgent","id","useCreateAgent","queryClient","useQueryClient","useMutation","body","useUpdateAgent","useDeleteAgent"],"mappings":"qGAiEO,SAASA,EAAUC,EAAwB,GAAI,CACpD,MAAMC,EAAS,IAAI,gBACfD,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,kBAAkBC,EAAO,IAAI,mBAAoBD,EAAQ,gBAAgB,EACjFA,EAAQ,OAAS,MAAMC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EAChEA,EAAQ,QAAU,MAAMC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EACvE,MAAME,EAAKD,EAAO,SAAA,EAElB,OAAOE,EAA4B,CACjC,SAAU,CAAC,SAAUH,CAAO,EAC5B,QAAS,IAAMI,EAAS,UAAUF,EAAK,IAAIA,CAAE,GAAK,EAAE,EAAE,CAAA,CACvD,CACH,CAEO,SAASG,EAASC,EAAmB,CAC1C,OAAOH,EAAgB,CACrB,SAAU,CAAC,SAAUG,CAAE,EACvB,QAAS,IAAMF,EAAS,WAAWE,CAAE,EAAE,EACvC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAiB,CAC/B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAaC,GACXP,EAAS,UAAW,CAClB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASI,GAAiB,CAC/B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACpBP,EAAS,WAAWE,CAAE,GAAI,CACxB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASK,GAAiB,CAC/B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAiD,CACtD,WAAaJ,GACXF,EAAS,WAAWE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAChD,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH"}
1
+ {"version":3,"file":"agents-zM43d5Yf.js","sources":["../../src/api/agents.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface AgentCapability {\n serverId: string;\n toolNames?: string[];\n}\n\nexport interface AgentTrigger {\n event: string;\n filter?: Record<string, any>;\n}\n\nexport interface AgentSchedule {\n cron: string;\n workflow_type: string;\n envelope?: Record<string, any>;\n execute_as?: string;\n}\n\nexport interface AgentBehaviors {\n cron?: string;\n triggers?: AgentTrigger[];\n schedules?: AgentSchedule[];\n escalationRules?: Record<string, any>;\n}\n\nexport interface Agent {\n /** Agent identifier — human-readable kebab-case name (e.g. 'content-triage') */\n id: string;\n description?: string;\n status: 'inactive' | 'active' | 'paused' | 'error';\n user_id?: string;\n knowledge_domain?: string;\n capabilities: AgentCapability[];\n behaviors: AgentBehaviors;\n goals?: string;\n rules?: string;\n workflow_type?: string;\n pipeline_id?: string;\n metadata: Record<string, any>;\n last_run_at?: string;\n subscription_count?: number;\n sub_topics?: string[];\n created_at: string;\n updated_at: string;\n stats?: {\n knowledge_count: number;\n escalation_count: number;\n last_execution_at?: string;\n };\n}\n\ninterface AgentListResponse {\n agents: Agent[];\n total: number;\n}\n\ninterface AgentFilters {\n status?: string;\n knowledge_domain?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useAgents(filters: AgentFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.knowledge_domain) params.set('knowledge_domain', filters.knowledge_domain);\n if (filters.limit != null) params.set('limit', String(filters.limit));\n if (filters.offset != null) params.set('offset', String(filters.offset));\n const qs = params.toString();\n\n return useQuery<AgentListResponse>({\n queryKey: ['agents', filters],\n queryFn: () => apiFetch(`/agents${qs ? `?${qs}` : ''}`),\n });\n}\n\nexport function useAgent(id: string | null) {\n return useQuery<Agent>({\n queryKey: ['agents', id],\n queryFn: () => apiFetch(`/agents/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, Partial<Agent> & { id: string }>({\n mutationFn: (body) =>\n apiFetch('/agents', {\n method: 'POST',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useUpdateAgent() {\n const queryClient = useQueryClient();\n return useMutation<Agent, Error, { id: string } & Partial<Agent>>({\n mutationFn: ({ id, ...body }) =>\n apiFetch(`/agents/${id}`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n\nexport function useDeleteAgent() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean }, Error, string>({\n mutationFn: (id) =>\n apiFetch(`/agents/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['agents'] });\n },\n });\n}\n"],"names":["useAgents","filters","params","qs","useQuery","apiFetch","useAgent","id","useCreateAgent","queryClient","useQueryClient","useMutation","body","useUpdateAgent","useDeleteAgent"],"mappings":"qGAiEO,SAASA,EAAUC,EAAwB,GAAI,CACpD,MAAMC,EAAS,IAAI,gBACfD,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,kBAAkBC,EAAO,IAAI,mBAAoBD,EAAQ,gBAAgB,EACjFA,EAAQ,OAAS,MAAMC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EAChEA,EAAQ,QAAU,MAAMC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EACvE,MAAME,EAAKD,EAAO,SAAA,EAElB,OAAOE,EAA4B,CACjC,SAAU,CAAC,SAAUH,CAAO,EAC5B,QAAS,IAAMI,EAAS,UAAUF,EAAK,IAAIA,CAAE,GAAK,EAAE,EAAE,CAAA,CACvD,CACH,CAEO,SAASG,EAASC,EAAmB,CAC1C,OAAOH,EAAgB,CACrB,SAAU,CAAC,SAAUG,CAAE,EACvB,QAAS,IAAMF,EAAS,WAAWE,CAAE,EAAE,EACvC,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAiB,CAC/B,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAaC,GACXP,EAAS,UAAW,CAClB,OAAQ,OACR,KAAM,KAAK,UAAUO,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASI,GAAiB,CAC/B,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAA2D,CAChE,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACpBP,EAAS,WAAWE,CAAE,GAAI,CACxB,OAAQ,MACR,KAAM,KAAK,UAAUK,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH,CAEO,SAASK,GAAiB,CAC/B,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAiD,CACtD,WAAaJ,GACXF,EAAS,WAAWE,CAAE,GAAI,CAAE,OAAQ,SAAU,EAChD,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,QAAQ,EAAG,CACxD,CAAA,CACD,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-D1xVY4JR.js";function y(e={}){const t=new URLSearchParams;return e.limit&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),a({queryKey:["bots",e],queryFn:()=>n(`/bot-accounts?${t}`)})}function d(e){return a({queryKey:["bots",e,"api-keys"],queryFn:()=>n(`/bot-accounts/${e}/api-keys`),enabled:!!e})}function b(){const e=s();return u({mutationFn:t=>n("/bot-accounts",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function m(){const e=s();return u({mutationFn:({id:t,...o})=>n(`/bot-accounts/${t}`,{method:"PUT",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function f(){const e=s();return u({mutationFn:t=>n(`/bot-accounts/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function l(){const e=s();return u({mutationFn:({botId:t,name:o,scopes:i})=>n(`/bot-accounts/${t}/api-keys`,{method:"POST",body:JSON.stringify({name:o,scopes:i})}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function q(){const e=s();return u({mutationFn:({botId:t,keyId:o})=>n(`/bot-accounts/${t}/api-keys/${o}`,{method:"DELETE"}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function S(){const e=s();return u({mutationFn:({botId:t,role:o,type:i})=>n(`/bot-accounts/${t}/roles`,{method:"POST",body:JSON.stringify({role:o,type:i})}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function p(){const e=s();return u({mutationFn:({botId:t,role:o})=>n(`/bot-accounts/${t}/roles/${encodeURIComponent(o)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}export{m as a,d as b,l as c,q as d,S as e,p as f,f as g,y as h,b as u};
2
- //# sourceMappingURL=bots-BztAI0s_.js.map
1
+ import{u as a,b as s,c as u}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-DE0r9SEX.js";function y(e={}){const t=new URLSearchParams;return e.limit&&t.set("limit",String(e.limit)),e.offset!==void 0&&t.set("offset",String(e.offset)),a({queryKey:["bots",e],queryFn:()=>n(`/bot-accounts?${t}`)})}function d(e){return a({queryKey:["bots",e,"api-keys"],queryFn:()=>n(`/bot-accounts/${e}/api-keys`),enabled:!!e})}function b(){const e=s();return u({mutationFn:t=>n("/bot-accounts",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function m(){const e=s();return u({mutationFn:({id:t,...o})=>n(`/bot-accounts/${t}`,{method:"PUT",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function f(){const e=s();return u({mutationFn:t=>n(`/bot-accounts/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function l(){const e=s();return u({mutationFn:({botId:t,name:o,scopes:i})=>n(`/bot-accounts/${t}/api-keys`,{method:"POST",body:JSON.stringify({name:o,scopes:i})}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function q(){const e=s();return u({mutationFn:({botId:t,keyId:o})=>n(`/bot-accounts/${t}/api-keys/${o}`,{method:"DELETE"}),onSuccess:(t,o)=>{e.invalidateQueries({queryKey:["bots",o.botId,"api-keys"]})}})}function S(){const e=s();return u({mutationFn:({botId:t,role:o,type:i})=>n(`/bot-accounts/${t}/roles`,{method:"POST",body:JSON.stringify({role:o,type:i})}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}function p(){const e=s();return u({mutationFn:({botId:t,role:o})=>n(`/bot-accounts/${t}/roles/${encodeURIComponent(o)}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["bots"]})}})}export{m as a,d as b,l as c,q as d,S as e,p as f,f as g,y as h,b as u};
2
+ //# sourceMappingURL=bots-D5BasOGz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bots-BztAI0s_.js","sources":["../../src/api/bots.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { BotRecord, BotApiKeyRecord } from './types';\nimport type { LTRoleType } from './types';\n\ninterface BotListResponse {\n bots: BotRecord[];\n total: number;\n}\n\ninterface BotFilters {\n limit?: number;\n offset?: number;\n}\n\n// ── Query hooks ──────────────────────────────────────────────────────────────\n\nexport function useBots(filters: BotFilters = {}) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<BotListResponse>({\n queryKey: ['bots', filters],\n queryFn: () => apiFetch(`/bot-accounts?${params}`),\n });\n}\n\nexport function useBotApiKeys(botId: string) {\n return useQuery<{ keys: BotApiKeyRecord[] }>({\n queryKey: ['bots', botId, 'api-keys'],\n queryFn: () => apiFetch(`/bot-accounts/${botId}/api-keys`),\n enabled: !!botId,\n });\n}\n\n// ── Mutation hooks ───────────────────────────────────────────────────────────\n\nexport function useCreateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n name: string;\n description?: string;\n display_name?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/bot-accounts', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useUpdateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n display_name?: string;\n description?: string;\n status?: string;\n }) =>\n apiFetch(`/bot-accounts/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useDeleteBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/bot-accounts/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useCreateBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n name,\n scopes,\n }: {\n botId: string;\n name: string;\n scopes?: string[];\n }) =>\n apiFetch<{ id: string; rawKey: string }>(`/bot-accounts/${botId}/api-keys`, {\n method: 'POST',\n body: JSON.stringify({ name, scopes }),\n }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useRevokeBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, keyId }: { botId: string; keyId: string }) =>\n apiFetch(`/bot-accounts/${botId}/api-keys/${keyId}`, { method: 'DELETE' }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useAddBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n role,\n type,\n }: {\n botId: string;\n role: string;\n type: LTRoleType;\n }) =>\n apiFetch(`/bot-accounts/${botId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useRemoveBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, role }: { botId: string; role: string }) =>\n apiFetch(`/bot-accounts/${botId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n"],"names":["useBots","filters","params","useQuery","apiFetch","useBotApiKeys","botId","useCreateBot","queryClient","useQueryClient","useMutation","data","useUpdateBot","id","useDeleteBot","useCreateBotApiKey","name","scopes","_data","vars","useRevokeBotApiKey","keyId","useAddBotRole","role","type","useRemoveBotRole"],"mappings":"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"}
1
+ {"version":3,"file":"bots-D5BasOGz.js","sources":["../../src/api/bots.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { BotRecord, BotApiKeyRecord } from './types';\nimport type { LTRoleType } from './types';\n\ninterface BotListResponse {\n bots: BotRecord[];\n total: number;\n}\n\ninterface BotFilters {\n limit?: number;\n offset?: number;\n}\n\n// ── Query hooks ──────────────────────────────────────────────────────────────\n\nexport function useBots(filters: BotFilters = {}) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<BotListResponse>({\n queryKey: ['bots', filters],\n queryFn: () => apiFetch(`/bot-accounts?${params}`),\n });\n}\n\nexport function useBotApiKeys(botId: string) {\n return useQuery<{ keys: BotApiKeyRecord[] }>({\n queryKey: ['bots', botId, 'api-keys'],\n queryFn: () => apiFetch(`/bot-accounts/${botId}/api-keys`),\n enabled: !!botId,\n });\n}\n\n// ── Mutation hooks ───────────────────────────────────────────────────────────\n\nexport function useCreateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (data: {\n name: string;\n description?: string;\n display_name?: string;\n roles?: { role: string; type: LTRoleType }[];\n }) =>\n apiFetch('/bot-accounts', {\n method: 'POST',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useUpdateBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n ...data\n }: {\n id: string;\n display_name?: string;\n description?: string;\n status?: string;\n }) =>\n apiFetch(`/bot-accounts/${id}`, {\n method: 'PUT',\n body: JSON.stringify(data),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useDeleteBot() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch(`/bot-accounts/${id}`, { method: 'DELETE' }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useCreateBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n name,\n scopes,\n }: {\n botId: string;\n name: string;\n scopes?: string[];\n }) =>\n apiFetch<{ id: string; rawKey: string }>(`/bot-accounts/${botId}/api-keys`, {\n method: 'POST',\n body: JSON.stringify({ name, scopes }),\n }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useRevokeBotApiKey() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, keyId }: { botId: string; keyId: string }) =>\n apiFetch(`/bot-accounts/${botId}/api-keys/${keyId}`, { method: 'DELETE' }),\n onSuccess: (_data, vars) => {\n queryClient.invalidateQueries({ queryKey: ['bots', vars.botId, 'api-keys'] });\n },\n });\n}\n\nexport function useAddBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n botId,\n role,\n type,\n }: {\n botId: string;\n role: string;\n type: LTRoleType;\n }) =>\n apiFetch(`/bot-accounts/${botId}/roles`, {\n method: 'POST',\n body: JSON.stringify({ role, type }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n\nexport function useRemoveBotRole() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ botId, role }: { botId: string; role: string }) =>\n apiFetch(`/bot-accounts/${botId}/roles/${encodeURIComponent(role)}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['bots'] });\n },\n });\n}\n"],"names":["useBots","filters","params","useQuery","apiFetch","useBotApiKeys","botId","useCreateBot","queryClient","useQueryClient","useMutation","data","useUpdateBot","id","useDeleteBot","useCreateBotApiKey","name","scopes","_data","vars","useRevokeBotApiKey","keyId","useAddBotRole","role","type","useRemoveBotRole"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-D1xVY4JR.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
2
- //# sourceMappingURL=capabilities-CEDwtxNL.js.map
1
+ import{u as i}from"./vendor-query-B2UbickB.js";import{d as e}from"./index-DE0r9SEX.js";function t(){return i({queryKey:["capabilities"],queryFn:()=>e("/capabilities")})}export{t as u};
2
+ //# sourceMappingURL=capabilities-BT3PW9CZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities-CEDwtxNL.js","sources":["../../src/api/capabilities.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface CapabilityTool {\n name: string;\n description: string;\n inputSchema: Record<string, any>;\n serverName: string;\n serverId: string;\n}\n\nexport interface CapabilityCategory {\n name: string;\n tools: CapabilityTool[];\n}\n\nexport interface CapabilitiesResponse {\n categories: CapabilityCategory[];\n totalTools: number;\n}\n\nexport function useCapabilities() {\n return useQuery<CapabilitiesResponse>({\n queryKey: ['capabilities'],\n queryFn: () => apiFetch('/capabilities'),\n });\n}\n"],"names":["useCapabilities","useQuery","apiFetch"],"mappings":"uFAqBO,SAASA,GAAkB,CAChC,OAAOC,EAA+B,CACpC,SAAU,CAAC,cAAc,EACzB,QAAS,IAAMC,EAAS,eAAe,CAAA,CACxC,CACH"}
1
+ {"version":3,"file":"capabilities-BT3PW9CZ.js","sources":["../../src/api/capabilities.ts"],"sourcesContent":["import { useQuery } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\nexport interface CapabilityTool {\n name: string;\n description: string;\n inputSchema: Record<string, any>;\n serverName: string;\n serverId: string;\n}\n\nexport interface CapabilityCategory {\n name: string;\n tools: CapabilityTool[];\n}\n\nexport interface CapabilitiesResponse {\n categories: CapabilityCategory[];\n totalTools: number;\n}\n\nexport function useCapabilities() {\n return useQuery<CapabilitiesResponse>({\n queryKey: ['capabilities'],\n queryFn: () => apiFetch('/capabilities'),\n });\n}\n"],"names":["useCapabilities","useQuery","apiFetch"],"mappings":"uFAqBO,SAASA,GAAkB,CAChC,OAAOC,EAA+B,CACpC,SAAU,CAAC,cAAc,EACzB,QAAS,IAAMC,EAAS,eAAe,CAAA,CACxC,CACH"}
@@ -1,2 +1,2 @@
1
- import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-D1xVY4JR.js";function s(){return n("/controlplane/apps")}function c(e){return n(`/controlplane/rollcall?app_id=${encodeURIComponent(e)}`)}function i(e){return n("/controlplane/throttle",{method:"POST",body:JSON.stringify(e)})}function p(e){return n("/controlplane/subscribe",{method:"POST",body:JSON.stringify(e)})}function m(e,t,u){let r=`/controlplane/streams?app_id=${encodeURIComponent(e)}&duration=${encodeURIComponent(t)}`;return n(r)}function b(){return o({queryKey:["controlplane","apps"],queryFn:s,staleTime:6e4})}function h(e,t){return o({queryKey:["controlplane","rollcall",e],queryFn:()=>c(e),enabled:!!e,refetchInterval:t})}function S(){const e=a();return l({mutationFn:i,onSuccess:()=>{setTimeout(()=>{e.invalidateQueries({queryKey:["controlplane","rollcall"]})},1500)}})}function d(e,t,u,r){return o({queryKey:["controlplane","streams",e,t,""],queryFn:()=>m(e,t),enabled:!!e,staleTime:15e3,refetchInterval:r})}function q(){return l({mutationFn:p})}export{S as a,q as b,h as c,d,b as u};
2
- //# sourceMappingURL=controlplane-BlGEsRKe.js.map
1
+ import{u as o,c as l,b as a}from"./vendor-query-B2UbickB.js";import{d as n}from"./index-DE0r9SEX.js";function s(){return n("/controlplane/apps")}function c(e){return n(`/controlplane/rollcall?app_id=${encodeURIComponent(e)}`)}function i(e){return n("/controlplane/throttle",{method:"POST",body:JSON.stringify(e)})}function p(e){return n("/controlplane/subscribe",{method:"POST",body:JSON.stringify(e)})}function m(e,t,u){let r=`/controlplane/streams?app_id=${encodeURIComponent(e)}&duration=${encodeURIComponent(t)}`;return n(r)}function b(){return o({queryKey:["controlplane","apps"],queryFn:s,staleTime:6e4})}function h(e,t){return o({queryKey:["controlplane","rollcall",e],queryFn:()=>c(e),enabled:!!e,refetchInterval:t})}function S(){const e=a();return l({mutationFn:i,onSuccess:()=>{setTimeout(()=>{e.invalidateQueries({queryKey:["controlplane","rollcall"]})},1500)}})}function d(e,t,u,r){return o({queryKey:["controlplane","streams",e,t,""],queryFn:()=>m(e,t),enabled:!!e,staleTime:15e3,refetchInterval:r})}function q(){return l({mutationFn:p})}export{S as a,q as b,h as c,d,b as u};
2
+ //# sourceMappingURL=controlplane-NpJr49rN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controlplane-BlGEsRKe.js","sources":["../../src/api/controlplane.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ControlPlaneApp {\n appId: string;\n version: string;\n}\n\nexport interface QuorumProfile {\n namespace: string;\n app_id: string;\n engine_id: string;\n entity?: string;\n worker_topic?: string;\n stream?: string;\n stream_depth?: number;\n counts?: Record<string, number>;\n inited?: string;\n timestamp?: string;\n throttle?: number;\n reclaimDelay?: number;\n reclaimCount?: number;\n system?: {\n TotalMemoryGB: string;\n FreeMemoryGB: string;\n UsedMemoryGB: string;\n CPULoad: Array<Record<string, string>>;\n NetworkStats: Array<Record<string, unknown>>;\n };\n is_scout?: boolean;\n signature?: string;\n}\n\n// ── API functions ───────────────────────────────────────────────────────────\n\nfunction fetchApps() {\n return apiFetch<{ apps: ControlPlaneApp[] }>('/controlplane/apps');\n}\n\nfunction fetchRollCall(appId: string) {\n return apiFetch<{ profiles: QuorumProfile[] }>(`/controlplane/rollcall?app_id=${encodeURIComponent(appId)}`);\n}\n\nfunction postThrottle(body: { appId: string; throttle: number; topic?: string; guid?: string; scope?: 'engines' | 'workers' | 'all' }) {\n return apiFetch<{ success: boolean }>('/controlplane/throttle', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nfunction postSubscribe(body: { appId: string }) {\n return apiFetch<{ subscribed: boolean; appId: string }>('/controlplane/subscribe', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nexport interface StreamStats {\n pending: number;\n processed: number;\n byStream: Array<{ stream_type: 'engine' | 'worker'; stream_name: string; count: number }>;\n}\n\nfunction fetchStreamStats(appId: string, duration: string, stream?: string) {\n let url = `/controlplane/streams?app_id=${encodeURIComponent(appId)}&duration=${encodeURIComponent(duration)}`;\n if (stream) url += `&stream=${encodeURIComponent(stream)}`;\n return apiFetch<StreamStats>(url);\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\nexport function useControlPlaneApps() {\n return useQuery({\n queryKey: ['controlplane', 'apps'],\n queryFn: fetchApps,\n staleTime: 60_000,\n });\n}\n\nexport function useRollCall(appId: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'rollcall', appId],\n queryFn: () => fetchRollCall(appId),\n enabled: !!appId,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useThrottle() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: postThrottle,\n onSuccess: () => {\n // Delay refetch so mesh members have time to process the throttle message\n setTimeout(() => {\n qc.invalidateQueries({ queryKey: ['controlplane', 'rollcall'] });\n }, 1500);\n },\n });\n}\n\nexport function useStreamStats(appId: string, duration: string, stream?: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'streams', appId, duration, stream ?? ''],\n queryFn: () => fetchStreamStats(appId, duration, stream),\n enabled: !!appId,\n staleTime: 15_000,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useSubscribeMesh() {\n return useMutation({\n mutationFn: postSubscribe,\n });\n}\n"],"names":["fetchApps","apiFetch","fetchRollCall","appId","postThrottle","body","postSubscribe","fetchStreamStats","duration","stream","url","useControlPlaneApps","useQuery","useRollCall","refetchInterval","useThrottle","qc","useQueryClient","useMutation","useStreamStats","useSubscribeMesh"],"mappings":"qGAqCA,SAASA,GAAY,CACnB,OAAOC,EAAsC,oBAAoB,CACnE,CAEA,SAASC,EAAcC,EAAe,CACpC,OAAOF,EAAwC,iCAAiC,mBAAmBE,CAAK,CAAC,EAAE,CAC7G,CAEA,SAASC,EAAaC,EAAiH,CACrI,OAAOJ,EAA+B,yBAA0B,CAC9D,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAEA,SAASC,EAAcD,EAAyB,CAC9C,OAAOJ,EAAiD,0BAA2B,CACjF,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAQA,SAASE,EAAiBJ,EAAeK,EAAkBC,EAAiB,CAC1E,IAAIC,EAAM,gCAAgC,mBAAmBP,CAAK,CAAC,aAAa,mBAAmBK,CAAQ,CAAC,GAE5G,OAAOP,EAAsBS,CAAG,CAClC,CAIO,SAASC,GAAsB,CACpC,OAAOC,EAAS,CACd,SAAU,CAAC,eAAgB,MAAM,EACjC,QAASZ,EACT,UAAW,GAAA,CACZ,CACH,CAEO,SAASa,EAAYV,EAAeW,EAAkC,CAC3E,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,WAAYT,CAAK,EAC5C,QAAS,IAAMD,EAAcC,CAAK,EAClC,QAAS,CAAC,CAACA,EACX,gBAAiBW,CAAmB,CACrC,CACH,CAEO,SAASC,GAAc,CAC5B,MAAMC,EAAKC,EAAA,EACX,OAAOC,EAAY,CACjB,WAAYd,EACZ,UAAW,IAAM,CAEf,WAAW,IAAM,CACfY,EAAG,kBAAkB,CAAE,SAAU,CAAC,eAAgB,UAAU,EAAG,CACjE,EAAG,IAAI,CACT,CAAA,CACD,CACH,CAEO,SAASG,EAAehB,EAAeK,EAAkBC,EAAiBK,EAAkC,CACjH,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,UAAWT,EAAOK,EAAoB,EAAE,EACnE,QAAS,IAAMD,EAAiBJ,EAAOK,CAAgB,EACvD,QAAS,CAAC,CAACL,EACX,UAAW,KACX,gBAAiBW,CAAmB,CACrC,CACH,CAEO,SAASM,GAAmB,CACjC,OAAOF,EAAY,CACjB,WAAYZ,CAAA,CACb,CACH"}
1
+ {"version":3,"file":"controlplane-NpJr49rN.js","sources":["../../src/api/controlplane.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\n\n// ── Types ───────────────────────────────────────────────────────────────────\n\nexport interface ControlPlaneApp {\n appId: string;\n version: string;\n}\n\nexport interface QuorumProfile {\n namespace: string;\n app_id: string;\n engine_id: string;\n entity?: string;\n worker_topic?: string;\n stream?: string;\n stream_depth?: number;\n counts?: Record<string, number>;\n inited?: string;\n timestamp?: string;\n throttle?: number;\n reclaimDelay?: number;\n reclaimCount?: number;\n system?: {\n TotalMemoryGB: string;\n FreeMemoryGB: string;\n UsedMemoryGB: string;\n CPULoad: Array<Record<string, string>>;\n NetworkStats: Array<Record<string, unknown>>;\n };\n is_scout?: boolean;\n signature?: string;\n}\n\n// ── API functions ───────────────────────────────────────────────────────────\n\nfunction fetchApps() {\n return apiFetch<{ apps: ControlPlaneApp[] }>('/controlplane/apps');\n}\n\nfunction fetchRollCall(appId: string) {\n return apiFetch<{ profiles: QuorumProfile[] }>(`/controlplane/rollcall?app_id=${encodeURIComponent(appId)}`);\n}\n\nfunction postThrottle(body: { appId: string; throttle: number; topic?: string; guid?: string; scope?: 'engines' | 'workers' | 'all' }) {\n return apiFetch<{ success: boolean }>('/controlplane/throttle', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nfunction postSubscribe(body: { appId: string }) {\n return apiFetch<{ subscribed: boolean; appId: string }>('/controlplane/subscribe', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n}\n\nexport interface StreamStats {\n pending: number;\n processed: number;\n byStream: Array<{ stream_type: 'engine' | 'worker'; stream_name: string; count: number }>;\n}\n\nfunction fetchStreamStats(appId: string, duration: string, stream?: string) {\n let url = `/controlplane/streams?app_id=${encodeURIComponent(appId)}&duration=${encodeURIComponent(duration)}`;\n if (stream) url += `&stream=${encodeURIComponent(stream)}`;\n return apiFetch<StreamStats>(url);\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\nexport function useControlPlaneApps() {\n return useQuery({\n queryKey: ['controlplane', 'apps'],\n queryFn: fetchApps,\n staleTime: 60_000,\n });\n}\n\nexport function useRollCall(appId: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'rollcall', appId],\n queryFn: () => fetchRollCall(appId),\n enabled: !!appId,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useThrottle() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: postThrottle,\n onSuccess: () => {\n // Delay refetch so mesh members have time to process the throttle message\n setTimeout(() => {\n qc.invalidateQueries({ queryKey: ['controlplane', 'rollcall'] });\n }, 1500);\n },\n });\n}\n\nexport function useStreamStats(appId: string, duration: string, stream?: string, refetchInterval?: number | false) {\n return useQuery({\n queryKey: ['controlplane', 'streams', appId, duration, stream ?? ''],\n queryFn: () => fetchStreamStats(appId, duration, stream),\n enabled: !!appId,\n staleTime: 15_000,\n refetchInterval: refetchInterval ?? false,\n });\n}\n\nexport function useSubscribeMesh() {\n return useMutation({\n mutationFn: postSubscribe,\n });\n}\n"],"names":["fetchApps","apiFetch","fetchRollCall","appId","postThrottle","body","postSubscribe","fetchStreamStats","duration","stream","url","useControlPlaneApps","useQuery","useRollCall","refetchInterval","useThrottle","qc","useQueryClient","useMutation","useStreamStats","useSubscribeMesh"],"mappings":"qGAqCA,SAASA,GAAY,CACnB,OAAOC,EAAsC,oBAAoB,CACnE,CAEA,SAASC,EAAcC,EAAe,CACpC,OAAOF,EAAwC,iCAAiC,mBAAmBE,CAAK,CAAC,EAAE,CAC7G,CAEA,SAASC,EAAaC,EAAiH,CACrI,OAAOJ,EAA+B,yBAA0B,CAC9D,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAEA,SAASC,EAAcD,EAAyB,CAC9C,OAAOJ,EAAiD,0BAA2B,CACjF,OAAQ,OACR,KAAM,KAAK,UAAUI,CAAI,CAAA,CAC1B,CACH,CAQA,SAASE,EAAiBJ,EAAeK,EAAkBC,EAAiB,CAC1E,IAAIC,EAAM,gCAAgC,mBAAmBP,CAAK,CAAC,aAAa,mBAAmBK,CAAQ,CAAC,GAE5G,OAAOP,EAAsBS,CAAG,CAClC,CAIO,SAASC,GAAsB,CACpC,OAAOC,EAAS,CACd,SAAU,CAAC,eAAgB,MAAM,EACjC,QAASZ,EACT,UAAW,GAAA,CACZ,CACH,CAEO,SAASa,EAAYV,EAAeW,EAAkC,CAC3E,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,WAAYT,CAAK,EAC5C,QAAS,IAAMD,EAAcC,CAAK,EAClC,QAAS,CAAC,CAACA,EACX,gBAAiBW,CAAmB,CACrC,CACH,CAEO,SAASC,GAAc,CAC5B,MAAMC,EAAKC,EAAA,EACX,OAAOC,EAAY,CACjB,WAAYd,EACZ,UAAW,IAAM,CAEf,WAAW,IAAM,CACfY,EAAG,kBAAkB,CAAE,SAAU,CAAC,eAAgB,UAAU,EAAG,CACjE,EAAG,IAAI,CACT,CAAA,CACD,CACH,CAEO,SAASG,EAAehB,EAAeK,EAAkBC,EAAiBK,EAAkC,CACjH,OAAOF,EAAS,CACd,SAAU,CAAC,eAAgB,UAAWT,EAAOK,EAAoB,EAAE,EACnE,QAAS,IAAMD,EAAiBJ,EAAOK,CAAgB,EACvD,QAAS,CAAC,CAACL,EACX,UAAW,KACX,gBAAiBW,CAAmB,CACrC,CACH,CAEO,SAASM,GAAmB,CACjC,OAAOF,EAAY,CACjB,WAAYZ,CAAA,CACb,CACH"}
@@ -1,2 +1,2 @@
1
- import{a,j as r}from"./vendor-query-B2UbickB.js";import{z as l,A as c,B as m}from"./index-D1xVY4JR.js";const n=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function u(t){if(t<=0)return n[0].color;for(const e of n)if(t<e.maxMs)return e.color;return n[n.length-1].color}function w({until:t}){const[e,s]=a.useState(()=>new Date(t).getTime()-Date.now());a.useEffect(()=>{const o=setInterval(()=>{s(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(o)},[t]);const i=a.useMemo(()=>{const o=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:o.toISOString()},{label:"local",value:l(o,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return r.jsx(c,{options:i,children:r.jsx("span",{className:`text-xs font-mono ${u(e)}`,children:m(e)})})}function d(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function g(t){return!t.workflow_type}export{w as C,d as a,g as i};
2
- //# sourceMappingURL=escalation-iI4QKlP-.js.map
1
+ import{a,j as r}from"./vendor-query-B2UbickB.js";import{G as l,H as c,I as m}from"./index-DE0r9SEX.js";const n=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function u(t){if(t<=0)return n[0].color;for(const e of n)if(t<e.maxMs)return e.color;return n[n.length-1].color}function w({until:t}){const[e,s]=a.useState(()=>new Date(t).getTime()-Date.now());a.useEffect(()=>{const o=setInterval(()=>{s(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(o)},[t]);const i=a.useMemo(()=>{const o=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:o.toISOString()},{label:"local",value:l(o,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return r.jsx(c,{options:i,children:r.jsx("span",{className:`text-xs font-mono ${u(e)}`,children:m(e)})})}function d(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function g(t){return!t.workflow_type}export{w as C,d as a,g as i};
2
+ //# sourceMappingURL=escalation-DrzQolPG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"escalation-iI4QKlP-.js","sources":["../../src/components/common/display/CountdownTimer.tsx","../../src/lib/escalation.ts"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { format as fnsFormat } from 'date-fns';\nimport { formatRemaining } from '../../../lib/format';\nimport { DateTooltip } from './DateTooltip';\n\nconst COUNTDOWN_THRESHOLDS = [\n { maxMs: 0, color: 'text-status-error' },\n { maxMs: 5 * 60 * 1000, color: 'text-status-error' },\n { maxMs: 15 * 60 * 1000, color: 'text-status-warning' },\n { maxMs: Infinity, color: 'text-text-secondary' },\n] as const;\n\nfunction countdownColor(remainingMs: number): string {\n if (remainingMs <= 0) return COUNTDOWN_THRESHOLDS[0].color;\n for (const t of COUNTDOWN_THRESHOLDS) {\n if (remainingMs < t.maxMs) return t.color;\n }\n return COUNTDOWN_THRESHOLDS[COUNTDOWN_THRESHOLDS.length - 1].color;\n}\n\nexport function CountdownTimer({ until }: { until: string }) {\n const [remaining, setRemaining] = useState(() => new Date(until).getTime() - Date.now());\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(new Date(until).getTime() - Date.now());\n }, 1000);\n return () => clearInterval(interval);\n }, [until]);\n\n const options = useMemo(() => {\n const d = new Date(until);\n return [\n { label: 'ms', value: String(Math.max(0, remaining)) },\n { label: 'until', value: d.toISOString() },\n { label: 'local', value: fnsFormat(d, 'MMM d, yyyy h:mm:ss a') },\n ];\n }, [until, remaining]);\n\n return (\n <DateTooltip options={options}>\n <span className={`text-xs font-mono ${countdownColor(remaining)}`}>\n {formatRemaining(remaining)}\n </span>\n </DateTooltip>\n );\n}\n","import type { LTEscalationRecord } from '../api/types';\n\nexport function isEffectivelyClaimed(esc: LTEscalationRecord): boolean {\n return !!(\n esc.assigned_to &&\n esc.assigned_until &&\n new Date(esc.assigned_until) > new Date()\n );\n}\n\n/** An ACK escalation has no associated workflow — it's a notification, not a task. */\nexport function isAckEscalation(esc: LTEscalationRecord): boolean {\n return !esc.workflow_type;\n}\n\nexport function isAvailable(esc: LTEscalationRecord): boolean {\n return (\n esc.status === 'pending' &&\n (!esc.assigned_to ||\n !esc.assigned_until ||\n new Date(esc.assigned_until) <= new Date())\n );\n}\n"],"names":["COUNTDOWN_THRESHOLDS","countdownColor","remainingMs","t","CountdownTimer","until","remaining","setRemaining","useState","useEffect","interval","options","useMemo","d","fnsFormat","jsx","DateTooltip","formatRemaining","isEffectivelyClaimed","esc","isAckEscalation"],"mappings":"uGAKA,MAAMA,EAAuB,CAC3B,CAAE,MAAO,EAAgB,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAS,IAAO,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAU,IAAM,MAAO,qBAAA,EAChC,CAAE,MAAO,IAAiB,MAAO,qBAAA,CACnC,EAEA,SAASC,EAAeC,EAA6B,CACnD,GAAIA,GAAe,EAAG,OAAOF,EAAqB,CAAC,EAAE,MACrD,UAAWG,KAAKH,EACd,GAAIE,EAAcC,EAAE,MAAO,OAAOA,EAAE,MAEtC,OAAOH,EAAqBA,EAAqB,OAAS,CAAC,EAAE,KAC/D,CAEO,SAASI,EAAe,CAAE,MAAAC,GAA4B,CAC3D,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,IAAM,IAAI,KAAKH,CAAK,EAAE,QAAA,EAAY,KAAK,KAAK,EAEvFI,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAW,YAAY,IAAM,CACjCH,EAAa,IAAI,KAAKF,CAAK,EAAE,UAAY,KAAK,KAAK,CACrD,EAAG,GAAI,EACP,MAAO,IAAM,cAAcK,CAAQ,CACrC,EAAG,CAACL,CAAK,CAAC,EAEV,MAAMM,EAAUC,EAAAA,QAAQ,IAAM,CAC5B,MAAMC,EAAI,IAAI,KAAKR,CAAK,EACxB,MAAO,CACL,CAAE,MAAO,KAAM,MAAO,OAAO,KAAK,IAAI,EAAGC,CAAS,CAAC,CAAA,EACnD,CAAE,MAAO,QAAS,MAAOO,EAAE,aAAY,EACvC,CAAE,MAAO,QAAS,MAAOC,EAAUD,EAAG,uBAAuB,CAAA,CAAE,CAEnE,EAAG,CAACR,EAAOC,CAAS,CAAC,EAErB,OACES,EAAAA,IAACC,EAAA,CAAY,QAAAL,EACX,SAAAI,MAAC,QAAK,UAAW,qBAAqBd,EAAeK,CAAS,CAAC,GAC5D,SAAAW,EAAgBX,CAAS,EAC5B,EACF,CAEJ,CC5CO,SAASY,EAAqBC,EAAkC,CACrE,MAAO,CAAC,EACNA,EAAI,aACJA,EAAI,gBACJ,IAAI,KAAKA,EAAI,cAAc,EAAI,IAAI,KAEvC,CAGO,SAASC,EAAgBD,EAAkC,CAChE,MAAO,CAACA,EAAI,aACd"}
1
+ {"version":3,"file":"escalation-DrzQolPG.js","sources":["../../src/components/common/display/CountdownTimer.tsx","../../src/lib/escalation.ts"],"sourcesContent":["import { useState, useEffect, useMemo } from 'react';\nimport { format as fnsFormat } from 'date-fns';\nimport { formatRemaining } from '../../../lib/format';\nimport { DateTooltip } from './DateTooltip';\n\nconst COUNTDOWN_THRESHOLDS = [\n { maxMs: 0, color: 'text-status-error' },\n { maxMs: 5 * 60 * 1000, color: 'text-status-error' },\n { maxMs: 15 * 60 * 1000, color: 'text-status-warning' },\n { maxMs: Infinity, color: 'text-text-secondary' },\n] as const;\n\nfunction countdownColor(remainingMs: number): string {\n if (remainingMs <= 0) return COUNTDOWN_THRESHOLDS[0].color;\n for (const t of COUNTDOWN_THRESHOLDS) {\n if (remainingMs < t.maxMs) return t.color;\n }\n return COUNTDOWN_THRESHOLDS[COUNTDOWN_THRESHOLDS.length - 1].color;\n}\n\nexport function CountdownTimer({ until }: { until: string }) {\n const [remaining, setRemaining] = useState(() => new Date(until).getTime() - Date.now());\n\n useEffect(() => {\n const interval = setInterval(() => {\n setRemaining(new Date(until).getTime() - Date.now());\n }, 1000);\n return () => clearInterval(interval);\n }, [until]);\n\n const options = useMemo(() => {\n const d = new Date(until);\n return [\n { label: 'ms', value: String(Math.max(0, remaining)) },\n { label: 'until', value: d.toISOString() },\n { label: 'local', value: fnsFormat(d, 'MMM d, yyyy h:mm:ss a') },\n ];\n }, [until, remaining]);\n\n return (\n <DateTooltip options={options}>\n <span className={`text-xs font-mono ${countdownColor(remaining)}`}>\n {formatRemaining(remaining)}\n </span>\n </DateTooltip>\n );\n}\n","import type { LTEscalationRecord } from '../api/types';\n\nexport function isEffectivelyClaimed(esc: LTEscalationRecord): boolean {\n return !!(\n esc.assigned_to &&\n esc.assigned_until &&\n new Date(esc.assigned_until) > new Date()\n );\n}\n\n/** An ACK escalation has no associated workflow — it's a notification, not a task. */\nexport function isAckEscalation(esc: LTEscalationRecord): boolean {\n return !esc.workflow_type;\n}\n\nexport function isAvailable(esc: LTEscalationRecord): boolean {\n return (\n esc.status === 'pending' &&\n (!esc.assigned_to ||\n !esc.assigned_until ||\n new Date(esc.assigned_until) <= new Date())\n );\n}\n"],"names":["COUNTDOWN_THRESHOLDS","countdownColor","remainingMs","t","CountdownTimer","until","remaining","setRemaining","useState","useEffect","interval","options","useMemo","d","fnsFormat","jsx","DateTooltip","formatRemaining","isEffectivelyClaimed","esc","isAckEscalation"],"mappings":"uGAKA,MAAMA,EAAuB,CAC3B,CAAE,MAAO,EAAgB,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAS,IAAO,MAAO,mBAAA,EAChC,CAAE,MAAO,IAAU,IAAM,MAAO,qBAAA,EAChC,CAAE,MAAO,IAAiB,MAAO,qBAAA,CACnC,EAEA,SAASC,EAAeC,EAA6B,CACnD,GAAIA,GAAe,EAAG,OAAOF,EAAqB,CAAC,EAAE,MACrD,UAAWG,KAAKH,EACd,GAAIE,EAAcC,EAAE,MAAO,OAAOA,EAAE,MAEtC,OAAOH,EAAqBA,EAAqB,OAAS,CAAC,EAAE,KAC/D,CAEO,SAASI,EAAe,CAAE,MAAAC,GAA4B,CAC3D,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAAAA,SAAS,IAAM,IAAI,KAAKH,CAAK,EAAE,QAAA,EAAY,KAAK,KAAK,EAEvFI,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAW,YAAY,IAAM,CACjCH,EAAa,IAAI,KAAKF,CAAK,EAAE,UAAY,KAAK,KAAK,CACrD,EAAG,GAAI,EACP,MAAO,IAAM,cAAcK,CAAQ,CACrC,EAAG,CAACL,CAAK,CAAC,EAEV,MAAMM,EAAUC,EAAAA,QAAQ,IAAM,CAC5B,MAAMC,EAAI,IAAI,KAAKR,CAAK,EACxB,MAAO,CACL,CAAE,MAAO,KAAM,MAAO,OAAO,KAAK,IAAI,EAAGC,CAAS,CAAC,CAAA,EACnD,CAAE,MAAO,QAAS,MAAOO,EAAE,aAAY,EACvC,CAAE,MAAO,QAAS,MAAOC,EAAUD,EAAG,uBAAuB,CAAA,CAAE,CAEnE,EAAG,CAACR,EAAOC,CAAS,CAAC,EAErB,OACES,EAAAA,IAACC,EAAA,CAAY,QAAAL,EACX,SAAAI,MAAC,QAAK,UAAW,qBAAqBd,EAAeK,CAAS,CAAC,GAC5D,SAAAW,EAAgBX,CAAS,EAC5B,EACF,CAEJ,CC5CO,SAASY,EAAqBC,EAAkC,CACrE,MAAO,CAAC,EACNA,EAAI,aACJA,EAAI,gBACJ,IAAI,KAAKA,EAAI,cAAc,EAAI,IAAI,KAEvC,CAGO,SAASC,EAAgBD,EAAkC,CAChE,MAAO,CAACA,EAAI,aACd"}
@@ -0,0 +1,2 @@
1
+ import{j as a,a as p}from"./vendor-query-B2UbickB.js";import{F as d,b as i,a as u}from"./FilterBar-Ck4K4rzu.js";import{P as h}from"./PriorityBadge-B4ykBH7f.js";import{R as f}from"./RolePill-BaW-30TC.js";import{W as j}from"./WorkflowPill-B66_AnaY.js";import{C as w,i as y,a as v}from"./escalation-DrzQolPG.js";import{x as N,y as b,J as g}from"./index-DE0r9SEX.js";import{a5 as k,a6 as C,a7 as o,n as _}from"./vendor-icons-Dy5Jpknf.js";const l="text-text-secondary transition-colors group-hover/row:text-text-primary";function P({row:e}){if(y(e)){const t=e.status==="resolved"?"text-status-success":"text-text-tertiary";return a.jsx(C,{className:`w-3 h-3 shrink-0 ${t}`})}return e.status==="resolved"?a.jsx(o,{className:"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success"}):e.status==="cancelled"?a.jsx(o,{className:"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error"}):v(e)?a.jsx(o,{className:"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning"}):a.jsx(o,{className:"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active"})}function T({metadata:e}){const[t,c]=p.useState(!1);if(!e||Object.keys(e).length===0)return a.jsx("span",{className:"text-[11px] text-text-tertiary",children:"—"});const r=Object.keys(e),m=`${r.slice(0,2).join(", ")}${r.length>2?` +${r.length-2}`:""}`;return a.jsxs("div",{className:"w-full",children:[a.jsxs("button",{onClick:n=>{n.stopPropagation(),c(x=>!x)},className:`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${l}`,title:t?"Collapse metadata":"Expand metadata",children:[a.jsx(_,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`}),a.jsx("span",{className:"truncate",children:`{ ${m} }`})]}),a.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${t?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:a.jsx("div",{className:"overflow-hidden",children:a.jsx("div",{className:"mt-1 overflow-x-auto",onClick:n=>n.stopPropagation(),children:a.jsx(g,{data:e,defaultCollapsed:!0})})})})]})}const D=[{key:"description",label:"Summary",render:e=>a.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[a.jsx("span",{className:"shrink-0",children:a.jsx(P,{row:e})}),a.jsx("span",{className:`truncate text-xs ${l}`,children:e.description||e.type})]}),className:"max-w-0"},{key:"workflow_type",label:"Workflow",render:e=>a.jsx(j,{type:e.workflow_type||e.type}),className:"w-40 whitespace-nowrap"},{key:"metadata",label:"Metadata",render:e=>a.jsx(T,{metadata:e.metadata}),className:"w-80 max-w-[19rem] align-top"},{key:"role",label:"Role",render:e=>a.jsx("span",{className:l,children:a.jsx(f,{role:e.role,size:"md",tone:"inherit"})}),className:"w-28"},{key:"priority",label:"Priority",render:e=>a.jsx("span",{className:l,children:a.jsx(h,{priority:e.priority,size:"sm",tone:"inherit"})}),className:"w-14",sortable:!0},{key:"created_time",label:"Created",render:e=>a.jsx("span",{className:`text-[11px] font-mono whitespace-nowrap ${l}`,title:e.created_at,children:N(e.created_at)}),className:"w-40 whitespace-nowrap"},{key:"created_at",label:"Ago",render:e=>a.jsx("span",{className:`text-xs tabular-nums ${l}`,title:e.created_at,children:b(e.created_at)}),className:"w-12 whitespace-nowrap",sortable:!0}],U={key:"expires",label:a.jsx(k,{className:"w-3.5 h-3.5 text-text-tertiary"}),render:e=>e.assigned_until?a.jsx(w,{until:e.assigned_until}):a.jsx("span",{className:"text-xs text-text-tertiary",children:"—"}),className:"w-16 whitespace-nowrap"},E=[{value:"1",label:"P1"},{value:"2",label:"P2"},{value:"3",label:"P3"},{value:"4",label:"P4"}],S=[{value:"available",label:"Available"},{value:"claimed",label:"Claimed"},{value:"resolved",label:"Resolved"},{value:"cancelled",label:"Cancelled"}];function W({filters:e,setFilter:t,roles:c,types:r,showStatus:m=!1,showSearch:n=!0,actions:x}){return a.jsxs(d,{actions:x,children:[m&&a.jsx(i,{label:"Status",value:e.status??"",onChange:s=>t("status",s),options:S}),a.jsx(i,{label:"Role",value:e.role,onChange:s=>t("role",s),options:c.map(s=>({value:s,label:s}))}),a.jsx(i,{label:"Type",value:e.type,onChange:s=>t("type",s),options:r.map(s=>({value:s,label:s}))}),a.jsx(i,{label:"Priority",value:e.priority,onChange:s=>t("priority",s),options:E}),n&&a.jsx(u,{label:"Search",value:e.search??"",onChange:s=>t("search",s),placeholder:"ID, workflow, origin…"})]})}export{D as E,U as T,W as a};
2
+ //# sourceMappingURL=escalation-columns-QzwmtD60.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalation-columns-QzwmtD60.js","sources":["../../src/pages/operator/escalation-columns.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Circle, Bell, Clock, ChevronRight } from 'lucide-react';\nimport type { Column } from '../../components/common/data/DataTable';\nimport { FilterBar, FilterSelect, FilterInput } from '../../components/common/data/FilterBar';\nimport { PriorityBadge } from '../../components/common/display/PriorityBadge';\nimport { RolePill } from '../../components/common/display/RolePill';\nimport { WorkflowPill } from '../../components/common/display/WorkflowPill';\nimport { CountdownTimer } from '../../components/common/display/CountdownTimer';\nimport { JsonViewer } from '../../components/common/data/JsonViewer';\nimport { formatAgoCompact, formatDateTime } from '../../lib/format';\nimport { isEffectivelyClaimed, isAckEscalation } from '../../lib/escalation';\nimport type { LTEscalationRecord } from '../../api/types';\n\n// Shared cell text: a consistent resting shade for every cell, sharpening to\n// the primary text colour when the row is hovered. Cells (and pills via their\n// `inherit` tone) all read this single source so the whole row darkens as one.\nconst CELL_TEXT = 'text-text-secondary transition-colors group-hover/row:text-text-primary';\n\n/** Status dot — rendered inline before summary. */\nfunction StatusDot({ row }: { row: LTEscalationRecord }) {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 shrink-0 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-success text-status-success\" />;\n }\n if (row.status === 'cancelled') {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-error text-status-error\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 shrink-0 fill-status-active text-status-active\" />;\n}\n\n/**\n * Metadata cell — a compact `{ key, key +N }` preview that expands inline to the\n * pretty-printed JSON. The same metadata the faceted query filters on, visible per row.\n */\nfunction MetadataCell({ metadata }: { metadata: Record<string, unknown> | null }) {\n const [open, setOpen] = useState(false);\n if (!metadata || Object.keys(metadata).length === 0) {\n return <span className=\"text-[11px] text-text-tertiary\">—</span>;\n }\n const keys = Object.keys(metadata);\n const preview = `${keys.slice(0, 2).join(', ')}${keys.length > 2 ? ` +${keys.length - 2}` : ''}`;\n // Width is fixed by the wrapper so toggling never changes the column width —\n // the JSON viewer reveals with an animated row-height transition, and long\n // lines scroll horizontally inside the cell rather than widening it.\n return (\n <div className=\"w-full\">\n <button\n onClick={(e) => { e.stopPropagation(); setOpen((v) => !v); }}\n className={`inline-flex max-w-full items-center gap-1 font-mono text-[11px] ${CELL_TEXT}`}\n title={open ? 'Collapse metadata' : 'Expand metadata'}\n >\n <ChevronRight className={`h-3 w-3 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`} />\n <span className=\"truncate\">{`{ ${preview} }`}</span>\n </button>\n <div\n className={`grid transition-[grid-template-rows] duration-200 ease-out ${open ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'}`}\n >\n <div className=\"overflow-hidden\">\n <div className=\"mt-1 overflow-x-auto\" onClick={(e) => e.stopPropagation()}>\n {/* defaultCollapsed → root expanded, nested objects collapsed (one level). */}\n <JsonViewer data={metadata} defaultCollapsed />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** Base columns shared by all escalation list pages. */\nexport const ESCALATION_COLUMNS: Column<LTEscalationRecord>[] = [\n {\n key: 'description',\n label: 'Summary',\n render: (row) => (\n <div className=\"flex items-center gap-2 overflow-hidden\">\n <span className=\"shrink-0\"><StatusDot row={row} /></span>\n <span className={`truncate text-xs ${CELL_TEXT}`}>{row.description || row.type}</span>\n </div>\n ),\n className: 'max-w-0',\n },\n {\n key: 'workflow_type',\n label: 'Workflow',\n // The workflow function name (e.g. `richForm`, `basicSignal`) lives in\n // workflow_type; `type` is the escalation category. Fall back to type for\n // standalone escalations with no workflow.\n render: (row) => <WorkflowPill type={row.workflow_type || row.type} />,\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'metadata',\n label: 'Metadata',\n render: (row) => <MetadataCell metadata={row.metadata} />,\n // Fixed width — never grows on expand (the viewer reveals via row-height).\n // Given extra room (borrowed from priority/ago/actions) so JSON wraps less.\n className: 'w-80 max-w-[19rem] align-top',\n },\n {\n key: 'role',\n label: 'Role',\n render: (row) => (\n <span className={CELL_TEXT}>\n <RolePill role={row.role} size=\"md\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-28',\n },\n {\n key: 'priority',\n label: 'Priority',\n render: (row) => (\n <span className={CELL_TEXT}>\n <PriorityBadge priority={row.priority} size=\"sm\" tone=\"inherit\" />\n </span>\n ),\n className: 'w-14',\n sortable: true,\n },\n {\n key: 'created_time',\n label: 'Created',\n render: (row) => (\n <span className={`text-[11px] font-mono whitespace-nowrap ${CELL_TEXT}`} title={row.created_at}>\n {formatDateTime(row.created_at)}\n </span>\n ),\n className: 'w-40 whitespace-nowrap',\n },\n {\n key: 'created_at',\n label: 'Ago',\n render: (row) => (\n <span className={`text-xs tabular-nums ${CELL_TEXT}`} title={row.created_at}>\n {formatAgoCompact(row.created_at)}\n </span>\n ),\n className: 'w-12 whitespace-nowrap',\n sortable: true,\n },\n];\n\n/** Time-remaining column for claimed escalations — aligns with checkbox column on All Escalations. */\nexport const TIME_LEFT_COLUMN: Column<LTEscalationRecord> = {\n key: 'expires',\n label: (<Clock className=\"w-3.5 h-3.5 text-text-tertiary\" />) as any,\n render: (row) =>\n row.assigned_until ? (\n <CountdownTimer until={row.assigned_until} />\n ) : (\n <span className=\"text-xs text-text-tertiary\">—</span>\n ),\n className: 'w-16 whitespace-nowrap',\n};\n\n/** Status icon column — color-coded filled circle, or bell for ACK/notification escalations. */\nexport const STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) => {\n if (isAckEscalation(row)) {\n const color = row.status === 'resolved' ? 'text-status-success' : 'text-text-tertiary';\n return <Bell className={`w-3 h-3 ${color}`} />;\n }\n if (row.status === 'resolved') {\n return <Circle className=\"w-2.5 h-2.5 fill-status-success text-status-success\" />;\n }\n if (isEffectivelyClaimed(row)) {\n return <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />;\n }\n // pending (unclaimed)\n return <Circle className=\"w-2.5 h-2.5 fill-text-tertiary text-text-tertiary\" />;\n },\n className: 'w-8',\n};\n\n/** Claimed-only status icon (always orange, or bell for ACK). */\nexport const CLAIMED_STATUS_COLUMN: Column<LTEscalationRecord> = {\n key: 'status',\n label: '',\n render: (row) =>\n isAckEscalation(row)\n ? <Bell className=\"w-3 h-3 text-status-warning\" />\n : <Circle className=\"w-2.5 h-2.5 fill-status-warning text-status-warning\" />,\n className: 'w-8',\n};\n\n/** Priority filter options shared by both pages. */\nexport const PRIORITY_OPTIONS = [\n { value: '1', label: 'P1' },\n { value: '2', label: 'P2' },\n { value: '3', label: 'P3' },\n { value: '4', label: 'P4' },\n];\n\n/** Status filter options for escalation list pages. */\nexport const STATUS_OPTIONS = [\n { value: 'available', label: 'Available' },\n { value: 'claimed', label: 'Claimed' },\n { value: 'resolved', label: 'Resolved' },\n { value: 'cancelled', label: 'Cancelled' },\n];\n\n/** Shared filter bar for escalation list pages. */\nexport function EscalationFilterBar({\n filters,\n setFilter,\n roles,\n types,\n showStatus = false,\n showSearch = true,\n actions,\n}: {\n filters: { role: string; type: string; priority: string; status?: string; search?: string };\n setFilter: (key: any, value: string) => void;\n roles: string[];\n types: string[];\n showStatus?: boolean;\n // Free-text search lives here by default, but the faceted page folds it into\n // the drawer instead so there's a single search surface.\n showSearch?: boolean;\n actions?: React.ReactNode;\n}) {\n return (\n <FilterBar actions={actions}>\n {showStatus && (\n <FilterSelect\n label=\"Status\"\n value={filters.status ?? ''}\n onChange={(v) => setFilter('status', v)}\n options={STATUS_OPTIONS}\n />\n )}\n <FilterSelect\n label=\"Role\"\n value={filters.role}\n onChange={(v) => setFilter('role', v)}\n options={roles.map((r) => ({ value: r, label: r }))}\n />\n <FilterSelect\n label=\"Type\"\n value={filters.type}\n onChange={(v) => setFilter('type', v)}\n options={types.map((t) => ({ value: t, label: t }))}\n />\n <FilterSelect\n label=\"Priority\"\n value={filters.priority}\n onChange={(v) => setFilter('priority', v)}\n options={PRIORITY_OPTIONS}\n />\n {showSearch && (\n <FilterInput\n label=\"Search\"\n value={filters.search ?? ''}\n onChange={(v) => setFilter('search', v)}\n placeholder=\"ID, workflow, origin…\"\n />\n )}\n </FilterBar>\n );\n}\n"],"names":["CELL_TEXT","StatusDot","row","isAckEscalation","color","jsx","Bell","Circle","isEffectivelyClaimed","MetadataCell","metadata","open","setOpen","useState","keys","preview","jsxs","e","v","ChevronRight","JsonViewer","ESCALATION_COLUMNS","WorkflowPill","RolePill","PriorityBadge","formatDateTime","formatAgoCompact","TIME_LEFT_COLUMN","Clock","CountdownTimer","PRIORITY_OPTIONS","STATUS_OPTIONS","EscalationFilterBar","filters","setFilter","roles","types","showStatus","showSearch","actions","FilterBar","FilterSelect","r","t","FilterInput"],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ import{a as f,j as e,b as tt}from"./vendor-query-B2UbickB.js";import{z as de,v as ge,c as U,C as st,J as ne,j as at,A as nt,g as rt,h as it,B as lt,E as ot,u as ct}from"./index-DE0r9SEX.js";import{u as dt}from"./useCollapsedSections-BU5HULGs.js";import{u as xt,C as ut,a as mt}from"./CustomDurationPicker-DHflFoEa.js";import{a as pt}from"./roles-t9HzhI5N.js";import{P as ht}from"./PageHeader-DVOZjBfL.js";import{a as Le,C as he,i as ft}from"./escalation-DrzQolPG.js";import{L as gt}from"./ListToolbar-_73JCdbB.js";import{u as jt}from"./workflows-S7MF1nNk.js";import{g as bt}from"./useEventHooks-DK9mw1cI.js";import{U as fe}from"./UserName-CMoFi9zb.js";import{S as Te}from"./StatusBadge-Bl3FXVmF.js";import{R as Ee}from"./RolePill-BaW-30TC.js";import{C as M}from"./CopyableId-blg-gZvT.js";import{U as Re,a8 as yt,a6 as vt,a9 as Se}from"./vendor-icons-Dy5Jpknf.js";import{C as ie}from"./CollapsibleSection-BjGNYEvh.js";import{L as Oe,e as wt,c as Nt}from"./vendor-react-CXumBFUA.js";import"./Modal-CSrxpXeM.js";import"./constants-BHkpVaqx.js";import"./users-CC4B5Fm5.js";const $e="lt_view_mode";function kt(t){const[n,i]=f.useState(()=>{try{const s=localStorage.getItem($e);if(s!==null)return s==="dev"}catch{}return t}),a=f.useCallback(()=>{i(s=>{const l=!s;try{localStorage.setItem($e,l?"dev":"user")}catch{}return l})},[]);return{isDevMode:n,toggleMode:a}}const xe=4;function Me({pct:t,place:n,label:i,title:a,emphasis:s}){const l=e.jsx("span",{className:"w-px h-1.5 bg-surface-border","aria-hidden":!0}),x=e.jsx("span",{className:`whitespace-nowrap leading-none ${s?"text-text-secondary":"text-text-tertiary"}`,children:i});return e.jsx("div",{title:a,className:`absolute ${n==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0.5 -translate-x-1/2 cursor-help`,style:{left:`${t}%`},children:n==="above"?e.jsxs(e.Fragment,{children:[x,l]}):e.jsxs(e.Fragment,{children:[l,x]})})}function _t({esc:t,className:n=""}){const i=new Date(t.created_at).getTime(),a=t.claimed_at?new Date(t.claimed_at).getTime():null,s=t.status==="resolved",l=t.status==="cancelled",x=s||l,d=Le(t),r=!!a&&(d||x),o=s&&t.resolved_at?new Date(t.resolved_at).getTime():l?new Date(t.updated_at).getTime():Date.now(),c=Math.max(o-i,1),m=r&&a?Math.max(a-i,0):c,p=r&&a?Math.max(o-a,0):0,b=Math.min(100,Math.max(0,m/c*100)),u=r?Math.max(0,100-b):0,j=s?"bg-status-success":l?"bg-status-error":"bg-status-active",h=s?"Worked":l?"Open before cancel":"In progress",g=de(m),k=de(c),S=s?`Resolved in ${k} total`:l?`Cancelled after ${k}`:`Open ${k} so far (current age)`,C=`Lifecycle: amber = time spent waiting to be claimed, the colored end = ${h.toLowerCase()} after the claim. Top label is time-to-claim, bottom is total time.`;return e.jsxs("div",{className:n,title:C,children:[e.jsx("div",{className:"relative h-3.5 text-[9px] font-mono",children:r&&e.jsx(Me,{pct:b,place:"above",label:g,title:`Time to claim: ${g} (created → claimed)`})}),e.jsxs("div",{className:"flex w-full rounded-full overflow-hidden bg-surface-sunken cursor-help",style:{height:xe},title:C,children:[e.jsx("div",{style:{width:`${b}%`,minWidth:xe},className:"bg-status-pending",title:`Waiting ${g} — created → claimed`}),r&&e.jsx("div",{style:{width:`${u}%`,minWidth:xe},className:j,title:`${h} ${de(p)} — claimed → ${s?"resolved":l?"cancelled":"now"}`})]}),e.jsx("div",{className:"relative h-3.5 text-[9px] font-mono",children:e.jsx(Me,{pct:100,place:"below",emphasis:!0,label:k,title:S})})]})}function Ct(t){const{mode:n,activeView:i,onActiveViewChange:a,onClaim:s,claimPending:l,workflowType:x,json:d,onResolve:r,resolvePending:o,resolveError:c,requestTriage:m,triageNotes:p,currentRole:b,escalationTargets:u,onEscalate:j,escalatePending:h,escalateError:g,onRelease:k,releasePending:S,onCancel:C,assignedTo:D,assignedUntil:I,onSubmitAttempt:T}=t,E=xt(),[y,w]=f.useState("30"),[N,R]=f.useState(0),[A,J]=f.useState(""),[B,P]=f.useState(""),L=y==="custom",z=f.useCallback(v=>R(v),[]);if(n==="terminal")return null;const oe=()=>{const v=L?N:parseInt(y);!v||v<=0||s(v)},H=()=>{if(J(""),m){const V={_lt:{needsTriage:!0}};p.trim()&&(V.notes=p.trim()),r(V);return}let v;try{v=JSON.parse(d)}catch{J("Invalid JSON");return}const G=v._form_schema,X=G==null?void 0:G.required;if(X!=null&&X.length){const V=X.filter(q=>{const O=v[q];return O==null||typeof O=="string"&&O.trim()===""});if(V.length>0){T==null||T();const q=V.map(Z=>Z.replace(/[_-]/g," ")),O=q.length<=2?q.join(", "):`${q.slice(0,2).join(", ")}...`;J(`Required: ${O}`);return}}r(v)},W=v=>`text-xs transition-colors ${v?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"sticky bottom-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-10 px-10 pt-3 pb-5 z-10","data-testid":"escalation-action-bar",children:[n==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[E.map(v=>e.jsx("button",{onClick:()=>{w(v.value),R(0)},className:W(!L&&y===v.value),children:v.label},v.value)),e.jsx("button",{onClick:()=>w("custom"),className:W(L),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:C,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:"Cancel escalation"}),e.jsx("div",{className:"flex-1"}),L&&e.jsx(ut,{onChange:z,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:oe,disabled:l||L&&N<=0,className:"btn-primary text-xs",children:l?"Claiming...":"Claim"})]})]}),n==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:D?e.jsx(fe,{userId:D}):"unknown"})]}),I&&e.jsx(he,{until:I})]}),n==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>a("resolve"),className:W(i==="resolve"),children:x?"Resolve":"Acknowledge"}),u.length>0&&e.jsx("button",{onClick:()=>a("escalate"),className:W(i==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>a("release"),className:`text-xs transition-colors ${i==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"}),e.jsx("button",{onClick:C,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:"Cancel"})]}),i==="resolve"&&(x?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),A&&e.jsx("span",{className:"text-xs text-status-error",children:A}),c&&e.jsx("span",{className:"text-xs text-status-error",children:c.message}),e.jsx("button",{onClick:H,disabled:o,className:"btn-primary text-xs",children:o?"Submitting...":m?"Send to Triage":"Submit"})]}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Notification — acknowledge to resolve"}),e.jsx("div",{className:"flex-1"}),c&&e.jsx("span",{className:"text-xs text-status-error mr-3",children:c.message}),e.jsx("button",{onClick:()=>r({acknowledged:!0}),disabled:o,className:"btn-primary text-xs",children:o?"Acknowledging...":"Acknowledge"})]})),i==="escalate"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",e.jsx("span",{className:"font-medium text-text-primary",children:b})," to"]}),e.jsxs("select",{value:B,onChange:v=>P(v.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),u.map(v=>e.jsx("option",{value:v,children:v},v))]}),e.jsx("div",{className:"flex-1"}),g&&e.jsx("span",{className:"text-xs text-status-error",children:g.message}),e.jsx("button",{onClick:()=>j(B),disabled:!B||h,className:"btn-primary text-xs",children:h?"Escalating...":"Escalate"})]}),i==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>a("resolve"),className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:k,disabled:S,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:S?"Releasing...":"Yes, Release"})]})]})]})}const Tt={1:{pad:"px-3 py-2.5",label:"text-[9px] mb-1.5",value:"text-xs",bg:"bg-surface-sunken/60"},2:{pad:"px-3 py-2",label:"text-[8px] mb-1",value:"text-[11px]",bg:"bg-surface-sunken/30"},3:{pad:"px-2.5 py-1.5",label:"text-[8px] mb-0.5",value:"text-[10px]",bg:"bg-surface-sunken/15"}};function $({label:t,children:n,tier:i=1,className:a=""}){const s=Tt[i];return e.jsxs("div",{className:`flex-1 min-w-0 rounded-lg ${s.bg} ${s.pad} ${a}`,children:[e.jsx("p",{className:`font-semibold uppercase tracking-widest text-text-tertiary leading-none ${s.label}`,children:t}),e.jsx("div",{className:`text-text-secondary leading-tight min-w-0 ${s.value}`,children:n})]})}const Ie=56;function Et({value:t}){const[n,i]=f.useState(!1),a=typeof t=="object"?JSON.stringify(t):String(t??"");return a.length<=Ie?e.jsx("span",{className:"font-mono break-all",title:a,children:a}):e.jsx("button",{onClick:()=>i(s=>!s),title:a,className:"font-mono break-all text-left hover:text-accent transition-colors",children:n?a:`${a.slice(0,Ie)}…`})}function Rt({esc:t,claimedByMe:n,claimed:i,isTerminal:a,traceUrl:s,isDevMode:l,showDetails:x,onToggleDetails:d}){const{isBuilder:r}=ge(),o=ft(t);return l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o&&e.jsx(vt,{className:"w-5 h-5 text-text-tertiary shrink-0"}),e.jsxs("p",{className:"text-[1.5rem] leading-snug font-light text-text-secondary",children:[t.type,t.subtype?` / ${t.subtype}`:""]})]}),t.description&&e.jsx("p",{className:"text-sm leading-relaxed text-text-tertiary mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-end gap-x-6 gap-y-3 mt-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Status"}),e.jsx("span",{className:"mb-1 inline-block",children:e.jsx(Te,{status:t.status})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Role"}),e.jsx(Ee,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Created"}),e.jsx("span",{className:"inline-flex items-center mb-1 text-xs text-text-secondary",children:e.jsx(U,{date:t.created_at})})]}),(i||a)&&t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Claimed by"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Re,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(fe,{userId:t.assigned_to})]})]}),i&&!a&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Time left"}),e.jsx("span",{className:"inline-flex items-center h-5",children:e.jsx(he,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Resolved"}),e.jsx("span",{className:"inline-flex items-center h-5 text-xs text-text-secondary",children:e.jsx(U,{date:t.resolved_at})})]})]})]}):e.jsxs("div",{className:"-mt-6 mb-2",children:[t.description&&e.jsx("p",{className:"text-2xl font-light text-text-primary leading-relaxed mb-5",children:t.description}),e.jsxs("div",{className:"flex gap-1 items-stretch",children:[e.jsx($,{label:"Status",children:e.jsx(Te,{status:t.status})}),e.jsx($,{label:"Assigned to Role",children:e.jsx(Ee,{role:t.role,size:"md"})}),(i||a)&&t.assigned_to&&e.jsx($,{label:"Claimed By",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[e.jsx(Re,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(fe,{userId:t.assigned_to})]})}),e.jsx($,{label:"Created",children:e.jsx(U,{date:t.created_at})}),(i||a)&&t.claimed_at&&e.jsx($,{label:"Claimed",children:e.jsx(U,{date:t.claimed_at})}),i&&!a&&t.assigned_until&&e.jsx($,{label:"Time Remaining",children:e.jsx(he,{until:t.assigned_until})}),t.resolved_at&&e.jsx($,{label:"Completed",children:e.jsx("span",{className:"text-status-success",children:e.jsx(U,{date:t.resolved_at})})}),e.jsxs($,{label:"Priority",children:["P",t.priority]}),r&&e.jsx("button",{onClick:d,title:x?"Hide details":"Show details",className:"shrink-0 rounded-lg bg-surface-sunken/60 px-3 flex items-center text-text-tertiary/60 hover:text-accent transition-colors",children:e.jsx(yt,{className:`w-3.5 h-3.5 ${x?"text-accent":""}`})})]}),r&&e.jsxs(st,{open:x,children:[e.jsxs("div",{className:"flex gap-1 mt-1",children:[e.jsx($,{tier:2,label:"Escalation ID",children:e.jsx(M,{bare:!0,value:t.id})}),t.task_id&&e.jsx($,{tier:2,label:"Task ID",children:e.jsx(M,{bare:!0,value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`})}),t.workflow_type&&e.jsx($,{tier:2,label:"Workflow Name",children:e.jsx(M,{bare:!0,value:t.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`})}),t.workflow_id&&e.jsx($,{tier:2,label:"Workflow ID",children:e.jsx(M,{bare:!0,value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`})}),t.task_queue&&e.jsx($,{tier:2,label:"Task Queue",children:e.jsx(M,{bare:!0,value:t.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`})}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx($,{tier:2,label:"Origin",children:e.jsx(M,{bare:!0,value:t.origin_id,href:`/processes/detail/${t.origin_id}`})}),t.trace_id&&e.jsx($,{tier:2,label:"Trace",children:e.jsx(M,{bare:!0,value:t.trace_id,href:s?s.replace("{traceId}",t.trace_id):void 0,external:!0})})]}),t.metadata&&Object.keys(t.metadata).filter(c=>!c.startsWith("_")).length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-1 mt-1",children:Object.entries(t.metadata).filter(([c])=>!c.startsWith("_")).map(([c,m])=>e.jsx($,{tier:3,label:c,children:e.jsx(Et,{value:m})},c))})]})]})}function Y(t){return t.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function ue({content:t,compact:n}){const i=[],a=/^```(\w*)\n([\s\S]*?)^```$/gm;let s=0,l;for(;(l=a.exec(t))!==null;)l.index>s&&i.push({type:"text",text:t.slice(s,l.index)}),i.push({type:"code",lang:l[1],code:l[2].replace(/\n$/,"")}),s=l.index+l[0].length;s<t.length&&i.push({type:"text",text:t.slice(s)});const x=n?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-[11px]"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},d=[];for(const r of i){if(r.type==="code"){const o=r.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${x.code} font-mono text-text-secondary leading-relaxed">${o}</code></pre>`);continue}d.push(...St(r.text,x))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:d.join(`
2
+ `)}})}function St(t,n){const i=t.split(`
3
+ `),a=[];let s=!1,l=!1,x=[];for(const d of i){const r=d.trim();if(r.startsWith("|")&&r.endsWith("|")){const o=r.slice(1,-1).split("|").map(c=>c.trim());if(o.every(c=>/^[-:]+$/.test(c)))continue;l||(l=!0,x=[]),x.push(o);continue}if(l){l=!1;const[o,...c]=x;a.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const m of o)a.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${Y(m)}</th>`);a.push("</tr></thead><tbody>");for(const m of c){a.push("<tr>");for(const p of m)a.push(`<td class="py-1 px-2 border-b border-border/50">${Y(p)}</td>`);a.push("</tr>")}a.push("</tbody></table></div>"),x=[]}if(!r){s&&(a.push("</ul>"),s=!1);continue}if(r.startsWith("### ")){s&&(a.push("</ul>"),s=!1),a.push(`<h4 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${Y(r.slice(4))}</h4>`);continue}if(r.startsWith("## ")){s&&(a.push("</ul>"),s=!1),a.push(`<h3 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${Y(r.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(r)){s&&(a.push("</ul>"),s=!1),a.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(r)){s||(a.push('<ul class="space-y-1 my-1">'),s=!0),a.push(`<li class="${n.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${Y(r.slice(2))}</span></li>`);continue}s&&(a.push("</ul>"),s=!1),a.push(`<p class="${n.text} text-text-secondary my-1">${Y(r)}</p>`)}if(l&&x.length){const[d,...r]=x;a.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const o of d)a.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${Y(o)}</th>`);a.push("</tr></thead><tbody>");for(const o of r){a.push("<tr>");for(const c of o)a.push(`<td class="py-1 px-2 border-b border-border/50">${Y(c)}</td>`);a.push("</tr>")}a.push("</tbody></table></div>")}return s&&a.push("</ul>"),a}function me({children:t}){return e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:t})}function $t({payload:t,isTerminal:n,resolverPayload:i,onRetryTriage:a,isRetrying:s}){const l=t.title,x=t.summary,d=t.diagnosis,r=t.tool_calls_made,o=t.result,c=i==null?void 0:i._lt,m=(c==null?void 0:c.triaged)===!0,p=c==null?void 0:c.triageWorkflowId,b=n&&m,[u,j]=f.useState(!1);return b?e.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),e.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof r=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[r," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[l&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:l}),d&&e.jsxs("div",{children:[e.jsx(me,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(ue,{content:d})})]}),e.jsx("div",{className:"flex items-center gap-3",children:p&&e.jsx(Oe,{to:`/workflows/executions/${p}`,className:"text-[10px] text-accent hover:underline",children:"View triage execution"})})]})]}):e.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),e.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof r=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[r," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[l&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:l}),x&&e.jsxs("div",{children:[e.jsx(me,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(ue,{content:x})})]}),d&&e.jsxs("div",{children:[e.jsx(me,{children:"What went wrong"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(ue,{content:d})})]}),o!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>j(!u),className:"flex items-center gap-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[e.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),u&&e.jsx("div",{className:"mt-2",children:e.jsx(ne,{data:o,defaultMode:"tree"})})]}),a&&!n&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:a,disabled:s,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:e.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),s?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function Mt({triage:t,payload:n}){const i=t.confidence??0,a=i>=.8?"text-status-success":i>=.5?"text-status-pending":"text-status-error",s=It(t.originalData,n);return e.jsxs("div",{className:"space-y-5",children:[t.diagnosis&&e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:t.diagnosis}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[t.tool_calls_made!=null&&e.jsxs("span",{children:[t.tool_calls_made," tool call",t.tool_calls_made!==1?"s":""]}),t.tool_calls_made!=null&&e.jsx("span",{className:"text-text-quaternary",children:"·"}),e.jsxs("span",{className:`font-medium ${a}`,children:[Math.round(i*100),"% confidence"]})]}),t.actions_taken&&t.actions_taken.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions_taken.map((l,x)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px]
4
+ text-text-secondary`,children:[e.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),l]},x))}),t.recommendation&&e.jsx("p",{className:"text-[11px] text-text-tertiary italic",children:t.recommendation}),s.length>0&&e.jsx("div",{className:"space-y-4 pt-2",children:s.map(l=>e.jsx(At,{diff:l},l.key))})]})}function It(t,n){if(!t)return[];const i=[];for(const a of Object.keys(t)){if(a.startsWith("_"))continue;const s=t[a],l=n[a];l!==void 0&&JSON.stringify(s)!==JSON.stringify(l)&&i.push({key:a,label:a.replace(/[_-]/g," "),original:s,corrected:l})}return i}function At({diff:t}){const n=Ae(t.original),i=Ae(t.corrected);return n!==null&&i!==null?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:n})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:i})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.original=="object"?JSON.stringify(t.original,null,2):String(t.original)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.corrected=="object"?JSON.stringify(t.corrected,null,2):String(t.corrected)})]})]})}function Ae(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}function We({src:t,escalation:n,schema:i,onResolve:a,onEscalate:s,submitAttempted:l}){const x=f.useRef(null),d=f.useRef("");f.useEffect(()=>{try{const o=new URL(t);d.current=o.origin}catch{d.current=""}},[t]);const r=f.useCallback(()=>{const o=x.current;if(!(o!=null&&o.contentWindow)||!d.current)return;const m={type:"lt:init",escalation:{id:n.id,type:n.type,subtype:n.subtype,description:n.description,status:n.status,priority:n.priority,role:n.role,workflow_type:n.workflow_type},schema:i};o.contentWindow.postMessage(m,d.current)},[n,i]);return f.useEffect(()=>{const o=c=>{if(c.origin!==d.current)return;const m=c.data;if(!(!m||typeof m!="object"||typeof m.type!="string"))switch(m.type){case"lt:ready":r();break;case"lt:submit":m.payload&&typeof m.payload=="object"&&a(m.payload);break;case"lt:escalate":typeof m.target=="string"&&m.target&&s(m.target);break;case"lt:resize":{const p=x.current;p&&typeof m.height=="number"&&m.height>0&&(p.style.height=`${Math.min(m.height,2e3)}px`);break}}};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r,a,s]),f.useEffect(()=>{if(!l)return;const o=x.current;o!=null&&o.contentWindow&&d.current&&o.contentWindow.postMessage({type:"lt:validate"},d.current)},[l]),e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:x,src:t,sandbox:"allow-scripts allow-same-origin allow-forms",className:"w-full border-0",style:{minHeight:"400px"},title:"HITL Viewport",onLoad:r})})}function Wt({fieldKey:t,value:n,onChange:i,schema:a}){const s=f.useRef(null),l=(a==null?void 0:a.accept)??void 0,x=t.replace(/[_-]/g," "),d=a==null?void 0:a.description,r=f.useCallback(c=>{var b;const m=(b=c.target.files)==null?void 0:b[0];if(!m)return;const p=new FileReader;p.onload=()=>{typeof p.result=="string"&&i(p.result)},p.readAsDataURL(m)},[i]),o=n.startsWith("data:");return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:x}),d&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:d}),e.jsxs("div",{className:"mt-1",children:[e.jsx("input",{ref:s,type:"file",accept:l,onChange:r,className:"hidden"}),e.jsx("button",{type:"button",onClick:()=>{var c;return(c=s.current)==null?void 0:c.click()},className:"btn-secondary text-xs px-3 py-1.5",children:o?"Replace file":"Choose file"}),o&&e.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function Dt({fieldKey:t,value:n,onChange:i,schema:a}){const s=t.replace(/[_-]/g," "),l=a==null?void 0:a.description,x=(a==null?void 0:a["x-lt-language"])??"",d=f.useCallback(r=>{if(r.key==="Tab"){r.preventDefault();const o=r.currentTarget,c=o.selectionStart,m=o.selectionEnd,p=n.substring(0,c)+" "+n.substring(m);i(p),requestAnimationFrame(()=>{o.selectionStart=o.selectionEnd=c+2})}},[n,i]);return e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:[s,x&&e.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:x})]}),l&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:l}),e.jsx("textarea",{value:n,onChange:r=>i(r.target.value),onKeyDown:d,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function Pt({fieldKey:t,value:n,onChange:i,schema:a}){const s=f.useRef(null),[l,x]=f.useState(!1),d=t.replace(/[_-]/g," "),r=a==null?void 0:a.description;f.useEffect(()=>{const u=s.current;if(!u)return;const j=u.getContext("2d");if(j&&(j.lineWidth=2,j.lineCap="round",j.strokeStyle="#1E1535",n&&n.startsWith("data:"))){const h=new Image;h.onload=()=>j.drawImage(h,0,0),h.src=n}},[]);const o=f.useCallback(u=>{const h=s.current.getBoundingClientRect();return"touches"in u?{x:u.touches[0].clientX-h.left,y:u.touches[0].clientY-h.top}:{x:u.clientX-h.left,y:u.clientY-h.top}},[]),c=f.useCallback(u=>{var g;x(!0);const j=(g=s.current)==null?void 0:g.getContext("2d");if(!j)return;const h=o(u);j.beginPath(),j.moveTo(h.x,h.y)},[o]),m=f.useCallback(u=>{var g;if(!l)return;const j=(g=s.current)==null?void 0:g.getContext("2d");if(!j)return;const h=o(u);j.lineTo(h.x,h.y),j.stroke()},[l,o]),p=f.useCallback(()=>{x(!1);const u=s.current;u&&i(u.toDataURL("image/png"))},[i]),b=f.useCallback(()=>{const u=s.current;if(!u)return;const j=u.getContext("2d");j&&(j.clearRect(0,0,u.width,u.height),i(""))},[i]);return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),r&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:r}),e.jsx("div",{className:"mt-1 border border-surface-border rounded-md overflow-hidden bg-white",children:e.jsx("canvas",{ref:s,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:c,onMouseMove:m,onMouseUp:p,onMouseLeave:p,onTouchStart:c,onTouchMove:m,onTouchEnd:p})}),e.jsx("button",{type:"button",onClick:b,className:"mt-1 text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Lt({fieldKey:t,value:n,onChange:i,schema:a}){const s=t.replace(/[_-]/g," "),l=a==null?void 0:a.description;return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:s}),l&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:l}),e.jsx("textarea",{value:n,onChange:x=>i(x.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}const De={"file-upload":Wt,"code-editor":Dt,signature:Pt,"rich-text":Lt};function Fe({value:t,onChange:n,disabled:i,submitAttempted:a}){const[s,l]=f.useState({}),[x,d]=f.useState({}),[r,o]=f.useState(null),[c,m]=f.useState(!1),[p,b]=f.useState(new Set);f.useEffect(()=>{try{const y=JSON.parse(t);if(typeof y=="object"&&y!==null&&!Array.isArray(y)){const w={},N={};for(const[R,A]of Object.entries(y))R.startsWith("_")?N[R]=A:w[R]=A;l(w),d(N),o(N._form_schema&&typeof N._form_schema=="object"?N._form_schema:null),m(!1)}}catch{m(!0)}},[t]);const u=f.useCallback(y=>{l(y),n(JSON.stringify({...y,...x},null,2))},[x,n]),j=f.useCallback((y,w)=>{u({...s,[y]:w})},[s,u]),h=f.useCallback(y=>{b(w=>{if(w.has(y))return w;const N=new Set(w);return N.add(y),N})},[]);if(c)return e.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const g=Object.entries(s);if(g.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const k=r==null?void 0:r["x-lt-order"],S=k?[...g].sort((y,w)=>{const N=k.indexOf(y[0]),R=k.indexOf(w[0]);return(N===-1?1/0:N)-(R===-1?1/0:R)}):g,C=new Set((r==null?void 0:r.required)??[]),D=r==null?void 0:r["x-lt-layout"],I=r==null?void 0:r.title,T=r==null?void 0:r.description,E=S.map(([y,w])=>{var L;const N=(L=r==null?void 0:r.properties)==null?void 0:L[y],R=(N==null?void 0:N.readOnly)===!0,A=(N==null?void 0:N["x-lt-span"])??1,J=C.has(y),B=p.has(y)||!!a;let P;if(J&&B&&(w==null||typeof w=="string"&&w.trim()==="")&&(P="Required"),B&&typeof w=="string"&&w.trim()!==""&&N){const z=N.format;z==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(w)&&(P="Enter a valid email address"),z==="uri"&&!/^https?:\/\/.+/.test(w)&&(P="Enter a valid URL")}return e.jsx("div",{className:D==="two-column"&&A>=2?"col-span-2":"",children:e.jsx(Je,{fieldKey:y,value:w,onChange:z=>j(y,z),onBlur:()=>h(y),schema:r,isRequired:J,isReadOnly:R,error:P})},y)});return e.jsxs("div",{className:`pb-8 ${i?"opacity-60 pointer-events-none":""}`,children:[I&&e.jsx("h3",{className:"text-lg font-light text-text-primary mb-1",children:I}),T&&e.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:T}),D==="two-column"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-14 gap-y-6",children:E}):e.jsx("div",{className:"space-y-6",children:E})]})}function Je({fieldKey:t,value:n,onChange:i,onBlur:a,schema:s,isRequired:l,isReadOnly:x,error:d}){var m;const r=t.replace(/[_-]/g," "),o=(m=s==null?void 0:s.properties)==null?void 0:m[t];if(x){const p=n===null?"null":typeof n=="object"?JSON.stringify(n,null,2):String(n);return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),e.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:p})]})}const c=o==null?void 0:o["x-lt-widget"];if(c&&c in De&&typeof n=="string"){const p=De[c];return e.jsx(p,{fieldKey:t,value:n,onChange:b=>i(b),schema:o})}if(typeof n=="boolean")return e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:p=>{i(p.target.checked),a==null||a()},className:"w-3.5 h-3.5 rounded accent-accent"}),e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[r,l&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),e.jsx(ee,{error:d})]});if(typeof n=="number")return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),e.jsx("input",{type:"number",value:n,onChange:p=>i(parseFloat(p.target.value)||0),onBlur:a,step:"any",className:te(!!d)}),e.jsx(ee,{error:d})]});if(typeof n=="string"){const p=(o==null?void 0:o.format)==="password",b=o==null?void 0:o.enum,u=o==null?void 0:o.description;if(b!=null&&b.length)return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("select",{value:n,onChange:g=>i(g.target.value),onBlur:a,className:te(!!d),children:b.map(g=>e.jsx("option",{value:g,children:g},g))}),e.jsx(ee,{error:d})]});if(p)return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:"password",value:n,onChange:g=>i(g.target.value),onBlur:a,className:te(!!d),autoComplete:"off"}),e.jsx(ee,{error:d})]});const j=o==null?void 0:o.format,h={date:"date","date-time":"datetime-local",email:"email",uri:"url"};return j&&j in h?e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:h[j],value:n,onChange:g=>i(g.target.value),onBlur:a,className:te(!!d)}),e.jsx(ee,{error:d})]}):j==="textarea"||n.length>80?e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("textarea",{value:n,onChange:g=>i(g.target.value),onBlur:a,className:`${te(!!d)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(n.length/60)))}),e.jsx(ee,{error:d})]}):e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:"text",value:n,onChange:g=>i(g.target.value),onBlur:a,className:te(!!d)}),e.jsx(ee,{error:d})]})}if(n===null)return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(n))return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:n.map((p,b)=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-mono bg-surface-sunken rounded text-text-secondary",children:String(p)},b))})]});if(typeof n=="object"){const p=Object.entries(n);return e.jsxs("div",{children:[e.jsx(F,{isRequired:l,children:r}),e.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:p.map(([b,u])=>e.jsx(Je,{fieldKey:b,value:u,onChange:j=>i({...n,[b]:j})},b))})]})}return null}function F({children:t,isRequired:n}){return e.jsxs("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t,n&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function ee({error:t}){return t?e.jsx("p",{className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:t}):null}function te(t){return t?"input text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"input text-sm w-full mt-1"}function Pe({json:t,onJsonChange:n,requestTriage:i,onRequestTriageChange:a,triageNotes:s,onTriageNotesChange:l,isDevMode:x=!0,disabled:d=!1,submitAttempted:r=!1,showTriage:o=!1}){const[c,m]=f.useState("form"),{visibleJson:p,hiddenFields:b}=f.useMemo(()=>{try{const h=JSON.parse(t);if(typeof h=="object"&&h!==null&&!Array.isArray(h)){const g={},k={};for(const[S,C]of Object.entries(h))S.startsWith("_")?g[S]=C:k[S]=C;return{visibleJson:JSON.stringify(k,null,2),hiddenFields:g}}}catch{}return{visibleJson:t,hiddenFields:{}}},[t]),u=f.useCallback(h=>{try{const g=JSON.parse(h);n(JSON.stringify({...g,...b},null,2))}catch{n(h)}},[b,n]),j=Object.keys(b).length>0;return e.jsxs(e.Fragment,{children:[(o||x)&&e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o?i?e.jsxs("button",{onClick:()=>a(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>a(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),e.jsxs("span",{className:"text-[13px] text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]}):e.jsx("span",{}),x&&!i&&e.jsx("button",{onClick:()=>m(c==="form"?"json":"form"),className:"text-[10px] text-text-tertiary hover:text-accent transition-colors",children:c==="form"?"Raw JSON":"Form"})]}),e.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:i?"pointer-events-none select-none":"",children:c==="form"?e.jsx(Fe,{value:t,onChange:n,disabled:d,submitAttempted:r}):e.jsxs("div",{children:[j&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2 italic",children:"Form schema hidden. Edit the resolver values below — they will be merged with the schema on submit."}),e.jsx("textarea",{value:p,onChange:h=>u(h.target.value),className:"input-json w-full",rows:Math.max(8,p.split(`
5
+ `).length+2),spellCheck:!1,"data-testid":"resolve-json"})]})}),i&&e.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[e.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),e.jsx("textarea",{value:s,onChange:h=>l(h.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function Q({children:t}){return e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:t})}function le({children:t}){return e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5 font-mono",children:t})}function Ot({esc:t}){const{isBuilder:n}=ge();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Classification"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Type"}),e.jsx(le,{children:t.type})]}),t.subtype&&e.jsxs("div",{children:[e.jsx(Q,{children:"Subtype"}),e.jsx(le,{children:t.subtype})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Priority"}),e.jsxs(le,{children:["P",t.priority]})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Status"}),e.jsx(le,{children:t.status})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"References"}),e.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-4",children:[e.jsx(M,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(M,{label:"Task ID",value:t.task_id,href:n?`/workflows/tasks/detail/${t.task_id}`:void 0}),t.workflow_type&&e.jsx(M,{label:"Workflow Name",value:t.workflow_type,href:n?`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`:void 0}),t.workflow_id&&e.jsx(M,{label:"Workflow ID",value:t.workflow_id,href:n?`/workflows/executions/${t.workflow_id}`:void 0}),t.task_queue&&e.jsx(M,{label:"Task Queue",value:t.task_queue,href:n?`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`:void 0}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(M,{label:"Origin ID",value:t.origin_id}),t.parent_id&&e.jsx(M,{label:"Parent ID",value:t.parent_id}),t.trace_id&&e.jsx(M,{label:"Trace ID",value:t.trace_id}),t.span_id&&e.jsx(M,{label:"Span ID",value:t.span_id})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Timeline"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Created"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(U,{date:t.created_at})})]}),t.claimed_at&&e.jsxs("div",{children:[e.jsx(Q,{children:"Claimed"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(U,{date:t.claimed_at})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx(Q,{children:"Resolved"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(U,{date:t.resolved_at})})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Updated"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(U,{date:t.updated_at})})]})]})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsx("div",{children:e.jsx(ne,{data:t.metadata,label:"Metadata"})})]})}function Ft({isRoundsExhausted:t,payloadObj:n,isTerminal:i,resolverPayload:a,onRetryTriage:s,isRetrying:l}){return e.jsxs(e.Fragment,{children:[t&&n&&e.jsx("div",{className:"mt-8",children:e.jsx($t,{payload:n,isTerminal:i,resolverPayload:a,onRetryTriage:s,isRetrying:l})}),(n==null?void 0:n.category)==="missing_credential"&&e.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[e.jsx(Se,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),e.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",e.jsx("span",{className:"font-medium capitalize",children:String(n.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),e.jsxs(Oe,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(Se,{size:12}),"Go to Credentials"]})]})]})]})}function Jt({isCollapsed:t,toggleSection:n,esc:i,escalationPayload:a,resolverPayload:s,triageData:l,payloadObj:x,isTerminal:d,claimedByMe:r,activeView:o,metadataFormSchema:c,json:m,onJsonChange:p,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:h,isDevMode:g,onResolve:k,onEscalate:S,submitAttempted:C,isCertified:D,hasAI:I}){return e.jsxs("div",{className:"mt-8 space-y-6",children:[g&&e.jsx(ie,{title:"Escalation Record",sectionKey:"record",isCollapsed:t("record"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsx(Ot,{esc:i})}),g&&e.jsx(ie,{title:"Input / Output",sectionKey:"context",isCollapsed:t("context"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[!!i.envelope&&e.jsx("div",{children:e.jsx(ne,{data:i.envelope,label:"Input Envelope"})}),a!=null&&e.jsx("div",{children:e.jsx(ne,{data:a,label:"Escalation Context"})})]}),s!=null&&e.jsx("div",{className:"max-w-xl",children:e.jsx(ne,{data:s,label:"Resolver Payload"})})]})}),g&&l&&x&&e.jsx(ie,{title:"AI Triage",sectionKey:"triage",isCollapsed:t("triage"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsx(Mt,{triage:l,payload:x})}),!g&&d&&s!=null&&(()=>{const T=typeof s=="object"&&s!==null?s:{},E=c,y=E?{...T,_form_schema:E}:T;return e.jsx("div",{className:"pt-6",children:e.jsx(Fe,{value:JSON.stringify(y,null,2),onChange:()=>{},disabled:!0})})})(),!d&&(r||!g)&&o==="resolve"&&!!(i.workflow_type||c)&&(()=>{const T=c,E=T==null?void 0:T["x-lt-viewport"],y=(E==null?void 0:E.type)==="iframe"&&!!E.src&&k&&S;return g?e.jsx(ie,{title:"Submit Your Resolution",sectionKey:"resolver",isCollapsed:t("resolver"),onToggle:n,contentClassName:"mt-4 ml-9",children:y?e.jsx(We,{src:E.src,escalation:i,schema:T,onResolve:k,onEscalate:S}):e.jsx(Pe,{json:m,onJsonChange:p,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:h,isDevMode:g,submitAttempted:C,showTriage:!!D&&!!I})}):e.jsx("div",{className:"pt-6",children:y?e.jsx(We,{src:E.src,escalation:i,schema:T,onResolve:k,onEscalate:S}):e.jsx(Pe,{json:m,onJsonChange:p,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:h,isDevMode:g,disabled:!r,submitAttempted:C,showTriage:!!D&&!!I})})})()]})}function pe(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function Vt(t){if(!t)return!1;try{const n=JSON.parse(t);return!!(n&&typeof n=="object"&&n._triage)}catch{return!1}}function cs(){var we,Ne,ke,_e;const{id:t}=wt(),{user:n}=at(),i=Nt(),a=tt(),{data:s,isLoading:l,refetch:x,isFetching:d}=nt(t);bt(t);const r=rt(),o=it(),c=lt(),m=ot(),[p,b]=f.useState(!1),{data:u}=pt((s==null?void 0:s.role)??""),{data:j}=jt(),{data:h}=ct(),{isBuilder:g}=ge(),{isDevMode:k,toggleMode:S}=kt(!1),C=j==null?void 0:j.find(_=>_.workflow_type===(s==null?void 0:s.workflow_type)),D=((we=h==null?void 0:h.telemetry)==null?void 0:we.traceUrl)??null,[I,T]=f.useState("resolve"),[E,y]=f.useState("{}"),{isCollapsed:w,toggle:N,collapse:R,expand:A}=dt("escalation-detail"),[J,B]=f.useState(!1),[P,L]=f.useState(""),[z,oe]=f.useState(!1),H=(C==null?void 0:C.resolver_schema)??null,W=((Ne=s==null?void 0:s.metadata)==null?void 0:Ne.form_schema)??null,v=W??H,G=f.useRef(!1);f.useEffect(()=>{if(G.current)return;const _=W??(H!=null&&H.properties?H:null);if(_!=null&&_.properties){G.current=!0;const Ce={_form_schema:_};for(const[Xe,Ze]of Object.entries(_.properties)){const et=Ze;Ce[Xe]=et.default??""}y(JSON.stringify(Ce,null,2))}else v&&(G.current=!0,y(JSON.stringify(v,null,2)))},[v,W,H]);const X=Vt(s==null?void 0:s.escalation_payload),V=(s==null?void 0:s.subtype)==="rounds_exhausted",q=(s==null?void 0:s.subtype)==="wait_for_human";if(f.useEffect(()=>{(X||V)&&R("context"),q&&W&&(R("context"),A("resolver"))},[X,V,q,W,R,A]),l)return e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const O=Le(s),Z=O&&s.assigned_to===(n==null?void 0:n.userId),Ve=O&&!Z,re=s.status==="resolved"||s.status==="cancelled",se=pe(s.escalation_payload),je=pe(s.resolver_payload),ce=pe(s.envelope),Ue=!!((ke=ce==null?void 0:ce.metadata)!=null&&ke.certified),Be=!!((_e=h==null?void 0:h.ai)!=null&&_e.enabled),K=typeof se=="object"&&se!==null&&!Array.isArray(se)?se:null,ze=K==null?void 0:K._triage,He=re?"terminal":Z?"claimed_by_me":Ve?"claimed_by_other":"available",qe=_=>{r.mutate({id:s.id,durationMinutes:_}),R("context"),R("triage"),A("resolver")},ae=()=>{a.resetQueries({queryKey:["escalations"]}),a.resetQueries({queryKey:["escalationStats"]}),i(-1)},be=async _=>{await o.mutateAsync({id:s.id,resolverPayload:_}),ae()},ye=async _=>{_&&(await c.mutateAsync({id:s.id,targetRole:_}),ae())},Ke=async()=>{Z||await r.mutateAsync({id:s.id,durationMinutes:30});const _=(K==null?void 0:K.diagnosis)||s.description||"";await o.mutateAsync({id:s.id,resolverPayload:{_lt:{needsTriage:!0},notes:_}}),ae()},Ye=async()=>{await r.mutateAsync({id:s.id,durationMinutes:0}),ae()},Qe=async()=>{await m.mutateAsync(s.id),b(!1),ae()},ve=g?e.jsx("button",{onClick:S,className:"text-text-tertiary hover:text-accent transition-colors",title:k?"Switch to user view":"Switch to developer view",children:k?e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"})}):e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}):void 0,Ge=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gt,{onRefresh:()=>x(),isFetching:d,apiPath:`/escalations/${s.id}`}),ve&&e.jsx("div",{className:"ml-4",children:ve})]});return e.jsxs("div",{className:"min-h-[calc(100vh-9rem)] flex flex-col",children:[e.jsx(ht,{title:"Escalation",actions:Ge,center:e.jsx(_t,{esc:s,className:"w-[25%] shrink-0"})}),e.jsx(Rt,{esc:s,claimedByMe:Z,claimed:O,isTerminal:re,traceUrl:D,isDevMode:k,showDetails:!w("details"),onToggleDetails:()=>N("details")}),e.jsx(Ft,{isRoundsExhausted:V,payloadObj:K,isTerminal:re,resolverPayload:je,onRetryTriage:Ke,isRetrying:r.isPending||o.isPending}),e.jsx(Jt,{isCollapsed:w,toggleSection:N,esc:s,escalationPayload:se,resolverPayload:je,triageData:ze,payloadObj:K,isTerminal:re,claimedByMe:Z,activeView:I,metadataFormSchema:W,json:E,onJsonChange:y,requestTriage:J,onRequestTriageChange:B,triageNotes:P,onTriageNotesChange:L,isDevMode:k,onResolve:be,onEscalate:ye,submitAttempted:z,isCertified:Ue,hasAI:Be}),e.jsx("div",{className:"flex-1"}),e.jsx(Ct,{mode:He,activeView:I,onActiveViewChange:T,onClaim:qe,claimPending:r.isPending,workflowType:s.workflow_type,json:E,onResolve:be,resolvePending:o.isPending,resolveError:o.error,requestTriage:J,triageNotes:P,currentRole:s.role,escalationTargets:((u==null?void 0:u.targets)??[]).filter(_=>_!==s.role),onEscalate:ye,escalatePending:c.isPending,escalateError:c.error,onRelease:Ye,releasePending:r.isPending,onCancel:()=>b(!0),assignedTo:s.assigned_to,assignedUntil:s.assigned_until,onSubmitAttempt:()=>oe(!0)}),e.jsx(mt,{open:p,onClose:()=>b(!1),onConfirm:Qe,isPending:m.isPending,error:m.error})]})}export{cs as EscalationDetailPage};
6
+ //# sourceMappingURL=index-B5w4Gjyk.js.map