@hailer/mcp 1.2.1 ā 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-hailer-helper.md +118 -0
- 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 +133 -143
- package/.claude/skills/hailer-app-builder/SKILL.md +29 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +141 -10
- package/dist/app-prep.d.ts +27 -0
- package/dist/app-prep.d.ts.map +1 -0
- package/dist/app-prep.js +94 -0
- package/dist/app-prep.js.map +1 -0
- 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 +61 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +927 -151
- 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 +37 -5
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +159 -35
- 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 +47 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +99 -80
- 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 +181 -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 +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +92 -11
- 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 +83 -34
- 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/publish-auth-injector.d.ts +22 -0
- package/dist/mcp/publish-auth-injector.d.ts.map +1 -0
- package/dist/mcp/publish-auth-injector.js +100 -0
- package/dist/mcp/publish-auth-injector.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 +184 -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 +2 -0
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +575 -218
- 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 +182 -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 +12 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +748 -856
- 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 +29 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +419 -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 +24 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +513 -480
- 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 +9 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +852 -860
- 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 +0 -3
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +32 -5
- 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 +113 -103
- 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 +2 -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 +367 -48
- 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 +183 -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 +1340 -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 +435 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +13 -7
- package/scripts/build-public-chat-knowledge.py +101 -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/app-squad.md +0 -131
- 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,18 @@
|
|
|
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;
|
|
18
|
+
exports.extractForwardedMessage = extractForwardedMessage;
|
|
13
19
|
const zod_1 = require("zod");
|
|
14
20
|
const tool_registry_1 = require("../tool-registry");
|
|
15
21
|
const index_1 = require("../utils/index");
|
|
@@ -24,8 +30,9 @@ const logger = (0, index_1.createLogger)({ component: 'discussion-tools' });
|
|
|
24
30
|
* Sanitize string to remove invalid Unicode characters
|
|
25
31
|
*/
|
|
26
32
|
function sanitizeString(str) {
|
|
27
|
-
if (!str)
|
|
33
|
+
if (!str) {
|
|
28
34
|
return '';
|
|
35
|
+
}
|
|
29
36
|
return str.replace(/[\ud800-\udfff]/g, '\ufffd');
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
@@ -95,7 +102,7 @@ exports.listMyDiscussionsTool = {
|
|
|
95
102
|
responseText += `ā You are not currently participating in any discussions.\n\n`;
|
|
96
103
|
responseText += `š” **TIP**: Join activity discussions using the \`join_discussion\` tool.`;
|
|
97
104
|
return {
|
|
98
|
-
content: [{ type:
|
|
105
|
+
content: [{ type: 'text', text: responseText }],
|
|
99
106
|
};
|
|
100
107
|
}
|
|
101
108
|
// Collect all linked activity IDs to fetch their names
|
|
@@ -160,14 +167,16 @@ exports.listMyDiscussionsTool = {
|
|
|
160
167
|
other: 'ā Other Discussions'
|
|
161
168
|
};
|
|
162
169
|
for (const [type, typeDiscussions] of Object.entries(discussionsByType)) {
|
|
163
|
-
if (typeDiscussions.length === 0)
|
|
170
|
+
if (typeDiscussions.length === 0) {
|
|
164
171
|
continue;
|
|
172
|
+
}
|
|
165
173
|
responseText += `${typeLabels[type]} (${typeDiscussions.length}):\n\n`;
|
|
166
174
|
typeDiscussions.forEach((discussion, index) => {
|
|
167
175
|
const unreadCount = unreadCounts[discussion._id] || 0;
|
|
168
176
|
responseText += `${index + 1}. `;
|
|
169
|
-
if (unreadCount > 0)
|
|
177
|
+
if (unreadCount > 0) {
|
|
170
178
|
responseText += `š“ `;
|
|
179
|
+
}
|
|
171
180
|
// For activity discussions, prefer the activity name over discussion.name
|
|
172
181
|
let displayName = sanitizeString(discussion.name) || 'Untitled';
|
|
173
182
|
if (discussion.linked_activity && activityNames[discussion.linked_activity]) {
|
|
@@ -216,19 +225,20 @@ exports.listMyDiscussionsTool = {
|
|
|
216
225
|
return {
|
|
217
226
|
content: [
|
|
218
227
|
{
|
|
219
|
-
type:
|
|
228
|
+
type: 'text',
|
|
220
229
|
text: responseText,
|
|
221
230
|
},
|
|
222
231
|
],
|
|
223
232
|
};
|
|
224
233
|
}
|
|
225
234
|
catch (error) {
|
|
226
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
227
|
-
logger.error(
|
|
235
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
236
|
+
logger.error('Failed to list discussions', error);
|
|
237
|
+
}
|
|
228
238
|
return {
|
|
229
239
|
content: [
|
|
230
240
|
{
|
|
231
|
-
type:
|
|
241
|
+
type: 'text',
|
|
232
242
|
text: `ā Failed to list discussions: ${error instanceof Error ? error.message : String(error)}`,
|
|
233
243
|
},
|
|
234
244
|
],
|
|
@@ -236,10 +246,336 @@ exports.listMyDiscussionsTool = {
|
|
|
236
246
|
}
|
|
237
247
|
},
|
|
238
248
|
};
|
|
249
|
+
/**
|
|
250
|
+
* Reverse lookup: find the activity linked to a discussion.
|
|
251
|
+
*
|
|
252
|
+
* Replaces the retired get_activity_from_discussion tool - the central alias
|
|
253
|
+
* layer keeps the old tool name callable through this helper, and
|
|
254
|
+
* fetch_discussion_messages uses it for includeLinkedActivity enrichment.
|
|
255
|
+
*
|
|
256
|
+
* Returns null when the discussion is not found, has no linked activity, or
|
|
257
|
+
* the linked activity cannot be loaded. API errors propagate to the caller.
|
|
258
|
+
*/
|
|
259
|
+
async function lookupActivityFromDiscussion(discussionId, context) {
|
|
260
|
+
const syncResponse = await context.hailer.request('v2.discussion.sync', [{ timestamp: 0 }]);
|
|
261
|
+
const discussions = syncResponse.discussions || [];
|
|
262
|
+
const targetDiscussion = discussions.find((disc) => disc._id === discussionId);
|
|
263
|
+
if (!targetDiscussion?.linked_activity) {
|
|
264
|
+
logger.debug('No linked activity for discussion', {
|
|
265
|
+
discussionId,
|
|
266
|
+
discussionFound: !!targetDiscussion
|
|
267
|
+
});
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const activityId = targetDiscussion.linked_activity;
|
|
271
|
+
const activity = await context.hailer.fetchActivityById(activityId);
|
|
272
|
+
if (!activity) {
|
|
273
|
+
logger.debug('Linked activity could not be loaded', { discussionId, activityId });
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
activityId: activity._id,
|
|
278
|
+
name: activity.name || 'Untitled',
|
|
279
|
+
workflowId: activity.workflowId || null
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Best-effort linked-activity lookup for response enrichment - never throws
|
|
284
|
+
*/
|
|
285
|
+
async function safeLinkedActivityLookup(discussionId, context) {
|
|
286
|
+
try {
|
|
287
|
+
return await lookupActivityFromDiscussion(discussionId, context);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
logger.debug('Linked activity enrichment failed', {
|
|
291
|
+
discussionId,
|
|
292
|
+
error: error instanceof Error ? error.message : String(error)
|
|
293
|
+
});
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
239
297
|
// ============================================================================
|
|
240
298
|
// TOOL 2: FETCH DISCUSSION MESSAGES
|
|
241
299
|
// ============================================================================
|
|
242
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Extract a forwarded message (and any nested forwards, max depth 10) into optimized form.
|
|
302
|
+
* Exported for tests.
|
|
303
|
+
*/
|
|
304
|
+
function extractForwardedMessage(context, fwd, depth = 0) {
|
|
305
|
+
if (depth > 10) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
const fwdUserInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, fwd.uid);
|
|
309
|
+
let fwdUsername = `User ${fwd.uid}`;
|
|
310
|
+
if (fwdUserInfo) {
|
|
311
|
+
const fullName = `${fwdUserInfo.firstname || ''} ${fwdUserInfo.lastname || ''}`.trim();
|
|
312
|
+
fwdUsername = fullName || fwdUserInfo.fullName || `User ${fwd.uid}`;
|
|
313
|
+
}
|
|
314
|
+
const extracted = {
|
|
315
|
+
_id: fwd._id,
|
|
316
|
+
uid: fwd.uid,
|
|
317
|
+
username: fwdUsername,
|
|
318
|
+
created: new Date(fwd.created).toLocaleString(),
|
|
319
|
+
msg: fwd.msg || '',
|
|
320
|
+
type: fwd.type
|
|
321
|
+
};
|
|
322
|
+
if (fwd.forwardMessageId) {
|
|
323
|
+
extracted.forwardMessageId = fwd.forwardMessageId;
|
|
324
|
+
}
|
|
325
|
+
const nested = fwd.forwardMessage ? extractForwardedMessage(context, fwd.forwardMessage, depth + 1) : null;
|
|
326
|
+
if (nested) {
|
|
327
|
+
extracted.forwardMessage = nested;
|
|
328
|
+
}
|
|
329
|
+
return extracted;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Convert a raw discussion message into optimized form - strips base64 payloads, resolves usernames
|
|
333
|
+
*/
|
|
334
|
+
function optimizeMessage(context, msg) {
|
|
335
|
+
let cleanMsg = msg.msg || '';
|
|
336
|
+
if (cleanMsg) {
|
|
337
|
+
cleanMsg = cleanMsg.replace(/data:[^;]+;base64,[A-Za-z0-9+/=]+/g, '[FILE_REMOVED]');
|
|
338
|
+
cleanMsg = cleanMsg.replace(/!\[.*?\]\(data:[^)]+\)/g, '[IMAGE_REMOVED]');
|
|
339
|
+
}
|
|
340
|
+
const userInfo = (0, workspace_cache_1.getUserById)(context.workspaceCache, msg.uid);
|
|
341
|
+
let username = `User ${msg.uid}`;
|
|
342
|
+
if (userInfo) {
|
|
343
|
+
const fullName = `${userInfo.firstname || ''} ${userInfo.lastname || ''}`.trim();
|
|
344
|
+
username = fullName || userInfo.fullName || `User ${msg.uid}`;
|
|
345
|
+
}
|
|
346
|
+
const optimizedMsg = {
|
|
347
|
+
_id: msg._id,
|
|
348
|
+
uid: msg.uid,
|
|
349
|
+
username: username,
|
|
350
|
+
created: new Date(msg.created).toLocaleString(),
|
|
351
|
+
type: msg.type,
|
|
352
|
+
msg: cleanMsg
|
|
353
|
+
};
|
|
354
|
+
const isSystemWithoutText = msg.type !== 'user' && !msg.msg;
|
|
355
|
+
if (isSystemWithoutText) {
|
|
356
|
+
optimizedMsg.systemDescription = formatSystemMessage(msg);
|
|
357
|
+
}
|
|
358
|
+
if (isSystemWithoutText && msg.meta && Object.keys(msg.meta).length > 0) {
|
|
359
|
+
optimizedMsg.meta = msg.meta;
|
|
360
|
+
}
|
|
361
|
+
if (msg.replyTo) {
|
|
362
|
+
optimizedMsg.replyTo = msg.replyTo;
|
|
363
|
+
}
|
|
364
|
+
if (msg.forwardMessageId) {
|
|
365
|
+
optimizedMsg.forwardMessageId = msg.forwardMessageId;
|
|
366
|
+
}
|
|
367
|
+
const forwarded = msg.forwardMessage ? extractForwardedMessage(context, msg.forwardMessage, 0) : null;
|
|
368
|
+
if (forwarded) {
|
|
369
|
+
optimizedMsg.forwardMessage = forwarded;
|
|
370
|
+
}
|
|
371
|
+
return optimizedMsg;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Latest-messages branch of fetch_discussion_messages (no beforeMessageId)
|
|
375
|
+
*/
|
|
376
|
+
async function fetchLatestMessages(args, context) {
|
|
377
|
+
const limit = args.limit || 50;
|
|
378
|
+
let discussionId = args.discussionId;
|
|
379
|
+
logger.debug('Fetching discussion messages', {
|
|
380
|
+
discussionId: discussionId,
|
|
381
|
+
limit: limit,
|
|
382
|
+
includeLinkedActivity: !!args.includeLinkedActivity,
|
|
383
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
384
|
+
});
|
|
385
|
+
try {
|
|
386
|
+
// Auto-detect: if this is an activity ID, get its discussion ID
|
|
387
|
+
// Try fetching as discussion first, if it fails, check if it's an activity
|
|
388
|
+
let result;
|
|
389
|
+
try {
|
|
390
|
+
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
391
|
+
}
|
|
392
|
+
catch (firstError) {
|
|
393
|
+
// If first attempt fails, try loading as activity to get discussion ID
|
|
394
|
+
logger.debug('First fetch failed, checking if this is an activity ID', {
|
|
395
|
+
providedId: discussionId,
|
|
396
|
+
error: firstError?.msg || firstError?.message
|
|
397
|
+
});
|
|
398
|
+
const activity = await context.hailer.fetchActivityById(discussionId).catch(() => null);
|
|
399
|
+
if (!activity?.discussion) {
|
|
400
|
+
// Not an activity or no discussion linked, rethrow original error
|
|
401
|
+
throw firstError;
|
|
402
|
+
}
|
|
403
|
+
logger.debug('Auto-converted activity ID to discussion ID', {
|
|
404
|
+
activityId: discussionId,
|
|
405
|
+
discussionId: activity.discussion,
|
|
406
|
+
activityName: activity.name
|
|
407
|
+
});
|
|
408
|
+
discussionId = activity.discussion;
|
|
409
|
+
result = await context.hailer.fetchDiscussionMessages(discussionId, limit);
|
|
410
|
+
}
|
|
411
|
+
const messages = result.messages || [];
|
|
412
|
+
const messageCount = messages.length;
|
|
413
|
+
const userMessages = messages.filter((msg) => msg.type === 'user');
|
|
414
|
+
const recentMessage = messages[0];
|
|
415
|
+
const optimizedMessages = messages.map((msg) => optimizeMessage(context, msg));
|
|
416
|
+
const optimizedResult = {
|
|
417
|
+
oldestLoaded: result.oldestLoaded,
|
|
418
|
+
newestLoaded: result.newestLoaded,
|
|
419
|
+
messages: optimizedMessages
|
|
420
|
+
};
|
|
421
|
+
if (args.includeLinkedActivity) {
|
|
422
|
+
optimizedResult.linkedActivity = await safeLinkedActivityLookup(discussionId, context);
|
|
423
|
+
}
|
|
424
|
+
let responseText = `š¬ Successfully fetched ${messageCount} messages from discussion ${args.discussionId}`;
|
|
425
|
+
if (result.truncated) {
|
|
426
|
+
responseText += ` (limited from ${result.originalCount} available messages)`;
|
|
427
|
+
}
|
|
428
|
+
const recentSummary = recentMessage
|
|
429
|
+
? `"${recentMessage.msg || 'System event'}" at ${new Date(recentMessage.created).toLocaleString()}`
|
|
430
|
+
: 'No messages';
|
|
431
|
+
responseText += `\n\nš Summary:`;
|
|
432
|
+
responseText += `\n- ${userMessages.length} user messages`;
|
|
433
|
+
responseText += `\n- ${messages.length - userMessages.length} system messages (joins, activity creation, etc.)`;
|
|
434
|
+
responseText += `\n- Most recent: ${recentSummary}`;
|
|
435
|
+
responseText += `\n- Requested limit: ${limit} messages (API max: 50)`;
|
|
436
|
+
if (result.truncated) {
|
|
437
|
+
responseText += `\n- ā ļø More messages available: ${result.originalCount - limit} additional messages not shown`;
|
|
438
|
+
}
|
|
439
|
+
if (optimizedMessages.length > 0) {
|
|
440
|
+
const oldestMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
441
|
+
responseText += `\n\nš **PAGINATION**: To get older messages, call fetch_discussion_messages again with:`;
|
|
442
|
+
responseText += `\n- discussionId: "${discussionId}"`;
|
|
443
|
+
responseText += `\n- beforeMessageId: "${oldestMessage._id}"`;
|
|
444
|
+
responseText += `\n- batches: 1-10 (each batch = ~50 messages)`;
|
|
445
|
+
}
|
|
446
|
+
responseText += `\n\nš” Use this to understand conversation context, get project updates, or analyze team communications!`;
|
|
447
|
+
responseText += `\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
448
|
+
return {
|
|
449
|
+
content: [
|
|
450
|
+
{
|
|
451
|
+
type: 'text',
|
|
452
|
+
text: responseText,
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
459
|
+
logger.error('Error fetching discussion messages', error);
|
|
460
|
+
}
|
|
461
|
+
const errorMessage = error instanceof Error
|
|
462
|
+
? error.message
|
|
463
|
+
: (typeof error === 'object' && error !== null)
|
|
464
|
+
? JSON.stringify(error, null, 2)
|
|
465
|
+
: String(error);
|
|
466
|
+
const isPermissionError = errorMessage.toLowerCase().includes('permission') ||
|
|
467
|
+
errorMessage.toLowerCase().includes('access') ||
|
|
468
|
+
errorMessage.toLowerCase().includes('forbidden') ||
|
|
469
|
+
errorMessage.toLowerCase().includes('unauthorized');
|
|
470
|
+
let helpText = `ā Error fetching discussion messages: ${errorMessage}\n\n`;
|
|
471
|
+
if (isPermissionError) {
|
|
472
|
+
helpText += `š **PERMISSION REQUIRED**: You need to join this discussion before you can read messages.\n\n` +
|
|
473
|
+
`š” **Solution**: Use the join_discussion tool first:\n` +
|
|
474
|
+
` join_discussion(discussionId: "${args.discussionId}")\n\n`;
|
|
475
|
+
}
|
|
476
|
+
helpText += `š” Tips:\n` +
|
|
477
|
+
`- Make sure the discussion ID is correct (24-character string)\n` +
|
|
478
|
+
`- You must be a member/follower of the discussion to read messages\n` +
|
|
479
|
+
`- Some discussions may be private or require specific permissions\n\n` +
|
|
480
|
+
`Example discussion ID: '683ef53087e3d8329abaa3ad'`;
|
|
481
|
+
return {
|
|
482
|
+
content: [
|
|
483
|
+
{
|
|
484
|
+
type: 'text',
|
|
485
|
+
text: helpText,
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Older-messages branch of fetch_discussion_messages (beforeMessageId cursor)
|
|
493
|
+
*/
|
|
494
|
+
async function fetchPreviousMessages(args, context) {
|
|
495
|
+
const batches = args.batches || 1;
|
|
496
|
+
logger.debug('Fetching previous discussion messages', {
|
|
497
|
+
discussionId: args.discussionId,
|
|
498
|
+
beforeMessageId: args.beforeMessageId,
|
|
499
|
+
batches: batches,
|
|
500
|
+
includeLinkedActivity: !!args.includeLinkedActivity,
|
|
501
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
502
|
+
});
|
|
503
|
+
try {
|
|
504
|
+
const result = await context.hailer.fetchPreviousDiscussionMessages(args.beforeMessageId, batches);
|
|
505
|
+
const messages = result.messages || [];
|
|
506
|
+
const messageCount = messages.length;
|
|
507
|
+
const userMessages = messages.filter((msg) => msg.type === 'user');
|
|
508
|
+
const oldestMessage = messages.length > 0 ? messages[messages.length - 1] : null;
|
|
509
|
+
const optimizedMessages = messages.map((msg) => optimizeMessage(context, msg));
|
|
510
|
+
const optimizedResult = {
|
|
511
|
+
messages: optimizedMessages,
|
|
512
|
+
totalFetched: result.totalFetched,
|
|
513
|
+
batchesCompleted: result.batchesCompleted,
|
|
514
|
+
oldestMessageId: result.oldestMessageId,
|
|
515
|
+
hasMore: result.hasMore
|
|
516
|
+
};
|
|
517
|
+
if (args.includeLinkedActivity) {
|
|
518
|
+
optimizedResult.linkedActivity = await safeLinkedActivityLookup(args.discussionId, context);
|
|
519
|
+
}
|
|
520
|
+
let responseText = `š¬ Successfully fetched ${messageCount} previous messages`;
|
|
521
|
+
responseText += `\n\nš Summary:`;
|
|
522
|
+
responseText += `\n- ${userMessages.length} user messages`;
|
|
523
|
+
responseText += `\n- ${messages.length - userMessages.length} system messages`;
|
|
524
|
+
responseText += `\n- Batches completed: ${result.batchesCompleted}/${batches}`;
|
|
525
|
+
responseText += `\n- Total messages fetched: ${result.totalFetched}`;
|
|
526
|
+
if (oldestMessage) {
|
|
527
|
+
const oldestSummary = `"${oldestMessage.msg || 'System event'}" at ${new Date(oldestMessage.created).toLocaleString()}`;
|
|
528
|
+
responseText += `\n- Oldest message: ${oldestSummary}`;
|
|
529
|
+
}
|
|
530
|
+
if (result.hasMore && optimizedMessages.length > 0) {
|
|
531
|
+
const oldestOptimizedMessage = optimizedMessages[optimizedMessages.length - 1];
|
|
532
|
+
responseText += `\n\nš **CONTINUE PAGINATION**: To get even older messages, call fetch_discussion_messages with:`;
|
|
533
|
+
responseText += `\n- discussionId: "${args.discussionId}"`;
|
|
534
|
+
responseText += `\n- beforeMessageId: "${oldestOptimizedMessage._id}"`;
|
|
535
|
+
responseText += `\n- batches: 1-10 (for more history)`;
|
|
536
|
+
}
|
|
537
|
+
if (!result.hasMore) {
|
|
538
|
+
responseText += `\n\nā
**END OF HISTORY**: No more messages available in this discussion.`;
|
|
539
|
+
}
|
|
540
|
+
responseText += `\n\nš” Use this to explore conversation history and understand context!`;
|
|
541
|
+
responseText += `\n\nOptimized conversation data (essential fields only):\n${JSON.stringify(optimizedResult, null, 2)}`;
|
|
542
|
+
return {
|
|
543
|
+
content: [
|
|
544
|
+
{
|
|
545
|
+
type: 'text',
|
|
546
|
+
text: responseText,
|
|
547
|
+
},
|
|
548
|
+
],
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
553
|
+
logger.error('Error fetching previous discussion messages', error);
|
|
554
|
+
}
|
|
555
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
556
|
+
const helpText = `ā Error fetching previous discussion messages: ${errorMessage}\n\n` +
|
|
557
|
+
`š” **IMPORTANT**: beforeMessageId must be a MESSAGE ID, not a DISCUSSION ID!\n\n` +
|
|
558
|
+
`**How to get the correct beforeMessageId:**\n` +
|
|
559
|
+
`1. First call fetch_discussion_messages with only your discussionId\n` +
|
|
560
|
+
`2. Look at the last message in the results\n` +
|
|
561
|
+
`3. Use that message's '_id' field as beforeMessageId\n\n` +
|
|
562
|
+
`**Example:**\n` +
|
|
563
|
+
`- ā Wrong: "682dcfa9d36a4907a88bb279" (this is a discussion ID)\n` +
|
|
564
|
+
`- ā
Correct: "68e5c1903b104307efdebce9" (this is a message ID)\n\n` +
|
|
565
|
+
`Message IDs are usually different from discussion IDs!`;
|
|
566
|
+
return {
|
|
567
|
+
content: [
|
|
568
|
+
{
|
|
569
|
+
type: 'text',
|
|
570
|
+
text: helpText,
|
|
571
|
+
},
|
|
572
|
+
],
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const fetchDiscussionMessagesDescription = 'Read messages from any Hailer discussion/chat (up to 50 per batch - API limit). ' +
|
|
577
|
+
"Latest messages by default; pass beforeMessageId (a message '_id' from a previous result) to page back through older history. " +
|
|
578
|
+
'Optionally set includeLinkedActivity to also return the activity linked to the discussion';
|
|
243
579
|
exports.fetchDiscussionMessagesTool = {
|
|
244
580
|
name: 'fetch_discussion_messages',
|
|
245
581
|
group: tool_registry_1.ToolGroup.READ,
|
|
@@ -247,337 +583,47 @@ exports.fetchDiscussionMessagesTool = {
|
|
|
247
583
|
schema: zod_1.z.object({
|
|
248
584
|
discussionId: zod_1.z
|
|
249
585
|
.string()
|
|
250
|
-
.min(24,
|
|
251
|
-
.describe("The discussion ID to read messages from. You can get this from activity results (look for 'discussion' field)
|
|
586
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
587
|
+
.describe("The discussion ID to read messages from. You can get this from activity results (look for 'discussion' field) " +
|
|
588
|
+
'or from URLs like https://app.hailer.com/#/discussions/DISCUSSION_ID'),
|
|
252
589
|
limit: zod_1.z
|
|
253
590
|
.number()
|
|
254
591
|
.int()
|
|
255
|
-
.min(1,
|
|
256
|
-
.max(50,
|
|
592
|
+
.min(1, 'Limit must be at least 1')
|
|
593
|
+
.max(50, 'Limit cannot exceed 50 messages (API maximum)')
|
|
257
594
|
.default(50)
|
|
258
595
|
.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
|
|
596
|
+
.describe('Number of messages to fetch (default: 50, max: 50 due to API limit). Use beforeMessageId for older messages'),
|
|
597
|
+
beforeMessageId: zod_1.z
|
|
446
598
|
.string()
|
|
447
|
-
.min(24,
|
|
448
|
-
.
|
|
599
|
+
.min(24, 'Message ID must be at least 24 characters')
|
|
600
|
+
.optional()
|
|
601
|
+
.describe("Pagination cursor: the '_id' of the oldest message from a previous fetch (a MESSAGE ID, not a discussion ID). " +
|
|
602
|
+
'When set, fetches messages older than this message'),
|
|
449
603
|
batches: zod_1.z
|
|
450
604
|
.number()
|
|
451
605
|
.int()
|
|
452
|
-
.min(1,
|
|
453
|
-
.max(10,
|
|
606
|
+
.min(1, 'Batches must be at least 1')
|
|
607
|
+
.max(10, 'Cannot fetch more than 10 batches at once')
|
|
454
608
|
.default(1)
|
|
455
609
|
.optional()
|
|
456
|
-
.describe(
|
|
610
|
+
.describe('Number of older message batches to fetch (default: 1, max: 10). Each batch contains up to 50 messages. ' +
|
|
611
|
+
'Only used together with beforeMessageId'),
|
|
612
|
+
includeLinkedActivity: zod_1.z
|
|
613
|
+
.boolean()
|
|
614
|
+
.optional()
|
|
615
|
+
.describe('Set true to include the activity linked to this discussion ({ activityId, name, workflowId } or null). ' +
|
|
616
|
+
'Costs an extra API call (default: false)')
|
|
457
617
|
}),
|
|
458
618
|
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
|
-
};
|
|
619
|
+
if (args.beforeMessageId) {
|
|
620
|
+
return fetchPreviousMessages(args, context);
|
|
576
621
|
}
|
|
622
|
+
return fetchLatestMessages(args, context);
|
|
577
623
|
},
|
|
578
624
|
};
|
|
579
625
|
// ============================================================================
|
|
580
|
-
// TOOL
|
|
626
|
+
// TOOL 3: JOIN DISCUSSION
|
|
581
627
|
// ============================================================================
|
|
582
628
|
const joinDiscussionDescription = `<purpose>Bot joins a discussion and optionally invites ONE user</purpose>
|
|
583
629
|
<when-to-use>
|
|
@@ -599,30 +645,30 @@ exports.joinDiscussionTool = {
|
|
|
599
645
|
schema: zod_1.z.object({
|
|
600
646
|
activityId: zod_1.z
|
|
601
647
|
.string()
|
|
602
|
-
.min(24,
|
|
648
|
+
.min(24, 'Activity ID must be at least 24 characters')
|
|
603
649
|
.optional()
|
|
604
|
-
.describe(
|
|
650
|
+
.describe('Activity ID to join its discussion (preferred method for activity discussions)'),
|
|
605
651
|
discussionId: zod_1.z
|
|
606
652
|
.string()
|
|
607
|
-
.min(24,
|
|
653
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
608
654
|
.optional()
|
|
609
|
-
.describe(
|
|
655
|
+
.describe('Discussion ID to join directly (use this for non-activity discussions)'),
|
|
610
656
|
inviteUserId: zod_1.z
|
|
611
657
|
.string()
|
|
612
|
-
.min(24,
|
|
658
|
+
.min(24, 'User ID must be at least 24 characters')
|
|
613
659
|
.optional()
|
|
614
|
-
.describe(
|
|
660
|
+
.describe('User ID to invite. Get from incoming message user_id attribute when user asks to be invited.'),
|
|
615
661
|
welcomeReason: zod_1.z
|
|
616
662
|
.string()
|
|
617
663
|
.optional()
|
|
618
|
-
.describe(
|
|
664
|
+
.describe('Context/reason for the invite - posted as welcome message in the discussion.'),
|
|
619
665
|
sourceActivityId: zod_1.z
|
|
620
666
|
.string()
|
|
621
667
|
.min(24)
|
|
622
668
|
.optional()
|
|
623
669
|
.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
670
|
}).refine((data) => data.activityId || data.discussionId, {
|
|
625
|
-
message:
|
|
671
|
+
message: 'Either activityId or discussionId must be provided'
|
|
626
672
|
}),
|
|
627
673
|
async execute(args, context) {
|
|
628
674
|
logger.debug('Joining discussion', {
|
|
@@ -694,7 +740,7 @@ exports.joinDiscussionTool = {
|
|
|
694
740
|
else {
|
|
695
741
|
return {
|
|
696
742
|
content: [{
|
|
697
|
-
type:
|
|
743
|
+
type: 'text',
|
|
698
744
|
text: `ā Error: Either activityId or discussionId must be provided`,
|
|
699
745
|
}],
|
|
700
746
|
};
|
|
@@ -819,14 +865,15 @@ exports.joinDiscussionTool = {
|
|
|
819
865
|
}
|
|
820
866
|
return {
|
|
821
867
|
content: [{
|
|
822
|
-
type:
|
|
868
|
+
type: 'text',
|
|
823
869
|
text: responseText,
|
|
824
870
|
}],
|
|
825
871
|
};
|
|
826
872
|
}
|
|
827
873
|
catch (error) {
|
|
828
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
829
|
-
logger.error(
|
|
874
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
875
|
+
logger.error('Error joining discussion', error);
|
|
876
|
+
}
|
|
830
877
|
const errorMessage = error instanceof Error
|
|
831
878
|
? error.message
|
|
832
879
|
: (typeof error === 'object' && error !== null)
|
|
@@ -835,7 +882,7 @@ exports.joinDiscussionTool = {
|
|
|
835
882
|
return {
|
|
836
883
|
content: [
|
|
837
884
|
{
|
|
838
|
-
type:
|
|
885
|
+
type: 'text',
|
|
839
886
|
text: `ā Error joining discussion: ${errorMessage}\n\n` +
|
|
840
887
|
`š” Troubleshooting:\n` +
|
|
841
888
|
`- For activity discussions: Use join_discussion(activityId: "...")\n` +
|
|
@@ -853,7 +900,7 @@ exports.joinDiscussionTool = {
|
|
|
853
900
|
},
|
|
854
901
|
};
|
|
855
902
|
// ============================================================================
|
|
856
|
-
// TOOL
|
|
903
|
+
// TOOL 4: LEAVE DISCUSSION
|
|
857
904
|
// ============================================================================
|
|
858
905
|
const leaveDiscussionDescription = `Leave a discussion - Bot removes itself from a discussion.
|
|
859
906
|
|
|
@@ -873,20 +920,20 @@ exports.leaveDiscussionTool = {
|
|
|
873
920
|
schema: zod_1.z.object({
|
|
874
921
|
activityId: zod_1.z
|
|
875
922
|
.string()
|
|
876
|
-
.min(24,
|
|
923
|
+
.min(24, 'Activity ID must be at least 24 characters')
|
|
877
924
|
.optional()
|
|
878
|
-
.describe(
|
|
925
|
+
.describe('Activity ID to leave its discussion (preferred method for activity discussions)'),
|
|
879
926
|
discussionId: zod_1.z
|
|
880
927
|
.string()
|
|
881
|
-
.min(24,
|
|
928
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
882
929
|
.optional()
|
|
883
|
-
.describe(
|
|
930
|
+
.describe('Discussion ID to leave directly')
|
|
884
931
|
}).refine((data) => data.activityId || data.discussionId, {
|
|
885
|
-
message:
|
|
932
|
+
message: 'Either activityId or discussionId must be provided'
|
|
886
933
|
}),
|
|
887
934
|
async execute(args, context) {
|
|
888
935
|
// DEBUG: Log raw input to diagnose LLM tool calling issues
|
|
889
|
-
logger.debug(
|
|
936
|
+
logger.debug('leave_discussion called', {
|
|
890
937
|
hasActivityId: !!args.activityId,
|
|
891
938
|
hasDiscussionId: !!args.discussionId,
|
|
892
939
|
activityId: args.activityId || '(not provided)',
|
|
@@ -906,7 +953,7 @@ exports.leaveDiscussionTool = {
|
|
|
906
953
|
return {
|
|
907
954
|
content: [
|
|
908
955
|
{
|
|
909
|
-
type:
|
|
956
|
+
type: 'text',
|
|
910
957
|
text: `ā
Successfully left activity discussion!\n\n` +
|
|
911
958
|
`š **Activity**: ${activity.name || args.activityId}\n` +
|
|
912
959
|
`š¬ **Discussion ID**: ${discussionId}\n` +
|
|
@@ -925,7 +972,7 @@ exports.leaveDiscussionTool = {
|
|
|
925
972
|
return {
|
|
926
973
|
content: [
|
|
927
974
|
{
|
|
928
|
-
type:
|
|
975
|
+
type: 'text',
|
|
929
976
|
text: `ā
Successfully left discussion!\n\n` +
|
|
930
977
|
`š¬ **Discussion ID**: ${args.discussionId}\n\n` +
|
|
931
978
|
`š You will no longer receive notifications from this discussion.\n\n` +
|
|
@@ -938,15 +985,16 @@ exports.leaveDiscussionTool = {
|
|
|
938
985
|
return {
|
|
939
986
|
content: [
|
|
940
987
|
{
|
|
941
|
-
type:
|
|
988
|
+
type: 'text',
|
|
942
989
|
text: `ā Error: Either activityId or discussionId must be provided`,
|
|
943
990
|
},
|
|
944
991
|
],
|
|
945
992
|
};
|
|
946
993
|
}
|
|
947
994
|
catch (error) {
|
|
948
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
949
|
-
logger.error(
|
|
995
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
996
|
+
logger.error('Error leaving discussion', error);
|
|
997
|
+
}
|
|
950
998
|
const errorMessage = error instanceof Error
|
|
951
999
|
? error.message
|
|
952
1000
|
: (typeof error === 'object' && error !== null)
|
|
@@ -955,7 +1003,7 @@ exports.leaveDiscussionTool = {
|
|
|
955
1003
|
return {
|
|
956
1004
|
content: [
|
|
957
1005
|
{
|
|
958
|
-
type:
|
|
1006
|
+
type: 'text',
|
|
959
1007
|
text: `ā Error leaving discussion: ${errorMessage}\n\n` +
|
|
960
1008
|
`š” Troubleshooting:\n` +
|
|
961
1009
|
`- For activity discussions: Use leave_discussion(activityId: "...")\n` +
|
|
@@ -973,7 +1021,7 @@ exports.leaveDiscussionTool = {
|
|
|
973
1021
|
},
|
|
974
1022
|
};
|
|
975
1023
|
// ============================================================================
|
|
976
|
-
// TOOL
|
|
1024
|
+
// TOOL 5: ADD DISCUSSION MESSAGE
|
|
977
1025
|
// ============================================================================
|
|
978
1026
|
const addDiscussionMessageDescription = `Post a message to a Hailer discussion with optional file attachments - AI agents can participate in conversations`;
|
|
979
1027
|
exports.addDiscussionMessageTool = {
|
|
@@ -981,9 +1029,9 @@ exports.addDiscussionMessageTool = {
|
|
|
981
1029
|
group: tool_registry_1.ToolGroup.WRITE,
|
|
982
1030
|
description: addDiscussionMessageDescription,
|
|
983
1031
|
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(
|
|
1032
|
+
discussionId: zod_1.z.string().min(24, 'Discussion ID must be at least 24 characters').describe('The discussion ID where to post the message'),
|
|
1033
|
+
content: zod_1.z.string().min(1, 'Message content cannot be empty').describe('The message text to post'),
|
|
1034
|
+
fileIds: zod_1.z.array(zod_1.z.string()).optional().describe('Optional array of file IDs to attach (from upload_files tool)')
|
|
987
1035
|
}),
|
|
988
1036
|
async execute(args, context) {
|
|
989
1037
|
try {
|
|
@@ -996,7 +1044,7 @@ exports.addDiscussionMessageTool = {
|
|
|
996
1044
|
return {
|
|
997
1045
|
content: [
|
|
998
1046
|
{
|
|
999
|
-
type:
|
|
1047
|
+
type: 'text',
|
|
1000
1048
|
text: responseText,
|
|
1001
1049
|
},
|
|
1002
1050
|
],
|
|
@@ -1006,7 +1054,7 @@ exports.addDiscussionMessageTool = {
|
|
|
1006
1054
|
return {
|
|
1007
1055
|
content: [
|
|
1008
1056
|
{
|
|
1009
|
-
type:
|
|
1057
|
+
type: 'text',
|
|
1010
1058
|
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
1059
|
},
|
|
1012
1060
|
],
|
|
@@ -1015,7 +1063,7 @@ exports.addDiscussionMessageTool = {
|
|
|
1015
1063
|
},
|
|
1016
1064
|
};
|
|
1017
1065
|
// ============================================================================
|
|
1018
|
-
// TOOL
|
|
1066
|
+
// TOOL 6: INVITE DISCUSSION MEMBERS
|
|
1019
1067
|
// ============================================================================
|
|
1020
1068
|
const inviteDiscussionMembersDescription = `<purpose>Invite users to a discussion WITHOUT the bot joining. Use this to add people to activity discussions.</purpose>
|
|
1021
1069
|
<when-to-use>
|
|
@@ -1031,12 +1079,12 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1031
1079
|
schema: zod_1.z.object({
|
|
1032
1080
|
discussionId: zod_1.z
|
|
1033
1081
|
.string()
|
|
1034
|
-
.min(24,
|
|
1035
|
-
.describe(
|
|
1082
|
+
.min(24, 'Discussion ID must be at least 24 characters')
|
|
1083
|
+
.describe('The discussion ID where to invite members'),
|
|
1036
1084
|
userIds: zod_1.z
|
|
1037
|
-
.array(zod_1.z.string().min(24,
|
|
1038
|
-
.min(1,
|
|
1039
|
-
.describe(
|
|
1085
|
+
.array(zod_1.z.string().min(24, 'User ID must be at least 24 characters'))
|
|
1086
|
+
.min(1, 'At least one user ID must be provided')
|
|
1087
|
+
.describe('Array of user IDs to invite to the discussion. Use search_workspace_users to find user IDs')
|
|
1040
1088
|
}),
|
|
1041
1089
|
async execute(args, context) {
|
|
1042
1090
|
logger.debug('Inviting members to discussion', {
|
|
@@ -1059,7 +1107,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1059
1107
|
if (isDm) {
|
|
1060
1108
|
return {
|
|
1061
1109
|
content: [{
|
|
1062
|
-
type:
|
|
1110
|
+
type: 'text',
|
|
1063
1111
|
text: `ā Cannot invite members to a private chat.\n\n` +
|
|
1064
1112
|
`Private chats are 1-on-1 conversations and cannot have additional members.\n` +
|
|
1065
1113
|
`š” To include more people, create a group discussion instead.`
|
|
@@ -1120,7 +1168,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1120
1168
|
const alreadyMembersList = alreadyMembers.map((userId) => `- ${getUserName(userId)} (${userId})`).join('\n');
|
|
1121
1169
|
return {
|
|
1122
1170
|
content: [{
|
|
1123
|
-
type:
|
|
1171
|
+
type: 'text',
|
|
1124
1172
|
text: `ā¹ļø All users are already members of this discussion!\n\n` +
|
|
1125
1173
|
`š¬ **Discussion ID**: ${args.discussionId}\n` +
|
|
1126
1174
|
`š„ **Already Members**:\n${alreadyMembersList}\n\n` +
|
|
@@ -1150,12 +1198,13 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1150
1198
|
`- Receive notifications for new activity\n\n` +
|
|
1151
1199
|
`š **Discussion Link:** https://app.hailer.com/#/discussions/${args.discussionId}`;
|
|
1152
1200
|
return {
|
|
1153
|
-
content: [{ type:
|
|
1201
|
+
content: [{ type: 'text', text: responseText }],
|
|
1154
1202
|
};
|
|
1155
1203
|
}
|
|
1156
1204
|
catch (error) {
|
|
1157
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1158
|
-
logger.error(
|
|
1205
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
1206
|
+
logger.error('Error inviting discussion members', error);
|
|
1207
|
+
}
|
|
1159
1208
|
const errorMessage = error instanceof Error
|
|
1160
1209
|
? error.message
|
|
1161
1210
|
: (typeof error === 'object' && error !== null)
|
|
@@ -1164,7 +1213,7 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1164
1213
|
return {
|
|
1165
1214
|
content: [
|
|
1166
1215
|
{
|
|
1167
|
-
type:
|
|
1216
|
+
type: 'text',
|
|
1168
1217
|
text: `ā Error inviting members to discussion: ${errorMessage}\n\n` +
|
|
1169
1218
|
`š” Troubleshooting:\n` +
|
|
1170
1219
|
`- Verify the discussion ID is correct (24-character string)\n` +
|
|
@@ -1184,177 +1233,13 @@ exports.inviteDiscussionMembersTool = {
|
|
|
1184
1233
|
};
|
|
1185
1234
|
// Note: Hailer API does not have a "kick" or "remove members" feature.
|
|
1186
1235
|
// 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
1236
|
/** All discussion tools */
|
|
1350
1237
|
exports.discussionTools = [
|
|
1351
1238
|
exports.listMyDiscussionsTool,
|
|
1352
1239
|
exports.fetchDiscussionMessagesTool,
|
|
1353
|
-
exports.
|
|
1240
|
+
exports.addDiscussionMessageTool,
|
|
1354
1241
|
exports.joinDiscussionTool,
|
|
1355
1242
|
exports.leaveDiscussionTool,
|
|
1356
|
-
exports.addDiscussionMessageTool,
|
|
1357
1243
|
exports.inviteDiscussionMembersTool,
|
|
1358
|
-
exports.getActivityFromDiscussionTool,
|
|
1359
1244
|
];
|
|
1360
1245
|
//# sourceMappingURL=discussion.js.map
|