@hotmeshio/long-tail 0.8.2 → 0.8.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 (194) hide show
  1. package/build/api/escalations/create.js +19 -60
  2. package/build/api/escalations/resolve.js +12 -4
  3. package/build/api/escalations/single.js +8 -4
  4. package/build/api/roles.d.ts +1 -0
  5. package/build/scripts/twin-farm.d.ts +44 -0
  6. package/build/scripts/twin-farm.js +427 -0
  7. package/build/services/escalation/queries.d.ts +13 -0
  8. package/build/services/escalation/queries.js +27 -0
  9. package/build/services/orchestrator/condition.d.ts +18 -12
  10. package/build/services/orchestrator/condition.js +11 -8
  11. package/build/services/role/index.d.ts +1 -2
  12. package/build/services/role/index.js +1 -2
  13. package/build/services/role/schema-validator.d.ts +9 -0
  14. package/build/services/role/schema-validator.js +42 -0
  15. package/build/services/role/sql.d.ts +1 -1
  16. package/build/services/role/sql.js +2 -2
  17. package/build/services/role/types.d.ts +8 -6
  18. package/build/system/mcp-servers/admin/schemas.js +4 -2
  19. package/build/system/mcp-servers/human-queue-schemas.js +6 -2
  20. package/build/system/mcp-servers/human-queue.js +11 -3
  21. package/build/tsconfig.tsbuildinfo +1 -1
  22. package/build/types/config.d.ts +2 -0
  23. package/build/types/startup.d.ts +5 -1
  24. package/dashboard/dist/assets/{AdminDashboard-Nvja-XIJ.js → AdminDashboard-B-JptT54.js} +2 -2
  25. package/dashboard/dist/assets/{AdminDashboard-Nvja-XIJ.js.map → AdminDashboard-B-JptT54.js.map} +1 -1
  26. package/dashboard/dist/assets/{AgentConfigPage-Sf2god7q.js → AgentConfigPage-B1Jc6iJk.js} +2 -2
  27. package/dashboard/dist/assets/{AgentConfigPage-Sf2god7q.js.map → AgentConfigPage-B1Jc6iJk.js.map} +1 -1
  28. package/dashboard/dist/assets/{AgentDetailPage-DtgDeZJR.js → AgentDetailPage-CWpclCOY.js} +2 -2
  29. package/dashboard/dist/assets/{AgentDetailPage-DtgDeZJR.js.map → AgentDetailPage-CWpclCOY.js.map} +1 -1
  30. package/dashboard/dist/assets/{AgentsPage-C6zqP_xC.js → AgentsPage-DyAf5GA2.js} +2 -2
  31. package/dashboard/dist/assets/{AgentsPage-C6zqP_xC.js.map → AgentsPage-DyAf5GA2.js.map} +1 -1
  32. package/dashboard/dist/assets/{AvailableEscalationsPage-D61kC7Is.js → AvailableEscalationsPage-DDwAgklw.js} +2 -2
  33. package/dashboard/dist/assets/{AvailableEscalationsPage-D61kC7Is.js.map → AvailableEscalationsPage-DDwAgklw.js.map} +1 -1
  34. package/dashboard/dist/assets/{BotPicker-ChgljKHj.js → BotPicker-B1RdaNuY.js} +2 -2
  35. package/dashboard/dist/assets/{BotPicker-ChgljKHj.js.map → BotPicker-B1RdaNuY.js.map} +1 -1
  36. package/dashboard/dist/assets/{CapabilitiesPage-DeybKoZM.js → CapabilitiesPage-CxHDnyjX.js} +2 -2
  37. package/dashboard/dist/assets/{CapabilitiesPage-DeybKoZM.js.map → CapabilitiesPage-CxHDnyjX.js.map} +1 -1
  38. package/dashboard/dist/assets/{CollapsibleSection-BPiTuPBk.js → CollapsibleSection-Ds0e8cCO.js} +2 -2
  39. package/dashboard/dist/assets/{CollapsibleSection-BPiTuPBk.js.map → CollapsibleSection-Ds0e8cCO.js.map} +1 -1
  40. package/dashboard/dist/assets/{CredentialsPage-DXOcPWtd.js → CredentialsPage-D8UVO-3A.js} +2 -2
  41. package/dashboard/dist/assets/{CredentialsPage-DXOcPWtd.js.map → CredentialsPage-D8UVO-3A.js.map} +1 -1
  42. package/dashboard/dist/assets/{CronLabel-D3411N8x.js → CronLabel-ZesYXxCH.js} +2 -2
  43. package/dashboard/dist/assets/{CronLabel-D3411N8x.js.map → CronLabel-ZesYXxCH.js.map} +1 -1
  44. package/dashboard/dist/assets/{CustomDurationPicker-WG2tPSbV.js → CustomDurationPicker-OKlwH5a_.js} +2 -2
  45. package/dashboard/dist/assets/{CustomDurationPicker-WG2tPSbV.js.map → CustomDurationPicker-OKlwH5a_.js.map} +1 -1
  46. package/dashboard/dist/assets/{ElapsedCell-BFWEGSD7.js → ElapsedCell-CO8S6vdb.js} +2 -2
  47. package/dashboard/dist/assets/{ElapsedCell-BFWEGSD7.js.map → ElapsedCell-CO8S6vdb.js.map} +1 -1
  48. package/dashboard/dist/assets/{EscalationSchemaPage-D2Y5Yeqn.js → EscalationSchemaPage-Br5sD8-N.js} +2 -2
  49. package/dashboard/dist/assets/{EscalationSchemaPage-D2Y5Yeqn.js.map → EscalationSchemaPage-Br5sD8-N.js.map} +1 -1
  50. package/dashboard/dist/assets/{EscalationsOverview-VlLcX2YM.js → EscalationsOverview-DMpRvVql.js} +2 -2
  51. package/dashboard/dist/assets/{EscalationsOverview-VlLcX2YM.js.map → EscalationsOverview-DMpRvVql.js.map} +1 -1
  52. package/dashboard/dist/assets/{EventTable-3MJw14jp.js → EventTable-BARJeiS2.js} +2 -2
  53. package/dashboard/dist/assets/{EventTable-3MJw14jp.js.map → EventTable-BARJeiS2.js.map} +1 -1
  54. package/dashboard/dist/assets/{GraphInvokePage-QaUUrPnh.js → GraphInvokePage-CTuul-av.js} +2 -2
  55. package/dashboard/dist/assets/{GraphInvokePage-QaUUrPnh.js.map → GraphInvokePage-CTuul-av.js.map} +1 -1
  56. package/dashboard/dist/assets/{HomePage-Br0A3iOp.js → HomePage-BKFpOaHX.js} +2 -2
  57. package/dashboard/dist/assets/{HomePage-Br0A3iOp.js.map → HomePage-BKFpOaHX.js.map} +1 -1
  58. package/dashboard/dist/assets/{ListToolbar-d4MGQefV.js → ListToolbar-Dz2_neVF.js} +2 -2
  59. package/dashboard/dist/assets/{ListToolbar-d4MGQefV.js.map → ListToolbar-Dz2_neVF.js.map} +1 -1
  60. package/dashboard/dist/assets/{McpOverview-CUzJD5Z5.js → McpOverview-Do-vaEqV.js} +2 -2
  61. package/dashboard/dist/assets/{McpOverview-CUzJD5Z5.js.map → McpOverview-Do-vaEqV.js.map} +1 -1
  62. package/dashboard/dist/assets/{McpQueryDetailPage-pYSZmV3M.js → McpQueryDetailPage-HwDGNSbN.js} +2 -2
  63. package/dashboard/dist/assets/{McpQueryDetailPage-pYSZmV3M.js.map → McpQueryDetailPage-HwDGNSbN.js.map} +1 -1
  64. package/dashboard/dist/assets/{McpQueryPage-CA5C5dss.js → McpQueryPage-DxMUpQ7R.js} +2 -2
  65. package/dashboard/dist/assets/{McpQueryPage-CA5C5dss.js.map → McpQueryPage-DxMUpQ7R.js.map} +1 -1
  66. package/dashboard/dist/assets/{McpRunDetailPage-CrRkXwAe.js → McpRunDetailPage-BzzZIXIk.js} +2 -2
  67. package/dashboard/dist/assets/{McpRunDetailPage-CrRkXwAe.js.map → McpRunDetailPage-BzzZIXIk.js.map} +1 -1
  68. package/dashboard/dist/assets/{McpRunsPage-BqRBDbkn.js → McpRunsPage-D3J42d2i.js} +2 -2
  69. package/dashboard/dist/assets/{McpRunsPage-BqRBDbkn.js.map → McpRunsPage-D3J42d2i.js.map} +1 -1
  70. package/dashboard/dist/assets/OperationsPage-BaM-QDhy.js +2 -0
  71. package/dashboard/dist/assets/{OperationsPage--uVJxzmP.js.map → OperationsPage-BaM-QDhy.js.map} +1 -1
  72. package/dashboard/dist/assets/{OperatorDashboard-D-UMrTqI.js → OperatorDashboard-BqJn8wEZ.js} +2 -2
  73. package/dashboard/dist/assets/{OperatorDashboard-D-UMrTqI.js.map → OperatorDashboard-BqJn8wEZ.js.map} +1 -1
  74. package/dashboard/dist/assets/{ProcessDetailPage-BV6D_wuR.js → ProcessDetailPage-C8sT2xuE.js} +2 -2
  75. package/dashboard/dist/assets/{ProcessDetailPage-BV6D_wuR.js.map → ProcessDetailPage-C8sT2xuE.js.map} +1 -1
  76. package/dashboard/dist/assets/{ProcessesListPage-BAalEHpx.js → ProcessesListPage-eA8buUgd.js} +2 -2
  77. package/dashboard/dist/assets/{ProcessesListPage-BAalEHpx.js.map → ProcessesListPage-eA8buUgd.js.map} +1 -1
  78. package/dashboard/dist/assets/{RoleDetailPage-ClE7rUoo.js → RoleDetailPage-aR-ror5v.js} +2 -2
  79. package/dashboard/dist/assets/{RoleDetailPage-ClE7rUoo.js.map → RoleDetailPage-aR-ror5v.js.map} +1 -1
  80. package/dashboard/dist/assets/{RolesPage-DMsgZioQ.js → RolesPage-BQNQxsMY.js} +2 -2
  81. package/dashboard/dist/assets/{RolesPage-DMsgZioQ.js.map → RolesPage-BQNQxsMY.js.map} +1 -1
  82. package/dashboard/dist/assets/{RunAsSelector-VCnEYIwj.js → RunAsSelector-mhusrlYE.js} +2 -2
  83. package/dashboard/dist/assets/{RunAsSelector-VCnEYIwj.js.map → RunAsSelector-mhusrlYE.js.map} +1 -1
  84. package/dashboard/dist/assets/{StickyPagination-3eCY2-_V.js → StickyPagination-CqT9Q1I6.js} +2 -2
  85. package/dashboard/dist/assets/{StickyPagination-3eCY2-_V.js.map → StickyPagination-CqT9Q1I6.js.map} +1 -1
  86. package/dashboard/dist/assets/{StreamMessageDetail-70kDFH4o.js → StreamMessageDetail-jOJaoupp.js} +2 -2
  87. package/dashboard/dist/assets/{StreamMessageDetail-70kDFH4o.js.map → StreamMessageDetail-jOJaoupp.js.map} +1 -1
  88. package/dashboard/dist/assets/{SwimlaneTimeline-BOXRit6t.js → SwimlaneTimeline-BrfmWgAj.js} +2 -2
  89. package/dashboard/dist/assets/{SwimlaneTimeline-BOXRit6t.js.map → SwimlaneTimeline-BrfmWgAj.js.map} +1 -1
  90. package/dashboard/dist/assets/{TaskDetailPage-YxGQE9Qg.js → TaskDetailPage-Cus_JHIC.js} +2 -2
  91. package/dashboard/dist/assets/{TaskDetailPage-YxGQE9Qg.js.map → TaskDetailPage-Cus_JHIC.js.map} +1 -1
  92. package/dashboard/dist/assets/{TasksListPage-DuLJQN7Q.js → TasksListPage-B7GK8AoX.js} +2 -2
  93. package/dashboard/dist/assets/{TasksListPage-DuLJQN7Q.js.map → TasksListPage-B7GK8AoX.js.map} +1 -1
  94. package/dashboard/dist/assets/{TimeAgo-dnc1ZjKc.js → TimeAgo-C606LzT3.js} +2 -2
  95. package/dashboard/dist/assets/{TimeAgo-dnc1ZjKc.js.map → TimeAgo-C606LzT3.js.map} +1 -1
  96. package/dashboard/dist/assets/{TimestampCell-CDR6cTyq.js → TimestampCell-hfh6zvH-.js} +2 -2
  97. package/dashboard/dist/assets/{TimestampCell-CDR6cTyq.js.map → TimestampCell-hfh6zvH-.js.map} +1 -1
  98. package/dashboard/dist/assets/{ToolTestPanel-CfwGdRdz.js → ToolTestPanel-CsPsyvQq.js} +2 -2
  99. package/dashboard/dist/assets/{ToolTestPanel-CfwGdRdz.js.map → ToolTestPanel-CsPsyvQq.js.map} +1 -1
  100. package/dashboard/dist/assets/{TopicDetailPage-f2qaeGFz.js → TopicDetailPage-Diz6r7zr.js} +2 -2
  101. package/dashboard/dist/assets/{TopicDetailPage-f2qaeGFz.js.map → TopicDetailPage-Diz6r7zr.js.map} +1 -1
  102. package/dashboard/dist/assets/{TopicsPage-CwYdVmyK.js → TopicsPage-B6fn7fFh.js} +2 -2
  103. package/dashboard/dist/assets/{TopicsPage-CwYdVmyK.js.map → TopicsPage-B6fn7fFh.js.map} +1 -1
  104. package/dashboard/dist/assets/{UserName-CRE7EZPU.js → UserName-Cc-5QH5q.js} +2 -2
  105. package/dashboard/dist/assets/{UserName-CRE7EZPU.js.map → UserName-Cc-5QH5q.js.map} +1 -1
  106. package/dashboard/dist/assets/{WorkflowExecutionPage-BjNBu-Zt.js → WorkflowExecutionPage-BFq7UdhA.js} +2 -2
  107. package/dashboard/dist/assets/{WorkflowExecutionPage-BjNBu-Zt.js.map → WorkflowExecutionPage-BFq7UdhA.js.map} +1 -1
  108. package/dashboard/dist/assets/{WorkflowsDashboard-DfpvbzNt.js → WorkflowsDashboard-CHCM6hUa.js} +2 -2
  109. package/dashboard/dist/assets/{WorkflowsDashboard-DfpvbzNt.js.map → WorkflowsDashboard-CHCM6hUa.js.map} +1 -1
  110. package/dashboard/dist/assets/{WorkflowsOverview-BwD2lQwj.js → WorkflowsOverview-WeOvl8-_.js} +2 -2
  111. package/dashboard/dist/assets/{WorkflowsOverview-BwD2lQwj.js.map → WorkflowsOverview-WeOvl8-_.js.map} +1 -1
  112. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BhHb7j2s.js → YamlWorkflowDetailPage-6GfhVDpv.js} +2 -2
  113. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BhHb7j2s.js.map → YamlWorkflowDetailPage-6GfhVDpv.js.map} +1 -1
  114. package/dashboard/dist/assets/{YamlWorkflowsPage-SBRpY2dI.js → YamlWorkflowsPage-DqcY3ocP.js} +2 -2
  115. package/dashboard/dist/assets/{YamlWorkflowsPage-SBRpY2dI.js.map → YamlWorkflowsPage-DqcY3ocP.js.map} +1 -1
  116. package/dashboard/dist/assets/{agents-VbkdqWCr.js → agents-DlzvjNxE.js} +2 -2
  117. package/dashboard/dist/assets/{agents-VbkdqWCr.js.map → agents-DlzvjNxE.js.map} +1 -1
  118. package/dashboard/dist/assets/{bots-CsgYcYU_.js → bots-CWMN-KUI.js} +2 -2
  119. package/dashboard/dist/assets/{bots-CsgYcYU_.js.map → bots-CWMN-KUI.js.map} +1 -1
  120. package/dashboard/dist/assets/{capabilities-CMhFyoDl.js → capabilities-_WSZ7cxO.js} +2 -2
  121. package/dashboard/dist/assets/{capabilities-CMhFyoDl.js.map → capabilities-_WSZ7cxO.js.map} +1 -1
  122. package/dashboard/dist/assets/{controlplane-BstXtPbV.js → controlplane-_k9nWZy3.js} +2 -2
  123. package/dashboard/dist/assets/{controlplane-BstXtPbV.js.map → controlplane-_k9nWZy3.js.map} +1 -1
  124. package/dashboard/dist/assets/{escalation-C0BNAeIG.js → escalation-CK8ElYzD.js} +2 -2
  125. package/dashboard/dist/assets/{escalation-C0BNAeIG.js.map → escalation-CK8ElYzD.js.map} +1 -1
  126. package/dashboard/dist/assets/{escalation-columns-DajPgfuV.js → escalation-columns-Dyrf6Tdp.js} +2 -2
  127. package/dashboard/dist/assets/{escalation-columns-DajPgfuV.js.map → escalation-columns-Dyrf6Tdp.js.map} +1 -1
  128. package/dashboard/dist/assets/{index-BWLVqWLU.js → index-BiApvBEz.js} +2 -2
  129. package/dashboard/dist/assets/{index-BWLVqWLU.js.map → index-BiApvBEz.js.map} +1 -1
  130. package/dashboard/dist/assets/{index-D_6JFBiM.js → index-C3h0qGzG.js} +2 -2
  131. package/dashboard/dist/assets/{index-D_6JFBiM.js.map → index-C3h0qGzG.js.map} +1 -1
  132. package/dashboard/dist/assets/{index-fqU_l4dC.js → index-C5Yc3TT7.js} +2 -2
  133. package/dashboard/dist/assets/{index-fqU_l4dC.js.map → index-C5Yc3TT7.js.map} +1 -1
  134. package/dashboard/dist/assets/{index-Cl1vY8Lg.js → index-C7VXLKJs.js} +2 -2
  135. package/dashboard/dist/assets/{index-Cl1vY8Lg.js.map → index-C7VXLKJs.js.map} +1 -1
  136. package/dashboard/dist/assets/{index-CvFQtPWA.js → index-D8GcHxNJ.js} +2 -2
  137. package/dashboard/dist/assets/{index-CvFQtPWA.js.map → index-D8GcHxNJ.js.map} +1 -1
  138. package/dashboard/dist/assets/{index-CSixdp5W.js → index-Dc-Ye2wk.js} +2 -2
  139. package/dashboard/dist/assets/{index-CSixdp5W.js.map → index-Dc-Ye2wk.js.map} +1 -1
  140. package/dashboard/dist/assets/{index-DWlPFH3T.js → index-Dd4Si1Rl.js} +2 -2
  141. package/dashboard/dist/assets/{index-DWlPFH3T.js.map → index-Dd4Si1Rl.js.map} +1 -1
  142. package/dashboard/dist/assets/{index-C8k3Z2su.js → index-DwWP-Z_c.js} +3 -3
  143. package/dashboard/dist/assets/{index-C8k3Z2su.js.map → index-DwWP-Z_c.js.map} +1 -1
  144. package/dashboard/dist/assets/index-Ex5tEte8.js +5 -0
  145. package/dashboard/dist/assets/index-Ex5tEte8.js.map +1 -0
  146. package/dashboard/dist/assets/index-OV1JoB_P.js +6 -0
  147. package/dashboard/dist/assets/index-OV1JoB_P.js.map +1 -0
  148. package/dashboard/dist/assets/{index-BY5m8rhE.js → index-ZBj6Xgim.js} +2 -2
  149. package/dashboard/dist/assets/{index-BY5m8rhE.js.map → index-ZBj6Xgim.js.map} +1 -1
  150. package/dashboard/dist/assets/{index-CXnSqSFH.js → index-kKufOPLo.js} +2 -2
  151. package/dashboard/dist/assets/{index-CXnSqSFH.js.map → index-kKufOPLo.js.map} +1 -1
  152. package/dashboard/dist/assets/{index-CaSMWhLU.js → index-uUYXmvFf.js} +2 -2
  153. package/dashboard/dist/assets/{index-CaSMWhLU.js.map → index-uUYXmvFf.js.map} +1 -1
  154. package/dashboard/dist/assets/{knowledge-Bskl1MbC.js → knowledge-fYoEF4Lx.js} +2 -2
  155. package/dashboard/dist/assets/{knowledge-Bskl1MbC.js.map → knowledge-fYoEF4Lx.js.map} +1 -1
  156. package/dashboard/dist/assets/{mcp-C_qz25AB.js → mcp-1lzlgtS8.js} +2 -2
  157. package/dashboard/dist/assets/{mcp-C_qz25AB.js.map → mcp-1lzlgtS8.js.map} +1 -1
  158. package/dashboard/dist/assets/{mcp-query-CJx58s1A.js → mcp-query-nlrAz7m_.js} +2 -2
  159. package/dashboard/dist/assets/{mcp-query-CJx58s1A.js.map → mcp-query-nlrAz7m_.js.map} +1 -1
  160. package/dashboard/dist/assets/{pipelines-B6GzpgtG.js → pipelines-Ihi7EKXi.js} +2 -2
  161. package/dashboard/dist/assets/{pipelines-B6GzpgtG.js.map → pipelines-Ihi7EKXi.js.map} +1 -1
  162. package/dashboard/dist/assets/{roles-D8lPvFgG.js → roles-D4Wn7kE9.js} +2 -2
  163. package/dashboard/dist/assets/{roles-D8lPvFgG.js.map → roles-D4Wn7kE9.js.map} +1 -1
  164. package/dashboard/dist/assets/{tasks-BWHakSYf.js → tasks-Crk9Y3C4.js} +2 -2
  165. package/dashboard/dist/assets/{tasks-BWHakSYf.js.map → tasks-Crk9Y3C4.js.map} +1 -1
  166. package/dashboard/dist/assets/{topics-0dXzPX8t.js → topics-CtfcCyw9.js} +2 -2
  167. package/dashboard/dist/assets/{topics-0dXzPX8t.js.map → topics-CtfcCyw9.js.map} +1 -1
  168. package/dashboard/dist/assets/{useEventHooks-Dpixlgp-.js → useEventHooks-Dn_vN2xE.js} +2 -2
  169. package/dashboard/dist/assets/{useEventHooks-Dpixlgp-.js.map → useEventHooks-Dn_vN2xE.js.map} +1 -1
  170. package/dashboard/dist/assets/{useNamespace-DQMc77ok.js → useNamespace-Cfs3vKWk.js} +2 -2
  171. package/dashboard/dist/assets/{useNamespace-DQMc77ok.js.map → useNamespace-Cfs3vKWk.js.map} +1 -1
  172. package/dashboard/dist/assets/{useYamlActivityEvents-DO5bHOVE.js → useYamlActivityEvents-ymobxH47.js} +2 -2
  173. package/dashboard/dist/assets/{useYamlActivityEvents-DO5bHOVE.js.map → useYamlActivityEvents-ymobxH47.js.map} +1 -1
  174. package/dashboard/dist/assets/{users-B_LVbnUk.js → users-DngGIiC_.js} +2 -2
  175. package/dashboard/dist/assets/{users-B_LVbnUk.js.map → users-DngGIiC_.js.map} +1 -1
  176. package/dashboard/dist/assets/{workflows-WmmGDAvo.js → workflows-DuUspMAl.js} +2 -2
  177. package/dashboard/dist/assets/{workflows-WmmGDAvo.js.map → workflows-DuUspMAl.js.map} +1 -1
  178. package/dashboard/dist/assets/{yaml-workflows-BS7KHhU1.js → yaml-workflows-DXQCiOsP.js} +2 -2
  179. package/dashboard/dist/assets/{yaml-workflows-BS7KHhU1.js.map → yaml-workflows-DXQCiOsP.js.map} +1 -1
  180. package/dashboard/dist/index.html +1 -1
  181. package/docs/api/http/escalations.md +8 -4
  182. package/docs/api/http/roles.md +1 -1
  183. package/docs/api/http/workflows.md +1 -1
  184. package/docs/api/sdk/escalations.md +3 -3
  185. package/docs/api/sdk/workflows.md +1 -1
  186. package/docs/dashboard.md +2 -2
  187. package/docs/data.md +1 -1
  188. package/docs/hitl-guide.md +2 -3
  189. package/package.json +2 -1
  190. package/dashboard/dist/assets/OperationsPage--uVJxzmP.js +0 -2
  191. package/dashboard/dist/assets/index-BYf0oNSQ.js +0 -6
  192. package/dashboard/dist/assets/index-BYf0oNSQ.js.map +0 -1
  193. package/dashboard/dist/assets/index-BcaQ_hCz.js +0 -9
  194. package/dashboard/dist/assets/index-BcaQ_hCz.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-workflows-BS7KHhU1.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"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"}
1
+ {"version":3,"file":"yaml-workflows-DXQCiOsP.js","sources":["../../src/api/yaml-workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { LTYamlWorkflowRecord, LTYamlWorkflowStatus, LTYamlWorkflowVersion } from './types';\n\ninterface YamlWorkflowListResponse {\n workflows: LTYamlWorkflowRecord[];\n total: number;\n}\n\ninterface YamlWorkflowFilters {\n status?: LTYamlWorkflowStatus;\n graph_topic?: string;\n app_id?: string;\n search?: string;\n set_id?: string;\n limit?: number;\n offset?: number;\n}\n\nexport function useYamlWorkflows(filters: YamlWorkflowFilters = {}) {\n const params = new URLSearchParams();\n if (filters.status) params.set('status', filters.status);\n if (filters.graph_topic) params.set('graph_topic', filters.graph_topic);\n if (filters.app_id) params.set('app_id', filters.app_id);\n if (filters.search) params.set('search', filters.search);\n if (filters.set_id) params.set('set_id', filters.set_id);\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', filters],\n queryFn: () => apiFetch(`/yaml-workflows?${params}`),\n });\n}\n\nexport function useYamlWorkflowAppIds() {\n return useQuery<{ app_ids: string[] }>({\n queryKey: ['yamlWorkflowAppIds'],\n queryFn: () => apiFetch('/yaml-workflows/app-ids'),\n });\n}\n\nexport function useYamlWorkflowByTopic(graphTopic: string | undefined, appId?: string) {\n return useQuery<YamlWorkflowListResponse>({\n queryKey: ['yamlWorkflows', 'byTopic', graphTopic, appId],\n queryFn: () => {\n const params = new URLSearchParams({ graph_topic: graphTopic!, limit: '1' });\n if (appId) params.set('app_id', appId);\n return apiFetch(`/yaml-workflows?${params}`);\n },\n enabled: !!graphTopic,\n });\n}\n\nexport function useYamlWorkflow(id: string) {\n return useQuery<LTYamlWorkflowRecord>({\n queryKey: ['yamlWorkflows', id],\n queryFn: () => apiFetch(`/yaml-workflows/${id}`),\n enabled: !!id,\n });\n}\n\nexport function useCreateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: {\n workflow_id: string;\n task_queue: string;\n workflow_name: string;\n name: string;\n description?: string;\n app_id?: string;\n subscribes?: string;\n tags?: string[];\n compilation_feedback?: string;\n }) =>\n apiFetch<LTYamlWorkflowRecord>('/yaml-workflows', {\n method: 'POST',\n body: JSON.stringify(input),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeployYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/deploy`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useActivateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/activate`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, data, sync, execute_as }: { id: string; data: Record<string, unknown>; sync?: boolean; execute_as?: string }) =>\n apiFetch<{ result?: unknown; job_id?: string }>(`/yaml-workflows/${id}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, sync, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRegenerateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, task_queue, compilation_feedback }: { id: string; task_queue?: string; compilation_feedback?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/regenerate`, {\n method: 'POST',\n body: JSON.stringify({ task_queue, compilation_feedback }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useArchiveYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/archive`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useRestoreYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/restore`, {\n method: 'POST',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflow'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpdateYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, ...updates }: { id: string; yaml_content?: string; name?: string; description?: string; input_schema?: Record<string, unknown>; output_schema?: Record<string, unknown>; tags?: string[]; app_id?: string; graph_topic?: string }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}`, {\n method: 'PUT',\n body: JSON.stringify(updates),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteYamlWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<{ deleted: boolean }>(`/yaml-workflows/${id}`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Cron scheduling ─────────────────────────────────────────────\n\nexport function useSetYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, cron_schedule, cron_envelope, execute_as }: {\n id: string;\n cron_schedule: string;\n cron_envelope?: Record<string, unknown> | null;\n execute_as?: string | null;\n }) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'PUT',\n body: JSON.stringify({ cron_schedule, cron_envelope, execute_as }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\nexport function useClearYamlCron() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (id: string) =>\n apiFetch<LTYamlWorkflowRecord>(`/yaml-workflows/${id}/cron`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['yamlWorkflows'], refetchType: 'all' });\n },\n });\n}\n\n// ── Version history ─────────────────────────────────────────────\n\nexport function useYamlWorkflowVersions(id: string) {\n return useQuery<{ versions: LTYamlWorkflowVersion[]; total: number }>({\n queryKey: ['yamlWorkflows', id, 'versions'],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions`),\n enabled: !!id,\n });\n}\n\nexport function useYamlWorkflowVersion(id: string, version: number | null) {\n return useQuery<LTYamlWorkflowVersion>({\n queryKey: ['yamlWorkflows', id, 'versions', version],\n queryFn: () => apiFetch(`/yaml-workflows/${id}/versions/${version}`),\n enabled: !!id && version !== null,\n });\n}\n"],"names":["useYamlWorkflows","filters","params","useQuery","apiFetch","useYamlWorkflowAppIds","useYamlWorkflow","id","useCreateYamlWorkflow","queryClient","useQueryClient","useMutation","input","useDeployYamlWorkflow","useActivateYamlWorkflow","useInvokeYamlWorkflow","data","sync","execute_as","useRegenerateYamlWorkflow","task_queue","compilation_feedback","useArchiveYamlWorkflow","useRestoreYamlWorkflow","useUpdateYamlWorkflow","updates","useDeleteYamlWorkflow","useYamlWorkflowVersions","useYamlWorkflowVersion","version"],"mappings":"qGAmBO,SAASA,EAAiBC,EAA+B,GAAI,CAClE,MAAMC,EAAS,IAAI,gBACnB,OAAID,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,aAAaC,EAAO,IAAI,cAAeD,EAAQ,WAAW,EAClEA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,QAAQC,EAAO,IAAI,SAAUD,EAAQ,MAAM,EACnDA,EAAQ,OAAOC,EAAO,IAAI,QAAS,OAAOD,EAAQ,KAAK,CAAC,EACxDA,EAAQ,SAAW,QAAWC,EAAO,IAAI,SAAU,OAAOD,EAAQ,MAAM,CAAC,EAEtEE,EAAmC,CACxC,SAAU,CAAC,gBAAiBF,CAAO,EACnC,QAAS,IAAMG,EAAS,mBAAmBF,CAAM,EAAE,CAAA,CACpD,CACH,CAEO,SAASG,GAAwB,CACtC,OAAOF,EAAgC,CACrC,SAAU,CAAC,oBAAoB,EAC/B,QAAS,IAAMC,EAAS,yBAAyB,CAAA,CAClD,CACH,CAcO,SAASE,EAAgBC,EAAY,CAC1C,OAAOJ,EAA+B,CACpC,SAAU,CAAC,gBAAiBI,CAAE,EAC9B,QAAS,IAAMH,EAAS,mBAAmBG,CAAE,EAAE,EAC/C,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASC,GAAwB,CACtC,MAAMC,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaC,GAWXR,EAA+B,kBAAmB,CAChD,OAAQ,OACR,KAAM,KAAK,UAAUQ,CAAK,CAAA,CAC3B,EACH,UAAW,IAAM,CACfH,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASI,GAAwB,CACtC,MAAMJ,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,UAAW,CAC7D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASK,GAA0B,CACxC,MAAML,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,YAAa,CAC/D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASM,GAAwB,CACtC,MAAMN,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,KAAAS,EAAM,KAAAC,EAAM,WAAAC,KAC7Bd,EAAgD,mBAAmBG,CAAE,UAAW,CAC9E,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAS,EAAM,KAAAC,EAAM,GAAIC,EAAa,CAAE,WAAAA,CAAA,EAAe,GAAK,CAAA,CAC3E,EACH,UAAW,IAAM,CACfT,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASU,GAA4B,CAC1C,MAAMV,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,WAAAa,EAAY,qBAAAC,KAC7BjB,EAA+B,mBAAmBG,CAAE,cAAe,CACjE,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,WAAAa,EAAY,qBAAAC,EAAsB,CAAA,CAC1D,EACH,UAAW,IAAM,CACfZ,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASa,GAAyB,CACvC,MAAMb,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,WAAY,CAC9D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASc,GAAyB,CACvC,MAAMd,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,WAAY,CAC9D,OAAQ,MAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,EACjFA,EAAY,kBAAkB,CAAE,SAAU,CAAC,cAAc,EAAG,YAAa,MAAO,CAClF,CAAA,CACD,CACH,CAEO,SAASe,GAAwB,CACtC,MAAMf,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAY,CAAC,CAAE,GAAAJ,EAAI,GAAGkB,KACpBrB,EAA+B,mBAAmBG,CAAE,GAAI,CACtD,OAAQ,MACR,KAAM,KAAK,UAAUkB,CAAO,CAAA,CAC7B,EACH,UAAW,IAAM,CACfhB,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAEO,SAASiB,GAAwB,CACtC,MAAMjB,EAAcC,EAAA,EACpB,OAAOC,EAAY,CACjB,WAAaJ,GACXH,EAA+B,mBAAmBG,CAAE,GAAI,CACtD,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACfE,EAAY,kBAAkB,CAAE,SAAU,CAAC,eAAe,EAAG,YAAa,MAAO,CACnF,CAAA,CACD,CACH,CAsCO,SAASkB,EAAwBpB,EAAY,CAClD,OAAOJ,EAA+D,CACpE,SAAU,CAAC,gBAAiBI,EAAI,UAAU,EAC1C,QAAS,IAAMH,EAAS,mBAAmBG,CAAE,WAAW,EACxD,QAAS,CAAC,CAACA,CAAA,CACZ,CACH,CAEO,SAASqB,EAAuBrB,EAAYsB,EAAwB,CACzE,OAAO1B,EAAgC,CACrC,SAAU,CAAC,gBAAiBI,EAAI,WAAYsB,CAAO,EACnD,QAAS,IAAMzB,EAAS,mBAAmBG,CAAE,aAAasB,CAAO,EAAE,EACnE,QAAS,CAAC,CAACtB,GAAMsB,IAAY,IAAA,CAC9B,CACH"}
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com" />
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
11
- <script type="module" crossorigin src="./assets/index-C8k3Z2su.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-DwWP-Z_c.js"></script>
12
12
  <link rel="modulepreload" crossorigin href="./assets/vendor-query-B2UbickB.js">
13
13
  <link rel="modulepreload" crossorigin href="./assets/vendor-react-CXumBFUA.js">
14
14
  <link rel="modulepreload" crossorigin href="./assets/vendor-icons-DOIDKgo6.js">
@@ -145,7 +145,7 @@ GET /api/escalations/:id
145
145
 
146
146
  **Scope:** Enforces read scope. A `member` with `read_scope=self` sees only escalations assigned to them; an item outside their read surface returns 404.
147
147
 
148
- **Response 200:** A single escalation object.
148
+ **Response 200:** A single escalation object. The response embeds a `form_schema` field — the target role's versioned `form_schema` resolved to the escalation's pinned `metadata.schema_version` (or the role's latest when unpinned), JOINed from the roles tables in the same query and never stored on the escalation row. The dashboard renders the resolve form from this field; an MCP agent sees the same schema via `check_resolution`.
149
149
 
150
150
  **Response 404:**
151
151
 
@@ -204,6 +204,8 @@ Resolving an escalation starts a new workflow execution with the resolver's payl
204
204
  | `resolverPayload` | `object` | yes | The reviewer's decision — injected into `envelope.resolver` |
205
205
  | `metadata` | `object` | no | Outcome facets merged into the escalation's GIN-indexed metadata. Records *what happened* (disposition, timing) next to *what was asked*; `@>`-queryable. Distinct from `resolverPayload`, which resumes the workflow and is not indexed |
206
206
 
207
+ The `resolverPayload` is stored exactly as submitted — the resolver payload is the payload. There is no server-side validation and no server-side mapping of its shape. The client forms the final payload: the React dashboard maps the flat form to the nested payload via each field's `x-lt-bind` before submitting.
208
+
207
209
  **Example request:**
208
210
 
209
211
  ```json
@@ -304,9 +306,11 @@ Returns `404` when the key is unknown, `409` when the escalation is already term
304
306
 
305
307
  When a reviewer claims an escalation, the dashboard renders a typed form instead of a raw JSON editor — if a schema is available. There are two ways to attach a schema:
306
308
 
307
- ### Option 1: Workflow config (static)
309
+ ### Option 1: Role `form_schema` (versioned)
310
+
311
+ The escalation form is owned by the target **role** as a versioned `form_schema`, declared on the role (e.g. via `PATCH /api/roles/:role`). Every escalation targeting that role resolves against it. A workflow pins a specific version through `conditionLT`'s `schemaVersion`, which stamps `metadata.schema_version` on the escalation; unpinned escalations resolve against the role's latest `form_schema`. Fields may carry `x-lt-bind` to map a form value to a path in the resolver payload.
308
312
 
309
- Register a `resolver_schema` in the workflow registry wizard (Step 3, Certification). Every escalation from that workflow type inherits the schema automatically.
313
+ The deprecated workflow-config `resolver_schema` remains only as a legacy fallback when no role `form_schema` is available.
310
314
 
311
315
  ### Option 2: Escalation metadata (dynamic)
312
316
 
@@ -383,7 +387,7 @@ Keys prefixed with `_` (e.g., `_internal_id`) are stored in the payload but hidd
383
387
 
384
388
  ### Schema priority
385
389
 
386
- When both exist, `metadata.form_schema` takes precedence over `resolver_schema` from the workflow config. This lets workflows define a default form while allowing individual escalations to override it.
390
+ The form that renders is resolved by precedence: `metadata.form_schema` (a legacy inline schema on the escalation row) > the role's `form_schema` (resolved to the escalation's pinned `metadata.schema_version`, or the role's latest when unpinned, and embedded in the `GET /api/escalations/:id` response) > the deprecated workflow-config `resolver_schema` legacy fallback.
387
391
 
388
392
  ## Release expired claims
389
393
 
@@ -264,7 +264,7 @@ Returns all roles with metadata and usage counts.
264
264
  |-------|------|-------------|
265
265
  | `title` | `string \| null` | Display name separate from the technical role key |
266
266
  | `description` | `string \| null` | Human-readable summary |
267
- | `form_schema` | `object \| null` | JSON Schema for the escalation resolve form (overridden per-workflow by `resolver_schema`) |
267
+ | `form_schema` | `object \| null` | JSON Schema for the escalation resolve form (the JIT UI). Versioned per role; fields may carry `x-lt-bind` to map values into the payload. Takes precedence over the deprecated workflow-level `resolver_schema` |
268
268
  | `metadata_schema` | `object \| null` | JSON Schema declaring the expected shape of `lt_escalations.metadata` for this role. Drives faceted-query key autocomplete and creation-time validation |
269
269
  | `properties` | `object` | Free user-owned bag — icons, colors, tags, etc. No reserved keys |
270
270
  | `ops_visible` | `boolean` | When `true`, the role appears as a station on the `/operations` view |
@@ -140,7 +140,7 @@ PUT /api/workflows/:type/config
140
140
  | `execute_as` | `string \| null` | `null` | Service account `external_id` to run as (overrides invoker identity) |
141
141
  | `tool_tags` | `string[]` | `[]` | MCP tool tags for scoped tool discovery |
142
142
  | `envelope_schema` | `object \| null` | `null` | JSON Schema for the workflow input envelope |
143
- | `resolver_schema` | `object \| null` | `null` | JSON Schema for the escalation resolver payload |
143
+ | `resolver_schema` | `object \| null` | `null` | **Deprecated** legacy fallback only. The escalation form is owned by the target role as a versioned `form_schema`. |
144
144
  | `cron_schedule` | `string \| null` | `null` | Cron expression for scheduled execution (e.g., `"0 9 * * *"`) |
145
145
 
146
146
  **Example request:**
@@ -472,9 +472,9 @@ If you use raw `Durable.workflow.condition()` instead, the `$escalation_id` fiel
472
472
 
473
473
  When a reviewer claims an escalation in the dashboard, a typed form is rendered instead of a raw JSON editor — if a schema is available. There are two ways to provide one:
474
474
 
475
- **Option 1 — Workflow config (static):** Set `resolver_schema` in the workflow registry wizard (Step 3, Certification). Every escalation from that workflow inherits the schema.
475
+ **Option 1 — Role `form_schema` (versioned):** The escalation form is owned by the target role as a versioned `form_schema`. A workflow pins a version through `conditionLT`'s `schemaVersion`; unpinned escalations resolve against the role's latest. Fields may carry `x-lt-bind` to map a form value to a path in the resolver payload. The deprecated workflow-config `resolver_schema` remains only as a legacy fallback.
476
476
 
477
- **Option 2 — Escalation metadata (dynamic):** Pass `form_schema` inside `metadata` when creating an escalation. This overrides any workflow-level schema.
477
+ **Option 2 — Escalation metadata (dynamic):** Pass `form_schema` inside `metadata` when creating an escalation. This overrides any role-level schema.
478
478
 
479
479
  ### Schema shape
480
480
 
@@ -511,7 +511,7 @@ Keys prefixed with `_` are stored in the payload but hidden from the form. `_for
511
511
 
512
512
  ### Priority
513
513
 
514
- `metadata.form_schema` takes precedence over `resolver_schema` from the workflow config.
514
+ The form is resolved by precedence: `metadata.form_schema` (legacy inline on the row) > the role's `form_schema` (resolved to the escalation's pinned `metadata.schema_version`, or the role's latest when unpinned) > the deprecated workflow-config `resolver_schema` legacy fallback.
515
515
 
516
516
  ---
517
517
 
@@ -242,7 +242,7 @@ const result = await lt.workflows.upsertConfig({
242
242
  | `consumes` | `string[]` | No | Workflow types whose data this workflow consumes |
243
243
  | `tool_tags` | `string[]` | No | MCP tool tags for discovery |
244
244
  | `envelope_schema` | `any` | No | JSON Schema for envelope.data validation |
245
- | `resolver_schema` | `any` | No | JSON Schema for resolver payload validation |
245
+ | `resolver_schema` | `any` | No | **Deprecated** legacy fallback only. There is no resolver-payload validation; the escalation form is owned by the target role as a versioned `form_schema`. |
246
246
  | `cron_schedule` | `string \| null` | No | Cron expression for scheduled execution |
247
247
 
248
248
  **Returns:** `LTApiResult<LTWorkflowConfig>`
package/docs/dashboard.md CHANGED
@@ -110,7 +110,7 @@ workers: [
110
110
  certified: true,
111
111
  roles: ['reviewer', 'admin'],
112
112
  envelopeSchema: { data: { field1: '', field2: 0 } },
113
- resolverSchema: { approved: true, notes: '' },
113
+ resolverSchema: { approved: true, notes: '' }, // deprecated legacy fallback — the escalation form is owned by the target role as a versioned form_schema
114
114
  },
115
115
  },
116
116
  ]
@@ -308,7 +308,7 @@ The central queue for all escalation activity across every workflow.
308
308
  - **Filter bar** — filter by status (pending/claimed/resolved), role, workflow type, priority, and time window.
309
309
  - **Columns:** Escalation ID, workflow type, role, status, priority, created time, and claimed-by user.
310
310
  - **Claim** — click the claim action to lock an escalation to your user. Only users with matching roles see pending escalations. The queue list and aggregate stats reflect `read_all` memberships — a member scoped to `read_self` lands directly on their own assigned item in user mode rather than browsing the full queue.
311
- - **Resolve** — after claiming, submit a resolver payload (pre-filled from the workflow's `resolver_schema` if configured). Resolution triggers a workflow re-run with the resolver data injected. A `member` whose `write_scope` is `self` can resolve only items already assigned to them; `write_scope=none` is read-only.
311
+ - **Resolve** — after claiming, submit a resolver payload. The form is pre-filled from the role's versioned `form_schema` field defaults and from the workflow's seeded `envelope.formDefaults` (reverse-mapped through each field's `x-lt-bind`). The dashboard maps the flat form to the nested payload via `x-lt-bind` and the submitted payload is stored as-is. Resolution triggers a workflow re-run with the resolver data injected. A `member` whose `write_scope` is `self` can resolve only items already assigned to them; `write_scope=none` is read-only.
312
312
  - **Escalate** — forward a claimed escalation to a higher-tier role via the escalation chain.
313
313
 
314
314
  **API:** `GET /api/escalations` lists with filters. `POST /api/escalations/:id/claim` claims. `POST /api/escalations/:id/resolve` resolves.
package/docs/data.md CHANGED
@@ -263,7 +263,7 @@ Workflow registration. Every workflow that uses the LT interceptor must have a r
263
263
  | `consumes` | `TEXT[] NOT NULL` | `'{}'` | Array of workflow types whose completed data this workflow receives via `envelope.lt.providers` |
264
264
  | `tool_tags` | `TEXT[]` | `'{}'` | Tags for MCP tool discovery |
265
265
  | `envelope_schema` | `JSONB` | — | JSON Schema for the workflow input envelope |
266
- | `resolver_schema` | `JSONB` | — | JSON Schema for the escalation resolver payload |
266
+ | `resolver_schema` | `JSONB` | — | **Deprecated** legacy fallback only. The escalation form is owned by the target role as a versioned `form_schema`. |
267
267
  | `cron_schedule` | `TEXT` | — | Cron expression for scheduled execution |
268
268
  | `created_at` | `TIMESTAMPTZ NOT NULL` | `NOW()` | Row creation time |
269
269
  | `updated_at` | `TIMESTAMPTZ NOT NULL` | `NOW()` | Last modification |
@@ -165,9 +165,8 @@ export async function reviewWorkflow(envelope: LTEnvelope) {
165
165
  The resolver form resolves in order, most specific first:
166
166
 
167
167
  1. **`metadata.form_schema`** — a full JSON Schema embedded on the escalation row. Use when different escalation points in the same workflow need different forms.
168
- 2. **`metadata.schema_version`** — a pin to a specific version of the role's schema (set via `schemaVersion` in the `conditionLT` config). The form renders exactly that snapshot, even after the role's schema changes.
169
- 3. **Workflow config `resolver_schema`** — default form for all escalations of this workflow type. Set in the workflow registry.
170
- 4. **The role's latest `form_schema`** — the fallback every role provides.
168
+ 2. **The role's `form_schema`** — the versioned form every role provides. When the row carries a `metadata.schema_version` pin (set via `schemaVersion` in the `conditionLT` config), the form renders exactly that snapshot even after the role's schema changes; without a pin, the role's latest applies.
169
+ 3. **Workflow config `resolver_schema`** — **deprecated** legacy fallback only, used when no role `form_schema` is available.
171
170
 
172
171
  ### Versioned Role Schemas
173
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -44,6 +44,7 @@
44
44
  "process": "tsx scripts/process.ts",
45
45
  "demo": "bash scripts/demo.sh",
46
46
  "ortho:populate": "ts-node scripts/ortho-populate.ts",
47
+ "twin:farm": "ts-node scripts/twin-farm.ts",
47
48
  "dashboard:install": "cd dashboard && npm install",
48
49
  "dashboard:dev": "cd dashboard && npm run dev",
49
50
  "dashboard:build": "cd dashboard && npm run build",
@@ -1,2 +0,0 @@
1
- import{a as w,j as e}from"./vendor-query-B2UbickB.js";import{b as Me}from"./roles-D8lPvFgG.js";import{O as ye}from"./index-C8k3Z2su.js";import{i as Se}from"./useEventHooks-Dpixlgp-.js";import{P as Ce}from"./PageHeader-DJo7yMUR.js";import{X as Le,ae as ie,av as qe,ar as Fe}from"./vendor-icons-DOIDKgo6.js";import{L as U,f as Oe,c as Ae}from"./vendor-react-CXumBFUA.js";const ge=800,je=270,I=40,Ee=76,ce=24,We=72,oe=ge-I-Ee,be=je-ce-We,$=ce+be,he=I+oe,j="0.5s cubic-bezier(0.4, 0, 0.2, 1)",me=9;function ve(t){return`M ${(t.x-me).toFixed(1)} ${t.y.toFixed(1)} L ${(t.x+me).toFixed(1)} ${t.y.toFixed(1)}`}function Ie(t){return t.length===0?"":t.length===1?ve(t[0]):t.map((n,o)=>`${o===0?"M":"L"} ${n.x.toFixed(1)} ${n.y.toFixed(1)}`).join(" ")}function Q(t){if(t.length===0)return"";if(t.length===1)return ve(t[0]);const n=[];for(let o=0;o<t.length-1;o++){const i=t[Math.max(0,o-1)],c=t[o],p=t[o+1],a=t[Math.min(t.length-1,o+2)],d=(c.x+(p.x-i.x)/6).toFixed(1),u=(c.y+(p.y-i.y)/6).toFixed(1),l=(p.x-(a.x-c.x)/6).toFixed(1),x=(p.y-(a.y-c.y)/6).toFixed(1);o===0&&n.push(`M ${c.x.toFixed(1)} ${c.y.toFixed(1)}`),n.push(`C ${d} ${u}, ${l} ${x}, ${p.x.toFixed(1)} ${p.y.toFixed(1)}`)}return n.join(" ")}function Te(t,n){if(t.length<2||n.length<2)return"";const o=Q(t),i=[...n].reverse(),c=Q(i),p=c.slice(c.indexOf("C"));return`${o} L ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)} ${p} Z`}function De(t){return t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function ne(t){return t.length>0?t[t.length-1]:void 0}const O="#6366f1",T="#0ea5e9",q="#1E3A8A",X="#059669",Ne="#b0e0e6",A="#5b93ad",Be=13;function ze(t,n){const o=[...t].sort((a,d)=>a.y-d.y);let i=-1/0;const c=o.map(a=>{const d=Math.max(a.y+3,i+Be);return i=d,{...a,labelY:d}}),p=c.length>0?c[c.length-1].labelY-n:0;if(p>0)for(const a of c)a.labelY-=p;return c}function He({stations:t,selectedRole:n,onSelect:o,onUpstreamSelect:i,onPrioritySelect:c,periodHours:p}){const[a,d]=w.useState(null),u=t.length;if(u===0)return null;const l=s=>u===1?I+oe/2:I+s/(u-1)*oe,x=new Map(t.map((s,h)=>[s.role,l(h)])),y=t.map((s,h)=>{var R,Y,V,G;const f=s.target_per_hour??null,S=f!=null?f*p:null;return{idx:h,x:l(h),expected:S,actual:((R=s.metric)==null?void 0:R.resolved)??0,active:((Y=s.metric)==null?void 0:Y.claimed)??0,pending:((V=s.metric)==null?void 0:V.pending)??0,priorityCount:((G=s.metric)==null?void 0:G.priority_count)??0}}),b=y.some(s=>s.expected!=null),v=Math.max(1,...y.map(s=>s.expected??0),...y.map(s=>s.actual),...y.map(s=>s.expected!=null?s.pending:0))*1.15,M=s=>ce+be*(1-Math.max(0,Math.min(s,v))/v),N=y.filter(s=>s.expected!=null),C=N.map(s=>({...s,y:M(s.expected)})),_=N.map(s=>({...s,y:M(s.actual)})),P=N.map(s=>({...s,y:M(s.active)})),k=N.map(s=>({...s,y:M(s.pending)})),D=Ie(C),B=Q(_),z=Q(P),Z=Q(k),F=ne(_),K=ne(C),E=ne(P),J=ne(k),ee=_.length>=2&&F?`${B} L ${F.x.toFixed(1)} ${$} L ${_[0].x.toFixed(1)} ${$} Z`:"",W=N.some(s=>s.pending>0||s.active>0),te=W&&P.length>=2&&E?`${z} L ${E.x.toFixed(1)} ${$} L ${P[0].x.toFixed(1)} ${$} Z`:"",H=W?Te(k,P):"",r=N.some(s=>s.active>0),m=N.some(s=>s.pending>s.active),L=ze([K?{key:"target",text:"Target",color:X,y:K.y}:null,F?{key:"actual",text:"Resolved",color:q,y:F.y}:null,r&&E?{key:"active",text:"Claimed",color:O,y:E.y}:null,m&&J?{key:"queued",text:"Pending",color:T,y:J.y}:null].filter(Boolean),$+4);return e.jsxs("svg",{viewBox:`0 0 ${ge} ${je}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[t.map(s=>{if(!s.parent_role)return null;const h=x.get(s.parent_role);if(h==null)return null;const f=l(t.findIndex(S=>S.role===s.role));return e.jsx("line",{x1:h,y1:$,x2:f,y2:$,stroke:"#e2e8f0",strokeWidth:.75},`dep-${s.role}`)}),ee&&e.jsx("path",{d:ee,fill:q,opacity:.05,style:{transition:`d ${j}`}}),te&&e.jsx("path",{d:te,fill:O,opacity:.12,style:{transition:`d ${j}`}}),H&&e.jsx("path",{d:H,fill:T,opacity:.12,style:{transition:`d ${j}`}}),D&&e.jsx("path",{d:D,fill:"none",stroke:X,strokeWidth:.5,strokeLinejoin:"round",opacity:.9,style:{transition:`d ${j}`}}),C.map(s=>e.jsx("text",{x:s.x,y:s.y-3.5,textAnchor:"middle",fontSize:6.5,fill:X,fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,style:{transition:`y ${j}`},children:Math.round(s.expected)},`tval-${s.idx}`)),W&&Z&&e.jsx("path",{d:Z,fill:"none",stroke:T,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${j}`}}),z&&e.jsx("path",{d:z,fill:"none",stroke:O,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${j}`}}),B&&e.jsx("path",{d:B,fill:"none",stroke:q,strokeWidth:.6,strokeLinejoin:"round",strokeLinecap:"round",opacity:.65,style:{transition:`d ${j}`}}),P.map((s,h)=>{if(s.pending<=0&&s.active<=0)return null;const f=Math.max(2.5,Math.min(5,2.5+s.active/10)),S=s.pending>s.active,R=Math.min(k[h].y-4,s.y-f-4);return e.jsxs("g",{children:[s.pending>0&&e.jsx("text",{x:s.x,y:R,textAnchor:"middle",fontSize:7.5,fill:S?T:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${j}`},children:s.pending}),e.jsxs("g",{transform:`translate(${s.x} ${s.y})`,style:{transition:`transform ${j}`},children:[e.jsx("circle",{r:f,fill:O,opacity:.85}),s.active>0&&e.jsx("text",{y:f+9,textAnchor:"middle",fontSize:7.5,fill:O,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:s.active})]})]},`active-${s.idx}`)}),y.map(s=>{var ue;const h=t[s.idx],f=s.x,S=s.expected!=null?M(s.actual):$,R=Math.max(2.25,Math.min(4,2.25+s.actual/160)),Y=h.role===n,V=a===s.idx,G=s.expected==null?"idle · set a target rate to plot pace":`${s.actual} resolved · target ${Math.round(s.expected)}`+(s.pending>s.active?` · ${s.pending-s.active} pending`:"")+(s.active>0?` · ${s.active} claimed`:"")+(s.priorityCount>0?` · ${s.priorityCount} priority`:""),se=G.length*5.5+20,de=Math.max(I+se/2+4,Math.min(he-se/2-4,f)),pe=S-R-10;return e.jsxs("g",{onClick:()=>o(h.role),onMouseEnter:()=>d(s.idx),onMouseLeave:()=>d(null),style:{cursor:"pointer"},children:[e.jsxs("g",{transform:`translate(${f} ${S})`,style:{transition:`transform ${j}`},children:[e.jsx("circle",{r:22,fill:"transparent"}),e.jsx("circle",{r:R,fill:q,opacity:.9,style:{transition:`r ${j}`}}),s.expected!=null&&e.jsx("text",{y:-R-5,textAnchor:"middle",fontSize:9.5,fill:q,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:De(s.actual)}),V&&!Y&&e.jsx("circle",{r:R+3,fill:"none",stroke:q,strokeWidth:1,opacity:.4}),Y&&e.jsx("circle",{r:R+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),s.priorityCount>0&&e.jsxs("g",{transform:`translate(${f+15} ${Math.max(S-15,12)})`,onClick:le=>{le.stopPropagation(),c==null||c(h.role)},style:{cursor:"pointer",transition:`transform ${j}`},children:[e.jsx("title",{children:`${s.priorityCount} past the priority threshold — click to pull oldest first`}),e.jsx("circle",{r:6.5+(String(s.priorityCount).length-1)*2,fill:Ne,opacity:.9}),e.jsx("text",{y:2.5,textAnchor:"middle",fontSize:7,fill:A,fontFamily:"ui-monospace, monospace",fontWeight:"700",children:s.priorityCount})]}),(((ue=h.upstream_roles)==null?void 0:ue.length)??0)>0&&e.jsxs("g",{transform:`translate(${f-20} ${$})`,onClick:le=>{le.stopPropagation(),i==null||i(h.upstream_roles[0])},style:{cursor:"pointer"},children:[e.jsx("title",{children:`Fed by ${h.upstream_roles.join(", ")} — click to view that sequence`}),e.jsx("circle",{r:9,cy:-6,fill:"transparent"}),e.jsx("path",{d:"M -7 -14 C -3 -14 -1 -9 0 -2",fill:"none",stroke:"#94a3b8",strokeWidth:1,strokeDasharray:"2 2",strokeLinecap:"round"}),e.jsx("path",{d:"M 0 -2 L 8 -2",stroke:"#94a3b8",strokeWidth:1,strokeLinecap:"round"}),e.jsx("path",{d:"M 8 -2 l -3.5 -2 v 4 z",fill:"#94a3b8"})]}),e.jsx("text",{x:f,y:$+14,textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:h.title??h.role}),e.jsx("text",{x:f,y:$+26,textAnchor:"middle",fontSize:8,fill:"#94a3b8",fontFamily:"ui-monospace, monospace",children:h.role}),V&&e.jsxs("g",{children:[e.jsx("rect",{x:de-se/2,y:pe-16,width:se,height:19,rx:3,fill:"#0f172a",opacity:.88}),e.jsx("text",{x:de,y:pe-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:G})]})]},h.role)}),!b&&e.jsx("text",{x:I+oe/2,y:$+48,textAnchor:"middle",fontSize:8.5,fill:"#94a3b8",fontFamily:"ui-sans-serif, sans-serif",children:"Set target_per_hour on each role in Admin → Roles to enable the pace chart"}),L.map(s=>e.jsx("text",{x:he+6,y:s.labelY,fontSize:8,fill:s.color,fontFamily:"ui-sans-serif, sans-serif",fontWeight:s.key==="actual"?700:500,opacity:s.key==="active"?.85:1,style:{transition:`y ${j}`},children:s.text},s.key))]})}function xe(t){const n=`/escalations/available?role=${encodeURIComponent(t.role)}`;if(t.priority_facet){const o=JSON.stringify([{field:`metadata.${t.priority_facet}`,direction:"asc"}]);return`${n}&orderBy=${encodeURIComponent(o)}`}return`${n}&sort_by=created_at&order=asc`}const ke=["15m","1h","24h","7d","30d"],Ye=t=>ke.includes(t);function ae(t){if(t==null)return"—";if(t<1){const n=Math.round(t*60);return n<=0?"< 1s":`${n}s`}return t<60?`${t.toFixed(0)}m`:`${(t/60).toFixed(1)}h`}function re({label:t,value:n}){return e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary uppercase tracking-wider",children:t}),e.jsx("span",{className:"text-xs font-mono font-medium text-text-primary tabular-nums",children:n})]})}function Ve({period:t,onChange:n}){return e.jsx("div",{className:"flex items-center gap-1 mb-4",children:ke.map(o=>e.jsx("button",{onClick:()=>n(o),className:`px-2 py-0.5 text-[10px] font-mono rounded transition-colors ${t===o?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:o},o))})}function Ge({role:t,globalPeriod:n,onClose:o}){const[i,c]=w.useState(Ye(n)?n:"24h"),{data:p}=ye(i),a=p==null?void 0:p.stations.find(x=>x.role===t.role),d=t.sla_minutes??void 0,u=t.target_per_hour??void 0,l=t.worker_count??void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start justify-between mb-1",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-sm font-mono font-bold text-text-primary",children:t.role}),t.title&&e.jsx("span",{className:"text-[10px] text-text-secondary",children:t.title})]}),t.description&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5 line-clamp-2 leading-relaxed",children:t.description})]}),e.jsx("button",{onClick:o,className:"text-text-quaternary hover:text-text-secondary transition-colors mt-0.5 shrink-0 ml-2",children:e.jsx(Le,{className:"w-4 h-4"})})]}),e.jsxs(U,{to:`/admin/roles/${encodeURIComponent(t.role)}`,className:"flex items-center gap-1 text-[10px] text-accent hover:underline mb-4",children:[e.jsx(ie,{className:"w-2.5 h-2.5"}),"Edit in Roles"]}),e.jsx(Ve,{period:i,onChange:c}),(u||d||l)&&e.jsxs("div",{className:"flex items-center gap-4 mb-4 text-[10px]",children:[u&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-mono font-semibold text-text-primary",children:[u,"/h"]}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px]",children:"target"})]}),d&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-mono font-semibold text-text-primary",children:[d,"m"]}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px]",children:"SLA"})]}),l&&e.jsxs("div",{children:[e.jsx("div",{className:"font-mono font-semibold text-text-primary",children:l}),e.jsx("div",{className:"text-text-quaternary uppercase tracking-wider text-[8.5px]",children:"workers"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] text-text-quaternary uppercase tracking-wider mb-1.5",children:"Wait (queue)"}),e.jsx(re,{label:"P99",value:ae((a==null?void 0:a.wait.p99)??null)}),e.jsx(re,{label:"avg",value:ae((a==null?void 0:a.wait.avg)??null)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] text-text-quaternary uppercase tracking-wider mb-1.5",children:"Work (proc.)"}),e.jsx(re,{label:"P99",value:ae((a==null?void 0:a.work.p99)??null)}),e.jsx(re,{label:"avg",value:ae((a==null?void 0:a.work.avg)??null)})]})]}),e.jsxs("div",{className:"border-t border-surface-border/40 pt-2 mt-3 space-y-1.5",children:[d&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] text-text-tertiary",children:"SLA target"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[d,"m"]})]}),a&&a.priority_count>0&&e.jsxs(U,{to:xe(t),className:"flex items-center justify-between group",children:[e.jsxs("span",{className:"text-[10px]",style:{color:A},children:[a.priority_count," priority — pull oldest first"]}),e.jsx(ie,{className:"w-3 h-3 transition-colors",style:{color:A}})]})]}),e.jsx("div",{className:"mt-4 border-t border-surface-border/40 pt-3",children:e.jsxs(U,{to:`/escalations/available?role=${encodeURIComponent(t.role)}`,className:"flex items-center gap-1.5 text-[10px] text-accent hover:underline",children:["View full queue",e.jsx(ie,{className:"w-2.5 h-2.5"})]})})]})}function Ue({allMetrics:t,orderedRoles:n,period:o}){const i=t.reduce((l,x)=>l+x.pending,0),c=t.reduce((l,x)=>l+x.resolved,0),p=t.reduce((l,x)=>l+x.priority_count,0),a=new Map(t.map(l=>[l.role,l])),d=t.filter(l=>l.priority_count>0).length,u=t.filter(l=>l.pending>0).length;return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[9px] text-text-quaternary uppercase tracking-wider mb-3",children:["Pipeline · ",o]}),e.jsx("div",{className:"mb-4",children:d>0?e.jsxs("p",{className:"text-[11px]",style:{color:A},children:[d," station",d>1?"s":""," with priority items"]}):u>0?e.jsxs("p",{className:"text-[11px] text-status-warning",children:[u," station",u>1?"s":""," with backlog"]}):c>0?e.jsx("p",{className:"text-[11px] text-status-success",children:"Flowing — queue clear"}):e.jsx("p",{className:"text-[11px] text-text-quaternary",children:"Quiet — awaiting work"})}),e.jsxs("div",{className:"space-y-1.5 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider",children:"Pending"}),e.jsx("span",{className:`text-xs font-mono tabular-nums ${i>0?"text-text-primary font-semibold":"text-text-quaternary"}`,children:i})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider",children:["Resolved · ",o]}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-secondary",children:c})]}),p>0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] text-text-quaternary uppercase tracking-wider",children:"Priority"}),e.jsx("span",{className:"text-xs font-mono tabular-nums font-semibold",style:{color:A},children:p})]})]}),e.jsx("div",{className:"border-t border-surface-border/40 pt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[8px] text-text-quaternary uppercase tracking-wider flex-1",children:"Station"}),e.jsx("span",{className:"text-[8px] text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"pend"}),e.jsx("span",{className:"text-[8px] text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"clmd"}),e.jsx("span",{className:"text-[8px] text-text-quaternary uppercase tracking-wider w-8 text-right shrink-0",children:"res"})]})}),e.jsx("div",{className:"space-y-0.5",children:n.map(l=>{const x=a.get(l.role),y=(x==null?void 0:x.pending)??0,b=(x==null?void 0:x.claimed)??0,g=(x==null?void 0:x.resolved)??0,v=(x==null?void 0:x.priority_count)??0,M=l.title||l.role,N=v>0,C=y>0;return e.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[e.jsxs("span",{className:`text-[10px] font-mono flex-1 truncate ${C?"text-text-primary":"text-text-quaternary"}`,children:[M,N&&e.jsxs("span",{className:"ml-1 text-[8px] font-semibold",style:{color:A},children:[v," PRIORITY"]})]}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${C?"text-text-primary font-semibold":"text-text-quaternary"}`,children:y>0?y:"—"}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${b>0?"text-accent":"text-text-quaternary"}`,children:b>0?b:"—"}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${g>0?"text-text-secondary":"text-text-quaternary"}`,children:g>0?g:"—"})]},l.role)})}),e.jsx("p",{className:"text-[9px] text-text-quaternary mt-5",children:"Select a station for queue detail."})]})}function Qe({role:t,allMetrics:n,orderedRoles:o,globalPeriod:i,onClose:c}){return e.jsx("div",{className:"w-[280px] shrink-0 px-6 py-8 flex flex-col overflow-y-auto min-h-0",children:t?e.jsx(Ge,{role:t,globalPeriod:i,onClose:c}):e.jsx(Ue,{allMetrics:n,orderedRoles:o,period:i})})}const $e=`${X}14`,we=`${T}14`,_e=`${O}14`,Pe=`${q}14`,Xe=["15m","1h","24h","7d","30d"],Ze={"15m":.25,"1h":1,"24h":24,"7d":168,"30d":720};function Re(t){const n=t.filter(a=>a.ops_visible),o=new Map(n.map(a=>[a.role,a])),i=new Set,p=n.filter(a=>!a.parent_role||!o.has(a.parent_role)).map(a=>{const d=[],u=[{role:a,depth:0}];for(;u.length>0;){const l=u.shift();i.has(l.role.role)||(i.add(l.role.role),d.push(l),n.filter(x=>x.parent_role===l.role.role&&!i.has(x.role)).forEach(x=>u.push({role:x,depth:l.depth+1})))}return{origin:a,stations:d}});return n.filter(a=>!i.has(a.role)).forEach(a=>p.push({origin:a,stations:[{role:a,depth:0}]})),p.sort((a,d)=>d.stations.length-a.stations.length||a.origin.role.localeCompare(d.origin.role))}function fe(t){if(t==null)return"—";if(t<1){const n=Math.round(t*60);return n<=0?"< 1s":`${n}s`}return t<60?`${t.toFixed(0)}m`:`${(t/60).toFixed(1)}h`}function Ke(t,n){if(!n||t===0)return{pct:null,color:"bg-surface-border"};const o=t/n,i=Math.round(o*100),c=o>1?"bg-status-warning":o<.2?"bg-status-draft":"bg-status-success";return{pct:i,color:c}}function Je({role:t,metric:n,selected:o,onClick:i}){var b;const c=(n==null?void 0:n.pending)??0,p=(n==null?void 0:n.claimed)??0,a=(n==null?void 0:n.resolved)??0,d=(n==null?void 0:n.priority_count)??0,u=t.target_per_hour??null,{pct:l,color:x}=Ke(c,u),y=l!=null?Math.min(100,l):0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:i,onKeyDown:g=>{g.key==="Enter"&&i()},className:`grid items-center gap-4 pr-3 cursor-pointer transition-colors ${o?"border-l-2 !border-l-accent pl-2.5":"pl-3"}`,style:{gridTemplateColumns:"1fr 64px 56px 56px 60px 72px 72px 104px"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 py-1.5",children:[e.jsx("span",{className:"font-mono font-bold text-text-primary truncate text-[11px]",children:t.role}),t.title&&e.jsx("span",{className:"text-[10px] text-text-tertiary truncate",children:t.title}),(((b=t.upstream_roles)==null?void 0:b.length)??0)>0&&e.jsx("span",{title:`Fed by ${t.upstream_roles.join(", ")}`,className:"shrink-0 leading-none",children:e.jsx(Fe,{className:"w-3 h-3 text-text-quaternary"})})]}),e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:$e},children:e.jsx("span",{className:`text-xs font-mono tabular-nums ${u!=null?"text-text-secondary":"text-text-quaternary"}`,children:u??"—"})}),e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:we},children:e.jsx("span",{className:`text-xs font-mono tabular-nums ${c>0?"text-text-primary font-semibold":"text-text-quaternary"}`,children:c})}),e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:_e},children:e.jsx("span",{className:`text-xs font-mono tabular-nums ${p>0?"text-accent font-semibold":"text-text-quaternary"}`,children:p})}),e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:Pe},children:e.jsx("span",{className:"text-xs font-mono tabular-nums text-text-quaternary",children:a})}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-right py-1.5 text-text-secondary",children:fe((n==null?void 0:n.wait.p99)??null)}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-right py-1.5 text-text-secondary",children:fe((n==null?void 0:n.work.p99)??null)}),e.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[e.jsx("div",{className:"w-12 h-1.5 bg-surface-sunken rounded-full overflow-hidden shrink-0",children:e.jsx("div",{className:`h-full rounded-full ${x}`,style:{width:`${y}%`}})}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums ${l!=null&&l>100?"text-status-warning font-semibold":"text-text-quaternary"}`,children:l!=null?`${l}%`:"—"})]})]}),d>0&&e.jsxs("div",{className:"flex items-center gap-1.5 pb-2 pl-3.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full dot-ring shrink-0",style:{backgroundColor:Ne}}),e.jsxs(U,{to:xe(t),className:"text-[10px] hover:underline",style:{color:A},onClick:g=>g.stopPropagation(),children:[d," priority — pull oldest first →"]})]})]})}function et(){const t=[{label:"ROLE"},{label:"TARGET/H",band:$e,hue:X},{label:"PENDING",band:we,hue:T},{label:"CLAIMED",band:_e,hue:O},{label:"RESOLVED",band:Pe,hue:q},{label:"P99 WAIT"},{label:"P99 WORK"},{label:"TREND"}];return e.jsx("div",{className:"grid items-center gap-4 px-3 border-b border-surface-border mb-0.5",style:{gridTemplateColumns:"1fr 64px 56px 56px 60px 72px 72px 104px"},children:t.map((n,o)=>n.band?e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:n.band},children:e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider",style:{color:n.hue},children:n.label})},n.label):e.jsx("span",{className:`text-[9px] font-semibold uppercase tracking-wider text-text-quaternary py-1.5 ${o>0&&o<7?"text-right":""}`,children:n.label},n.label))})}function tt(){var H;const[t,n]=w.useState("1h"),[o,i]=w.useState(null),[c,p]=w.useState(!1);Se();const{data:a,isLoading:d,refetch:u}=Me(),{data:l,isLoading:x,refetch:y}=ye(t),b=(a==null?void 0:a.roles)??[],g=(l==null?void 0:l.stations)??[],v=w.useMemo(()=>Re(b),[b]),[M,N]=Oe(),C=M.get("fragment"),_=v.find(r=>r.origin.role===C)??v[0]??null,P=w.useCallback(r=>{i(null),N(m=>{const L=new URLSearchParams(m);return L.set("fragment",r),L})},[N]),k=(_==null?void 0:_.stations)??[],D=w.useMemo(()=>new Set(k.map(({role:r})=>r.role)),[k]),B=w.useMemo(()=>g.filter(r=>D.has(r.role)),[g,D]),z=w.useMemo(()=>k.map(({role:r})=>({role:r.role,title:r.title,parent_role:r.parent_role,target_per_hour:r.target_per_hour??null,upstream_roles:r.upstream_roles??[],metric:g.find(m=>m.role===r.role)})),[k,g]),Z=w.useCallback(r=>{const m=v.find(L=>L.stations.some(({role:s})=>s.role===r));m&&P(m.origin.role)},[v,P]),F=Ae(),K=w.useCallback(r=>{const m=b.find(L=>L.role===r);m&&F(xe(m))},[b,F]),E=((H=k.find(({role:r})=>r.role===o))==null?void 0:H.role)??null,J=d||x,ee=async()=>{p(!0),await Promise.all([u(),y()]),p(!1)},W=r=>i(m=>m===r?null:r),te=e.jsx("div",{className:"flex items-center gap-0.5",children:Xe.map(r=>e.jsx("button",{onClick:()=>n(r),className:`px-2.5 py-1 text-[10px] font-mono rounded transition-colors ${t===r?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:r},r))});return e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[e.jsx(Ce,{title:"Pace Board",docsHash:"#docs:dashboard.md:pace-board",center:te,actions:e.jsx("button",{onClick:ee,disabled:c,className:"text-text-quaternary hover:text-text-secondary transition-colors disabled:opacity-40",children:e.jsx(qe,{className:`w-3.5 h-3.5 ${c?"animate-spin":""}`})})}),J?e.jsxs("div",{className:"animate-pulse space-y-6 mt-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-64 bg-surface-sunken rounded w-full"}),e.jsx("div",{className:"space-y-3",children:[1,2,3].map(r=>e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-full"},r))})]}):v.length===0?e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-2",children:"Stations appear here once roles are marked visible in Operations."}),e.jsxs("p",{className:"text-xs text-text-tertiary",children:["Go to"," ",e.jsx(U,{to:"/admin/roles",className:"text-accent hover:underline",children:"Roles"})," ","and enable ",e.jsx("strong",{children:"Visible in Operations"})," on roles that represent pipeline stations."]})]}):e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[v.length>1&&e.jsx("div",{className:"flex items-center gap-0.5 px-4 pt-2",children:v.map(r=>{const m=r.origin.role===(_==null?void 0:_.origin.role);return e.jsxs("button",{onClick:()=>P(r.origin.role),className:`px-2.5 py-1 text-[10px] font-mono rounded transition-colors ${m?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:[r.origin.title??r.origin.role,e.jsx("span",{className:`ml-1.5 tabular-nums ${m?"text-accent/60":"text-text-quaternary/60"}`,children:r.stations.length})]},r.origin.role)})}),e.jsxs("div",{className:"flex-1 min-h-0 flex items-stretch overflow-hidden",children:[e.jsx("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col justify-center overflow-hidden p-4",children:e.jsx(He,{stations:z,selectedRole:o,onSelect:W,onUpstreamSelect:Z,onPrioritySelect:K,periodHours:Ze[t]})}),e.jsx("div",{className:"w-px bg-surface-border shrink-0 self-stretch"}),e.jsx(Qe,{role:E,allMetrics:B,orderedRoles:k.map(r=>r.role),globalPeriod:t,onClose:()=>i(null)})]}),e.jsxs("div",{className:"max-h-[45vh] flex-none flex flex-col border-t border-surface-border overflow-hidden",children:[e.jsx(et,{}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto divide-y divide-surface-border/30",children:k.map(({role:r})=>e.jsx(Je,{role:r,metric:g.find(m=>m.role===r.role),selected:o===r.role,onClick:()=>W(r.role)},r.role))})]})]})]})}const ct=Object.freeze(Object.defineProperty({__proto__:null,OperationsPage:tt,buildFragments:Re},Symbol.toStringTag,{value:"Module"}));export{ct as O,He as P,Re as b,xe as p};
2
- //# sourceMappingURL=OperationsPage--uVJxzmP.js.map
@@ -1,6 +0,0 @@
1
- import{a as f,j as e,b as ot}from"./vendor-query-B2UbickB.js";import{z as me,v as ye,b as H,C as ct,J as ne,j as dt,A as xt,g as ut,h as mt,B as pt,E as ht,u as ft}from"./index-C8k3Z2su.js";import{u as gt}from"./useCollapsedSections-BU5HULGs.js";import{u as jt,C as bt,a as yt}from"./CustomDurationPicker-WG2tPSbV.js";import{a as vt,b as wt,c as Nt}from"./roles-D8lPvFgG.js";import{P as kt}from"./PageHeader-DJo7yMUR.js";import{a as ze,C as je,i as _t}from"./escalation-C0BNAeIG.js";import{L as Ct}from"./ListToolbar-d4MGQefV.js";import{u as Tt}from"./workflows-WmmGDAvo.js";import{g as Et}from"./useEventHooks-Dpixlgp-.js";import{U as be}from"./UserName-CRE7EZPU.js";import{S as Ae}from"./StatusBadge-DZ9137bI.js";import{R as We}from"./RolePill-DHWixsQR.js";import{C as R}from"./CopyableId-blg-gZvT.js";import{U as Pe,a9 as St,a7 as Rt,aa as De}from"./vendor-icons-DOIDKgo6.js";import{C as ie}from"./CollapsibleSection-BPiTuPBk.js";import{L as He,e as $t,c as Mt}from"./vendor-react-CXumBFUA.js";import"./Modal-CSrxpXeM.js";import"./constants-BHkpVaqx.js";import"./users-B_LVbnUk.js";const Le="lt_view_mode";function It(t){const[n,i]=f.useState(()=>{try{const s=localStorage.getItem(Le);if(s!==null)return s==="dev"}catch{}return t}),a=f.useCallback(()=>{i(s=>{const l=!s;try{localStorage.setItem(Le,l?"dev":"user")}catch{}return l})},[]);return{isDevMode:n,toggleMode:a}}const pe=4;function Oe({pct:t,place:n,label:i,title:a,emphasis:s}){const l=e.jsx("span",{className:"w-px h-1.5 bg-surface-border","aria-hidden":!0}),x=e.jsx("span",{className:`whitespace-nowrap leading-none ${s?"text-text-secondary":"text-text-tertiary"}`,children:i});return e.jsx("div",{title:a,className:`absolute ${n==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0.5 -translate-x-1/2 cursor-help`,style:{left:`${t}%`},children:n==="above"?e.jsxs(e.Fragment,{children:[x,l]}):e.jsxs(e.Fragment,{children:[l,x]})})}function At({esc:t,className:n=""}){const i=new Date(t.created_at).getTime(),a=t.claimed_at?new Date(t.claimed_at).getTime():null,s=t.status==="resolved",l=t.status==="cancelled",x=s||l,d=ze(t),r=!!a&&(d||x),o=s&&t.resolved_at?new Date(t.resolved_at).getTime():l?new Date(t.updated_at).getTime():Date.now(),c=Math.max(o-i,1),m=r&&a?Math.max(a-i,0):c,h=r&&a?Math.max(o-a,0):0,b=Math.min(100,Math.max(0,m/c*100)),u=r?Math.max(0,100-b):0,j=s?"bg-status-success":l?"bg-status-error":"bg-status-active",g=s?"Worked":l?"Open before cancel":"In progress",p=me(m),_=me(c),C=s?`Resolved in ${_} total`:l?`Cancelled after ${_}`:`Open ${_} so far (current age)`,$=`Lifecycle: amber = time spent waiting to be claimed, the colored end = ${g.toLowerCase()} after the claim. Top label is time-to-claim, bottom is total time.`;return e.jsxs("div",{className:n,title:$,children:[e.jsx("div",{className:"relative h-3.5 text-[9px] font-mono",children:r&&e.jsx(Oe,{pct:b,place:"above",label:p,title:`Time to claim: ${p} (created → claimed)`})}),e.jsxs("div",{className:"flex w-full rounded-full overflow-hidden bg-surface-sunken cursor-help",style:{height:pe},title:$,children:[e.jsx("div",{style:{width:`${b}%`,minWidth:pe},className:"bg-status-pending",title:`Waiting ${p} — created → claimed`}),r&&e.jsx("div",{style:{width:`${u}%`,minWidth:pe},className:j,title:`${g} ${me(h)} — claimed → ${s?"resolved":l?"cancelled":"now"}`})]}),e.jsx("div",{className:"relative h-3.5 text-[9px] font-mono",children:e.jsx(Oe,{pct:100,place:"below",emphasis:!0,label:_,title:C})})]})}function Wt(t){const{mode:n,activeView:i,onActiveViewChange:a,onClaim:s,claimPending:l,workflowType:x,json:d,onResolve:r,resolvePending:o,resolveError:c,requestTriage:m,triageNotes:h,currentRole:b,escalationTargets:u,onEscalate:j,escalatePending:g,escalateError:p,onRelease:_,releasePending:C,onCancel:$,assignedTo:I,assignedUntil:A,onSubmitAttempt:T}=t,E=jt(),[y,N]=f.useState("30"),[w,M]=f.useState(0),[D,W]=f.useState(""),[L,O]=f.useState(""),F=y==="custom",B=f.useCallback(v=>M(v),[]);if(n==="terminal")return null;const oe=()=>{const v=F?w:parseInt(y);!v||v<=0||s(v)},ce=()=>{if(W(""),m){const X={_lt:{needsTriage:!0}};h.trim()&&(X.notes=h.trim()),r(X);return}let v;try{v=JSON.parse(d)}catch{W("Invalid JSON");return}const z=v._form_schema,J=z==null?void 0:z.required;if(J!=null&&J.length){const X=J.filter(P=>{const V=v[P];return V==null||typeof V=="string"&&V.trim()===""});if(X.length>0){T==null||T();const P=X.map(ee=>ee.replace(/[_-]/g," ")),V=P.length<=2?P.join(", "):`${P.slice(0,2).join(", ")}...`;W(`Required: ${V}`);return}}r(v)},G=v=>`text-xs transition-colors ${v?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"sticky bottom-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-10 px-10 pt-3 pb-5 z-10","data-testid":"escalation-action-bar",children:[n==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[E.map(v=>e.jsx("button",{onClick:()=>{N(v.value),M(0)},className:G(!F&&y===v.value),children:v.label},v.value)),e.jsx("button",{onClick:()=>N("custom"),className:G(F),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:$,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:"Cancel escalation"}),e.jsx("div",{className:"flex-1"}),F&&e.jsx(bt,{onChange:B,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:oe,disabled:l||F&&w<=0,className:"btn-primary text-xs",children:l?"Claiming...":"Claim"})]})]}),n==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:I?e.jsx(be,{userId:I}):"unknown"})]}),A&&e.jsx(je,{until:A})]}),n==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>a("resolve"),className:G(i==="resolve"),children:x?"Resolve":"Acknowledge"}),u.length>0&&e.jsx("button",{onClick:()=>a("escalate"),className:G(i==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>a("release"),className:`text-xs transition-colors ${i==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"}),e.jsx("button",{onClick:$,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:"Cancel"})]}),i==="resolve"&&(x?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),D&&e.jsx("span",{className:"text-xs text-status-error",children:D}),c&&e.jsx("span",{className:"text-xs text-status-error",children:c.message}),e.jsx("button",{onClick:ce,disabled:o,className:"btn-primary text-xs",children:o?"Submitting...":m?"Send to Triage":"Submit"})]}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Notification — acknowledge to resolve"}),e.jsx("div",{className:"flex-1"}),c&&e.jsx("span",{className:"text-xs text-status-error mr-3",children:c.message}),e.jsx("button",{onClick:()=>r({acknowledged:!0}),disabled:o,className:"btn-primary text-xs",children:o?"Acknowledging...":"Acknowledge"})]})),i==="escalate"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",e.jsx("span",{className:"font-medium text-text-primary",children:b})," to"]}),e.jsxs("select",{value:L,onChange:v=>O(v.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),u.map(v=>e.jsx("option",{value:v,children:v},v))]}),e.jsx("div",{className:"flex-1"}),p&&e.jsx("span",{className:"text-xs text-status-error",children:p.message}),e.jsx("button",{onClick:()=>j(L),disabled:!L||g,className:"btn-primary text-xs",children:g?"Escalating...":"Escalate"})]}),i==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>a("resolve"),className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:_,disabled:C,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:C?"Releasing...":"Yes, Release"})]})]})]})}const Pt={1:{pad:"px-3 py-2.5",label:"text-[9px] mb-1.5",value:"text-xs",bg:"bg-surface-sunken/60"},2:{pad:"px-3 py-2",label:"text-[8px] mb-1",value:"text-[11px]",bg:"bg-surface-sunken/30"},3:{pad:"px-2.5 py-1.5",label:"text-[8px] mb-0.5",value:"text-[10px]",bg:"bg-surface-sunken/15"}};function S({label:t,children:n,tier:i=1,className:a=""}){const s=Pt[i];return e.jsxs("div",{className:`flex-1 min-w-0 rounded-lg ${s.bg} ${s.pad} ${a}`,children:[e.jsx("p",{className:`font-semibold uppercase tracking-widest text-text-tertiary leading-none ${s.label}`,children:t}),e.jsx("div",{className:`text-text-secondary leading-tight min-w-0 ${s.value}`,children:n})]})}const Fe=56;function Dt({value:t}){const[n,i]=f.useState(!1),a=typeof t=="object"?JSON.stringify(t):String(t??"");return a.length<=Fe?e.jsx("span",{className:"font-mono break-all",title:a,children:a}):e.jsx("button",{onClick:()=>i(s=>!s),title:a,className:"font-mono break-all text-left hover:text-accent transition-colors",children:n?a:`${a.slice(0,Fe)}…`})}function Lt({esc:t,claimedByMe:n,claimed:i,isTerminal:a,traceUrl:s,isDevMode:l,showDetails:x,onToggleDetails:d}){const{isBuilder:r}=ye(),o=_t(t);return l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o&&e.jsx(Rt,{className:"w-5 h-5 text-text-tertiary shrink-0"}),e.jsxs("p",{className:"text-[1.5rem] leading-snug font-light text-text-secondary",children:[t.type,t.subtype?` / ${t.subtype}`:""]})]}),t.description&&e.jsx("p",{className:"text-sm leading-relaxed text-text-tertiary mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-end gap-x-6 gap-y-3 mt-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Status"}),e.jsx("span",{className:"mb-1 inline-block",children:e.jsx(Ae,{status:t.status})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Role"}),e.jsx(We,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Created"}),e.jsx("span",{className:"inline-flex items-center mb-1 text-xs text-text-secondary",children:e.jsx(H,{date:t.created_at})})]}),(i||a)&&t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Claimed by"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(be,{userId:t.assigned_to})]})]}),i&&!a&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Time left"}),e.jsx("span",{className:"inline-flex items-center h-5",children:e.jsx(je,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Resolved"}),e.jsx("span",{className:"inline-flex items-center h-5 text-xs text-text-secondary",children:e.jsx(H,{date:t.resolved_at})})]})]})]}):e.jsxs("div",{className:"-mt-6 mb-2",children:[t.description&&e.jsx("p",{className:"text-2xl font-light text-text-primary leading-relaxed mb-5",children:t.description}),e.jsxs("div",{className:"flex gap-1 items-stretch",children:[e.jsx(S,{label:"Status",children:e.jsx(Ae,{status:t.status})}),e.jsx(S,{label:"Assigned to Role",children:e.jsx(We,{role:t.role,size:"md"})}),(i||a)&&t.assigned_to&&e.jsx(S,{label:"Claimed By",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[e.jsx(Pe,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(be,{userId:t.assigned_to})]})}),e.jsx(S,{label:"Created",children:e.jsx(H,{date:t.created_at})}),(i||a)&&t.claimed_at&&e.jsx(S,{label:"Claimed",children:e.jsx(H,{date:t.claimed_at})}),i&&!a&&t.assigned_until&&e.jsx(S,{label:"Time Remaining",children:e.jsx(je,{until:t.assigned_until})}),t.resolved_at&&e.jsx(S,{label:"Completed",children:e.jsx("span",{className:"text-status-success",children:e.jsx(H,{date:t.resolved_at})})}),e.jsxs(S,{label:"Priority",children:["P",t.priority]}),r&&e.jsx("button",{onClick:d,title:x?"Hide details":"Show details",className:"shrink-0 rounded-lg bg-surface-sunken/60 px-3 flex items-center text-text-tertiary/60 hover:text-accent transition-colors",children:e.jsx(St,{className:`w-3.5 h-3.5 ${x?"text-accent":""}`})})]}),r&&e.jsxs(ct,{open:x,children:[e.jsxs("div",{className:"flex gap-1 mt-1",children:[e.jsx(S,{tier:2,label:"Escalation ID",children:e.jsx(R,{bare:!0,value:t.id})}),t.task_id&&e.jsx(S,{tier:2,label:"Task ID",children:e.jsx(R,{bare:!0,value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`})}),t.workflow_type&&e.jsx(S,{tier:2,label:"Workflow Name",children:e.jsx(R,{bare:!0,value:t.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`})}),t.workflow_id&&e.jsx(S,{tier:2,label:"Workflow ID",children:e.jsx(R,{bare:!0,value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`})}),t.task_queue&&e.jsx(S,{tier:2,label:"Task Queue",children:e.jsx(R,{bare:!0,value:t.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`})}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(S,{tier:2,label:"Origin",children:e.jsx(R,{bare:!0,value:t.origin_id,href:`/processes/detail/${t.origin_id}`})}),t.trace_id&&e.jsx(S,{tier:2,label:"Trace",children:e.jsx(R,{bare:!0,value:t.trace_id,href:s?s.replace("{traceId}",t.trace_id):void 0,external:!0})})]}),t.metadata&&Object.keys(t.metadata).filter(c=>!c.startsWith("_")).length>0&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-1 mt-1",children:Object.entries(t.metadata).filter(([c])=>!c.startsWith("_")).map(([c,m])=>e.jsx(S,{tier:3,label:c,children:e.jsx(Dt,{value:m})},c))})]})]})}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 he({content:t,compact:n}){const i=[],a=/^```(\w*)\n([\s\S]*?)^```$/gm;let s=0,l;for(;(l=a.exec(t))!==null;)l.index>s&&i.push({type:"text",text:t.slice(s,l.index)}),i.push({type:"code",lang:l[1],code:l[2].replace(/\n$/,"")}),s=l.index+l[0].length;s<t.length&&i.push({type:"text",text:t.slice(s)});const x=n?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-[11px]"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},d=[];for(const r of i){if(r.type==="code"){const o=r.code.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${x.code} font-mono text-text-secondary leading-relaxed">${o}</code></pre>`);continue}d.push(...Ot(r.text,x))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:d.join(`
2
- `)}})}function Ot(t,n){const i=t.split(`
3
- `),a=[];let s=!1,l=!1,x=[];for(const d of i){const r=d.trim();if(r.startsWith("|")&&r.endsWith("|")){const o=r.slice(1,-1).split("|").map(c=>c.trim());if(o.every(c=>/^[-:]+$/.test(c)))continue;l||(l=!0,x=[]),x.push(o);continue}if(l){l=!1;const[o,...c]=x;a.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const m of o)a.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(m)}</th>`);a.push("</tr></thead><tbody>");for(const m of c){a.push("<tr>");for(const h of m)a.push(`<td class="py-1 px-2 border-b border-border/50">${K(h)}</td>`);a.push("</tr>")}a.push("</tbody></table></div>"),x=[]}if(!r){s&&(a.push("</ul>"),s=!1);continue}if(r.startsWith("### ")){s&&(a.push("</ul>"),s=!1),a.push(`<h4 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${K(r.slice(4))}</h4>`);continue}if(r.startsWith("## ")){s&&(a.push("</ul>"),s=!1),a.push(`<h3 class="${n.heading} font-semibold text-text-primary mt-3 mb-1">${K(r.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(r)){s&&(a.push("</ul>"),s=!1),a.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(r)){s||(a.push('<ul class="space-y-1 my-1">'),s=!0),a.push(`<li class="${n.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${K(r.slice(2))}</span></li>`);continue}s&&(a.push("</ul>"),s=!1),a.push(`<p class="${n.text} text-text-secondary my-1">${K(r)}</p>`)}if(l&&x.length){const[d,...r]=x;a.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const o of d)a.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${K(o)}</th>`);a.push("</tr></thead><tbody>");for(const o of r){a.push("<tr>");for(const c of o)a.push(`<td class="py-1 px-2 border-b border-border/50">${K(c)}</td>`);a.push("</tr>")}a.push("</tbody></table></div>")}return s&&a.push("</ul>"),a}function fe({children:t}){return e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:t})}function Ft({payload:t,isTerminal:n,resolverPayload:i,onRetryTriage:a,isRetrying:s}){const l=t.title,x=t.summary,d=t.diagnosis,r=t.tool_calls_made,o=t.result,c=i==null?void 0:i._lt,m=(c==null?void 0:c.triaged)===!0,h=c==null?void 0:c.triageWorkflowId,b=n&&m,[u,j]=f.useState(!1);return b?e.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),e.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof r=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[r," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[l&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:l}),d&&e.jsxs("div",{children:[e.jsx(fe,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(he,{content:d})})]}),e.jsx("div",{className:"flex items-center gap-3",children:h&&e.jsx(He,{to:`/workflows/executions/${h}`,className:"text-[10px] text-accent hover:underline",children:"View triage execution"})})]})]}):e.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),e.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof r=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[r," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[l&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:l}),x&&e.jsxs("div",{children:[e.jsx(fe,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(he,{content:x})})]}),d&&e.jsxs("div",{children:[e.jsx(fe,{children:"What went wrong"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(he,{content:d})})]}),o!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>j(!u),className:"flex items-center gap-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[e.jsx("svg",{className:`w-3 h-3 transition-transform ${u?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),u&&e.jsx("div",{className:"mt-2",children:e.jsx(ne,{data:o,defaultMode:"tree"})})]}),a&&!n&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:a,disabled:s,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:e.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),s?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function Jt({triage:t,payload:n}){const i=t.confidence??0,a=i>=.8?"text-status-success":i>=.5?"text-status-pending":"text-status-error",s=Vt(t.originalData,n);return e.jsxs("div",{className:"space-y-5",children:[t.diagnosis&&e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:t.diagnosis}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[t.tool_calls_made!=null&&e.jsxs("span",{children:[t.tool_calls_made," tool call",t.tool_calls_made!==1?"s":""]}),t.tool_calls_made!=null&&e.jsx("span",{className:"text-text-quaternary",children:"·"}),e.jsxs("span",{className:`font-medium ${a}`,children:[Math.round(i*100),"% confidence"]})]}),t.actions_taken&&t.actions_taken.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions_taken.map((l,x)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px]
4
- text-text-secondary`,children:[e.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),l]},x))}),t.recommendation&&e.jsx("p",{className:"text-[11px] text-text-tertiary italic",children:t.recommendation}),s.length>0&&e.jsx("div",{className:"space-y-4 pt-2",children:s.map(l=>e.jsx(Ut,{diff:l},l.key))})]})}function Vt(t,n){if(!t)return[];const i=[];for(const a of Object.keys(t)){if(a.startsWith("_"))continue;const s=t[a],l=n[a];l!==void 0&&JSON.stringify(s)!==JSON.stringify(l)&&i.push({key:a,label:a.replace(/[_-]/g," "),original:s,corrected:l})}return i}function Ut({diff:t}){const n=Je(t.original),i=Je(t.corrected);return n!==null&&i!==null?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:n})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:i})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.original=="object"?JSON.stringify(t.original,null,2):String(t.original)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.corrected=="object"?JSON.stringify(t.corrected,null,2):String(t.corrected)})]})]})}function Je(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}function Ve({src:t,escalation:n,schema:i,onResolve:a,onEscalate:s,submitAttempted:l}){const x=f.useRef(null),d=f.useRef("");f.useEffect(()=>{try{const o=new URL(t);d.current=o.origin}catch{d.current=""}},[t]);const r=f.useCallback(()=>{const o=x.current;if(!(o!=null&&o.contentWindow)||!d.current)return;const m={type:"lt:init",escalation:{id:n.id,type:n.type,subtype:n.subtype,description:n.description,status:n.status,priority:n.priority,role:n.role,workflow_type:n.workflow_type},schema:i};o.contentWindow.postMessage(m,d.current)},[n,i]);return f.useEffect(()=>{const o=c=>{if(c.origin!==d.current)return;const m=c.data;if(!(!m||typeof m!="object"||typeof m.type!="string"))switch(m.type){case"lt:ready":r();break;case"lt:submit":m.payload&&typeof m.payload=="object"&&a(m.payload);break;case"lt:escalate":typeof m.target=="string"&&m.target&&s(m.target);break;case"lt:resize":{const h=x.current;h&&typeof m.height=="number"&&m.height>0&&(h.style.height=`${Math.min(m.height,2e3)}px`);break}}};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[r,a,s]),f.useEffect(()=>{if(!l)return;const o=x.current;o!=null&&o.contentWindow&&d.current&&o.contentWindow.postMessage({type:"lt:validate"},d.current)},[l]),e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:x,src:t,sandbox:"allow-scripts allow-same-origin allow-forms",className:"w-full border-0",style:{minHeight:"400px"},title:"HITL Viewport",onLoad:r})})}function Bt({fieldKey:t,value:n,onChange:i,schema:a}){const s=f.useRef(null),l=(a==null?void 0:a.accept)??void 0,x=t.replace(/[_-]/g," "),d=a==null?void 0:a.description,r=f.useCallback(c=>{var b;const m=(b=c.target.files)==null?void 0:b[0];if(!m)return;const h=new FileReader;h.onload=()=>{typeof h.result=="string"&&i(h.result)},h.readAsDataURL(m)},[i]),o=n.startsWith("data:");return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:x}),d&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:d}),e.jsxs("div",{className:"mt-1",children:[e.jsx("input",{ref:s,type:"file",accept:l,onChange:r,className:"hidden"}),e.jsx("button",{type:"button",onClick:()=>{var c;return(c=s.current)==null?void 0:c.click()},className:"btn-secondary text-xs px-3 py-1.5",children:o?"Replace file":"Choose file"}),o&&e.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function zt({fieldKey:t,value:n,onChange:i,schema:a}){const s=t.replace(/[_-]/g," "),l=a==null?void 0:a.description,x=(a==null?void 0:a["x-lt-language"])??"",d=f.useCallback(r=>{if(r.key==="Tab"){r.preventDefault();const o=r.currentTarget,c=o.selectionStart,m=o.selectionEnd,h=n.substring(0,c)+" "+n.substring(m);i(h),requestAnimationFrame(()=>{o.selectionStart=o.selectionEnd=c+2})}},[n,i]);return e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:[s,x&&e.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:x})]}),l&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:l}),e.jsx("textarea",{value:n,onChange:r=>i(r.target.value),onKeyDown:d,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function Ht({fieldKey:t,value:n,onChange:i,schema:a}){const s=f.useRef(null),[l,x]=f.useState(!1),d=t.replace(/[_-]/g," "),r=a==null?void 0:a.description;f.useEffect(()=>{const u=s.current;if(!u)return;const j=u.getContext("2d");if(j&&(j.lineWidth=2,j.lineCap="round",j.strokeStyle="#1E1535",n&&n.startsWith("data:"))){const g=new Image;g.onload=()=>j.drawImage(g,0,0),g.src=n}},[]);const o=f.useCallback(u=>{const g=s.current.getBoundingClientRect();return"touches"in u?{x:u.touches[0].clientX-g.left,y:u.touches[0].clientY-g.top}:{x:u.clientX-g.left,y:u.clientY-g.top}},[]),c=f.useCallback(u=>{var p;x(!0);const j=(p=s.current)==null?void 0:p.getContext("2d");if(!j)return;const g=o(u);j.beginPath(),j.moveTo(g.x,g.y)},[o]),m=f.useCallback(u=>{var p;if(!l)return;const j=(p=s.current)==null?void 0:p.getContext("2d");if(!j)return;const g=o(u);j.lineTo(g.x,g.y),j.stroke()},[l,o]),h=f.useCallback(()=>{x(!1);const u=s.current;u&&i(u.toDataURL("image/png"))},[i]),b=f.useCallback(()=>{const u=s.current;if(!u)return;const j=u.getContext("2d");j&&(j.clearRect(0,0,u.width,u.height),i(""))},[i]);return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:d}),r&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:r}),e.jsx("div",{className:"mt-1 border border-surface-border rounded-md overflow-hidden bg-white",children:e.jsx("canvas",{ref:s,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:c,onMouseMove:m,onMouseUp:h,onMouseLeave:h,onTouchStart:c,onTouchMove:m,onTouchEnd:h})}),e.jsx("button",{type:"button",onClick:b,className:"mt-1 text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function qt({fieldKey:t,value:n,onChange:i,schema:a}){const s=t.replace(/[_-]/g," "),l=a==null?void 0:a.description;return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:s}),l&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:l}),e.jsx("textarea",{value:n,onChange:x=>i(x.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}const Ue={"file-upload":Bt,"code-editor":zt,signature:Ht,"rich-text":qt};function qe({value:t,onChange:n,disabled:i,submitAttempted:a}){const[s,l]=f.useState({}),[x,d]=f.useState({}),[r,o]=f.useState(null),[c,m]=f.useState(!1),[h,b]=f.useState(new Set);f.useEffect(()=>{try{const y=JSON.parse(t);if(typeof y=="object"&&y!==null&&!Array.isArray(y)){const N={},w={};for(const[M,D]of Object.entries(y))M.startsWith("_")?w[M]=D:N[M]=D;l(N),d(w),o(w._form_schema&&typeof w._form_schema=="object"?w._form_schema:null),m(!1)}}catch{m(!0)}},[t]);const u=f.useCallback(y=>{l(y),n(JSON.stringify({...y,...x},null,2))},[x,n]),j=f.useCallback((y,N)=>{u({...s,[y]:N})},[s,u]),g=f.useCallback(y=>{b(N=>{if(N.has(y))return N;const w=new Set(N);return w.add(y),w})},[]);if(c)return e.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const p=Object.entries(s);if(p.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const _=r==null?void 0:r["x-lt-order"],C=_?[...p].sort((y,N)=>{const w=_.indexOf(y[0]),M=_.indexOf(N[0]);return(w===-1?1/0:w)-(M===-1?1/0:M)}):p,$=new Set((r==null?void 0:r.required)??[]),I=r==null?void 0:r["x-lt-layout"],A=r==null?void 0:r.title,T=r==null?void 0:r.description,E=C.map(([y,N])=>{var F;const w=(F=r==null?void 0:r.properties)==null?void 0:F[y],M=(w==null?void 0:w.readOnly)===!0,D=(w==null?void 0:w["x-lt-span"])??1,W=$.has(y),L=h.has(y)||!!a;let O;if(W&&L&&(N==null||typeof N=="string"&&N.trim()==="")&&(O="Required"),L&&typeof N=="string"&&N.trim()!==""&&w){const B=w.format;B==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(N)&&(O="Enter a valid email address"),B==="uri"&&!/^https?:\/\/.+/.test(N)&&(O="Enter a valid URL")}return e.jsx("div",{className:I==="two-column"&&D>=2?"col-span-2":"",children:e.jsx(Ke,{fieldKey:y,value:N,onChange:B=>j(y,B),onBlur:()=>g(y),schema:r,isRequired:W,isReadOnly:M,error:O})},y)});return e.jsxs("div",{className:`pb-8 ${i?"opacity-60 pointer-events-none":""}`,children:[A&&e.jsx("h3",{className:"text-lg font-light text-text-primary mb-1",children:A}),T&&e.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:T}),I==="two-column"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-14 gap-y-6",children:E}):e.jsx("div",{className:"space-y-6",children:E})]})}function Ke({fieldKey:t,value:n,onChange:i,onBlur:a,schema:s,isRequired:l,isReadOnly:x,error:d}){var m;const r=t.replace(/[_-]/g," "),o=(m=s==null?void 0:s.properties)==null?void 0:m[t];if(x){const h=n===null?"null":typeof n=="object"?JSON.stringify(n,null,2):String(n);return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),e.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:h})]})}const c=o==null?void 0:o["x-lt-widget"];if(c&&c in Ue&&typeof n=="string"){const h=Ue[c];return e.jsx(h,{fieldKey:t,value:n,onChange:b=>i(b),schema:o})}if(typeof n=="boolean")return e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:h=>{i(h.target.checked),a==null||a()},className:"w-3.5 h-3.5 rounded accent-accent"}),e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[r,l&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),e.jsx(Y,{error:d})]});if(typeof n=="number")return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),e.jsx("input",{type:"number",value:n,onChange:h=>i(parseFloat(h.target.value)||0),onBlur:a,step:"any",className:Z(!!d)}),e.jsx(Y,{error:d})]});if(typeof n=="string"){const h=(o==null?void 0:o.format)==="password",b=o==null?void 0:o.enum,u=o==null?void 0:o.description;if(b!=null&&b.length)return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("select",{value:n,onChange:p=>i(p.target.value),onBlur:a,className:Z(!!d),children:b.map(p=>e.jsx("option",{value:p,children:p},p))}),e.jsx(Y,{error:d})]});if(h)return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:"password",value:n,onChange:p=>i(p.target.value),onBlur:a,className:Z(!!d),autoComplete:"off"}),e.jsx(Y,{error:d})]});const j=o==null?void 0:o.format,g={date:"date","date-time":"datetime-local",email:"email",uri:"url"};return j&&j in g?e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:g[j],value:n,onChange:p=>i(p.target.value),onBlur:a,className:Z(!!d)}),e.jsx(Y,{error:d})]}):j==="textarea"||n.length>80?e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("textarea",{value:n,onChange:p=>i(p.target.value),onBlur:a,className:`${Z(!!d)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(n.length/60)))}),e.jsx(Y,{error:d})]}):e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),u&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:u}),e.jsx("input",{type:"text",value:n,onChange:p=>i(p.target.value),onBlur:a,className:Z(!!d)}),e.jsx(Y,{error:d})]})}if(n===null)return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(n))return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:n.map((h,b)=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-mono bg-surface-sunken rounded text-text-secondary",children:String(h)},b))})]});if(typeof n=="object"){const h=Object.entries(n);return e.jsxs("div",{children:[e.jsx(U,{isRequired:l,children:r}),e.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:h.map(([b,u])=>e.jsx(Ke,{fieldKey:b,value:u,onChange:j=>i({...n,[b]:j})},b))})]})}return null}function U({children:t,isRequired:n}){return e.jsxs("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t,n&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function Y({error:t}){return t?e.jsx("p",{className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:t}):null}function Z(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 Be({json:t,onJsonChange:n,requestTriage:i,onRequestTriageChange:a,triageNotes:s,onTriageNotesChange:l,isDevMode:x=!0,disabled:d=!1,submitAttempted:r=!1,showTriage:o=!1}){const[c,m]=f.useState("form"),{visibleJson:h,hiddenFields:b}=f.useMemo(()=>{try{const g=JSON.parse(t);if(typeof g=="object"&&g!==null&&!Array.isArray(g)){const p={},_={};for(const[C,$]of Object.entries(g))C.startsWith("_")?p[C]=$:_[C]=$;return{visibleJson:JSON.stringify(_,null,2),hiddenFields:p}}}catch{}return{visibleJson:t,hiddenFields:{}}},[t]),u=f.useCallback(g=>{try{const p=JSON.parse(g);n(JSON.stringify({...p,...b},null,2))}catch{n(g)}},[b,n]),j=Object.keys(b).length>0;return e.jsxs(e.Fragment,{children:[(o||x)&&e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o?i?e.jsxs("button",{onClick:()=>a(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>a(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),e.jsxs("span",{className:"text-[13px] text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]}):e.jsx("span",{}),x&&!i&&e.jsx("button",{onClick:()=>m(c==="form"?"json":"form"),className:"text-[10px] text-text-tertiary hover:text-accent transition-colors",children:c==="form"?"Raw JSON":"Form"})]}),e.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:i?"pointer-events-none select-none":"",children:c==="form"?e.jsx(qe,{value:t,onChange:n,disabled:d,submitAttempted:r}):e.jsxs("div",{children:[j&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2 italic",children:"Form schema hidden. Edit the resolver values below — they will be merged with the schema on submit."}),e.jsx("textarea",{value:h,onChange:g=>u(g.target.value),className:"input-json w-full",rows:Math.max(8,h.split(`
5
- `).length+2),spellCheck:!1,"data-testid":"resolve-json"})]})}),i&&e.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[e.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),e.jsx("textarea",{value:s,onChange:g=>l(g.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function Q({children:t}){return e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:t})}function le({children:t}){return e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5 font-mono",children:t})}function Kt({esc:t}){const{isBuilder:n}=ye();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Classification"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Type"}),e.jsx(le,{children:t.type})]}),t.subtype&&e.jsxs("div",{children:[e.jsx(Q,{children:"Subtype"}),e.jsx(le,{children:t.subtype})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Priority"}),e.jsxs(le,{children:["P",t.priority]})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Status"}),e.jsx(le,{children:t.status})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"References"}),e.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-4",children:[e.jsx(R,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(R,{label:"Task ID",value:t.task_id,href:n?`/workflows/tasks/detail/${t.task_id}`:void 0}),t.workflow_type&&e.jsx(R,{label:"Workflow Name",value:t.workflow_type,href:n?`/workflows/executions?entity=${encodeURIComponent(t.workflow_type)}`:void 0}),t.workflow_id&&e.jsx(R,{label:"Workflow ID",value:t.workflow_id,href:n?`/workflows/executions/${t.workflow_id}`:void 0}),t.task_queue&&e.jsx(R,{label:"Task Queue",value:t.task_queue,href:n?`/admin/controlplane?queue=${encodeURIComponent(t.task_queue)}`:void 0}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(R,{label:"Origin ID",value:t.origin_id}),t.parent_id&&e.jsx(R,{label:"Parent ID",value:t.parent_id}),t.trace_id&&e.jsx(R,{label:"Trace ID",value:t.trace_id}),t.span_id&&e.jsx(R,{label:"Span ID",value:t.span_id})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Timeline"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(Q,{children:"Created"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(H,{date:t.created_at})})]}),t.claimed_at&&e.jsxs("div",{children:[e.jsx(Q,{children:"Claimed"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(H,{date:t.claimed_at})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx(Q,{children:"Resolved"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(H,{date:t.resolved_at})})]}),e.jsxs("div",{children:[e.jsx(Q,{children:"Updated"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(H,{date:t.updated_at})})]})]})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsx("div",{children:e.jsx(ne,{data:t.metadata,label:"Metadata"})})]})}function Qt({isRoundsExhausted:t,payloadObj:n,isTerminal:i,resolverPayload:a,onRetryTriage:s,isRetrying:l}){return e.jsxs(e.Fragment,{children:[t&&n&&e.jsx("div",{className:"mt-8",children:e.jsx(Ft,{payload:n,isTerminal:i,resolverPayload:a,onRetryTriage:s,isRetrying:l})}),(n==null?void 0:n.category)==="missing_credential"&&e.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[e.jsx(De,{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(He,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(De,{size:12}),"Go to Credentials"]})]})]})]})}function Yt({isCollapsed:t,toggleSection:n,esc:i,escalationPayload:a,resolverPayload:s,triageData:l,payloadObj:x,isTerminal:d,claimedByMe:r,activeView:o,metadataFormSchema:c,json:m,onJsonChange:h,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:g,isDevMode:p,onResolve:_,onEscalate:C,submitAttempted:$,isCertified:I,hasAI:A}){return e.jsxs("div",{className:"mt-8 space-y-6",children:[p&&e.jsx(ie,{title:"Escalation Record",sectionKey:"record",isCollapsed:t("record"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsx(Kt,{esc:i})}),p&&e.jsx(ie,{title:"Input / Output",sectionKey:"context",isCollapsed:t("context"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[!!i.envelope&&e.jsx("div",{children:e.jsx(ne,{data:i.envelope,label:"Input Envelope"})}),a!=null&&e.jsx("div",{children:e.jsx(ne,{data:a,label:"Escalation Context"})})]}),s!=null&&e.jsx("div",{className:"max-w-xl",children:e.jsx(ne,{data:s,label:"Resolver Payload"})})]})}),p&&l&&x&&e.jsx(ie,{title:"AI Triage",sectionKey:"triage",isCollapsed:t("triage"),onToggle:n,contentClassName:"mt-4 ml-9",children:e.jsx(Jt,{triage:l,payload:x})}),!p&&d&&s!=null&&(()=>{const T=typeof s=="object"&&s!==null?s:{},E=c,y=E?{...T,_form_schema:E}:T;return e.jsx("div",{className:"pt-6",children:e.jsx(qe,{value:JSON.stringify(y,null,2),onChange:()=>{},disabled:!0})})})(),!d&&(r||!p)&&o==="resolve"&&!!(i.workflow_type||c)&&(()=>{const T=c,E=T==null?void 0:T["x-lt-viewport"],y=(E==null?void 0:E.type)==="iframe"&&!!E.src&&_&&C;return p?e.jsx(ie,{title:"Submit Your Resolution",sectionKey:"resolver",isCollapsed:t("resolver"),onToggle:n,contentClassName:"mt-4 ml-9",children:y?e.jsx(Ve,{src:E.src,escalation:i,schema:T,onResolve:_,onEscalate:C}):e.jsx(Be,{json:m,onJsonChange:h,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:g,isDevMode:p,submitAttempted:$,showTriage:!!I&&!!A})}):e.jsx("div",{className:"pt-6",children:y?e.jsx(Ve,{src:E.src,escalation:i,schema:T,onResolve:_,onEscalate:C}):e.jsx(Be,{json:m,onJsonChange:h,requestTriage:b,onRequestTriageChange:u,triageNotes:j,onTriageNotesChange:g,isDevMode:p,disabled:!r,submitAttempted:$,showTriage:!!I&&!!A})})})()]})}function ge(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function Gt(t){if(!t)return!1;try{const n=JSON.parse(t);return!!(n&&typeof n=="object"&&n._triage)}catch{return!1}}function js(){var Te,Ee,Se,Re,$e,Me;const{id:t}=$t(),{user:n}=dt(),i=Mt(),a=ot(),{data:s,isLoading:l,refetch:x,isFetching:d}=xt(t);Et(t);const r=ut(),o=mt(),c=pt(),m=ht(),[h,b]=f.useState(!1),{data:u}=vt((s==null?void 0:s.role)??""),{data:j}=Tt(),{data:g}=wt(),{data:p}=ft(),{isBuilder:_}=ye(),{isDevMode:C,toggleMode:$}=It(!1),I=j==null?void 0:j.find(k=>k.workflow_type===(s==null?void 0:s.workflow_type)),A=g==null?void 0:g.roles.find(k=>k.role===(s==null?void 0:s.role)),T=((Te=p==null?void 0:p.telemetry)==null?void 0:Te.traceUrl)??null,[E,y]=f.useState("resolve"),[N,w]=f.useState("{}"),{isCollapsed:M,toggle:D,collapse:W,expand:L}=gt("escalation-detail"),[O,F]=f.useState(!1),[B,oe]=f.useState(""),[ce,G]=f.useState(!1),v=((Ee=s==null?void 0:s.metadata)==null?void 0:Ee.form_schema)??null,z=((Se=s==null?void 0:s.metadata)==null?void 0:Se.schema_version)??null,J=Nt((s==null?void 0:s.role)??"",z??void 0,z!=null),P=(z!=null?((Re=J.data)==null?void 0:Re.form_schema)??null:null)??(I==null?void 0:I.resolver_schema)??(A==null?void 0:A.form_schema)??null,V=v??P,ee=f.useRef(!1);f.useEffect(()=>{if(ee.current||z!=null&&!v&&J.data===void 0&&!J.isError)return;const k=v??(P!=null&&P.properties?P:null);if(k!=null&&k.properties){ee.current=!0;const Ie={_form_schema:k};for(const[rt,it]of Object.entries(k.properties)){const lt=it;Ie[rt]=lt.default??""}w(JSON.stringify(Ie,null,2))}else V&&(ee.current=!0,w(JSON.stringify(V,null,2)))},[V,v,P,z,J.data,J.isError]);const ve=Gt(s==null?void 0:s.escalation_payload),de=(s==null?void 0:s.subtype)==="rounds_exhausted",we=(s==null?void 0:s.subtype)==="wait_for_human";if(f.useEffect(()=>{(ve||de)&&W("context"),we&&v&&(W("context"),L("resolver"))},[ve,de,we,v,W,L]),l)return e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const xe=ze(s),te=xe&&s.assigned_to===(n==null?void 0:n.userId),Qe=xe&&!te,re=s.status==="resolved"||s.status==="cancelled",se=ge(s.escalation_payload),Ne=ge(s.resolver_payload),ue=ge(s.envelope),Ye=!!(($e=ue==null?void 0:ue.metadata)!=null&&$e.certified),Ge=!!((Me=p==null?void 0:p.ai)!=null&&Me.enabled),q=typeof se=="object"&&se!==null&&!Array.isArray(se)?se:null,Xe=q==null?void 0:q._triage,Ze=re?"terminal":te?"claimed_by_me":Qe?"claimed_by_other":"available",et=k=>{r.mutate({id:s.id,durationMinutes:k}),W("context"),W("triage"),L("resolver")},ae=()=>{a.resetQueries({queryKey:["escalations"]}),a.resetQueries({queryKey:["escalationStats"]}),i(-1)},ke=async k=>{await o.mutateAsync({id:s.id,resolverPayload:k}),ae()},_e=async k=>{k&&(await c.mutateAsync({id:s.id,targetRole:k}),ae())},tt=async()=>{te||await r.mutateAsync({id:s.id,durationMinutes:30});const k=(q==null?void 0:q.diagnosis)||s.description||"";await o.mutateAsync({id:s.id,resolverPayload:{_lt:{needsTriage:!0},notes:k}}),ae()},st=async()=>{await r.mutateAsync({id:s.id,durationMinutes:0}),ae()},at=async()=>{await m.mutateAsync(s.id),b(!1),ae()},Ce=_?e.jsx("button",{onClick:$,className:"text-text-tertiary hover:text-accent transition-colors",title:C?"Switch to user view":"Switch to developer view",children:C?e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"})}):e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}):void 0,nt=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ct,{onRefresh:()=>x(),isFetching:d,apiPath:`/escalations/${s.id}`}),Ce&&e.jsx("div",{className:"ml-4",children:Ce})]});return e.jsxs("div",{className:"min-h-[calc(100vh-9rem)] flex flex-col",children:[e.jsx(kt,{title:"Escalation",actions:nt,center:e.jsx(At,{esc:s,className:"w-[25%] shrink-0"})}),e.jsx(Lt,{esc:s,claimedByMe:te,claimed:xe,isTerminal:re,traceUrl:T,isDevMode:C,showDetails:!M("details"),onToggleDetails:()=>D("details")}),e.jsx(Qt,{isRoundsExhausted:de,payloadObj:q,isTerminal:re,resolverPayload:Ne,onRetryTriage:tt,isRetrying:r.isPending||o.isPending}),e.jsx(Yt,{isCollapsed:M,toggleSection:D,esc:s,escalationPayload:se,resolverPayload:Ne,triageData:Xe,payloadObj:q,isTerminal:re,claimedByMe:te,activeView:E,metadataFormSchema:v,json:N,onJsonChange:w,requestTriage:O,onRequestTriageChange:F,triageNotes:B,onTriageNotesChange:oe,isDevMode:C,onResolve:ke,onEscalate:_e,submitAttempted:ce,isCertified:Ye,hasAI:Ge}),e.jsx("div",{className:"flex-1"}),e.jsx(Wt,{mode:Ze,activeView:E,onActiveViewChange:y,onClaim:et,claimPending:r.isPending,workflowType:s.workflow_type,json:N,onResolve:ke,resolvePending:o.isPending,resolveError:o.error,requestTriage:O,triageNotes:B,currentRole:s.role,escalationTargets:((u==null?void 0:u.targets)??[]).filter(k=>k!==s.role),onEscalate:_e,escalatePending:c.isPending,escalateError:c.error,onRelease:st,releasePending:r.isPending,onCancel:()=>b(!0),assignedTo:s.assigned_to,assignedUntil:s.assigned_until,onSubmitAttempt:()=>G(!0)}),e.jsx(yt,{open:h,onClose:()=>b(!1),onConfirm:at,isPending:m.isPending,error:m.error})]})}export{js as EscalationDetailPage};
6
- //# sourceMappingURL=index-BYf0oNSQ.js.map