@hailer/mcp 1.1.16 → 1.1.17-beta.0

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 (313) hide show
  1. package/.claude/CLAUDE.md +117 -320
  2. package/.claude/commands/app-squad.md +86 -90
  3. package/.claude/commands/audit-squad.md +19 -19
  4. package/.claude/commands/autoplan.md +3 -3
  5. package/.claude/commands/cleanup-squad.md +16 -16
  6. package/.claude/commands/config-squad.md +30 -30
  7. package/.claude/commands/crud-squad.md +23 -23
  8. package/.claude/commands/data-squad.md +21 -21
  9. package/.claude/commands/debug-squad.md +44 -44
  10. package/.claude/commands/doc-squad.md +16 -16
  11. package/.claude/commands/help:agents.md +130 -99
  12. package/.claude/commands/help:commands.md +15 -15
  13. package/.claude/commands/help:faq.md +17 -17
  14. package/.claude/commands/help:plugins.md +1 -1
  15. package/.claude/commands/help:skills.md +18 -24
  16. package/.claude/commands/hotfix-squad.md +22 -22
  17. package/.claude/commands/integration-squad.md +22 -22
  18. package/.claude/commands/janitor-squad.md +31 -31
  19. package/.claude/commands/learn-auto.md +5 -5
  20. package/.claude/commands/learn.md +12 -20
  21. package/.claude/commands/onboard-squad.md +39 -49
  22. package/.claude/commands/plan-workspace.md +2 -2
  23. package/.claude/commands/publish.md +32 -37
  24. package/.claude/commands/review-squad.md +27 -27
  25. package/.claude/commands/stats.md +26 -12
  26. package/.claude/commands/swarm.md +25 -25
  27. package/.claude/skills/chrome-mcp-reference/SKILL.md +5 -0
  28. package/.claude/skills/hailer-api-client/SKILL.md +55 -16
  29. package/.claude/skills/hailer-app-builder/SKILL.md +4 -270
  30. package/.claude/skills/hailer-apps-pictures/SKILL.md +3 -3
  31. package/.claude/skills/hailer-design-system/SKILL.md +96 -4
  32. package/.claude/skills/hailer-monolith-automations/SKILL.md +138 -116
  33. package/.claude/skills/hailer-permissions-system/SKILL.md +6 -9
  34. package/.claude/skills/hailer-project-protocol/SKILL.md +20 -110
  35. package/.claude/skills/integration-patterns/SKILL.md +6 -6
  36. package/.claude/skills/lsp-setup/SKILL.md +8 -9
  37. package/.claude/skills/sdk-activity-patterns/SKILL.md +238 -0
  38. package/.claude/skills/{SDK-document-templates → sdk-document-templates}/SKILL.md +13 -340
  39. package/.claude/skills/{SDK-function-fields → sdk-function-fields}/SKILL.md +8 -40
  40. package/.claude/skills/{SDK-insight-queries → sdk-insight-queries}/SKILL.md +114 -392
  41. package/.claude/skills/{SDK-ws-config-skill → sdk-ws-config-skill}/SKILL.md +79 -310
  42. package/.claude/skills/zapier-hailer-patterns/SKILL.md +84 -361
  43. package/.opencode/package-lock.json +117 -0
  44. package/CLAUDE.md +5 -358
  45. package/dist/app.d.ts.map +1 -1
  46. package/dist/app.js +10 -127
  47. package/dist/app.js.map +1 -1
  48. package/dist/bot/bot-manager.d.ts +3 -14
  49. package/dist/bot/bot-manager.d.ts.map +1 -1
  50. package/dist/bot/bot-manager.js +13 -4
  51. package/dist/bot/bot-manager.js.map +1 -1
  52. package/dist/bot/bot.d.ts +23 -102
  53. package/dist/bot/bot.d.ts.map +1 -1
  54. package/dist/bot/bot.js +356 -1212
  55. package/dist/bot/bot.js.map +1 -1
  56. package/dist/bot/services/bot-permissions.d.ts +50 -0
  57. package/dist/bot/services/bot-permissions.d.ts.map +1 -0
  58. package/dist/bot/services/bot-permissions.js +198 -0
  59. package/dist/bot/services/bot-permissions.js.map +1 -0
  60. package/dist/bot/services/index.d.ts +4 -2
  61. package/dist/bot/services/index.d.ts.map +1 -1
  62. package/dist/bot/services/index.js +10 -5
  63. package/dist/bot/services/index.js.map +1 -1
  64. package/dist/bot/services/message-classifier.d.ts +1 -1
  65. package/dist/bot/services/message-classifier.d.ts.map +1 -1
  66. package/dist/bot/services/message-classifier.js.map +1 -1
  67. package/dist/bot/services/signal-router.d.ts +32 -0
  68. package/dist/bot/services/signal-router.d.ts.map +1 -0
  69. package/dist/bot/services/signal-router.js +132 -0
  70. package/dist/bot/services/signal-router.js.map +1 -0
  71. package/dist/bot/services/system-prompt.d.ts +12 -0
  72. package/dist/bot/services/system-prompt.d.ts.map +1 -0
  73. package/dist/bot/services/system-prompt.js +93 -0
  74. package/dist/bot/services/system-prompt.js.map +1 -0
  75. package/dist/bot/services/types.d.ts +7 -34
  76. package/dist/bot/services/types.d.ts.map +1 -1
  77. package/dist/bot/services/types.js +0 -3
  78. package/dist/bot/services/types.js.map +1 -1
  79. package/dist/bot/services/workspace-refresh.d.ts +47 -0
  80. package/dist/bot/services/workspace-refresh.d.ts.map +1 -0
  81. package/dist/bot/services/workspace-refresh.js +154 -0
  82. package/dist/bot/services/workspace-refresh.js.map +1 -0
  83. package/dist/bot-config/constants.d.ts +0 -36
  84. package/dist/bot-config/constants.d.ts.map +1 -1
  85. package/dist/bot-config/constants.js +1 -76
  86. package/dist/bot-config/constants.js.map +1 -1
  87. package/dist/bot-config/context.d.ts +2 -42
  88. package/dist/bot-config/context.d.ts.map +1 -1
  89. package/dist/bot-config/context.js +13 -134
  90. package/dist/bot-config/context.js.map +1 -1
  91. package/dist/bot-config/index.d.ts +6 -15
  92. package/dist/bot-config/index.d.ts.map +1 -1
  93. package/dist/bot-config/index.js +5 -80
  94. package/dist/bot-config/index.js.map +1 -1
  95. package/dist/bot-config/loader.d.ts +16 -4
  96. package/dist/bot-config/loader.d.ts.map +1 -1
  97. package/dist/bot-config/loader.js +187 -96
  98. package/dist/bot-config/loader.js.map +1 -1
  99. package/dist/bot-config/persistence.d.ts +1 -52
  100. package/dist/bot-config/persistence.d.ts.map +1 -1
  101. package/dist/bot-config/persistence.js +3 -213
  102. package/dist/bot-config/persistence.js.map +1 -1
  103. package/dist/bot-config/state.d.ts +0 -41
  104. package/dist/bot-config/state.d.ts.map +1 -1
  105. package/dist/bot-config/state.js +0 -151
  106. package/dist/bot-config/state.js.map +1 -1
  107. package/dist/bot-config/tools.d.ts +1 -1
  108. package/dist/bot-config/tools.js +27 -27
  109. package/dist/bot-config/tools.js.map +1 -1
  110. package/dist/bot-config/types.d.ts +39 -32
  111. package/dist/bot-config/types.d.ts.map +1 -1
  112. package/dist/bot-config/types.js +0 -3
  113. package/dist/bot-config/types.js.map +1 -1
  114. package/dist/bot-config/webhooks.d.ts +0 -4
  115. package/dist/bot-config/webhooks.d.ts.map +1 -1
  116. package/dist/bot-config/webhooks.js +0 -13
  117. package/dist/bot-config/webhooks.js.map +1 -1
  118. package/dist/commands/seed-config.js +16 -31
  119. package/dist/commands/seed-config.js.map +1 -1
  120. package/dist/config.d.ts +0 -9
  121. package/dist/config.d.ts.map +1 -1
  122. package/dist/config.js +0 -15
  123. package/dist/config.js.map +1 -1
  124. package/dist/mcp/hailer-clients.js +2 -2
  125. package/dist/mcp/hailer-clients.js.map +1 -1
  126. package/dist/mcp/tool-registry.d.ts +10 -115
  127. package/dist/mcp/tool-registry.d.ts.map +1 -1
  128. package/dist/mcp/tool-registry.js +39 -363
  129. package/dist/mcp/tool-registry.js.map +1 -1
  130. package/dist/mcp/tools/activity.d.ts +3 -0
  131. package/dist/mcp/tools/activity.d.ts.map +1 -1
  132. package/dist/mcp/tools/activity.js +8 -1
  133. package/dist/mcp/tools/activity.js.map +1 -1
  134. package/dist/mcp/tools/app-core.d.ts +3 -0
  135. package/dist/mcp/tools/app-core.d.ts.map +1 -1
  136. package/dist/mcp/tools/app-core.js +9 -2
  137. package/dist/mcp/tools/app-core.js.map +1 -1
  138. package/dist/mcp/tools/app-marketplace.d.ts +3 -0
  139. package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
  140. package/dist/mcp/tools/app-marketplace.js +13 -1
  141. package/dist/mcp/tools/app-marketplace.js.map +1 -1
  142. package/dist/mcp/tools/app-member.d.ts +3 -0
  143. package/dist/mcp/tools/app-member.d.ts.map +1 -1
  144. package/dist/mcp/tools/app-member.js +6 -1
  145. package/dist/mcp/tools/app-member.js.map +1 -1
  146. package/dist/mcp/tools/app-scaffold.d.ts +3 -0
  147. package/dist/mcp/tools/app-scaffold.d.ts.map +1 -1
  148. package/dist/mcp/tools/app-scaffold.js +15 -11
  149. package/dist/mcp/tools/app-scaffold.js.map +1 -1
  150. package/dist/mcp/tools/company.d.ts +3 -0
  151. package/dist/mcp/tools/company.d.ts.map +1 -1
  152. package/dist/mcp/tools/company.js +5 -1
  153. package/dist/mcp/tools/company.js.map +1 -1
  154. package/dist/mcp/tools/discussion.d.ts +3 -0
  155. package/dist/mcp/tools/discussion.d.ts.map +1 -1
  156. package/dist/mcp/tools/discussion.js +13 -2
  157. package/dist/mcp/tools/discussion.js.map +1 -1
  158. package/dist/mcp/tools/file.d.ts +3 -0
  159. package/dist/mcp/tools/file.d.ts.map +1 -1
  160. package/dist/mcp/tools/file.js +6 -1
  161. package/dist/mcp/tools/file.js.map +1 -1
  162. package/dist/mcp/tools/index.d.ts +7 -0
  163. package/dist/mcp/tools/index.d.ts.map +1 -0
  164. package/dist/mcp/tools/index.js +34 -0
  165. package/dist/mcp/tools/index.js.map +1 -0
  166. package/dist/mcp/tools/insight.d.ts +3 -0
  167. package/dist/mcp/tools/insight.d.ts.map +1 -1
  168. package/dist/mcp/tools/insight.js +18 -8
  169. package/dist/mcp/tools/insight.js.map +1 -1
  170. package/dist/mcp/tools/user.d.ts +3 -0
  171. package/dist/mcp/tools/user.d.ts.map +1 -1
  172. package/dist/mcp/tools/user.js +6 -1
  173. package/dist/mcp/tools/user.js.map +1 -1
  174. package/dist/mcp/tools/workflow-permissions.d.ts +3 -0
  175. package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
  176. package/dist/mcp/tools/workflow-permissions.js +8 -1
  177. package/dist/mcp/tools/workflow-permissions.js.map +1 -1
  178. package/dist/mcp/tools/workflow.d.ts +3 -0
  179. package/dist/mcp/tools/workflow.d.ts.map +1 -1
  180. package/dist/mcp/tools/workflow.js +29 -28
  181. package/dist/mcp/tools/workflow.js.map +1 -1
  182. package/dist/mcp/utils/index.d.ts +4 -11
  183. package/dist/mcp/utils/index.d.ts.map +1 -1
  184. package/dist/mcp/utils/index.js +5 -36
  185. package/dist/mcp/utils/index.js.map +1 -1
  186. package/dist/mcp/utils/role-utils.d.ts +0 -32
  187. package/dist/mcp/utils/role-utils.d.ts.map +1 -1
  188. package/dist/mcp/utils/role-utils.js +0 -73
  189. package/dist/mcp/utils/role-utils.js.map +1 -1
  190. package/dist/mcp/utils/tool-helpers.d.ts +0 -25
  191. package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
  192. package/dist/mcp/utils/tool-helpers.js +0 -34
  193. package/dist/mcp/utils/tool-helpers.js.map +1 -1
  194. package/dist/mcp/webhook-handler.d.ts +4 -34
  195. package/dist/mcp/webhook-handler.d.ts.map +1 -1
  196. package/dist/mcp/webhook-handler.js +57 -74
  197. package/dist/mcp/webhook-handler.js.map +1 -1
  198. package/dist/mcp-server.d.ts.map +1 -1
  199. package/dist/mcp-server.js +3 -78
  200. package/dist/mcp-server.js.map +1 -1
  201. package/package.json +1 -2
  202. package/.claude/agents/agent-ada-skill-builder.md +0 -94
  203. package/.claude/agents/agent-alejandro-function-fields.md +0 -342
  204. package/.claude/agents/agent-bjorn-config-audit.md +0 -103
  205. package/.claude/agents/agent-builder-agent-creator.md +0 -130
  206. package/.claude/agents/agent-code-simplifier.md +0 -53
  207. package/.claude/agents/agent-dmitri-activity-crud.md +0 -159
  208. package/.claude/agents/agent-giuseppe-app-builder.md +0 -208
  209. package/.claude/agents/agent-gunther-mcp-tools.md +0 -39
  210. package/.claude/agents/agent-helga-workflow-config.md +0 -204
  211. package/.claude/agents/agent-igor-activity-mover-automation.md +0 -125
  212. package/.claude/agents/agent-ingrid-doc-templates.md +0 -261
  213. package/.claude/agents/agent-ivan-monolith.md +0 -154
  214. package/.claude/agents/agent-kenji-data-reader.md +0 -86
  215. package/.claude/agents/agent-lars-code-inspector.md +0 -102
  216. package/.claude/agents/agent-marco-mockup-builder.md +0 -110
  217. package/.claude/agents/agent-marcus-api-documenter.md +0 -323
  218. package/.claude/agents/agent-marketplace-publisher.md +0 -280
  219. package/.claude/agents/agent-marketplace-reviewer.md +0 -309
  220. package/.claude/agents/agent-permissions-handler.md +0 -208
  221. package/.claude/agents/agent-simple-writer.md +0 -48
  222. package/.claude/agents/agent-svetlana-code-review.md +0 -171
  223. package/.claude/agents/agent-tanya-test-runner.md +0 -333
  224. package/.claude/agents/agent-ui-designer.md +0 -100
  225. package/.claude/agents/agent-viktor-sql-insights.md +0 -212
  226. package/.claude/agents/agent-web-search.md +0 -55
  227. package/.claude/agents/agent-yevgeni-discussions.md +0 -45
  228. package/.claude/agents/agent-zara-zapier.md +0 -159
  229. package/.claude/skills/SDK-activity-patterns/SKILL.md +0 -428
  230. package/.claude/skills/SDK-generate-skill/SKILL.md +0 -92
  231. package/.claude/skills/SDK-init-skill/SKILL.md +0 -127
  232. package/.claude/skills/agent-structure/SKILL.md +0 -98
  233. package/.claude/skills/delegation-routing/SKILL.md +0 -202
  234. package/.claude/skills/frontend-design/SKILL.md +0 -254
  235. package/.claude/skills/hailer-activity-mover/SKILL.md +0 -213
  236. package/.claude/skills/hailer-rest-api/SKILL.md +0 -61
  237. package/.claude/skills/hailer-rest-api/hailer-activities.md +0 -184
  238. package/.claude/skills/hailer-rest-api/hailer-admin.md +0 -473
  239. package/.claude/skills/hailer-rest-api/hailer-calendar.md +0 -256
  240. package/.claude/skills/hailer-rest-api/hailer-feed.md +0 -249
  241. package/.claude/skills/hailer-rest-api/hailer-insights.md +0 -195
  242. package/.claude/skills/hailer-rest-api/hailer-messaging.md +0 -276
  243. package/.claude/skills/hailer-rest-api/hailer-workflows.md +0 -283
  244. package/.claude/skills/insight-join-patterns/SKILL.md +0 -174
  245. package/.claude/skills/json-only-output/SKILL.md +0 -72
  246. package/.claude/skills/mcp-direct-tools/SKILL.md +0 -153
  247. package/.claude/skills/optional-parameters/SKILL.md +0 -72
  248. package/.claude/skills/tool-parameter-usage/SKILL.md +0 -126
  249. package/.claude/skills/tool-response-verification/SKILL.md +0 -92
  250. package/.opencode/agent/agent-ada-skill-builder.md +0 -35
  251. package/.opencode/agent/agent-alejandro-function-fields.md +0 -39
  252. package/.opencode/agent/agent-bjorn-config-audit.md +0 -36
  253. package/.opencode/agent/agent-builder-agent-creator.md +0 -39
  254. package/.opencode/agent/agent-code-simplifier.md +0 -31
  255. package/.opencode/agent/agent-dmitri-activity-crud.md +0 -40
  256. package/.opencode/agent/agent-giuseppe-app-builder.md +0 -37
  257. package/.opencode/agent/agent-gunther-mcp-tools.md +0 -39
  258. package/.opencode/agent/agent-helga-workflow-config.md +0 -204
  259. package/.opencode/agent/agent-igor-activity-mover-automation.md +0 -46
  260. package/.opencode/agent/agent-ingrid-doc-templates.md +0 -39
  261. package/.opencode/agent/agent-ivan-monolith.md +0 -46
  262. package/.opencode/agent/agent-kenji-data-reader.md +0 -53
  263. package/.opencode/agent/agent-lars-code-inspector.md +0 -28
  264. package/.opencode/agent/agent-marco-mockup-builder.md +0 -42
  265. package/.opencode/agent/agent-marcus-api-documenter.md +0 -53
  266. package/.opencode/agent/agent-marketplace-publisher.md +0 -44
  267. package/.opencode/agent/agent-marketplace-reviewer.md +0 -42
  268. package/.opencode/agent/agent-permissions-handler.md +0 -50
  269. package/.opencode/agent/agent-simple-writer.md +0 -45
  270. package/.opencode/agent/agent-svetlana-code-review.md +0 -39
  271. package/.opencode/agent/agent-tanya-test-runner.md +0 -57
  272. package/.opencode/agent/agent-ui-designer.md +0 -56
  273. package/.opencode/agent/agent-viktor-sql-insights.md +0 -34
  274. package/.opencode/agent/agent-web-search.md +0 -42
  275. package/.opencode/agent/agent-yevgeni-discussions.md +0 -37
  276. package/.opencode/agent/agent-zara-zapier.md +0 -53
  277. package/.opencode/commands/app-squad.md +0 -135
  278. package/.opencode/commands/audit-squad.md +0 -158
  279. package/.opencode/commands/autoplan.md +0 -563
  280. package/.opencode/commands/cleanup-squad.md +0 -98
  281. package/.opencode/commands/config-squad.md +0 -106
  282. package/.opencode/commands/crud-squad.md +0 -87
  283. package/.opencode/commands/data-squad.md +0 -97
  284. package/.opencode/commands/debug-squad.md +0 -303
  285. package/.opencode/commands/doc-squad.md +0 -65
  286. package/.opencode/commands/handoff.md +0 -137
  287. package/.opencode/commands/health.md +0 -49
  288. package/.opencode/commands/help-agents.md +0 -151
  289. package/.opencode/commands/help-commands.md +0 -32
  290. package/.opencode/commands/help-faq.md +0 -29
  291. package/.opencode/commands/help-plugins.md +0 -28
  292. package/.opencode/commands/help-skills.md +0 -7
  293. package/.opencode/commands/help-tools.md +0 -40
  294. package/.opencode/commands/help.md +0 -28
  295. package/.opencode/commands/hotfix-squad.md +0 -112
  296. package/.opencode/commands/integration-squad.md +0 -82
  297. package/.opencode/commands/janitor-squad.md +0 -167
  298. package/.opencode/commands/learn-auto.md +0 -120
  299. package/.opencode/commands/learn.md +0 -120
  300. package/.opencode/commands/mcp-list.md +0 -27
  301. package/.opencode/commands/onboard-squad.md +0 -140
  302. package/.opencode/commands/plan-workspace.md +0 -732
  303. package/.opencode/commands/prd.md +0 -131
  304. package/.opencode/commands/project-status.md +0 -82
  305. package/.opencode/commands/publish.md +0 -138
  306. package/.opencode/commands/recap.md +0 -69
  307. package/.opencode/commands/restore.md +0 -64
  308. package/.opencode/commands/review-squad.md +0 -152
  309. package/.opencode/commands/save.md +0 -24
  310. package/.opencode/commands/stats.md +0 -19
  311. package/.opencode/commands/swarm.md +0 -210
  312. package/.opencode/commands/tool-builder.md +0 -39
  313. package/.opencode/commands/ws-pull.md +0 -44
@@ -2,132 +2,15 @@
2
2
  /**
3
3
  * Bot Configuration Persistence
4
4
  *
5
- * Handles initialization and persistence of bot configuration.
5
+ * Workspace management and config reload from Hailer API.
6
6
  */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
7
  Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.cleanupBotConfig = void 0;
42
- exports.initBotConfigPersistence = initBotConfigPersistence;
43
- exports.initWorkspaceSchema = initWorkspaceSchema;
44
- exports.isPersistenceInitialized = isPersistenceInitialized;
45
8
  exports.setActiveWorkspace = setActiveWorkspace;
46
- exports.getActiveWorkspace = getActiveWorkspace;
47
9
  exports.reloadConfigFromHailer = reloadConfigFromHailer;
48
- exports.getLocalBotCredentials = getLocalBotCredentials;
49
- exports.getAllLocalBotCredentials = getAllLocalBotCredentials;
50
- exports.getPersistenceStatus = getPersistenceStatus;
51
- const fs = __importStar(require("fs"));
52
10
  const logger_1 = require("../lib/logger");
53
- const signal_handler_1 = require("../mcp/signal-handler");
54
- const constants_1 = require("./constants");
55
11
  const context_1 = require("./context");
56
- const loader_1 = require("./loader");
57
12
  const logger = (0, logger_1.createLogger)({ component: 'BotConfigPersistence' });
58
13
  // ============================================================================
59
- // State
60
- // ============================================================================
61
- let persistenceInitialized = false;
62
- let hailerClient = null;
63
- // ============================================================================
64
- // Initialization
65
- // ============================================================================
66
- /**
67
- * Initialize bot config persistence
68
- *
69
- * Sets up signal handler and loads bot configuration from files.
70
- */
71
- async function initBotConfigPersistence(client) {
72
- if (persistenceInitialized) {
73
- logger.debug('Bot config persistence already initialized');
74
- return;
75
- }
76
- hailerClient = client;
77
- // Set up signal handler for real-time activity signals
78
- try {
79
- signal_handler_1.SignalHandler.getOrCreate(client.getClient());
80
- logger.debug('Signal handler initialized for bot config monitoring');
81
- }
82
- catch (error) {
83
- logger.warn('Failed to initialize signal handler', {
84
- error: error instanceof Error ? error.message : String(error)
85
- });
86
- }
87
- // Load bot configs from .bot-config/*.json
88
- const contexts = (0, loader_1.loadBotConfigs)();
89
- logger.debug('Loaded bot configs', { count: contexts.length });
90
- persistenceInitialized = true;
91
- logger.debug('Bot config persistence initialized');
92
- }
93
- /**
94
- * Initialize workspace schema for a specific workspace
95
- *
96
- * Discovers the Agent Directory in the workspace and caches field IDs.
97
- */
98
- async function initWorkspaceSchema(client, workspaceId) {
99
- // Check if we already have a context for this workspace
100
- const existingContexts = (0, context_1.listBotContexts)();
101
- if (existingContexts.includes(workspaceId)) {
102
- const ctx = (0, context_1.getBotContext)(workspaceId);
103
- const schema = ctx.getSchema();
104
- if (schema?.agentDirectoryWorkflowId) {
105
- logger.debug('Workspace schema already initialized', { workspaceId });
106
- return true;
107
- }
108
- }
109
- // Try to initialize from API
110
- try {
111
- const ctx = (0, context_1.getBotContext)(workspaceId);
112
- await ctx.initializeFromApi(client);
113
- logger.debug('Workspace schema initialized from API', { workspaceId });
114
- return true;
115
- }
116
- catch (error) {
117
- logger.warn('Failed to initialize workspace schema', {
118
- workspaceId,
119
- error: error instanceof Error ? error.message : String(error)
120
- });
121
- return false;
122
- }
123
- }
124
- /**
125
- * Check if persistence is initialized
126
- */
127
- function isPersistenceInitialized() {
128
- return persistenceInitialized;
129
- }
130
- // ============================================================================
131
14
  // Workspace Management
132
15
  // ============================================================================
133
16
  let activeWorkspaceId = null;
@@ -138,21 +21,13 @@ function setActiveWorkspace(workspaceId) {
138
21
  activeWorkspaceId = workspaceId;
139
22
  logger.debug('Active workspace set', { workspaceId });
140
23
  }
141
- /**
142
- * Get the active workspace ID
143
- */
144
- function getActiveWorkspace() {
145
- return activeWorkspaceId;
146
- }
147
24
  /**
148
25
  * Reload bot configuration from Hailer
149
26
  *
150
27
  * Re-discovers the Agent Directory and reloads credentials.
151
- * If no client is provided, uses the stored hailerClient.
152
28
  */
153
29
  async function reloadConfigFromHailer(client) {
154
- const clientToUse = client || hailerClient;
155
- if (!clientToUse) {
30
+ if (!client) {
156
31
  logger.warn('No Hailer client available for config reload');
157
32
  return;
158
33
  }
@@ -163,7 +38,7 @@ async function reloadConfigFromHailer(client) {
163
38
  }
164
39
  try {
165
40
  const ctx = (0, context_1.getBotContext)(workspaceId);
166
- await ctx.initializeFromApi(clientToUse);
41
+ await ctx.initializeFromApi(client);
167
42
  logger.debug('Bot config reloaded from Hailer', { workspaceId });
168
43
  }
169
44
  catch (error) {
@@ -173,89 +48,4 @@ async function reloadConfigFromHailer(client) {
173
48
  });
174
49
  }
175
50
  }
176
- // ============================================================================
177
- // Credentials
178
- // ============================================================================
179
- /**
180
- * Load local credentials from .bot-credentials.json
181
- */
182
- function loadLocalCredentials() {
183
- try {
184
- if (fs.existsSync(constants_1.LOCAL_CREDENTIALS_FILE)) {
185
- const content = fs.readFileSync(constants_1.LOCAL_CREDENTIALS_FILE, 'utf-8');
186
- return JSON.parse(content);
187
- }
188
- }
189
- catch (error) {
190
- logger.warn('Failed to load local credentials', {
191
- error: error instanceof Error ? error.message : String(error)
192
- });
193
- }
194
- return {};
195
- }
196
- /**
197
- * Get local bot credentials for daemon creation
198
- *
199
- * Looks up credentials by user ID or bot ID.
200
- */
201
- function getLocalBotCredentials(userIdOrBotId) {
202
- // First try local credentials file
203
- const localCreds = loadLocalCredentials();
204
- if (localCreds[userIdOrBotId]) {
205
- return localCreds[userIdOrBotId];
206
- }
207
- // Then try bot contexts
208
- for (const workspaceId of (0, context_1.listBotContexts)()) {
209
- const ctx = (0, context_1.getBotContext)(workspaceId);
210
- const creds = ctx.getCredentials(userIdOrBotId);
211
- if (creds) {
212
- return {
213
- email: creds.email,
214
- password: creds.password,
215
- displayName: creds.displayName
216
- };
217
- }
218
- }
219
- return null;
220
- }
221
- /**
222
- * Get all local bot credentials
223
- */
224
- function getAllLocalBotCredentials() {
225
- const result = {};
226
- // Load from file
227
- const localCreds = loadLocalCredentials();
228
- Object.assign(result, localCreds);
229
- // Add from bot contexts
230
- for (const workspaceId of (0, context_1.listBotContexts)()) {
231
- const ctx = (0, context_1.getBotContext)(workspaceId);
232
- const allCreds = ctx.getAllCredentials();
233
- for (const creds of allCreds) {
234
- result[creds.userId] = {
235
- email: creds.email,
236
- password: creds.password,
237
- displayName: creds.displayName
238
- };
239
- }
240
- }
241
- return result;
242
- }
243
- /**
244
- * Get persistence status (for debugging)
245
- */
246
- function getPersistenceStatus() {
247
- return {
248
- initialized: persistenceInitialized,
249
- workspaceCount: (0, context_1.listBotContexts)().length,
250
- hasClient: hailerClient !== null
251
- };
252
- }
253
- // ============================================================================
254
- // Cleanup
255
- // ============================================================================
256
- /**
257
- * Cleanup bot config (alias for cleanupBotState)
258
- */
259
- var state_1 = require("./state");
260
- Object.defineProperty(exports, "cleanupBotConfig", { enumerable: true, get: function () { return state_1.cleanupBotState; } });
261
51
  //# sourceMappingURL=persistence.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.js","sourceRoot":"","sources":["../../src/bot-config/persistence.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,4DAwBC;AAOD,kDAyBC;AAKD,4DAEC;AAWD,gDAGC;AAKD,gDAEC;AAQD,wDAuBC;AA4BD,wDAqBC;AAKD,8DAqBC;AAKD,oDAUC;AAxOD,uCAAyB;AACzB,0CAA6C;AAE7C,0DAAsD;AACtD,2CAAqD;AACrD,uCAA2D;AAC3D,qCAA0C;AAG1C,MAAM,MAAM,GAAG,IA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iBAAiB,IAAI,IAAA,yBAAe,GAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;QACxD,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,CAAC;QACvC,MAAM,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE;YAClD,WAAW;YACX,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -4,43 +4,6 @@
4
4
  * Manages which bots are enabled/disabled.
5
5
  * Delegates to BotContext for storage.
6
6
  */
7
- /**
8
- * Register callback for bot state changes
9
- */
10
- export declare function onBotStateChange(callback: (userId: string, enabled: boolean) => void): void;
11
- /**
12
- * Register callback for daemon restart needs
13
- */
14
- export declare function onDaemonRestartNeeded(callback: () => void): void;
15
- /**
16
- * Notify that daemon restart is needed (debounced)
17
- */
18
- export declare function notifyDaemonRestartNeeded(): void;
19
- /**
20
- * Cleanup function - clear pending timers and callbacks
21
- */
22
- export declare function cleanupBotState(): void;
23
- /**
24
- * Get bot state for all workspaces (merged)
25
- * Returns userId -> enabled map
26
- */
27
- export declare function getBotState(): Record<string, boolean>;
28
- /**
29
- * Get bot state for a specific workspace
30
- */
31
- export declare function getBotContextBotState(workspaceId: string): Record<string, boolean>;
32
- /**
33
- * Get bot user ID (returns the userId itself for compatibility)
34
- */
35
- export declare function getBotUserId(userId: string): string | null;
36
- /**
37
- * Get bot type for a user ID
38
- */
39
- export declare function getBotType(userId: string): string | null;
40
- /**
41
- * Get all enabled bots with their types (all workspaces)
42
- */
43
- export declare function getEnabledBotsWithTypes(): Map<string, string | null>;
44
7
  /**
45
8
  * Set bot enabled state
46
9
  *
@@ -49,8 +12,4 @@ export declare function getEnabledBotsWithTypes(): Map<string, string | null>;
49
12
  * - setBotEnabled(userId, enabled) - auto-find workspace (backward compat)
50
13
  */
51
14
  export declare function setBotEnabled(workspaceIdOrUserId: string, userIdOrEnabled: string | boolean, enabledOptional?: boolean): void;
52
- /**
53
- * Set bot user ID (for compatibility - updates state map)
54
- */
55
- export declare function setBotUserId(workspaceId: string, userId: string, botType?: string | null): void;
56
15
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/bot-config/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAE3F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEhE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAiBhD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAUtC;AAMD;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYrD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIlF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOxD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAcpE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,MAAM,GAAG,OAAO,EACjC,eAAe,CAAC,EAAE,OAAO,GACxB,IAAI,CAyCN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAM,GAAG,IAAW,GAC5B,IAAI,CAIN"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/bot-config/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,MAAM,GAAG,OAAO,EACjC,eAAe,CAAC,EAAE,OAAO,GACxB,IAAI,CA2BN"}
@@ -6,141 +6,10 @@
6
6
  * Delegates to BotContext for storage.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.onBotStateChange = onBotStateChange;
10
- exports.onDaemonRestartNeeded = onDaemonRestartNeeded;
11
- exports.notifyDaemonRestartNeeded = notifyDaemonRestartNeeded;
12
- exports.cleanupBotState = cleanupBotState;
13
- exports.getBotState = getBotState;
14
- exports.getBotContextBotState = getBotContextBotState;
15
- exports.getBotUserId = getBotUserId;
16
- exports.getBotType = getBotType;
17
- exports.getEnabledBotsWithTypes = getEnabledBotsWithTypes;
18
9
  exports.setBotEnabled = setBotEnabled;
19
- exports.setBotUserId = setBotUserId;
20
10
  const logger_1 = require("../lib/logger");
21
11
  const context_1 = require("./context");
22
12
  const logger = (0, logger_1.createLogger)({ component: 'BotState' });
23
- // ============================================================================
24
- // Callbacks
25
- // ============================================================================
26
- // Global callbacks for bot state changes (cross-workspace)
27
- const stateChangeCallbacks = [];
28
- const daemonRestartCallbacks = [];
29
- // Debounce mechanism for restart triggers
30
- let restartDebounceTimer = null;
31
- const RESTART_DEBOUNCE_MS = 500;
32
- /**
33
- * Register callback for bot state changes
34
- */
35
- function onBotStateChange(callback) {
36
- stateChangeCallbacks.push(callback);
37
- }
38
- /**
39
- * Register callback for daemon restart needs
40
- */
41
- function onDaemonRestartNeeded(callback) {
42
- daemonRestartCallbacks.push(callback);
43
- }
44
- /**
45
- * Notify that daemon restart is needed (debounced)
46
- */
47
- function notifyDaemonRestartNeeded() {
48
- if (restartDebounceTimer) {
49
- logger.debug('Daemon restart already pending, resetting debounce timer');
50
- clearTimeout(restartDebounceTimer);
51
- }
52
- restartDebounceTimer = setTimeout(() => {
53
- restartDebounceTimer = null;
54
- logger.debug('Notifying daemon restart needed');
55
- daemonRestartCallbacks.forEach(cb => {
56
- try {
57
- cb();
58
- }
59
- catch (error) {
60
- logger.error('Daemon restart callback failed', { error });
61
- }
62
- });
63
- }, RESTART_DEBOUNCE_MS);
64
- }
65
- /**
66
- * Cleanup function - clear pending timers and callbacks
67
- */
68
- function cleanupBotState() {
69
- if (restartDebounceTimer) {
70
- clearTimeout(restartDebounceTimer);
71
- restartDebounceTimer = null;
72
- }
73
- stateChangeCallbacks.length = 0;
74
- daemonRestartCallbacks.length = 0;
75
- logger.debug('Bot state cleanup completed');
76
- }
77
- // ============================================================================
78
- // State Access
79
- // ============================================================================
80
- /**
81
- * Get bot state for all workspaces (merged)
82
- * Returns userId -> enabled map
83
- */
84
- function getBotState() {
85
- const result = {};
86
- for (const workspaceId of (0, context_1.listBotContexts)()) {
87
- const ctx = (0, context_1.getExistingBotContext)(workspaceId);
88
- if (ctx) {
89
- const states = ctx.getAllBotStates();
90
- Object.assign(result, states);
91
- }
92
- }
93
- return result;
94
- }
95
- /**
96
- * Get bot state for a specific workspace
97
- */
98
- function getBotContextBotState(workspaceId) {
99
- const ctx = (0, context_1.getExistingBotContext)(workspaceId);
100
- if (!ctx)
101
- return {};
102
- return ctx.getAllBotStates();
103
- }
104
- /**
105
- * Get bot user ID (returns the userId itself for compatibility)
106
- */
107
- function getBotUserId(userId) {
108
- for (const workspaceId of (0, context_1.listBotContexts)()) {
109
- const ctx = (0, context_1.getExistingBotContext)(workspaceId);
110
- if (ctx?.getBotState(userId)) {
111
- return userId;
112
- }
113
- }
114
- return null;
115
- }
116
- /**
117
- * Get bot type for a user ID
118
- */
119
- function getBotType(userId) {
120
- for (const workspaceId of (0, context_1.listBotContexts)()) {
121
- const ctx = (0, context_1.getExistingBotContext)(workspaceId);
122
- const state = ctx?.getBotState(userId);
123
- if (state)
124
- return state.botType;
125
- }
126
- return null;
127
- }
128
- /**
129
- * Get all enabled bots with their types (all workspaces)
130
- */
131
- function getEnabledBotsWithTypes() {
132
- const result = new Map();
133
- for (const workspaceId of (0, context_1.listBotContexts)()) {
134
- const ctx = (0, context_1.getExistingBotContext)(workspaceId);
135
- if (ctx) {
136
- const enabled = ctx.getEnabledBotsWithTypes();
137
- for (const [userId, botType] of enabled) {
138
- result.set(userId, botType);
139
- }
140
- }
141
- }
142
- return result;
143
- }
144
13
  /**
145
14
  * Set bot enabled state
146
15
  *
@@ -152,12 +21,9 @@ function setBotEnabled(workspaceIdOrUserId, userIdOrEnabled, enabledOptional) {
152
21
  let workspaceId;
153
22
  let userId;
154
23
  let enabled;
155
- // Detect which signature was used
156
24
  if (typeof userIdOrEnabled === 'boolean') {
157
- // 2-argument form: setBotEnabled(userId, enabled)
158
25
  userId = workspaceIdOrUserId;
159
26
  enabled = userIdOrEnabled;
160
- // Find workspace that has this bot
161
27
  const workspaces = (0, context_1.listBotContexts)();
162
28
  workspaceId = workspaces[0] || 'default';
163
29
  for (const wsId of workspaces) {
@@ -169,29 +35,12 @@ function setBotEnabled(workspaceIdOrUserId, userIdOrEnabled, enabledOptional) {
169
35
  }
170
36
  }
171
37
  else {
172
- // 3-argument form: setBotEnabled(workspaceId, userId, enabled)
173
38
  workspaceId = workspaceIdOrUserId;
174
39
  userId = userIdOrEnabled;
175
40
  enabled = enabledOptional;
176
41
  }
177
42
  const ctx = (0, context_1.getBotContext)(workspaceId);
178
43
  ctx.setBotEnabled(userId, enabled);
179
- // Notify global listeners
180
- stateChangeCallbacks.forEach(cb => cb(userId, enabled));
181
44
  logger.info('Bot state changed', { workspaceId, userId, enabled });
182
- // If orchestrator state changes, trigger daemon restart
183
- const state = ctx.getBotState(userId);
184
- if (state?.botType === 'orchestrator') {
185
- logger.info('Orchestrator state changed, triggering daemon restart');
186
- notifyDaemonRestartNeeded();
187
- }
188
- }
189
- /**
190
- * Set bot user ID (for compatibility - updates state map)
191
- */
192
- function setBotUserId(workspaceId, userId, botType = null) {
193
- const ctx = (0, context_1.getBotContext)(workspaceId);
194
- ctx.setBotType(userId, botType);
195
- logger.debug('Bot user ID set', { workspaceId, userId, botType });
196
45
  }
197
46
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/bot-config/state.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAsBH,4CAEC;AAKD,sDAEC;AAKD,8DAiBC;AAKD,0CAUC;AAUD,kCAYC;AAKD,sDAIC;AAKD,oCAQC;AAKD,gCAOC;AAKD,0DAcC;AASD,sCA6CC;AAKD,oCAQC;AAhND,0CAA6C;AAC7C,uCAAkF;AAElF,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AAEvD,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,2DAA2D;AAC3D,MAAM,oBAAoB,GAAsD,EAAE,CAAC;AACnF,MAAM,sBAAsB,GAAsB,EAAE,CAAC;AAErD,0CAA0C;AAC1C,IAAI,oBAAoB,GAA0B,IAAI,CAAC;AACvD,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;GAEG;AACH,SAAgB,gBAAgB,CAAC,QAAoD;IACnF,oBAAoB,CA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Ae,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,GAAG,mBAAmB,CAAC;QAC7B,OAAO,GAAG,eAAe,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;QACrC,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;QACzC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,IAAA,+BAAqB,EAAC,IAAI,CAAC,CAAC;YACxC,IAAI,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC7B,WAAW,GAAG,IAAI,CAAC;gBACnB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,WAAW,GAAG,mBAAmB,CAAC;QAClC,MAAM,GAAG,eAAyB,CAAC;QACnC,OAAO,GAAG,eAAgB,CAAC;IAC7B,CAAC;IAED,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAC,WAAW,CAAC,CAAC;IACvC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -18,7 +18,7 @@ export declare const enableBotTool: Tool;
18
18
  */
19
19
  export declare const disableBotTool: Tool;
20
20
  /**
21
- * Check specialist status from Agent Directory
21
+ * Check bot status from Agent Directory
22
22
  */
23
23
  export declare const checkSpecialistStatusTool: Tool;
24
24
  /**
@@ -129,17 +129,17 @@ exports.disableBotTool = {
129
129
  }
130
130
  };
131
131
  /**
132
- * Check specialist status from Agent Directory
132
+ * Check bot status from Agent Directory
133
133
  */
134
134
  exports.checkSpecialistStatusTool = {
135
- name: 'check_specialist_status',
135
+ name: 'check_bot_status',
136
136
  group: tool_registry_1.ToolGroup.BOT_INTERNAL,
137
- description: 'Check real-time status of AI specialists from Agent Directory. Returns which specialists are deployed (active) vs retired (disabled).',
137
+ description: 'Check real-time status of AI bots from Agent Directory. Returns which bots are deployed (active) vs retired (disabled).',
138
138
  schema: zod_1.z.object({
139
- specialistName: zod_1.z.string().optional().describe("Optional: specific specialist name to check (e.g., 'Hailer Expert', 'Bug Fixer'). If not provided, returns all specialists.")
139
+ botName: zod_1.z.string().optional().describe("Optional: specific bot name to check (e.g., 'Hailer Expert', 'Bug Fixer'). If not provided, returns all bots.")
140
140
  }),
141
141
  execute: async (params, context) => {
142
- const { specialistName } = params;
142
+ const { botName } = params;
143
143
  // Get the first available bot context
144
144
  const workspaceId = getPrimaryWorkspaceId();
145
145
  if (!workspaceId) {
@@ -174,9 +174,9 @@ exports.checkSpecialistStatusTool = {
174
174
  };
175
175
  }
176
176
  try {
177
- const deployedSpecialists = [];
178
- const retiredSpecialists = [];
179
- // Fetch deployed (active) specialists
177
+ const deployedBots = [];
178
+ const retiredBots = [];
179
+ // Fetch deployed (active) bots
180
180
  const deployedActivities = await client.fetchActivityList(schema.agentDirectoryWorkflowId, schema.deployedPhaseId, 100, { returnFlat: true });
181
181
  const deployedList = Array.isArray(deployedActivities)
182
182
  ? deployedActivities
@@ -184,21 +184,21 @@ exports.checkSpecialistStatusTool = {
184
184
  for (const activity of deployedList) {
185
185
  const botType = activity.fields?.botType || null;
186
186
  const name = activity.name || 'Unknown';
187
- if (specialistName) {
188
- const normalizedSearch = specialistName.toLowerCase();
187
+ if (botName) {
188
+ const normalizedSearch = botName.toLowerCase();
189
189
  const normalizedName = name.toLowerCase();
190
190
  const normalizedBotType = (botType || '').toLowerCase();
191
191
  if (!normalizedName.includes(normalizedSearch) && !normalizedBotType.includes(normalizedSearch)) {
192
192
  continue;
193
193
  }
194
194
  }
195
- deployedSpecialists.push({
195
+ deployedBots.push({
196
196
  name,
197
197
  botType,
198
198
  activityId: activity._id
199
199
  });
200
200
  }
201
- // Fetch retired (disabled) specialists
201
+ // Fetch retired (disabled) bots
202
202
  const retiredActivities = await client.fetchActivityList(schema.agentDirectoryWorkflowId, schema.retiredPhaseId, 100, { returnFlat: true });
203
203
  const retiredList = Array.isArray(retiredActivities)
204
204
  ? retiredActivities
@@ -206,15 +206,15 @@ exports.checkSpecialistStatusTool = {
206
206
  for (const activity of retiredList) {
207
207
  const botType = activity.fields?.botType || null;
208
208
  const name = activity.name || 'Unknown';
209
- if (specialistName) {
210
- const normalizedSearch = specialistName.toLowerCase();
209
+ if (botName) {
210
+ const normalizedSearch = botName.toLowerCase();
211
211
  const normalizedName = name.toLowerCase();
212
212
  const normalizedBotType = (botType || '').toLowerCase();
213
213
  if (!normalizedName.includes(normalizedSearch) && !normalizedBotType.includes(normalizedSearch)) {
214
214
  continue;
215
215
  }
216
216
  }
217
- retiredSpecialists.push({
217
+ retiredBots.push({
218
218
  name,
219
219
  botType,
220
220
  activityId: activity._id
@@ -222,29 +222,29 @@ exports.checkSpecialistStatusTool = {
222
222
  }
223
223
  // Format output
224
224
  let output = '**Specialist Status** (live from Agent Directory)\n\n';
225
- if (deployedSpecialists.length > 0) {
225
+ if (deployedBots.length > 0) {
226
226
  output += '✅ **Deployed (Active):**\n';
227
- for (const specialist of deployedSpecialists) {
228
- const typeDisplay = specialist.botType ? ` (${specialist.botType})` : '';
229
- output += `- ${specialist.name}${typeDisplay}\n`;
227
+ for (const bot of deployedBots) {
228
+ const typeDisplay = bot.botType ? ` (${bot.botType})` : '';
229
+ output += `- ${bot.name}${typeDisplay}\n`;
230
230
  }
231
231
  }
232
232
  else {
233
233
  output += '✅ **Deployed (Active):** None\n';
234
234
  }
235
235
  output += '\n';
236
- if (retiredSpecialists.length > 0) {
236
+ if (retiredBots.length > 0) {
237
237
  output += '❌ **Retired (Disabled):**\n';
238
- for (const specialist of retiredSpecialists) {
239
- const typeDisplay = specialist.botType ? ` (${specialist.botType})` : '';
240
- output += `- ${specialist.name}${typeDisplay}\n`;
238
+ for (const bot of retiredBots) {
239
+ const typeDisplay = bot.botType ? ` (${bot.botType})` : '';
240
+ output += `- ${bot.name}${typeDisplay}\n`;
241
241
  }
242
242
  }
243
243
  else {
244
244
  output += '❌ **Retired (Disabled):** None\n';
245
245
  }
246
- if (specialistName && deployedSpecialists.length === 0 && retiredSpecialists.length === 0) {
247
- output = `**No specialists found matching "${specialistName}"**\n\nTry searching without a filter to see all specialists.`;
246
+ if (botName && deployedBots.length === 0 && retiredBots.length === 0) {
247
+ output = `**No bots found matching "${botName}"**\n\nTry searching without a filter to see all bots.`;
248
248
  }
249
249
  return {
250
250
  content: [{
@@ -254,13 +254,13 @@ exports.checkSpecialistStatusTool = {
254
254
  };
255
255
  }
256
256
  catch (error) {
257
- logger.error('Failed to check specialist status', {
257
+ logger.error('Failed to check bot status', {
258
258
  error: error instanceof Error ? error.message : String(error)
259
259
  });
260
260
  return {
261
261
  content: [{
262
262
  type: 'text',
263
- text: `**Error checking specialist status**\n\n${error instanceof Error ? error.message : String(error)}`
263
+ text: `**Error checking bot status**\n\n${error instanceof Error ? error.message : String(error)}`
264
264
  }],
265
265
  isError: true
266
266
  };