@hotmeshio/long-tail 0.1.6 → 0.1.7

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 (335) hide show
  1. package/README.md +44 -4
  2. package/build/api/auth.d.ts +5 -0
  3. package/build/api/auth.js +42 -0
  4. package/build/api/bot-accounts.d.ts +50 -0
  5. package/build/api/bot-accounts.js +215 -0
  6. package/build/api/controlplane.d.ts +20 -0
  7. package/build/api/controlplane.js +110 -0
  8. package/build/api/dba.d.ts +15 -0
  9. package/build/api/dba.js +68 -0
  10. package/build/api/escalations.d.ts +70 -0
  11. package/build/api/escalations.js +656 -0
  12. package/build/api/exports.d.ts +32 -0
  13. package/build/api/exports.js +146 -0
  14. package/build/api/index.d.ts +18 -0
  15. package/build/api/index.js +54 -0
  16. package/build/api/insight.d.ts +29 -0
  17. package/build/api/insight.js +90 -0
  18. package/build/api/maintenance.d.ts +7 -0
  19. package/build/api/maintenance.js +28 -0
  20. package/build/api/mcp-runs.d.ts +16 -0
  21. package/build/api/mcp-runs.js +62 -0
  22. package/build/api/mcp.d.ts +52 -0
  23. package/build/api/mcp.js +212 -0
  24. package/build/api/namespaces.d.ts +7 -0
  25. package/build/{routes/escalations/helpers.js → api/namespaces.js} +24 -12
  26. package/build/api/roles.d.ts +25 -0
  27. package/build/api/roles.js +159 -0
  28. package/build/api/settings.d.ts +2 -0
  29. package/build/api/settings.js +35 -0
  30. package/build/api/tasks.d.ts +27 -0
  31. package/build/api/tasks.js +96 -0
  32. package/build/api/users.d.ts +44 -0
  33. package/build/api/users.js +162 -0
  34. package/build/api/workflow-sets.d.ts +26 -0
  35. package/build/api/workflow-sets.js +119 -0
  36. package/build/api/workflows.d.ts +48 -0
  37. package/build/api/workflows.js +298 -0
  38. package/build/api/yaml-workflows.d.ts +87 -0
  39. package/build/api/yaml-workflows.js +556 -0
  40. package/build/index.d.ts +4 -0
  41. package/build/index.js +6 -1
  42. package/build/lib/db/schemas/004_workflow_sets.sql +29 -0
  43. package/build/lib/db/schemas/005_unique_graph_topic.sql +7 -0
  44. package/build/lib/db/schemas/011_system_workflow_configs.sql +7 -0
  45. package/build/lib/events/callback.d.ts +41 -0
  46. package/build/lib/events/callback.js +98 -0
  47. package/build/modules/config.js +1 -1
  48. package/build/routes/auth.js +37 -36
  49. package/build/routes/bot-accounts.js +34 -164
  50. package/build/routes/controlplane.js +20 -60
  51. package/build/routes/dba.js +18 -28
  52. package/build/routes/escalations/bulk.js +17 -192
  53. package/build/routes/escalations/list.js +29 -75
  54. package/build/routes/escalations/resolve.js +3 -193
  55. package/build/routes/escalations/single.js +13 -122
  56. package/build/routes/exports.js +44 -95
  57. package/build/routes/index.js +2 -0
  58. package/build/routes/insight.js +46 -88
  59. package/build/routes/maintenance.js +41 -17
  60. package/build/routes/mcp-runs.js +52 -60
  61. package/build/routes/mcp.js +49 -177
  62. package/build/routes/namespaces.js +9 -20
  63. package/build/routes/roles.js +23 -97
  64. package/build/routes/settings.js +37 -25
  65. package/build/routes/tasks.js +28 -64
  66. package/build/routes/users.js +24 -113
  67. package/build/routes/workflow-sets.d.ts +2 -0
  68. package/build/routes/workflow-sets.js +98 -0
  69. package/build/routes/workflows/config.js +23 -57
  70. package/build/routes/workflows/discovery.js +11 -85
  71. package/build/routes/workflows/invocation.js +16 -84
  72. package/build/routes/yaml-workflows/cron.js +12 -61
  73. package/build/routes/yaml-workflows/crud.js +30 -223
  74. package/build/routes/yaml-workflows/deployment.js +15 -115
  75. package/build/routes/yaml-workflows/versions.js +20 -58
  76. package/build/sdk/index.d.ts +327 -0
  77. package/build/sdk/index.js +298 -0
  78. package/build/services/controlplane/index.d.ts +1 -2
  79. package/build/services/controlplane/index.js +3 -3
  80. package/build/services/controlplane/sql.d.ts +2 -2
  81. package/build/services/controlplane/sql.js +4 -5
  82. package/build/services/controlplane/types.d.ts +1 -0
  83. package/build/services/export/index.js +6 -1
  84. package/build/services/hotmesh-utils.js +2 -4
  85. package/build/services/insight/index.d.ts +7 -0
  86. package/build/services/insight/index.js +30 -0
  87. package/build/services/mcp/client/tools.js +13 -1
  88. package/build/services/mcp-runs/sql.js +1 -1
  89. package/build/services/workflow-sets/db.d.ts +16 -0
  90. package/build/services/workflow-sets/db.js +78 -0
  91. package/build/services/workflow-sets/index.d.ts +1 -0
  92. package/build/services/workflow-sets/index.js +11 -0
  93. package/build/services/workflow-sets/sql.d.ts +6 -0
  94. package/build/services/workflow-sets/sql.js +24 -0
  95. package/build/services/yaml-workflow/db-utils.d.ts +1 -0
  96. package/build/services/yaml-workflow/db-utils.js +4 -0
  97. package/build/services/yaml-workflow/db.d.ts +5 -0
  98. package/build/services/yaml-workflow/db.js +17 -0
  99. package/build/services/yaml-workflow/pipeline/build/wiring.js +14 -1
  100. package/build/services/yaml-workflow/pipeline/prompts.d.ts +1 -1
  101. package/build/services/yaml-workflow/pipeline/prompts.js +1 -1
  102. package/build/services/yaml-workflow/sql.d.ts +2 -1
  103. package/build/services/yaml-workflow/sql.js +8 -3
  104. package/build/services/yaml-workflow/types.d.ts +3 -0
  105. package/build/services/yaml-workflow/workers/callbacks.js +7 -1
  106. package/build/services/yaml-workflow/workers/register.js +7 -0
  107. package/build/start/adapters.js +4 -0
  108. package/build/system/index.js +6 -0
  109. package/build/system/mcp-servers/knowledge.js +1 -1
  110. package/build/system/seed/server-definitions.js +2 -1
  111. package/build/system/workflows/mcp-workflow-builder/activities/index.d.ts +1 -1
  112. package/build/system/workflows/mcp-workflow-builder/activities/index.js +2 -1
  113. package/build/system/workflows/mcp-workflow-builder/activities/tool-loader.d.ts +6 -0
  114. package/build/system/workflows/mcp-workflow-builder/activities/tool-loader.js +26 -0
  115. package/build/system/workflows/mcp-workflow-builder/index.js +26 -2
  116. package/build/system/workflows/mcp-workflow-builder/prompts.js +104 -35
  117. package/build/system/workflows/mcp-workflow-planner/activities/analyze.d.ts +11 -0
  118. package/build/system/workflows/mcp-workflow-planner/activities/analyze.js +36 -0
  119. package/build/system/workflows/mcp-workflow-planner/activities/index.d.ts +3 -0
  120. package/build/system/workflows/mcp-workflow-planner/activities/index.js +12 -0
  121. package/build/system/workflows/mcp-workflow-planner/activities/persist.d.ts +19 -0
  122. package/build/system/workflows/mcp-workflow-planner/activities/persist.js +55 -0
  123. package/build/system/workflows/mcp-workflow-planner/activities/plan.d.ts +10 -0
  124. package/build/system/workflows/mcp-workflow-planner/activities/plan.js +43 -0
  125. package/build/system/workflows/mcp-workflow-planner/index.d.ts +7 -0
  126. package/build/system/workflows/mcp-workflow-planner/index.js +152 -0
  127. package/build/system/workflows/mcp-workflow-planner/prompts.d.ts +7 -0
  128. package/build/system/workflows/mcp-workflow-planner/prompts.js +77 -0
  129. package/build/tsconfig.tsbuildinfo +1 -1
  130. package/build/types/index.d.ts +1 -0
  131. package/build/types/sdk.d.ts +27 -0
  132. package/build/types/sdk.js +2 -0
  133. package/build/types/workflow-set.d.ts +44 -0
  134. package/build/types/workflow-set.js +5 -0
  135. package/dashboard/dist/assets/{AdminDashboard-BXkKGkb5.js → AdminDashboard-DRjkRSjJ.js} +2 -2
  136. package/dashboard/dist/assets/{AdminDashboard-BXkKGkb5.js.map → AdminDashboard-DRjkRSjJ.js.map} +1 -1
  137. package/dashboard/dist/assets/{AvailableEscalationsPage-DcH592mc.js → AvailableEscalationsPage-CnivX4Tz.js} +2 -2
  138. package/dashboard/dist/assets/{AvailableEscalationsPage-DcH592mc.js.map → AvailableEscalationsPage-CnivX4Tz.js.map} +1 -1
  139. package/dashboard/dist/assets/BotPicker-DwwaBhTH.js +2 -0
  140. package/dashboard/dist/assets/{BotPicker-A6LtzyuO.js.map → BotPicker-DwwaBhTH.js.map} +1 -1
  141. package/dashboard/dist/assets/{CollapsibleSection-C7nL2_mv.js → CollapsibleSection-DQpaVA0M.js} +2 -2
  142. package/dashboard/dist/assets/{CollapsibleSection-C7nL2_mv.js.map → CollapsibleSection-DQpaVA0M.js.map} +1 -1
  143. package/dashboard/dist/assets/{ConfirmDeleteModal-CWFwJrSl.js → ConfirmDeleteModal-B7JoDNvt.js} +2 -2
  144. package/dashboard/dist/assets/{ConfirmDeleteModal-CWFwJrSl.js.map → ConfirmDeleteModal-B7JoDNvt.js.map} +1 -1
  145. package/dashboard/dist/assets/{CopyableId-DbZ5c3jh.js → CopyableId-AqoZayBG.js} +2 -2
  146. package/dashboard/dist/assets/{CopyableId-DbZ5c3jh.js.map → CopyableId-AqoZayBG.js.map} +1 -1
  147. package/dashboard/dist/assets/{CredentialsPage-ClWkmLPu.js → CredentialsPage-qGw1kQzi.js} +2 -2
  148. package/dashboard/dist/assets/{CredentialsPage-ClWkmLPu.js.map → CredentialsPage-qGw1kQzi.js.map} +1 -1
  149. package/dashboard/dist/assets/{CustomDurationPicker-CtH2hReF.js → CustomDurationPicker-D1HUQcd0.js} +2 -2
  150. package/dashboard/dist/assets/{CustomDurationPicker-CtH2hReF.js.map → CustomDurationPicker-D1HUQcd0.js.map} +1 -1
  151. package/dashboard/dist/assets/{DataTable-CM5ZcpPi.js → DataTable-DKvSKoVG.js} +2 -2
  152. package/dashboard/dist/assets/{DataTable-CM5ZcpPi.js.map → DataTable-DKvSKoVG.js.map} +1 -1
  153. package/dashboard/dist/assets/{ElapsedCell-CwqavyeC.js → ElapsedCell-B0yrReGQ.js} +2 -2
  154. package/dashboard/dist/assets/{ElapsedCell-CwqavyeC.js.map → ElapsedCell-B0yrReGQ.js.map} +1 -1
  155. package/dashboard/dist/assets/{EmptyState-BBn78pmm.js → EmptyState-X0fIzYID.js} +2 -2
  156. package/dashboard/dist/assets/{EmptyState-BBn78pmm.js.map → EmptyState-X0fIzYID.js.map} +1 -1
  157. package/dashboard/dist/assets/{EscalationsOverview-BcJ2E3X7.js → EscalationsOverview-BQAT9W7r.js} +2 -2
  158. package/dashboard/dist/assets/{EscalationsOverview-BcJ2E3X7.js.map → EscalationsOverview-BQAT9W7r.js.map} +1 -1
  159. package/dashboard/dist/assets/{EventTable-C1en_KZ0.js → EventTable-CX1KNLhZ.js} +2 -2
  160. package/dashboard/dist/assets/{EventTable-C1en_KZ0.js.map → EventTable-CX1KNLhZ.js.map} +1 -1
  161. package/dashboard/dist/assets/{FilterBar-CZTlrLQT.js → FilterBar-DMTvuQy-.js} +2 -2
  162. package/dashboard/dist/assets/{FilterBar-CZTlrLQT.js.map → FilterBar-DMTvuQy-.js.map} +1 -1
  163. package/dashboard/dist/assets/{ListToolbar-Cdbsapig.js → ListToolbar-DTOSxoEy.js} +2 -2
  164. package/dashboard/dist/assets/{ListToolbar-Cdbsapig.js.map → ListToolbar-DTOSxoEy.js.map} +1 -1
  165. package/dashboard/dist/assets/{McpOverview-CSpEJxKa.js → McpOverview-BaKTIWrG.js} +2 -2
  166. package/dashboard/dist/assets/{McpOverview-CSpEJxKa.js.map → McpOverview-BaKTIWrG.js.map} +1 -1
  167. package/dashboard/dist/assets/McpQueryDetailPage-CC08T5k8.js +5 -0
  168. package/dashboard/dist/assets/McpQueryDetailPage-CC08T5k8.js.map +1 -0
  169. package/dashboard/dist/assets/McpQueryPage-CVfF9dYg.js +2 -0
  170. package/dashboard/dist/assets/McpQueryPage-CVfF9dYg.js.map +1 -0
  171. package/dashboard/dist/assets/{McpRunDetailPage-9xdxgG4d.js → McpRunDetailPage-CKs1RWeV.js} +2 -2
  172. package/dashboard/dist/assets/{McpRunDetailPage-9xdxgG4d.js.map → McpRunDetailPage-CKs1RWeV.js.map} +1 -1
  173. package/dashboard/dist/assets/{McpRunsPage-wWLqHsd4.js → McpRunsPage-CcPD_tY1.js} +2 -2
  174. package/dashboard/dist/assets/{McpRunsPage-wWLqHsd4.js.map → McpRunsPage-CcPD_tY1.js.map} +1 -1
  175. package/dashboard/dist/assets/{Modal-kB_P7ZOr.js → Modal-_2AbWxJT.js} +2 -2
  176. package/dashboard/dist/assets/{Modal-kB_P7ZOr.js.map → Modal-_2AbWxJT.js.map} +1 -1
  177. package/dashboard/dist/assets/OperatorDashboard-BGiRaRDr.js +2 -0
  178. package/dashboard/dist/assets/{OperatorDashboard-jc0vrgDI.js.map → OperatorDashboard-BGiRaRDr.js.map} +1 -1
  179. package/dashboard/dist/assets/{PageHeader-NkOeBR05.js → PageHeader-DVr5Qyzm.js} +2 -2
  180. package/dashboard/dist/assets/{PageHeader-NkOeBR05.js.map → PageHeader-DVr5Qyzm.js.map} +1 -1
  181. package/dashboard/dist/assets/{PageHeaderWithStats-ywNhrmFK.js → PageHeaderWithStats-D0KRASML.js} +2 -2
  182. package/dashboard/dist/assets/{PageHeaderWithStats-ywNhrmFK.js.map → PageHeaderWithStats-D0KRASML.js.map} +1 -1
  183. package/dashboard/dist/assets/{PriorityBadge-B2MQbSxy.js → PriorityBadge-Bx2559OU.js} +2 -2
  184. package/dashboard/dist/assets/{PriorityBadge-B2MQbSxy.js.map → PriorityBadge-Bx2559OU.js.map} +1 -1
  185. package/dashboard/dist/assets/{ProcessDetailPage-B7z7IdqE.js → ProcessDetailPage-69I--sry.js} +2 -2
  186. package/dashboard/dist/assets/{ProcessDetailPage-B7z7IdqE.js.map → ProcessDetailPage-69I--sry.js.map} +1 -1
  187. package/dashboard/dist/assets/{ProcessesListPage-C-uHadO6.js → ProcessesListPage-BDpUbua2.js} +2 -2
  188. package/dashboard/dist/assets/{ProcessesListPage-C-uHadO6.js.map → ProcessesListPage-BDpUbua2.js.map} +1 -1
  189. package/dashboard/dist/assets/{RolePill-C1dgC-fK.js → RolePill-CcAqEaSt.js} +2 -2
  190. package/dashboard/dist/assets/{RolePill-C1dgC-fK.js.map → RolePill-CcAqEaSt.js.map} +1 -1
  191. package/dashboard/dist/assets/{RolesPage-BSxrD1vm.js → RolesPage-Cl23Hjet.js} +2 -2
  192. package/dashboard/dist/assets/{RolesPage-BSxrD1vm.js.map → RolesPage-Cl23Hjet.js.map} +1 -1
  193. package/dashboard/dist/assets/{RowActions-lYaHGI-v.js → RowActions-B4mqIt3Z.js} +2 -2
  194. package/dashboard/dist/assets/{RowActions-lYaHGI-v.js.map → RowActions-B4mqIt3Z.js.map} +1 -1
  195. package/dashboard/dist/assets/{StatCard-v2TiITVr.js → StatCard-Cz_2OjAZ.js} +2 -2
  196. package/dashboard/dist/assets/{StatCard-v2TiITVr.js.map → StatCard-Cz_2OjAZ.js.map} +1 -1
  197. package/dashboard/dist/assets/{StatusBadge-DWlxevgG.js → StatusBadge-Wi2FJZsn.js} +2 -2
  198. package/dashboard/dist/assets/{StatusBadge-DWlxevgG.js.map → StatusBadge-Wi2FJZsn.js.map} +1 -1
  199. package/dashboard/dist/assets/{StepIndicator-CRM4ft28.js → StepIndicator-PW5NRDMb.js} +2 -2
  200. package/dashboard/dist/assets/{StepIndicator-CRM4ft28.js.map → StepIndicator-PW5NRDMb.js.map} +1 -1
  201. package/dashboard/dist/assets/{StickyPagination-CF0EToEU.js → StickyPagination-Bl2Uzz65.js} +2 -2
  202. package/dashboard/dist/assets/{StickyPagination-CF0EToEU.js.map → StickyPagination-Bl2Uzz65.js.map} +1 -1
  203. package/dashboard/dist/assets/{SwimlaneTimeline-CNlj7fgg.js → SwimlaneTimeline-CUPqMd0z.js} +2 -2
  204. package/dashboard/dist/assets/{SwimlaneTimeline-CNlj7fgg.js.map → SwimlaneTimeline-CUPqMd0z.js.map} +1 -1
  205. package/dashboard/dist/assets/{TagInput-CH8qMGhC.js → TagInput-BLtf86Ly.js} +2 -2
  206. package/dashboard/dist/assets/{TagInput-CH8qMGhC.js.map → TagInput-BLtf86Ly.js.map} +1 -1
  207. package/dashboard/dist/assets/{TaskDetailPage-CdWo-6mu.js → TaskDetailPage-BXJFX74D.js} +2 -2
  208. package/dashboard/dist/assets/{TaskDetailPage-CdWo-6mu.js.map → TaskDetailPage-BXJFX74D.js.map} +1 -1
  209. package/dashboard/dist/assets/{TaskQueuePill-BPj4ogVG.js → TaskQueuePill-CWYj3xKe.js} +2 -2
  210. package/dashboard/dist/assets/{TaskQueuePill-BPj4ogVG.js.map → TaskQueuePill-CWYj3xKe.js.map} +1 -1
  211. package/dashboard/dist/assets/{TasksListPage-CtRkMpKU.js → TasksListPage-C3cX94Mw.js} +2 -2
  212. package/dashboard/dist/assets/{TasksListPage-CtRkMpKU.js.map → TasksListPage-C3cX94Mw.js.map} +1 -1
  213. package/dashboard/dist/assets/{TimeAgo-Di1a3X5P.js → TimeAgo-B_5yDDHV.js} +2 -2
  214. package/dashboard/dist/assets/{TimeAgo-Di1a3X5P.js.map → TimeAgo-B_5yDDHV.js.map} +1 -1
  215. package/dashboard/dist/assets/{TimestampCell-CqrXql-S.js → TimestampCell-DRX724uU.js} +2 -2
  216. package/dashboard/dist/assets/{TimestampCell-CqrXql-S.js.map → TimestampCell-DRX724uU.js.map} +1 -1
  217. package/dashboard/dist/assets/{UserName-BUFYCnRa.js → UserName-Ca8FA469.js} +2 -2
  218. package/dashboard/dist/assets/{UserName-BUFYCnRa.js.map → UserName-Ca8FA469.js.map} +1 -1
  219. package/dashboard/dist/assets/{WorkflowExecutionPage-25iusMml.js → WorkflowExecutionPage-BBYWEV2P.js} +2 -2
  220. package/dashboard/dist/assets/{WorkflowExecutionPage-25iusMml.js.map → WorkflowExecutionPage-BBYWEV2P.js.map} +1 -1
  221. package/dashboard/dist/assets/WorkflowPill-BXifAuLi.js +2 -0
  222. package/dashboard/dist/assets/{WorkflowPill-DPKOcbf4.js.map → WorkflowPill-BXifAuLi.js.map} +1 -1
  223. package/dashboard/dist/assets/{WorkflowsDashboard-BgxslssH.js → WorkflowsDashboard-Drl3juz9.js} +2 -2
  224. package/dashboard/dist/assets/{WorkflowsDashboard-BgxslssH.js.map → WorkflowsDashboard-Drl3juz9.js.map} +1 -1
  225. package/dashboard/dist/assets/{WorkflowsOverview-Doe5L-Re.js → WorkflowsOverview-03IRrDLg.js} +2 -2
  226. package/dashboard/dist/assets/{WorkflowsOverview-Doe5L-Re.js.map → WorkflowsOverview-03IRrDLg.js.map} +1 -1
  227. package/dashboard/dist/assets/YamlWorkflowsPage-DC2cLxVi.js +2 -0
  228. package/dashboard/dist/assets/YamlWorkflowsPage-DC2cLxVi.js.map +1 -0
  229. package/dashboard/dist/assets/{bots-Bi2_O1Ts.js → bots-DZEXcgiJ.js} +2 -2
  230. package/dashboard/dist/assets/{bots-Bi2_O1Ts.js.map → bots-DZEXcgiJ.js.map} +1 -1
  231. package/dashboard/dist/assets/{escalation-Ck1KlLkT.js → escalation-Cw48lNaF.js} +2 -2
  232. package/dashboard/dist/assets/{escalation-Ck1KlLkT.js.map → escalation-Cw48lNaF.js.map} +1 -1
  233. package/dashboard/dist/assets/{escalation-columns-ohDsj2eJ.js → escalation-columns-NINpo3qf.js} +2 -2
  234. package/dashboard/dist/assets/{escalation-columns-ohDsj2eJ.js.map → escalation-columns-NINpo3qf.js.map} +1 -1
  235. package/dashboard/dist/assets/helpers-Cuu3xKfr.js +2 -0
  236. package/dashboard/dist/assets/helpers-Cuu3xKfr.js.map +1 -0
  237. package/dashboard/dist/assets/{helpers-BoD2SgUY.js → helpers-fk_qr729.js} +2 -2
  238. package/dashboard/dist/assets/{helpers-BoD2SgUY.js.map → helpers-fk_qr729.js.map} +1 -1
  239. package/dashboard/dist/assets/index-B98ipWxE.js +2 -0
  240. package/dashboard/dist/assets/{index-D7zYZOnH.js.map → index-B98ipWxE.js.map} +1 -1
  241. package/dashboard/dist/assets/{index-BEtLIsML.js → index-BIG3KooI.js} +2 -2
  242. package/dashboard/dist/assets/{index-BEtLIsML.js.map → index-BIG3KooI.js.map} +1 -1
  243. package/dashboard/dist/assets/{index-DYyLF-Qb.js → index-BwN3KP_L.js} +5 -5
  244. package/dashboard/dist/assets/{index-DYyLF-Qb.js.map → index-BwN3KP_L.js.map} +1 -1
  245. package/dashboard/dist/assets/index-Bxe8h1x4.js +17 -0
  246. package/dashboard/dist/assets/{index-DOkHXmyf.js.map → index-Bxe8h1x4.js.map} +1 -1
  247. package/dashboard/dist/assets/{index-FuohTtaM.js → index-CNI7k7oB.js} +3 -3
  248. package/dashboard/dist/assets/{index-FuohTtaM.js.map → index-CNI7k7oB.js.map} +1 -1
  249. package/dashboard/dist/assets/{index-CZrJ09p-.js → index-CORHB0WC.js} +2 -2
  250. package/dashboard/dist/assets/{index-CZrJ09p-.js.map → index-CORHB0WC.js.map} +1 -1
  251. package/dashboard/dist/assets/{index-PyCTS05D.css → index-DcIKW-cZ.css} +1 -1
  252. package/dashboard/dist/assets/{index-D3NyVADW.js → index-Dj-z-x8M.js} +2 -2
  253. package/dashboard/dist/assets/index-Dj-z-x8M.js.map +1 -0
  254. package/dashboard/dist/assets/{index-Bn2xHDr8.js → index-DwRytW9O.js} +3 -3
  255. package/dashboard/dist/assets/{index-Bn2xHDr8.js.map → index-DwRytW9O.js.map} +1 -1
  256. package/dashboard/dist/assets/index-aRvL-dXp.js +2 -0
  257. package/dashboard/dist/assets/{index-Dk2Q51o0.js.map → index-aRvL-dXp.js.map} +1 -1
  258. package/dashboard/dist/assets/index-b03HlbnH.js +2 -0
  259. package/dashboard/dist/assets/{index-BpT-6WgJ.js.map → index-b03HlbnH.js.map} +1 -1
  260. package/dashboard/dist/assets/{mcp-CJtYjA7A.js → mcp-BZoFryNc.js} +2 -2
  261. package/dashboard/dist/assets/{mcp-CJtYjA7A.js.map → mcp-BZoFryNc.js.map} +1 -1
  262. package/dashboard/dist/assets/mcp-query-wiw1kwm8.js +2 -0
  263. package/dashboard/dist/assets/mcp-query-wiw1kwm8.js.map +1 -0
  264. package/dashboard/dist/assets/{mcp-runs-DUWm9Z4V.js → mcp-runs-BaEKnf5v.js} +2 -2
  265. package/dashboard/dist/assets/{mcp-runs-DUWm9Z4V.js.map → mcp-runs-BaEKnf5v.js.map} +1 -1
  266. package/dashboard/dist/assets/{namespaces-BM5P2qmL.js → namespaces-BwnZI4_A.js} +2 -2
  267. package/dashboard/dist/assets/{namespaces-BM5P2qmL.js.map → namespaces-BwnZI4_A.js.map} +1 -1
  268. package/dashboard/dist/assets/{roles-lv0shpjJ.js → roles-Bgn1K8zU.js} +2 -2
  269. package/dashboard/dist/assets/{roles-lv0shpjJ.js.map → roles-Bgn1K8zU.js.map} +1 -1
  270. package/dashboard/dist/assets/{settings-Wlq92mRo.js → settings-CizYiutL.js} +2 -2
  271. package/dashboard/dist/assets/{settings-Wlq92mRo.js.map → settings-CizYiutL.js.map} +1 -1
  272. package/dashboard/dist/assets/{tasks-BFGm4PuE.js → tasks-Bmte_hc4.js} +2 -2
  273. package/dashboard/dist/assets/{tasks-BFGm4PuE.js.map → tasks-Bmte_hc4.js.map} +1 -1
  274. package/dashboard/dist/assets/{useEventHooks-DIE6ue4x.js → useEventHooks-CUCxpiI2.js} +2 -2
  275. package/dashboard/dist/assets/{useEventHooks-DIE6ue4x.js.map → useEventHooks-CUCxpiI2.js.map} +1 -1
  276. package/dashboard/dist/assets/{useYamlActivityEvents-DCwSO73t.js → useYamlActivityEvents-Cum02Ej9.js} +2 -2
  277. package/dashboard/dist/assets/{useYamlActivityEvents-DCwSO73t.js.map → useYamlActivityEvents-Cum02Ej9.js.map} +1 -1
  278. package/dashboard/dist/assets/{users-tA5-K0wA.js → users-NSDgTt-z.js} +2 -2
  279. package/dashboard/dist/assets/{users-tA5-K0wA.js.map → users-NSDgTt-z.js.map} +1 -1
  280. package/dashboard/dist/assets/{vendor-icons-BiIug1SK.js → vendor-icons-D1DdudfH.js} +93 -73
  281. package/dashboard/dist/assets/vendor-icons-D1DdudfH.js.map +1 -0
  282. package/dashboard/dist/assets/{workflows-CfLc15Wr.js → workflows-k0XRdGXx.js} +2 -2
  283. package/dashboard/dist/assets/{workflows-CfLc15Wr.js.map → workflows-k0XRdGXx.js.map} +1 -1
  284. package/dashboard/dist/assets/yaml-workflows-DAre8I78.js +2 -0
  285. package/dashboard/dist/assets/yaml-workflows-DAre8I78.js.map +1 -0
  286. package/dashboard/dist/index.html +3 -3
  287. package/docs/epic-integration.md +224 -0
  288. package/docs/events.md +28 -0
  289. package/docs/sdk.md +177 -0
  290. package/docs/story.md +157 -0
  291. package/docs/workflow-builder.md +371 -0
  292. package/package.json +3 -2
  293. package/build/routes/escalations/helpers.d.ts +0 -5
  294. package/build/routes/resolve.d.ts +0 -9
  295. package/build/routes/resolve.js +0 -19
  296. package/build/routes/yaml-workflows/helpers.d.ts +0 -2
  297. package/build/routes/yaml-workflows/helpers.js +0 -8
  298. package/dashboard/dist/assets/BotPicker-A6LtzyuO.js +0 -2
  299. package/dashboard/dist/assets/McpQueryDetailPage-DhqEI180.js +0 -5
  300. package/dashboard/dist/assets/McpQueryDetailPage-DhqEI180.js.map +0 -1
  301. package/dashboard/dist/assets/McpQueryPage-CIiVMlqo.js +0 -2
  302. package/dashboard/dist/assets/McpQueryPage-CIiVMlqo.js.map +0 -1
  303. package/dashboard/dist/assets/OperatorDashboard-jc0vrgDI.js +0 -2
  304. package/dashboard/dist/assets/RunAsSelector-CJDnyp93.js +0 -2
  305. package/dashboard/dist/assets/RunAsSelector-CJDnyp93.js.map +0 -1
  306. package/dashboard/dist/assets/WorkflowPill-DPKOcbf4.js +0 -2
  307. package/dashboard/dist/assets/YamlWorkflowsPage-BliAckJ6.js +0 -2
  308. package/dashboard/dist/assets/YamlWorkflowsPage-BliAckJ6.js.map +0 -1
  309. package/dashboard/dist/assets/index-BpT-6WgJ.js +0 -2
  310. package/dashboard/dist/assets/index-D3NyVADW.js.map +0 -1
  311. package/dashboard/dist/assets/index-D7zYZOnH.js +0 -2
  312. package/dashboard/dist/assets/index-DOkHXmyf.js +0 -17
  313. package/dashboard/dist/assets/index-Dk2Q51o0.js +0 -2
  314. package/dashboard/dist/assets/mcp-query-jQJQrs_7.js +0 -2
  315. package/dashboard/dist/assets/mcp-query-jQJQrs_7.js.map +0 -1
  316. package/dashboard/dist/assets/vendor-icons-BiIug1SK.js.map +0 -1
  317. package/dashboard/dist/assets/yaml-workflows-D7JXNqbM.js +0 -2
  318. package/dashboard/dist/assets/yaml-workflows-D7JXNqbM.js.map +0 -1
  319. package/docs/img/01-login.png +0 -0
  320. package/docs/img/02-dashboard-home.png +0 -0
  321. package/docs/img/03-processes-list.png +0 -0
  322. package/docs/img/04-escalations-list.png +0 -0
  323. package/docs/img/05-mcp-servers.png +0 -0
  324. package/docs/img/06-mcp-pipelines.png +0 -0
  325. package/docs/img/07-workflows-list.png +0 -0
  326. package/docs/img/compilation/01-query-submit.png +0 -0
  327. package/docs/img/compilation/02-mcp-servers.png +0 -0
  328. package/docs/img/compilation/03-query-completed.png +0 -0
  329. package/docs/img/compilation/04-wizard-original.png +0 -0
  330. package/docs/img/compilation/05-wizard-timeline.png +0 -0
  331. package/docs/img/compilation/06-wizard-profile.png +0 -0
  332. package/docs/img/compilation/07-wizard-deploy.png +0 -0
  333. package/docs/img/compilation/08-wizard-test-modal.png +0 -0
  334. package/docs/img/compilation/09-wizard-test-compare.png +0 -0
  335. package/docs/img/compilation/10-wizard-verify.png +0 -0
package/docs/events.md CHANGED
@@ -133,6 +133,34 @@ await eventRegistry.connect();
133
133
 
134
134
  On disconnect, the adapter calls `drain()` on the NATS connection, ensuring in-flight publishes complete before closing.
135
135
 
136
+ ## Callback Adapter
137
+
138
+ `CallbackEventAdapter` delivers events via registered callbacks. Use it when Long Tail runs as an embedded package and you want event subscriptions without socket.io or NATS.
139
+
140
+ ```typescript
141
+ import { eventRegistry, CallbackEventAdapter } from '@hotmeshio/long-tail';
142
+
143
+ const adapter = new CallbackEventAdapter();
144
+ eventRegistry.register(adapter);
145
+ await adapter.connect();
146
+
147
+ // Exact match
148
+ const unsub = adapter.on('escalation.claimed', (event) => {
149
+ console.log('claimed:', event.escalationId);
150
+ });
151
+
152
+ // Category wildcard — matches all task.* events
153
+ adapter.on('task.*', (event) => { ... });
154
+
155
+ // Global wildcard
156
+ adapter.on('*', (event) => { ... });
157
+
158
+ // Unsubscribe
159
+ unsub();
160
+ ```
161
+
162
+ The adapter is registered automatically by `start()`. If you use `createClient()`, the SDK exposes it as `lt.events.on()` — see the [SDK guide](sdk.md) for details.
163
+
136
164
  ## In-Memory Adapter
137
165
 
138
166
  `InMemoryEventAdapter` captures events in an array. It exists for testing.
package/docs/sdk.md ADDED
@@ -0,0 +1,177 @@
1
+ # SDK
2
+
3
+ Long Tail exposes its full API as an in-process SDK. Every operation available through the REST API can be called directly as a function — same validation, same RBAC, same event publishing — without HTTP transport overhead.
4
+
5
+ Use the SDK when Long Tail runs as an embedded package inside your own application (NestJS, Next.js, Express, or any Node.js process). The HTTP server, socket.io, and dashboard are optional — disable them and call the SDK directly.
6
+
7
+ ## Setup
8
+
9
+ ```typescript
10
+ import { start, createClient } from '@hotmeshio/long-tail';
11
+
12
+ // Start without HTTP server
13
+ await start({
14
+ database: { connectionString: process.env.DATABASE_URL },
15
+ server: { enabled: false },
16
+ workers: [{ taskQueue: 'default', workflow: myWorkflow.handler }],
17
+ });
18
+
19
+ // Create a client with a default auth context
20
+ const lt = createClient({ auth: { userId: 'my-service' } });
21
+ ```
22
+
23
+ The `auth` context binds to every call that requires it. Override per-call when needed:
24
+
25
+ ```typescript
26
+ // Uses the default auth ('my-service')
27
+ await lt.escalations.list({ status: 'pending' });
28
+
29
+ // Override for a specific call
30
+ await lt.escalations.claim({ id: 'esc_123' }, { userId: 'user-456' });
31
+ ```
32
+
33
+ ## LTApiResult
34
+
35
+ Every SDK call returns an `LTApiResult`:
36
+
37
+ ```typescript
38
+ interface LTApiResult<T = any> {
39
+ status: number; // HTTP-equivalent status code (200, 400, 403, 404, 409, 500)
40
+ data?: T; // Success payload (present when status is 2xx)
41
+ error?: string; // Error message (present when status is 4xx/5xx)
42
+ }
43
+ ```
44
+
45
+ Status codes follow the same semantics as the REST API. Check `result.status` to distinguish success from failure:
46
+
47
+ ```typescript
48
+ const result = await lt.tasks.get({ id: 'task-123' });
49
+
50
+ if (result.status === 200) {
51
+ console.log(result.data); // the task record
52
+ } else if (result.status === 404) {
53
+ console.log('not found');
54
+ } else {
55
+ console.error(result.error);
56
+ }
57
+ ```
58
+
59
+ ## API Namespaces
60
+
61
+ The client mirrors the REST route structure:
62
+
63
+ | Namespace | REST equivalent | Key operations |
64
+ |-----------|----------------|----------------|
65
+ | `lt.tasks` | `/api/tasks` | `list`, `get`, `listProcesses`, `getProcess`, `getProcessStats` |
66
+ | `lt.escalations` | `/api/escalations` | `list`, `listAvailable`, `get`, `claim`, `release`, `resolve`, `escalate`, `bulkClaim`, `bulkAssign` |
67
+ | `lt.workflows` | `/api/workflows` | `invoke`, `getStatus`, `getResult`, `terminate`, `listWorkers`, `listDiscovered`, `listConfigs`, `getConfig`, `upsertConfig` |
68
+ | `lt.yamlWorkflows` | `/api/yaml-workflows` | `list`, `get`, `create`, `deploy`, `activate`, `invoke`, `archive` |
69
+ | `lt.users` | `/api/users` | `list`, `get`, `create`, `update`, `delete`, `getRoles`, `addRole`, `removeRole` |
70
+ | `lt.roles` | `/api/roles` | `list`, `listWithDetails`, `create`, `delete`, `getEscalationChains` |
71
+ | `lt.auth` | `/api/auth` | `login` |
72
+ | `lt.mcp` | `/api/mcp` | `listServers`, `createServer`, `getServer`, `connectServer`, `listTools`, `callTool` |
73
+ | `lt.mcpRuns` | `/api/mcp-runs` | `listEntities`, `listJobs`, `getExecution` |
74
+ | `lt.insight` | `/api/insight` | `mcpQuery`, `buildWorkflow`, `refineWorkflow`, `describeWorkflow` |
75
+ | `lt.exports` | `/api/workflow-states` | `listJobs`, `exportState`, `exportExecution`, `getStatus`, `getState` |
76
+ | `lt.controlplane` | `/api/controlplane` | `listApps`, `rollCall`, `throttle`, `getStreamStats` |
77
+ | `lt.botAccounts` | `/api/bot-accounts` | `list`, `get`, `create`, `update`, `delete`, `listKeys`, `createKey` |
78
+ | `lt.workflowSets` | `/api/workflow-sets` | `create`, `list`, `get`, `updatePlan`, `build`, `deploy` |
79
+ | `lt.settings` | `/api/settings` | `get` |
80
+ | `lt.dba` | `/api/dba` | `prune`, `deploy` |
81
+ | `lt.namespaces` | `/api/namespaces` | `list`, `register` |
82
+ | `lt.maintenance` | `/api/config/maintenance` | `getConfig`, `updateConfig` |
83
+
84
+ ## Events
85
+
86
+ The SDK includes a callback-based event adapter. Subscribe to events directly — no socket.io client, no WebSocket connection.
87
+
88
+ ```typescript
89
+ // Exact event type
90
+ const unsub = lt.events.on('escalation.claimed', (event) => {
91
+ console.log('claimed:', event.escalationId, 'by:', event.data?.assigned_to);
92
+ });
93
+
94
+ // Category wildcard — matches all task.* events
95
+ lt.events.on('task.*', (event) => {
96
+ metrics.increment(`task.${event.type}`);
97
+ });
98
+
99
+ // Global wildcard — every event
100
+ lt.events.on('*', (event) => {
101
+ auditLog.append(event);
102
+ });
103
+
104
+ // Unsubscribe when done
105
+ unsub();
106
+ ```
107
+
108
+ Events fire from the same publish calls that feed socket.io and NATS. The callback adapter runs in-process with zero serialization overhead. All event types documented in [Events](events.md) are available.
109
+
110
+ ### Event types
111
+
112
+ ```
113
+ task.created task.started task.completed task.escalated task.failed
114
+ escalation.created escalation.claimed escalation.released escalation.resolved
115
+ workflow.started workflow.completed workflow.failed
116
+ activity.started activity.completed activity.failed
117
+ milestone
118
+ ```
119
+
120
+ ## Running Alongside an HTTP Server
121
+
122
+ The SDK works whether or not the HTTP server is running. If your application already has its own Express/Fastify/Koa server, you can start Long Tail without its built-in server and expose routes however you like:
123
+
124
+ ```typescript
125
+ // Your NestJS controller
126
+ @Controller('workflows')
127
+ export class WorkflowController {
128
+ private lt = createClient({ auth: { userId: 'nest-service' } });
129
+
130
+ @Post(':type/invoke')
131
+ async invoke(@Param('type') type: string, @Body() body: any) {
132
+ return this.lt.workflows.invoke({ type, data: body.data });
133
+ }
134
+
135
+ @Get(':id/status')
136
+ async status(@Param('id') id: string) {
137
+ return this.lt.workflows.getStatus({ workflowId: id });
138
+ }
139
+ }
140
+ ```
141
+
142
+ ## CallbackEventAdapter
143
+
144
+ If you need lower-level control over event subscriptions, use the `CallbackEventAdapter` directly:
145
+
146
+ ```typescript
147
+ import { eventRegistry, CallbackEventAdapter } from '@hotmeshio/long-tail';
148
+
149
+ const adapter = new CallbackEventAdapter();
150
+ eventRegistry.register(adapter);
151
+ await adapter.connect();
152
+
153
+ // Subscribe
154
+ const unsub = adapter.on('task.completed', (event) => { ... });
155
+
156
+ // Unsubscribe
157
+ unsub();
158
+ ```
159
+
160
+ The `createClient()` function manages this automatically — you only need the adapter directly if you want event subscriptions without the full SDK client.
161
+
162
+ ## Mixing Transports
163
+
164
+ The event registry supports multiple adapters simultaneously. Events publish to all registered adapters in parallel:
165
+
166
+ ```typescript
167
+ await start({
168
+ database: { connectionString: process.env.DATABASE_URL },
169
+ server: { enabled: false },
170
+ events: { nats: { url: 'nats://localhost:4222' } }, // NATS for external consumers
171
+ });
172
+
173
+ const lt = createClient({ auth: { userId: 'system' } });
174
+
175
+ // In-process callbacks AND NATS — both receive every event
176
+ lt.events.on('task.*', handleTaskLocally);
177
+ ```
package/docs/story.md ADDED
@@ -0,0 +1,157 @@
1
+ # The Long Tail Story
2
+
3
+ ## Infrastructure That Learns
4
+
5
+ Most software you deploy stays exactly as capable as the day you shipped it. It doesn't get smarter. It doesn't absorb what your team knows. It runs the same logic on day one thousand that it ran on day one.
6
+
7
+ Long Tail is different. Every problem solved through it becomes a permanent capability. The first time, an LLM reasons through it. A human reviews the result. The system compiles the solution into a deterministic tool. The next occurrence runs without AI, without human intervention, without cost. The tool inventory grows. The need for reasoning shrinks. The system gets cheaper and more capable simultaneously.
8
+
9
+ This document walks through what happens when an organization adopts Long Tail, told from the perspective of what accumulates over time.
10
+
11
+ ---
12
+
13
+ ## The Starting Point
14
+
15
+ You have Postgres and a problem. Maybe it's content review, document processing, customer onboarding, incident response — any operational workflow where human judgment is currently the bottleneck.
16
+
17
+ You install the package, point it at your database, and start it up. The system creates its schema, registers the built-in MCP servers, and opens the dashboard. Two container types from one codebase: API servers serve the dashboard and REST endpoints; workers execute workflows. Both read from Postgres.
18
+
19
+ That's the entire infrastructure story. No message queues to configure. No object stores to provision. No separate orchestration service. Postgres is the durable execution engine, the tool registry, the escalation queue, and the audit log.
20
+
21
+ ---
22
+
23
+ ## The First Tool
24
+
25
+ The system ships with MCP servers for common capabilities: browser automation, file storage, document vision, database queries, HTTP requests. You can add your own — npm packages, remote services, custom TypeScript — and their tools immediately appear in the designer and compiler.
26
+
27
+ Open the MCP Tool Designer. Describe what you need in natural language:
28
+
29
+ > *"Screenshot every page in the admin panel and flag any that return errors."*
30
+
31
+ The system discovers the relevant tools across registered servers, plans the execution, and runs it. The browser server navigates pages. The vision server inspects screenshots. The file server stores results. Each step is a durable activity — if the process crashes mid-run, it resumes from the last completed step, not from the beginning.
32
+
33
+ The result lands in your dashboard: a structured output with screenshots, error flags, and metadata. It worked. But it cost tokens, took time, and required an LLM to reason through each step.
34
+
35
+ This is the dynamic path. It's powerful and flexible. It's also the most expensive way to run anything.
36
+
37
+ ---
38
+
39
+ ## The Compilation Moment
40
+
41
+ This is the pivot — the point where Long Tail stops being "an AI tool" and starts being infrastructure.
42
+
43
+ Open the compiler. It examines the execution trace from the dynamic run: which tools were called, in what order, with what arguments. It identifies what's dynamic (the URL, the credentials, the list of pages) versus what's fixed (the CSS selectors, the wait times, the error-detection logic). It produces a deterministic DAG — a directed acyclic graph that encodes the exact same workflow without any LLM reasoning.
44
+
45
+ Deploy it. It's now a tool — tagged, versioned, invocable. It has typed inputs and outputs. It runs in milliseconds instead of seconds. It costs nothing in API tokens. And it's just as reliable as the dynamic version, because it was extracted from a successful execution, not written by hand.
46
+
47
+ The compilation step is where operational knowledge crosses the boundary from tacit to executable. Before compilation, the knowledge of "how to screenshot admin pages and check for errors" lived in the LLM prompt and the human who wrote it. After compilation, it lives in the database as a versioned, deterministic tool that anyone — or any other workflow — can invoke.
48
+
49
+ ---
50
+
51
+ ## The Accumulation
52
+
53
+ Next week, someone describes a similar task. The router examines the request, searches the compiled tool registry by tags and capability descriptions, and finds a match. It extracts the parameters from the natural language request and routes directly to the compiled tool.
54
+
55
+ No LLM. No tokens. Sub-second execution.
56
+
57
+ The tool that was born from one person's request now serves the whole team. And it can be composed. Another workflow can call it as a step. The DAG that screenshots pages becomes an activity inside a larger workflow that audits, compares, and reports across environments.
58
+
59
+ This is the accumulation effect. Each compiled tool is both an endpoint and a building block. The library of tools grows monotonically — new compilations only add capabilities, never remove them. Workflows that compose multiple tools inherit the reliability and speed of each component.
60
+
61
+ Over time, the system develops a vocabulary of operations specific to your organization. Not generic "send HTTP request" primitives, but domain-specific tools like "audit staging environment" or "validate customer document against policy template." These are your operations, encoded in your database, reflecting your team's actual practices.
62
+
63
+ ---
64
+
65
+ ## The Long Tail
66
+
67
+ The name comes from the distribution of problems.
68
+
69
+ Most operational tasks converge to patterns. After a month of use, the common paths — the head of the distribution — are compiled. Content reviews follow templates. Document processing has known formats. Onboarding flows have standard steps. These run deterministically, cheaply, instantly.
70
+
71
+ What remains is the long tail: novel requests, edge cases, genuine unknowns. A document format nobody's seen before. An admin page with non-standard markup. A customer request that doesn't match any existing workflow.
72
+
73
+ For these, the dynamic path still runs. The LLM reasons through the problem with the full tool inventory available. When it succeeds, the solution is a candidate for compilation. The tail gets shorter.
74
+
75
+ When it fails — when the available tools can't solve the problem or the LLM's reasoning produces an incorrect result — the system escalates. RBAC-scoped chains route the problem to the right human based on the credentials, domain, and tool requirements involved. The human resolves it through the dashboard, with full context: what was attempted, what failed, and why.
76
+
77
+ If the resolution reveals a repeatable pattern, it compiles too. The escalation itself becomes the training data for the next compiled tool.
78
+
79
+ This is the dynamic the name describes: the long tail of problems that resist automation. Long Tail doesn't eliminate the tail. It systematically shortens it by converting each solved problem into a permanent, reusable capability.
80
+
81
+ ---
82
+
83
+ ## What You Own
84
+
85
+ Long Tail runs on your Postgres. This isn't a philosophical stance about data sovereignty — it's an architectural consequence of using durable execution backed by a database you control.
86
+
87
+ The compiled tools live in your database. The execution history lives in your database. The escalation patterns, the credential flows, the audit trail — all in your database. You can back it up, replicate it, query it with SQL, migrate it to another provider, or inspect it with any tool that speaks Postgres.
88
+
89
+ When the system compiles a workflow, that compiled DAG is a row in a table you own. When a team member resolves an escalation, that resolution is recorded in a schema you can read. The institutional knowledge that accumulates over months of use — the specific ways your organization handles its specific problems — never leaves your infrastructure.
90
+
91
+ This matters for a practical reason beyond principle. Operational knowledge is one of the few genuine competitive advantages an organization has. The specific patterns of how your team reviews content, processes documents, responds to incidents — these reflect hard-won expertise. Infrastructure that captures and encodes that expertise should store it where you control access, retention, and usage.
92
+
93
+ Two container types scale independently behind a load balancer. Add API servers for dashboard traffic. Add workers for execution throughput. Both connect to the same Postgres. There's no orchestration service to license, no execution platform to subscribe to, no vendor that accumulates your operational patterns as a side effect of providing the service.
94
+
95
+ ---
96
+
97
+ ## The Pluggable Platform
98
+
99
+ MCP servers are the extension mechanism. Each server registers a set of tools with typed inputs, outputs, and descriptive metadata. The system uses this metadata for discovery — both by the LLM during dynamic execution and by the router during compiled tool matching.
100
+
101
+ The built-in servers cover common ground: browser automation for web interaction, file storage for document handling, vision for image analysis, database queries for structured data, HTTP for external API integration. But the real power is in what you add.
102
+
103
+ Install an npm package that exposes an MCP server. Register it. Its tools are immediately available to the designer, the compiler, and the router. A server that wraps your internal API becomes a set of tools that workflows can compose. A server that connects to a third-party service extends the platform's reach without modifying any core code.
104
+
105
+ The LLM can even discover what's missing. If a dynamic execution fails because no available tool can perform a required step, the triage system surfaces the gap: "This workflow needs access to [capability] but no registered server provides it." Install the server, register the tools, and re-run. The platform grows in response to the problems it encounters.
106
+
107
+ Tags organize the tool space. Servers and tools carry tags that describe their domain and capabilities. The router uses tags to scope discovery — a database analytics query doesn't need to search browser automation tools. As the tool inventory grows, tags keep discovery focused and fast.
108
+
109
+ ---
110
+
111
+ ## The Three Execution Tiers
112
+
113
+ Every request flows through a routing decision:
114
+
115
+ **Deterministic.** A compiled tool matches the request. Parameters are extracted and the DAG executes directly. No LLM involved. Sub-second. Free.
116
+
117
+ **Dynamic.** No compiled tool matches, but the available tools can likely solve the problem. The LLM reasons through the execution, calling tools as needed. Durable — survives crashes and restarts. Successful runs are candidates for compilation.
118
+
119
+ **Escalation.** The dynamic path fails or the system determines it can't solve the problem autonomously. RBAC-scoped routing sends it to the right human with full context. The human resolves it through the dashboard. Resolutions that reveal patterns feed back into compilation.
120
+
121
+ The ratio shifts over time. Early on, most requests take the dynamic path. As compilations accumulate, more requests route deterministically. The escalation path handles a shrinking residual. The system is always getting cheaper and faster, with no manual optimization required.
122
+
123
+ ---
124
+
125
+ ## The Workflow Lifecycle
126
+
127
+ A workflow in Long Tail has a natural lifecycle:
128
+
129
+ **Born dynamic.** Someone describes a need. The LLM orchestrates tools to meet it. The execution is durable — each step is checkpointed in Postgres. If the worker crashes, it resumes from the last completed activity, not from scratch.
130
+
131
+ **Reviewed.** The result appears in the dashboard. A human confirms it's correct, flags issues, or provides corrections. This review step is optional but valuable — it's the quality gate that ensures compiled tools encode correct behavior.
132
+
133
+ **Compiled.** The successful execution trace is fed to the compiler. The compiler extracts the fixed structure, parameterizes the dynamic inputs, and produces a deterministic DAG. The DAG is deployed as a new tool with typed inputs, outputs, and tags.
134
+
135
+ **Composed.** The compiled tool becomes available as an activity for other workflows. A tool that validates a single document can be composed into a workflow that processes a batch. A tool that checks a single page can be composed into a site-wide audit. Composition is how individual capabilities combine into organizational processes.
136
+
137
+ **Evolved.** When the domain changes — new document formats, new page layouts, new policies — the compiled tool may start failing. Failures route to escalation. The human resolution captures the new pattern. A new compilation encodes the updated behavior. The old version remains available for rollback.
138
+
139
+ This lifecycle runs continuously. The system is always compiling, always accumulating, always refining. No migration projects. No "automation initiatives." Just a steady conversion of operational knowledge into executable tools.
140
+
141
+ ---
142
+
143
+ ## What You're Really Building
144
+
145
+ Long Tail isn't a workflow engine that happens to use AI. It's a **knowledge compiler** that uses workflows as the intermediate representation.
146
+
147
+ The input is human expertise and LLM reasoning — the tacit operational knowledge of how your team solves problems. The output is deterministic, versioned, composable tools that run without either.
148
+
149
+ Every organization has operational patterns that live in people's heads, in runbooks, in tribal knowledge, in the "ask Sarah, she knows how to handle that" moments. These patterns are valuable, fragile, and almost never systematically captured. When someone leaves, the knowledge leaves with them. When a team scales, the patterns dilute.
150
+
151
+ Long Tail is the machine that extracts those patterns and makes them executable. Not by asking people to document their processes — that rarely works and the documentation immediately drifts from reality. Instead, by observing how problems are actually solved, compiling the successful patterns, and deploying them as tools that anyone can invoke.
152
+
153
+ The LLM is scaffolding. It provides the initial reasoning capability that bridges the gap between "describe what you need" and "here's a working solution." But scaffolding is temporary by design. As compiled tools accumulate, the LLM handles less. The deterministic tools handle more. The system converges toward a state where the LLM is only needed for genuinely novel problems — the shrinking long tail.
154
+
155
+ The compiled tools are the building--the durable artifact. They're what remains after the LLM has done its work and moved on. They encode your organization's operational knowledge in a form that's versioned, testable, composable, and entirely under your control.
156
+
157
+ That's the Long Tail.