@hailer/mcp 1.2.1 ā 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-hailer-helper.md +118 -0
- package/.claude/commands/app-squad.md +16 -110
- package/.claude/commands/debug-squad.md +13 -290
- package/.claude/commands/publish.md +2 -2
- package/.claude/commands/review-squad.md +17 -139
- package/.claude/skills/create-and-publish-app/SKILL.md +105 -151
- package/.claude/skills/hailer-app-builder/SKILL.md +2 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +138 -10
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/bot/bot-manager.d.ts +9 -6
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +142 -31
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot.d.ts +59 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +889 -142
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/operation-logger.d.ts.map +1 -1
- package/dist/bot/operation-logger.js +24 -12
- package/dist/bot/operation-logger.js.map +1 -1
- package/dist/bot/services/bot-permissions.d.ts +2 -2
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +28 -9
- package/dist/bot/services/bot-permissions.js.map +1 -1
- package/dist/bot/services/conversation-manager.d.ts +23 -23
- package/dist/bot/services/conversation-manager.d.ts.map +1 -1
- package/dist/bot/services/conversation-manager.js +52 -49
- package/dist/bot/services/conversation-manager.js.map +1 -1
- package/dist/bot/services/helper-prompt.d.ts +8 -0
- package/dist/bot/services/helper-prompt.d.ts.map +1 -0
- package/dist/bot/services/helper-prompt.js +177 -0
- package/dist/bot/services/helper-prompt.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts +16 -16
- package/dist/bot/services/message-classifier.d.ts.map +1 -1
- package/dist/bot/services/message-classifier.js +55 -49
- package/dist/bot/services/message-classifier.js.map +1 -1
- package/dist/bot/services/message-formatter.d.ts +38 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +81 -74
- package/dist/bot/services/message-formatter.js.map +1 -1
- package/dist/bot/services/permission-guard.d.ts.map +1 -1
- package/dist/bot/services/permission-guard.js +20 -10
- package/dist/bot/services/permission-guard.js.map +1 -1
- package/dist/bot/services/signal-router.d.ts.map +1 -1
- package/dist/bot/services/signal-router.js +11 -6
- package/dist/bot/services/signal-router.js.map +1 -1
- package/dist/bot/services/system-prompt.d.ts +14 -0
- package/dist/bot/services/system-prompt.d.ts.map +1 -1
- package/dist/bot/services/system-prompt.js +179 -4
- package/dist/bot/services/system-prompt.js.map +1 -1
- package/dist/bot/services/token-billing.d.ts +23 -23
- package/dist/bot/services/token-billing.d.ts.map +1 -1
- package/dist/bot/services/token-billing.js +51 -36
- package/dist/bot/services/token-billing.js.map +1 -1
- package/dist/bot/services/types.d.ts +3 -1
- package/dist/bot/services/types.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.d.ts +8 -8
- package/dist/bot/services/typing-indicator.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.js +12 -10
- package/dist/bot/services/typing-indicator.js.map +1 -1
- package/dist/bot/services/workspace-refresh.d.ts +3 -3
- package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
- package/dist/bot/services/workspace-refresh.js +23 -13
- package/dist/bot/services/workspace-refresh.js.map +1 -1
- package/dist/bot/tool-executor.d.ts +10 -6
- package/dist/bot/tool-executor.d.ts.map +1 -1
- package/dist/bot/tool-executor.js +12 -6
- package/dist/bot/tool-executor.js.map +1 -1
- package/dist/bot/workspace-overview.d.ts.map +1 -1
- package/dist/bot/workspace-overview.js +6 -3
- package/dist/bot/workspace-overview.js.map +1 -1
- package/dist/bot-config/activity-error.d.ts +47 -0
- package/dist/bot-config/activity-error.d.ts.map +1 -0
- package/dist/bot-config/activity-error.js +67 -0
- package/dist/bot-config/activity-error.js.map +1 -0
- package/dist/bot-config/context.d.ts +4 -4
- package/dist/bot-config/context.d.ts.map +1 -1
- package/dist/bot-config/context.js +18 -14
- package/dist/bot-config/context.js.map +1 -1
- package/dist/bot-config/events.d.ts +45 -0
- package/dist/bot-config/events.d.ts.map +1 -0
- package/dist/bot-config/events.js +51 -0
- package/dist/bot-config/events.js.map +1 -0
- package/dist/bot-config/index.d.ts +3 -0
- package/dist/bot-config/index.d.ts.map +1 -1
- package/dist/bot-config/index.js +8 -1
- package/dist/bot-config/index.js.map +1 -1
- package/dist/bot-config/loader.d.ts +3 -0
- package/dist/bot-config/loader.d.ts.map +1 -1
- package/dist/bot-config/loader.js +45 -20
- package/dist/bot-config/loader.js.map +1 -1
- package/dist/bot-config/persistence.js.map +1 -1
- package/dist/bot-config/reconciler.d.ts +11 -0
- package/dist/bot-config/reconciler.d.ts.map +1 -0
- package/dist/bot-config/reconciler.js +121 -0
- package/dist/bot-config/reconciler.js.map +1 -0
- package/dist/bot-config/state.d.ts.map +1 -1
- package/dist/bot-config/state.js.map +1 -1
- package/dist/bot-config/types.d.ts +32 -0
- package/dist/bot-config/types.d.ts.map +1 -1
- package/dist/bot-config/webhooks.d.ts.map +1 -1
- package/dist/bot-config/webhooks.js.map +1 -1
- package/dist/bot-config/workflow-installer.d.ts +37 -0
- package/dist/bot-config/workflow-installer.d.ts.map +1 -0
- package/dist/bot-config/workflow-installer.js +346 -0
- package/dist/bot-config/workflow-installer.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +54 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -27
- package/dist/config.js.map +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -16
- package/dist/core.js.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +7 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/request-logger.d.ts +19 -19
- package/dist/lib/request-logger.d.ts.map +1 -1
- package/dist/lib/request-logger.js +19 -19
- package/dist/lib/request-logger.js.map +1 -1
- package/dist/mcp/UserContextCache.d.ts +28 -22
- package/dist/mcp/UserContextCache.d.ts.map +1 -1
- package/dist/mcp/UserContextCache.js +23 -23
- package/dist/mcp/UserContextCache.js.map +1 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/hailer-clients.d.ts +5 -4
- package/dist/mcp/hailer-clients.d.ts.map +1 -1
- package/dist/mcp/hailer-clients.js +61 -27
- package/dist/mcp/hailer-clients.js.map +1 -1
- package/dist/mcp/hailer-rpc.d.ts +40 -0
- package/dist/mcp/hailer-rpc.d.ts.map +1 -0
- package/dist/mcp/hailer-rpc.js +43 -0
- package/dist/mcp/hailer-rpc.js.map +1 -0
- package/dist/mcp/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 +176 -0
- package/dist/mcp/tool-profiles.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +16 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +91 -39
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +398 -198
- package/dist/mcp/tools/activity.js.map +1 -1
- package/dist/mcp/tools/aliases.d.ts +11 -0
- package/dist/mcp/tools/aliases.d.ts.map +1 -0
- package/dist/mcp/tools/aliases.js +176 -0
- package/dist/mcp/tools/aliases.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts +6 -8
- package/dist/mcp/tools/app-core.d.ts.map +1 -1
- package/dist/mcp/tools/app-core.js +355 -254
- package/dist/mcp/tools/app-core.js.map +1 -1
- package/dist/mcp/tools/app-marketplace.d.ts +8 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +604 -930
- package/dist/mcp/tools/app-marketplace.js.map +1 -1
- package/dist/mcp/tools/app.d.ts +4 -7
- package/dist/mcp/tools/app.d.ts.map +1 -1
- package/dist/mcp/tools/app.js +4 -7
- package/dist/mcp/tools/app.js.map +1 -1
- package/dist/mcp/tools/bot-self.d.ts +21 -0
- package/dist/mcp/tools/bot-self.d.ts.map +1 -0
- package/dist/mcp/tools/bot-self.js +174 -0
- package/dist/mcp/tools/bot-self.js.map +1 -0
- package/dist/mcp/tools/calendar.d.ts +21 -0
- package/dist/mcp/tools/calendar.d.ts.map +1 -0
- package/dist/mcp/tools/calendar.js +741 -0
- package/dist/mcp/tools/calendar.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -1
- package/dist/mcp/tools/company.js +2 -1
- package/dist/mcp/tools/company.js.map +1 -1
- package/dist/mcp/tools/date.js.map +1 -1
- package/dist/mcp/tools/discussion.d.ts +23 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +417 -534
- package/dist/mcp/tools/discussion.js.map +1 -1
- package/dist/mcp/tools/file.d.ts.map +1 -1
- package/dist/mcp/tools/file.js +18 -16
- package/dist/mcp/tools/file.js.map +1 -1
- package/dist/mcp/tools/index.js +4 -4
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/insight.d.ts +7 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +419 -477
- package/dist/mcp/tools/insight.js.map +1 -1
- package/dist/mcp/tools/user.d.ts.map +1 -1
- package/dist/mcp/tools/user.js +15 -13
- package/dist/mcp/tools/user.js.map +1 -1
- package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
- package/dist/mcp/tools/workflow-permissions.js +88 -97
- package/dist/mcp/tools/workflow-permissions.js.map +1 -1
- package/dist/mcp/tools/workflow.d.ts +2 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +817 -850
- package/dist/mcp/tools/workflow.js.map +1 -1
- package/dist/mcp/utils/api-errors.d.ts.map +1 -1
- package/dist/mcp/utils/api-errors.js +2 -2
- package/dist/mcp/utils/api-errors.js.map +1 -1
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +8 -4
- package/dist/mcp/utils/data-transformers.js.map +1 -1
- package/dist/mcp/utils/file-upload.d.ts.map +1 -1
- package/dist/mcp/utils/file-upload.js +1 -1
- package/dist/mcp/utils/file-upload.js.map +1 -1
- package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
- package/dist/mcp/utils/hailer-api-client.js +103 -101
- package/dist/mcp/utils/hailer-api-client.js.map +1 -1
- package/dist/mcp/utils/index.d.ts.map +1 -1
- package/dist/mcp/utils/index.js.map +1 -1
- package/dist/mcp/utils/logger.d.ts.map +1 -1
- package/dist/mcp/utils/logger.js.map +1 -1
- package/dist/mcp/utils/response-builder.d.ts.map +1 -1
- package/dist/mcp/utils/response-builder.js +8 -4
- package/dist/mcp/utils/response-builder.js.map +1 -1
- package/dist/mcp/utils/role-utils.d.ts.map +1 -1
- package/dist/mcp/utils/role-utils.js +6 -3
- package/dist/mcp/utils/role-utils.js.map +1 -1
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
- package/dist/mcp/utils/tool-helpers.js +2 -2
- package/dist/mcp/utils/tool-helpers.js.map +1 -1
- package/dist/mcp/utils/types.d.ts +1 -1
- package/dist/mcp/utils/types.d.ts.map +1 -1
- package/dist/mcp/utils/types.js.map +1 -1
- package/dist/mcp/webhook-handler.d.ts +43 -8
- package/dist/mcp/webhook-handler.d.ts.map +1 -1
- package/dist/mcp/webhook-handler.js +861 -116
- package/dist/mcp/webhook-handler.js.map +1 -1
- package/dist/mcp/workspace-admin-store.d.ts +49 -0
- package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
- package/dist/mcp/workspace-admin-store.js +168 -0
- package/dist/mcp/workspace-admin-store.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts +2 -2
- package/dist/mcp/workspace-cache.d.ts.map +1 -1
- package/dist/mcp/workspace-cache.js +9 -5
- package/dist/mcp/workspace-cache.js.map +1 -1
- package/dist/mcp-server.d.ts +26 -11
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +360 -36
- package/dist/mcp-server.js.map +1 -1
- package/dist/plugins/vipunen/client.d.ts +41 -41
- package/dist/plugins/vipunen/client.d.ts.map +1 -1
- package/dist/plugins/vipunen/client.js +53 -48
- package/dist/plugins/vipunen/client.js.map +1 -1
- package/dist/plugins/vipunen/index.js.map +1 -1
- package/dist/plugins/vipunen/tools.d.ts.map +1 -1
- package/dist/plugins/vipunen/tools.js +6 -3
- package/dist/plugins/vipunen/tools.js.map +1 -1
- package/dist/public-chat/graduate.d.ts +29 -0
- package/dist/public-chat/graduate.d.ts.map +1 -0
- package/dist/public-chat/graduate.js +593 -0
- package/dist/public-chat/graduate.js.map +1 -0
- package/dist/public-chat/handler.d.ts +12 -0
- package/dist/public-chat/handler.d.ts.map +1 -0
- package/dist/public-chat/handler.js +179 -0
- package/dist/public-chat/handler.js.map +1 -0
- package/dist/public-chat/index.d.ts +16 -0
- package/dist/public-chat/index.d.ts.map +1 -0
- package/dist/public-chat/index.js +74 -0
- package/dist/public-chat/index.js.map +1 -0
- package/dist/public-chat/knowledge.d.ts +3 -0
- package/dist/public-chat/knowledge.d.ts.map +1 -0
- package/dist/public-chat/knowledge.js +1339 -0
- package/dist/public-chat/knowledge.js.map +1 -0
- package/dist/public-chat/rate-limit.d.ts +16 -0
- package/dist/public-chat/rate-limit.d.ts.map +1 -0
- package/dist/public-chat/rate-limit.js +51 -0
- package/dist/public-chat/rate-limit.js.map +1 -0
- package/dist/public-chat/session-store.d.ts +41 -0
- package/dist/public-chat/session-store.d.ts.map +1 -0
- package/dist/public-chat/session-store.js +95 -0
- package/dist/public-chat/session-store.js.map +1 -0
- package/dist/public-chat/studio-prewarm.d.ts +61 -0
- package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
- package/dist/public-chat/studio-prewarm.js +162 -0
- package/dist/public-chat/studio-prewarm.js.map +1 -0
- package/dist/public-chat/system-prompt.d.ts +22 -0
- package/dist/public-chat/system-prompt.d.ts.map +1 -0
- package/dist/public-chat/system-prompt.js +428 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +14 -7
- package/scripts/build-public-chat-knowledge.py +101 -0
- package/scripts/probe-mcp-pricing.ts +52 -0
- package/scripts/smoke-public-chat-live.ts +148 -0
- package/scripts/smoke-public-chat.ts +110 -0
- package/.claude/CLAUDE.md +0 -126
- package/.claude/commands/audit-squad.md +0 -158
- package/.claude/commands/cleanup-squad.md +0 -98
- package/.claude/commands/config-squad.md +0 -106
- package/.claude/commands/crud-squad.md +0 -87
- package/.claude/commands/data-squad.md +0 -97
- package/.claude/commands/doc-squad.md +0 -65
- package/.claude/commands/help.md +0 -29
- package/.claude/commands/help:agents.md +0 -182
- package/.claude/commands/help:commands.md +0 -78
- package/.claude/commands/help:faq.md +0 -79
- package/.claude/commands/help:plugins.md +0 -50
- package/.claude/commands/help:skills.md +0 -87
- package/.claude/commands/help:tools.md +0 -75
- package/.claude/commands/hotfix-squad.md +0 -112
- package/.claude/commands/integration-squad.md +0 -82
- package/.claude/commands/janitor-squad.md +0 -167
- package/.claude/commands/onboard-squad.md +0 -130
- package/.claude/commands/swarm.md +0 -210
- package/.claude/commands/tool-builder.md +0 -39
- package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
- package/dist/CLAUDE.md +0 -370
- package/dist/agents/bot-manager.d.ts +0 -48
- package/dist/agents/bot-manager.d.ts.map +0 -1
- package/dist/agents/bot-manager.js +0 -254
- package/dist/agents/bot-manager.js.map +0 -1
- package/dist/agents/bug-fixer/ai.d.ts +0 -80
- package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
- package/dist/agents/bug-fixer/ai.js +0 -466
- package/dist/agents/bug-fixer/ai.js.map +0 -1
- package/dist/agents/bug-fixer/bot.d.ts +0 -92
- package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
- package/dist/agents/bug-fixer/bot.js +0 -687
- package/dist/agents/bug-fixer/bot.js.map +0 -1
- package/dist/agents/bug-fixer/config.d.ts +0 -21
- package/dist/agents/bug-fixer/config.d.ts.map +0 -1
- package/dist/agents/bug-fixer/config.js +0 -218
- package/dist/agents/bug-fixer/config.js.map +0 -1
- package/dist/agents/bug-fixer/files.d.ts +0 -67
- package/dist/agents/bug-fixer/files.d.ts.map +0 -1
- package/dist/agents/bug-fixer/files.js +0 -386
- package/dist/agents/bug-fixer/files.js.map +0 -1
- package/dist/agents/bug-fixer/git.d.ts +0 -48
- package/dist/agents/bug-fixer/git.d.ts.map +0 -1
- package/dist/agents/bug-fixer/git.js +0 -298
- package/dist/agents/bug-fixer/git.js.map +0 -1
- package/dist/agents/bug-fixer/index.d.ts +0 -103
- package/dist/agents/bug-fixer/index.d.ts.map +0 -1
- package/dist/agents/bug-fixer/index.js +0 -262
- package/dist/agents/bug-fixer/index.js.map +0 -1
- package/dist/agents/bug-fixer/lsp.d.ts +0 -113
- package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
- package/dist/agents/bug-fixer/lsp.js +0 -485
- package/dist/agents/bug-fixer/lsp.js.map +0 -1
- package/dist/agents/bug-fixer/monitor.d.ts +0 -123
- package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
- package/dist/agents/bug-fixer/monitor.js +0 -629
- package/dist/agents/bug-fixer/monitor.js.map +0 -1
- package/dist/agents/bug-fixer/prompt.d.ts +0 -5
- package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
- package/dist/agents/bug-fixer/prompt.js +0 -94
- package/dist/agents/bug-fixer/prompt.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
- package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
- package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
- package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.js +0 -49
- package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
- package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
- package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
- package/dist/agents/bug-fixer/specialist.d.ts +0 -47
- package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist.js +0 -327
- package/dist/agents/bug-fixer/specialist.js.map +0 -1
- package/dist/agents/bug-fixer/types.d.ts +0 -123
- package/dist/agents/bug-fixer/types.d.ts.map +0 -1
- package/dist/agents/bug-fixer/types.js +0 -9
- package/dist/agents/bug-fixer/types.js.map +0 -1
- package/dist/agents/factory.d.ts +0 -172
- package/dist/agents/factory.d.ts.map +0 -1
- package/dist/agents/factory.js +0 -706
- package/dist/agents/factory.js.map +0 -1
- package/dist/agents/hailer-expert/index.d.ts +0 -8
- package/dist/agents/hailer-expert/index.d.ts.map +0 -1
- package/dist/agents/hailer-expert/index.js +0 -14
- package/dist/agents/hailer-expert/index.js.map +0 -1
- package/dist/agents/hal/daemon.d.ts +0 -174
- package/dist/agents/hal/daemon.d.ts.map +0 -1
- package/dist/agents/hal/daemon.js +0 -1385
- package/dist/agents/hal/daemon.js.map +0 -1
- package/dist/agents/hal/definitions.d.ts +0 -42
- package/dist/agents/hal/definitions.d.ts.map +0 -1
- package/dist/agents/hal/definitions.js +0 -300
- package/dist/agents/hal/definitions.js.map +0 -1
- package/dist/agents/hal/index.d.ts +0 -3
- package/dist/agents/hal/index.d.ts.map +0 -1
- package/dist/agents/hal/index.js +0 -8
- package/dist/agents/hal/index.js.map +0 -1
- package/dist/agents/index.d.ts +0 -18
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -48
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared/base.d.ts +0 -253
- package/dist/agents/shared/base.d.ts.map +0 -1
- package/dist/agents/shared/base.js +0 -1122
- package/dist/agents/shared/base.js.map +0 -1
- package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
- package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
- package/dist/agents/shared/schemas/action-schema.js +0 -483
- package/dist/agents/shared/schemas/action-schema.js.map +0 -1
- package/dist/agents/shared/services/agent-registry.d.ts +0 -108
- package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
- package/dist/agents/shared/services/agent-registry.js +0 -469
- package/dist/agents/shared/services/agent-registry.js.map +0 -1
- package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
- package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
- package/dist/agents/shared/services/conversation-manager.js +0 -168
- package/dist/agents/shared/services/conversation-manager.js.map +0 -1
- package/dist/agents/shared/services/mcp-client.d.ts +0 -56
- package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
- package/dist/agents/shared/services/mcp-client.js +0 -124
- package/dist/agents/shared/services/mcp-client.js.map +0 -1
- package/dist/agents/shared/services/message-classifier.d.ts +0 -37
- package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
- package/dist/agents/shared/services/message-classifier.js +0 -203
- package/dist/agents/shared/services/message-classifier.js.map +0 -1
- package/dist/agents/shared/services/message-formatter.d.ts +0 -89
- package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
- package/dist/agents/shared/services/message-formatter.js +0 -390
- package/dist/agents/shared/services/message-formatter.js.map +0 -1
- package/dist/agents/shared/services/session-logger.d.ts +0 -162
- package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
- package/dist/agents/shared/services/session-logger.js +0 -724
- package/dist/agents/shared/services/session-logger.js.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
- package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.js +0 -296
- package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
- package/dist/agents/shared/services/token-billing.d.ts +0 -72
- package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
- package/dist/agents/shared/services/token-billing.js +0 -198
- package/dist/agents/shared/services/token-billing.js.map +0 -1
- package/dist/agents/shared/services/tool-executor.d.ts +0 -43
- package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/tool-executor.js +0 -175
- package/dist/agents/shared/services/tool-executor.js.map +0 -1
- package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
- package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
- package/dist/agents/shared/services/typing-indicator.js +0 -54
- package/dist/agents/shared/services/typing-indicator.js.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
- package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
- package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
- package/dist/agents/shared/specialist.d.ts +0 -91
- package/dist/agents/shared/specialist.d.ts.map +0 -1
- package/dist/agents/shared/specialist.js +0 -399
- package/dist/agents/shared/specialist.js.map +0 -1
- package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
- package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
- package/dist/agents/shared/tool-schema-loader.js +0 -238
- package/dist/agents/shared/tool-schema-loader.js.map +0 -1
- package/dist/agents/shared/types.d.ts +0 -190
- package/dist/agents/shared/types.d.ts.map +0 -1
- package/dist/agents/shared/types.js +0 -13
- package/dist/agents/shared/types.js.map +0 -1
- package/dist/bot/bot-config.d.ts +0 -37
- package/dist/bot/bot-config.d.ts.map +0 -1
- package/dist/bot/bot-config.js +0 -219
- package/dist/bot/bot-config.js.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
- package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
- package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
- package/dist/bot/services/session-logger.d.ts +0 -162
- package/dist/bot/services/session-logger.d.ts.map +0 -1
- package/dist/bot/services/session-logger.js +0 -724
- package/dist/bot/services/session-logger.js.map +0 -1
- package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
- package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/bot/services/workspace-schema-cache.js +0 -506
- package/dist/bot/services/workspace-schema-cache.js.map +0 -1
- package/dist/bot-config/tools.d.ts +0 -28
- package/dist/bot-config/tools.d.ts.map +0 -1
- package/dist/bot-config/tools.js +0 -279
- package/dist/bot-config/tools.js.map +0 -1
- package/dist/client/agents/base.d.ts +0 -207
- package/dist/client/agents/base.d.ts.map +0 -1
- package/dist/client/agents/base.js +0 -744
- package/dist/client/agents/base.js.map +0 -1
- package/dist/client/agents/definitions.d.ts +0 -53
- package/dist/client/agents/definitions.d.ts.map +0 -1
- package/dist/client/agents/definitions.js +0 -263
- package/dist/client/agents/definitions.js.map +0 -1
- package/dist/client/agents/orchestrator.d.ts +0 -141
- package/dist/client/agents/orchestrator.d.ts.map +0 -1
- package/dist/client/agents/orchestrator.js +0 -1062
- package/dist/client/agents/orchestrator.js.map +0 -1
- package/dist/client/agents/specialist.d.ts +0 -86
- package/dist/client/agents/specialist.d.ts.map +0 -1
- package/dist/client/agents/specialist.js +0 -340
- package/dist/client/agents/specialist.js.map +0 -1
- package/dist/client/bot-entrypoint.d.ts +0 -7
- package/dist/client/bot-entrypoint.d.ts.map +0 -1
- package/dist/client/bot-entrypoint.js +0 -103
- package/dist/client/bot-entrypoint.js.map +0 -1
- package/dist/client/bot-manager.d.ts +0 -44
- package/dist/client/bot-manager.d.ts.map +0 -1
- package/dist/client/bot-manager.js +0 -173
- package/dist/client/bot-manager.js.map +0 -1
- package/dist/client/bot-runner.d.ts +0 -35
- package/dist/client/bot-runner.d.ts.map +0 -1
- package/dist/client/bot-runner.js +0 -188
- package/dist/client/bot-runner.js.map +0 -1
- package/dist/client/chat-agent-daemon.d.ts +0 -464
- package/dist/client/chat-agent-daemon.d.ts.map +0 -1
- package/dist/client/chat-agent-daemon.js +0 -1774
- package/dist/client/chat-agent-daemon.js.map +0 -1
- package/dist/client/daemon-factory.d.ts +0 -106
- package/dist/client/daemon-factory.d.ts.map +0 -1
- package/dist/client/daemon-factory.js +0 -301
- package/dist/client/daemon-factory.js.map +0 -1
- package/dist/client/factory.d.ts +0 -111
- package/dist/client/factory.d.ts.map +0 -1
- package/dist/client/factory.js +0 -314
- package/dist/client/factory.js.map +0 -1
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -38
- package/dist/client/index.js.map +0 -1
- package/dist/client/multi-bot-manager.d.ts +0 -42
- package/dist/client/multi-bot-manager.d.ts.map +0 -1
- package/dist/client/multi-bot-manager.js +0 -161
- package/dist/client/multi-bot-manager.js.map +0 -1
- package/dist/client/orchestrator-daemon.d.ts +0 -87
- package/dist/client/orchestrator-daemon.d.ts.map +0 -1
- package/dist/client/orchestrator-daemon.js +0 -444
- package/dist/client/orchestrator-daemon.js.map +0 -1
- package/dist/client/server.d.ts +0 -8
- package/dist/client/server.d.ts.map +0 -1
- package/dist/client/server.js +0 -251
- package/dist/client/server.js.map +0 -1
- package/dist/client/services/agent-registry.d.ts +0 -108
- package/dist/client/services/agent-registry.d.ts.map +0 -1
- package/dist/client/services/agent-registry.js +0 -630
- package/dist/client/services/agent-registry.js.map +0 -1
- package/dist/client/services/conversation-manager.d.ts +0 -50
- package/dist/client/services/conversation-manager.d.ts.map +0 -1
- package/dist/client/services/conversation-manager.js +0 -136
- package/dist/client/services/conversation-manager.js.map +0 -1
- package/dist/client/services/mcp-client.d.ts +0 -48
- package/dist/client/services/mcp-client.d.ts.map +0 -1
- package/dist/client/services/mcp-client.js +0 -105
- package/dist/client/services/mcp-client.js.map +0 -1
- package/dist/client/services/message-classifier.d.ts +0 -37
- package/dist/client/services/message-classifier.d.ts.map +0 -1
- package/dist/client/services/message-classifier.js +0 -187
- package/dist/client/services/message-classifier.js.map +0 -1
- package/dist/client/services/message-formatter.d.ts +0 -84
- package/dist/client/services/message-formatter.d.ts.map +0 -1
- package/dist/client/services/message-formatter.js +0 -353
- package/dist/client/services/message-formatter.js.map +0 -1
- package/dist/client/services/session-logger.d.ts +0 -106
- package/dist/client/services/session-logger.d.ts.map +0 -1
- package/dist/client/services/session-logger.js +0 -446
- package/dist/client/services/session-logger.js.map +0 -1
- package/dist/client/services/tool-executor.d.ts +0 -41
- package/dist/client/services/tool-executor.d.ts.map +0 -1
- package/dist/client/services/tool-executor.js +0 -169
- package/dist/client/services/tool-executor.js.map +0 -1
- package/dist/client/services/workspace-schema-cache.d.ts +0 -149
- package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/client/services/workspace-schema-cache.js +0 -732
- package/dist/client/services/workspace-schema-cache.js.map +0 -1
- package/dist/client/specialist-daemon.d.ts +0 -77
- package/dist/client/specialist-daemon.d.ts.map +0 -1
- package/dist/client/specialist-daemon.js +0 -197
- package/dist/client/specialist-daemon.js.map +0 -1
- package/dist/client/specialists.d.ts +0 -53
- package/dist/client/specialists.d.ts.map +0 -1
- package/dist/client/specialists.js +0 -178
- package/dist/client/specialists.js.map +0 -1
- package/dist/client/tool-schema-loader.d.ts +0 -62
- package/dist/client/tool-schema-loader.d.ts.map +0 -1
- package/dist/client/tool-schema-loader.js +0 -232
- package/dist/client/tool-schema-loader.js.map +0 -1
- package/dist/client/types.d.ts +0 -327
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -121
- package/dist/client/types.js.map +0 -1
- package/dist/commands/seed-config.d.ts +0 -9
- package/dist/commands/seed-config.d.ts.map +0 -1
- package/dist/commands/seed-config.js +0 -377
- package/dist/commands/seed-config.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -11
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -320
- package/dist/commands/setup.js.map +0 -1
- package/dist/lib/discussion-lock.d.ts +0 -42
- package/dist/lib/discussion-lock.d.ts.map +0 -1
- package/dist/lib/discussion-lock.js +0 -110
- package/dist/lib/discussion-lock.js.map +0 -1
- package/dist/mcp/signal-handler.d.ts +0 -82
- package/dist/mcp/signal-handler.d.ts.map +0 -1
- package/dist/mcp/signal-handler.js +0 -406
- package/dist/mcp/signal-handler.js.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
- package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
- package/dist/mcp/tools/app-member.d.ts +0 -14
- package/dist/mcp/tools/app-member.d.ts.map +0 -1
- package/dist/mcp/tools/app-member.js +0 -195
- package/dist/mcp/tools/app-member.js.map +0 -1
- package/dist/mcp/tools/app-scaffold.d.ts +0 -14
- package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
- package/dist/mcp/tools/app-scaffold.js +0 -581
- package/dist/mcp/tools/app-scaffold.js.map +0 -1
- package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
- package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/constants.js +0 -94
- package/dist/mcp/tools/bot-config/constants.js.map +0 -1
- package/dist/mcp/tools/bot-config/core.d.ts +0 -253
- package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/core.js +0 -2456
- package/dist/mcp/tools/bot-config/core.js.map +0 -1
- package/dist/mcp/tools/bot-config/index.d.ts +0 -10
- package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/index.js +0 -59
- package/dist/mcp/tools/bot-config/index.js.map +0 -1
- package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
- package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/tools.js +0 -15
- package/dist/mcp/tools/bot-config/tools.js.map +0 -1
- package/dist/mcp/tools/bot-config/types.d.ts +0 -50
- package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/types.js +0 -6
- package/dist/mcp/tools/bot-config/types.js.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
- package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
- package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
- package/dist/mcp/tools/document.d.ts +0 -11
- package/dist/mcp/tools/document.d.ts.map +0 -1
- package/dist/mcp/tools/document.js +0 -741
- package/dist/mcp/tools/document.js.map +0 -1
- package/dist/mcp/tools/investigate.d.ts +0 -9
- package/dist/mcp/tools/investigate.d.ts.map +0 -1
- package/dist/mcp/tools/investigate.js +0 -254
- package/dist/mcp/tools/investigate.js.map +0 -1
- package/dist/mcp/utils/pagination.d.ts +0 -40
- package/dist/mcp/utils/pagination.d.ts.map +0 -1
- package/dist/mcp/utils/pagination.js +0 -55
- package/dist/mcp/utils/pagination.js.map +0 -1
- package/dist/modules/bug-reports/bug-config.d.ts +0 -25
- package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-config.js +0 -187
- package/dist/modules/bug-reports/bug-config.js.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
- package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.js +0 -510
- package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
- package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
- package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
- package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
- package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
- package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
- package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
- package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
- package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.js +0 -375
- package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
- package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.js +0 -298
- package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
- package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
- package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
- package/dist/modules/bug-reports/index.d.ts +0 -77
- package/dist/modules/bug-reports/index.d.ts.map +0 -1
- package/dist/modules/bug-reports/index.js +0 -215
- package/dist/modules/bug-reports/index.js.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
- package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
- package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
- package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
- package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
- package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-registry.js +0 -49
- package/dist/modules/bug-reports/pending-registry.js.map +0 -1
- package/dist/modules/bug-reports/types.d.ts +0 -123
- package/dist/modules/bug-reports/types.d.ts.map +0 -1
- package/dist/modules/bug-reports/types.js +0 -9
- package/dist/modules/bug-reports/types.js.map +0 -1
- package/dist/plugins/bug-fixer/index.d.ts +0 -2
- package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/index.js +0 -18
- package/dist/plugins/bug-fixer/index.js.map +0 -1
- package/dist/plugins/bug-fixer/tools.d.ts +0 -45
- package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/tools.js +0 -1096
- package/dist/plugins/bug-fixer/tools.js.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
- package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
- package/dist/routes/agents.d.ts +0 -44
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js +0 -311
- package/dist/routes/agents.js.map +0 -1
- package/dist/services/agent-credential-store.d.ts +0 -73
- package/dist/services/agent-credential-store.d.ts.map +0 -1
- package/dist/services/agent-credential-store.js +0 -212
- package/dist/services/agent-credential-store.js.map +0 -1
- package/dist/stdio-server.d.ts +0 -14
- package/dist/stdio-server.d.ts.map +0 -1
- package/dist/stdio-server.js +0 -101
- package/dist/stdio-server.js.map +0 -1
- package/dist/workspace/context.d.ts +0 -148
- package/dist/workspace/context.d.ts.map +0 -1
- package/dist/workspace/context.js +0 -339
- package/dist/workspace/context.js.map +0 -1
- package/dist/workspace/credentials.d.ts +0 -55
- package/dist/workspace/credentials.d.ts.map +0 -1
- package/dist/workspace/credentials.js +0 -239
- package/dist/workspace/credentials.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -21
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js +0 -45
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/loader.d.ts +0 -27
- package/dist/workspace/loader.d.ts.map +0 -1
- package/dist/workspace/loader.js +0 -222
- package/dist/workspace/loader.js.map +0 -1
- package/dist/workspace/schema.d.ts +0 -37
- package/dist/workspace/schema.d.ts.map +0 -1
- package/dist/workspace/schema.js +0 -192
- package/dist/workspace/schema.js.map +0 -1
|
@@ -98,7 +98,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
98
98
|
let malformatFilterErrorMessage = undefined;
|
|
99
99
|
for (const [fieldId, filterConfig] of Object.entries(mcpToolActivityListFilters)) {
|
|
100
100
|
switch (filterConfig.operator) {
|
|
101
|
-
case
|
|
101
|
+
case 'text_search':
|
|
102
102
|
if (filterConfig.value !== undefined) {
|
|
103
103
|
apiActivityFilters.and.push({ [fieldId]: { textSearch: filterConfig.value } });
|
|
104
104
|
}
|
|
@@ -106,7 +106,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
106
106
|
malformatFilterErrorMessage = 'text_search filter requires a value';
|
|
107
107
|
}
|
|
108
108
|
break;
|
|
109
|
-
case
|
|
109
|
+
case 'equals':
|
|
110
110
|
if (filterConfig.value !== undefined) {
|
|
111
111
|
apiActivityFilters.and.push({ [fieldId]: { equalTo: filterConfig.value } });
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
114
114
|
malformatFilterErrorMessage = 'equals filter requires a value';
|
|
115
115
|
}
|
|
116
116
|
break;
|
|
117
|
-
case
|
|
117
|
+
case 'not_equals':
|
|
118
118
|
if (filterConfig.value !== undefined) {
|
|
119
119
|
apiActivityFilters.and.push({ [fieldId]: { notEqualTo: filterConfig.value } });
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
122
122
|
malformatFilterErrorMessage = 'not_equals filter requires a value';
|
|
123
123
|
}
|
|
124
124
|
break;
|
|
125
|
-
case
|
|
125
|
+
case 'contains':
|
|
126
126
|
if (filterConfig.value !== undefined) {
|
|
127
127
|
apiActivityFilters.and.push({ [fieldId]: { contains: filterConfig.value } });
|
|
128
128
|
}
|
|
@@ -130,7 +130,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
130
130
|
malformatFilterErrorMessage = 'contains filter requires a value';
|
|
131
131
|
}
|
|
132
132
|
break;
|
|
133
|
-
case
|
|
133
|
+
case 'greater_than':
|
|
134
134
|
if (filterConfig.value !== undefined && typeof filterConfig.value === 'number') {
|
|
135
135
|
apiActivityFilters.and.push({ [fieldId]: { greaterThan: filterConfig.value } });
|
|
136
136
|
}
|
|
@@ -138,7 +138,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
138
138
|
malformatFilterErrorMessage = 'greater_than filter requires a numeric value';
|
|
139
139
|
}
|
|
140
140
|
break;
|
|
141
|
-
case
|
|
141
|
+
case 'greater_than_or_equal':
|
|
142
142
|
if (filterConfig.value !== undefined && typeof filterConfig.value === 'number') {
|
|
143
143
|
apiActivityFilters.and.push({ [fieldId]: { greaterThanOrEqual: filterConfig.value } });
|
|
144
144
|
}
|
|
@@ -146,7 +146,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
146
146
|
malformatFilterErrorMessage = 'greater_than_or_equal filter requires a numeric value';
|
|
147
147
|
}
|
|
148
148
|
break;
|
|
149
|
-
case
|
|
149
|
+
case 'less_than':
|
|
150
150
|
if (filterConfig.value !== undefined && typeof filterConfig.value === 'number') {
|
|
151
151
|
apiActivityFilters.and.push({ [fieldId]: { lessThan: filterConfig.value } });
|
|
152
152
|
}
|
|
@@ -154,7 +154,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
154
154
|
malformatFilterErrorMessage = 'less_than filter requires a numeric value';
|
|
155
155
|
}
|
|
156
156
|
break;
|
|
157
|
-
case
|
|
157
|
+
case 'less_than_or_equal':
|
|
158
158
|
if (filterConfig.value !== undefined && typeof filterConfig.value === 'number') {
|
|
159
159
|
apiActivityFilters.and.push({ [fieldId]: { lessThanOrEqual: filterConfig.value } });
|
|
160
160
|
}
|
|
@@ -162,7 +162,7 @@ function convertActivityFilters(mcpToolActivityListFilters) {
|
|
|
162
162
|
malformatFilterErrorMessage = 'less_than_or_equal filter requires a numeric value';
|
|
163
163
|
}
|
|
164
164
|
break;
|
|
165
|
-
case
|
|
165
|
+
case 'range':
|
|
166
166
|
if (!filterConfig.start || !filterConfig.end) {
|
|
167
167
|
malformatFilterErrorMessage = 'Incorrect filter format, either start or end not provided for range';
|
|
168
168
|
break;
|
|
@@ -205,7 +205,7 @@ function formatActivityListResponseWithPagination(activityData, workflow, init,
|
|
|
205
205
|
return {
|
|
206
206
|
content: [
|
|
207
207
|
{
|
|
208
|
-
type:
|
|
208
|
+
type: 'text',
|
|
209
209
|
text: responseText,
|
|
210
210
|
},
|
|
211
211
|
],
|
|
@@ -232,11 +232,13 @@ function formatFilteredActivityListResponse(activityData, workflow, init, args)
|
|
|
232
232
|
for (const [fieldId, filter] of Object.entries(args.filters || {})) {
|
|
233
233
|
const filterConfig = filter;
|
|
234
234
|
responseText += `- Field \`${fieldId}\`: ${filterConfig.operator}`;
|
|
235
|
-
if (filterConfig.value !== undefined)
|
|
235
|
+
if (filterConfig.value !== undefined) {
|
|
236
236
|
responseText += ` = "${filterConfig.value}"`;
|
|
237
|
-
|
|
237
|
+
}
|
|
238
|
+
if (filterConfig.start !== undefined) {
|
|
238
239
|
responseText += ` from ${filterConfig.start} to ${filterConfig.end}`;
|
|
239
|
-
|
|
240
|
+
}
|
|
241
|
+
responseText += '\n';
|
|
240
242
|
}
|
|
241
243
|
if (args.search) {
|
|
242
244
|
responseText += `- Text search: "${args.search}"\n`;
|
|
@@ -257,7 +259,7 @@ function formatFilteredActivityListResponse(activityData, workflow, init, args)
|
|
|
257
259
|
responseText += `- Call get_workflow_schema to verify field IDs are correct\n`;
|
|
258
260
|
responseText += `- Use list_activities without filters to see all activities`;
|
|
259
261
|
return {
|
|
260
|
-
content: [{ type:
|
|
262
|
+
content: [{ type: 'text', text: responseText }],
|
|
261
263
|
};
|
|
262
264
|
}
|
|
263
265
|
responseText += `\n` + (0, index_1.formatActivityListResponse)(filteredActivities, workflow, undefined);
|
|
@@ -270,19 +272,164 @@ function formatFilteredActivityListResponse(activityData, workflow, init, args)
|
|
|
270
272
|
return {
|
|
271
273
|
content: [
|
|
272
274
|
{
|
|
273
|
-
type:
|
|
275
|
+
type: 'text',
|
|
274
276
|
text: responseText,
|
|
275
277
|
},
|
|
276
278
|
],
|
|
277
279
|
};
|
|
278
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* countOnly fast path for list_activities ā preserved verbatim from the retired
|
|
283
|
+
* count_activities tool. O(1): calls v3.activity.count, never fetches activities.
|
|
284
|
+
*/
|
|
285
|
+
async function executeActivityCount(workflowId, context) {
|
|
286
|
+
logger.debug('Counting activities', {
|
|
287
|
+
workflowId,
|
|
288
|
+
apiKey: context.apiKey.substring(0, 8) + '...',
|
|
289
|
+
});
|
|
290
|
+
try {
|
|
291
|
+
// Get workflow name from cached data (matches by _id or key)
|
|
292
|
+
const workflow = (context.init.processes || []).find((proc) => proc._id === workflowId || proc.key === workflowId);
|
|
293
|
+
if (!workflow) {
|
|
294
|
+
return {
|
|
295
|
+
content: [{
|
|
296
|
+
type: 'text',
|
|
297
|
+
text: `ā Workflow "${workflowId}" not found`,
|
|
298
|
+
}],
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
logger.debug('Calling v3.activity.count', {
|
|
302
|
+
workflowId,
|
|
303
|
+
workflowName: workflow.name,
|
|
304
|
+
});
|
|
305
|
+
// Call v3.activity.count endpoint
|
|
306
|
+
// Returns object with phase IDs as keys and counts as values
|
|
307
|
+
const result = await context.hailer.request('v3.activity.count', [workflowId]);
|
|
308
|
+
logger.debug('Activity count retrieved', {
|
|
309
|
+
result: JSON.stringify(result),
|
|
310
|
+
});
|
|
311
|
+
// Sum all counts across phases
|
|
312
|
+
const count = Object.values(result).reduce((sum, phaseCount) => sum + phaseCount, 0);
|
|
313
|
+
let responseText = `š¢ **Activity Count for "${workflow.name}"**\n\n`;
|
|
314
|
+
responseText += `**Workflow ID:** \`${workflowId}\`\n`;
|
|
315
|
+
responseText += `**Total Activities:** ${count}\n\n`;
|
|
316
|
+
if (count === 0) {
|
|
317
|
+
responseText += `š” This workflow has no activities yet. Use \`create_activity\` to add one.\n`;
|
|
318
|
+
return {
|
|
319
|
+
content: [{ type: 'text', text: responseText }],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
responseText += `š” **Next Steps:**\n`;
|
|
323
|
+
responseText += `- Use \`list_activities\` to see the activities\n`;
|
|
324
|
+
responseText += `- Use \`get_workflow_schema\` to see workflow structure\n`;
|
|
325
|
+
return {
|
|
326
|
+
content: [{ type: 'text', text: responseText }],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
331
|
+
logger.error('Error counting activities', error);
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
content: [{
|
|
335
|
+
type: 'text',
|
|
336
|
+
text: `ā Error counting activities: ${error instanceof Error ? error.message : String(error)}\n\n**Tips:**\n` +
|
|
337
|
+
'- Check that workflow ID is valid (24 characters)\n- Use `list_workflows` to find workflow IDs',
|
|
338
|
+
}],
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Validate the keys of a fields object against a workflow's field definitions.
|
|
344
|
+
* The server silently ignores unknown keys (e.g. field NAMES instead of IDs) and
|
|
345
|
+
* reports success ā the #1 documented footgun ā so we error out before the API call.
|
|
346
|
+
*
|
|
347
|
+
* ORDERING: in both create_activity and update_activity this runs AFTER the
|
|
348
|
+
* date/activitylink auto-fixups and immediately before the API call. The fixups
|
|
349
|
+
* rewrite values only, never keys, so the validated key set is identical either way.
|
|
350
|
+
*
|
|
351
|
+
* Accepts field IDs and field keys (the API resolves both).
|
|
352
|
+
* Returns error text for unknown keys, or undefined when all keys are known.
|
|
353
|
+
*/
|
|
354
|
+
function validateFieldKeys(fields, workflowFields) {
|
|
355
|
+
const knownKeys = new Set();
|
|
356
|
+
const labelToId = new Map();
|
|
357
|
+
for (const [fieldId, fieldDef] of Object.entries(workflowFields)) {
|
|
358
|
+
const def = fieldDef;
|
|
359
|
+
knownKeys.add(fieldId);
|
|
360
|
+
if (def.key) {
|
|
361
|
+
knownKeys.add(def.key);
|
|
362
|
+
}
|
|
363
|
+
if (def.label) {
|
|
364
|
+
labelToId.set(String(def.label).toLowerCase(), fieldId);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const unknownKeys = Object.keys(fields).filter((key) => !knownKeys.has(key));
|
|
368
|
+
if (unknownKeys.length === 0) {
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
371
|
+
const lines = [];
|
|
372
|
+
let needsFieldList = false;
|
|
373
|
+
for (const key of unknownKeys) {
|
|
374
|
+
const labelMatchId = labelToId.get(key.toLowerCase());
|
|
375
|
+
if (labelMatchId) {
|
|
376
|
+
const label = workflowFields[labelMatchId].label;
|
|
377
|
+
lines.push(`Field "${key}" must be referenced by ID: use "${labelMatchId}" (label: "${label}")`);
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
lines.push(`Unknown field key "${key}".`);
|
|
381
|
+
needsFieldList = true;
|
|
382
|
+
}
|
|
383
|
+
if (needsFieldList) {
|
|
384
|
+
const available = Object.entries(workflowFields)
|
|
385
|
+
.slice(0, 20)
|
|
386
|
+
.map(([fid, def]) => `- "${fid}" (label: "${def.label || def.key || fid}")`);
|
|
387
|
+
lines.push('', 'Available field IDs:', ...available);
|
|
388
|
+
}
|
|
389
|
+
return lines.join('\n');
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* update_activity field-key validation: resolves the activity's workflow (the
|
|
393
|
+
* workflowId is not a tool param) via fetchActivityById ā activity.process, then
|
|
394
|
+
* validates the fields object's keys. Fail-open on resolution problems (broken
|
|
395
|
+
* function fields, deleted activity, workflow missing from init) ā those must not
|
|
396
|
+
* block updates; unknown keys in a resolved workflow still hard-error.
|
|
397
|
+
* Returns formatted error text, or undefined when valid or unresolvable.
|
|
398
|
+
*/
|
|
399
|
+
async function validateUpdateFieldKeys(activityId, fields, context) {
|
|
400
|
+
if (Object.keys(fields).length === 0) {
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
let workflowFields;
|
|
404
|
+
try {
|
|
405
|
+
const activity = await context.hailer.fetchActivityById(activityId);
|
|
406
|
+
const workflow = context.init.processes?.find((proc) => proc._id === activity?.process);
|
|
407
|
+
workflowFields = workflow?.fields;
|
|
408
|
+
}
|
|
409
|
+
catch (error) {
|
|
410
|
+
logger.warn('Skipping field-key validation - could not resolve workflow for activity', {
|
|
411
|
+
activityId,
|
|
412
|
+
error: (0, tool_helpers_1.extractErrorMessage)(error),
|
|
413
|
+
});
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
if (!workflowFields) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
const keyError = validateFieldKeys(fields, workflowFields);
|
|
420
|
+
if (!keyError) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
return `ā Invalid field keys for activity ${activityId} ā nothing was updated.\n\n${keyError}`;
|
|
424
|
+
}
|
|
279
425
|
/** Auto-fix date fields: convert ISO date strings to Unix timestamps (ms).
|
|
280
426
|
* If workspaceCache is available, only converts confirmed date/datetime/time fields.
|
|
281
427
|
* If not available, converts any value matching ISO date format (safe ā non-date fields won't have date strings). */
|
|
282
428
|
function autoFixDateFields(fields, context) {
|
|
283
429
|
for (const [fieldId, fieldValue] of Object.entries(fields)) {
|
|
284
|
-
if (typeof fieldValue !== 'string' || !/^\d{4}-\d{2}-\d{2}/.test(fieldValue))
|
|
430
|
+
if (typeof fieldValue !== 'string' || !/^\d{4}-\d{2}-\d{2}/.test(fieldValue)) {
|
|
285
431
|
continue;
|
|
432
|
+
}
|
|
286
433
|
// Try to confirm field type from cache
|
|
287
434
|
let fieldType;
|
|
288
435
|
if (context.workspaceCache) {
|
|
@@ -297,15 +444,16 @@ function autoFixDateFields(fields, context) {
|
|
|
297
444
|
// Convert if confirmed date type, OR if no cache (assume date ā non-date fields won't have ISO date strings)
|
|
298
445
|
if (!fieldType || fieldType === 'date' || fieldType === 'datetime' || fieldType === 'time') {
|
|
299
446
|
const parsed = new Date(fieldValue.length === 10 ? fieldValue + 'T12:00:00' : fieldValue).getTime();
|
|
300
|
-
if (!isNaN(parsed))
|
|
447
|
+
if (!isNaN(parsed)) {
|
|
301
448
|
fields[fieldId] = parsed;
|
|
449
|
+
}
|
|
302
450
|
}
|
|
303
451
|
}
|
|
304
452
|
}
|
|
305
453
|
/** Build activity update object */
|
|
306
454
|
function buildActivityUpdate(args, context) {
|
|
307
455
|
let parsedFields = args.fields;
|
|
308
|
-
if (typeof args.fields ===
|
|
456
|
+
if (typeof args.fields === 'string') {
|
|
309
457
|
try {
|
|
310
458
|
parsedFields = JSON.parse(args.fields);
|
|
311
459
|
}
|
|
@@ -314,25 +462,25 @@ function buildActivityUpdate(args, context) {
|
|
|
314
462
|
}
|
|
315
463
|
}
|
|
316
464
|
// Auto-fix activitylink fields: if LLM passes an object instead of just the ID string
|
|
317
|
-
if (parsedFields && typeof parsedFields ===
|
|
465
|
+
if (parsedFields && typeof parsedFields === 'object') {
|
|
318
466
|
for (const [fieldId, fieldValue] of Object.entries(parsedFields)) {
|
|
319
|
-
if (fieldValue && typeof fieldValue ===
|
|
467
|
+
if (fieldValue && typeof fieldValue === 'object' && !Array.isArray(fieldValue)) {
|
|
320
468
|
const obj = fieldValue;
|
|
321
469
|
let extractedId = null;
|
|
322
470
|
// Case 1: {type: "activitylink", value: {_id: "...", name: "..."}}
|
|
323
|
-
if (obj.type && obj.value && typeof obj.value ===
|
|
471
|
+
if (obj.type && obj.value && typeof obj.value === 'object' && obj.value._id) {
|
|
324
472
|
extractedId = obj.value._id;
|
|
325
473
|
}
|
|
326
474
|
// Case 2: {_id: "...", name: "..."}
|
|
327
|
-
|
|
475
|
+
if (!extractedId && obj._id && typeof obj._id === 'string') {
|
|
328
476
|
extractedId = obj._id;
|
|
329
477
|
}
|
|
330
478
|
// Case 3: {value: "..."} where value is the ID string
|
|
331
|
-
|
|
479
|
+
if (!extractedId && obj.value && typeof obj.value === 'string' && /^[a-f0-9]{24}$/i.test(obj.value)) {
|
|
332
480
|
extractedId = obj.value;
|
|
333
481
|
}
|
|
334
482
|
if (extractedId) {
|
|
335
|
-
logger.warn(
|
|
483
|
+
logger.warn('Auto-fixing activitylink field - extracting ID from object', {
|
|
336
484
|
fieldId,
|
|
337
485
|
original: JSON.stringify(fieldValue),
|
|
338
486
|
extracted: extractedId,
|
|
@@ -343,20 +491,21 @@ function buildActivityUpdate(args, context) {
|
|
|
343
491
|
}
|
|
344
492
|
}
|
|
345
493
|
// Field-type aware validation and auto-fix
|
|
346
|
-
if (parsedFields && typeof parsedFields ===
|
|
494
|
+
if (parsedFields && typeof parsedFields === 'object' && context.workspaceCache) {
|
|
347
495
|
autoFixDateFields(parsedFields, context);
|
|
348
496
|
const invalidUsers = [];
|
|
349
497
|
for (const [fieldId, fieldValue] of Object.entries(parsedFields)) {
|
|
350
498
|
// Only check string values that look like IDs
|
|
351
|
-
if (typeof fieldValue !==
|
|
499
|
+
if (typeof fieldValue !== 'string' || !/^[a-f0-9]{24}$/i.test(fieldValue)) {
|
|
352
500
|
continue;
|
|
353
501
|
}
|
|
354
502
|
// Find the field definition to check its type
|
|
355
503
|
let fieldType;
|
|
356
504
|
for (const workflow of context.workspaceCache.rawInit.processes) {
|
|
357
505
|
const workflowFields = workflow.fields;
|
|
358
|
-
if (!workflowFields)
|
|
506
|
+
if (!workflowFields) {
|
|
359
507
|
continue;
|
|
508
|
+
}
|
|
360
509
|
const field = workflowFields[fieldId];
|
|
361
510
|
if (field) {
|
|
362
511
|
fieldType = field.type;
|
|
@@ -373,14 +522,14 @@ function buildActivityUpdate(args, context) {
|
|
|
373
522
|
// Skip validation for 'activitylink' and other field types
|
|
374
523
|
}
|
|
375
524
|
if (invalidUsers.length > 0) {
|
|
376
|
-
throw new Error(`Invalid user IDs in user fields: ${invalidUsers.join(
|
|
525
|
+
throw new Error(`Invalid user IDs in user fields: ${invalidUsers.join(', ')}. Use search_workspace_users to find valid user IDs.`);
|
|
377
526
|
}
|
|
378
527
|
}
|
|
379
528
|
return {
|
|
380
529
|
_id: args.activityId,
|
|
381
530
|
...(args.name && { name: args.name }),
|
|
382
531
|
...(parsedFields &&
|
|
383
|
-
typeof parsedFields ===
|
|
532
|
+
typeof parsedFields === 'object' && {
|
|
384
533
|
fields: parsedFields,
|
|
385
534
|
}),
|
|
386
535
|
...(args.phaseId && { phaseId: args.phaseId }),
|
|
@@ -391,22 +540,115 @@ function buildActivityUpdate(args, context) {
|
|
|
391
540
|
*/
|
|
392
541
|
function formatUpdateActivityResponse(args, result) {
|
|
393
542
|
const changesText = [
|
|
394
|
-
args.name ? `- Name: "${args.name}"` :
|
|
395
|
-
args.fields ? `- Fields: ${JSON.stringify(args.fields, null, 2)}` :
|
|
396
|
-
args.phaseId ? `- Moved to phase: ${args.phaseId}` :
|
|
543
|
+
args.name ? `- Name: "${args.name}"` : '',
|
|
544
|
+
args.fields ? `- Fields: ${JSON.stringify(args.fields, null, 2)}` : '',
|
|
545
|
+
args.phaseId ? `- Moved to phase: ${args.phaseId}` : '',
|
|
397
546
|
]
|
|
398
547
|
.filter(Boolean)
|
|
399
|
-
.join(
|
|
548
|
+
.join('\n');
|
|
400
549
|
const responseText = `ā
Successfully updated activity ${args.activityId}!\n\nš Changes applied:\n${changesText}\n\nš” The activity has been updated in your Hailer workspace.\n\nAPI Response:\n${JSON.stringify(result, null, 2)}`;
|
|
401
550
|
return {
|
|
402
551
|
content: [
|
|
403
552
|
{
|
|
404
|
-
type:
|
|
553
|
+
type: 'text',
|
|
405
554
|
text: responseText,
|
|
406
555
|
},
|
|
407
556
|
],
|
|
408
557
|
};
|
|
409
558
|
}
|
|
559
|
+
/** Bulk-mode body of update_activity ā extracted so the per-item field-key validation keeps flat control flow. */
|
|
560
|
+
async function executeBulkUpdate(activities, context) {
|
|
561
|
+
logger.debug('Bulk update mode', {
|
|
562
|
+
activityCount: activities.length,
|
|
563
|
+
activities: JSON.stringify(activities, null, 2)
|
|
564
|
+
});
|
|
565
|
+
// Auto-fix common parameter name mistakes
|
|
566
|
+
for (const activity of activities) {
|
|
567
|
+
// Fix activityId -> _id
|
|
568
|
+
if (!activity._id && activity.activityId) {
|
|
569
|
+
logger.warn('Auto-fixing: activityId -> _id', { activityId: activity.activityId });
|
|
570
|
+
activity._id = activity.activityId;
|
|
571
|
+
delete activity.activityId;
|
|
572
|
+
}
|
|
573
|
+
// Fix fieldsAndValues -> fields
|
|
574
|
+
if (!activity.fields && activity.fieldsAndValues) {
|
|
575
|
+
logger.warn('Auto-fixing: fieldsAndValues -> fields', { activityId: activity._id });
|
|
576
|
+
activity.fields = activity.fieldsAndValues;
|
|
577
|
+
delete activity.fieldsAndValues;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
// Validate that all activities have _id
|
|
581
|
+
const invalidActivities = activities.filter((act) => !act._id || typeof act._id !== 'string' || act._id.length < 24);
|
|
582
|
+
if (invalidActivities.length > 0) {
|
|
583
|
+
return {
|
|
584
|
+
content: [{
|
|
585
|
+
type: 'text',
|
|
586
|
+
text: `ā **Error: Invalid bulk update request**\n\nEach activity in the "activities" array MUST have a valid "_id" field (24-character activity ID).\n\n**What you sent:** ${JSON.stringify(activities, null, 2)}\n\n**Correct format:**\n\`\`\`json\n{\n "activities": [\n { "_id": "691ffe654217e9e8434e577c", "fields": { "fieldId": "value" } },\n { "_id": "691ffe654217e9e8434e5774", "name": "New Name" }\n ]\n}\n\`\`\`\n\n**Tip:** First use list_activities to get the activity IDs, then pass them in the _id field.`,
|
|
587
|
+
}],
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
// Build updates for each activity
|
|
591
|
+
const updates = activities.map((activity) => {
|
|
592
|
+
const activityUpdate = { _id: activity._id };
|
|
593
|
+
if (activity.name) {
|
|
594
|
+
activityUpdate.name = activity.name;
|
|
595
|
+
}
|
|
596
|
+
if (activity.fields) {
|
|
597
|
+
// Parse fields if string
|
|
598
|
+
const parsedFields = typeof activity.fields === 'string'
|
|
599
|
+
? JSON.parse(activity.fields)
|
|
600
|
+
: activity.fields;
|
|
601
|
+
// Auto-fix activitylink fields: if LLM passes object with _id, extract just the ID
|
|
602
|
+
if (parsedFields && typeof parsedFields === 'object') {
|
|
603
|
+
for (const [fieldId, fieldValue] of Object.entries(parsedFields)) {
|
|
604
|
+
if (fieldValue &&
|
|
605
|
+
typeof fieldValue === 'object' &&
|
|
606
|
+
!Array.isArray(fieldValue) &&
|
|
607
|
+
'_id' in fieldValue &&
|
|
608
|
+
typeof fieldValue._id === 'string') {
|
|
609
|
+
logger.warn('Auto-fixing activitylink field in bulk mode', {
|
|
610
|
+
activityId: activity._id,
|
|
611
|
+
fieldId,
|
|
612
|
+
extracted: fieldValue._id,
|
|
613
|
+
});
|
|
614
|
+
parsedFields[fieldId] = fieldValue._id;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
autoFixDateFields(parsedFields, context);
|
|
619
|
+
activityUpdate.fields = parsedFields;
|
|
620
|
+
}
|
|
621
|
+
return activityUpdate;
|
|
622
|
+
});
|
|
623
|
+
// Per-item field-key validation ā runs AFTER the auto-fixups above
|
|
624
|
+
// (values only, keys unchanged; see validateFieldKeys). Resolves each
|
|
625
|
+
// activity's workflow first; unknown keys silently no-op server-side otherwise.
|
|
626
|
+
for (const update of updates) {
|
|
627
|
+
const keyError = update.fields ? await validateUpdateFieldKeys(update._id, update.fields, context) : undefined;
|
|
628
|
+
if (keyError) {
|
|
629
|
+
return {
|
|
630
|
+
content: [{ type: 'text', text: keyError }],
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
// Collect unique phase IDs (most activities will have the same phase)
|
|
635
|
+
const phaseIds = activities
|
|
636
|
+
.map((act) => act.phaseId)
|
|
637
|
+
.filter((pid) => pid);
|
|
638
|
+
const commonPhaseId = phaseIds.length > 0 ? phaseIds[0] : undefined;
|
|
639
|
+
// Call API with all updates
|
|
640
|
+
const options = commonPhaseId ? { phaseId: commonPhaseId } : undefined;
|
|
641
|
+
await context.hailer.updateActivities(updates, options);
|
|
642
|
+
// Format bulk response
|
|
643
|
+
return {
|
|
644
|
+
content: [
|
|
645
|
+
{
|
|
646
|
+
type: 'text',
|
|
647
|
+
text: `š Successfully updated ${activities.length} activities!\n\nš **Bulk Update Summary:**\n- **Total Updated**: ${activities.length} activities\n- **Status**: All activities updated successfully\n\nā
All activities have been updated in your Hailer workspace!`,
|
|
648
|
+
},
|
|
649
|
+
],
|
|
650
|
+
};
|
|
651
|
+
}
|
|
410
652
|
const listActivitiesDescription = `List activities (items/records/tasks) from a workflow phase.
|
|
411
653
|
|
|
412
654
|
**Prerequisites:** You need workflowId, phaseId, and field IDs. Get them via:
|
|
@@ -416,18 +658,17 @@ const listActivitiesDescription = `List activities (items/records/tasks) from a
|
|
|
416
658
|
|
|
417
659
|
**Required params:** workflowId, phaseId, fields[] (array of field IDs to return)
|
|
418
660
|
|
|
419
|
-
**
|
|
420
|
-
1. list_workflows_minimal ā find "Tasks" workflow
|
|
421
|
-
2. list_workflow_phases ā find "Open" phase
|
|
422
|
-
3. get_workflow_schema ā get field IDs
|
|
423
|
-
4. list_activities with those IDs`;
|
|
661
|
+
**Fast path:** \`countOnly: true\` returns only the workflow's total activity count (O(1), needs just workflowId ā no phaseId/fields).`;
|
|
424
662
|
exports.listActivitiesTool = {
|
|
425
663
|
name: 'list_activities',
|
|
426
664
|
group: tool_registry_1.ToolGroup.READ,
|
|
427
665
|
description: listActivitiesDescription,
|
|
428
666
|
schema: zod_1.z.object({
|
|
429
|
-
workflowId: zod_1.z.string().describe(
|
|
430
|
-
phaseId: zod_1.z.string().
|
|
667
|
+
workflowId: zod_1.z.string().describe('Workflow ID or key to list activities from'),
|
|
668
|
+
phaseId: zod_1.z.string().optional()
|
|
669
|
+
.describe('Phase ID or key to filter activities. Required unless countOnly=true. Use list_workflow_phases for phases'),
|
|
670
|
+
countOnly: zod_1.z.coerce.boolean().optional().default(false).describe('Fast path: return only the total activity count for the workflow (O(1) v3.activity.count). ' +
|
|
671
|
+
'Needs just workflowId; phaseId/fields/filters are ignored.'),
|
|
431
672
|
fields: zod_1.z.preprocess((val) => {
|
|
432
673
|
if (typeof val === 'string') {
|
|
433
674
|
try {
|
|
@@ -440,31 +681,35 @@ exports.listActivitiesTool = {
|
|
|
440
681
|
}
|
|
441
682
|
}
|
|
442
683
|
return val;
|
|
443
|
-
}, zod_1.z.array(zod_1.z.string()).optional()).describe(
|
|
684
|
+
}, zod_1.z.array(zod_1.z.string()).optional()).describe('Array of field IDs or keys to return (use get_workflow_schema to see available fields). Select the fields needed for the task - use fewer fields for listings (name, status, etc.) and more fields when detailed information is required. If not provided, you must call get_workflow_schema first.'),
|
|
444
685
|
filters: zod_1.z.record(zod_1.z.object({
|
|
445
686
|
operator: zod_1.z.enum([
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
]).describe(
|
|
456
|
-
value: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional().describe(
|
|
687
|
+
'text_search',
|
|
688
|
+
'equals',
|
|
689
|
+
'not_equals',
|
|
690
|
+
'contains',
|
|
691
|
+
'greater_than',
|
|
692
|
+
'greater_than_or_equal',
|
|
693
|
+
'less_than',
|
|
694
|
+
'less_than_or_equal',
|
|
695
|
+
'range',
|
|
696
|
+
]).describe('Filter operator: text_search for partial text match in field (BEST for filtering by text in relationship fields when you only have a name), equals for exact match (requires activity ID), range for date/number ranges, contains for partial text, comparison operators for numbers/dates'),
|
|
697
|
+
value: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional().describe('Value to filter by - REQUIRED for text_search, equals, not_equals, contains, greater_than, less_than operators. NOT USED for range operator (use start/end instead). For text_search: use the text/name to search for. For equals: use the entity ID.'),
|
|
457
698
|
start: zod_1.z.coerce.number().optional().describe("Start value - ONLY for range operator (NOT in 'value' field). Unix timestamp in milliseconds for date ranges. NOT nested in 'value'."),
|
|
458
699
|
end: zod_1.z.coerce.number().optional().describe("End value - ONLY for range operator (NOT in 'value' field). Unix timestamp in milliseconds for date ranges. Example: for June 2025 date range, use end=1719791999000 directly here, NOT nested in 'value'."),
|
|
459
700
|
})).optional().describe("Filter by field values. STRUCTURE: {\"fieldId\": {\"operator\": \"...\", \"value\": \"...\"}}. EXAMPLE: To find player named 'Harry Kane', use: {\"691ffdf84217e9e8434e5694\": {\"operator\": \"text_search\", \"value\": \"Harry Kane\"}}. WRONG: {\"playerName\": \"Harry Kane\"} or {\"fieldId\": \"Harry Kane\"}. Operators: text_search (partial text match), equals (exact ID match), range (use start/end instead of value)."),
|
|
460
|
-
search: zod_1.z.string().optional().describe(
|
|
461
|
-
limit: zod_1.z.coerce.number().optional().default(50).describe(
|
|
462
|
-
page: zod_1.z.coerce.number().optional().default(0).describe(
|
|
463
|
-
sortBy: zod_1.z.enum([
|
|
464
|
-
sortOrder: zod_1.z.enum([
|
|
465
|
-
includeStats: zod_1.z.coerce.boolean().optional().default(true).describe(
|
|
701
|
+
search: zod_1.z.string().optional().describe('Text search across activity content - USE FILTERS INSTEAD when possible for reliable results. Only use search for truly exploratory queries.'),
|
|
702
|
+
limit: zod_1.z.coerce.number().optional().default(50).describe('Maximum number of activities to return (default: 50, max: 20000)'),
|
|
703
|
+
page: zod_1.z.coerce.number().optional().default(0).describe('Page number for pagination (0-based)'),
|
|
704
|
+
sortBy: zod_1.z.enum(['name', 'created', 'updated', 'priority']).optional().default('updated').describe('Field to sort by'),
|
|
705
|
+
sortOrder: zod_1.z.enum(['asc', 'desc']).optional().default('desc').describe('Sort direction'),
|
|
706
|
+
includeStats: zod_1.z.coerce.boolean().optional().default(true).describe('Include total count and pagination metadata'),
|
|
466
707
|
}),
|
|
467
708
|
async execute(args, context) {
|
|
709
|
+
// countOnly fast path ā dispatches to the retired count_activities body (own error handling)
|
|
710
|
+
if (args.countOnly) {
|
|
711
|
+
return executeActivityCount(args.workflowId, context);
|
|
712
|
+
}
|
|
468
713
|
try {
|
|
469
714
|
const workflow = validateAndGetWorkflow(args.workflowId, context.init);
|
|
470
715
|
const phaseId = await resolvePhaseForListing(workflow, args, context.init);
|
|
@@ -472,7 +717,7 @@ exports.listActivitiesTool = {
|
|
|
472
717
|
return {
|
|
473
718
|
content: [
|
|
474
719
|
{
|
|
475
|
-
type:
|
|
720
|
+
type: 'text',
|
|
476
721
|
text: `ā **Fields parameter required**: You must specify which fields to return to avoid huge responses.\n\n` +
|
|
477
722
|
`š **Next steps:**\n` +
|
|
478
723
|
`1. Call \`get_workflow_schema\` with workflowId: "${args.workflowId}" and phaseId: "${phaseId}" to see available fields\n` +
|
|
@@ -502,7 +747,7 @@ exports.listActivitiesTool = {
|
|
|
502
747
|
return {
|
|
503
748
|
content: [
|
|
504
749
|
{
|
|
505
|
-
type:
|
|
750
|
+
type: 'text',
|
|
506
751
|
text: `ā **Filter Error:** ${filterErrorMessage}\n\n` +
|
|
507
752
|
`š” **Valid operators:** equals, not_equals, contains, text_search, greater_than, less_than, range\n` +
|
|
508
753
|
`š Call \`get_workflow_schema\` to see available field IDs and types`,
|
|
@@ -542,12 +787,13 @@ exports.listActivitiesTool = {
|
|
|
542
787
|
return response;
|
|
543
788
|
}
|
|
544
789
|
catch (error) {
|
|
545
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
546
|
-
logger.error(
|
|
790
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
791
|
+
logger.error('Failed to list activities', error);
|
|
792
|
+
}
|
|
547
793
|
return {
|
|
548
794
|
content: [
|
|
549
795
|
{
|
|
550
|
-
type:
|
|
796
|
+
type: 'text',
|
|
551
797
|
text: `ā Failed to list activities: ${(0, tool_helpers_1.extractErrorMessage)(error)}`,
|
|
552
798
|
},
|
|
553
799
|
],
|
|
@@ -567,37 +813,38 @@ exports.showActivityByIdTool = {
|
|
|
567
813
|
group: tool_registry_1.ToolGroup.READ,
|
|
568
814
|
description: showActivityByIdDescription,
|
|
569
815
|
schema: zod_1.z.object({
|
|
570
|
-
activityId: zod_1.z.string().describe(
|
|
816
|
+
activityId: zod_1.z.string().describe('Activity ID to load'),
|
|
571
817
|
}),
|
|
572
818
|
async execute(args, context) {
|
|
573
819
|
// Validate: reject known non-activity ID patterns
|
|
574
820
|
const id = args.activityId;
|
|
575
821
|
if (!id || typeof id !== 'string' || id.length < 24) {
|
|
576
822
|
return {
|
|
577
|
-
content: [{ type:
|
|
823
|
+
content: [{ type: 'text', text: `ā Invalid activity ID: "${id}". Activity IDs are 24-character hex strings from list_activities results. Do NOT use workflow IDs, field IDs, phase IDs, or discussion IDs.` }],
|
|
578
824
|
};
|
|
579
825
|
}
|
|
580
826
|
try {
|
|
581
827
|
const activity = await context.hailer.fetchActivityById(args.activityId);
|
|
582
|
-
|
|
828
|
+
const responseText = `ā
Loaded activity with ID "${activity._id}":\n\n${JSON.stringify(activity, null, 2)}`;
|
|
583
829
|
return {
|
|
584
830
|
content: [
|
|
585
831
|
{
|
|
586
|
-
type:
|
|
832
|
+
type: 'text',
|
|
587
833
|
text: responseText,
|
|
588
834
|
},
|
|
589
835
|
],
|
|
590
836
|
};
|
|
591
837
|
}
|
|
592
838
|
catch (error) {
|
|
593
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
594
|
-
logger.error(
|
|
839
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
840
|
+
logger.error('Failed to load activity', error, {
|
|
595
841
|
activityId: args.activityId,
|
|
596
842
|
});
|
|
843
|
+
}
|
|
597
844
|
return {
|
|
598
845
|
content: [
|
|
599
846
|
{
|
|
600
|
-
type:
|
|
847
|
+
type: 'text',
|
|
601
848
|
text: `ā Failed to load activity "${args.activityId}": ${(0, tool_helpers_1.extractErrorMessage)(error)}\n\nā ļø Make sure this is an ACTIVITY ID (from list_activities or activity._id), NOT a workflow ID, field ID, phase ID, or discussion ID.`,
|
|
602
849
|
},
|
|
603
850
|
],
|
|
@@ -633,38 +880,38 @@ exports.createActivityTool = {
|
|
|
633
880
|
schema: zod_1.z.object({
|
|
634
881
|
workflowId: zod_1.z
|
|
635
882
|
.string()
|
|
636
|
-
.describe(
|
|
883
|
+
.describe('The workflow ID or key where to create the activity/activities. Find this in any list_* tool results'),
|
|
637
884
|
// BULK CREATION (optional - takes precedence over single parameters)
|
|
638
885
|
activities: zod_1.z
|
|
639
886
|
.array(zod_1.z.object({
|
|
640
|
-
name: zod_1.z.string().min(1,
|
|
641
|
-
fields: zod_1.z.union([zod_1.z.record(zod_1.z.any()), zod_1.z.string()]).optional().describe(
|
|
642
|
-
phaseId: zod_1.z.string().optional().describe(
|
|
643
|
-
teamId: zod_1.z.string().optional().describe(
|
|
644
|
-
discussionId: zod_1.z.string().optional().describe(
|
|
645
|
-
followerIds: zod_1.z.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional().describe(
|
|
646
|
-
fileIds: zod_1.z.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional().describe(
|
|
887
|
+
name: zod_1.z.string().min(1, 'Activity name cannot be empty').describe('Activity name/title'),
|
|
888
|
+
fields: zod_1.z.union([zod_1.z.record(zod_1.z.any()), zod_1.z.string()]).optional().describe('Custom field values (field keys or IDs)'),
|
|
889
|
+
phaseId: zod_1.z.string().optional().describe('Phase ID or key for this activity'),
|
|
890
|
+
teamId: zod_1.z.string().optional().describe('Team ID for this activity'),
|
|
891
|
+
discussionId: zod_1.z.string().optional().describe('Link to existing discussion'),
|
|
892
|
+
followerIds: zod_1.z.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional().describe('User IDs to invite'),
|
|
893
|
+
fileIds: zod_1.z.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()]).optional().describe('File IDs to attach'),
|
|
647
894
|
}))
|
|
648
895
|
.optional()
|
|
649
|
-
.describe(
|
|
896
|
+
.describe('BULK: Array of activities. Example: [{"name": "Task 1", "fields": {...}}, {"name": "Task 2"}]. If provided, single parameters are ignored.'),
|
|
650
897
|
// SINGLE CREATION (used when 'activities' is not provided)
|
|
651
898
|
name: zod_1.z
|
|
652
899
|
.string()
|
|
653
|
-
.min(1,
|
|
900
|
+
.min(1, 'Activity name cannot be empty')
|
|
654
901
|
.optional()
|
|
655
902
|
.describe("SINGLE: The activity name/title (e.g. 'š¤ AI Analysis Bot', 'Customer Research Task')"),
|
|
656
903
|
description: zod_1.z
|
|
657
904
|
.string()
|
|
658
905
|
.optional()
|
|
659
|
-
.describe(
|
|
906
|
+
.describe('SINGLE: Optional detailed description'),
|
|
660
907
|
phaseId: zod_1.z
|
|
661
908
|
.string()
|
|
662
909
|
.optional()
|
|
663
|
-
.describe(
|
|
910
|
+
.describe('SINGLE: Optional phase/category ID or key. If not specified, uses the default phase'),
|
|
664
911
|
teamId: zod_1.z
|
|
665
912
|
.string()
|
|
666
913
|
.optional()
|
|
667
|
-
.describe(
|
|
914
|
+
.describe('SINGLE: Optional team ID for team-specific activities'),
|
|
668
915
|
fields: zod_1.z
|
|
669
916
|
.union([zod_1.z.record(zod_1.z.any()), zod_1.z.string()])
|
|
670
917
|
.optional()
|
|
@@ -672,20 +919,20 @@ exports.createActivityTool = {
|
|
|
672
919
|
discussionId: zod_1.z
|
|
673
920
|
.string()
|
|
674
921
|
.optional()
|
|
675
|
-
.describe(
|
|
922
|
+
.describe('SINGLE: Optional discussion ID to link to existing conversation'),
|
|
676
923
|
followerIds: zod_1.z
|
|
677
924
|
.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()])
|
|
678
925
|
.optional()
|
|
679
|
-
.describe(
|
|
926
|
+
.describe('SINGLE: Optional array of user IDs to invite'),
|
|
680
927
|
fileIds: zod_1.z
|
|
681
928
|
.union([zod_1.z.array(zod_1.z.string()), zod_1.z.string()])
|
|
682
929
|
.optional()
|
|
683
|
-
.describe(
|
|
930
|
+
.describe('SINGLE: Optional array of file IDs to attach'),
|
|
684
931
|
}),
|
|
685
932
|
async execute(args, context) {
|
|
686
933
|
try {
|
|
687
934
|
// DEBUG: Log raw input to diagnose LLM tool calling issues
|
|
688
|
-
logger.debug(
|
|
935
|
+
logger.debug('create_activity called', {
|
|
689
936
|
hasName: !!args.name,
|
|
690
937
|
hasActivities: !!args.activities,
|
|
691
938
|
activitiesType: typeof args.activities,
|
|
@@ -701,7 +948,7 @@ exports.createActivityTool = {
|
|
|
701
948
|
};
|
|
702
949
|
if (activityData.fields) {
|
|
703
950
|
let parsedFields = activityData.fields;
|
|
704
|
-
if (typeof activityData.fields ===
|
|
951
|
+
if (typeof activityData.fields === 'string' && activityData.fields.trim() !== '') {
|
|
705
952
|
try {
|
|
706
953
|
parsedFields = JSON.parse(activityData.fields);
|
|
707
954
|
}
|
|
@@ -710,22 +957,22 @@ exports.createActivityTool = {
|
|
|
710
957
|
}
|
|
711
958
|
}
|
|
712
959
|
if (parsedFields &&
|
|
713
|
-
typeof parsedFields ===
|
|
960
|
+
typeof parsedFields === 'object' &&
|
|
714
961
|
Object.keys(parsedFields).length > 0) {
|
|
715
962
|
autoFixDateFields(parsedFields, context);
|
|
716
963
|
activity.fields = parsedFields;
|
|
717
964
|
}
|
|
718
965
|
}
|
|
719
|
-
if (activityData.phaseId && activityData.phaseId.trim() !==
|
|
966
|
+
if (activityData.phaseId && activityData.phaseId.trim() !== '') {
|
|
720
967
|
activity.phaseId = activityData.phaseId;
|
|
721
968
|
}
|
|
722
|
-
if (activityData.teamId && activityData.teamId.trim() !==
|
|
969
|
+
if (activityData.teamId && activityData.teamId.trim() !== '') {
|
|
723
970
|
activity.teamId = activityData.teamId;
|
|
724
971
|
}
|
|
725
972
|
if (activityData.followerIds) {
|
|
726
973
|
let parsedFollowerIds = activityData.followerIds;
|
|
727
|
-
if (typeof activityData.followerIds ===
|
|
728
|
-
activityData.followerIds.trim() !==
|
|
974
|
+
if (typeof activityData.followerIds === 'string' &&
|
|
975
|
+
activityData.followerIds.trim() !== '') {
|
|
729
976
|
try {
|
|
730
977
|
parsedFollowerIds = JSON.parse(activityData.followerIds);
|
|
731
978
|
}
|
|
@@ -744,7 +991,7 @@ exports.createActivityTool = {
|
|
|
744
991
|
}
|
|
745
992
|
}
|
|
746
993
|
if (invalidUsers.length > 0) {
|
|
747
|
-
throw new Error(`Invalid user IDs in followerIds: ${invalidUsers.join(
|
|
994
|
+
throw new Error(`Invalid user IDs in followerIds: ${invalidUsers.join(', ')}. Use search_workspace_users to find valid user IDs.`);
|
|
748
995
|
}
|
|
749
996
|
}
|
|
750
997
|
activity.followerIds = parsedFollowerIds;
|
|
@@ -752,8 +999,8 @@ exports.createActivityTool = {
|
|
|
752
999
|
}
|
|
753
1000
|
if (activityData.fileIds) {
|
|
754
1001
|
let parsedFileIds = activityData.fileIds;
|
|
755
|
-
if (typeof activityData.fileIds ===
|
|
756
|
-
activityData.fileIds.trim() !==
|
|
1002
|
+
if (typeof activityData.fileIds === 'string' &&
|
|
1003
|
+
activityData.fileIds.trim() !== '') {
|
|
757
1004
|
try {
|
|
758
1005
|
parsedFileIds = JSON.parse(activityData.fileIds);
|
|
759
1006
|
}
|
|
@@ -791,7 +1038,7 @@ exports.createActivityTool = {
|
|
|
791
1038
|
}
|
|
792
1039
|
}
|
|
793
1040
|
let activitiesToCreate;
|
|
794
|
-
|
|
1041
|
+
const options = {
|
|
795
1042
|
returnDocument: true,
|
|
796
1043
|
};
|
|
797
1044
|
if (isBulk) {
|
|
@@ -810,7 +1057,7 @@ exports.createActivityTool = {
|
|
|
810
1057
|
return activity;
|
|
811
1058
|
});
|
|
812
1059
|
// Check for common discussionId in bulk
|
|
813
|
-
if (args.discussionId && args.discussionId.trim() !==
|
|
1060
|
+
if (args.discussionId && args.discussionId.trim() !== '') {
|
|
814
1061
|
options.discussionId = args.discussionId;
|
|
815
1062
|
}
|
|
816
1063
|
}
|
|
@@ -819,7 +1066,7 @@ exports.createActivityTool = {
|
|
|
819
1066
|
if (!args.name) {
|
|
820
1067
|
throw new Error("Either 'activities' array or 'name' parameter is required");
|
|
821
1068
|
}
|
|
822
|
-
logger.debug(
|
|
1069
|
+
logger.debug('Creating single activity', {
|
|
823
1070
|
workflowId: args.workflowId,
|
|
824
1071
|
name: args.name,
|
|
825
1072
|
defaultTeamId: defaultTeamId,
|
|
@@ -830,12 +1077,29 @@ exports.createActivityTool = {
|
|
|
830
1077
|
activity.teamId = defaultTeamId;
|
|
831
1078
|
}
|
|
832
1079
|
activitiesToCreate = [activity];
|
|
833
|
-
if (args.discussionId && args.discussionId.trim() !==
|
|
1080
|
+
if (args.discussionId && args.discussionId.trim() !== '') {
|
|
834
1081
|
options.discussionId = args.discussionId;
|
|
835
1082
|
}
|
|
836
1083
|
}
|
|
1084
|
+
// Pre-validate field keys before API call ā runs AFTER processActivity's
|
|
1085
|
+
// auto-fixups (values only, keys unchanged; see validateFieldKeys).
|
|
1086
|
+
// Unknown keys (e.g. field NAMES) silently no-op server-side.
|
|
1087
|
+
const workflow = context.init.processes?.find((proc) => proc._id === args.workflowId);
|
|
1088
|
+
const workflowFieldDefs = workflow?.fields;
|
|
1089
|
+
for (let i = 0; i < activitiesToCreate.length; i++) {
|
|
1090
|
+
const item = activitiesToCreate[i];
|
|
1091
|
+
const keyError = workflowFieldDefs && item.fields ? validateFieldKeys(item.fields, workflowFieldDefs) : undefined;
|
|
1092
|
+
if (keyError) {
|
|
1093
|
+
const itemName = item.name || `Activity ${i + 1}`;
|
|
1094
|
+
return {
|
|
1095
|
+
content: [{
|
|
1096
|
+
type: 'text',
|
|
1097
|
+
text: `ā Invalid field keys in "${itemName}" ā nothing was created.\n\n${keyError}`,
|
|
1098
|
+
}],
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
837
1102
|
// Pre-validate required fields before API call
|
|
838
|
-
const workflow = context.init.processes?.find((p) => p._id === args.workflowId);
|
|
839
1103
|
if (workflow?.fields) {
|
|
840
1104
|
const requiredFields = [];
|
|
841
1105
|
for (const [fieldId, field] of Object.entries(workflow.fields)) {
|
|
@@ -864,7 +1128,7 @@ exports.createActivityTool = {
|
|
|
864
1128
|
const fieldList = requiredFields.map(f => `- ${f.label} (key: ${f.key}, id: ${f.id})`).join('\n');
|
|
865
1129
|
return {
|
|
866
1130
|
content: [{
|
|
867
|
-
type:
|
|
1131
|
+
type: 'text',
|
|
868
1132
|
text: `ā Missing required fields - cannot create activities.\n\n**Required fields for this workflow:**\n${fieldList}\n\n**Activities with missing fields:**\n${missingByActivity.map(m => `- ${m}`).join('\n')}\n\nš” Add the missing fields to each activity's \`fields\` object using either the field key or ID.`,
|
|
869
1133
|
}],
|
|
870
1134
|
};
|
|
@@ -891,7 +1155,7 @@ exports.createActivityTool = {
|
|
|
891
1155
|
return {
|
|
892
1156
|
content: [
|
|
893
1157
|
{
|
|
894
|
-
type:
|
|
1158
|
+
type: 'text',
|
|
895
1159
|
text: responseText,
|
|
896
1160
|
},
|
|
897
1161
|
],
|
|
@@ -922,7 +1186,7 @@ exports.createActivityTool = {
|
|
|
922
1186
|
return {
|
|
923
1187
|
content: [
|
|
924
1188
|
{
|
|
925
|
-
type:
|
|
1189
|
+
type: 'text',
|
|
926
1190
|
text: responseText,
|
|
927
1191
|
},
|
|
928
1192
|
],
|
|
@@ -930,11 +1194,12 @@ exports.createActivityTool = {
|
|
|
930
1194
|
}
|
|
931
1195
|
}
|
|
932
1196
|
catch (error) {
|
|
933
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
934
|
-
logger.error(
|
|
1197
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
1198
|
+
logger.error('Failed to create activity/activities', error, {
|
|
935
1199
|
workflowId: args.workflowId,
|
|
936
1200
|
isBulk: !!(args.activities && args.activities.length > 0),
|
|
937
1201
|
});
|
|
1202
|
+
}
|
|
938
1203
|
const errorMessage = error instanceof Error
|
|
939
1204
|
? error.message
|
|
940
1205
|
: (typeof error === 'object' && error !== null)
|
|
@@ -943,7 +1208,7 @@ exports.createActivityTool = {
|
|
|
943
1208
|
return {
|
|
944
1209
|
content: [
|
|
945
1210
|
{
|
|
946
|
-
type:
|
|
1211
|
+
type: 'text',
|
|
947
1212
|
text: `ā Error creating activity: ${errorMessage}\n\nš” Troubleshooting Tips:\n- Verify the workflowId exists and is accessible\n- Check that you have permission to create activities in this workflow\n- Ensure field IDs in the fields object match the workflow's field definitions\n- Use search_workspace_users to find valid user IDs for assignment\n- Verify user IDs in followerIds exist and are accessible`,
|
|
948
1213
|
},
|
|
949
1214
|
],
|
|
@@ -976,9 +1241,9 @@ exports.updateActivityTool = {
|
|
|
976
1241
|
schema: zod_1.z.object({
|
|
977
1242
|
// BULK: Array of activities to update
|
|
978
1243
|
activities: zod_1.z
|
|
979
|
-
.preprocess((val) => (typeof val ===
|
|
1244
|
+
.preprocess((val) => (typeof val === 'string' ? JSON.parse(val) : val), zod_1.z
|
|
980
1245
|
.array(zod_1.z.object({
|
|
981
|
-
_id: zod_1.z.string().min(24,
|
|
1246
|
+
_id: zod_1.z.string().min(24, 'Activity ID must be at least 24 characters'),
|
|
982
1247
|
name: zod_1.z.string().optional(),
|
|
983
1248
|
fields: zod_1.z.record(zod_1.z.any()).optional(),
|
|
984
1249
|
phaseId: zod_1.z.string().optional(),
|
|
@@ -989,10 +1254,10 @@ exports.updateActivityTool = {
|
|
|
989
1254
|
// SINGLE: Individual activity parameters
|
|
990
1255
|
activityId: zod_1.z
|
|
991
1256
|
.string()
|
|
992
|
-
.min(24,
|
|
1257
|
+
.min(24, 'Activity ID must be at least 24 characters')
|
|
993
1258
|
.optional()
|
|
994
|
-
.describe(
|
|
995
|
-
name: zod_1.z.string().optional().describe(
|
|
1259
|
+
.describe('SINGLE: The unique ID of the activity to update (works for any workflow)'),
|
|
1260
|
+
name: zod_1.z.string().optional().describe('SINGLE: New activity title/name'),
|
|
996
1261
|
fields: zod_1.z
|
|
997
1262
|
.union([zod_1.z.record(zod_1.z.any()), zod_1.z.string()])
|
|
998
1263
|
.optional()
|
|
@@ -1000,97 +1265,20 @@ exports.updateActivityTool = {
|
|
|
1000
1265
|
phaseId: zod_1.z
|
|
1001
1266
|
.string()
|
|
1002
1267
|
.optional()
|
|
1003
|
-
.describe(
|
|
1268
|
+
.describe('SINGLE: Optional phase ID or key to move the activity to'),
|
|
1004
1269
|
}),
|
|
1005
1270
|
async execute(args, context) {
|
|
1006
1271
|
try {
|
|
1007
1272
|
// BULK MODE: Update multiple activities
|
|
1008
1273
|
if (args.activities && Array.isArray(args.activities)) {
|
|
1009
|
-
|
|
1010
|
-
activityCount: args.activities.length,
|
|
1011
|
-
activities: JSON.stringify(args.activities, null, 2)
|
|
1012
|
-
});
|
|
1013
|
-
// Auto-fix common parameter name mistakes
|
|
1014
|
-
for (const activity of args.activities) {
|
|
1015
|
-
// Fix activityId -> _id
|
|
1016
|
-
if (!activity._id && activity.activityId) {
|
|
1017
|
-
logger.warn("Auto-fixing: activityId -> _id", { activityId: activity.activityId });
|
|
1018
|
-
activity._id = activity.activityId;
|
|
1019
|
-
delete activity.activityId;
|
|
1020
|
-
}
|
|
1021
|
-
// Fix fieldsAndValues -> fields
|
|
1022
|
-
if (!activity.fields && activity.fieldsAndValues) {
|
|
1023
|
-
logger.warn("Auto-fixing: fieldsAndValues -> fields", { activityId: activity._id });
|
|
1024
|
-
activity.fields = activity.fieldsAndValues;
|
|
1025
|
-
delete activity.fieldsAndValues;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
// Validate that all activities have _id
|
|
1029
|
-
const invalidActivities = args.activities.filter((a) => !a._id || typeof a._id !== 'string' || a._id.length < 24);
|
|
1030
|
-
if (invalidActivities.length > 0) {
|
|
1031
|
-
return {
|
|
1032
|
-
content: [{
|
|
1033
|
-
type: "text",
|
|
1034
|
-
text: `ā **Error: Invalid bulk update request**\n\nEach activity in the "activities" array MUST have a valid "_id" field (24-character activity ID).\n\n**What you sent:** ${JSON.stringify(args.activities, null, 2)}\n\n**Correct format:**\n\`\`\`json\n{\n "activities": [\n { "_id": "691ffe654217e9e8434e577c", "fields": { "fieldId": "value" } },\n { "_id": "691ffe654217e9e8434e5774", "name": "New Name" }\n ]\n}\n\`\`\`\n\n**Tip:** First use list_activities to get the activity IDs, then pass them in the _id field.`,
|
|
1035
|
-
}],
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
// Build updates for each activity
|
|
1039
|
-
const updates = args.activities.map((activity) => {
|
|
1040
|
-
const activityUpdate = { _id: activity._id };
|
|
1041
|
-
if (activity.name)
|
|
1042
|
-
activityUpdate.name = activity.name;
|
|
1043
|
-
if (activity.fields) {
|
|
1044
|
-
// Parse fields if string
|
|
1045
|
-
let parsedFields = typeof activity.fields === 'string'
|
|
1046
|
-
? JSON.parse(activity.fields)
|
|
1047
|
-
: activity.fields;
|
|
1048
|
-
// Auto-fix activitylink fields: if LLM passes object with _id, extract just the ID
|
|
1049
|
-
if (parsedFields && typeof parsedFields === "object") {
|
|
1050
|
-
for (const [fieldId, fieldValue] of Object.entries(parsedFields)) {
|
|
1051
|
-
if (fieldValue &&
|
|
1052
|
-
typeof fieldValue === "object" &&
|
|
1053
|
-
!Array.isArray(fieldValue) &&
|
|
1054
|
-
"_id" in fieldValue &&
|
|
1055
|
-
typeof fieldValue._id === "string") {
|
|
1056
|
-
logger.warn("Auto-fixing activitylink field in bulk mode", {
|
|
1057
|
-
activityId: activity._id,
|
|
1058
|
-
fieldId,
|
|
1059
|
-
extracted: fieldValue._id,
|
|
1060
|
-
});
|
|
1061
|
-
parsedFields[fieldId] = fieldValue._id;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
autoFixDateFields(parsedFields, context);
|
|
1066
|
-
activityUpdate.fields = parsedFields;
|
|
1067
|
-
}
|
|
1068
|
-
return activityUpdate;
|
|
1069
|
-
});
|
|
1070
|
-
// Collect unique phase IDs (most activities will have the same phase)
|
|
1071
|
-
const phaseIds = args.activities
|
|
1072
|
-
.map((a) => a.phaseId)
|
|
1073
|
-
.filter((p) => p);
|
|
1074
|
-
const commonPhaseId = phaseIds.length > 0 ? phaseIds[0] : undefined;
|
|
1075
|
-
// Call API with all updates
|
|
1076
|
-
const options = commonPhaseId ? { phaseId: commonPhaseId } : undefined;
|
|
1077
|
-
await context.hailer.updateActivities(updates, options);
|
|
1078
|
-
// Format bulk response
|
|
1079
|
-
return {
|
|
1080
|
-
content: [
|
|
1081
|
-
{
|
|
1082
|
-
type: "text",
|
|
1083
|
-
text: `š Successfully updated ${args.activities.length} activities!\n\nš **Bulk Update Summary:**\n- **Total Updated**: ${args.activities.length} activities\n- **Status**: All activities updated successfully\n\nā
All activities have been updated in your Hailer workspace!`,
|
|
1084
|
-
},
|
|
1085
|
-
],
|
|
1086
|
-
};
|
|
1274
|
+
return await executeBulkUpdate(args.activities, context);
|
|
1087
1275
|
}
|
|
1088
1276
|
// SINGLE MODE: Update one activity
|
|
1089
1277
|
// Validate activityId is provided for single mode
|
|
1090
1278
|
if (!args.activityId || typeof args.activityId !== 'string' || args.activityId.length < 24) {
|
|
1091
1279
|
return {
|
|
1092
1280
|
content: [{
|
|
1093
|
-
type:
|
|
1281
|
+
type: 'text',
|
|
1094
1282
|
text: `ā **Error: Missing or invalid activityId**\n\nFor single activity updates, you must provide a valid "activityId" (24-character hex string).\n\n**What you sent:** activityId = ${JSON.stringify(args.activityId)}\n\n**Correct format:**\n\`\`\`json\n{\n "activityId": "691ffe654217e9e8434e577c",\n "name": "New Name",\n "fields": { "fieldId": "value" }\n}\n\`\`\`\n\n**For bulk updates (3+ activities), use:**\n\`\`\`json\n{\n "activities": [\n { "_id": "activity-id-1", "fields": {...} },\n { "_id": "activity-id-2", "name": "New Name" }\n ]\n}\n\`\`\`\n\n**Tip:** Use list_activities or show_activity_by_id to find activity IDs first.`,
|
|
1095
1283
|
}],
|
|
1096
1284
|
};
|
|
@@ -1099,32 +1287,44 @@ exports.updateActivityTool = {
|
|
|
1099
1287
|
if (!args.name && !args.fields && !args.phaseId) {
|
|
1100
1288
|
return {
|
|
1101
1289
|
content: [{
|
|
1102
|
-
type:
|
|
1290
|
+
type: 'text',
|
|
1103
1291
|
text: `ā **Error: No update data provided**\n\nYou called update_activity with activityId="${args.activityId}" but didn't provide any data to update.\n\n**You must provide at least one of:**\n- "name" - to update the activity name\n- "fields" - to update field values\n- "phaseId" - to move to a different phase\n\n**Example:**\n\`\`\`json\n{\n "activityId": "${args.activityId}",\n "fields": {\n "fieldId123": "new value"\n }\n}\n\`\`\``,
|
|
1104
1292
|
}],
|
|
1105
1293
|
};
|
|
1106
1294
|
}
|
|
1107
|
-
logger.debug(
|
|
1295
|
+
logger.debug('Single update mode', {
|
|
1108
1296
|
activityId: args.activityId,
|
|
1109
1297
|
name: args.name,
|
|
1110
1298
|
fields: JSON.stringify(args.fields, null, 2),
|
|
1111
1299
|
phaseId: args.phaseId
|
|
1112
1300
|
});
|
|
1113
1301
|
const updates = buildActivityUpdate(args, context);
|
|
1302
|
+
// Field-key validation ā runs AFTER buildActivityUpdate's auto-fixups
|
|
1303
|
+
// (values only, keys unchanged; see validateFieldKeys), right before the
|
|
1304
|
+
// API call. Unknown keys (e.g. field NAMES) silently no-op server-side.
|
|
1305
|
+
const singleKeyError = updates.fields
|
|
1306
|
+
? await validateUpdateFieldKeys(args.activityId, updates.fields, context)
|
|
1307
|
+
: undefined;
|
|
1308
|
+
if (singleKeyError) {
|
|
1309
|
+
return {
|
|
1310
|
+
content: [{ type: 'text', text: singleKeyError }],
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1114
1313
|
const options = args.phaseId ? { phaseId: args.phaseId } : undefined;
|
|
1115
1314
|
const result = await context.hailer.updateActivities([updates], options);
|
|
1116
1315
|
return formatUpdateActivityResponse(args, result);
|
|
1117
1316
|
}
|
|
1118
1317
|
catch (error) {
|
|
1119
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1120
|
-
logger.error(
|
|
1318
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
1319
|
+
logger.error('Failed to update activity', error, {
|
|
1121
1320
|
activityId: args.activityId || 'bulk',
|
|
1122
1321
|
activityCount: args.activities?.length,
|
|
1123
1322
|
});
|
|
1323
|
+
}
|
|
1124
1324
|
return {
|
|
1125
1325
|
content: [
|
|
1126
1326
|
{
|
|
1127
|
-
type:
|
|
1327
|
+
type: 'text',
|
|
1128
1328
|
text: `ā Error updating ${args.activities ? 'activities' : 'activity'}: ${error instanceof Error ? error.message : String(error)}`,
|
|
1129
1329
|
},
|
|
1130
1330
|
],
|