@hailer/mcp 1.1.14 → 1.1.16
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.
- package/.claude/CLAUDE.md +370 -0
- package/.claude/agents/agent-ada-skill-builder.md +94 -0
- package/.claude/agents/agent-alejandro-function-fields.md +342 -0
- package/.claude/agents/agent-bjorn-config-audit.md +103 -0
- package/.claude/agents/agent-builder-agent-creator.md +130 -0
- package/.claude/agents/agent-code-simplifier.md +53 -0
- package/.claude/agents/agent-dmitri-activity-crud.md +159 -0
- package/.claude/agents/agent-giuseppe-app-builder.md +208 -0
- package/.claude/agents/agent-gunther-mcp-tools.md +39 -0
- package/.claude/agents/agent-helga-workflow-config.md +204 -0
- package/.claude/agents/agent-igor-activity-mover-automation.md +125 -0
- package/.claude/agents/agent-ingrid-doc-templates.md +261 -0
- package/.claude/agents/agent-ivan-monolith.md +154 -0
- package/.claude/agents/agent-kenji-data-reader.md +86 -0
- package/.claude/agents/agent-lars-code-inspector.md +102 -0
- package/.claude/agents/agent-marco-mockup-builder.md +110 -0
- package/.claude/agents/agent-marcus-api-documenter.md +323 -0
- package/.claude/agents/agent-marketplace-publisher.md +280 -0
- package/.claude/agents/agent-marketplace-reviewer.md +309 -0
- package/.claude/agents/agent-permissions-handler.md +208 -0
- package/.claude/agents/agent-simple-writer.md +48 -0
- package/.claude/agents/agent-svetlana-code-review.md +171 -0
- package/.claude/agents/agent-tanya-test-runner.md +333 -0
- package/.claude/agents/agent-ui-designer.md +100 -0
- package/.claude/agents/agent-viktor-sql-insights.md +212 -0
- package/.claude/agents/agent-web-search.md +55 -0
- package/.claude/agents/agent-yevgeni-discussions.md +45 -0
- package/.claude/agents/agent-zara-zapier.md +159 -0
- package/.claude/agents/ragnar.md +68 -0
- package/.claude/commands/app-squad.md +135 -0
- package/.claude/commands/audit-squad.md +158 -0
- package/.claude/commands/autoplan.md +563 -0
- package/.claude/commands/cleanup-squad.md +98 -0
- package/.claude/commands/config-squad.md +106 -0
- package/.claude/commands/crud-squad.md +87 -0
- package/.claude/commands/data-squad.md +97 -0
- package/.claude/commands/debug-squad.md +303 -0
- package/.claude/commands/doc-squad.md +65 -0
- package/.claude/commands/handoff.md +137 -0
- package/.claude/commands/health.md +49 -0
- package/.claude/commands/help.md +29 -0
- package/.claude/commands/help:agents.md +151 -0
- package/.claude/commands/help:commands.md +78 -0
- package/.claude/commands/help:faq.md +79 -0
- package/.claude/commands/help:plugins.md +50 -0
- package/.claude/commands/help:skills.md +93 -0
- package/.claude/commands/help:tools.md +75 -0
- package/.claude/commands/hotfix-squad.md +112 -0
- package/.claude/commands/integration-squad.md +82 -0
- package/.claude/commands/janitor-squad.md +167 -0
- package/.claude/commands/learn-auto.md +120 -0
- package/.claude/commands/learn.md +120 -0
- package/.claude/commands/mcp-list.md +27 -0
- package/.claude/commands/onboard-squad.md +140 -0
- package/.claude/commands/plan-workspace.md +732 -0
- package/.claude/commands/prd.md +130 -0
- package/.claude/commands/project-status.md +82 -0
- package/.claude/commands/publish.md +138 -0
- package/.claude/commands/recap.md +69 -0
- package/.claude/commands/restore.md +64 -0
- package/.claude/commands/review-squad.md +152 -0
- package/.claude/commands/save.md +24 -0
- package/.claude/commands/stats.md +19 -0
- package/.claude/commands/swarm.md +210 -0
- package/.claude/commands/tool-builder.md +39 -0
- package/.claude/commands/ws-pull.md +44 -0
- package/.claude/skills/SDK-activity-patterns/SKILL.md +428 -0
- package/.claude/skills/SDK-document-templates/SKILL.md +1033 -0
- package/.claude/skills/SDK-function-fields/SKILL.md +542 -0
- package/.claude/skills/SDK-generate-skill/SKILL.md +92 -0
- package/.claude/skills/SDK-init-skill/SKILL.md +127 -0
- package/.claude/skills/SDK-insight-queries/SKILL.md +787 -0
- package/.claude/skills/SDK-ws-config-skill/SKILL.md +1139 -0
- package/.claude/skills/agent-structure/SKILL.md +98 -0
- package/.claude/skills/api-documentation-patterns/SKILL.md +474 -0
- package/.claude/skills/chrome-mcp-reference/SKILL.md +370 -0
- package/.claude/skills/delegation-routing/SKILL.md +202 -0
- package/.claude/skills/frontend-design/SKILL.md +254 -0
- package/.claude/skills/hailer-activity-mover/SKILL.md +213 -0
- package/.claude/skills/hailer-api-client/SKILL.md +518 -0
- package/.claude/skills/hailer-app-builder/SKILL.md +1440 -0
- package/.claude/skills/hailer-apps-pictures/SKILL.md +269 -0
- package/.claude/skills/hailer-design-system/SKILL.md +231 -0
- package/.claude/skills/hailer-monolith-automations/SKILL.md +686 -0
- package/.claude/skills/hailer-permissions-system/SKILL.md +121 -0
- package/.claude/skills/hailer-project-protocol/SKILL.md +488 -0
- package/.claude/skills/hailer-rest-api/SKILL.md +61 -0
- package/.claude/skills/hailer-rest-api/hailer-activities.md +184 -0
- package/.claude/skills/hailer-rest-api/hailer-admin.md +473 -0
- package/.claude/skills/hailer-rest-api/hailer-calendar.md +256 -0
- package/.claude/skills/hailer-rest-api/hailer-feed.md +249 -0
- package/.claude/skills/hailer-rest-api/hailer-insights.md +195 -0
- package/.claude/skills/hailer-rest-api/hailer-messaging.md +276 -0
- package/.claude/skills/hailer-rest-api/hailer-workflows.md +283 -0
- package/.claude/skills/insight-join-patterns/SKILL.md +174 -0
- package/.claude/skills/integration-patterns/SKILL.md +421 -0
- package/.claude/skills/json-only-output/SKILL.md +72 -0
- package/.claude/skills/lsp-setup/SKILL.md +160 -0
- package/.claude/skills/mcp-direct-tools/SKILL.md +153 -0
- package/.claude/skills/optional-parameters/SKILL.md +72 -0
- package/.claude/skills/publish-hailer-app/SKILL.md +221 -0
- package/.claude/skills/testing-patterns/SKILL.md +630 -0
- package/.claude/skills/tool-builder/SKILL.md +250 -0
- package/.claude/skills/tool-parameter-usage/SKILL.md +126 -0
- package/.claude/skills/tool-response-verification/SKILL.md +92 -0
- package/.claude/skills/zapier-hailer-patterns/SKILL.md +581 -0
- package/.opencode/agent/agent-ada-skill-builder.md +35 -0
- package/.opencode/agent/agent-alejandro-function-fields.md +39 -0
- package/.opencode/agent/agent-bjorn-config-audit.md +36 -0
- package/.opencode/agent/agent-builder-agent-creator.md +39 -0
- package/.opencode/agent/agent-code-simplifier.md +31 -0
- package/.opencode/agent/agent-dmitri-activity-crud.md +40 -0
- package/.opencode/agent/agent-giuseppe-app-builder.md +37 -0
- package/.opencode/agent/agent-gunther-mcp-tools.md +39 -0
- package/.opencode/agent/agent-helga-workflow-config.md +204 -0
- package/.opencode/agent/agent-igor-activity-mover-automation.md +46 -0
- package/.opencode/agent/agent-ingrid-doc-templates.md +39 -0
- package/.opencode/agent/agent-ivan-monolith.md +46 -0
- package/.opencode/agent/agent-kenji-data-reader.md +53 -0
- package/.opencode/agent/agent-lars-code-inspector.md +28 -0
- package/.opencode/agent/agent-marco-mockup-builder.md +42 -0
- package/.opencode/agent/agent-marcus-api-documenter.md +53 -0
- package/.opencode/agent/agent-marketplace-publisher.md +44 -0
- package/.opencode/agent/agent-marketplace-reviewer.md +42 -0
- package/.opencode/agent/agent-permissions-handler.md +50 -0
- package/.opencode/agent/agent-simple-writer.md +45 -0
- package/.opencode/agent/agent-svetlana-code-review.md +39 -0
- package/.opencode/agent/agent-tanya-test-runner.md +57 -0
- package/.opencode/agent/agent-ui-designer.md +56 -0
- package/.opencode/agent/agent-viktor-sql-insights.md +34 -0
- package/.opencode/agent/agent-web-search.md +42 -0
- package/.opencode/agent/agent-yevgeni-discussions.md +37 -0
- package/.opencode/agent/agent-zara-zapier.md +53 -0
- package/.opencode/commands/app-squad.md +135 -0
- package/.opencode/commands/audit-squad.md +158 -0
- package/.opencode/commands/autoplan.md +563 -0
- package/.opencode/commands/cleanup-squad.md +98 -0
- package/.opencode/commands/config-squad.md +106 -0
- package/.opencode/commands/crud-squad.md +87 -0
- package/.opencode/commands/data-squad.md +97 -0
- package/.opencode/commands/debug-squad.md +303 -0
- package/.opencode/commands/doc-squad.md +65 -0
- package/.opencode/commands/handoff.md +137 -0
- package/.opencode/commands/health.md +49 -0
- package/.opencode/commands/help-agents.md +151 -0
- package/.opencode/commands/help-commands.md +32 -0
- package/.opencode/commands/help-faq.md +29 -0
- package/.opencode/commands/help-plugins.md +28 -0
- package/.opencode/commands/help-skills.md +7 -0
- package/.opencode/commands/help-tools.md +40 -0
- package/.opencode/commands/help.md +28 -0
- package/.opencode/commands/hotfix-squad.md +112 -0
- package/.opencode/commands/integration-squad.md +82 -0
- package/.opencode/commands/janitor-squad.md +167 -0
- package/.opencode/commands/learn-auto.md +120 -0
- package/.opencode/commands/learn.md +120 -0
- package/.opencode/commands/mcp-list.md +27 -0
- package/.opencode/commands/onboard-squad.md +140 -0
- package/.opencode/commands/plan-workspace.md +732 -0
- package/.opencode/commands/prd.md +131 -0
- package/.opencode/commands/project-status.md +82 -0
- package/.opencode/commands/publish.md +138 -0
- package/.opencode/commands/recap.md +69 -0
- package/.opencode/commands/restore.md +64 -0
- package/.opencode/commands/review-squad.md +152 -0
- package/.opencode/commands/save.md +24 -0
- package/.opencode/commands/stats.md +19 -0
- package/.opencode/commands/swarm.md +210 -0
- package/.opencode/commands/tool-builder.md +39 -0
- package/.opencode/commands/ws-pull.md +44 -0
- package/.opencode/opencode.json +21 -0
- package/dist/agents/bot-manager.d.ts +48 -0
- package/dist/agents/bot-manager.d.ts.map +1 -0
- package/dist/agents/bot-manager.js +254 -0
- package/dist/agents/bot-manager.js.map +1 -0
- package/dist/agents/bug-fixer/ai.d.ts +80 -0
- package/dist/agents/bug-fixer/ai.d.ts.map +1 -0
- package/dist/agents/bug-fixer/ai.js +466 -0
- package/dist/agents/bug-fixer/ai.js.map +1 -0
- package/dist/agents/bug-fixer/bot.d.ts +92 -0
- package/dist/agents/bug-fixer/bot.d.ts.map +1 -0
- package/dist/agents/bug-fixer/bot.js +687 -0
- package/dist/agents/bug-fixer/bot.js.map +1 -0
- package/dist/agents/bug-fixer/config.d.ts +21 -0
- package/dist/agents/bug-fixer/config.d.ts.map +1 -0
- package/dist/agents/bug-fixer/config.js +218 -0
- package/dist/agents/bug-fixer/config.js.map +1 -0
- package/dist/agents/bug-fixer/files.d.ts +67 -0
- package/dist/agents/bug-fixer/files.d.ts.map +1 -0
- package/dist/agents/bug-fixer/files.js +386 -0
- package/dist/agents/bug-fixer/files.js.map +1 -0
- package/dist/agents/bug-fixer/git.d.ts +48 -0
- package/dist/agents/bug-fixer/git.d.ts.map +1 -0
- package/dist/agents/bug-fixer/git.js +298 -0
- package/dist/agents/bug-fixer/git.js.map +1 -0
- package/dist/agents/bug-fixer/index.d.ts +103 -0
- package/dist/agents/bug-fixer/index.d.ts.map +1 -0
- package/dist/agents/bug-fixer/index.js +262 -0
- package/dist/agents/bug-fixer/index.js.map +1 -0
- package/dist/agents/bug-fixer/lsp.d.ts +113 -0
- package/dist/agents/bug-fixer/lsp.d.ts.map +1 -0
- package/dist/agents/bug-fixer/lsp.js +485 -0
- package/dist/agents/bug-fixer/lsp.js.map +1 -0
- package/dist/agents/bug-fixer/monitor.d.ts +123 -0
- package/dist/agents/bug-fixer/monitor.d.ts.map +1 -0
- package/dist/agents/bug-fixer/monitor.js +629 -0
- package/dist/agents/bug-fixer/monitor.js.map +1 -0
- package/dist/agents/bug-fixer/prompt.d.ts +5 -0
- package/dist/agents/bug-fixer/prompt.d.ts.map +1 -0
- package/dist/agents/bug-fixer/prompt.js +94 -0
- package/dist/agents/bug-fixer/prompt.js.map +1 -0
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts +28 -0
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +1 -0
- package/dist/agents/bug-fixer/registries/pending-classification.js +50 -0
- package/dist/agents/bug-fixer/registries/pending-classification.js.map +1 -0
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts +33 -0
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +1 -0
- package/dist/agents/bug-fixer/registries/pending-fix.js +64 -0
- package/dist/agents/bug-fixer/registries/pending-fix.js.map +1 -0
- package/dist/agents/bug-fixer/registries/pending.d.ts +27 -0
- package/dist/agents/bug-fixer/registries/pending.d.ts.map +1 -0
- package/dist/agents/bug-fixer/registries/pending.js +49 -0
- package/dist/agents/bug-fixer/registries/pending.js.map +1 -0
- package/dist/agents/bug-fixer/specialist-daemon.d.ts +88 -0
- package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +1 -0
- package/dist/agents/bug-fixer/specialist-daemon.js +431 -0
- package/dist/agents/bug-fixer/specialist-daemon.js.map +1 -0
- package/dist/agents/bug-fixer/specialist.d.ts +47 -0
- package/dist/agents/bug-fixer/specialist.d.ts.map +1 -0
- package/dist/agents/bug-fixer/specialist.js +327 -0
- package/dist/agents/bug-fixer/specialist.js.map +1 -0
- package/dist/agents/bug-fixer/types.d.ts +123 -0
- package/dist/agents/bug-fixer/types.d.ts.map +1 -0
- package/dist/agents/bug-fixer/types.js +9 -0
- package/dist/agents/bug-fixer/types.js.map +1 -0
- package/dist/agents/factory.d.ts +172 -0
- package/dist/agents/factory.d.ts.map +1 -0
- package/dist/agents/factory.js +706 -0
- package/dist/agents/factory.js.map +1 -0
- package/dist/agents/hailer-expert/index.d.ts +8 -0
- package/dist/agents/hailer-expert/index.d.ts.map +1 -0
- package/dist/agents/hailer-expert/index.js +14 -0
- package/dist/agents/hailer-expert/index.js.map +1 -0
- package/dist/agents/hal/daemon.d.ts +174 -0
- package/dist/agents/hal/daemon.d.ts.map +1 -0
- package/dist/agents/hal/daemon.js +1385 -0
- package/dist/agents/hal/daemon.js.map +1 -0
- package/dist/agents/hal/definitions.d.ts +42 -0
- package/dist/agents/hal/definitions.d.ts.map +1 -0
- package/dist/agents/hal/definitions.js +300 -0
- package/dist/agents/hal/definitions.js.map +1 -0
- package/dist/agents/hal/index.d.ts +3 -0
- package/dist/agents/hal/index.d.ts.map +1 -0
- package/dist/agents/hal/index.js +8 -0
- package/dist/agents/hal/index.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +48 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/shared/base.d.ts +253 -0
- package/dist/agents/shared/base.d.ts.map +1 -0
- package/dist/agents/shared/base.js +1122 -0
- package/dist/agents/shared/base.js.map +1 -0
- package/dist/agents/shared/schemas/action-schema.d.ts +62 -0
- package/dist/agents/shared/schemas/action-schema.d.ts.map +1 -0
- package/dist/agents/shared/schemas/action-schema.js +483 -0
- package/dist/agents/shared/schemas/action-schema.js.map +1 -0
- package/dist/agents/shared/services/agent-registry.d.ts +108 -0
- package/dist/agents/shared/services/agent-registry.d.ts.map +1 -0
- package/dist/agents/shared/services/agent-registry.js +469 -0
- package/dist/agents/shared/services/agent-registry.js.map +1 -0
- package/dist/agents/shared/services/conversation-manager.d.ts +57 -0
- package/dist/agents/shared/services/conversation-manager.d.ts.map +1 -0
- package/dist/agents/shared/services/conversation-manager.js +168 -0
- package/dist/agents/shared/services/conversation-manager.js.map +1 -0
- package/dist/agents/shared/services/mcp-client.d.ts +56 -0
- package/dist/agents/shared/services/mcp-client.d.ts.map +1 -0
- package/dist/agents/shared/services/mcp-client.js +124 -0
- package/dist/agents/shared/services/mcp-client.js.map +1 -0
- package/dist/agents/shared/services/message-classifier.d.ts +37 -0
- package/dist/agents/shared/services/message-classifier.d.ts.map +1 -0
- package/dist/agents/shared/services/message-classifier.js +203 -0
- package/dist/agents/shared/services/message-classifier.js.map +1 -0
- package/dist/agents/shared/services/message-formatter.d.ts +89 -0
- package/dist/agents/shared/services/message-formatter.d.ts.map +1 -0
- package/dist/agents/shared/services/message-formatter.js +390 -0
- package/dist/agents/shared/services/message-formatter.js.map +1 -0
- package/dist/agents/shared/services/session-logger.d.ts +162 -0
- package/dist/agents/shared/services/session-logger.d.ts.map +1 -0
- package/dist/agents/shared/services/session-logger.js +724 -0
- package/dist/agents/shared/services/session-logger.js.map +1 -0
- package/dist/agents/shared/services/structured-output-executor.d.ts +88 -0
- package/dist/agents/shared/services/structured-output-executor.d.ts.map +1 -0
- package/dist/agents/shared/services/structured-output-executor.js +296 -0
- package/dist/agents/shared/services/structured-output-executor.js.map +1 -0
- package/dist/agents/shared/services/token-billing.d.ts +72 -0
- package/dist/agents/shared/services/token-billing.d.ts.map +1 -0
- package/dist/agents/shared/services/token-billing.js +198 -0
- package/dist/agents/shared/services/token-billing.js.map +1 -0
- package/dist/agents/shared/services/tool-executor.d.ts +43 -0
- package/dist/agents/shared/services/tool-executor.d.ts.map +1 -0
- package/dist/agents/shared/services/tool-executor.js +175 -0
- package/dist/agents/shared/services/tool-executor.js.map +1 -0
- package/dist/agents/shared/services/typing-indicator.d.ts +24 -0
- package/dist/agents/shared/services/typing-indicator.d.ts.map +1 -0
- package/dist/agents/shared/services/typing-indicator.js +54 -0
- package/dist/agents/shared/services/typing-indicator.js.map +1 -0
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +122 -0
- package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +1 -0
- package/dist/agents/shared/services/workspace-schema-cache.js +507 -0
- package/dist/agents/shared/services/workspace-schema-cache.js.map +1 -0
- package/dist/agents/shared/specialist.d.ts +91 -0
- package/dist/agents/shared/specialist.d.ts.map +1 -0
- package/dist/agents/shared/specialist.js +399 -0
- package/dist/agents/shared/specialist.js.map +1 -0
- package/dist/agents/shared/tool-schema-loader.d.ts +65 -0
- package/dist/agents/shared/tool-schema-loader.d.ts.map +1 -0
- package/dist/agents/shared/tool-schema-loader.js +238 -0
- package/dist/agents/shared/tool-schema-loader.js.map +1 -0
- package/dist/agents/shared/types.d.ts +190 -0
- package/dist/agents/shared/types.d.ts.map +1 -0
- package/dist/agents/shared/types.js +13 -0
- package/dist/agents/shared/types.js.map +1 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js.map +1 -0
- package/dist/bot/bot-config.d.ts.map +1 -0
- package/dist/bot/bot-config.js.map +1 -0
- package/dist/bot/bot-manager.d.ts.map +1 -0
- package/dist/bot/bot-manager.js.map +1 -0
- package/dist/bot/bot.d.ts.map +1 -0
- package/dist/bot/bot.js.map +1 -0
- package/dist/bot/operation-logger.d.ts.map +1 -0
- package/dist/bot/operation-logger.js.map +1 -0
- package/dist/bot/services/__tests__/permission-guard.test.d.ts +2 -0
- package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +1 -0
- package/dist/bot/services/__tests__/permission-guard.test.js +357 -0
- package/dist/bot/services/__tests__/permission-guard.test.js.map +1 -0
- package/dist/bot/services/conversation-manager.d.ts.map +1 -0
- package/dist/bot/services/conversation-manager.js.map +1 -0
- package/dist/bot/services/index.d.ts.map +1 -0
- package/dist/bot/services/index.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts.map +1 -0
- package/dist/bot/services/message-classifier.js.map +1 -0
- package/dist/bot/services/message-formatter.d.ts.map +1 -0
- package/dist/bot/services/message-formatter.js.map +1 -0
- package/dist/bot/services/permission-guard.d.ts.map +1 -0
- package/dist/bot/services/permission-guard.js.map +1 -0
- package/dist/bot/services/session-logger.d.ts.map +1 -0
- package/dist/bot/services/session-logger.js.map +1 -0
- package/dist/bot/services/token-billing.d.ts.map +1 -0
- package/dist/bot/services/token-billing.js.map +1 -0
- package/dist/bot/services/types.d.ts.map +1 -0
- package/dist/bot/services/types.js.map +1 -0
- package/dist/bot/services/typing-indicator.d.ts.map +1 -0
- package/dist/bot/services/typing-indicator.js.map +1 -0
- package/dist/bot/services/workspace-schema-cache.d.ts.map +1 -0
- package/dist/bot/services/workspace-schema-cache.js.map +1 -0
- package/dist/bot/tool-executor.d.ts.map +1 -0
- package/dist/bot/tool-executor.js.map +1 -0
- package/dist/bot/workspace-overview.d.ts.map +1 -0
- package/dist/bot/workspace-overview.js.map +1 -0
- package/dist/bot-config/constants.d.ts +42 -0
- package/dist/bot-config/constants.d.ts.map +1 -0
- package/dist/bot-config/constants.js +118 -0
- package/dist/bot-config/constants.js.map +1 -0
- package/dist/bot-config/context.d.ts +157 -0
- package/dist/bot-config/context.d.ts.map +1 -0
- package/dist/bot-config/context.js +475 -0
- package/dist/bot-config/context.js.map +1 -0
- package/dist/bot-config/index.d.ts +21 -0
- package/dist/bot-config/index.d.ts.map +1 -0
- package/dist/bot-config/index.js +104 -0
- package/dist/bot-config/index.js.map +1 -0
- package/dist/bot-config/loader.d.ts +28 -0
- package/dist/bot-config/loader.d.ts.map +1 -0
- package/dist/bot-config/loader.js +194 -0
- package/dist/bot-config/loader.js.map +1 -0
- package/dist/bot-config/persistence.d.ts +68 -0
- package/dist/bot-config/persistence.d.ts.map +1 -0
- package/dist/bot-config/persistence.js +261 -0
- package/dist/bot-config/persistence.js.map +1 -0
- package/dist/bot-config/state.d.ts +56 -0
- package/dist/bot-config/state.d.ts.map +1 -0
- package/dist/bot-config/state.js +197 -0
- package/dist/bot-config/state.js.map +1 -0
- package/dist/bot-config/tools.d.ts +28 -0
- package/dist/bot-config/tools.d.ts.map +1 -0
- package/dist/bot-config/tools.js +279 -0
- package/dist/bot-config/tools.js.map +1 -0
- package/dist/bot-config/types.d.ts +45 -0
- package/dist/bot-config/types.d.ts.map +1 -0
- package/dist/bot-config/types.js +9 -0
- package/dist/bot-config/types.js.map +1 -0
- package/dist/bot-config/webhooks.d.ts +27 -0
- package/dist/bot-config/webhooks.d.ts.map +1 -0
- package/dist/bot-config/webhooks.js +212 -0
- package/dist/bot-config/webhooks.js.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/agents/base.d.ts +207 -0
- package/dist/client/agents/base.d.ts.map +1 -0
- package/dist/client/agents/base.js +744 -0
- package/dist/client/agents/base.js.map +1 -0
- package/dist/client/agents/definitions.d.ts +53 -0
- package/dist/client/agents/definitions.d.ts.map +1 -0
- package/dist/client/agents/definitions.js +263 -0
- package/dist/client/agents/definitions.js.map +1 -0
- package/dist/client/agents/orchestrator.d.ts +141 -0
- package/dist/client/agents/orchestrator.d.ts.map +1 -0
- package/dist/client/agents/orchestrator.js +1062 -0
- package/dist/client/agents/orchestrator.js.map +1 -0
- package/dist/client/agents/specialist.d.ts +86 -0
- package/dist/client/agents/specialist.d.ts.map +1 -0
- package/dist/client/agents/specialist.js +340 -0
- package/dist/client/agents/specialist.js.map +1 -0
- package/dist/client/bot-entrypoint.d.ts +7 -0
- package/dist/client/bot-entrypoint.d.ts.map +1 -0
- package/dist/client/bot-entrypoint.js +103 -0
- package/dist/client/bot-entrypoint.js.map +1 -0
- package/dist/client/bot-manager.d.ts +44 -0
- package/dist/client/bot-manager.d.ts.map +1 -0
- package/dist/client/bot-manager.js +173 -0
- package/dist/client/bot-manager.js.map +1 -0
- package/dist/client/bot-runner.d.ts +35 -0
- package/dist/client/bot-runner.d.ts.map +1 -0
- package/dist/client/bot-runner.js +188 -0
- package/dist/client/bot-runner.js.map +1 -0
- package/dist/client/chat-agent-daemon.d.ts +464 -0
- package/dist/client/chat-agent-daemon.d.ts.map +1 -0
- package/dist/client/chat-agent-daemon.js +1774 -0
- package/dist/client/chat-agent-daemon.js.map +1 -0
- package/dist/client/daemon-factory.d.ts +106 -0
- package/dist/client/daemon-factory.d.ts.map +1 -0
- package/dist/client/daemon-factory.js +301 -0
- package/dist/client/daemon-factory.js.map +1 -0
- package/dist/client/factory.d.ts +111 -0
- package/dist/client/factory.d.ts.map +1 -0
- package/dist/client/factory.js +314 -0
- package/dist/client/factory.js.map +1 -0
- package/dist/client/index.d.ts +17 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +38 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/multi-bot-manager.d.ts +42 -0
- package/dist/client/multi-bot-manager.d.ts.map +1 -0
- package/dist/client/multi-bot-manager.js +161 -0
- package/dist/client/multi-bot-manager.js.map +1 -0
- package/dist/client/orchestrator-daemon.d.ts +87 -0
- package/dist/client/orchestrator-daemon.d.ts.map +1 -0
- package/dist/client/orchestrator-daemon.js +444 -0
- package/dist/client/orchestrator-daemon.js.map +1 -0
- package/dist/client/server.d.ts +8 -0
- package/dist/client/server.d.ts.map +1 -0
- package/dist/client/server.js +251 -0
- package/dist/client/server.js.map +1 -0
- package/dist/client/services/agent-registry.d.ts +108 -0
- package/dist/client/services/agent-registry.d.ts.map +1 -0
- package/dist/client/services/agent-registry.js +630 -0
- package/dist/client/services/agent-registry.js.map +1 -0
- package/dist/client/services/conversation-manager.d.ts +50 -0
- package/dist/client/services/conversation-manager.d.ts.map +1 -0
- package/dist/client/services/conversation-manager.js +136 -0
- package/dist/client/services/conversation-manager.js.map +1 -0
- package/dist/client/services/mcp-client.d.ts +48 -0
- package/dist/client/services/mcp-client.d.ts.map +1 -0
- package/dist/client/services/mcp-client.js +105 -0
- package/dist/client/services/mcp-client.js.map +1 -0
- package/dist/client/services/message-classifier.d.ts +37 -0
- package/dist/client/services/message-classifier.d.ts.map +1 -0
- package/dist/client/services/message-classifier.js +187 -0
- package/dist/client/services/message-classifier.js.map +1 -0
- package/dist/client/services/message-formatter.d.ts +84 -0
- package/dist/client/services/message-formatter.d.ts.map +1 -0
- package/dist/client/services/message-formatter.js +353 -0
- package/dist/client/services/message-formatter.js.map +1 -0
- package/dist/client/services/session-logger.d.ts +106 -0
- package/dist/client/services/session-logger.d.ts.map +1 -0
- package/dist/client/services/session-logger.js +446 -0
- package/dist/client/services/session-logger.js.map +1 -0
- package/dist/client/services/tool-executor.d.ts +41 -0
- package/dist/client/services/tool-executor.d.ts.map +1 -0
- package/dist/client/services/tool-executor.js +169 -0
- package/dist/client/services/tool-executor.js.map +1 -0
- package/dist/client/services/workspace-schema-cache.d.ts +149 -0
- package/dist/client/services/workspace-schema-cache.d.ts.map +1 -0
- package/dist/client/services/workspace-schema-cache.js +732 -0
- package/dist/client/services/workspace-schema-cache.js.map +1 -0
- package/dist/client/specialist-daemon.d.ts +77 -0
- package/dist/client/specialist-daemon.d.ts.map +1 -0
- package/dist/client/specialist-daemon.js +197 -0
- package/dist/client/specialist-daemon.js.map +1 -0
- package/dist/client/specialists.d.ts +53 -0
- package/dist/client/specialists.d.ts.map +1 -0
- package/dist/client/specialists.js +178 -0
- package/dist/client/specialists.js.map +1 -0
- package/dist/client/tool-schema-loader.d.ts +62 -0
- package/dist/client/tool-schema-loader.d.ts.map +1 -0
- package/dist/client/tool-schema-loader.js +232 -0
- package/dist/client/tool-schema-loader.js.map +1 -0
- package/dist/client/types.d.ts +327 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +121 -0
- package/dist/client/types.js.map +1 -0
- package/dist/commands/seed-config.d.ts +9 -0
- package/dist/commands/seed-config.d.ts.map +1 -0
- package/dist/commands/seed-config.js +392 -0
- package/dist/commands/seed-config.js.map +1 -0
- package/dist/commands/setup.d.ts +11 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +320 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js.map +1 -0
- package/dist/lib/discussion-lock.d.ts.map +1 -0
- package/dist/lib/discussion-lock.js.map +1 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/request-logger.d.ts.map +1 -0
- package/dist/lib/request-logger.js.map +1 -0
- package/dist/mcp/UserContextCache.d.ts.map +1 -0
- package/dist/mcp/UserContextCache.js.map +1 -0
- package/dist/mcp/auth.d.ts.map +1 -0
- package/dist/mcp/auth.js.map +1 -0
- package/dist/mcp/hailer-clients.d.ts.map +1 -0
- package/dist/mcp/hailer-clients.js.map +1 -0
- package/dist/mcp/session-store.d.ts.map +1 -0
- package/dist/mcp/session-store.js.map +1 -0
- package/dist/mcp/signal-handler.d.ts.map +1 -0
- package/dist/mcp/signal-handler.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +2 -0
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +1 -0
- package/dist/mcp/tools/__tests__/discussion-forward.test.js +218 -0
- package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +1 -0
- package/dist/mcp/tools/activity.d.ts.map +1 -0
- package/dist/mcp/tools/activity.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts.map +1 -0
- package/dist/mcp/tools/app-core.js.map +1 -0
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -0
- package/dist/mcp/tools/app-marketplace.js.map +1 -0
- package/dist/mcp/tools/app-member.d.ts.map +1 -0
- package/dist/mcp/tools/app-member.js.map +1 -0
- package/dist/mcp/tools/app-scaffold.d.ts.map +1 -0
- package/dist/mcp/tools/app-scaffold.js.map +1 -0
- package/dist/mcp/tools/app.d.ts.map +1 -0
- package/dist/mcp/tools/app.js.map +1 -0
- package/dist/mcp/tools/bot-config/constants.d.ts.map +1 -0
- package/dist/mcp/tools/bot-config/constants.js.map +1 -0
- package/dist/mcp/tools/bot-config/core.d.ts.map +1 -0
- package/dist/mcp/tools/bot-config/core.js.map +1 -0
- package/dist/mcp/tools/bot-config/index.d.ts.map +1 -0
- package/dist/mcp/tools/bot-config/index.js.map +1 -0
- package/dist/mcp/tools/bot-config/tools.d.ts.map +1 -0
- package/dist/mcp/tools/bot-config/tools.js.map +1 -0
- package/dist/mcp/tools/bot-config/types.d.ts.map +1 -0
- package/dist/mcp/tools/bot-config/types.js.map +1 -0
- package/dist/mcp/tools/bug-fixer-tools.d.ts.map +1 -0
- package/dist/mcp/tools/bug-fixer-tools.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -0
- package/dist/mcp/tools/company.js.map +1 -0
- package/dist/mcp/tools/discussion.d.ts.map +1 -0
- package/dist/mcp/tools/discussion.js.map +1 -0
- package/dist/mcp/tools/document.d.ts.map +1 -0
- package/dist/mcp/tools/document.js.map +1 -0
- package/dist/mcp/tools/file.d.ts.map +1 -0
- package/dist/mcp/tools/file.js.map +1 -0
- package/dist/mcp/tools/insight.d.ts.map +1 -0
- package/dist/mcp/tools/insight.js.map +1 -0
- package/dist/mcp/tools/investigate.d.ts.map +1 -0
- package/dist/mcp/tools/investigate.js.map +1 -0
- package/dist/mcp/tools/user.d.ts.map +1 -0
- package/dist/mcp/tools/user.js.map +1 -0
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -0
- package/dist/mcp/tools/workflow-permissions.js.map +1 -0
- package/dist/mcp/tools/workflow.d.ts.map +1 -0
- package/dist/mcp/tools/workflow.js.map +1 -0
- package/dist/mcp/utils/api-errors.d.ts.map +1 -0
- package/dist/mcp/utils/api-errors.js.map +1 -0
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -0
- package/dist/mcp/utils/data-transformers.js.map +1 -0
- package/dist/mcp/utils/file-upload.d.ts.map +1 -0
- package/dist/mcp/utils/file-upload.js.map +1 -0
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -0
- package/dist/mcp/utils/hailer-api-client.js.map +1 -0
- package/dist/mcp/utils/index.d.ts.map +1 -0
- package/dist/mcp/utils/index.js.map +1 -0
- package/dist/mcp/utils/logger.d.ts.map +1 -0
- package/dist/mcp/utils/logger.js.map +1 -0
- package/dist/mcp/utils/pagination.d.ts.map +1 -0
- package/dist/mcp/utils/pagination.js.map +1 -0
- package/dist/mcp/utils/response-builder.d.ts.map +1 -0
- package/dist/mcp/utils/response-builder.js.map +1 -0
- package/dist/mcp/utils/role-utils.d.ts.map +1 -0
- package/dist/mcp/utils/role-utils.js.map +1 -0
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -0
- package/dist/mcp/utils/tool-helpers.js.map +1 -0
- package/dist/mcp/utils/types.d.ts.map +1 -0
- package/dist/mcp/utils/types.js.map +1 -0
- package/dist/mcp/webhook-handler.d.ts.map +1 -0
- package/dist/mcp/webhook-handler.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts.map +1 -0
- package/dist/mcp/workspace-cache.js.map +1 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/modules/bug-reports/bug-config.d.ts +25 -0
- package/dist/modules/bug-reports/bug-config.d.ts.map +1 -0
- package/dist/modules/bug-reports/bug-config.js +187 -0
- package/dist/modules/bug-reports/bug-config.js.map +1 -0
- package/dist/modules/bug-reports/bug-monitor.d.ts +108 -0
- package/dist/modules/bug-reports/bug-monitor.d.ts.map +1 -0
- package/dist/modules/bug-reports/bug-monitor.js +510 -0
- package/dist/modules/bug-reports/bug-monitor.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +58 -0
- package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-agent.js +467 -0
- package/dist/modules/bug-reports/giuseppe-agent.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +83 -0
- package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-ai.js +466 -0
- package/dist/modules/bug-reports/giuseppe-ai.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +110 -0
- package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-bot.js +804 -0
- package/dist/modules/bug-reports/giuseppe-bot.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +80 -0
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-daemon.js +617 -0
- package/dist/modules/bug-reports/giuseppe-daemon.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-files.d.ts +64 -0
- package/dist/modules/bug-reports/giuseppe-files.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-files.js +375 -0
- package/dist/modules/bug-reports/giuseppe-files.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-git.d.ts +48 -0
- package/dist/modules/bug-reports/giuseppe-git.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-git.js +298 -0
- package/dist/modules/bug-reports/giuseppe-git.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +113 -0
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-lsp.js +485 -0
- package/dist/modules/bug-reports/giuseppe-lsp.js.map +1 -0
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +5 -0
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +1 -0
- package/dist/modules/bug-reports/giuseppe-prompt.js +94 -0
- package/dist/modules/bug-reports/giuseppe-prompt.js.map +1 -0
- package/dist/modules/bug-reports/index.d.ts +77 -0
- package/dist/modules/bug-reports/index.d.ts.map +1 -0
- package/dist/modules/bug-reports/index.js +215 -0
- package/dist/modules/bug-reports/index.js.map +1 -0
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +28 -0
- package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +1 -0
- package/dist/modules/bug-reports/pending-classification-registry.js +50 -0
- package/dist/modules/bug-reports/pending-classification-registry.js.map +1 -0
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +30 -0
- package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +1 -0
- package/dist/modules/bug-reports/pending-fix-registry.js +42 -0
- package/dist/modules/bug-reports/pending-fix-registry.js.map +1 -0
- package/dist/modules/bug-reports/pending-registry.d.ts +27 -0
- package/dist/modules/bug-reports/pending-registry.d.ts.map +1 -0
- package/dist/modules/bug-reports/pending-registry.js +49 -0
- package/dist/modules/bug-reports/pending-registry.js.map +1 -0
- package/dist/modules/bug-reports/types.d.ts +123 -0
- package/dist/modules/bug-reports/types.d.ts.map +1 -0
- package/dist/modules/bug-reports/types.js +9 -0
- package/dist/modules/bug-reports/types.js.map +1 -0
- package/dist/plugins/bug-fixer/index.d.ts.map +1 -0
- package/dist/plugins/bug-fixer/index.js.map +1 -0
- package/dist/plugins/bug-fixer/tools.d.ts.map +1 -0
- package/dist/plugins/bug-fixer/tools.js.map +1 -0
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts +10 -0
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +1 -0
- package/dist/plugins/vipunen/__tests__/tools.test.js +646 -0
- package/dist/plugins/vipunen/__tests__/tools.test.js.map +1 -0
- package/dist/plugins/vipunen/client.d.ts.map +1 -0
- package/dist/plugins/vipunen/client.js.map +1 -0
- package/dist/plugins/vipunen/index.d.ts.map +1 -0
- package/dist/plugins/vipunen/index.js.map +1 -0
- package/dist/plugins/vipunen/tools.d.ts.map +1 -0
- package/dist/plugins/vipunen/tools.js.map +1 -0
- package/dist/routes/agents.d.ts +44 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +311 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/services/agent-credential-store.d.ts +73 -0
- package/dist/services/agent-credential-store.d.ts.map +1 -0
- package/dist/services/agent-credential-store.js +212 -0
- package/dist/services/agent-credential-store.js.map +1 -0
- package/dist/stdio-server.d.ts.map +1 -0
- package/dist/stdio-server.js.map +1 -0
- package/dist/workspace/context.d.ts +148 -0
- package/dist/workspace/context.d.ts.map +1 -0
- package/dist/workspace/context.js +339 -0
- package/dist/workspace/context.js.map +1 -0
- package/dist/workspace/credentials.d.ts +55 -0
- package/dist/workspace/credentials.d.ts.map +1 -0
- package/dist/workspace/credentials.js +239 -0
- package/dist/workspace/credentials.js.map +1 -0
- package/dist/workspace/index.d.ts +21 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +45 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/loader.d.ts +27 -0
- package/dist/workspace/loader.d.ts.map +1 -0
- package/dist/workspace/loader.js +222 -0
- package/dist/workspace/loader.js.map +1 -0
- package/dist/workspace/schema.d.ts +37 -0
- package/dist/workspace/schema.d.ts.map +1 -0
- package/dist/workspace/schema.js +192 -0
- package/dist/workspace/schema.js.map +1 -0
- package/package.json +13 -1
- package/test-billing-server.js +0 -136
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Daemon Factory
|
|
4
|
+
*
|
|
5
|
+
* Creates and manages agent daemons in orchestrator mode:
|
|
6
|
+
* - One orchestrator (HAL) handles general conversation
|
|
7
|
+
* - Specialist daemons handle complex domain-specific tasks
|
|
8
|
+
*
|
|
9
|
+
* Uses BotContext for credential management (workspace isolation).
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DaemonManager = void 0;
|
|
13
|
+
exports.createDaemonManager = createDaemonManager;
|
|
14
|
+
exports.startDaemonMode = startDaemonMode;
|
|
15
|
+
exports.createStandaloneBugFixer = createStandaloneBugFixer;
|
|
16
|
+
const daemon_1 = require("./hal/daemon");
|
|
17
|
+
const specialist_1 = require("./shared/specialist");
|
|
18
|
+
const specialist_daemon_1 = require("./bug-fixer/specialist-daemon");
|
|
19
|
+
const definitions_1 = require("./hal/definitions");
|
|
20
|
+
const bot_manager_1 = require("./bot-manager");
|
|
21
|
+
const config_1 = require("../config");
|
|
22
|
+
const logger_1 = require("../lib/logger");
|
|
23
|
+
const bot_config_1 = require("../bot-config");
|
|
24
|
+
const hailer_clients_1 = require("../mcp/hailer-clients");
|
|
25
|
+
const UserContextCache_1 = require("../mcp/UserContextCache");
|
|
26
|
+
const bot_config_2 = require("../bot-config");
|
|
27
|
+
const tool_registry_1 = require("../mcp/tool-registry");
|
|
28
|
+
const logger = (0, logger_1.createLogger)({ component: "DaemonFactory" });
|
|
29
|
+
/**
|
|
30
|
+
* Map botType from Agent Directory to specialist key
|
|
31
|
+
* botType values come from the Agent Directory workflow
|
|
32
|
+
*/
|
|
33
|
+
function mapBotTypeToSpecialistKey(botType) {
|
|
34
|
+
if (!botType)
|
|
35
|
+
return null;
|
|
36
|
+
const mapping = {
|
|
37
|
+
'workflow-expert': 'hailerExpert',
|
|
38
|
+
'bug-fixer': 'bugFixer',
|
|
39
|
+
// Add more mappings as new specialists are added
|
|
40
|
+
};
|
|
41
|
+
return mapping[botType] || null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Manages orchestrator + specialist daemons
|
|
45
|
+
*/
|
|
46
|
+
class DaemonManager {
|
|
47
|
+
daemons = new Map();
|
|
48
|
+
orchestrator = null;
|
|
49
|
+
specialists = new Map();
|
|
50
|
+
botManager;
|
|
51
|
+
options;
|
|
52
|
+
botTypeMap;
|
|
53
|
+
displayNameMap;
|
|
54
|
+
constructor(botManager, options) {
|
|
55
|
+
this.botManager = botManager;
|
|
56
|
+
this.options = options;
|
|
57
|
+
this.botTypeMap = options.botTypeMap || new Map();
|
|
58
|
+
this.displayNameMap = options.displayNameMap || new Map();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get the workspace ID this daemon manager is running for
|
|
62
|
+
*/
|
|
63
|
+
getWorkspaceId() {
|
|
64
|
+
return this.options.workspaceId;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Orchestrator mode: one orchestrator (HAL) + specialist daemons
|
|
68
|
+
*/
|
|
69
|
+
async startOrchestratorMode() {
|
|
70
|
+
const botClients = this.botManager.getAllBotClients();
|
|
71
|
+
logger.info("Starting daemons in ORCHESTRATOR mode", {
|
|
72
|
+
botCount: botClients.length,
|
|
73
|
+
});
|
|
74
|
+
// Find orchestrator bot
|
|
75
|
+
let orchestratorClient;
|
|
76
|
+
const specialistClients = new Map();
|
|
77
|
+
for (const botClient of botClients) {
|
|
78
|
+
const email = botClient.config.email;
|
|
79
|
+
const botType = this.botTypeMap.get(botClient.userId) || null;
|
|
80
|
+
// Check if this is the orchestrator (by email match, botType, or first bot fallback)
|
|
81
|
+
if (this.options.orchestratorEmail === email ||
|
|
82
|
+
botType === 'orchestrator' ||
|
|
83
|
+
(!this.options.orchestratorEmail && !orchestratorClient)) {
|
|
84
|
+
orchestratorClient = botClient;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// Check if this matches a specialist
|
|
88
|
+
if (this.options.specialistEmails) {
|
|
89
|
+
for (const [specialistKey, specialistEmail] of Object.entries(this.options.specialistEmails)) {
|
|
90
|
+
if (email === specialistEmail) {
|
|
91
|
+
specialistClients.set(specialistKey, botClient);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Auto-assign based on botType from workspace config
|
|
98
|
+
const specialistKey = mapBotTypeToSpecialistKey(botType);
|
|
99
|
+
if (specialistKey && definitions_1.SPECIALISTS[specialistKey]) {
|
|
100
|
+
specialistClients.set(specialistKey, botClient);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Fallback: assign to first available specialist
|
|
104
|
+
for (const key of Object.keys(definitions_1.SPECIALISTS)) {
|
|
105
|
+
if (!specialistClients.has(key)) {
|
|
106
|
+
specialistClients.set(key, botClient);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!orchestratorClient) {
|
|
114
|
+
throw new Error("No orchestrator bot found");
|
|
115
|
+
}
|
|
116
|
+
// Create specialist user ID map for orchestrator
|
|
117
|
+
const specialistUserIds = new Map();
|
|
118
|
+
for (const [key, client] of specialistClients) {
|
|
119
|
+
specialistUserIds.set(key, client.userId);
|
|
120
|
+
}
|
|
121
|
+
// Start orchestrator
|
|
122
|
+
const orchestratorConfig = {
|
|
123
|
+
botClient: orchestratorClient,
|
|
124
|
+
mcpServerUrl: this.options.mcpServerUrl,
|
|
125
|
+
anthropicApiKey: this.options.anthropicApiKey,
|
|
126
|
+
model: this.options.model,
|
|
127
|
+
specialistUserIds,
|
|
128
|
+
useStructuredOutputs: this.options.useStructuredOutputs,
|
|
129
|
+
};
|
|
130
|
+
this.orchestrator = new daemon_1.OrchestratorDaemon(orchestratorConfig);
|
|
131
|
+
await this.orchestrator.initialize();
|
|
132
|
+
// Register specialist user IDs with orchestrator (with display names from workspace)
|
|
133
|
+
for (const [key, userId] of specialistUserIds) {
|
|
134
|
+
const displayName = this.displayNameMap.get(userId) || this.botManager.getUserName(userId);
|
|
135
|
+
this.orchestrator.registerSpecialistUserId(key, userId, displayName);
|
|
136
|
+
}
|
|
137
|
+
this.daemons.set(orchestratorClient.userId, this.orchestrator);
|
|
138
|
+
// Subscribe to bot state changes to update specialist availability
|
|
139
|
+
(0, bot_config_1.onBotStateChange)((userId, enabled) => {
|
|
140
|
+
const botType = this.botTypeMap.get(userId) || null;
|
|
141
|
+
// Skip orchestrator changes (handled by daemon restart)
|
|
142
|
+
if (botType === 'orchestrator')
|
|
143
|
+
return;
|
|
144
|
+
// Find the specialist key for this user
|
|
145
|
+
const specialistKey = mapBotTypeToSpecialistKey(botType);
|
|
146
|
+
if (!specialistKey) {
|
|
147
|
+
logger.debug('No specialist mapping for botType', { userId, botType });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (enabled) {
|
|
151
|
+
// Re-register the specialist (with display name from workspace)
|
|
152
|
+
const displayName = this.displayNameMap.get(userId) || this.botManager.getUserName(userId);
|
|
153
|
+
this.orchestrator?.registerSpecialistUserId(specialistKey, userId, displayName);
|
|
154
|
+
logger.info('Specialist re-enabled', { specialistKey, userId, displayName });
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// Unregister the specialist
|
|
158
|
+
this.orchestrator?.unregisterSpecialist(specialistKey);
|
|
159
|
+
logger.info('Specialist disabled', { specialistKey, userId });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
// Start specialist daemons
|
|
163
|
+
for (const [specialistKey, botClient] of specialistClients) {
|
|
164
|
+
const specialistDef = definitions_1.SPECIALISTS[specialistKey];
|
|
165
|
+
if (!specialistDef) {
|
|
166
|
+
logger.warn("Unknown specialist key", { key: specialistKey });
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
// Clone the specialist to avoid cross-workspace contamination
|
|
170
|
+
const specialist = { ...specialistDef, botUserId: botClient.userId };
|
|
171
|
+
let specialistDaemon;
|
|
172
|
+
// Create BugFixerSpecialistDaemon for bugFixer (has actual bug fixing code)
|
|
173
|
+
if (specialistKey === 'bugFixer') {
|
|
174
|
+
const userContext = await UserContextCache_1.UserContextCache.getContext(botClient.config.mcpServerApiKey);
|
|
175
|
+
const bugFixerConfig = {
|
|
176
|
+
botClient,
|
|
177
|
+
mcpServerUrl: this.options.mcpServerUrl,
|
|
178
|
+
anthropicApiKey: this.options.anthropicApiKey,
|
|
179
|
+
model: specialist.model || this.options.model,
|
|
180
|
+
specialist,
|
|
181
|
+
userContext,
|
|
182
|
+
};
|
|
183
|
+
specialistDaemon = new specialist_daemon_1.BugFixerSpecialistDaemon(bugFixerConfig);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const specialistConfig = {
|
|
187
|
+
botClient,
|
|
188
|
+
mcpServerUrl: this.options.mcpServerUrl,
|
|
189
|
+
anthropicApiKey: this.options.anthropicApiKey,
|
|
190
|
+
model: specialist.model || this.options.model,
|
|
191
|
+
specialist,
|
|
192
|
+
};
|
|
193
|
+
specialistDaemon = new specialist_1.SpecialistDaemon(specialistConfig);
|
|
194
|
+
}
|
|
195
|
+
await specialistDaemon.initialize();
|
|
196
|
+
this.specialists.set(specialistKey, specialistDaemon);
|
|
197
|
+
this.daemons.set(botClient.userId, specialistDaemon);
|
|
198
|
+
logger.info("Specialist daemon started", {
|
|
199
|
+
key: specialistKey,
|
|
200
|
+
name: specialist.name,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
logger.info("Orchestrator started", {
|
|
204
|
+
specialistCount: this.specialists.size,
|
|
205
|
+
totalDaemons: this.daemons.size,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Stop all daemons
|
|
210
|
+
* Flushes session logs for each daemon before stopping
|
|
211
|
+
*/
|
|
212
|
+
async stopAll() {
|
|
213
|
+
const stopPromises = Array.from(this.daemons.entries()).map(async ([botId, daemon]) => {
|
|
214
|
+
await daemon.stop();
|
|
215
|
+
logger.info("Daemon stopped", { botId });
|
|
216
|
+
});
|
|
217
|
+
await Promise.all(stopPromises);
|
|
218
|
+
this.daemons.clear();
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get daemon for a specific bot
|
|
222
|
+
*/
|
|
223
|
+
getDaemon(botId) {
|
|
224
|
+
return this.daemons.get(botId);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get status of all daemons
|
|
228
|
+
*/
|
|
229
|
+
getStatus() {
|
|
230
|
+
return Array.from(this.daemons.entries()).map(([botId, daemon]) => ({
|
|
231
|
+
botId,
|
|
232
|
+
state: daemon.getConversationState(),
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Log current status to console (for monitoring)
|
|
237
|
+
*/
|
|
238
|
+
logStatus() {
|
|
239
|
+
const orchStatus = this.orchestrator?.getOrchestratorStatus();
|
|
240
|
+
logger.info("Daemon status", {
|
|
241
|
+
orchestrator: orchStatus ? {
|
|
242
|
+
discussions: orchStatus.conversationState.discussionCount,
|
|
243
|
+
processing: orchStatus.conversationState.isProcessing,
|
|
244
|
+
specialists: orchStatus.specialists.filter(s => s.available).length,
|
|
245
|
+
} : null,
|
|
246
|
+
specialistCount: this.specialists.size,
|
|
247
|
+
totalDaemons: this.daemons.size,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Get orchestrator instance (only in orchestrator mode)
|
|
252
|
+
*/
|
|
253
|
+
getOrchestrator() {
|
|
254
|
+
return this.orchestrator;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get the workspace schema cache from the orchestrator
|
|
258
|
+
* Used by other modules that need dynamic workflow/field ID lookup
|
|
259
|
+
*/
|
|
260
|
+
getSchemaCache() {
|
|
261
|
+
return this.orchestrator?.getSchemaCache() ?? null;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get specialist by key (only in orchestrator mode)
|
|
265
|
+
*/
|
|
266
|
+
getSpecialist(key) {
|
|
267
|
+
return this.specialists.get(key);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Register a standalone daemon (for standalone Bug Fixer mode)
|
|
271
|
+
*/
|
|
272
|
+
registerStandaloneDaemon(userId, daemon) {
|
|
273
|
+
this.daemons.set(userId, daemon);
|
|
274
|
+
logger.info("Registered standalone daemon", { userId });
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Check if running in orchestrator mode
|
|
278
|
+
*/
|
|
279
|
+
isOrchestratorMode() {
|
|
280
|
+
return !!this.options.orchestratorMode;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Trigger HAL to respond in a discussion with context
|
|
284
|
+
*/
|
|
285
|
+
async triggerHalResponse(discussionId, activityId, context) {
|
|
286
|
+
if (!this.orchestrator) {
|
|
287
|
+
logger.warn('Cannot trigger HAL response - orchestrator not running');
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
await this.orchestrator.respondWithContext(discussionId, activityId, context);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Hot-reload: Start a specialist daemon dynamically
|
|
294
|
+
* Preserves orchestrator conversation context
|
|
295
|
+
*/
|
|
296
|
+
async startSpecialist(email, password, botType, userId) {
|
|
297
|
+
const specialistKey = mapBotTypeToSpecialistKey(botType);
|
|
298
|
+
if (!specialistKey) {
|
|
299
|
+
logger.warn('Unknown botType for specialist', { botType });
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
// Check if already running
|
|
303
|
+
if (this.specialists.has(specialistKey)) {
|
|
304
|
+
logger.info('Specialist already running', { specialistKey });
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
const specialistDef = definitions_1.SPECIALISTS[specialistKey];
|
|
308
|
+
if (!specialistDef) {
|
|
309
|
+
logger.warn('Specialist definition not found', { specialistKey });
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
try {
|
|
313
|
+
// Initialize bot client
|
|
314
|
+
const actualUserId = userId || email;
|
|
315
|
+
// Bug Fixer specialists need BOT_INTERNAL tool access
|
|
316
|
+
const isBugFixer = botType === 'bugFixer' || botType === 'bug-fixer' || specialistKey === 'bugFixer';
|
|
317
|
+
const allowedGroups = isBugFixer
|
|
318
|
+
? [tool_registry_1.ToolGroup.READ, tool_registry_1.ToolGroup.WRITE, tool_registry_1.ToolGroup.BOT_INTERNAL]
|
|
319
|
+
: undefined;
|
|
320
|
+
const apiKey = (0, hailer_clients_1.registerBotCredentials)(actualUserId, email, password, { allowedGroups });
|
|
321
|
+
await this.botManager.initializeBotClient(email, password, apiKey);
|
|
322
|
+
const botClient = this.botManager.getBotClientByBotId(specialistKey) ||
|
|
323
|
+
Array.from(this.botManager.getAllBotClients())
|
|
324
|
+
.find(bc => bc.config.email === email);
|
|
325
|
+
if (!botClient) {
|
|
326
|
+
logger.error('Failed to get bot client after initialization', { email: (0, config_1.maskEmail)(email) });
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
// Update botType map
|
|
330
|
+
this.botTypeMap.set(botClient.userId, botType);
|
|
331
|
+
// Clone the specialist to avoid cross-workspace contamination
|
|
332
|
+
const specialist = { ...specialistDef, botUserId: botClient.userId };
|
|
333
|
+
// Create and start specialist daemon
|
|
334
|
+
let specialistDaemon;
|
|
335
|
+
// Create BugFixerSpecialistDaemon for bugFixer (has actual bug fixing code)
|
|
336
|
+
if (specialistKey === 'bugFixer') {
|
|
337
|
+
const userContext = await UserContextCache_1.UserContextCache.getContext(apiKey);
|
|
338
|
+
const bugFixerConfig = {
|
|
339
|
+
botClient,
|
|
340
|
+
mcpServerUrl: this.options.mcpServerUrl,
|
|
341
|
+
anthropicApiKey: this.options.anthropicApiKey,
|
|
342
|
+
model: specialist.model || this.options.model,
|
|
343
|
+
specialist,
|
|
344
|
+
userContext,
|
|
345
|
+
};
|
|
346
|
+
specialistDaemon = new specialist_daemon_1.BugFixerSpecialistDaemon(bugFixerConfig);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
const specialistConfig = {
|
|
350
|
+
botClient,
|
|
351
|
+
mcpServerUrl: this.options.mcpServerUrl,
|
|
352
|
+
anthropicApiKey: this.options.anthropicApiKey,
|
|
353
|
+
model: specialist.model || this.options.model,
|
|
354
|
+
specialist,
|
|
355
|
+
};
|
|
356
|
+
specialistDaemon = new specialist_1.SpecialistDaemon(specialistConfig);
|
|
357
|
+
}
|
|
358
|
+
await specialistDaemon.initialize();
|
|
359
|
+
this.specialists.set(specialistKey, specialistDaemon);
|
|
360
|
+
this.daemons.set(botClient.userId, specialistDaemon);
|
|
361
|
+
// Register with orchestrator (with display name from workspace)
|
|
362
|
+
const displayName = this.displayNameMap.get(botClient.userId) || this.botManager.getUserName(botClient.userId);
|
|
363
|
+
this.orchestrator?.registerSpecialistUserId(specialistKey, botClient.userId, displayName);
|
|
364
|
+
// Register bot as enabled in state so message processing works
|
|
365
|
+
const workspaceId = this.getWorkspaceId();
|
|
366
|
+
if (workspaceId) {
|
|
367
|
+
(0, bot_config_1.setBotEnabled)(workspaceId, botClient.userId, true);
|
|
368
|
+
(0, bot_config_1.setBotUserId)(workspaceId, botClient.userId, botType);
|
|
369
|
+
}
|
|
370
|
+
logger.info('Specialist hot-loaded successfully', {
|
|
371
|
+
specialistKey,
|
|
372
|
+
name: specialist.name,
|
|
373
|
+
botId: botClient.userId,
|
|
374
|
+
email,
|
|
375
|
+
});
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
logger.error('Failed to hot-load specialist', {
|
|
380
|
+
specialistKey,
|
|
381
|
+
email,
|
|
382
|
+
error: error instanceof Error ? error.message : String(error),
|
|
383
|
+
});
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Hot-reload: Stop a specialist daemon dynamically
|
|
389
|
+
* Preserves orchestrator conversation context
|
|
390
|
+
*/
|
|
391
|
+
async stopSpecialist(botType) {
|
|
392
|
+
const specialistKey = mapBotTypeToSpecialistKey(botType);
|
|
393
|
+
if (!specialistKey) {
|
|
394
|
+
logger.warn('Unknown botType for specialist', { botType });
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
const specialistDaemon = this.specialists.get(specialistKey);
|
|
398
|
+
if (!specialistDaemon) {
|
|
399
|
+
logger.info('Specialist not running', { specialistKey });
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
// Find botId by looking through daemons map
|
|
404
|
+
let botId;
|
|
405
|
+
for (const [id, daemon] of this.daemons) {
|
|
406
|
+
if (daemon === specialistDaemon) {
|
|
407
|
+
botId = id;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// Unregister from orchestrator first
|
|
412
|
+
this.orchestrator?.unregisterSpecialist(specialistKey);
|
|
413
|
+
// Stop the daemon
|
|
414
|
+
await specialistDaemon.stop();
|
|
415
|
+
// Remove from maps
|
|
416
|
+
this.specialists.delete(specialistKey);
|
|
417
|
+
if (botId) {
|
|
418
|
+
this.daemons.delete(botId);
|
|
419
|
+
this.botTypeMap.delete(botId);
|
|
420
|
+
// Remove bot client connection
|
|
421
|
+
await this.botManager.removeBotClient(botId);
|
|
422
|
+
}
|
|
423
|
+
logger.info('Specialist stopped successfully', {
|
|
424
|
+
specialistKey,
|
|
425
|
+
botId,
|
|
426
|
+
});
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
logger.error('Failed to stop specialist', {
|
|
431
|
+
specialistKey,
|
|
432
|
+
error: error instanceof Error ? error.message : String(error),
|
|
433
|
+
});
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Hot-reload a specialist (stop if running, start if enabled)
|
|
439
|
+
*/
|
|
440
|
+
async hotReloadSpecialist(email, password, botType, enabled, userId) {
|
|
441
|
+
if (enabled) {
|
|
442
|
+
return this.startSpecialist(email, password, botType, userId);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
return this.stopSpecialist(botType);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Start periodic status logging
|
|
450
|
+
*/
|
|
451
|
+
startStatusLogging(intervalMs = 30000) {
|
|
452
|
+
return setInterval(() => {
|
|
453
|
+
this.logStatus();
|
|
454
|
+
}, intervalMs);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
exports.DaemonManager = DaemonManager;
|
|
458
|
+
/**
|
|
459
|
+
* Create and start the daemon manager
|
|
460
|
+
* This is the main entry point for daemon mode
|
|
461
|
+
*
|
|
462
|
+
* Uses WorkspaceContext for credential management (workspace isolation).
|
|
463
|
+
*
|
|
464
|
+
* @param options - Optional settings for orchestrator mode
|
|
465
|
+
*/
|
|
466
|
+
async function createDaemonManager(options) {
|
|
467
|
+
const appConfig = (0, config_1.createApplicationConfig)();
|
|
468
|
+
const mcpClientConfig = appConfig.mcpClient;
|
|
469
|
+
if (!mcpClientConfig) {
|
|
470
|
+
logger.error("MCP Client not configured - cannot start daemon mode");
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
// Find Anthropic API key from providers
|
|
474
|
+
const anthropicProvider = mcpClientConfig.providers.find(p => p.type === "anthropic");
|
|
475
|
+
if (!anthropicProvider) {
|
|
476
|
+
logger.error("Anthropic provider not configured - daemon mode requires Anthropic");
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
// Create bot manager
|
|
480
|
+
const botManager = new bot_manager_1.MultiBotManager([]);
|
|
481
|
+
// Load workspaces from .bot-config/*.json via BotContext
|
|
482
|
+
const botContexts = (0, bot_config_2.loadBotConfigs)();
|
|
483
|
+
if (botContexts.length === 0) {
|
|
484
|
+
logger.warn('No workspace configs found in .bot-config/ - run npm run seed-config first');
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
// Find workspace with orchestrator
|
|
488
|
+
const botCtx = options?.workspaceId
|
|
489
|
+
? botContexts.find(ctx => ctx.workspaceId === options.workspaceId && ctx.getOrchestratorCredentials())
|
|
490
|
+
: botContexts.find(ctx => ctx.getOrchestratorCredentials());
|
|
491
|
+
if (!botCtx) {
|
|
492
|
+
logger.error('No workspace with orchestrator found');
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
logger.info('Using workspace', {
|
|
496
|
+
workspaceId: botCtx.workspaceId,
|
|
497
|
+
workspaceName: botCtx.workspaceName
|
|
498
|
+
});
|
|
499
|
+
// Build botTypeMap and displayNameMap for runtime lookups
|
|
500
|
+
const botTypeMap = new Map();
|
|
501
|
+
const displayNameMap = new Map();
|
|
502
|
+
// Get orchestrator from BotContext
|
|
503
|
+
const orchCreds = botCtx.getOrchestratorCredentials();
|
|
504
|
+
if (!orchCreds) {
|
|
505
|
+
logger.error('Orchestrator credentials not found');
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
let orchestratorEmail;
|
|
509
|
+
try {
|
|
510
|
+
logger.info('Loading orchestrator', {
|
|
511
|
+
email: (0, config_1.maskEmail)(orchCreds.email),
|
|
512
|
+
displayName: orchCreds.displayName
|
|
513
|
+
});
|
|
514
|
+
const orchestratorUserId = orchCreds.userId;
|
|
515
|
+
orchestratorEmail = orchCreds.email;
|
|
516
|
+
const apiKey = (0, hailer_clients_1.registerBotCredentials)(orchestratorUserId, orchCreds.email, orchCreds.password);
|
|
517
|
+
await botManager.initializeBotClient(orchCreds.email, orchCreds.password, apiKey);
|
|
518
|
+
// Register orchestrator botType and displayName
|
|
519
|
+
botTypeMap.set(orchestratorUserId, 'orchestrator');
|
|
520
|
+
if (orchCreds.displayName) {
|
|
521
|
+
displayNameMap.set(orchestratorUserId, orchCreds.displayName);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
logger.error('Failed to initialize orchestrator', { error });
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
// Initialize specialists (disabled by default - HAL handles everything)
|
|
529
|
+
// Set SPECIALISTS_ENABLED=true to enable specialist bots from AI Hub
|
|
530
|
+
const specialistsEnabled = process.env.SPECIALISTS_ENABLED === 'true';
|
|
531
|
+
if (specialistsEnabled) {
|
|
532
|
+
const specialists = botCtx.getSpecialistCredentials();
|
|
533
|
+
// If Bug Fixer env vars are set, use them instead of AI Hub
|
|
534
|
+
const bugFixerFromEnv = process.env.BUG_MONITOR_ENABLED === 'true' && process.env.BUG_FIXER_EMAIL;
|
|
535
|
+
if (bugFixerFromEnv) {
|
|
536
|
+
// Remove any AI Hub Bug Fixer config (env vars take priority)
|
|
537
|
+
const existingIdx = specialists.findIndex(s => s.botType === 'bugFixer');
|
|
538
|
+
if (existingIdx >= 0) {
|
|
539
|
+
specialists.splice(existingIdx, 1);
|
|
540
|
+
}
|
|
541
|
+
// Add Bug Fixer from env vars
|
|
542
|
+
specialists.push({
|
|
543
|
+
userId: '', // Set after login
|
|
544
|
+
email: process.env.BUG_FIXER_EMAIL,
|
|
545
|
+
password: process.env.BUG_FIXER_PASSWORD || '',
|
|
546
|
+
botType: 'bugFixer',
|
|
547
|
+
enabled: true,
|
|
548
|
+
displayName: 'Bug Fixer',
|
|
549
|
+
workspaceId: botCtx.workspaceId,
|
|
550
|
+
});
|
|
551
|
+
logger.info('Bug Fixer configured from env vars (AI Hub bypassed)');
|
|
552
|
+
}
|
|
553
|
+
for (const spec of specialists) {
|
|
554
|
+
try {
|
|
555
|
+
logger.info('Loading specialist', {
|
|
556
|
+
email: (0, config_1.maskEmail)(spec.email),
|
|
557
|
+
botType: spec.botType,
|
|
558
|
+
displayName: spec.displayName
|
|
559
|
+
});
|
|
560
|
+
const specialistUserId = spec.userId;
|
|
561
|
+
// Bug Fixer specialists need BOT_INTERNAL tool access
|
|
562
|
+
const isBugFixer = spec.botType === 'bugFixer' || spec.botType === 'bug-fixer';
|
|
563
|
+
const allowedGroups = isBugFixer
|
|
564
|
+
? [tool_registry_1.ToolGroup.READ, tool_registry_1.ToolGroup.WRITE, tool_registry_1.ToolGroup.BOT_INTERNAL]
|
|
565
|
+
: undefined;
|
|
566
|
+
const apiKey = (0, hailer_clients_1.registerBotCredentials)(specialistUserId, spec.email, spec.password, { allowedGroups });
|
|
567
|
+
await botManager.initializeBotClient(spec.email, spec.password, apiKey);
|
|
568
|
+
// Register specialist botType and displayName
|
|
569
|
+
if (spec.botType) {
|
|
570
|
+
botTypeMap.set(specialistUserId, spec.botType);
|
|
571
|
+
}
|
|
572
|
+
if (spec.displayName) {
|
|
573
|
+
displayNameMap.set(specialistUserId, spec.displayName);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
catch (error) {
|
|
577
|
+
logger.warn('Failed to initialize specialist', {
|
|
578
|
+
email: spec.email,
|
|
579
|
+
error: error instanceof Error ? error.message : String(error)
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
logger.info('Specialists disabled (SPECIALISTS_ENABLED=false) - HAL running solo');
|
|
586
|
+
}
|
|
587
|
+
// Check environment for orchestrator mode (defaults to TRUE)
|
|
588
|
+
const orchestratorMode = options?.orchestratorMode ??
|
|
589
|
+
process.env.DAEMON_ORCHESTRATOR_MODE !== "false";
|
|
590
|
+
// Check environment for structured outputs mode (defaults to FALSE for safety)
|
|
591
|
+
// Set USE_STRUCTURED_OUTPUTS=true to save ~100K tokens per request
|
|
592
|
+
const useStructuredOutputs = options?.useStructuredOutputs ??
|
|
593
|
+
process.env.USE_STRUCTURED_OUTPUTS === "true";
|
|
594
|
+
// Create daemon manager
|
|
595
|
+
const daemonManager = new DaemonManager(botManager, {
|
|
596
|
+
mcpServerUrl: mcpClientConfig.mcpServerUrl,
|
|
597
|
+
anthropicApiKey: anthropicProvider.apiKey,
|
|
598
|
+
model: anthropicProvider.model,
|
|
599
|
+
orchestratorMode,
|
|
600
|
+
orchestratorEmail: orchestratorEmail || options?.orchestratorEmail,
|
|
601
|
+
specialistEmails: options?.specialistEmails,
|
|
602
|
+
botTypeMap,
|
|
603
|
+
displayNameMap,
|
|
604
|
+
workspaceId: botCtx.workspaceId,
|
|
605
|
+
useStructuredOutputs,
|
|
606
|
+
});
|
|
607
|
+
// Start all daemons
|
|
608
|
+
await daemonManager.startOrchestratorMode();
|
|
609
|
+
return daemonManager;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Quick start function for testing
|
|
613
|
+
*
|
|
614
|
+
* @param orchestratorMode - Enable orchestrator mode (default: true)
|
|
615
|
+
*/
|
|
616
|
+
async function startDaemonMode(orchestratorMode = true) {
|
|
617
|
+
logger.info("Starting Chat Agent Daemon Mode (ORCHESTRATOR)...");
|
|
618
|
+
const manager = await createDaemonManager({ orchestratorMode });
|
|
619
|
+
if (!manager) {
|
|
620
|
+
logger.error("Failed to create daemon manager");
|
|
621
|
+
process.exit(1);
|
|
622
|
+
}
|
|
623
|
+
// Handle shutdown - await async stopAll() to flush session logs
|
|
624
|
+
process.on("SIGINT", () => {
|
|
625
|
+
logger.info("Shutting down daemons...");
|
|
626
|
+
manager.stopAll().then(() => process.exit(0));
|
|
627
|
+
});
|
|
628
|
+
process.on("SIGTERM", () => {
|
|
629
|
+
logger.info("Shutting down daemons...");
|
|
630
|
+
manager.stopAll().then(() => process.exit(0));
|
|
631
|
+
});
|
|
632
|
+
logger.info("Chat Agent Daemon Mode (ORCHESTRATOR) running. Press Ctrl+C to stop.");
|
|
633
|
+
// Start periodic status logging
|
|
634
|
+
manager.startStatusLogging(60000);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Create standalone Bug Fixer daemon (no orchestrator/AI Hub needed)
|
|
638
|
+
* For testing Bug Fixer independently
|
|
639
|
+
*/
|
|
640
|
+
async function createStandaloneBugFixer(email, password) {
|
|
641
|
+
const appConfig = (0, config_1.createApplicationConfig)();
|
|
642
|
+
const mcpClientConfig = appConfig.mcpClient;
|
|
643
|
+
if (!mcpClientConfig) {
|
|
644
|
+
logger.error("MCP Client not configured - cannot start standalone Bug Fixer");
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
const anthropicProvider = mcpClientConfig.providers.find(p => p.type === 'anthropic');
|
|
648
|
+
if (!anthropicProvider?.apiKey) {
|
|
649
|
+
logger.error("Anthropic API key not configured");
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
logger.info("Creating standalone Bug Fixer", { email: (0, config_1.maskEmail)(email) });
|
|
653
|
+
// Create bot manager with empty config (we'll add the bot dynamically)
|
|
654
|
+
const botManager = new bot_manager_1.MultiBotManager([]);
|
|
655
|
+
// Register credentials and get API key
|
|
656
|
+
const bugFixerApiKey = (0, hailer_clients_1.registerBotCredentials)('standalone-bugfixer', email, password, { allowedGroups: [tool_registry_1.ToolGroup.READ, tool_registry_1.ToolGroup.WRITE, tool_registry_1.ToolGroup.BOT_INTERNAL] });
|
|
657
|
+
// Initialize the bot client - returns userId
|
|
658
|
+
const bugFixerUserId = await botManager.initializeBotClient(email, password, bugFixerApiKey);
|
|
659
|
+
if (!bugFixerUserId) {
|
|
660
|
+
logger.error("Failed to initialize Bug Fixer client");
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
// Get the actual BotClient object
|
|
664
|
+
const bugFixerClient = botManager.getBotClient(bugFixerUserId);
|
|
665
|
+
if (!bugFixerClient) {
|
|
666
|
+
logger.error("Failed to get Bug Fixer client after init");
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
logger.info("Bug Fixer logged in", { userId: bugFixerUserId });
|
|
670
|
+
// Get user context for API calls
|
|
671
|
+
const userContext = await UserContextCache_1.UserContextCache.getContext(bugFixerApiKey);
|
|
672
|
+
// Enable bot in bot state - CRITICAL for message processing
|
|
673
|
+
const workspaceId = bugFixerClient.workspaceCache?.currentWorkspace?._id;
|
|
674
|
+
if (workspaceId) {
|
|
675
|
+
(0, bot_config_1.setBotEnabled)(workspaceId, bugFixerUserId, true);
|
|
676
|
+
logger.info("Bug Fixer bot enabled in state", { workspaceId, userId: bugFixerUserId });
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
logger.warn("No workspace ID for Bug Fixer - bot state may not work correctly");
|
|
680
|
+
}
|
|
681
|
+
// Create minimal daemon manager for Bug Fixer only
|
|
682
|
+
const daemonManager = new DaemonManager(botManager, {
|
|
683
|
+
mcpServerUrl: mcpClientConfig.mcpServerUrl,
|
|
684
|
+
anthropicApiKey: anthropicProvider.apiKey,
|
|
685
|
+
model: anthropicProvider.model,
|
|
686
|
+
orchestratorMode: false,
|
|
687
|
+
});
|
|
688
|
+
// Create Bug Fixer specialist definition
|
|
689
|
+
const bugFixerSpecialist = definitions_1.SPECIALISTS.bugFixer;
|
|
690
|
+
// Create BugFixerSpecialistDaemon directly
|
|
691
|
+
const bugFixerConfig = {
|
|
692
|
+
botClient: bugFixerClient,
|
|
693
|
+
mcpServerUrl: mcpClientConfig.mcpServerUrl,
|
|
694
|
+
anthropicApiKey: anthropicProvider.apiKey,
|
|
695
|
+
model: anthropicProvider.model,
|
|
696
|
+
specialist: bugFixerSpecialist,
|
|
697
|
+
userContext,
|
|
698
|
+
};
|
|
699
|
+
const bugFixerDaemon = new specialist_daemon_1.BugFixerSpecialistDaemon(bugFixerConfig);
|
|
700
|
+
await bugFixerDaemon.initialize();
|
|
701
|
+
// Track the daemon for cleanup
|
|
702
|
+
daemonManager.registerStandaloneDaemon(bugFixerUserId, bugFixerDaemon);
|
|
703
|
+
logger.info("Standalone Bug Fixer daemon started", { userId: bugFixerUserId });
|
|
704
|
+
return daemonManager;
|
|
705
|
+
}
|
|
706
|
+
//# sourceMappingURL=factory.js.map
|