@hailer/mcp 1.2.0 ā 2.0.0-beta.1
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/agents/agent-hailer-helper.md +118 -0
- package/.claude/commands/app-squad.md +16 -110
- package/.claude/commands/debug-squad.md +13 -290
- package/.claude/commands/publish.md +2 -2
- package/.claude/commands/review-squad.md +17 -139
- package/.claude/skills/create-and-publish-app/SKILL.md +102 -83
- package/.claude/skills/hailer-app-builder/SKILL.md +2 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +136 -10
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/bot/bot-manager.d.ts +9 -6
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +142 -31
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot.d.ts +59 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +889 -142
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/operation-logger.d.ts.map +1 -1
- package/dist/bot/operation-logger.js +24 -12
- package/dist/bot/operation-logger.js.map +1 -1
- package/dist/bot/services/bot-permissions.d.ts +2 -2
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +28 -9
- package/dist/bot/services/bot-permissions.js.map +1 -1
- package/dist/bot/services/conversation-manager.d.ts +23 -23
- package/dist/bot/services/conversation-manager.d.ts.map +1 -1
- package/dist/bot/services/conversation-manager.js +52 -49
- package/dist/bot/services/conversation-manager.js.map +1 -1
- package/dist/bot/services/helper-prompt.d.ts +8 -0
- package/dist/bot/services/helper-prompt.d.ts.map +1 -0
- package/dist/bot/services/helper-prompt.js +177 -0
- package/dist/bot/services/helper-prompt.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts +16 -16
- package/dist/bot/services/message-classifier.d.ts.map +1 -1
- package/dist/bot/services/message-classifier.js +55 -49
- package/dist/bot/services/message-classifier.js.map +1 -1
- package/dist/bot/services/message-formatter.d.ts +38 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +81 -74
- package/dist/bot/services/message-formatter.js.map +1 -1
- package/dist/bot/services/permission-guard.d.ts.map +1 -1
- package/dist/bot/services/permission-guard.js +20 -10
- package/dist/bot/services/permission-guard.js.map +1 -1
- package/dist/bot/services/signal-router.d.ts.map +1 -1
- package/dist/bot/services/signal-router.js +11 -6
- package/dist/bot/services/signal-router.js.map +1 -1
- package/dist/bot/services/system-prompt.d.ts +14 -0
- package/dist/bot/services/system-prompt.d.ts.map +1 -1
- package/dist/bot/services/system-prompt.js +179 -4
- package/dist/bot/services/system-prompt.js.map +1 -1
- package/dist/bot/services/token-billing.d.ts +23 -23
- package/dist/bot/services/token-billing.d.ts.map +1 -1
- package/dist/bot/services/token-billing.js +51 -36
- package/dist/bot/services/token-billing.js.map +1 -1
- package/dist/bot/services/types.d.ts +3 -1
- package/dist/bot/services/types.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.d.ts +8 -8
- package/dist/bot/services/typing-indicator.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.js +12 -10
- package/dist/bot/services/typing-indicator.js.map +1 -1
- package/dist/bot/services/workspace-refresh.d.ts +3 -3
- package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
- package/dist/bot/services/workspace-refresh.js +23 -13
- package/dist/bot/services/workspace-refresh.js.map +1 -1
- package/dist/bot/tool-executor.d.ts +10 -6
- package/dist/bot/tool-executor.d.ts.map +1 -1
- package/dist/bot/tool-executor.js +12 -6
- package/dist/bot/tool-executor.js.map +1 -1
- package/dist/bot/workspace-overview.d.ts.map +1 -1
- package/dist/bot/workspace-overview.js +6 -3
- package/dist/bot/workspace-overview.js.map +1 -1
- package/dist/bot-config/activity-error.d.ts +47 -0
- package/dist/bot-config/activity-error.d.ts.map +1 -0
- package/dist/bot-config/activity-error.js +67 -0
- package/dist/bot-config/activity-error.js.map +1 -0
- package/dist/bot-config/context.d.ts +4 -4
- package/dist/bot-config/context.d.ts.map +1 -1
- package/dist/bot-config/context.js +18 -14
- package/dist/bot-config/context.js.map +1 -1
- package/dist/bot-config/events.d.ts +45 -0
- package/dist/bot-config/events.d.ts.map +1 -0
- package/dist/bot-config/events.js +51 -0
- package/dist/bot-config/events.js.map +1 -0
- package/dist/bot-config/index.d.ts +3 -0
- package/dist/bot-config/index.d.ts.map +1 -1
- package/dist/bot-config/index.js +8 -1
- package/dist/bot-config/index.js.map +1 -1
- package/dist/bot-config/loader.d.ts +3 -0
- package/dist/bot-config/loader.d.ts.map +1 -1
- package/dist/bot-config/loader.js +45 -20
- package/dist/bot-config/loader.js.map +1 -1
- package/dist/bot-config/persistence.js.map +1 -1
- package/dist/bot-config/reconciler.d.ts +11 -0
- package/dist/bot-config/reconciler.d.ts.map +1 -0
- package/dist/bot-config/reconciler.js +121 -0
- package/dist/bot-config/reconciler.js.map +1 -0
- package/dist/bot-config/state.d.ts.map +1 -1
- package/dist/bot-config/state.js.map +1 -1
- package/dist/bot-config/types.d.ts +32 -0
- package/dist/bot-config/types.d.ts.map +1 -1
- package/dist/bot-config/webhooks.d.ts.map +1 -1
- package/dist/bot-config/webhooks.js.map +1 -1
- package/dist/bot-config/workflow-installer.d.ts +37 -0
- package/dist/bot-config/workflow-installer.d.ts.map +1 -0
- package/dist/bot-config/workflow-installer.js +346 -0
- package/dist/bot-config/workflow-installer.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -27
- package/dist/config.js.map +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -16
- package/dist/core.js.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +7 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/request-logger.d.ts +19 -19
- package/dist/lib/request-logger.d.ts.map +1 -1
- package/dist/lib/request-logger.js +19 -19
- package/dist/lib/request-logger.js.map +1 -1
- package/dist/mcp/UserContextCache.d.ts +28 -22
- package/dist/mcp/UserContextCache.d.ts.map +1 -1
- package/dist/mcp/UserContextCache.js +23 -23
- package/dist/mcp/UserContextCache.js.map +1 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/hailer-clients.d.ts +5 -4
- package/dist/mcp/hailer-clients.d.ts.map +1 -1
- package/dist/mcp/hailer-clients.js +61 -27
- package/dist/mcp/hailer-clients.js.map +1 -1
- package/dist/mcp/hailer-rpc.d.ts +40 -0
- package/dist/mcp/hailer-rpc.d.ts.map +1 -0
- package/dist/mcp/hailer-rpc.js +43 -0
- package/dist/mcp/hailer-rpc.js.map +1 -0
- package/dist/mcp/session-store.d.ts +16 -16
- package/dist/mcp/session-store.d.ts.map +1 -1
- package/dist/mcp/session-store.js +16 -16
- package/dist/mcp/session-store.js.map +1 -1
- package/dist/mcp/tool-profiles.d.ts +69 -0
- package/dist/mcp/tool-profiles.d.ts.map +1 -0
- package/dist/mcp/tool-profiles.js +176 -0
- package/dist/mcp/tool-profiles.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +16 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +91 -39
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +398 -198
- package/dist/mcp/tools/activity.js.map +1 -1
- package/dist/mcp/tools/aliases.d.ts +11 -0
- package/dist/mcp/tools/aliases.d.ts.map +1 -0
- package/dist/mcp/tools/aliases.js +176 -0
- package/dist/mcp/tools/aliases.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts +6 -8
- package/dist/mcp/tools/app-core.d.ts.map +1 -1
- package/dist/mcp/tools/app-core.js +355 -254
- package/dist/mcp/tools/app-core.js.map +1 -1
- package/dist/mcp/tools/app-marketplace.d.ts +8 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +604 -930
- package/dist/mcp/tools/app-marketplace.js.map +1 -1
- package/dist/mcp/tools/app.d.ts +4 -7
- package/dist/mcp/tools/app.d.ts.map +1 -1
- package/dist/mcp/tools/app.js +4 -7
- package/dist/mcp/tools/app.js.map +1 -1
- package/dist/mcp/tools/bot-self.d.ts +21 -0
- package/dist/mcp/tools/bot-self.d.ts.map +1 -0
- package/dist/mcp/tools/bot-self.js +174 -0
- package/dist/mcp/tools/bot-self.js.map +1 -0
- package/dist/mcp/tools/calendar.d.ts +21 -0
- package/dist/mcp/tools/calendar.d.ts.map +1 -0
- package/dist/mcp/tools/calendar.js +741 -0
- package/dist/mcp/tools/calendar.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -1
- package/dist/mcp/tools/company.js +2 -1
- package/dist/mcp/tools/company.js.map +1 -1
- package/dist/mcp/tools/date.js.map +1 -1
- package/dist/mcp/tools/discussion.d.ts +23 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +417 -534
- package/dist/mcp/tools/discussion.js.map +1 -1
- package/dist/mcp/tools/file.d.ts.map +1 -1
- package/dist/mcp/tools/file.js +18 -16
- package/dist/mcp/tools/file.js.map +1 -1
- package/dist/mcp/tools/index.js +4 -4
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/insight.d.ts +7 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +419 -477
- package/dist/mcp/tools/insight.js.map +1 -1
- package/dist/mcp/tools/user.d.ts.map +1 -1
- package/dist/mcp/tools/user.js +15 -13
- package/dist/mcp/tools/user.js.map +1 -1
- package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
- package/dist/mcp/tools/workflow-permissions.js +88 -97
- package/dist/mcp/tools/workflow-permissions.js.map +1 -1
- package/dist/mcp/tools/workflow.d.ts +2 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +817 -850
- package/dist/mcp/tools/workflow.js.map +1 -1
- package/dist/mcp/utils/api-errors.d.ts.map +1 -1
- package/dist/mcp/utils/api-errors.js +2 -2
- package/dist/mcp/utils/api-errors.js.map +1 -1
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +8 -4
- package/dist/mcp/utils/data-transformers.js.map +1 -1
- package/dist/mcp/utils/file-upload.d.ts.map +1 -1
- package/dist/mcp/utils/file-upload.js +1 -1
- package/dist/mcp/utils/file-upload.js.map +1 -1
- package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
- package/dist/mcp/utils/hailer-api-client.js +103 -101
- package/dist/mcp/utils/hailer-api-client.js.map +1 -1
- package/dist/mcp/utils/index.d.ts.map +1 -1
- package/dist/mcp/utils/index.js.map +1 -1
- package/dist/mcp/utils/logger.d.ts.map +1 -1
- package/dist/mcp/utils/logger.js.map +1 -1
- package/dist/mcp/utils/response-builder.d.ts.map +1 -1
- package/dist/mcp/utils/response-builder.js +8 -4
- package/dist/mcp/utils/response-builder.js.map +1 -1
- package/dist/mcp/utils/role-utils.d.ts.map +1 -1
- package/dist/mcp/utils/role-utils.js +6 -3
- package/dist/mcp/utils/role-utils.js.map +1 -1
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
- package/dist/mcp/utils/tool-helpers.js +2 -2
- package/dist/mcp/utils/tool-helpers.js.map +1 -1
- package/dist/mcp/utils/types.d.ts +1 -1
- package/dist/mcp/utils/types.d.ts.map +1 -1
- package/dist/mcp/utils/types.js.map +1 -1
- package/dist/mcp/webhook-handler.d.ts +43 -8
- package/dist/mcp/webhook-handler.d.ts.map +1 -1
- package/dist/mcp/webhook-handler.js +861 -116
- package/dist/mcp/webhook-handler.js.map +1 -1
- package/dist/mcp/workspace-admin-store.d.ts +49 -0
- package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
- package/dist/mcp/workspace-admin-store.js +168 -0
- package/dist/mcp/workspace-admin-store.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts +2 -2
- package/dist/mcp/workspace-cache.d.ts.map +1 -1
- package/dist/mcp/workspace-cache.js +9 -5
- package/dist/mcp/workspace-cache.js.map +1 -1
- package/dist/mcp-server.d.ts +26 -11
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +360 -36
- package/dist/mcp-server.js.map +1 -1
- package/dist/plugins/vipunen/client.d.ts +41 -41
- package/dist/plugins/vipunen/client.d.ts.map +1 -1
- package/dist/plugins/vipunen/client.js +53 -48
- package/dist/plugins/vipunen/client.js.map +1 -1
- package/dist/plugins/vipunen/index.js.map +1 -1
- package/dist/plugins/vipunen/tools.d.ts.map +1 -1
- package/dist/plugins/vipunen/tools.js +6 -3
- package/dist/plugins/vipunen/tools.js.map +1 -1
- package/dist/public-chat/graduate.d.ts +29 -0
- package/dist/public-chat/graduate.d.ts.map +1 -0
- package/dist/public-chat/graduate.js +593 -0
- package/dist/public-chat/graduate.js.map +1 -0
- package/dist/public-chat/handler.d.ts +12 -0
- package/dist/public-chat/handler.d.ts.map +1 -0
- package/dist/public-chat/handler.js +179 -0
- package/dist/public-chat/handler.js.map +1 -0
- package/dist/public-chat/index.d.ts +16 -0
- package/dist/public-chat/index.d.ts.map +1 -0
- package/dist/public-chat/index.js +74 -0
- package/dist/public-chat/index.js.map +1 -0
- package/dist/public-chat/knowledge.d.ts +3 -0
- package/dist/public-chat/knowledge.d.ts.map +1 -0
- package/dist/public-chat/knowledge.js +1339 -0
- package/dist/public-chat/knowledge.js.map +1 -0
- package/dist/public-chat/rate-limit.d.ts +16 -0
- package/dist/public-chat/rate-limit.d.ts.map +1 -0
- package/dist/public-chat/rate-limit.js +51 -0
- package/dist/public-chat/rate-limit.js.map +1 -0
- package/dist/public-chat/session-store.d.ts +41 -0
- package/dist/public-chat/session-store.d.ts.map +1 -0
- package/dist/public-chat/session-store.js +95 -0
- package/dist/public-chat/session-store.js.map +1 -0
- package/dist/public-chat/studio-prewarm.d.ts +61 -0
- package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
- package/dist/public-chat/studio-prewarm.js +162 -0
- package/dist/public-chat/studio-prewarm.js.map +1 -0
- package/dist/public-chat/system-prompt.d.ts +22 -0
- package/dist/public-chat/system-prompt.d.ts.map +1 -0
- package/dist/public-chat/system-prompt.js +428 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +14 -6
- package/scripts/build-public-chat-knowledge.py +101 -0
- package/scripts/probe-mcp-pricing.ts +52 -0
- package/scripts/smoke-public-chat-live.ts +148 -0
- package/scripts/smoke-public-chat.ts +110 -0
- package/.claude/CLAUDE.md +0 -126
- package/.claude/commands/audit-squad.md +0 -158
- package/.claude/commands/cleanup-squad.md +0 -98
- package/.claude/commands/config-squad.md +0 -106
- package/.claude/commands/crud-squad.md +0 -87
- package/.claude/commands/data-squad.md +0 -97
- package/.claude/commands/doc-squad.md +0 -65
- package/.claude/commands/help.md +0 -29
- package/.claude/commands/help:agents.md +0 -182
- package/.claude/commands/help:commands.md +0 -78
- package/.claude/commands/help:faq.md +0 -79
- package/.claude/commands/help:plugins.md +0 -50
- package/.claude/commands/help:skills.md +0 -87
- package/.claude/commands/help:tools.md +0 -75
- package/.claude/commands/hotfix-squad.md +0 -112
- package/.claude/commands/integration-squad.md +0 -82
- package/.claude/commands/janitor-squad.md +0 -167
- package/.claude/commands/onboard-squad.md +0 -130
- package/.claude/commands/swarm.md +0 -210
- package/.claude/commands/tool-builder.md +0 -39
- package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
- package/dist/CLAUDE.md +0 -370
- package/dist/agents/bot-manager.d.ts +0 -48
- package/dist/agents/bot-manager.d.ts.map +0 -1
- package/dist/agents/bot-manager.js +0 -254
- package/dist/agents/bot-manager.js.map +0 -1
- package/dist/agents/bug-fixer/ai.d.ts +0 -80
- package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
- package/dist/agents/bug-fixer/ai.js +0 -466
- package/dist/agents/bug-fixer/ai.js.map +0 -1
- package/dist/agents/bug-fixer/bot.d.ts +0 -92
- package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
- package/dist/agents/bug-fixer/bot.js +0 -687
- package/dist/agents/bug-fixer/bot.js.map +0 -1
- package/dist/agents/bug-fixer/config.d.ts +0 -21
- package/dist/agents/bug-fixer/config.d.ts.map +0 -1
- package/dist/agents/bug-fixer/config.js +0 -218
- package/dist/agents/bug-fixer/config.js.map +0 -1
- package/dist/agents/bug-fixer/files.d.ts +0 -67
- package/dist/agents/bug-fixer/files.d.ts.map +0 -1
- package/dist/agents/bug-fixer/files.js +0 -386
- package/dist/agents/bug-fixer/files.js.map +0 -1
- package/dist/agents/bug-fixer/git.d.ts +0 -48
- package/dist/agents/bug-fixer/git.d.ts.map +0 -1
- package/dist/agents/bug-fixer/git.js +0 -298
- package/dist/agents/bug-fixer/git.js.map +0 -1
- package/dist/agents/bug-fixer/index.d.ts +0 -103
- package/dist/agents/bug-fixer/index.d.ts.map +0 -1
- package/dist/agents/bug-fixer/index.js +0 -262
- package/dist/agents/bug-fixer/index.js.map +0 -1
- package/dist/agents/bug-fixer/lsp.d.ts +0 -113
- package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
- package/dist/agents/bug-fixer/lsp.js +0 -485
- package/dist/agents/bug-fixer/lsp.js.map +0 -1
- package/dist/agents/bug-fixer/monitor.d.ts +0 -123
- package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
- package/dist/agents/bug-fixer/monitor.js +0 -629
- package/dist/agents/bug-fixer/monitor.js.map +0 -1
- package/dist/agents/bug-fixer/prompt.d.ts +0 -5
- package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
- package/dist/agents/bug-fixer/prompt.js +0 -94
- package/dist/agents/bug-fixer/prompt.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
- package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
- package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
- package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.js +0 -49
- package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
- package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
- package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
- package/dist/agents/bug-fixer/specialist.d.ts +0 -47
- package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist.js +0 -327
- package/dist/agents/bug-fixer/specialist.js.map +0 -1
- package/dist/agents/bug-fixer/types.d.ts +0 -123
- package/dist/agents/bug-fixer/types.d.ts.map +0 -1
- package/dist/agents/bug-fixer/types.js +0 -9
- package/dist/agents/bug-fixer/types.js.map +0 -1
- package/dist/agents/factory.d.ts +0 -172
- package/dist/agents/factory.d.ts.map +0 -1
- package/dist/agents/factory.js +0 -706
- package/dist/agents/factory.js.map +0 -1
- package/dist/agents/hailer-expert/index.d.ts +0 -8
- package/dist/agents/hailer-expert/index.d.ts.map +0 -1
- package/dist/agents/hailer-expert/index.js +0 -14
- package/dist/agents/hailer-expert/index.js.map +0 -1
- package/dist/agents/hal/daemon.d.ts +0 -174
- package/dist/agents/hal/daemon.d.ts.map +0 -1
- package/dist/agents/hal/daemon.js +0 -1385
- package/dist/agents/hal/daemon.js.map +0 -1
- package/dist/agents/hal/definitions.d.ts +0 -42
- package/dist/agents/hal/definitions.d.ts.map +0 -1
- package/dist/agents/hal/definitions.js +0 -300
- package/dist/agents/hal/definitions.js.map +0 -1
- package/dist/agents/hal/index.d.ts +0 -3
- package/dist/agents/hal/index.d.ts.map +0 -1
- package/dist/agents/hal/index.js +0 -8
- package/dist/agents/hal/index.js.map +0 -1
- package/dist/agents/index.d.ts +0 -18
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -48
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared/base.d.ts +0 -253
- package/dist/agents/shared/base.d.ts.map +0 -1
- package/dist/agents/shared/base.js +0 -1122
- package/dist/agents/shared/base.js.map +0 -1
- package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
- package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
- package/dist/agents/shared/schemas/action-schema.js +0 -483
- package/dist/agents/shared/schemas/action-schema.js.map +0 -1
- package/dist/agents/shared/services/agent-registry.d.ts +0 -108
- package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
- package/dist/agents/shared/services/agent-registry.js +0 -469
- package/dist/agents/shared/services/agent-registry.js.map +0 -1
- package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
- package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
- package/dist/agents/shared/services/conversation-manager.js +0 -168
- package/dist/agents/shared/services/conversation-manager.js.map +0 -1
- package/dist/agents/shared/services/mcp-client.d.ts +0 -56
- package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
- package/dist/agents/shared/services/mcp-client.js +0 -124
- package/dist/agents/shared/services/mcp-client.js.map +0 -1
- package/dist/agents/shared/services/message-classifier.d.ts +0 -37
- package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
- package/dist/agents/shared/services/message-classifier.js +0 -203
- package/dist/agents/shared/services/message-classifier.js.map +0 -1
- package/dist/agents/shared/services/message-formatter.d.ts +0 -89
- package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
- package/dist/agents/shared/services/message-formatter.js +0 -390
- package/dist/agents/shared/services/message-formatter.js.map +0 -1
- package/dist/agents/shared/services/session-logger.d.ts +0 -162
- package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
- package/dist/agents/shared/services/session-logger.js +0 -724
- package/dist/agents/shared/services/session-logger.js.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
- package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.js +0 -296
- package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
- package/dist/agents/shared/services/token-billing.d.ts +0 -72
- package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
- package/dist/agents/shared/services/token-billing.js +0 -198
- package/dist/agents/shared/services/token-billing.js.map +0 -1
- package/dist/agents/shared/services/tool-executor.d.ts +0 -43
- package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/tool-executor.js +0 -175
- package/dist/agents/shared/services/tool-executor.js.map +0 -1
- package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
- package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
- package/dist/agents/shared/services/typing-indicator.js +0 -54
- package/dist/agents/shared/services/typing-indicator.js.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
- package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
- package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
- package/dist/agents/shared/specialist.d.ts +0 -91
- package/dist/agents/shared/specialist.d.ts.map +0 -1
- package/dist/agents/shared/specialist.js +0 -399
- package/dist/agents/shared/specialist.js.map +0 -1
- package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
- package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
- package/dist/agents/shared/tool-schema-loader.js +0 -238
- package/dist/agents/shared/tool-schema-loader.js.map +0 -1
- package/dist/agents/shared/types.d.ts +0 -190
- package/dist/agents/shared/types.d.ts.map +0 -1
- package/dist/agents/shared/types.js +0 -13
- package/dist/agents/shared/types.js.map +0 -1
- package/dist/bot/bot-config.d.ts +0 -37
- package/dist/bot/bot-config.d.ts.map +0 -1
- package/dist/bot/bot-config.js +0 -219
- package/dist/bot/bot-config.js.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
- package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
- package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
- package/dist/bot/services/session-logger.d.ts +0 -162
- package/dist/bot/services/session-logger.d.ts.map +0 -1
- package/dist/bot/services/session-logger.js +0 -724
- package/dist/bot/services/session-logger.js.map +0 -1
- package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
- package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/bot/services/workspace-schema-cache.js +0 -506
- package/dist/bot/services/workspace-schema-cache.js.map +0 -1
- package/dist/bot-config/tools.d.ts +0 -28
- package/dist/bot-config/tools.d.ts.map +0 -1
- package/dist/bot-config/tools.js +0 -279
- package/dist/bot-config/tools.js.map +0 -1
- package/dist/client/agents/base.d.ts +0 -207
- package/dist/client/agents/base.d.ts.map +0 -1
- package/dist/client/agents/base.js +0 -744
- package/dist/client/agents/base.js.map +0 -1
- package/dist/client/agents/definitions.d.ts +0 -53
- package/dist/client/agents/definitions.d.ts.map +0 -1
- package/dist/client/agents/definitions.js +0 -263
- package/dist/client/agents/definitions.js.map +0 -1
- package/dist/client/agents/orchestrator.d.ts +0 -141
- package/dist/client/agents/orchestrator.d.ts.map +0 -1
- package/dist/client/agents/orchestrator.js +0 -1062
- package/dist/client/agents/orchestrator.js.map +0 -1
- package/dist/client/agents/specialist.d.ts +0 -86
- package/dist/client/agents/specialist.d.ts.map +0 -1
- package/dist/client/agents/specialist.js +0 -340
- package/dist/client/agents/specialist.js.map +0 -1
- package/dist/client/bot-entrypoint.d.ts +0 -7
- package/dist/client/bot-entrypoint.d.ts.map +0 -1
- package/dist/client/bot-entrypoint.js +0 -103
- package/dist/client/bot-entrypoint.js.map +0 -1
- package/dist/client/bot-manager.d.ts +0 -44
- package/dist/client/bot-manager.d.ts.map +0 -1
- package/dist/client/bot-manager.js +0 -173
- package/dist/client/bot-manager.js.map +0 -1
- package/dist/client/bot-runner.d.ts +0 -35
- package/dist/client/bot-runner.d.ts.map +0 -1
- package/dist/client/bot-runner.js +0 -188
- package/dist/client/bot-runner.js.map +0 -1
- package/dist/client/chat-agent-daemon.d.ts +0 -464
- package/dist/client/chat-agent-daemon.d.ts.map +0 -1
- package/dist/client/chat-agent-daemon.js +0 -1774
- package/dist/client/chat-agent-daemon.js.map +0 -1
- package/dist/client/daemon-factory.d.ts +0 -106
- package/dist/client/daemon-factory.d.ts.map +0 -1
- package/dist/client/daemon-factory.js +0 -301
- package/dist/client/daemon-factory.js.map +0 -1
- package/dist/client/factory.d.ts +0 -111
- package/dist/client/factory.d.ts.map +0 -1
- package/dist/client/factory.js +0 -314
- package/dist/client/factory.js.map +0 -1
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -38
- package/dist/client/index.js.map +0 -1
- package/dist/client/multi-bot-manager.d.ts +0 -42
- package/dist/client/multi-bot-manager.d.ts.map +0 -1
- package/dist/client/multi-bot-manager.js +0 -161
- package/dist/client/multi-bot-manager.js.map +0 -1
- package/dist/client/orchestrator-daemon.d.ts +0 -87
- package/dist/client/orchestrator-daemon.d.ts.map +0 -1
- package/dist/client/orchestrator-daemon.js +0 -444
- package/dist/client/orchestrator-daemon.js.map +0 -1
- package/dist/client/server.d.ts +0 -8
- package/dist/client/server.d.ts.map +0 -1
- package/dist/client/server.js +0 -251
- package/dist/client/server.js.map +0 -1
- package/dist/client/services/agent-registry.d.ts +0 -108
- package/dist/client/services/agent-registry.d.ts.map +0 -1
- package/dist/client/services/agent-registry.js +0 -630
- package/dist/client/services/agent-registry.js.map +0 -1
- package/dist/client/services/conversation-manager.d.ts +0 -50
- package/dist/client/services/conversation-manager.d.ts.map +0 -1
- package/dist/client/services/conversation-manager.js +0 -136
- package/dist/client/services/conversation-manager.js.map +0 -1
- package/dist/client/services/mcp-client.d.ts +0 -48
- package/dist/client/services/mcp-client.d.ts.map +0 -1
- package/dist/client/services/mcp-client.js +0 -105
- package/dist/client/services/mcp-client.js.map +0 -1
- package/dist/client/services/message-classifier.d.ts +0 -37
- package/dist/client/services/message-classifier.d.ts.map +0 -1
- package/dist/client/services/message-classifier.js +0 -187
- package/dist/client/services/message-classifier.js.map +0 -1
- package/dist/client/services/message-formatter.d.ts +0 -84
- package/dist/client/services/message-formatter.d.ts.map +0 -1
- package/dist/client/services/message-formatter.js +0 -353
- package/dist/client/services/message-formatter.js.map +0 -1
- package/dist/client/services/session-logger.d.ts +0 -106
- package/dist/client/services/session-logger.d.ts.map +0 -1
- package/dist/client/services/session-logger.js +0 -446
- package/dist/client/services/session-logger.js.map +0 -1
- package/dist/client/services/tool-executor.d.ts +0 -41
- package/dist/client/services/tool-executor.d.ts.map +0 -1
- package/dist/client/services/tool-executor.js +0 -169
- package/dist/client/services/tool-executor.js.map +0 -1
- package/dist/client/services/workspace-schema-cache.d.ts +0 -149
- package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/client/services/workspace-schema-cache.js +0 -732
- package/dist/client/services/workspace-schema-cache.js.map +0 -1
- package/dist/client/specialist-daemon.d.ts +0 -77
- package/dist/client/specialist-daemon.d.ts.map +0 -1
- package/dist/client/specialist-daemon.js +0 -197
- package/dist/client/specialist-daemon.js.map +0 -1
- package/dist/client/specialists.d.ts +0 -53
- package/dist/client/specialists.d.ts.map +0 -1
- package/dist/client/specialists.js +0 -178
- package/dist/client/specialists.js.map +0 -1
- package/dist/client/tool-schema-loader.d.ts +0 -62
- package/dist/client/tool-schema-loader.d.ts.map +0 -1
- package/dist/client/tool-schema-loader.js +0 -232
- package/dist/client/tool-schema-loader.js.map +0 -1
- package/dist/client/types.d.ts +0 -327
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -121
- package/dist/client/types.js.map +0 -1
- package/dist/commands/seed-config.d.ts +0 -9
- package/dist/commands/seed-config.d.ts.map +0 -1
- package/dist/commands/seed-config.js +0 -377
- package/dist/commands/seed-config.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -11
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -320
- package/dist/commands/setup.js.map +0 -1
- package/dist/lib/discussion-lock.d.ts +0 -42
- package/dist/lib/discussion-lock.d.ts.map +0 -1
- package/dist/lib/discussion-lock.js +0 -110
- package/dist/lib/discussion-lock.js.map +0 -1
- package/dist/mcp/signal-handler.d.ts +0 -82
- package/dist/mcp/signal-handler.d.ts.map +0 -1
- package/dist/mcp/signal-handler.js +0 -406
- package/dist/mcp/signal-handler.js.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
- package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
- package/dist/mcp/tools/app-member.d.ts +0 -14
- package/dist/mcp/tools/app-member.d.ts.map +0 -1
- package/dist/mcp/tools/app-member.js +0 -195
- package/dist/mcp/tools/app-member.js.map +0 -1
- package/dist/mcp/tools/app-scaffold.d.ts +0 -14
- package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
- package/dist/mcp/tools/app-scaffold.js +0 -581
- package/dist/mcp/tools/app-scaffold.js.map +0 -1
- package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
- package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/constants.js +0 -94
- package/dist/mcp/tools/bot-config/constants.js.map +0 -1
- package/dist/mcp/tools/bot-config/core.d.ts +0 -253
- package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/core.js +0 -2456
- package/dist/mcp/tools/bot-config/core.js.map +0 -1
- package/dist/mcp/tools/bot-config/index.d.ts +0 -10
- package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/index.js +0 -59
- package/dist/mcp/tools/bot-config/index.js.map +0 -1
- package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
- package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/tools.js +0 -15
- package/dist/mcp/tools/bot-config/tools.js.map +0 -1
- package/dist/mcp/tools/bot-config/types.d.ts +0 -50
- package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/types.js +0 -6
- package/dist/mcp/tools/bot-config/types.js.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
- package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
- package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
- package/dist/mcp/tools/document.d.ts +0 -11
- package/dist/mcp/tools/document.d.ts.map +0 -1
- package/dist/mcp/tools/document.js +0 -741
- package/dist/mcp/tools/document.js.map +0 -1
- package/dist/mcp/tools/investigate.d.ts +0 -9
- package/dist/mcp/tools/investigate.d.ts.map +0 -1
- package/dist/mcp/tools/investigate.js +0 -254
- package/dist/mcp/tools/investigate.js.map +0 -1
- package/dist/mcp/utils/pagination.d.ts +0 -40
- package/dist/mcp/utils/pagination.d.ts.map +0 -1
- package/dist/mcp/utils/pagination.js +0 -55
- package/dist/mcp/utils/pagination.js.map +0 -1
- package/dist/modules/bug-reports/bug-config.d.ts +0 -25
- package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-config.js +0 -187
- package/dist/modules/bug-reports/bug-config.js.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
- package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.js +0 -510
- package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
- package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
- package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
- package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
- package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
- package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
- package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
- package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
- package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.js +0 -375
- package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
- package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.js +0 -298
- package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
- package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
- package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
- package/dist/modules/bug-reports/index.d.ts +0 -77
- package/dist/modules/bug-reports/index.d.ts.map +0 -1
- package/dist/modules/bug-reports/index.js +0 -215
- package/dist/modules/bug-reports/index.js.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
- package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
- package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
- package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
- package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
- package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-registry.js +0 -49
- package/dist/modules/bug-reports/pending-registry.js.map +0 -1
- package/dist/modules/bug-reports/types.d.ts +0 -123
- package/dist/modules/bug-reports/types.d.ts.map +0 -1
- package/dist/modules/bug-reports/types.js +0 -9
- package/dist/modules/bug-reports/types.js.map +0 -1
- package/dist/plugins/bug-fixer/index.d.ts +0 -2
- package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/index.js +0 -18
- package/dist/plugins/bug-fixer/index.js.map +0 -1
- package/dist/plugins/bug-fixer/tools.d.ts +0 -45
- package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/tools.js +0 -1096
- package/dist/plugins/bug-fixer/tools.js.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
- package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
- package/dist/routes/agents.d.ts +0 -44
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js +0 -311
- package/dist/routes/agents.js.map +0 -1
- package/dist/services/agent-credential-store.d.ts +0 -73
- package/dist/services/agent-credential-store.d.ts.map +0 -1
- package/dist/services/agent-credential-store.js +0 -212
- package/dist/services/agent-credential-store.js.map +0 -1
- package/dist/stdio-server.d.ts +0 -14
- package/dist/stdio-server.d.ts.map +0 -1
- package/dist/stdio-server.js +0 -101
- package/dist/stdio-server.js.map +0 -1
- package/dist/workspace/context.d.ts +0 -148
- package/dist/workspace/context.d.ts.map +0 -1
- package/dist/workspace/context.js +0 -339
- package/dist/workspace/context.js.map +0 -1
- package/dist/workspace/credentials.d.ts +0 -55
- package/dist/workspace/credentials.d.ts.map +0 -1
- package/dist/workspace/credentials.js +0 -239
- package/dist/workspace/credentials.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -21
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js +0 -45
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/loader.d.ts +0 -27
- package/dist/workspace/loader.d.ts.map +0 -1
- package/dist/workspace/loader.js +0 -222
- package/dist/workspace/loader.js.map +0 -1
- package/dist/workspace/schema.d.ts +0 -37
- package/dist/workspace/schema.d.ts.map +0 -1
- package/dist/workspace/schema.js +0 -192
- package/dist/workspace/schema.js.map +0 -1
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Tools for managing Hailer discussions/chats:
|
|
6
6
|
* - List user's discussions (READ)
|
|
7
|
-
* - Fetch discussion messages
|
|
7
|
+
* - Fetch discussion messages, latest or older via beforeMessageId cursor (READ)
|
|
8
8
|
* - Join/leave discussions (WRITE)
|
|
9
9
|
* - Post messages to discussions (WRITE)
|
|
10
|
+
*
|
|
11
|
+
* get_activity_from_discussion is retired as a listed tool; its lookup logic
|
|
12
|
+
* lives on as the exported lookupActivityFromDiscussion helper (used by the
|
|
13
|
+
* central alias layer and by fetch_discussion_messages enrichment).
|
|
10
14
|
*/
|
|
11
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.discussionTools = exports.
|
|
16
|
+
exports.discussionTools = exports.inviteDiscussionMembersTool = exports.addDiscussionMessageTool = exports.leaveDiscussionTool = exports.joinDiscussionTool = exports.fetchDiscussionMessagesTool = exports.listMyDiscussionsTool = void 0;
|
|
17
|
+
exports.lookupActivityFromDiscussion = lookupActivityFromDiscussion;
|
|
13
18
|
const zod_1 = require("zod");
|
|
14
19
|
const tool_registry_1 = require("../tool-registry");
|
|
15
20
|
const index_1 = require("../utils/index");
|
|
@@ -24,8 +29,9 @@ const logger = (0, index_1.createLogger)({ component: 'discussion-tools' });
|
|
|
24
29
|
* Sanitize string to remove invalid Unicode characters
|
|
25
30
|
*/
|
|
26
31
|
function sanitizeString(str) {
|
|
27
|
-
if (!str)
|
|
32
|
+
if (!str) {
|
|
28
33
|
return '';
|
|
34
|
+
}
|
|
29
35
|
return str.replace(/[\ud800-\udfff]/g, '\ufffd');
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
@@ -95,7 +101,7 @@ exports.listMyDiscussionsTool = {
|
|
|
95
101
|
responseText += `ā You are not currently participating in any discussions.\n\n`;
|
|
96
102
|
responseText += `š” **TIP**: Join activity discussions using the \`join_discussion\` tool.`;
|
|
97
103
|
return {
|
|
98
|
-
content: [{ type:
|
|
104
|
+
content: [{ type: 'text', text: responseText }],
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
107
|
// Collect all linked activity IDs to fetch their names
|
|
@@ -160,14 +166,16 @@ exports.listMyDiscussionsTool = {
|
|
|
160
166
|
other: 'ā Other Discussions'
|
|
161
167
|
};
|
|
162
168
|
for (const [type, typeDiscussions] of Object.entries(discussionsByType)) {
|
|
163
|
-
if (typeDiscussions.length === 0)
|
|
169
|
+
if (typeDiscussions.length === 0) {
|
|
164
170
|
continue;
|
|
171
|
+
}
|
|
165
172
|
responseText += `${typeLabels[type]} (${typeDiscussions.length}):\n\n`;
|
|
166
173
|
typeDiscussions.forEach((discussion, index) => {
|
|
167
174
|
const unreadCount = unreadCounts[discussion._id] || 0;
|
|
168
175
|
responseText += `${index + 1}. `;
|
|
169
|
-
if (unreadCount > 0)
|
|
176
|
+
if (unreadCount > 0) {
|
|
170
177
|
responseText += `š“ `;
|
|
178
|
+
}
|
|
171
179
|
// For activity discussions, prefer the activity name over discussion.name
|
|
172
180
|
let displayName = sanitizeString(discussion.name) || 'Untitled';
|
|
173
181
|
if (discussion.linked_activity && activityNames[discussion.linked_activity]) {
|
|
@@ -216,19 +224,20 @@ exports.listMyDiscussionsTool = {
|
|
|
216
224
|
return {
|
|
217
225
|
content: [
|
|
218
226
|
{
|
|
219
|
-
type:
|
|
227
|
+
type: 'text',
|
|
220
228
|
text: responseText,
|
|
221
229
|
},
|
|
222
230
|
],
|
|
223
231
|
};
|
|
224
232
|
}
|
|
225
233
|
catch (error) {
|
|
226
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
227
|
-
logger.error(
|
|
234
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
235
|
+
logger.error('Failed to list discussions', error);
|
|
236
|
+
}
|
|
228
237
|
return {
|
|
229
238
|
content: [
|
|
230
239
|
{
|
|
231
|
-
type:
|
|
240
|
+
type: 'text',
|
|
232
241
|
text: `ā Failed to list discussions: ${error instanceof Error ? error.message : String(error)}`,
|
|
233
242
|
},
|
|
234
243
|
],
|
|
@@ -236,10 +245,335 @@ exports.listMyDiscussionsTool = {
|
|
|
236
245
|
}
|
|
237
246
|
},
|
|
238
247
|
};
|
|
248
|
+
/**
|
|
249
|
+
* Reverse lookup: find the activity linked to a discussion.
|
|
250
|
+
*
|
|
251
|
+
* Replaces the retired get_activity_from_discussion tool - the central alias
|
|
252
|
+
* layer keeps the old tool name callable through this helper, and
|
|
253
|
+
* fetch_discussion_messages uses it for includeLinkedActivity enrichment.
|
|
254
|
+
*
|
|
255
|
+
* Returns null when the discussion is not found, has no linked activity, or
|
|
256
|
+
* the linked activity cannot be loaded. API errors propagate to the caller.
|
|
257
|
+
*/
|
|
258
|
+
async function lookupActivityFromDiscussion(discussionId, context) {
|
|
259
|
+
const syncResponse = await context.hailer.request('v2.discussion.sync', [{ timestamp: 0 }]);
|
|
260
|
+
const discussions = syncResponse.discussions || [];
|
|
261
|
+
const targetDiscussion = discussions.find((disc) => disc._id === discussionId);
|
|
262
|
+
if (!targetDiscussion?.linked_activity) {
|
|
263
|
+
logger.debug('No linked activity for discussion', {
|
|
264
|
+
discussionId,
|
|
265
|
+
discussionFound: !!targetDiscussion
|
|
266
|
+
});
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
const activityId = targetDiscussion.linked_activity;
|
|
270
|
+
const activity = await context.hailer.fetchActivityById(activityId);
|
|
271
|
+
if (!activity) {
|
|
272
|
+
logger.debug('Linked activity could not be loaded', { discussionId, activityId });
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
activityId: activity._id,
|
|
277
|
+
name: activity.name || 'Untitled',
|
|
278
|
+
workflowId: activity.workflowId || null
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Best-effort linked-activity lookup for response enrichment - never throws
|
|
283
|
+
*/
|
|
284
|
+
async function safeLinkedActivityLookup(discussionId, context) {
|
|
285
|
+
try {
|
|
286
|
+
return await lookupActivityFromDiscussion(discussionId, context);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
logger.debug('Linked activity enrichment failed', {
|
|
290
|
+
discussionId,
|
|
291
|
+
error: error instanceof Error ? error.message : String(error)
|
|
292
|
+
});
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
239
296
|
// ============================================================================
|
|
240
297
|
// TOOL 2: FETCH DISCUSSION MESSAGES
|
|
241
298
|
// ============================================================================
|
|
242
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Extract a forwarded message (and any nested forwards, max depth 10) into optimized form
|
|
301
|
+
*/
|
|
302
|
+
function extractForwardedMessage(context, fwd, depth = 0) {
|
|
303
|
+
if (depth > 10) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
const fwdUserInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, fwd.uid);
|
|
307
|
+
let fwdUsername = `User ${fwd.uid}`;
|
|
308
|
+
if (fwdUserInfo) {
|
|
309
|
+
const fullName = `${fwdUserInfo.firstname || ''} ${fwdUserInfo.lastname || ''}`.trim();
|
|
310
|
+
fwdUsername = fullName || fwdUserInfo.fullName || `User ${fwd.uid}`;
|
|
311
|
+
}
|
|
312
|
+
const extracted = {
|
|
313
|
+
_id: fwd._id,
|
|
314
|
+
uid: fwd.uid,
|
|
315
|
+
username: fwdUsername,
|
|
316
|
+
created: new Date(fwd.created).toLocaleString(),
|
|
317
|
+
msg: fwd.msg || '',
|
|
318
|
+
type: fwd.type
|
|
319
|
+
};
|
|
320
|
+
if (fwd.forwardMessageId) {
|
|
321
|
+
extracted.forwardMessageId = fwd.forwardMessageId;
|
|
322
|
+
}
|
|
323
|
+
const nested = fwd.forwardMessage ? extractForwardedMessage(context, fwd.forwardMessage, depth + 1) : null;
|
|
324
|
+
if (nested) {
|
|
325
|
+
extracted.forwardMessage = nested;
|
|
326
|
+
}
|
|
327
|
+
return extracted;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Convert a raw discussion message into optimized form - strips base64 payloads, resolves usernames
|
|
331
|
+
*/
|
|
332
|
+
function optimizeMessage(context, msg) {
|
|
333
|
+
let cleanMsg = msg.msg || '';
|
|
334
|
+
if (cleanMsg) {
|
|
335
|
+
cleanMsg = cleanMsg.replace(/data:[^;]+;base64,[A-Za-z0-9+/=]+/g, '[FILE_REMOVED]');
|
|
336
|
+
cleanMsg = cleanMsg.replace(/!\[.*?\]\(data:[^)]+\)/g, '[IMAGE_REMOVED]');
|
|
337
|
+
}
|
|
338
|
+
const userInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, msg.uid);
|
|
339
|
+
let username = `User ${msg.uid}`;
|
|
340
|
+
if (userInfo) {
|
|
341
|
+
const fullName = `${userInfo.firstname || ''} ${userInfo.lastname || ''}`.trim();
|
|
342
|
+
username = fullName || userInfo.fullName || `User ${msg.uid}`;
|
|
343
|
+
}
|
|
344
|
+
const optimizedMsg = {
|
|
345
|
+
_id: msg._id,
|
|
346
|
+
uid: msg.uid,
|
|
347
|
+
username: username,
|
|
348
|
+
created: new Date(msg.created).toLocaleString(),
|
|
349
|
+
type: msg.type,
|
|
350
|
+
msg: cleanMsg
|
|
351
|
+
};
|
|
352
|
+
const isSystemWithoutText = msg.type !== 'user' && !msg.msg;
|
|
353
|
+
if (isSystemWithoutText) {
|
|
354
|
+
optimizedMsg.systemDescription = formatSystemMessage(msg);
|
|
355
|
+
}
|
|
356
|
+
if (isSystemWithoutText && msg.meta && Object.keys(msg.meta).length > 0) {
|
|
357
|
+
optimizedMsg.meta = msg.meta;
|
|
358
|
+
}
|
|
359
|
+
if (msg.replyTo) {
|
|
360
|
+
optimizedMsg.replyTo = msg.replyTo;
|
|
361
|
+
}
|
|
362
|
+
if (msg.forwardMessageId) {
|
|
363
|
+
optimizedMsg.forwardMessageId = msg.forwardMessageId;
|
|
364
|
+
}
|
|
365
|
+
const forwarded = msg.forwardMessage ? extractForwardedMessage(context, msg.forwardMessage, 0) : null;
|
|
366
|
+
if (forwarded) {
|
|
367
|
+
optimizedMsg.forwardMessage = forwarded;
|
|
368
|
+
}
|
|
369
|
+
return optimizedMsg;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Latest-messages branch of fetch_discussion_messages (no beforeMessageId)
|
|
373
|
+
*/
|
|
374
|
+
async function fetchLatestMessages(args, context) {
|
|
375
|
+
const limit = args.limit || 50;
|
|
376
|
+
let discussionId = args.discussionId;
|
|
377
|
+
logger.debug('Fetching discussion messages', {
|
|
378
|
+
discussionId: discussionId,
|
|
379
|
+
limit: limit,
|
|
380
|
+
includeLinkedActivity: !!args.includeLinkedActivity,
|
|
381
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
382
|
+
});
|
|
383
|
+
try {
|
|
384
|
+
// Auto-detect: if this is an activity ID, get its discussion ID
|
|
385
|
+
// Try fetching as discussion first, if it fails, check if it's an activity
|
|
386
|
+
let result;
|
|
387
|
+
try {
|
|
388
|
+
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
389
|
+
}
|
|
390
|
+
catch (firstError) {
|
|
391
|
+
// If first attempt fails, try loading as activity to get discussion ID
|
|
392
|
+
logger.debug('First fetch failed, checking if this is an activity ID', {
|
|
393
|
+
providedId: discussionId,
|
|
394
|
+
error: firstError?.msg || firstError?.message
|
|
395
|
+
});
|
|
396
|
+
const activity = await context.hailer.fetchActivityById(discussionId).catch(() => null);
|
|
397
|
+
if (!activity?.discussion) {
|
|
398
|
+
// Not an activity or no discussion linked, rethrow original error
|
|
399
|
+
throw firstError;
|
|
400
|
+
}
|
|
401
|
+
logger.debug('Auto-converted activity ID to discussion ID', {
|
|
402
|
+
activityId: discussionId,
|
|
403
|
+
discussionId: activity.discussion,
|
|
404
|
+
activityName: activity.name
|
|
405
|
+
});
|
|
406
|
+
discussionId = activity.discussion;
|
|
407
|
+
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
408
|
+
}
|
|
409
|
+
const messages = result.messages || [];
|
|
410
|
+
const messageCount = messages.length;
|
|
411
|
+
const userMessages = messages.filter((msg) => msg.type === 'user');
|
|
412
|
+
const recentMessage = messages[0];
|
|
413
|
+
const optimizedMessages = messages.map((msg) => optimizeMessage(context, msg));
|
|
414
|
+
const optimizedResult = {
|
|
415
|
+
oldestLoaded: result.oldestLoaded,
|
|
416
|
+
newestLoaded: result.newestLoaded,
|
|
417
|
+
messages: optimizedMessages
|
|
418
|
+
};
|
|
419
|
+
if (args.includeLinkedActivity) {
|
|
420
|
+
optimizedResult.linkedActivity = await safeLinkedActivityLookup(discussionId, context);
|
|
421
|
+
}
|
|
422
|
+
let responseText = `š¬ Successfully fetched ${messageCount} messages from discussion ${args.discussionId}`;
|
|
423
|
+
if (result.truncated) {
|
|
424
|
+
responseText += ` (limited from ${result.originalCount} available messages)`;
|
|
425
|
+
}
|
|
426
|
+
const recentSummary = recentMessage
|
|
427
|
+
? `"${recentMessage.msg || 'System event'}" at ${new Date(recentMessage.created).toLocaleString()}`
|
|
428
|
+
: 'No messages';
|
|
429
|
+
responseText += `\n\nš Summary:`;
|
|
430
|
+
responseText += `\n- ${userMessages.length} user messages`;
|
|
431
|
+
responseText += `\n- ${messages.length - userMessages.length} system messages (joins, activity creation, etc.)`;
|
|
432
|
+
responseText += `\n- Most recent: ${recentSummary}`;
|
|
433
|
+
responseText += `\n- Requested limit: ${limit} messages (API max: 50)`;
|
|
434
|
+
if (result.truncated) {
|
|
435
|
+
responseText += `\n- ā ļø More messages available: ${result.originalCount - limit} additional messages not shown`;
|
|
436
|
+
}
|
|
437
|
+
if (optimizedMessages.length > 0) {
|
|
438
|
+
const oldestMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
439
|
+
responseText += `\n\nš **PAGINATION**: To get older messages, call fetch_discussion_messages again with:`;
|
|
440
|
+
responseText += `\n- discussionId: "${discussionId}"`;
|
|
441
|
+
responseText += `\n- beforeMessageId: "${oldestMessage._id}"`;
|
|
442
|
+
responseText += `\n- batches: 1-10 (each batch = ~50 messages)`;
|
|
443
|
+
}
|
|
444
|
+
responseText += `\n\nš” Use this to understand conversation context, get project updates, or analyze team communications!`;
|
|
445
|
+
responseText += `\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
446
|
+
return {
|
|
447
|
+
content: [
|
|
448
|
+
{
|
|
449
|
+
type: 'text',
|
|
450
|
+
text: responseText,
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
457
|
+
logger.error('Error fetching discussion messages', error);
|
|
458
|
+
}
|
|
459
|
+
const errorMessage = error instanceof Error
|
|
460
|
+
? error.message
|
|
461
|
+
: (typeof error === 'object' && error !== null)
|
|
462
|
+
? JSON.stringify(error, null, 2)
|
|
463
|
+
: String(error);
|
|
464
|
+
const isPermissionError = errorMessage.toLowerCase().includes('permission') ||
|
|
465
|
+
errorMessage.toLowerCase().includes('access') ||
|
|
466
|
+
errorMessage.toLowerCase().includes('forbidden') ||
|
|
467
|
+
errorMessage.toLowerCase().includes('unauthorized');
|
|
468
|
+
let helpText = `ā Error fetching discussion messages: ${errorMessage}\n\n`;
|
|
469
|
+
if (isPermissionError) {
|
|
470
|
+
helpText += `š **PERMISSION REQUIRED**: You need to join this discussion before you can read messages.\n\n` +
|
|
471
|
+
`š” **Solution**: Use the join_discussion tool first:\n` +
|
|
472
|
+
` join_discussion(discussionId: "${args.discussionId}")\n\n`;
|
|
473
|
+
}
|
|
474
|
+
helpText += `š” Tips:\n` +
|
|
475
|
+
`- Make sure the discussion ID is correct (24-character string)\n` +
|
|
476
|
+
`- You must be a member/follower of the discussion to read messages\n` +
|
|
477
|
+
`- Some discussions may be private or require specific permissions\n\n` +
|
|
478
|
+
`Example discussion ID: '683ef53087e3d8329abaa3ad'`;
|
|
479
|
+
return {
|
|
480
|
+
content: [
|
|
481
|
+
{
|
|
482
|
+
type: 'text',
|
|
483
|
+
text: helpText,
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Older-messages branch of fetch_discussion_messages (beforeMessageId cursor)
|
|
491
|
+
*/
|
|
492
|
+
async function fetchPreviousMessages(args, context) {
|
|
493
|
+
const batches = args.batches || 1;
|
|
494
|
+
logger.debug('Fetching previous discussion messages', {
|
|
495
|
+
discussionId: args.discussionId,
|
|
496
|
+
beforeMessageId: args.beforeMessageId,
|
|
497
|
+
batches: batches,
|
|
498
|
+
includeLinkedActivity: !!args.includeLinkedActivity,
|
|
499
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
500
|
+
});
|
|
501
|
+
try {
|
|
502
|
+
const result = await context.hailer.fetchPreviousDiscussionMessages(args.beforeMessageId, batches);
|
|
503
|
+
const messages = result.messages || [];
|
|
504
|
+
const messageCount = messages.length;
|
|
505
|
+
const userMessages = messages.filter((msg) => msg.type === 'user');
|
|
506
|
+
const oldestMessage = messages.length > 0 ? messages[messages.length - 1] : null;
|
|
507
|
+
const optimizedMessages = messages.map((msg) => optimizeMessage(context, msg));
|
|
508
|
+
const optimizedResult = {
|
|
509
|
+
messages: optimizedMessages,
|
|
510
|
+
totalFetched: result.totalFetched,
|
|
511
|
+
batchesCompleted: result.batchesCompleted,
|
|
512
|
+
oldestMessageId: result.oldestMessageId,
|
|
513
|
+
hasMore: result.hasMore
|
|
514
|
+
};
|
|
515
|
+
if (args.includeLinkedActivity) {
|
|
516
|
+
optimizedResult.linkedActivity = await safeLinkedActivityLookup(args.discussionId, context);
|
|
517
|
+
}
|
|
518
|
+
let responseText = `š¬ Successfully fetched ${messageCount} previous messages`;
|
|
519
|
+
responseText += `\n\nš Summary:`;
|
|
520
|
+
responseText += `\n- ${userMessages.length} user messages`;
|
|
521
|
+
responseText += `\n- ${messages.length - userMessages.length} system messages`;
|
|
522
|
+
responseText += `\n- Batches completed: ${result.batchesCompleted}/${batches}`;
|
|
523
|
+
responseText += `\n- Total messages fetched: ${result.totalFetched}`;
|
|
524
|
+
if (oldestMessage) {
|
|
525
|
+
const oldestSummary = `"${oldestMessage.msg || 'System event'}" at ${new Date(oldestMessage.created).toLocaleString()}`;
|
|
526
|
+
responseText += `\n- Oldest message: ${oldestSummary}`;
|
|
527
|
+
}
|
|
528
|
+
if (result.hasMore && optimizedMessages.length > 0) {
|
|
529
|
+
const oldestOptimizedMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
530
|
+
responseText += `\n\nš **CONTINUE PAGINATION**: To get even older messages, call fetch_discussion_messages with:`;
|
|
531
|
+
responseText += `\n- discussionId: "${args.discussionId}"`;
|
|
532
|
+
responseText += `\n- beforeMessageId: "${oldestOptimizedMessage._id}"`;
|
|
533
|
+
responseText += `\n- batches: 1-10 (for more history)`;
|
|
534
|
+
}
|
|
535
|
+
if (!result.hasMore) {
|
|
536
|
+
responseText += `\n\nā
**END OF HISTORY**: No more messages available in this discussion.`;
|
|
537
|
+
}
|
|
538
|
+
responseText += `\n\nš” Use this to explore conversation history and understand context!`;
|
|
539
|
+
responseText += `\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
540
|
+
return {
|
|
541
|
+
content: [
|
|
542
|
+
{
|
|
543
|
+
type: 'text',
|
|
544
|
+
text: responseText,
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
catch (error) {
|
|
550
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
551
|
+
logger.error('Error fetching previous discussion messages', error);
|
|
552
|
+
}
|
|
553
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
554
|
+
const helpText = `ā Error fetching previous discussion messages: ${errorMessage}\n\n` +
|
|
555
|
+
`š” **IMPORTANT**: beforeMessageId must be a MESSAGE ID, not a DISCUSSION ID!\n\n` +
|
|
556
|
+
`**How to get the correct beforeMessageId:**\n` +
|
|
557
|
+
`1. First call fetch_discussion_messages with only your discussionId\n` +
|
|
558
|
+
`2. Look at the last message in the results\n` +
|
|
559
|
+
`3. Use that message's '_id' field as beforeMessageId\n\n` +
|
|
560
|
+
`**Example:**\n` +
|
|
561
|
+
`- ā Wrong: "682dcfa9d36a4907a88bb279" (this is a discussion ID)\n` +
|
|
562
|
+
`- ā
Correct: "68e5c1903b104307efdebce9" (this is a message ID)\n\n` +
|
|
563
|
+
`Message IDs are usually different from discussion IDs!`;
|
|
564
|
+
return {
|
|
565
|
+
content: [
|
|
566
|
+
{
|
|
567
|
+
type: 'text',
|
|
568
|
+
text: helpText,
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
const fetchDiscussionMessagesDescription = 'Read messages from any Hailer discussion/chat (up to 50 per batch - API limit). ' +
|
|
575
|
+
"Latest messages by default; pass beforeMessageId (a message '_id' from a previous result) to page back through older history. " +
|
|
576
|
+
'Optionally set includeLinkedActivity to also return the activity linked to the discussion';
|
|
243
577
|
exports.fetchDiscussionMessagesTool = {
|
|
244
578
|
name: 'fetch_discussion_messages',
|
|
245
579
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -247,337 +581,47 @@ exports.fetchDiscussionMessagesTool = {
|
|
|
247
581
|
schema: zod_1.z.object({
|
|
248
582
|
discussionId: zod_1.z
|
|
249
583
|
.string()
|
|
250
|
-
.min(24,
|
|
251
|
-
.describe("The discussion ID to read messages from. You can get this from activity results (look for 'discussion' field)
|
|
584
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
585
|
+
.describe("The discussion ID to read messages from. You can get this from activity results (look for 'discussion' field) " +
|
|
586
|
+
'or from URLs like https://app.hailer.com/#/discussions/DISCUSSION_ID'),
|
|
252
587
|
limit: zod_1.z
|
|
253
588
|
.number()
|
|
254
589
|
.int()
|
|
255
|
-
.min(1,
|
|
256
|
-
.max(50,
|
|
590
|
+
.min(1, 'Limit must be at least 1')
|
|
591
|
+
.max(50, 'Limit cannot exceed 50 messages (API maximum)')
|
|
257
592
|
.default(50)
|
|
258
593
|
.optional()
|
|
259
|
-
.describe(
|
|
260
|
-
|
|
261
|
-
async execute(args, context) {
|
|
262
|
-
const limit = args.limit || 50;
|
|
263
|
-
let discussionId = args.discussionId;
|
|
264
|
-
logger.debug('Fetching discussion messages', {
|
|
265
|
-
discussionId: discussionId,
|
|
266
|
-
limit: limit,
|
|
267
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
268
|
-
});
|
|
269
|
-
try {
|
|
270
|
-
// Auto-detect: if this is an activity ID, get its discussion ID
|
|
271
|
-
// Try fetching as discussion first, if it fails, check if it's an activity
|
|
272
|
-
let result;
|
|
273
|
-
try {
|
|
274
|
-
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
275
|
-
}
|
|
276
|
-
catch (firstError) {
|
|
277
|
-
// If first attempt fails, try loading as activity to get discussion ID
|
|
278
|
-
logger.debug('First fetch failed, checking if this is an activity ID', {
|
|
279
|
-
providedId: discussionId,
|
|
280
|
-
error: firstError?.msg || firstError?.message
|
|
281
|
-
});
|
|
282
|
-
try {
|
|
283
|
-
const activity = await context.hailer.fetchActivityById(discussionId);
|
|
284
|
-
if (activity?.discussion) {
|
|
285
|
-
logger.debug('Auto-converted activity ID to discussion ID', {
|
|
286
|
-
activityId: discussionId,
|
|
287
|
-
discussionId: activity.discussion,
|
|
288
|
-
activityName: activity.name
|
|
289
|
-
});
|
|
290
|
-
discussionId = activity.discussion;
|
|
291
|
-
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
// Not an activity or no discussion linked, rethrow original error
|
|
295
|
-
throw firstError;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
catch (activityError) {
|
|
299
|
-
// Activity lookup failed too, rethrow original error
|
|
300
|
-
throw firstError;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
const messages = result.messages || [];
|
|
304
|
-
const messageCount = messages.length;
|
|
305
|
-
const userMessages = messages.filter((m) => m.type === "user");
|
|
306
|
-
const recentMessage = messages[0];
|
|
307
|
-
function extractForwardedMessage(fwd, depth = 0) {
|
|
308
|
-
if (depth > 10)
|
|
309
|
-
return null;
|
|
310
|
-
const fwdUserInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, fwd.uid);
|
|
311
|
-
let fwdUsername = `User ${fwd.uid}`;
|
|
312
|
-
if (fwdUserInfo) {
|
|
313
|
-
const fullName = `${fwdUserInfo.firstname || ''} ${fwdUserInfo.lastname || ''}`.trim();
|
|
314
|
-
fwdUsername = fullName || fwdUserInfo.fullName || `User ${fwd.uid}`;
|
|
315
|
-
}
|
|
316
|
-
const extracted = {
|
|
317
|
-
_id: fwd._id,
|
|
318
|
-
uid: fwd.uid,
|
|
319
|
-
username: fwdUsername,
|
|
320
|
-
created: new Date(fwd.created).toLocaleString(),
|
|
321
|
-
msg: fwd.msg || '',
|
|
322
|
-
type: fwd.type
|
|
323
|
-
};
|
|
324
|
-
if (fwd.forwardMessageId)
|
|
325
|
-
extracted.forwardMessageId = fwd.forwardMessageId;
|
|
326
|
-
if (fwd.forwardMessage) {
|
|
327
|
-
const nested = extractForwardedMessage(fwd.forwardMessage, depth + 1);
|
|
328
|
-
if (nested)
|
|
329
|
-
extracted.forwardMessage = nested;
|
|
330
|
-
}
|
|
331
|
-
return extracted;
|
|
332
|
-
}
|
|
333
|
-
const optimizedMessages = messages.map((msg) => {
|
|
334
|
-
let cleanMsg = msg.msg || '';
|
|
335
|
-
if (cleanMsg) {
|
|
336
|
-
cleanMsg = cleanMsg.replace(/data:[^;]+;base64,[A-Za-z0-9+/=]+/g, '[FILE_REMOVED]');
|
|
337
|
-
cleanMsg = cleanMsg.replace(/!\[.*?\]\(data:[^)]+\)/g, '[IMAGE_REMOVED]');
|
|
338
|
-
}
|
|
339
|
-
const userInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, msg.uid);
|
|
340
|
-
let username = `User ${msg.uid}`;
|
|
341
|
-
if (userInfo) {
|
|
342
|
-
const fullName = `${userInfo.firstname || ''} ${userInfo.lastname || ''}`.trim();
|
|
343
|
-
username = fullName || userInfo.fullName || `User ${msg.uid}`;
|
|
344
|
-
}
|
|
345
|
-
const optimizedMsg = {
|
|
346
|
-
_id: msg._id,
|
|
347
|
-
uid: msg.uid,
|
|
348
|
-
username: username,
|
|
349
|
-
created: new Date(msg.created).toLocaleString(),
|
|
350
|
-
type: msg.type,
|
|
351
|
-
msg: cleanMsg
|
|
352
|
-
};
|
|
353
|
-
if (msg.type !== 'user' && !msg.msg) {
|
|
354
|
-
optimizedMsg.systemDescription = formatSystemMessage(msg);
|
|
355
|
-
if (msg.meta && Object.keys(msg.meta).length > 0) {
|
|
356
|
-
optimizedMsg.meta = msg.meta;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
if (msg.replyTo) {
|
|
360
|
-
optimizedMsg.replyTo = msg.replyTo;
|
|
361
|
-
}
|
|
362
|
-
if (msg.forwardMessageId) {
|
|
363
|
-
optimizedMsg.forwardMessageId = msg.forwardMessageId;
|
|
364
|
-
}
|
|
365
|
-
if (msg.forwardMessage) {
|
|
366
|
-
const forwarded = extractForwardedMessage(msg.forwardMessage, 0);
|
|
367
|
-
if (forwarded)
|
|
368
|
-
optimizedMsg.forwardMessage = forwarded;
|
|
369
|
-
}
|
|
370
|
-
return optimizedMsg;
|
|
371
|
-
});
|
|
372
|
-
const optimizedResult = {
|
|
373
|
-
oldestLoaded: result.oldestLoaded,
|
|
374
|
-
newestLoaded: result.newestLoaded,
|
|
375
|
-
messages: optimizedMessages
|
|
376
|
-
};
|
|
377
|
-
let responseText = `š¬ Successfully fetched ${messageCount} messages from discussion ${args.discussionId}`;
|
|
378
|
-
if (result.truncated) {
|
|
379
|
-
responseText += ` (limited from ${result.originalCount} available messages)`;
|
|
380
|
-
}
|
|
381
|
-
responseText += `\n\nš Summary:\n- ${userMessages.length} user messages\n- ${messages.length - userMessages.length} system messages (joins, activity creation, etc.)\n- Most recent: ${recentMessage ? `"${recentMessage.msg || "System event"}" at ${new Date(recentMessage.created).toLocaleString()}` : "No messages"}`;
|
|
382
|
-
responseText += `\n- Requested limit: ${limit} messages (API max: 50)`;
|
|
383
|
-
if (result.truncated) {
|
|
384
|
-
responseText += `\n- ā ļø More messages available: ${result.originalCount - limit} additional messages not shown`;
|
|
385
|
-
}
|
|
386
|
-
if (optimizedMessages.length > 0) {
|
|
387
|
-
const oldestMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
388
|
-
responseText += `\n\nš **PAGINATION**: To get older messages, use fetch_previous_discussion_messages with:`;
|
|
389
|
-
responseText += `\n- oldestMessageId: "${oldestMessage._id}"`;
|
|
390
|
-
responseText += `\n- batches: 1-10 (each batch = ~50 messages)`;
|
|
391
|
-
}
|
|
392
|
-
responseText += `\n\nš” Use this to understand conversation context, get project updates, or analyze team communications!\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
393
|
-
return {
|
|
394
|
-
content: [
|
|
395
|
-
{
|
|
396
|
-
type: "text",
|
|
397
|
-
text: responseText,
|
|
398
|
-
},
|
|
399
|
-
],
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
catch (error) {
|
|
403
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
404
|
-
logger.error("Error fetching discussion messages", error);
|
|
405
|
-
const errorMessage = error instanceof Error
|
|
406
|
-
? error.message
|
|
407
|
-
: (typeof error === 'object' && error !== null)
|
|
408
|
-
? JSON.stringify(error, null, 2)
|
|
409
|
-
: String(error);
|
|
410
|
-
const isPermissionError = errorMessage.toLowerCase().includes('permission') ||
|
|
411
|
-
errorMessage.toLowerCase().includes('access') ||
|
|
412
|
-
errorMessage.toLowerCase().includes('forbidden') ||
|
|
413
|
-
errorMessage.toLowerCase().includes('unauthorized');
|
|
414
|
-
let helpText = `ā Error fetching discussion messages: ${errorMessage}\n\n`;
|
|
415
|
-
if (isPermissionError) {
|
|
416
|
-
helpText += `š **PERMISSION REQUIRED**: You need to join this discussion before you can read messages.\n\n` +
|
|
417
|
-
`š” **Solution**: Use the join_discussion tool first:\n` +
|
|
418
|
-
` join_discussion(discussionId: "${args.discussionId}")\n\n`;
|
|
419
|
-
}
|
|
420
|
-
helpText += `š” Tips:\n` +
|
|
421
|
-
`- Make sure the discussion ID is correct (24-character string)\n` +
|
|
422
|
-
`- You must be a member/follower of the discussion to read messages\n` +
|
|
423
|
-
`- Some discussions may be private or require specific permissions\n\n` +
|
|
424
|
-
`Example discussion ID: '683ef53087e3d8329abaa3ad'`;
|
|
425
|
-
return {
|
|
426
|
-
content: [
|
|
427
|
-
{
|
|
428
|
-
type: "text",
|
|
429
|
-
text: helpText,
|
|
430
|
-
},
|
|
431
|
-
],
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
};
|
|
436
|
-
// ============================================================================
|
|
437
|
-
// TOOL 3: FETCH PREVIOUS DISCUSSION MESSAGES
|
|
438
|
-
// ============================================================================
|
|
439
|
-
const fetchPreviousDiscussionMessagesDescription = `Fetch older messages from a discussion using pagination - requires a message ID from previous results to continue from`;
|
|
440
|
-
exports.fetchPreviousDiscussionMessagesTool = {
|
|
441
|
-
name: 'fetch_previous_discussion_messages',
|
|
442
|
-
group: tool_registry_1.ToolGroup.READ,
|
|
443
|
-
description: fetchPreviousDiscussionMessagesDescription,
|
|
444
|
-
schema: zod_1.z.object({
|
|
445
|
-
oldestMessageId: zod_1.z
|
|
594
|
+
.describe('Number of messages to fetch (default: 50, max: 50 due to API limit). Use beforeMessageId for older messages'),
|
|
595
|
+
beforeMessageId: zod_1.z
|
|
446
596
|
.string()
|
|
447
|
-
.min(24,
|
|
448
|
-
.
|
|
597
|
+
.min(24, 'Message ID must be at least 24 characters')
|
|
598
|
+
.optional()
|
|
599
|
+
.describe("Pagination cursor: the '_id' of the oldest message from a previous fetch (a MESSAGE ID, not a discussion ID). " +
|
|
600
|
+
'When set, fetches messages older than this message'),
|
|
449
601
|
batches: zod_1.z
|
|
450
602
|
.number()
|
|
451
603
|
.int()
|
|
452
|
-
.min(1,
|
|
453
|
-
.max(10,
|
|
604
|
+
.min(1, 'Batches must be at least 1')
|
|
605
|
+
.max(10, 'Cannot fetch more than 10 batches at once')
|
|
454
606
|
.default(1)
|
|
455
607
|
.optional()
|
|
456
|
-
.describe(
|
|
608
|
+
.describe('Number of older message batches to fetch (default: 1, max: 10). Each batch contains up to 50 messages. ' +
|
|
609
|
+
'Only used together with beforeMessageId'),
|
|
610
|
+
includeLinkedActivity: zod_1.z
|
|
611
|
+
.boolean()
|
|
612
|
+
.optional()
|
|
613
|
+
.describe('Set true to include the activity linked to this discussion ({ activityId, name, workflowId } or null). ' +
|
|
614
|
+
'Costs an extra API call (default: false)')
|
|
457
615
|
}),
|
|
458
616
|
async execute(args, context) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
oldestMessageId: args.oldestMessageId,
|
|
462
|
-
batches: batches,
|
|
463
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
464
|
-
});
|
|
465
|
-
try {
|
|
466
|
-
const result = await context.hailer.fetchPreviousDiscussionMessages(args.oldestMessageId, batches);
|
|
467
|
-
const messages = result.messages || [];
|
|
468
|
-
const messageCount = messages.length;
|
|
469
|
-
const userMessages = messages.filter((m) => m.type === "user");
|
|
470
|
-
const oldestMessage = messages.length > 0 ? messages[messages.length - 1] : null;
|
|
471
|
-
function extractForwardedMessage(fwd, depth = 0) {
|
|
472
|
-
if (depth > 10)
|
|
473
|
-
return null;
|
|
474
|
-
const fwdUserInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, fwd.uid);
|
|
475
|
-
let fwdUsername = `User ${fwd.uid}`;
|
|
476
|
-
if (fwdUserInfo) {
|
|
477
|
-
const fullName = `${fwdUserInfo.firstname || ''} ${fwdUserInfo.lastname || ''}`.trim();
|
|
478
|
-
fwdUsername = fullName || fwdUserInfo.fullName || `User ${fwd.uid}`;
|
|
479
|
-
}
|
|
480
|
-
const extracted = {
|
|
481
|
-
_id: fwd._id,
|
|
482
|
-
uid: fwd.uid,
|
|
483
|
-
username: fwdUsername,
|
|
484
|
-
created: new Date(fwd.created).toLocaleString(),
|
|
485
|
-
msg: fwd.msg || '',
|
|
486
|
-
type: fwd.type
|
|
487
|
-
};
|
|
488
|
-
if (fwd.forwardMessageId)
|
|
489
|
-
extracted.forwardMessageId = fwd.forwardMessageId;
|
|
490
|
-
if (fwd.forwardMessage) {
|
|
491
|
-
const nested = extractForwardedMessage(fwd.forwardMessage, depth + 1);
|
|
492
|
-
if (nested)
|
|
493
|
-
extracted.forwardMessage = nested;
|
|
494
|
-
}
|
|
495
|
-
return extracted;
|
|
496
|
-
}
|
|
497
|
-
const optimizedMessages = messages.map((msg) => {
|
|
498
|
-
let cleanMsg = msg.msg || '';
|
|
499
|
-
if (cleanMsg) {
|
|
500
|
-
cleanMsg = cleanMsg.replace(/data:[^;]+;base64,[A-Za-z0-9+/=]+/g, '[FILE_REMOVED]');
|
|
501
|
-
cleanMsg = cleanMsg.replace(/!\[.*?\]\(data:[^)]+\)/g, '[IMAGE_REMOVED]');
|
|
502
|
-
}
|
|
503
|
-
const userInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, msg.uid);
|
|
504
|
-
let username = `User ${msg.uid}`;
|
|
505
|
-
if (userInfo) {
|
|
506
|
-
const fullName = `${userInfo.firstname || ''} ${userInfo.lastname || ''}`.trim();
|
|
507
|
-
username = fullName || userInfo.fullName || `User ${msg.uid}`;
|
|
508
|
-
}
|
|
509
|
-
const optimizedMsg = {
|
|
510
|
-
_id: msg._id,
|
|
511
|
-
uid: msg.uid,
|
|
512
|
-
username: username,
|
|
513
|
-
created: new Date(msg.created).toLocaleString(),
|
|
514
|
-
type: msg.type || 'user',
|
|
515
|
-
msg: cleanMsg
|
|
516
|
-
};
|
|
517
|
-
if (msg.replyTo) {
|
|
518
|
-
optimizedMsg.replyTo = msg.replyTo;
|
|
519
|
-
}
|
|
520
|
-
if (msg.forwardMessageId) {
|
|
521
|
-
optimizedMsg.forwardMessageId = msg.forwardMessageId;
|
|
522
|
-
}
|
|
523
|
-
if (msg.forwardMessage) {
|
|
524
|
-
const forwarded = extractForwardedMessage(msg.forwardMessage, 0);
|
|
525
|
-
if (forwarded)
|
|
526
|
-
optimizedMsg.forwardMessage = forwarded;
|
|
527
|
-
}
|
|
528
|
-
return optimizedMsg;
|
|
529
|
-
});
|
|
530
|
-
const optimizedResult = {
|
|
531
|
-
messages: optimizedMessages,
|
|
532
|
-
totalFetched: result.totalFetched,
|
|
533
|
-
batchesCompleted: result.batchesCompleted,
|
|
534
|
-
oldestMessageId: result.oldestMessageId,
|
|
535
|
-
hasMore: result.hasMore
|
|
536
|
-
};
|
|
537
|
-
let responseText = `š¬ Successfully fetched ${messageCount} previous messages`;
|
|
538
|
-
responseText += `\n\nš Summary:`;
|
|
539
|
-
responseText += `\n- ${userMessages.length} user messages`;
|
|
540
|
-
responseText += `\n- ${messages.length - userMessages.length} system messages`;
|
|
541
|
-
responseText += `\n- Batches completed: ${result.batchesCompleted}/${batches}`;
|
|
542
|
-
responseText += `\n- Total messages fetched: ${result.totalFetched}`;
|
|
543
|
-
if (oldestMessage) {
|
|
544
|
-
responseText += `\n- Oldest message: "${oldestMessage.msg || 'System event'}" at ${new Date(oldestMessage.created).toLocaleString()}`;
|
|
545
|
-
}
|
|
546
|
-
if (result.hasMore && optimizedMessages.length > 0) {
|
|
547
|
-
const oldestOptimizedMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
548
|
-
responseText += `\n\nš **CONTINUE PAGINATION**: To get even older messages:`;
|
|
549
|
-
responseText += `\n- oldestMessageId: "${oldestOptimizedMessage._id}"`;
|
|
550
|
-
responseText += `\n- batches: 1-10 (for more history)`;
|
|
551
|
-
}
|
|
552
|
-
else if (!result.hasMore) {
|
|
553
|
-
responseText += `\n\nā
**END OF HISTORY**: No more messages available in this discussion.`;
|
|
554
|
-
}
|
|
555
|
-
responseText += `\n\nš” Use this to explore conversation history and understand context!\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
556
|
-
return {
|
|
557
|
-
content: [
|
|
558
|
-
{
|
|
559
|
-
type: "text",
|
|
560
|
-
text: responseText,
|
|
561
|
-
},
|
|
562
|
-
],
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
catch (error) {
|
|
566
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
567
|
-
logger.error("Error fetching previous discussion messages", error);
|
|
568
|
-
return {
|
|
569
|
-
content: [
|
|
570
|
-
{
|
|
571
|
-
type: "text",
|
|
572
|
-
text: `ā Error fetching previous discussion messages: ${error instanceof Error ? error.message : String(error)}\n\nš” **IMPORTANT**: Make sure you're using a MESSAGE ID, not a DISCUSSION ID!\n\n**How to get the correct oldestMessageId:**\n1. First call fetch_discussion_messages with your discussionId\n2. Look at the last message in the results\n3. Use that message's '_id' field as oldestMessageId\n\n**Example:**\n- ā Wrong: "682dcfa9d36a4907a88bb279" (this is a discussion ID)\n- ā
Correct: "68e5c1903b104307efdebce9" (this is a message ID)\n\nMessage IDs are usually different from discussion IDs!`,
|
|
573
|
-
},
|
|
574
|
-
],
|
|
575
|
-
};
|
|
617
|
+
if (args.beforeMessageId) {
|
|
618
|
+
return fetchPreviousMessages(args, context);
|
|
576
619
|
}
|
|
620
|
+
return fetchLatestMessages(args, context);
|
|
577
621
|
},
|
|
578
622
|
};
|
|
579
623
|
// ============================================================================
|
|
580
|
-
// TOOL
|
|
624
|
+
// TOOL 3: JOIN DISCUSSION
|
|
581
625
|
// ============================================================================
|
|
582
626
|
const joinDiscussionDescription = `<purpose>Bot joins a discussion and optionally invites ONE user</purpose>
|
|
583
627
|
<when-to-use>
|
|
@@ -599,30 +643,30 @@ exports.joinDiscussionTool = {
|
|
|
599
643
|
schema: zod_1.z.object({
|
|
600
644
|
activityId: zod_1.z
|
|
601
645
|
.string()
|
|
602
|
-
.min(24,
|
|
646
|
+
.min(24, 'Activity ID must be at least 24 characters')
|
|
603
647
|
.optional()
|
|
604
|
-
.describe(
|
|
648
|
+
.describe('Activity ID to join its discussion (preferred method for activity discussions)'),
|
|
605
649
|
discussionId: zod_1.z
|
|
606
650
|
.string()
|
|
607
|
-
.min(24,
|
|
651
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
608
652
|
.optional()
|
|
609
|
-
.describe(
|
|
653
|
+
.describe('Discussion ID to join directly (use this for non-activity discussions)'),
|
|
610
654
|
inviteUserId: zod_1.z
|
|
611
655
|
.string()
|
|
612
|
-
.min(24,
|
|
656
|
+
.min(24, 'User ID must be at least 24 characters')
|
|
613
657
|
.optional()
|
|
614
|
-
.describe(
|
|
658
|
+
.describe('User ID to invite. Get from incoming message user_id attribute when user asks to be invited.'),
|
|
615
659
|
welcomeReason: zod_1.z
|
|
616
660
|
.string()
|
|
617
661
|
.optional()
|
|
618
|
-
.describe(
|
|
662
|
+
.describe('Context/reason for the invite - posted as welcome message in the discussion.'),
|
|
619
663
|
sourceActivityId: zod_1.z
|
|
620
664
|
.string()
|
|
621
665
|
.min(24)
|
|
622
666
|
.optional()
|
|
623
667
|
.describe("IMPORTANT: The activity_id from the CURRENT discussion where the request was made. This creates a 'came from' link in the welcome message. Get this from the incoming message's activity_id attribute.")
|
|
624
668
|
}).refine((data) => data.activityId || data.discussionId, {
|
|
625
|
-
message:
|
|
669
|
+
message: 'Either activityId or discussionId must be provided'
|
|
626
670
|
}),
|
|
627
671
|
async execute(args, context) {
|
|
628
672
|
logger.debug('Joining discussion', {
|
|
@@ -694,7 +738,7 @@ exports.joinDiscussionTool = {
|
|
|
694
738
|
else {
|
|
695
739
|
return {
|
|
696
740
|
content: [{
|
|
697
|
-
type:
|
|
741
|
+
type: 'text',
|
|
698
742
|
text: `ā Error: Either activityId or discussionId must be provided`,
|
|
699
743
|
}],
|
|
700
744
|
};
|
|
@@ -819,14 +863,15 @@ exports.joinDiscussionTool = {
|
|
|
819
863
|
}
|
|
820
864
|
return {
|
|
821
865
|
content: [{
|
|
822
|
-
type:
|
|
866
|
+
type: 'text',
|
|
823
867
|
text: responseText,
|
|
824
868
|
}],
|
|
825
869
|
};
|
|
826
870
|
}
|
|
827
871
|
catch (error) {
|
|
828
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
829
|
-
logger.error(
|
|
872
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
873
|
+
logger.error('Error joining discussion', error);
|
|
874
|
+
}
|
|
830
875
|
const errorMessage = error instanceof Error
|
|
831
876
|
? error.message
|
|
832
877
|
: (typeof error === 'object' && error !== null)
|
|
@@ -835,7 +880,7 @@ exports.joinDiscussionTool = {
|
|
|
835
880
|
return {
|
|
836
881
|
content: [
|
|
837
882
|
{
|
|
838
|
-
type:
|
|
883
|
+
type: 'text',
|
|
839
884
|
text: `ā Error joining discussion: ${errorMessage}\n\n` +
|
|
840
885
|
`š” Troubleshooting:\n` +
|
|
841
886
|
`- For activity discussions: Use join_discussion(activityId: "...")\n` +
|
|
@@ -853,7 +898,7 @@ exports.joinDiscussionTool = {
|
|
|
853
898
|
},
|
|
854
899
|
};
|
|
855
900
|
// ============================================================================
|
|
856
|
-
// TOOL
|
|
901
|
+
// TOOL 4: LEAVE DISCUSSION
|
|
857
902
|
// ============================================================================
|
|
858
903
|
const leaveDiscussionDescription = `Leave a discussion - Bot removes itself from a discussion.
|
|
859
904
|
|
|
@@ -873,20 +918,20 @@ exports.leaveDiscussionTool = {
|
|
|
873
918
|
schema: zod_1.z.object({
|
|
874
919
|
activityId: zod_1.z
|
|
875
920
|
.string()
|
|
876
|
-
.min(24,
|
|
921
|
+
.min(24, 'Activity ID must be at least 24 characters')
|
|
877
922
|
.optional()
|
|
878
|
-
.describe(
|
|
923
|
+
.describe('Activity ID to leave its discussion (preferred method for activity discussions)'),
|
|
879
924
|
discussionId: zod_1.z
|
|
880
925
|
.string()
|
|
881
|
-
.min(24,
|
|
926
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
882
927
|
.optional()
|
|
883
|
-
.describe(
|
|
928
|
+
.describe('Discussion ID to leave directly')
|
|
884
929
|
}).refine((data) => data.activityId || data.discussionId, {
|
|
885
|
-
message:
|
|
930
|
+
message: 'Either activityId or discussionId must be provided'
|
|
886
931
|
}),
|
|
887
932
|
async execute(args, context) {
|
|
888
933
|
// DEBUG: Log raw input to diagnose LLM tool calling issues
|
|
889
|
-
logger.debug(
|
|
934
|
+
logger.debug('leave_discussion called', {
|
|
890
935
|
hasActivityId: !!args.activityId,
|
|
891
936
|
hasDiscussionId: !!args.discussionId,
|
|
892
937
|
activityId: args.activityId || '(not provided)',
|
|
@@ -906,7 +951,7 @@ exports.leaveDiscussionTool = {
|
|
|
906
951
|
return {
|
|
907
952
|
content: [
|
|
908
953
|
{
|
|
909
|
-
type:
|
|
954
|
+
type: 'text',
|
|
910
955
|
text: `ā
Successfully left activity discussion!\n\n` +
|
|
911
956
|
`š **Activity**: ${activity.name || args.activityId}\n` +
|
|
912
957
|
`š¬ **Discussion ID**: ${discussionId}\n` +
|
|
@@ -925,7 +970,7 @@ exports.leaveDiscussionTool = {
|
|
|
925
970
|
return {
|
|
926
971
|
content: [
|
|
927
972
|
{
|
|
928
|
-
type:
|
|
973
|
+
type: 'text',
|
|
929
974
|
text: `ā
Successfully left discussion!\n\n` +
|
|
930
975
|
`š¬ **Discussion ID**: ${args.discussionId}\n\n` +
|
|
931
976
|
`š You will no longer receive notifications from this discussion.\n\n` +
|
|
@@ -938,15 +983,16 @@ exports.leaveDiscussionTool = {
|
|
|
938
983
|
return {
|
|
939
984
|
content: [
|
|
940
985
|
{
|
|
941
|
-
type:
|
|
986
|
+
type: 'text',
|
|
942
987
|
text: `ā Error: Either activityId or discussionId must be provided`,
|
|
943
988
|
},
|
|
944
989
|
],
|
|
945
990
|
};
|
|
946
991
|
}
|
|
947
992
|
catch (error) {
|
|
948
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
949
|
-
logger.error(
|
|
993
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
994
|
+
logger.error('Error leaving discussion', error);
|
|
995
|
+
}
|
|
950
996
|
const errorMessage = error instanceof Error
|
|
951
997
|
? error.message
|
|
952
998
|
: (typeof error === 'object' && error !== null)
|
|
@@ -955,7 +1001,7 @@ exports.leaveDiscussionTool = {
|
|
|
955
1001
|
return {
|
|
956
1002
|
content: [
|
|
957
1003
|
{
|
|
958
|
-
type:
|
|
1004
|
+
type: 'text',
|
|
959
1005
|
text: `ā Error leaving discussion: ${errorMessage}\n\n` +
|
|
960
1006
|
`š” Troubleshooting:\n` +
|
|
961
1007
|
`- For activity discussions: Use leave_discussion(activityId: "...")\n` +
|
|
@@ -973,7 +1019,7 @@ exports.leaveDiscussionTool = {
|
|
|
973
1019
|
},
|
|
974
1020
|
};
|
|
975
1021
|
// ============================================================================
|
|
976
|
-
// TOOL
|
|
1022
|
+
// TOOL 5: ADD DISCUSSION MESSAGE
|
|
977
1023
|
// ============================================================================
|
|
978
1024
|
const addDiscussionMessageDescription = `Post a message to a Hailer discussion with optional file attachments - AI agents can participate in conversations`;
|
|
979
1025
|
exports.addDiscussionMessageTool = {
|
|
@@ -981,9 +1027,9 @@ exports.addDiscussionMessageTool = {
|
|
|
981
1027
|
group: tool_registry_1.ToolGroup.WRITE,
|
|
982
1028
|
description: addDiscussionMessageDescription,
|
|
983
1029
|
schema: zod_1.z.object({
|
|
984
|
-
discussionId: zod_1.z.string().min(24,
|
|
985
|
-
content: zod_1.z.string().min(1,
|
|
986
|
-
fileIds: zod_1.z.array(zod_1.z.string()).optional().describe(
|
|
1030
|
+
discussionId: zod_1.z.string().min(24, 'Discussion ID must be at least 24 characters').describe('The discussion ID where to post the message'),
|
|
1031
|
+
content: zod_1.z.string().min(1, 'Message content cannot be empty').describe('The message text to post'),
|
|
1032
|
+
fileIds: zod_1.z.array(zod_1.z.string()).optional().describe('Optional array of file IDs to attach (from upload_files tool)')
|
|
987
1033
|
}),
|
|
988
1034
|
async execute(args, context) {
|
|
989
1035
|
try {
|
|
@@ -996,7 +1042,7 @@ exports.addDiscussionMessageTool = {
|
|
|
996
1042
|
return {
|
|
997
1043
|
content: [
|
|
998
1044
|
{
|
|
999
|
-
type:
|
|
1045
|
+
type: 'text',
|
|
1000
1046
|
text: responseText,
|
|
1001
1047
|
},
|
|
1002
1048
|
],
|
|
@@ -1006,7 +1052,7 @@ exports.addDiscussionMessageTool = {
|
|
|
1006
1052
|
return {
|
|
1007
1053
|
content: [
|
|
1008
1054
|
{
|
|
1009
|
-
type:
|
|
1055
|
+
type: 'text',
|
|
1010
1056
|
text: `ā Error posting message: ${error instanceof Error ? error.message : (typeof error === 'object' ? JSON.stringify(error) : String(error))}\n\nš” Tips:\n- Make sure the discussion ID is correct (24-character string)\n- Check that you have permission to post to this discussion\n- Verify the discussion exists and is accessible\n- If attaching files, ensure file IDs are valid (from upload_files tool)\n\nExample discussion ID: '683ef53087e3d8329abaa3ad'`,
|
|
1011
1057
|
},
|
|
1012
1058
|
],
|
|
@@ -1015,7 +1061,7 @@ exports.addDiscussionMessageTool = {
|
|
|
1015
1061
|
},
|
|
1016
1062
|
};
|
|
1017
1063
|
// ============================================================================
|
|
1018
|
-
// TOOL
|
|
1064
|
+
// TOOL 6: INVITE DISCUSSION MEMBERS
|
|
1019
1065
|
// ============================================================================
|
|
1020
1066
|
const inviteDiscussionMembersDescription = `<purpose>Invite users to a discussion WITHOUT the bot joining. Use this to add people to activity discussions.</purpose>
|
|
1021
1067
|
<when-to-use>
|
|
@@ -1031,12 +1077,12 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1031
1077
|
schema: zod_1.z.object({
|
|
1032
1078
|
discussionId: zod_1.z
|
|
1033
1079
|
.string()
|
|
1034
|
-
.min(24,
|
|
1035
|
-
.describe(
|
|
1080
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
1081
|
+
.describe('The discussion ID where to invite members'),
|
|
1036
1082
|
userIds: zod_1.z
|
|
1037
|
-
.array(zod_1.z.string().min(24,
|
|
1038
|
-
.min(1,
|
|
1039
|
-
.describe(
|
|
1083
|
+
.array(zod_1.z.string().min(24, 'User ID must be at least 24 characters'))
|
|
1084
|
+
.min(1, 'At least one user ID must be provided')
|
|
1085
|
+
.describe('Array of user IDs to invite to the discussion. Use search_workspace_users to find user IDs')
|
|
1040
1086
|
}),
|
|
1041
1087
|
async execute(args, context) {
|
|
1042
1088
|
logger.debug('Inviting members to discussion', {
|
|
@@ -1059,7 +1105,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1059
1105
|
if (isDm) {
|
|
1060
1106
|
return {
|
|
1061
1107
|
content: [{
|
|
1062
|
-
type:
|
|
1108
|
+
type: 'text',
|
|
1063
1109
|
text: `ā Cannot invite members to a private chat.\n\n` +
|
|
1064
1110
|
`Private chats are 1-on-1 conversations and cannot have additional members.\n` +
|
|
1065
1111
|
`š” To include more people, create a group discussion instead.`
|
|
@@ -1120,7 +1166,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1120
1166
|
const alreadyMembersList = alreadyMembers.map((userId) => `- ${getUserName(userId)} (${userId})`).join('\n');
|
|
1121
1167
|
return {
|
|
1122
1168
|
content: [{
|
|
1123
|
-
type:
|
|
1169
|
+
type: 'text',
|
|
1124
1170
|
text: `ā¹ļø All users are already members of this discussion!\n\n` +
|
|
1125
1171
|
`š¬ **Discussion ID**: ${args.discussionId}\n` +
|
|
1126
1172
|
`š„ **Already Members**:\n${alreadyMembersList}\n\n` +
|
|
@@ -1150,12 +1196,13 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1150
1196
|
`- Receive notifications for new activity\n\n` +
|
|
1151
1197
|
`š **Discussion Link:** https://app.hailer.com/#/discussions/${args.discussionId}`;
|
|
1152
1198
|
return {
|
|
1153
|
-
content: [{ type:
|
|
1199
|
+
content: [{ type: 'text', text: responseText }],
|
|
1154
1200
|
};
|
|
1155
1201
|
}
|
|
1156
1202
|
catch (error) {
|
|
1157
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1158
|
-
logger.error(
|
|
1203
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
1204
|
+
logger.error('Error inviting discussion members', error);
|
|
1205
|
+
}
|
|
1159
1206
|
const errorMessage = error instanceof Error
|
|
1160
1207
|
? error.message
|
|
1161
1208
|
: (typeof error === 'object' && error !== null)
|
|
@@ -1164,7 +1211,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1164
1211
|
return {
|
|
1165
1212
|
content: [
|
|
1166
1213
|
{
|
|
1167
|
-
type:
|
|
1214
|
+
type: 'text',
|
|
1168
1215
|
text: `ā Error inviting members to discussion: ${errorMessage}\n\n` +
|
|
1169
1216
|
`š” Troubleshooting:\n` +
|
|
1170
1217
|
`- Verify the discussion ID is correct (24-character string)\n` +
|
|
@@ -1184,177 +1231,13 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1184
1231
|
};
|
|
1185
1232
|
// Note: Hailer API does not have a "kick" or "remove members" feature.
|
|
1186
1233
|
// Bots can only remove themselves using the leave_discussion tool.
|
|
1187
|
-
// ============================================================================
|
|
1188
|
-
// TOOL 8: GET ACTIVITY FROM DISCUSSION
|
|
1189
|
-
// ============================================================================
|
|
1190
|
-
const getActivityFromDiscussionDescription = `š Reverse lookup: Get activity details from a discussion ID
|
|
1191
|
-
|
|
1192
|
-
**Purpose**: When you have a discussion ID but need to know what activity it belongs to.
|
|
1193
|
-
|
|
1194
|
-
**Example**:
|
|
1195
|
-
\`\`\`javascript
|
|
1196
|
-
get_activity_from_discussion({
|
|
1197
|
-
discussionId: "691ffe874217e9e8434e57f5"
|
|
1198
|
-
})
|
|
1199
|
-
\`\`\`
|
|
1200
|
-
|
|
1201
|
-
**Returns**: Activity name, ID, workflow info, phase, and field values
|
|
1202
|
-
|
|
1203
|
-
**Use Cases**:
|
|
1204
|
-
- Identify which activity a discussion belongs to
|
|
1205
|
-
- Get activity context when processing discussion messages
|
|
1206
|
-
- Navigate from chat to activity details`;
|
|
1207
|
-
exports.getActivityFromDiscussionTool = {
|
|
1208
|
-
name: 'get_activity_from_discussion',
|
|
1209
|
-
group: tool_registry_1.ToolGroup.READ,
|
|
1210
|
-
description: getActivityFromDiscussionDescription,
|
|
1211
|
-
schema: zod_1.z.object({
|
|
1212
|
-
discussionId: zod_1.z
|
|
1213
|
-
.string()
|
|
1214
|
-
.min(24, "Discussion ID must be at least 24 characters")
|
|
1215
|
-
.describe("The discussion ID to look up the associated activity for")
|
|
1216
|
-
}),
|
|
1217
|
-
async execute(args, context) {
|
|
1218
|
-
logger.debug('Getting activity from discussion', {
|
|
1219
|
-
discussionId: args.discussionId,
|
|
1220
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
1221
|
-
});
|
|
1222
|
-
try {
|
|
1223
|
-
// First, sync discussions to find the one with this ID
|
|
1224
|
-
const syncResponse = await context.hailer.request('v2.discussion.sync', [{ timestamp: 0 }]);
|
|
1225
|
-
const discussions = syncResponse.discussions || [];
|
|
1226
|
-
const targetDiscussion = discussions.find((d) => d._id === args.discussionId);
|
|
1227
|
-
if (!targetDiscussion) {
|
|
1228
|
-
return {
|
|
1229
|
-
content: [{
|
|
1230
|
-
type: "text",
|
|
1231
|
-
text: `ā Discussion not found: ${args.discussionId}\n\n` +
|
|
1232
|
-
`š” **Possible reasons:**\n` +
|
|
1233
|
-
`- You are not a member of this discussion\n` +
|
|
1234
|
-
`- The discussion ID is incorrect\n` +
|
|
1235
|
-
`- The discussion has been deleted\n\n` +
|
|
1236
|
-
`**Tip**: Use \`list_my_discussions\` to see discussions you have access to.`
|
|
1237
|
-
}]
|
|
1238
|
-
};
|
|
1239
|
-
}
|
|
1240
|
-
// Check if this discussion is linked to an activity
|
|
1241
|
-
if (!targetDiscussion.linked_activity) {
|
|
1242
|
-
let discussionType = 'unknown';
|
|
1243
|
-
if (targetDiscussion.linked_event) {
|
|
1244
|
-
discussionType = 'event';
|
|
1245
|
-
}
|
|
1246
|
-
else if (targetDiscussion.private === true) {
|
|
1247
|
-
discussionType = 'private';
|
|
1248
|
-
}
|
|
1249
|
-
else if (targetDiscussion.private === false) {
|
|
1250
|
-
discussionType = 'group';
|
|
1251
|
-
}
|
|
1252
|
-
return {
|
|
1253
|
-
content: [{
|
|
1254
|
-
type: "text",
|
|
1255
|
-
text: `ā ļø Discussion found but not linked to an activity\n\n` +
|
|
1256
|
-
`š¬ **Discussion ID**: \`${args.discussionId}\`\n` +
|
|
1257
|
-
`š **Type**: ${discussionType}\n` +
|
|
1258
|
-
`š **Name**: ${sanitizeString(targetDiscussion.name) || 'Untitled'}\n` +
|
|
1259
|
-
(targetDiscussion.linked_event ? `š
**Event ID**: \`${targetDiscussion.linked_event}\`\n` : '') +
|
|
1260
|
-
`\nš” This discussion is not associated with any activity.`
|
|
1261
|
-
}]
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
// Fetch the linked activity details
|
|
1265
|
-
const activityId = targetDiscussion.linked_activity;
|
|
1266
|
-
const activity = await context.hailer.fetchActivityById(activityId);
|
|
1267
|
-
if (!activity) {
|
|
1268
|
-
return {
|
|
1269
|
-
content: [{
|
|
1270
|
-
type: "text",
|
|
1271
|
-
text: `ā ļø Discussion is linked to activity \`${activityId}\` but activity could not be loaded.\n\n` +
|
|
1272
|
-
`š” **Possible reasons:**\n` +
|
|
1273
|
-
`- The activity has been deleted\n` +
|
|
1274
|
-
`- You don't have permission to view the activity\n` +
|
|
1275
|
-
`- The activity is in a different workspace`
|
|
1276
|
-
}]
|
|
1277
|
-
};
|
|
1278
|
-
}
|
|
1279
|
-
// Build comprehensive response
|
|
1280
|
-
let responseText = `ā
**Activity Found!**\n\n`;
|
|
1281
|
-
responseText += `š **Activity Details:**\n`;
|
|
1282
|
-
responseText += `- **Name**: ${activity.name || 'Untitled'}\n`;
|
|
1283
|
-
responseText += `- **Activity ID**: \`${activity._id}\`\n`;
|
|
1284
|
-
responseText += `- **Discussion ID**: \`${args.discussionId}\`\n`;
|
|
1285
|
-
if (activity.workflowId) {
|
|
1286
|
-
responseText += `- **Workflow ID**: \`${activity.workflowId}\`\n`;
|
|
1287
|
-
}
|
|
1288
|
-
if (activity.workflowName) {
|
|
1289
|
-
responseText += `- **Workflow**: ${activity.workflowName}\n`;
|
|
1290
|
-
}
|
|
1291
|
-
if (activity.phaseName) {
|
|
1292
|
-
responseText += `- **Phase**: ${activity.phaseName}\n`;
|
|
1293
|
-
}
|
|
1294
|
-
if (activity.phaseId) {
|
|
1295
|
-
responseText += `- **Phase ID**: \`${activity.phaseId}\`\n`;
|
|
1296
|
-
}
|
|
1297
|
-
if (activity.created) {
|
|
1298
|
-
responseText += `- **Created**: ${new Date(activity.created).toLocaleString()}\n`;
|
|
1299
|
-
}
|
|
1300
|
-
if (activity.updated) {
|
|
1301
|
-
responseText += `- **Updated**: ${new Date(activity.updated).toLocaleString()}\n`;
|
|
1302
|
-
}
|
|
1303
|
-
// Add field values if present
|
|
1304
|
-
if (activity.fields && Object.keys(activity.fields).length > 0) {
|
|
1305
|
-
responseText += `\nš **Field Values:**\n`;
|
|
1306
|
-
for (const [fieldId, value] of Object.entries(activity.fields)) {
|
|
1307
|
-
if (value !== null && value !== undefined && value !== '') {
|
|
1308
|
-
const displayValue = typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
1309
|
-
responseText += `- \`${fieldId}\`: ${displayValue}\n`;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
responseText += `\nš **Links:**\n`;
|
|
1314
|
-
responseText += `- Activity: https://app.hailer.com/#/activities/${activity._id}\n`;
|
|
1315
|
-
responseText += `- Discussion: https://app.hailer.com/#/discussions/${args.discussionId}\n`;
|
|
1316
|
-
responseText += `\nš” **Next Steps:**\n`;
|
|
1317
|
-
responseText += `- View full activity: \`show_activity_by_id({ activityId: "${activity._id}" })\`\n`;
|
|
1318
|
-
responseText += `- List workflow activities: \`list_activities({ workflowId: "${activity.workflowId}", phaseId: "${activity.phaseId}", fields: [...] })\``;
|
|
1319
|
-
return {
|
|
1320
|
-
content: [{
|
|
1321
|
-
type: "text",
|
|
1322
|
-
text: responseText
|
|
1323
|
-
}]
|
|
1324
|
-
};
|
|
1325
|
-
}
|
|
1326
|
-
catch (error) {
|
|
1327
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1328
|
-
logger.error("Error getting activity from discussion", error);
|
|
1329
|
-
const errorMessage = error instanceof Error
|
|
1330
|
-
? error.message
|
|
1331
|
-
: (typeof error === 'object' && error !== null)
|
|
1332
|
-
? JSON.stringify(error, null, 2)
|
|
1333
|
-
: String(error);
|
|
1334
|
-
return {
|
|
1335
|
-
content: [{
|
|
1336
|
-
type: "text",
|
|
1337
|
-
text: `ā Error getting activity from discussion: ${errorMessage}\n\n` +
|
|
1338
|
-
`š” **Troubleshooting:**\n` +
|
|
1339
|
-
`- Verify the discussion ID is correct (24-character string)\n` +
|
|
1340
|
-
`- Ensure you have access to the discussion\n` +
|
|
1341
|
-
`- Try \`list_my_discussions\` to see available discussions\n\n` +
|
|
1342
|
-
`š **Example:**\n` +
|
|
1343
|
-
`get_activity_from_discussion({ discussionId: "691ffe874217e9e8434e57f5" })`
|
|
1344
|
-
}]
|
|
1345
|
-
};
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
};
|
|
1349
1234
|
/** All discussion tools */
|
|
1350
1235
|
exports.discussionTools = [
|
|
1351
1236
|
exports.listMyDiscussionsTool,
|
|
1352
1237
|
exports.fetchDiscussionMessagesTool,
|
|
1353
|
-
exports.
|
|
1238
|
+
exports.addDiscussionMessageTool,
|
|
1354
1239
|
exports.joinDiscussionTool,
|
|
1355
1240
|
exports.leaveDiscussionTool,
|
|
1356
|
-
exports.addDiscussionMessageTool,
|
|
1357
1241
|
exports.inviteDiscussionMembersTool,
|
|
1358
|
-
exports.getActivityFromDiscussionTool,
|
|
1359
1242
|
];
|
|
1360
1243
|
//# sourceMappingURL=discussion.js.map
|