@hailer/mcp 1.2.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-hailer-helper.md +118 -0
- package/.claude/commands/app-squad.md +16 -110
- package/.claude/commands/debug-squad.md +13 -290
- package/.claude/commands/publish.md +2 -2
- package/.claude/commands/review-squad.md +17 -139
- package/.claude/skills/create-and-publish-app/SKILL.md +102 -83
- package/.claude/skills/hailer-app-builder/SKILL.md +2 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +136 -10
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/bot/bot-manager.d.ts +9 -6
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +142 -31
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot.d.ts +59 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +889 -142
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/operation-logger.d.ts.map +1 -1
- package/dist/bot/operation-logger.js +24 -12
- package/dist/bot/operation-logger.js.map +1 -1
- package/dist/bot/services/bot-permissions.d.ts +2 -2
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +28 -9
- package/dist/bot/services/bot-permissions.js.map +1 -1
- package/dist/bot/services/conversation-manager.d.ts +23 -23
- package/dist/bot/services/conversation-manager.d.ts.map +1 -1
- package/dist/bot/services/conversation-manager.js +52 -49
- package/dist/bot/services/conversation-manager.js.map +1 -1
- package/dist/bot/services/helper-prompt.d.ts +8 -0
- package/dist/bot/services/helper-prompt.d.ts.map +1 -0
- package/dist/bot/services/helper-prompt.js +177 -0
- package/dist/bot/services/helper-prompt.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts +16 -16
- package/dist/bot/services/message-classifier.d.ts.map +1 -1
- package/dist/bot/services/message-classifier.js +55 -49
- package/dist/bot/services/message-classifier.js.map +1 -1
- package/dist/bot/services/message-formatter.d.ts +38 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +81 -74
- package/dist/bot/services/message-formatter.js.map +1 -1
- package/dist/bot/services/permission-guard.d.ts.map +1 -1
- package/dist/bot/services/permission-guard.js +20 -10
- package/dist/bot/services/permission-guard.js.map +1 -1
- package/dist/bot/services/signal-router.d.ts.map +1 -1
- package/dist/bot/services/signal-router.js +11 -6
- package/dist/bot/services/signal-router.js.map +1 -1
- package/dist/bot/services/system-prompt.d.ts +14 -0
- package/dist/bot/services/system-prompt.d.ts.map +1 -1
- package/dist/bot/services/system-prompt.js +179 -4
- package/dist/bot/services/system-prompt.js.map +1 -1
- package/dist/bot/services/token-billing.d.ts +23 -23
- package/dist/bot/services/token-billing.d.ts.map +1 -1
- package/dist/bot/services/token-billing.js +51 -36
- package/dist/bot/services/token-billing.js.map +1 -1
- package/dist/bot/services/types.d.ts +3 -1
- package/dist/bot/services/types.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.d.ts +8 -8
- package/dist/bot/services/typing-indicator.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.js +12 -10
- package/dist/bot/services/typing-indicator.js.map +1 -1
- package/dist/bot/services/workspace-refresh.d.ts +3 -3
- package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
- package/dist/bot/services/workspace-refresh.js +23 -13
- package/dist/bot/services/workspace-refresh.js.map +1 -1
- package/dist/bot/tool-executor.d.ts +10 -6
- package/dist/bot/tool-executor.d.ts.map +1 -1
- package/dist/bot/tool-executor.js +12 -6
- package/dist/bot/tool-executor.js.map +1 -1
- package/dist/bot/workspace-overview.d.ts.map +1 -1
- package/dist/bot/workspace-overview.js +6 -3
- package/dist/bot/workspace-overview.js.map +1 -1
- package/dist/bot-config/activity-error.d.ts +47 -0
- package/dist/bot-config/activity-error.d.ts.map +1 -0
- package/dist/bot-config/activity-error.js +67 -0
- package/dist/bot-config/activity-error.js.map +1 -0
- package/dist/bot-config/context.d.ts +4 -4
- package/dist/bot-config/context.d.ts.map +1 -1
- package/dist/bot-config/context.js +18 -14
- package/dist/bot-config/context.js.map +1 -1
- package/dist/bot-config/events.d.ts +45 -0
- package/dist/bot-config/events.d.ts.map +1 -0
- package/dist/bot-config/events.js +51 -0
- package/dist/bot-config/events.js.map +1 -0
- package/dist/bot-config/index.d.ts +3 -0
- package/dist/bot-config/index.d.ts.map +1 -1
- package/dist/bot-config/index.js +8 -1
- package/dist/bot-config/index.js.map +1 -1
- package/dist/bot-config/loader.d.ts +3 -0
- package/dist/bot-config/loader.d.ts.map +1 -1
- package/dist/bot-config/loader.js +45 -20
- package/dist/bot-config/loader.js.map +1 -1
- package/dist/bot-config/persistence.js.map +1 -1
- package/dist/bot-config/reconciler.d.ts +11 -0
- package/dist/bot-config/reconciler.d.ts.map +1 -0
- package/dist/bot-config/reconciler.js +121 -0
- package/dist/bot-config/reconciler.js.map +1 -0
- package/dist/bot-config/state.d.ts.map +1 -1
- package/dist/bot-config/state.js.map +1 -1
- package/dist/bot-config/types.d.ts +32 -0
- package/dist/bot-config/types.d.ts.map +1 -1
- package/dist/bot-config/webhooks.d.ts.map +1 -1
- package/dist/bot-config/webhooks.js.map +1 -1
- package/dist/bot-config/workflow-installer.d.ts +37 -0
- package/dist/bot-config/workflow-installer.d.ts.map +1 -0
- package/dist/bot-config/workflow-installer.js +346 -0
- package/dist/bot-config/workflow-installer.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -27
- package/dist/config.js.map +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -16
- package/dist/core.js.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +7 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/request-logger.d.ts +19 -19
- package/dist/lib/request-logger.d.ts.map +1 -1
- package/dist/lib/request-logger.js +19 -19
- package/dist/lib/request-logger.js.map +1 -1
- package/dist/mcp/UserContextCache.d.ts +28 -22
- package/dist/mcp/UserContextCache.d.ts.map +1 -1
- package/dist/mcp/UserContextCache.js +23 -23
- package/dist/mcp/UserContextCache.js.map +1 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/hailer-clients.d.ts +5 -4
- package/dist/mcp/hailer-clients.d.ts.map +1 -1
- package/dist/mcp/hailer-clients.js +61 -27
- package/dist/mcp/hailer-clients.js.map +1 -1
- package/dist/mcp/hailer-rpc.d.ts +40 -0
- package/dist/mcp/hailer-rpc.d.ts.map +1 -0
- package/dist/mcp/hailer-rpc.js +43 -0
- package/dist/mcp/hailer-rpc.js.map +1 -0
- package/dist/mcp/session-store.d.ts +16 -16
- package/dist/mcp/session-store.d.ts.map +1 -1
- package/dist/mcp/session-store.js +16 -16
- package/dist/mcp/session-store.js.map +1 -1
- package/dist/mcp/tool-profiles.d.ts +69 -0
- package/dist/mcp/tool-profiles.d.ts.map +1 -0
- package/dist/mcp/tool-profiles.js +176 -0
- package/dist/mcp/tool-profiles.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +16 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +91 -39
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +398 -198
- package/dist/mcp/tools/activity.js.map +1 -1
- package/dist/mcp/tools/aliases.d.ts +11 -0
- package/dist/mcp/tools/aliases.d.ts.map +1 -0
- package/dist/mcp/tools/aliases.js +176 -0
- package/dist/mcp/tools/aliases.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts +6 -8
- package/dist/mcp/tools/app-core.d.ts.map +1 -1
- package/dist/mcp/tools/app-core.js +355 -254
- package/dist/mcp/tools/app-core.js.map +1 -1
- package/dist/mcp/tools/app-marketplace.d.ts +8 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +604 -930
- package/dist/mcp/tools/app-marketplace.js.map +1 -1
- package/dist/mcp/tools/app.d.ts +4 -7
- package/dist/mcp/tools/app.d.ts.map +1 -1
- package/dist/mcp/tools/app.js +4 -7
- package/dist/mcp/tools/app.js.map +1 -1
- package/dist/mcp/tools/bot-self.d.ts +21 -0
- package/dist/mcp/tools/bot-self.d.ts.map +1 -0
- package/dist/mcp/tools/bot-self.js +174 -0
- package/dist/mcp/tools/bot-self.js.map +1 -0
- package/dist/mcp/tools/calendar.d.ts +21 -0
- package/dist/mcp/tools/calendar.d.ts.map +1 -0
- package/dist/mcp/tools/calendar.js +741 -0
- package/dist/mcp/tools/calendar.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -1
- package/dist/mcp/tools/company.js +2 -1
- package/dist/mcp/tools/company.js.map +1 -1
- package/dist/mcp/tools/date.js.map +1 -1
- package/dist/mcp/tools/discussion.d.ts +23 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +417 -534
- package/dist/mcp/tools/discussion.js.map +1 -1
- package/dist/mcp/tools/file.d.ts.map +1 -1
- package/dist/mcp/tools/file.js +18 -16
- package/dist/mcp/tools/file.js.map +1 -1
- package/dist/mcp/tools/index.js +4 -4
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/insight.d.ts +7 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +419 -477
- package/dist/mcp/tools/insight.js.map +1 -1
- package/dist/mcp/tools/user.d.ts.map +1 -1
- package/dist/mcp/tools/user.js +15 -13
- package/dist/mcp/tools/user.js.map +1 -1
- package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
- package/dist/mcp/tools/workflow-permissions.js +88 -97
- package/dist/mcp/tools/workflow-permissions.js.map +1 -1
- package/dist/mcp/tools/workflow.d.ts +2 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +817 -850
- package/dist/mcp/tools/workflow.js.map +1 -1
- package/dist/mcp/utils/api-errors.d.ts.map +1 -1
- package/dist/mcp/utils/api-errors.js +2 -2
- package/dist/mcp/utils/api-errors.js.map +1 -1
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +8 -4
- package/dist/mcp/utils/data-transformers.js.map +1 -1
- package/dist/mcp/utils/file-upload.d.ts.map +1 -1
- package/dist/mcp/utils/file-upload.js +1 -1
- package/dist/mcp/utils/file-upload.js.map +1 -1
- package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
- package/dist/mcp/utils/hailer-api-client.js +103 -101
- package/dist/mcp/utils/hailer-api-client.js.map +1 -1
- package/dist/mcp/utils/index.d.ts.map +1 -1
- package/dist/mcp/utils/index.js.map +1 -1
- package/dist/mcp/utils/logger.d.ts.map +1 -1
- package/dist/mcp/utils/logger.js.map +1 -1
- package/dist/mcp/utils/response-builder.d.ts.map +1 -1
- package/dist/mcp/utils/response-builder.js +8 -4
- package/dist/mcp/utils/response-builder.js.map +1 -1
- package/dist/mcp/utils/role-utils.d.ts.map +1 -1
- package/dist/mcp/utils/role-utils.js +6 -3
- package/dist/mcp/utils/role-utils.js.map +1 -1
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
- package/dist/mcp/utils/tool-helpers.js +2 -2
- package/dist/mcp/utils/tool-helpers.js.map +1 -1
- package/dist/mcp/utils/types.d.ts +1 -1
- package/dist/mcp/utils/types.d.ts.map +1 -1
- package/dist/mcp/utils/types.js.map +1 -1
- package/dist/mcp/webhook-handler.d.ts +43 -8
- package/dist/mcp/webhook-handler.d.ts.map +1 -1
- package/dist/mcp/webhook-handler.js +861 -116
- package/dist/mcp/webhook-handler.js.map +1 -1
- package/dist/mcp/workspace-admin-store.d.ts +49 -0
- package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
- package/dist/mcp/workspace-admin-store.js +168 -0
- package/dist/mcp/workspace-admin-store.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts +2 -2
- package/dist/mcp/workspace-cache.d.ts.map +1 -1
- package/dist/mcp/workspace-cache.js +9 -5
- package/dist/mcp/workspace-cache.js.map +1 -1
- package/dist/mcp-server.d.ts +26 -11
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +360 -36
- package/dist/mcp-server.js.map +1 -1
- package/dist/plugins/vipunen/client.d.ts +41 -41
- package/dist/plugins/vipunen/client.d.ts.map +1 -1
- package/dist/plugins/vipunen/client.js +53 -48
- package/dist/plugins/vipunen/client.js.map +1 -1
- package/dist/plugins/vipunen/index.js.map +1 -1
- package/dist/plugins/vipunen/tools.d.ts.map +1 -1
- package/dist/plugins/vipunen/tools.js +6 -3
- package/dist/plugins/vipunen/tools.js.map +1 -1
- package/dist/public-chat/graduate.d.ts +29 -0
- package/dist/public-chat/graduate.d.ts.map +1 -0
- package/dist/public-chat/graduate.js +593 -0
- package/dist/public-chat/graduate.js.map +1 -0
- package/dist/public-chat/handler.d.ts +12 -0
- package/dist/public-chat/handler.d.ts.map +1 -0
- package/dist/public-chat/handler.js +179 -0
- package/dist/public-chat/handler.js.map +1 -0
- package/dist/public-chat/index.d.ts +16 -0
- package/dist/public-chat/index.d.ts.map +1 -0
- package/dist/public-chat/index.js +74 -0
- package/dist/public-chat/index.js.map +1 -0
- package/dist/public-chat/knowledge.d.ts +3 -0
- package/dist/public-chat/knowledge.d.ts.map +1 -0
- package/dist/public-chat/knowledge.js +1339 -0
- package/dist/public-chat/knowledge.js.map +1 -0
- package/dist/public-chat/rate-limit.d.ts +16 -0
- package/dist/public-chat/rate-limit.d.ts.map +1 -0
- package/dist/public-chat/rate-limit.js +51 -0
- package/dist/public-chat/rate-limit.js.map +1 -0
- package/dist/public-chat/session-store.d.ts +41 -0
- package/dist/public-chat/session-store.d.ts.map +1 -0
- package/dist/public-chat/session-store.js +95 -0
- package/dist/public-chat/session-store.js.map +1 -0
- package/dist/public-chat/studio-prewarm.d.ts +61 -0
- package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
- package/dist/public-chat/studio-prewarm.js +162 -0
- package/dist/public-chat/studio-prewarm.js.map +1 -0
- package/dist/public-chat/system-prompt.d.ts +22 -0
- package/dist/public-chat/system-prompt.d.ts.map +1 -0
- package/dist/public-chat/system-prompt.js +428 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +14 -6
- package/scripts/build-public-chat-knowledge.py +101 -0
- package/scripts/probe-mcp-pricing.ts +52 -0
- package/scripts/smoke-public-chat-live.ts +148 -0
- package/scripts/smoke-public-chat.ts +110 -0
- package/.claude/CLAUDE.md +0 -126
- package/.claude/commands/audit-squad.md +0 -158
- package/.claude/commands/cleanup-squad.md +0 -98
- package/.claude/commands/config-squad.md +0 -106
- package/.claude/commands/crud-squad.md +0 -87
- package/.claude/commands/data-squad.md +0 -97
- package/.claude/commands/doc-squad.md +0 -65
- package/.claude/commands/help.md +0 -29
- package/.claude/commands/help:agents.md +0 -182
- package/.claude/commands/help:commands.md +0 -78
- package/.claude/commands/help:faq.md +0 -79
- package/.claude/commands/help:plugins.md +0 -50
- package/.claude/commands/help:skills.md +0 -87
- package/.claude/commands/help:tools.md +0 -75
- package/.claude/commands/hotfix-squad.md +0 -112
- package/.claude/commands/integration-squad.md +0 -82
- package/.claude/commands/janitor-squad.md +0 -167
- package/.claude/commands/onboard-squad.md +0 -130
- package/.claude/commands/swarm.md +0 -210
- package/.claude/commands/tool-builder.md +0 -39
- package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
- package/dist/CLAUDE.md +0 -370
- package/dist/agents/bot-manager.d.ts +0 -48
- package/dist/agents/bot-manager.d.ts.map +0 -1
- package/dist/agents/bot-manager.js +0 -254
- package/dist/agents/bot-manager.js.map +0 -1
- package/dist/agents/bug-fixer/ai.d.ts +0 -80
- package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
- package/dist/agents/bug-fixer/ai.js +0 -466
- package/dist/agents/bug-fixer/ai.js.map +0 -1
- package/dist/agents/bug-fixer/bot.d.ts +0 -92
- package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
- package/dist/agents/bug-fixer/bot.js +0 -687
- package/dist/agents/bug-fixer/bot.js.map +0 -1
- package/dist/agents/bug-fixer/config.d.ts +0 -21
- package/dist/agents/bug-fixer/config.d.ts.map +0 -1
- package/dist/agents/bug-fixer/config.js +0 -218
- package/dist/agents/bug-fixer/config.js.map +0 -1
- package/dist/agents/bug-fixer/files.d.ts +0 -67
- package/dist/agents/bug-fixer/files.d.ts.map +0 -1
- package/dist/agents/bug-fixer/files.js +0 -386
- package/dist/agents/bug-fixer/files.js.map +0 -1
- package/dist/agents/bug-fixer/git.d.ts +0 -48
- package/dist/agents/bug-fixer/git.d.ts.map +0 -1
- package/dist/agents/bug-fixer/git.js +0 -298
- package/dist/agents/bug-fixer/git.js.map +0 -1
- package/dist/agents/bug-fixer/index.d.ts +0 -103
- package/dist/agents/bug-fixer/index.d.ts.map +0 -1
- package/dist/agents/bug-fixer/index.js +0 -262
- package/dist/agents/bug-fixer/index.js.map +0 -1
- package/dist/agents/bug-fixer/lsp.d.ts +0 -113
- package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
- package/dist/agents/bug-fixer/lsp.js +0 -485
- package/dist/agents/bug-fixer/lsp.js.map +0 -1
- package/dist/agents/bug-fixer/monitor.d.ts +0 -123
- package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
- package/dist/agents/bug-fixer/monitor.js +0 -629
- package/dist/agents/bug-fixer/monitor.js.map +0 -1
- package/dist/agents/bug-fixer/prompt.d.ts +0 -5
- package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
- package/dist/agents/bug-fixer/prompt.js +0 -94
- package/dist/agents/bug-fixer/prompt.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
- package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
- package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
- package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.js +0 -49
- package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
- package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
- package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
- package/dist/agents/bug-fixer/specialist.d.ts +0 -47
- package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist.js +0 -327
- package/dist/agents/bug-fixer/specialist.js.map +0 -1
- package/dist/agents/bug-fixer/types.d.ts +0 -123
- package/dist/agents/bug-fixer/types.d.ts.map +0 -1
- package/dist/agents/bug-fixer/types.js +0 -9
- package/dist/agents/bug-fixer/types.js.map +0 -1
- package/dist/agents/factory.d.ts +0 -172
- package/dist/agents/factory.d.ts.map +0 -1
- package/dist/agents/factory.js +0 -706
- package/dist/agents/factory.js.map +0 -1
- package/dist/agents/hailer-expert/index.d.ts +0 -8
- package/dist/agents/hailer-expert/index.d.ts.map +0 -1
- package/dist/agents/hailer-expert/index.js +0 -14
- package/dist/agents/hailer-expert/index.js.map +0 -1
- package/dist/agents/hal/daemon.d.ts +0 -174
- package/dist/agents/hal/daemon.d.ts.map +0 -1
- package/dist/agents/hal/daemon.js +0 -1385
- package/dist/agents/hal/daemon.js.map +0 -1
- package/dist/agents/hal/definitions.d.ts +0 -42
- package/dist/agents/hal/definitions.d.ts.map +0 -1
- package/dist/agents/hal/definitions.js +0 -300
- package/dist/agents/hal/definitions.js.map +0 -1
- package/dist/agents/hal/index.d.ts +0 -3
- package/dist/agents/hal/index.d.ts.map +0 -1
- package/dist/agents/hal/index.js +0 -8
- package/dist/agents/hal/index.js.map +0 -1
- package/dist/agents/index.d.ts +0 -18
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -48
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared/base.d.ts +0 -253
- package/dist/agents/shared/base.d.ts.map +0 -1
- package/dist/agents/shared/base.js +0 -1122
- package/dist/agents/shared/base.js.map +0 -1
- package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
- package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
- package/dist/agents/shared/schemas/action-schema.js +0 -483
- package/dist/agents/shared/schemas/action-schema.js.map +0 -1
- package/dist/agents/shared/services/agent-registry.d.ts +0 -108
- package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
- package/dist/agents/shared/services/agent-registry.js +0 -469
- package/dist/agents/shared/services/agent-registry.js.map +0 -1
- package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
- package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
- package/dist/agents/shared/services/conversation-manager.js +0 -168
- package/dist/agents/shared/services/conversation-manager.js.map +0 -1
- package/dist/agents/shared/services/mcp-client.d.ts +0 -56
- package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
- package/dist/agents/shared/services/mcp-client.js +0 -124
- package/dist/agents/shared/services/mcp-client.js.map +0 -1
- package/dist/agents/shared/services/message-classifier.d.ts +0 -37
- package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
- package/dist/agents/shared/services/message-classifier.js +0 -203
- package/dist/agents/shared/services/message-classifier.js.map +0 -1
- package/dist/agents/shared/services/message-formatter.d.ts +0 -89
- package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
- package/dist/agents/shared/services/message-formatter.js +0 -390
- package/dist/agents/shared/services/message-formatter.js.map +0 -1
- package/dist/agents/shared/services/session-logger.d.ts +0 -162
- package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
- package/dist/agents/shared/services/session-logger.js +0 -724
- package/dist/agents/shared/services/session-logger.js.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
- package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.js +0 -296
- package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
- package/dist/agents/shared/services/token-billing.d.ts +0 -72
- package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
- package/dist/agents/shared/services/token-billing.js +0 -198
- package/dist/agents/shared/services/token-billing.js.map +0 -1
- package/dist/agents/shared/services/tool-executor.d.ts +0 -43
- package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/tool-executor.js +0 -175
- package/dist/agents/shared/services/tool-executor.js.map +0 -1
- package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
- package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
- package/dist/agents/shared/services/typing-indicator.js +0 -54
- package/dist/agents/shared/services/typing-indicator.js.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
- package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
- package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
- package/dist/agents/shared/specialist.d.ts +0 -91
- package/dist/agents/shared/specialist.d.ts.map +0 -1
- package/dist/agents/shared/specialist.js +0 -399
- package/dist/agents/shared/specialist.js.map +0 -1
- package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
- package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
- package/dist/agents/shared/tool-schema-loader.js +0 -238
- package/dist/agents/shared/tool-schema-loader.js.map +0 -1
- package/dist/agents/shared/types.d.ts +0 -190
- package/dist/agents/shared/types.d.ts.map +0 -1
- package/dist/agents/shared/types.js +0 -13
- package/dist/agents/shared/types.js.map +0 -1
- package/dist/bot/bot-config.d.ts +0 -37
- package/dist/bot/bot-config.d.ts.map +0 -1
- package/dist/bot/bot-config.js +0 -219
- package/dist/bot/bot-config.js.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
- package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
- package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
- package/dist/bot/services/session-logger.d.ts +0 -162
- package/dist/bot/services/session-logger.d.ts.map +0 -1
- package/dist/bot/services/session-logger.js +0 -724
- package/dist/bot/services/session-logger.js.map +0 -1
- package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
- package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/bot/services/workspace-schema-cache.js +0 -506
- package/dist/bot/services/workspace-schema-cache.js.map +0 -1
- package/dist/bot-config/tools.d.ts +0 -28
- package/dist/bot-config/tools.d.ts.map +0 -1
- package/dist/bot-config/tools.js +0 -279
- package/dist/bot-config/tools.js.map +0 -1
- package/dist/client/agents/base.d.ts +0 -207
- package/dist/client/agents/base.d.ts.map +0 -1
- package/dist/client/agents/base.js +0 -744
- package/dist/client/agents/base.js.map +0 -1
- package/dist/client/agents/definitions.d.ts +0 -53
- package/dist/client/agents/definitions.d.ts.map +0 -1
- package/dist/client/agents/definitions.js +0 -263
- package/dist/client/agents/definitions.js.map +0 -1
- package/dist/client/agents/orchestrator.d.ts +0 -141
- package/dist/client/agents/orchestrator.d.ts.map +0 -1
- package/dist/client/agents/orchestrator.js +0 -1062
- package/dist/client/agents/orchestrator.js.map +0 -1
- package/dist/client/agents/specialist.d.ts +0 -86
- package/dist/client/agents/specialist.d.ts.map +0 -1
- package/dist/client/agents/specialist.js +0 -340
- package/dist/client/agents/specialist.js.map +0 -1
- package/dist/client/bot-entrypoint.d.ts +0 -7
- package/dist/client/bot-entrypoint.d.ts.map +0 -1
- package/dist/client/bot-entrypoint.js +0 -103
- package/dist/client/bot-entrypoint.js.map +0 -1
- package/dist/client/bot-manager.d.ts +0 -44
- package/dist/client/bot-manager.d.ts.map +0 -1
- package/dist/client/bot-manager.js +0 -173
- package/dist/client/bot-manager.js.map +0 -1
- package/dist/client/bot-runner.d.ts +0 -35
- package/dist/client/bot-runner.d.ts.map +0 -1
- package/dist/client/bot-runner.js +0 -188
- package/dist/client/bot-runner.js.map +0 -1
- package/dist/client/chat-agent-daemon.d.ts +0 -464
- package/dist/client/chat-agent-daemon.d.ts.map +0 -1
- package/dist/client/chat-agent-daemon.js +0 -1774
- package/dist/client/chat-agent-daemon.js.map +0 -1
- package/dist/client/daemon-factory.d.ts +0 -106
- package/dist/client/daemon-factory.d.ts.map +0 -1
- package/dist/client/daemon-factory.js +0 -301
- package/dist/client/daemon-factory.js.map +0 -1
- package/dist/client/factory.d.ts +0 -111
- package/dist/client/factory.d.ts.map +0 -1
- package/dist/client/factory.js +0 -314
- package/dist/client/factory.js.map +0 -1
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -38
- package/dist/client/index.js.map +0 -1
- package/dist/client/multi-bot-manager.d.ts +0 -42
- package/dist/client/multi-bot-manager.d.ts.map +0 -1
- package/dist/client/multi-bot-manager.js +0 -161
- package/dist/client/multi-bot-manager.js.map +0 -1
- package/dist/client/orchestrator-daemon.d.ts +0 -87
- package/dist/client/orchestrator-daemon.d.ts.map +0 -1
- package/dist/client/orchestrator-daemon.js +0 -444
- package/dist/client/orchestrator-daemon.js.map +0 -1
- package/dist/client/server.d.ts +0 -8
- package/dist/client/server.d.ts.map +0 -1
- package/dist/client/server.js +0 -251
- package/dist/client/server.js.map +0 -1
- package/dist/client/services/agent-registry.d.ts +0 -108
- package/dist/client/services/agent-registry.d.ts.map +0 -1
- package/dist/client/services/agent-registry.js +0 -630
- package/dist/client/services/agent-registry.js.map +0 -1
- package/dist/client/services/conversation-manager.d.ts +0 -50
- package/dist/client/services/conversation-manager.d.ts.map +0 -1
- package/dist/client/services/conversation-manager.js +0 -136
- package/dist/client/services/conversation-manager.js.map +0 -1
- package/dist/client/services/mcp-client.d.ts +0 -48
- package/dist/client/services/mcp-client.d.ts.map +0 -1
- package/dist/client/services/mcp-client.js +0 -105
- package/dist/client/services/mcp-client.js.map +0 -1
- package/dist/client/services/message-classifier.d.ts +0 -37
- package/dist/client/services/message-classifier.d.ts.map +0 -1
- package/dist/client/services/message-classifier.js +0 -187
- package/dist/client/services/message-classifier.js.map +0 -1
- package/dist/client/services/message-formatter.d.ts +0 -84
- package/dist/client/services/message-formatter.d.ts.map +0 -1
- package/dist/client/services/message-formatter.js +0 -353
- package/dist/client/services/message-formatter.js.map +0 -1
- package/dist/client/services/session-logger.d.ts +0 -106
- package/dist/client/services/session-logger.d.ts.map +0 -1
- package/dist/client/services/session-logger.js +0 -446
- package/dist/client/services/session-logger.js.map +0 -1
- package/dist/client/services/tool-executor.d.ts +0 -41
- package/dist/client/services/tool-executor.d.ts.map +0 -1
- package/dist/client/services/tool-executor.js +0 -169
- package/dist/client/services/tool-executor.js.map +0 -1
- package/dist/client/services/workspace-schema-cache.d.ts +0 -149
- package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/client/services/workspace-schema-cache.js +0 -732
- package/dist/client/services/workspace-schema-cache.js.map +0 -1
- package/dist/client/specialist-daemon.d.ts +0 -77
- package/dist/client/specialist-daemon.d.ts.map +0 -1
- package/dist/client/specialist-daemon.js +0 -197
- package/dist/client/specialist-daemon.js.map +0 -1
- package/dist/client/specialists.d.ts +0 -53
- package/dist/client/specialists.d.ts.map +0 -1
- package/dist/client/specialists.js +0 -178
- package/dist/client/specialists.js.map +0 -1
- package/dist/client/tool-schema-loader.d.ts +0 -62
- package/dist/client/tool-schema-loader.d.ts.map +0 -1
- package/dist/client/tool-schema-loader.js +0 -232
- package/dist/client/tool-schema-loader.js.map +0 -1
- package/dist/client/types.d.ts +0 -327
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -121
- package/dist/client/types.js.map +0 -1
- package/dist/commands/seed-config.d.ts +0 -9
- package/dist/commands/seed-config.d.ts.map +0 -1
- package/dist/commands/seed-config.js +0 -377
- package/dist/commands/seed-config.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -11
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -320
- package/dist/commands/setup.js.map +0 -1
- package/dist/lib/discussion-lock.d.ts +0 -42
- package/dist/lib/discussion-lock.d.ts.map +0 -1
- package/dist/lib/discussion-lock.js +0 -110
- package/dist/lib/discussion-lock.js.map +0 -1
- package/dist/mcp/signal-handler.d.ts +0 -82
- package/dist/mcp/signal-handler.d.ts.map +0 -1
- package/dist/mcp/signal-handler.js +0 -406
- package/dist/mcp/signal-handler.js.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
- package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
- package/dist/mcp/tools/app-member.d.ts +0 -14
- package/dist/mcp/tools/app-member.d.ts.map +0 -1
- package/dist/mcp/tools/app-member.js +0 -195
- package/dist/mcp/tools/app-member.js.map +0 -1
- package/dist/mcp/tools/app-scaffold.d.ts +0 -14
- package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
- package/dist/mcp/tools/app-scaffold.js +0 -581
- package/dist/mcp/tools/app-scaffold.js.map +0 -1
- package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
- package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/constants.js +0 -94
- package/dist/mcp/tools/bot-config/constants.js.map +0 -1
- package/dist/mcp/tools/bot-config/core.d.ts +0 -253
- package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/core.js +0 -2456
- package/dist/mcp/tools/bot-config/core.js.map +0 -1
- package/dist/mcp/tools/bot-config/index.d.ts +0 -10
- package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/index.js +0 -59
- package/dist/mcp/tools/bot-config/index.js.map +0 -1
- package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
- package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/tools.js +0 -15
- package/dist/mcp/tools/bot-config/tools.js.map +0 -1
- package/dist/mcp/tools/bot-config/types.d.ts +0 -50
- package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/types.js +0 -6
- package/dist/mcp/tools/bot-config/types.js.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
- package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
- package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
- package/dist/mcp/tools/document.d.ts +0 -11
- package/dist/mcp/tools/document.d.ts.map +0 -1
- package/dist/mcp/tools/document.js +0 -741
- package/dist/mcp/tools/document.js.map +0 -1
- package/dist/mcp/tools/investigate.d.ts +0 -9
- package/dist/mcp/tools/investigate.d.ts.map +0 -1
- package/dist/mcp/tools/investigate.js +0 -254
- package/dist/mcp/tools/investigate.js.map +0 -1
- package/dist/mcp/utils/pagination.d.ts +0 -40
- package/dist/mcp/utils/pagination.d.ts.map +0 -1
- package/dist/mcp/utils/pagination.js +0 -55
- package/dist/mcp/utils/pagination.js.map +0 -1
- package/dist/modules/bug-reports/bug-config.d.ts +0 -25
- package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-config.js +0 -187
- package/dist/modules/bug-reports/bug-config.js.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
- package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.js +0 -510
- package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
- package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
- package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
- package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
- package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
- package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
- package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
- package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
- package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.js +0 -375
- package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
- package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.js +0 -298
- package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
- package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
- package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
- package/dist/modules/bug-reports/index.d.ts +0 -77
- package/dist/modules/bug-reports/index.d.ts.map +0 -1
- package/dist/modules/bug-reports/index.js +0 -215
- package/dist/modules/bug-reports/index.js.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
- package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
- package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
- package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
- package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
- package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-registry.js +0 -49
- package/dist/modules/bug-reports/pending-registry.js.map +0 -1
- package/dist/modules/bug-reports/types.d.ts +0 -123
- package/dist/modules/bug-reports/types.d.ts.map +0 -1
- package/dist/modules/bug-reports/types.js +0 -9
- package/dist/modules/bug-reports/types.js.map +0 -1
- package/dist/plugins/bug-fixer/index.d.ts +0 -2
- package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/index.js +0 -18
- package/dist/plugins/bug-fixer/index.js.map +0 -1
- package/dist/plugins/bug-fixer/tools.d.ts +0 -45
- package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/tools.js +0 -1096
- package/dist/plugins/bug-fixer/tools.js.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
- package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
- package/dist/routes/agents.d.ts +0 -44
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js +0 -311
- package/dist/routes/agents.js.map +0 -1
- package/dist/services/agent-credential-store.d.ts +0 -73
- package/dist/services/agent-credential-store.d.ts.map +0 -1
- package/dist/services/agent-credential-store.js +0 -212
- package/dist/services/agent-credential-store.js.map +0 -1
- package/dist/stdio-server.d.ts +0 -14
- package/dist/stdio-server.d.ts.map +0 -1
- package/dist/stdio-server.js +0 -101
- package/dist/stdio-server.js.map +0 -1
- package/dist/workspace/context.d.ts +0 -148
- package/dist/workspace/context.d.ts.map +0 -1
- package/dist/workspace/context.js +0 -339
- package/dist/workspace/context.js.map +0 -1
- package/dist/workspace/credentials.d.ts +0 -55
- package/dist/workspace/credentials.d.ts.map +0 -1
- package/dist/workspace/credentials.js +0 -239
- package/dist/workspace/credentials.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -21
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js +0 -45
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/loader.d.ts +0 -27
- package/dist/workspace/loader.d.ts.map +0 -1
- package/dist/workspace/loader.js +0 -222
- package/dist/workspace/loader.js.map +0 -1
- package/dist/workspace/schema.d.ts +0 -37
- package/dist/workspace/schema.d.ts.map +0 -1
- package/dist/workspace/schema.js +0 -192
- package/dist/workspace/schema.js.map +0 -1
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
* - Activities = Rows
|
|
8
8
|
* - Fields = Columns
|
|
9
9
|
*
|
|
10
|
-
* All 4 insight
|
|
10
|
+
* All 4 insight tools in one file for cohesion (v2 surface):
|
|
11
|
+
* - run_insight (saved execution + ad-hoc preview)
|
|
12
|
+
* - save_insight (create + update upsert)
|
|
13
|
+
* - list_insights
|
|
14
|
+
* - remove_insight
|
|
11
15
|
*/
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.insightTools = exports.listInsightsTool = exports.removeInsightTool = exports.
|
|
17
|
+
exports.insightTools = exports.listInsightsTool = exports.removeInsightTool = exports.saveInsightTool = exports.runInsightTool = void 0;
|
|
14
18
|
const zod_1 = require("zod");
|
|
15
19
|
const tool_registry_1 = require("../tool-registry");
|
|
16
20
|
const logger_1 = require("../../lib/logger");
|
|
@@ -25,10 +29,10 @@ const logger = (0, logger_1.createLogger)({ component: 'insight-tools' });
|
|
|
25
29
|
* Accepts both 'id' and 'fieldId' for flexibility (LLMs often use 'id')
|
|
26
30
|
*/
|
|
27
31
|
const fieldSchema = zod_1.z.object({
|
|
28
|
-
name: zod_1.z.string().describe(
|
|
32
|
+
name: zod_1.z.string().describe('Column name in SQL query'),
|
|
29
33
|
// Accept both 'id' and 'fieldId' - will be normalized to 'fieldId'
|
|
30
|
-
id: zod_1.z.string().optional().describe(
|
|
31
|
-
fieldId: zod_1.z.string().optional().describe(
|
|
34
|
+
id: zod_1.z.string().optional().describe('Field ID (alias for fieldId)'),
|
|
35
|
+
fieldId: zod_1.z.string().optional().describe('Custom field ID from workflow'),
|
|
32
36
|
meta: zod_1.z.enum([
|
|
33
37
|
'_id',
|
|
34
38
|
'uid',
|
|
@@ -43,7 +47,7 @@ const fieldSchema = zod_1.z.object({
|
|
|
43
47
|
'workflowId',
|
|
44
48
|
'workflowName',
|
|
45
49
|
'priority'
|
|
46
|
-
]).optional().describe(
|
|
50
|
+
]).optional().describe('Built-in activity property (alternative to fieldId)'),
|
|
47
51
|
}).refine((data) => data.meta || data.fieldId || data.id, { message: "Field must have either 'meta', 'fieldId', or 'id'" });
|
|
48
52
|
/**
|
|
49
53
|
* Sanitize field name to be SQL-identifier safe (no spaces, special chars)
|
|
@@ -53,8 +57,9 @@ function sanitizeFieldName(name) {
|
|
|
53
57
|
return name
|
|
54
58
|
.split(/\s+/)
|
|
55
59
|
.map((word, index) => {
|
|
56
|
-
if (index === 0)
|
|
60
|
+
if (index === 0) {
|
|
57
61
|
return word.charAt(0).toLowerCase() + word.slice(1);
|
|
62
|
+
}
|
|
58
63
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
59
64
|
})
|
|
60
65
|
.join('')
|
|
@@ -67,7 +72,7 @@ function normalizeFields(sources) {
|
|
|
67
72
|
return sources.map(source => ({
|
|
68
73
|
...source,
|
|
69
74
|
fields: source.fields.map(field => {
|
|
70
|
-
|
|
75
|
+
const normalized = { ...field };
|
|
71
76
|
// Sanitize field name (remove spaces, make SQL-safe)
|
|
72
77
|
if (normalized.name) {
|
|
73
78
|
normalized.name = sanitizeFieldName(normalized.name);
|
|
@@ -85,17 +90,14 @@ function normalizeFields(sources) {
|
|
|
85
90
|
* Source definition schema - workflow as SQL table
|
|
86
91
|
*/
|
|
87
92
|
const sourceSchema = zod_1.z.object({
|
|
88
|
-
name: zod_1.z.string().describe(
|
|
89
|
-
workflowId: zod_1.z.string().describe(
|
|
90
|
-
fields: zod_1.z.array(fieldSchema).min(1).describe(
|
|
93
|
+
name: zod_1.z.string().describe('Table alias for SQL query'),
|
|
94
|
+
workflowId: zod_1.z.string().describe('Workflow ID to query'),
|
|
95
|
+
fields: zod_1.z.array(fieldSchema).min(1).describe('Field mappings for SQL columns'),
|
|
91
96
|
});
|
|
92
|
-
// ============================================================================
|
|
93
|
-
// CREATE INSIGHT TOOL
|
|
94
|
-
// ============================================================================
|
|
95
97
|
const INSIGHT_SQL_GUIDE = `**How sources map to SQL:**
|
|
96
98
|
- sources[].name → TABLE NAME in SQL
|
|
97
99
|
- sources[].fields[].name → COLUMN NAME in SQL
|
|
98
|
-
- sources[].fields[].fieldId → custom field ID (hex string from
|
|
100
|
+
- sources[].fields[].fieldId → custom field ID (hex string from describe_workflows include:["schema"])
|
|
99
101
|
- sources[].fields[].meta → built-in property (use INSTEAD of fieldId): phaseName, name, created, updated, uid, team, priority
|
|
100
102
|
|
|
101
103
|
**Example — count by phase:**
|
|
@@ -103,528 +105,468 @@ sources: [{ name: "T", workflowId: "...", fields: [{ name: "phase", meta: "phase
|
|
|
103
105
|
query: "SELECT phase, COUNT(*) as count FROM T GROUP BY phase"
|
|
104
106
|
|
|
105
107
|
**NEVER use fieldId or workflowId in the SQL — only field name values.**`;
|
|
106
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Format a headers/rows result set as a markdown table (first 10 rows)
|
|
110
|
+
*/
|
|
111
|
+
function formatResultTable(headers, rows) {
|
|
112
|
+
if (!headers || !rows) {
|
|
113
|
+
return '⚠️ No data returned\n';
|
|
114
|
+
}
|
|
115
|
+
if (rows.length === 0) {
|
|
116
|
+
return `**Columns:** ${headers.join(', ')}\n\n⚠️ **No rows matched** - Check your query filters\n`;
|
|
117
|
+
}
|
|
118
|
+
let text = `**Columns:** ${headers.join(', ')}\n\n`;
|
|
119
|
+
text += '**Sample Data (first 10 rows):**\n```\n';
|
|
120
|
+
text += headers.join(' | ') + '\n';
|
|
121
|
+
text += headers.map(() => '---').join(' | ') + '\n';
|
|
122
|
+
const rowsToShow = Math.min(rows.length, 10);
|
|
123
|
+
for (let idx = 0; idx < rowsToShow; idx++) {
|
|
124
|
+
text += rows[idx].map(val => String(val || '')).join(' | ') + '\n';
|
|
125
|
+
}
|
|
126
|
+
if (rows.length > 10) {
|
|
127
|
+
text += `\n... and ${rows.length - 10} more rows\n`;
|
|
128
|
+
}
|
|
129
|
+
text += '```\n';
|
|
130
|
+
return text;
|
|
131
|
+
}
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// RUN INSIGHT TOOL (saved execution + ad-hoc preview)
|
|
134
|
+
// ============================================================================
|
|
135
|
+
const runInsightDescription = `Execute an insight query and return rows. Two modes (mutually exclusive):
|
|
136
|
+
- Saved: pass insightId to run a stored insight. refresh: true recalculates instead of returning cached results.
|
|
137
|
+
- Ad-hoc: pass sources + query to test SQL without saving. One call replaces multiple list_activities calls. Always run ad-hoc before save_insight.
|
|
107
138
|
|
|
108
139
|
${INSIGHT_SQL_GUIDE}`;
|
|
109
|
-
|
|
110
|
-
|
|
140
|
+
/** Saved-insight path: v3.insight.data */
|
|
141
|
+
async function runSavedInsight(insightId, refresh, context) {
|
|
142
|
+
try {
|
|
143
|
+
logger.debug('Calling v3.insight.data', { insightId, refresh });
|
|
144
|
+
// Call v3.insight.data endpoint ('update' is the API name for refresh)
|
|
145
|
+
const result = await context.hailer.request('v3.insight.data', [insightId, { update: refresh }]);
|
|
146
|
+
logger.debug('Insight data retrieved', {
|
|
147
|
+
headers: result.headers?.length,
|
|
148
|
+
rows: result.rows?.length,
|
|
149
|
+
fullResult: JSON.stringify(result).substring(0, 500)
|
|
150
|
+
});
|
|
151
|
+
let responseText = `✅ **Insight Data Retrieved** (${result.rows?.length || 0} rows)\n\n`;
|
|
152
|
+
responseText += formatResultTable(result.headers, result.rows);
|
|
153
|
+
if (!result.headers || !result.rows) {
|
|
154
|
+
responseText += `**Debug:** Response keys: ${Object.keys(result).join(', ')}\n`;
|
|
155
|
+
responseText += `**Full response (truncated):** \`${JSON.stringify(result).substring(0, 300)}\`\n`;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
content: [{
|
|
159
|
+
type: 'text',
|
|
160
|
+
text: responseText,
|
|
161
|
+
}],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
166
|
+
logger.error('Error getting insight data', error);
|
|
167
|
+
}
|
|
168
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
169
|
+
return {
|
|
170
|
+
content: [{
|
|
171
|
+
type: 'text',
|
|
172
|
+
text: `❌ **Error getting insight data**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- Permission denied\n- Insight query has errors\n- Use \`list_insights\` to verify insight ID`,
|
|
173
|
+
}],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Ad-hoc path: v3.insight.preview */
|
|
178
|
+
async function runAdHocInsight(sources, query, context) {
|
|
179
|
+
try {
|
|
180
|
+
// Resolve workspace ID (returns undefined if cache unavailable)
|
|
181
|
+
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)({}, context);
|
|
182
|
+
if (!workspaceId) {
|
|
183
|
+
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
184
|
+
}
|
|
185
|
+
logger.debug('Calling v3.insight.preview', {
|
|
186
|
+
workspaceId,
|
|
187
|
+
sourcesCount: sources.length,
|
|
188
|
+
});
|
|
189
|
+
// Normalize sources (convert 'id' to 'fieldId' if needed)
|
|
190
|
+
const normalizedSources = normalizeFields(sources);
|
|
191
|
+
const previewData = {
|
|
192
|
+
sources: normalizedSources,
|
|
193
|
+
query,
|
|
194
|
+
};
|
|
195
|
+
// Call v3.insight.preview endpoint
|
|
196
|
+
const result = await context.hailer.request('v3.insight.preview', [workspaceId, previewData]);
|
|
197
|
+
logger.debug('Preview successful', {
|
|
198
|
+
headers: result.headers?.length,
|
|
199
|
+
rows: result.rows?.length
|
|
200
|
+
});
|
|
201
|
+
let responseText = `✅ **Preview Results** (~${result.rows?.length || 0} rows)\n\n`;
|
|
202
|
+
responseText += formatResultTable(result.headers, result.rows);
|
|
203
|
+
responseText += '\n✅ **Query is valid!** Ready to save with `save_insight`.';
|
|
204
|
+
return {
|
|
205
|
+
content: [{
|
|
206
|
+
type: 'text',
|
|
207
|
+
text: responseText,
|
|
208
|
+
}],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
213
|
+
logger.error('Error previewing insight', error);
|
|
214
|
+
}
|
|
215
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
216
|
+
return {
|
|
217
|
+
content: [{
|
|
218
|
+
type: 'text',
|
|
219
|
+
text: `❌ **Preview Failed**\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check SQL syntax\n- Verify field names match source definitions\n- Ensure workflow IDs are correct\n- Check table aliases match source names`,
|
|
220
|
+
}],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.runInsightTool = {
|
|
225
|
+
name: 'run_insight',
|
|
111
226
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
112
|
-
description:
|
|
227
|
+
description: runInsightDescription,
|
|
113
228
|
schema: zod_1.z.object({
|
|
114
|
-
|
|
229
|
+
insightId: zod_1.z
|
|
115
230
|
.string()
|
|
116
231
|
.optional()
|
|
117
|
-
.describe(
|
|
118
|
-
|
|
119
|
-
.string()
|
|
120
|
-
.min(1)
|
|
121
|
-
.describe("Insight name"),
|
|
122
|
-
public: zod_1.z
|
|
232
|
+
.describe('Saved insight ID to execute. Mutually exclusive with sources/query.'),
|
|
233
|
+
refresh: zod_1.z
|
|
123
234
|
.boolean()
|
|
124
235
|
.optional()
|
|
125
|
-
.
|
|
126
|
-
.describe("Whether insight is publicly accessible (default: false)"),
|
|
236
|
+
.describe('Saved mode only: recalculate data (true) instead of using cached results (false, default)'),
|
|
127
237
|
sources: zod_1.z
|
|
128
238
|
.array(sourceSchema)
|
|
129
239
|
.min(1)
|
|
130
|
-
.
|
|
240
|
+
.optional()
|
|
241
|
+
.describe('Ad-hoc mode: workflow sources. source.name = SQL table name, field.name = SQL column name.'),
|
|
131
242
|
query: zod_1.z
|
|
132
243
|
.string()
|
|
133
244
|
.min(1)
|
|
134
|
-
.
|
|
245
|
+
.optional()
|
|
246
|
+
.describe('Ad-hoc mode: SQL query to test'),
|
|
135
247
|
}),
|
|
136
248
|
async execute(args, context) {
|
|
137
|
-
logger.debug('
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
sourcesCount: args.sources
|
|
249
|
+
logger.debug('Running insight', {
|
|
250
|
+
insightId: args.insightId,
|
|
251
|
+
refresh: args.refresh,
|
|
252
|
+
sourcesCount: args.sources?.length,
|
|
253
|
+
hasQuery: !!args.query,
|
|
141
254
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
142
255
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
workspaceId,
|
|
151
|
-
name: args.name,
|
|
152
|
-
sourcesCount: args.sources.length
|
|
153
|
-
});
|
|
154
|
-
// Normalize sources (convert 'id' to 'fieldId' if needed)
|
|
155
|
-
const normalizedSources = normalizeFields(args.sources);
|
|
156
|
-
// Build insight payload
|
|
157
|
-
const insightData = {
|
|
158
|
-
name: args.name,
|
|
159
|
-
public: args.public || false,
|
|
160
|
-
sources: normalizedSources,
|
|
161
|
-
query: args.query,
|
|
256
|
+
const hasAdHocArgs = !!args.sources || !!args.query;
|
|
257
|
+
if (args.insightId && hasAdHocArgs) {
|
|
258
|
+
return {
|
|
259
|
+
content: [{
|
|
260
|
+
type: 'text',
|
|
261
|
+
text: '❌ **Conflicting modes**\n\nPass EITHER `insightId` (run a saved insight) OR `sources` + `query` (ad-hoc test) — not both.',
|
|
262
|
+
}],
|
|
162
263
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
169
|
-
const insightId = result.insightId || result._id;
|
|
170
|
-
const discussionId = result.discussionId || result.discussion;
|
|
171
|
-
// Automatically join the insight's discussion
|
|
172
|
-
if (discussionId) {
|
|
173
|
-
try {
|
|
174
|
-
logger.debug('Automatically joining insight discussion', { discussionId });
|
|
175
|
-
await context.hailer.joinDiscussion(discussionId);
|
|
176
|
-
logger.debug('Successfully joined insight discussion', { discussionId });
|
|
177
|
-
}
|
|
178
|
-
catch (joinError) {
|
|
179
|
-
logger.warn('Failed to join insight discussion (non-fatal)', {
|
|
180
|
-
discussionId,
|
|
181
|
-
error: joinError instanceof Error ? joinError.message : String(joinError)
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
logger.debug('No discussion ID in response, skipping auto-join');
|
|
187
|
-
}
|
|
188
|
-
// Build success response
|
|
189
|
-
let responseText = `✅ **Insight Created Successfully**\n\n`;
|
|
190
|
-
responseText += `**Insight Name:** ${args.name}\n`;
|
|
191
|
-
responseText += `**Insight ID:** \`${insightId}\`\n`;
|
|
192
|
-
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
193
|
-
responseText += `**Public:** ${args.public ? 'Yes' : 'No'}\n`;
|
|
194
|
-
responseText += `**Sources:** ${args.sources.length} workflow(s)\n`;
|
|
195
|
-
if (discussionId) {
|
|
196
|
-
responseText += `**Discussion:** Automatically joined ✓\n`;
|
|
197
|
-
}
|
|
198
|
-
responseText += `\n`;
|
|
199
|
-
// Show sources
|
|
200
|
-
responseText += `**Query Sources:**\n`;
|
|
201
|
-
args.sources.forEach((source) => {
|
|
202
|
-
responseText += `- \`${source.name}\` → Workflow: \`${source.workflowId}\` (${source.fields.length} fields)\n`;
|
|
203
|
-
});
|
|
204
|
-
responseText += `\n**SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n\n`;
|
|
205
|
-
responseText += `💡 **Next Steps:**\n`;
|
|
206
|
-
responseText += `- Use \`get_insight_data\` to execute the query and see results\n`;
|
|
207
|
-
responseText += `- Use \`list_insights\` to see all insights in workspace\n`;
|
|
208
|
-
responseText += `- Use \`update_insight\` to modify the insight\n`;
|
|
209
|
-
responseText += `- Use \`preview_insight\` to test query changes before saving\n\n`;
|
|
210
|
-
if (args.public) {
|
|
211
|
-
responseText += `🌐 **Public Insight:** This insight can be accessed without authentication.\n`;
|
|
212
|
-
}
|
|
264
|
+
}
|
|
265
|
+
if (args.insightId) {
|
|
266
|
+
return runSavedInsight(args.insightId, args.refresh ?? false, context);
|
|
267
|
+
}
|
|
268
|
+
if (!hasAdHocArgs) {
|
|
213
269
|
return {
|
|
214
270
|
content: [{
|
|
215
|
-
type:
|
|
216
|
-
text:
|
|
271
|
+
type: 'text',
|
|
272
|
+
text: '❌ **Missing parameters**\n\nPass `insightId` to run a saved insight, or `sources` + `query` to test an ad-hoc SQL query.\n\nUse `list_insights` to find saved insight IDs.',
|
|
217
273
|
}],
|
|
218
274
|
};
|
|
219
275
|
}
|
|
220
|
-
|
|
221
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
222
|
-
logger.error("Error creating insight", error);
|
|
223
|
-
let errorMessage = 'Unknown error occurred';
|
|
224
|
-
let errorDetails = '';
|
|
225
|
-
if (error instanceof Error) {
|
|
226
|
-
errorMessage = error.message;
|
|
227
|
-
if (error.stack) {
|
|
228
|
-
errorDetails = `\n\n**Stack trace:**\n\`\`\`\n${error.stack}\n\`\`\``;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
else if (typeof error === 'object' && error !== null) {
|
|
232
|
-
try {
|
|
233
|
-
errorMessage = JSON.stringify(error, null, 2);
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
errorMessage = String(error);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
errorMessage = String(error);
|
|
241
|
-
}
|
|
242
|
-
// Handle SQL syntax errors
|
|
243
|
-
if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
|
|
244
|
-
return {
|
|
245
|
-
content: [{
|
|
246
|
-
type: "text",
|
|
247
|
-
text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`preview_insight\` to test queries before creating\n- Make sure field IDs are correct (use \`get_workflow_schema\`)`,
|
|
248
|
-
}],
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
// Handle permission errors
|
|
252
|
-
if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
|
|
253
|
-
return {
|
|
254
|
-
content: [{
|
|
255
|
-
type: "text",
|
|
256
|
-
text: `❌ **Permission Denied**\n\nYou may not have permission to create insights or access the specified workflows.\n\n**Error:** ${errorMessage}`,
|
|
257
|
-
}],
|
|
258
|
-
};
|
|
259
|
-
}
|
|
276
|
+
if (!args.sources || !args.query) {
|
|
260
277
|
return {
|
|
261
278
|
content: [{
|
|
262
|
-
type:
|
|
263
|
-
text:
|
|
279
|
+
type: 'text',
|
|
280
|
+
text: '❌ **Incomplete ad-hoc query**\n\nAd-hoc mode requires BOTH `sources` and `query`.',
|
|
264
281
|
}],
|
|
265
282
|
};
|
|
266
283
|
}
|
|
284
|
+
return runAdHocInsight(args.sources, args.query, context);
|
|
267
285
|
}
|
|
268
286
|
};
|
|
269
287
|
// ============================================================================
|
|
270
|
-
//
|
|
288
|
+
// SAVE INSIGHT TOOL (create + update upsert)
|
|
271
289
|
// ============================================================================
|
|
272
|
-
const
|
|
290
|
+
const saveInsightDescription = `Create or update a SQL insight over workflow data (upsert).
|
|
291
|
+
- Create: omit insightId — name, sources, and query are required.
|
|
292
|
+
- Update: pass insightId — only the provided fields (name, public, sources, query) are changed.
|
|
273
293
|
|
|
274
294
|
${INSIGHT_SQL_GUIDE}`;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
.
|
|
296
|
-
}),
|
|
297
|
-
async execute(args, context) {
|
|
298
|
-
logger.debug('Previewing insight', {
|
|
299
|
-
workspaceId: args.workspaceId,
|
|
300
|
-
sourcesCount: args.sources.length,
|
|
301
|
-
insightId: args.insightId,
|
|
302
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
295
|
+
/** Create path: v3.insight.create (auto-joins the insight's discussion) */
|
|
296
|
+
async function createNewInsight(args, context) {
|
|
297
|
+
const { name, sources, query } = args;
|
|
298
|
+
if (!name || !sources || !query) {
|
|
299
|
+
return {
|
|
300
|
+
content: [{
|
|
301
|
+
type: 'text',
|
|
302
|
+
text: '❌ **Missing required fields**\n\nCreating a new insight (no `insightId`) requires `name`, `sources`, and `query`.\n\nTo update an existing insight instead, pass its `insightId`.',
|
|
303
|
+
}],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
// Resolve workspace ID (returns undefined if cache unavailable)
|
|
308
|
+
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
|
|
309
|
+
if (!workspaceId) {
|
|
310
|
+
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
311
|
+
}
|
|
312
|
+
logger.debug('Calling v3.insight.create', {
|
|
313
|
+
workspaceId,
|
|
314
|
+
name,
|
|
315
|
+
sourcesCount: sources.length
|
|
303
316
|
});
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
else if (result.rows.length === 0) {
|
|
334
|
-
responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
|
|
335
|
-
responseText += `⚠️ **No rows matched** - Check your query filters\n`;
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
responseText += `**Columns:** ${result.headers.join(', ')}\n\n`;
|
|
339
|
-
responseText += `**Sample Data:**\n\`\`\`\n`;
|
|
340
|
-
// Show column headers
|
|
341
|
-
responseText += result.headers.join(' | ') + '\n';
|
|
342
|
-
responseText += result.headers.map(() => '---').join(' | ') + '\n';
|
|
343
|
-
// Show first 10 rows
|
|
344
|
-
const rowsToShow = Math.min(result.rows.length, 10);
|
|
345
|
-
for (let i = 0; i < rowsToShow; i++) {
|
|
346
|
-
responseText += result.rows[i].map(v => String(v || '')).join(' | ') + '\n';
|
|
347
|
-
}
|
|
348
|
-
if (result.rows.length > 10) {
|
|
349
|
-
responseText += `\n... and ${result.rows.length - 10} more rows\n`;
|
|
350
|
-
}
|
|
351
|
-
responseText += `\`\`\`\n\n`;
|
|
317
|
+
// Normalize sources (convert 'id' to 'fieldId' if needed)
|
|
318
|
+
const normalizedSources = normalizeFields(sources);
|
|
319
|
+
// Build insight payload
|
|
320
|
+
const insightData = {
|
|
321
|
+
name,
|
|
322
|
+
public: args.public || false,
|
|
323
|
+
sources: normalizedSources,
|
|
324
|
+
query,
|
|
325
|
+
};
|
|
326
|
+
// Call v3.insight.create endpoint
|
|
327
|
+
const result = await context.hailer.request('v3.insight.create', [workspaceId, insightData]);
|
|
328
|
+
logger.debug('Insight creation successful', {
|
|
329
|
+
insightId: result.insightId || result._id,
|
|
330
|
+
result: JSON.stringify(result)
|
|
331
|
+
});
|
|
332
|
+
const insightId = result.insightId || result._id;
|
|
333
|
+
const discussionId = result.discussionId || result.discussion;
|
|
334
|
+
// Automatically join the insight's discussion
|
|
335
|
+
if (discussionId) {
|
|
336
|
+
try {
|
|
337
|
+
logger.debug('Automatically joining insight discussion', { discussionId });
|
|
338
|
+
await context.hailer.joinDiscussion(discussionId);
|
|
339
|
+
logger.debug('Successfully joined insight discussion', { discussionId });
|
|
340
|
+
}
|
|
341
|
+
catch (joinError) {
|
|
342
|
+
logger.warn('Failed to join insight discussion (non-fatal)', {
|
|
343
|
+
discussionId,
|
|
344
|
+
error: joinError instanceof Error ? joinError.message : String(joinError)
|
|
345
|
+
});
|
|
352
346
|
}
|
|
353
|
-
|
|
347
|
+
}
|
|
348
|
+
if (!discussionId) {
|
|
349
|
+
logger.debug('No discussion ID in response, skipping auto-join');
|
|
350
|
+
}
|
|
351
|
+
// Build success response
|
|
352
|
+
let responseText = '✅ **Insight Created Successfully**\n\n';
|
|
353
|
+
responseText += `**Insight Name:** ${name}\n`;
|
|
354
|
+
responseText += `**Insight ID:** \`${insightId}\`\n`;
|
|
355
|
+
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
356
|
+
responseText += `**Public:** ${args.public ? 'Yes' : 'No'}\n`;
|
|
357
|
+
responseText += `**Sources:** ${sources.length} workflow(s)\n`;
|
|
358
|
+
if (discussionId) {
|
|
359
|
+
responseText += '**Discussion:** Automatically joined ✓\n';
|
|
360
|
+
}
|
|
361
|
+
responseText += '\n';
|
|
362
|
+
// Show sources
|
|
363
|
+
responseText += '**Query Sources:**\n';
|
|
364
|
+
sources.forEach((source) => {
|
|
365
|
+
responseText += `- \`${source.name}\` → Workflow: \`${source.workflowId}\` (${source.fields.length} fields)\n`;
|
|
366
|
+
});
|
|
367
|
+
responseText += `\n**SQL Query:**\n\`\`\`sql\n${query}\n\`\`\`\n\n`;
|
|
368
|
+
responseText += '💡 **Next Steps:**\n';
|
|
369
|
+
responseText += '- Use `run_insight` with this insightId to execute the query and see results\n';
|
|
370
|
+
responseText += '- Use `list_insights` to see all insights in workspace\n';
|
|
371
|
+
responseText += '- Use `save_insight` with this insightId to modify the insight\n\n';
|
|
372
|
+
if (args.public) {
|
|
373
|
+
responseText += '🌐 **Public Insight:** This insight can be accessed without authentication.\n';
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
content: [{
|
|
377
|
+
type: 'text',
|
|
378
|
+
text: responseText,
|
|
379
|
+
}],
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
384
|
+
logger.error('Error creating insight', error);
|
|
385
|
+
}
|
|
386
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
387
|
+
const errorDetails = error instanceof Error && error.stack
|
|
388
|
+
? `\n\n**Stack trace:**\n\`\`\`\n${error.stack}\n\`\`\``
|
|
389
|
+
: '';
|
|
390
|
+
// Handle SQL syntax errors
|
|
391
|
+
if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
|
|
354
392
|
return {
|
|
355
393
|
content: [{
|
|
356
|
-
type:
|
|
357
|
-
text:
|
|
394
|
+
type: 'text',
|
|
395
|
+
text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`run_insight\` (sources + query) to test queries before saving\n- Make sure field IDs are correct (use \`describe_workflows\` with include:["schema"])`,
|
|
358
396
|
}],
|
|
359
397
|
};
|
|
360
398
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
logger.error("Error previewing insight", error);
|
|
364
|
-
let errorMessage = 'Unknown error occurred';
|
|
365
|
-
if (error instanceof Error) {
|
|
366
|
-
errorMessage = error.message;
|
|
367
|
-
}
|
|
368
|
-
else if (typeof error === 'object' && error !== null) {
|
|
369
|
-
try {
|
|
370
|
-
errorMessage = JSON.stringify(error, null, 2);
|
|
371
|
-
}
|
|
372
|
-
catch {
|
|
373
|
-
errorMessage = String(error);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
errorMessage = String(error);
|
|
378
|
-
}
|
|
399
|
+
// Handle permission errors
|
|
400
|
+
if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
|
|
379
401
|
return {
|
|
380
402
|
content: [{
|
|
381
|
-
type:
|
|
382
|
-
text: `❌ **
|
|
403
|
+
type: 'text',
|
|
404
|
+
text: `❌ **Permission Denied**\n\nYou may not have permission to create insights or access the specified workflows.\n\n**Error:** ${errorMessage}`,
|
|
383
405
|
}],
|
|
384
406
|
};
|
|
385
407
|
}
|
|
408
|
+
return {
|
|
409
|
+
content: [{
|
|
410
|
+
type: 'text',
|
|
411
|
+
text: `❌ **Error creating insight**\n\n**Error:** ${errorMessage}${errorDetails}\n\n**Common Issues:**\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Workflow fields don't exist\n- Permission issues\n- Check field IDs with \`describe_workflows\` include:["schema"]\n- Test query with \`run_insight\` (sources + query) first`,
|
|
412
|
+
}],
|
|
413
|
+
};
|
|
386
414
|
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
.
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
415
|
+
}
|
|
416
|
+
/** Update path: v3.insight.update (partial-field semantics) */
|
|
417
|
+
async function updateExistingInsight(insightId, args, context) {
|
|
418
|
+
try {
|
|
419
|
+
// Build update payload - only include provided fields
|
|
420
|
+
const updateData = {};
|
|
421
|
+
if (args.name) {
|
|
422
|
+
updateData.name = args.name;
|
|
423
|
+
}
|
|
424
|
+
if (typeof args.public === 'boolean') {
|
|
425
|
+
updateData.public = args.public;
|
|
426
|
+
}
|
|
427
|
+
if (args.sources) {
|
|
428
|
+
updateData.sources = normalizeFields(args.sources);
|
|
429
|
+
}
|
|
430
|
+
if (args.query) {
|
|
431
|
+
updateData.query = args.query;
|
|
432
|
+
}
|
|
433
|
+
// Validate at least one field is being updated
|
|
434
|
+
if (Object.keys(updateData).length === 0) {
|
|
435
|
+
return {
|
|
436
|
+
content: [{
|
|
437
|
+
type: 'text',
|
|
438
|
+
text: `❌ **No updates provided**\n\nYou must provide at least one field to update:\n- name\n- public\n- sources\n- query\n\nExample:\n\`\`\`javascript\nsave_insight({\n insightId: "${insightId}",\n name: "New Name"\n})\n\`\`\``,
|
|
439
|
+
}],
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
logger.debug('Calling v3.insight.update', {
|
|
443
|
+
insightId,
|
|
444
|
+
updateFields: Object.keys(updateData)
|
|
411
445
|
});
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
446
|
+
// Call v3.insight.update endpoint
|
|
447
|
+
// API expects: [insightId, updateData]
|
|
448
|
+
const result = await context.hailer.request('v3.insight.update', [
|
|
449
|
+
insightId,
|
|
450
|
+
updateData
|
|
451
|
+
]);
|
|
452
|
+
logger.debug('Insight update successful', {
|
|
453
|
+
insightId,
|
|
454
|
+
result: JSON.stringify(result)
|
|
455
|
+
});
|
|
456
|
+
// Build success response
|
|
457
|
+
let responseText = '✅ **Insight Updated Successfully**\n\n';
|
|
458
|
+
responseText += `**Insight ID:** \`${insightId}\`\n`;
|
|
459
|
+
responseText += '**Updated Fields:**\n';
|
|
460
|
+
if (args.name) {
|
|
461
|
+
responseText += `- Name: ${args.name}\n`;
|
|
462
|
+
}
|
|
463
|
+
if (typeof args.public === 'boolean') {
|
|
464
|
+
responseText += `- Public: ${args.public ? 'Yes' : 'No'}\n`;
|
|
465
|
+
}
|
|
466
|
+
if (args.sources) {
|
|
467
|
+
responseText += `- Sources: ${args.sources.length} workflow(s)\n`;
|
|
468
|
+
}
|
|
469
|
+
if (args.query) {
|
|
470
|
+
responseText += '- Query: Updated\n';
|
|
471
|
+
}
|
|
472
|
+
if (args.query) {
|
|
473
|
+
responseText += `\n**New SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n`;
|
|
474
|
+
}
|
|
475
|
+
responseText += '\n💡 **Next Steps:**\n';
|
|
476
|
+
responseText += '- Use `run_insight` with `refresh: true` to see fresh results\n';
|
|
477
|
+
responseText += '- Use `run_insight` (sources + query) to test if you made query changes\n';
|
|
478
|
+
responseText += '- Use `list_insights` to see all insights\n';
|
|
479
|
+
return {
|
|
480
|
+
content: [{
|
|
481
|
+
type: 'text',
|
|
482
|
+
text: responseText,
|
|
483
|
+
}],
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
488
|
+
logger.error('Error updating insight', error);
|
|
489
|
+
}
|
|
490
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
491
|
+
// Handle SQL syntax errors
|
|
492
|
+
if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
|
|
451
493
|
return {
|
|
452
494
|
content: [{
|
|
453
|
-
type:
|
|
454
|
-
text:
|
|
495
|
+
type: 'text',
|
|
496
|
+
text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`run_insight\` (sources + query) to test queries before updating\n- Make sure field IDs are correct (use \`describe_workflows\` with include:["schema"])`,
|
|
455
497
|
}],
|
|
456
498
|
};
|
|
457
499
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
logger.error("Error getting insight data", error);
|
|
461
|
-
let errorMessage = 'Unknown error occurred';
|
|
462
|
-
if (error instanceof Error) {
|
|
463
|
-
errorMessage = error.message;
|
|
464
|
-
}
|
|
465
|
-
else if (typeof error === 'object' && error !== null) {
|
|
466
|
-
try {
|
|
467
|
-
errorMessage = JSON.stringify(error, null, 2);
|
|
468
|
-
}
|
|
469
|
-
catch {
|
|
470
|
-
errorMessage = String(error);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
errorMessage = String(error);
|
|
475
|
-
}
|
|
500
|
+
// Handle permission errors
|
|
501
|
+
if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
|
|
476
502
|
return {
|
|
477
503
|
content: [{
|
|
478
|
-
type:
|
|
479
|
-
text: `❌ **
|
|
504
|
+
type: 'text',
|
|
505
|
+
text: `❌ **Permission Denied**\n\nYou may not have permission to update this insight.\n\n**Error:** ${errorMessage}`,
|
|
480
506
|
}],
|
|
481
507
|
};
|
|
482
508
|
}
|
|
509
|
+
// Handle not found errors
|
|
510
|
+
if (errorMessage.includes('not found') || errorMessage.includes('NotFound')) {
|
|
511
|
+
return {
|
|
512
|
+
content: [{
|
|
513
|
+
type: 'text',
|
|
514
|
+
text: `❌ **Insight Not Found**\n\nInsight ID \`${insightId}\` does not exist.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Use \`list_insights\` to find valid insight IDs\n- Check for typos in the insight ID`,
|
|
515
|
+
}],
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
content: [{
|
|
520
|
+
type: 'text',
|
|
521
|
+
text: `❌ **Error updating insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Permission issues\n- Use \`list_insights\` to verify insight ID\n- Use \`run_insight\` (sources + query) to test query changes first`,
|
|
522
|
+
}],
|
|
523
|
+
};
|
|
483
524
|
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
// ============================================================================
|
|
488
|
-
const updateInsightDescription = `Update existing insight (name, query, sources, or visibility)`;
|
|
489
|
-
exports.updateInsightTool = {
|
|
490
|
-
name: 'update_insight',
|
|
525
|
+
}
|
|
526
|
+
exports.saveInsightTool = {
|
|
527
|
+
name: 'save_insight',
|
|
491
528
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
492
|
-
description:
|
|
529
|
+
description: saveInsightDescription,
|
|
493
530
|
schema: zod_1.z.object({
|
|
531
|
+
workspaceId: zod_1.z
|
|
532
|
+
.string()
|
|
533
|
+
.optional()
|
|
534
|
+
.describe('Optional workspace ID or name - defaults to current workspace (create mode only)'),
|
|
494
535
|
insightId: zod_1.z
|
|
495
536
|
.string()
|
|
496
|
-
.
|
|
537
|
+
.optional()
|
|
538
|
+
.describe('Existing insight ID to update (24 characters). Omit to create a new insight.'),
|
|
497
539
|
name: zod_1.z
|
|
498
540
|
.string()
|
|
541
|
+
.min(1)
|
|
499
542
|
.optional()
|
|
500
|
-
.describe(
|
|
543
|
+
.describe('Insight name (required when creating)'),
|
|
501
544
|
public: zod_1.z
|
|
502
545
|
.coerce.boolean()
|
|
503
546
|
.optional()
|
|
504
|
-
.describe(
|
|
547
|
+
.describe('Whether insight is publicly accessible (default: false on create)'),
|
|
505
548
|
sources: zod_1.z
|
|
506
|
-
.preprocess((val) => typeof val === 'string' ? JSON.parse(val) : val, zod_1.z.array(sourceSchema).optional())
|
|
507
|
-
.describe(
|
|
549
|
+
.preprocess((val) => typeof val === 'string' ? JSON.parse(val) : val, zod_1.z.array(sourceSchema).min(1).optional())
|
|
550
|
+
.describe('Workflow sources (required when creating). source.name = SQL table name, field.name = SQL column name. Never use IDs in the query.'),
|
|
508
551
|
query: zod_1.z
|
|
509
552
|
.string()
|
|
553
|
+
.min(1)
|
|
510
554
|
.optional()
|
|
511
|
-
.describe(
|
|
555
|
+
.describe('SQL query (SELECT, JOIN, WHERE, GROUP BY, ORDER BY, etc.) - required when creating'),
|
|
512
556
|
}),
|
|
513
557
|
async execute(args, context) {
|
|
514
|
-
logger.debug('
|
|
558
|
+
logger.debug('Saving insight', {
|
|
515
559
|
insightId: args.insightId,
|
|
516
560
|
hasName: !!args.name,
|
|
517
561
|
hasQuery: !!args.query,
|
|
518
562
|
hasSources: !!args.sources,
|
|
519
|
-
hasPublic: args.public
|
|
563
|
+
hasPublic: typeof args.public === 'boolean',
|
|
520
564
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
521
565
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const updateData = {};
|
|
525
|
-
if (args.name !== undefined) {
|
|
526
|
-
updateData.name = args.name;
|
|
527
|
-
}
|
|
528
|
-
if (args.public !== undefined) {
|
|
529
|
-
updateData.public = args.public;
|
|
530
|
-
}
|
|
531
|
-
if (args.sources !== undefined) {
|
|
532
|
-
updateData.sources = normalizeFields(args.sources);
|
|
533
|
-
}
|
|
534
|
-
if (args.query !== undefined) {
|
|
535
|
-
updateData.query = args.query;
|
|
536
|
-
}
|
|
537
|
-
// Validate at least one field is being updated
|
|
538
|
-
if (Object.keys(updateData).length === 0) {
|
|
539
|
-
return {
|
|
540
|
-
content: [{
|
|
541
|
-
type: "text",
|
|
542
|
-
text: `❌ **No updates provided**\n\nYou must provide at least one field to update:\n- name\n- public\n- sources\n- query\n\nExample:\n\`\`\`javascript\nupdate_insight({\n insightId: "${args.insightId}",\n name: "New Name"\n})\n\`\`\``,
|
|
543
|
-
}],
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
logger.debug('Calling v3.insight.update', {
|
|
547
|
-
insightId: args.insightId,
|
|
548
|
-
updateFields: Object.keys(updateData)
|
|
549
|
-
});
|
|
550
|
-
// Call v3.insight.update endpoint
|
|
551
|
-
// API expects: [insightId, updateData]
|
|
552
|
-
const result = await context.hailer.request('v3.insight.update', [
|
|
553
|
-
args.insightId,
|
|
554
|
-
updateData
|
|
555
|
-
]);
|
|
556
|
-
logger.debug('Insight update successful', {
|
|
557
|
-
insightId: args.insightId,
|
|
558
|
-
result: JSON.stringify(result)
|
|
559
|
-
});
|
|
560
|
-
// Build success response
|
|
561
|
-
let responseText = `✅ **Insight Updated Successfully**\n\n`;
|
|
562
|
-
responseText += `**Insight ID:** \`${args.insightId}\`\n`;
|
|
563
|
-
responseText += `**Updated Fields:**\n`;
|
|
564
|
-
if (args.name !== undefined) {
|
|
565
|
-
responseText += `- Name: ${args.name}\n`;
|
|
566
|
-
}
|
|
567
|
-
if (args.public !== undefined) {
|
|
568
|
-
responseText += `- Public: ${args.public ? 'Yes' : 'No'}\n`;
|
|
569
|
-
}
|
|
570
|
-
if (args.sources !== undefined) {
|
|
571
|
-
responseText += `- Sources: ${args.sources.length} workflow(s)\n`;
|
|
572
|
-
}
|
|
573
|
-
if (args.query !== undefined) {
|
|
574
|
-
responseText += `- Query: Updated\n`;
|
|
575
|
-
}
|
|
576
|
-
if (args.query) {
|
|
577
|
-
responseText += `\n**New SQL Query:**\n\`\`\`sql\n${args.query}\n\`\`\`\n`;
|
|
578
|
-
}
|
|
579
|
-
responseText += `\n💡 **Next Steps:**\n`;
|
|
580
|
-
responseText += `- Use \`get_insight_data\` with \`update: true\` to see fresh results\n`;
|
|
581
|
-
responseText += `- Use \`preview_insight\` to test if you made query changes\n`;
|
|
582
|
-
responseText += `- Use \`list_insights\` to see all insights\n`;
|
|
583
|
-
return {
|
|
584
|
-
content: [{
|
|
585
|
-
type: "text",
|
|
586
|
-
text: responseText,
|
|
587
|
-
}],
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
catch (error) {
|
|
591
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
592
|
-
logger.error("Error updating insight", error);
|
|
593
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
594
|
-
// Handle SQL syntax errors
|
|
595
|
-
if (errorMessage.toLowerCase().includes('sql') || errorMessage.toLowerCase().includes('syntax')) {
|
|
596
|
-
return {
|
|
597
|
-
content: [{
|
|
598
|
-
type: "text",
|
|
599
|
-
text: `❌ **SQL Query Error**\n\nThere's a problem with your SQL query.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check column names match field names in sources\n- Check table names match source names\n- Use \`preview_insight\` to test queries before updating\n- Make sure field IDs are correct (use \`get_workflow_schema\`)`,
|
|
600
|
-
}],
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
// Handle permission errors
|
|
604
|
-
if (errorMessage.includes('permission') || errorMessage.includes('PermissionDenied')) {
|
|
605
|
-
return {
|
|
606
|
-
content: [{
|
|
607
|
-
type: "text",
|
|
608
|
-
text: `❌ **Permission Denied**\n\nYou may not have permission to update this insight.\n\n**Error:** ${errorMessage}`,
|
|
609
|
-
}],
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
// Handle not found errors
|
|
613
|
-
if (errorMessage.includes('not found') || errorMessage.includes('NotFound')) {
|
|
614
|
-
return {
|
|
615
|
-
content: [{
|
|
616
|
-
type: "text",
|
|
617
|
-
text: `❌ **Insight Not Found**\n\nInsight ID \`${args.insightId}\` does not exist.\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Use \`list_insights\` to find valid insight IDs\n- Check for typos in the insight ID`,
|
|
618
|
-
}],
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
return {
|
|
622
|
-
content: [{
|
|
623
|
-
type: "text",
|
|
624
|
-
text: `❌ **Error updating insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- SQL query syntax errors\n- Invalid field IDs or workflow IDs\n- Permission issues\n- Use \`list_insights\` to verify insight ID\n- Use \`preview_insight\` to test query changes first`,
|
|
625
|
-
}],
|
|
626
|
-
};
|
|
566
|
+
if (args.insightId) {
|
|
567
|
+
return updateExistingInsight(args.insightId, args, context);
|
|
627
568
|
}
|
|
569
|
+
return createNewInsight(args, context);
|
|
628
570
|
}
|
|
629
571
|
};
|
|
630
572
|
// ============================================================================
|
|
@@ -638,15 +580,15 @@ exports.removeInsightTool = {
|
|
|
638
580
|
schema: zod_1.z.object({
|
|
639
581
|
insightId: zod_1.z
|
|
640
582
|
.string()
|
|
641
|
-
.describe(
|
|
583
|
+
.describe('Insight ID to remove (get from list_insights or save_insight)'),
|
|
642
584
|
confirmed: zod_1.z
|
|
643
585
|
.boolean()
|
|
644
586
|
.optional()
|
|
645
|
-
.describe(
|
|
587
|
+
.describe('First confirmation - must be true to proceed'),
|
|
646
588
|
secondConfirmed: zod_1.z
|
|
647
589
|
.boolean()
|
|
648
590
|
.optional()
|
|
649
|
-
.describe(
|
|
591
|
+
.describe('Second confirmation - must be true to proceed (required for double-check safety)'),
|
|
650
592
|
}),
|
|
651
593
|
async execute(args, context) {
|
|
652
594
|
logger.debug('Removing insight', {
|
|
@@ -664,7 +606,7 @@ exports.removeInsightTool = {
|
|
|
664
606
|
// Fetch insight info and workspace info
|
|
665
607
|
const [insightListResult, initData] = await Promise.all([
|
|
666
608
|
context.hailer.request('v3.insight.list', [workspaceId]),
|
|
667
|
-
context.hailer.request('v2.core.init', [[
|
|
609
|
+
context.hailer.request('v2.core.init', [['network']])
|
|
668
610
|
]);
|
|
669
611
|
const insights = Array.isArray(insightListResult) ? insightListResult : (insightListResult.details || insightListResult.insights || []);
|
|
670
612
|
const insight = insights.find((i) => i._id === args.insightId);
|
|
@@ -695,11 +637,11 @@ exports.removeInsightTool = {
|
|
|
695
637
|
warningText += `\`\`\`\n\n`;
|
|
696
638
|
warningText += `💡 **Before proceeding:**\n`;
|
|
697
639
|
warningText += `- Load \`remove-insight-skill\` to review safety checklist\n`;
|
|
698
|
-
warningText += `- Use \`
|
|
640
|
+
warningText += `- Use \`run_insight\` to verify before deleting\n`;
|
|
699
641
|
warningText += `- Verify with user that this is intentional`;
|
|
700
642
|
return {
|
|
701
643
|
content: [{
|
|
702
|
-
type:
|
|
644
|
+
type: 'text',
|
|
703
645
|
text: warningText,
|
|
704
646
|
}],
|
|
705
647
|
};
|
|
@@ -724,14 +666,15 @@ exports.removeInsightTool = {
|
|
|
724
666
|
responseText += `💡 Use \`list_insights\` to see remaining insights.`;
|
|
725
667
|
return {
|
|
726
668
|
content: [{
|
|
727
|
-
type:
|
|
669
|
+
type: 'text',
|
|
728
670
|
text: responseText,
|
|
729
671
|
}],
|
|
730
672
|
};
|
|
731
673
|
}
|
|
732
674
|
catch (error) {
|
|
733
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
734
|
-
logger.error(
|
|
675
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
676
|
+
logger.error('Error removing insight', error);
|
|
677
|
+
}
|
|
735
678
|
let errorMessage = 'Unknown error occurred';
|
|
736
679
|
if (error instanceof Error) {
|
|
737
680
|
errorMessage = error.message;
|
|
@@ -749,7 +692,7 @@ exports.removeInsightTool = {
|
|
|
749
692
|
}
|
|
750
693
|
return {
|
|
751
694
|
content: [{
|
|
752
|
-
type:
|
|
695
|
+
type: 'text',
|
|
753
696
|
text: `❌ **Error removing insight**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Insight ID not found\n- Permission denied\n- Insight already deleted\n- Use \`list_insights\` to verify insight ID`,
|
|
754
697
|
}],
|
|
755
698
|
};
|
|
@@ -765,7 +708,7 @@ exports.listInsightsTool = {
|
|
|
765
708
|
workspaceId: zod_1.z
|
|
766
709
|
.string()
|
|
767
710
|
.optional()
|
|
768
|
-
.describe(
|
|
711
|
+
.describe('Optional workspace ID or name - defaults to current workspace'),
|
|
769
712
|
}),
|
|
770
713
|
async execute(args, context) {
|
|
771
714
|
logger.debug('Listing insights', {
|
|
@@ -792,7 +735,7 @@ exports.listInsightsTool = {
|
|
|
792
735
|
let responseText = `📊 **Insights Found** (${insights.length || 0} total)\n\n`;
|
|
793
736
|
if (!insights || insights.length === 0) {
|
|
794
737
|
responseText += `No insights found in this workspace.\n\n`;
|
|
795
|
-
responseText += `💡 Use \`
|
|
738
|
+
responseText += `💡 Use \`save_insight\` to create a new SQL-like report.`;
|
|
796
739
|
}
|
|
797
740
|
else {
|
|
798
741
|
insights.forEach((insight, index) => {
|
|
@@ -807,20 +750,21 @@ exports.listInsightsTool = {
|
|
|
807
750
|
responseText += ` - Query: \`${insight.query?.substring(0, 80)}${(insight.query?.length || 0) > 80 ? '...' : ''}\`\n\n`;
|
|
808
751
|
});
|
|
809
752
|
responseText += `💡 **Next Steps:**\n`;
|
|
810
|
-
responseText += `- Use \`
|
|
811
|
-
responseText += `- Use \`
|
|
753
|
+
responseText += `- Use \`run_insight\` with an insightId to execute an insight\n`;
|
|
754
|
+
responseText += `- Use \`run_insight\` with sources + query to test changes\n`;
|
|
812
755
|
responseText += `- Use \`remove_insight\` to delete an insight\n`;
|
|
813
756
|
}
|
|
814
757
|
return {
|
|
815
758
|
content: [{
|
|
816
|
-
type:
|
|
759
|
+
type: 'text',
|
|
817
760
|
text: responseText,
|
|
818
761
|
}],
|
|
819
762
|
};
|
|
820
763
|
}
|
|
821
764
|
catch (error) {
|
|
822
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
823
|
-
logger.error(
|
|
765
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
766
|
+
logger.error('Error listing insights', error);
|
|
767
|
+
}
|
|
824
768
|
let errorMessage = 'Unknown error occurred';
|
|
825
769
|
if (error instanceof Error) {
|
|
826
770
|
errorMessage = error.message;
|
|
@@ -838,7 +782,7 @@ exports.listInsightsTool = {
|
|
|
838
782
|
}
|
|
839
783
|
return {
|
|
840
784
|
content: [{
|
|
841
|
-
type:
|
|
785
|
+
type: 'text',
|
|
842
786
|
text: `❌ **Error listing insights**\n\n**Error:** ${errorMessage}\n\n**Tips:**\n- Check workspace ID is valid\n- Verify you have permission to list insights`,
|
|
843
787
|
}],
|
|
844
788
|
};
|
|
@@ -847,11 +791,9 @@ exports.listInsightsTool = {
|
|
|
847
791
|
};
|
|
848
792
|
/** All insight tools */
|
|
849
793
|
exports.insightTools = [
|
|
850
|
-
exports.createInsightTool,
|
|
851
|
-
exports.previewInsightTool,
|
|
852
|
-
exports.getInsightDataTool,
|
|
853
|
-
exports.updateInsightTool,
|
|
854
|
-
exports.removeInsightTool,
|
|
855
794
|
exports.listInsightsTool,
|
|
795
|
+
exports.runInsightTool,
|
|
796
|
+
exports.saveInsightTool,
|
|
797
|
+
exports.removeInsightTool,
|
|
856
798
|
];
|
|
857
799
|
//# sourceMappingURL=insight.js.map
|