@hailer/mcp 1.2.1 → 2.0.0-beta.10

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 (768) hide show
  1. package/.claude/agents/agent-hailer-helper.md +118 -0
  2. package/.claude/commands/debug-squad.md +13 -290
  3. package/.claude/commands/publish.md +2 -2
  4. package/.claude/commands/review-squad.md +17 -139
  5. package/.claude/skills/create-and-publish-app/SKILL.md +119 -148
  6. package/.claude/skills/hailer-app-builder/SKILL.md +24 -2
  7. package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
  8. package/.env.example +50 -1
  9. package/CLAUDE.md +141 -10
  10. package/dist/app.d.ts.map +1 -1
  11. package/dist/app.js +3 -0
  12. package/dist/app.js.map +1 -1
  13. package/dist/bot/bot-manager.d.ts +9 -6
  14. package/dist/bot/bot-manager.d.ts.map +1 -1
  15. package/dist/bot/bot-manager.js +142 -31
  16. package/dist/bot/bot-manager.js.map +1 -1
  17. package/dist/bot/bot.d.ts +59 -16
  18. package/dist/bot/bot.d.ts.map +1 -1
  19. package/dist/bot/bot.js +889 -142
  20. package/dist/bot/bot.js.map +1 -1
  21. package/dist/bot/operation-logger.d.ts.map +1 -1
  22. package/dist/bot/operation-logger.js +24 -12
  23. package/dist/bot/operation-logger.js.map +1 -1
  24. package/dist/bot/services/bot-permissions.d.ts +2 -2
  25. package/dist/bot/services/bot-permissions.d.ts.map +1 -1
  26. package/dist/bot/services/bot-permissions.js +28 -9
  27. package/dist/bot/services/bot-permissions.js.map +1 -1
  28. package/dist/bot/services/conversation-manager.d.ts +23 -23
  29. package/dist/bot/services/conversation-manager.d.ts.map +1 -1
  30. package/dist/bot/services/conversation-manager.js +52 -49
  31. package/dist/bot/services/conversation-manager.js.map +1 -1
  32. package/dist/bot/services/helper-prompt.d.ts +8 -0
  33. package/dist/bot/services/helper-prompt.d.ts.map +1 -0
  34. package/dist/bot/services/helper-prompt.js +177 -0
  35. package/dist/bot/services/helper-prompt.js.map +1 -0
  36. package/dist/bot/services/message-classifier.d.ts +16 -16
  37. package/dist/bot/services/message-classifier.d.ts.map +1 -1
  38. package/dist/bot/services/message-classifier.js +55 -49
  39. package/dist/bot/services/message-classifier.js.map +1 -1
  40. package/dist/bot/services/message-formatter.d.ts +38 -38
  41. package/dist/bot/services/message-formatter.d.ts.map +1 -1
  42. package/dist/bot/services/message-formatter.js +81 -74
  43. package/dist/bot/services/message-formatter.js.map +1 -1
  44. package/dist/bot/services/permission-guard.d.ts.map +1 -1
  45. package/dist/bot/services/permission-guard.js +20 -10
  46. package/dist/bot/services/permission-guard.js.map +1 -1
  47. package/dist/bot/services/signal-router.d.ts.map +1 -1
  48. package/dist/bot/services/signal-router.js +11 -6
  49. package/dist/bot/services/signal-router.js.map +1 -1
  50. package/dist/bot/services/system-prompt.d.ts +14 -0
  51. package/dist/bot/services/system-prompt.d.ts.map +1 -1
  52. package/dist/bot/services/system-prompt.js +179 -4
  53. package/dist/bot/services/system-prompt.js.map +1 -1
  54. package/dist/bot/services/token-billing.d.ts +23 -23
  55. package/dist/bot/services/token-billing.d.ts.map +1 -1
  56. package/dist/bot/services/token-billing.js +51 -36
  57. package/dist/bot/services/token-billing.js.map +1 -1
  58. package/dist/bot/services/types.d.ts +3 -1
  59. package/dist/bot/services/types.d.ts.map +1 -1
  60. package/dist/bot/services/typing-indicator.d.ts +8 -8
  61. package/dist/bot/services/typing-indicator.d.ts.map +1 -1
  62. package/dist/bot/services/typing-indicator.js +12 -10
  63. package/dist/bot/services/typing-indicator.js.map +1 -1
  64. package/dist/bot/services/workspace-refresh.d.ts +3 -3
  65. package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
  66. package/dist/bot/services/workspace-refresh.js +23 -13
  67. package/dist/bot/services/workspace-refresh.js.map +1 -1
  68. package/dist/bot/tool-executor.d.ts +10 -6
  69. package/dist/bot/tool-executor.d.ts.map +1 -1
  70. package/dist/bot/tool-executor.js +12 -6
  71. package/dist/bot/tool-executor.js.map +1 -1
  72. package/dist/bot/workspace-overview.d.ts.map +1 -1
  73. package/dist/bot/workspace-overview.js +6 -3
  74. package/dist/bot/workspace-overview.js.map +1 -1
  75. package/dist/bot-config/activity-error.d.ts +47 -0
  76. package/dist/bot-config/activity-error.d.ts.map +1 -0
  77. package/dist/bot-config/activity-error.js +67 -0
  78. package/dist/bot-config/activity-error.js.map +1 -0
  79. package/dist/bot-config/context.d.ts +4 -4
  80. package/dist/bot-config/context.d.ts.map +1 -1
  81. package/dist/bot-config/context.js +18 -14
  82. package/dist/bot-config/context.js.map +1 -1
  83. package/dist/bot-config/events.d.ts +45 -0
  84. package/dist/bot-config/events.d.ts.map +1 -0
  85. package/dist/bot-config/events.js +51 -0
  86. package/dist/bot-config/events.js.map +1 -0
  87. package/dist/bot-config/index.d.ts +3 -0
  88. package/dist/bot-config/index.d.ts.map +1 -1
  89. package/dist/bot-config/index.js +8 -1
  90. package/dist/bot-config/index.js.map +1 -1
  91. package/dist/bot-config/loader.d.ts +3 -0
  92. package/dist/bot-config/loader.d.ts.map +1 -1
  93. package/dist/bot-config/loader.js +45 -20
  94. package/dist/bot-config/loader.js.map +1 -1
  95. package/dist/bot-config/persistence.js.map +1 -1
  96. package/dist/bot-config/reconciler.d.ts +11 -0
  97. package/dist/bot-config/reconciler.d.ts.map +1 -0
  98. package/dist/bot-config/reconciler.js +121 -0
  99. package/dist/bot-config/reconciler.js.map +1 -0
  100. package/dist/bot-config/state.d.ts.map +1 -1
  101. package/dist/bot-config/state.js.map +1 -1
  102. package/dist/bot-config/types.d.ts +32 -0
  103. package/dist/bot-config/types.d.ts.map +1 -1
  104. package/dist/bot-config/webhooks.d.ts.map +1 -1
  105. package/dist/bot-config/webhooks.js.map +1 -1
  106. package/dist/bot-config/workflow-installer.d.ts +37 -0
  107. package/dist/bot-config/workflow-installer.d.ts.map +1 -0
  108. package/dist/bot-config/workflow-installer.js +346 -0
  109. package/dist/bot-config/workflow-installer.js.map +1 -0
  110. package/dist/cli.d.ts.map +1 -1
  111. package/dist/cli.js +54 -0
  112. package/dist/cli.js.map +1 -1
  113. package/dist/config.d.ts +23 -19
  114. package/dist/config.d.ts.map +1 -1
  115. package/dist/config.js +65 -27
  116. package/dist/config.js.map +1 -1
  117. package/dist/core.d.ts +6 -4
  118. package/dist/core.d.ts.map +1 -1
  119. package/dist/core.js +11 -16
  120. package/dist/core.js.map +1 -1
  121. package/dist/lib/logger.d.ts.map +1 -1
  122. package/dist/lib/logger.js +7 -4
  123. package/dist/lib/logger.js.map +1 -1
  124. package/dist/lib/request-logger.d.ts +19 -19
  125. package/dist/lib/request-logger.d.ts.map +1 -1
  126. package/dist/lib/request-logger.js +19 -19
  127. package/dist/lib/request-logger.js.map +1 -1
  128. package/dist/mcp/UserContextCache.d.ts +28 -22
  129. package/dist/mcp/UserContextCache.d.ts.map +1 -1
  130. package/dist/mcp/UserContextCache.js +23 -23
  131. package/dist/mcp/UserContextCache.js.map +1 -1
  132. package/dist/mcp/auth.js.map +1 -1
  133. package/dist/mcp/hailer-clients.d.ts +5 -4
  134. package/dist/mcp/hailer-clients.d.ts.map +1 -1
  135. package/dist/mcp/hailer-clients.js +61 -27
  136. package/dist/mcp/hailer-clients.js.map +1 -1
  137. package/dist/mcp/hailer-rpc.d.ts +40 -0
  138. package/dist/mcp/hailer-rpc.d.ts.map +1 -0
  139. package/dist/mcp/hailer-rpc.js +43 -0
  140. package/dist/mcp/hailer-rpc.js.map +1 -0
  141. package/dist/mcp/publish-auth-injector.d.ts +22 -0
  142. package/dist/mcp/publish-auth-injector.d.ts.map +1 -0
  143. package/dist/mcp/publish-auth-injector.js +100 -0
  144. package/dist/mcp/publish-auth-injector.js.map +1 -0
  145. package/dist/mcp/session-store.d.ts +16 -16
  146. package/dist/mcp/session-store.d.ts.map +1 -1
  147. package/dist/mcp/session-store.js +16 -16
  148. package/dist/mcp/session-store.js.map +1 -1
  149. package/dist/mcp/tool-profiles.d.ts +69 -0
  150. package/dist/mcp/tool-profiles.d.ts.map +1 -0
  151. package/dist/mcp/tool-profiles.js +176 -0
  152. package/dist/mcp/tool-profiles.js.map +1 -0
  153. package/dist/mcp/tool-registry.d.ts +16 -0
  154. package/dist/mcp/tool-registry.d.ts.map +1 -1
  155. package/dist/mcp/tool-registry.js +91 -39
  156. package/dist/mcp/tool-registry.js.map +1 -1
  157. package/dist/mcp/tools/activity.d.ts.map +1 -1
  158. package/dist/mcp/tools/activity.js +398 -198
  159. package/dist/mcp/tools/activity.js.map +1 -1
  160. package/dist/mcp/tools/aliases.d.ts +11 -0
  161. package/dist/mcp/tools/aliases.d.ts.map +1 -0
  162. package/dist/mcp/tools/aliases.js +176 -0
  163. package/dist/mcp/tools/aliases.js.map +1 -0
  164. package/dist/mcp/tools/app-core.d.ts +6 -8
  165. package/dist/mcp/tools/app-core.d.ts.map +1 -1
  166. package/dist/mcp/tools/app-core.js +355 -254
  167. package/dist/mcp/tools/app-core.js.map +1 -1
  168. package/dist/mcp/tools/app-marketplace.d.ts +8 -16
  169. package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
  170. package/dist/mcp/tools/app-marketplace.js +604 -930
  171. package/dist/mcp/tools/app-marketplace.js.map +1 -1
  172. package/dist/mcp/tools/app.d.ts +4 -7
  173. package/dist/mcp/tools/app.d.ts.map +1 -1
  174. package/dist/mcp/tools/app.js +4 -7
  175. package/dist/mcp/tools/app.js.map +1 -1
  176. package/dist/mcp/tools/bot-self.d.ts +21 -0
  177. package/dist/mcp/tools/bot-self.d.ts.map +1 -0
  178. package/dist/mcp/tools/bot-self.js +174 -0
  179. package/dist/mcp/tools/bot-self.js.map +1 -0
  180. package/dist/mcp/tools/calendar.d.ts +21 -0
  181. package/dist/mcp/tools/calendar.d.ts.map +1 -0
  182. package/dist/mcp/tools/calendar.js +741 -0
  183. package/dist/mcp/tools/calendar.js.map +1 -0
  184. package/dist/mcp/tools/company.d.ts.map +1 -1
  185. package/dist/mcp/tools/company.js +2 -1
  186. package/dist/mcp/tools/company.js.map +1 -1
  187. package/dist/mcp/tools/date.js.map +1 -1
  188. package/dist/mcp/tools/discussion.d.ts +23 -3
  189. package/dist/mcp/tools/discussion.d.ts.map +1 -1
  190. package/dist/mcp/tools/discussion.js +417 -534
  191. package/dist/mcp/tools/discussion.js.map +1 -1
  192. package/dist/mcp/tools/file.d.ts.map +1 -1
  193. package/dist/mcp/tools/file.js +18 -16
  194. package/dist/mcp/tools/file.js.map +1 -1
  195. package/dist/mcp/tools/index.js +4 -4
  196. package/dist/mcp/tools/index.js.map +1 -1
  197. package/dist/mcp/tools/insight.d.ts +7 -5
  198. package/dist/mcp/tools/insight.d.ts.map +1 -1
  199. package/dist/mcp/tools/insight.js +419 -477
  200. package/dist/mcp/tools/insight.js.map +1 -1
  201. package/dist/mcp/tools/user.d.ts.map +1 -1
  202. package/dist/mcp/tools/user.js +15 -13
  203. package/dist/mcp/tools/user.js.map +1 -1
  204. package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
  205. package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
  206. package/dist/mcp/tools/workflow-permissions.js +88 -97
  207. package/dist/mcp/tools/workflow-permissions.js.map +1 -1
  208. package/dist/mcp/tools/workflow.d.ts +2 -7
  209. package/dist/mcp/tools/workflow.d.ts.map +1 -1
  210. package/dist/mcp/tools/workflow.js +817 -850
  211. package/dist/mcp/tools/workflow.js.map +1 -1
  212. package/dist/mcp/utils/api-errors.d.ts.map +1 -1
  213. package/dist/mcp/utils/api-errors.js +2 -2
  214. package/dist/mcp/utils/api-errors.js.map +1 -1
  215. package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
  216. package/dist/mcp/utils/data-transformers.js +8 -4
  217. package/dist/mcp/utils/data-transformers.js.map +1 -1
  218. package/dist/mcp/utils/file-upload.d.ts.map +1 -1
  219. package/dist/mcp/utils/file-upload.js +1 -1
  220. package/dist/mcp/utils/file-upload.js.map +1 -1
  221. package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
  222. package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
  223. package/dist/mcp/utils/hailer-api-client.js +103 -101
  224. package/dist/mcp/utils/hailer-api-client.js.map +1 -1
  225. package/dist/mcp/utils/index.d.ts.map +1 -1
  226. package/dist/mcp/utils/index.js.map +1 -1
  227. package/dist/mcp/utils/logger.d.ts.map +1 -1
  228. package/dist/mcp/utils/logger.js.map +1 -1
  229. package/dist/mcp/utils/response-builder.d.ts.map +1 -1
  230. package/dist/mcp/utils/response-builder.js +8 -4
  231. package/dist/mcp/utils/response-builder.js.map +1 -1
  232. package/dist/mcp/utils/role-utils.d.ts.map +1 -1
  233. package/dist/mcp/utils/role-utils.js +6 -3
  234. package/dist/mcp/utils/role-utils.js.map +1 -1
  235. package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
  236. package/dist/mcp/utils/tool-helpers.js +2 -2
  237. package/dist/mcp/utils/tool-helpers.js.map +1 -1
  238. package/dist/mcp/utils/types.d.ts +1 -1
  239. package/dist/mcp/utils/types.d.ts.map +1 -1
  240. package/dist/mcp/utils/types.js.map +1 -1
  241. package/dist/mcp/webhook-handler.d.ts +43 -8
  242. package/dist/mcp/webhook-handler.d.ts.map +1 -1
  243. package/dist/mcp/webhook-handler.js +861 -116
  244. package/dist/mcp/webhook-handler.js.map +1 -1
  245. package/dist/mcp/workspace-admin-store.d.ts +49 -0
  246. package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
  247. package/dist/mcp/workspace-admin-store.js +168 -0
  248. package/dist/mcp/workspace-admin-store.js.map +1 -0
  249. package/dist/mcp/workspace-cache.d.ts +2 -2
  250. package/dist/mcp/workspace-cache.d.ts.map +1 -1
  251. package/dist/mcp/workspace-cache.js +9 -5
  252. package/dist/mcp/workspace-cache.js.map +1 -1
  253. package/dist/mcp-server.d.ts +26 -11
  254. package/dist/mcp-server.d.ts.map +1 -1
  255. package/dist/mcp-server.js +360 -36
  256. package/dist/mcp-server.js.map +1 -1
  257. package/dist/plugins/vipunen/client.d.ts +41 -41
  258. package/dist/plugins/vipunen/client.d.ts.map +1 -1
  259. package/dist/plugins/vipunen/client.js +53 -48
  260. package/dist/plugins/vipunen/client.js.map +1 -1
  261. package/dist/plugins/vipunen/index.js.map +1 -1
  262. package/dist/plugins/vipunen/tools.d.ts.map +1 -1
  263. package/dist/plugins/vipunen/tools.js +6 -3
  264. package/dist/plugins/vipunen/tools.js.map +1 -1
  265. package/dist/public-chat/graduate.d.ts +29 -0
  266. package/dist/public-chat/graduate.d.ts.map +1 -0
  267. package/dist/public-chat/graduate.js +593 -0
  268. package/dist/public-chat/graduate.js.map +1 -0
  269. package/dist/public-chat/handler.d.ts +12 -0
  270. package/dist/public-chat/handler.d.ts.map +1 -0
  271. package/dist/public-chat/handler.js +179 -0
  272. package/dist/public-chat/handler.js.map +1 -0
  273. package/dist/public-chat/index.d.ts +16 -0
  274. package/dist/public-chat/index.d.ts.map +1 -0
  275. package/dist/public-chat/index.js +74 -0
  276. package/dist/public-chat/index.js.map +1 -0
  277. package/dist/public-chat/knowledge.d.ts +3 -0
  278. package/dist/public-chat/knowledge.d.ts.map +1 -0
  279. package/dist/public-chat/knowledge.js +1341 -0
  280. package/dist/public-chat/knowledge.js.map +1 -0
  281. package/dist/public-chat/rate-limit.d.ts +16 -0
  282. package/dist/public-chat/rate-limit.d.ts.map +1 -0
  283. package/dist/public-chat/rate-limit.js +51 -0
  284. package/dist/public-chat/rate-limit.js.map +1 -0
  285. package/dist/public-chat/session-store.d.ts +41 -0
  286. package/dist/public-chat/session-store.d.ts.map +1 -0
  287. package/dist/public-chat/session-store.js +95 -0
  288. package/dist/public-chat/session-store.js.map +1 -0
  289. package/dist/public-chat/studio-prewarm.d.ts +61 -0
  290. package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
  291. package/dist/public-chat/studio-prewarm.js +162 -0
  292. package/dist/public-chat/studio-prewarm.js.map +1 -0
  293. package/dist/public-chat/system-prompt.d.ts +22 -0
  294. package/dist/public-chat/system-prompt.d.ts.map +1 -0
  295. package/dist/public-chat/system-prompt.js +428 -0
  296. package/dist/public-chat/system-prompt.js.map +1 -0
  297. package/package.json +14 -7
  298. package/scripts/build-public-chat-knowledge.py +101 -0
  299. package/scripts/probe-mcp-pricing.ts +52 -0
  300. package/scripts/smoke-public-chat-live.ts +148 -0
  301. package/scripts/smoke-public-chat.ts +110 -0
  302. package/.claude/CLAUDE.md +0 -126
  303. package/.claude/commands/app-squad.md +0 -131
  304. package/.claude/commands/audit-squad.md +0 -158
  305. package/.claude/commands/cleanup-squad.md +0 -98
  306. package/.claude/commands/config-squad.md +0 -106
  307. package/.claude/commands/crud-squad.md +0 -87
  308. package/.claude/commands/data-squad.md +0 -97
  309. package/.claude/commands/doc-squad.md +0 -65
  310. package/.claude/commands/help.md +0 -29
  311. package/.claude/commands/help:agents.md +0 -182
  312. package/.claude/commands/help:commands.md +0 -78
  313. package/.claude/commands/help:faq.md +0 -79
  314. package/.claude/commands/help:plugins.md +0 -50
  315. package/.claude/commands/help:skills.md +0 -87
  316. package/.claude/commands/help:tools.md +0 -75
  317. package/.claude/commands/hotfix-squad.md +0 -112
  318. package/.claude/commands/integration-squad.md +0 -82
  319. package/.claude/commands/janitor-squad.md +0 -167
  320. package/.claude/commands/onboard-squad.md +0 -130
  321. package/.claude/commands/swarm.md +0 -210
  322. package/.claude/commands/tool-builder.md +0 -39
  323. package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
  324. package/dist/CLAUDE.md +0 -370
  325. package/dist/agents/bot-manager.d.ts +0 -48
  326. package/dist/agents/bot-manager.d.ts.map +0 -1
  327. package/dist/agents/bot-manager.js +0 -254
  328. package/dist/agents/bot-manager.js.map +0 -1
  329. package/dist/agents/bug-fixer/ai.d.ts +0 -80
  330. package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
  331. package/dist/agents/bug-fixer/ai.js +0 -466
  332. package/dist/agents/bug-fixer/ai.js.map +0 -1
  333. package/dist/agents/bug-fixer/bot.d.ts +0 -92
  334. package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
  335. package/dist/agents/bug-fixer/bot.js +0 -687
  336. package/dist/agents/bug-fixer/bot.js.map +0 -1
  337. package/dist/agents/bug-fixer/config.d.ts +0 -21
  338. package/dist/agents/bug-fixer/config.d.ts.map +0 -1
  339. package/dist/agents/bug-fixer/config.js +0 -218
  340. package/dist/agents/bug-fixer/config.js.map +0 -1
  341. package/dist/agents/bug-fixer/files.d.ts +0 -67
  342. package/dist/agents/bug-fixer/files.d.ts.map +0 -1
  343. package/dist/agents/bug-fixer/files.js +0 -386
  344. package/dist/agents/bug-fixer/files.js.map +0 -1
  345. package/dist/agents/bug-fixer/git.d.ts +0 -48
  346. package/dist/agents/bug-fixer/git.d.ts.map +0 -1
  347. package/dist/agents/bug-fixer/git.js +0 -298
  348. package/dist/agents/bug-fixer/git.js.map +0 -1
  349. package/dist/agents/bug-fixer/index.d.ts +0 -103
  350. package/dist/agents/bug-fixer/index.d.ts.map +0 -1
  351. package/dist/agents/bug-fixer/index.js +0 -262
  352. package/dist/agents/bug-fixer/index.js.map +0 -1
  353. package/dist/agents/bug-fixer/lsp.d.ts +0 -113
  354. package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
  355. package/dist/agents/bug-fixer/lsp.js +0 -485
  356. package/dist/agents/bug-fixer/lsp.js.map +0 -1
  357. package/dist/agents/bug-fixer/monitor.d.ts +0 -123
  358. package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
  359. package/dist/agents/bug-fixer/monitor.js +0 -629
  360. package/dist/agents/bug-fixer/monitor.js.map +0 -1
  361. package/dist/agents/bug-fixer/prompt.d.ts +0 -5
  362. package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
  363. package/dist/agents/bug-fixer/prompt.js +0 -94
  364. package/dist/agents/bug-fixer/prompt.js.map +0 -1
  365. package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
  366. package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
  367. package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
  368. package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
  369. package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
  370. package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
  371. package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
  372. package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
  373. package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
  374. package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
  375. package/dist/agents/bug-fixer/registries/pending.js +0 -49
  376. package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
  377. package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
  378. package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
  379. package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
  380. package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
  381. package/dist/agents/bug-fixer/specialist.d.ts +0 -47
  382. package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
  383. package/dist/agents/bug-fixer/specialist.js +0 -327
  384. package/dist/agents/bug-fixer/specialist.js.map +0 -1
  385. package/dist/agents/bug-fixer/types.d.ts +0 -123
  386. package/dist/agents/bug-fixer/types.d.ts.map +0 -1
  387. package/dist/agents/bug-fixer/types.js +0 -9
  388. package/dist/agents/bug-fixer/types.js.map +0 -1
  389. package/dist/agents/factory.d.ts +0 -172
  390. package/dist/agents/factory.d.ts.map +0 -1
  391. package/dist/agents/factory.js +0 -706
  392. package/dist/agents/factory.js.map +0 -1
  393. package/dist/agents/hailer-expert/index.d.ts +0 -8
  394. package/dist/agents/hailer-expert/index.d.ts.map +0 -1
  395. package/dist/agents/hailer-expert/index.js +0 -14
  396. package/dist/agents/hailer-expert/index.js.map +0 -1
  397. package/dist/agents/hal/daemon.d.ts +0 -174
  398. package/dist/agents/hal/daemon.d.ts.map +0 -1
  399. package/dist/agents/hal/daemon.js +0 -1385
  400. package/dist/agents/hal/daemon.js.map +0 -1
  401. package/dist/agents/hal/definitions.d.ts +0 -42
  402. package/dist/agents/hal/definitions.d.ts.map +0 -1
  403. package/dist/agents/hal/definitions.js +0 -300
  404. package/dist/agents/hal/definitions.js.map +0 -1
  405. package/dist/agents/hal/index.d.ts +0 -3
  406. package/dist/agents/hal/index.d.ts.map +0 -1
  407. package/dist/agents/hal/index.js +0 -8
  408. package/dist/agents/hal/index.js.map +0 -1
  409. package/dist/agents/index.d.ts +0 -18
  410. package/dist/agents/index.d.ts.map +0 -1
  411. package/dist/agents/index.js +0 -48
  412. package/dist/agents/index.js.map +0 -1
  413. package/dist/agents/shared/base.d.ts +0 -253
  414. package/dist/agents/shared/base.d.ts.map +0 -1
  415. package/dist/agents/shared/base.js +0 -1122
  416. package/dist/agents/shared/base.js.map +0 -1
  417. package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
  418. package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
  419. package/dist/agents/shared/schemas/action-schema.js +0 -483
  420. package/dist/agents/shared/schemas/action-schema.js.map +0 -1
  421. package/dist/agents/shared/services/agent-registry.d.ts +0 -108
  422. package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
  423. package/dist/agents/shared/services/agent-registry.js +0 -469
  424. package/dist/agents/shared/services/agent-registry.js.map +0 -1
  425. package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
  426. package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
  427. package/dist/agents/shared/services/conversation-manager.js +0 -168
  428. package/dist/agents/shared/services/conversation-manager.js.map +0 -1
  429. package/dist/agents/shared/services/mcp-client.d.ts +0 -56
  430. package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
  431. package/dist/agents/shared/services/mcp-client.js +0 -124
  432. package/dist/agents/shared/services/mcp-client.js.map +0 -1
  433. package/dist/agents/shared/services/message-classifier.d.ts +0 -37
  434. package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
  435. package/dist/agents/shared/services/message-classifier.js +0 -203
  436. package/dist/agents/shared/services/message-classifier.js.map +0 -1
  437. package/dist/agents/shared/services/message-formatter.d.ts +0 -89
  438. package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
  439. package/dist/agents/shared/services/message-formatter.js +0 -390
  440. package/dist/agents/shared/services/message-formatter.js.map +0 -1
  441. package/dist/agents/shared/services/session-logger.d.ts +0 -162
  442. package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
  443. package/dist/agents/shared/services/session-logger.js +0 -724
  444. package/dist/agents/shared/services/session-logger.js.map +0 -1
  445. package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
  446. package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
  447. package/dist/agents/shared/services/structured-output-executor.js +0 -296
  448. package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
  449. package/dist/agents/shared/services/token-billing.d.ts +0 -72
  450. package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
  451. package/dist/agents/shared/services/token-billing.js +0 -198
  452. package/dist/agents/shared/services/token-billing.js.map +0 -1
  453. package/dist/agents/shared/services/tool-executor.d.ts +0 -43
  454. package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
  455. package/dist/agents/shared/services/tool-executor.js +0 -175
  456. package/dist/agents/shared/services/tool-executor.js.map +0 -1
  457. package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
  458. package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
  459. package/dist/agents/shared/services/typing-indicator.js +0 -54
  460. package/dist/agents/shared/services/typing-indicator.js.map +0 -1
  461. package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
  462. package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
  463. package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
  464. package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
  465. package/dist/agents/shared/specialist.d.ts +0 -91
  466. package/dist/agents/shared/specialist.d.ts.map +0 -1
  467. package/dist/agents/shared/specialist.js +0 -399
  468. package/dist/agents/shared/specialist.js.map +0 -1
  469. package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
  470. package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
  471. package/dist/agents/shared/tool-schema-loader.js +0 -238
  472. package/dist/agents/shared/tool-schema-loader.js.map +0 -1
  473. package/dist/agents/shared/types.d.ts +0 -190
  474. package/dist/agents/shared/types.d.ts.map +0 -1
  475. package/dist/agents/shared/types.js +0 -13
  476. package/dist/agents/shared/types.js.map +0 -1
  477. package/dist/bot/bot-config.d.ts +0 -37
  478. package/dist/bot/bot-config.d.ts.map +0 -1
  479. package/dist/bot/bot-config.js +0 -219
  480. package/dist/bot/bot-config.js.map +0 -1
  481. package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
  482. package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
  483. package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
  484. package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
  485. package/dist/bot/services/session-logger.d.ts +0 -162
  486. package/dist/bot/services/session-logger.d.ts.map +0 -1
  487. package/dist/bot/services/session-logger.js +0 -724
  488. package/dist/bot/services/session-logger.js.map +0 -1
  489. package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
  490. package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
  491. package/dist/bot/services/workspace-schema-cache.js +0 -506
  492. package/dist/bot/services/workspace-schema-cache.js.map +0 -1
  493. package/dist/bot-config/tools.d.ts +0 -28
  494. package/dist/bot-config/tools.d.ts.map +0 -1
  495. package/dist/bot-config/tools.js +0 -279
  496. package/dist/bot-config/tools.js.map +0 -1
  497. package/dist/client/agents/base.d.ts +0 -207
  498. package/dist/client/agents/base.d.ts.map +0 -1
  499. package/dist/client/agents/base.js +0 -744
  500. package/dist/client/agents/base.js.map +0 -1
  501. package/dist/client/agents/definitions.d.ts +0 -53
  502. package/dist/client/agents/definitions.d.ts.map +0 -1
  503. package/dist/client/agents/definitions.js +0 -263
  504. package/dist/client/agents/definitions.js.map +0 -1
  505. package/dist/client/agents/orchestrator.d.ts +0 -141
  506. package/dist/client/agents/orchestrator.d.ts.map +0 -1
  507. package/dist/client/agents/orchestrator.js +0 -1062
  508. package/dist/client/agents/orchestrator.js.map +0 -1
  509. package/dist/client/agents/specialist.d.ts +0 -86
  510. package/dist/client/agents/specialist.d.ts.map +0 -1
  511. package/dist/client/agents/specialist.js +0 -340
  512. package/dist/client/agents/specialist.js.map +0 -1
  513. package/dist/client/bot-entrypoint.d.ts +0 -7
  514. package/dist/client/bot-entrypoint.d.ts.map +0 -1
  515. package/dist/client/bot-entrypoint.js +0 -103
  516. package/dist/client/bot-entrypoint.js.map +0 -1
  517. package/dist/client/bot-manager.d.ts +0 -44
  518. package/dist/client/bot-manager.d.ts.map +0 -1
  519. package/dist/client/bot-manager.js +0 -173
  520. package/dist/client/bot-manager.js.map +0 -1
  521. package/dist/client/bot-runner.d.ts +0 -35
  522. package/dist/client/bot-runner.d.ts.map +0 -1
  523. package/dist/client/bot-runner.js +0 -188
  524. package/dist/client/bot-runner.js.map +0 -1
  525. package/dist/client/chat-agent-daemon.d.ts +0 -464
  526. package/dist/client/chat-agent-daemon.d.ts.map +0 -1
  527. package/dist/client/chat-agent-daemon.js +0 -1774
  528. package/dist/client/chat-agent-daemon.js.map +0 -1
  529. package/dist/client/daemon-factory.d.ts +0 -106
  530. package/dist/client/daemon-factory.d.ts.map +0 -1
  531. package/dist/client/daemon-factory.js +0 -301
  532. package/dist/client/daemon-factory.js.map +0 -1
  533. package/dist/client/factory.d.ts +0 -111
  534. package/dist/client/factory.d.ts.map +0 -1
  535. package/dist/client/factory.js +0 -314
  536. package/dist/client/factory.js.map +0 -1
  537. package/dist/client/index.d.ts +0 -17
  538. package/dist/client/index.d.ts.map +0 -1
  539. package/dist/client/index.js +0 -38
  540. package/dist/client/index.js.map +0 -1
  541. package/dist/client/multi-bot-manager.d.ts +0 -42
  542. package/dist/client/multi-bot-manager.d.ts.map +0 -1
  543. package/dist/client/multi-bot-manager.js +0 -161
  544. package/dist/client/multi-bot-manager.js.map +0 -1
  545. package/dist/client/orchestrator-daemon.d.ts +0 -87
  546. package/dist/client/orchestrator-daemon.d.ts.map +0 -1
  547. package/dist/client/orchestrator-daemon.js +0 -444
  548. package/dist/client/orchestrator-daemon.js.map +0 -1
  549. package/dist/client/server.d.ts +0 -8
  550. package/dist/client/server.d.ts.map +0 -1
  551. package/dist/client/server.js +0 -251
  552. package/dist/client/server.js.map +0 -1
  553. package/dist/client/services/agent-registry.d.ts +0 -108
  554. package/dist/client/services/agent-registry.d.ts.map +0 -1
  555. package/dist/client/services/agent-registry.js +0 -630
  556. package/dist/client/services/agent-registry.js.map +0 -1
  557. package/dist/client/services/conversation-manager.d.ts +0 -50
  558. package/dist/client/services/conversation-manager.d.ts.map +0 -1
  559. package/dist/client/services/conversation-manager.js +0 -136
  560. package/dist/client/services/conversation-manager.js.map +0 -1
  561. package/dist/client/services/mcp-client.d.ts +0 -48
  562. package/dist/client/services/mcp-client.d.ts.map +0 -1
  563. package/dist/client/services/mcp-client.js +0 -105
  564. package/dist/client/services/mcp-client.js.map +0 -1
  565. package/dist/client/services/message-classifier.d.ts +0 -37
  566. package/dist/client/services/message-classifier.d.ts.map +0 -1
  567. package/dist/client/services/message-classifier.js +0 -187
  568. package/dist/client/services/message-classifier.js.map +0 -1
  569. package/dist/client/services/message-formatter.d.ts +0 -84
  570. package/dist/client/services/message-formatter.d.ts.map +0 -1
  571. package/dist/client/services/message-formatter.js +0 -353
  572. package/dist/client/services/message-formatter.js.map +0 -1
  573. package/dist/client/services/session-logger.d.ts +0 -106
  574. package/dist/client/services/session-logger.d.ts.map +0 -1
  575. package/dist/client/services/session-logger.js +0 -446
  576. package/dist/client/services/session-logger.js.map +0 -1
  577. package/dist/client/services/tool-executor.d.ts +0 -41
  578. package/dist/client/services/tool-executor.d.ts.map +0 -1
  579. package/dist/client/services/tool-executor.js +0 -169
  580. package/dist/client/services/tool-executor.js.map +0 -1
  581. package/dist/client/services/workspace-schema-cache.d.ts +0 -149
  582. package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
  583. package/dist/client/services/workspace-schema-cache.js +0 -732
  584. package/dist/client/services/workspace-schema-cache.js.map +0 -1
  585. package/dist/client/specialist-daemon.d.ts +0 -77
  586. package/dist/client/specialist-daemon.d.ts.map +0 -1
  587. package/dist/client/specialist-daemon.js +0 -197
  588. package/dist/client/specialist-daemon.js.map +0 -1
  589. package/dist/client/specialists.d.ts +0 -53
  590. package/dist/client/specialists.d.ts.map +0 -1
  591. package/dist/client/specialists.js +0 -178
  592. package/dist/client/specialists.js.map +0 -1
  593. package/dist/client/tool-schema-loader.d.ts +0 -62
  594. package/dist/client/tool-schema-loader.d.ts.map +0 -1
  595. package/dist/client/tool-schema-loader.js +0 -232
  596. package/dist/client/tool-schema-loader.js.map +0 -1
  597. package/dist/client/types.d.ts +0 -327
  598. package/dist/client/types.d.ts.map +0 -1
  599. package/dist/client/types.js +0 -121
  600. package/dist/client/types.js.map +0 -1
  601. package/dist/commands/seed-config.d.ts +0 -9
  602. package/dist/commands/seed-config.d.ts.map +0 -1
  603. package/dist/commands/seed-config.js +0 -377
  604. package/dist/commands/seed-config.js.map +0 -1
  605. package/dist/commands/setup.d.ts +0 -11
  606. package/dist/commands/setup.d.ts.map +0 -1
  607. package/dist/commands/setup.js +0 -320
  608. package/dist/commands/setup.js.map +0 -1
  609. package/dist/lib/discussion-lock.d.ts +0 -42
  610. package/dist/lib/discussion-lock.d.ts.map +0 -1
  611. package/dist/lib/discussion-lock.js +0 -110
  612. package/dist/lib/discussion-lock.js.map +0 -1
  613. package/dist/mcp/signal-handler.d.ts +0 -82
  614. package/dist/mcp/signal-handler.d.ts.map +0 -1
  615. package/dist/mcp/signal-handler.js +0 -406
  616. package/dist/mcp/signal-handler.js.map +0 -1
  617. package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
  618. package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
  619. package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
  620. package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
  621. package/dist/mcp/tools/app-member.d.ts +0 -14
  622. package/dist/mcp/tools/app-member.d.ts.map +0 -1
  623. package/dist/mcp/tools/app-member.js +0 -195
  624. package/dist/mcp/tools/app-member.js.map +0 -1
  625. package/dist/mcp/tools/app-scaffold.d.ts +0 -14
  626. package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
  627. package/dist/mcp/tools/app-scaffold.js +0 -581
  628. package/dist/mcp/tools/app-scaffold.js.map +0 -1
  629. package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
  630. package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
  631. package/dist/mcp/tools/bot-config/constants.js +0 -94
  632. package/dist/mcp/tools/bot-config/constants.js.map +0 -1
  633. package/dist/mcp/tools/bot-config/core.d.ts +0 -253
  634. package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
  635. package/dist/mcp/tools/bot-config/core.js +0 -2456
  636. package/dist/mcp/tools/bot-config/core.js.map +0 -1
  637. package/dist/mcp/tools/bot-config/index.d.ts +0 -10
  638. package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
  639. package/dist/mcp/tools/bot-config/index.js +0 -59
  640. package/dist/mcp/tools/bot-config/index.js.map +0 -1
  641. package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
  642. package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
  643. package/dist/mcp/tools/bot-config/tools.js +0 -15
  644. package/dist/mcp/tools/bot-config/tools.js.map +0 -1
  645. package/dist/mcp/tools/bot-config/types.d.ts +0 -50
  646. package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
  647. package/dist/mcp/tools/bot-config/types.js +0 -6
  648. package/dist/mcp/tools/bot-config/types.js.map +0 -1
  649. package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
  650. package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
  651. package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
  652. package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
  653. package/dist/mcp/tools/document.d.ts +0 -11
  654. package/dist/mcp/tools/document.d.ts.map +0 -1
  655. package/dist/mcp/tools/document.js +0 -741
  656. package/dist/mcp/tools/document.js.map +0 -1
  657. package/dist/mcp/tools/investigate.d.ts +0 -9
  658. package/dist/mcp/tools/investigate.d.ts.map +0 -1
  659. package/dist/mcp/tools/investigate.js +0 -254
  660. package/dist/mcp/tools/investigate.js.map +0 -1
  661. package/dist/mcp/utils/pagination.d.ts +0 -40
  662. package/dist/mcp/utils/pagination.d.ts.map +0 -1
  663. package/dist/mcp/utils/pagination.js +0 -55
  664. package/dist/mcp/utils/pagination.js.map +0 -1
  665. package/dist/modules/bug-reports/bug-config.d.ts +0 -25
  666. package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
  667. package/dist/modules/bug-reports/bug-config.js +0 -187
  668. package/dist/modules/bug-reports/bug-config.js.map +0 -1
  669. package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
  670. package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
  671. package/dist/modules/bug-reports/bug-monitor.js +0 -510
  672. package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
  673. package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
  674. package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
  675. package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
  676. package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
  677. package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
  678. package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
  679. package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
  680. package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
  681. package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
  682. package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
  683. package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
  684. package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
  685. package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
  686. package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
  687. package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
  688. package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
  689. package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
  690. package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
  691. package/dist/modules/bug-reports/giuseppe-files.js +0 -375
  692. package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
  693. package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
  694. package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
  695. package/dist/modules/bug-reports/giuseppe-git.js +0 -298
  696. package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
  697. package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
  698. package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
  699. package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
  700. package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
  701. package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
  702. package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
  703. package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
  704. package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
  705. package/dist/modules/bug-reports/index.d.ts +0 -77
  706. package/dist/modules/bug-reports/index.d.ts.map +0 -1
  707. package/dist/modules/bug-reports/index.js +0 -215
  708. package/dist/modules/bug-reports/index.js.map +0 -1
  709. package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
  710. package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
  711. package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
  712. package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
  713. package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
  714. package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
  715. package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
  716. package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
  717. package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
  718. package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
  719. package/dist/modules/bug-reports/pending-registry.js +0 -49
  720. package/dist/modules/bug-reports/pending-registry.js.map +0 -1
  721. package/dist/modules/bug-reports/types.d.ts +0 -123
  722. package/dist/modules/bug-reports/types.d.ts.map +0 -1
  723. package/dist/modules/bug-reports/types.js +0 -9
  724. package/dist/modules/bug-reports/types.js.map +0 -1
  725. package/dist/plugins/bug-fixer/index.d.ts +0 -2
  726. package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
  727. package/dist/plugins/bug-fixer/index.js +0 -18
  728. package/dist/plugins/bug-fixer/index.js.map +0 -1
  729. package/dist/plugins/bug-fixer/tools.d.ts +0 -45
  730. package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
  731. package/dist/plugins/bug-fixer/tools.js +0 -1096
  732. package/dist/plugins/bug-fixer/tools.js.map +0 -1
  733. package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
  734. package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
  735. package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
  736. package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
  737. package/dist/routes/agents.d.ts +0 -44
  738. package/dist/routes/agents.d.ts.map +0 -1
  739. package/dist/routes/agents.js +0 -311
  740. package/dist/routes/agents.js.map +0 -1
  741. package/dist/services/agent-credential-store.d.ts +0 -73
  742. package/dist/services/agent-credential-store.d.ts.map +0 -1
  743. package/dist/services/agent-credential-store.js +0 -212
  744. package/dist/services/agent-credential-store.js.map +0 -1
  745. package/dist/stdio-server.d.ts +0 -14
  746. package/dist/stdio-server.d.ts.map +0 -1
  747. package/dist/stdio-server.js +0 -101
  748. package/dist/stdio-server.js.map +0 -1
  749. package/dist/workspace/context.d.ts +0 -148
  750. package/dist/workspace/context.d.ts.map +0 -1
  751. package/dist/workspace/context.js +0 -339
  752. package/dist/workspace/context.js.map +0 -1
  753. package/dist/workspace/credentials.d.ts +0 -55
  754. package/dist/workspace/credentials.d.ts.map +0 -1
  755. package/dist/workspace/credentials.js +0 -239
  756. package/dist/workspace/credentials.js.map +0 -1
  757. package/dist/workspace/index.d.ts +0 -21
  758. package/dist/workspace/index.d.ts.map +0 -1
  759. package/dist/workspace/index.js +0 -45
  760. package/dist/workspace/index.js.map +0 -1
  761. package/dist/workspace/loader.d.ts +0 -27
  762. package/dist/workspace/loader.d.ts.map +0 -1
  763. package/dist/workspace/loader.js +0 -222
  764. package/dist/workspace/loader.js.map +0 -1
  765. package/dist/workspace/schema.d.ts +0 -37
  766. package/dist/workspace/schema.d.ts.map +0 -1
  767. package/dist/workspace/schema.js +0 -192
  768. package/dist/workspace/schema.js.map +0 -1
@@ -7,10 +7,14 @@
7
7
  * - Activities = Rows
8
8
  * - Fields = Columns
9
9
  *
10
- * All 4 insight management tools in one file for cohesion.
10
+ * All 4 insight tools in one file for cohesion (v2 surface):
11
+ * - run_insight (saved execution + ad-hoc preview)
12
+ * - save_insight (create + update upsert)
13
+ * - list_insights
14
+ * - remove_insight
11
15
  */
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.insightTools = exports.listInsightsTool = exports.removeInsightTool = exports.updateInsightTool = exports.getInsightDataTool = exports.previewInsightTool = exports.createInsightTool = void 0;
17
+ exports.insightTools = exports.listInsightsTool = exports.removeInsightTool = exports.saveInsightTool = exports.runInsightTool = void 0;
14
18
  const zod_1 = require("zod");
15
19
  const tool_registry_1 = require("../tool-registry");
16
20
  const logger_1 = require("../../lib/logger");
@@ -25,10 +29,10 @@ const logger = (0, logger_1.createLogger)({ component: 'insight-tools' });
25
29
  * Accepts both 'id' and 'fieldId' for flexibility (LLMs often use 'id')
26
30
  */
27
31
  const fieldSchema = zod_1.z.object({
28
- name: zod_1.z.string().describe("Column name in SQL query"),
32
+ name: zod_1.z.string().describe('Column name in SQL query'),
29
33
  // Accept both 'id' and 'fieldId' - will be normalized to 'fieldId'
30
- id: zod_1.z.string().optional().describe("Field ID (alias for fieldId)"),
31
- fieldId: zod_1.z.string().optional().describe("Custom field ID from workflow"),
34
+ id: zod_1.z.string().optional().describe('Field ID (alias for fieldId)'),
35
+ fieldId: zod_1.z.string().optional().describe('Custom field ID from workflow'),
32
36
  meta: zod_1.z.enum([
33
37
  '_id',
34
38
  'uid',
@@ -43,7 +47,7 @@ const fieldSchema = zod_1.z.object({
43
47
  'workflowId',
44
48
  'workflowName',
45
49
  'priority'
46
- ]).optional().describe("Built-in activity property (alternative to fieldId)"),
50
+ ]).optional().describe('Built-in activity property (alternative to fieldId)'),
47
51
  }).refine((data) => data.meta || data.fieldId || data.id, { message: "Field must have either 'meta', 'fieldId', or 'id'" });
48
52
  /**
49
53
  * Sanitize field name to be SQL-identifier safe (no spaces, special chars)
@@ -53,8 +57,9 @@ function sanitizeFieldName(name) {
53
57
  return name
54
58
  .split(/\s+/)
55
59
  .map((word, index) => {
56
- if (index === 0)
60
+ if (index === 0) {
57
61
  return word.charAt(0).toLowerCase() + word.slice(1);
62
+ }
58
63
  return word.charAt(0).toUpperCase() + word.slice(1);
59
64
  })
60
65
  .join('')
@@ -67,7 +72,7 @@ function normalizeFields(sources) {
67
72
  return sources.map(source => ({
68
73
  ...source,
69
74
  fields: source.fields.map(field => {
70
- let normalized = { ...field };
75
+ const normalized = { ...field };
71
76
  // Sanitize field name (remove spaces, make SQL-safe)
72
77
  if (normalized.name) {
73
78
  normalized.name = sanitizeFieldName(normalized.name);
@@ -85,17 +90,14 @@ function normalizeFields(sources) {
85
90
  * Source definition schema - workflow as SQL table
86
91
  */
87
92
  const sourceSchema = zod_1.z.object({
88
- name: zod_1.z.string().describe("Table alias for SQL query"),
89
- workflowId: zod_1.z.string().describe("Workflow ID to query"),
90
- fields: zod_1.z.array(fieldSchema).min(1).describe("Field mappings for SQL columns"),
93
+ name: zod_1.z.string().describe('Table alias for SQL query'),
94
+ workflowId: zod_1.z.string().describe('Workflow ID to query'),
95
+ fields: zod_1.z.array(fieldSchema).min(1).describe('Field mappings for SQL columns'),
91
96
  });
92
- // ============================================================================
93
- // CREATE INSIGHT TOOL
94
- // ============================================================================
95
97
  const INSIGHT_SQL_GUIDE = `**How sources map to SQL:**
96
98
  - sources[].name → TABLE NAME in SQL
97
99
  - sources[].fields[].name → COLUMN NAME in SQL
98
- - sources[].fields[].fieldId → custom field ID (hex string from get_workflow_schema)
100
+ - sources[].fields[].fieldId → custom field ID (hex string from describe_workflows include:["schema"])
99
101
  - sources[].fields[].meta → built-in property (use INSTEAD of fieldId): phaseName, name, created, updated, uid, team, priority
100
102
 
101
103
  **Example — count by phase:**
@@ -103,528 +105,468 @@ sources: [{ name: "T", workflowId: "...", fields: [{ name: "phase", meta: "phase
103
105
  query: "SELECT phase, COUNT(*) as count FROM T GROUP BY phase"
104
106
 
105
107
  **NEVER use fieldId or workflowId in the SQL — only field name values.**`;
106
- const createInsightDescription = `Create SQL insight over workflow data.
108
+ /**
109
+ * Format a headers/rows result set as a markdown table (first 10 rows)
110
+ */
111
+ function formatResultTable(headers, rows) {
112
+ if (!headers || !rows) {
113
+ return '⚠️ No data returned\n';
114
+ }
115
+ if (rows.length === 0) {
116
+ return `**Columns:** ${headers.join(', ')}\n\n⚠️ **No rows matched** - Check your query filters\n`;
117
+ }
118
+ let text = `**Columns:** ${headers.join(', ')}\n\n`;
119
+ text += '**Sample Data (first 10 rows):**\n```\n';
120
+ text += headers.join(' | ') + '\n';
121
+ text += headers.map(() => '---').join(' | ') + '\n';
122
+ const rowsToShow = Math.min(rows.length, 10);
123
+ for (let idx = 0; idx < rowsToShow; idx++) {
124
+ text += rows[idx].map(val => String(val || '')).join(' | ') + '\n';
125
+ }
126
+ if (rows.length > 10) {
127
+ text += `\n... and ${rows.length - 10} more rows\n`;
128
+ }
129
+ text += '```\n';
130
+ return text;
131
+ }
132
+ // ============================================================================
133
+ // RUN INSIGHT TOOL (saved execution + ad-hoc preview)
134
+ // ============================================================================
135
+ const runInsightDescription = `Execute an insight query and return rows. Two modes (mutually exclusive):
136
+ - Saved: pass insightId to run a stored insight. refresh: true recalculates instead of returning cached results.
137
+ - Ad-hoc: pass sources + query to test SQL without saving. One call replaces multiple list_activities calls. Always run ad-hoc before save_insight.
107
138
 
108
139
  ${INSIGHT_SQL_GUIDE}`;
109
- exports.createInsightTool = {
110
- name: 'create_insight',
140
+ /** Saved-insight path: v3.insight.data */
141
+ async function runSavedInsight(insightId, refresh, context) {
142
+ try {
143
+ logger.debug('Calling v3.insight.data', { insightId, refresh });
144
+ // Call v3.insight.data endpoint ('update' is the API name for refresh)
145
+ const result = await context.hailer.request('v3.insight.data', [insightId, { update: refresh }]);
146
+ logger.debug('Insight data retrieved', {
147
+ headers: result.headers?.length,
148
+ rows: result.rows?.length,
149
+ fullResult: JSON.stringify(result).substring(0, 500)
150
+ });
151
+ let responseText = `✅ **Insight Data Retrieved** (${result.rows?.length || 0} rows)\n\n`;
152
+ responseText += formatResultTable(result.headers, result.rows);
153
+ if (!result.headers || !result.rows) {
154
+ responseText += `**Debug:** Response keys: ${Object.keys(result).join(', ')}\n`;
155
+ responseText += `**Full response (truncated):** \`${JSON.stringify(result).substring(0, 300)}\`\n`;
156
+ }
157
+ return {
158
+ content: [{
159
+ type: 'text',
160
+ text: responseText,
161
+ }],
162
+ };
163
+ }
164
+ catch (error) {
165
+ if (!request_logger_1.RequestLogger.getCurrent()) {
166
+ logger.error('Error getting insight data', error);
167
+ }
168
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
169
+ return {
170
+ content: [{
171
+ type: 'text',
172
+ text: `❌ **Error getting insight data**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- Permission denied\n- Insight query has errors\n- Use \`list_insights\` to verify insight ID`,
173
+ }],
174
+ };
175
+ }
176
+ }
177
+ /** Ad-hoc path: v3.insight.preview */
178
+ async function runAdHocInsight(sources, query, context) {
179
+ try {
180
+ // Resolve workspace ID (returns undefined if cache unavailable)
181
+ const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)({}, context);
182
+ if (!workspaceId) {
183
+ return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
184
+ }
185
+ logger.debug('Calling v3.insight.preview', {
186
+ workspaceId,
187
+ sourcesCount: sources.length,
188
+ });
189
+ // Normalize sources (convert 'id' to 'fieldId' if needed)
190
+ const normalizedSources = normalizeFields(sources);
191
+ const previewData = {
192
+ sources: normalizedSources,
193
+ query,
194
+ };
195
+ // Call v3.insight.preview endpoint
196
+ const result = await context.hailer.request('v3.insight.preview', [workspaceId, previewData]);
197
+ logger.debug('Preview successful', {
198
+ headers: result.headers?.length,
199
+ rows: result.rows?.length
200
+ });
201
+ let responseText = `✅ **Preview Results** (~${result.rows?.length || 0} rows)\n\n`;
202
+ responseText += formatResultTable(result.headers, result.rows);
203
+ responseText += '\n✅ **Query is valid!** Ready to save with `save_insight`.';
204
+ return {
205
+ content: [{
206
+ type: 'text',
207
+ text: responseText,
208
+ }],
209
+ };
210
+ }
211
+ catch (error) {
212
+ if (!request_logger_1.RequestLogger.getCurrent()) {
213
+ logger.error('Error previewing insight', error);
214
+ }
215
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
216
+ return {
217
+ content: [{
218
+ type: 'text',
219
+ text: `❌ **Preview Failed**\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check SQL syntax\n- Verify field names match source definitions\n- Ensure workflow IDs are correct\n- Check table aliases match source names`,
220
+ }],
221
+ };
222
+ }
223
+ }
224
+ exports.runInsightTool = {
225
+ name: 'run_insight',
111
226
  group: tool_registry_1.ToolGroup.PLAYGROUND,
112
- description: createInsightDescription,
227
+ description: runInsightDescription,
113
228
  schema: zod_1.z.object({
114
- workspaceId: zod_1.z
229
+ insightId: zod_1.z
115
230
  .string()
116
231
  .optional()
117
- .describe("Optional workspace ID or name - defaults to current workspace"),
118
- name: zod_1.z
119
- .string()
120
- .min(1)
121
- .describe("Insight name"),
122
- public: zod_1.z
232
+ .describe('Saved insight ID to execute. Mutually exclusive with sources/query.'),
233
+ refresh: zod_1.z
123
234
  .boolean()
124
235
  .optional()
125
- .default(false)
126
- .describe("Whether insight is publicly accessible (default: false)"),
236
+ .describe('Saved mode only: recalculate data (true) instead of using cached results (false, default)'),
127
237
  sources: zod_1.z
128
238
  .array(sourceSchema)
129
239
  .min(1)
130
- .describe("Workflow sources. source.name = SQL table name, field.name = SQL column name. Never use IDs in the query."),
240
+ .optional()
241
+ .describe('Ad-hoc mode: workflow sources. source.name = SQL table name, field.name = SQL column name.'),
131
242
  query: zod_1.z
132
243
  .string()
133
244
  .min(1)
134
- .describe("SQL query (SELECT, JOIN, WHERE, GROUP BY, ORDER BY, etc.)"),
245
+ .optional()
246
+ .describe('Ad-hoc mode: SQL query to test'),
135
247
  }),
136
248
  async execute(args, context) {
137
- logger.debug('Creating insight', {
138
- name: args.name,
139
- workspaceId: args.workspaceId,
140
- sourcesCount: args.sources.length,
249
+ logger.debug('Running insight', {
250
+ insightId: args.insightId,
251
+ refresh: args.refresh,
252
+ sourcesCount: args.sources?.length,
253
+ hasQuery: !!args.query,
141
254
  apiKey: context.apiKey.substring(0, 8) + '...'
142
255
  });
143
- try {
144
- // Resolve workspace ID (returns undefined if cache unavailable)
145
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
146
- if (!workspaceId) {
147
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
148
- }
149
- logger.debug('Calling v3.insight.create', {
150
- workspaceId,
151
- name: args.name,
152
- sourcesCount: args.sources.length
153
- });
154
- // Normalize sources (convert 'id' to 'fieldId' if needed)
155
- const normalizedSources = normalizeFields(args.sources);
156
- // Build insight payload
157
- const insightData = {
158
- name: args.name,
159
- public: args.public || false,
160
- sources: normalizedSources,
161
- query: args.query,
256
+ const hasAdHocArgs = !!args.sources || !!args.query;
257
+ if (args.insightId && hasAdHocArgs) {
258
+ return {
259
+ content: [{
260
+ type: 'text',
261
+ text: '❌ **Conflicting modes**\n\nPass EITHER `insightId` (run a saved insight) OR `sources` + `query` (ad-hoc test) — not both.',
262
+ }],
162
263
  };
163
- // Call v3.insight.create endpoint
164
- const result = await context.hailer.request('v3.insight.create', [workspaceId, insightData]);
165
- logger.debug('Insight creation successful', {
166
- insightId: result.insightId || result._id,
167
- result: JSON.stringify(result)
168
- });
169
- const insightId = result.insightId || result._id;
170
- const discussionId = result.discussionId || result.discussion;
171
- // Automatically join the insight's discussion
172
- if (discussionId) {
173
- try {
174
- logger.debug('Automatically joining insight discussion', { discussionId });
175
- await context.hailer.joinDiscussion(discussionId);
176
- logger.debug('Successfully joined insight discussion', { discussionId });
177
- }
178
- catch (joinError) {
179
- logger.warn('Failed to join insight discussion (non-fatal)', {
180
- discussionId,
181
- error: joinError instanceof Error ? joinError.message : String(joinError)
182
- });
183
- }
184
- }
185
- else {
186
- logger.debug('No discussion ID in response, skipping auto-join');
187
- }
188
- // Build success response
189
- let responseText = `✅ **Insight Created Successfully**\n\n`;
190
- responseText += `**Insight Name:** ${args.name}\n`;
191
- responseText += `**Insight ID:** \`${insightId}\`\n`;
192
- responseText += `**Workspace:** ${workspaceId}\n`;
193
- responseText += `**Public:** ${args.public ? 'Yes' : 'No'}\n`;
194
- responseText += `**Sources:** ${args.sources.length} workflow(s)\n`;
195
- if (discussionId) {
196
- responseText += `**Discussion:** Automatically joined ✓\n`;
197
- }
198
- responseText += `\n`;
199
- // Show sources
200
- responseText += `**Query Sources:**\n`;
201
- args.sources.forEach((source) => {
202
- responseText += `- \`${source.name}\` → Workflow: \`${source.workflowId}\` (${source.fields.length} fields)\n`;
203
- });
204
- responseText += `\n**SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n\n`;
205
- responseText += `💡 **Next Steps:**\n`;
206
- responseText += `- Use \`get_insight_data\` to execute the query and see results\n`;
207
- responseText += `- Use \`list_insights\` to see all insights in workspace\n`;
208
- responseText += `- Use \`update_insight\` to modify the insight\n`;
209
- responseText += `- Use \`preview_insight\` to test query changes before saving\n\n`;
210
- if (args.public) {
211
- responseText += `🌐 **Public Insight:** This insight can be accessed without authentication.\n`;
212
- }
264
+ }
265
+ if (args.insightId) {
266
+ return runSavedInsight(args.insightId, args.refresh ?? false, context);
267
+ }
268
+ if (!hasAdHocArgs) {
213
269
  return {
214
270
  content: [{
215
- type: "text",
216
- text: responseText,
271
+ type: 'text',
272
+ text: '❌ **Missing parameters**\n\nPass `insightId` to run a saved insight, or `sources` + `query` to test an ad-hoc SQL query.\n\nUse `list_insights` to find saved insight IDs.',
217
273
  }],
218
274
  };
219
275
  }
220
- catch (error) {
221
- if (!request_logger_1.RequestLogger.getCurrent())
222
- logger.error("Error creating insight", error);
223
- let errorMessage = 'Unknown error occurred';
224
- let errorDetails = '';
225
- if (error instanceof Error) {
226
- errorMessage = error.message;
227
- if (error.stack) {
228
- errorDetails = `\n\n**Stack trace:**\n\`\`\`\n${error.stack}\n\`\`\``;
229
- }
230
- }
231
- else if (typeof error === 'object' && error !== null) {
232
- try {
233
- errorMessage = JSON.stringify(error, null, 2);
234
- }
235
- catch {
236
- errorMessage = String(error);
237
- }
238
- }
239
- else {
240
- errorMessage = String(error);
241
- }
242
- // Handle SQL syntax errors
243
- if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
244
- return {
245
- content: [{
246
- type: "text",
247
- text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`preview_insight\` to test queries before creating\n- Make sure field IDs are correct (use \`get_workflow_schema\`)`,
248
- }],
249
- };
250
- }
251
- // Handle permission errors
252
- if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
253
- return {
254
- content: [{
255
- type: "text",
256
- text: `❌ **Permission Denied**\n\nYou may not have permission to create insights or access the specified workflows.\n\n**Error:** ${errorMessage}`,
257
- }],
258
- };
259
- }
276
+ if (!args.sources || !args.query) {
260
277
  return {
261
278
  content: [{
262
- type: "text",
263
- text: `❌ **Error creating insight**\n\n**Error:** ${errorMessage}${errorDetails}\n\n**Common Issues:**\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Workflow fields don't exist\n- Permission issues\n- Check field IDs with \`get_workflow_schema\`\n- Test query with \`preview_insight\` first`,
279
+ type: 'text',
280
+ text: '❌ **Incomplete ad-hoc query**\n\nAd-hoc mode requires BOTH `sources` and `query`.',
264
281
  }],
265
282
  };
266
283
  }
284
+ return runAdHocInsight(args.sources, args.query, context);
267
285
  }
268
286
  };
269
287
  // ============================================================================
270
- // PREVIEW INSIGHT TOOL
288
+ // SAVE INSIGHT TOOL (create + update upsert)
271
289
  // ============================================================================
272
- const previewInsightDescription = `Test SQL query before creating insight. One call replaces multiple list_activities calls. Always preview before create_insight.
290
+ const saveInsightDescription = `Create or update a SQL insight over workflow data (upsert).
291
+ - Create: omit insightId — name, sources, and query are required.
292
+ - Update: pass insightId — only the provided fields (name, public, sources, query) are changed.
273
293
 
274
294
  ${INSIGHT_SQL_GUIDE}`;
275
- exports.previewInsightTool = {
276
- name: 'preview_insight',
277
- group: tool_registry_1.ToolGroup.PLAYGROUND,
278
- description: previewInsightDescription,
279
- schema: zod_1.z.object({
280
- workspaceId: zod_1.z
281
- .string()
282
- .optional()
283
- .describe("Optional workspace ID or name - defaults to current workspace"),
284
- sources: zod_1.z
285
- .array(sourceSchema)
286
- .min(1)
287
- .describe("Workflow sources. Use source.name as table, field.name as column in SQL."),
288
- query: zod_1.z
289
- .string()
290
- .min(1)
291
- .describe("SQL query to test"),
292
- insightId: zod_1.z
293
- .string()
294
- .optional()
295
- .describe("Optional insight ID if previewing changes to existing insight"),
296
- }),
297
- async execute(args, context) {
298
- logger.debug('Previewing insight', {
299
- workspaceId: args.workspaceId,
300
- sourcesCount: args.sources.length,
301
- insightId: args.insightId,
302
- apiKey: context.apiKey.substring(0, 8) + '...'
295
+ /** Create path: v3.insight.create (auto-joins the insight's discussion) */
296
+ async function createNewInsight(args, context) {
297
+ const { name, sources, query } = args;
298
+ if (!name || !sources || !query) {
299
+ return {
300
+ content: [{
301
+ type: 'text',
302
+ text: '❌ **Missing required fields**\n\nCreating a new insight (no `insightId`) requires `name`, `sources`, and `query`.\n\nTo update an existing insight instead, pass its `insightId`.',
303
+ }],
304
+ };
305
+ }
306
+ try {
307
+ // Resolve workspace ID (returns undefined if cache unavailable)
308
+ const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
309
+ if (!workspaceId) {
310
+ return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
311
+ }
312
+ logger.debug('Calling v3.insight.create', {
313
+ workspaceId,
314
+ name,
315
+ sourcesCount: sources.length
303
316
  });
304
- try {
305
- // Resolve workspace ID (returns undefined if cache unavailable)
306
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
307
- if (!workspaceId) {
308
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
309
- }
310
- logger.debug('Calling v3.insight.preview', {
311
- workspaceId,
312
- sourcesCount: args.sources.length,
313
- insightId: args.insightId
314
- });
315
- // Normalize sources (convert 'id' to 'fieldId' if needed)
316
- const normalizedSources = normalizeFields(args.sources);
317
- // Build preview payload (insightId not accepted by v3.insight.preview)
318
- const previewData = {
319
- sources: normalizedSources,
320
- query: args.query,
321
- };
322
- // Call v3.insight.preview endpoint
323
- const result = await context.hailer.request('v3.insight.preview', [workspaceId, previewData]);
324
- logger.debug('Preview successful', {
325
- headers: result.headers?.length,
326
- rows: result.rows?.length
327
- });
328
- // Format results
329
- let responseText = `✅ **Preview Results** (~${result.rows?.length || 0} rows)\n\n`;
330
- if (!result.headers || !result.rows) {
331
- responseText += `⚠️ No data returned from preview\n`;
332
- }
333
- else if (result.rows.length === 0) {
334
- responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
335
- responseText += `⚠️ **No rows matched** - Check your query filters\n`;
336
- }
337
- else {
338
- responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
339
- responseText += `**Sample Data:**\n\`\`\`\n`;
340
- // Show column headers
341
- responseText += result.headers.join(' | ') + '\n';
342
- responseText += result.headers.map(() => '---').join(' | ') + '\n';
343
- // Show first 10 rows
344
- const rowsToShow = Math.min(result.rows.length, 10);
345
- for (let i = 0; i < rowsToShow; i++) {
346
- responseText += result.rows[i].map(v => String(v || '')).join(' | ') + '\n';
347
- }
348
- if (result.rows.length > 10) {
349
- responseText += `\n... and ${result.rows.length - 10} more rows\n`;
350
- }
351
- responseText += `\`\`\`\n\n`;
317
+ // Normalize sources (convert 'id' to 'fieldId' if needed)
318
+ const normalizedSources = normalizeFields(sources);
319
+ // Build insight payload
320
+ const insightData = {
321
+ name,
322
+ public: args.public || false,
323
+ sources: normalizedSources,
324
+ query,
325
+ };
326
+ // Call v3.insight.create endpoint
327
+ const result = await context.hailer.request('v3.insight.create', [workspaceId, insightData]);
328
+ logger.debug('Insight creation successful', {
329
+ insightId: result.insightId || result._id,
330
+ result: JSON.stringify(result)
331
+ });
332
+ const insightId = result.insightId || result._id;
333
+ const discussionId = result.discussionId || result.discussion;
334
+ // Automatically join the insight's discussion
335
+ if (discussionId) {
336
+ try {
337
+ logger.debug('Automatically joining insight discussion', { discussionId });
338
+ await context.hailer.joinDiscussion(discussionId);
339
+ logger.debug('Successfully joined insight discussion', { discussionId });
340
+ }
341
+ catch (joinError) {
342
+ logger.warn('Failed to join insight discussion (non-fatal)', {
343
+ discussionId,
344
+ error: joinError instanceof Error ? joinError.message : String(joinError)
345
+ });
352
346
  }
353
- responseText += `\n✅ **Query is valid!** Ready to use in \`create_insight\` or \`update_insight\`.`;
347
+ }
348
+ if (!discussionId) {
349
+ logger.debug('No discussion ID in response, skipping auto-join');
350
+ }
351
+ // Build success response
352
+ let responseText = '✅ **Insight Created Successfully**\n\n';
353
+ responseText += `**Insight Name:** ${name}\n`;
354
+ responseText += `**Insight ID:** \`${insightId}\`\n`;
355
+ responseText += `**Workspace:** ${workspaceId}\n`;
356
+ responseText += `**Public:** ${args.public ? 'Yes' : 'No'}\n`;
357
+ responseText += `**Sources:** ${sources.length} workflow(s)\n`;
358
+ if (discussionId) {
359
+ responseText += '**Discussion:** Automatically joined ✓\n';
360
+ }
361
+ responseText += '\n';
362
+ // Show sources
363
+ responseText += '**Query Sources:**\n';
364
+ sources.forEach((source) => {
365
+ responseText += `- \`${source.name}\` → Workflow: \`${source.workflowId}\` (${source.fields.length} fields)\n`;
366
+ });
367
+ responseText += `\n**SQL Query:**\n\`\`\`sql\n${query}\n\`\`\`\n\n`;
368
+ responseText += '💡 **Next Steps:**\n';
369
+ responseText += '- Use `run_insight` with this insightId to execute the query and see results\n';
370
+ responseText += '- Use `list_insights` to see all insights in workspace\n';
371
+ responseText += '- Use `save_insight` with this insightId to modify the insight\n\n';
372
+ if (args.public) {
373
+ responseText += '🌐 **Public Insight:** This insight can be accessed without authentication.\n';
374
+ }
375
+ return {
376
+ content: [{
377
+ type: 'text',
378
+ text: responseText,
379
+ }],
380
+ };
381
+ }
382
+ catch (error) {
383
+ if (!request_logger_1.RequestLogger.getCurrent()) {
384
+ logger.error('Error creating insight', error);
385
+ }
386
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
387
+ const errorDetails = error instanceof Error && error.stack
388
+ ? `\n\n**Stack trace:**\n\`\`\`\n${error.stack}\n\`\`\``
389
+ : '';
390
+ // Handle SQL syntax errors
391
+ if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
354
392
  return {
355
393
  content: [{
356
- type: "text",
357
- text: responseText,
394
+ type: 'text',
395
+ text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`run_insight\` (sources + query) to test queries before saving\n- Make sure field IDs are correct (use \`describe_workflows\` with include:["schema"])`,
358
396
  }],
359
397
  };
360
398
  }
361
- catch (error) {
362
- if (!request_logger_1.RequestLogger.getCurrent())
363
- logger.error("Error previewing insight", error);
364
- let errorMessage = 'Unknown error occurred';
365
- if (error instanceof Error) {
366
- errorMessage = error.message;
367
- }
368
- else if (typeof error === 'object' && error !== null) {
369
- try {
370
- errorMessage = JSON.stringify(error, null, 2);
371
- }
372
- catch {
373
- errorMessage = String(error);
374
- }
375
- }
376
- else {
377
- errorMessage = String(error);
378
- }
399
+ // Handle permission errors
400
+ if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
379
401
  return {
380
402
  content: [{
381
- type: "text",
382
- text: `❌ **Preview Failed**\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check SQL syntax\n- Verify field names match source definitions\n- Ensure workflow IDs are correct\n- Check table aliases match source names`,
403
+ type: 'text',
404
+ text: `❌ **Permission Denied**\n\nYou may not have permission to create insights or access the specified workflows.\n\n**Error:** ${errorMessage}`,
383
405
  }],
384
406
  };
385
407
  }
408
+ return {
409
+ content: [{
410
+ type: 'text',
411
+ text: `❌ **Error creating insight**\n\n**Error:** ${errorMessage}${errorDetails}\n\n**Common Issues:**\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Workflow fields don't exist\n- Permission issues\n- Check field IDs with \`describe_workflows\` include:["schema"]\n- Test query with \`run_insight\` (sources + query) first`,
412
+ }],
413
+ };
386
414
  }
387
- };
388
- // ============================================================================
389
- // GET INSIGHT DATA TOOL
390
- // ============================================================================
391
- const getInsightDataDescription = `Execute insight and get results`;
392
- exports.getInsightDataTool = {
393
- name: 'get_insight_data',
394
- group: tool_registry_1.ToolGroup.PLAYGROUND,
395
- description: getInsightDataDescription,
396
- schema: zod_1.z.object({
397
- insightId: zod_1.z
398
- .string()
399
- .describe("Insight ID to execute"),
400
- update: zod_1.z
401
- .boolean()
402
- .optional()
403
- .default(false)
404
- .describe("Whether to recalculate data (true) or use cached results (false, default)"),
405
- }),
406
- async execute(args, context) {
407
- logger.debug('Getting insight data', {
408
- insightId: args.insightId,
409
- update: args.update,
410
- apiKey: context.apiKey.substring(0, 8) + '...'
415
+ }
416
+ /** Update path: v3.insight.update (partial-field semantics) */
417
+ async function updateExistingInsight(insightId, args, context) {
418
+ try {
419
+ // Build update payload - only include provided fields
420
+ const updateData = {};
421
+ if (args.name) {
422
+ updateData.name = args.name;
423
+ }
424
+ if (typeof args.public === 'boolean') {
425
+ updateData.public = args.public;
426
+ }
427
+ if (args.sources) {
428
+ updateData.sources = normalizeFields(args.sources);
429
+ }
430
+ if (args.query) {
431
+ updateData.query = args.query;
432
+ }
433
+ // Validate at least one field is being updated
434
+ if (Object.keys(updateData).length === 0) {
435
+ return {
436
+ content: [{
437
+ type: 'text',
438
+ text: `❌ **No updates provided**\n\nYou must provide at least one field to update:\n- name\n- public\n- sources\n- query\n\nExample:\n\`\`\`javascript\nsave_insight({\n insightId: "${insightId}",\n name: "New Name"\n})\n\`\`\``,
439
+ }],
440
+ };
441
+ }
442
+ logger.debug('Calling v3.insight.update', {
443
+ insightId,
444
+ updateFields: Object.keys(updateData)
411
445
  });
412
- try {
413
- logger.debug('Calling v3.insight.data', {
414
- insightId: args.insightId,
415
- update: args.update
416
- });
417
- // Call v3.insight.data endpoint
418
- const result = await context.hailer.request('v3.insight.data', [args.insightId, { update: args.update || false }]);
419
- logger.debug('Insight data retrieved', {
420
- headers: result.headers?.length,
421
- rows: result.rows?.length,
422
- fullResult: JSON.stringify(result).substring(0, 500)
423
- });
424
- // Format results
425
- let responseText = `✅ **Insight Data Retrieved** (${result.rows?.length || 0} rows)\n\n`;
426
- if (!result.headers || !result.rows) {
427
- responseText += `⚠️ No data returned\n`;
428
- responseText += `**Debug:** Response keys: ${Object.keys(result).join(', ')}\n`;
429
- responseText += `**Full response (truncated):** \`${JSON.stringify(result).substring(0, 300)}\`\n`;
430
- }
431
- else if (result.rows.length === 0) {
432
- responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
433
- responseText += `⚠️ **No rows matched**\n`;
434
- }
435
- else {
436
- responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
437
- responseText += `**Sample Data (first 10 rows):**\n\`\`\`\n`;
438
- // Show column headers
439
- responseText += result.headers.join(' | ') + '\n';
440
- responseText += result.headers.map(() => '---').join(' | ') + '\n';
441
- // Show first 10 rows
442
- const rowsToShow = Math.min(result.rows.length, 10);
443
- for (let i = 0; i < rowsToShow; i++) {
444
- responseText += result.rows[i].map(v => String(v || '')).join(' | ') + '\n';
445
- }
446
- if (result.rows.length > 10) {
447
- responseText += `\n... and ${result.rows.length - 10} more rows\n`;
448
- }
449
- responseText += `\`\`\`\n`;
450
- }
446
+ // Call v3.insight.update endpoint
447
+ // API expects: [insightId, updateData]
448
+ const result = await context.hailer.request('v3.insight.update', [
449
+ insightId,
450
+ updateData
451
+ ]);
452
+ logger.debug('Insight update successful', {
453
+ insightId,
454
+ result: JSON.stringify(result)
455
+ });
456
+ // Build success response
457
+ let responseText = '✅ **Insight Updated Successfully**\n\n';
458
+ responseText += `**Insight ID:** \`${insightId}\`\n`;
459
+ responseText += '**Updated Fields:**\n';
460
+ if (args.name) {
461
+ responseText += `- Name: ${args.name}\n`;
462
+ }
463
+ if (typeof args.public === 'boolean') {
464
+ responseText += `- Public: ${args.public ? 'Yes' : 'No'}\n`;
465
+ }
466
+ if (args.sources) {
467
+ responseText += `- Sources: ${args.sources.length} workflow(s)\n`;
468
+ }
469
+ if (args.query) {
470
+ responseText += '- Query: Updated\n';
471
+ }
472
+ if (args.query) {
473
+ responseText += `\n**New SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n`;
474
+ }
475
+ responseText += '\n💡 **Next Steps:**\n';
476
+ responseText += '- Use `run_insight` with `refresh: true` to see fresh results\n';
477
+ responseText += '- Use `run_insight` (sources + query) to test if you made query changes\n';
478
+ responseText += '- Use `list_insights` to see all insights\n';
479
+ return {
480
+ content: [{
481
+ type: 'text',
482
+ text: responseText,
483
+ }],
484
+ };
485
+ }
486
+ catch (error) {
487
+ if (!request_logger_1.RequestLogger.getCurrent()) {
488
+ logger.error('Error updating insight', error);
489
+ }
490
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
491
+ // Handle SQL syntax errors
492
+ if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
451
493
  return {
452
494
  content: [{
453
- type: "text",
454
- text: responseText,
495
+ type: 'text',
496
+ text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`run_insight\` (sources + query) to test queries before updating\n- Make sure field IDs are correct (use \`describe_workflows\` with include:["schema"])`,
455
497
  }],
456
498
  };
457
499
  }
458
- catch (error) {
459
- if (!request_logger_1.RequestLogger.getCurrent())
460
- logger.error("Error getting insight data", error);
461
- let errorMessage = 'Unknown error occurred';
462
- if (error instanceof Error) {
463
- errorMessage = error.message;
464
- }
465
- else if (typeof error === 'object' && error !== null) {
466
- try {
467
- errorMessage = JSON.stringify(error, null, 2);
468
- }
469
- catch {
470
- errorMessage = String(error);
471
- }
472
- }
473
- else {
474
- errorMessage = String(error);
475
- }
500
+ // Handle permission errors
501
+ if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
476
502
  return {
477
503
  content: [{
478
- type: "text",
479
- text: `❌ **Error getting insight data**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- Permission denied\n- Insight query has errors\n- Use \`list_insights\` to verify insight ID`,
504
+ type: 'text',
505
+ text: `❌ **Permission Denied**\n\nYou may not have permission to update this insight.\n\n**Error:** ${errorMessage}`,
480
506
  }],
481
507
  };
482
508
  }
509
+ // Handle not found errors
510
+ if (errorMessage.includes('not found') || errorMessage.includes('NotFound')) {
511
+ return {
512
+ content: [{
513
+ type: 'text',
514
+ text: `❌ **Insight Not Found**\n\nInsight ID \`${insightId}\` does not exist.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Use \`list_insights\` to find valid insight IDs\n- Check for typos in the insight ID`,
515
+ }],
516
+ };
517
+ }
518
+ return {
519
+ content: [{
520
+ type: 'text',
521
+ text: `❌ **Error updating insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Permission issues\n- Use \`list_insights\` to verify insight ID\n- Use \`run_insight\` (sources + query) to test query changes first`,
522
+ }],
523
+ };
483
524
  }
484
- };
485
- // ============================================================================
486
- // UPDATE INSIGHT TOOL
487
- // ============================================================================
488
- const updateInsightDescription = `Update existing insight (name, query, sources, or visibility)`;
489
- exports.updateInsightTool = {
490
- name: 'update_insight',
525
+ }
526
+ exports.saveInsightTool = {
527
+ name: 'save_insight',
491
528
  group: tool_registry_1.ToolGroup.PLAYGROUND,
492
- description: updateInsightDescription,
529
+ description: saveInsightDescription,
493
530
  schema: zod_1.z.object({
531
+ workspaceId: zod_1.z
532
+ .string()
533
+ .optional()
534
+ .describe('Optional workspace ID or name - defaults to current workspace (create mode only)'),
494
535
  insightId: zod_1.z
495
536
  .string()
496
- .describe("Insight ID to update (24 characters)"),
537
+ .optional()
538
+ .describe('Existing insight ID to update (24 characters). Omit to create a new insight.'),
497
539
  name: zod_1.z
498
540
  .string()
541
+ .min(1)
499
542
  .optional()
500
- .describe("New insight name"),
543
+ .describe('Insight name (required when creating)'),
501
544
  public: zod_1.z
502
545
  .coerce.boolean()
503
546
  .optional()
504
- .describe("Whether insight is publicly accessible"),
547
+ .describe('Whether insight is publicly accessible (default: false on create)'),
505
548
  sources: zod_1.z
506
- .preprocess((val) => typeof val === 'string' ? JSON.parse(val) : val, zod_1.z.array(sourceSchema).optional())
507
- .describe("Updated workflow sources (like SQL table references)"),
549
+ .preprocess((val) => typeof val === 'string' ? JSON.parse(val) : val, zod_1.z.array(sourceSchema).min(1).optional())
550
+ .describe('Workflow sources (required when creating). source.name = SQL table name, field.name = SQL column name. Never use IDs in the query.'),
508
551
  query: zod_1.z
509
552
  .string()
553
+ .min(1)
510
554
  .optional()
511
- .describe("Updated SQL query"),
555
+ .describe('SQL query (SELECT, JOIN, WHERE, GROUP BY, ORDER BY, etc.) - required when creating'),
512
556
  }),
513
557
  async execute(args, context) {
514
- logger.debug('Updating insight', {
558
+ logger.debug('Saving insight', {
515
559
  insightId: args.insightId,
516
560
  hasName: !!args.name,
517
561
  hasQuery: !!args.query,
518
562
  hasSources: !!args.sources,
519
- hasPublic: args.public !== undefined,
563
+ hasPublic: typeof args.public === 'boolean',
520
564
  apiKey: context.apiKey.substring(0, 8) + '...'
521
565
  });
522
- try {
523
- // Build update payload - only include provided fields
524
- const updateData = {};
525
- if (args.name !== undefined) {
526
- updateData.name = args.name;
527
- }
528
- if (args.public !== undefined) {
529
- updateData.public = args.public;
530
- }
531
- if (args.sources !== undefined) {
532
- updateData.sources = normalizeFields(args.sources);
533
- }
534
- if (args.query !== undefined) {
535
- updateData.query = args.query;
536
- }
537
- // Validate at least one field is being updated
538
- if (Object.keys(updateData).length === 0) {
539
- return {
540
- content: [{
541
- type: "text",
542
- text: `❌ **No updates provided**\n\nYou must provide at least one field to update:\n- name\n- public\n- sources\n- query\n\nExample:\n\`\`\`javascript\nupdate_insight({\n insightId: "${args.insightId}",\n name: "New Name"\n})\n\`\`\``,
543
- }],
544
- };
545
- }
546
- logger.debug('Calling v3.insight.update', {
547
- insightId: args.insightId,
548
- updateFields: Object.keys(updateData)
549
- });
550
- // Call v3.insight.update endpoint
551
- // API expects: [insightId, updateData]
552
- const result = await context.hailer.request('v3.insight.update', [
553
- args.insightId,
554
- updateData
555
- ]);
556
- logger.debug('Insight update successful', {
557
- insightId: args.insightId,
558
- result: JSON.stringify(result)
559
- });
560
- // Build success response
561
- let responseText = `✅ **Insight Updated Successfully**\n\n`;
562
- responseText += `**Insight ID:** \`${args.insightId}\`\n`;
563
- responseText += `**Updated Fields:**\n`;
564
- if (args.name !== undefined) {
565
- responseText += `- Name: ${args.name}\n`;
566
- }
567
- if (args.public !== undefined) {
568
- responseText += `- Public: ${args.public ? 'Yes' : 'No'}\n`;
569
- }
570
- if (args.sources !== undefined) {
571
- responseText += `- Sources: ${args.sources.length} workflow(s)\n`;
572
- }
573
- if (args.query !== undefined) {
574
- responseText += `- Query: Updated\n`;
575
- }
576
- if (args.query) {
577
- responseText += `\n**New SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n`;
578
- }
579
- responseText += `\n💡 **Next Steps:**\n`;
580
- responseText += `- Use \`get_insight_data\` with \`update: true\` to see fresh results\n`;
581
- responseText += `- Use \`preview_insight\` to test if you made query changes\n`;
582
- responseText += `- Use \`list_insights\` to see all insights\n`;
583
- return {
584
- content: [{
585
- type: "text",
586
- text: responseText,
587
- }],
588
- };
589
- }
590
- catch (error) {
591
- if (!request_logger_1.RequestLogger.getCurrent())
592
- logger.error("Error updating insight", error);
593
- const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
594
- // Handle SQL syntax errors
595
- if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
596
- return {
597
- content: [{
598
- type: "text",
599
- text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`preview_insight\` to test queries before updating\n- Make sure field IDs are correct (use \`get_workflow_schema\`)`,
600
- }],
601
- };
602
- }
603
- // Handle permission errors
604
- if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
605
- return {
606
- content: [{
607
- type: "text",
608
- text: `❌ **Permission Denied**\n\nYou may not have permission to update this insight.\n\n**Error:** ${errorMessage}`,
609
- }],
610
- };
611
- }
612
- // Handle not found errors
613
- if (errorMessage.includes('not found') || errorMessage.includes('NotFound')) {
614
- return {
615
- content: [{
616
- type: "text",
617
- text: `❌ **Insight Not Found**\n\nInsight ID \`${args.insightId}\` does not exist.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Use \`list_insights\` to find valid insight IDs\n- Check for typos in the insight ID`,
618
- }],
619
- };
620
- }
621
- return {
622
- content: [{
623
- type: "text",
624
- text: `❌ **Error updating insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Permission issues\n- Use \`list_insights\` to verify insight ID\n- Use \`preview_insight\` to test query changes first`,
625
- }],
626
- };
566
+ if (args.insightId) {
567
+ return updateExistingInsight(args.insightId, args, context);
627
568
  }
569
+ return createNewInsight(args, context);
628
570
  }
629
571
  };
630
572
  // ============================================================================
@@ -638,15 +580,15 @@ exports.removeInsightTool = {
638
580
  schema: zod_1.z.object({
639
581
  insightId: zod_1.z
640
582
  .string()
641
- .describe("Insight ID to remove (get from list_insights or create_insight)"),
583
+ .describe('Insight ID to remove (get from list_insights or save_insight)'),
642
584
  confirmed: zod_1.z
643
585
  .boolean()
644
586
  .optional()
645
- .describe("First confirmation - must be true to proceed"),
587
+ .describe('First confirmation - must be true to proceed'),
646
588
  secondConfirmed: zod_1.z
647
589
  .boolean()
648
590
  .optional()
649
- .describe("Second confirmation - must be true to proceed (required for double-check safety)"),
591
+ .describe('Second confirmation - must be true to proceed (required for double-check safety)'),
650
592
  }),
651
593
  async execute(args, context) {
652
594
  logger.debug('Removing insight', {
@@ -664,7 +606,7 @@ exports.removeInsightTool = {
664
606
  // Fetch insight info and workspace info
665
607
  const [insightListResult, initData] = await Promise.all([
666
608
  context.hailer.request('v3.insight.list', [workspaceId]),
667
- context.hailer.request('v2.core.init', [["network"]])
609
+ context.hailer.request('v2.core.init', [['network']])
668
610
  ]);
669
611
  const insights = Array.isArray(insightListResult) ? insightListResult : (insightListResult.details || insightListResult.insights || []);
670
612
  const insight = insights.find((i) => i._id === args.insightId);
@@ -695,11 +637,11 @@ exports.removeInsightTool = {
695
637
  warningText += `\`\`\`\n\n`;
696
638
  warningText += `💡 **Before proceeding:**\n`;
697
639
  warningText += `- Load \`remove-insight-skill\` to review safety checklist\n`;
698
- warningText += `- Use \`get_insight_data\` to verify before deleting\n`;
640
+ warningText += `- Use \`run_insight\` to verify before deleting\n`;
699
641
  warningText += `- Verify with user that this is intentional`;
700
642
  return {
701
643
  content: [{
702
- type: "text",
644
+ type: 'text',
703
645
  text: warningText,
704
646
  }],
705
647
  };
@@ -724,14 +666,15 @@ exports.removeInsightTool = {
724
666
  responseText += `💡 Use \`list_insights\` to see remaining insights.`;
725
667
  return {
726
668
  content: [{
727
- type: "text",
669
+ type: 'text',
728
670
  text: responseText,
729
671
  }],
730
672
  };
731
673
  }
732
674
  catch (error) {
733
- if (!request_logger_1.RequestLogger.getCurrent())
734
- logger.error("Error removing insight", error);
675
+ if (!request_logger_1.RequestLogger.getCurrent()) {
676
+ logger.error('Error removing insight', error);
677
+ }
735
678
  let errorMessage = 'Unknown error occurred';
736
679
  if (error instanceof Error) {
737
680
  errorMessage = error.message;
@@ -749,7 +692,7 @@ exports.removeInsightTool = {
749
692
  }
750
693
  return {
751
694
  content: [{
752
- type: "text",
695
+ type: 'text',
753
696
  text: `❌ **Error removing insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- Permission denied\n- Insight already deleted\n- Use \`list_insights\` to verify insight ID`,
754
697
  }],
755
698
  };
@@ -765,7 +708,7 @@ exports.listInsightsTool = {
765
708
  workspaceId: zod_1.z
766
709
  .string()
767
710
  .optional()
768
- .describe("Optional workspace ID or name - defaults to current workspace"),
711
+ .describe('Optional workspace ID or name - defaults to current workspace'),
769
712
  }),
770
713
  async execute(args, context) {
771
714
  logger.debug('Listing insights', {
@@ -792,7 +735,7 @@ exports.listInsightsTool = {
792
735
  let responseText = `📊 **Insights Found** (${insights.length || 0} total)\n\n`;
793
736
  if (!insights || insights.length === 0) {
794
737
  responseText += `No insights found in this workspace.\n\n`;
795
- responseText += `💡 Use \`create_insight\` to create a new SQL-like report.`;
738
+ responseText += `💡 Use \`save_insight\` to create a new SQL-like report.`;
796
739
  }
797
740
  else {
798
741
  insights.forEach((insight, index) => {
@@ -807,20 +750,21 @@ exports.listInsightsTool = {
807
750
  responseText += ` - Query: \`${insight.query?.substring(0, 80)}${(insight.query?.length || 0) > 80 ? '...' : ''}\`\n\n`;
808
751
  });
809
752
  responseText += `💡 **Next Steps:**\n`;
810
- responseText += `- Use \`get_insight_data\` to execute an insight\n`;
811
- responseText += `- Use \`preview_insight\` to test query changes\n`;
753
+ responseText += `- Use \`run_insight\` with an insightId to execute an insight\n`;
754
+ responseText += `- Use \`run_insight\` with sources + query to test changes\n`;
812
755
  responseText += `- Use \`remove_insight\` to delete an insight\n`;
813
756
  }
814
757
  return {
815
758
  content: [{
816
- type: "text",
759
+ type: 'text',
817
760
  text: responseText,
818
761
  }],
819
762
  };
820
763
  }
821
764
  catch (error) {
822
- if (!request_logger_1.RequestLogger.getCurrent())
823
- logger.error("Error listing insights", error);
765
+ if (!request_logger_1.RequestLogger.getCurrent()) {
766
+ logger.error('Error listing insights', error);
767
+ }
824
768
  let errorMessage = 'Unknown error occurred';
825
769
  if (error instanceof Error) {
826
770
  errorMessage = error.message;
@@ -838,7 +782,7 @@ exports.listInsightsTool = {
838
782
  }
839
783
  return {
840
784
  content: [{
841
- type: "text",
785
+ type: 'text',
842
786
  text: `❌ **Error listing insights**\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check workspace ID is valid\n- Verify you have permission to list insights`,
843
787
  }],
844
788
  };
@@ -847,11 +791,9 @@ exports.listInsightsTool = {
847
791
  };
848
792
  /** All insight tools */
849
793
  exports.insightTools = [
850
- exports.createInsightTool,
851
- exports.previewInsightTool,
852
- exports.getInsightDataTool,
853
- exports.updateInsightTool,
854
- exports.removeInsightTool,
855
794
  exports.listInsightsTool,
795
+ exports.runInsightTool,
796
+ exports.saveInsightTool,
797
+ exports.removeInsightTool,
856
798
  ];
857
799
  //# sourceMappingURL=insight.js.map