@hotmeshio/long-tail 0.1.7 → 0.1.9

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 (278) hide show
  1. package/README.md +3 -1
  2. package/build/api/auth.d.ts +11 -0
  3. package/build/api/auth.js +11 -0
  4. package/build/api/bot-accounts.d.ts +87 -0
  5. package/build/api/bot-accounts.js +87 -0
  6. package/build/api/controlplane.d.ts +48 -0
  7. package/build/api/controlplane.js +48 -0
  8. package/build/api/dba.d.ts +27 -0
  9. package/build/api/dba.js +27 -0
  10. package/build/api/escalations.d.ts +201 -0
  11. package/build/api/escalations.js +276 -5
  12. package/build/api/exports.d.ts +58 -0
  13. package/build/api/exports.js +58 -0
  14. package/build/api/insight.d.ts +57 -0
  15. package/build/api/insight.js +57 -0
  16. package/build/api/maintenance.d.ts +15 -0
  17. package/build/api/maintenance.js +15 -0
  18. package/build/api/mcp-runs.d.ts +27 -0
  19. package/build/api/mcp-runs.js +27 -0
  20. package/build/api/mcp.d.ts +108 -0
  21. package/build/api/mcp.js +108 -0
  22. package/build/api/namespaces.d.ts +13 -0
  23. package/build/api/namespaces.js +13 -0
  24. package/build/api/roles.d.ts +63 -0
  25. package/build/api/roles.js +63 -5
  26. package/build/api/settings.d.ts +8 -0
  27. package/build/api/settings.js +8 -0
  28. package/build/api/tasks.d.ts +68 -1
  29. package/build/api/tasks.js +92 -0
  30. package/build/api/users.d.ts +71 -0
  31. package/build/api/users.js +71 -5
  32. package/build/api/workflow-sets.d.ts +51 -0
  33. package/build/api/workflow-sets.js +51 -0
  34. package/build/api/workflows.d.ts +110 -0
  35. package/build/api/workflows.js +117 -1
  36. package/build/api/yaml-workflows.d.ts +195 -0
  37. package/build/api/yaml-workflows.js +195 -0
  38. package/build/examples/seed.js +18 -0
  39. package/build/examples/types/envelopes.d.ts +35 -0
  40. package/build/examples/types/index.d.ts +1 -1
  41. package/build/examples/workers.js +10 -0
  42. package/build/examples/workflows/assembly-line/activities.d.ts +28 -0
  43. package/build/examples/workflows/assembly-line/activities.js +53 -0
  44. package/build/examples/workflows/assembly-line/index.d.ts +17 -0
  45. package/build/examples/workflows/assembly-line/index.js +60 -0
  46. package/build/examples/workflows/assembly-line/iterator.d.ts +12 -0
  47. package/build/examples/workflows/assembly-line/iterator.js +54 -0
  48. package/build/examples/workflows/assembly-line/reverter.d.ts +18 -0
  49. package/build/examples/workflows/assembly-line/reverter.js +89 -0
  50. package/build/examples/workflows/assembly-line/types.d.ts +25 -0
  51. package/build/examples/workflows/assembly-line/types.js +8 -0
  52. package/build/examples/workflows/assembly-line/worker.d.ts +13 -0
  53. package/build/examples/workflows/assembly-line/worker.js +81 -0
  54. package/build/examples/workflows/basic-signal/activities.d.ts +17 -0
  55. package/build/examples/workflows/basic-signal/activities.js +18 -0
  56. package/build/examples/workflows/basic-signal/index.d.ts +17 -0
  57. package/build/examples/workflows/basic-signal/index.js +116 -0
  58. package/build/index.d.ts +1 -0
  59. package/build/index.js +4 -1
  60. package/build/lib/db/schemas/002_seed.sql +9 -1
  61. package/build/modules/ltconfig.d.ts +8 -1
  62. package/build/modules/ltconfig.js +12 -2
  63. package/build/routes/escalations/list.js +22 -0
  64. package/build/routes/tasks.js +23 -0
  65. package/build/routes/workflows/invocation.js +16 -10
  66. package/build/sdk/index.d.ts +26 -0
  67. package/build/sdk/index.js +2 -0
  68. package/build/services/interceptor/index.js +9 -3
  69. package/build/services/orchestrator/condition.d.ts +34 -0
  70. package/build/services/orchestrator/condition.js +92 -0
  71. package/build/services/workflow-invocation.d.ts +16 -3
  72. package/build/services/workflow-invocation.js +15 -7
  73. package/build/start/index.d.ts +24 -0
  74. package/build/start/index.js +24 -0
  75. package/build/start/workers.d.ts +6 -8
  76. package/build/start/workers.js +25 -2
  77. package/build/system/mcp-servers/admin/workflows.js +5 -0
  78. package/build/tsconfig.tsbuildinfo +1 -1
  79. package/build/types/envelope.d.ts +7 -0
  80. package/build/types/sdk.d.ts +2 -0
  81. package/build/types/startup.d.ts +29 -2
  82. package/dashboard/dist/assets/{AdminDashboard-DRjkRSjJ.js → AdminDashboard-DUrSBQOl.js} +2 -2
  83. package/dashboard/dist/assets/{AdminDashboard-DRjkRSjJ.js.map → AdminDashboard-DUrSBQOl.js.map} +1 -1
  84. package/dashboard/dist/assets/{AvailableEscalationsPage-CnivX4Tz.js → AvailableEscalationsPage-Dbd1qUK_.js} +2 -2
  85. package/dashboard/dist/assets/{AvailableEscalationsPage-CnivX4Tz.js.map → AvailableEscalationsPage-Dbd1qUK_.js.map} +1 -1
  86. package/dashboard/dist/assets/{BotPicker-DwwaBhTH.js → BotPicker-Cg5iNEkm.js} +2 -2
  87. package/dashboard/dist/assets/{BotPicker-DwwaBhTH.js.map → BotPicker-Cg5iNEkm.js.map} +1 -1
  88. package/dashboard/dist/assets/{CollapsibleSection-DQpaVA0M.js → CollapsibleSection-Kd9UIyeU.js} +2 -2
  89. package/dashboard/dist/assets/{CollapsibleSection-DQpaVA0M.js.map → CollapsibleSection-Kd9UIyeU.js.map} +1 -1
  90. package/dashboard/dist/assets/{ConfirmDeleteModal-B7JoDNvt.js → ConfirmDeleteModal-DZMgmlof.js} +2 -2
  91. package/dashboard/dist/assets/{ConfirmDeleteModal-B7JoDNvt.js.map → ConfirmDeleteModal-DZMgmlof.js.map} +1 -1
  92. package/dashboard/dist/assets/{CopyableId-AqoZayBG.js → CopyableId-cPFTRm8q.js} +2 -2
  93. package/dashboard/dist/assets/{CopyableId-AqoZayBG.js.map → CopyableId-cPFTRm8q.js.map} +1 -1
  94. package/dashboard/dist/assets/{CredentialsPage-qGw1kQzi.js → CredentialsPage-DJablIbs.js} +2 -2
  95. package/dashboard/dist/assets/{CredentialsPage-qGw1kQzi.js.map → CredentialsPage-DJablIbs.js.map} +1 -1
  96. package/dashboard/dist/assets/{CustomDurationPicker-D1HUQcd0.js → CustomDurationPicker-NgIP6YDW.js} +2 -2
  97. package/dashboard/dist/assets/{CustomDurationPicker-D1HUQcd0.js.map → CustomDurationPicker-NgIP6YDW.js.map} +1 -1
  98. package/dashboard/dist/assets/{DataTable-DKvSKoVG.js → DataTable-CTRhTAfT.js} +2 -2
  99. package/dashboard/dist/assets/{DataTable-DKvSKoVG.js.map → DataTable-CTRhTAfT.js.map} +1 -1
  100. package/dashboard/dist/assets/{ElapsedCell-B0yrReGQ.js → ElapsedCell-HcSJ_MMs.js} +2 -2
  101. package/dashboard/dist/assets/{ElapsedCell-B0yrReGQ.js.map → ElapsedCell-HcSJ_MMs.js.map} +1 -1
  102. package/dashboard/dist/assets/{EmptyState-X0fIzYID.js → EmptyState-joNbd4gg.js} +2 -2
  103. package/dashboard/dist/assets/{EmptyState-X0fIzYID.js.map → EmptyState-joNbd4gg.js.map} +1 -1
  104. package/dashboard/dist/assets/{EscalationsOverview-BQAT9W7r.js → EscalationsOverview-DpXDnQux.js} +2 -2
  105. package/dashboard/dist/assets/{EscalationsOverview-BQAT9W7r.js.map → EscalationsOverview-DpXDnQux.js.map} +1 -1
  106. package/dashboard/dist/assets/{EventTable-CX1KNLhZ.js → EventTable-CYem3v8n.js} +2 -2
  107. package/dashboard/dist/assets/{EventTable-CX1KNLhZ.js.map → EventTable-CYem3v8n.js.map} +1 -1
  108. package/dashboard/dist/assets/{FilterBar-DMTvuQy-.js → FilterBar-BiO8SOzc.js} +2 -2
  109. package/dashboard/dist/assets/{FilterBar-DMTvuQy-.js.map → FilterBar-BiO8SOzc.js.map} +1 -1
  110. package/dashboard/dist/assets/{ListToolbar-DTOSxoEy.js → ListToolbar-6yRDh2e9.js} +2 -2
  111. package/dashboard/dist/assets/{ListToolbar-DTOSxoEy.js.map → ListToolbar-6yRDh2e9.js.map} +1 -1
  112. package/dashboard/dist/assets/{McpOverview-BaKTIWrG.js → McpOverview-CUgSxkQe.js} +2 -2
  113. package/dashboard/dist/assets/{McpOverview-BaKTIWrG.js.map → McpOverview-CUgSxkQe.js.map} +1 -1
  114. package/dashboard/dist/assets/{McpQueryDetailPage-CC08T5k8.js → McpQueryDetailPage-BWbinTM_.js} +2 -2
  115. package/dashboard/dist/assets/{McpQueryDetailPage-CC08T5k8.js.map → McpQueryDetailPage-BWbinTM_.js.map} +1 -1
  116. package/dashboard/dist/assets/{McpQueryPage-CVfF9dYg.js → McpQueryPage-lV6kfDG5.js} +2 -2
  117. package/dashboard/dist/assets/{McpQueryPage-CVfF9dYg.js.map → McpQueryPage-lV6kfDG5.js.map} +1 -1
  118. package/dashboard/dist/assets/{McpRunDetailPage-CKs1RWeV.js → McpRunDetailPage-D6gaxH3_.js} +2 -2
  119. package/dashboard/dist/assets/{McpRunDetailPage-CKs1RWeV.js.map → McpRunDetailPage-D6gaxH3_.js.map} +1 -1
  120. package/dashboard/dist/assets/{McpRunsPage-CcPD_tY1.js → McpRunsPage-DKvTklh9.js} +2 -2
  121. package/dashboard/dist/assets/{McpRunsPage-CcPD_tY1.js.map → McpRunsPage-DKvTklh9.js.map} +1 -1
  122. package/dashboard/dist/assets/{Modal-_2AbWxJT.js → Modal-BuTvD0pz.js} +2 -2
  123. package/dashboard/dist/assets/{Modal-_2AbWxJT.js.map → Modal-BuTvD0pz.js.map} +1 -1
  124. package/dashboard/dist/assets/{OperatorDashboard-BGiRaRDr.js → OperatorDashboard-C9SSV96T.js} +2 -2
  125. package/dashboard/dist/assets/{OperatorDashboard-BGiRaRDr.js.map → OperatorDashboard-C9SSV96T.js.map} +1 -1
  126. package/dashboard/dist/assets/{PageHeader-DVr5Qyzm.js → PageHeader-BcTVF9ul.js} +2 -2
  127. package/dashboard/dist/assets/{PageHeader-DVr5Qyzm.js.map → PageHeader-BcTVF9ul.js.map} +1 -1
  128. package/dashboard/dist/assets/{PageHeaderWithStats-D0KRASML.js → PageHeaderWithStats-BI7JG5x6.js} +2 -2
  129. package/dashboard/dist/assets/{PageHeaderWithStats-D0KRASML.js.map → PageHeaderWithStats-BI7JG5x6.js.map} +1 -1
  130. package/dashboard/dist/assets/{PriorityBadge-Bx2559OU.js → PriorityBadge-DqVaOU65.js} +2 -2
  131. package/dashboard/dist/assets/{PriorityBadge-Bx2559OU.js.map → PriorityBadge-DqVaOU65.js.map} +1 -1
  132. package/dashboard/dist/assets/{ProcessDetailPage-69I--sry.js → ProcessDetailPage-hFMhf9qa.js} +2 -2
  133. package/dashboard/dist/assets/{ProcessDetailPage-69I--sry.js.map → ProcessDetailPage-hFMhf9qa.js.map} +1 -1
  134. package/dashboard/dist/assets/{ProcessesListPage-BDpUbua2.js → ProcessesListPage-ByVoBCQ3.js} +2 -2
  135. package/dashboard/dist/assets/{ProcessesListPage-BDpUbua2.js.map → ProcessesListPage-ByVoBCQ3.js.map} +1 -1
  136. package/dashboard/dist/assets/{RolePill-CcAqEaSt.js → RolePill-D9ZIkYiu.js} +2 -2
  137. package/dashboard/dist/assets/{RolePill-CcAqEaSt.js.map → RolePill-D9ZIkYiu.js.map} +1 -1
  138. package/dashboard/dist/assets/{RolesPage-Cl23Hjet.js → RolesPage-SMedMuqa.js} +2 -2
  139. package/dashboard/dist/assets/{RolesPage-Cl23Hjet.js.map → RolesPage-SMedMuqa.js.map} +1 -1
  140. package/dashboard/dist/assets/{RowActions-B4mqIt3Z.js → RowActions-yDhwwDbU.js} +2 -2
  141. package/dashboard/dist/assets/{RowActions-B4mqIt3Z.js.map → RowActions-yDhwwDbU.js.map} +1 -1
  142. package/dashboard/dist/assets/{StatCard-Cz_2OjAZ.js → StatCard-BrBnQFxh.js} +2 -2
  143. package/dashboard/dist/assets/{StatCard-Cz_2OjAZ.js.map → StatCard-BrBnQFxh.js.map} +1 -1
  144. package/dashboard/dist/assets/{StatusBadge-Wi2FJZsn.js → StatusBadge-xgb-lZku.js} +2 -2
  145. package/dashboard/dist/assets/{StatusBadge-Wi2FJZsn.js.map → StatusBadge-xgb-lZku.js.map} +1 -1
  146. package/dashboard/dist/assets/{StepIndicator-PW5NRDMb.js → StepIndicator-B9ps2SvM.js} +2 -2
  147. package/dashboard/dist/assets/{StepIndicator-PW5NRDMb.js.map → StepIndicator-B9ps2SvM.js.map} +1 -1
  148. package/dashboard/dist/assets/{StickyPagination-Bl2Uzz65.js → StickyPagination-DTIjBKN3.js} +2 -2
  149. package/dashboard/dist/assets/{StickyPagination-Bl2Uzz65.js.map → StickyPagination-DTIjBKN3.js.map} +1 -1
  150. package/dashboard/dist/assets/{SwimlaneTimeline-CUPqMd0z.js → SwimlaneTimeline-RK4Yu66z.js} +2 -2
  151. package/dashboard/dist/assets/{SwimlaneTimeline-CUPqMd0z.js.map → SwimlaneTimeline-RK4Yu66z.js.map} +1 -1
  152. package/dashboard/dist/assets/{TagInput-BLtf86Ly.js → TagInput-CdNUuqk4.js} +2 -2
  153. package/dashboard/dist/assets/{TagInput-BLtf86Ly.js.map → TagInput-CdNUuqk4.js.map} +1 -1
  154. package/dashboard/dist/assets/{TaskDetailPage-BXJFX74D.js → TaskDetailPage-C-nzaNea.js} +2 -2
  155. package/dashboard/dist/assets/{TaskDetailPage-BXJFX74D.js.map → TaskDetailPage-C-nzaNea.js.map} +1 -1
  156. package/dashboard/dist/assets/{TaskQueuePill-CWYj3xKe.js → TaskQueuePill-Lvr2-NzS.js} +2 -2
  157. package/dashboard/dist/assets/{TaskQueuePill-CWYj3xKe.js.map → TaskQueuePill-Lvr2-NzS.js.map} +1 -1
  158. package/dashboard/dist/assets/{TasksListPage-C3cX94Mw.js → TasksListPage-DSUmD84y.js} +2 -2
  159. package/dashboard/dist/assets/{TasksListPage-C3cX94Mw.js.map → TasksListPage-DSUmD84y.js.map} +1 -1
  160. package/dashboard/dist/assets/{TimeAgo-B_5yDDHV.js → TimeAgo-BZdLdrIh.js} +2 -2
  161. package/dashboard/dist/assets/{TimeAgo-B_5yDDHV.js.map → TimeAgo-BZdLdrIh.js.map} +1 -1
  162. package/dashboard/dist/assets/{TimestampCell-DRX724uU.js → TimestampCell-QX_0i5FK.js} +2 -2
  163. package/dashboard/dist/assets/{TimestampCell-DRX724uU.js.map → TimestampCell-QX_0i5FK.js.map} +1 -1
  164. package/dashboard/dist/assets/{UserName-Ca8FA469.js → UserName-DyZMXcBm.js} +2 -2
  165. package/dashboard/dist/assets/{UserName-Ca8FA469.js.map → UserName-DyZMXcBm.js.map} +1 -1
  166. package/dashboard/dist/assets/{WorkflowExecutionPage-BBYWEV2P.js → WorkflowExecutionPage-DjVxfZaF.js} +2 -2
  167. package/dashboard/dist/assets/{WorkflowExecutionPage-BBYWEV2P.js.map → WorkflowExecutionPage-DjVxfZaF.js.map} +1 -1
  168. package/dashboard/dist/assets/WorkflowPill-CZqGslD6.js +2 -0
  169. package/dashboard/dist/assets/WorkflowPill-CZqGslD6.js.map +1 -0
  170. package/dashboard/dist/assets/WorkflowsDashboard-DZjuiFZ0.js +2 -0
  171. package/dashboard/dist/assets/WorkflowsDashboard-DZjuiFZ0.js.map +1 -0
  172. package/dashboard/dist/assets/{WorkflowsOverview-03IRrDLg.js → WorkflowsOverview-CLnLRpOu.js} +2 -2
  173. package/dashboard/dist/assets/{WorkflowsOverview-03IRrDLg.js.map → WorkflowsOverview-CLnLRpOu.js.map} +1 -1
  174. package/dashboard/dist/assets/{YamlWorkflowsPage-DC2cLxVi.js → YamlWorkflowsPage-VjdhnLmO.js} +2 -2
  175. package/dashboard/dist/assets/{YamlWorkflowsPage-DC2cLxVi.js.map → YamlWorkflowsPage-VjdhnLmO.js.map} +1 -1
  176. package/dashboard/dist/assets/{bots-DZEXcgiJ.js → bots-DIM6lBoY.js} +2 -2
  177. package/dashboard/dist/assets/{bots-DZEXcgiJ.js.map → bots-DIM6lBoY.js.map} +1 -1
  178. package/dashboard/dist/assets/{escalation-Cw48lNaF.js → escalation-JOTuOqjq.js} +2 -2
  179. package/dashboard/dist/assets/{escalation-Cw48lNaF.js.map → escalation-JOTuOqjq.js.map} +1 -1
  180. package/dashboard/dist/assets/{escalation-columns-NINpo3qf.js → escalation-columns-Cyg58nkg.js} +2 -2
  181. package/dashboard/dist/assets/{escalation-columns-NINpo3qf.js.map → escalation-columns-Cyg58nkg.js.map} +1 -1
  182. package/dashboard/dist/assets/{helpers-fk_qr729.js → helpers-B1BDxBZd.js} +2 -2
  183. package/dashboard/dist/assets/{helpers-fk_qr729.js.map → helpers-B1BDxBZd.js.map} +1 -1
  184. package/dashboard/dist/assets/{helpers-Cuu3xKfr.js → helpers-BCix9c_m.js} +2 -2
  185. package/dashboard/dist/assets/{helpers-Cuu3xKfr.js.map → helpers-BCix9c_m.js.map} +1 -1
  186. package/dashboard/dist/assets/{index-Dj-z-x8M.js → index-BUK3qR-1.js} +2 -2
  187. package/dashboard/dist/assets/{index-Dj-z-x8M.js.map → index-BUK3qR-1.js.map} +1 -1
  188. package/dashboard/dist/assets/{index-BwN3KP_L.js → index-BYZX9tOb.js} +8 -8
  189. package/dashboard/dist/assets/index-BYZX9tOb.js.map +1 -0
  190. package/dashboard/dist/assets/{index-BIG3KooI.js → index-BcR6PfpY.js} +2 -2
  191. package/dashboard/dist/assets/{index-BIG3KooI.js.map → index-BcR6PfpY.js.map} +1 -1
  192. package/dashboard/dist/assets/index-BizfauqT.js +6 -0
  193. package/dashboard/dist/assets/index-BizfauqT.js.map +1 -0
  194. package/dashboard/dist/assets/{index-aRvL-dXp.js → index-Cf60K3x9.js} +2 -2
  195. package/dashboard/dist/assets/{index-aRvL-dXp.js.map → index-Cf60K3x9.js.map} +1 -1
  196. package/dashboard/dist/assets/{index-b03HlbnH.js → index-Cg5nfiYX.js} +2 -2
  197. package/dashboard/dist/assets/{index-b03HlbnH.js.map → index-Cg5nfiYX.js.map} +1 -1
  198. package/dashboard/dist/assets/index-D1wVX50Z.js +15 -0
  199. package/dashboard/dist/assets/index-D1wVX50Z.js.map +1 -0
  200. package/dashboard/dist/assets/{index-DwRytW9O.js → index-DDYFpi4l.js} +4 -4
  201. package/dashboard/dist/assets/index-DDYFpi4l.js.map +1 -0
  202. package/dashboard/dist/assets/{index-B98ipWxE.js → index-Di12t56M.js} +2 -2
  203. package/dashboard/dist/assets/{index-B98ipWxE.js.map → index-Di12t56M.js.map} +1 -1
  204. package/dashboard/dist/assets/{index-CORHB0WC.js → index-Ds0JoXS2.js} +2 -2
  205. package/dashboard/dist/assets/{index-CORHB0WC.js.map → index-Ds0JoXS2.js.map} +1 -1
  206. package/dashboard/dist/assets/{mcp-BZoFryNc.js → mcp-B_xbczAt.js} +2 -2
  207. package/dashboard/dist/assets/{mcp-BZoFryNc.js.map → mcp-B_xbczAt.js.map} +1 -1
  208. package/dashboard/dist/assets/{mcp-query-wiw1kwm8.js → mcp-query-B8-P_QoG.js} +2 -2
  209. package/dashboard/dist/assets/{mcp-query-wiw1kwm8.js.map → mcp-query-B8-P_QoG.js.map} +1 -1
  210. package/dashboard/dist/assets/{mcp-runs-BaEKnf5v.js → mcp-runs-CWeZinoF.js} +2 -2
  211. package/dashboard/dist/assets/{mcp-runs-BaEKnf5v.js.map → mcp-runs-CWeZinoF.js.map} +1 -1
  212. package/dashboard/dist/assets/{namespaces-BwnZI4_A.js → namespaces-C3WtdO_9.js} +2 -2
  213. package/dashboard/dist/assets/{namespaces-BwnZI4_A.js.map → namespaces-C3WtdO_9.js.map} +1 -1
  214. package/dashboard/dist/assets/{roles-Bgn1K8zU.js → roles-BDAsPpZG.js} +2 -2
  215. package/dashboard/dist/assets/{roles-Bgn1K8zU.js.map → roles-BDAsPpZG.js.map} +1 -1
  216. package/dashboard/dist/assets/{settings-CizYiutL.js → settings-Ife_UwAp.js} +2 -2
  217. package/dashboard/dist/assets/{settings-CizYiutL.js.map → settings-Ife_UwAp.js.map} +1 -1
  218. package/dashboard/dist/assets/{tasks-Bmte_hc4.js → tasks-BquNDHDI.js} +2 -2
  219. package/dashboard/dist/assets/{tasks-Bmte_hc4.js.map → tasks-BquNDHDI.js.map} +1 -1
  220. package/dashboard/dist/assets/{useEventHooks-CUCxpiI2.js → useEventHooks-anv_B2Yy.js} +2 -2
  221. package/dashboard/dist/assets/{useEventHooks-CUCxpiI2.js.map → useEventHooks-anv_B2Yy.js.map} +1 -1
  222. package/dashboard/dist/assets/{useYamlActivityEvents-Cum02Ej9.js → useYamlActivityEvents-DN-PTgVx.js} +2 -2
  223. package/dashboard/dist/assets/{useYamlActivityEvents-Cum02Ej9.js.map → useYamlActivityEvents-DN-PTgVx.js.map} +1 -1
  224. package/dashboard/dist/assets/{users-NSDgTt-z.js → users-CFcxB4v6.js} +2 -2
  225. package/dashboard/dist/assets/{users-NSDgTt-z.js.map → users-CFcxB4v6.js.map} +1 -1
  226. package/dashboard/dist/assets/{vendor-icons-D1DdudfH.js → vendor-icons-T4r2DSPD.js} +2 -2
  227. package/dashboard/dist/assets/{vendor-icons-D1DdudfH.js.map → vendor-icons-T4r2DSPD.js.map} +1 -1
  228. package/dashboard/dist/assets/{workflows-k0XRdGXx.js → workflows-CeRci9z3.js} +2 -2
  229. package/dashboard/dist/assets/{workflows-k0XRdGXx.js.map → workflows-CeRci9z3.js.map} +1 -1
  230. package/dashboard/dist/assets/{yaml-workflows-DAre8I78.js → yaml-workflows-DLwd2BOX.js} +2 -2
  231. package/dashboard/dist/assets/{yaml-workflows-DAre8I78.js.map → yaml-workflows-DLwd2BOX.js.map} +1 -1
  232. package/dashboard/dist/index.html +2 -2
  233. package/docs/api/{escalations.md → http/escalations.md} +99 -0
  234. package/docs/api/{tasks.md → http/tasks.md} +47 -0
  235. package/docs/api/sdk/auth.md +27 -0
  236. package/docs/api/sdk/bot-accounts.md +243 -0
  237. package/docs/api/sdk/controlplane.md +103 -0
  238. package/docs/api/sdk/dba.md +52 -0
  239. package/docs/api/sdk/escalations.md +511 -0
  240. package/docs/api/sdk/events.md +68 -0
  241. package/docs/api/sdk/exports.md +124 -0
  242. package/docs/api/sdk/insight.md +112 -0
  243. package/docs/api/sdk/maintenance.md +54 -0
  244. package/docs/api/sdk/mcp-runs.md +71 -0
  245. package/docs/api/sdk/mcp.md +250 -0
  246. package/docs/api/sdk/namespaces.md +43 -0
  247. package/docs/api/sdk/roles.md +183 -0
  248. package/docs/api/sdk/settings.md +24 -0
  249. package/docs/api/sdk/tasks.md +159 -0
  250. package/docs/api/sdk/users.md +196 -0
  251. package/docs/api/sdk/workflow-sets.md +135 -0
  252. package/docs/api/sdk/workflows.md +271 -0
  253. package/docs/api/sdk/yaml-workflows.md +408 -0
  254. package/package.json +1 -1
  255. package/dashboard/dist/assets/WorkflowPill-BXifAuLi.js +0 -2
  256. package/dashboard/dist/assets/WorkflowPill-BXifAuLi.js.map +0 -1
  257. package/dashboard/dist/assets/WorkflowsDashboard-Drl3juz9.js +0 -2
  258. package/dashboard/dist/assets/WorkflowsDashboard-Drl3juz9.js.map +0 -1
  259. package/dashboard/dist/assets/index-BwN3KP_L.js.map +0 -1
  260. package/dashboard/dist/assets/index-Bxe8h1x4.js +0 -17
  261. package/dashboard/dist/assets/index-Bxe8h1x4.js.map +0 -1
  262. package/dashboard/dist/assets/index-CNI7k7oB.js +0 -6
  263. package/dashboard/dist/assets/index-CNI7k7oB.js.map +0 -1
  264. package/dashboard/dist/assets/index-DwRytW9O.js.map +0 -1
  265. package/docs/epic-integration.md +0 -224
  266. package/docs/workflow-builder.md +0 -371
  267. /package/docs/api/{dba.md → http/dba.md} +0 -0
  268. /package/docs/api/{exports.md → http/exports.md} +0 -0
  269. /package/docs/api/{maintenance.md → http/maintenance.md} +0 -0
  270. /package/docs/api/{mcp-runs.md → http/mcp-runs.md} +0 -0
  271. /package/docs/api/{mcp-servers.md → http/mcp-servers.md} +0 -0
  272. /package/docs/api/{namespaces.md → http/namespaces.md} +0 -0
  273. /package/docs/api/{roles.md → http/roles.md} +0 -0
  274. /package/docs/api/{service-accounts.md → http/service-accounts.md} +0 -0
  275. /package/docs/api/{settings.md → http/settings.md} +0 -0
  276. /package/docs/api/{users.md → http/users.md} +0 -0
  277. /package/docs/api/{workflows.md → http/workflows.md} +0 -0
  278. /package/docs/api/{yaml-workflows.md → http/yaml-workflows.md} +0 -0
@@ -1,4 +1,51 @@
1
1
  import type { LTApiResult, LTApiAuth } from '../types/sdk';
2
+ /**
3
+ * Create a standalone escalation (not tied to a workflow).
4
+ *
5
+ * Useful for manual work items, support tickets, or approval requests
6
+ * that originate outside the durable workflow engine. The caller must
7
+ * hold the target role or be a superadmin.
8
+ *
9
+ * @param input.type — escalation category (e.g. `"support"`, `"approval"`)
10
+ * @param input.subtype — subcategory for finer routing
11
+ * @param input.role — role responsible for resolving this escalation
12
+ * @param input.description — human-readable summary
13
+ * @param input.priority — 1 (critical) through 4 (low), default 2
14
+ * @param input.envelope — serialized context for the resolver
15
+ * @param input.metadata — arbitrary key-value data (e.g. signal_routing)
16
+ * @param input.escalation_payload — serialized payload for the resolver UI
17
+ * @param auth — authenticated user context (must hold target role or be superadmin)
18
+ * @returns `{ status: 201, data: <escalation record> }`
19
+ */
20
+ export declare function createEscalation(input: {
21
+ type: string;
22
+ subtype?: string;
23
+ role: string;
24
+ description?: string;
25
+ priority?: number;
26
+ envelope?: string;
27
+ metadata?: Record<string, any>;
28
+ escalation_payload?: string;
29
+ }, auth: LTApiAuth): Promise<LTApiResult>;
30
+ /**
31
+ * List escalations with optional filters.
32
+ *
33
+ * Results are scoped to the authenticated user's roles unless the user
34
+ * is a superadmin (who sees all roles).
35
+ *
36
+ * @param input.status — filter by `pending`, `resolved`, or `cancelled`
37
+ * @param input.role — filter by assigned role
38
+ * @param input.type — filter by workflow type
39
+ * @param input.subtype — filter by subtype
40
+ * @param input.assigned_to — filter by assigned user ID
41
+ * @param input.priority — filter by priority (1–4)
42
+ * @param input.limit — max results (default: 50)
43
+ * @param input.offset — pagination offset
44
+ * @param input.sort_by — column to sort by (e.g. `created_at`, `priority`)
45
+ * @param input.order — `asc` or `desc`
46
+ * @param auth — authenticated user context (required for role scoping)
47
+ * @returns `{ status: 200, data: { escalations, total } }`
48
+ */
2
49
  export declare function listEscalations(input: {
3
50
  status?: string;
4
51
  role?: string;
@@ -11,6 +58,23 @@ export declare function listEscalations(input: {
11
58
  sort_by?: string;
12
59
  order?: string;
13
60
  }, auth: LTApiAuth): Promise<LTApiResult>;
61
+ /**
62
+ * List escalations available for claim (pending and not actively claimed).
63
+ *
64
+ * Similar to `listEscalations` but excludes escalations with active claims.
65
+ * Scoped to the authenticated user's roles.
66
+ *
67
+ * @param input.role — filter by role
68
+ * @param input.type — filter by workflow type
69
+ * @param input.subtype — filter by subtype
70
+ * @param input.priority — filter by priority (1–4)
71
+ * @param input.limit — max results (default: 50)
72
+ * @param input.offset — pagination offset
73
+ * @param input.sort_by — column to sort by
74
+ * @param input.order — `asc` or `desc`
75
+ * @param auth — authenticated user context
76
+ * @returns `{ status: 200, data: { escalations, total } }`
77
+ */
14
78
  export declare function listAvailableEscalations(input: {
15
79
  role?: string;
16
80
  type?: string;
@@ -21,49 +85,186 @@ export declare function listAvailableEscalations(input: {
21
85
  sort_by?: string;
22
86
  order?: string;
23
87
  }, auth: LTApiAuth): Promise<LTApiResult>;
88
+ /**
89
+ * List all distinct escalation type values.
90
+ *
91
+ * @returns `{ status: 200, data: { types: string[] } }`
92
+ */
24
93
  export declare function listDistinctTypes(): Promise<LTApiResult>;
94
+ /**
95
+ * Get aggregate escalation statistics scoped to the user's roles.
96
+ *
97
+ * @param input.period — time window (`1h`, `24h`, `7d`, `30d`)
98
+ * @param auth — authenticated user context
99
+ * @returns `{ status: 200, data: { pending, claimed, created, resolved, by_role, by_type } }`
100
+ */
25
101
  export declare function getEscalationStats(input: {
26
102
  period?: string;
27
103
  }, auth: LTApiAuth): Promise<LTApiResult>;
104
+ /**
105
+ * Get a single escalation by ID.
106
+ *
107
+ * Non-superadmin users must hold the escalation's assigned role.
108
+ *
109
+ * @param input.id — escalation UUID
110
+ * @param auth — authenticated user context
111
+ * @returns `{ status: 200, data: <escalation record> }` or 403/404
112
+ */
28
113
  export declare function getEscalation(input: {
29
114
  id: string;
30
115
  }, auth: LTApiAuth): Promise<LTApiResult>;
116
+ /**
117
+ * List all escalations for a given workflow ID.
118
+ *
119
+ * @param input.workflowId — HotMesh workflow ID
120
+ * @returns `{ status: 200, data: { escalations } }`
121
+ */
31
122
  export declare function getEscalationsByWorkflowId(input: {
32
123
  workflowId: string;
33
124
  }): Promise<LTApiResult>;
125
+ /**
126
+ * Route a pending escalation to a different role.
127
+ *
128
+ * The user must be authorized to escalate from the current role to the
129
+ * target role (checked via escalation chain configuration).
130
+ *
131
+ * @param input.id — escalation UUID
132
+ * @param input.targetRole — destination role
133
+ * @param auth — authenticated user context
134
+ * @returns `{ status: 200, data: <updated escalation> }` or 403/404/409
135
+ */
34
136
  export declare function escalateToRole(input: {
35
137
  id: string;
36
138
  targetRole: string;
37
139
  }, auth: LTApiAuth): Promise<LTApiResult>;
140
+ /**
141
+ * Claim a pending escalation for the authenticated user.
142
+ *
143
+ * Sets `assigned_to` and `assigned_until` on the escalation (soft lock).
144
+ * Non-superadmin users must hold the escalation's role. Publishes a
145
+ * `escalation.claimed` event.
146
+ *
147
+ * @param input.id — escalation UUID
148
+ * @param input.durationMinutes — claim duration (default: 30)
149
+ * @param auth — authenticated user context
150
+ * @returns `{ status: 200, data: { escalation, isExtension } }` or 403/404/409
151
+ */
38
152
  export declare function claimEscalation(input: {
39
153
  id: string;
40
154
  durationMinutes?: number;
41
155
  }, auth: LTApiAuth): Promise<LTApiResult>;
156
+ /**
157
+ * Release a claimed escalation back to the pool.
158
+ *
159
+ * Only the user who holds the claim can release it. Publishes a
160
+ * `escalation.released` event.
161
+ *
162
+ * @param input.id — escalation UUID
163
+ * @param auth — authenticated user context
164
+ * @returns `{ status: 200, data: { escalation } }` or 409
165
+ */
42
166
  export declare function releaseEscalation(input: {
43
167
  id: string;
44
168
  }, auth: LTApiAuth): Promise<LTApiResult>;
169
+ /**
170
+ * Release all escalation claims past their `assigned_until` deadline.
171
+ *
172
+ * Typically called on a maintenance schedule. Returns the count of
173
+ * released claims.
174
+ *
175
+ * @returns `{ status: 200, data: { released: number } }`
176
+ */
45
177
  export declare function releaseExpiredClaims(): Promise<LTApiResult>;
178
+ /**
179
+ * Update priority for one or more escalations.
180
+ *
181
+ * @param input.ids — array of escalation UUIDs
182
+ * @param input.priority — new priority (1=critical, 2=high, 3=medium, 4=low)
183
+ * @param auth — authenticated user context (admin or role-holder required)
184
+ * @returns `{ status: 200, data: { updated: number } }`
185
+ */
46
186
  export declare function updatePriority(input: {
47
187
  ids: string[];
48
188
  priority: number;
49
189
  }, auth: LTApiAuth): Promise<LTApiResult>;
190
+ /**
191
+ * Claim multiple escalations at once for the authenticated user.
192
+ *
193
+ * @param input.ids — array of escalation UUIDs
194
+ * @param input.durationMinutes — claim duration (default: 30)
195
+ * @param auth — authenticated user context
196
+ * @returns `{ status: 200, data: { claimed, skipped } }`
197
+ */
50
198
  export declare function bulkClaim(input: {
51
199
  ids: string[];
52
200
  durationMinutes?: number;
53
201
  }, auth: LTApiAuth): Promise<LTApiResult>;
202
+ /**
203
+ * Assign multiple escalations to a specific user.
204
+ *
205
+ * Non-superadmin callers must verify the target user holds each
206
+ * escalation's role. Publishes claim events for assigned items.
207
+ *
208
+ * @param input.ids — array of escalation UUIDs
209
+ * @param input.targetUserId — user to assign to
210
+ * @param input.durationMinutes — assignment duration (default: 30)
211
+ * @param auth — authenticated user context
212
+ * @returns `{ status: 200, data: { assigned, skipped } }`
213
+ */
54
214
  export declare function bulkAssign(input: {
55
215
  ids: string[];
56
216
  targetUserId: string;
57
217
  durationMinutes?: number;
58
218
  }, auth: LTApiAuth): Promise<LTApiResult>;
219
+ /**
220
+ * Route multiple escalations to a different role.
221
+ *
222
+ * @param input.ids — array of escalation UUIDs
223
+ * @param input.targetRole — destination role
224
+ * @param auth — authenticated user context
225
+ * @returns `{ status: 200, data: { updated: number } }`
226
+ */
59
227
  export declare function bulkEscalate(input: {
60
228
  ids: string[];
61
229
  targetRole: string;
62
230
  }, auth: LTApiAuth): Promise<LTApiResult>;
231
+ /**
232
+ * Trigger AI triage for multiple escalations.
233
+ *
234
+ * Resolves each escalation and starts a triage workflow that uses MCP
235
+ * tools to analyze and potentially auto-resolve the issue.
236
+ *
237
+ * @param input.ids — array of escalation UUIDs
238
+ * @param input.hint — optional natural-language guidance for the triage AI
239
+ * @param auth — authenticated user context
240
+ * @returns `{ status: 200, data: { triaged, workflows } }`
241
+ */
63
242
  export declare function bulkTriage(input: {
64
243
  ids: string[];
65
244
  hint?: string;
66
245
  }, auth: LTApiAuth): Promise<LTApiResult>;
246
+ /**
247
+ * Resolve a pending escalation with a human-provided payload.
248
+ *
249
+ * Handles two resolution paths:
250
+ * 1. **Signal-routed** — if the escalation has `signal_routing` metadata,
251
+ * the resolver payload is sent directly to the paused workflow via
252
+ * `handle.signal()`. Supports both Durable and YAML engines.
253
+ * 2. **Re-run** — the original workflow is re-started with the resolver
254
+ * payload injected into `envelope.resolver`. The interceptor detects
255
+ * the re-run and skips to the resolution branch.
256
+ *
257
+ * Password fields in the resolver payload are replaced with ephemeral
258
+ * tokens (15-minute TTL) so plaintext never enters the signal store.
259
+ *
260
+ * Supports optional escalation strategy execution after resolution.
261
+ *
262
+ * @param input.id — escalation UUID
263
+ * @param input.resolverPayload — human decision data
264
+ * @param auth — authenticated user context
265
+ * @returns `{ status: 200, data: { signaled, escalationId, workflowId } }` (signal path)
266
+ * or `{ status: 200, data: { workflowId, resumed, escalationId } }` (re-run path)
267
+ */
67
268
  export declare function resolveEscalation(input: {
68
269
  id: string;
69
270
  resolverPayload: Record<string, any>;
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createEscalation = createEscalation;
36
37
  exports.listEscalations = listEscalations;
37
38
  exports.listAvailableEscalations = listAvailableEscalations;
38
39
  exports.listDistinctTypes = listDistinctTypes;
@@ -97,7 +98,88 @@ function publishBulkClaimEvents(ids, assignedTo) {
97
98
  });
98
99
  }
99
100
  }
101
+ // ── Create ────────────────────────────────────────────────────────────────
102
+ /**
103
+ * Create a standalone escalation (not tied to a workflow).
104
+ *
105
+ * Useful for manual work items, support tickets, or approval requests
106
+ * that originate outside the durable workflow engine. The caller must
107
+ * hold the target role or be a superadmin.
108
+ *
109
+ * @param input.type — escalation category (e.g. `"support"`, `"approval"`)
110
+ * @param input.subtype — subcategory for finer routing
111
+ * @param input.role — role responsible for resolving this escalation
112
+ * @param input.description — human-readable summary
113
+ * @param input.priority — 1 (critical) through 4 (low), default 2
114
+ * @param input.envelope — serialized context for the resolver
115
+ * @param input.metadata — arbitrary key-value data (e.g. signal_routing)
116
+ * @param input.escalation_payload — serialized payload for the resolver UI
117
+ * @param auth — authenticated user context (must hold target role or be superadmin)
118
+ * @returns `{ status: 201, data: <escalation record> }`
119
+ */
120
+ async function createEscalation(input, auth) {
121
+ try {
122
+ const { type, role } = input;
123
+ if (!type || typeof type !== 'string') {
124
+ return { status: 400, error: 'type is required' };
125
+ }
126
+ if (!role || typeof role !== 'string') {
127
+ return { status: 400, error: 'role is required' };
128
+ }
129
+ // RBAC: caller must hold the target role or be superadmin
130
+ const isSuperAdminUser = await userService.isSuperAdmin(auth.userId);
131
+ if (!isSuperAdminUser) {
132
+ const userHasRole = await userService.hasRole(auth.userId, role);
133
+ if (!userHasRole) {
134
+ return { status: 403, error: `You must hold the "${role}" role or be a superadmin to create escalations for it` };
135
+ }
136
+ }
137
+ const escalation = await escalationService.createEscalation({
138
+ type,
139
+ subtype: input.subtype ?? type,
140
+ description: input.description,
141
+ priority: input.priority,
142
+ role,
143
+ envelope: input.envelope ?? '{}',
144
+ metadata: input.metadata,
145
+ escalation_payload: input.escalation_payload,
146
+ });
147
+ (0, publish_1.publishEscalationEvent)({
148
+ type: 'escalation.created',
149
+ source: 'api',
150
+ workflowId: '',
151
+ workflowName: '',
152
+ taskQueue: '',
153
+ escalationId: escalation.id,
154
+ status: 'pending',
155
+ data: { type: input.type, role },
156
+ });
157
+ return { status: 201, data: escalation };
158
+ }
159
+ catch (err) {
160
+ return { status: 500, error: err.message };
161
+ }
162
+ }
100
163
  // ── List routes ────────────────────────────────────────────────────────────
164
+ /**
165
+ * List escalations with optional filters.
166
+ *
167
+ * Results are scoped to the authenticated user's roles unless the user
168
+ * is a superadmin (who sees all roles).
169
+ *
170
+ * @param input.status — filter by `pending`, `resolved`, or `cancelled`
171
+ * @param input.role — filter by assigned role
172
+ * @param input.type — filter by workflow type
173
+ * @param input.subtype — filter by subtype
174
+ * @param input.assigned_to — filter by assigned user ID
175
+ * @param input.priority — filter by priority (1–4)
176
+ * @param input.limit — max results (default: 50)
177
+ * @param input.offset — pagination offset
178
+ * @param input.sort_by — column to sort by (e.g. `created_at`, `priority`)
179
+ * @param input.order — `asc` or `desc`
180
+ * @param auth — authenticated user context (required for role scoping)
181
+ * @returns `{ status: 200, data: { escalations, total } }`
182
+ */
101
183
  async function listEscalations(input, auth) {
102
184
  try {
103
185
  const visibleRoles = await getVisibleRoles(auth.userId);
@@ -123,6 +205,23 @@ async function listEscalations(input, auth) {
123
205
  return { status: 500, error: err.message };
124
206
  }
125
207
  }
208
+ /**
209
+ * List escalations available for claim (pending and not actively claimed).
210
+ *
211
+ * Similar to `listEscalations` but excludes escalations with active claims.
212
+ * Scoped to the authenticated user's roles.
213
+ *
214
+ * @param input.role — filter by role
215
+ * @param input.type — filter by workflow type
216
+ * @param input.subtype — filter by subtype
217
+ * @param input.priority — filter by priority (1–4)
218
+ * @param input.limit — max results (default: 50)
219
+ * @param input.offset — pagination offset
220
+ * @param input.sort_by — column to sort by
221
+ * @param input.order — `asc` or `desc`
222
+ * @param auth — authenticated user context
223
+ * @returns `{ status: 200, data: { escalations, total } }`
224
+ */
126
225
  async function listAvailableEscalations(input, auth) {
127
226
  try {
128
227
  const visibleRoles = await getVisibleRoles(auth.userId);
@@ -146,6 +245,11 @@ async function listAvailableEscalations(input, auth) {
146
245
  return { status: 500, error: err.message };
147
246
  }
148
247
  }
248
+ /**
249
+ * List all distinct escalation type values.
250
+ *
251
+ * @returns `{ status: 200, data: { types: string[] } }`
252
+ */
149
253
  async function listDistinctTypes() {
150
254
  try {
151
255
  const types = await escalationService.listDistinctTypes();
@@ -155,6 +259,13 @@ async function listDistinctTypes() {
155
259
  return { status: 500, error: err.message };
156
260
  }
157
261
  }
262
+ /**
263
+ * Get aggregate escalation statistics scoped to the user's roles.
264
+ *
265
+ * @param input.period — time window (`1h`, `24h`, `7d`, `30d`)
266
+ * @param auth — authenticated user context
267
+ * @returns `{ status: 200, data: { pending, claimed, created, resolved, by_role, by_type } }`
268
+ */
158
269
  async function getEscalationStats(input, auth) {
159
270
  try {
160
271
  const visibleRoles = await getVisibleRoles(auth.userId);
@@ -179,6 +290,15 @@ async function getEscalationStats(input, auth) {
179
290
  }
180
291
  }
181
292
  // ── Single-escalation routes ───────────────────────────────────────────────
293
+ /**
294
+ * Get a single escalation by ID.
295
+ *
296
+ * Non-superadmin users must hold the escalation's assigned role.
297
+ *
298
+ * @param input.id — escalation UUID
299
+ * @param auth — authenticated user context
300
+ * @returns `{ status: 200, data: <escalation record> }` or 403/404
301
+ */
182
302
  async function getEscalation(input, auth) {
183
303
  try {
184
304
  const escalation = await escalationService.getEscalation(input.id);
@@ -198,6 +318,12 @@ async function getEscalation(input, auth) {
198
318
  return { status: 500, error: err.message };
199
319
  }
200
320
  }
321
+ /**
322
+ * List all escalations for a given workflow ID.
323
+ *
324
+ * @param input.workflowId — HotMesh workflow ID
325
+ * @returns `{ status: 200, data: { escalations } }`
326
+ */
201
327
  async function getEscalationsByWorkflowId(input) {
202
328
  try {
203
329
  const escalations = await escalationService.getEscalationsByWorkflowId(input.workflowId);
@@ -207,6 +333,17 @@ async function getEscalationsByWorkflowId(input) {
207
333
  return { status: 500, error: err.message };
208
334
  }
209
335
  }
336
+ /**
337
+ * Route a pending escalation to a different role.
338
+ *
339
+ * The user must be authorized to escalate from the current role to the
340
+ * target role (checked via escalation chain configuration).
341
+ *
342
+ * @param input.id — escalation UUID
343
+ * @param input.targetRole — destination role
344
+ * @param auth — authenticated user context
345
+ * @returns `{ status: 200, data: <updated escalation> }` or 403/404/409
346
+ */
210
347
  async function escalateToRole(input, auth) {
211
348
  try {
212
349
  const { id, targetRole } = input;
@@ -234,6 +371,18 @@ async function escalateToRole(input, auth) {
234
371
  return { status: 500, error: err.message };
235
372
  }
236
373
  }
374
+ /**
375
+ * Claim a pending escalation for the authenticated user.
376
+ *
377
+ * Sets `assigned_to` and `assigned_until` on the escalation (soft lock).
378
+ * Non-superadmin users must hold the escalation's role. Publishes a
379
+ * `escalation.claimed` event.
380
+ *
381
+ * @param input.id — escalation UUID
382
+ * @param input.durationMinutes — claim duration (default: 30)
383
+ * @param auth — authenticated user context
384
+ * @returns `{ status: 200, data: { escalation, isExtension } }` or 403/404/409
385
+ */
237
386
  async function claimEscalation(input, auth) {
238
387
  try {
239
388
  const { id, durationMinutes } = input;
@@ -271,6 +420,16 @@ async function claimEscalation(input, auth) {
271
420
  return { status: 500, error: err.message };
272
421
  }
273
422
  }
423
+ /**
424
+ * Release a claimed escalation back to the pool.
425
+ *
426
+ * Only the user who holds the claim can release it. Publishes a
427
+ * `escalation.released` event.
428
+ *
429
+ * @param input.id — escalation UUID
430
+ * @param auth — authenticated user context
431
+ * @returns `{ status: 200, data: { escalation } }` or 409
432
+ */
274
433
  async function releaseEscalation(input, auth) {
275
434
  try {
276
435
  const result = await escalationService.releaseEscalation(input.id, auth.userId);
@@ -294,6 +453,14 @@ async function releaseEscalation(input, auth) {
294
453
  }
295
454
  }
296
455
  // ── Bulk routes ────────────────────────────────────────────────────────────
456
+ /**
457
+ * Release all escalation claims past their `assigned_until` deadline.
458
+ *
459
+ * Typically called on a maintenance schedule. Returns the count of
460
+ * released claims.
461
+ *
462
+ * @returns `{ status: 200, data: { released: number } }`
463
+ */
297
464
  async function releaseExpiredClaims() {
298
465
  try {
299
466
  const released = await escalationService.releaseExpiredClaims();
@@ -303,6 +470,14 @@ async function releaseExpiredClaims() {
303
470
  return { status: 500, error: err.message };
304
471
  }
305
472
  }
473
+ /**
474
+ * Update priority for one or more escalations.
475
+ *
476
+ * @param input.ids — array of escalation UUIDs
477
+ * @param input.priority — new priority (1=critical, 2=high, 3=medium, 4=low)
478
+ * @param auth — authenticated user context (admin or role-holder required)
479
+ * @returns `{ status: 200, data: { updated: number } }`
480
+ */
306
481
  async function updatePriority(input, auth) {
307
482
  try {
308
483
  const { ids, priority } = input;
@@ -322,6 +497,14 @@ async function updatePriority(input, auth) {
322
497
  return { status: 500, error: err.message };
323
498
  }
324
499
  }
500
+ /**
501
+ * Claim multiple escalations at once for the authenticated user.
502
+ *
503
+ * @param input.ids — array of escalation UUIDs
504
+ * @param input.durationMinutes — claim duration (default: 30)
505
+ * @param auth — authenticated user context
506
+ * @returns `{ status: 200, data: { claimed, skipped } }`
507
+ */
325
508
  async function bulkClaim(input, auth) {
326
509
  try {
327
510
  const { ids, durationMinutes } = input;
@@ -340,6 +523,18 @@ async function bulkClaim(input, auth) {
340
523
  return { status: 500, error: err.message };
341
524
  }
342
525
  }
526
+ /**
527
+ * Assign multiple escalations to a specific user.
528
+ *
529
+ * Non-superadmin callers must verify the target user holds each
530
+ * escalation's role. Publishes claim events for assigned items.
531
+ *
532
+ * @param input.ids — array of escalation UUIDs
533
+ * @param input.targetUserId — user to assign to
534
+ * @param input.durationMinutes — assignment duration (default: 30)
535
+ * @param auth — authenticated user context
536
+ * @returns `{ status: 200, data: { assigned, skipped } }`
537
+ */
343
538
  async function bulkAssign(input, auth) {
344
539
  try {
345
540
  const { ids, targetUserId, durationMinutes } = input;
@@ -372,6 +567,14 @@ async function bulkAssign(input, auth) {
372
567
  return { status: 500, error: err.message };
373
568
  }
374
569
  }
570
+ /**
571
+ * Route multiple escalations to a different role.
572
+ *
573
+ * @param input.ids — array of escalation UUIDs
574
+ * @param input.targetRole — destination role
575
+ * @param auth — authenticated user context
576
+ * @returns `{ status: 200, data: { updated: number } }`
577
+ */
375
578
  async function bulkEscalate(input, auth) {
376
579
  try {
377
580
  const { ids, targetRole } = input;
@@ -391,6 +594,17 @@ async function bulkEscalate(input, auth) {
391
594
  return { status: 500, error: err.message };
392
595
  }
393
596
  }
597
+ /**
598
+ * Trigger AI triage for multiple escalations.
599
+ *
600
+ * Resolves each escalation and starts a triage workflow that uses MCP
601
+ * tools to analyze and potentially auto-resolve the issue.
602
+ *
603
+ * @param input.ids — array of escalation UUIDs
604
+ * @param input.hint — optional natural-language guidance for the triage AI
605
+ * @param auth — authenticated user context
606
+ * @returns `{ status: 200, data: { triaged, workflows } }`
607
+ */
394
608
  async function bulkTriage(input, auth) {
395
609
  try {
396
610
  const { ids, hint } = input;
@@ -414,6 +628,28 @@ async function bulkTriage(input, auth) {
414
628
  }
415
629
  }
416
630
  // ── Resolve route ──────────────────────────────────────────────────────────
631
+ /**
632
+ * Resolve a pending escalation with a human-provided payload.
633
+ *
634
+ * Handles two resolution paths:
635
+ * 1. **Signal-routed** — if the escalation has `signal_routing` metadata,
636
+ * the resolver payload is sent directly to the paused workflow via
637
+ * `handle.signal()`. Supports both Durable and YAML engines.
638
+ * 2. **Re-run** — the original workflow is re-started with the resolver
639
+ * payload injected into `envelope.resolver`. The interceptor detects
640
+ * the re-run and skips to the resolution branch.
641
+ *
642
+ * Password fields in the resolver payload are replaced with ephemeral
643
+ * tokens (15-minute TTL) so plaintext never enters the signal store.
644
+ *
645
+ * Supports optional escalation strategy execution after resolution.
646
+ *
647
+ * @param input.id — escalation UUID
648
+ * @param input.resolverPayload — human decision data
649
+ * @param auth — authenticated user context
650
+ * @returns `{ status: 200, data: { signaled, escalationId, workflowId } }` (signal path)
651
+ * or `{ status: 200, data: { workflowId, resumed, escalationId } }` (re-run path)
652
+ */
417
653
  async function resolveEscalation(input, auth) {
418
654
  try {
419
655
  const { id, resolverPayload } = input;
@@ -428,7 +664,42 @@ async function resolveEscalation(input, auth) {
428
664
  if (escalation.status !== 'pending') {
429
665
  return { status: 409, error: 'Escalation not available for resolution' };
430
666
  }
431
- // 2. waitFor signal escalation -- signal the paused workflow directly
667
+ // 2. Lightweight signal path: metadata.signal_id + escalation fields
668
+ // The workflow called `await conditionLT(signalId)` and created its
669
+ // own escalation with the signal_id in metadata. On resolution, we
670
+ // inject $escalation_id into the payload and signal the running
671
+ // workflow. The workflow is responsible for resolving the escalation
672
+ // (conditionLT handles this automatically via a durable activity).
673
+ const metadataSignalId = escalation.metadata?.signal_id;
674
+ if (metadataSignalId && escalation.workflow_id && escalation.task_queue && escalation.workflow_type) {
675
+ const client = (0, workers_1.createClient)();
676
+ const handle = await client.workflow.getHandle(escalation.task_queue, escalation.workflow_type, escalation.workflow_id);
677
+ await handle.signal(metadataSignalId, {
678
+ ...resolverPayload,
679
+ $escalation_id: escalation.id,
680
+ });
681
+ (0, publish_1.publishEscalationEvent)({
682
+ type: 'escalation.resolved',
683
+ source: 'api',
684
+ workflowId: escalation.workflow_id,
685
+ workflowName: escalation.workflow_type,
686
+ taskQueue: escalation.task_queue,
687
+ taskId: escalation.task_id,
688
+ escalationId: escalation.id,
689
+ originId: escalation.origin_id ?? undefined,
690
+ status: 'resolved',
691
+ });
692
+ return {
693
+ status: 200,
694
+ data: {
695
+ signaled: true,
696
+ escalationId: escalation.id,
697
+ workflowId: escalation.workflow_id,
698
+ },
699
+ };
700
+ }
701
+ // 3. waitFor signal escalation -- signal the paused workflow directly
702
+ // (full signal_routing object from interceptor/MCP tool)
432
703
  const signalRouting = escalation.metadata?.signal_routing;
433
704
  if (signalRouting?.signalId) {
434
705
  // Replace password fields with ephemeral tokens so plaintext never enters the signal store
@@ -480,7 +751,7 @@ async function resolveEscalation(input, auth) {
480
751
  },
481
752
  };
482
753
  }
483
- // 3. Reconstruct the original envelope from the escalation or task
754
+ // 4. Reconstruct the original envelope from the escalation or task
484
755
  let envelope = {};
485
756
  if (escalation.envelope) {
486
757
  try {
@@ -497,7 +768,7 @@ async function resolveEscalation(input, auth) {
497
768
  catch { /* use empty */ }
498
769
  }
499
770
  }
500
- // 4. Check escalation strategy for triage routing
771
+ // 5. Check escalation strategy for triage routing
501
772
  const strategy = escalation_strategy_1.escalationStrategyRegistry.current;
502
773
  if (strategy) {
503
774
  const directive = await strategy.onResolution({
@@ -557,12 +828,12 @@ async function resolveEscalation(input, auth) {
557
828
  };
558
829
  }
559
830
  }
560
- // 5. If no workflow_type, this is a notification-only escalation -- acknowledge and close
831
+ // 6. If no workflow_type, this is a notification-only escalation -- acknowledge and close
561
832
  if (!escalation.workflow_type || !escalation.task_queue) {
562
833
  await escalationService.resolveEscalation(escalation.id, resolverPayload);
563
834
  return { status: 200, data: { acknowledged: true, escalationId: escalation.id } };
564
835
  }
565
- // 6. Standard re-run: inject resolver data and start original workflow
836
+ // 7. Standard re-run: inject resolver data and start original workflow
566
837
  envelope.resolver = resolverPayload;
567
838
  envelope.lt = {
568
839
  ...envelope.lt,