@hotmeshio/long-tail 0.1.14 → 0.1.15

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 (349) hide show
  1. package/README.md +15 -0
  2. package/build/api/escalations/bulk.d.ts +78 -0
  3. package/build/api/escalations/bulk.js +279 -0
  4. package/build/api/escalations/claim.d.ts +30 -0
  5. package/build/api/escalations/claim.js +121 -0
  6. package/build/api/escalations/create.d.ts +29 -0
  7. package/build/api/escalations/create.js +101 -0
  8. package/build/api/escalations/helpers.d.ts +10 -0
  9. package/build/api/escalations/helpers.js +80 -0
  10. package/build/api/escalations/index.d.ts +6 -0
  11. package/build/api/escalations/index.js +26 -0
  12. package/build/api/escalations/list.d.ts +75 -0
  13. package/build/api/escalations/list.js +170 -0
  14. package/build/api/escalations/resolve.d.ts +18 -0
  15. package/build/api/escalations/resolve.js +243 -0
  16. package/build/api/escalations/single.d.ts +37 -0
  17. package/build/api/escalations/single.js +123 -0
  18. package/build/api/files.d.ts +3 -0
  19. package/build/api/files.js +18 -1
  20. package/build/api/knowledge.d.ts +36 -0
  21. package/build/api/knowledge.js +112 -0
  22. package/build/api/mcp/index.d.ts +2 -0
  23. package/build/api/mcp/index.js +16 -0
  24. package/build/api/{mcp.d.ts → mcp/servers.d.ts} +1 -33
  25. package/build/api/{mcp.js → mcp/servers.js} +4 -65
  26. package/build/api/mcp/tools.d.ts +33 -0
  27. package/build/api/mcp/tools.js +64 -0
  28. package/build/api/settings.js +9 -1
  29. package/build/api/workflows/config.d.ts +64 -0
  30. package/build/api/workflows/config.js +142 -0
  31. package/build/api/workflows/discovery.d.ts +29 -0
  32. package/build/api/workflows/discovery.js +153 -0
  33. package/build/api/workflows/index.d.ts +3 -0
  34. package/build/api/workflows/index.js +18 -0
  35. package/build/api/workflows/invocation.d.ts +67 -0
  36. package/build/api/workflows/invocation.js +188 -0
  37. package/build/api/yaml-workflows/cron.d.ts +39 -0
  38. package/build/api/yaml-workflows/cron.js +127 -0
  39. package/build/api/{yaml-workflows.d.ts → yaml-workflows/crud.d.ts} +22 -146
  40. package/build/api/{yaml-workflows.js → yaml-workflows/crud.js} +77 -378
  41. package/build/api/yaml-workflows/deploy.d.ts +71 -0
  42. package/build/api/yaml-workflows/deploy.js +223 -0
  43. package/build/api/yaml-workflows/helpers.d.ts +2 -0
  44. package/build/api/yaml-workflows/helpers.js +8 -0
  45. package/build/api/yaml-workflows/index.d.ts +4 -0
  46. package/build/api/yaml-workflows/index.js +27 -0
  47. package/build/api/yaml-workflows/versions.d.ts +43 -0
  48. package/build/api/yaml-workflows/versions.js +124 -0
  49. package/build/bin/ltc.d.ts +2 -0
  50. package/build/bin/ltc.js +220 -0
  51. package/build/examples/seed-data.d.ts +55 -0
  52. package/build/examples/seed-data.js +161 -0
  53. package/build/examples/seed.js +7 -164
  54. package/build/lib/cli/auth.d.ts +23 -0
  55. package/build/lib/cli/auth.js +167 -0
  56. package/build/lib/cli/client.d.ts +6 -0
  57. package/build/lib/cli/client.js +31 -0
  58. package/build/lib/cli/commands/escalations.d.ts +19 -0
  59. package/build/lib/cli/commands/escalations.js +69 -0
  60. package/build/lib/cli/commands/knowledge.d.ts +18 -0
  61. package/build/lib/cli/commands/knowledge.js +87 -0
  62. package/build/lib/cli/commands/mcp.d.ts +8 -0
  63. package/build/lib/cli/commands/mcp.js +33 -0
  64. package/build/lib/cli/commands/pipelines.d.ts +16 -0
  65. package/build/lib/cli/commands/pipelines.js +67 -0
  66. package/build/lib/cli/commands/status.d.ts +1 -0
  67. package/build/lib/cli/commands/status.js +28 -0
  68. package/build/lib/cli/commands/users.d.ts +7 -0
  69. package/build/lib/cli/commands/users.js +25 -0
  70. package/build/lib/cli/commands/workflows.d.ts +16 -0
  71. package/build/lib/cli/commands/workflows.js +104 -0
  72. package/build/lib/cli/compile.d.ts +2 -0
  73. package/build/lib/cli/compile.js +165 -0
  74. package/build/lib/cli/format.d.ts +23 -0
  75. package/build/lib/cli/format.js +94 -0
  76. package/build/lib/cli/init.d.ts +1 -0
  77. package/build/lib/cli/init.js +61 -0
  78. package/build/lib/cli/output.d.ts +27 -0
  79. package/build/lib/cli/output.js +126 -0
  80. package/build/lib/cli/scanner.d.ts +10 -0
  81. package/build/lib/cli/scanner.js +164 -0
  82. package/build/lib/cli/types.d.ts +16 -0
  83. package/build/lib/cli/types.js +2 -0
  84. package/build/lib/logger/index.d.ts +0 -9
  85. package/build/lib/logger/index.js +9 -4
  86. package/build/lib/storage/index.js +2 -2
  87. package/build/routes/file-browser.js +14 -0
  88. package/build/routes/index.js +2 -0
  89. package/build/routes/knowledge.d.ts +2 -0
  90. package/build/routes/knowledge.js +141 -0
  91. package/build/routes/yaml-workflows/crud.js +9 -0
  92. package/build/sdk/index.d.ts +17 -0
  93. package/build/sdk/index.js +19 -0
  94. package/build/services/mcp/client/connection-dispatch.d.ts +18 -0
  95. package/build/services/mcp/client/connection-dispatch.js +78 -0
  96. package/build/services/mcp/client/connection-lifecycle.d.ts +48 -0
  97. package/build/services/mcp/client/connection-lifecycle.js +296 -0
  98. package/build/services/mcp/client/connection-test.d.ts +10 -0
  99. package/build/services/mcp/client/connection-test.js +49 -0
  100. package/build/services/mcp/client/connection.d.ts +3 -68
  101. package/build/services/mcp/client/connection.js +15 -393
  102. package/build/services/mcp/server-lifecycle.d.ts +27 -0
  103. package/build/services/mcp/server-lifecycle.js +49 -0
  104. package/build/services/mcp/server-tools.d.ts +13 -0
  105. package/build/services/mcp/server-tools.js +287 -0
  106. package/build/services/mcp/server.d.ts +2 -26
  107. package/build/services/mcp/server.js +7 -315
  108. package/build/services/yaml-workflow/builder-regenerate.d.ts +25 -0
  109. package/build/services/yaml-workflow/builder-regenerate.js +111 -0
  110. package/build/services/yaml-workflow/db-versions.d.ts +17 -0
  111. package/build/services/yaml-workflow/db-versions.js +76 -0
  112. package/build/services/yaml-workflow/db.d.ts +3 -13
  113. package/build/services/yaml-workflow/db.js +15 -71
  114. package/build/services/yaml-workflow/deployer-helpers.js +48 -17
  115. package/build/services/yaml-workflow/durable-compiler/index.d.ts +22 -0
  116. package/build/services/yaml-workflow/durable-compiler/index.js +168 -0
  117. package/build/services/yaml-workflow/durable-compiler/parser.d.ts +12 -0
  118. package/build/services/yaml-workflow/durable-compiler/parser.js +110 -0
  119. package/build/services/yaml-workflow/durable-compiler/prompts.d.ts +18 -0
  120. package/build/services/yaml-workflow/durable-compiler/prompts.js +570 -0
  121. package/build/services/yaml-workflow/durable-compiler/types.d.ts +51 -0
  122. package/build/services/yaml-workflow/durable-compiler/types.js +5 -0
  123. package/build/services/yaml-workflow/pipeline/build/dag-assembly.d.ts +17 -0
  124. package/build/services/yaml-workflow/pipeline/build/dag-assembly.js +192 -0
  125. package/build/services/yaml-workflow/pipeline/build/dag.d.ts +4 -13
  126. package/build/services/yaml-workflow/pipeline/build/dag.js +9 -185
  127. package/build/services/yaml-workflow/pipeline/prompt-templates.d.ts +10 -0
  128. package/build/services/yaml-workflow/pipeline/prompt-templates.js +270 -0
  129. package/build/services/yaml-workflow/pipeline/prompts.d.ts +3 -6
  130. package/build/services/yaml-workflow/pipeline/prompts.js +8 -263
  131. package/build/start/workers.js +6 -5
  132. package/build/system/activities/file-storage.d.ts +4 -0
  133. package/build/system/activities/file-storage.js +7 -1
  134. package/build/system/activities/knowledge.d.ts +23 -0
  135. package/build/system/activities/knowledge.js +50 -10
  136. package/build/system/activities/sql.d.ts +3 -0
  137. package/build/system/activities/sql.js +25 -1
  138. package/build/system/mcp-servers/file-storage.js +3 -1
  139. package/build/system/mcp-servers/human-queue-schemas.d.ts +91 -0
  140. package/build/system/mcp-servers/human-queue-schemas.js +42 -0
  141. package/build/system/mcp-servers/human-queue.d.ts +2 -6
  142. package/build/system/mcp-servers/human-queue.js +9 -51
  143. package/build/system/mcp-servers/knowledge.js +43 -9
  144. package/build/system/mcp-servers/workflow-compiler.js +54 -0
  145. package/build/system/workflows/mcp-triage/activities-proxy.d.ts +21 -0
  146. package/build/system/workflows/mcp-triage/activities-proxy.js +70 -0
  147. package/build/system/workflows/mcp-triage/index.js +17 -75
  148. package/build/system/workflows/mcp-workflow-planner/activities/persist.d.ts +1 -0
  149. package/build/system/workflows/mcp-workflow-planner/activities/persist.js +1 -0
  150. package/build/system/workflows/mcp-workflow-planner/index.js +2 -0
  151. package/build/tsconfig.tsbuildinfo +1 -1
  152. package/dashboard/dist/assets/{AdminDashboard-Cngijp4Q.js → AdminDashboard-NLryl1_B.js} +2 -2
  153. package/dashboard/dist/assets/{AdminDashboard-Cngijp4Q.js.map → AdminDashboard-NLryl1_B.js.map} +1 -1
  154. package/dashboard/dist/assets/AvailableEscalationsPage-6vexlrk3.js +2 -0
  155. package/dashboard/dist/assets/AvailableEscalationsPage-6vexlrk3.js.map +1 -0
  156. package/dashboard/dist/assets/{BotPicker-B8Uvw9Si.js → BotPicker-DWhn0tr1.js} +2 -2
  157. package/dashboard/dist/assets/{BotPicker-B8Uvw9Si.js.map → BotPicker-DWhn0tr1.js.map} +1 -1
  158. package/dashboard/dist/assets/{CollapsibleSection-DiFPuWOY.js → CollapsibleSection-CgYgQiOc.js} +2 -2
  159. package/dashboard/dist/assets/{CollapsibleSection-DiFPuWOY.js.map → CollapsibleSection-CgYgQiOc.js.map} +1 -1
  160. package/dashboard/dist/assets/{ConfirmDeleteModal-CpXG9uyu.js → ConfirmDeleteModal-DCKAPXD3.js} +2 -2
  161. package/dashboard/dist/assets/{ConfirmDeleteModal-CpXG9uyu.js.map → ConfirmDeleteModal-DCKAPXD3.js.map} +1 -1
  162. package/dashboard/dist/assets/{CopyableId-DKsTR9lK.js → CopyableId-DXkaAOYk.js} +2 -2
  163. package/dashboard/dist/assets/{CopyableId-DKsTR9lK.js.map → CopyableId-DXkaAOYk.js.map} +1 -1
  164. package/dashboard/dist/assets/{CredentialsPage-DlS7Kf40.js → CredentialsPage-B361BOfU.js} +2 -2
  165. package/dashboard/dist/assets/{CredentialsPage-DlS7Kf40.js.map → CredentialsPage-B361BOfU.js.map} +1 -1
  166. package/dashboard/dist/assets/{CustomDurationPicker-B-9eW3pm.js → CustomDurationPicker-D2G1ldiF.js} +2 -2
  167. package/dashboard/dist/assets/{CustomDurationPicker-B-9eW3pm.js.map → CustomDurationPicker-D2G1ldiF.js.map} +1 -1
  168. package/dashboard/dist/assets/{DataTable-DkOokbtL.js → DataTable-DXSUbA26.js} +2 -2
  169. package/dashboard/dist/assets/{DataTable-DkOokbtL.js.map → DataTable-DXSUbA26.js.map} +1 -1
  170. package/dashboard/dist/assets/{ElapsedCell-DVtHqM-5.js → ElapsedCell-CQGqkXP_.js} +2 -2
  171. package/dashboard/dist/assets/{ElapsedCell-DVtHqM-5.js.map → ElapsedCell-CQGqkXP_.js.map} +1 -1
  172. package/dashboard/dist/assets/{EmptyState-C7KIMIbE.js → EmptyState-Dep92Wkg.js} +2 -2
  173. package/dashboard/dist/assets/{EmptyState-C7KIMIbE.js.map → EmptyState-Dep92Wkg.js.map} +1 -1
  174. package/dashboard/dist/assets/{EscalationsOverview-BMKBlkPx.js → EscalationsOverview-DVEFVjs7.js} +2 -2
  175. package/dashboard/dist/assets/{EscalationsOverview-BMKBlkPx.js.map → EscalationsOverview-DVEFVjs7.js.map} +1 -1
  176. package/dashboard/dist/assets/{EventTable-BYZ5OVdQ.js → EventTable-BMJAPkMi.js} +2 -2
  177. package/dashboard/dist/assets/{EventTable-BYZ5OVdQ.js.map → EventTable-BMJAPkMi.js.map} +1 -1
  178. package/dashboard/dist/assets/{FilterBar-C5r3n6YO.js → FilterBar-DbVbCzH2.js} +2 -2
  179. package/dashboard/dist/assets/{FilterBar-C5r3n6YO.js.map → FilterBar-DbVbCzH2.js.map} +1 -1
  180. package/dashboard/dist/assets/{ListToolbar-BGUajIsW.js → ListToolbar-0XNuXj0M.js} +2 -2
  181. package/dashboard/dist/assets/{ListToolbar-BGUajIsW.js.map → ListToolbar-0XNuXj0M.js.map} +1 -1
  182. package/dashboard/dist/assets/{McpOverview-B_kJYHea.js → McpOverview-CeYnCzBN.js} +2 -2
  183. package/dashboard/dist/assets/{McpOverview-B_kJYHea.js.map → McpOverview-CeYnCzBN.js.map} +1 -1
  184. package/dashboard/dist/assets/McpQueryDetailPage-t3qW3QNa.js +5 -0
  185. package/dashboard/dist/assets/McpQueryDetailPage-t3qW3QNa.js.map +1 -0
  186. package/dashboard/dist/assets/{McpQueryPage-BgAq_bQg.js → McpQueryPage-CfUcdzaj.js} +2 -2
  187. package/dashboard/dist/assets/{McpQueryPage-BgAq_bQg.js.map → McpQueryPage-CfUcdzaj.js.map} +1 -1
  188. package/dashboard/dist/assets/{McpRunDetailPage-B8c0OszR.js → McpRunDetailPage-CZtodW_Z.js} +2 -2
  189. package/dashboard/dist/assets/{McpRunDetailPage-B8c0OszR.js.map → McpRunDetailPage-CZtodW_Z.js.map} +1 -1
  190. package/dashboard/dist/assets/{McpRunsPage-BY8C6k78.js → McpRunsPage-Dzgq7HGt.js} +2 -2
  191. package/dashboard/dist/assets/{McpRunsPage-BY8C6k78.js.map → McpRunsPage-Dzgq7HGt.js.map} +1 -1
  192. package/dashboard/dist/assets/{Modal-E1yRnCeW.js → Modal-yyhUeKoA.js} +2 -2
  193. package/dashboard/dist/assets/{Modal-E1yRnCeW.js.map → Modal-yyhUeKoA.js.map} +1 -1
  194. package/dashboard/dist/assets/{OperatorDashboard-C8MSTzey.js → OperatorDashboard-Ceh7OQtZ.js} +2 -2
  195. package/dashboard/dist/assets/{OperatorDashboard-C8MSTzey.js.map → OperatorDashboard-Ceh7OQtZ.js.map} +1 -1
  196. package/dashboard/dist/assets/{PageHeader-Cm5HBQF_.js → PageHeader-CZ9a8cpr.js} +2 -2
  197. package/dashboard/dist/assets/{PageHeader-Cm5HBQF_.js.map → PageHeader-CZ9a8cpr.js.map} +1 -1
  198. package/dashboard/dist/assets/{PageHeaderWithStats-CNmWJFSN.js → PageHeaderWithStats-BJuNs5NM.js} +2 -2
  199. package/dashboard/dist/assets/{PageHeaderWithStats-CNmWJFSN.js.map → PageHeaderWithStats-BJuNs5NM.js.map} +1 -1
  200. package/dashboard/dist/assets/{PriorityBadge-HSI4RVhs.js → PriorityBadge-BrPikMFy.js} +2 -2
  201. package/dashboard/dist/assets/{PriorityBadge-HSI4RVhs.js.map → PriorityBadge-BrPikMFy.js.map} +1 -1
  202. package/dashboard/dist/assets/{ProcessDetailPage-Dln8622H.js → ProcessDetailPage-2miaYd8G.js} +2 -2
  203. package/dashboard/dist/assets/{ProcessDetailPage-Dln8622H.js.map → ProcessDetailPage-2miaYd8G.js.map} +1 -1
  204. package/dashboard/dist/assets/{ProcessesListPage-bIsd9N_h.js → ProcessesListPage-DqpRDqjk.js} +2 -2
  205. package/dashboard/dist/assets/{ProcessesListPage-bIsd9N_h.js.map → ProcessesListPage-DqpRDqjk.js.map} +1 -1
  206. package/dashboard/dist/assets/{RolePill-BVUp2bF0.js → RolePill-DxbJMfJu.js} +2 -2
  207. package/dashboard/dist/assets/{RolePill-BVUp2bF0.js.map → RolePill-DxbJMfJu.js.map} +1 -1
  208. package/dashboard/dist/assets/RolesPage-CYHRo21-.js +2 -0
  209. package/dashboard/dist/assets/{RolesPage-kH-Njt25.js.map → RolesPage-CYHRo21-.js.map} +1 -1
  210. package/dashboard/dist/assets/{RowActions-DbUJPfaW.js → RowActions-DurFwIwe.js} +2 -2
  211. package/dashboard/dist/assets/{RowActions-DbUJPfaW.js.map → RowActions-DurFwIwe.js.map} +1 -1
  212. package/dashboard/dist/assets/RunAsSelector-CNKraP6u.js +2 -0
  213. package/dashboard/dist/assets/RunAsSelector-CNKraP6u.js.map +1 -0
  214. package/dashboard/dist/assets/{StatCard-Bs3JbyAz.js → StatCard-CKplpK3w.js} +2 -2
  215. package/dashboard/dist/assets/{StatCard-Bs3JbyAz.js.map → StatCard-CKplpK3w.js.map} +1 -1
  216. package/dashboard/dist/assets/{StatusBadge-CakDdsCw.js → StatusBadge-Dm0V1dNN.js} +2 -2
  217. package/dashboard/dist/assets/{StatusBadge-CakDdsCw.js.map → StatusBadge-Dm0V1dNN.js.map} +1 -1
  218. package/dashboard/dist/assets/{StepIndicator-Cd_SG_yA.js → StepIndicator-Dicx0WTZ.js} +2 -2
  219. package/dashboard/dist/assets/{StepIndicator-Cd_SG_yA.js.map → StepIndicator-Dicx0WTZ.js.map} +1 -1
  220. package/dashboard/dist/assets/{StickyPagination-Bz0C18nC.js → StickyPagination-B2jYvU3-.js} +2 -2
  221. package/dashboard/dist/assets/{StickyPagination-Bz0C18nC.js.map → StickyPagination-B2jYvU3-.js.map} +1 -1
  222. package/dashboard/dist/assets/SwimlaneTimeline-ClwumkT1.js +2 -0
  223. package/dashboard/dist/assets/SwimlaneTimeline-ClwumkT1.js.map +1 -0
  224. package/dashboard/dist/assets/{TagInput-ClFhXG-U.js → TagInput-CypDZ6Kl.js} +2 -2
  225. package/dashboard/dist/assets/{TagInput-ClFhXG-U.js.map → TagInput-CypDZ6Kl.js.map} +1 -1
  226. package/dashboard/dist/assets/{TaskDetailPage-SuMBdARt.js → TaskDetailPage-DooDNJGT.js} +2 -2
  227. package/dashboard/dist/assets/{TaskDetailPage-SuMBdARt.js.map → TaskDetailPage-DooDNJGT.js.map} +1 -1
  228. package/dashboard/dist/assets/{TaskQueuePill-lJR1JW_W.js → TaskQueuePill-C1hZ-j31.js} +2 -2
  229. package/dashboard/dist/assets/{TaskQueuePill-lJR1JW_W.js.map → TaskQueuePill-C1hZ-j31.js.map} +1 -1
  230. package/dashboard/dist/assets/{TasksListPage-Dkq1Vtbt.js → TasksListPage-D7CdkAeg.js} +2 -2
  231. package/dashboard/dist/assets/{TasksListPage-Dkq1Vtbt.js.map → TasksListPage-D7CdkAeg.js.map} +1 -1
  232. package/dashboard/dist/assets/{TimeAgo-DgfDZ1pl.js → TimeAgo-B5LXB2aj.js} +2 -2
  233. package/dashboard/dist/assets/{TimeAgo-DgfDZ1pl.js.map → TimeAgo-B5LXB2aj.js.map} +1 -1
  234. package/dashboard/dist/assets/{TimestampCell-MpHZ1hMD.js → TimestampCell-Crb9b0Gw.js} +2 -2
  235. package/dashboard/dist/assets/{TimestampCell-MpHZ1hMD.js.map → TimestampCell-Crb9b0Gw.js.map} +1 -1
  236. package/dashboard/dist/assets/{UserName-DqsosA4B.js → UserName-OPg-nkRa.js} +2 -2
  237. package/dashboard/dist/assets/{UserName-DqsosA4B.js.map → UserName-OPg-nkRa.js.map} +1 -1
  238. package/dashboard/dist/assets/{WorkflowExecutionPage-CVlg38C3.js → WorkflowExecutionPage-CcLVrs9b.js} +2 -2
  239. package/dashboard/dist/assets/{WorkflowExecutionPage-CVlg38C3.js.map → WorkflowExecutionPage-CcLVrs9b.js.map} +1 -1
  240. package/dashboard/dist/assets/{WorkflowPill-CRpZhjGR.js → WorkflowPill-CCV4MMj7.js} +2 -2
  241. package/dashboard/dist/assets/{WorkflowPill-CRpZhjGR.js.map → WorkflowPill-CCV4MMj7.js.map} +1 -1
  242. package/dashboard/dist/assets/{WorkflowsDashboard-Ugzbs8mV.js → WorkflowsDashboard-DB1SncBi.js} +2 -2
  243. package/dashboard/dist/assets/{WorkflowsDashboard-Ugzbs8mV.js.map → WorkflowsDashboard-DB1SncBi.js.map} +1 -1
  244. package/dashboard/dist/assets/{WorkflowsOverview-CIp_lTNl.js → WorkflowsOverview-DvShiYJV.js} +2 -2
  245. package/dashboard/dist/assets/{WorkflowsOverview-CIp_lTNl.js.map → WorkflowsOverview-DvShiYJV.js.map} +1 -1
  246. package/dashboard/dist/assets/YamlWorkflowsPage-DCBoMeGI.js +2 -0
  247. package/dashboard/dist/assets/YamlWorkflowsPage-DCBoMeGI.js.map +1 -0
  248. package/dashboard/dist/assets/{bots-DPfUpVqI.js → bots-Dqos20NE.js} +2 -2
  249. package/dashboard/dist/assets/{bots-DPfUpVqI.js.map → bots-Dqos20NE.js.map} +1 -1
  250. package/dashboard/dist/assets/{escalation-RrCDbMC3.js → escalation-A0CsbvNV.js} +2 -2
  251. package/dashboard/dist/assets/{escalation-RrCDbMC3.js.map → escalation-A0CsbvNV.js.map} +1 -1
  252. package/dashboard/dist/assets/{escalation-columns-CDGa9wsD.js → escalation-columns-BpBJN6k4.js} +2 -2
  253. package/dashboard/dist/assets/{escalation-columns-CDGa9wsD.js.map → escalation-columns-BpBJN6k4.js.map} +1 -1
  254. package/dashboard/dist/assets/{helpers-ZSKqdkdS.js → helpers-CmznCuAx.js} +2 -2
  255. package/dashboard/dist/assets/{helpers-ZSKqdkdS.js.map → helpers-CmznCuAx.js.map} +1 -1
  256. package/dashboard/dist/assets/index-BIeYV5QK.js +2 -0
  257. package/dashboard/dist/assets/index-BIeYV5QK.js.map +1 -0
  258. package/dashboard/dist/assets/index-BYwD3kHN.js +5 -0
  259. package/dashboard/dist/assets/index-BYwD3kHN.js.map +1 -0
  260. package/dashboard/dist/assets/index-C5TUqJu0.css +1 -0
  261. package/dashboard/dist/assets/{index-DX6zxr6t.js → index-C8-UaN4N.js} +2 -2
  262. package/dashboard/dist/assets/{index-DX6zxr6t.js.map → index-C8-UaN4N.js.map} +1 -1
  263. package/dashboard/dist/assets/index-CAj5LT9H.js +15 -0
  264. package/dashboard/dist/assets/index-CAj5LT9H.js.map +1 -0
  265. package/dashboard/dist/assets/index-CjxHCVxl.js +2 -0
  266. package/dashboard/dist/assets/{index-C90ZPzXk.js.map → index-CjxHCVxl.js.map} +1 -1
  267. package/dashboard/dist/assets/index-Cr0Rqsj7.js +2 -0
  268. package/dashboard/dist/assets/index-Cr0Rqsj7.js.map +1 -0
  269. package/dashboard/dist/assets/index-DZHNte4o.js +2 -0
  270. package/dashboard/dist/assets/{index-K40Qw1tk.js.map → index-DZHNte4o.js.map} +1 -1
  271. package/dashboard/dist/assets/{index-DNytWfSZ.js → index-VnYkWW8r.js} +2 -2
  272. package/dashboard/dist/assets/{index-DNytWfSZ.js.map → index-VnYkWW8r.js.map} +1 -1
  273. package/dashboard/dist/assets/{index-BbI2dzhJ.js → index-XGOmZ117.js} +2 -2
  274. package/dashboard/dist/assets/{index-BbI2dzhJ.js.map → index-XGOmZ117.js.map} +1 -1
  275. package/dashboard/dist/assets/index-ZjOUzWhc.js +2 -0
  276. package/dashboard/dist/assets/index-ZjOUzWhc.js.map +1 -0
  277. package/dashboard/dist/assets/{index-Cmgrk7PQ.js → index-puKKZ5l8.js} +71 -71
  278. package/dashboard/dist/assets/index-puKKZ5l8.js.map +1 -0
  279. package/dashboard/dist/assets/{index-BmVCyB6C.js → index-t5frSddy.js} +2 -2
  280. package/dashboard/dist/assets/{index-BmVCyB6C.js.map → index-t5frSddy.js.map} +1 -1
  281. package/dashboard/dist/assets/{mcp-CNE44TSp.js → mcp-DrWymhSu.js} +2 -2
  282. package/dashboard/dist/assets/{mcp-CNE44TSp.js.map → mcp-DrWymhSu.js.map} +1 -1
  283. package/dashboard/dist/assets/{mcp-query-RQX0uN-5.js → mcp-query-BhUxVEMS.js} +2 -2
  284. package/dashboard/dist/assets/{mcp-query-RQX0uN-5.js.map → mcp-query-BhUxVEMS.js.map} +1 -1
  285. package/dashboard/dist/assets/{mcp-runs-0w40bdz-.js → mcp-runs-DUfz4mLd.js} +2 -2
  286. package/dashboard/dist/assets/{mcp-runs-0w40bdz-.js.map → mcp-runs-DUfz4mLd.js.map} +1 -1
  287. package/dashboard/dist/assets/{namespaces-BbmdXuPp.js → namespaces-Cm6AY5sh.js} +2 -2
  288. package/dashboard/dist/assets/{namespaces-BbmdXuPp.js.map → namespaces-Cm6AY5sh.js.map} +1 -1
  289. package/dashboard/dist/assets/{roles-DoHYlhWH.js → roles-2v1Kc7BJ.js} +2 -2
  290. package/dashboard/dist/assets/{roles-DoHYlhWH.js.map → roles-2v1Kc7BJ.js.map} +1 -1
  291. package/dashboard/dist/assets/{settings-BAiJiCHS.js → settings-DTQNp6tH.js} +2 -2
  292. package/dashboard/dist/assets/{settings-BAiJiCHS.js.map → settings-DTQNp6tH.js.map} +1 -1
  293. package/dashboard/dist/assets/{tasks-CvroqHtm.js → tasks-CS1rgG1s.js} +2 -2
  294. package/dashboard/dist/assets/{tasks-CvroqHtm.js.map → tasks-CS1rgG1s.js.map} +1 -1
  295. package/dashboard/dist/assets/useEventHooks-BjXX8x3a.js +2 -0
  296. package/dashboard/dist/assets/{useEventHooks-BHMbzR_y.js.map → useEventHooks-BjXX8x3a.js.map} +1 -1
  297. package/dashboard/dist/assets/useYamlActivityEvents-BeR-nVWQ.js +2 -0
  298. package/dashboard/dist/assets/{useYamlActivityEvents-D56KV14X.js.map → useYamlActivityEvents-BeR-nVWQ.js.map} +1 -1
  299. package/dashboard/dist/assets/{users-CxIMy_xw.js → users-DYsdQ7Md.js} +2 -2
  300. package/dashboard/dist/assets/{users-CxIMy_xw.js.map → users-DYsdQ7Md.js.map} +1 -1
  301. package/dashboard/dist/assets/{vendor-icons-AFGxSeQS.js → vendor-icons-CWl44VA6.js} +77 -77
  302. package/dashboard/dist/assets/vendor-icons-CWl44VA6.js.map +1 -0
  303. package/dashboard/dist/assets/{workflows-yR9yais7.js → workflows-2QAXh3UD.js} +2 -2
  304. package/dashboard/dist/assets/{workflows-yR9yais7.js.map → workflows-2QAXh3UD.js.map} +1 -1
  305. package/dashboard/dist/assets/{yaml-workflows-QVF2MZ0l.js → yaml-workflows-sx8-UEE3.js} +2 -2
  306. package/dashboard/dist/assets/{yaml-workflows-QVF2MZ0l.js.map → yaml-workflows-sx8-UEE3.js.map} +1 -1
  307. package/dashboard/dist/index.html +3 -3
  308. package/docs/api/http/file-browser.md +101 -0
  309. package/docs/api/http/knowledge.md +203 -0
  310. package/docs/api/http/settings.md +6 -4
  311. package/docs/api/sdk/files.md +68 -0
  312. package/docs/api/sdk/knowledge.md +126 -0
  313. package/docs/api/sdk/settings.md +3 -2
  314. package/docs/cli.md +171 -0
  315. package/docs/compilation.md +16 -0
  316. package/docs/compiler.md +311 -0
  317. package/docs/events.md +19 -0
  318. package/docs/workflows.md +19 -0
  319. package/package.json +13 -2
  320. package/build/api/escalations.d.ts +0 -271
  321. package/build/api/escalations.js +0 -932
  322. package/build/api/workflows.d.ts +0 -158
  323. package/build/api/workflows.js +0 -414
  324. package/dashboard/dist/assets/AvailableEscalationsPage-CpBfGV1h.js +0 -2
  325. package/dashboard/dist/assets/AvailableEscalationsPage-CpBfGV1h.js.map +0 -1
  326. package/dashboard/dist/assets/McpQueryDetailPage-Czsmovqw.js +0 -5
  327. package/dashboard/dist/assets/McpQueryDetailPage-Czsmovqw.js.map +0 -1
  328. package/dashboard/dist/assets/RolesPage-kH-Njt25.js +0 -2
  329. package/dashboard/dist/assets/SwimlaneTimeline-Cfe-xQRX.js +0 -2
  330. package/dashboard/dist/assets/SwimlaneTimeline-Cfe-xQRX.js.map +0 -1
  331. package/dashboard/dist/assets/YamlWorkflowsPage-BICF0fRO.js +0 -2
  332. package/dashboard/dist/assets/YamlWorkflowsPage-BICF0fRO.js.map +0 -1
  333. package/dashboard/dist/assets/helpers-rMEcLwKs.js +0 -2
  334. package/dashboard/dist/assets/helpers-rMEcLwKs.js.map +0 -1
  335. package/dashboard/dist/assets/index-ABcJHHlN.js +0 -5
  336. package/dashboard/dist/assets/index-ABcJHHlN.js.map +0 -1
  337. package/dashboard/dist/assets/index-B91h_jZ0.js +0 -15
  338. package/dashboard/dist/assets/index-B91h_jZ0.js.map +0 -1
  339. package/dashboard/dist/assets/index-C1E5GTs9.js +0 -2
  340. package/dashboard/dist/assets/index-C1E5GTs9.js.map +0 -1
  341. package/dashboard/dist/assets/index-C90ZPzXk.js +0 -2
  342. package/dashboard/dist/assets/index-Cmgrk7PQ.js.map +0 -1
  343. package/dashboard/dist/assets/index-DeX-ezqf.css +0 -1
  344. package/dashboard/dist/assets/index-K40Qw1tk.js +0 -2
  345. package/dashboard/dist/assets/index-lCyNr5Xk.js +0 -2
  346. package/dashboard/dist/assets/index-lCyNr5Xk.js.map +0 -1
  347. package/dashboard/dist/assets/useEventHooks-BHMbzR_y.js +0 -2
  348. package/dashboard/dist/assets/useYamlActivityEvents-D56KV14X.js +0 -2
  349. package/dashboard/dist/assets/vendor-icons-AFGxSeQS.js.map +0 -1
@@ -0,0 +1,311 @@
1
+ # The Workflow Compiler
2
+
3
+ You wrote a durable workflow. It works. `proxyActivities`, `sleep`, `condition` — the Temporal-like API is productive and familiar. But under the hood, the durable engine replays the entire workflow function on every wake-up. Sleep three times in a ten-step workflow? Steps 1–3 replay on wake one. Steps 1–6 replay on wake two. Steps 1–9 replay on wake three. The replay is deterministic — it skips completed activities — but the function still executes from the top every time.
4
+
5
+ The compiled YAML DAG does the same work without replay. Each step fires exactly once. State flows explicitly between activities through input mappings. No function re-execution, no replay loop, no wasted cycles.
6
+
7
+ `ltc` is the compiler. It reads your TypeScript source and produces an equivalent YAML DAG. Write procedural because it's productive. Run the DAG because it's fast.
8
+
9
+ ---
10
+
11
+ ## The Analogy
12
+
13
+ `tsc` compiles TypeScript to JavaScript. You write in the language that's expressive. You run the artifact that's efficient. The source is authoritative — you edit it, test it, review it. The compiled output is what actually executes.
14
+
15
+ `ltc` does the same for workflows:
16
+
17
+ ```
18
+ TypeScript source ltc compile YAML DAG
19
+ (developer-friendly) ──────────────────→ (execution-optimized)
20
+
21
+ assembly-line.ts → assembly-line.compiled.yaml
22
+ ```
23
+
24
+ The `.ts` file is the spec. The `.compiled.yaml` is the optimized execution. Both live in the repo. A reviewer reads both side-by-side and traces every line of orchestration logic to its DAG equivalent.
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ ```bash
31
+ npm install -g @hotmeshio/long-tail
32
+ export ANTHROPIC_API_KEY=sk-ant-...
33
+
34
+ ltc compile workflows/basic-echo/index.ts
35
+ ```
36
+
37
+ Output:
38
+
39
+ ```
40
+ ✓ index.ts → workflows/basic-echo/index.compiled.yaml
41
+ 1 activities · 2 inputs (message, sleepSeconds) · topic: basic.echo
42
+
43
+ Compiled 1 workflow in 18.1s
44
+ ```
45
+
46
+ The compiled YAML appears adjacent to the source file.
47
+
48
+ ---
49
+
50
+ ## Before and After
51
+
52
+ ### The source (procedural)
53
+
54
+ ```typescript
55
+ import { Durable } from '@hotmeshio/hotmesh';
56
+ import * as activities from './activities';
57
+
58
+ const { echo } = Durable.workflow.proxyActivities<typeof activities>({
59
+ activities,
60
+ });
61
+
62
+ export async function basicEcho(envelope: LTEnvelope): Promise<any> {
63
+ const { message = 'Hello, Long Tail!', sleepSeconds = 1 } = envelope.data;
64
+
65
+ // 1. Durable sleep — the engine replays to this point on wake-up
66
+ await Durable.workflow.sleep(`${sleepSeconds} seconds`);
67
+
68
+ // 2. Activity call — replayed as a no-op if already completed
69
+ const echoResult = await echo({ message });
70
+
71
+ return {
72
+ type: 'return' as const,
73
+ data: { ...echoResult, sleepSeconds, userId: envelope.lt?.userId },
74
+ };
75
+ }
76
+ ```
77
+
78
+ This function executes three times: once on initial invocation, once when the sleep timer fires, and once when the echo activity completes. Each time, the engine replays from the top, skipping completed steps. For a two-step workflow this is fine. For a twenty-step workflow with multiple sleeps, the replay cost compounds.
79
+
80
+ ### The compiled output (DAG)
81
+
82
+ ```yaml
83
+ app:
84
+ id: longtail
85
+ version: '1'
86
+ graphs:
87
+ - subscribes: basic.echo
88
+ expire: 300
89
+ input:
90
+ schema:
91
+ type: object
92
+ properties:
93
+ message:
94
+ type: string
95
+ default: 'Hello, Long Tail!'
96
+ sleepSeconds:
97
+ type: number
98
+ default: 1
99
+ activities:
100
+ trigger_m7qz:
101
+ type: trigger
102
+ output:
103
+ schema:
104
+ type: object
105
+ properties:
106
+ message: { type: string }
107
+ sleepSeconds: { type: number }
108
+
109
+ delay_m7qz:
110
+ type: hook
111
+ sleep: '{trigger_m7qz.output.data.sleepSeconds}'
112
+
113
+ echo_m7qz:
114
+ type: worker
115
+ topic: basic.echo
116
+ input:
117
+ maps:
118
+ message: '{trigger_m7qz.output.data.message}'
119
+ workflowName: echo
120
+
121
+ transitions:
122
+ trigger_m7qz:
123
+ - to: delay_m7qz
124
+ delay_m7qz:
125
+ - to: echo_m7qz
126
+ ```
127
+
128
+ ### The mapping
129
+
130
+ | TypeScript | YAML | What happens |
131
+ |---|---|---|
132
+ | `envelope.data` destructuring | `trigger` activity with input schema | Inputs declared as typed schema with defaults |
133
+ | `Durable.workflow.sleep(N)` | `hook` activity with `sleep` field | Engine sets a timer; no replay on wake |
134
+ | `await echo({ message })` | `worker` activity with input `maps` | Worker fires once; result stored in job hash |
135
+ | `return { data: ... }` | `job.maps` on the final activity | Output fields plucked from activity results |
136
+
137
+ Each step executes exactly once. The `sleep` hook pauses the DAG. When the timer fires, execution resumes at `echo_m7qz` — not from the top of the function.
138
+
139
+ ---
140
+
141
+ ## Discovery
142
+
143
+ Point `ltc` at a directory and it finds workflow files automatically:
144
+
145
+ ```bash
146
+ ltc compile examples/workflows/ --dry-run
147
+ ```
148
+
149
+ ```
150
+ Found 10 workflows:
151
+
152
+ ● assembly-line/index.ts
153
+ Function: assemblyLine · HotMesh Durable
154
+ Control flow: startChild, condition
155
+
156
+ ● basic-echo/index.ts
157
+ Function: basicEcho · HotMesh Durable
158
+ Activities: echo
159
+ Control flow: sleep
160
+
161
+ ● basic-signal/index.ts
162
+ Function: basicSignal · HotMesh Durable
163
+ Activities: ltCreateEscalation, processApproval
164
+ Control flow: conditionLT
165
+
166
+ ● kitchen-sink/index.ts
167
+ Function: kitchenSink · HotMesh Durable
168
+ Activities: greet, fetchData, transformData, notifyComplete
169
+ Control flow: sleep, executeLT
170
+ ```
171
+
172
+ ### What the scanner looks for
173
+
174
+ | Pattern | Classification |
175
+ |---|---|
176
+ | `proxyActivities` / `Durable.workflow.proxyActivities` | HotMesh Durable workflow |
177
+ | `@temporalio/workflow` import | Temporal workflow |
178
+ | `sleep`, `condition`, `signal` | Control flow primitives |
179
+ | `startChild`, `executeChild`, `executeLT` | Composition (parent workflow) |
180
+ | Exported async function | Workflow entry point |
181
+
182
+ Files in `node_modules/`, `build/`, `dist/`, and test files (`*.test.ts`, `*.spec.ts`) are excluded.
183
+
184
+ ---
185
+
186
+ ## How Compilation Works
187
+
188
+ The compiler is not an AST parser. It uses the LLM to translate orchestration logic, grounded by structural metadata extracted from the source.
189
+
190
+ 1. **Read source** — file or inline string
191
+ 2. **Extract metadata** — lightweight regex extraction: activity names, durable primitives, envelope fields, import paths, control flow markers (loops, Promise.all, conditionals, escalation)
192
+ 3. **Resolve activities** — if the source imports activity modules, the compiler reads them too and includes them in the LLM context
193
+ 4. **LLM translation** — the source code, extracted metadata, and the full HotMesh YAML specification are sent to the LLM. Temperature 0. Up to 3 retry attempts on parse failure.
194
+ 5. **Fix patterns** — known LLM anti-patterns in YAML pipe expressions are corrected deterministically
195
+
196
+ The metadata extraction is intentionally lightweight — regex, not a TypeScript AST. It gives the LLM structural hints (which functions are activities, which primitives are used) without requiring `ts-morph` or the TypeScript compiler API as a dependency.
197
+
198
+ ---
199
+
200
+ ## Composition
201
+
202
+ When a workflow uses `startChild` or `executeChild`, the compiler resolves the child workflow source through imports and compiles children first (leaf-first ordering). The parent's compiled YAML references each child by topic using the `await` activity type — the same mechanism used by the Pipeline Designer's Plan Build mode.
203
+
204
+ ```
205
+ parent.ts ──→ parent.compiled.yaml
206
+ └─ startChild(worker)
207
+ └─ worker.ts ──→ worker.compiled.yaml
208
+ ```
209
+
210
+ All compiled workflows in the same composition share the same `app.id` namespace, enabling cross-graph invocation.
211
+
212
+ ---
213
+
214
+ ## Three Surfaces
215
+
216
+ The compiler is the same function regardless of how you invoke it.
217
+
218
+ ### CLI
219
+
220
+ ```bash
221
+ ltc compile workflows/assembly-line.ts
222
+ ltc compile src/workflows/ --dry-run
223
+ ltc compile --model claude-sonnet-4-6
224
+ ```
225
+
226
+ ### HTTP API
227
+
228
+ ```bash
229
+ curl -X POST http://localhost:3000/api/yaml-workflows/from-durable \
230
+ -H "Authorization: Bearer $TOKEN" \
231
+ -H "Content-Type: application/json" \
232
+ -d '{
233
+ "source": "export async function basicEcho(envelope) { ... }",
234
+ "workflow_name": "basicEcho",
235
+ "name": "basic_echo"
236
+ }'
237
+ ```
238
+
239
+ ### SDK
240
+
241
+ ```typescript
242
+ import { createClient } from '@hotmeshio/long-tail/sdk';
243
+
244
+ const lt = createClient({ auth: { userId: 'system' } });
245
+
246
+ const result = await lt.yamlWorkflows.compileDurable({
247
+ source: fs.readFileSync('workflows/assembly-line.ts', 'utf-8'),
248
+ workflow_name: 'assemblyLine',
249
+ name: 'assembly_line',
250
+ });
251
+ ```
252
+
253
+ The CLI writes `.compiled.yaml` files to disk. The HTTP and SDK surfaces store the compiled workflow in the database and return the record. All three use the same underlying `compileDurableToYaml()` function.
254
+
255
+ ---
256
+
257
+ ## Configuration
258
+
259
+ | Variable | Default | Description |
260
+ |---|---|---|
261
+ | `ANTHROPIC_API_KEY` | — | Required for Claude models |
262
+ | `OPENAI_API_KEY` | — | Required for OpenAI models |
263
+ | `LT_LLM_MODEL_PRIMARY` | `claude-sonnet-4-6` | Model used for compilation |
264
+ | `LT_LLM_BASE_URL` | — | Custom endpoint for OpenAI-compatible models |
265
+
266
+ The CLI loads `.env` automatically if present in the current directory.
267
+
268
+ ---
269
+
270
+ ## CLI Reference
271
+
272
+ ```
273
+ Usage: ltc compile [options] [target]
274
+
275
+ Compile durable TypeScript workflows to YAML DAGs
276
+
277
+ Arguments:
278
+ target File or directory to compile (default: current directory)
279
+
280
+ Options:
281
+ --dry-run Show discovered workflows without compiling
282
+ -o, --output <dir> Output directory (default: adjacent to source file)
283
+ --model <model> LLM model to use (default: claude-sonnet-4-6)
284
+ --function <name> Workflow function name (auto-detected if omitted)
285
+ -h, --help Display help
286
+ ```
287
+
288
+ ### Examples
289
+
290
+ ```bash
291
+ # Compile a single file
292
+ ltc compile workflows/basic-echo/index.ts
293
+
294
+ # Scan and compile all workflows in a directory
295
+ ltc compile src/workflows/
296
+
297
+ # Compile everything in the current directory
298
+ ltc compile
299
+
300
+ # Preview what would be compiled
301
+ ltc compile examples/workflows/ --dry-run
302
+
303
+ # Use a specific model
304
+ ltc compile workflows/complex.ts --model claude-opus-4-6
305
+
306
+ # Write output to a separate directory
307
+ ltc compile workflows/ -o compiled/
308
+
309
+ # Compile a specific function from a multi-export file
310
+ ltc compile workflows/multi.ts --function assemblyLine
311
+ ```
package/docs/events.md CHANGED
@@ -26,6 +26,25 @@ await start({
26
26
 
27
27
  `start()` handles adapter connection and graceful disconnection on shutdown automatically.
28
28
 
29
+ ## Dashboard Transport Selection
30
+
31
+ The dashboard auto-detects its event transport via `GET /api/settings`. By default, Socket.IO is reported — it works in-process with no additional infrastructure.
32
+
33
+ For multi-container deployments where the API and workers run as separate processes, set `EVENT_TRANSPORT=nats` to tell the dashboard to connect via NATS WebSocket instead of Socket.IO:
34
+
35
+ ```yaml
36
+ # docker-compose.yml
37
+ services:
38
+ app:
39
+ environment:
40
+ - EVENT_TRANSPORT=nats
41
+ - NATS_URL=nats://nats:4222
42
+ - NATS_WS_URL=ws://localhost:9222
43
+ - NATS_TOKEN=your-token
44
+ ```
45
+
46
+ Both adapters still publish events regardless of `EVENT_TRANSPORT` — the setting only controls what the dashboard listens on. This means server-side event consumers (callbacks, NATS subscribers) work independently of the dashboard transport.
47
+
29
48
  ## LTEvent
30
49
 
31
50
  Every published event conforms to the `LTEvent` interface:
package/docs/workflows.md CHANGED
@@ -693,3 +693,22 @@ OPENAI_API_KEY=sk-... npm run test:vision
693
693
  # Full backend suite
694
694
  npm test
695
695
  ```
696
+
697
+ ---
698
+
699
+ ## From Durable to DAG
700
+
701
+ Every durable workflow you write is a candidate for compilation. The `ltc` CLI reads your workflow source and produces an equivalent YAML DAG that runs without replay overhead.
702
+
703
+ ```bash
704
+ ltc compile workflows/my-workflow.ts
705
+ ```
706
+
707
+ The durable code is the spec — developer-friendly, familiar, testable with standard tools. The compiled YAML is the optimized execution path — each step fires exactly once, state is plucked explicitly from upstream activities, no replay loop.
708
+
709
+ ```
710
+ my-workflow.ts → my-workflow.compiled.yaml
711
+ (write and test here) (deploy and run this)
712
+ ```
713
+
714
+ Write procedural because it's productive. Compile because it's fast. See the [Compiler Guide](compiler.md) for details.
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
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",
7
+ "bin": {
8
+ "ltc": "./build/bin/ltc.js"
9
+ },
7
10
  "homepage": "https://github.com/hotmeshio/long-tail/",
8
11
  "publishConfig": {
9
12
  "access": "public"
@@ -44,7 +47,11 @@
44
47
  "dashboard:build": "cd dashboard && npm run build",
45
48
  "dashboard:test": "cd dashboard && npm test",
46
49
  "dashboard:test:watch": "cd dashboard && npm run test:watch",
47
- "build:all": "npm run build && npm run dashboard:build"
50
+ "ltc": "tsx bin/ltc.ts",
51
+ "build:all": "npm run build && npm run dashboard:build",
52
+ "release:patch": "npm version patch && git push && git push --tags",
53
+ "release:minor": "npm version minor && git push && git push --tags",
54
+ "release:major": "npm version major && git push && git push --tags"
48
55
  },
49
56
  "keywords": [
50
57
  "Long Tail Workflows",
@@ -71,11 +78,14 @@
71
78
  "ajv": "^8.20.0",
72
79
  "arctic": "^3.7.0",
73
80
  "bcryptjs": "^2.4.3",
81
+ "commander": "^14.0.3",
74
82
  "express": "^5.1.0",
75
83
  "jsonwebtoken": "^9.0.3",
76
84
  "nats": "^2.28.0",
77
85
  "openai": "^5.9.0",
86
+ "ora": "^9.4.0",
78
87
  "pg": "^8.13.0",
88
+ "picocolors": "^1.1.1",
79
89
  "pino": "^9.6.0",
80
90
  "playwright": "^1.58.2",
81
91
  "sharp": "^0.34.5",
@@ -93,6 +103,7 @@
93
103
  "rimraf": "^4.4.1",
94
104
  "ts-node": "^10.9.1",
95
105
  "ts-node-dev": "^2.0.0",
106
+ "tsx": "^4.21.0",
96
107
  "typescript": "^5.0.4",
97
108
  "vitest": "^3.2.4"
98
109
  }
@@ -1,271 +0,0 @@
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
- */
49
- export declare function listEscalations(input: {
50
- status?: string;
51
- role?: string;
52
- type?: string;
53
- subtype?: string;
54
- assigned_to?: string;
55
- priority?: number;
56
- limit?: number;
57
- offset?: number;
58
- sort_by?: string;
59
- order?: string;
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
- */
78
- export declare function listAvailableEscalations(input: {
79
- role?: string;
80
- type?: string;
81
- subtype?: string;
82
- priority?: number;
83
- limit?: number;
84
- offset?: number;
85
- sort_by?: string;
86
- order?: string;
87
- }, auth: LTApiAuth): Promise<LTApiResult>;
88
- /**
89
- * List all distinct escalation type values.
90
- *
91
- * @returns `{ status: 200, data: { types: string[] } }`
92
- */
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
- */
101
- export declare function getEscalationStats(input: {
102
- period?: string;
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
- */
113
- export declare function getEscalation(input: {
114
- id: string;
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
- */
122
- export declare function getEscalationsByWorkflowId(input: {
123
- workflowId: string;
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
- */
136
- export declare function escalateToRole(input: {
137
- id: string;
138
- targetRole: string;
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
- */
152
- export declare function claimEscalation(input: {
153
- id: string;
154
- durationMinutes?: number;
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
- */
166
- export declare function releaseEscalation(input: {
167
- id: string;
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
- */
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
- */
186
- export declare function updatePriority(input: {
187
- ids: string[];
188
- priority: number;
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
- */
198
- export declare function bulkClaim(input: {
199
- ids: string[];
200
- durationMinutes?: number;
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
- */
214
- export declare function bulkAssign(input: {
215
- ids: string[];
216
- targetUserId: string;
217
- durationMinutes?: number;
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
- */
227
- export declare function bulkEscalate(input: {
228
- ids: string[];
229
- targetRole: string;
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
- */
242
- export declare function bulkTriage(input: {
243
- ids: string[];
244
- hint?: string;
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
- */
268
- export declare function resolveEscalation(input: {
269
- id: string;
270
- resolverPayload: Record<string, any>;
271
- }, auth: LTApiAuth): Promise<LTApiResult>;