@hailer/mcp 1.2.1 → 1.3.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 (774) 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 +133 -143
  6. package/.claude/skills/hailer-app-builder/SKILL.md +29 -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-prep.d.ts +27 -0
  11. package/dist/app-prep.d.ts.map +1 -0
  12. package/dist/app-prep.js +94 -0
  13. package/dist/app-prep.js.map +1 -0
  14. package/dist/app.d.ts.map +1 -1
  15. package/dist/app.js +3 -0
  16. package/dist/app.js.map +1 -1
  17. package/dist/bot/bot-manager.d.ts +9 -6
  18. package/dist/bot/bot-manager.d.ts.map +1 -1
  19. package/dist/bot/bot-manager.js +142 -31
  20. package/dist/bot/bot-manager.js.map +1 -1
  21. package/dist/bot/bot.d.ts +61 -16
  22. package/dist/bot/bot.d.ts.map +1 -1
  23. package/dist/bot/bot.js +927 -151
  24. package/dist/bot/bot.js.map +1 -1
  25. package/dist/bot/operation-logger.d.ts.map +1 -1
  26. package/dist/bot/operation-logger.js +24 -12
  27. package/dist/bot/operation-logger.js.map +1 -1
  28. package/dist/bot/services/bot-permissions.d.ts +37 -5
  29. package/dist/bot/services/bot-permissions.d.ts.map +1 -1
  30. package/dist/bot/services/bot-permissions.js +159 -35
  31. package/dist/bot/services/bot-permissions.js.map +1 -1
  32. package/dist/bot/services/conversation-manager.d.ts +23 -23
  33. package/dist/bot/services/conversation-manager.d.ts.map +1 -1
  34. package/dist/bot/services/conversation-manager.js +52 -49
  35. package/dist/bot/services/conversation-manager.js.map +1 -1
  36. package/dist/bot/services/helper-prompt.d.ts +8 -0
  37. package/dist/bot/services/helper-prompt.d.ts.map +1 -0
  38. package/dist/bot/services/helper-prompt.js +177 -0
  39. package/dist/bot/services/helper-prompt.js.map +1 -0
  40. package/dist/bot/services/message-classifier.d.ts +16 -16
  41. package/dist/bot/services/message-classifier.d.ts.map +1 -1
  42. package/dist/bot/services/message-classifier.js +55 -49
  43. package/dist/bot/services/message-classifier.js.map +1 -1
  44. package/dist/bot/services/message-formatter.d.ts +47 -38
  45. package/dist/bot/services/message-formatter.d.ts.map +1 -1
  46. package/dist/bot/services/message-formatter.js +99 -80
  47. package/dist/bot/services/message-formatter.js.map +1 -1
  48. package/dist/bot/services/permission-guard.d.ts.map +1 -1
  49. package/dist/bot/services/permission-guard.js +20 -10
  50. package/dist/bot/services/permission-guard.js.map +1 -1
  51. package/dist/bot/services/signal-router.d.ts.map +1 -1
  52. package/dist/bot/services/signal-router.js +11 -6
  53. package/dist/bot/services/signal-router.js.map +1 -1
  54. package/dist/bot/services/system-prompt.d.ts +14 -0
  55. package/dist/bot/services/system-prompt.d.ts.map +1 -1
  56. package/dist/bot/services/system-prompt.js +181 -4
  57. package/dist/bot/services/system-prompt.js.map +1 -1
  58. package/dist/bot/services/token-billing.d.ts +23 -23
  59. package/dist/bot/services/token-billing.d.ts.map +1 -1
  60. package/dist/bot/services/token-billing.js +51 -36
  61. package/dist/bot/services/token-billing.js.map +1 -1
  62. package/dist/bot/services/types.d.ts +3 -1
  63. package/dist/bot/services/types.d.ts.map +1 -1
  64. package/dist/bot/services/typing-indicator.d.ts +8 -8
  65. package/dist/bot/services/typing-indicator.d.ts.map +1 -1
  66. package/dist/bot/services/typing-indicator.js +12 -10
  67. package/dist/bot/services/typing-indicator.js.map +1 -1
  68. package/dist/bot/services/workspace-refresh.d.ts +3 -3
  69. package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
  70. package/dist/bot/services/workspace-refresh.js +23 -13
  71. package/dist/bot/services/workspace-refresh.js.map +1 -1
  72. package/dist/bot/tool-executor.d.ts +10 -6
  73. package/dist/bot/tool-executor.d.ts.map +1 -1
  74. package/dist/bot/tool-executor.js +12 -6
  75. package/dist/bot/tool-executor.js.map +1 -1
  76. package/dist/bot/workspace-overview.d.ts.map +1 -1
  77. package/dist/bot/workspace-overview.js +6 -3
  78. package/dist/bot/workspace-overview.js.map +1 -1
  79. package/dist/bot-config/activity-error.d.ts +47 -0
  80. package/dist/bot-config/activity-error.d.ts.map +1 -0
  81. package/dist/bot-config/activity-error.js +67 -0
  82. package/dist/bot-config/activity-error.js.map +1 -0
  83. package/dist/bot-config/context.d.ts +4 -4
  84. package/dist/bot-config/context.d.ts.map +1 -1
  85. package/dist/bot-config/context.js +18 -14
  86. package/dist/bot-config/context.js.map +1 -1
  87. package/dist/bot-config/events.d.ts +45 -0
  88. package/dist/bot-config/events.d.ts.map +1 -0
  89. package/dist/bot-config/events.js +51 -0
  90. package/dist/bot-config/events.js.map +1 -0
  91. package/dist/bot-config/index.d.ts +3 -0
  92. package/dist/bot-config/index.d.ts.map +1 -1
  93. package/dist/bot-config/index.js +8 -1
  94. package/dist/bot-config/index.js.map +1 -1
  95. package/dist/bot-config/loader.d.ts +3 -0
  96. package/dist/bot-config/loader.d.ts.map +1 -1
  97. package/dist/bot-config/loader.js +45 -20
  98. package/dist/bot-config/loader.js.map +1 -1
  99. package/dist/bot-config/persistence.js.map +1 -1
  100. package/dist/bot-config/reconciler.d.ts +11 -0
  101. package/dist/bot-config/reconciler.d.ts.map +1 -0
  102. package/dist/bot-config/reconciler.js +121 -0
  103. package/dist/bot-config/reconciler.js.map +1 -0
  104. package/dist/bot-config/state.d.ts.map +1 -1
  105. package/dist/bot-config/state.js.map +1 -1
  106. package/dist/bot-config/types.d.ts +32 -0
  107. package/dist/bot-config/types.d.ts.map +1 -1
  108. package/dist/bot-config/webhooks.d.ts.map +1 -1
  109. package/dist/bot-config/webhooks.js.map +1 -1
  110. package/dist/bot-config/workflow-installer.d.ts +37 -0
  111. package/dist/bot-config/workflow-installer.d.ts.map +1 -0
  112. package/dist/bot-config/workflow-installer.js +346 -0
  113. package/dist/bot-config/workflow-installer.js.map +1 -0
  114. package/dist/cli.d.ts +4 -1
  115. package/dist/cli.d.ts.map +1 -1
  116. package/dist/cli.js +92 -11
  117. package/dist/cli.js.map +1 -1
  118. package/dist/config.d.ts +23 -19
  119. package/dist/config.d.ts.map +1 -1
  120. package/dist/config.js +65 -27
  121. package/dist/config.js.map +1 -1
  122. package/dist/core.d.ts +6 -4
  123. package/dist/core.d.ts.map +1 -1
  124. package/dist/core.js +11 -16
  125. package/dist/core.js.map +1 -1
  126. package/dist/lib/logger.d.ts.map +1 -1
  127. package/dist/lib/logger.js +7 -4
  128. package/dist/lib/logger.js.map +1 -1
  129. package/dist/lib/request-logger.d.ts +19 -19
  130. package/dist/lib/request-logger.d.ts.map +1 -1
  131. package/dist/lib/request-logger.js +19 -19
  132. package/dist/lib/request-logger.js.map +1 -1
  133. package/dist/mcp/UserContextCache.d.ts +28 -22
  134. package/dist/mcp/UserContextCache.d.ts.map +1 -1
  135. package/dist/mcp/UserContextCache.js +23 -23
  136. package/dist/mcp/UserContextCache.js.map +1 -1
  137. package/dist/mcp/auth.js.map +1 -1
  138. package/dist/mcp/hailer-clients.d.ts +5 -4
  139. package/dist/mcp/hailer-clients.d.ts.map +1 -1
  140. package/dist/mcp/hailer-clients.js +83 -34
  141. package/dist/mcp/hailer-clients.js.map +1 -1
  142. package/dist/mcp/hailer-rpc.d.ts +40 -0
  143. package/dist/mcp/hailer-rpc.d.ts.map +1 -0
  144. package/dist/mcp/hailer-rpc.js +43 -0
  145. package/dist/mcp/hailer-rpc.js.map +1 -0
  146. package/dist/mcp/publish-auth-injector.d.ts +22 -0
  147. package/dist/mcp/publish-auth-injector.d.ts.map +1 -0
  148. package/dist/mcp/publish-auth-injector.js +100 -0
  149. package/dist/mcp/publish-auth-injector.js.map +1 -0
  150. package/dist/mcp/session-store.d.ts +16 -16
  151. package/dist/mcp/session-store.d.ts.map +1 -1
  152. package/dist/mcp/session-store.js +16 -16
  153. package/dist/mcp/session-store.js.map +1 -1
  154. package/dist/mcp/tool-profiles.d.ts +69 -0
  155. package/dist/mcp/tool-profiles.d.ts.map +1 -0
  156. package/dist/mcp/tool-profiles.js +184 -0
  157. package/dist/mcp/tool-profiles.js.map +1 -0
  158. package/dist/mcp/tool-registry.d.ts +16 -0
  159. package/dist/mcp/tool-registry.d.ts.map +1 -1
  160. package/dist/mcp/tool-registry.js +91 -39
  161. package/dist/mcp/tool-registry.js.map +1 -1
  162. package/dist/mcp/tools/activity.d.ts +2 -0
  163. package/dist/mcp/tools/activity.d.ts.map +1 -1
  164. package/dist/mcp/tools/activity.js +575 -218
  165. package/dist/mcp/tools/activity.js.map +1 -1
  166. package/dist/mcp/tools/aliases.d.ts +11 -0
  167. package/dist/mcp/tools/aliases.d.ts.map +1 -0
  168. package/dist/mcp/tools/aliases.js +182 -0
  169. package/dist/mcp/tools/aliases.js.map +1 -0
  170. package/dist/mcp/tools/app-core.d.ts +6 -8
  171. package/dist/mcp/tools/app-core.d.ts.map +1 -1
  172. package/dist/mcp/tools/app-core.js +355 -254
  173. package/dist/mcp/tools/app-core.js.map +1 -1
  174. package/dist/mcp/tools/app-marketplace.d.ts +12 -16
  175. package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
  176. package/dist/mcp/tools/app-marketplace.js +748 -856
  177. package/dist/mcp/tools/app-marketplace.js.map +1 -1
  178. package/dist/mcp/tools/app.d.ts +4 -7
  179. package/dist/mcp/tools/app.d.ts.map +1 -1
  180. package/dist/mcp/tools/app.js +4 -7
  181. package/dist/mcp/tools/app.js.map +1 -1
  182. package/dist/mcp/tools/bot-self.d.ts +21 -0
  183. package/dist/mcp/tools/bot-self.d.ts.map +1 -0
  184. package/dist/mcp/tools/bot-self.js +174 -0
  185. package/dist/mcp/tools/bot-self.js.map +1 -0
  186. package/dist/mcp/tools/calendar.d.ts +21 -0
  187. package/dist/mcp/tools/calendar.d.ts.map +1 -0
  188. package/dist/mcp/tools/calendar.js +741 -0
  189. package/dist/mcp/tools/calendar.js.map +1 -0
  190. package/dist/mcp/tools/company.d.ts.map +1 -1
  191. package/dist/mcp/tools/company.js +2 -1
  192. package/dist/mcp/tools/company.js.map +1 -1
  193. package/dist/mcp/tools/date.js.map +1 -1
  194. package/dist/mcp/tools/discussion.d.ts +29 -3
  195. package/dist/mcp/tools/discussion.d.ts.map +1 -1
  196. package/dist/mcp/tools/discussion.js +419 -534
  197. package/dist/mcp/tools/discussion.js.map +1 -1
  198. package/dist/mcp/tools/file.d.ts.map +1 -1
  199. package/dist/mcp/tools/file.js +18 -16
  200. package/dist/mcp/tools/file.js.map +1 -1
  201. package/dist/mcp/tools/index.js +4 -4
  202. package/dist/mcp/tools/index.js.map +1 -1
  203. package/dist/mcp/tools/insight.d.ts +24 -5
  204. package/dist/mcp/tools/insight.d.ts.map +1 -1
  205. package/dist/mcp/tools/insight.js +513 -480
  206. package/dist/mcp/tools/insight.js.map +1 -1
  207. package/dist/mcp/tools/user.d.ts.map +1 -1
  208. package/dist/mcp/tools/user.js +15 -13
  209. package/dist/mcp/tools/user.js.map +1 -1
  210. package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
  211. package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
  212. package/dist/mcp/tools/workflow-permissions.js +88 -97
  213. package/dist/mcp/tools/workflow-permissions.js.map +1 -1
  214. package/dist/mcp/tools/workflow.d.ts +9 -7
  215. package/dist/mcp/tools/workflow.d.ts.map +1 -1
  216. package/dist/mcp/tools/workflow.js +852 -860
  217. package/dist/mcp/tools/workflow.js.map +1 -1
  218. package/dist/mcp/utils/api-errors.d.ts.map +1 -1
  219. package/dist/mcp/utils/api-errors.js +2 -2
  220. package/dist/mcp/utils/api-errors.js.map +1 -1
  221. package/dist/mcp/utils/data-transformers.d.ts +0 -3
  222. package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
  223. package/dist/mcp/utils/data-transformers.js +32 -5
  224. package/dist/mcp/utils/data-transformers.js.map +1 -1
  225. package/dist/mcp/utils/file-upload.d.ts.map +1 -1
  226. package/dist/mcp/utils/file-upload.js +1 -1
  227. package/dist/mcp/utils/file-upload.js.map +1 -1
  228. package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
  229. package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
  230. package/dist/mcp/utils/hailer-api-client.js +113 -103
  231. package/dist/mcp/utils/hailer-api-client.js.map +1 -1
  232. package/dist/mcp/utils/index.d.ts.map +1 -1
  233. package/dist/mcp/utils/index.js.map +1 -1
  234. package/dist/mcp/utils/logger.d.ts.map +1 -1
  235. package/dist/mcp/utils/logger.js.map +1 -1
  236. package/dist/mcp/utils/response-builder.d.ts.map +1 -1
  237. package/dist/mcp/utils/response-builder.js +8 -4
  238. package/dist/mcp/utils/response-builder.js.map +1 -1
  239. package/dist/mcp/utils/role-utils.d.ts.map +1 -1
  240. package/dist/mcp/utils/role-utils.js +6 -3
  241. package/dist/mcp/utils/role-utils.js.map +1 -1
  242. package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
  243. package/dist/mcp/utils/tool-helpers.js +2 -2
  244. package/dist/mcp/utils/tool-helpers.js.map +1 -1
  245. package/dist/mcp/utils/types.d.ts +2 -1
  246. package/dist/mcp/utils/types.d.ts.map +1 -1
  247. package/dist/mcp/utils/types.js.map +1 -1
  248. package/dist/mcp/webhook-handler.d.ts +43 -8
  249. package/dist/mcp/webhook-handler.d.ts.map +1 -1
  250. package/dist/mcp/webhook-handler.js +861 -116
  251. package/dist/mcp/webhook-handler.js.map +1 -1
  252. package/dist/mcp/workspace-admin-store.d.ts +49 -0
  253. package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
  254. package/dist/mcp/workspace-admin-store.js +168 -0
  255. package/dist/mcp/workspace-admin-store.js.map +1 -0
  256. package/dist/mcp/workspace-cache.d.ts +2 -2
  257. package/dist/mcp/workspace-cache.d.ts.map +1 -1
  258. package/dist/mcp/workspace-cache.js +9 -5
  259. package/dist/mcp/workspace-cache.js.map +1 -1
  260. package/dist/mcp-server.d.ts +26 -11
  261. package/dist/mcp-server.d.ts.map +1 -1
  262. package/dist/mcp-server.js +367 -48
  263. package/dist/mcp-server.js.map +1 -1
  264. package/dist/plugins/vipunen/client.d.ts +41 -41
  265. package/dist/plugins/vipunen/client.d.ts.map +1 -1
  266. package/dist/plugins/vipunen/client.js +53 -48
  267. package/dist/plugins/vipunen/client.js.map +1 -1
  268. package/dist/plugins/vipunen/index.js.map +1 -1
  269. package/dist/plugins/vipunen/tools.d.ts.map +1 -1
  270. package/dist/plugins/vipunen/tools.js +6 -3
  271. package/dist/plugins/vipunen/tools.js.map +1 -1
  272. package/dist/public-chat/graduate.d.ts +29 -0
  273. package/dist/public-chat/graduate.d.ts.map +1 -0
  274. package/dist/public-chat/graduate.js +593 -0
  275. package/dist/public-chat/graduate.js.map +1 -0
  276. package/dist/public-chat/handler.d.ts +12 -0
  277. package/dist/public-chat/handler.d.ts.map +1 -0
  278. package/dist/public-chat/handler.js +183 -0
  279. package/dist/public-chat/handler.js.map +1 -0
  280. package/dist/public-chat/index.d.ts +16 -0
  281. package/dist/public-chat/index.d.ts.map +1 -0
  282. package/dist/public-chat/index.js +74 -0
  283. package/dist/public-chat/index.js.map +1 -0
  284. package/dist/public-chat/knowledge.d.ts +3 -0
  285. package/dist/public-chat/knowledge.d.ts.map +1 -0
  286. package/dist/public-chat/knowledge.js +1340 -0
  287. package/dist/public-chat/knowledge.js.map +1 -0
  288. package/dist/public-chat/rate-limit.d.ts +16 -0
  289. package/dist/public-chat/rate-limit.d.ts.map +1 -0
  290. package/dist/public-chat/rate-limit.js +51 -0
  291. package/dist/public-chat/rate-limit.js.map +1 -0
  292. package/dist/public-chat/session-store.d.ts +41 -0
  293. package/dist/public-chat/session-store.d.ts.map +1 -0
  294. package/dist/public-chat/session-store.js +95 -0
  295. package/dist/public-chat/session-store.js.map +1 -0
  296. package/dist/public-chat/studio-prewarm.d.ts +61 -0
  297. package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
  298. package/dist/public-chat/studio-prewarm.js +162 -0
  299. package/dist/public-chat/studio-prewarm.js.map +1 -0
  300. package/dist/public-chat/system-prompt.d.ts +22 -0
  301. package/dist/public-chat/system-prompt.d.ts.map +1 -0
  302. package/dist/public-chat/system-prompt.js +435 -0
  303. package/dist/public-chat/system-prompt.js.map +1 -0
  304. package/package.json +13 -7
  305. package/scripts/build-public-chat-knowledge.py +101 -0
  306. package/scripts/smoke-public-chat-live.ts +148 -0
  307. package/scripts/smoke-public-chat.ts +110 -0
  308. package/.claude/CLAUDE.md +0 -126
  309. package/.claude/commands/app-squad.md +0 -131
  310. package/.claude/commands/audit-squad.md +0 -158
  311. package/.claude/commands/cleanup-squad.md +0 -98
  312. package/.claude/commands/config-squad.md +0 -106
  313. package/.claude/commands/crud-squad.md +0 -87
  314. package/.claude/commands/data-squad.md +0 -97
  315. package/.claude/commands/doc-squad.md +0 -65
  316. package/.claude/commands/help.md +0 -29
  317. package/.claude/commands/help:agents.md +0 -182
  318. package/.claude/commands/help:commands.md +0 -78
  319. package/.claude/commands/help:faq.md +0 -79
  320. package/.claude/commands/help:plugins.md +0 -50
  321. package/.claude/commands/help:skills.md +0 -87
  322. package/.claude/commands/help:tools.md +0 -75
  323. package/.claude/commands/hotfix-squad.md +0 -112
  324. package/.claude/commands/integration-squad.md +0 -82
  325. package/.claude/commands/janitor-squad.md +0 -167
  326. package/.claude/commands/onboard-squad.md +0 -130
  327. package/.claude/commands/swarm.md +0 -210
  328. package/.claude/commands/tool-builder.md +0 -39
  329. package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
  330. package/dist/CLAUDE.md +0 -370
  331. package/dist/agents/bot-manager.d.ts +0 -48
  332. package/dist/agents/bot-manager.d.ts.map +0 -1
  333. package/dist/agents/bot-manager.js +0 -254
  334. package/dist/agents/bot-manager.js.map +0 -1
  335. package/dist/agents/bug-fixer/ai.d.ts +0 -80
  336. package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
  337. package/dist/agents/bug-fixer/ai.js +0 -466
  338. package/dist/agents/bug-fixer/ai.js.map +0 -1
  339. package/dist/agents/bug-fixer/bot.d.ts +0 -92
  340. package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
  341. package/dist/agents/bug-fixer/bot.js +0 -687
  342. package/dist/agents/bug-fixer/bot.js.map +0 -1
  343. package/dist/agents/bug-fixer/config.d.ts +0 -21
  344. package/dist/agents/bug-fixer/config.d.ts.map +0 -1
  345. package/dist/agents/bug-fixer/config.js +0 -218
  346. package/dist/agents/bug-fixer/config.js.map +0 -1
  347. package/dist/agents/bug-fixer/files.d.ts +0 -67
  348. package/dist/agents/bug-fixer/files.d.ts.map +0 -1
  349. package/dist/agents/bug-fixer/files.js +0 -386
  350. package/dist/agents/bug-fixer/files.js.map +0 -1
  351. package/dist/agents/bug-fixer/git.d.ts +0 -48
  352. package/dist/agents/bug-fixer/git.d.ts.map +0 -1
  353. package/dist/agents/bug-fixer/git.js +0 -298
  354. package/dist/agents/bug-fixer/git.js.map +0 -1
  355. package/dist/agents/bug-fixer/index.d.ts +0 -103
  356. package/dist/agents/bug-fixer/index.d.ts.map +0 -1
  357. package/dist/agents/bug-fixer/index.js +0 -262
  358. package/dist/agents/bug-fixer/index.js.map +0 -1
  359. package/dist/agents/bug-fixer/lsp.d.ts +0 -113
  360. package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
  361. package/dist/agents/bug-fixer/lsp.js +0 -485
  362. package/dist/agents/bug-fixer/lsp.js.map +0 -1
  363. package/dist/agents/bug-fixer/monitor.d.ts +0 -123
  364. package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
  365. package/dist/agents/bug-fixer/monitor.js +0 -629
  366. package/dist/agents/bug-fixer/monitor.js.map +0 -1
  367. package/dist/agents/bug-fixer/prompt.d.ts +0 -5
  368. package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
  369. package/dist/agents/bug-fixer/prompt.js +0 -94
  370. package/dist/agents/bug-fixer/prompt.js.map +0 -1
  371. package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
  372. package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
  373. package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
  374. package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
  375. package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
  376. package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
  377. package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
  378. package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
  379. package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
  380. package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
  381. package/dist/agents/bug-fixer/registries/pending.js +0 -49
  382. package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
  383. package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
  384. package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
  385. package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
  386. package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
  387. package/dist/agents/bug-fixer/specialist.d.ts +0 -47
  388. package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
  389. package/dist/agents/bug-fixer/specialist.js +0 -327
  390. package/dist/agents/bug-fixer/specialist.js.map +0 -1
  391. package/dist/agents/bug-fixer/types.d.ts +0 -123
  392. package/dist/agents/bug-fixer/types.d.ts.map +0 -1
  393. package/dist/agents/bug-fixer/types.js +0 -9
  394. package/dist/agents/bug-fixer/types.js.map +0 -1
  395. package/dist/agents/factory.d.ts +0 -172
  396. package/dist/agents/factory.d.ts.map +0 -1
  397. package/dist/agents/factory.js +0 -706
  398. package/dist/agents/factory.js.map +0 -1
  399. package/dist/agents/hailer-expert/index.d.ts +0 -8
  400. package/dist/agents/hailer-expert/index.d.ts.map +0 -1
  401. package/dist/agents/hailer-expert/index.js +0 -14
  402. package/dist/agents/hailer-expert/index.js.map +0 -1
  403. package/dist/agents/hal/daemon.d.ts +0 -174
  404. package/dist/agents/hal/daemon.d.ts.map +0 -1
  405. package/dist/agents/hal/daemon.js +0 -1385
  406. package/dist/agents/hal/daemon.js.map +0 -1
  407. package/dist/agents/hal/definitions.d.ts +0 -42
  408. package/dist/agents/hal/definitions.d.ts.map +0 -1
  409. package/dist/agents/hal/definitions.js +0 -300
  410. package/dist/agents/hal/definitions.js.map +0 -1
  411. package/dist/agents/hal/index.d.ts +0 -3
  412. package/dist/agents/hal/index.d.ts.map +0 -1
  413. package/dist/agents/hal/index.js +0 -8
  414. package/dist/agents/hal/index.js.map +0 -1
  415. package/dist/agents/index.d.ts +0 -18
  416. package/dist/agents/index.d.ts.map +0 -1
  417. package/dist/agents/index.js +0 -48
  418. package/dist/agents/index.js.map +0 -1
  419. package/dist/agents/shared/base.d.ts +0 -253
  420. package/dist/agents/shared/base.d.ts.map +0 -1
  421. package/dist/agents/shared/base.js +0 -1122
  422. package/dist/agents/shared/base.js.map +0 -1
  423. package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
  424. package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
  425. package/dist/agents/shared/schemas/action-schema.js +0 -483
  426. package/dist/agents/shared/schemas/action-schema.js.map +0 -1
  427. package/dist/agents/shared/services/agent-registry.d.ts +0 -108
  428. package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
  429. package/dist/agents/shared/services/agent-registry.js +0 -469
  430. package/dist/agents/shared/services/agent-registry.js.map +0 -1
  431. package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
  432. package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
  433. package/dist/agents/shared/services/conversation-manager.js +0 -168
  434. package/dist/agents/shared/services/conversation-manager.js.map +0 -1
  435. package/dist/agents/shared/services/mcp-client.d.ts +0 -56
  436. package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
  437. package/dist/agents/shared/services/mcp-client.js +0 -124
  438. package/dist/agents/shared/services/mcp-client.js.map +0 -1
  439. package/dist/agents/shared/services/message-classifier.d.ts +0 -37
  440. package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
  441. package/dist/agents/shared/services/message-classifier.js +0 -203
  442. package/dist/agents/shared/services/message-classifier.js.map +0 -1
  443. package/dist/agents/shared/services/message-formatter.d.ts +0 -89
  444. package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
  445. package/dist/agents/shared/services/message-formatter.js +0 -390
  446. package/dist/agents/shared/services/message-formatter.js.map +0 -1
  447. package/dist/agents/shared/services/session-logger.d.ts +0 -162
  448. package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
  449. package/dist/agents/shared/services/session-logger.js +0 -724
  450. package/dist/agents/shared/services/session-logger.js.map +0 -1
  451. package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
  452. package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
  453. package/dist/agents/shared/services/structured-output-executor.js +0 -296
  454. package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
  455. package/dist/agents/shared/services/token-billing.d.ts +0 -72
  456. package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
  457. package/dist/agents/shared/services/token-billing.js +0 -198
  458. package/dist/agents/shared/services/token-billing.js.map +0 -1
  459. package/dist/agents/shared/services/tool-executor.d.ts +0 -43
  460. package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
  461. package/dist/agents/shared/services/tool-executor.js +0 -175
  462. package/dist/agents/shared/services/tool-executor.js.map +0 -1
  463. package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
  464. package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
  465. package/dist/agents/shared/services/typing-indicator.js +0 -54
  466. package/dist/agents/shared/services/typing-indicator.js.map +0 -1
  467. package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
  468. package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
  469. package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
  470. package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
  471. package/dist/agents/shared/specialist.d.ts +0 -91
  472. package/dist/agents/shared/specialist.d.ts.map +0 -1
  473. package/dist/agents/shared/specialist.js +0 -399
  474. package/dist/agents/shared/specialist.js.map +0 -1
  475. package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
  476. package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
  477. package/dist/agents/shared/tool-schema-loader.js +0 -238
  478. package/dist/agents/shared/tool-schema-loader.js.map +0 -1
  479. package/dist/agents/shared/types.d.ts +0 -190
  480. package/dist/agents/shared/types.d.ts.map +0 -1
  481. package/dist/agents/shared/types.js +0 -13
  482. package/dist/agents/shared/types.js.map +0 -1
  483. package/dist/bot/bot-config.d.ts +0 -37
  484. package/dist/bot/bot-config.d.ts.map +0 -1
  485. package/dist/bot/bot-config.js +0 -219
  486. package/dist/bot/bot-config.js.map +0 -1
  487. package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
  488. package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
  489. package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
  490. package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
  491. package/dist/bot/services/session-logger.d.ts +0 -162
  492. package/dist/bot/services/session-logger.d.ts.map +0 -1
  493. package/dist/bot/services/session-logger.js +0 -724
  494. package/dist/bot/services/session-logger.js.map +0 -1
  495. package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
  496. package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
  497. package/dist/bot/services/workspace-schema-cache.js +0 -506
  498. package/dist/bot/services/workspace-schema-cache.js.map +0 -1
  499. package/dist/bot-config/tools.d.ts +0 -28
  500. package/dist/bot-config/tools.d.ts.map +0 -1
  501. package/dist/bot-config/tools.js +0 -279
  502. package/dist/bot-config/tools.js.map +0 -1
  503. package/dist/client/agents/base.d.ts +0 -207
  504. package/dist/client/agents/base.d.ts.map +0 -1
  505. package/dist/client/agents/base.js +0 -744
  506. package/dist/client/agents/base.js.map +0 -1
  507. package/dist/client/agents/definitions.d.ts +0 -53
  508. package/dist/client/agents/definitions.d.ts.map +0 -1
  509. package/dist/client/agents/definitions.js +0 -263
  510. package/dist/client/agents/definitions.js.map +0 -1
  511. package/dist/client/agents/orchestrator.d.ts +0 -141
  512. package/dist/client/agents/orchestrator.d.ts.map +0 -1
  513. package/dist/client/agents/orchestrator.js +0 -1062
  514. package/dist/client/agents/orchestrator.js.map +0 -1
  515. package/dist/client/agents/specialist.d.ts +0 -86
  516. package/dist/client/agents/specialist.d.ts.map +0 -1
  517. package/dist/client/agents/specialist.js +0 -340
  518. package/dist/client/agents/specialist.js.map +0 -1
  519. package/dist/client/bot-entrypoint.d.ts +0 -7
  520. package/dist/client/bot-entrypoint.d.ts.map +0 -1
  521. package/dist/client/bot-entrypoint.js +0 -103
  522. package/dist/client/bot-entrypoint.js.map +0 -1
  523. package/dist/client/bot-manager.d.ts +0 -44
  524. package/dist/client/bot-manager.d.ts.map +0 -1
  525. package/dist/client/bot-manager.js +0 -173
  526. package/dist/client/bot-manager.js.map +0 -1
  527. package/dist/client/bot-runner.d.ts +0 -35
  528. package/dist/client/bot-runner.d.ts.map +0 -1
  529. package/dist/client/bot-runner.js +0 -188
  530. package/dist/client/bot-runner.js.map +0 -1
  531. package/dist/client/chat-agent-daemon.d.ts +0 -464
  532. package/dist/client/chat-agent-daemon.d.ts.map +0 -1
  533. package/dist/client/chat-agent-daemon.js +0 -1774
  534. package/dist/client/chat-agent-daemon.js.map +0 -1
  535. package/dist/client/daemon-factory.d.ts +0 -106
  536. package/dist/client/daemon-factory.d.ts.map +0 -1
  537. package/dist/client/daemon-factory.js +0 -301
  538. package/dist/client/daemon-factory.js.map +0 -1
  539. package/dist/client/factory.d.ts +0 -111
  540. package/dist/client/factory.d.ts.map +0 -1
  541. package/dist/client/factory.js +0 -314
  542. package/dist/client/factory.js.map +0 -1
  543. package/dist/client/index.d.ts +0 -17
  544. package/dist/client/index.d.ts.map +0 -1
  545. package/dist/client/index.js +0 -38
  546. package/dist/client/index.js.map +0 -1
  547. package/dist/client/multi-bot-manager.d.ts +0 -42
  548. package/dist/client/multi-bot-manager.d.ts.map +0 -1
  549. package/dist/client/multi-bot-manager.js +0 -161
  550. package/dist/client/multi-bot-manager.js.map +0 -1
  551. package/dist/client/orchestrator-daemon.d.ts +0 -87
  552. package/dist/client/orchestrator-daemon.d.ts.map +0 -1
  553. package/dist/client/orchestrator-daemon.js +0 -444
  554. package/dist/client/orchestrator-daemon.js.map +0 -1
  555. package/dist/client/server.d.ts +0 -8
  556. package/dist/client/server.d.ts.map +0 -1
  557. package/dist/client/server.js +0 -251
  558. package/dist/client/server.js.map +0 -1
  559. package/dist/client/services/agent-registry.d.ts +0 -108
  560. package/dist/client/services/agent-registry.d.ts.map +0 -1
  561. package/dist/client/services/agent-registry.js +0 -630
  562. package/dist/client/services/agent-registry.js.map +0 -1
  563. package/dist/client/services/conversation-manager.d.ts +0 -50
  564. package/dist/client/services/conversation-manager.d.ts.map +0 -1
  565. package/dist/client/services/conversation-manager.js +0 -136
  566. package/dist/client/services/conversation-manager.js.map +0 -1
  567. package/dist/client/services/mcp-client.d.ts +0 -48
  568. package/dist/client/services/mcp-client.d.ts.map +0 -1
  569. package/dist/client/services/mcp-client.js +0 -105
  570. package/dist/client/services/mcp-client.js.map +0 -1
  571. package/dist/client/services/message-classifier.d.ts +0 -37
  572. package/dist/client/services/message-classifier.d.ts.map +0 -1
  573. package/dist/client/services/message-classifier.js +0 -187
  574. package/dist/client/services/message-classifier.js.map +0 -1
  575. package/dist/client/services/message-formatter.d.ts +0 -84
  576. package/dist/client/services/message-formatter.d.ts.map +0 -1
  577. package/dist/client/services/message-formatter.js +0 -353
  578. package/dist/client/services/message-formatter.js.map +0 -1
  579. package/dist/client/services/session-logger.d.ts +0 -106
  580. package/dist/client/services/session-logger.d.ts.map +0 -1
  581. package/dist/client/services/session-logger.js +0 -446
  582. package/dist/client/services/session-logger.js.map +0 -1
  583. package/dist/client/services/tool-executor.d.ts +0 -41
  584. package/dist/client/services/tool-executor.d.ts.map +0 -1
  585. package/dist/client/services/tool-executor.js +0 -169
  586. package/dist/client/services/tool-executor.js.map +0 -1
  587. package/dist/client/services/workspace-schema-cache.d.ts +0 -149
  588. package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
  589. package/dist/client/services/workspace-schema-cache.js +0 -732
  590. package/dist/client/services/workspace-schema-cache.js.map +0 -1
  591. package/dist/client/specialist-daemon.d.ts +0 -77
  592. package/dist/client/specialist-daemon.d.ts.map +0 -1
  593. package/dist/client/specialist-daemon.js +0 -197
  594. package/dist/client/specialist-daemon.js.map +0 -1
  595. package/dist/client/specialists.d.ts +0 -53
  596. package/dist/client/specialists.d.ts.map +0 -1
  597. package/dist/client/specialists.js +0 -178
  598. package/dist/client/specialists.js.map +0 -1
  599. package/dist/client/tool-schema-loader.d.ts +0 -62
  600. package/dist/client/tool-schema-loader.d.ts.map +0 -1
  601. package/dist/client/tool-schema-loader.js +0 -232
  602. package/dist/client/tool-schema-loader.js.map +0 -1
  603. package/dist/client/types.d.ts +0 -327
  604. package/dist/client/types.d.ts.map +0 -1
  605. package/dist/client/types.js +0 -121
  606. package/dist/client/types.js.map +0 -1
  607. package/dist/commands/seed-config.d.ts +0 -9
  608. package/dist/commands/seed-config.d.ts.map +0 -1
  609. package/dist/commands/seed-config.js +0 -377
  610. package/dist/commands/seed-config.js.map +0 -1
  611. package/dist/commands/setup.d.ts +0 -11
  612. package/dist/commands/setup.d.ts.map +0 -1
  613. package/dist/commands/setup.js +0 -320
  614. package/dist/commands/setup.js.map +0 -1
  615. package/dist/lib/discussion-lock.d.ts +0 -42
  616. package/dist/lib/discussion-lock.d.ts.map +0 -1
  617. package/dist/lib/discussion-lock.js +0 -110
  618. package/dist/lib/discussion-lock.js.map +0 -1
  619. package/dist/mcp/signal-handler.d.ts +0 -82
  620. package/dist/mcp/signal-handler.d.ts.map +0 -1
  621. package/dist/mcp/signal-handler.js +0 -406
  622. package/dist/mcp/signal-handler.js.map +0 -1
  623. package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
  624. package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
  625. package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
  626. package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
  627. package/dist/mcp/tools/app-member.d.ts +0 -14
  628. package/dist/mcp/tools/app-member.d.ts.map +0 -1
  629. package/dist/mcp/tools/app-member.js +0 -195
  630. package/dist/mcp/tools/app-member.js.map +0 -1
  631. package/dist/mcp/tools/app-scaffold.d.ts +0 -14
  632. package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
  633. package/dist/mcp/tools/app-scaffold.js +0 -581
  634. package/dist/mcp/tools/app-scaffold.js.map +0 -1
  635. package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
  636. package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
  637. package/dist/mcp/tools/bot-config/constants.js +0 -94
  638. package/dist/mcp/tools/bot-config/constants.js.map +0 -1
  639. package/dist/mcp/tools/bot-config/core.d.ts +0 -253
  640. package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
  641. package/dist/mcp/tools/bot-config/core.js +0 -2456
  642. package/dist/mcp/tools/bot-config/core.js.map +0 -1
  643. package/dist/mcp/tools/bot-config/index.d.ts +0 -10
  644. package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
  645. package/dist/mcp/tools/bot-config/index.js +0 -59
  646. package/dist/mcp/tools/bot-config/index.js.map +0 -1
  647. package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
  648. package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
  649. package/dist/mcp/tools/bot-config/tools.js +0 -15
  650. package/dist/mcp/tools/bot-config/tools.js.map +0 -1
  651. package/dist/mcp/tools/bot-config/types.d.ts +0 -50
  652. package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
  653. package/dist/mcp/tools/bot-config/types.js +0 -6
  654. package/dist/mcp/tools/bot-config/types.js.map +0 -1
  655. package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
  656. package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
  657. package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
  658. package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
  659. package/dist/mcp/tools/document.d.ts +0 -11
  660. package/dist/mcp/tools/document.d.ts.map +0 -1
  661. package/dist/mcp/tools/document.js +0 -741
  662. package/dist/mcp/tools/document.js.map +0 -1
  663. package/dist/mcp/tools/investigate.d.ts +0 -9
  664. package/dist/mcp/tools/investigate.d.ts.map +0 -1
  665. package/dist/mcp/tools/investigate.js +0 -254
  666. package/dist/mcp/tools/investigate.js.map +0 -1
  667. package/dist/mcp/utils/pagination.d.ts +0 -40
  668. package/dist/mcp/utils/pagination.d.ts.map +0 -1
  669. package/dist/mcp/utils/pagination.js +0 -55
  670. package/dist/mcp/utils/pagination.js.map +0 -1
  671. package/dist/modules/bug-reports/bug-config.d.ts +0 -25
  672. package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
  673. package/dist/modules/bug-reports/bug-config.js +0 -187
  674. package/dist/modules/bug-reports/bug-config.js.map +0 -1
  675. package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
  676. package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
  677. package/dist/modules/bug-reports/bug-monitor.js +0 -510
  678. package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
  679. package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
  680. package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
  681. package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
  682. package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
  683. package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
  684. package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
  685. package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
  686. package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
  687. package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
  688. package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
  689. package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
  690. package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
  691. package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
  692. package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
  693. package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
  694. package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
  695. package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
  696. package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
  697. package/dist/modules/bug-reports/giuseppe-files.js +0 -375
  698. package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
  699. package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
  700. package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
  701. package/dist/modules/bug-reports/giuseppe-git.js +0 -298
  702. package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
  703. package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
  704. package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
  705. package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
  706. package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
  707. package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
  708. package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
  709. package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
  710. package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
  711. package/dist/modules/bug-reports/index.d.ts +0 -77
  712. package/dist/modules/bug-reports/index.d.ts.map +0 -1
  713. package/dist/modules/bug-reports/index.js +0 -215
  714. package/dist/modules/bug-reports/index.js.map +0 -1
  715. package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
  716. package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
  717. package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
  718. package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
  719. package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
  720. package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
  721. package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
  722. package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
  723. package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
  724. package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
  725. package/dist/modules/bug-reports/pending-registry.js +0 -49
  726. package/dist/modules/bug-reports/pending-registry.js.map +0 -1
  727. package/dist/modules/bug-reports/types.d.ts +0 -123
  728. package/dist/modules/bug-reports/types.d.ts.map +0 -1
  729. package/dist/modules/bug-reports/types.js +0 -9
  730. package/dist/modules/bug-reports/types.js.map +0 -1
  731. package/dist/plugins/bug-fixer/index.d.ts +0 -2
  732. package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
  733. package/dist/plugins/bug-fixer/index.js +0 -18
  734. package/dist/plugins/bug-fixer/index.js.map +0 -1
  735. package/dist/plugins/bug-fixer/tools.d.ts +0 -45
  736. package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
  737. package/dist/plugins/bug-fixer/tools.js +0 -1096
  738. package/dist/plugins/bug-fixer/tools.js.map +0 -1
  739. package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
  740. package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
  741. package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
  742. package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
  743. package/dist/routes/agents.d.ts +0 -44
  744. package/dist/routes/agents.d.ts.map +0 -1
  745. package/dist/routes/agents.js +0 -311
  746. package/dist/routes/agents.js.map +0 -1
  747. package/dist/services/agent-credential-store.d.ts +0 -73
  748. package/dist/services/agent-credential-store.d.ts.map +0 -1
  749. package/dist/services/agent-credential-store.js +0 -212
  750. package/dist/services/agent-credential-store.js.map +0 -1
  751. package/dist/stdio-server.d.ts +0 -14
  752. package/dist/stdio-server.d.ts.map +0 -1
  753. package/dist/stdio-server.js +0 -101
  754. package/dist/stdio-server.js.map +0 -1
  755. package/dist/workspace/context.d.ts +0 -148
  756. package/dist/workspace/context.d.ts.map +0 -1
  757. package/dist/workspace/context.js +0 -339
  758. package/dist/workspace/context.js.map +0 -1
  759. package/dist/workspace/credentials.d.ts +0 -55
  760. package/dist/workspace/credentials.d.ts.map +0 -1
  761. package/dist/workspace/credentials.js +0 -239
  762. package/dist/workspace/credentials.js.map +0 -1
  763. package/dist/workspace/index.d.ts +0 -21
  764. package/dist/workspace/index.d.ts.map +0 -1
  765. package/dist/workspace/index.js +0 -45
  766. package/dist/workspace/index.js.map +0 -1
  767. package/dist/workspace/loader.d.ts +0 -27
  768. package/dist/workspace/loader.d.ts.map +0 -1
  769. package/dist/workspace/loader.js +0 -222
  770. package/dist/workspace/loader.js.map +0 -1
  771. package/dist/workspace/schema.d.ts +0 -37
  772. package/dist/workspace/schema.d.ts.map +0 -1
  773. package/dist/workspace/schema.js +0 -192
  774. package/dist/workspace/schema.js.map +0 -1
@@ -1,234 +1,367 @@
1
1
  "use strict";
2
2
  /**
3
- * App Tools - Marketplace & Templates
3
+ * App Tools - Marketplace (v2 tool surface)
4
4
  *
5
- * App marketplace and template management tools:
6
- * - List, create, get, and install templates
7
- * - Publish templates to marketplace
8
- * - Publish apps to marketplace
9
- * - Install marketplace apps
10
- * - Get product info and manifests
5
+ * Three merged marketplace tools:
6
+ * - browse_marketplace: list products / product detail (+ manifest)
7
+ * - install_marketplace: install app or template products (type auto-detected)
8
+ * - publish_marketplace: publish/update app or template listings
11
9
  */
12
10
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.appMarketplaceTools = exports.installMarketplaceAppTool = exports.publishAppTool = exports.getProductManifestTool = exports.getProductTool = exports.publishTemplateTool = exports.getTemplateTool = exports.installTemplateTool = exports.createTemplateTool = exports.listTemplatesTool = void 0;
11
+ exports.appMarketplaceTools = exports.getMarketplacePricingTool = exports.removeMarketplaceProductTool = exports.setMarketplaceVisibilityTool = exports.getInstalledVersionTool = exports.publishMarketplaceTool = exports.installMarketplaceTool = exports.browseMarketplaceTool = void 0;
14
12
  const zod_1 = require("zod");
15
13
  const tool_registry_1 = require("../tool-registry");
16
14
  const UserContextCache_1 = require("../UserContextCache");
17
15
  const logger_1 = require("../../lib/logger");
18
16
  const request_logger_1 = require("../../lib/request-logger");
19
17
  const tool_helpers_1 = require("../utils/tool-helpers");
18
+ const workspace_admin_store_1 = require("../workspace-admin-store");
20
19
  const logger = (0, logger_1.createLogger)({ component: 'app-marketplace' });
21
- const listTemplatesDescription = `List marketplace templates`;
22
- exports.listTemplatesTool = {
23
- name: 'list_templates',
24
- group: tool_registry_1.ToolGroup.PLAYGROUND,
25
- description: listTemplatesDescription,
26
- schema: zod_1.z.object({
27
- workspaceId: zod_1.z
28
- .string()
29
- .optional()
30
- .describe("Optional workspace ID - defaults to current workspace"),
31
- publicOnly: zod_1.z
32
- .boolean()
33
- .optional()
34
- .default(false)
35
- .describe("If true, show only public marketplace templates. If false (default), show private/workspace templates."),
36
- }),
37
- async execute(args, context) {
38
- const showPublic = args.publicOnly ?? false;
39
- logger.debug('Listing marketplace templates', {
40
- workspaceId: args.workspaceId,
41
- publicOnly: showPublic,
42
- apiKey: context.apiKey.substring(0, 8) + '...'
43
- });
44
- try {
45
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
46
- if (!workspaceId) {
47
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
48
- }
49
- logger.debug('Calling v3.product.list', { workspaceId, public: showPublic });
50
- // v3.product.list endpoint with public flag
51
- const result = await context.hailer.request('v3.product.list', [
52
- { cid: workspaceId, public: showPublic },
53
- {} // pagination options
54
- ]);
55
- logger.debug('Template list response', {
56
- result: JSON.stringify(result)
57
- });
58
- const templateType = showPublic ? 'Public Marketplace' : 'Private/Workspace';
59
- let responseText = `✅ **${templateType} Templates**\n\n`;
60
- responseText += `**Workspace:** ${workspaceId}\n`;
61
- responseText += `**Filter:** ${showPublic ? 'Public only' : 'Private/workspace'}\n\n`;
62
- // Handle response: {products: [], totalCount: 0}
63
- const products = result?.products || [];
64
- const totalCount = result?.totalCount || 0;
65
- if (products.length === 0) {
66
- responseText += `**No ${showPublic ? 'public' : 'private'} templates found.**\n\n`;
67
- if (showPublic) {
68
- responseText += `💡 Try \`list_templates()\` without \`publicOnly: true\` to see private workspace templates.\n`;
69
- }
70
- else {
71
- responseText += `💡 Use \`create_template\` to create a new template.\n`;
72
- }
73
- return {
74
- content: [{
75
- type: "text",
76
- text: responseText,
77
- }],
78
- };
79
- }
80
- const templates = products;
81
- responseText += `**Total Templates:** ${templates.length}\n\n`;
82
- templates.forEach((template, index) => {
83
- responseText += `### ${index + 1}. ${template.name || 'Unnamed Template'}\n`;
84
- responseText += `- **ID:** \`${template._id || template.id || 'N/A'}\`\n`;
85
- if (template.description) {
86
- responseText += `- **Description:** ${template.description}\n`;
87
- }
88
- if (template.creator) {
89
- responseText += `- **Creator:** ${template.creator}\n`;
90
- }
91
- if (template.version) {
92
- responseText += `- **Version:** ${template.version}\n`;
93
- }
94
- if (template.icon) {
95
- responseText += `- **Icon:** \`${template.icon}\`\n`;
96
- }
97
- if (template.images && template.images.length > 0) {
98
- responseText += `- **Images:** ${template.images.map((img) => `\`${img}\``).join(', ')}\n`;
99
- }
100
- responseText += `\n`;
101
- });
102
- responseText += `💡 **Next Steps:**\n`;
103
- responseText += `- Use \`install_template\` to install a template\n`;
104
- responseText += `- Use \`get_template\` to see template details`;
105
- return {
106
- content: [{
107
- type: "text",
108
- text: responseText,
109
- }],
110
- };
111
- }
112
- catch (error) {
113
- if (!request_logger_1.RequestLogger.getCurrent())
114
- logger.error("Error listing templates", error);
115
- const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
116
- return {
117
- content: [{
118
- type: "text",
119
- text: `❌ **Error listing templates**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- API endpoint not available\n- Permission issues`,
120
- }],
121
- };
20
+ function textResponse(text) {
21
+ return {
22
+ content: [{
23
+ type: 'text',
24
+ text,
25
+ }],
26
+ };
27
+ }
28
+ async function fetchProductDetail(productId, context) {
29
+ try {
30
+ logger.debug('Calling v3.app.product.get', { productId });
31
+ const result = await context.hailer.request('v3.app.product.get', [productId]);
32
+ if (result) {
33
+ return { product: result, source: 'v3' };
122
34
  }
123
35
  }
124
- };
36
+ catch (v3Error) {
37
+ logger.debug('v3 product get failed, falling back to v2 template lookup', {
38
+ productId,
39
+ error: v3Error instanceof Error ? v3Error.message : String(v3Error)
40
+ });
41
+ }
42
+ logger.debug('Calling v2.network.product.get', { productId });
43
+ const legacyResult = await context.hailer.request('v2.network.product.get', [productId]);
44
+ return { product: legacyResult?.product || legacyResult, source: 'v2' };
45
+ }
46
+ async function fetchProductManifest(productId, source, context) {
47
+ if (source === 'v3') {
48
+ logger.debug('Calling v3.app.product.getManifest', { productId });
49
+ return context.hailer.request('v3.app.product.getManifest', [productId]);
50
+ }
51
+ logger.debug('Calling v2.network.product.getManifest', { productId });
52
+ return context.hailer.request('v2.network.product.getManifest', [productId]);
53
+ }
54
+ function resolveProductType(source, product) {
55
+ if (source === 'v2') {
56
+ return 'template';
57
+ }
58
+ if (product?.type === 'template') {
59
+ return 'template';
60
+ }
61
+ return 'app';
62
+ }
125
63
  // ============================================================================
126
- // CREATE TEMPLATE TOOL (MARKETPLACE)
64
+ // BROWSE MARKETPLACE list products / product detail (+ manifest)
127
65
  // ============================================================================
128
- const createTemplateDescription = `Create marketplace template`;
129
- exports.createTemplateTool = {
130
- name: 'create_template',
131
- group: tool_registry_1.ToolGroup.PLAYGROUND,
132
- description: createTemplateDescription,
133
- schema: zod_1.z.object({
134
- name: zod_1.z
135
- .string()
136
- .min(1)
137
- .describe("Template name (required)"),
138
- description: zod_1.z
139
- .string()
140
- .optional()
141
- .describe("Template description"),
142
- workflowId: zod_1.z
143
- .string()
144
- .optional()
145
- .describe("Source workflow ID to create template from"),
146
- }),
147
- async execute(args, context) {
148
- logger.debug('Creating marketplace template', {
149
- name: args.name,
150
- hasWorkflowId: !!args.workflowId,
151
- apiKey: context.apiKey.substring(0, 8) + '...'
66
+ const browseMarketplaceDescription = `Browse the Hailer marketplace. Marketplace products come in two types — apps (installable web-apps) and ` +
67
+ `templates (packaged workspace configurations: workflows, phases, fields) — both distributed via the ` +
68
+ `marketplace.\n\n` +
69
+ `Without productId: lists products. publicOnly: true shows the public marketplace; default shows ` +
70
+ `private/workspace products. With productId: full details for one product (legacy v2 template IDs are ` +
71
+ `resolved via automatic fallback). Set includeManifest: true to also fetch the product manifest — its ` +
72
+ `versions and contained workflows — which you need before installing a specific version or ` +
73
+ `editing/publishing a new one.`;
74
+ const browseMarketplaceSchema = zod_1.z.object({
75
+ productId: zod_1.z
76
+ .string()
77
+ .min(1)
78
+ .optional()
79
+ .describe('Product ID for a detail view. Omit to list products.'),
80
+ includeManifest: zod_1.z
81
+ .boolean()
82
+ .optional()
83
+ .default(false)
84
+ .describe('Detail view only: also fetch the product manifest (versions + contained workflows)'),
85
+ publicOnly: zod_1.z
86
+ .boolean()
87
+ .optional()
88
+ .default(false)
89
+ .describe('List view only: true = public marketplace products, false (default) = private/workspace products'),
90
+ workspaceId: zod_1.z
91
+ .string()
92
+ .optional()
93
+ .describe('Optional workspace ID - defaults to current workspace'),
94
+ });
95
+ async function executeListProducts(args, context) {
96
+ const showPublic = args.publicOnly ?? false;
97
+ logger.debug('Listing marketplace products', {
98
+ workspaceId: args.workspaceId,
99
+ publicOnly: showPublic,
100
+ apiKey: context.apiKey.substring(0, 8) + '...'
101
+ });
102
+ try {
103
+ const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
104
+ if (!workspaceId) {
105
+ return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
106
+ }
107
+ logger.debug('Calling v3.product.list', { workspaceId, public: showPublic });
108
+ // v3.product.list endpoint with public flag
109
+ const result = await context.hailer.request('v3.product.list', [
110
+ { cid: workspaceId, public: showPublic },
111
+ {} // pagination options
112
+ ]);
113
+ logger.debug('Product list response', {
114
+ result: JSON.stringify(result)
152
115
  });
153
- try {
154
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)({}, context);
155
- if (!workspaceId) {
156
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
116
+ const listingType = showPublic ? 'Public Marketplace' : 'Private/Workspace';
117
+ let responseText = `✅ **${listingType} Products**\n\n`;
118
+ responseText += `**Workspace:** ${workspaceId}\n`;
119
+ responseText += `**Filter:** ${showPublic ? 'Public only' : 'Private/workspace'}\n\n`;
120
+ // Handle response: {products: [], totalCount: 0}
121
+ const products = result?.products || [];
122
+ if (products.length === 0) {
123
+ responseText += `**No ${showPublic ? 'public' : 'private'} products found.**\n\n`;
124
+ responseText += showPublic
125
+ ? `💡 Try \`browse_marketplace()\` without \`publicOnly: true\` to see private workspace products.\n`
126
+ : `💡 Use \`publish_marketplace\` to publish an app or template.\n`;
127
+ return textResponse(responseText);
128
+ }
129
+ responseText += `**Total Products:** ${products.length}\n\n`;
130
+ products.forEach((product, index) => {
131
+ responseText += `### ${index + 1}. ${product.name || 'Unnamed Product'}\n`;
132
+ responseText += `- **ID:** \`${product._id || product.id || 'N/A'}\`\n`;
133
+ if (product.type) {
134
+ responseText += `- **Type:** ${product.type}\n`;
157
135
  }
158
- // v2.network.product.create - creates a product entry (only accepts name)
159
- const templateData = {
160
- name: args.name
161
- };
162
- logger.debug('Calling v2.network.product.create', {
163
- workspaceId,
164
- templateData
165
- });
166
- const result = await context.hailer.request('v2.network.product.create', [templateData]);
167
- logger.debug('Template creation response', {
168
- result: JSON.stringify(result)
169
- });
170
- const templateId = result?.productId || result?._id || result?.id;
171
- let responseText = `✅ **Template Created Successfully**\n\n`;
172
- responseText += `**Template Name:** ${args.name}\n`;
173
- responseText += `**Template ID:** \`${templateId || 'See response'}\`\n`;
174
- responseText += `**Workspace:** ${workspaceId}\n`;
175
- responseText += `\n💡 **Next Steps:**\n`;
176
- responseText += `- Use Hailer marketplace UI to add workflows and description\n`;
177
- responseText += `- Share the template ID with others to install\n`;
178
- if (args.description || args.workflowId) {
179
- responseText += `\n⚠️ **Note:** The \`v3.app.product.create\` API only accepts \`name\`.\n`;
180
- responseText += `Description and workflow attachment must be done via Hailer UI.\n`;
136
+ if (product.description) {
137
+ responseText += `- **Description:** ${product.description}\n`;
181
138
  }
182
- return {
183
- content: [{
184
- type: "text",
185
- text: responseText,
186
- }],
187
- };
188
- }
189
- catch (error) {
190
- if (!request_logger_1.RequestLogger.getCurrent())
191
- logger.error("Error creating template", error);
192
- const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
193
- if (errorMessage.toLowerCase().includes('permission')) {
194
- return {
195
- content: [{
196
- type: "text",
197
- text: `❌ **Permission Denied**\n\nYou don't have permission to create templates. Only workspace administrators can create templates.\n\n**Error:** ${errorMessage}`,
198
- }],
199
- };
139
+ if (product.creator) {
140
+ responseText += `- **Creator:** ${product.creator}\n`;
200
141
  }
201
- return {
202
- content: [{
203
- type: "text",
204
- text: `❌ **Error creating template**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- User must be workspace administrator\n- Invalid workflow ID`,
205
- }],
206
- };
142
+ if (product.version) {
143
+ responseText += `- **Version:** ${product.version}\n`;
144
+ }
145
+ if (product.icon) {
146
+ responseText += `- **Icon:** \`${product.icon}\`\n`;
147
+ }
148
+ if (product.images && product.images.length > 0) {
149
+ responseText += `- **Images:** ${product.images.map((img) => `\`${img}\``).join(', ')}\n`;
150
+ }
151
+ responseText += `\n`;
152
+ });
153
+ responseText += `💡 **Next Steps:**\n`;
154
+ responseText += `- Use \`browse_marketplace({ productId })\` to see product details\n`;
155
+ responseText += `- Use \`install_marketplace({ productId })\` to install a product`;
156
+ return textResponse(responseText);
157
+ }
158
+ catch (error) {
159
+ if (!request_logger_1.RequestLogger.getCurrent()) {
160
+ logger.error('Error listing marketplace products', error);
161
+ }
162
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
163
+ return textResponse(`❌ **Error listing marketplace products**\n\n**Error:** ${errorMessage}\n\n` +
164
+ `**Common Issues:**\n- API endpoint not available\n- Permission issues`);
165
+ }
166
+ }
167
+ async function buildManifestSection(productId, source, context) {
168
+ try {
169
+ const manifest = await fetchProductManifest(productId, source, context);
170
+ logger.debug('Product manifest response', { manifest: JSON.stringify(manifest) });
171
+ if (!manifest) {
172
+ return '';
173
+ }
174
+ return `\n**Manifest:**\n\`\`\`json\n${JSON.stringify(manifest, null, 2)}\n\`\`\`\n`;
175
+ }
176
+ catch (manifestError) {
177
+ logger.debug('Could not fetch manifest', { error: manifestError });
178
+ return `\n⚠️ Manifest could not be fetched for this product.\n`;
179
+ }
180
+ }
181
+ async function checkTemplateInstalled(productId, context) {
182
+ if (!context.workspaceCache) {
183
+ return null;
184
+ }
185
+ try {
186
+ const workspaceId = context.workspaceCache.currentWorkspace._id;
187
+ const installed = await context.hailer.request('v2.network.product.isProductInstalled', [
188
+ productId,
189
+ workspaceId
190
+ ]);
191
+ logger.debug('Template installation check', { installed: JSON.stringify(installed) });
192
+ return installed || null;
193
+ }
194
+ catch (installCheckError) {
195
+ logger.debug('Could not check installation status', { error: installCheckError });
196
+ return null;
197
+ }
198
+ }
199
+ function buildInstalledSection(installedInfo) {
200
+ if (!installedInfo) {
201
+ return '';
202
+ }
203
+ if (!installedInfo.installed) {
204
+ return `\n⚪ **Status:** Not installed in current workspace\n`;
205
+ }
206
+ if (installedInfo.appId) {
207
+ return `\n✅ **Status:** Installed in current workspace\n**App ID:** \`${installedInfo.appId}\`\n`;
208
+ }
209
+ return `\n✅ **Status:** Installed in current workspace\n`;
210
+ }
211
+ async function executeProductDetail(args, context) {
212
+ const productId = args.productId;
213
+ logger.debug('Getting marketplace product details', {
214
+ productId,
215
+ includeManifest: args.includeManifest,
216
+ apiKey: context.apiKey.substring(0, 8) + '...'
217
+ });
218
+ try {
219
+ const detail = await fetchProductDetail(productId, context);
220
+ const product = detail.product;
221
+ logger.debug('Product detail response', {
222
+ source: detail.source,
223
+ result: JSON.stringify(product)
224
+ });
225
+ let responseText = `✅ **Product Details**\n\n`;
226
+ responseText += `**Product ID:** \`${productId}\`\n`;
227
+ if (product?.name) {
228
+ responseText += `**Name:** ${product.name}\n`;
229
+ }
230
+ if (product?.description) {
231
+ responseText += `**Description:** ${product.description}\n`;
232
+ }
233
+ if (product?.type) {
234
+ responseText += `**Type:** ${product.type}\n`;
235
+ }
236
+ if (product?.version) {
237
+ responseText += `**Version:** ${product.version}\n`;
207
238
  }
239
+ if (product?.versions?.length) {
240
+ responseText += `**Versions:** ${product.versions.length}\n`;
241
+ }
242
+ if (detail.source === 'v2') {
243
+ responseText += `**Source:** Legacy template (v2)\n`;
244
+ }
245
+ if (args.includeManifest) {
246
+ responseText += await buildManifestSection(productId, detail.source, context);
247
+ }
248
+ if (detail.source === 'v2') {
249
+ responseText += buildInstalledSection(await checkTemplateInstalled(productId, context));
250
+ }
251
+ responseText += `\n💡 **Next Steps:**\n`;
252
+ responseText += `- Use \`install_marketplace({ productId: "${productId}" })\` to install this product\n`;
253
+ responseText += `- Use \`browse_marketplace()\` to see other products`;
254
+ return textResponse(responseText);
255
+ }
256
+ catch (error) {
257
+ if (!request_logger_1.RequestLogger.getCurrent()) {
258
+ logger.error('Error getting marketplace product', error);
259
+ }
260
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
261
+ if (errorMessage.toLowerCase().includes('not found')) {
262
+ return textResponse(`❌ **Product Not Found**\n\nProduct ID \`${productId}\` not found in marketplace.\n\n` +
263
+ `**Check:**\n- Product ID is correct\n- Product exists and is published\n\n` +
264
+ `💡 Use \`browse_marketplace()\` to see available products.`);
265
+ }
266
+ return textResponse(`❌ **Error getting product**\n\n**Error:** ${errorMessage}\n\n` +
267
+ `**Common Issues:**\n- Invalid product ID\n- Product not found`);
268
+ }
269
+ }
270
+ exports.browseMarketplaceTool = {
271
+ name: 'browse_marketplace',
272
+ group: tool_registry_1.ToolGroup.PLAYGROUND,
273
+ description: browseMarketplaceDescription,
274
+ schema: browseMarketplaceSchema,
275
+ async execute(args, context) {
276
+ if (!args.productId) {
277
+ return executeListProducts(args, context);
278
+ }
279
+ return executeProductDetail(args, context);
208
280
  }
209
281
  };
210
282
  // ============================================================================
211
- // INSTALL TEMPLATE TOOL (MARKETPLACE)
283
+ // INSTALL MARKETPLACE install app or template products
212
284
  // ============================================================================
213
- const installTemplateDescription = `Install marketplace template to workspace`;
214
- exports.installTemplateTool = {
215
- name: 'install_template',
285
+ const installMarketplaceDescription = `Install a marketplace product into a workspace. Handles both product types automatically: apps are installed ` +
286
+ `via the v3 app install; templates (packaged workflows) via the v2 template install, which adds the ` +
287
+ `template's workflows to the workspace. The product type is detected from the marketplace entry — legacy v2 ` +
288
+ `template IDs route to the template path. Already-installed products are reported instead of reinstalled.`;
289
+ async function persistInstallAdminCredentials(productId, workspaceId, context) {
290
+ try {
291
+ const identity = await (0, workspace_admin_store_1.resolveAdminIdentity)(context.hailer.getClient());
292
+ // Only persist the admin key for a verified admin — an unverified
293
+ // admin's key triggers the bot-invite doom loop downstream.
294
+ if (!identity.emailVerified) {
295
+ logger.warn('Marketplace install: admin email not verified — not persisting admin credentials', {
296
+ workspaceId,
297
+ adminUid: identity.uid
298
+ });
299
+ return;
300
+ }
301
+ (0, workspace_admin_store_1.persistAdminCredentials)(workspaceId, context.apiKey, identity);
302
+ }
303
+ catch (persistError) {
304
+ // Install already succeeded — surface the failure with enough context to trace
305
+ // popup-auth breakage back to this install instead of swallowing it.
306
+ logger.warn('Marketplace install: failed to persist admin credentials — popup auth may need admin re-authorization', {
307
+ workspaceId,
308
+ productId,
309
+ error: persistError instanceof Error ? persistError.message : String(persistError)
310
+ });
311
+ }
312
+ }
313
+ async function findExistingInstall(productId, workspaceId, context) {
314
+ logger.debug('Checking if product is already installed', { productId, workspaceId });
315
+ try {
316
+ const isInstalledResult = await context.hailer.request('v3.app.product.isProductInstalled', [
317
+ productId,
318
+ workspaceId
319
+ ]);
320
+ return isInstalledResult || null;
321
+ }
322
+ catch (checkError) {
323
+ // Ignore check errors and proceed with installation
324
+ logger.debug('Could not check installation status, proceeding', {
325
+ error: checkError instanceof Error ? checkError.message : String(checkError)
326
+ });
327
+ return null;
328
+ }
329
+ }
330
+ async function installTemplateProduct(productId, workspaceId, context) {
331
+ logger.debug('Calling v2.network.product.install', { productId, workspaceId });
332
+ const result = await context.hailer.request('v2.network.product.install', [productId, workspaceId]);
333
+ logger.debug('Template installation response', { result: JSON.stringify(result) });
334
+ // Invalidate user context cache so subsequent workflow listings get fresh data
335
+ UserContextCache_1.UserContextCache.clearContext(context.apiKey);
336
+ logger.debug('Cleared user context cache after template install', {
337
+ apiKey: context.apiKey.substring(0, 8) + '...'
338
+ });
339
+ return result;
340
+ }
341
+ async function installAppProduct(productId, workspaceId, context) {
342
+ logger.debug('Calling v3.app.product.install', { productId, workspaceId });
343
+ const installResult = await context.hailer.request('v3.app.product.install', [productId, workspaceId]);
344
+ logger.debug('Install result', { result: JSON.stringify(installResult) });
345
+ await persistInstallAdminCredentials(productId, workspaceId, context);
346
+ return installResult;
347
+ }
348
+ exports.installMarketplaceTool = {
349
+ name: 'install_marketplace',
216
350
  group: tool_registry_1.ToolGroup.PLAYGROUND,
217
- description: installTemplateDescription,
351
+ description: installMarketplaceDescription,
218
352
  schema: zod_1.z.object({
219
- templateId: zod_1.z
353
+ productId: zod_1.z
220
354
  .string()
221
355
  .min(1)
222
- .describe("Template/Product ID to install"),
356
+ .describe('Marketplace product ID to install'),
223
357
  workspaceId: zod_1.z
224
358
  .string()
225
359
  .optional()
226
- .describe("Target workspace ID (defaults to current)"),
360
+ .describe('Target workspace ID (defaults to current)'),
227
361
  }),
228
362
  async execute(args, context) {
229
- logger.debug('Installing marketplace template', {
230
- templateId: args.templateId,
231
- workspaceId: args.workspaceId,
363
+ logger.debug('Installing marketplace product', {
364
+ productId: args.productId,
232
365
  apiKey: context.apiKey.substring(0, 8) + '...'
233
366
  });
234
367
  try {
@@ -236,242 +369,205 @@ exports.installTemplateTool = {
236
369
  if (!workspaceId) {
237
370
  return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
238
371
  }
239
- logger.debug('Calling v2.network.product.install', {
240
- templateId: args.templateId,
241
- workspaceId
242
- });
243
- const result = await context.hailer.request('v2.network.product.install', [
244
- args.templateId,
245
- workspaceId
246
- ]);
247
- logger.debug('Template installation response', {
248
- result: JSON.stringify(result)
249
- });
250
- // Invalidate user context cache so subsequent list_workflows calls get fresh data
251
- UserContextCache_1.UserContextCache.clearContext(context.apiKey);
252
- logger.debug('Cleared user context cache after template install', {
253
- apiKey: context.apiKey.substring(0, 8) + '...'
254
- });
255
- const appId = result?.appId || result?._id;
256
- let responseText = `✅ **Template Installed Successfully**\n\n`;
257
- responseText += `**Template ID:** \`${args.templateId}\`\n`;
258
- responseText += `**Workspace:** ${workspaceId}\n`;
259
- if (appId) {
260
- responseText += `**App ID:** \`${appId}\`\n`;
261
- }
262
- responseText += `\n💡 **Next Steps:**\n`;
263
- responseText += `- Use \`list_workflows\` to see new workflow(s)\n`;
264
- responseText += `- Use \`list_apps\` to see new app(s)\n`;
265
- return {
266
- content: [{
267
- type: "text",
268
- text: responseText,
269
- }],
270
- };
271
- }
272
- catch (error) {
273
- if (!request_logger_1.RequestLogger.getCurrent())
274
- logger.error("Error installing template", error);
275
- const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
276
- if (errorMessage.toLowerCase().includes('not found')) {
277
- return {
278
- content: [{
279
- type: "text",
280
- text: `❌ **Template Not Found**\n\nTemplate ID \`${args.templateId}\` not found in marketplace.\n\n**Check:**\n- Template ID is correct\n- Template is published and available\n\n💡 Use \`list_templates\` to see available templates.`,
281
- }],
282
- };
283
- }
284
- if (errorMessage.toLowerCase().includes('permission')) {
285
- return {
286
- content: [{
287
- type: "text",
288
- text: `❌ **Permission Denied**\n\nYou don't have permission to install templates. Only workspace administrators can install templates.\n\n**Error:** ${errorMessage}`,
289
- }],
290
- };
372
+ const existing = await findExistingInstall(args.productId, workspaceId, context);
373
+ if (existing?.installed) {
374
+ return textResponse(`ℹ️ **Product Already Installed**\n\nThis product is already installed in your workspace.\n\n` +
375
+ `**App ID:** \`${existing.appId || 'unknown'}\`\n\n**Tips:**\n- Use \`list_apps()\` to see installed apps\n` +
376
+ `- Use \`browse_marketplace({ productId: "${args.productId}" })\` to view product details`);
291
377
  }
292
- if (errorMessage.toLowerCase().includes('already installed')) {
293
- return {
294
- content: [{
295
- type: "text",
296
- text: `⚠️ **Template Already Installed**\n\nThis template is already installed in the workspace.\n\n**Template ID:** \`${args.templateId}\`\n\n💡 Use \`list_apps\` to see installed apps.`,
297
- }],
298
- };
299
- }
300
- // Include debug info for troubleshooting
301
- const debugInfo = {
302
- endpoint: 'v2.network.product.install',
303
- requestData: [args.templateId, args.workspaceId || 'current-workspace']
304
- };
305
- return {
306
- content: [{
307
- type: "text",
308
- text: `❌ **Error installing template**\n\n**Error:** ${errorMessage}\n\n**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n**Common Issues:**\n- Invalid template ID\n- Template not found\n- Permission denied\n- Already installed`,
309
- }],
310
- };
311
- }
312
- }
313
- };
314
- // ============================================================================
315
- // GET TEMPLATE TOOL (MARKETPLACE)
316
- // ============================================================================
317
- const getTemplateDescription = `Get template details from marketplace`;
318
- exports.getTemplateTool = {
319
- name: 'get_template',
320
- group: tool_registry_1.ToolGroup.PLAYGROUND,
321
- description: getTemplateDescription,
322
- schema: zod_1.z.object({
323
- templateId: zod_1.z
324
- .string()
325
- .min(1)
326
- .describe("Template/Product ID to get details for"),
327
- }),
328
- async execute(args, context) {
329
- logger.debug('Getting marketplace template', {
330
- templateId: args.templateId,
331
- apiKey: context.apiKey.substring(0, 8) + '...'
332
- });
333
- try {
334
- logger.debug('Calling v2.network.product.get', {
335
- templateId: args.templateId
336
- });
337
- const result = await context.hailer.request('v2.network.product.get', [args.templateId]);
338
- logger.debug('Template get response', {
339
- result: JSON.stringify(result)
340
- });
341
- const product = result?.product || result;
342
- let responseText = `✅ **Template Details**\n\n`;
343
- responseText += `**Template ID:** \`${args.templateId}\`\n`;
344
- if (product?.name) {
345
- responseText += `**Name:** ${product.name}\n`;
346
- }
347
- if (product?.description) {
348
- responseText += `**Description:** ${product.description}\n`;
349
- }
350
- if (product?.version) {
351
- responseText += `**Version:** ${product.version}\n`;
352
- }
353
- // Also try to get manifest
378
+ // Detect product type to route v2 template install vs v3 app install
379
+ let productName = 'Unknown';
380
+ let productType = 'app';
354
381
  try {
355
- const manifest = await context.hailer.request('v2.network.product.getManifest', [args.templateId]);
356
- logger.debug('Template manifest response', {
357
- manifest: JSON.stringify(manifest)
358
- });
359
- if (manifest) {
360
- responseText += `\n**Manifest:**\n\`\`\`json\n${JSON.stringify(manifest, null, 2)}\n\`\`\`\n`;
361
- }
362
- }
363
- catch (manifestError) {
364
- logger.debug('Could not fetch manifest', { error: manifestError });
382
+ const detail = await fetchProductDetail(args.productId, context);
383
+ productName = detail.product?.name || detail.product?.title || 'Unknown';
384
+ productType = resolveProductType(detail.source, detail.product);
365
385
  }
366
- // Check if installed (needs productId and workspaceId)
367
- try {
368
- if (context.workspaceCache) {
369
- const workspaceId = context.workspaceCache.currentWorkspace._id;
370
- const installed = await context.hailer.request('v2.network.product.isProductInstalled', [
371
- args.templateId,
372
- workspaceId
373
- ]);
374
- logger.debug('Template installation check', {
375
- installed: JSON.stringify(installed)
376
- });
377
- if (installed?.installed) {
378
- responseText += `\n✅ **Status:** Installed in current workspace\n`;
379
- if (installed.appId) {
380
- responseText += `**App ID:** \`${installed.appId}\`\n`;
381
- }
382
- }
383
- else {
384
- responseText += `\n⚪ **Status:** Not installed in current workspace\n`;
385
- }
386
- }
386
+ catch (productError) {
387
+ logger.debug('Could not fetch product details, defaulting to app install', {
388
+ error: productError instanceof Error ? productError.message : String(productError)
389
+ });
387
390
  }
388
- catch (installCheckError) {
389
- logger.debug('Could not check installation status', { error: installCheckError });
391
+ const installResult = productType === 'template'
392
+ ? await installTemplateProduct(args.productId, workspaceId, context)
393
+ : await installAppProduct(args.productId, workspaceId, context);
394
+ const installedAppId = installResult?.appId || installResult?.details?.appId || installResult?._id;
395
+ let responseText = `✅ **${productType === 'template' ? 'Template' : 'App'} Installed Successfully**\n\n`;
396
+ responseText += `**Product:** ${productName}\n`;
397
+ responseText += `**Product ID:** \`${args.productId}\`\n`;
398
+ if (installedAppId) {
399
+ responseText += `**Installed App ID:** \`${installedAppId}\`\n`;
390
400
  }
401
+ responseText += `**Workspace:** \`${workspaceId}\`\n`;
391
402
  responseText += `\n💡 **Next Steps:**\n`;
392
- responseText += `- Use \`install_template\` to install this template\n`;
393
- responseText += `- Use \`list_templates\` to see other templates`;
394
- return {
395
- content: [{
396
- type: "text",
397
- text: responseText,
398
- }],
399
- };
403
+ if (productType === 'template') {
404
+ responseText += `- Use \`describe_workflows\` to see the new workflow(s)\n`;
405
+ }
406
+ responseText += `- Use \`list_apps()\` to see installed app(s)\n`;
407
+ responseText += `- Use \`manage_app\` with action 'add_member' to share with workspace members\n`;
408
+ return textResponse(responseText);
400
409
  }
401
410
  catch (error) {
402
- if (!request_logger_1.RequestLogger.getCurrent())
403
- logger.error("Error getting template", error);
411
+ if (!request_logger_1.RequestLogger.getCurrent()) {
412
+ logger.error('Error installing marketplace product', error);
413
+ }
404
414
  const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
415
+ if (errorMessage.toLowerCase().includes('permission')) {
416
+ return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to install marketplace products. ` +
417
+ `Only workspace administrators can install.\n\n**Error:** ${errorMessage}`);
418
+ }
405
419
  if (errorMessage.toLowerCase().includes('not found')) {
406
- return {
407
- content: [{
408
- type: "text",
409
- text: `❌ **Template Not Found**\n\nTemplate ID \`${args.templateId}\` not found in marketplace.\n\n**Check:**\n- Template ID is correct\n- Template exists and is published\n\n💡 Use \`list_templates\` to see available templates.`,
410
- }],
411
- };
420
+ return textResponse(`❌ **Product Not Found**\n\nThe marketplace product \`${args.productId}\` was not found.\n\n` +
421
+ `**Tips:**\n- Verify the product ID is correct\n` +
422
+ `- Use \`browse_marketplace({ productId: "${args.productId}" })\` to check if the product exists\n\n` +
423
+ `**Error:** ${errorMessage}`);
412
424
  }
413
- return {
414
- content: [{
415
- type: "text",
416
- text: `❌ **Error getting template**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Invalid template ID\n- Template not found`,
417
- }],
418
- };
425
+ if (errorMessage.toLowerCase().includes('already installed')) {
426
+ return textResponse(`⚠️ **Product Already Installed**\n\nThis product is already installed in the workspace.\n\n` +
427
+ `**Product ID:** \`${args.productId}\`\n\n💡 Use \`list_apps\` to see installed apps.`);
428
+ }
429
+ return textResponse(`❌ **Error installing marketplace product**\n\n**Error:** ${errorMessage}\n\n` +
430
+ `**Common Issues:**\n- Invalid product ID\n- Product not found in marketplace\n- Insufficient permissions`);
419
431
  }
420
432
  }
421
433
  };
422
434
  // ============================================================================
423
- // PUBLISH TEMPLATE TOOL (MARKETPLACE)
435
+ // PUBLISH MARKETPLACE publish/update app or template listings
424
436
  // ============================================================================
425
- const publishTemplateDescription = `Publish workspace as marketplace template`;
426
- exports.publishTemplateTool = {
427
- name: 'publish_template',
437
+ const publishMarketplaceDescription = `Publish an app or workspace template to the Hailer marketplace, or update an existing listing.\n\n` +
438
+ `type 'app': requires the appId of a production app (empty url — dev/localhost apps are rejected). Creating ` +
439
+ `a NEW app listing also requires versionId — the targetId written to public/manifest.json by ` +
440
+ `\`npm run publish-production -- --market\`. type 'template': packages the current workspace as an installable template (step 1 ` +
441
+ `creates the v2 template manifest, step 2 the marketplace listing).\n\n` +
442
+ `Pass productId to UPDATE an existing listing's metadata (name, description, publisher, icon, images, ` +
443
+ `externalUrl) — no version bump needed. Omit productId to CREATE a new listing. Upload iconFileId / ` +
444
+ `imageFileIds via \`upload_files\` first.`;
445
+ const publishMarketplaceSchema = zod_1.z.object({
446
+ type: zod_1.z
447
+ .enum(['app', 'template'])
448
+ .describe("What to publish: 'app' (requires appId; new listings also need versionId) or 'template' (packages the current workspace)"),
449
+ appId: zod_1.z
450
+ .string()
451
+ .length(24)
452
+ .optional()
453
+ .describe("App ID to publish (24 chars). Required when type is 'app'"),
454
+ productId: zod_1.z
455
+ .string()
456
+ .length(24)
457
+ .optional()
458
+ .describe('Existing marketplace product ID to UPDATE (omit to create a new listing)'),
459
+ versionId: zod_1.z
460
+ .string()
461
+ .length(24)
462
+ .optional()
463
+ .describe('App version ID used as the listing targetId — written to public/manifest.json by ' +
464
+ '`npm run publish-production -- --market`. Required for NEW app listings'),
465
+ title: zod_1.z
466
+ .string()
467
+ .min(1)
468
+ .max(64)
469
+ .describe('Marketplace listing name (max 64 chars)'),
470
+ description: zod_1.z
471
+ .string()
472
+ .min(1)
473
+ .max(4096)
474
+ .describe('Full listing description (max 4096 chars)'),
475
+ version: zod_1.z
476
+ .string()
477
+ .min(1)
478
+ .describe("Version string (e.g. '1.0.0')"),
479
+ versionDescription: zod_1.z
480
+ .string()
481
+ .min(1)
482
+ .describe('Release notes for this version'),
483
+ publisher: zod_1.z
484
+ .string()
485
+ .min(1)
486
+ .describe('Publishing company or person name'),
487
+ iconFileId: zod_1.z
488
+ .string()
489
+ .length(24)
490
+ .describe('Icon file ID (24 chars). Upload with upload_files first'),
491
+ imageFileIds: zod_1.z
492
+ .array(zod_1.z.string().length(24))
493
+ .optional()
494
+ .describe('Optional array of preview image file IDs'),
495
+ externalUrl: zod_1.z
496
+ .string()
497
+ .url()
498
+ .optional()
499
+ .describe('Optional external website/documentation URL'),
500
+ workflowId: zod_1.z
501
+ .string()
502
+ .optional()
503
+ .describe('Template creation only: source workflow ID. Note: the API manifests the whole workspace; ' +
504
+ 'workflow attachment is finalized in the Hailer UI'),
505
+ });
506
+ async function verifyPublishableApp(appId, context) {
507
+ logger.debug('Fetching app details', { appId });
508
+ const appResult = await context.hailer.request('v3.app.list', [{}]);
509
+ const apps = appResult?.apps || appResult?.details?.apps || (Array.isArray(appResult) ? appResult : []);
510
+ const app = Array.isArray(apps) ? apps.find((entry) => entry._id === appId) : null;
511
+ if (!app) {
512
+ return {
513
+ errorResponse: textResponse(`❌ **App Not Found**\n\nApp ID \`${appId}\` was not found in the current workspace.\n\n` +
514
+ `**Tips:**\n- Use \`list_apps()\` to see available apps\n- Ensure the app exists and you have access`)
515
+ };
516
+ }
517
+ // Dev apps (localhost URL) can't be listed on the marketplace
518
+ if (app.url && app.url.includes('localhost')) {
519
+ return {
520
+ errorResponse: textResponse(`⚠️ **Cannot Publish Development App**\n\nApp "${app.name}" is a development app (URL: ${app.url}).\n\n` +
521
+ `**To publish to marketplace:**\n1. First publish the app code: \`npm run publish-production -- --market\`\n` +
522
+ `2. Or create a production app with empty URL\n3. Then call \`publish_marketplace\` again`)
523
+ };
524
+ }
525
+ return { appName: app.name };
526
+ }
527
+ async function createTemplateManifest(args, workspaceId, context) {
528
+ // Note: versionDescription is required and cannot be empty
529
+ const publishData = {
530
+ workspaceId,
531
+ version: args.version,
532
+ versionDescription: args.versionDescription,
533
+ title: args.title,
534
+ description: args.description
535
+ };
536
+ logger.debug('Calling v2.network.product.publishTemplate', { publishData });
537
+ const publishResult = await context.hailer.request('v2.network.product.publishTemplate', [publishData]);
538
+ logger.debug('Publish template response', { result: JSON.stringify(publishResult) });
539
+ const targetId = publishResult?.productId || publishResult?._id || publishResult?.id;
540
+ if (!targetId) {
541
+ return {
542
+ errorResponse: textResponse(`❌ **Error**: publishTemplate succeeded but no product ID returned.\n\n` +
543
+ `**Response:**\n\`\`\`json\n${JSON.stringify(publishResult, null, 2)}\n\`\`\``)
544
+ };
545
+ }
546
+ return { targetId };
547
+ }
548
+ function buildListingData(args) {
549
+ const productData = {
550
+ name: args.title,
551
+ description: args.description,
552
+ publisher: args.publisher,
553
+ icon: args.iconFileId,
554
+ images: args.imageFileIds || [args.iconFileId]
555
+ };
556
+ if (args.externalUrl) {
557
+ productData.externalUrl = args.externalUrl;
558
+ }
559
+ return productData;
560
+ }
561
+ exports.publishMarketplaceTool = {
562
+ name: 'publish_marketplace',
428
563
  group: tool_registry_1.ToolGroup.PLAYGROUND,
429
- description: publishTemplateDescription,
430
- schema: zod_1.z.object({
431
- productId: zod_1.z
432
- .string()
433
- .length(24)
434
- .optional()
435
- .describe("Existing product ID to UPDATE (omit to create new template)"),
436
- title: zod_1.z
437
- .string()
438
- .min(1)
439
- .max(64)
440
- .describe("Template name (max 64 chars)"),
441
- description: zod_1.z
442
- .string()
443
- .min(1)
444
- .max(4096)
445
- .describe("Template description (max 4096 chars)"),
446
- version: zod_1.z
447
- .string()
448
- .min(1)
449
- .describe("Version string (e.g. '1.0.0')"),
450
- versionDescription: zod_1.z
451
- .string()
452
- .min(1)
453
- .describe("Release notes for this version"),
454
- publisher: zod_1.z
455
- .string()
456
- .min(1)
457
- .describe("Publishing company or person name"),
458
- iconFileId: zod_1.z
459
- .string()
460
- .length(24)
461
- .describe("Icon file ID (24 chars). Upload with upload_files first"),
462
- imageFileIds: zod_1.z
463
- .array(zod_1.z.string().length(24))
464
- .optional()
465
- .describe("Optional array of preview image file IDs"),
466
- externalUrl: zod_1.z
467
- .string()
468
- .url()
469
- .optional()
470
- .describe("Optional external website URL"),
471
- }),
564
+ description: publishMarketplaceDescription,
565
+ schema: publishMarketplaceSchema,
472
566
  async execute(args, context) {
473
567
  const isUpdate = !!args.productId;
474
- logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} template to marketplace`, {
568
+ logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} marketplace listing`, {
569
+ type: args.type,
570
+ appId: args.appId,
475
571
  title: args.title,
476
572
  version: args.version,
477
573
  productId: args.productId,
@@ -482,558 +578,354 @@ exports.publishTemplateTool = {
482
578
  if (!workspaceId) {
483
579
  return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
484
580
  }
485
- let productId = args.productId;
486
- // Only create new manifest if not updating existing template
487
- if (!isUpdate) {
488
- // Note: versionDescription is required and cannot be empty
489
- const publishData = {
490
- workspaceId,
491
- version: args.version,
492
- versionDescription: args.versionDescription,
493
- title: args.title,
494
- description: args.description
495
- };
496
- logger.debug('Calling v2.network.product.publishTemplate', {
497
- publishData
498
- });
499
- // Step 1: Create the template manifest
500
- const publishResult = await context.hailer.request('v2.network.product.publishTemplate', [publishData]);
501
- logger.debug('Publish template response', {
502
- result: JSON.stringify(publishResult)
503
- });
504
- productId = publishResult?.productId || publishResult?._id || publishResult?.id;
505
- if (!productId) {
506
- return {
507
- content: [{
508
- type: "text",
509
- text: `❌ **Error**: publishTemplate succeeded but no product ID returned.\n\n**Response:**\n\`\`\`json\n${JSON.stringify(publishResult, null, 2)}\n\`\`\``,
510
- }],
511
- };
512
- }
513
- }
514
- // Step 2: Create or Update the product in marketplace
515
- let productData;
516
- let apiMethod;
517
- let apiArgs;
581
+ if (args.type === 'app' && !args.appId) {
582
+ return textResponse(`❌ **Missing appId**\n\n\`appId\` is required when \`type\` is 'app'.`);
583
+ }
584
+ const appCheck = args.type === 'app'
585
+ ? await verifyPublishableApp(args.appId, context)
586
+ : undefined;
587
+ if (appCheck?.errorResponse) {
588
+ return appCheck.errorResponse;
589
+ }
590
+ const appName = appCheck?.appName || '';
591
+ // For new app listings we need the targetId from a --market publish
592
+ if (args.type === 'app' && !isUpdate && !args.versionId) {
593
+ return textResponse(`❌ **Error**: Missing required IDs.\n\n**To create a new app marketplace listing:**\n` +
594
+ `1. Run \`npm run publish-production -- --market\` — the targetId is saved to public/manifest.json\n` +
595
+ `2. Then run \`publish_marketplace\` with \`type: 'app'\` and the \`versionId\` (targetId)\n\n` +
596
+ `**To update existing listing metadata (icon, name, etc.):**\n` +
597
+ `Include the \`productId\` parameter - no version bump needed.`);
598
+ }
599
+ // Step 1 (template create only): manifest the current workspace via v2
600
+ let targetId = args.versionId;
601
+ const stepOne = (args.type === 'template' && !isUpdate)
602
+ ? await createTemplateManifest(args, workspaceId, context)
603
+ : undefined;
604
+ if (stepOne?.errorResponse) {
605
+ return stepOne.errorResponse;
606
+ }
607
+ if (stepOne) {
608
+ targetId = stepOne.targetId;
609
+ }
610
+ // Step 2: create or update the marketplace listing via v3
611
+ const productData = buildListingData(args);
612
+ let apiMethod = 'v3.product.create';
613
+ let apiArgs = [{ cid: workspaceId, targetId, type: args.type, ...productData }];
518
614
  if (isUpdate) {
519
- // Update only allows specific fields
520
- productData = {
521
- name: args.title,
522
- description: args.description,
523
- publisher: args.publisher,
524
- icon: args.iconFileId,
525
- images: args.imageFileIds || [args.iconFileId]
526
- };
527
- if (args.externalUrl) {
528
- productData.externalUrl = args.externalUrl;
529
- }
530
615
  apiMethod = 'v3.product.update';
531
- apiArgs = [productId, productData];
616
+ apiArgs = [args.productId, productData];
532
617
  }
533
- else {
534
- // Create requires full data
535
- productData = {
536
- cid: workspaceId,
537
- targetId: productId,
538
- name: args.title,
539
- description: args.description,
540
- type: 'template',
541
- publisher: args.publisher,
542
- icon: args.iconFileId,
543
- images: args.imageFileIds || [args.iconFileId]
544
- };
545
- if (args.externalUrl) {
546
- productData.externalUrl = args.externalUrl;
618
+ logger.debug(`Calling ${apiMethod}`, {
619
+ productId: args.productId,
620
+ workspaceId,
621
+ appId: args.appId,
622
+ targetId,
623
+ iconFileId: args.iconFileId
624
+ });
625
+ let apiResult;
626
+ try {
627
+ apiResult = await context.hailer.request(apiMethod, apiArgs);
628
+ }
629
+ catch (stepTwoError) {
630
+ const stepTwoMessage = (0, tool_helpers_1.extractErrorMessage)(stepTwoError);
631
+ // Fail-safe for the two-step template publish: step 1 (v2 manifest) succeeded,
632
+ // step 2 (v3 listing) failed — report the orphan instead of hiding it.
633
+ if (args.type === 'template' && !isUpdate) {
634
+ logger.error('publish_marketplace: v3 listing creation failed after v2 template manifest was created', {
635
+ orphanedV2ProductId: targetId,
636
+ workspaceId,
637
+ error: stepTwoMessage
638
+ });
639
+ return textResponse(`❌ **Marketplace listing creation failed after the template manifest was created**\n\n` +
640
+ `Step 1 (v2 template manifest) succeeded, but step 2 (v3 marketplace listing) failed.\n\n` +
641
+ `**Orphaned v2 product ID:** \`${targetId}\`\n` +
642
+ `**Step 2 error:** ${stepTwoMessage}\n\n` +
643
+ `**What to do:**\n` +
644
+ `- Fix the cause above, then re-run \`publish_marketplace\` — it will create a fresh manifest\n` +
645
+ `- The orphaned manifest \`${targetId}\` never appears in the marketplace; it is harmless ` +
646
+ `but can be cleaned up via the Hailer UI or support`);
547
647
  }
548
- apiMethod = 'v3.product.create';
549
- apiArgs = [productData];
648
+ throw stepTwoError;
550
649
  }
551
- logger.debug(`Calling ${apiMethod}`, { productId, workspaceId, iconFileId: args.iconFileId });
552
- const apiResult = await context.hailer.request(apiMethod, apiArgs);
553
650
  logger.debug(`${apiMethod} response`, {
554
651
  result: JSON.stringify(apiResult)
555
652
  });
556
- // Get the final product ID from the v3 API response (this is the correct marketplace ID)
557
- const finalProductId = apiResult?._id || apiResult?.id || productId;
558
- let responseText = `✅ **Template ${isUpdate ? 'Updated' : 'Published'} Successfully**\n\n`;
653
+ // Get the final product ID from the v3 API response (this is the marketplace ID)
654
+ const finalProductId = apiResult?._id || apiResult?.id || args.productId || targetId;
655
+ const typeLabel = args.type === 'app' ? 'App' : 'Template';
656
+ let responseText = `✅ **${typeLabel} ${isUpdate ? 'Updated' : 'Published'} Successfully**\n\n`;
657
+ if (args.type === 'app') {
658
+ responseText += `**App:** ${appName} (\`${args.appId}\`)\n`;
659
+ }
559
660
  responseText += `**Title:** ${args.title}\n`;
560
661
  responseText += `**Publisher:** ${args.publisher}\n`;
561
662
  responseText += `**Version:** ${args.version}\n`;
562
663
  responseText += `**Workspace:** ${workspaceId}\n`;
563
664
  responseText += `**Product ID:** \`${finalProductId}\`\n`;
564
665
  responseText += `**Release Notes:** ${args.versionDescription}\n`;
666
+ if (args.type === 'template' && args.workflowId) {
667
+ responseText += `\n⚠️ **Note:** The publish API manifests the whole workspace — ` +
668
+ `attaching a specific workflow must be done via the Hailer UI.\n`;
669
+ }
565
670
  responseText += `\n💡 **Next Steps:**\n`;
566
- responseText += `- Use \`list_templates()\` to see it in the marketplace\n`;
671
+ responseText += `- Use \`browse_marketplace()\` to see it in the marketplace\n`;
567
672
  responseText += `- Share the product ID with other workspaces\n`;
568
- responseText += `- They can install with \`install_template({ templateId: "${finalProductId}" })\`\n`;
569
- return {
570
- content: [{
571
- type: "text",
572
- text: responseText,
573
- }],
574
- };
673
+ responseText += `- They can install with \`install_marketplace({ productId: "${finalProductId}" })\`\n`;
674
+ responseText += `- To update this listing, include \`productId: "${finalProductId}"\` in the next publish\n`;
675
+ return textResponse(responseText);
575
676
  }
576
677
  catch (error) {
577
- if (!request_logger_1.RequestLogger.getCurrent())
578
- logger.error("Error publishing template", error);
678
+ if (!request_logger_1.RequestLogger.getCurrent()) {
679
+ logger.error('Error publishing to marketplace', error);
680
+ }
579
681
  const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
580
682
  if (errorMessage.toLowerCase().includes('permission')) {
581
- return {
582
- content: [{
583
- type: "text",
584
- text: `❌ **Permission Denied**\n\nYou don't have permission to publish templates. Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`,
585
- }],
586
- };
683
+ return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to publish to the marketplace. ` +
684
+ `Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`);
587
685
  }
588
686
  // Always include debug info for troubleshooting
589
- const debugWorkspaceId = context.workspaceCache?.currentWorkspace._id || 'unknown';
590
687
  const debugInfo = {
591
- endpoint: 'v2.network.product.publishTemplate',
688
+ type: args.type,
689
+ isUpdate,
592
690
  requestData: {
593
- workspaceId: debugWorkspaceId,
691
+ workspaceId: context.workspaceCache?.currentWorkspace._id || 'unknown',
594
692
  version: args.version,
595
693
  versionDescription: args.versionDescription,
596
694
  title: args.title,
597
695
  description: args.description
598
696
  }
599
697
  };
600
- return {
601
- content: [{
602
- type: "text",
603
- text: `❌ **Error publishing template**\n\n**Error:** ${errorMessage}\n\n**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n**Common Issues:**\n- Product may need to exist first (use create_template)\n- Version format may be incorrect\n- Workflow may not be attached to product`,
604
- }],
605
- };
698
+ return textResponse(`❌ **Error publishing to marketplace**\n\n**Error:** ${errorMessage}\n\n` +
699
+ `**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n` +
700
+ `**Common Issues:**\n- Must be workspace administrator\n- Icon file must be uploaded first\n` +
701
+ `- App must be a production app (not dev/localhost)\n- Invalid version format`);
606
702
  }
607
703
  }
608
704
  };
609
- // =============================================================================
610
- // GET PRODUCT (v3) TOOL
611
- // =============================================================================
612
- const getProductDescription = `Get product details from marketplace`;
613
- exports.getProductTool = {
614
- name: 'get_product',
705
+ // ============================================================================
706
+ // GET INSTALLED VERSION — version installed in the current workspace
707
+ // ============================================================================
708
+ const getInstalledVersionDescription = `Report the version of a marketplace product installed in the CURRENT workspace. The server uses the ` +
709
+ `session's workspace implicitly — there is no workspaceId override, so this always reflects the workspace ` +
710
+ `the session is connected to. If the product is not installed in the current workspace, that is stated ` +
711
+ `clearly. Otherwise the installed version, description, package hash and install date are reported.`;
712
+ exports.getInstalledVersionTool = {
713
+ name: 'get_installed_version',
615
714
  group: tool_registry_1.ToolGroup.PLAYGROUND,
616
- description: getProductDescription,
715
+ description: getInstalledVersionDescription,
617
716
  schema: zod_1.z.object({
618
717
  productId: zod_1.z
619
718
  .string()
620
719
  .length(24)
621
- .describe("Product ID to get details for (24 characters)"),
720
+ .describe('Marketplace product ID (24 chars) to check the installed version of'),
622
721
  }),
623
722
  async execute(args, context) {
624
- logger.debug('Getting product details (v3)', {
723
+ logger.debug('Getting installed version', {
625
724
  productId: args.productId,
626
725
  apiKey: context.apiKey.substring(0, 8) + '...'
627
726
  });
628
727
  try {
629
- logger.debug('Calling v3.app.product.get', {
630
- productId: args.productId
631
- });
632
- const result = await context.hailer.request('v3.app.product.get', [args.productId]);
633
- logger.debug('Product get response', {
634
- result: JSON.stringify(result)
635
- });
636
- const product = result;
637
- let responseText = `✅ **Product Details (v3)**\n\n`;
728
+ logger.debug('Calling v3.app.product.getInstalledVersion', { productId: args.productId });
729
+ const result = await context.hailer.request('v3.app.product.getInstalledVersion', [args.productId]);
730
+ logger.debug('Installed version response', { result: JSON.stringify(result) });
731
+ // An empty object means the product is not installed in the session workspace.
732
+ const hasVersion = result && Object.keys(result).length > 0;
733
+ if (!hasVersion) {
734
+ return textResponse(`⚪ **Not Installed**\n\nProduct \`${args.productId}\` is not installed in the current workspace.\n\n` +
735
+ `💡 Use \`install_marketplace({ productId: "${args.productId}" })\` to install it.`);
736
+ }
737
+ let responseText = `✅ **Installed Version**\n\n`;
638
738
  responseText += `**Product ID:** \`${args.productId}\`\n`;
639
- if (product?.name) {
640
- responseText += `**Name:** ${product.name}\n`;
739
+ if (result.version) {
740
+ responseText += `**Version:** ${result.version}\n`;
641
741
  }
642
- if (product?.description) {
643
- responseText += `**Description:** ${product.description}\n`;
742
+ if (result.description) {
743
+ responseText += `**Description:** ${result.description}\n`;
644
744
  }
645
- if (product?.type) {
646
- responseText += `**Type:** ${product.type}\n`;
745
+ if (result.packageHash) {
746
+ responseText += `**Package Hash:** \`${result.packageHash}\`\n`;
647
747
  }
648
- if (product?.versions?.length) {
649
- responseText += `**Versions:** ${product.versions.length}\n`;
748
+ if (result.created) {
749
+ responseText += `**Installed:** ${result.created}\n`;
650
750
  }
651
- return {
652
- content: [{
653
- type: "text",
654
- text: responseText,
655
- }],
656
- };
751
+ responseText += `\nℹ️ This reflects the CURRENT workspace only.`;
752
+ return textResponse(responseText);
657
753
  }
658
754
  catch (error) {
659
- if (!request_logger_1.RequestLogger.getCurrent())
660
- logger.error("Error getting product", error);
755
+ if (!request_logger_1.RequestLogger.getCurrent()) {
756
+ logger.error('Error getting installed version', error);
757
+ }
661
758
  const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
662
- return {
663
- content: [{
664
- type: "text",
665
- text: `❌ **Error getting product**\n\n**Error:** ${errorMessage}`,
666
- }],
667
- };
759
+ return textResponse(`❌ **Error getting installed version**\n\n**Error:** ${errorMessage}\n\n` +
760
+ `**Common Issues:**\n- Invalid product ID\n- Product not found`);
668
761
  }
669
762
  }
670
763
  };
671
- // =============================================================================
672
- // GET PRODUCT MANIFEST (v3) TOOL
673
- // =============================================================================
674
- const getProductManifestDescription = `Get product manifest from marketplace`;
675
- exports.getProductManifestTool = {
676
- name: 'get_product_manifest',
764
+ // ============================================================================
765
+ // SET MARKETPLACE VISIBILITY toggle a product public/private
766
+ // ============================================================================
767
+ const setMarketplaceVisibilityDescription = `Set a marketplace product's visibility: public (listed on the public marketplace) or private (workspace ` +
768
+ `only). Requires the caller be a network admin of the product's workspace — otherwise the call is rejected ` +
769
+ `with a permission error. Reports the resulting public/private state on success.`;
770
+ exports.setMarketplaceVisibilityTool = {
771
+ name: 'set_marketplace_visibility',
677
772
  group: tool_registry_1.ToolGroup.PLAYGROUND,
678
- description: getProductManifestDescription,
773
+ description: setMarketplaceVisibilityDescription,
679
774
  schema: zod_1.z.object({
680
775
  productId: zod_1.z
681
776
  .string()
682
777
  .length(24)
683
- .describe("Product ID to get manifest for (24 characters)"),
778
+ .describe('Marketplace product ID (24 chars)'),
779
+ isPublic: zod_1.z
780
+ .boolean()
781
+ .describe('true = list on the public marketplace, false = make private/workspace-only'),
684
782
  }),
685
783
  async execute(args, context) {
686
- logger.debug('Getting product manifest (v3)', {
784
+ logger.debug('Setting marketplace visibility', {
687
785
  productId: args.productId,
786
+ isPublic: args.isPublic,
688
787
  apiKey: context.apiKey.substring(0, 8) + '...'
689
788
  });
690
789
  try {
691
- logger.debug('Calling v3.app.product.getManifest', {
692
- productId: args.productId
693
- });
694
- const result = await context.hailer.request('v3.app.product.getManifest', [args.productId]);
695
- logger.debug('Product manifest response', {
696
- result: JSON.stringify(result)
697
- });
698
- const manifest = result;
699
- let responseText = `✅ **Product Manifest (v3)**\n\n`;
790
+ logger.debug('Calling v3.product.setPublic', { productId: args.productId, isPublic: args.isPublic });
791
+ await context.hailer.request('v3.product.setPublic', [args.productId, args.isPublic]);
792
+ const stateLabel = args.isPublic ? 'Public' : 'Private';
793
+ let responseText = `✅ **Visibility Updated**\n\n`;
700
794
  responseText += `**Product ID:** \`${args.productId}\`\n`;
701
- if (manifest?.version) {
702
- responseText += `**Version:** ${manifest.version}\n`;
703
- }
704
- if (manifest?.workflows?.length) {
705
- responseText += `**Workflows:** ${manifest.workflows.length}\n`;
706
- }
707
- return {
708
- content: [{
709
- type: "text",
710
- text: responseText,
711
- }],
712
- };
795
+ responseText += `**Visibility:** ${stateLabel}\n\n`;
796
+ responseText += args.isPublic
797
+ ? `This product is now listed on the public marketplace.`
798
+ : `This product is now private (workspace only).`;
799
+ return textResponse(responseText);
713
800
  }
714
801
  catch (error) {
715
- if (!request_logger_1.RequestLogger.getCurrent())
716
- logger.error("Error getting product manifest", error);
802
+ if (!request_logger_1.RequestLogger.getCurrent()) {
803
+ logger.error('Error setting marketplace visibility', error);
804
+ }
717
805
  const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
718
- return {
719
- content: [{
720
- type: "text",
721
- text: `❌ **Error getting product manifest**\n\n**Error:** ${errorMessage}`,
722
- }],
723
- };
806
+ if (errorMessage.toLowerCase().includes('permission')) {
807
+ return textResponse(`❌ **Permission Denied**\n\nOnly a network admin of the product's workspace can change its ` +
808
+ `visibility.\n\n**Error:** ${errorMessage}`);
809
+ }
810
+ return textResponse(`❌ **Error setting marketplace visibility**\n\n**Error:** ${errorMessage}\n\n` +
811
+ `**Common Issues:**\n- Must be a network admin of the product's workspace\n- Invalid product ID`);
724
812
  }
725
813
  }
726
814
  };
727
- // =============================================================================
728
- // PUBLISH APP TO MARKETPLACE TOOL
729
- // =============================================================================
730
- const publishAppDescription = `Publish app to Hailer marketplace`;
731
- exports.publishAppTool = {
732
- name: 'publish_app',
815
+ // ============================================================================
816
+ // REMOVE MARKETPLACE PRODUCT delete a product listing
817
+ // ============================================================================
818
+ const removeMarketplaceProductDescription = `Permanently remove a marketplace product listing. Requires the caller be a network admin of the product's ` +
819
+ `workspace. The API also blocks deletion if any purchase exists for the product — that block is reported ` +
820
+ `explicitly so it isn't mistaken for a permission error.`;
821
+ exports.removeMarketplaceProductTool = {
822
+ name: 'remove_marketplace_product',
733
823
  group: tool_registry_1.ToolGroup.PLAYGROUND,
734
- description: publishAppDescription,
824
+ description: removeMarketplaceProductDescription,
735
825
  schema: zod_1.z.object({
736
- appId: zod_1.z
737
- .string()
738
- .length(24)
739
- .describe("App ID to publish (24 characters)"),
740
- versionId: zod_1.z
741
- .string()
742
- .length(24)
743
- .optional()
744
- .describe("Optional version ID. If not provided, uses appId as targetId."),
745
826
  productId: zod_1.z
746
827
  .string()
747
828
  .length(24)
748
- .optional()
749
- .describe("Existing product ID to UPDATE (omit to create new listing)"),
750
- title: zod_1.z
751
- .string()
752
- .min(1)
753
- .max(64)
754
- .describe("Marketplace listing name (max 64 chars)"),
755
- description: zod_1.z
756
- .string()
757
- .min(1)
758
- .max(4096)
759
- .describe("Full description (max 4096 chars)"),
760
- version: zod_1.z
761
- .string()
762
- .min(1)
763
- .describe("Version string (e.g. '1.0.0')"),
764
- versionDescription: zod_1.z
765
- .string()
766
- .min(1)
767
- .describe("Release notes for this version"),
768
- publisher: zod_1.z
769
- .string()
770
- .min(1)
771
- .describe("Publishing company or person name"),
772
- iconFileId: zod_1.z
773
- .string()
774
- .length(24)
775
- .describe("Icon file ID (24 chars). Upload with upload_files first"),
776
- imageFileIds: zod_1.z
777
- .array(zod_1.z.string().length(24))
778
- .optional()
779
- .describe("Optional array of preview image file IDs"),
780
- externalUrl: zod_1.z
781
- .string()
782
- .url()
783
- .optional()
784
- .describe("Optional external documentation URL"),
829
+ .describe('Marketplace product ID (24 chars) to remove'),
785
830
  }),
786
831
  async execute(args, context) {
787
- const isUpdate = !!args.productId;
788
- logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} app to marketplace`, {
789
- appId: args.appId,
790
- title: args.title,
791
- version: args.version,
832
+ logger.debug('Removing marketplace product', {
792
833
  productId: args.productId,
793
834
  apiKey: context.apiKey.substring(0, 8) + '...'
794
835
  });
795
836
  try {
796
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)({}, context);
797
- if (!workspaceId) {
798
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
799
- }
800
- // Verify app exists and get details
801
- logger.debug('Fetching app details', { appId: args.appId });
802
- const appResult = await context.hailer.request('v3.app.list', [{}]);
803
- const apps = appResult?.apps || appResult?.details?.apps || (Array.isArray(appResult) ? appResult : []);
804
- const app = Array.isArray(apps) ? apps.find((a) => a._id === args.appId) : null;
805
- if (!app) {
806
- return {
807
- content: [{
808
- type: "text",
809
- text: `❌ **App Not Found**\n\nApp ID \`${args.appId}\` was not found in the current workspace.\n\n**Tips:**\n- Use \`list_apps()\` to see available apps\n- Ensure the app exists and you have access`,
810
- }],
811
- };
812
- }
813
- // Warn if app is a dev app (has localhost URL)
814
- if (app.url && app.url.includes('localhost')) {
815
- return {
816
- content: [{
817
- type: "text",
818
- text: `⚠️ **Cannot Publish Development App**\n\nApp "${app.name}" is a development app (URL: ${app.url}).\n\n**To publish to marketplace:**\n1. First publish the app code with \`publish_hailer_app\`\n2. Or create a production app with empty URL\n3. Then call \`publish_app\` again`,
819
- }],
820
- };
821
- }
822
- let productId = args.productId;
823
- const targetId = args.versionId;
824
- // For new listings, we need both targetId (from publish_hailer_app) to create the product
825
- if (!productId && !targetId) {
826
- return {
827
- content: [{
828
- type: "text",
829
- text: `❌ **Error**: Missing required IDs.\n\n**To create a new marketplace listing:**\n1. Run \`publish_hailer_app\` with \`publishToMarket: true\` to get a targetId\n2. Then run \`publish_app\` with the \`versionId\` (targetId)\n\n**To update existing listing metadata (icon, name, etc.):**\nInclude the \`productId\` parameter - no version bump needed.`,
830
- }],
831
- };
832
- }
833
- // Step 2: Create or Update the product in marketplace
834
- let productData;
835
- let apiMethod;
836
- let apiArgs;
837
- if (isUpdate && productId) {
838
- // Update only allows specific fields
839
- productData = {
840
- name: args.title,
841
- description: args.description,
842
- publisher: args.publisher,
843
- icon: args.iconFileId,
844
- images: args.imageFileIds || [args.iconFileId]
845
- };
846
- if (args.externalUrl) {
847
- productData.externalUrl = args.externalUrl;
848
- }
849
- apiMethod = 'v3.product.update';
850
- apiArgs = [productId, productData];
851
- }
852
- else {
853
- // Create requires full data - targetId comes from versionId param or publishAppVersion call
854
- productData = {
855
- cid: workspaceId,
856
- targetId, // Version ID from publishAppVersion or provided versionId
857
- name: args.title,
858
- description: args.description,
859
- type: 'app',
860
- publisher: args.publisher,
861
- icon: args.iconFileId,
862
- images: args.imageFileIds || [args.iconFileId]
863
- };
864
- if (args.externalUrl) {
865
- productData.externalUrl = args.externalUrl;
866
- }
867
- apiMethod = 'v3.product.create';
868
- apiArgs = [productData];
869
- }
870
- logger.debug(`Calling ${apiMethod}`, { productId, workspaceId, appId: args.appId, targetId, productData });
871
- const apiResult = await context.hailer.request(apiMethod, apiArgs);
872
- logger.debug(`${apiMethod} response`, {
873
- result: JSON.stringify(apiResult)
874
- });
875
- // Get the final product ID from the v3 API response
876
- const finalProductId = apiResult?._id || apiResult?.id || productId;
877
- let responseText = `✅ **App ${isUpdate ? 'Updated' : 'Published'} to Marketplace**\n\n`;
878
- responseText += `**App:** ${app.name} (\`${args.appId}\`)\n`;
879
- responseText += `**Title:** ${args.title}\n`;
880
- responseText += `**Publisher:** ${args.publisher}\n`;
881
- responseText += `**Version:** ${args.version}\n`;
882
- responseText += `**Product ID:** \`${finalProductId}\`\n`;
883
- responseText += `**Release Notes:** ${args.versionDescription}\n`;
884
- responseText += `\n💡 **Next Steps:**\n`;
885
- responseText += `- Share the product ID with other workspaces\n`;
886
- responseText += `- They can install with \`install_marketplace_app({ productId: "${finalProductId}" })\`\n`;
887
- responseText += `- To update, include \`productId: "${finalProductId}"\` in next publish\n`;
888
- return {
889
- content: [{
890
- type: "text",
891
- text: responseText,
892
- }],
893
- };
837
+ logger.debug('Calling v3.product.remove', { productId: args.productId });
838
+ await context.hailer.request('v3.product.remove', [args.productId]);
839
+ return textResponse(`✅ **Product Removed**\n\nProduct \`${args.productId}\` has been deleted from the marketplace.`);
894
840
  }
895
841
  catch (error) {
896
- if (!request_logger_1.RequestLogger.getCurrent())
897
- logger.error("Error publishing app to marketplace", error);
842
+ if (!request_logger_1.RequestLogger.getCurrent()) {
843
+ logger.error('Error removing marketplace product', error);
844
+ }
898
845
  const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
846
+ if (errorMessage.toLowerCase().includes('purchase')) {
847
+ return textResponse(`❌ **Cannot Remove — Existing Purchases**\n\nProduct \`${args.productId}\` cannot be deleted ` +
848
+ `because it has existing purchases.\n\n**Error:** ${errorMessage}`);
849
+ }
899
850
  if (errorMessage.toLowerCase().includes('permission')) {
900
- return {
901
- content: [{
902
- type: "text",
903
- text: `❌ **Permission Denied**\n\nYou don't have permission to publish apps to marketplace. Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`,
904
- }],
905
- };
851
+ return textResponse(`❌ **Permission Denied**\n\nOnly a network admin of the product's workspace can remove it.\n\n` +
852
+ `**Error:** ${errorMessage}`);
906
853
  }
907
- return {
908
- content: [{
909
- type: "text",
910
- text: `❌ **Error publishing app to marketplace**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- App must be a production app (not dev/localhost)\n- Must be workspace administrator\n- Icon file must be uploaded first\n- Invalid version format`,
911
- }],
912
- };
854
+ return textResponse(`❌ **Error removing marketplace product**\n\n**Error:** ${errorMessage}\n\n` +
855
+ `**Common Issues:**\n- Must be a network admin of the product's workspace\n` +
856
+ `- Product cannot have existing purchases\n- Invalid product ID`);
913
857
  }
914
858
  }
915
859
  };
916
- // =============================================================================
917
- // INSTALL MARKETPLACE APP TOOL
918
- // =============================================================================
919
- const installMarketplaceAppDescription = `Install app from marketplace`;
920
- exports.installMarketplaceAppTool = {
921
- name: 'install_marketplace_app',
860
+ // ============================================================================
861
+ // GET MARKETPLACE PRICING — report pricing; never charges (returns a link for paid)
862
+ // ============================================================================
863
+ const getMarketplacePricingDescription = `Report a marketplace product's pricing. This tool NEVER purchases or charges money — it only reads pricing ` +
864
+ `and, for paid products, returns a link the user can open to complete the purchase themselves.\n\n` +
865
+ `FREE products (no pricing configured, payment disabled, or no priced plan): tell the user it's free and ` +
866
+ `install it with \`install_marketplace\`. PAID products: tell the user it is paid, list the priced plans, ` +
867
+ `and give them the purchase link to open — do NOT attempt to install or pay.`;
868
+ function pricedPlans(pricing) {
869
+ if (!pricing || !pricing.paymentEnabled || !Array.isArray(pricing.types)) {
870
+ return [];
871
+ }
872
+ return pricing.types.filter((type) => typeof type.price === 'number' && type.price > 0);
873
+ }
874
+ exports.getMarketplacePricingTool = {
875
+ name: 'get_marketplace_pricing',
922
876
  group: tool_registry_1.ToolGroup.PLAYGROUND,
923
- description: installMarketplaceAppDescription,
877
+ description: getMarketplacePricingDescription,
924
878
  schema: zod_1.z.object({
925
879
  productId: zod_1.z
926
880
  .string()
927
881
  .length(24)
928
- .describe("Marketplace product ID to install (24 characters)"),
929
- workspaceId: zod_1.z
930
- .string()
931
- .optional()
932
- .describe("Target workspace ID (defaults to current)"),
882
+ .describe('Marketplace product ID (24 chars) to report pricing for'),
933
883
  }),
934
884
  async execute(args, context) {
935
- logger.debug('Installing marketplace app', {
885
+ logger.debug('Getting marketplace pricing', {
936
886
  productId: args.productId,
937
887
  apiKey: context.apiKey.substring(0, 8) + '...'
938
888
  });
939
889
  try {
940
- const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
941
- if (!workspaceId) {
942
- return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
943
- }
944
- // Check if already installed
945
- logger.debug('Checking if product is already installed', { productId: args.productId, workspaceId });
946
- try {
947
- const isInstalledResult = await context.hailer.request('v3.app.product.isProductInstalled', [args.productId, workspaceId]);
948
- if (isInstalledResult?.installed) {
949
- return {
950
- content: [{
951
- type: "text",
952
- text: `ℹ️ **App Already Installed**\n\nThis app is already installed in your workspace.\n\n**App ID:** \`${isInstalledResult.appId || 'unknown'}\`\n\n**Tips:**\n- Use \`list_apps()\` to see installed apps\n- Use \`get_product({ productId: "${args.productId}" })\` to view product details`,
953
- }],
954
- };
955
- }
956
- }
957
- catch (checkError) {
958
- // Ignore check errors and proceed with installation
959
- logger.debug('Could not check installation status, proceeding', {
960
- error: checkError instanceof Error ? checkError.message : String(checkError)
961
- });
962
- }
963
- // Get product details first
964
- logger.debug('Fetching product details', { productId: args.productId });
965
- let productName = 'Unknown';
966
- try {
967
- const productResult = await context.hailer.request('v3.app.product.get', [args.productId]);
968
- productName = productResult?.name || productResult?.title || 'Unknown';
969
- }
970
- catch (productError) {
971
- logger.debug('Could not fetch product details', {
972
- error: productError instanceof Error ? productError.message : String(productError)
973
- });
974
- }
975
- // Install the app
976
- logger.debug('Calling v3.app.product.install', { productId: args.productId, workspaceId });
977
- const installResult = await context.hailer.request('v3.app.product.install', [args.productId, workspaceId]);
978
- logger.debug('Install result', { result: JSON.stringify(installResult) });
979
- const installedAppId = installResult?.appId || installResult?.details?.appId || installResult?._id;
980
- let responseText = `✅ **App Installed Successfully**\n\n`;
981
- responseText += `**Product:** ${productName}\n`;
982
- responseText += `**Product ID:** \`${args.productId}\`\n`;
983
- if (installedAppId) {
984
- responseText += `**Installed App ID:** \`${installedAppId}\`\n`;
985
- }
986
- responseText += `**Workspace:** \`${workspaceId}\`\n`;
987
- responseText += `\n💡 **Next Steps:**\n`;
988
- responseText += `- Use \`list_apps()\` to see the installed app\n`;
989
- responseText += `- Use \`add_app_member\` to share with workspace members\n`;
990
- responseText += `- Open the app from Hailer workspace menu\n`;
991
- return {
992
- content: [{
993
- type: "text",
994
- text: responseText,
995
- }],
996
- };
890
+ logger.debug('Calling v3.payment.getPricing', { productId: args.productId });
891
+ const pricing = await context.hailer.request('v3.payment.getPricing', [{ productId: args.productId }]);
892
+ logger.debug('Pricing response', { pricing: JSON.stringify(pricing) });
893
+ const plans = pricedPlans(pricing);
894
+ if (plans.length === 0) {
895
+ return textResponse(`✅ **Free Product**\n\nProduct \`${args.productId}\` is FREE no purchase needed.\n\n` +
896
+ `💡 Add it with \`install_marketplace({ productId: "${args.productId}" })\`.`);
897
+ }
898
+ const host = context.hailer.getClient().socket.host;
899
+ const purchaseLink = `${host}/p/${args.productId}`;
900
+ let responseText = `💳 **Paid Product**\n\nProduct \`${args.productId}\` is a PAID product. This tool ` +
901
+ `does not purchase it — open the link below to complete the purchase.\n\n`;
902
+ responseText += `**Plans:**\n`;
903
+ plans.forEach((plan) => {
904
+ const interval = plan.interval ? ` / ${plan.interval}` : '';
905
+ responseText += `- **${plan.planId}**: ${plan.price} ${plan.currency || ''}${interval}\n`;
906
+ });
907
+ responseText += `\n**Purchase link:** ${purchaseLink}\n\n`;
908
+ responseText += `Tell the user this product is paid and give them the link above to complete the purchase.`;
909
+ return textResponse(responseText);
997
910
  }
998
911
  catch (error) {
999
- if (!request_logger_1.RequestLogger.getCurrent())
1000
- logger.error("Error installing marketplace app", error);
1001
- const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
1002
- if (errorMessage.toLowerCase().includes('permission')) {
1003
- return {
1004
- content: [{
1005
- type: "text",
1006
- text: `❌ **Permission Denied**\n\nYou don't have permission to install apps. Only workspace administrators can install marketplace apps.\n\n**Error:** ${errorMessage}`,
1007
- }],
1008
- };
1009
- }
1010
- if (errorMessage.toLowerCase().includes('not found')) {
1011
- return {
1012
- content: [{
1013
- type: "text",
1014
- text: `❌ **Product Not Found**\n\nThe marketplace product \`${args.productId}\` was not found.\n\n**Tips:**\n- Verify the product ID is correct\n- Use \`get_product\` to check if the product exists\n\n**Error:** ${errorMessage}`,
1015
- }],
1016
- };
912
+ if (!request_logger_1.RequestLogger.getCurrent()) {
913
+ logger.error('Error getting marketplace pricing', error);
1017
914
  }
1018
- return {
1019
- content: [{
1020
- type: "text",
1021
- text: `❌ **Error installing marketplace app**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Invalid product ID\n- Product not found in marketplace\n- Insufficient permissions`,
1022
- }],
1023
- };
915
+ const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
916
+ return textResponse(`❌ **Error getting marketplace pricing**\n\n**Error:** ${errorMessage}\n\n` +
917
+ `**Common Issues:**\n- Invalid product ID\n- Product not found`);
1024
918
  }
1025
919
  }
1026
920
  };
1027
921
  /** All app marketplace tools */
1028
922
  exports.appMarketplaceTools = [
1029
- exports.listTemplatesTool,
1030
- exports.createTemplateTool,
1031
- exports.installTemplateTool,
1032
- exports.getTemplateTool,
1033
- exports.publishTemplateTool,
1034
- exports.getProductTool,
1035
- exports.getProductManifestTool,
1036
- exports.publishAppTool,
1037
- exports.installMarketplaceAppTool,
923
+ exports.browseMarketplaceTool,
924
+ exports.installMarketplaceTool,
925
+ exports.publishMarketplaceTool,
926
+ exports.getInstalledVersionTool,
927
+ exports.setMarketplaceVisibilityTool,
928
+ exports.removeMarketplaceProductTool,
929
+ exports.getMarketplacePricingTool,
1038
930
  ];
1039
931
  //# sourceMappingURL=app-marketplace.js.map