@hotmeshio/long-tail 0.10.2 → 0.10.4

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 (397) hide show
  1. package/README.md +1 -0
  2. package/build/api/bot-accounts.d.ts +4 -0
  3. package/build/api/bot-accounts.js +3 -1
  4. package/build/api/escalations/metadata.js +21 -1
  5. package/build/api/escalations/resolve.d.ts +8 -0
  6. package/build/api/escalations/resolve.js +82 -3
  7. package/build/api/roles.d.ts +2 -0
  8. package/build/api/roles.js +4 -0
  9. package/build/bin/ltc.js +10 -1
  10. package/build/index.js +7 -1
  11. package/build/lib/cli/client.d.ts +4 -1
  12. package/build/lib/cli/client.js +4 -2
  13. package/build/lib/db/schemas/023_role_enforce_schema.sql +18 -0
  14. package/build/lib/typed-resolution.d.ts +35 -0
  15. package/build/lib/typed-resolution.js +37 -0
  16. package/build/modules/branding.d.ts +21 -2
  17. package/build/modules/branding.js +22 -1
  18. package/build/modules/config.d.ts +1 -0
  19. package/build/modules/config.js +5 -0
  20. package/build/routes/bot-accounts.js +3 -1
  21. package/build/routes/settings.js +21 -0
  22. package/build/sdk/index.d.ts +4 -0
  23. package/build/sdk/index.js +14 -0
  24. package/build/services/escalation/crud.d.ts +18 -6
  25. package/build/services/escalation/crud.js +18 -2
  26. package/build/services/escalation/index.d.ts +1 -0
  27. package/build/services/escalation/index.js +1 -0
  28. package/build/services/escalation/resolver-validation.d.ts +28 -0
  29. package/build/services/escalation/resolver-validation.js +95 -0
  30. package/build/services/escalation/sql.d.ts +12 -2
  31. package/build/services/escalation/sql.js +22 -2
  32. package/build/services/iam/bots.d.ts +4 -1
  33. package/build/services/iam/bots.js +5 -3
  34. package/build/services/iam/sql.d.ts +2 -2
  35. package/build/services/iam/sql.js +15 -1
  36. package/build/services/role/enforcement-cache.d.ts +21 -0
  37. package/build/services/role/enforcement-cache.js +0 -0
  38. package/build/services/role/index.js +5 -0
  39. package/build/services/role/sql.d.ts +12 -2
  40. package/build/services/role/sql.js +15 -2
  41. package/build/services/role/types.d.ts +9 -0
  42. package/build/shared/form-validation/derive-field-label.d.ts +14 -0
  43. package/build/shared/form-validation/derive-field-label.js +31 -0
  44. package/build/shared/form-validation/field-validator.d.ts +45 -0
  45. package/build/shared/form-validation/field-validator.js +214 -0
  46. package/build/shared/form-validation/index.d.ts +12 -0
  47. package/build/shared/form-validation/index.js +28 -0
  48. package/build/shared/form-validation/validate-resolver-payload.d.ts +41 -0
  49. package/build/shared/form-validation/validate-resolver-payload.js +62 -0
  50. package/build/shared/form-validation/x-lt-bind.d.ts +41 -0
  51. package/build/shared/form-validation/x-lt-bind.js +110 -0
  52. package/build/shared/form-validation/x-lt-help.d.ts +21 -0
  53. package/build/shared/form-validation/x-lt-help.js +91 -0
  54. package/build/shared/form-validation/x-lt-show-if.d.ts +7 -0
  55. package/build/shared/form-validation/x-lt-show-if.js +84 -0
  56. package/build/system/mcp-servers/admin/schemas.d.ts +3 -0
  57. package/build/system/mcp-servers/admin/schemas.js +1 -0
  58. package/build/system/mcp-servers/admin/users.js +3 -1
  59. package/build/system/mcp-servers/human-queue-schemas.d.ts +4 -4
  60. package/build/system/mcp-servers/human-queue-schemas.js +4 -1
  61. package/build/system/mcp-servers/human-queue.js +41 -2
  62. package/build/tsconfig.tsbuildinfo +1 -1
  63. package/build/types/sdk.d.ts +6 -1
  64. package/build/types/startup.d.ts +26 -0
  65. package/build/types/validation.d.ts +43 -0
  66. package/build/types/validation.js +28 -0
  67. package/dashboard/dist/assets/{AdminDashboard-Dy031e9g.js → AdminDashboard-Cma2NGsF.js} +2 -2
  68. package/dashboard/dist/assets/{AdminDashboard-Dy031e9g.js.map → AdminDashboard-Cma2NGsF.js.map} +1 -1
  69. package/dashboard/dist/assets/AgentConfigPage-CbIhM-fa.js +16 -0
  70. package/dashboard/dist/assets/AgentConfigPage-CbIhM-fa.js.map +1 -0
  71. package/dashboard/dist/assets/AgentDetailPage-DuLEKzRT.js +4 -0
  72. package/dashboard/dist/assets/AgentDetailPage-DuLEKzRT.js.map +1 -0
  73. package/dashboard/dist/assets/AgentsPage-DZO9i7Nl.js +2 -0
  74. package/dashboard/dist/assets/AgentsPage-DZO9i7Nl.js.map +1 -0
  75. package/dashboard/dist/assets/AvailableEscalationsPage-DlVoNd8B.js +2 -0
  76. package/dashboard/dist/assets/AvailableEscalationsPage-DlVoNd8B.js.map +1 -0
  77. package/dashboard/dist/assets/{BotPicker-2QEIpc-K.js → BotPicker-CidlGr6f.js} +2 -2
  78. package/dashboard/dist/assets/{BotPicker-2QEIpc-K.js.map → BotPicker-CidlGr6f.js.map} +1 -1
  79. package/dashboard/dist/assets/CapabilitiesPage-BMNNTa0D.js +2 -0
  80. package/dashboard/dist/assets/{CapabilitiesPage-lQJGZ_-t.js.map → CapabilitiesPage-BMNNTa0D.js.map} +1 -1
  81. package/dashboard/dist/assets/{CollapsibleSection-CHWP0WI6.js → CollapsibleSection-W9F9lziT.js} +2 -2
  82. package/dashboard/dist/assets/{CollapsibleSection-CHWP0WI6.js.map → CollapsibleSection-W9F9lziT.js.map} +1 -1
  83. package/dashboard/dist/assets/ConfirmDeleteModal-BUh-Dzba.js +2 -0
  84. package/dashboard/dist/assets/{ConfirmDeleteModal-C0x0HcHX.js.map → ConfirmDeleteModal-BUh-Dzba.js.map} +1 -1
  85. package/dashboard/dist/assets/{CopyableId-uot2mE_g.js → CopyableId-B1mxKfVb.js} +2 -2
  86. package/dashboard/dist/assets/{CopyableId-uot2mE_g.js.map → CopyableId-B1mxKfVb.js.map} +1 -1
  87. package/dashboard/dist/assets/CountdownTimer-lkv_7msa.js +2 -0
  88. package/dashboard/dist/assets/{CountdownTimer-TXsRlTU4.js.map → CountdownTimer-lkv_7msa.js.map} +1 -1
  89. package/dashboard/dist/assets/{CredentialsPage-BKxS-1sA.js → CredentialsPage-DyOgfnPB.js} +2 -2
  90. package/dashboard/dist/assets/CredentialsPage-DyOgfnPB.js.map +1 -0
  91. package/dashboard/dist/assets/{CronLabel-Bd2G0Rap.js → CronLabel-geum95dj.js} +2 -2
  92. package/dashboard/dist/assets/{CronLabel-Bd2G0Rap.js.map → CronLabel-geum95dj.js.map} +1 -1
  93. package/dashboard/dist/assets/CustomDurationPicker-ClufO2ew.js +2 -0
  94. package/dashboard/dist/assets/CustomDurationPicker-ClufO2ew.js.map +1 -0
  95. package/dashboard/dist/assets/DataTable-BTu2AaEl.js +2 -0
  96. package/dashboard/dist/assets/DataTable-BTu2AaEl.js.map +1 -0
  97. package/dashboard/dist/assets/{DropZone-DNDEgMpJ.js → DropZone-C3hOjJtC.js} +2 -2
  98. package/dashboard/dist/assets/{DropZone-DNDEgMpJ.js.map → DropZone-C3hOjJtC.js.map} +1 -1
  99. package/dashboard/dist/assets/{ElapsedCell-g7GO7f8L.js → ElapsedCell-DFOW9T4b.js} +2 -2
  100. package/dashboard/dist/assets/{ElapsedCell-g7GO7f8L.js.map → ElapsedCell-DFOW9T4b.js.map} +1 -1
  101. package/dashboard/dist/assets/EscalationListSchemaPage-_IhqXIQu.js +20 -0
  102. package/dashboard/dist/assets/EscalationListSchemaPage-_IhqXIQu.js.map +1 -0
  103. package/dashboard/dist/assets/EscalationSchemaPage-BCC7iscN.js +9 -0
  104. package/dashboard/dist/assets/EscalationSchemaPage-BCC7iscN.js.map +1 -0
  105. package/dashboard/dist/assets/EscalationsOverview-CvIdOtoP.js +2 -0
  106. package/dashboard/dist/assets/EscalationsOverview-CvIdOtoP.js.map +1 -0
  107. package/dashboard/dist/assets/EventTable-DJWJ7J0m.js +2 -0
  108. package/dashboard/dist/assets/EventTable-DJWJ7J0m.js.map +1 -0
  109. package/dashboard/dist/assets/FilterBar-BR3ztZ8y.js +2 -0
  110. package/dashboard/dist/assets/FilterBar-BR3ztZ8y.js.map +1 -0
  111. package/dashboard/dist/assets/GraphInvokePage-Cwn-8Glr.js +2 -0
  112. package/dashboard/dist/assets/GraphInvokePage-Cwn-8Glr.js.map +1 -0
  113. package/dashboard/dist/assets/HomePage-D8RVntg0.js +2 -0
  114. package/dashboard/dist/assets/HomePage-D8RVntg0.js.map +1 -0
  115. package/dashboard/dist/assets/ListToolbar-DuoEdVtK.js +2 -0
  116. package/dashboard/dist/assets/ListToolbar-DuoEdVtK.js.map +1 -0
  117. package/dashboard/dist/assets/McpOverview-NXKsGiWU.js +2 -0
  118. package/dashboard/dist/assets/McpOverview-NXKsGiWU.js.map +1 -0
  119. package/dashboard/dist/assets/McpQueryDetailPage-BC-iXfIx.js +5 -0
  120. package/dashboard/dist/assets/McpQueryDetailPage-BC-iXfIx.js.map +1 -0
  121. package/dashboard/dist/assets/{McpQueryPage-CsKNXUhb.js → McpQueryPage-BPJmFYOY.js} +2 -2
  122. package/dashboard/dist/assets/{McpQueryPage-CsKNXUhb.js.map → McpQueryPage-BPJmFYOY.js.map} +1 -1
  123. package/dashboard/dist/assets/McpRunDetailPage-B49nUXEl.js +2 -0
  124. package/dashboard/dist/assets/McpRunDetailPage-B49nUXEl.js.map +1 -0
  125. package/dashboard/dist/assets/McpRunsPage-Ce_XIYpP.js +2 -0
  126. package/dashboard/dist/assets/McpRunsPage-Ce_XIYpP.js.map +1 -0
  127. package/dashboard/dist/assets/NamespacePill-LWvZXt_g.js +2 -0
  128. package/dashboard/dist/assets/NamespacePill-LWvZXt_g.js.map +1 -0
  129. package/dashboard/dist/assets/OperationsPage-DI7AQO9f.js +2 -0
  130. package/dashboard/dist/assets/OperationsPage-DI7AQO9f.js.map +1 -0
  131. package/dashboard/dist/assets/OperatorDashboard-DpXjhs-3.js +2 -0
  132. package/dashboard/dist/assets/{OperatorDashboard-_axS17fp.js.map → OperatorDashboard-DpXjhs-3.js.map} +1 -1
  133. package/dashboard/dist/assets/PageHeader-DvEmMMP6.js +2 -0
  134. package/dashboard/dist/assets/PageHeader-DvEmMMP6.js.map +1 -0
  135. package/dashboard/dist/assets/PageHeaderWithStats-X0eAmu-x.js +2 -0
  136. package/dashboard/dist/assets/PageHeaderWithStats-X0eAmu-x.js.map +1 -0
  137. package/dashboard/dist/assets/{PriorityBadge-B4ykBH7f.js → PriorityBadge-CCERr9vQ.js} +2 -2
  138. package/dashboard/dist/assets/PriorityBadge-CCERr9vQ.js.map +1 -0
  139. package/dashboard/dist/assets/ProcessDetailPage-DpYSMRj1.js +2 -0
  140. package/dashboard/dist/assets/ProcessDetailPage-DpYSMRj1.js.map +1 -0
  141. package/dashboard/dist/assets/{ProcessesListPage-CoQEi_Su.js → ProcessesListPage-CQ9tSw7U.js} +2 -2
  142. package/dashboard/dist/assets/{ProcessesListPage-CoQEi_Su.js.map → ProcessesListPage-CQ9tSw7U.js.map} +1 -1
  143. package/dashboard/dist/assets/RoleDetailPage-DKeQKDkW.js +8 -0
  144. package/dashboard/dist/assets/RoleDetailPage-DKeQKDkW.js.map +1 -0
  145. package/dashboard/dist/assets/RolePill-CWhoLwef.js +2 -0
  146. package/dashboard/dist/assets/RolePill-CWhoLwef.js.map +1 -0
  147. package/dashboard/dist/assets/RolesPage-D-6kIact.js +2 -0
  148. package/dashboard/dist/assets/RolesPage-D-6kIact.js.map +1 -0
  149. package/dashboard/dist/assets/RunAsSelector-DzYcpQTm.js +2 -0
  150. package/dashboard/dist/assets/RunAsSelector-DzYcpQTm.js.map +1 -0
  151. package/dashboard/dist/assets/StatCard-DBANWIss.js +2 -0
  152. package/dashboard/dist/assets/StatCard-DBANWIss.js.map +1 -0
  153. package/dashboard/dist/assets/StatusBadge-BbqghFMi.js +2 -0
  154. package/dashboard/dist/assets/StatusBadge-BbqghFMi.js.map +1 -0
  155. package/dashboard/dist/assets/{StickyPagination-Cd83AHd_.js → StickyPagination-BTGfmGV3.js} +2 -2
  156. package/dashboard/dist/assets/{StickyPagination-Cd83AHd_.js.map → StickyPagination-BTGfmGV3.js.map} +1 -1
  157. package/dashboard/dist/assets/StreamMessageDetail-DqRpzA_6.js +2 -0
  158. package/dashboard/dist/assets/StreamMessageDetail-DqRpzA_6.js.map +1 -0
  159. package/dashboard/dist/assets/SwimlaneTimeline-CA106TYo.js +2 -0
  160. package/dashboard/dist/assets/SwimlaneTimeline-CA106TYo.js.map +1 -0
  161. package/dashboard/dist/assets/TagInput-CoR4MzsW.js +2 -0
  162. package/dashboard/dist/assets/TagInput-CoR4MzsW.js.map +1 -0
  163. package/dashboard/dist/assets/{TaskDetailPage-DnjhW7qv.js → TaskDetailPage-BRg-w2Ev.js} +2 -2
  164. package/dashboard/dist/assets/{TaskDetailPage-DnjhW7qv.js.map → TaskDetailPage-BRg-w2Ev.js.map} +1 -1
  165. package/dashboard/dist/assets/TaskQueuePill-Dw3YN8M-.js +2 -0
  166. package/dashboard/dist/assets/TaskQueuePill-Dw3YN8M-.js.map +1 -0
  167. package/dashboard/dist/assets/{TasksListPage-DySfZFgs.js → TasksListPage-kB_j9G8o.js} +2 -2
  168. package/dashboard/dist/assets/{TasksListPage-DySfZFgs.js.map → TasksListPage-kB_j9G8o.js.map} +1 -1
  169. package/dashboard/dist/assets/{TimeAgo-BKOl-7Tt.js → TimeAgo-D7dSIY7-.js} +2 -2
  170. package/dashboard/dist/assets/{TimeAgo-BKOl-7Tt.js.map → TimeAgo-D7dSIY7-.js.map} +1 -1
  171. package/dashboard/dist/assets/TimestampCell-BZe6bx18.js +2 -0
  172. package/dashboard/dist/assets/TimestampCell-BZe6bx18.js.map +1 -0
  173. package/dashboard/dist/assets/ToolPill-xX-buQtY.js +2 -0
  174. package/dashboard/dist/assets/ToolPill-xX-buQtY.js.map +1 -0
  175. package/dashboard/dist/assets/ToolTestPanel-U3NaF_T_.js +2 -0
  176. package/dashboard/dist/assets/ToolTestPanel-U3NaF_T_.js.map +1 -0
  177. package/dashboard/dist/assets/TopicDetailPage-BpALvXP1.js +9 -0
  178. package/dashboard/dist/assets/TopicDetailPage-BpALvXP1.js.map +1 -0
  179. package/dashboard/dist/assets/TopicsPage-Cy3chaca.js +2 -0
  180. package/dashboard/dist/assets/{TopicsPage-5yW63ELl.js.map → TopicsPage-Cy3chaca.js.map} +1 -1
  181. package/dashboard/dist/assets/{UserName-DcXhOSVm.js → UserName-VXM1oHMC.js} +2 -2
  182. package/dashboard/dist/assets/{UserName-DcXhOSVm.js.map → UserName-VXM1oHMC.js.map} +1 -1
  183. package/dashboard/dist/assets/WorkflowExecutionPage-BCq2cR1V.js +2 -0
  184. package/dashboard/dist/assets/WorkflowExecutionPage-BCq2cR1V.js.map +1 -0
  185. package/dashboard/dist/assets/WorkflowPill-CQ1AmhlC.js +2 -0
  186. package/dashboard/dist/assets/WorkflowPill-CQ1AmhlC.js.map +1 -0
  187. package/dashboard/dist/assets/{WorkflowsDashboard-C0Bbrd5M.js → WorkflowsDashboard-BbM69MnB.js} +2 -2
  188. package/dashboard/dist/assets/{WorkflowsDashboard-C0Bbrd5M.js.map → WorkflowsDashboard-BbM69MnB.js.map} +1 -1
  189. package/dashboard/dist/assets/WorkflowsOverview-D5HthpAW.js +2 -0
  190. package/dashboard/dist/assets/WorkflowsOverview-D5HthpAW.js.map +1 -0
  191. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BcbrYhDI.js → YamlWorkflowDetailPage-CDDVMYWi.js} +10 -10
  192. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BcbrYhDI.js.map → YamlWorkflowDetailPage-CDDVMYWi.js.map} +1 -1
  193. package/dashboard/dist/assets/YamlWorkflowsPage-FFjWwydj.js +2 -0
  194. package/dashboard/dist/assets/YamlWorkflowsPage-FFjWwydj.js.map +1 -0
  195. package/dashboard/dist/assets/{agents-CopQ3t5o.js → agents-BwiSNu73.js} +2 -2
  196. package/dashboard/dist/assets/{agents-CopQ3t5o.js.map → agents-BwiSNu73.js.map} +1 -1
  197. package/dashboard/dist/assets/bots-ClgSrxel.js +2 -0
  198. package/dashboard/dist/assets/bots-ClgSrxel.js.map +1 -0
  199. package/dashboard/dist/assets/{capabilities-5JRieYUy.js → capabilities-JUaKsby4.js} +2 -2
  200. package/dashboard/dist/assets/{capabilities-5JRieYUy.js.map → capabilities-JUaKsby4.js.map} +1 -1
  201. package/dashboard/dist/assets/{controlplane-B4rT6tIw.js → controlplane-CuTQ7eUE.js} +2 -2
  202. package/dashboard/dist/assets/{controlplane-B4rT6tIw.js.map → controlplane-CuTQ7eUE.js.map} +1 -1
  203. package/dashboard/dist/assets/escalation-columns-CS0c7cAr.js +2 -0
  204. package/dashboard/dist/assets/escalation-columns-CS0c7cAr.js.map +1 -0
  205. package/dashboard/dist/assets/index-BBA4AxmL.js +2 -0
  206. package/dashboard/dist/assets/index-BBA4AxmL.js.map +1 -0
  207. package/dashboard/dist/assets/index-C-8xXyvr.js +63 -0
  208. package/dashboard/dist/assets/index-C-8xXyvr.js.map +1 -0
  209. package/dashboard/dist/assets/index-C1t0YIXC.js +5 -0
  210. package/dashboard/dist/assets/index-C1t0YIXC.js.map +1 -0
  211. package/dashboard/dist/assets/index-C9o2UNhC.js +2 -0
  212. package/dashboard/dist/assets/index-C9o2UNhC.js.map +1 -0
  213. package/dashboard/dist/assets/index-CBj-vstO.js +2 -0
  214. package/dashboard/dist/assets/{index-Dd1RxGNw.js.map → index-CBj-vstO.js.map} +1 -1
  215. package/dashboard/dist/assets/index-CUguKMXZ.js +2 -0
  216. package/dashboard/dist/assets/index-CUguKMXZ.js.map +1 -0
  217. package/dashboard/dist/assets/index-Cavwd8UU.js +6 -0
  218. package/dashboard/dist/assets/index-Cavwd8UU.js.map +1 -0
  219. package/dashboard/dist/assets/index-CnsPBTXL.js +2 -0
  220. package/dashboard/dist/assets/index-CnsPBTXL.js.map +1 -0
  221. package/dashboard/dist/assets/index-CoPWHo_H.js +2 -0
  222. package/dashboard/dist/assets/index-CoPWHo_H.js.map +1 -0
  223. package/dashboard/dist/assets/index-CwQVaa7x.js +2 -0
  224. package/dashboard/dist/assets/index-CwQVaa7x.js.map +1 -0
  225. package/dashboard/dist/assets/index-DSa-6Ux8.js +2 -0
  226. package/dashboard/dist/assets/index-DSa-6Ux8.js.map +1 -0
  227. package/dashboard/dist/assets/index-DeMs_aBT.css +1 -0
  228. package/dashboard/dist/assets/index-Ikj_NTuy.js +5 -0
  229. package/dashboard/dist/assets/index-Ikj_NTuy.js.map +1 -0
  230. package/dashboard/dist/assets/index-Xd1jcHe7.js +2 -0
  231. package/dashboard/dist/assets/index-Xd1jcHe7.js.map +1 -0
  232. package/dashboard/dist/assets/{knowledge-B9bmoXOe.js → knowledge-BHBt-6kW.js} +2 -2
  233. package/dashboard/dist/assets/{knowledge-B9bmoXOe.js.map → knowledge-BHBt-6kW.js.map} +1 -1
  234. package/dashboard/dist/assets/{mcp-DYMFBOFz.js → mcp-CBcz4BCS.js} +2 -2
  235. package/dashboard/dist/assets/{mcp-DYMFBOFz.js.map → mcp-CBcz4BCS.js.map} +1 -1
  236. package/dashboard/dist/assets/{mcp-query-wloSpyPM.js → mcp-query-C4fKTOYo.js} +2 -2
  237. package/dashboard/dist/assets/{mcp-query-wloSpyPM.js.map → mcp-query-C4fKTOYo.js.map} +1 -1
  238. package/dashboard/dist/assets/{pipelines-DBXX6TEi.js → pipelines-CmAAH3B6.js} +2 -2
  239. package/dashboard/dist/assets/{pipelines-DBXX6TEi.js.map → pipelines-CmAAH3B6.js.map} +1 -1
  240. package/dashboard/dist/assets/role-display-Dvo2lDpU.js +2 -0
  241. package/dashboard/dist/assets/role-display-Dvo2lDpU.js.map +1 -0
  242. package/dashboard/dist/assets/task-queues-7-sHKPsN.js +2 -0
  243. package/dashboard/dist/assets/task-queues-7-sHKPsN.js.map +1 -0
  244. package/dashboard/dist/assets/{tasks-CD3-C7tP.js → tasks-BAEsqcz2.js} +2 -2
  245. package/dashboard/dist/assets/{tasks-CD3-C7tP.js.map → tasks-BAEsqcz2.js.map} +1 -1
  246. package/dashboard/dist/assets/{topics-D8pKi6zA.js → topics-CY0pJ6_o.js} +2 -2
  247. package/dashboard/dist/assets/{topics-D8pKi6zA.js.map → topics-CY0pJ6_o.js.map} +1 -1
  248. package/dashboard/dist/assets/{useEventHooks-DV9pLDOW.js → useEventHooks-BlpwRvHO.js} +2 -2
  249. package/dashboard/dist/assets/{useEventHooks-DV9pLDOW.js.map → useEventHooks-BlpwRvHO.js.map} +1 -1
  250. package/dashboard/dist/assets/{useNamespace-DykYhZY9.js → useNamespace-CoNUlZ6Z.js} +2 -2
  251. package/dashboard/dist/assets/{useNamespace-DykYhZY9.js.map → useNamespace-CoNUlZ6Z.js.map} +1 -1
  252. package/dashboard/dist/assets/{useYamlActivityEvents-By044UAv.js → useYamlActivityEvents-8GUn5Wie.js} +2 -2
  253. package/dashboard/dist/assets/{useYamlActivityEvents-By044UAv.js.map → useYamlActivityEvents-8GUn5Wie.js.map} +1 -1
  254. package/dashboard/dist/assets/{users-mI9goDjj.js → users-uGtDRGxR.js} +2 -2
  255. package/dashboard/dist/assets/{users-mI9goDjj.js.map → users-uGtDRGxR.js.map} +1 -1
  256. package/dashboard/dist/assets/{vendor-icons-ihWGa7_d.js → vendor-icons-DKCAtTJ9.js} +135 -130
  257. package/dashboard/dist/assets/vendor-icons-DKCAtTJ9.js.map +1 -0
  258. package/dashboard/dist/assets/{workflows-DCUilz68.js → workflows-DoX-AtHN.js} +2 -2
  259. package/dashboard/dist/assets/{workflows-DCUilz68.js.map → workflows-DoX-AtHN.js.map} +1 -1
  260. package/dashboard/dist/assets/{yaml-workflows-DWNMP1PT.js → yaml-workflows-DM3jVem2.js} +2 -2
  261. package/dashboard/dist/assets/{yaml-workflows-DWNMP1PT.js.map → yaml-workflows-DM3jVem2.js.map} +1 -1
  262. package/dashboard/dist/index.html +3 -3
  263. package/docs/api/http/escalations.md +15 -1
  264. package/docs/api/http/roles.md +2 -0
  265. package/docs/design-principles.md +234 -0
  266. package/docs/hitl/design.md +228 -0
  267. package/docs/hitl/form.md +21 -1
  268. package/docs/hitl/iframe.md +1 -1
  269. package/docs/hitl/x-lt-display.md +56 -0
  270. package/docs/hitl/x-lt-layout.md +20 -1
  271. package/docs/hitl/x-lt-list-schema.md +8 -1
  272. package/docs/hitl/x-lt-widget.md +23 -0
  273. package/docs/hitl-guide.md +4 -2
  274. package/docs/schema-enforcement.md +149 -0
  275. package/package.json +1 -1
  276. package/dashboard/dist/assets/AgentConfigPage-CqmtYBbC.js +0 -16
  277. package/dashboard/dist/assets/AgentConfigPage-CqmtYBbC.js.map +0 -1
  278. package/dashboard/dist/assets/AgentDetailPage-oYLBrN74.js +0 -4
  279. package/dashboard/dist/assets/AgentDetailPage-oYLBrN74.js.map +0 -1
  280. package/dashboard/dist/assets/AgentsPage-CHczRx5N.js +0 -2
  281. package/dashboard/dist/assets/AgentsPage-CHczRx5N.js.map +0 -1
  282. package/dashboard/dist/assets/AvailableEscalationsPage-DDVuivEE.js +0 -2
  283. package/dashboard/dist/assets/AvailableEscalationsPage-DDVuivEE.js.map +0 -1
  284. package/dashboard/dist/assets/CapabilitiesPage-lQJGZ_-t.js +0 -2
  285. package/dashboard/dist/assets/ConfirmDeleteModal-C0x0HcHX.js +0 -2
  286. package/dashboard/dist/assets/CountdownTimer-TXsRlTU4.js +0 -2
  287. package/dashboard/dist/assets/CredentialsPage-BKxS-1sA.js.map +0 -1
  288. package/dashboard/dist/assets/CustomDurationPicker-j4bBrDJ6.js +0 -2
  289. package/dashboard/dist/assets/CustomDurationPicker-j4bBrDJ6.js.map +0 -1
  290. package/dashboard/dist/assets/DataTable-Byn3oyT9.js +0 -2
  291. package/dashboard/dist/assets/DataTable-Byn3oyT9.js.map +0 -1
  292. package/dashboard/dist/assets/EscalationListSchemaPage-CIJ-OgVC.js +0 -20
  293. package/dashboard/dist/assets/EscalationListSchemaPage-CIJ-OgVC.js.map +0 -1
  294. package/dashboard/dist/assets/EscalationSchemaPage-C7dHgG8e.js +0 -9
  295. package/dashboard/dist/assets/EscalationSchemaPage-C7dHgG8e.js.map +0 -1
  296. package/dashboard/dist/assets/EscalationsOverview-D8NrATg2.js +0 -2
  297. package/dashboard/dist/assets/EscalationsOverview-D8NrATg2.js.map +0 -1
  298. package/dashboard/dist/assets/EventTable-DBV1P2ME.js +0 -2
  299. package/dashboard/dist/assets/EventTable-DBV1P2ME.js.map +0 -1
  300. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js +0 -2
  301. package/dashboard/dist/assets/FilterBar-B5Vk5tBF.js.map +0 -1
  302. package/dashboard/dist/assets/GraphInvokePage-DbHvggQ_.js +0 -2
  303. package/dashboard/dist/assets/GraphInvokePage-DbHvggQ_.js.map +0 -1
  304. package/dashboard/dist/assets/HomePage-BpexnDO_.js +0 -2
  305. package/dashboard/dist/assets/HomePage-BpexnDO_.js.map +0 -1
  306. package/dashboard/dist/assets/ListToolbar-KC6LGtKP.js +0 -2
  307. package/dashboard/dist/assets/ListToolbar-KC6LGtKP.js.map +0 -1
  308. package/dashboard/dist/assets/McpOverview-BDZC9Hvl.js +0 -2
  309. package/dashboard/dist/assets/McpOverview-BDZC9Hvl.js.map +0 -1
  310. package/dashboard/dist/assets/McpQueryDetailPage-CXhgX1pS.js +0 -5
  311. package/dashboard/dist/assets/McpQueryDetailPage-CXhgX1pS.js.map +0 -1
  312. package/dashboard/dist/assets/McpRunDetailPage-BM3mUSlH.js +0 -2
  313. package/dashboard/dist/assets/McpRunDetailPage-BM3mUSlH.js.map +0 -1
  314. package/dashboard/dist/assets/McpRunsPage-f5hDbpLo.js +0 -2
  315. package/dashboard/dist/assets/McpRunsPage-f5hDbpLo.js.map +0 -1
  316. package/dashboard/dist/assets/NamespacePill-C4u6Go1W.js +0 -2
  317. package/dashboard/dist/assets/NamespacePill-C4u6Go1W.js.map +0 -1
  318. package/dashboard/dist/assets/OperationsPage-D37cZ8Qh.js +0 -2
  319. package/dashboard/dist/assets/OperationsPage-D37cZ8Qh.js.map +0 -1
  320. package/dashboard/dist/assets/OperatorDashboard-_axS17fp.js +0 -2
  321. package/dashboard/dist/assets/PageHeader-Bxa1XFz0.js +0 -2
  322. package/dashboard/dist/assets/PageHeader-Bxa1XFz0.js.map +0 -1
  323. package/dashboard/dist/assets/PageHeaderWithStats-D_sO0MqJ.js +0 -2
  324. package/dashboard/dist/assets/PageHeaderWithStats-D_sO0MqJ.js.map +0 -1
  325. package/dashboard/dist/assets/PriorityBadge-B4ykBH7f.js.map +0 -1
  326. package/dashboard/dist/assets/ProcessDetailPage-D8pAWUXx.js +0 -2
  327. package/dashboard/dist/assets/ProcessDetailPage-D8pAWUXx.js.map +0 -1
  328. package/dashboard/dist/assets/RoleDetailPage-ufbypNNR.js +0 -8
  329. package/dashboard/dist/assets/RoleDetailPage-ufbypNNR.js.map +0 -1
  330. package/dashboard/dist/assets/RolePill-DLwmVMam.js +0 -2
  331. package/dashboard/dist/assets/RolePill-DLwmVMam.js.map +0 -1
  332. package/dashboard/dist/assets/RolesPage-CxpXm4Sw.js +0 -2
  333. package/dashboard/dist/assets/RolesPage-CxpXm4Sw.js.map +0 -1
  334. package/dashboard/dist/assets/RunAsSelector-BebF8Lib.js +0 -2
  335. package/dashboard/dist/assets/RunAsSelector-BebF8Lib.js.map +0 -1
  336. package/dashboard/dist/assets/SlidePanel-BDVDuwIf.js +0 -2
  337. package/dashboard/dist/assets/SlidePanel-BDVDuwIf.js.map +0 -1
  338. package/dashboard/dist/assets/StatCard-DrdlUeQz.js +0 -2
  339. package/dashboard/dist/assets/StatCard-DrdlUeQz.js.map +0 -1
  340. package/dashboard/dist/assets/StatusBadge-CEQMRmSQ.js +0 -2
  341. package/dashboard/dist/assets/StatusBadge-CEQMRmSQ.js.map +0 -1
  342. package/dashboard/dist/assets/StreamMessageDetail-BIXbrZM0.js +0 -2
  343. package/dashboard/dist/assets/StreamMessageDetail-BIXbrZM0.js.map +0 -1
  344. package/dashboard/dist/assets/SwimlaneTimeline-CC5qZjYo.js +0 -2
  345. package/dashboard/dist/assets/SwimlaneTimeline-CC5qZjYo.js.map +0 -1
  346. package/dashboard/dist/assets/TagInput-C2gi47M8.js +0 -2
  347. package/dashboard/dist/assets/TagInput-C2gi47M8.js.map +0 -1
  348. package/dashboard/dist/assets/TaskQueuePill-BPP0Almh.js +0 -2
  349. package/dashboard/dist/assets/TaskQueuePill-BPP0Almh.js.map +0 -1
  350. package/dashboard/dist/assets/TimestampCell-DGOsba-A.js +0 -2
  351. package/dashboard/dist/assets/TimestampCell-DGOsba-A.js.map +0 -1
  352. package/dashboard/dist/assets/ToolPill-D74TkYB-.js +0 -2
  353. package/dashboard/dist/assets/ToolPill-D74TkYB-.js.map +0 -1
  354. package/dashboard/dist/assets/ToolTestPanel-Bez6OyRL.js +0 -2
  355. package/dashboard/dist/assets/ToolTestPanel-Bez6OyRL.js.map +0 -1
  356. package/dashboard/dist/assets/TopicDetailPage-BHccgkU_.js +0 -9
  357. package/dashboard/dist/assets/TopicDetailPage-BHccgkU_.js.map +0 -1
  358. package/dashboard/dist/assets/TopicsPage-5yW63ELl.js +0 -2
  359. package/dashboard/dist/assets/WorkflowExecutionPage-CDDLled5.js +0 -2
  360. package/dashboard/dist/assets/WorkflowExecutionPage-CDDLled5.js.map +0 -1
  361. package/dashboard/dist/assets/WorkflowPill-Fjc2q9U9.js +0 -2
  362. package/dashboard/dist/assets/WorkflowPill-Fjc2q9U9.js.map +0 -1
  363. package/dashboard/dist/assets/WorkflowsOverview-D8MkSMex.js +0 -2
  364. package/dashboard/dist/assets/WorkflowsOverview-D8MkSMex.js.map +0 -1
  365. package/dashboard/dist/assets/YamlWorkflowsPage-9Ki54d-9.js +0 -2
  366. package/dashboard/dist/assets/YamlWorkflowsPage-9Ki54d-9.js.map +0 -1
  367. package/dashboard/dist/assets/bots-CAYJYL9E.js +0 -2
  368. package/dashboard/dist/assets/bots-CAYJYL9E.js.map +0 -1
  369. package/dashboard/dist/assets/escalation-columns-BbS5X61l.js +0 -2
  370. package/dashboard/dist/assets/escalation-columns-BbS5X61l.js.map +0 -1
  371. package/dashboard/dist/assets/index-B68A3v-S.js +0 -2
  372. package/dashboard/dist/assets/index-B68A3v-S.js.map +0 -1
  373. package/dashboard/dist/assets/index-BAi89Xpm.js +0 -2
  374. package/dashboard/dist/assets/index-BAi89Xpm.js.map +0 -1
  375. package/dashboard/dist/assets/index-BJ0jjFsI.js +0 -5
  376. package/dashboard/dist/assets/index-BJ0jjFsI.js.map +0 -1
  377. package/dashboard/dist/assets/index-BOJMUk4F.js +0 -2
  378. package/dashboard/dist/assets/index-BOJMUk4F.js.map +0 -1
  379. package/dashboard/dist/assets/index-BrgYykPV.js +0 -2
  380. package/dashboard/dist/assets/index-BrgYykPV.js.map +0 -1
  381. package/dashboard/dist/assets/index-BxgtIqvl.js +0 -2
  382. package/dashboard/dist/assets/index-BxgtIqvl.js.map +0 -1
  383. package/dashboard/dist/assets/index-C0cHXaX-.css +0 -1
  384. package/dashboard/dist/assets/index-CDHDoHYz.js +0 -6
  385. package/dashboard/dist/assets/index-CDHDoHYz.js.map +0 -1
  386. package/dashboard/dist/assets/index-CUZJHXew.js +0 -2
  387. package/dashboard/dist/assets/index-CUZJHXew.js.map +0 -1
  388. package/dashboard/dist/assets/index-D5n_e59T.js +0 -2
  389. package/dashboard/dist/assets/index-D5n_e59T.js.map +0 -1
  390. package/dashboard/dist/assets/index-DIgiIoou.js +0 -63
  391. package/dashboard/dist/assets/index-DIgiIoou.js.map +0 -1
  392. package/dashboard/dist/assets/index-Dd1RxGNw.js +0 -2
  393. package/dashboard/dist/assets/index-iOb3sGsC.js +0 -5
  394. package/dashboard/dist/assets/index-iOb3sGsC.js.map +0 -1
  395. package/dashboard/dist/assets/index-mcAkQblr.js +0 -2
  396. package/dashboard/dist/assets/index-mcAkQblr.js.map +0 -1
  397. package/dashboard/dist/assets/vendor-icons-ihWGa7_d.js.map +0 -1
@@ -1,5 +0,0 @@
1
- import{j as e,a as p,b as At}from"./vendor-query-B2UbickB.js";import{R as $e,M as Oe,J as ye,b as Te,m as Xe,o as Mt,V as It,g as St,h as Ot,W as Dt,X as Pt,Y as Wt,u as Lt,x as Ft,n as qt}from"./index-DIgiIoou.js";import{b as Vt,d as Jt,H as zt,g as lt,u as ot,C as ct,m as Ht,c as dt,a as Ut}from"./CustomDurationPicker-j4bBrDJ6.js";import{P as Yt}from"./PageHeader-Bxa1XFz0.js";import{L as Gt}from"./ListToolbar-KC6LGtKP.js";import{i as xt,C as Pe}from"./CountdownTimer-TXsRlTU4.js";import{u as Xt}from"./workflows-DCUilz68.js";import{g as Bt}from"./useEventHooks-DV9pLDOW.js";import{S as Qt,a as Zt,P as Z}from"./SlidePanel-BDVDuwIf.js";import{S as Kt}from"./StatusBadge-CEQMRmSQ.js";import{R as es}from"./RolePill-DLwmVMam.js";import{C as se}from"./CopyableId-uot2mE_g.js";import{U as ut}from"./UserName-DcXhOSVm.js";import{Q as ts,an as ss,S as ns,ao as rs,H as mt,l as as,a8 as pt,U as is,ac as ls,ad as os,ap as cs,aq as ds,ar as xs,as as Be,at as us,au as Qe,av as Ze,aw as ms,X as ps}from"./vendor-icons-ihWGa7_d.js";import{c as ft,L as ke,e as fs}from"./vendor-react-CXumBFUA.js";import{M as hs}from"./Modal-D4afnAjc.js";import"./constants-BHkpVaqx.js";import"./users-mI9goDjj.js";const we={pending:"#0ea5e9",claimed:"#f97316",resolved:"#16a34a",cancelled:"#ef4444"},Re=5;function Ke({pct:t,place:n,label:a,title:r,emphasis:s}){const i=e.jsx("span",{className:"w-px h-1.5 bg-slate-300","aria-hidden":!0}),d=e.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums ${s?"text-text-secondary":"text-text-tertiary"}`,children:a});return e.jsx("div",{title:r,className:`absolute ${n==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${t}%`},children:n==="above"?e.jsxs(e.Fragment,{children:[d,i]}):e.jsxs(e.Fragment,{children:[i,d]})})}function gs({esc:t,className:n=""}){const a=new Date(t.created_at).getTime(),r=t.claimed_at?new Date(t.claimed_at).getTime():null,s=t.status==="resolved",i=t.status==="cancelled"||t.status==="expired",d=s||i,c=xt(t),l=!!r&&(c||d),o=s&&t.resolved_at?new Date(t.resolved_at).getTime():i?new Date(t.updated_at).getTime():Date.now(),x=Math.max(o-a,1),u=l&&r?Math.max(r-a,0):x,f=l&&r?Math.max(o-r,0):0,j=Math.min(100,Math.max(0,u/x*100)),h=l?Math.max(0,100-j):0,g=s?we.resolved:i?we.cancelled:we.claimed,m=s?"Resolved after":i?"Cancelled after":"In progress",R=$e(u),C=$e(x),I=s?`Resolved in ${C} total`:i?`Cancelled after ${C}`:`Open ${C} so far`,P=`Lifecycle bar: blue = time waiting to be claimed, ${s?"green":i?"red":"orange"} = ${m.toLowerCase()} the claim.`;return e.jsxs("div",{className:n,title:P,children:[e.jsx("div",{className:"relative h-3 text-[9px] font-mono",children:l&&e.jsx(Ke,{pct:j,place:"above",label:R,title:`Time to claim: ${R}`})}),e.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:Re,backgroundColor:"#e2e8f0"},title:P,children:[e.jsx("div",{style:{width:`${j}%`,minWidth:Re,backgroundColor:we.pending,opacity:.75},title:`Waiting ${R} — created → claimed`}),l&&h>0&&e.jsx("div",{style:{width:`${h}%`,minWidth:Re,backgroundColor:g,opacity:.75},title:`${m} ${$e(f)}`})]}),e.jsx("div",{className:"relative h-3 text-[9px] font-mono",children:e.jsx(Ke,{pct:100,place:"below",emphasis:!0,label:C,title:I})})]})}function js({triage:t,payload:n}){const a=t.confidence??0,r=a>=.8?"text-status-success":a>=.5?"text-status-pending":"text-status-error",s=bs(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 ${r}`,children:[Math.round(a*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((i,d)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px]
2
- 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"})}),i]},d))}),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(i=>e.jsx(ys,{diff:i},i.key))})]})}function bs(t,n){if(!t)return[];const a=[];for(const r of Object.keys(t)){if(r.startsWith("_"))continue;const s=t[r],i=n[r];i!==void 0&&JSON.stringify(s)!==JSON.stringify(i)&&a.push({key:r,label:r.replace(/[_-]/g," "),original:s,corrected:i})}return a}function ys({diff:t}){const n=et(t.original),a=et(t.corrected);return n!==null&&a!==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:a})]})]}):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 et(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}const G={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},ht="lt:escalation:panel:view";function vs(t){try{const n=localStorage.getItem(ht);if(n&&t.includes(n))return n}catch{}return G.HELP}const Ns=new Set(["form_schema"]);function ws({metadata:t,role:n}){const a=Object.entries(t??{}).filter(([r])=>!r.startsWith("_")&&!Ns.has(r));return a.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):e.jsx("dl",{className:"space-y-3.5",children:a.map(([r,s])=>{const i=typeof s=="object"&&s!==null?JSON.stringify(s):String(s),d=Xe(r,s,n),c=Xe(r,s);return e.jsxs("div",{className:"group relative",children:[e.jsx("dt",{className:"text-[11px] font-medium text-text-secondary uppercase tracking-wide",children:r.replace(/[_-]/g," ")}),e.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[e.jsx("span",{className:"text-[12px] text-text-primary font-mono break-all flex-1",children:i}),e.jsx(ke,{to:d,title:`Filter this queue: ${r} = ${i}`,className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:e.jsx(ls,{className:"w-3 h-3"})}),e.jsx(ke,{to:c,title:`Search all queues: ${r} = ${i}`,className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:e.jsx(os,{className:"w-3 h-3"})})]})]},r)})})}function ks({esc:t,claimed:n,isTerminal:a,isBuilder:r,traceUrl:s}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("dl",{className:"space-y-3.5",children:[e.jsx(Z,{label:"Status",children:e.jsx(Kt,{status:t.status})}),e.jsx(Z,{label:"Assigned to Role",children:e.jsx(es,{role:t.role,size:"md"})}),e.jsxs(Z,{label:"Priority",children:["P",t.priority]}),(n||a)&&t.assigned_to&&e.jsx(Z,{label:"Claimed By",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[e.jsx(is,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(ut,{userId:t.assigned_to})]})}),e.jsx(Z,{label:"Created",children:e.jsx(Te,{date:t.created_at})}),(n||a)&&t.claimed_at&&e.jsx(Z,{label:"Claimed",children:e.jsx(Te,{date:t.claimed_at})}),n&&!a&&t.assigned_until&&e.jsx(Z,{label:"Time Remaining",children:e.jsx(Pe,{until:t.assigned_until})}),t.resolved_at&&e.jsx(Z,{label:"Completed",children:e.jsx("span",{className:"text-status-success",children:e.jsx(Te,{date:t.resolved_at})})})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx("hr",{className:"border-surface-border/60"}),e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(se,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(se,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),t.workflow_type&&e.jsx(se,{label:"Workflow Name",value:t.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`}),t.workflow_id&&e.jsx(se,{label:"Workflow ID",value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`}),t.task_queue&&e.jsx(se,{label:"Task Queue",value:t.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(se,{label:"Origin",value:t.origin_id,href:`/processes/detail/${t.origin_id}`}),t.trace_id&&e.jsx(se,{label:"Trace",value:t.trace_id,href:s?s.replace("{traceId}",t.trace_id):void 0,external:!0})]})]})]})}function Cs({errors:t}){const n=a=>{const r=document.querySelector(`[data-field-key="${a}"]`);r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),r.focus({preventScroll:!0}))};return t.length===0?e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No errors to display."}):e.jsxs("div",{className:"space-y-1",role:"alert","aria-live":"polite",children:[e.jsxs("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-status-error mb-4",children:[t.length," ",t.length===1?"issue":"issues"," to resolve"]}),e.jsx("div",{className:"space-y-1.5",children:t.map(({field:a,message:r})=>e.jsxs("button",{onClick:()=>n(a),className:"w-full text-left flex items-start gap-3 px-3 py-2.5 rounded hover:bg-status-error/5 transition-colors group",children:[e.jsx(pt,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-text-primary capitalize leading-snug",children:a.replace(/[_-]/g," ")}),e.jsx("p",{className:"text-[11px] text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:r})]})]},a))}),e.jsx("p",{className:"text-[10px] text-text-quaternary mt-4 px-3",children:"Click an issue to scroll to and focus the field."})]})}function _s({esc:t,schema:n,envelope:a,payload:r,resolver:s,triage:i,hasAI:d,claimed:c,claimedByMe:l,isTerminal:o,isBuilder:x,traceUrl:u,open:f,noGutter:j,formErrors:h,activePanel:g,onPanelChange:m}){const R=ft(),C=Object.values(G),[I,P]=p.useState(()=>vs(C)),O=g??I,_=p.useCallback(S=>{try{localStorage.setItem(ht,S)}catch{}P(S),m==null||m(S)},[m]);p.useEffect(()=>{g&&g!==I&&P(g)},[g]);const E=p.useMemo(()=>Vt(n,{escalation:t,metadata:t.metadata??null,envelope:a,payload:r,resolver:s})??Jt({isTerminal:o,status:t.status,claimed:c,claimedByMe:l}),[n,t,a,r,s,o,c,l]),N=p.useCallback(S=>{const $=S.target.closest("a"),D=$==null?void 0:$.getAttribute("href");D!=null&&D.startsWith("/")&&(S.preventDefault(),R(D))},[R]),M=[{id:G.HELP,icon:ts,label:"Instructions",content:e.jsx(Oe,{content:E,onClick:N})},{id:G.DETAILS,icon:ss,label:"Details",content:e.jsx(ks,{esc:t,claimed:c,isTerminal:o,isBuilder:x,traceUrl:u})},...d&&i?[{id:G.TRIAGE,icon:ns,label:"AI Analysis",content:e.jsx(js,{triage:i,payload:r??{}})}]:[],{id:G.METADATA,icon:rs,label:"Metadata",content:e.jsx(ws,{metadata:t.metadata,role:t.role})},{id:G.CONTEXT,icon:mt,label:"Context",content:e.jsxs("div",{className:"space-y-5",children:[a!=null&&e.jsx(ye,{data:a,label:"Input Envelope"}),r!=null&&e.jsx(ye,{data:r,label:"Escalation Context"}),s!=null&&e.jsx(ye,{data:s,label:"Resolver Payload"}),a==null&&r==null&&s==null&&e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...x?[{id:G.RECORD,icon:as,label:"Record",content:e.jsx(ye,{data:t,label:"Escalation Record"})}]:[],...h&&h.length>0?[{id:G.ERRORS,icon:(({className:S})=>e.jsx(pt,{className:`${S??""} text-status-error`})),label:"Errors",content:e.jsx(Cs,{errors:h})}]:[]];return e.jsx(Qt,{open:f,width:384,className:"h-full",children:e.jsx("div",{className:`h-full${j?"":" pl-6"}`,children:e.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[e.jsx("div",{className:"shrink-0 pt-1.5 pb-0.5 flex justify-center",children:e.jsx(gs,{esc:t,className:"w-[80%]"})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Zt,{views:M,activeId:O,onViewChange:_,stickyClassName:"h-full min-h-0"})})]})})})}function tt(t){return t!=null&&t!==""&&t!==!1&&t!==0}function Es(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}function st(t,n){const a=t.indexOf("."),r=a===-1?t:t.slice(0,a);if(!zt.includes(r))return{known:!1,value:void 0};const s=n[r];if(a===-1)return{known:!0,value:s};try{return{known:!0,value:lt(s,t.slice(a+1))}}catch{return{known:!0,value:void 0}}}function We(t,n){if(typeof t!="string"||t.length===0||!n)return!0;const a=t.startsWith("!"),r=a?t.slice(1):t,s=r.indexOf("!="),i=r.indexOf("=");if(s!==-1||i!==-1&&i!==s+1){const l=s!==-1&&(i===-1||s<i),o=l?s:i,x=r.slice(0,o).trim(),u=r.slice(o+(l?2:1)).trim(),{known:f,value:j}=st(x,n);if(!f)return!0;const h=Es(j)===u,g=l?!h:h;return a?!g:g}const{known:d,value:c}=st(r,n);return d?a?!tt(c):tt(c):!0}function $s(t,n){if(typeof t!="string"||!n)return[];const a=t.indexOf(".");if(a===-1)return[];const r=n[t.slice(0,a)];if(!r||typeof r!="object")return[];let s=r;for(const i of t.slice(a+1).split("."))if(s=s[i],s===void 0)return[];return Array.isArray(s)?s:[]}function Ts(t,n,a){if((n==null?void 0:n["x-lt-widget"])!=="checklist"||n["x-lt-require-all"]!==!0)return;const s=$s(n["x-lt-source"],a).filter(c=>c.required!==!1);if(s.length===0)return;const i=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},d=s.filter(c=>!i[c.id]).length;if(d!==0)return`${d} of ${s.length} checks incomplete`}function Rs(t,n,a){if(n){if(typeof t=="string"){const r=t.trim();if(r==="")return;const s=de(n.minLength,n["x-lt-min-length"],a);if(s!==void 0&&r.length<s)return`Minimum ${s} character${s===1?"":"s"}`;const i=de(n.maxLength,n["x-lt-max-length"],a);if(i!==void 0&&r.length>i)return`Maximum ${i} characters (${r.length} entered)`;const d=n.pattern;if(d)try{if(!new RegExp(d).test(r))return n["x-lt-pattern-error"]??"Invalid format"}catch{}const c=n.format;if(c==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))return"Enter a valid email address";if(c==="uri"&&!/^https?:\/\/.+/.test(r))return"Enter a valid URL"}if(typeof t=="number"){const r=de(n.minimum,n["x-lt-minimum"],a),s=de(n.exclusiveMinimum,void 0,a),i=de(n.maximum,n["x-lt-maximum"],a),d=de(n.exclusiveMaximum,void 0,a);if(r!==void 0&&t<r)return`Minimum value is ${r}`;if(s!==void 0&&t<=s)return`Must be greater than ${s}`;if(i!==void 0&&t>i)return`Maximum value is ${i}`;if(d!==void 0&&t>=d)return`Must be less than ${d}`}}}function de(t,n,a){if(typeof t=="number")return t;if(typeof n=="string"&&a){const r=n.indexOf(".");if(r!==-1){const s=n.slice(0,r),i=n.slice(r+1),d=a[s];if(d&&typeof d=="object"){const c=i.split(".");let l=d;for(const o of c)if(l=l[o],l===void 0)break;if(typeof l=="number")return l;if(typeof l=="string"){const o=Number(l);if(!Number.isNaN(o))return o}}}}}function Le(t,n,a,r,s){if(!r)return;if(a){if(t==null||typeof t=="boolean"&&!t||typeof t=="string"&&t.trim()==="")return"Required";if(typeof t=="object"&&!Array.isArray(t)&&t!==null){const d=Object.values(t);if(d.length===0||d.every(c=>!c))return"Required"}}const i=Ts(t,n,s);return i||Rs(t,n,s)}function As(t){const{mode:n,activeView:a,onActiveViewChange:r,onClaim:s,claimPending:i,workflowType:d,json:c,onResolve:l,resolvePending:o,resolveError:x,requestTriage:u,triageNotes:f,currentRole:j,escalationTargets:h,onEscalate:g,escalatePending:m,escalateError:R,onRelease:C,releasePending:I,onCancel:P,assignedTo:O,assignedUntil:_,onSubmitAttempt:E,onValidationErrors:N,escalationContext:M}=t,S=ot(),[$,D]=p.useState("30"),[L,V]=p.useState(0),[b,v]=p.useState(""),[w,T]=p.useState(""),A=$==="custom",H=p.useCallback(k=>V(k),[]);if(n==="terminal")return null;const re=()=>{const k=A?L:parseInt($);!k||k<=0||s(k)},xe=()=>{if(v(""),u){const ie={_lt:{needsTriage:!0}};f.trim()&&(ie.notes=f.trim()),l(ie);return}let k;try{k=JSON.parse(c)}catch{v("Invalid JSON");return}const W=k._form_schema;if(W){const ie=W.properties??{},me=new Set(W.required??[]),U={...M??{},resolver:k},ee=[];for(const[q,F]of Object.entries(ie)){if(!We(F["x-lt-showIf"],U))continue;const X=Le(k[q],F,me.has(q),!0,U);X&&ee.push({field:q,message:X})}if(ee.length>0){E==null||E(),N==null||N(ee);const q=ee[0],F=ee.map(le=>le.field.replace(/[_-]/g," ")),X=F.length<=2?F.join(", "):`${F.slice(0,2).join(", ")}...`;v(q.message==="Required"?`Required: ${X}`:`${q.message} — ${X}`);return}}const{_form_schema:ue,...ae}=k;l(Ht(ae,W))},J=k=>`text-xs transition-colors ${k?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"shrink-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -ml-10 pl-10 pr-10 pt-3 pb-5","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:[S.map(k=>e.jsx("button",{onClick:()=>{D(k.value),V(0)},className:J(!A&&$===k.value),children:k.label},k.value)),e.jsx("button",{onClick:()=>D("custom"),className:J(A),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:P,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:"Cancel escalation"}),e.jsx("div",{className:"flex-1"}),A&&e.jsx(ct,{onChange:H,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:re,disabled:i||A&&L<=0,className:"btn-primary text-xs",children:i?"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:O?e.jsx(ut,{userId:O}):"unknown"})]}),_&&e.jsx(Pe,{until:_})]}),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:()=>r("resolve"),className:J(a==="resolve"),children:d?"Resolve":"Acknowledge"}),h.length>0&&e.jsx("button",{onClick:()=>r("escalate"),className:J(a==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>r("release"),className:`text-xs transition-colors ${a==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"}),e.jsx("button",{onClick:P,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:"Cancel"})]}),a==="resolve"&&e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),b&&e.jsx("span",{className:"text-xs text-status-error",children:b}),x&&e.jsx("span",{className:"text-xs text-status-error",children:x.message}),e.jsx("button",{onClick:xe,disabled:o,className:"btn-primary text-xs",children:o?d?"Submitting...":"Acknowledging...":u?"Send to Triage":d?"Submit":"Acknowledge"})]}),a==="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:j})," to"]}),e.jsxs("select",{value:w,onChange:k=>T(k.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),h.map(k=>e.jsx("option",{value:k,children:k},k))]}),e.jsx("div",{className:"flex-1"}),R&&e.jsx("span",{className:"text-xs text-status-error",children:R.message}),e.jsx("button",{onClick:()=>g(w),disabled:!w||m,className:"btn-primary text-xs",children:m?"Escalating...":"Escalate"})]}),a==="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:()=>r("resolve"),className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:C,disabled:I,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:I?"Releasing...":"Yes, Release"})]})]})]})}function K(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 Ae({content:t,compact:n}){const a=[],r=/^```(\w*)\n([\s\S]*?)^```$/gm;let s=0,i;for(;(i=r.exec(t))!==null;)i.index>s&&a.push({type:"text",text:t.slice(s,i.index)}),a.push({type:"code",lang:i[1],code:i[2].replace(/\n$/,"")}),s=i.index+i[0].length;s<t.length&&a.push({type:"text",text:t.slice(s)});const d=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"},c=[];for(const l of a){if(l.type==="code"){const o=l.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");c.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${o}</code></pre>`);continue}c.push(...Ms(l.text,d))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:c.join(`
3
- `)}})}function Ms(t,n){const a=t.split(`
4
- `),r=[];let s=!1,i=!1,d=[];for(const c of a){const l=c.trim();if(l.startsWith("|")&&l.endsWith("|")){const o=l.slice(1,-1).split("|").map(x=>x.trim());if(o.every(x=>/^[-:]+$/.test(x)))continue;i||(i=!0,d=[]),d.push(o);continue}if(i){i=!1;const[o,...x]=d;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of o)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(u)}</th>`);r.push("</tr></thead><tbody>");for(const u of x){r.push("<tr>");for(const f of u)r.push(`<td class="py-1 px-2 border-b border-border/50">${K(f)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>"),d=[]}if(!l){s&&(r.push("</ul>"),s=!1);continue}if(l.startsWith("### ")){s&&(r.push("</ul>"),s=!1),r.push(`<h4 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${K(l.slice(4))}</h4>`);continue}if(l.startsWith("## ")){s&&(r.push("</ul>"),s=!1),r.push(`<h3 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${K(l.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(l)){s&&(r.push("</ul>"),s=!1),r.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(l)){s||(r.push('<ul class="space-y-1 my-1">'),s=!0),r.push(`<li class="${n.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${K(l.slice(2))}</span></li>`);continue}s&&(r.push("</ul>"),s=!1),r.push(`<p class="${n.text} text-text-secondary my-1">${K(l)}</p>`)}if(i&&d.length){const[c,...l]=d;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const o of c)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(o)}</th>`);r.push("</tr></thead><tbody>");for(const o of l){r.push("<tr>");for(const x of o)r.push(`<td class="py-1 px-2 border-b border-border/50">${K(x)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>")}return s&&r.push("</ul>"),r}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 Is({payload:t,isTerminal:n,resolverPayload:a,onRetryTriage:r,isRetrying:s}){const i=t.title,d=t.summary,c=t.diagnosis,l=t.tool_calls_made,o=t.result,x=a==null?void 0:a._lt,u=(x==null?void 0:x.triaged)===!0,f=x==null?void 0:x.triageWorkflowId,j=n&&u,[h,g]=p.useState(!1);return j?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 l=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[l," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),c&&e.jsxs("div",{children:[e.jsx(Me,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(Ae,{content:c})})]}),e.jsx("div",{className:"flex items-center gap-3",children:f&&e.jsx(ke,{to:`/workflows/executions/${f}`,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 l=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[l," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),d&&e.jsxs("div",{children:[e.jsx(Me,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(Ae,{content:d})})]}),c&&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(Ae,{content:c})})]}),o!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(!h),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 ${h?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),h&&e.jsx("div",{className:"mt-2",children:e.jsx(ye,{data:o,defaultMode:"tree"})})]}),r&&!n&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:r,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 nt(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function gt({src:t,escalation:n,schema:a,onResolve:r,onEscalate:s,submitAttempted:i,fill:d}){const c=p.useRef(null),l=p.useRef("");p.useEffect(()=>{try{const x=new URL(t);l.current=x.origin}catch{l.current=""}},[t]);const o=p.useCallback(()=>{const x=c.current;if(!(x!=null&&x.contentWindow)||!l.current)return;const f={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,envelope:nt(n.envelope),metadata:n.metadata??null,escalation_payload:nt(n.escalation_payload)},schema:a};x.contentWindow.postMessage(f,l.current)},[n,a]);return p.useEffect(()=>{const x=u=>{if(u.origin!==l.current)return;const f=u.data;if(!(!f||typeof f!="object"||typeof f.type!="string"))switch(f.type){case"lt:ready":o();break;case"lt:submit":f.payload&&typeof f.payload=="object"&&r(f.payload);break;case"lt:escalate":typeof f.target=="string"&&f.target&&s(f.target);break;case"lt:resize":{const j=c.current;j&&typeof f.height=="number"&&f.height>0&&(j.style.height=`${Math.min(f.height,2e3)}px`);break}}};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[o,r,s]),p.useEffect(()=>{if(!i)return;const x=c.current;x!=null&&x.contentWindow&&l.current&&x.contentWindow.postMessage({type:"lt:validate"},l.current)},[i]),d?e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.jsx("iframe",{ref:c,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full h-full border-0 block",title:"HITL Viewport",onLoad:o})}):e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:c,src:t,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full border-0",style:{minHeight:"600px"},title:"HITL Viewport",onLoad:o})})}function Ss({fieldKey:t,value:n,onChange:a,schema:r}){const s=p.useRef(null),i=(r==null?void 0:r.accept)??void 0,d=t.replace(/[_-]/g," "),c=r==null?void 0:r.description,l=p.useCallback(x=>{var j;const u=(j=x.target.files)==null?void 0:j[0];if(!u)return;const f=new FileReader;f.onload=()=>{typeof f.result=="string"&&a(f.result)},f.readAsDataURL(u)},[a]),o=n.startsWith("data:");return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),c&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:c}),e.jsxs("div",{className:"mt-1",children:[e.jsx("input",{ref:s,type:"file",accept:i,onChange:l,className:"hidden"}),e.jsx("button",{type:"button",onClick:()=>{var x;return(x=s.current)==null?void 0:x.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 Os({fieldKey:t,value:n,onChange:a,schema:r}){const s=t.replace(/[_-]/g," "),i=r==null?void 0:r.description,d=(r==null?void 0:r["x-lt-language"])??"",c=p.useCallback(l=>{if(l.key==="Tab"){l.preventDefault();const o=l.currentTarget,x=o.selectionStart,u=o.selectionEnd,f=n.substring(0,x)+" "+n.substring(u);a(f),requestAnimationFrame(()=>{o.selectionStart=o.selectionEnd=x+2})}},[n,a]);return e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:[s,d&&e.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:d})]}),i&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:i}),e.jsx("textarea",{value:n,onChange:l=>a(l.target.value),onKeyDown:c,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function Ds({fieldKey:t,value:n,onChange:a,schema:r}){const s=p.useRef(null),[i,d]=p.useState(!1),c=t.replace(/[_-]/g," "),l=r==null?void 0:r.description;p.useEffect(()=>{const h=s.current;if(!h)return;const g=h.getContext("2d");if(g&&(g.lineWidth=2,g.lineCap="round",g.strokeStyle="#1E1535",n&&n.startsWith("data:"))){const m=new Image;m.onload=()=>g.drawImage(m,0,0),m.src=n}},[]);const o=p.useCallback(h=>{const m=s.current.getBoundingClientRect();return"touches"in h?{x:h.touches[0].clientX-m.left,y:h.touches[0].clientY-m.top}:{x:h.clientX-m.left,y:h.clientY-m.top}},[]),x=p.useCallback(h=>{var R;d(!0);const g=(R=s.current)==null?void 0:R.getContext("2d");if(!g)return;const m=o(h);g.beginPath(),g.moveTo(m.x,m.y)},[o]),u=p.useCallback(h=>{var R;if(!i)return;const g=(R=s.current)==null?void 0:R.getContext("2d");if(!g)return;const m=o(h);g.lineTo(m.x,m.y),g.stroke()},[i,o]),f=p.useCallback(()=>{d(!1);const h=s.current;h&&a(h.toDataURL("image/png"))},[a]),j=p.useCallback(()=>{const h=s.current;if(!h)return;const g=h.getContext("2d");g&&(g.clearRect(0,0,h.width,h.height),a(""))},[a]);return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:c}),l&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:l}),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:x,onMouseMove:u,onMouseUp:f,onMouseLeave:f,onTouchStart:x,onTouchMove:u,onTouchEnd:f})}),e.jsx("button",{type:"button",onClick:j,className:"mt-1 text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Ps({fieldKey:t,value:n,onChange:a,schema:r}){const s=t.replace(/[_-]/g," "),i=r==null?void 0:r.description;return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:s}),i&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:i}),e.jsx("textarea",{value:n,onChange:d=>a(d.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}function Ws({fieldKey:t,value:n,onChange:a,schema:r}){const[s,i]=p.useState("write"),d=t.replace(/[_-]/g," "),c=r==null?void 0:r.description;return(r==null?void 0:r.readOnly)===!0?e.jsx(Oe,{content:n,className:"my-1"}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),e.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(o=>e.jsx("button",{type:"button",onClick:()=>i(o),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${s===o?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:o==="write"?"Write":"Preview"},o))})]}),c&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:c}),s==="write"?e.jsx("textarea",{value:n,onChange:o=>a(o.target.value),className:"input w-full mt-1 text-sm font-mono leading-relaxed",rows:10,placeholder:"Write markdown — headings, lists, tables, code blocks, and links all render."}):e.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:n.trim()?e.jsx(Oe,{content:n}):e.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}function Ls({fieldKey:t,value:n,onChange:a,schema:r,escalationContext:s,isRequired:i,submitAttempted:d,error:c}){const l=r==null?void 0:r["x-lt-source"],o=(r==null?void 0:r["x-lt-require-all"])===!0,x=[];if(l&&s){const m=l.indexOf(".");if(m!==-1){const R=l.slice(0,m),C=l.slice(m+1);try{const I=lt(s[R],C);Array.isArray(I)&&x.push(...I)}catch{}}}let u={};try{n&&(u=JSON.parse(n))}catch{}const f=m=>a(JSON.stringify({...u,[m]:!u[m]}));if(x.length===0)return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. Provide checklist_items in the escalation envelope or metadata."}),c&&e.jsx("p",{className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:c})]});const j=x.filter(m=>u[m.id]).length,h=(r==null?void 0:r.description)||"Checklist",g=(x.find(m=>!u[m.id]&&m.required!==!1)??x[0]).id;return e.jsxs("div",{role:"group","aria-label":h,"aria-required":i||void 0,"aria-invalid":c?!0:void 0,children:[e.jsx("div",{className:"space-y-2.5 mt-1",children:x.map(m=>{const R=u[m.id]??!1,C=!R&&!!d&&(o?m.required!==!1:j===0&&(m.required||i));return e.jsxs("label",{className:`flex items-start gap-3 cursor-pointer group select-none rounded px-2 py-1 -mx-2 transition-colors ${C?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[e.jsx("input",{type:"checkbox",checked:R,onChange:()=>f(m.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${C?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${m.id}`,...m.id===g?{"data-field-key":t}:{}}),e.jsxs("span",{className:`text-sm leading-snug transition-colors ${C?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[m.label,m.required&&e.jsx("span",{className:`ml-0.5 text-[10px] ${C?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},m.id)})}),e.jsxs("p",{className:"text-[10px] text-text-quaternary mt-3 tabular-nums",children:[j," / ",x.length," confirmed",o?e.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",x.some(m=>m.required===!1)?" except optional":"",")"]}):i&&j===0&&!!d&&e.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]}),c&&e.jsx("p",{role:"alert",className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:c})]})}const Fs=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function qs(t){var r,s,i,d;const n=t.trim();if(!n)return{kind:"none"};const a=(s=(r=/^data:([^;,]+)[;,]/.exec(n))==null?void 0:r[1])==null?void 0:s.toLowerCase();if(a)return a.startsWith("image/")?{kind:"image",src:n}:{kind:"file",href:n,label:a==="application/pdf"?"PDF":a,isData:!0};if(/^https?:\/\//i.test(n)){if(Fs.test(n))return{kind:"image",src:n};const c=(d=(i=/\.([a-z0-9]{2,5})(\?.*)?$/i.exec(n))==null?void 0:i[1])==null?void 0:d.toUpperCase();return{kind:"file",href:n,label:c??"attachment",isData:!1}}return{kind:"none"}}function rt({fieldKey:t,value:n,schema:a}){const[r,s]=p.useState(!1),i=qs(n??""),d=t.replace(/[_-]/g," "),c=a==null?void 0:a.description,l=e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),c&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:c})]});return i.kind==="none"?e.jsxs("div",{children:[l,e.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):i.kind==="image"?e.jsxs("div",{children:[l,e.jsxs("div",{className:"mt-1",children:[e.jsx("button",{type:"button",onClick:()=>s(!0),className:"block rounded-[0.125em] border border-surface-border overflow-hidden hover:border-accent transition-colors",title:"View full size",children:e.jsx("img",{src:i.src,alt:t.replace(/[_-]/g," "),className:"max-h-48 max-w-full object-contain","data-testid":`attachment-image-${t}`})}),r&&e.jsx("div",{className:"fixed inset-0 z-[100] bg-text-primary/60 backdrop-blur-sm flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>s(!1),role:"dialog","aria-modal":"true","aria-label":`${d} — full size`,children:e.jsx("img",{src:i.src,alt:d,className:"max-h-[90vh] max-w-[90vw] object-contain"})})]})]}):e.jsxs("div",{children:[l,e.jsx("div",{className:"mt-1",children:e.jsxs("a",{href:i.href,...i.isData?{download:`${t}.${i.label==="PDF"?"pdf":"bin"}`}:{target:"_blank",rel:"noopener noreferrer"},className:"inline-flex items-center gap-1.5 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`attachment-link-${t}`,children:[e.jsx(cs,{className:"w-3.5 h-3.5",strokeWidth:1.5}),i.isData?`Download ${i.label}`:`Open ${i.label}`,i.isData?e.jsx(ds,{className:"w-3 h-3",strokeWidth:1.5}):e.jsx(xs,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}const at={"file-upload":Ss,"code-editor":Os,signature:Ds,"rich-text":Ps,markdown:Ws,checklist:Ls,attachment:rt,image:rt};function jt({value:t,onChange:n,disabled:a,submitAttempted:r,escalationContext:s}){var L,V;const[i,d]=p.useState({}),[c,l]=p.useState({}),[o,x]=p.useState(null),[u,f]=p.useState(!1),[j,h]=p.useState(new Set);p.useEffect(()=>{try{const b=JSON.parse(t);if(typeof b=="object"&&b!==null&&!Array.isArray(b)){const v={},w={};for(const[T,A]of Object.entries(b))T.startsWith("_")?w[T]=A:v[T]=A;d(v),l(w),x(w._form_schema&&typeof w._form_schema=="object"?w._form_schema:null),f(!1)}}catch{f(!0)}},[t]);const g=p.useCallback(b=>{d(b),n(JSON.stringify({...b,...c},null,2))},[c,n]),m=p.useCallback((b,v)=>{g({...i,[b]:v})},[i,g]),R=p.useCallback(b=>{h(v=>{if(v.has(b))return v;const w=new Set(v);return w.add(b),w})},[]);if(u)return e.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const C=Object.entries(i);if(C.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const I=o==null?void 0:o["x-lt-order"],P=I?[...C].sort((b,v)=>{const w=I.indexOf(b[0]),T=I.indexOf(v[0]);return(w===-1?1/0:w)-(T===-1?1/0:T)}):C,O={...s??{},resolver:i},_=P.filter(([b,v])=>{var T;const w=(T=o==null?void 0:o.properties)==null?void 0:T[b];return!(!We(w==null?void 0:w["x-lt-showIf"],O)||(w==null?void 0:w["x-lt-hide-if-empty"])===!0&&(v==null||v===""||v===!1||v===0))}),E=new Set((o==null?void 0:o.required)??[]),N=o==null?void 0:o["x-lt-layout"],M=o==null?void 0:o.title,S=o==null?void 0:o.description,$=[];for(const b of _){const[v]=b,w=(L=o==null?void 0:o.properties)==null?void 0:L[v],T=((V=w==null?void 0:w["x-lt-section"])==null?void 0:V.trim())||null,A=$[$.length-1];!A||A.name!==T?$.push({name:T,entries:[b]}):A.entries.push(b)}const D=b=>b.map(([v,w])=>{var k;const T=(k=o==null?void 0:o.properties)==null?void 0:k[v],A=(T==null?void 0:T.readOnly)===!0,H=(T==null?void 0:T["x-lt-span"])??1,re=E.has(v),xe=j.has(v)||!!r,J=Le(w,T,re,xe,O);return e.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${N==="two-column"&&H>=2?"col-span-2":""}`,children:e.jsx(bt,{fieldKey:v,value:w,onChange:W=>m(v,W),onBlur:()=>R(v),schema:o,isRequired:re,isReadOnly:A,error:J,escalationContext:O,submitAttempted:!!r})},v)});return e.jsxs("div",{className:`pb-8 ${a?"opacity-60 pointer-events-none":""}`,inert:a||void 0,"aria-disabled":a||void 0,children:[M&&e.jsx("h3",{className:"text-lg font-light text-text-primary mb-1",children:M}),S&&e.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:S}),e.jsx("div",{className:"space-y-10",children:$.map((b,v)=>e.jsxs("div",{className:b.name?"border-l-2 border-accent/30 bg-surface-sunken/80 rounded-[0.125em] p-4 animate-[section-enter_0.25s_ease-out]":"",children:[b.name&&e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(mt,{className:"w-3.5 h-3.5 text-accent/50 shrink-0",strokeWidth:1.5}),e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:b.name})]}),N==="two-column"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-14 gap-y-6",children:D(b.entries)}):e.jsx("div",{className:"space-y-6",children:D(b.entries)})]},b.name??`__s${v}`))})]})}function bt({fieldKey:t,value:n,onChange:a,onBlur:r,schema:s,isRequired:i,isReadOnly:d,error:c,escalationContext:l,submitAttempted:o}){var O;const x=t.replace(/[_-]/g," "),u=(O=s==null?void 0:s.properties)==null?void 0:O[t],f=u==null?void 0:u["x-lt-widget"],j=`lt-field-${t}`,h=`${j}-error`,g=`${j}-help`,m=typeof(u==null?void 0:u.description)=="string"&&u.description.length>0,C={id:j,"aria-required":i||void 0,"aria-invalid":c?!0:void 0,"aria-describedby":c?h:m?g:void 0};if(d&&!(f==="markdown"&&typeof n=="string")&&!((f==="attachment"||f==="image")&&typeof n=="string")){const _=n===null?"null":typeof n=="object"?JSON.stringify(n,null,2):String(n);return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,children:x}),e.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:_})]})}if(f&&f in at){const _=at[f],E={fieldKey:t,schema:u,escalationContext:l,isRequired:i,submitAttempted:o,error:c};if(typeof n=="string")return e.jsx(_,{...E,value:n,onChange:N=>a(N)});if(typeof n=="object"&&n!==null&&!Array.isArray(n))return e.jsx(_,{...E,value:JSON.stringify(n),onChange:N=>{try{a(JSON.parse(N))}catch{a(N)}}})}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:_=>{a(_.target.checked),r==null||r()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":t,...C}),e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[x,i&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),e.jsx(ne,{error:c,id:h})]});if(typeof n=="number")return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),e.jsx("input",{type:"number",value:n,onChange:_=>a(parseFloat(_.target.value)||0),onBlur:r,step:"any","data-field-key":t,className:je(!!c),...C}),e.jsx(ne,{error:c,id:h})]});if(typeof n=="string"){const _=(u==null?void 0:u.format)==="password",E=u==null?void 0:u.enum,N=u==null?void 0:u.description;if(E!=null&&E.length)return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),N&&e.jsx("p",{id:g,className:"text-[10px] text-text-tertiary mt-0.5",children:N}),e.jsx("select",{value:n,onChange:$=>a($.target.value),onBlur:r,"data-field-key":t,className:Vs(!!c),...C,children:E.map($=>e.jsx("option",{value:$,children:$},$))}),e.jsx(ne,{error:c,id:h})]});if(_)return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),N&&e.jsx("p",{id:g,className:"text-[10px] text-text-tertiary mt-0.5",children:N}),e.jsx("input",{type:"password",value:n,onChange:$=>a($.target.value),onBlur:r,"data-field-key":t,className:je(!!c),autoComplete:"off",...C}),e.jsx(ne,{error:c,id:h})]});const M=u==null?void 0:u.format,S={date:"date","date-time":"datetime-local",email:"email",uri:"url"};if(M&&M in S)return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),N&&e.jsx("p",{id:g,className:"text-[10px] text-text-tertiary mt-0.5",children:N}),e.jsx("input",{type:S[M],value:n,onChange:$=>a($.target.value),onBlur:r,"data-field-key":t,className:je(!!c),...C}),e.jsx(ne,{error:c,id:h})]});if(M==="textarea"||n.length>80){const $=u==null?void 0:u.maxLength,D=u==null?void 0:u["x-lt-max-length"];let L=$;if(L===void 0&&D&&l){const b=D.indexOf(".");if(b!==-1){const v=D.slice(0,b),w=D.slice(b+1),T=l[v];if(T&&typeof T=="object"){let A=T;for(const H of w.split("."))if(A=A[H],A===void 0)break;if(typeof A=="number")L=A;else if(typeof A=="string"){const H=Number(A);Number.isNaN(H)||(L=H)}}}}const V=L!==void 0&&n.length>L;return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),N&&e.jsx("p",{id:g,className:"text-[10px] text-text-tertiary mt-0.5",children:N}),e.jsx("textarea",{value:n,onChange:b=>{a(b.target.value),r==null||r()},onBlur:r,"data-field-key":t,className:`${je(!!c)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(n.length/60))),...C}),L!==void 0&&e.jsxs("p",{className:`text-[10px] mt-0.5 text-right tabular-nums ${V?"text-status-error font-medium":"text-text-quaternary"}`,children:[n.length," / ",L]}),e.jsx(ne,{error:c,id:h})]})}return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,htmlFor:j,children:x}),N&&e.jsx("p",{id:g,className:"text-[10px] text-text-tertiary mt-0.5",children:N}),e.jsx("input",{type:"text",value:n,onChange:$=>a($.target.value),onBlur:r,"data-field-key":t,className:je(!!c),...C}),e.jsx(ne,{error:c,id:h})]})}if(n===null)return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,children:x}),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(Y,{isRequired:i,children:x}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:n.map((_,E)=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-mono bg-surface-sunken rounded text-text-secondary",children:String(_)},E))})]});if(typeof n=="object"){const _=Object.entries(n);return e.jsxs("div",{children:[e.jsx(Y,{isRequired:i,children:x}),e.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:_.map(([E,N])=>e.jsx(bt,{fieldKey:E,value:N,onChange:M=>a({...n,[E]:M})},E))})]})}return null}function Y({children:t,isRequired:n,htmlFor:a}){return e.jsxs("label",{htmlFor:a,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 ne({error:t,id:n}){return t?e.jsx("p",{id:n,role:"alert",className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:t}):null}function je(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 Vs(t){return t?"select text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"select text-sm w-full mt-1"}function Js({json:t,onJsonChange:n,requestTriage:a,onRequestTriageChange:r,triageNotes:s,onTriageNotesChange:i,disabled:d=!1,submitAttempted:c=!1,showTriage:l=!1,escalationContext:o}){return e.jsxs(e.Fragment,{children:[l&&e.jsx("div",{className:"flex items-center justify-between mb-3",children:a?e.jsxs("button",{onClick:()=>r(!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:()=>r(!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.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:a?"pointer-events-none select-none":"",children:e.jsx(jt,{value:t,onChange:n,disabled:d,submitAttempted:c,escalationContext:o})}),a&&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:x=>i(x.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 yt(t,n){if(!t.includes("{"))return t;try{const a=s=>{if(!s)return{};try{return JSON.parse(s)}catch{return{}}},r={...n.metadata??{},...a(n.envelope),...a(n.escalation_payload)};return t.replace(/\{([^}]+)\}/g,(s,i)=>Object.prototype.hasOwnProperty.call(r,i)?String(r[i]):`{${i}}`)}catch{return t}}function it(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function De(t){return{escalation:t,metadata:t.metadata??null,envelope:it(t.envelope),payload:it(t.escalation_payload),resolver:null}}function zs({isRoundsExhausted:t,payloadObj:n,isTerminal:a,resolverPayload:r,onRetryTriage:s,isRetrying:i}){return e.jsxs(e.Fragment,{children:[t&&n&&e.jsx("div",{className:"mt-8",children:e.jsx(Is,{payload:n,isTerminal:a,resolverPayload:r,onRetryTriage:s,isRetrying:i})}),(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(Be,{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(ke,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(Be,{size:12}),"Go to Credentials"]})]})]})]})}function Hs({esc:t,resolverPayload:n,isTerminal:a,claimedByMe:r,activeView:s,metadataFormSchema:i,effectiveSchema:d,json:c,onJsonChange:l,requestTriage:o,onRequestTriageChange:x,triageNotes:u,onTriageNotesChange:f,onResolve:j,onEscalate:h,onClaim:g,submitAttempted:m,isCertified:R,hasAI:C}){const I=d,P=De(t);if(a){if(n==null)return null;const N=typeof n=="object"&&n!==null?n:{},M=d??i,S=M!=null&&M.properties?{...dt(N,M),_form_schema:M}:N;return e.jsx("div",{className:"mt-8 pt-6",children:e.jsx(jt,{value:JSON.stringify(S,null,2),onChange:()=>{},disabled:!0,escalationContext:P})})}if(s!=="resolve"||!(t.workflow_type||d))return null;const O=I==null?void 0:I["x-lt-viewport"],_=(O==null?void 0:O.type)==="iframe"&&!!O.src&&j&&h;if(_&&!r)return e.jsxs("button",{onClick:()=>g==null?void 0:g(),disabled:!g,className:"flex flex-col items-center justify-center min-h-[55vh] w-full gap-3 text-center group disabled:opacity-50 disabled:cursor-default",children:[e.jsx(us,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),e.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const E=_?yt(O.src,t):"";return e.jsx("div",{className:"mt-8 pt-6",children:_?e.jsx(gt,{src:E,escalation:t,schema:I,onResolve:j,onEscalate:h,submitAttempted:m}):e.jsx(Js,{json:c,onJsonChange:l,requestTriage:o,onRequestTriageChange:x,triageNotes:u,onTriageNotesChange:f,disabled:!r,submitAttempted:m,showTriage:!!R&&!!C,escalationContext:P})})}function Us({open:t,assignedUntil:n,onClose:a,onExtend:r,isPending:s}){const i=ot(),[d,c]=p.useState("30"),[l,o]=p.useState(0),x=d==="custom",u=x?l:parseInt(d),f=p.useCallback(j=>o(j),[]);return e.jsx(hs,{open:t,onClose:a,title:"Claim Expiring",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",e.jsx(Pe,{until:n}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),e.jsxs("select",{value:d,onChange:j=>{c(j.target.value),o(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[i.map(j=>e.jsx("option",{value:j.value,children:j.label},j.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),x&&e.jsx(ct,{onChange:f,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:a,className:"btn-secondary text-xs",children:"Dismiss"}),e.jsx("button",{onClick:()=>r(u),className:"btn-primary text-xs",disabled:s||!u||u<=0,children:s?"Extending...":"Extend Claim"})]})]})})}const Ys=9e4;function Gs(t,n=Ys){const[,a]=p.useState(0);if(p.useEffect(()=>{if(!t)return;const s=new Date(t).getTime()-Date.now();if(s<=0)return;const i=()=>a(l=>l+1),d=[],c=s-n;return c>0&&d.push(window.setTimeout(i,c)),d.push(window.setTimeout(i,s)),()=>d.forEach(l=>window.clearTimeout(l))},[t,n]),!t)return{expired:!1,expiringSoon:!1,msRemaining:0};const r=Math.max(0,new Date(t).getTime()-Date.now());return{expired:r<=0,expiringSoon:r>0&&r<=n,msRemaining:r}}const Xs="lt:escalation:draft:";function Fe(t){return`${Xs}${t}`}function Bs(t){try{return localStorage.getItem(Fe(t))}catch{return null}}function Qs(t,n){try{localStorage.setItem(Fe(t),n)}catch{}}function Ie(t){try{localStorage.removeItem(Fe(t))}catch{}}const vt="lt:escalation:panel:open";function Zs(){try{const t=localStorage.getItem(vt);return t===null?!0:t==="true"}catch{return!0}}function Se(t){try{localStorage.setItem(vt,String(t))}catch{}}function be(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function jn(){var ze,He,Ue,Ye;const{id:t}=fs(),{user:n}=Mt(),a=ft(),r=At(),{data:s,isLoading:i,refetch:d,isFetching:c}=It(t);Bt(t);const l=St(),o=Ot(),x=Dt(),u=Pt(),[f,j]=p.useState(!1),{data:h}=Wt((s==null?void 0:s.role)??""),{data:g}=Xt(),{data:m}=Lt(),{isBuilder:R}=Ft(),C=g==null?void 0:g.find(y=>y.workflow_type===(s==null?void 0:s.workflow_type)),I=((ze=m==null?void 0:m.telemetry)==null?void 0:ze.traceUrl)??null,[P,O]=p.useState("resolve"),[_,E]=p.useState("{}"),[N,M]=p.useState(Zs),[S,$]=p.useState(!1),[D,L]=p.useState(""),[V,b]=p.useState(!1),[v,w]=p.useState([]),[T,A]=p.useState(void 0),H=Gs(s==null?void 0:s.assigned_until),[re,xe]=p.useState(null);p.useEffect(()=>{if(!(!V||!s))try{const y=JSON.parse(_),z=y._form_schema;if(!z){w([]);return}const Q=z.properties??{},fe=new Set(z.required??[]),ce={...De(s),resolver:y},he=[];for(const[Ne,ge]of Object.entries(Q)){if(!We(ge["x-lt-showIf"],ce))continue;const te=Le(y[Ne],ge,fe.has(Ne),!0,ce);te&&he.push({field:Ne,message:te})}w(he)}catch{}},[_,V,s]);const J=((He=s==null?void 0:s.metadata)==null?void 0:He.form_schema)??null,k=(s==null?void 0:s.form_schema)??(C==null?void 0:C.resolver_schema)??null,W=J??k,ue=p.useRef(!1),ae=p.useRef(null);p.useEffect(()=>{if(ue.current)return;const y=J??(k!=null&&k.properties?k:null);if(y!=null&&y.properties){ue.current=!0;const z=be(s==null?void 0:s.envelope),Q=z==null?void 0:z.formDefaults,fe={...(s==null?void 0:s.metadata)??{},...typeof Q=="object"&&Q!==null?Q:{}},ce=dt(fe,y),he={_form_schema:y};for(const[Ge,Tt]of Object.entries(y.properties)){const Rt=Tt;he[Ge]=ce[Ge]??Rt.default??""}ae.current=JSON.stringify(he,null,2);const ge=!((s==null?void 0:s.status)==="resolved"||(s==null?void 0:s.status)==="cancelled")&&(s!=null&&s.id)?Bs(s.id):null,te=ge?be(ge):null;te&&typeof te=="object"&&!Array.isArray(te)?E(JSON.stringify({...te,_form_schema:y},null,2)):E(ae.current)}else W&&(ue.current=!0,E(JSON.stringify(W,null,2)))},[W,J,k,s==null?void 0:s.envelope,s==null?void 0:s.metadata,s==null?void 0:s.id,s==null?void 0:s.status]),p.useEffect(()=>{if(!ue.current||ae.current===null||!(s!=null&&s.id)||s.status!=="pending")return;const y=s.id,z=window.setTimeout(()=>{_===ae.current?Ie(y):Qs(y,_)},400);return()=>window.clearTimeout(z)},[_,s==null?void 0:s.id,s==null?void 0:s.status]);const ie=(s==null?void 0:s.subtype)==="rounds_exhausted";if(i)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 me=xt(s),U=me&&s.assigned_to===(n==null?void 0:n.userId),ee=me&&!U,q=s.status==="resolved"||s.status==="cancelled",F=W==null?void 0:W["x-lt-viewport"],X=(F==null?void 0:F.type)==="iframe"&&!!(F!=null&&F.src)&&U&&!q,le=be(s.escalation_payload),oe=be(s.resolver_payload),ve=be(s.envelope),Nt=!!((Ue=ve==null?void 0:ve.metadata)!=null&&Ue.certified),qe=qt(),Ve=qe!==null?qe:!!((Ye=m==null?void 0:m.ai)!=null&&Ye.enabled),B=typeof le=="object"&&le!==null&&!Array.isArray(le)?le:null,wt=B==null?void 0:B._triage,kt=typeof oe=="object"&&oe!==null&&!Array.isArray(oe)?oe:null,Ct=q?"terminal":U?"claimed_by_me":ee?"claimed_by_other":"available",Ce=y=>{l.mutate({id:s.id,durationMinutes:y})},pe=()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),a(-1)},_e=async y=>{await o.mutateAsync({id:s.id,resolverPayload:y}),Ie(s.id),pe()},Ee=async y=>{y&&(await x.mutateAsync({id:s.id,targetRole:y}),pe())},_t=async()=>{U||await l.mutateAsync({id:s.id,durationMinutes:30});const y=(B==null?void 0:B.diagnosis)||s.description||"";await o.mutateAsync({id:s.id,resolverPayload:{_lt:{needsTriage:!0},notes:y}}),pe()},Je=async()=>{await l.mutateAsync({id:s.id,durationMinutes:0}),pe()},Et=async()=>{await u.mutateAsync(s.id),Ie(s.id),j(!1),pe()},$t=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{onRefresh:()=>d(),isFetching:c,apiPath:`/escalations/${s.id}`}),e.jsx("button",{onClick:()=>M(y=>(Se(!y),!y)),className:"ml-2 text-text-tertiary hover:text-accent transition-colors",title:N?"Hide side panel":"Show side panel",children:N?e.jsx(Qe,{className:"w-5 h-5",strokeWidth:1.5}):e.jsx(Ze,{className:"w-5 h-5",strokeWidth:1.5})})]});return e.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-10 -mr-10 -mb-16",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[X?e.jsxs("div",{className:"relative flex-1 min-h-0 -ml-10",children:[e.jsx("div",{className:"absolute top-3 right-3 z-50 flex items-center gap-0.5 bg-surface/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-surface-border/40",children:[{onClick:Je,disabled:l.isPending,label:"Release",hoverClass:"hover:text-accent",icon:e.jsx(ms,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>j(!0),disabled:!1,label:"Cancel",hoverClass:"hover:text-status-error",icon:e.jsx(ps,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>M(y=>(Se(!y),!y)),disabled:!1,label:N?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:N?e.jsx(Qe,{className:"w-4 h-4",strokeWidth:1.5}):e.jsx(Ze,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:y,disabled:z,label:Q,hoverClass:fe,icon:ce})=>e.jsxs("div",{className:"relative group/tip",children:[e.jsx("button",{onClick:y,disabled:z,className:`text-text-tertiary ${fe} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:ce}),e.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-0.5 rounded text-[11px] bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:Q})]},Q))}),e.jsx(gt,{src:yt(F.src,s),escalation:s,schema:W,onResolve:_e,onEscalate:Ee,submitAttempted:V,fill:!0})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"shrink-0 pt-10 pr-10",children:e.jsx(Yt,{title:s.description||"Escalation",actions:$t})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-10",children:[e.jsx(zs,{isRoundsExhausted:ie,payloadObj:B,isTerminal:q,resolverPayload:oe,onRetryTriage:_t,isRetrying:l.isPending||o.isPending}),e.jsx(Hs,{esc:s,resolverPayload:oe,isTerminal:q,claimedByMe:U,activeView:P,metadataFormSchema:J,effectiveSchema:W,json:_,onJsonChange:E,requestTriage:S,onRequestTriageChange:$,triageNotes:D,onTriageNotesChange:L,onResolve:_e,onEscalate:Ee,onClaim:()=>Ce(30),submitAttempted:V,isCertified:Nt,hasAI:Ve}),e.jsx("div",{className:"h-10"})]})]}),!X&&e.jsx(As,{escalationContext:De(s),mode:Ct,activeView:P,onActiveViewChange:O,onClaim:Ce,claimPending:l.isPending,workflowType:s.workflow_type,json:_,onResolve:_e,resolvePending:o.isPending,resolveError:o.error,requestTriage:S,triageNotes:D,currentRole:s.role,escalationTargets:((h==null?void 0:h.targets)??[]).filter(y=>y!==s.role),onEscalate:Ee,escalatePending:x.isPending,escalateError:x.error,onRelease:Je,releasePending:l.isPending,onCancel:()=>j(!0),assignedTo:s.assigned_to,assignedUntil:s.assigned_until,onSubmitAttempt:()=>b(!0),onValidationErrors:y=>{w(y),M(!0),Se(!0),A(G.ERRORS)}})]}),e.jsx(_s,{esc:s,schema:W,envelope:ve,payload:B,resolver:kt,triage:wt??null,hasAI:Ve,claimed:me,claimedByMe:U,isTerminal:q,isBuilder:R,traceUrl:I,open:N,noGutter:X,formErrors:v,activePanel:T,onPanelChange:A}),e.jsx(Ut,{open:f,onClose:()=>j(!1),onConfirm:Et,isPending:u.isPending,error:u.error}),U&&!q&&s.assigned_until&&e.jsx(Us,{open:H.expiringSoon&&s.assigned_until!==re,assignedUntil:s.assigned_until,onClose:()=>xe(s.assigned_until??null),onExtend:Ce,isPending:l.isPending})]})}export{jn as EscalationDetailPage};
5
- //# sourceMappingURL=index-BJ0jjFsI.js.map