@hotmeshio/long-tail 0.7.3 → 0.7.5

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 (213) hide show
  1. package/build/api/roles.d.ts +4 -0
  2. package/build/api/roles.js +7 -1
  3. package/build/lib/db/schemas/019_role_priority.sql +28 -0
  4. package/build/routes/roles.js +1 -1
  5. package/build/scripts/ortho-populate.d.ts +7 -1
  6. package/build/scripts/ortho-populate.js +21 -6
  7. package/build/services/escalation/facet-sql.d.ts +1 -0
  8. package/build/services/escalation/facet-sql.js +7 -6
  9. package/build/services/escalation/queries.js +27 -5
  10. package/build/services/escalation/sql.d.ts +19 -2
  11. package/build/services/escalation/sql.js +32 -9
  12. package/build/services/escalation/types.d.ts +7 -1
  13. package/build/services/role/index.js +2 -0
  14. package/build/services/role/sql.d.ts +4 -4
  15. package/build/services/role/sql.js +12 -6
  16. package/build/services/role/types.d.ts +14 -0
  17. package/build/system/mcp-servers/admin/schemas.d.ts +6 -0
  18. package/build/system/mcp-servers/admin/schemas.js +3 -0
  19. package/build/system/mcp-servers/admin/users.js +4 -1
  20. package/build/system/seed/tool-manifests-admin.d.ts +152 -0
  21. package/build/system/seed/tool-manifests-admin.js +1 -1
  22. package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js → AdminDashboard-Bgomc_jH.js} +2 -2
  23. package/dashboard/dist/assets/{AdminDashboard-C9eE1VEp.js.map → AdminDashboard-Bgomc_jH.js.map} +1 -1
  24. package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js → AgentConfigPage-C6gDgz21.js} +6 -6
  25. package/dashboard/dist/assets/{AgentConfigPage-Ba8QfXM2.js.map → AgentConfigPage-C6gDgz21.js.map} +1 -1
  26. package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js → AgentDetailPage-0rrH5FmV.js} +4 -4
  27. package/dashboard/dist/assets/{AgentDetailPage-DVmec0CP.js.map → AgentDetailPage-0rrH5FmV.js.map} +1 -1
  28. package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js → AgentsPage-DkIU2zed.js} +2 -2
  29. package/dashboard/dist/assets/{AgentsPage-DNiCYMh3.js.map → AgentsPage-DkIU2zed.js.map} +1 -1
  30. package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js → AvailableEscalationsPage-C9DAtNGp.js} +2 -2
  31. package/dashboard/dist/assets/{AvailableEscalationsPage-gDIF8ocC.js.map → AvailableEscalationsPage-C9DAtNGp.js.map} +1 -1
  32. package/dashboard/dist/assets/{BotPicker-3wBcBavT.js → BotPicker-MnI3OyE7.js} +2 -2
  33. package/dashboard/dist/assets/{BotPicker-3wBcBavT.js.map → BotPicker-MnI3OyE7.js.map} +1 -1
  34. package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js → CapabilitiesPage-Cv_AD_5i.js} +2 -2
  35. package/dashboard/dist/assets/{CapabilitiesPage-WoPkND2y.js.map → CapabilitiesPage-Cv_AD_5i.js.map} +1 -1
  36. package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js → CollapsibleSection-Ne-Q3QFM.js} +2 -2
  37. package/dashboard/dist/assets/{CollapsibleSection-Cx99mqNN.js.map → CollapsibleSection-Ne-Q3QFM.js.map} +1 -1
  38. package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js → CredentialsPage-B3Mfwl22.js} +2 -2
  39. package/dashboard/dist/assets/{CredentialsPage-DbNaoPbF.js.map → CredentialsPage-B3Mfwl22.js.map} +1 -1
  40. package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js → CronLabel-CtjUBRPo.js} +2 -2
  41. package/dashboard/dist/assets/{CronLabel-DLW4_Zg4.js.map → CronLabel-CtjUBRPo.js.map} +1 -1
  42. package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js → CustomDurationPicker-Cp1fgzPX.js} +2 -2
  43. package/dashboard/dist/assets/{CustomDurationPicker-BRUFjkiu.js.map → CustomDurationPicker-Cp1fgzPX.js.map} +1 -1
  44. package/dashboard/dist/assets/{DropZone-DEX0BBqt.js → DropZone-CZDmNBn-.js} +2 -2
  45. package/dashboard/dist/assets/{DropZone-DEX0BBqt.js.map → DropZone-CZDmNBn-.js.map} +1 -1
  46. package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js → ElapsedCell-Gr5UlUbn.js} +2 -2
  47. package/dashboard/dist/assets/{ElapsedCell-BtmDQaym.js.map → ElapsedCell-Gr5UlUbn.js.map} +1 -1
  48. package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js → EscalationSchemaPage-C5tuV6SJ.js} +2 -2
  49. package/dashboard/dist/assets/{EscalationSchemaPage-Bm4yBEGN.js.map → EscalationSchemaPage-C5tuV6SJ.js.map} +1 -1
  50. package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js → EscalationsOverview-BIZVnSBF.js} +2 -2
  51. package/dashboard/dist/assets/{EscalationsOverview-B3xZwTQA.js.map → EscalationsOverview-BIZVnSBF.js.map} +1 -1
  52. package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js → EventTable-90aUfsNr.js} +2 -2
  53. package/dashboard/dist/assets/{EventTable-Bh9FKXLI.js.map → EventTable-90aUfsNr.js.map} +1 -1
  54. package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js → GraphInvokePage-Io5ZucT8.js} +2 -2
  55. package/dashboard/dist/assets/{GraphInvokePage-ov_ANlaE.js.map → GraphInvokePage-Io5ZucT8.js.map} +1 -1
  56. package/dashboard/dist/assets/{HomePage-D0DV6izb.js → HomePage-Cu0vUzTF.js} +2 -2
  57. package/dashboard/dist/assets/{HomePage-D0DV6izb.js.map → HomePage-Cu0vUzTF.js.map} +1 -1
  58. package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js → ListToolbar-CdmIvEIF.js} +2 -2
  59. package/dashboard/dist/assets/{ListToolbar-FpcvqNkN.js.map → ListToolbar-CdmIvEIF.js.map} +1 -1
  60. package/dashboard/dist/assets/{McpOverview-DcuRiAff.js → McpOverview-C-Ypezuv.js} +2 -2
  61. package/dashboard/dist/assets/{McpOverview-DcuRiAff.js.map → McpOverview-C-Ypezuv.js.map} +1 -1
  62. package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js → McpQueryDetailPage-DdontKcj.js} +2 -2
  63. package/dashboard/dist/assets/{McpQueryDetailPage-BcYl67KP.js.map → McpQueryDetailPage-DdontKcj.js.map} +1 -1
  64. package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js → McpQueryPage-D-1TaOGG.js} +2 -2
  65. package/dashboard/dist/assets/{McpQueryPage-C3GDzqZM.js.map → McpQueryPage-D-1TaOGG.js.map} +1 -1
  66. package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js → McpRunDetailPage-B1sCxKLD.js} +2 -2
  67. package/dashboard/dist/assets/{McpRunDetailPage-SzOyhDBW.js.map → McpRunDetailPage-B1sCxKLD.js.map} +1 -1
  68. package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js → McpRunsPage-eWJ7cDa3.js} +2 -2
  69. package/dashboard/dist/assets/{McpRunsPage-BwgB6mRV.js.map → McpRunsPage-eWJ7cDa3.js.map} +1 -1
  70. package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js → NamespacePill-DlqBTvFR.js} +2 -2
  71. package/dashboard/dist/assets/{NamespacePill-CwKdoyRM.js.map → NamespacePill-DlqBTvFR.js.map} +1 -1
  72. package/dashboard/dist/assets/OperationsPage-C5phWL0O.js +2 -0
  73. package/dashboard/dist/assets/OperationsPage-C5phWL0O.js.map +1 -0
  74. package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js → OperatorDashboard-YP6kP-f_.js} +2 -2
  75. package/dashboard/dist/assets/{OperatorDashboard-DSXh-yYw.js.map → OperatorDashboard-YP6kP-f_.js.map} +1 -1
  76. package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js → PageHeader-CFta2VaS.js} +2 -2
  77. package/dashboard/dist/assets/{PageHeader-BhaWTWcM.js.map → PageHeader-CFta2VaS.js.map} +1 -1
  78. package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js → PageHeaderWithStats-CcVAji-7.js} +2 -2
  79. package/dashboard/dist/assets/{PageHeaderWithStats-yex5WmHB.js.map → PageHeaderWithStats-CcVAji-7.js.map} +1 -1
  80. package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js → ProcessDetailPage-C_BXQvBs.js} +2 -2
  81. package/dashboard/dist/assets/{ProcessDetailPage-iIB1rwEt.js.map → ProcessDetailPage-C_BXQvBs.js.map} +1 -1
  82. package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js → ProcessesListPage-BNhFwTLl.js} +2 -2
  83. package/dashboard/dist/assets/{ProcessesListPage-BrqWR2zr.js.map → ProcessesListPage-BNhFwTLl.js.map} +1 -1
  84. package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js +11 -0
  85. package/dashboard/dist/assets/RoleDetailPage-8GLNjj9I.js.map +1 -0
  86. package/dashboard/dist/assets/{RolePill-Cl71eDUA.js → RolePill-CXEyPMqb.js} +2 -2
  87. package/dashboard/dist/assets/{RolePill-Cl71eDUA.js.map → RolePill-CXEyPMqb.js.map} +1 -1
  88. package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js → RolesPage-B59tE2lZ.js} +2 -2
  89. package/dashboard/dist/assets/{RolesPage-Bzp9FhAl.js.map → RolesPage-B59tE2lZ.js.map} +1 -1
  90. package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js → RunAsSelector-CokM3Ifp.js} +2 -2
  91. package/dashboard/dist/assets/{RunAsSelector-DXbHRxQs.js.map → RunAsSelector-CokM3Ifp.js.map} +1 -1
  92. package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js → StickyPagination-_H2j2CAH.js} +2 -2
  93. package/dashboard/dist/assets/{StickyPagination-D8XuMSWD.js.map → StickyPagination-_H2j2CAH.js.map} +1 -1
  94. package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js → StreamMessageDetail-sSfHDYIa.js} +2 -2
  95. package/dashboard/dist/assets/{StreamMessageDetail-D5v95pmz.js.map → StreamMessageDetail-sSfHDYIa.js.map} +1 -1
  96. package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js → SwimlaneTimeline-LZWtfBK3.js} +2 -2
  97. package/dashboard/dist/assets/{SwimlaneTimeline-CUEf2R5R.js.map → SwimlaneTimeline-LZWtfBK3.js.map} +1 -1
  98. package/dashboard/dist/assets/{TagInput-B_WQiuer.js → TagInput-CQg-TrV9.js} +2 -2
  99. package/dashboard/dist/assets/{TagInput-B_WQiuer.js.map → TagInput-CQg-TrV9.js.map} +1 -1
  100. package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js → TaskDetailPage-CHBV2V6R.js} +2 -2
  101. package/dashboard/dist/assets/{TaskDetailPage-BJvKNwEe.js.map → TaskDetailPage-CHBV2V6R.js.map} +1 -1
  102. package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js → TaskQueuePill-DyvtL8X4.js} +2 -2
  103. package/dashboard/dist/assets/{TaskQueuePill-Lgn2obNU.js.map → TaskQueuePill-DyvtL8X4.js.map} +1 -1
  104. package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js → TasksListPage-B71FxvrY.js} +2 -2
  105. package/dashboard/dist/assets/{TasksListPage-CM7BWh_h.js.map → TasksListPage-B71FxvrY.js.map} +1 -1
  106. package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js → TimeAgo-JgT0U_sd.js} +2 -2
  107. package/dashboard/dist/assets/{TimeAgo-D1K7xKq5.js.map → TimeAgo-JgT0U_sd.js.map} +1 -1
  108. package/dashboard/dist/assets/{TimestampCell-7G0echgP.js → TimestampCell-gEreK8Nn.js} +2 -2
  109. package/dashboard/dist/assets/{TimestampCell-7G0echgP.js.map → TimestampCell-gEreK8Nn.js.map} +1 -1
  110. package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js → ToolPill-miuRcj1Q.js} +2 -2
  111. package/dashboard/dist/assets/{ToolPill-uVqcbHPE.js.map → ToolPill-miuRcj1Q.js.map} +1 -1
  112. package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js → ToolTestPanel-ChfHw9Aq.js} +2 -2
  113. package/dashboard/dist/assets/{ToolTestPanel-LxuJvURK.js.map → ToolTestPanel-ChfHw9Aq.js.map} +1 -1
  114. package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js → TopicDetailPage-DigI0HGt.js} +2 -2
  115. package/dashboard/dist/assets/{TopicDetailPage-JvAX6rrR.js.map → TopicDetailPage-DigI0HGt.js.map} +1 -1
  116. package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js → TopicsPage-BHjlFpPN.js} +2 -2
  117. package/dashboard/dist/assets/{TopicsPage-tFT2AcTz.js.map → TopicsPage-BHjlFpPN.js.map} +1 -1
  118. package/dashboard/dist/assets/{UserName-Djz0nmaZ.js → UserName-uncbaKYf.js} +2 -2
  119. package/dashboard/dist/assets/{UserName-Djz0nmaZ.js.map → UserName-uncbaKYf.js.map} +1 -1
  120. package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js → WorkflowExecutionPage-DwzLKTkt.js} +2 -2
  121. package/dashboard/dist/assets/{WorkflowExecutionPage-f53hilbI.js.map → WorkflowExecutionPage-DwzLKTkt.js.map} +1 -1
  122. package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js → WorkflowPill-BegV-iRF.js} +2 -2
  123. package/dashboard/dist/assets/{WorkflowPill-IDjTRfQ8.js.map → WorkflowPill-BegV-iRF.js.map} +1 -1
  124. package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js → WorkflowsDashboard-rpnGhGnl.js} +2 -2
  125. package/dashboard/dist/assets/{WorkflowsDashboard-DM9Xe665.js.map → WorkflowsDashboard-rpnGhGnl.js.map} +1 -1
  126. package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js → WorkflowsOverview-ihhW8DiS.js} +2 -2
  127. package/dashboard/dist/assets/{WorkflowsOverview-CUGSrx9N.js.map → WorkflowsOverview-ihhW8DiS.js.map} +1 -1
  128. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js → YamlWorkflowDetailPage-C61-8y-E.js} +2 -2
  129. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B1_yqxAw.js.map → YamlWorkflowDetailPage-C61-8y-E.js.map} +1 -1
  130. package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js → YamlWorkflowsPage-CMpgsLEo.js} +2 -2
  131. package/dashboard/dist/assets/{YamlWorkflowsPage-NtGvqiu7.js.map → YamlWorkflowsPage-CMpgsLEo.js.map} +1 -1
  132. package/dashboard/dist/assets/{agents-tML6AjDj.js → agents-27sErp5R.js} +2 -2
  133. package/dashboard/dist/assets/{agents-tML6AjDj.js.map → agents-27sErp5R.js.map} +1 -1
  134. package/dashboard/dist/assets/{bots-Cb0WTwhY.js → bots-CPHuAvjW.js} +2 -2
  135. package/dashboard/dist/assets/{bots-Cb0WTwhY.js.map → bots-CPHuAvjW.js.map} +1 -1
  136. package/dashboard/dist/assets/{capabilities-BGZogsi_.js → capabilities-BBTPqF-V.js} +2 -2
  137. package/dashboard/dist/assets/{capabilities-BGZogsi_.js.map → capabilities-BBTPqF-V.js.map} +1 -1
  138. package/dashboard/dist/assets/{controlplane-B7VJTlZD.js → controlplane-C9j2mwX8.js} +2 -2
  139. package/dashboard/dist/assets/{controlplane-B7VJTlZD.js.map → controlplane-C9j2mwX8.js.map} +1 -1
  140. package/dashboard/dist/assets/{escalation-Bl-SQV_u.js → escalation-CyJ_wz-f.js} +2 -2
  141. package/dashboard/dist/assets/{escalation-Bl-SQV_u.js.map → escalation-CyJ_wz-f.js.map} +1 -1
  142. package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js → escalation-columns-DU4Jyxxo.js} +2 -2
  143. package/dashboard/dist/assets/{escalation-columns-BlJOswRx.js.map → escalation-columns-DU4Jyxxo.js.map} +1 -1
  144. package/dashboard/dist/assets/{index-e97M6GoI.js → index-BBQggGcf.js} +2 -2
  145. package/dashboard/dist/assets/{index-e97M6GoI.js.map → index-BBQggGcf.js.map} +1 -1
  146. package/dashboard/dist/assets/{index-D0-8byNu.js → index-BHS-ubrT.js} +2 -2
  147. package/dashboard/dist/assets/{index-D0-8byNu.js.map → index-BHS-ubrT.js.map} +1 -1
  148. package/dashboard/dist/assets/{index-DcbEIXit.js → index-BVHXREYZ.js} +2 -2
  149. package/dashboard/dist/assets/{index-DcbEIXit.js.map → index-BVHXREYZ.js.map} +1 -1
  150. package/dashboard/dist/assets/{index-Il_g7kw5.js → index-BiLZJ43R.js} +2 -2
  151. package/dashboard/dist/assets/{index-Il_g7kw5.js.map → index-BiLZJ43R.js.map} +1 -1
  152. package/dashboard/dist/assets/{index-Dgw1KKpq.js → index-BoZydcaW.js} +4 -4
  153. package/dashboard/dist/assets/{index-Dgw1KKpq.js.map → index-BoZydcaW.js.map} +1 -1
  154. package/dashboard/dist/assets/{index-CBv3UxF2.js → index-CCHGKErT.js} +2 -2
  155. package/dashboard/dist/assets/{index-CBv3UxF2.js.map → index-CCHGKErT.js.map} +1 -1
  156. package/dashboard/dist/assets/{index-0o71lRuY.js → index-CNprOGuS.js} +2 -2
  157. package/dashboard/dist/assets/{index-0o71lRuY.js.map → index-CNprOGuS.js.map} +1 -1
  158. package/dashboard/dist/assets/{index-Wny0bRgq.css → index-CZ6-l8_0.css} +1 -1
  159. package/dashboard/dist/assets/{index-3A_5CL81.js → index-CgeFUhUr.js} +2 -2
  160. package/dashboard/dist/assets/{index-3A_5CL81.js.map → index-CgeFUhUr.js.map} +1 -1
  161. package/dashboard/dist/assets/{index-TiKh2Ctj.js → index-ChniBGqD.js} +2 -2
  162. package/dashboard/dist/assets/{index-TiKh2Ctj.js.map → index-ChniBGqD.js.map} +1 -1
  163. package/dashboard/dist/assets/{index--WeZDfeN.js → index-CjXzZ19T.js} +2 -2
  164. package/dashboard/dist/assets/{index--WeZDfeN.js.map → index-CjXzZ19T.js.map} +1 -1
  165. package/dashboard/dist/assets/{index-DfDfJivY.js → index-D9pi0fs6.js} +2 -2
  166. package/dashboard/dist/assets/{index-DfDfJivY.js.map → index-D9pi0fs6.js.map} +1 -1
  167. package/dashboard/dist/assets/{index-SCrD3l-K.js → index-DoivEaUZ.js} +2 -2
  168. package/dashboard/dist/assets/{index-SCrD3l-K.js.map → index-DoivEaUZ.js.map} +1 -1
  169. package/dashboard/dist/assets/{index-BorpZbZA.js → index-Dzqt3g-K.js} +2 -2
  170. package/dashboard/dist/assets/{index-BorpZbZA.js.map → index-Dzqt3g-K.js.map} +1 -1
  171. package/dashboard/dist/assets/{knowledge-CDzw4E6q.js → knowledge-BErJA3Je.js} +2 -2
  172. package/dashboard/dist/assets/{knowledge-CDzw4E6q.js.map → knowledge-BErJA3Je.js.map} +1 -1
  173. package/dashboard/dist/assets/{mcp-D_-NQtnG.js → mcp-Cx9L42EN.js} +2 -2
  174. package/dashboard/dist/assets/{mcp-D_-NQtnG.js.map → mcp-Cx9L42EN.js.map} +1 -1
  175. package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js → mcp-query-Cf6kcBoW.js} +2 -2
  176. package/dashboard/dist/assets/{mcp-query-BqZXdf9A.js.map → mcp-query-Cf6kcBoW.js.map} +1 -1
  177. package/dashboard/dist/assets/{pipelines-CNLhgj8b.js → pipelines-CFctrv71.js} +2 -2
  178. package/dashboard/dist/assets/{pipelines-CNLhgj8b.js.map → pipelines-CFctrv71.js.map} +1 -1
  179. package/dashboard/dist/assets/{roles-CFD2eYap.js → roles-CCXZtqDr.js} +2 -2
  180. package/dashboard/dist/assets/roles-CCXZtqDr.js.map +1 -0
  181. package/dashboard/dist/assets/{tasks-DcSvF636.js → tasks-BPNj8ZWL.js} +2 -2
  182. package/dashboard/dist/assets/{tasks-DcSvF636.js.map → tasks-BPNj8ZWL.js.map} +1 -1
  183. package/dashboard/dist/assets/{topics-DI8TFSZv.js → topics-CR4UBuSV.js} +2 -2
  184. package/dashboard/dist/assets/{topics-DI8TFSZv.js.map → topics-CR4UBuSV.js.map} +1 -1
  185. package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js → useEventHooks-BgdnN8Rj.js} +2 -2
  186. package/dashboard/dist/assets/{useEventHooks-DcIgMDh3.js.map → useEventHooks-BgdnN8Rj.js.map} +1 -1
  187. package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js → useNamespace-BDsKfT0f.js} +2 -2
  188. package/dashboard/dist/assets/{useNamespace-C88ZxGoX.js.map → useNamespace-BDsKfT0f.js.map} +1 -1
  189. package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js → useYamlActivityEvents-CWZwHIlR.js} +2 -2
  190. package/dashboard/dist/assets/{useYamlActivityEvents-D2-yVjJ7.js.map → useYamlActivityEvents-CWZwHIlR.js.map} +1 -1
  191. package/dashboard/dist/assets/{users-C0WV36X8.js → users-BqmKVXR1.js} +2 -2
  192. package/dashboard/dist/assets/{users-C0WV36X8.js.map → users-BqmKVXR1.js.map} +1 -1
  193. package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js → vendor-icons-BaQqUm-e.js} +2 -2
  194. package/dashboard/dist/assets/{vendor-icons-CEWCGPeJ.js.map → vendor-icons-BaQqUm-e.js.map} +1 -1
  195. package/dashboard/dist/assets/{workflows-CkPv7xk-.js → workflows-Dps45zjk.js} +2 -2
  196. package/dashboard/dist/assets/{workflows-CkPv7xk-.js.map → workflows-Dps45zjk.js.map} +1 -1
  197. package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js → yaml-workflows-DhlTkbvY.js} +2 -2
  198. package/dashboard/dist/assets/{yaml-workflows-BjrMQLTK.js.map → yaml-workflows-DhlTkbvY.js.map} +1 -1
  199. package/dashboard/dist/index.html +3 -3
  200. package/docs/api/http/escalations.md +3 -3
  201. package/docs/api/http/roles.md +6 -0
  202. package/docs/api/mcp/admin.md +2 -0
  203. package/docs/api/sdk/escalations.md +2 -2
  204. package/docs/api/sdk/roles.md +7 -1
  205. package/docs/dashboard.md +5 -4
  206. package/docs/data.md +2 -0
  207. package/docs/operations.md +16 -3
  208. package/package.json +2 -2
  209. package/dashboard/dist/assets/OperationsPage-BCr21p8I.js +0 -2
  210. package/dashboard/dist/assets/OperationsPage-BCr21p8I.js.map +0 -1
  211. package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js +0 -11
  212. package/dashboard/dist/assets/RoleDetailPage-DS37tJhq.js.map +0 -1
  213. package/dashboard/dist/assets/roles-CFD2eYap.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{u as n,b as t,c as u}from"./vendor-query-B2UbickB.js";import{d as s}from"./index-Dgw1KKpq.js";function f(){return n({queryKey:["activeWorkers"],queryFn:async()=>(await s("/workflows/workers")).workers})}function w(){return n({queryKey:["discoveredWorkflows"],queryFn:async()=>(await s("/workflows/discovered")).workflows})}function l(){return n({queryKey:["workflowConfigs"],queryFn:async()=>(await s("/workflows/config")).workflows})}function d(){return n({queryKey:["cronStatus"],queryFn:async()=>(await s("/workflows/cron/status")).schedules})}function k(e){return n({queryKey:["workflowExecution",e],queryFn:()=>s(`/workflow-states/${e}/execution`),enabled:!!e})}function m(e,o){const r=new URLSearchParams;return e.limit&&r.set("limit",String(e.limit)),e.offset!==void 0&&r.set("offset",String(e.offset)),e.entity&&r.set("entity",e.entity),e.search&&r.set("search",e.search),e.status&&r.set("status",e.status),e.sort_by&&r.set("sort_by",e.sort_by),e.order&&r.set("order",e.order),e.registered&&r.set("registered",e.registered),e.namespace&&r.set("namespace",e.namespace),n({queryKey:["jobs",e],queryFn:()=>s(`/workflow-states/jobs?${r}`),enabled:(o==null?void 0:o.enabled)??!0})}function q(){const e=t();return u({mutationFn:o=>s(`/workflows/${o}/terminate`,{method:"POST"}),onSuccess:(o,r)=>{e.invalidateQueries({queryKey:["workflowExecution",r],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function g(){const e=t();return u({mutationFn:({workflow_type:o,...r})=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function h(){const e=t();return u({mutationFn:o=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function b(){const e=t();return u({mutationFn:({workflowType:o,data:r,metadata:i,execute_as:a})=>s(`/workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:r,metadata:i,...a?{execute_as:a}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}export{k as a,m as b,b as c,w as d,d as e,q as f,f as g,h,g as i,l as u};
2
- //# sourceMappingURL=workflows-CkPv7xk-.js.map
1
+ import{u as n,b as t,c as u}from"./vendor-query-B2UbickB.js";import{d as s}from"./index-BoZydcaW.js";function f(){return n({queryKey:["activeWorkers"],queryFn:async()=>(await s("/workflows/workers")).workers})}function w(){return n({queryKey:["discoveredWorkflows"],queryFn:async()=>(await s("/workflows/discovered")).workflows})}function l(){return n({queryKey:["workflowConfigs"],queryFn:async()=>(await s("/workflows/config")).workflows})}function d(){return n({queryKey:["cronStatus"],queryFn:async()=>(await s("/workflows/cron/status")).schedules})}function k(e){return n({queryKey:["workflowExecution",e],queryFn:()=>s(`/workflow-states/${e}/execution`),enabled:!!e})}function m(e,o){const r=new URLSearchParams;return e.limit&&r.set("limit",String(e.limit)),e.offset!==void 0&&r.set("offset",String(e.offset)),e.entity&&r.set("entity",e.entity),e.search&&r.set("search",e.search),e.status&&r.set("status",e.status),e.sort_by&&r.set("sort_by",e.sort_by),e.order&&r.set("order",e.order),e.registered&&r.set("registered",e.registered),e.namespace&&r.set("namespace",e.namespace),n({queryKey:["jobs",e],queryFn:()=>s(`/workflow-states/jobs?${r}`),enabled:(o==null?void 0:o.enabled)??!0})}function q(){const e=t();return u({mutationFn:o=>s(`/workflows/${o}/terminate`,{method:"POST"}),onSuccess:(o,r)=>{e.invalidateQueries({queryKey:["workflowExecution",r],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}function g(){const e=t();return u({mutationFn:({workflow_type:o,...r})=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"PUT",body:JSON.stringify(r)}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function h(){const e=t();return u({mutationFn:o=>s(`/workflows/${encodeURIComponent(o)}/config`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["workflowConfigs"],refetchType:"all"})}})}function b(){const e=t();return u({mutationFn:({workflowType:o,data:r,metadata:i,execute_as:a})=>s(`/workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:r,metadata:i,...a?{execute_as:a}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"],refetchType:"all"}),e.invalidateQueries({queryKey:["jobs"],refetchType:"all"})}})}export{k as a,m as b,b as c,w as d,d as e,q as f,f as g,h,g as i,l as u};
2
+ //# sourceMappingURL=workflows-Dps45zjk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflows-CkPv7xk-.js","sources":["../../src/api/workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { ActiveWorker, CronScheduleEntry, DiscoveredWorkflow, LTJob, LTWorkflowConfig, WorkflowExecution } from './types';\n\nexport function useActiveWorkers() {\n return useQuery<ActiveWorker[]>({\n queryKey: ['activeWorkers'],\n queryFn: async () => {\n const res = await apiFetch<{ workers: ActiveWorker[] }>('/workflows/workers');\n return res.workers;\n },\n });\n}\n\nexport function useDiscoveredWorkflows() {\n return useQuery<DiscoveredWorkflow[]>({\n queryKey: ['discoveredWorkflows'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: DiscoveredWorkflow[] }>('/workflows/discovered');\n return res.workflows;\n },\n });\n}\n\nexport function useWorkflowConfigs() {\n return useQuery<LTWorkflowConfig[]>({\n queryKey: ['workflowConfigs'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: LTWorkflowConfig[] }>('/workflows/config');\n return res.workflows;\n },\n });\n}\n\nexport function useCronStatus() {\n return useQuery<CronScheduleEntry[]>({\n queryKey: ['cronStatus'],\n queryFn: async () => {\n const res = await apiFetch<{ schedules: CronScheduleEntry[] }>('/workflows/cron/status');\n return res.schedules;\n },\n });\n}\n\nexport function useWorkflowExecution(workflowId: string) {\n return useQuery<WorkflowExecution>({\n queryKey: ['workflowExecution', workflowId],\n queryFn: () =>\n apiFetch(`/workflow-states/${workflowId}/execution`),\n enabled: !!workflowId,\n });\n}\n\nexport function useWorkflowState(workflowId: string) {\n return useQuery<{ workflow_id: string; state: Record<string, unknown> }>({\n queryKey: ['workflowState', workflowId],\n queryFn: () => apiFetch(`/workflow-states/${workflowId}/state`),\n enabled: !!workflowId,\n });\n}\n\nexport function useJobs(filters: {\n limit?: number;\n offset?: number;\n entity?: string;\n search?: string;\n status?: string;\n sort_by?: string;\n order?: string;\n registered?: string;\n namespace?: string;\n}, options?: { enabled?: boolean }) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n if (filters.entity) params.set('entity', filters.entity);\n if (filters.search) params.set('search', filters.search);\n if (filters.status) params.set('status', filters.status);\n if (filters.sort_by) params.set('sort_by', filters.sort_by);\n if (filters.order) params.set('order', filters.order);\n if (filters.registered) params.set('registered', filters.registered);\n if (filters.namespace) params.set('namespace', filters.namespace);\n\n return useQuery<{ jobs: LTJob[]; total: number }>({\n queryKey: ['jobs', filters],\n queryFn: () => apiFetch(`/workflow-states/jobs?${params}`),\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useTerminateWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (workflowId: string) =>\n apiFetch(`/workflows/${workflowId}/terminate`, { method: 'POST' }),\n onSuccess: (_data, workflowId) => {\n queryClient.invalidateQueries({ queryKey: ['workflowExecution', workflowId], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpsertWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n {\n workflow_type: string;\n description?: string | null;\n\n invocable?: boolean;\n task_queue?: string | null;\n default_role?: string;\n roles?: string[];\n invocation_roles?: string[];\n consumes?: string[];\n envelope_schema?: Record<string, unknown> | null;\n resolver_schema?: Record<string, unknown> | null;\n cron_schedule?: string | null;\n execute_as?: string | null;\n }\n >({\n mutationFn: ({ workflow_type, ...body }) =>\n apiFetch(`/workflows/${encodeURIComponent(workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean; workflow_type: string }, Error, string>({\n mutationFn: (workflowType) =>\n apiFetch(`/workflows/${encodeURIComponent(workflowType)}/config`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useSetCronSchedule() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n { config: LTWorkflowConfig; cron_schedule: string | null; envelope_schema?: Record<string, unknown> | null }\n >({\n mutationFn: ({ config, cron_schedule, envelope_schema }) =>\n apiFetch(`/workflows/${encodeURIComponent(config.workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify({\n ...config,\n cron_schedule,\n ...(envelope_schema !== undefined ? { envelope_schema } : {}),\n }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['cronStatus'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeWorkflow() {\n const queryClient = useQueryClient();\n return useMutation<\n { workflowId: string; message: string },\n Error,\n { workflowType: string; data: Record<string, unknown>; metadata?: Record<string, unknown>; execute_as?: string }\n >({\n mutationFn: ({ workflowType, data, metadata, execute_as }) =>\n apiFetch(`/workflows/${workflowType}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, metadata, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['tasks'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n"],"names":["useActiveWorkers","useQuery","apiFetch","useDiscoveredWorkflows","useWorkflowConfigs","useCronStatus","useWorkflowExecution","workflowId","useJobs","filters","options","params","useTerminateWorkflow","queryClient","useQueryClient","useMutation","_data","useUpsertWorkflowConfig","workflow_type","body","useDeleteWorkflowConfig","workflowType","useInvokeWorkflow","data","metadata","execute_as"],"mappings":"qGAIO,SAASA,GAAmB,CACjC,OAAOC,EAAyB,CAC9B,SAAU,CAAC,eAAe,EAC1B,QAAS,UACK,MAAMC,EAAsC,oBAAoB,GACjE,OACb,CACD,CACH,CAEO,SAASC,GAAyB,CACvC,OAAOF,EAA+B,CACpC,SAAU,CAAC,qBAAqB,EAChC,QAAS,UACK,MAAMC,EAA8C,uBAAuB,GAC5E,SACb,CACD,CACH,CAEO,SAASE,GAAqB,CACnC,OAAOH,EAA6B,CAClC,SAAU,CAAC,iBAAiB,EAC5B,QAAS,UACK,MAAMC,EAA4C,mBAAmB,GACtE,SACb,CACD,CACH,CAEO,SAASG,GAAgB,CAC9B,OAAOJ,EAA8B,CACnC,SAAU,CAAC,YAAY,EACvB,QAAS,UACK,MAAMC,EAA6C,wBAAwB,GAC5E,SACb,CACD,CACH,CAEO,SAASI,EAAqBC,EAAoB,CACvD,OAAON,EAA4B,CACjC,SAAU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L,CACA,WAAY,CAAC,CAAE,cAAAG,EAAe,GAAGC,CAAA,IAC/BjB,EAAS,cAAc,mBAAmBgB,CAAa,CAAC,UAAW,CACjE,OAAQ,MACR,KAAM,KAAK,UAAUC,CAAI,CAAA,CAC1B,EACH,UAAW,IAAM,CACfN,EAAY,kBAAkB,CAAE,SAAU,CAAC,iBAAiB,EAAG,YAAa,MAAO,CACrF,CAAA,CACD,CACH,CAEO,SAASO,GAA0B,CACxC,MAAMP,EAAcC,EAAA,EACpB,OAAOC,EAAwE,CAC7E,WAAaM,GACXnB,EAAS,cAAc,mBAAmBmB,CAAY,CAAC,UAAW,CAChE,OAAQ,QAAA,CACT,EACH,UAAW,IAAM,CACfR,EAAY,kBAAkB,CAAE,SAAU,CAAC,iBAAiB,EAAG,YAAa,MAAO,CACrF,CAAA,CACD,CACH,CAyBO,SAASS,GAAoB,CAClC,MAAMT,EAAcC,EAAA,EACpB,OAAOC,EAIL,CACA,WAAY,CAAC,CAAE,aAAAM,EAAc,KAAAE,EAAM,SAAAC,EAAU,WAAAC,KAC3CvB,EAAS,cAAcmB,CAAY,UAAW,CAC5C,OAAQ,OACR,KAAM,KAAK,UAAU,CAAE,KAAAE,EAAM,SAAAC,EAAU,GAAIC,EAAa,CAAE,WAAAA,CAAA,EAAe,GAAK,CAAA,CAC/E,EACH,UAAW,IAAM,CACfZ,EAAY,kBAAkB,CAAE,SAAU,CAAC,OAAO,EAAG,YAAa,MAAO,EACzEA,EAAY,kBAAkB,CAAE,SAAU,CAAC,MAAM,EAAG,YAAa,MAAO,CAC1E,CAAA,CACD,CACH"}
1
+ {"version":3,"file":"workflows-Dps45zjk.js","sources":["../../src/api/workflows.ts"],"sourcesContent":["import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';\nimport { apiFetch } from './client';\nimport type { ActiveWorker, CronScheduleEntry, DiscoveredWorkflow, LTJob, LTWorkflowConfig, WorkflowExecution } from './types';\n\nexport function useActiveWorkers() {\n return useQuery<ActiveWorker[]>({\n queryKey: ['activeWorkers'],\n queryFn: async () => {\n const res = await apiFetch<{ workers: ActiveWorker[] }>('/workflows/workers');\n return res.workers;\n },\n });\n}\n\nexport function useDiscoveredWorkflows() {\n return useQuery<DiscoveredWorkflow[]>({\n queryKey: ['discoveredWorkflows'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: DiscoveredWorkflow[] }>('/workflows/discovered');\n return res.workflows;\n },\n });\n}\n\nexport function useWorkflowConfigs() {\n return useQuery<LTWorkflowConfig[]>({\n queryKey: ['workflowConfigs'],\n queryFn: async () => {\n const res = await apiFetch<{ workflows: LTWorkflowConfig[] }>('/workflows/config');\n return res.workflows;\n },\n });\n}\n\nexport function useCronStatus() {\n return useQuery<CronScheduleEntry[]>({\n queryKey: ['cronStatus'],\n queryFn: async () => {\n const res = await apiFetch<{ schedules: CronScheduleEntry[] }>('/workflows/cron/status');\n return res.schedules;\n },\n });\n}\n\nexport function useWorkflowExecution(workflowId: string) {\n return useQuery<WorkflowExecution>({\n queryKey: ['workflowExecution', workflowId],\n queryFn: () =>\n apiFetch(`/workflow-states/${workflowId}/execution`),\n enabled: !!workflowId,\n });\n}\n\nexport function useWorkflowState(workflowId: string) {\n return useQuery<{ workflow_id: string; state: Record<string, unknown> }>({\n queryKey: ['workflowState', workflowId],\n queryFn: () => apiFetch(`/workflow-states/${workflowId}/state`),\n enabled: !!workflowId,\n });\n}\n\nexport function useJobs(filters: {\n limit?: number;\n offset?: number;\n entity?: string;\n search?: string;\n status?: string;\n sort_by?: string;\n order?: string;\n registered?: string;\n namespace?: string;\n}, options?: { enabled?: boolean }) {\n const params = new URLSearchParams();\n if (filters.limit) params.set('limit', String(filters.limit));\n if (filters.offset !== undefined) params.set('offset', String(filters.offset));\n if (filters.entity) params.set('entity', filters.entity);\n if (filters.search) params.set('search', filters.search);\n if (filters.status) params.set('status', filters.status);\n if (filters.sort_by) params.set('sort_by', filters.sort_by);\n if (filters.order) params.set('order', filters.order);\n if (filters.registered) params.set('registered', filters.registered);\n if (filters.namespace) params.set('namespace', filters.namespace);\n\n return useQuery<{ jobs: LTJob[]; total: number }>({\n queryKey: ['jobs', filters],\n queryFn: () => apiFetch(`/workflow-states/jobs?${params}`),\n enabled: options?.enabled ?? true,\n });\n}\n\nexport function useTerminateWorkflow() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (workflowId: string) =>\n apiFetch(`/workflows/${workflowId}/terminate`, { method: 'POST' }),\n onSuccess: (_data, workflowId) => {\n queryClient.invalidateQueries({ queryKey: ['workflowExecution', workflowId], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useUpsertWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n {\n workflow_type: string;\n description?: string | null;\n\n invocable?: boolean;\n task_queue?: string | null;\n default_role?: string;\n roles?: string[];\n invocation_roles?: string[];\n consumes?: string[];\n envelope_schema?: Record<string, unknown> | null;\n resolver_schema?: Record<string, unknown> | null;\n cron_schedule?: string | null;\n execute_as?: string | null;\n }\n >({\n mutationFn: ({ workflow_type, ...body }) =>\n apiFetch(`/workflows/${encodeURIComponent(workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify(body),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useDeleteWorkflowConfig() {\n const queryClient = useQueryClient();\n return useMutation<{ deleted: boolean; workflow_type: string }, Error, string>({\n mutationFn: (workflowType) =>\n apiFetch(`/workflows/${encodeURIComponent(workflowType)}/config`, {\n method: 'DELETE',\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n },\n });\n}\n\nexport function useSetCronSchedule() {\n const queryClient = useQueryClient();\n return useMutation<\n LTWorkflowConfig,\n Error,\n { config: LTWorkflowConfig; cron_schedule: string | null; envelope_schema?: Record<string, unknown> | null }\n >({\n mutationFn: ({ config, cron_schedule, envelope_schema }) =>\n apiFetch(`/workflows/${encodeURIComponent(config.workflow_type)}/config`, {\n method: 'PUT',\n body: JSON.stringify({\n ...config,\n cron_schedule,\n ...(envelope_schema !== undefined ? { envelope_schema } : {}),\n }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['workflowConfigs'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['cronStatus'], refetchType: 'all' });\n },\n });\n}\n\nexport function useInvokeWorkflow() {\n const queryClient = useQueryClient();\n return useMutation<\n { workflowId: string; message: string },\n Error,\n { workflowType: string; data: Record<string, unknown>; metadata?: Record<string, unknown>; execute_as?: string }\n >({\n mutationFn: ({ workflowType, data, metadata, execute_as }) =>\n apiFetch(`/workflows/${workflowType}/invoke`, {\n method: 'POST',\n body: JSON.stringify({ data, metadata, ...(execute_as ? { execute_as } : {}) }),\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: ['tasks'], refetchType: 'all' });\n queryClient.invalidateQueries({ queryKey: ['jobs'], refetchType: 'all' });\n },\n });\n}\n"],"names":["useActiveWorkers","useQuery","apiFetch","useDiscoveredWorkflows","useWorkflowConfigs","useCronStatus","useWorkflowExecution","workflowId","useJobs","filters","options","params","useTerminateWorkflow","queryClient","useQueryClient","useMutation","_data","useUpsertWorkflowConfig","workflow_type","body","useDeleteWorkflowConfig","workflowType","useInvokeWorkflow","data","metadata","execute_as"],"mappings":"qGAIO,SAASA,GAAmB,CACjC,OAAOC,EAAyB,CAC9B,SAAU,CAAC,eAAe,EAC1B,QAAS,UACK,MAAMC,EAAsC,oBAAoB,GACjE,OACb,CACD,CACH,CAEO,SAASC,GAAyB,CACvC,OAAOF,EAA+B,CACpC,SAAU,CAAC,qBAAqB,EAChC,QAAS,UACK,MAAMC,EAA8C,uBAAuB,GAC5E,SACb,CACD,CACH,CAEO,SAASE,GAAqB,CACnC,OAAOH,EAA6B,CAClC,SAAU,CAAC,iBAAiB,EAC5B,QAAS,UAC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2 @@
1
- import{u as l,b as a,c as s}from"./vendor-query-B2UbickB.js";import{d as r}from"./index-Dgw1KKpq.js";function f(e={}){const o=new URLSearchParams;return e.status&&o.set("status",e.status),e.graph_topic&&o.set("graph_topic",e.graph_topic),e.app_id&&o.set("app_id",e.app_id),e.search&&o.set("search",e.search),e.set_id&&o.set("set_id",e.set_id),e.limit&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows?${o}`)})}function m(){return l({queryKey:["yamlWorkflowAppIds"],queryFn:()=>r("/yaml-workflows/app-ids")})}function c(e){return l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows/${e}`),enabled:!!e})}function w(){const e=a();return s({mutationFn:o=>r("/yaml-workflows",{method:"POST",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function k(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/deploy`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function p(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/activate`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function d(){const e=a();return s({mutationFn:({id:o,data:t,sync:n,execute_as:u})=>r(`/yaml-workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:t,sync:n,...u?{execute_as:u}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function h(){const e=a();return s({mutationFn:({id:o,task_queue:t,compilation_feedback:n})=>r(`/yaml-workflows/${o}/regenerate`,{method:"POST",body:JSON.stringify({task_queue:t,compilation_feedback:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function q(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/archive`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function W(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/restore`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"}),e.invalidateQueries({queryKey:["yamlWorkflow"],refetchType:"all"})}})}function S(){const e=a();return s({mutationFn:({id:o,...t})=>r(`/yaml-workflows/${o}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function v(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function T(e){return l({queryKey:["yamlWorkflows",e,"versions"],queryFn:()=>r(`/yaml-workflows/${e}/versions`),enabled:!!e})}function F(e,o){return l({queryKey:["yamlWorkflows",e,"versions",o],queryFn:()=>r(`/yaml-workflows/${e}/versions/${o}`),enabled:!!e&&o!==null})}export{m as a,S as b,c,T as d,k as e,p as f,q as g,W as h,v as i,h as j,F as k,d as l,w as m,f as u};
2
- //# sourceMappingURL=yaml-workflows-BjrMQLTK.js.map
1
+ import{u as l,b as a,c as s}from"./vendor-query-B2UbickB.js";import{d as r}from"./index-BoZydcaW.js";function f(e={}){const o=new URLSearchParams;return e.status&&o.set("status",e.status),e.graph_topic&&o.set("graph_topic",e.graph_topic),e.app_id&&o.set("app_id",e.app_id),e.search&&o.set("search",e.search),e.set_id&&o.set("set_id",e.set_id),e.limit&&o.set("limit",String(e.limit)),e.offset!==void 0&&o.set("offset",String(e.offset)),l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows?${o}`)})}function m(){return l({queryKey:["yamlWorkflowAppIds"],queryFn:()=>r("/yaml-workflows/app-ids")})}function c(e){return l({queryKey:["yamlWorkflows",e],queryFn:()=>r(`/yaml-workflows/${e}`),enabled:!!e})}function w(){const e=a();return s({mutationFn:o=>r("/yaml-workflows",{method:"POST",body:JSON.stringify(o)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function k(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/deploy`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function p(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/activate`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function d(){const e=a();return s({mutationFn:({id:o,data:t,sync:n,execute_as:u})=>r(`/yaml-workflows/${o}/invoke`,{method:"POST",body:JSON.stringify({data:t,sync:n,...u?{execute_as:u}:{}})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function h(){const e=a();return s({mutationFn:({id:o,task_queue:t,compilation_feedback:n})=>r(`/yaml-workflows/${o}/regenerate`,{method:"POST",body:JSON.stringify({task_queue:t,compilation_feedback:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function q(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/archive`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function W(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}/restore`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"}),e.invalidateQueries({queryKey:["yamlWorkflow"],refetchType:"all"})}})}function S(){const e=a();return s({mutationFn:({id:o,...t})=>r(`/yaml-workflows/${o}`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function v(){const e=a();return s({mutationFn:o=>r(`/yaml-workflows/${o}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["yamlWorkflows"],refetchType:"all"})}})}function T(e){return l({queryKey:["yamlWorkflows",e,"versions"],queryFn:()=>r(`/yaml-workflows/${e}/versions`),enabled:!!e})}function F(e,o){return l({queryKey:["yamlWorkflows",e,"versions",o],queryFn:()=>r(`/yaml-workflows/${e}/versions/${o}`),enabled:!!e&&o!==null})}export{m as a,S as b,c,T as d,k as e,p as f,q as g,W as h,v as i,h as j,F as k,d as l,w as m,f as u};
2
+ //# sourceMappingURL=yaml-workflows-DhlTkbvY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-workflows-BjrMQLTK.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,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AAkB,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"}
1
+ {"version":3,"file":"yaml-workflows-DhlTkbvY.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,CA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,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,11 +8,11 @@
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-Dgw1KKpq.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-BoZydcaW.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
- <link rel="modulepreload" crossorigin href="./assets/vendor-icons-CEWCGPeJ.js">
15
- <link rel="stylesheet" crossorigin href="./assets/index-Wny0bRgq.css">
14
+ <link rel="modulepreload" crossorigin href="./assets/vendor-icons-BaQqUm-e.js">
15
+ <link rel="stylesheet" crossorigin href="./assets/index-CZ6-l8_0.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
@@ -445,7 +445,7 @@ RBAC: `superadmin` sees all stations; other roles see only stations for their as
445
445
  "pending": 12,
446
446
  "claimed": 3,
447
447
  "resolved": 45,
448
- "in_arrears": 2,
448
+ "priority_count": 2,
449
449
  "throughput_pct": 112.5,
450
450
  "wait": {
451
451
  "p99": 18.3,
@@ -472,7 +472,7 @@ RBAC: `superadmin` sees all stations; other roles see only stations for their as
472
472
  | `pending` | `number` | Escalations currently pending (real-time) |
473
473
  | `claimed` | `number` | Escalations actively claimed (real-time) |
474
474
  | `resolved` | `number` | Escalations resolved within the selected period |
475
- | `in_arrears` | `number` | Pending escalations that have exceeded the role's `sla_minutes` target |
475
+ | `priority_count` | `number` | Pending, unclaimed escalations past the role's age threshold — the Pace Board rebalance signal |
476
476
  | `throughput_pct` | `number \| null` | `resolved / (target_per_hour × period_hours) × 100`. `null` when the role has no `target_per_hour` set |
477
477
  | `wait.p99` | `number \| null` | 99th-percentile wait time in minutes (creation → first claim) within the period. `null` when no resolved items |
478
478
  | `wait.p50` | `number \| null` | Median wait time in minutes |
@@ -486,7 +486,7 @@ RBAC: `superadmin` sees all stations; other roles see only stations for their as
486
486
  **Notes:**
487
487
  - `pending` and `claimed` reflect the live queue state, not the selected period.
488
488
  - `throughput_pct` above 100 means the station resolved more than its target — ahead of schedule. Below 100 means behind.
489
- - `in_arrears` counts items whose age exceeds the role's `sla_minutes`; it is 0 when `sla_minutes` is not configured for the role.
489
+ - `priority_count` measures age from the role's `priority_facet` metadata timestamp (`created_at` when unset) against `priority_threshold_minutes` (`sla_minutes` when unset); it is 0 when neither threshold is configured. Claimed items are excluded. With a facet configured, items missing the key or holding an unparseable value are not counted.
490
490
  - Time values are in decimal minutes.
491
491
 
492
492
  **Example:** Fetch station metrics for the last hour:
@@ -250,6 +250,8 @@ Returns all roles with metadata and usage counts.
250
250
  "sla_minutes": 30,
251
251
  "target_per_hour": 20,
252
252
  "worker_count": 4,
253
+ "priority_threshold_minutes": null,
254
+ "priority_facet": null,
253
255
  "user_count": 5,
254
256
  "chain_count": 2,
255
257
  "workflow_count": 3
@@ -270,6 +272,8 @@ Returns all roles with metadata and usage counts.
270
272
  | `sla_minutes` | `number \| null` | Target resolution time in minutes (capacity setting) |
271
273
  | `target_per_hour` | `number \| null` | Intended throughput — items resolved per hour (capacity setting) |
272
274
  | `worker_count` | `number \| null` | Capacity at this station — staff or machine count (capacity setting) |
275
+ | `priority_threshold_minutes` | `number \| null` | Max age (minutes) before a pending unclaimed item counts toward `priority_count` in station metrics; falls back to `sla_minutes` |
276
+ | `priority_facet` | `string \| null` | Escalation metadata key holding the age origin as an ISO 8601 UTC timestamp (e.g. `authorized_at`); falls back to `created_at` |
273
277
  | `user_count` | `number` | Number of users assigned this role |
274
278
  | `chain_count` | `number` | Number of escalation chain entries referencing this role |
275
279
  | `workflow_count` | `number` | Number of workflow configs that reference this role |
@@ -366,6 +370,8 @@ When the update changes `form_schema` or `metadata_schema`, the new pair is snap
366
370
  | `sla_minutes` | `number \| null` | SLA target in minutes |
367
371
  | `target_per_hour` | `number \| null` | Throughput target (items per hour) |
368
372
  | `worker_count` | `number \| null` | Station capacity |
373
+ | `priority_threshold_minutes` | `number \| null` | Priority age threshold in minutes; falls back to `sla_minutes` |
374
+ | `priority_facet` | `string \| null` | Metadata key for the priority age origin (letters, numbers, underscores); falls back to `created_at` |
369
375
  | `upstream_roles` | `string[] \| null` | Replace the set of roles this station draws input from across other Operations sequences (omitted = preserve; `null` or `[]` = clear). Every entry must name an existing role other than this one. Distinct from `parent_role`, which places the role in its own sequence. |
370
376
  | `change_summary` | `string` | Label recorded on the schema version snapshot when this update changes a schema field |
371
377
 
@@ -745,6 +745,8 @@ Update a role's metadata: display name, description, form schema, metadata schem
745
745
  | `sla_minutes` | `number \| null` | No | Target resolution time in minutes |
746
746
  | `target_per_hour` | `number \| null` | No | Throughput goal (items resolved per hour) |
747
747
  | `worker_count` | `number \| null` | No | Station capacity (staff or machines) |
748
+ | `priority_threshold_minutes` | `number \| null` | No | Priority age threshold in minutes; falls back to `sla_minutes` |
749
+ | `priority_facet` | `string \| null` | No | Metadata key for the priority age origin (ISO 8601 UTC); falls back to `created_at` |
748
750
  | `upstream_roles` | `string[] \| null` | No | Replace the set of roles this station draws input from across other Operations sequences (omitted = preserve; `null` or `[]` = clear) |
749
751
  | `change_summary` | `string` | No | Label recorded on the schema version snapshot when this update changes a schema field |
750
752
 
@@ -911,13 +911,13 @@ interface StationMetric {
911
911
  pending: number; // currently queued (status = pending and not claimed)
912
912
  claimed: number; // active — claimed and assignment not expired
913
913
  resolved: number; // resolved within the lookback period
914
- in_arrears: number; // pending items older than sla_minutes
914
+ priority_count: number; // pending unclaimed items past the role's age threshold
915
915
  throughput_pct: number | null; // resolved / (target_per_hour × hours) × 100
916
916
  wait: StationMetricPeriod; // queue time: created_at → claimed_at
917
917
  work: StationMetricPeriod; // processing time: claimed_at → resolved_at
918
918
  }
919
919
  ```
920
920
 
921
- `pending` reflects the live queue depth regardless of period. `claimed`, `resolved`, and both percentile objects use the lookback window. `in_arrears` is computed from `sla_minutes` on the role — stations without `sla_minutes` always return `0`. `throughput_pct` is `null` when `target_per_hour` is not set.
921
+ `pending` reflects the live queue depth regardless of period. `claimed`, `resolved`, and both percentile objects use the lookback window. `priority_count` covers pending, unclaimed items whose age exceeds the role's threshold age from the `priority_facet` metadata timestamp (`created_at` when unset) against `priority_threshold_minutes` (`sla_minutes` when unset); stations with neither threshold always return `0`. `throughput_pct` is `null` when `target_per_hour` is not set.
922
922
 
923
923
  **Auth:** Same RBAC as `getStats` — callers see only the stations for roles they hold.
@@ -30,6 +30,8 @@ interface RoleDetail {
30
30
  sla_minutes: number | null;
31
31
  target_per_hour: number | null;
32
32
  worker_count: number | null;
33
+ priority_threshold_minutes: number | null;
34
+ priority_facet: string | null;
33
35
  user_count: number;
34
36
  chain_count: number;
35
37
  workflow_count: number;
@@ -46,9 +48,11 @@ interface RoleDetail {
46
48
  | `properties` | Free user-owned bag — arbitrary config stored on the role |
47
49
  | `ops_visible` | When `true`, the role appears as a station on the Operations view |
48
50
  | `parent_role` | Parent role in the process dependency graph; drives the pace chart dependency ordering |
49
- | `sla_minutes` | SLA target in minutes — items older than this appear in `in_arrears` in station metrics |
51
+ | `sla_minutes` | SLA target in minutes — the default age threshold for `priority_count` in station metrics |
50
52
  | `target_per_hour` | Throughput target used to compute `throughput_pct` in station metrics |
51
53
  | `worker_count` | Station capacity — number of workers expected to be active |
54
+ | `priority_threshold_minutes` | Max age before a pending unclaimed item counts toward `priority_count`; falls back to `sla_minutes` |
55
+ | `priority_facet` | Escalation metadata key holding the age origin as an ISO 8601 UTC timestamp (e.g. `authorized_at`); falls back to `created_at` |
52
56
  | `user_count` | Number of users currently assigned to this role |
53
57
  | `chain_count` | Number of escalation chain links originating from this role |
54
58
  | `workflow_count` | Number of registered workflows that target this role |
@@ -269,6 +273,8 @@ const result = await lt.roles.update({
269
273
  | `sla_minutes` | `number \| null` | No | SLA target in minutes |
270
274
  | `target_per_hour` | `number \| null` | No | Throughput target (items per hour) |
271
275
  | `worker_count` | `number \| null` | No | Station capacity |
276
+ | `priority_threshold_minutes` | `number \| null` | No | Priority age threshold in minutes; falls back to `sla_minutes` |
277
+ | `priority_facet` | `string \| null` | No | Metadata key for the priority age origin; falls back to `created_at` |
272
278
  | `upstream_roles` | `string[] \| null` | No | Replace the set of roles this station draws input from across other Operations sequences (omitted = preserve; `null` or `[]` = clear). Distinct from `parent_role`, which places the role in its own sequence |
273
279
  | `change_summary` | `string` | No | Label recorded on the schema version snapshot when this update changes a schema field |
274
280
 
package/docs/dashboard.md CHANGED
@@ -217,7 +217,7 @@ Search filters by key, label, or description. **+ Add Role** creates a role here
217
217
 
218
218
  Accessible at `/admin/roles/:role`. One page per role — a header plus three columns covering identity, routing and people, and schemas.
219
219
 
220
- **Header** — the role key with its prior step, the capacity set, and the **Ops** toggle that shows the role as a station on the [Pace Board](#pace-board). The capacity set holds `sla_minutes`, `target_per_hour`, and `worker_count`; enter any two and the header hints the derived third (`throughput = workers / (sla / 60)`). Save applies header and identity edits via `PATCH /api/roles/:role`.
220
+ **Header** — the role key with its prior step, the capacity set, and the **Ops** toggle that shows the role as a station on the [Pace Board](#pace-board). The capacity set holds `sla_minutes`, `target_per_hour`, and `worker_count`; enter any two and the header hints the derived third (`throughput = workers / (sla / 60)`). Beside it, the priority set holds `priority_threshold_minutes` and `priority_facet` — the age threshold and metadata timestamp key driving the Pace Board priority count (blank = `sla_minutes` and `created_at`). Save applies header and identity edits via `PATCH /api/roles/:role`.
221
221
 
222
222
  **Identity** — display name and description, shown on role rows and station labels.
223
223
 
@@ -314,13 +314,14 @@ Execution is a graph; this page tells its story as **sequences**. Each station r
314
314
 
315
315
  - **Sequence picker** — when more than one sequence exists, tabs appear above the chart, one per sequence, named by its origin role with the station count alongside. The active sequence is deep-linked (`?fragment=<origin role>`) and each switch is a browser-history entry, so a shared URL opens the same sequence and back/forward walks between them.
316
316
  - **Period selector** — `15m`, `1h`, `24h`, `7d`, `30d`. Controls the lookback window for resolved counts, percentile metrics, and throughput.
317
- - **Pace chart** — connects the active sequence's stations in process dependency order and plots absolute counts for the selected window: a straight red target polyline (`target_per_hour × window hours`) against a smooth actual (resolved) curve with a light area fill. The queue splits into two stacked bands — claimed-and-worked (indigo) and waiting-unclaimed (sky). Station circles are colored by pace ratio (green ≥ 100%, amber ≥ 60%, red below); a station with items past SLA carries a dashed red ring.
317
+ - **Pace chart** — connects the active sequence's stations in process dependency order and plots absolute counts for the selected window: a straight red target polyline (`target_per_hour × window hours`) against a smooth actual (resolved) curve with a light area fill. The queue splits into two stacked bands — claimed-and-worked (indigo) and waiting-unclaimed (sky). Station circles are colored by pace ratio (green ≥ 100%, amber ≥ 60%, red below).
318
+ - **Priority badge** — a station with unclaimed items past its age threshold carries a powder-blue circle with the count. Age is measured from the role's priority facet (a metadata timestamp such as the order's authorized date; `created_at` when unset) against its priority threshold (`sla_minutes` when unset). Clicking the badge opens that station's queue ordered oldest-first by the same facet — the counted items sit at the top, ready to pull to the front of the rack.
318
319
  - **Merge affordance** — a station that declares upstream inputs shows a small dashed merge glyph at its floor position. It is deliberately a symbol, never a bend in the line: the upstream is an input, not a descendant. Hover names the feeding roles; click jumps to their sequence.
319
- - **Station table** — one row per station: ROLE (with a merge icon marking cross-sequence inputs), TARGET/H, then PENDING, ACTIVE, RESOLVED in column bands carrying the chart's hues, P99 WAIT, P99 WORK, and a TREND mini-bar. TREND shows the live backlog-to-target ratio while the queue has items; when the queue is idle it shows the period's throughput efficiency, marked with `↩`. Stations with past-SLA items show a sub-row linking to the oldest-first queue view.
320
+ - **Station table** — one row per station: ROLE (with a merge icon marking cross-sequence inputs), TARGET/H, then PENDING, ACTIVE, RESOLVED in column bands carrying the chart's hues, P99 WAIT, P99 WORK, and a TREND mini-bar. TREND shows the live backlog-to-target ratio while the queue has items; when the queue is idle it shows the period's throughput efficiency, marked with `↩`. Stations with priority items show a powder-blue sub-row linking to the queue ordered oldest-first by the priority facet.
320
321
  - **Station detail panel** — opens on row or circle click. Shows the role's identity, an independent period toggle, and the full metric breakdown (wait/work percentiles, SLA target, worker count, links to the queue).
321
322
  - **Live updates** — escalation events refresh the metrics push-driven and debounced; the header's refresh button forces a reload.
322
323
 
323
- A role joins the board via the **Ops** toggle on its [Role Detail](#role-detail) page; the capacity settings (`sla_minutes`, `target_per_hour`, `worker_count`) drive the computed metrics. See [Operations](operations.md) for the full concept doc.
324
+ A role joins the board via the **Ops** toggle on its [Role Detail](#role-detail) page; the capacity settings (`sla_minutes`, `target_per_hour`, `worker_count`) and the priority dials (`priority_threshold_minutes`, `priority_facet`) drive the computed metrics. See [Operations](operations.md) for the full concept doc.
324
325
 
325
326
  **API:** `GET /api/escalations/station-metrics?period=24h`
326
327
 
package/docs/data.md CHANGED
@@ -22,6 +22,8 @@ Canonical role registry. Roles referenced by other tables are seeded here.
22
22
  | `sla_minutes` | `NUMERIC` | — | Target resolution time |
23
23
  | `target_per_hour` | `NUMERIC` | — | Throughput target |
24
24
  | `worker_count` | `NUMERIC` | — | Station capacity |
25
+ | `priority_threshold_minutes` | `NUMERIC` | — | Priority age threshold; falls back to `sla_minutes` |
26
+ | `priority_facet` | `TEXT` | — | Escalation metadata key holding the priority age origin (ISO 8601 UTC); falls back to `created_at` |
25
27
  | `created_at` | `TIMESTAMPTZ NOT NULL` | `NOW()` | Row creation time |
26
28
 
27
29
  **Seeds:** `reviewer`, `engineer`, `admin`, `superadmin`.
@@ -14,12 +14,25 @@ Each station has three settings that define what "healthy" looks like — knowin
14
14
 
15
15
  | Field | Description |
16
16
  |-------|-------------|
17
- | `sla_minutes` | Target resolution time in minutes. Items older than this are counted as `in_arrears`. |
17
+ | `sla_minutes` | Target resolution time in minutes. The default age threshold for the priority count. |
18
18
  | `target_per_hour` | Intended throughput — how many items should resolve per hour. Used to compute `throughput_pct` and the station's expected count on the pace chart. |
19
19
  | `worker_count` | Capacity at this station — number of staff or machines expected to be active. |
20
20
 
21
21
  These are set via `PATCH /api/roles/:role` or the Roles admin page.
22
22
 
23
+ ## Priority count
24
+
25
+ Every station carries one age signal: `priority_count`, the number of **pending, unclaimed** items older than the station's threshold. It is deliberately a count, not a re-sorted queue — the floor rebalances coarsely, pulling the counted items to the front of the rack, rather than continuously re-ordering everything.
26
+
27
+ Two per-role dials shape it, each with a fallback so the count works from `sla_minutes` alone:
28
+
29
+ | Dial | Description |
30
+ |------|-------------|
31
+ | `priority_facet` | `lt_escalations.metadata` key holding each item's age origin as an ISO 8601 UTC timestamp (e.g. `authorized_at`, the date the order was authorized). Blank = age from `created_at`. When set, items missing the key or holding an unparseable value are not counted. |
32
+ | `priority_threshold_minutes` | Max age before an item counts as priority. Blank = the station's `sla_minutes`. |
33
+
34
+ Claimed items are excluded — they are already in someone's hands; the count is what still needs pulling forward. On the pace chart the count renders as a powder-blue circle at the station; clicking it (or the sub-row link in the station table) opens the station's queue ordered oldest-first by the same facet, so the counted items sit at the top.
35
+
23
36
  ## Pace chart
24
37
 
25
38
  The chart is the centrepiece. It plots **absolute counts for the selected window** across the pipeline — every station in dependency order (parent before children, breadth-first) on the X axis.
@@ -63,7 +76,7 @@ Below the chart, a flat table lists every station with its live numbers:
63
76
  | P99 WORK | 99th-percentile processing time (claimed → resolved) in minutes |
64
77
  | TREND | Mini fill bar + percentage — live backlog ratio while items queue, period throughput efficiency when idle |
65
78
 
66
- If a station has `in_arrears > 0`, a sub-row appears: `⚠ N items past SLA view oldest first →`. The link opens the escalation queue sorted by `created_at` ascending, filtered to that role.
79
+ If a station has `priority_count > 0`, a powder-blue sub-row appears: `N prioritypull oldest first →`. The link opens the escalation queue filtered to that role and ordered oldest-first by the station's priority facet (`created_at` when no facet is configured), so the counted items sit at the top.
67
80
 
68
81
  Clicking any row opens the station detail panel.
69
82
 
@@ -79,7 +92,7 @@ Close the panel with × or by clicking another row.
79
92
 
80
93
  ## Data source
81
94
 
82
- All station metrics come from `GET /api/escalations/station-metrics?period=<period>`. The endpoint runs two queries against `public.hmsh_escalations` joined to `lt_roles` (for `sla_minutes` and `target_per_hour`): a live-counts pass over the pending backlog, and a window-bounded percentile pass over resolved rows (`PERCENTILE_CONT` in Postgres, served by the `idx_hmsh_esc_resolved_cover` index). Updates reach the page as push events — every escalation write invalidates the metrics through the Socket.IO event system.
95
+ All station metrics come from `GET /api/escalations/station-metrics?period=<period>`. The endpoint runs two queries against `public.hmsh_escalations` joined to `lt_roles` (for the priority dials and `target_per_hour`): a live-counts pass over the pending backlog, and a window-bounded percentile pass over resolved rows (`PERCENTILE_CONT` in Postgres, served by the `idx_hmsh_esc_resolved_cover` index). Updates reach the page as push events — every escalation write invalidates the metrics through the Socket.IO event system.
83
96
 
84
97
  `pending` is always the live count regardless of period. `resolved`, percentiles, and `throughput_pct` are scoped to the lookback window. See [`lt.escalations.getStationMetrics`](api/sdk/escalations.md#getstationmetrics) for the full response shape.
85
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
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",
@@ -71,7 +71,7 @@
71
71
  "@anthropic-ai/sdk": "^0.92.0",
72
72
  "@aws-sdk/client-s3": "^3.1017.0",
73
73
  "@aws-sdk/s3-request-presigner": "^3.1045.0",
74
- "@hotmeshio/hotmesh": "^0.25.4",
74
+ "@hotmeshio/hotmesh": "^0.25.5",
75
75
  "@modelcontextprotocol/sdk": "^1.27.1",
76
76
  "@opentelemetry/exporter-trace-otlp-proto": "^0.215.0",
77
77
  "@opentelemetry/resources": "^2.5.1",
@@ -1,2 +0,0 @@
1
- import{a as k,j as e}from"./vendor-query-B2UbickB.js";import{b as Ne}from"./roles-CFD2eYap.js";import{K as ue}from"./index-Dgw1KKpq.js";import{i as ke}from"./useEventHooks-DcIgMDh3.js";import{P as $e}from"./PageHeader-BhaWTWcM.js";import{X as we,ae,au as Se,as as Me,av as _e}from"./vendor-icons-CEWCGPeJ.js";import{L as T,f as Le}from"./vendor-react-CXumBFUA.js";const he=800,me=270,O=40,Pe=76,re=24,Re=72,se=he-O-Pe,fe=me-re-Re,v=re+fe,de=O+se,b="0.5s cubic-bezier(0.4, 0, 0.2, 1)";function qe(t){return t.length===0?"":t.map((n,o)=>`${o===0?"M":"L"} ${n.x.toFixed(1)} ${n.y.toFixed(1)}`).join(" ")}function U(t){if(t.length===0)return"";if(t.length===1)return`M ${t[0].x} ${t[0].y}`;const n=[];for(let o=0;o<t.length-1;o++){const c=t[Math.max(0,o-1)],d=t[o],p=t[o+1],a=t[Math.min(t.length-1,o+2)],x=(d.x+(p.x-c.x)/6).toFixed(1),u=(d.y+(p.y-c.y)/6).toFixed(1),l=(p.x-(a.x-d.x)/6).toFixed(1),i=(p.y-(a.y-d.y)/6).toFixed(1);o===0&&n.push(`M ${d.x.toFixed(1)} ${d.y.toFixed(1)}`),n.push(`C ${x} ${u}, ${l} ${i}, ${p.x.toFixed(1)} ${p.y.toFixed(1)}`)}return n.join(" ")}function Ae(t,n){if(t.length<2||n.length<2)return"";const o=U(t),c=[...n].reverse(),d=U(c),p=d.slice(d.indexOf("C"));return`${o} L ${c[0].x.toFixed(1)} ${c[0].y.toFixed(1)} ${p} Z`}function Ce(t){return t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function J(t){return t.length>0?t[t.length-1]:void 0}function Fe(t){return t==null?{stroke:"#cbd5e1",fill:"#f8fafc"}:t>=1?{stroke:"#10b981",fill:"#ecfdf5"}:t>=.6?{stroke:"#f59e0b",fill:"#fffbeb"}:{stroke:"#ef4444",fill:"#fef2f2"}}const q="#6366f1",D="#0ea5e9",I="#4e6a5e",Ee=13;function We(t,n){const o=[...t].sort((a,x)=>a.y-x.y);let c=-1/0;const d=o.map(a=>{const x=Math.max(a.y+3,c+Ee);return c=x,{...a,labelY:x}}),p=d.length>0?d[d.length-1].labelY-n:0;if(p>0)for(const a of d)a.labelY-=p;return d}function Oe({stations:t,selectedRole:n,onSelect:o,onUpstreamSelect:c,periodHours:d}){const[p,a]=k.useState(null),x=t.length;if(x===0)return null;const u=s=>x===1?O+se/2:O+s/(x-1)*se,l=new Map(t.map((s,m)=>[s.role,u(m)])),i=t.map((s,m)=>{var W,Y,L,G;const g=s.target_per_hour??null,R=g!=null?g*d:null;return{idx:m,x:u(m),expected:R,actual:((W=s.metric)==null?void 0:W.resolved)??0,active:((Y=s.metric)==null?void 0:Y.claimed)??0,pending:((L=s.metric)==null?void 0:L.pending)??0,inArrears:((G=s.metric)==null?void 0:G.in_arrears)??0}}),$=i.some(s=>s.expected!=null),f=Math.max(1,...i.map(s=>s.expected??0),...i.map(s=>s.actual),...i.map(s=>s.expected!=null?s.pending:0))*1.15,h=s=>re+fe*(1-Math.max(0,Math.min(s,f))/f),N=i.filter(s=>s.expected!=null),w=N.map(s=>({...s,y:h(s.expected)})),_=N.map(s=>({...s,y:h(s.actual)})),j=N.map(s=>({...s,y:h(s.active)})),P=N.map(s=>({...s,y:h(s.pending)})),S=qe(w),A=U(_),z=U(j),Q=U(P),C=J(_),K=J(w),F=J(j),Z=J(P),B=_.length>=2&&C?`${A} L ${C.x.toFixed(1)} ${v} L ${_[0].x.toFixed(1)} ${v} Z`:"",H=N.some(s=>s.pending>0||s.active>0),V=H&&j.length>=2&&F?`${z} L ${F.x.toFixed(1)} ${v} L ${j[0].x.toFixed(1)} ${v} Z`:"",r=H?Ae(P,j):"",y=N.some(s=>s.active>0),E=N.some(s=>s.pending>s.active),ne=We([K?{key:"target",text:"target",color:"#ef4444",y:K.y}:null,C?{key:"actual",text:"actual",color:I,y:C.y}:null,y&&F?{key:"active",text:"active",color:q,y:F.y}:null,E&&Z?{key:"queued",text:"queued",color:D,y:Z.y}:null].filter(Boolean),v+4);return e.jsxs("svg",{viewBox:`0 0 ${he} ${me}`,className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",style:{display:"block"},children:[t.map(s=>{if(!s.parent_role)return null;const m=l.get(s.parent_role);if(m==null)return null;const g=u(t.findIndex(R=>R.role===s.role));return e.jsx("line",{x1:m,y1:v,x2:g,y2:v,stroke:"#e2e8f0",strokeWidth:.75},`dep-${s.role}`)}),B&&e.jsx("path",{d:B,fill:I,opacity:.05,style:{transition:`d ${b}`}}),V&&e.jsx("path",{d:V,fill:q,opacity:.12,style:{transition:`d ${b}`}}),r&&e.jsx("path",{d:r,fill:D,opacity:.12,style:{transition:`d ${b}`}}),S&&e.jsx("path",{d:S,fill:"none",stroke:"#ef4444",strokeWidth:.5,strokeLinejoin:"round",opacity:.9,style:{transition:`d ${b}`}}),w.map(s=>e.jsx("text",{x:s.x,y:s.y-3.5,textAnchor:"middle",fontSize:6.5,fill:"#ef4444",fontFamily:"ui-monospace, monospace",fontWeight:"500",opacity:.7,style:{transition:`y ${b}`},children:Math.round(s.expected)},`tval-${s.idx}`)),H&&Q&&e.jsx("path",{d:Q,fill:"none",stroke:D,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.55,style:{transition:`d ${b}`}}),z&&e.jsx("path",{d:z,fill:"none",stroke:q,strokeWidth:.75,strokeDasharray:"2 3",strokeLinecap:"round",opacity:.5,style:{transition:`d ${b}`}}),A&&e.jsx("path",{d:A,fill:"none",stroke:I,strokeWidth:1,strokeLinejoin:"round",strokeLinecap:"round",opacity:.75,style:{transition:`d ${b}`}}),j.map((s,m)=>{if(s.pending<=0&&s.active<=0)return null;const g=Math.max(2.5,Math.min(5,2.5+s.active/10)),R=s.pending>s.active,W=Math.min(P[m].y-4,s.y-g-4);return e.jsxs("g",{children:[s.pending>0&&e.jsx("text",{x:s.x,y:W,textAnchor:"middle",fontSize:7.5,fill:R?D:"#64748b",fontFamily:"ui-monospace, monospace",fontWeight:"600",style:{transition:`y ${b}`},children:s.pending}),e.jsxs("g",{transform:`translate(${s.x} ${s.y})`,style:{transition:`transform ${b}`},children:[e.jsx("circle",{r:g,fill:q,opacity:.85}),s.active>0&&e.jsx("text",{y:g+9,textAnchor:"middle",fontSize:7.5,fill:q,fontFamily:"ui-monospace, monospace",fontWeight:"600",children:s.active})]})]},`active-${s.idx}`)}),i.map(s=>{var xe;const m=t[s.idx],g=s.x,R=s.expected!=null?h(s.actual):v,W=s.expected&&s.expected>0?s.actual/s.expected:null,{stroke:Y}=Fe(s.expected!=null?W:null),L=Math.max(3,Math.min(5.5,3+s.actual/120)),G=m.role===n,le=p===s.idx,oe=s.expected==null?"idle · set a target rate to plot pace":`${s.actual} done · target ${Math.round(s.expected)}`+(s.pending>s.active?` · ${s.pending-s.active} waiting`:"")+(s.active>0?` · ${s.active} active`:""),X=oe.length*5.5+20,ie=Math.max(O+X/2+4,Math.min(de-X/2-4,g)),ce=R-L-10;return e.jsxs("g",{onClick:()=>o(m.role),onMouseEnter:()=>a(s.idx),onMouseLeave:()=>a(null),style:{cursor:"pointer"},children:[e.jsxs("g",{transform:`translate(${g} ${R})`,style:{transition:`transform ${b}`},children:[e.jsx("circle",{r:22,fill:"transparent"}),s.inArrears>0&&e.jsx("circle",{r:L+4,fill:"none",stroke:"#ef4444",strokeWidth:1,strokeDasharray:"3 2",opacity:.6}),e.jsx("circle",{r:L,fill:Y,opacity:.9,style:{transition:`r ${b}`}}),s.expected!=null&&e.jsx("text",{y:-L-5,textAnchor:"middle",fontSize:9.5,fill:I,fontFamily:"ui-monospace, monospace",fontWeight:"500",children:Ce(s.actual)}),le&&!G&&e.jsx("circle",{r:L+3,fill:"none",stroke:Y,strokeWidth:1,opacity:.4}),G&&e.jsx("circle",{r:L+4,fill:"none",stroke:"#6366f1",strokeWidth:2})]}),(((xe=m.upstream_roles)==null?void 0:xe.length)??0)>0&&e.jsxs("g",{transform:`translate(${g-20} ${v})`,onClick:ve=>{ve.stopPropagation(),c==null||c(m.upstream_roles[0])},style:{cursor:"pointer"},children:[e.jsx("title",{children:`Fed by ${m.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:g,y:v+14,textAnchor:"middle",fontSize:9.5,fill:"#475569",fontFamily:"ui-sans-serif, sans-serif",fontWeight:"500",children:m.title??m.role}),e.jsx("text",{x:g,y:v+26,textAnchor:"middle",fontSize:8,fill:"#94a3b8",fontFamily:"ui-monospace, monospace",children:m.role}),le&&e.jsxs("g",{children:[e.jsx("rect",{x:ie-X/2,y:ce-16,width:X,height:19,rx:3,fill:"#0f172a",opacity:.88}),e.jsx("text",{x:ie,y:ce-3,textAnchor:"middle",fontSize:8.5,fill:"white",fontFamily:"ui-monospace, monospace",children:oe})]})]},m.role)}),!$&&e.jsx("text",{x:O+se/2,y:v+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"}),ne.map(s=>e.jsx("text",{x:de+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 ${b}`},children:s.text},s.key))]})}const ye=["15m","1h","24h","7d","30d"],De=t=>ye.includes(t);function ee(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 te({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 Ie({period:t,onChange:n}){return e.jsx("div",{className:"flex items-center gap-1 mb-4",children:ye.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 Te({role:t,globalPeriod:n,onClose:o}){const[c,d]=k.useState(De(n)?n:"24h"),{data:p}=ue(c),a=p==null?void 0:p.stations.find(i=>i.role===t.role),x=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(we,{className:"w-4 h-4"})})]}),e.jsxs(T,{to:`/admin/roles/${encodeURIComponent(t.role)}`,className:"flex items-center gap-1 text-[10px] text-accent hover:underline mb-4",children:[e.jsx(ae,{className:"w-2.5 h-2.5"}),"Edit in Roles"]}),e.jsx(Ie,{period:c,onChange:d}),(u||x||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"})]}),x&&e.jsxs("div",{children:[e.jsxs("div",{className:"font-mono font-semibold text-text-primary",children:[x,"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(te,{label:"P99",value:ee((a==null?void 0:a.wait.p99)??null)}),e.jsx(te,{label:"avg",value:ee((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(te,{label:"P99",value:ee((a==null?void 0:a.work.p99)??null)}),e.jsx(te,{label:"avg",value:ee((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:[x&&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:[x,"m"]})]}),a&&a.in_arrears>0&&e.jsxs(T,{to:`/escalations/available?role=${encodeURIComponent(a.role)}&sort_by=created_at&order=asc`,className:"flex items-center justify-between group",children:[e.jsxs("span",{className:"text-[10px] text-red-500",children:[a.in_arrears," past SLA"]}),e.jsx(ae,{className:"w-3 h-3 text-red-400 group-hover:text-red-500 transition-colors"})]})]}),e.jsx("div",{className:"mt-4 border-t border-surface-border/40 pt-3",children:e.jsxs(T,{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(ae,{className:"w-2.5 h-2.5"})]})})]})}function ze({allMetrics:t,orderedRoles:n,period:o}){const c=t.reduce((l,i)=>l+i.pending,0),d=t.reduce((l,i)=>l+i.resolved,0),p=t.reduce((l,i)=>l+i.in_arrears,0),a=new Map(t.map(l=>[l.role,l])),x=t.filter(l=>l.in_arrears>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:x>0?e.jsxs("p",{className:"text-[11px] text-red-400",children:[x," station",x>1?"s":""," past SLA"]}):u>0?e.jsxs("p",{className:"text-[11px] text-amber-400",children:[u," station",u>1?"s":""," with backlog"]}):d>0?e.jsx("p",{className:"text-[11px] text-emerald-500",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 ${c>0?"text-text-primary font-semibold":"text-text-quaternary"}`,children:c})]}),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:d})]}),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:"Past SLA"}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-red-500 font-semibold",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:"actv"}),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 i=a.get(l.role),$=(i==null?void 0:i.pending)??0,M=(i==null?void 0:i.claimed)??0,f=(i==null?void 0:i.resolved)??0,h=(i==null?void 0:i.in_arrears)??0,N=l.title||l.role,w=h>0,_=$>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 ${w?"text-red-400":_?"text-text-primary":"text-text-quaternary"}`,children:[N,w&&e.jsx("span",{className:"ml-1 text-[8px] text-red-400 font-semibold",children:"SLA"})]}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${w?"text-red-400":_?"text-text-primary font-semibold":"text-text-quaternary"}`,children:$>0?$:"—"}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${M>0?"text-accent":"text-text-quaternary"}`,children:M>0?M:"—"}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums w-8 text-right shrink-0 ${f>0?"text-text-secondary":"text-text-quaternary"}`,children:f>0?f:"—"})]},l.role)})}),e.jsx("p",{className:"text-[9px] text-text-quaternary mt-5",children:"Select a station for queue detail."})]})}function Be({role:t,allMetrics:n,orderedRoles:o,globalPeriod:c,onClose:d}){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(Te,{role:t,globalPeriod:c,onClose:d}):e.jsx(ze,{allMetrics:n,orderedRoles:o,period:c})})}const ge=`${D}14`,je=`${q}14`,be=`${I}14`,He=["15m","1h","24h","7d","30d"],Ve={"15m":.25,"1h":1,"24h":24,"7d":168,"30d":720};function Ye(t){const n=t.filter(a=>a.ops_visible),o=new Map(n.map(a=>[a.role,a])),c=new Set,p=n.filter(a=>!a.parent_role||!o.has(a.parent_role)).map(a=>{const x=[],u=[{role:a,depth:0}];for(;u.length>0;){const l=u.shift();c.has(l.role.role)||(c.add(l.role.role),x.push(l),n.filter(i=>i.parent_role===l.role.role&&!c.has(i.role)).forEach(i=>u.push({role:i,depth:l.depth+1})))}return{origin:a,stations:x}});return n.filter(a=>!c.has(a.role)).forEach(a=>p.push({origin:a,stations:[{role:a,depth:0}]})),p.sort((a,x)=>x.stations.length-a.stations.length||a.origin.role.localeCompare(x.origin.role))}function pe(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 Ge(t,n,o,c){if(!n)return{pct:null,color:"bg-surface-border",historical:!1};if(t>0){const x=t/n,u=Math.round(x*100),l=x>1?"bg-amber-400":x<.2?"bg-orange-400":"bg-emerald-400";return{pct:u,color:l,historical:!1}}if(c===0||o==null)return{pct:null,color:"bg-surface-border",historical:!0};const d=o/100,p=Math.round(o),a=d>1?"bg-amber-400":"bg-surface-border";return{pct:p,color:a,historical:!0}}function Ue({role:t,metric:n,selected:o,onClick:c}){var f;const d=(n==null?void 0:n.pending)??0,p=(n==null?void 0:n.claimed)??0,a=(n==null?void 0:n.resolved)??0,x=(n==null?void 0:n.in_arrears)??0,u=t.target_per_hour??null,{pct:l,color:i,historical:$}=Ge(d,u,(n==null?void 0:n.throughput_pct)??null,a),M=l!=null?Math.min(100,l):0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:c,onKeyDown:h=>{h.key==="Enter"&&c()},className:`grid items-center gap-4 cursor-pointer transition-colors ${o?"border-l-2 border-accent":"pl-0.5"}`,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-3.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}),(((f=t.upstream_roles)==null?void 0:f.length)??0)>0&&e.jsx("span",{title:`Fed by ${t.upstream_roles.join(", ")}`,className:"shrink-0 leading-none",children:e.jsx(Me,{className:"w-3 h-3 text-text-quaternary"})})]}),e.jsx("span",{className:`text-xs font-mono tabular-nums text-right py-3.5 ${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:ge},children:e.jsx("span",{className:`text-xs font-mono tabular-nums ${d>0?"text-text-primary font-semibold":"text-text-quaternary"}`,children:d})}),e.jsx("div",{className:"self-stretch flex items-center justify-end px-1.5",style:{backgroundColor:je},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:be},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-3.5 text-text-secondary",children:pe((n==null?void 0:n.wait.p99)??null)}),e.jsx("span",{className:"text-xs font-mono tabular-nums text-right py-3.5 text-text-secondary",children:pe((n==null?void 0:n.work.p99)??null)}),e.jsxs("div",{className:"flex items-center gap-2 py-3.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 ${i}`,style:{width:`${M}%`}})}),e.jsx("span",{className:`text-[10px] font-mono tabular-nums ${l!=null&&l>100?"text-amber-500 font-semibold":"text-text-quaternary"}`,title:$?"Throughput efficiency for the selected period":void 0,children:l!=null?`${l}%${$?"↩":""}`:"—"})]})]}),x>0&&e.jsxs("div",{className:"flex items-center gap-1.5 pb-2 pl-1",children:[e.jsx(_e,{className:"w-3 h-3 text-red-400 shrink-0"}),e.jsxs(T,{to:`/escalations/available?role=${encodeURIComponent(t.role)}&sort_by=created_at&order=asc`,className:"text-[10px] text-red-400 hover:text-red-500 hover:underline",onClick:h=>h.stopPropagation(),children:[x," past SLA — view oldest first →"]})]})]})}function Qe(){const t=[{label:"ROLE"},{label:"TARGET/H"},{label:"PENDING",band:ge,hue:D},{label:"ACTIVE",band:je,hue:q},{label:"RESOLVED",band:be,hue:I},{label:"P99 WAIT"},{label:"P99 WORK"},{label:"TREND"}];return e.jsx("div",{className:"grid items-center gap-4 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 nt(){var V;const[t,n]=k.useState("24h"),[o,c]=k.useState(null),[d,p]=k.useState(!1);ke();const{data:a,isLoading:x,refetch:u}=Ne(),{data:l,isLoading:i,refetch:$}=ue(t),M=(a==null?void 0:a.roles)??[],f=(l==null?void 0:l.stations)??[],h=k.useMemo(()=>Ye(M),[M]),[N,w]=Le(),_=N.get("fragment"),j=h.find(r=>r.origin.role===_)??h[0]??null,P=k.useCallback(r=>{c(null),w(y=>{const E=new URLSearchParams(y);return E.set("fragment",r),E})},[w]),S=(j==null?void 0:j.stations)??[],A=k.useMemo(()=>new Set(S.map(({role:r})=>r.role)),[S]),z=k.useMemo(()=>f.filter(r=>A.has(r.role)),[f,A]),Q=k.useMemo(()=>S.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:f.find(y=>y.role===r.role)})),[S,f]),C=k.useCallback(r=>{const y=h.find(E=>E.stations.some(({role:ne})=>ne.role===r));y&&P(y.origin.role)},[h,P]),K=((V=S.find(({role:r})=>r.role===o))==null?void 0:V.role)??null,F=x||i,Z=async()=>{p(!0),await Promise.all([u(),$()]),p(!1)},B=r=>c(y=>y===r?null:r),H=e.jsx("div",{className:"flex items-center gap-0.5",children:He.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($e,{title:"Pace Board",docsHash:"#docs:dashboard.md:pace-board",center:H,actions:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:Z,disabled:d,className:"text-text-quaternary hover:text-text-secondary transition-colors disabled:opacity-40",children:e.jsx(Se,{className:`w-3.5 h-3.5 ${d?"animate-spin":""}`})}),e.jsx(T,{to:"/admin/roles",className:"btn-secondary text-xs",children:"Configure"})]})}),F?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))})]}):h.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(T,{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:[h.length>1&&e.jsx("div",{className:"flex items-center gap-0.5 px-4 pt-2",children:h.map(r=>{const y=r.origin.role===(j==null?void 0:j.origin.role);return e.jsxs("button",{onClick:()=>P(r.origin.role),className:`px-2.5 py-1 text-[10px] font-mono rounded transition-colors ${y?"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 ${y?"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(Oe,{stations:Q,selectedRole:o,onSelect:B,onUpstreamSelect:C,periodHours:Ve[t]})}),e.jsx("div",{className:"w-px bg-surface-border shrink-0 self-stretch"}),e.jsx(Be,{role:K,allMetrics:z,orderedRoles:S.map(r=>r.role),globalPeriod:t,onClose:()=>c(null)})]}),e.jsxs("div",{className:"h-[30vh] flex-none flex flex-col border-t border-surface-border overflow-hidden",children:[e.jsx(Qe,{}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto divide-y divide-surface-border/30",children:S.map(({role:r})=>e.jsx(Ue,{role:r,metric:f.find(y=>y.role===r.role),selected:o===r.role,onClick:()=>B(r.role)},r.role))})]})]})]})}export{nt as OperationsPage};
2
- //# sourceMappingURL=OperationsPage-BCr21p8I.js.map