@hailer/mcp 1.2.1 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-hailer-helper.md +118 -0
- package/.claude/commands/debug-squad.md +13 -290
- package/.claude/commands/publish.md +2 -2
- package/.claude/commands/review-squad.md +17 -139
- package/.claude/skills/create-and-publish-app/SKILL.md +133 -143
- package/.claude/skills/hailer-app-builder/SKILL.md +29 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +141 -10
- package/dist/app-prep.d.ts +27 -0
- package/dist/app-prep.d.ts.map +1 -0
- package/dist/app-prep.js +94 -0
- package/dist/app-prep.js.map +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/bot/bot-manager.d.ts +9 -6
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +142 -31
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot.d.ts +61 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +927 -151
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/operation-logger.d.ts.map +1 -1
- package/dist/bot/operation-logger.js +24 -12
- package/dist/bot/operation-logger.js.map +1 -1
- package/dist/bot/services/bot-permissions.d.ts +37 -5
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +159 -35
- package/dist/bot/services/bot-permissions.js.map +1 -1
- package/dist/bot/services/conversation-manager.d.ts +23 -23
- package/dist/bot/services/conversation-manager.d.ts.map +1 -1
- package/dist/bot/services/conversation-manager.js +52 -49
- package/dist/bot/services/conversation-manager.js.map +1 -1
- package/dist/bot/services/helper-prompt.d.ts +8 -0
- package/dist/bot/services/helper-prompt.d.ts.map +1 -0
- package/dist/bot/services/helper-prompt.js +177 -0
- package/dist/bot/services/helper-prompt.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts +16 -16
- package/dist/bot/services/message-classifier.d.ts.map +1 -1
- package/dist/bot/services/message-classifier.js +55 -49
- package/dist/bot/services/message-classifier.js.map +1 -1
- package/dist/bot/services/message-formatter.d.ts +47 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +99 -80
- package/dist/bot/services/message-formatter.js.map +1 -1
- package/dist/bot/services/permission-guard.d.ts.map +1 -1
- package/dist/bot/services/permission-guard.js +20 -10
- package/dist/bot/services/permission-guard.js.map +1 -1
- package/dist/bot/services/signal-router.d.ts.map +1 -1
- package/dist/bot/services/signal-router.js +11 -6
- package/dist/bot/services/signal-router.js.map +1 -1
- package/dist/bot/services/system-prompt.d.ts +14 -0
- package/dist/bot/services/system-prompt.d.ts.map +1 -1
- package/dist/bot/services/system-prompt.js +181 -4
- package/dist/bot/services/system-prompt.js.map +1 -1
- package/dist/bot/services/token-billing.d.ts +23 -23
- package/dist/bot/services/token-billing.d.ts.map +1 -1
- package/dist/bot/services/token-billing.js +51 -36
- package/dist/bot/services/token-billing.js.map +1 -1
- package/dist/bot/services/types.d.ts +3 -1
- package/dist/bot/services/types.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.d.ts +8 -8
- package/dist/bot/services/typing-indicator.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.js +12 -10
- package/dist/bot/services/typing-indicator.js.map +1 -1
- package/dist/bot/services/workspace-refresh.d.ts +3 -3
- package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
- package/dist/bot/services/workspace-refresh.js +23 -13
- package/dist/bot/services/workspace-refresh.js.map +1 -1
- package/dist/bot/tool-executor.d.ts +10 -6
- package/dist/bot/tool-executor.d.ts.map +1 -1
- package/dist/bot/tool-executor.js +12 -6
- package/dist/bot/tool-executor.js.map +1 -1
- package/dist/bot/workspace-overview.d.ts.map +1 -1
- package/dist/bot/workspace-overview.js +6 -3
- package/dist/bot/workspace-overview.js.map +1 -1
- package/dist/bot-config/activity-error.d.ts +47 -0
- package/dist/bot-config/activity-error.d.ts.map +1 -0
- package/dist/bot-config/activity-error.js +67 -0
- package/dist/bot-config/activity-error.js.map +1 -0
- package/dist/bot-config/context.d.ts +4 -4
- package/dist/bot-config/context.d.ts.map +1 -1
- package/dist/bot-config/context.js +18 -14
- package/dist/bot-config/context.js.map +1 -1
- package/dist/bot-config/events.d.ts +45 -0
- package/dist/bot-config/events.d.ts.map +1 -0
- package/dist/bot-config/events.js +51 -0
- package/dist/bot-config/events.js.map +1 -0
- package/dist/bot-config/index.d.ts +3 -0
- package/dist/bot-config/index.d.ts.map +1 -1
- package/dist/bot-config/index.js +8 -1
- package/dist/bot-config/index.js.map +1 -1
- package/dist/bot-config/loader.d.ts +3 -0
- package/dist/bot-config/loader.d.ts.map +1 -1
- package/dist/bot-config/loader.js +45 -20
- package/dist/bot-config/loader.js.map +1 -1
- package/dist/bot-config/persistence.js.map +1 -1
- package/dist/bot-config/reconciler.d.ts +11 -0
- package/dist/bot-config/reconciler.d.ts.map +1 -0
- package/dist/bot-config/reconciler.js +121 -0
- package/dist/bot-config/reconciler.js.map +1 -0
- package/dist/bot-config/state.d.ts.map +1 -1
- package/dist/bot-config/state.js.map +1 -1
- package/dist/bot-config/types.d.ts +32 -0
- package/dist/bot-config/types.d.ts.map +1 -1
- package/dist/bot-config/webhooks.d.ts.map +1 -1
- package/dist/bot-config/webhooks.js.map +1 -1
- package/dist/bot-config/workflow-installer.d.ts +37 -0
- package/dist/bot-config/workflow-installer.d.ts.map +1 -0
- package/dist/bot-config/workflow-installer.js +346 -0
- package/dist/bot-config/workflow-installer.js.map +1 -0
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +92 -11
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -27
- package/dist/config.js.map +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -16
- package/dist/core.js.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +7 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/request-logger.d.ts +19 -19
- package/dist/lib/request-logger.d.ts.map +1 -1
- package/dist/lib/request-logger.js +19 -19
- package/dist/lib/request-logger.js.map +1 -1
- package/dist/mcp/UserContextCache.d.ts +28 -22
- package/dist/mcp/UserContextCache.d.ts.map +1 -1
- package/dist/mcp/UserContextCache.js +23 -23
- package/dist/mcp/UserContextCache.js.map +1 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/hailer-clients.d.ts +5 -4
- package/dist/mcp/hailer-clients.d.ts.map +1 -1
- package/dist/mcp/hailer-clients.js +83 -34
- package/dist/mcp/hailer-clients.js.map +1 -1
- package/dist/mcp/hailer-rpc.d.ts +40 -0
- package/dist/mcp/hailer-rpc.d.ts.map +1 -0
- package/dist/mcp/hailer-rpc.js +43 -0
- package/dist/mcp/hailer-rpc.js.map +1 -0
- package/dist/mcp/publish-auth-injector.d.ts +22 -0
- package/dist/mcp/publish-auth-injector.d.ts.map +1 -0
- package/dist/mcp/publish-auth-injector.js +100 -0
- package/dist/mcp/publish-auth-injector.js.map +1 -0
- package/dist/mcp/session-store.d.ts +16 -16
- package/dist/mcp/session-store.d.ts.map +1 -1
- package/dist/mcp/session-store.js +16 -16
- package/dist/mcp/session-store.js.map +1 -1
- package/dist/mcp/tool-profiles.d.ts +69 -0
- package/dist/mcp/tool-profiles.d.ts.map +1 -0
- package/dist/mcp/tool-profiles.js +184 -0
- package/dist/mcp/tool-profiles.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +16 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +91 -39
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/activity.d.ts +2 -0
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +575 -218
- package/dist/mcp/tools/activity.js.map +1 -1
- package/dist/mcp/tools/aliases.d.ts +11 -0
- package/dist/mcp/tools/aliases.d.ts.map +1 -0
- package/dist/mcp/tools/aliases.js +182 -0
- package/dist/mcp/tools/aliases.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts +6 -8
- package/dist/mcp/tools/app-core.d.ts.map +1 -1
- package/dist/mcp/tools/app-core.js +355 -254
- package/dist/mcp/tools/app-core.js.map +1 -1
- package/dist/mcp/tools/app-marketplace.d.ts +12 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +748 -856
- package/dist/mcp/tools/app-marketplace.js.map +1 -1
- package/dist/mcp/tools/app.d.ts +4 -7
- package/dist/mcp/tools/app.d.ts.map +1 -1
- package/dist/mcp/tools/app.js +4 -7
- package/dist/mcp/tools/app.js.map +1 -1
- package/dist/mcp/tools/bot-self.d.ts +21 -0
- package/dist/mcp/tools/bot-self.d.ts.map +1 -0
- package/dist/mcp/tools/bot-self.js +174 -0
- package/dist/mcp/tools/bot-self.js.map +1 -0
- package/dist/mcp/tools/calendar.d.ts +21 -0
- package/dist/mcp/tools/calendar.d.ts.map +1 -0
- package/dist/mcp/tools/calendar.js +741 -0
- package/dist/mcp/tools/calendar.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -1
- package/dist/mcp/tools/company.js +2 -1
- package/dist/mcp/tools/company.js.map +1 -1
- package/dist/mcp/tools/date.js.map +1 -1
- package/dist/mcp/tools/discussion.d.ts +29 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +419 -534
- package/dist/mcp/tools/discussion.js.map +1 -1
- package/dist/mcp/tools/file.d.ts.map +1 -1
- package/dist/mcp/tools/file.js +18 -16
- package/dist/mcp/tools/file.js.map +1 -1
- package/dist/mcp/tools/index.js +4 -4
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/insight.d.ts +24 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +513 -480
- package/dist/mcp/tools/insight.js.map +1 -1
- package/dist/mcp/tools/user.d.ts.map +1 -1
- package/dist/mcp/tools/user.js +15 -13
- package/dist/mcp/tools/user.js.map +1 -1
- package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
- package/dist/mcp/tools/workflow-permissions.js +88 -97
- package/dist/mcp/tools/workflow-permissions.js.map +1 -1
- package/dist/mcp/tools/workflow.d.ts +9 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +852 -860
- package/dist/mcp/tools/workflow.js.map +1 -1
- package/dist/mcp/utils/api-errors.d.ts.map +1 -1
- package/dist/mcp/utils/api-errors.js +2 -2
- package/dist/mcp/utils/api-errors.js.map +1 -1
- package/dist/mcp/utils/data-transformers.d.ts +0 -3
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +32 -5
- package/dist/mcp/utils/data-transformers.js.map +1 -1
- package/dist/mcp/utils/file-upload.d.ts.map +1 -1
- package/dist/mcp/utils/file-upload.js +1 -1
- package/dist/mcp/utils/file-upload.js.map +1 -1
- package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
- package/dist/mcp/utils/hailer-api-client.js +113 -103
- package/dist/mcp/utils/hailer-api-client.js.map +1 -1
- package/dist/mcp/utils/index.d.ts.map +1 -1
- package/dist/mcp/utils/index.js.map +1 -1
- package/dist/mcp/utils/logger.d.ts.map +1 -1
- package/dist/mcp/utils/logger.js.map +1 -1
- package/dist/mcp/utils/response-builder.d.ts.map +1 -1
- package/dist/mcp/utils/response-builder.js +8 -4
- package/dist/mcp/utils/response-builder.js.map +1 -1
- package/dist/mcp/utils/role-utils.d.ts.map +1 -1
- package/dist/mcp/utils/role-utils.js +6 -3
- package/dist/mcp/utils/role-utils.js.map +1 -1
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
- package/dist/mcp/utils/tool-helpers.js +2 -2
- package/dist/mcp/utils/tool-helpers.js.map +1 -1
- package/dist/mcp/utils/types.d.ts +2 -1
- package/dist/mcp/utils/types.d.ts.map +1 -1
- package/dist/mcp/utils/types.js.map +1 -1
- package/dist/mcp/webhook-handler.d.ts +43 -8
- package/dist/mcp/webhook-handler.d.ts.map +1 -1
- package/dist/mcp/webhook-handler.js +861 -116
- package/dist/mcp/webhook-handler.js.map +1 -1
- package/dist/mcp/workspace-admin-store.d.ts +49 -0
- package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
- package/dist/mcp/workspace-admin-store.js +168 -0
- package/dist/mcp/workspace-admin-store.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts +2 -2
- package/dist/mcp/workspace-cache.d.ts.map +1 -1
- package/dist/mcp/workspace-cache.js +9 -5
- package/dist/mcp/workspace-cache.js.map +1 -1
- package/dist/mcp-server.d.ts +26 -11
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +367 -48
- package/dist/mcp-server.js.map +1 -1
- package/dist/plugins/vipunen/client.d.ts +41 -41
- package/dist/plugins/vipunen/client.d.ts.map +1 -1
- package/dist/plugins/vipunen/client.js +53 -48
- package/dist/plugins/vipunen/client.js.map +1 -1
- package/dist/plugins/vipunen/index.js.map +1 -1
- package/dist/plugins/vipunen/tools.d.ts.map +1 -1
- package/dist/plugins/vipunen/tools.js +6 -3
- package/dist/plugins/vipunen/tools.js.map +1 -1
- package/dist/public-chat/graduate.d.ts +29 -0
- package/dist/public-chat/graduate.d.ts.map +1 -0
- package/dist/public-chat/graduate.js +593 -0
- package/dist/public-chat/graduate.js.map +1 -0
- package/dist/public-chat/handler.d.ts +12 -0
- package/dist/public-chat/handler.d.ts.map +1 -0
- package/dist/public-chat/handler.js +183 -0
- package/dist/public-chat/handler.js.map +1 -0
- package/dist/public-chat/index.d.ts +16 -0
- package/dist/public-chat/index.d.ts.map +1 -0
- package/dist/public-chat/index.js +74 -0
- package/dist/public-chat/index.js.map +1 -0
- package/dist/public-chat/knowledge.d.ts +3 -0
- package/dist/public-chat/knowledge.d.ts.map +1 -0
- package/dist/public-chat/knowledge.js +1340 -0
- package/dist/public-chat/knowledge.js.map +1 -0
- package/dist/public-chat/rate-limit.d.ts +16 -0
- package/dist/public-chat/rate-limit.d.ts.map +1 -0
- package/dist/public-chat/rate-limit.js +51 -0
- package/dist/public-chat/rate-limit.js.map +1 -0
- package/dist/public-chat/session-store.d.ts +41 -0
- package/dist/public-chat/session-store.d.ts.map +1 -0
- package/dist/public-chat/session-store.js +95 -0
- package/dist/public-chat/session-store.js.map +1 -0
- package/dist/public-chat/studio-prewarm.d.ts +61 -0
- package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
- package/dist/public-chat/studio-prewarm.js +162 -0
- package/dist/public-chat/studio-prewarm.js.map +1 -0
- package/dist/public-chat/system-prompt.d.ts +22 -0
- package/dist/public-chat/system-prompt.d.ts.map +1 -0
- package/dist/public-chat/system-prompt.js +435 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +13 -7
- package/scripts/build-public-chat-knowledge.py +101 -0
- package/scripts/smoke-public-chat-live.ts +148 -0
- package/scripts/smoke-public-chat.ts +110 -0
- package/.claude/CLAUDE.md +0 -126
- package/.claude/commands/app-squad.md +0 -131
- package/.claude/commands/audit-squad.md +0 -158
- package/.claude/commands/cleanup-squad.md +0 -98
- package/.claude/commands/config-squad.md +0 -106
- package/.claude/commands/crud-squad.md +0 -87
- package/.claude/commands/data-squad.md +0 -97
- package/.claude/commands/doc-squad.md +0 -65
- package/.claude/commands/help.md +0 -29
- package/.claude/commands/help:agents.md +0 -182
- package/.claude/commands/help:commands.md +0 -78
- package/.claude/commands/help:faq.md +0 -79
- package/.claude/commands/help:plugins.md +0 -50
- package/.claude/commands/help:skills.md +0 -87
- package/.claude/commands/help:tools.md +0 -75
- package/.claude/commands/hotfix-squad.md +0 -112
- package/.claude/commands/integration-squad.md +0 -82
- package/.claude/commands/janitor-squad.md +0 -167
- package/.claude/commands/onboard-squad.md +0 -130
- package/.claude/commands/swarm.md +0 -210
- package/.claude/commands/tool-builder.md +0 -39
- package/.claude/skills/publish-hailer-app/SKILL.md +0 -280
- package/dist/CLAUDE.md +0 -370
- package/dist/agents/bot-manager.d.ts +0 -48
- package/dist/agents/bot-manager.d.ts.map +0 -1
- package/dist/agents/bot-manager.js +0 -254
- package/dist/agents/bot-manager.js.map +0 -1
- package/dist/agents/bug-fixer/ai.d.ts +0 -80
- package/dist/agents/bug-fixer/ai.d.ts.map +0 -1
- package/dist/agents/bug-fixer/ai.js +0 -466
- package/dist/agents/bug-fixer/ai.js.map +0 -1
- package/dist/agents/bug-fixer/bot.d.ts +0 -92
- package/dist/agents/bug-fixer/bot.d.ts.map +0 -1
- package/dist/agents/bug-fixer/bot.js +0 -687
- package/dist/agents/bug-fixer/bot.js.map +0 -1
- package/dist/agents/bug-fixer/config.d.ts +0 -21
- package/dist/agents/bug-fixer/config.d.ts.map +0 -1
- package/dist/agents/bug-fixer/config.js +0 -218
- package/dist/agents/bug-fixer/config.js.map +0 -1
- package/dist/agents/bug-fixer/files.d.ts +0 -67
- package/dist/agents/bug-fixer/files.d.ts.map +0 -1
- package/dist/agents/bug-fixer/files.js +0 -386
- package/dist/agents/bug-fixer/files.js.map +0 -1
- package/dist/agents/bug-fixer/git.d.ts +0 -48
- package/dist/agents/bug-fixer/git.d.ts.map +0 -1
- package/dist/agents/bug-fixer/git.js +0 -298
- package/dist/agents/bug-fixer/git.js.map +0 -1
- package/dist/agents/bug-fixer/index.d.ts +0 -103
- package/dist/agents/bug-fixer/index.d.ts.map +0 -1
- package/dist/agents/bug-fixer/index.js +0 -262
- package/dist/agents/bug-fixer/index.js.map +0 -1
- package/dist/agents/bug-fixer/lsp.d.ts +0 -113
- package/dist/agents/bug-fixer/lsp.d.ts.map +0 -1
- package/dist/agents/bug-fixer/lsp.js +0 -485
- package/dist/agents/bug-fixer/lsp.js.map +0 -1
- package/dist/agents/bug-fixer/monitor.d.ts +0 -123
- package/dist/agents/bug-fixer/monitor.d.ts.map +0 -1
- package/dist/agents/bug-fixer/monitor.js +0 -629
- package/dist/agents/bug-fixer/monitor.js.map +0 -1
- package/dist/agents/bug-fixer/prompt.d.ts +0 -5
- package/dist/agents/bug-fixer/prompt.d.ts.map +0 -1
- package/dist/agents/bug-fixer/prompt.js +0 -94
- package/dist/agents/bug-fixer/prompt.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts +0 -28
- package/dist/agents/bug-fixer/registries/pending-classification.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-classification.js +0 -50
- package/dist/agents/bug-fixer/registries/pending-classification.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts +0 -33
- package/dist/agents/bug-fixer/registries/pending-fix.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending-fix.js +0 -64
- package/dist/agents/bug-fixer/registries/pending-fix.js.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.d.ts +0 -27
- package/dist/agents/bug-fixer/registries/pending.d.ts.map +0 -1
- package/dist/agents/bug-fixer/registries/pending.js +0 -49
- package/dist/agents/bug-fixer/registries/pending.js.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.d.ts +0 -88
- package/dist/agents/bug-fixer/specialist-daemon.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist-daemon.js +0 -431
- package/dist/agents/bug-fixer/specialist-daemon.js.map +0 -1
- package/dist/agents/bug-fixer/specialist.d.ts +0 -47
- package/dist/agents/bug-fixer/specialist.d.ts.map +0 -1
- package/dist/agents/bug-fixer/specialist.js +0 -327
- package/dist/agents/bug-fixer/specialist.js.map +0 -1
- package/dist/agents/bug-fixer/types.d.ts +0 -123
- package/dist/agents/bug-fixer/types.d.ts.map +0 -1
- package/dist/agents/bug-fixer/types.js +0 -9
- package/dist/agents/bug-fixer/types.js.map +0 -1
- package/dist/agents/factory.d.ts +0 -172
- package/dist/agents/factory.d.ts.map +0 -1
- package/dist/agents/factory.js +0 -706
- package/dist/agents/factory.js.map +0 -1
- package/dist/agents/hailer-expert/index.d.ts +0 -8
- package/dist/agents/hailer-expert/index.d.ts.map +0 -1
- package/dist/agents/hailer-expert/index.js +0 -14
- package/dist/agents/hailer-expert/index.js.map +0 -1
- package/dist/agents/hal/daemon.d.ts +0 -174
- package/dist/agents/hal/daemon.d.ts.map +0 -1
- package/dist/agents/hal/daemon.js +0 -1385
- package/dist/agents/hal/daemon.js.map +0 -1
- package/dist/agents/hal/definitions.d.ts +0 -42
- package/dist/agents/hal/definitions.d.ts.map +0 -1
- package/dist/agents/hal/definitions.js +0 -300
- package/dist/agents/hal/definitions.js.map +0 -1
- package/dist/agents/hal/index.d.ts +0 -3
- package/dist/agents/hal/index.d.ts.map +0 -1
- package/dist/agents/hal/index.js +0 -8
- package/dist/agents/hal/index.js.map +0 -1
- package/dist/agents/index.d.ts +0 -18
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -48
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/shared/base.d.ts +0 -253
- package/dist/agents/shared/base.d.ts.map +0 -1
- package/dist/agents/shared/base.js +0 -1122
- package/dist/agents/shared/base.js.map +0 -1
- package/dist/agents/shared/schemas/action-schema.d.ts +0 -62
- package/dist/agents/shared/schemas/action-schema.d.ts.map +0 -1
- package/dist/agents/shared/schemas/action-schema.js +0 -483
- package/dist/agents/shared/schemas/action-schema.js.map +0 -1
- package/dist/agents/shared/services/agent-registry.d.ts +0 -108
- package/dist/agents/shared/services/agent-registry.d.ts.map +0 -1
- package/dist/agents/shared/services/agent-registry.js +0 -469
- package/dist/agents/shared/services/agent-registry.js.map +0 -1
- package/dist/agents/shared/services/conversation-manager.d.ts +0 -57
- package/dist/agents/shared/services/conversation-manager.d.ts.map +0 -1
- package/dist/agents/shared/services/conversation-manager.js +0 -168
- package/dist/agents/shared/services/conversation-manager.js.map +0 -1
- package/dist/agents/shared/services/mcp-client.d.ts +0 -56
- package/dist/agents/shared/services/mcp-client.d.ts.map +0 -1
- package/dist/agents/shared/services/mcp-client.js +0 -124
- package/dist/agents/shared/services/mcp-client.js.map +0 -1
- package/dist/agents/shared/services/message-classifier.d.ts +0 -37
- package/dist/agents/shared/services/message-classifier.d.ts.map +0 -1
- package/dist/agents/shared/services/message-classifier.js +0 -203
- package/dist/agents/shared/services/message-classifier.js.map +0 -1
- package/dist/agents/shared/services/message-formatter.d.ts +0 -89
- package/dist/agents/shared/services/message-formatter.d.ts.map +0 -1
- package/dist/agents/shared/services/message-formatter.js +0 -390
- package/dist/agents/shared/services/message-formatter.js.map +0 -1
- package/dist/agents/shared/services/session-logger.d.ts +0 -162
- package/dist/agents/shared/services/session-logger.d.ts.map +0 -1
- package/dist/agents/shared/services/session-logger.js +0 -724
- package/dist/agents/shared/services/session-logger.js.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.d.ts +0 -88
- package/dist/agents/shared/services/structured-output-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/structured-output-executor.js +0 -296
- package/dist/agents/shared/services/structured-output-executor.js.map +0 -1
- package/dist/agents/shared/services/token-billing.d.ts +0 -72
- package/dist/agents/shared/services/token-billing.d.ts.map +0 -1
- package/dist/agents/shared/services/token-billing.js +0 -198
- package/dist/agents/shared/services/token-billing.js.map +0 -1
- package/dist/agents/shared/services/tool-executor.d.ts +0 -43
- package/dist/agents/shared/services/tool-executor.d.ts.map +0 -1
- package/dist/agents/shared/services/tool-executor.js +0 -175
- package/dist/agents/shared/services/tool-executor.js.map +0 -1
- package/dist/agents/shared/services/typing-indicator.d.ts +0 -24
- package/dist/agents/shared/services/typing-indicator.d.ts.map +0 -1
- package/dist/agents/shared/services/typing-indicator.js +0 -54
- package/dist/agents/shared/services/typing-indicator.js.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.d.ts +0 -122
- package/dist/agents/shared/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/agents/shared/services/workspace-schema-cache.js +0 -507
- package/dist/agents/shared/services/workspace-schema-cache.js.map +0 -1
- package/dist/agents/shared/specialist.d.ts +0 -91
- package/dist/agents/shared/specialist.d.ts.map +0 -1
- package/dist/agents/shared/specialist.js +0 -399
- package/dist/agents/shared/specialist.js.map +0 -1
- package/dist/agents/shared/tool-schema-loader.d.ts +0 -65
- package/dist/agents/shared/tool-schema-loader.d.ts.map +0 -1
- package/dist/agents/shared/tool-schema-loader.js +0 -238
- package/dist/agents/shared/tool-schema-loader.js.map +0 -1
- package/dist/agents/shared/types.d.ts +0 -190
- package/dist/agents/shared/types.d.ts.map +0 -1
- package/dist/agents/shared/types.js +0 -13
- package/dist/agents/shared/types.js.map +0 -1
- package/dist/bot/bot-config.d.ts +0 -37
- package/dist/bot/bot-config.d.ts.map +0 -1
- package/dist/bot/bot-config.js +0 -219
- package/dist/bot/bot-config.js.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.d.ts +0 -2
- package/dist/bot/services/__tests__/permission-guard.test.d.ts.map +0 -1
- package/dist/bot/services/__tests__/permission-guard.test.js +0 -357
- package/dist/bot/services/__tests__/permission-guard.test.js.map +0 -1
- package/dist/bot/services/session-logger.d.ts +0 -162
- package/dist/bot/services/session-logger.d.ts.map +0 -1
- package/dist/bot/services/session-logger.js +0 -724
- package/dist/bot/services/session-logger.js.map +0 -1
- package/dist/bot/services/workspace-schema-cache.d.ts +0 -122
- package/dist/bot/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/bot/services/workspace-schema-cache.js +0 -506
- package/dist/bot/services/workspace-schema-cache.js.map +0 -1
- package/dist/bot-config/tools.d.ts +0 -28
- package/dist/bot-config/tools.d.ts.map +0 -1
- package/dist/bot-config/tools.js +0 -279
- package/dist/bot-config/tools.js.map +0 -1
- package/dist/client/agents/base.d.ts +0 -207
- package/dist/client/agents/base.d.ts.map +0 -1
- package/dist/client/agents/base.js +0 -744
- package/dist/client/agents/base.js.map +0 -1
- package/dist/client/agents/definitions.d.ts +0 -53
- package/dist/client/agents/definitions.d.ts.map +0 -1
- package/dist/client/agents/definitions.js +0 -263
- package/dist/client/agents/definitions.js.map +0 -1
- package/dist/client/agents/orchestrator.d.ts +0 -141
- package/dist/client/agents/orchestrator.d.ts.map +0 -1
- package/dist/client/agents/orchestrator.js +0 -1062
- package/dist/client/agents/orchestrator.js.map +0 -1
- package/dist/client/agents/specialist.d.ts +0 -86
- package/dist/client/agents/specialist.d.ts.map +0 -1
- package/dist/client/agents/specialist.js +0 -340
- package/dist/client/agents/specialist.js.map +0 -1
- package/dist/client/bot-entrypoint.d.ts +0 -7
- package/dist/client/bot-entrypoint.d.ts.map +0 -1
- package/dist/client/bot-entrypoint.js +0 -103
- package/dist/client/bot-entrypoint.js.map +0 -1
- package/dist/client/bot-manager.d.ts +0 -44
- package/dist/client/bot-manager.d.ts.map +0 -1
- package/dist/client/bot-manager.js +0 -173
- package/dist/client/bot-manager.js.map +0 -1
- package/dist/client/bot-runner.d.ts +0 -35
- package/dist/client/bot-runner.d.ts.map +0 -1
- package/dist/client/bot-runner.js +0 -188
- package/dist/client/bot-runner.js.map +0 -1
- package/dist/client/chat-agent-daemon.d.ts +0 -464
- package/dist/client/chat-agent-daemon.d.ts.map +0 -1
- package/dist/client/chat-agent-daemon.js +0 -1774
- package/dist/client/chat-agent-daemon.js.map +0 -1
- package/dist/client/daemon-factory.d.ts +0 -106
- package/dist/client/daemon-factory.d.ts.map +0 -1
- package/dist/client/daemon-factory.js +0 -301
- package/dist/client/daemon-factory.js.map +0 -1
- package/dist/client/factory.d.ts +0 -111
- package/dist/client/factory.d.ts.map +0 -1
- package/dist/client/factory.js +0 -314
- package/dist/client/factory.js.map +0 -1
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -38
- package/dist/client/index.js.map +0 -1
- package/dist/client/multi-bot-manager.d.ts +0 -42
- package/dist/client/multi-bot-manager.d.ts.map +0 -1
- package/dist/client/multi-bot-manager.js +0 -161
- package/dist/client/multi-bot-manager.js.map +0 -1
- package/dist/client/orchestrator-daemon.d.ts +0 -87
- package/dist/client/orchestrator-daemon.d.ts.map +0 -1
- package/dist/client/orchestrator-daemon.js +0 -444
- package/dist/client/orchestrator-daemon.js.map +0 -1
- package/dist/client/server.d.ts +0 -8
- package/dist/client/server.d.ts.map +0 -1
- package/dist/client/server.js +0 -251
- package/dist/client/server.js.map +0 -1
- package/dist/client/services/agent-registry.d.ts +0 -108
- package/dist/client/services/agent-registry.d.ts.map +0 -1
- package/dist/client/services/agent-registry.js +0 -630
- package/dist/client/services/agent-registry.js.map +0 -1
- package/dist/client/services/conversation-manager.d.ts +0 -50
- package/dist/client/services/conversation-manager.d.ts.map +0 -1
- package/dist/client/services/conversation-manager.js +0 -136
- package/dist/client/services/conversation-manager.js.map +0 -1
- package/dist/client/services/mcp-client.d.ts +0 -48
- package/dist/client/services/mcp-client.d.ts.map +0 -1
- package/dist/client/services/mcp-client.js +0 -105
- package/dist/client/services/mcp-client.js.map +0 -1
- package/dist/client/services/message-classifier.d.ts +0 -37
- package/dist/client/services/message-classifier.d.ts.map +0 -1
- package/dist/client/services/message-classifier.js +0 -187
- package/dist/client/services/message-classifier.js.map +0 -1
- package/dist/client/services/message-formatter.d.ts +0 -84
- package/dist/client/services/message-formatter.d.ts.map +0 -1
- package/dist/client/services/message-formatter.js +0 -353
- package/dist/client/services/message-formatter.js.map +0 -1
- package/dist/client/services/session-logger.d.ts +0 -106
- package/dist/client/services/session-logger.d.ts.map +0 -1
- package/dist/client/services/session-logger.js +0 -446
- package/dist/client/services/session-logger.js.map +0 -1
- package/dist/client/services/tool-executor.d.ts +0 -41
- package/dist/client/services/tool-executor.d.ts.map +0 -1
- package/dist/client/services/tool-executor.js +0 -169
- package/dist/client/services/tool-executor.js.map +0 -1
- package/dist/client/services/workspace-schema-cache.d.ts +0 -149
- package/dist/client/services/workspace-schema-cache.d.ts.map +0 -1
- package/dist/client/services/workspace-schema-cache.js +0 -732
- package/dist/client/services/workspace-schema-cache.js.map +0 -1
- package/dist/client/specialist-daemon.d.ts +0 -77
- package/dist/client/specialist-daemon.d.ts.map +0 -1
- package/dist/client/specialist-daemon.js +0 -197
- package/dist/client/specialist-daemon.js.map +0 -1
- package/dist/client/specialists.d.ts +0 -53
- package/dist/client/specialists.d.ts.map +0 -1
- package/dist/client/specialists.js +0 -178
- package/dist/client/specialists.js.map +0 -1
- package/dist/client/tool-schema-loader.d.ts +0 -62
- package/dist/client/tool-schema-loader.d.ts.map +0 -1
- package/dist/client/tool-schema-loader.js +0 -232
- package/dist/client/tool-schema-loader.js.map +0 -1
- package/dist/client/types.d.ts +0 -327
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -121
- package/dist/client/types.js.map +0 -1
- package/dist/commands/seed-config.d.ts +0 -9
- package/dist/commands/seed-config.d.ts.map +0 -1
- package/dist/commands/seed-config.js +0 -377
- package/dist/commands/seed-config.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -11
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -320
- package/dist/commands/setup.js.map +0 -1
- package/dist/lib/discussion-lock.d.ts +0 -42
- package/dist/lib/discussion-lock.d.ts.map +0 -1
- package/dist/lib/discussion-lock.js +0 -110
- package/dist/lib/discussion-lock.js.map +0 -1
- package/dist/mcp/signal-handler.d.ts +0 -82
- package/dist/mcp/signal-handler.d.ts.map +0 -1
- package/dist/mcp/signal-handler.js +0 -406
- package/dist/mcp/signal-handler.js.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts +0 -2
- package/dist/mcp/tools/__tests__/discussion-forward.test.d.ts.map +0 -1
- package/dist/mcp/tools/__tests__/discussion-forward.test.js +0 -218
- package/dist/mcp/tools/__tests__/discussion-forward.test.js.map +0 -1
- package/dist/mcp/tools/app-member.d.ts +0 -14
- package/dist/mcp/tools/app-member.d.ts.map +0 -1
- package/dist/mcp/tools/app-member.js +0 -195
- package/dist/mcp/tools/app-member.js.map +0 -1
- package/dist/mcp/tools/app-scaffold.d.ts +0 -14
- package/dist/mcp/tools/app-scaffold.d.ts.map +0 -1
- package/dist/mcp/tools/app-scaffold.js +0 -581
- package/dist/mcp/tools/app-scaffold.js.map +0 -1
- package/dist/mcp/tools/bot-config/constants.d.ts +0 -23
- package/dist/mcp/tools/bot-config/constants.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/constants.js +0 -94
- package/dist/mcp/tools/bot-config/constants.js.map +0 -1
- package/dist/mcp/tools/bot-config/core.d.ts +0 -253
- package/dist/mcp/tools/bot-config/core.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/core.js +0 -2456
- package/dist/mcp/tools/bot-config/core.js.map +0 -1
- package/dist/mcp/tools/bot-config/index.d.ts +0 -10
- package/dist/mcp/tools/bot-config/index.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/index.js +0 -59
- package/dist/mcp/tools/bot-config/index.js.map +0 -1
- package/dist/mcp/tools/bot-config/tools.d.ts +0 -7
- package/dist/mcp/tools/bot-config/tools.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/tools.js +0 -15
- package/dist/mcp/tools/bot-config/tools.js.map +0 -1
- package/dist/mcp/tools/bot-config/types.d.ts +0 -50
- package/dist/mcp/tools/bot-config/types.d.ts.map +0 -1
- package/dist/mcp/tools/bot-config/types.js +0 -6
- package/dist/mcp/tools/bot-config/types.js.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.d.ts +0 -45
- package/dist/mcp/tools/bug-fixer-tools.d.ts.map +0 -1
- package/dist/mcp/tools/bug-fixer-tools.js +0 -1096
- package/dist/mcp/tools/bug-fixer-tools.js.map +0 -1
- package/dist/mcp/tools/document.d.ts +0 -11
- package/dist/mcp/tools/document.d.ts.map +0 -1
- package/dist/mcp/tools/document.js +0 -741
- package/dist/mcp/tools/document.js.map +0 -1
- package/dist/mcp/tools/investigate.d.ts +0 -9
- package/dist/mcp/tools/investigate.d.ts.map +0 -1
- package/dist/mcp/tools/investigate.js +0 -254
- package/dist/mcp/tools/investigate.js.map +0 -1
- package/dist/mcp/utils/pagination.d.ts +0 -40
- package/dist/mcp/utils/pagination.d.ts.map +0 -1
- package/dist/mcp/utils/pagination.js +0 -55
- package/dist/mcp/utils/pagination.js.map +0 -1
- package/dist/modules/bug-reports/bug-config.d.ts +0 -25
- package/dist/modules/bug-reports/bug-config.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-config.js +0 -187
- package/dist/modules/bug-reports/bug-config.js.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.d.ts +0 -108
- package/dist/modules/bug-reports/bug-monitor.d.ts.map +0 -1
- package/dist/modules/bug-reports/bug-monitor.js +0 -510
- package/dist/modules/bug-reports/bug-monitor.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.d.ts +0 -58
- package/dist/modules/bug-reports/giuseppe-agent.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-agent.js +0 -467
- package/dist/modules/bug-reports/giuseppe-agent.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.d.ts +0 -83
- package/dist/modules/bug-reports/giuseppe-ai.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-ai.js +0 -466
- package/dist/modules/bug-reports/giuseppe-ai.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.d.ts +0 -110
- package/dist/modules/bug-reports/giuseppe-bot.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-bot.js +0 -804
- package/dist/modules/bug-reports/giuseppe-bot.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts +0 -80
- package/dist/modules/bug-reports/giuseppe-daemon.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-daemon.js +0 -617
- package/dist/modules/bug-reports/giuseppe-daemon.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.d.ts +0 -64
- package/dist/modules/bug-reports/giuseppe-files.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-files.js +0 -375
- package/dist/modules/bug-reports/giuseppe-files.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.d.ts +0 -48
- package/dist/modules/bug-reports/giuseppe-git.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-git.js +0 -298
- package/dist/modules/bug-reports/giuseppe-git.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts +0 -113
- package/dist/modules/bug-reports/giuseppe-lsp.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-lsp.js +0 -485
- package/dist/modules/bug-reports/giuseppe-lsp.js.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts +0 -5
- package/dist/modules/bug-reports/giuseppe-prompt.d.ts.map +0 -1
- package/dist/modules/bug-reports/giuseppe-prompt.js +0 -94
- package/dist/modules/bug-reports/giuseppe-prompt.js.map +0 -1
- package/dist/modules/bug-reports/index.d.ts +0 -77
- package/dist/modules/bug-reports/index.d.ts.map +0 -1
- package/dist/modules/bug-reports/index.js +0 -215
- package/dist/modules/bug-reports/index.js.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.d.ts +0 -28
- package/dist/modules/bug-reports/pending-classification-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-classification-registry.js +0 -50
- package/dist/modules/bug-reports/pending-classification-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.d.ts +0 -30
- package/dist/modules/bug-reports/pending-fix-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-fix-registry.js +0 -42
- package/dist/modules/bug-reports/pending-fix-registry.js.map +0 -1
- package/dist/modules/bug-reports/pending-registry.d.ts +0 -27
- package/dist/modules/bug-reports/pending-registry.d.ts.map +0 -1
- package/dist/modules/bug-reports/pending-registry.js +0 -49
- package/dist/modules/bug-reports/pending-registry.js.map +0 -1
- package/dist/modules/bug-reports/types.d.ts +0 -123
- package/dist/modules/bug-reports/types.d.ts.map +0 -1
- package/dist/modules/bug-reports/types.js +0 -9
- package/dist/modules/bug-reports/types.js.map +0 -1
- package/dist/plugins/bug-fixer/index.d.ts +0 -2
- package/dist/plugins/bug-fixer/index.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/index.js +0 -18
- package/dist/plugins/bug-fixer/index.js.map +0 -1
- package/dist/plugins/bug-fixer/tools.d.ts +0 -45
- package/dist/plugins/bug-fixer/tools.d.ts.map +0 -1
- package/dist/plugins/bug-fixer/tools.js +0 -1096
- package/dist/plugins/bug-fixer/tools.js.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts +0 -10
- package/dist/plugins/vipunen/__tests__/tools.test.d.ts.map +0 -1
- package/dist/plugins/vipunen/__tests__/tools.test.js +0 -646
- package/dist/plugins/vipunen/__tests__/tools.test.js.map +0 -1
- package/dist/routes/agents.d.ts +0 -44
- package/dist/routes/agents.d.ts.map +0 -1
- package/dist/routes/agents.js +0 -311
- package/dist/routes/agents.js.map +0 -1
- package/dist/services/agent-credential-store.d.ts +0 -73
- package/dist/services/agent-credential-store.d.ts.map +0 -1
- package/dist/services/agent-credential-store.js +0 -212
- package/dist/services/agent-credential-store.js.map +0 -1
- package/dist/stdio-server.d.ts +0 -14
- package/dist/stdio-server.d.ts.map +0 -1
- package/dist/stdio-server.js +0 -101
- package/dist/stdio-server.js.map +0 -1
- package/dist/workspace/context.d.ts +0 -148
- package/dist/workspace/context.d.ts.map +0 -1
- package/dist/workspace/context.js +0 -339
- package/dist/workspace/context.js.map +0 -1
- package/dist/workspace/credentials.d.ts +0 -55
- package/dist/workspace/credentials.d.ts.map +0 -1
- package/dist/workspace/credentials.js +0 -239
- package/dist/workspace/credentials.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -21
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js +0 -45
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/loader.d.ts +0 -27
- package/dist/workspace/loader.d.ts.map +0 -1
- package/dist/workspace/loader.js +0 -222
- package/dist/workspace/loader.js.map +0 -1
- package/dist/workspace/schema.d.ts +0 -37
- package/dist/workspace/schema.d.ts.map +0 -1
- package/dist/workspace/schema.js +0 -192
- package/dist/workspace/schema.js.map +0 -1
|
@@ -1,234 +1,367 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* App Tools - Marketplace
|
|
3
|
+
* App Tools - Marketplace (v2 tool surface)
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* - Install marketplace apps
|
|
10
|
-
* - Get product info and manifests
|
|
5
|
+
* Three merged marketplace tools:
|
|
6
|
+
* - browse_marketplace: list products / product detail (+ manifest)
|
|
7
|
+
* - install_marketplace: install app or template products (type auto-detected)
|
|
8
|
+
* - publish_marketplace: publish/update app or template listings
|
|
11
9
|
*/
|
|
12
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.appMarketplaceTools = exports.
|
|
11
|
+
exports.appMarketplaceTools = exports.getMarketplacePricingTool = exports.removeMarketplaceProductTool = exports.setMarketplaceVisibilityTool = exports.getInstalledVersionTool = exports.publishMarketplaceTool = exports.installMarketplaceTool = exports.browseMarketplaceTool = void 0;
|
|
14
12
|
const zod_1 = require("zod");
|
|
15
13
|
const tool_registry_1 = require("../tool-registry");
|
|
16
14
|
const UserContextCache_1 = require("../UserContextCache");
|
|
17
15
|
const logger_1 = require("../../lib/logger");
|
|
18
16
|
const request_logger_1 = require("../../lib/request-logger");
|
|
19
17
|
const tool_helpers_1 = require("../utils/tool-helpers");
|
|
18
|
+
const workspace_admin_store_1 = require("../workspace-admin-store");
|
|
20
19
|
const logger = (0, logger_1.createLogger)({ component: 'app-marketplace' });
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.describe("If true, show only public marketplace templates. If false (default), show private/workspace templates."),
|
|
36
|
-
}),
|
|
37
|
-
async execute(args, context) {
|
|
38
|
-
const showPublic = args.publicOnly ?? false;
|
|
39
|
-
logger.debug('Listing marketplace templates', {
|
|
40
|
-
workspaceId: args.workspaceId,
|
|
41
|
-
publicOnly: showPublic,
|
|
42
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
43
|
-
});
|
|
44
|
-
try {
|
|
45
|
-
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
|
|
46
|
-
if (!workspaceId) {
|
|
47
|
-
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
48
|
-
}
|
|
49
|
-
logger.debug('Calling v3.product.list', { workspaceId, public: showPublic });
|
|
50
|
-
// v3.product.list endpoint with public flag
|
|
51
|
-
const result = await context.hailer.request('v3.product.list', [
|
|
52
|
-
{ cid: workspaceId, public: showPublic },
|
|
53
|
-
{} // pagination options
|
|
54
|
-
]);
|
|
55
|
-
logger.debug('Template list response', {
|
|
56
|
-
result: JSON.stringify(result)
|
|
57
|
-
});
|
|
58
|
-
const templateType = showPublic ? 'Public Marketplace' : 'Private/Workspace';
|
|
59
|
-
let responseText = `✅ **${templateType} Templates**\n\n`;
|
|
60
|
-
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
61
|
-
responseText += `**Filter:** ${showPublic ? 'Public only' : 'Private/workspace'}\n\n`;
|
|
62
|
-
// Handle response: {products: [], totalCount: 0}
|
|
63
|
-
const products = result?.products || [];
|
|
64
|
-
const totalCount = result?.totalCount || 0;
|
|
65
|
-
if (products.length === 0) {
|
|
66
|
-
responseText += `**No ${showPublic ? 'public' : 'private'} templates found.**\n\n`;
|
|
67
|
-
if (showPublic) {
|
|
68
|
-
responseText += `💡 Try \`list_templates()\` without \`publicOnly: true\` to see private workspace templates.\n`;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
responseText += `💡 Use \`create_template\` to create a new template.\n`;
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
content: [{
|
|
75
|
-
type: "text",
|
|
76
|
-
text: responseText,
|
|
77
|
-
}],
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
const templates = products;
|
|
81
|
-
responseText += `**Total Templates:** ${templates.length}\n\n`;
|
|
82
|
-
templates.forEach((template, index) => {
|
|
83
|
-
responseText += `### ${index + 1}. ${template.name || 'Unnamed Template'}\n`;
|
|
84
|
-
responseText += `- **ID:** \`${template._id || template.id || 'N/A'}\`\n`;
|
|
85
|
-
if (template.description) {
|
|
86
|
-
responseText += `- **Description:** ${template.description}\n`;
|
|
87
|
-
}
|
|
88
|
-
if (template.creator) {
|
|
89
|
-
responseText += `- **Creator:** ${template.creator}\n`;
|
|
90
|
-
}
|
|
91
|
-
if (template.version) {
|
|
92
|
-
responseText += `- **Version:** ${template.version}\n`;
|
|
93
|
-
}
|
|
94
|
-
if (template.icon) {
|
|
95
|
-
responseText += `- **Icon:** \`${template.icon}\`\n`;
|
|
96
|
-
}
|
|
97
|
-
if (template.images && template.images.length > 0) {
|
|
98
|
-
responseText += `- **Images:** ${template.images.map((img) => `\`${img}\``).join(', ')}\n`;
|
|
99
|
-
}
|
|
100
|
-
responseText += `\n`;
|
|
101
|
-
});
|
|
102
|
-
responseText += `💡 **Next Steps:**\n`;
|
|
103
|
-
responseText += `- Use \`install_template\` to install a template\n`;
|
|
104
|
-
responseText += `- Use \`get_template\` to see template details`;
|
|
105
|
-
return {
|
|
106
|
-
content: [{
|
|
107
|
-
type: "text",
|
|
108
|
-
text: responseText,
|
|
109
|
-
}],
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
114
|
-
logger.error("Error listing templates", error);
|
|
115
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
116
|
-
return {
|
|
117
|
-
content: [{
|
|
118
|
-
type: "text",
|
|
119
|
-
text: `❌ **Error listing templates**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- API endpoint not available\n- Permission issues`,
|
|
120
|
-
}],
|
|
121
|
-
};
|
|
20
|
+
function textResponse(text) {
|
|
21
|
+
return {
|
|
22
|
+
content: [{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text,
|
|
25
|
+
}],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async function fetchProductDetail(productId, context) {
|
|
29
|
+
try {
|
|
30
|
+
logger.debug('Calling v3.app.product.get', { productId });
|
|
31
|
+
const result = await context.hailer.request('v3.app.product.get', [productId]);
|
|
32
|
+
if (result) {
|
|
33
|
+
return { product: result, source: 'v3' };
|
|
122
34
|
}
|
|
123
35
|
}
|
|
124
|
-
|
|
36
|
+
catch (v3Error) {
|
|
37
|
+
logger.debug('v3 product get failed, falling back to v2 template lookup', {
|
|
38
|
+
productId,
|
|
39
|
+
error: v3Error instanceof Error ? v3Error.message : String(v3Error)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
logger.debug('Calling v2.network.product.get', { productId });
|
|
43
|
+
const legacyResult = await context.hailer.request('v2.network.product.get', [productId]);
|
|
44
|
+
return { product: legacyResult?.product || legacyResult, source: 'v2' };
|
|
45
|
+
}
|
|
46
|
+
async function fetchProductManifest(productId, source, context) {
|
|
47
|
+
if (source === 'v3') {
|
|
48
|
+
logger.debug('Calling v3.app.product.getManifest', { productId });
|
|
49
|
+
return context.hailer.request('v3.app.product.getManifest', [productId]);
|
|
50
|
+
}
|
|
51
|
+
logger.debug('Calling v2.network.product.getManifest', { productId });
|
|
52
|
+
return context.hailer.request('v2.network.product.getManifest', [productId]);
|
|
53
|
+
}
|
|
54
|
+
function resolveProductType(source, product) {
|
|
55
|
+
if (source === 'v2') {
|
|
56
|
+
return 'template';
|
|
57
|
+
}
|
|
58
|
+
if (product?.type === 'template') {
|
|
59
|
+
return 'template';
|
|
60
|
+
}
|
|
61
|
+
return 'app';
|
|
62
|
+
}
|
|
125
63
|
// ============================================================================
|
|
126
|
-
//
|
|
64
|
+
// BROWSE MARKETPLACE — list products / product detail (+ manifest)
|
|
127
65
|
// ============================================================================
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
66
|
+
const browseMarketplaceDescription = `Browse the Hailer marketplace. Marketplace products come in two types — apps (installable web-apps) and ` +
|
|
67
|
+
`templates (packaged workspace configurations: workflows, phases, fields) — both distributed via the ` +
|
|
68
|
+
`marketplace.\n\n` +
|
|
69
|
+
`Without productId: lists products. publicOnly: true shows the public marketplace; default shows ` +
|
|
70
|
+
`private/workspace products. With productId: full details for one product (legacy v2 template IDs are ` +
|
|
71
|
+
`resolved via automatic fallback). Set includeManifest: true to also fetch the product manifest — its ` +
|
|
72
|
+
`versions and contained workflows — which you need before installing a specific version or ` +
|
|
73
|
+
`editing/publishing a new one.`;
|
|
74
|
+
const browseMarketplaceSchema = zod_1.z.object({
|
|
75
|
+
productId: zod_1.z
|
|
76
|
+
.string()
|
|
77
|
+
.min(1)
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('Product ID for a detail view. Omit to list products.'),
|
|
80
|
+
includeManifest: zod_1.z
|
|
81
|
+
.boolean()
|
|
82
|
+
.optional()
|
|
83
|
+
.default(false)
|
|
84
|
+
.describe('Detail view only: also fetch the product manifest (versions + contained workflows)'),
|
|
85
|
+
publicOnly: zod_1.z
|
|
86
|
+
.boolean()
|
|
87
|
+
.optional()
|
|
88
|
+
.default(false)
|
|
89
|
+
.describe('List view only: true = public marketplace products, false (default) = private/workspace products'),
|
|
90
|
+
workspaceId: zod_1.z
|
|
91
|
+
.string()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('Optional workspace ID - defaults to current workspace'),
|
|
94
|
+
});
|
|
95
|
+
async function executeListProducts(args, context) {
|
|
96
|
+
const showPublic = args.publicOnly ?? false;
|
|
97
|
+
logger.debug('Listing marketplace products', {
|
|
98
|
+
workspaceId: args.workspaceId,
|
|
99
|
+
publicOnly: showPublic,
|
|
100
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
101
|
+
});
|
|
102
|
+
try {
|
|
103
|
+
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
|
|
104
|
+
if (!workspaceId) {
|
|
105
|
+
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
106
|
+
}
|
|
107
|
+
logger.debug('Calling v3.product.list', { workspaceId, public: showPublic });
|
|
108
|
+
// v3.product.list endpoint with public flag
|
|
109
|
+
const result = await context.hailer.request('v3.product.list', [
|
|
110
|
+
{ cid: workspaceId, public: showPublic },
|
|
111
|
+
{} // pagination options
|
|
112
|
+
]);
|
|
113
|
+
logger.debug('Product list response', {
|
|
114
|
+
result: JSON.stringify(result)
|
|
152
115
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
116
|
+
const listingType = showPublic ? 'Public Marketplace' : 'Private/Workspace';
|
|
117
|
+
let responseText = `✅ **${listingType} Products**\n\n`;
|
|
118
|
+
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
119
|
+
responseText += `**Filter:** ${showPublic ? 'Public only' : 'Private/workspace'}\n\n`;
|
|
120
|
+
// Handle response: {products: [], totalCount: 0}
|
|
121
|
+
const products = result?.products || [];
|
|
122
|
+
if (products.length === 0) {
|
|
123
|
+
responseText += `**No ${showPublic ? 'public' : 'private'} products found.**\n\n`;
|
|
124
|
+
responseText += showPublic
|
|
125
|
+
? `💡 Try \`browse_marketplace()\` without \`publicOnly: true\` to see private workspace products.\n`
|
|
126
|
+
: `💡 Use \`publish_marketplace\` to publish an app or template.\n`;
|
|
127
|
+
return textResponse(responseText);
|
|
128
|
+
}
|
|
129
|
+
responseText += `**Total Products:** ${products.length}\n\n`;
|
|
130
|
+
products.forEach((product, index) => {
|
|
131
|
+
responseText += `### ${index + 1}. ${product.name || 'Unnamed Product'}\n`;
|
|
132
|
+
responseText += `- **ID:** \`${product._id || product.id || 'N/A'}\`\n`;
|
|
133
|
+
if (product.type) {
|
|
134
|
+
responseText += `- **Type:** ${product.type}\n`;
|
|
157
135
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
name: args.name
|
|
161
|
-
};
|
|
162
|
-
logger.debug('Calling v2.network.product.create', {
|
|
163
|
-
workspaceId,
|
|
164
|
-
templateData
|
|
165
|
-
});
|
|
166
|
-
const result = await context.hailer.request('v2.network.product.create', [templateData]);
|
|
167
|
-
logger.debug('Template creation response', {
|
|
168
|
-
result: JSON.stringify(result)
|
|
169
|
-
});
|
|
170
|
-
const templateId = result?.productId || result?._id || result?.id;
|
|
171
|
-
let responseText = `✅ **Template Created Successfully**\n\n`;
|
|
172
|
-
responseText += `**Template Name:** ${args.name}\n`;
|
|
173
|
-
responseText += `**Template ID:** \`${templateId || 'See response'}\`\n`;
|
|
174
|
-
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
175
|
-
responseText += `\n💡 **Next Steps:**\n`;
|
|
176
|
-
responseText += `- Use Hailer marketplace UI to add workflows and description\n`;
|
|
177
|
-
responseText += `- Share the template ID with others to install\n`;
|
|
178
|
-
if (args.description || args.workflowId) {
|
|
179
|
-
responseText += `\n⚠️ **Note:** The \`v3.app.product.create\` API only accepts \`name\`.\n`;
|
|
180
|
-
responseText += `Description and workflow attachment must be done via Hailer UI.\n`;
|
|
136
|
+
if (product.description) {
|
|
137
|
+
responseText += `- **Description:** ${product.description}\n`;
|
|
181
138
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
type: "text",
|
|
185
|
-
text: responseText,
|
|
186
|
-
}],
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
191
|
-
logger.error("Error creating template", error);
|
|
192
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
193
|
-
if (errorMessage.toLowerCase().includes('permission')) {
|
|
194
|
-
return {
|
|
195
|
-
content: [{
|
|
196
|
-
type: "text",
|
|
197
|
-
text: `❌ **Permission Denied**\n\nYou don't have permission to create templates. Only workspace administrators can create templates.\n\n**Error:** ${errorMessage}`,
|
|
198
|
-
}],
|
|
199
|
-
};
|
|
139
|
+
if (product.creator) {
|
|
140
|
+
responseText += `- **Creator:** ${product.creator}\n`;
|
|
200
141
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
142
|
+
if (product.version) {
|
|
143
|
+
responseText += `- **Version:** ${product.version}\n`;
|
|
144
|
+
}
|
|
145
|
+
if (product.icon) {
|
|
146
|
+
responseText += `- **Icon:** \`${product.icon}\`\n`;
|
|
147
|
+
}
|
|
148
|
+
if (product.images && product.images.length > 0) {
|
|
149
|
+
responseText += `- **Images:** ${product.images.map((img) => `\`${img}\``).join(', ')}\n`;
|
|
150
|
+
}
|
|
151
|
+
responseText += `\n`;
|
|
152
|
+
});
|
|
153
|
+
responseText += `💡 **Next Steps:**\n`;
|
|
154
|
+
responseText += `- Use \`browse_marketplace({ productId })\` to see product details\n`;
|
|
155
|
+
responseText += `- Use \`install_marketplace({ productId })\` to install a product`;
|
|
156
|
+
return textResponse(responseText);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
160
|
+
logger.error('Error listing marketplace products', error);
|
|
161
|
+
}
|
|
162
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
163
|
+
return textResponse(`❌ **Error listing marketplace products**\n\n**Error:** ${errorMessage}\n\n` +
|
|
164
|
+
`**Common Issues:**\n- API endpoint not available\n- Permission issues`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function buildManifestSection(productId, source, context) {
|
|
168
|
+
try {
|
|
169
|
+
const manifest = await fetchProductManifest(productId, source, context);
|
|
170
|
+
logger.debug('Product manifest response', { manifest: JSON.stringify(manifest) });
|
|
171
|
+
if (!manifest) {
|
|
172
|
+
return '';
|
|
173
|
+
}
|
|
174
|
+
return `\n**Manifest:**\n\`\`\`json\n${JSON.stringify(manifest, null, 2)}\n\`\`\`\n`;
|
|
175
|
+
}
|
|
176
|
+
catch (manifestError) {
|
|
177
|
+
logger.debug('Could not fetch manifest', { error: manifestError });
|
|
178
|
+
return `\n⚠️ Manifest could not be fetched for this product.\n`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function checkTemplateInstalled(productId, context) {
|
|
182
|
+
if (!context.workspaceCache) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
const workspaceId = context.workspaceCache.currentWorkspace._id;
|
|
187
|
+
const installed = await context.hailer.request('v2.network.product.isProductInstalled', [
|
|
188
|
+
productId,
|
|
189
|
+
workspaceId
|
|
190
|
+
]);
|
|
191
|
+
logger.debug('Template installation check', { installed: JSON.stringify(installed) });
|
|
192
|
+
return installed || null;
|
|
193
|
+
}
|
|
194
|
+
catch (installCheckError) {
|
|
195
|
+
logger.debug('Could not check installation status', { error: installCheckError });
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function buildInstalledSection(installedInfo) {
|
|
200
|
+
if (!installedInfo) {
|
|
201
|
+
return '';
|
|
202
|
+
}
|
|
203
|
+
if (!installedInfo.installed) {
|
|
204
|
+
return `\n⚪ **Status:** Not installed in current workspace\n`;
|
|
205
|
+
}
|
|
206
|
+
if (installedInfo.appId) {
|
|
207
|
+
return `\n✅ **Status:** Installed in current workspace\n**App ID:** \`${installedInfo.appId}\`\n`;
|
|
208
|
+
}
|
|
209
|
+
return `\n✅ **Status:** Installed in current workspace\n`;
|
|
210
|
+
}
|
|
211
|
+
async function executeProductDetail(args, context) {
|
|
212
|
+
const productId = args.productId;
|
|
213
|
+
logger.debug('Getting marketplace product details', {
|
|
214
|
+
productId,
|
|
215
|
+
includeManifest: args.includeManifest,
|
|
216
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
217
|
+
});
|
|
218
|
+
try {
|
|
219
|
+
const detail = await fetchProductDetail(productId, context);
|
|
220
|
+
const product = detail.product;
|
|
221
|
+
logger.debug('Product detail response', {
|
|
222
|
+
source: detail.source,
|
|
223
|
+
result: JSON.stringify(product)
|
|
224
|
+
});
|
|
225
|
+
let responseText = `✅ **Product Details**\n\n`;
|
|
226
|
+
responseText += `**Product ID:** \`${productId}\`\n`;
|
|
227
|
+
if (product?.name) {
|
|
228
|
+
responseText += `**Name:** ${product.name}\n`;
|
|
229
|
+
}
|
|
230
|
+
if (product?.description) {
|
|
231
|
+
responseText += `**Description:** ${product.description}\n`;
|
|
232
|
+
}
|
|
233
|
+
if (product?.type) {
|
|
234
|
+
responseText += `**Type:** ${product.type}\n`;
|
|
235
|
+
}
|
|
236
|
+
if (product?.version) {
|
|
237
|
+
responseText += `**Version:** ${product.version}\n`;
|
|
207
238
|
}
|
|
239
|
+
if (product?.versions?.length) {
|
|
240
|
+
responseText += `**Versions:** ${product.versions.length}\n`;
|
|
241
|
+
}
|
|
242
|
+
if (detail.source === 'v2') {
|
|
243
|
+
responseText += `**Source:** Legacy template (v2)\n`;
|
|
244
|
+
}
|
|
245
|
+
if (args.includeManifest) {
|
|
246
|
+
responseText += await buildManifestSection(productId, detail.source, context);
|
|
247
|
+
}
|
|
248
|
+
if (detail.source === 'v2') {
|
|
249
|
+
responseText += buildInstalledSection(await checkTemplateInstalled(productId, context));
|
|
250
|
+
}
|
|
251
|
+
responseText += `\n💡 **Next Steps:**\n`;
|
|
252
|
+
responseText += `- Use \`install_marketplace({ productId: "${productId}" })\` to install this product\n`;
|
|
253
|
+
responseText += `- Use \`browse_marketplace()\` to see other products`;
|
|
254
|
+
return textResponse(responseText);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
258
|
+
logger.error('Error getting marketplace product', error);
|
|
259
|
+
}
|
|
260
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
261
|
+
if (errorMessage.toLowerCase().includes('not found')) {
|
|
262
|
+
return textResponse(`❌ **Product Not Found**\n\nProduct ID \`${productId}\` not found in marketplace.\n\n` +
|
|
263
|
+
`**Check:**\n- Product ID is correct\n- Product exists and is published\n\n` +
|
|
264
|
+
`💡 Use \`browse_marketplace()\` to see available products.`);
|
|
265
|
+
}
|
|
266
|
+
return textResponse(`❌ **Error getting product**\n\n**Error:** ${errorMessage}\n\n` +
|
|
267
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.browseMarketplaceTool = {
|
|
271
|
+
name: 'browse_marketplace',
|
|
272
|
+
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
273
|
+
description: browseMarketplaceDescription,
|
|
274
|
+
schema: browseMarketplaceSchema,
|
|
275
|
+
async execute(args, context) {
|
|
276
|
+
if (!args.productId) {
|
|
277
|
+
return executeListProducts(args, context);
|
|
278
|
+
}
|
|
279
|
+
return executeProductDetail(args, context);
|
|
208
280
|
}
|
|
209
281
|
};
|
|
210
282
|
// ============================================================================
|
|
211
|
-
// INSTALL
|
|
283
|
+
// INSTALL MARKETPLACE — install app or template products
|
|
212
284
|
// ============================================================================
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
285
|
+
const installMarketplaceDescription = `Install a marketplace product into a workspace. Handles both product types automatically: apps are installed ` +
|
|
286
|
+
`via the v3 app install; templates (packaged workflows) via the v2 template install, which adds the ` +
|
|
287
|
+
`template's workflows to the workspace. The product type is detected from the marketplace entry — legacy v2 ` +
|
|
288
|
+
`template IDs route to the template path. Already-installed products are reported instead of reinstalled.`;
|
|
289
|
+
async function persistInstallAdminCredentials(productId, workspaceId, context) {
|
|
290
|
+
try {
|
|
291
|
+
const identity = await (0, workspace_admin_store_1.resolveAdminIdentity)(context.hailer.getClient());
|
|
292
|
+
// Only persist the admin key for a verified admin — an unverified
|
|
293
|
+
// admin's key triggers the bot-invite doom loop downstream.
|
|
294
|
+
if (!identity.emailVerified) {
|
|
295
|
+
logger.warn('Marketplace install: admin email not verified — not persisting admin credentials', {
|
|
296
|
+
workspaceId,
|
|
297
|
+
adminUid: identity.uid
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
(0, workspace_admin_store_1.persistAdminCredentials)(workspaceId, context.apiKey, identity);
|
|
302
|
+
}
|
|
303
|
+
catch (persistError) {
|
|
304
|
+
// Install already succeeded — surface the failure with enough context to trace
|
|
305
|
+
// popup-auth breakage back to this install instead of swallowing it.
|
|
306
|
+
logger.warn('Marketplace install: failed to persist admin credentials — popup auth may need admin re-authorization', {
|
|
307
|
+
workspaceId,
|
|
308
|
+
productId,
|
|
309
|
+
error: persistError instanceof Error ? persistError.message : String(persistError)
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
async function findExistingInstall(productId, workspaceId, context) {
|
|
314
|
+
logger.debug('Checking if product is already installed', { productId, workspaceId });
|
|
315
|
+
try {
|
|
316
|
+
const isInstalledResult = await context.hailer.request('v3.app.product.isProductInstalled', [
|
|
317
|
+
productId,
|
|
318
|
+
workspaceId
|
|
319
|
+
]);
|
|
320
|
+
return isInstalledResult || null;
|
|
321
|
+
}
|
|
322
|
+
catch (checkError) {
|
|
323
|
+
// Ignore check errors and proceed with installation
|
|
324
|
+
logger.debug('Could not check installation status, proceeding', {
|
|
325
|
+
error: checkError instanceof Error ? checkError.message : String(checkError)
|
|
326
|
+
});
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async function installTemplateProduct(productId, workspaceId, context) {
|
|
331
|
+
logger.debug('Calling v2.network.product.install', { productId, workspaceId });
|
|
332
|
+
const result = await context.hailer.request('v2.network.product.install', [productId, workspaceId]);
|
|
333
|
+
logger.debug('Template installation response', { result: JSON.stringify(result) });
|
|
334
|
+
// Invalidate user context cache so subsequent workflow listings get fresh data
|
|
335
|
+
UserContextCache_1.UserContextCache.clearContext(context.apiKey);
|
|
336
|
+
logger.debug('Cleared user context cache after template install', {
|
|
337
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
338
|
+
});
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
async function installAppProduct(productId, workspaceId, context) {
|
|
342
|
+
logger.debug('Calling v3.app.product.install', { productId, workspaceId });
|
|
343
|
+
const installResult = await context.hailer.request('v3.app.product.install', [productId, workspaceId]);
|
|
344
|
+
logger.debug('Install result', { result: JSON.stringify(installResult) });
|
|
345
|
+
await persistInstallAdminCredentials(productId, workspaceId, context);
|
|
346
|
+
return installResult;
|
|
347
|
+
}
|
|
348
|
+
exports.installMarketplaceTool = {
|
|
349
|
+
name: 'install_marketplace',
|
|
216
350
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
217
|
-
description:
|
|
351
|
+
description: installMarketplaceDescription,
|
|
218
352
|
schema: zod_1.z.object({
|
|
219
|
-
|
|
353
|
+
productId: zod_1.z
|
|
220
354
|
.string()
|
|
221
355
|
.min(1)
|
|
222
|
-
.describe(
|
|
356
|
+
.describe('Marketplace product ID to install'),
|
|
223
357
|
workspaceId: zod_1.z
|
|
224
358
|
.string()
|
|
225
359
|
.optional()
|
|
226
|
-
.describe(
|
|
360
|
+
.describe('Target workspace ID (defaults to current)'),
|
|
227
361
|
}),
|
|
228
362
|
async execute(args, context) {
|
|
229
|
-
logger.debug('Installing marketplace
|
|
230
|
-
|
|
231
|
-
workspaceId: args.workspaceId,
|
|
363
|
+
logger.debug('Installing marketplace product', {
|
|
364
|
+
productId: args.productId,
|
|
232
365
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
233
366
|
});
|
|
234
367
|
try {
|
|
@@ -236,242 +369,205 @@ exports.installTemplateTool = {
|
|
|
236
369
|
if (!workspaceId) {
|
|
237
370
|
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
238
371
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
args.templateId,
|
|
245
|
-
workspaceId
|
|
246
|
-
]);
|
|
247
|
-
logger.debug('Template installation response', {
|
|
248
|
-
result: JSON.stringify(result)
|
|
249
|
-
});
|
|
250
|
-
// Invalidate user context cache so subsequent list_workflows calls get fresh data
|
|
251
|
-
UserContextCache_1.UserContextCache.clearContext(context.apiKey);
|
|
252
|
-
logger.debug('Cleared user context cache after template install', {
|
|
253
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
254
|
-
});
|
|
255
|
-
const appId = result?.appId || result?._id;
|
|
256
|
-
let responseText = `✅ **Template Installed Successfully**\n\n`;
|
|
257
|
-
responseText += `**Template ID:** \`${args.templateId}\`\n`;
|
|
258
|
-
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
259
|
-
if (appId) {
|
|
260
|
-
responseText += `**App ID:** \`${appId}\`\n`;
|
|
261
|
-
}
|
|
262
|
-
responseText += `\n💡 **Next Steps:**\n`;
|
|
263
|
-
responseText += `- Use \`list_workflows\` to see new workflow(s)\n`;
|
|
264
|
-
responseText += `- Use \`list_apps\` to see new app(s)\n`;
|
|
265
|
-
return {
|
|
266
|
-
content: [{
|
|
267
|
-
type: "text",
|
|
268
|
-
text: responseText,
|
|
269
|
-
}],
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
274
|
-
logger.error("Error installing template", error);
|
|
275
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
276
|
-
if (errorMessage.toLowerCase().includes('not found')) {
|
|
277
|
-
return {
|
|
278
|
-
content: [{
|
|
279
|
-
type: "text",
|
|
280
|
-
text: `❌ **Template Not Found**\n\nTemplate ID \`${args.templateId}\` not found in marketplace.\n\n**Check:**\n- Template ID is correct\n- Template is published and available\n\n💡 Use \`list_templates\` to see available templates.`,
|
|
281
|
-
}],
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
if (errorMessage.toLowerCase().includes('permission')) {
|
|
285
|
-
return {
|
|
286
|
-
content: [{
|
|
287
|
-
type: "text",
|
|
288
|
-
text: `❌ **Permission Denied**\n\nYou don't have permission to install templates. Only workspace administrators can install templates.\n\n**Error:** ${errorMessage}`,
|
|
289
|
-
}],
|
|
290
|
-
};
|
|
372
|
+
const existing = await findExistingInstall(args.productId, workspaceId, context);
|
|
373
|
+
if (existing?.installed) {
|
|
374
|
+
return textResponse(`ℹ️ **Product Already Installed**\n\nThis product is already installed in your workspace.\n\n` +
|
|
375
|
+
`**App ID:** \`${existing.appId || 'unknown'}\`\n\n**Tips:**\n- Use \`list_apps()\` to see installed apps\n` +
|
|
376
|
+
`- Use \`browse_marketplace({ productId: "${args.productId}" })\` to view product details`);
|
|
291
377
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
type: "text",
|
|
296
|
-
text: `⚠️ **Template Already Installed**\n\nThis template is already installed in the workspace.\n\n**Template ID:** \`${args.templateId}\`\n\n💡 Use \`list_apps\` to see installed apps.`,
|
|
297
|
-
}],
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
// Include debug info for troubleshooting
|
|
301
|
-
const debugInfo = {
|
|
302
|
-
endpoint: 'v2.network.product.install',
|
|
303
|
-
requestData: [args.templateId, args.workspaceId || 'current-workspace']
|
|
304
|
-
};
|
|
305
|
-
return {
|
|
306
|
-
content: [{
|
|
307
|
-
type: "text",
|
|
308
|
-
text: `❌ **Error installing template**\n\n**Error:** ${errorMessage}\n\n**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n**Common Issues:**\n- Invalid template ID\n- Template not found\n- Permission denied\n- Already installed`,
|
|
309
|
-
}],
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
// ============================================================================
|
|
315
|
-
// GET TEMPLATE TOOL (MARKETPLACE)
|
|
316
|
-
// ============================================================================
|
|
317
|
-
const getTemplateDescription = `Get template details from marketplace`;
|
|
318
|
-
exports.getTemplateTool = {
|
|
319
|
-
name: 'get_template',
|
|
320
|
-
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
321
|
-
description: getTemplateDescription,
|
|
322
|
-
schema: zod_1.z.object({
|
|
323
|
-
templateId: zod_1.z
|
|
324
|
-
.string()
|
|
325
|
-
.min(1)
|
|
326
|
-
.describe("Template/Product ID to get details for"),
|
|
327
|
-
}),
|
|
328
|
-
async execute(args, context) {
|
|
329
|
-
logger.debug('Getting marketplace template', {
|
|
330
|
-
templateId: args.templateId,
|
|
331
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
332
|
-
});
|
|
333
|
-
try {
|
|
334
|
-
logger.debug('Calling v2.network.product.get', {
|
|
335
|
-
templateId: args.templateId
|
|
336
|
-
});
|
|
337
|
-
const result = await context.hailer.request('v2.network.product.get', [args.templateId]);
|
|
338
|
-
logger.debug('Template get response', {
|
|
339
|
-
result: JSON.stringify(result)
|
|
340
|
-
});
|
|
341
|
-
const product = result?.product || result;
|
|
342
|
-
let responseText = `✅ **Template Details**\n\n`;
|
|
343
|
-
responseText += `**Template ID:** \`${args.templateId}\`\n`;
|
|
344
|
-
if (product?.name) {
|
|
345
|
-
responseText += `**Name:** ${product.name}\n`;
|
|
346
|
-
}
|
|
347
|
-
if (product?.description) {
|
|
348
|
-
responseText += `**Description:** ${product.description}\n`;
|
|
349
|
-
}
|
|
350
|
-
if (product?.version) {
|
|
351
|
-
responseText += `**Version:** ${product.version}\n`;
|
|
352
|
-
}
|
|
353
|
-
// Also try to get manifest
|
|
378
|
+
// Detect product type to route v2 template install vs v3 app install
|
|
379
|
+
let productName = 'Unknown';
|
|
380
|
+
let productType = 'app';
|
|
354
381
|
try {
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
});
|
|
359
|
-
if (manifest) {
|
|
360
|
-
responseText += `\n**Manifest:**\n\`\`\`json\n${JSON.stringify(manifest, null, 2)}\n\`\`\`\n`;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
catch (manifestError) {
|
|
364
|
-
logger.debug('Could not fetch manifest', { error: manifestError });
|
|
382
|
+
const detail = await fetchProductDetail(args.productId, context);
|
|
383
|
+
productName = detail.product?.name || detail.product?.title || 'Unknown';
|
|
384
|
+
productType = resolveProductType(detail.source, detail.product);
|
|
365
385
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const installed = await context.hailer.request('v2.network.product.isProductInstalled', [
|
|
371
|
-
args.templateId,
|
|
372
|
-
workspaceId
|
|
373
|
-
]);
|
|
374
|
-
logger.debug('Template installation check', {
|
|
375
|
-
installed: JSON.stringify(installed)
|
|
376
|
-
});
|
|
377
|
-
if (installed?.installed) {
|
|
378
|
-
responseText += `\n✅ **Status:** Installed in current workspace\n`;
|
|
379
|
-
if (installed.appId) {
|
|
380
|
-
responseText += `**App ID:** \`${installed.appId}\`\n`;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
responseText += `\n⚪ **Status:** Not installed in current workspace\n`;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
386
|
+
catch (productError) {
|
|
387
|
+
logger.debug('Could not fetch product details, defaulting to app install', {
|
|
388
|
+
error: productError instanceof Error ? productError.message : String(productError)
|
|
389
|
+
});
|
|
387
390
|
}
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
const installResult = productType === 'template'
|
|
392
|
+
? await installTemplateProduct(args.productId, workspaceId, context)
|
|
393
|
+
: await installAppProduct(args.productId, workspaceId, context);
|
|
394
|
+
const installedAppId = installResult?.appId || installResult?.details?.appId || installResult?._id;
|
|
395
|
+
let responseText = `✅ **${productType === 'template' ? 'Template' : 'App'} Installed Successfully**\n\n`;
|
|
396
|
+
responseText += `**Product:** ${productName}\n`;
|
|
397
|
+
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
398
|
+
if (installedAppId) {
|
|
399
|
+
responseText += `**Installed App ID:** \`${installedAppId}\`\n`;
|
|
390
400
|
}
|
|
401
|
+
responseText += `**Workspace:** \`${workspaceId}\`\n`;
|
|
391
402
|
responseText += `\n💡 **Next Steps:**\n`;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}],
|
|
399
|
-
};
|
|
403
|
+
if (productType === 'template') {
|
|
404
|
+
responseText += `- Use \`describe_workflows\` to see the new workflow(s)\n`;
|
|
405
|
+
}
|
|
406
|
+
responseText += `- Use \`list_apps()\` to see installed app(s)\n`;
|
|
407
|
+
responseText += `- Use \`manage_app\` with action 'add_member' to share with workspace members\n`;
|
|
408
|
+
return textResponse(responseText);
|
|
400
409
|
}
|
|
401
410
|
catch (error) {
|
|
402
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
403
|
-
logger.error(
|
|
411
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
412
|
+
logger.error('Error installing marketplace product', error);
|
|
413
|
+
}
|
|
404
414
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
415
|
+
if (errorMessage.toLowerCase().includes('permission')) {
|
|
416
|
+
return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to install marketplace products. ` +
|
|
417
|
+
`Only workspace administrators can install.\n\n**Error:** ${errorMessage}`);
|
|
418
|
+
}
|
|
405
419
|
if (errorMessage.toLowerCase().includes('not found')) {
|
|
406
|
-
return {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}],
|
|
411
|
-
};
|
|
420
|
+
return textResponse(`❌ **Product Not Found**\n\nThe marketplace product \`${args.productId}\` was not found.\n\n` +
|
|
421
|
+
`**Tips:**\n- Verify the product ID is correct\n` +
|
|
422
|
+
`- Use \`browse_marketplace({ productId: "${args.productId}" })\` to check if the product exists\n\n` +
|
|
423
|
+
`**Error:** ${errorMessage}`);
|
|
412
424
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
425
|
+
if (errorMessage.toLowerCase().includes('already installed')) {
|
|
426
|
+
return textResponse(`⚠️ **Product Already Installed**\n\nThis product is already installed in the workspace.\n\n` +
|
|
427
|
+
`**Product ID:** \`${args.productId}\`\n\n💡 Use \`list_apps\` to see installed apps.`);
|
|
428
|
+
}
|
|
429
|
+
return textResponse(`❌ **Error installing marketplace product**\n\n**Error:** ${errorMessage}\n\n` +
|
|
430
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found in marketplace\n- Insufficient permissions`);
|
|
419
431
|
}
|
|
420
432
|
}
|
|
421
433
|
};
|
|
422
434
|
// ============================================================================
|
|
423
|
-
// PUBLISH
|
|
435
|
+
// PUBLISH MARKETPLACE — publish/update app or template listings
|
|
424
436
|
// ============================================================================
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
437
|
+
const publishMarketplaceDescription = `Publish an app or workspace template to the Hailer marketplace, or update an existing listing.\n\n` +
|
|
438
|
+
`type 'app': requires the appId of a production app (empty url — dev/localhost apps are rejected). Creating ` +
|
|
439
|
+
`a NEW app listing also requires versionId — the targetId written to public/manifest.json by ` +
|
|
440
|
+
`\`npm run publish-production -- --market\`. type 'template': packages the current workspace as an installable template (step 1 ` +
|
|
441
|
+
`creates the v2 template manifest, step 2 the marketplace listing).\n\n` +
|
|
442
|
+
`Pass productId to UPDATE an existing listing's metadata (name, description, publisher, icon, images, ` +
|
|
443
|
+
`externalUrl) — no version bump needed. Omit productId to CREATE a new listing. Upload iconFileId / ` +
|
|
444
|
+
`imageFileIds via \`upload_files\` first.`;
|
|
445
|
+
const publishMarketplaceSchema = zod_1.z.object({
|
|
446
|
+
type: zod_1.z
|
|
447
|
+
.enum(['app', 'template'])
|
|
448
|
+
.describe("What to publish: 'app' (requires appId; new listings also need versionId) or 'template' (packages the current workspace)"),
|
|
449
|
+
appId: zod_1.z
|
|
450
|
+
.string()
|
|
451
|
+
.length(24)
|
|
452
|
+
.optional()
|
|
453
|
+
.describe("App ID to publish (24 chars). Required when type is 'app'"),
|
|
454
|
+
productId: zod_1.z
|
|
455
|
+
.string()
|
|
456
|
+
.length(24)
|
|
457
|
+
.optional()
|
|
458
|
+
.describe('Existing marketplace product ID to UPDATE (omit to create a new listing)'),
|
|
459
|
+
versionId: zod_1.z
|
|
460
|
+
.string()
|
|
461
|
+
.length(24)
|
|
462
|
+
.optional()
|
|
463
|
+
.describe('App version ID used as the listing targetId — written to public/manifest.json by ' +
|
|
464
|
+
'`npm run publish-production -- --market`. Required for NEW app listings'),
|
|
465
|
+
title: zod_1.z
|
|
466
|
+
.string()
|
|
467
|
+
.min(1)
|
|
468
|
+
.max(64)
|
|
469
|
+
.describe('Marketplace listing name (max 64 chars)'),
|
|
470
|
+
description: zod_1.z
|
|
471
|
+
.string()
|
|
472
|
+
.min(1)
|
|
473
|
+
.max(4096)
|
|
474
|
+
.describe('Full listing description (max 4096 chars)'),
|
|
475
|
+
version: zod_1.z
|
|
476
|
+
.string()
|
|
477
|
+
.min(1)
|
|
478
|
+
.describe("Version string (e.g. '1.0.0')"),
|
|
479
|
+
versionDescription: zod_1.z
|
|
480
|
+
.string()
|
|
481
|
+
.min(1)
|
|
482
|
+
.describe('Release notes for this version'),
|
|
483
|
+
publisher: zod_1.z
|
|
484
|
+
.string()
|
|
485
|
+
.min(1)
|
|
486
|
+
.describe('Publishing company or person name'),
|
|
487
|
+
iconFileId: zod_1.z
|
|
488
|
+
.string()
|
|
489
|
+
.length(24)
|
|
490
|
+
.describe('Icon file ID (24 chars). Upload with upload_files first'),
|
|
491
|
+
imageFileIds: zod_1.z
|
|
492
|
+
.array(zod_1.z.string().length(24))
|
|
493
|
+
.optional()
|
|
494
|
+
.describe('Optional array of preview image file IDs'),
|
|
495
|
+
externalUrl: zod_1.z
|
|
496
|
+
.string()
|
|
497
|
+
.url()
|
|
498
|
+
.optional()
|
|
499
|
+
.describe('Optional external website/documentation URL'),
|
|
500
|
+
workflowId: zod_1.z
|
|
501
|
+
.string()
|
|
502
|
+
.optional()
|
|
503
|
+
.describe('Template creation only: source workflow ID. Note: the API manifests the whole workspace; ' +
|
|
504
|
+
'workflow attachment is finalized in the Hailer UI'),
|
|
505
|
+
});
|
|
506
|
+
async function verifyPublishableApp(appId, context) {
|
|
507
|
+
logger.debug('Fetching app details', { appId });
|
|
508
|
+
const appResult = await context.hailer.request('v3.app.list', [{}]);
|
|
509
|
+
const apps = appResult?.apps || appResult?.details?.apps || (Array.isArray(appResult) ? appResult : []);
|
|
510
|
+
const app = Array.isArray(apps) ? apps.find((entry) => entry._id === appId) : null;
|
|
511
|
+
if (!app) {
|
|
512
|
+
return {
|
|
513
|
+
errorResponse: textResponse(`❌ **App Not Found**\n\nApp ID \`${appId}\` was not found in the current workspace.\n\n` +
|
|
514
|
+
`**Tips:**\n- Use \`list_apps()\` to see available apps\n- Ensure the app exists and you have access`)
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
// Dev apps (localhost URL) can't be listed on the marketplace
|
|
518
|
+
if (app.url && app.url.includes('localhost')) {
|
|
519
|
+
return {
|
|
520
|
+
errorResponse: textResponse(`⚠️ **Cannot Publish Development App**\n\nApp "${app.name}" is a development app (URL: ${app.url}).\n\n` +
|
|
521
|
+
`**To publish to marketplace:**\n1. First publish the app code: \`npm run publish-production -- --market\`\n` +
|
|
522
|
+
`2. Or create a production app with empty URL\n3. Then call \`publish_marketplace\` again`)
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return { appName: app.name };
|
|
526
|
+
}
|
|
527
|
+
async function createTemplateManifest(args, workspaceId, context) {
|
|
528
|
+
// Note: versionDescription is required and cannot be empty
|
|
529
|
+
const publishData = {
|
|
530
|
+
workspaceId,
|
|
531
|
+
version: args.version,
|
|
532
|
+
versionDescription: args.versionDescription,
|
|
533
|
+
title: args.title,
|
|
534
|
+
description: args.description
|
|
535
|
+
};
|
|
536
|
+
logger.debug('Calling v2.network.product.publishTemplate', { publishData });
|
|
537
|
+
const publishResult = await context.hailer.request('v2.network.product.publishTemplate', [publishData]);
|
|
538
|
+
logger.debug('Publish template response', { result: JSON.stringify(publishResult) });
|
|
539
|
+
const targetId = publishResult?.productId || publishResult?._id || publishResult?.id;
|
|
540
|
+
if (!targetId) {
|
|
541
|
+
return {
|
|
542
|
+
errorResponse: textResponse(`❌ **Error**: publishTemplate succeeded but no product ID returned.\n\n` +
|
|
543
|
+
`**Response:**\n\`\`\`json\n${JSON.stringify(publishResult, null, 2)}\n\`\`\``)
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
return { targetId };
|
|
547
|
+
}
|
|
548
|
+
function buildListingData(args) {
|
|
549
|
+
const productData = {
|
|
550
|
+
name: args.title,
|
|
551
|
+
description: args.description,
|
|
552
|
+
publisher: args.publisher,
|
|
553
|
+
icon: args.iconFileId,
|
|
554
|
+
images: args.imageFileIds || [args.iconFileId]
|
|
555
|
+
};
|
|
556
|
+
if (args.externalUrl) {
|
|
557
|
+
productData.externalUrl = args.externalUrl;
|
|
558
|
+
}
|
|
559
|
+
return productData;
|
|
560
|
+
}
|
|
561
|
+
exports.publishMarketplaceTool = {
|
|
562
|
+
name: 'publish_marketplace',
|
|
428
563
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
429
|
-
description:
|
|
430
|
-
schema:
|
|
431
|
-
productId: zod_1.z
|
|
432
|
-
.string()
|
|
433
|
-
.length(24)
|
|
434
|
-
.optional()
|
|
435
|
-
.describe("Existing product ID to UPDATE (omit to create new template)"),
|
|
436
|
-
title: zod_1.z
|
|
437
|
-
.string()
|
|
438
|
-
.min(1)
|
|
439
|
-
.max(64)
|
|
440
|
-
.describe("Template name (max 64 chars)"),
|
|
441
|
-
description: zod_1.z
|
|
442
|
-
.string()
|
|
443
|
-
.min(1)
|
|
444
|
-
.max(4096)
|
|
445
|
-
.describe("Template description (max 4096 chars)"),
|
|
446
|
-
version: zod_1.z
|
|
447
|
-
.string()
|
|
448
|
-
.min(1)
|
|
449
|
-
.describe("Version string (e.g. '1.0.0')"),
|
|
450
|
-
versionDescription: zod_1.z
|
|
451
|
-
.string()
|
|
452
|
-
.min(1)
|
|
453
|
-
.describe("Release notes for this version"),
|
|
454
|
-
publisher: zod_1.z
|
|
455
|
-
.string()
|
|
456
|
-
.min(1)
|
|
457
|
-
.describe("Publishing company or person name"),
|
|
458
|
-
iconFileId: zod_1.z
|
|
459
|
-
.string()
|
|
460
|
-
.length(24)
|
|
461
|
-
.describe("Icon file ID (24 chars). Upload with upload_files first"),
|
|
462
|
-
imageFileIds: zod_1.z
|
|
463
|
-
.array(zod_1.z.string().length(24))
|
|
464
|
-
.optional()
|
|
465
|
-
.describe("Optional array of preview image file IDs"),
|
|
466
|
-
externalUrl: zod_1.z
|
|
467
|
-
.string()
|
|
468
|
-
.url()
|
|
469
|
-
.optional()
|
|
470
|
-
.describe("Optional external website URL"),
|
|
471
|
-
}),
|
|
564
|
+
description: publishMarketplaceDescription,
|
|
565
|
+
schema: publishMarketplaceSchema,
|
|
472
566
|
async execute(args, context) {
|
|
473
567
|
const isUpdate = !!args.productId;
|
|
474
|
-
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'}
|
|
568
|
+
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} marketplace listing`, {
|
|
569
|
+
type: args.type,
|
|
570
|
+
appId: args.appId,
|
|
475
571
|
title: args.title,
|
|
476
572
|
version: args.version,
|
|
477
573
|
productId: args.productId,
|
|
@@ -482,558 +578,354 @@ exports.publishTemplateTool = {
|
|
|
482
578
|
if (!workspaceId) {
|
|
483
579
|
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
484
580
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
// Step 2:
|
|
515
|
-
|
|
516
|
-
let apiMethod;
|
|
517
|
-
let apiArgs;
|
|
581
|
+
if (args.type === 'app' && !args.appId) {
|
|
582
|
+
return textResponse(`❌ **Missing appId**\n\n\`appId\` is required when \`type\` is 'app'.`);
|
|
583
|
+
}
|
|
584
|
+
const appCheck = args.type === 'app'
|
|
585
|
+
? await verifyPublishableApp(args.appId, context)
|
|
586
|
+
: undefined;
|
|
587
|
+
if (appCheck?.errorResponse) {
|
|
588
|
+
return appCheck.errorResponse;
|
|
589
|
+
}
|
|
590
|
+
const appName = appCheck?.appName || '';
|
|
591
|
+
// For new app listings we need the targetId from a --market publish
|
|
592
|
+
if (args.type === 'app' && !isUpdate && !args.versionId) {
|
|
593
|
+
return textResponse(`❌ **Error**: Missing required IDs.\n\n**To create a new app marketplace listing:**\n` +
|
|
594
|
+
`1. Run \`npm run publish-production -- --market\` — the targetId is saved to public/manifest.json\n` +
|
|
595
|
+
`2. Then run \`publish_marketplace\` with \`type: 'app'\` and the \`versionId\` (targetId)\n\n` +
|
|
596
|
+
`**To update existing listing metadata (icon, name, etc.):**\n` +
|
|
597
|
+
`Include the \`productId\` parameter - no version bump needed.`);
|
|
598
|
+
}
|
|
599
|
+
// Step 1 (template create only): manifest the current workspace via v2
|
|
600
|
+
let targetId = args.versionId;
|
|
601
|
+
const stepOne = (args.type === 'template' && !isUpdate)
|
|
602
|
+
? await createTemplateManifest(args, workspaceId, context)
|
|
603
|
+
: undefined;
|
|
604
|
+
if (stepOne?.errorResponse) {
|
|
605
|
+
return stepOne.errorResponse;
|
|
606
|
+
}
|
|
607
|
+
if (stepOne) {
|
|
608
|
+
targetId = stepOne.targetId;
|
|
609
|
+
}
|
|
610
|
+
// Step 2: create or update the marketplace listing via v3
|
|
611
|
+
const productData = buildListingData(args);
|
|
612
|
+
let apiMethod = 'v3.product.create';
|
|
613
|
+
let apiArgs = [{ cid: workspaceId, targetId, type: args.type, ...productData }];
|
|
518
614
|
if (isUpdate) {
|
|
519
|
-
// Update only allows specific fields
|
|
520
|
-
productData = {
|
|
521
|
-
name: args.title,
|
|
522
|
-
description: args.description,
|
|
523
|
-
publisher: args.publisher,
|
|
524
|
-
icon: args.iconFileId,
|
|
525
|
-
images: args.imageFileIds || [args.iconFileId]
|
|
526
|
-
};
|
|
527
|
-
if (args.externalUrl) {
|
|
528
|
-
productData.externalUrl = args.externalUrl;
|
|
529
|
-
}
|
|
530
615
|
apiMethod = 'v3.product.update';
|
|
531
|
-
apiArgs = [productId, productData];
|
|
616
|
+
apiArgs = [args.productId, productData];
|
|
532
617
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
618
|
+
logger.debug(`Calling ${apiMethod}`, {
|
|
619
|
+
productId: args.productId,
|
|
620
|
+
workspaceId,
|
|
621
|
+
appId: args.appId,
|
|
622
|
+
targetId,
|
|
623
|
+
iconFileId: args.iconFileId
|
|
624
|
+
});
|
|
625
|
+
let apiResult;
|
|
626
|
+
try {
|
|
627
|
+
apiResult = await context.hailer.request(apiMethod, apiArgs);
|
|
628
|
+
}
|
|
629
|
+
catch (stepTwoError) {
|
|
630
|
+
const stepTwoMessage = (0, tool_helpers_1.extractErrorMessage)(stepTwoError);
|
|
631
|
+
// Fail-safe for the two-step template publish: step 1 (v2 manifest) succeeded,
|
|
632
|
+
// step 2 (v3 listing) failed — report the orphan instead of hiding it.
|
|
633
|
+
if (args.type === 'template' && !isUpdate) {
|
|
634
|
+
logger.error('publish_marketplace: v3 listing creation failed after v2 template manifest was created', {
|
|
635
|
+
orphanedV2ProductId: targetId,
|
|
636
|
+
workspaceId,
|
|
637
|
+
error: stepTwoMessage
|
|
638
|
+
});
|
|
639
|
+
return textResponse(`❌ **Marketplace listing creation failed after the template manifest was created**\n\n` +
|
|
640
|
+
`Step 1 (v2 template manifest) succeeded, but step 2 (v3 marketplace listing) failed.\n\n` +
|
|
641
|
+
`**Orphaned v2 product ID:** \`${targetId}\`\n` +
|
|
642
|
+
`**Step 2 error:** ${stepTwoMessage}\n\n` +
|
|
643
|
+
`**What to do:**\n` +
|
|
644
|
+
`- Fix the cause above, then re-run \`publish_marketplace\` — it will create a fresh manifest\n` +
|
|
645
|
+
`- The orphaned manifest \`${targetId}\` never appears in the marketplace; it is harmless ` +
|
|
646
|
+
`but can be cleaned up via the Hailer UI or support`);
|
|
547
647
|
}
|
|
548
|
-
|
|
549
|
-
apiArgs = [productData];
|
|
648
|
+
throw stepTwoError;
|
|
550
649
|
}
|
|
551
|
-
logger.debug(`Calling ${apiMethod}`, { productId, workspaceId, iconFileId: args.iconFileId });
|
|
552
|
-
const apiResult = await context.hailer.request(apiMethod, apiArgs);
|
|
553
650
|
logger.debug(`${apiMethod} response`, {
|
|
554
651
|
result: JSON.stringify(apiResult)
|
|
555
652
|
});
|
|
556
|
-
// Get the final product ID from the v3 API response (this is the
|
|
557
|
-
const finalProductId = apiResult?._id || apiResult?.id || productId;
|
|
558
|
-
|
|
653
|
+
// Get the final product ID from the v3 API response (this is the marketplace ID)
|
|
654
|
+
const finalProductId = apiResult?._id || apiResult?.id || args.productId || targetId;
|
|
655
|
+
const typeLabel = args.type === 'app' ? 'App' : 'Template';
|
|
656
|
+
let responseText = `✅ **${typeLabel} ${isUpdate ? 'Updated' : 'Published'} Successfully**\n\n`;
|
|
657
|
+
if (args.type === 'app') {
|
|
658
|
+
responseText += `**App:** ${appName} (\`${args.appId}\`)\n`;
|
|
659
|
+
}
|
|
559
660
|
responseText += `**Title:** ${args.title}\n`;
|
|
560
661
|
responseText += `**Publisher:** ${args.publisher}\n`;
|
|
561
662
|
responseText += `**Version:** ${args.version}\n`;
|
|
562
663
|
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
563
664
|
responseText += `**Product ID:** \`${finalProductId}\`\n`;
|
|
564
665
|
responseText += `**Release Notes:** ${args.versionDescription}\n`;
|
|
666
|
+
if (args.type === 'template' && args.workflowId) {
|
|
667
|
+
responseText += `\n⚠️ **Note:** The publish API manifests the whole workspace — ` +
|
|
668
|
+
`attaching a specific workflow must be done via the Hailer UI.\n`;
|
|
669
|
+
}
|
|
565
670
|
responseText += `\n💡 **Next Steps:**\n`;
|
|
566
|
-
responseText += `- Use \`
|
|
671
|
+
responseText += `- Use \`browse_marketplace()\` to see it in the marketplace\n`;
|
|
567
672
|
responseText += `- Share the product ID with other workspaces\n`;
|
|
568
|
-
responseText += `- They can install with \`
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
type: "text",
|
|
572
|
-
text: responseText,
|
|
573
|
-
}],
|
|
574
|
-
};
|
|
673
|
+
responseText += `- They can install with \`install_marketplace({ productId: "${finalProductId}" })\`\n`;
|
|
674
|
+
responseText += `- To update this listing, include \`productId: "${finalProductId}"\` in the next publish\n`;
|
|
675
|
+
return textResponse(responseText);
|
|
575
676
|
}
|
|
576
677
|
catch (error) {
|
|
577
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
578
|
-
logger.error(
|
|
678
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
679
|
+
logger.error('Error publishing to marketplace', error);
|
|
680
|
+
}
|
|
579
681
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
580
682
|
if (errorMessage.toLowerCase().includes('permission')) {
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
type: "text",
|
|
584
|
-
text: `❌ **Permission Denied**\n\nYou don't have permission to publish templates. Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`,
|
|
585
|
-
}],
|
|
586
|
-
};
|
|
683
|
+
return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to publish to the marketplace. ` +
|
|
684
|
+
`Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`);
|
|
587
685
|
}
|
|
588
686
|
// Always include debug info for troubleshooting
|
|
589
|
-
const debugWorkspaceId = context.workspaceCache?.currentWorkspace._id || 'unknown';
|
|
590
687
|
const debugInfo = {
|
|
591
|
-
|
|
688
|
+
type: args.type,
|
|
689
|
+
isUpdate,
|
|
592
690
|
requestData: {
|
|
593
|
-
workspaceId:
|
|
691
|
+
workspaceId: context.workspaceCache?.currentWorkspace._id || 'unknown',
|
|
594
692
|
version: args.version,
|
|
595
693
|
versionDescription: args.versionDescription,
|
|
596
694
|
title: args.title,
|
|
597
695
|
description: args.description
|
|
598
696
|
}
|
|
599
697
|
};
|
|
600
|
-
return {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}],
|
|
605
|
-
};
|
|
698
|
+
return textResponse(`❌ **Error publishing to marketplace**\n\n**Error:** ${errorMessage}\n\n` +
|
|
699
|
+
`**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n` +
|
|
700
|
+
`**Common Issues:**\n- Must be workspace administrator\n- Icon file must be uploaded first\n` +
|
|
701
|
+
`- App must be a production app (not dev/localhost)\n- Invalid version format`);
|
|
606
702
|
}
|
|
607
703
|
}
|
|
608
704
|
};
|
|
609
|
-
//
|
|
610
|
-
// GET
|
|
611
|
-
//
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
705
|
+
// ============================================================================
|
|
706
|
+
// GET INSTALLED VERSION — version installed in the current workspace
|
|
707
|
+
// ============================================================================
|
|
708
|
+
const getInstalledVersionDescription = `Report the version of a marketplace product installed in the CURRENT workspace. The server uses the ` +
|
|
709
|
+
`session's workspace implicitly — there is no workspaceId override, so this always reflects the workspace ` +
|
|
710
|
+
`the session is connected to. If the product is not installed in the current workspace, that is stated ` +
|
|
711
|
+
`clearly. Otherwise the installed version, description, package hash and install date are reported.`;
|
|
712
|
+
exports.getInstalledVersionTool = {
|
|
713
|
+
name: 'get_installed_version',
|
|
615
714
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
616
|
-
description:
|
|
715
|
+
description: getInstalledVersionDescription,
|
|
617
716
|
schema: zod_1.z.object({
|
|
618
717
|
productId: zod_1.z
|
|
619
718
|
.string()
|
|
620
719
|
.length(24)
|
|
621
|
-
.describe(
|
|
720
|
+
.describe('Marketplace product ID (24 chars) to check the installed version of'),
|
|
622
721
|
}),
|
|
623
722
|
async execute(args, context) {
|
|
624
|
-
logger.debug('Getting
|
|
723
|
+
logger.debug('Getting installed version', {
|
|
625
724
|
productId: args.productId,
|
|
626
725
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
627
726
|
});
|
|
628
727
|
try {
|
|
629
|
-
logger.debug('Calling v3.app.product.
|
|
630
|
-
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
728
|
+
logger.debug('Calling v3.app.product.getInstalledVersion', { productId: args.productId });
|
|
729
|
+
const result = await context.hailer.request('v3.app.product.getInstalledVersion', [args.productId]);
|
|
730
|
+
logger.debug('Installed version response', { result: JSON.stringify(result) });
|
|
731
|
+
// An empty object means the product is not installed in the session workspace.
|
|
732
|
+
const hasVersion = result && Object.keys(result).length > 0;
|
|
733
|
+
if (!hasVersion) {
|
|
734
|
+
return textResponse(`⚪ **Not Installed**\n\nProduct \`${args.productId}\` is not installed in the current workspace.\n\n` +
|
|
735
|
+
`💡 Use \`install_marketplace({ productId: "${args.productId}" })\` to install it.`);
|
|
736
|
+
}
|
|
737
|
+
let responseText = `✅ **Installed Version**\n\n`;
|
|
638
738
|
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
639
|
-
if (
|
|
640
|
-
responseText += `**
|
|
739
|
+
if (result.version) {
|
|
740
|
+
responseText += `**Version:** ${result.version}\n`;
|
|
641
741
|
}
|
|
642
|
-
if (
|
|
643
|
-
responseText += `**Description:** ${
|
|
742
|
+
if (result.description) {
|
|
743
|
+
responseText += `**Description:** ${result.description}\n`;
|
|
644
744
|
}
|
|
645
|
-
if (
|
|
646
|
-
responseText += `**
|
|
745
|
+
if (result.packageHash) {
|
|
746
|
+
responseText += `**Package Hash:** \`${result.packageHash}\`\n`;
|
|
647
747
|
}
|
|
648
|
-
if (
|
|
649
|
-
responseText += `**
|
|
748
|
+
if (result.created) {
|
|
749
|
+
responseText += `**Installed:** ${result.created}\n`;
|
|
650
750
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
type: "text",
|
|
654
|
-
text: responseText,
|
|
655
|
-
}],
|
|
656
|
-
};
|
|
751
|
+
responseText += `\nℹ️ This reflects the CURRENT workspace only.`;
|
|
752
|
+
return textResponse(responseText);
|
|
657
753
|
}
|
|
658
754
|
catch (error) {
|
|
659
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
660
|
-
logger.error(
|
|
755
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
756
|
+
logger.error('Error getting installed version', error);
|
|
757
|
+
}
|
|
661
758
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
662
|
-
return {
|
|
663
|
-
|
|
664
|
-
type: "text",
|
|
665
|
-
text: `❌ **Error getting product**\n\n**Error:** ${errorMessage}`,
|
|
666
|
-
}],
|
|
667
|
-
};
|
|
759
|
+
return textResponse(`❌ **Error getting installed version**\n\n**Error:** ${errorMessage}\n\n` +
|
|
760
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found`);
|
|
668
761
|
}
|
|
669
762
|
}
|
|
670
763
|
};
|
|
671
|
-
//
|
|
672
|
-
//
|
|
673
|
-
//
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
|
|
764
|
+
// ============================================================================
|
|
765
|
+
// SET MARKETPLACE VISIBILITY — toggle a product public/private
|
|
766
|
+
// ============================================================================
|
|
767
|
+
const setMarketplaceVisibilityDescription = `Set a marketplace product's visibility: public (listed on the public marketplace) or private (workspace ` +
|
|
768
|
+
`only). Requires the caller be a network admin of the product's workspace — otherwise the call is rejected ` +
|
|
769
|
+
`with a permission error. Reports the resulting public/private state on success.`;
|
|
770
|
+
exports.setMarketplaceVisibilityTool = {
|
|
771
|
+
name: 'set_marketplace_visibility',
|
|
677
772
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
678
|
-
description:
|
|
773
|
+
description: setMarketplaceVisibilityDescription,
|
|
679
774
|
schema: zod_1.z.object({
|
|
680
775
|
productId: zod_1.z
|
|
681
776
|
.string()
|
|
682
777
|
.length(24)
|
|
683
|
-
.describe(
|
|
778
|
+
.describe('Marketplace product ID (24 chars)'),
|
|
779
|
+
isPublic: zod_1.z
|
|
780
|
+
.boolean()
|
|
781
|
+
.describe('true = list on the public marketplace, false = make private/workspace-only'),
|
|
684
782
|
}),
|
|
685
783
|
async execute(args, context) {
|
|
686
|
-
logger.debug('
|
|
784
|
+
logger.debug('Setting marketplace visibility', {
|
|
687
785
|
productId: args.productId,
|
|
786
|
+
isPublic: args.isPublic,
|
|
688
787
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
689
788
|
});
|
|
690
789
|
try {
|
|
691
|
-
logger.debug('Calling v3.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
logger.debug('Product manifest response', {
|
|
696
|
-
result: JSON.stringify(result)
|
|
697
|
-
});
|
|
698
|
-
const manifest = result;
|
|
699
|
-
let responseText = `✅ **Product Manifest (v3)**\n\n`;
|
|
790
|
+
logger.debug('Calling v3.product.setPublic', { productId: args.productId, isPublic: args.isPublic });
|
|
791
|
+
await context.hailer.request('v3.product.setPublic', [args.productId, args.isPublic]);
|
|
792
|
+
const stateLabel = args.isPublic ? 'Public' : 'Private';
|
|
793
|
+
let responseText = `✅ **Visibility Updated**\n\n`;
|
|
700
794
|
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
return {
|
|
708
|
-
content: [{
|
|
709
|
-
type: "text",
|
|
710
|
-
text: responseText,
|
|
711
|
-
}],
|
|
712
|
-
};
|
|
795
|
+
responseText += `**Visibility:** ${stateLabel}\n\n`;
|
|
796
|
+
responseText += args.isPublic
|
|
797
|
+
? `This product is now listed on the public marketplace.`
|
|
798
|
+
: `This product is now private (workspace only).`;
|
|
799
|
+
return textResponse(responseText);
|
|
713
800
|
}
|
|
714
801
|
catch (error) {
|
|
715
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
716
|
-
logger.error(
|
|
802
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
803
|
+
logger.error('Error setting marketplace visibility', error);
|
|
804
|
+
}
|
|
717
805
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
806
|
+
if (errorMessage.toLowerCase().includes('permission')) {
|
|
807
|
+
return textResponse(`❌ **Permission Denied**\n\nOnly a network admin of the product's workspace can change its ` +
|
|
808
|
+
`visibility.\n\n**Error:** ${errorMessage}`);
|
|
809
|
+
}
|
|
810
|
+
return textResponse(`❌ **Error setting marketplace visibility**\n\n**Error:** ${errorMessage}\n\n` +
|
|
811
|
+
`**Common Issues:**\n- Must be a network admin of the product's workspace\n- Invalid product ID`);
|
|
724
812
|
}
|
|
725
813
|
}
|
|
726
814
|
};
|
|
727
|
-
//
|
|
728
|
-
//
|
|
729
|
-
//
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
815
|
+
// ============================================================================
|
|
816
|
+
// REMOVE MARKETPLACE PRODUCT — delete a product listing
|
|
817
|
+
// ============================================================================
|
|
818
|
+
const removeMarketplaceProductDescription = `Permanently remove a marketplace product listing. Requires the caller be a network admin of the product's ` +
|
|
819
|
+
`workspace. The API also blocks deletion if any purchase exists for the product — that block is reported ` +
|
|
820
|
+
`explicitly so it isn't mistaken for a permission error.`;
|
|
821
|
+
exports.removeMarketplaceProductTool = {
|
|
822
|
+
name: 'remove_marketplace_product',
|
|
733
823
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
734
|
-
description:
|
|
824
|
+
description: removeMarketplaceProductDescription,
|
|
735
825
|
schema: zod_1.z.object({
|
|
736
|
-
appId: zod_1.z
|
|
737
|
-
.string()
|
|
738
|
-
.length(24)
|
|
739
|
-
.describe("App ID to publish (24 characters)"),
|
|
740
|
-
versionId: zod_1.z
|
|
741
|
-
.string()
|
|
742
|
-
.length(24)
|
|
743
|
-
.optional()
|
|
744
|
-
.describe("Optional version ID. If not provided, uses appId as targetId."),
|
|
745
826
|
productId: zod_1.z
|
|
746
827
|
.string()
|
|
747
828
|
.length(24)
|
|
748
|
-
.
|
|
749
|
-
.describe("Existing product ID to UPDATE (omit to create new listing)"),
|
|
750
|
-
title: zod_1.z
|
|
751
|
-
.string()
|
|
752
|
-
.min(1)
|
|
753
|
-
.max(64)
|
|
754
|
-
.describe("Marketplace listing name (max 64 chars)"),
|
|
755
|
-
description: zod_1.z
|
|
756
|
-
.string()
|
|
757
|
-
.min(1)
|
|
758
|
-
.max(4096)
|
|
759
|
-
.describe("Full description (max 4096 chars)"),
|
|
760
|
-
version: zod_1.z
|
|
761
|
-
.string()
|
|
762
|
-
.min(1)
|
|
763
|
-
.describe("Version string (e.g. '1.0.0')"),
|
|
764
|
-
versionDescription: zod_1.z
|
|
765
|
-
.string()
|
|
766
|
-
.min(1)
|
|
767
|
-
.describe("Release notes for this version"),
|
|
768
|
-
publisher: zod_1.z
|
|
769
|
-
.string()
|
|
770
|
-
.min(1)
|
|
771
|
-
.describe("Publishing company or person name"),
|
|
772
|
-
iconFileId: zod_1.z
|
|
773
|
-
.string()
|
|
774
|
-
.length(24)
|
|
775
|
-
.describe("Icon file ID (24 chars). Upload with upload_files first"),
|
|
776
|
-
imageFileIds: zod_1.z
|
|
777
|
-
.array(zod_1.z.string().length(24))
|
|
778
|
-
.optional()
|
|
779
|
-
.describe("Optional array of preview image file IDs"),
|
|
780
|
-
externalUrl: zod_1.z
|
|
781
|
-
.string()
|
|
782
|
-
.url()
|
|
783
|
-
.optional()
|
|
784
|
-
.describe("Optional external documentation URL"),
|
|
829
|
+
.describe('Marketplace product ID (24 chars) to remove'),
|
|
785
830
|
}),
|
|
786
831
|
async execute(args, context) {
|
|
787
|
-
|
|
788
|
-
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} app to marketplace`, {
|
|
789
|
-
appId: args.appId,
|
|
790
|
-
title: args.title,
|
|
791
|
-
version: args.version,
|
|
832
|
+
logger.debug('Removing marketplace product', {
|
|
792
833
|
productId: args.productId,
|
|
793
834
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
794
835
|
});
|
|
795
836
|
try {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
// Verify app exists and get details
|
|
801
|
-
logger.debug('Fetching app details', { appId: args.appId });
|
|
802
|
-
const appResult = await context.hailer.request('v3.app.list', [{}]);
|
|
803
|
-
const apps = appResult?.apps || appResult?.details?.apps || (Array.isArray(appResult) ? appResult : []);
|
|
804
|
-
const app = Array.isArray(apps) ? apps.find((a) => a._id === args.appId) : null;
|
|
805
|
-
if (!app) {
|
|
806
|
-
return {
|
|
807
|
-
content: [{
|
|
808
|
-
type: "text",
|
|
809
|
-
text: `❌ **App Not Found**\n\nApp ID \`${args.appId}\` was not found in the current workspace.\n\n**Tips:**\n- Use \`list_apps()\` to see available apps\n- Ensure the app exists and you have access`,
|
|
810
|
-
}],
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
// Warn if app is a dev app (has localhost URL)
|
|
814
|
-
if (app.url && app.url.includes('localhost')) {
|
|
815
|
-
return {
|
|
816
|
-
content: [{
|
|
817
|
-
type: "text",
|
|
818
|
-
text: `⚠️ **Cannot Publish Development App**\n\nApp "${app.name}" is a development app (URL: ${app.url}).\n\n**To publish to marketplace:**\n1. First publish the app code with \`publish_hailer_app\`\n2. Or create a production app with empty URL\n3. Then call \`publish_app\` again`,
|
|
819
|
-
}],
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
let productId = args.productId;
|
|
823
|
-
const targetId = args.versionId;
|
|
824
|
-
// For new listings, we need both targetId (from publish_hailer_app) to create the product
|
|
825
|
-
if (!productId && !targetId) {
|
|
826
|
-
return {
|
|
827
|
-
content: [{
|
|
828
|
-
type: "text",
|
|
829
|
-
text: `❌ **Error**: Missing required IDs.\n\n**To create a new marketplace listing:**\n1. Run \`publish_hailer_app\` with \`publishToMarket: true\` to get a targetId\n2. Then run \`publish_app\` with the \`versionId\` (targetId)\n\n**To update existing listing metadata (icon, name, etc.):**\nInclude the \`productId\` parameter - no version bump needed.`,
|
|
830
|
-
}],
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
// Step 2: Create or Update the product in marketplace
|
|
834
|
-
let productData;
|
|
835
|
-
let apiMethod;
|
|
836
|
-
let apiArgs;
|
|
837
|
-
if (isUpdate && productId) {
|
|
838
|
-
// Update only allows specific fields
|
|
839
|
-
productData = {
|
|
840
|
-
name: args.title,
|
|
841
|
-
description: args.description,
|
|
842
|
-
publisher: args.publisher,
|
|
843
|
-
icon: args.iconFileId,
|
|
844
|
-
images: args.imageFileIds || [args.iconFileId]
|
|
845
|
-
};
|
|
846
|
-
if (args.externalUrl) {
|
|
847
|
-
productData.externalUrl = args.externalUrl;
|
|
848
|
-
}
|
|
849
|
-
apiMethod = 'v3.product.update';
|
|
850
|
-
apiArgs = [productId, productData];
|
|
851
|
-
}
|
|
852
|
-
else {
|
|
853
|
-
// Create requires full data - targetId comes from versionId param or publishAppVersion call
|
|
854
|
-
productData = {
|
|
855
|
-
cid: workspaceId,
|
|
856
|
-
targetId, // Version ID from publishAppVersion or provided versionId
|
|
857
|
-
name: args.title,
|
|
858
|
-
description: args.description,
|
|
859
|
-
type: 'app',
|
|
860
|
-
publisher: args.publisher,
|
|
861
|
-
icon: args.iconFileId,
|
|
862
|
-
images: args.imageFileIds || [args.iconFileId]
|
|
863
|
-
};
|
|
864
|
-
if (args.externalUrl) {
|
|
865
|
-
productData.externalUrl = args.externalUrl;
|
|
866
|
-
}
|
|
867
|
-
apiMethod = 'v3.product.create';
|
|
868
|
-
apiArgs = [productData];
|
|
869
|
-
}
|
|
870
|
-
logger.debug(`Calling ${apiMethod}`, { productId, workspaceId, appId: args.appId, targetId, productData });
|
|
871
|
-
const apiResult = await context.hailer.request(apiMethod, apiArgs);
|
|
872
|
-
logger.debug(`${apiMethod} response`, {
|
|
873
|
-
result: JSON.stringify(apiResult)
|
|
874
|
-
});
|
|
875
|
-
// Get the final product ID from the v3 API response
|
|
876
|
-
const finalProductId = apiResult?._id || apiResult?.id || productId;
|
|
877
|
-
let responseText = `✅ **App ${isUpdate ? 'Updated' : 'Published'} to Marketplace**\n\n`;
|
|
878
|
-
responseText += `**App:** ${app.name} (\`${args.appId}\`)\n`;
|
|
879
|
-
responseText += `**Title:** ${args.title}\n`;
|
|
880
|
-
responseText += `**Publisher:** ${args.publisher}\n`;
|
|
881
|
-
responseText += `**Version:** ${args.version}\n`;
|
|
882
|
-
responseText += `**Product ID:** \`${finalProductId}\`\n`;
|
|
883
|
-
responseText += `**Release Notes:** ${args.versionDescription}\n`;
|
|
884
|
-
responseText += `\n💡 **Next Steps:**\n`;
|
|
885
|
-
responseText += `- Share the product ID with other workspaces\n`;
|
|
886
|
-
responseText += `- They can install with \`install_marketplace_app({ productId: "${finalProductId}" })\`\n`;
|
|
887
|
-
responseText += `- To update, include \`productId: "${finalProductId}"\` in next publish\n`;
|
|
888
|
-
return {
|
|
889
|
-
content: [{
|
|
890
|
-
type: "text",
|
|
891
|
-
text: responseText,
|
|
892
|
-
}],
|
|
893
|
-
};
|
|
837
|
+
logger.debug('Calling v3.product.remove', { productId: args.productId });
|
|
838
|
+
await context.hailer.request('v3.product.remove', [args.productId]);
|
|
839
|
+
return textResponse(`✅ **Product Removed**\n\nProduct \`${args.productId}\` has been deleted from the marketplace.`);
|
|
894
840
|
}
|
|
895
841
|
catch (error) {
|
|
896
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
897
|
-
logger.error(
|
|
842
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
843
|
+
logger.error('Error removing marketplace product', error);
|
|
844
|
+
}
|
|
898
845
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
846
|
+
if (errorMessage.toLowerCase().includes('purchase')) {
|
|
847
|
+
return textResponse(`❌ **Cannot Remove — Existing Purchases**\n\nProduct \`${args.productId}\` cannot be deleted ` +
|
|
848
|
+
`because it has existing purchases.\n\n**Error:** ${errorMessage}`);
|
|
849
|
+
}
|
|
899
850
|
if (errorMessage.toLowerCase().includes('permission')) {
|
|
900
|
-
return
|
|
901
|
-
|
|
902
|
-
type: "text",
|
|
903
|
-
text: `❌ **Permission Denied**\n\nYou don't have permission to publish apps to marketplace. Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`,
|
|
904
|
-
}],
|
|
905
|
-
};
|
|
851
|
+
return textResponse(`❌ **Permission Denied**\n\nOnly a network admin of the product's workspace can remove it.\n\n` +
|
|
852
|
+
`**Error:** ${errorMessage}`);
|
|
906
853
|
}
|
|
907
|
-
return {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
text: `❌ **Error publishing app to marketplace**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- App must be a production app (not dev/localhost)\n- Must be workspace administrator\n- Icon file must be uploaded first\n- Invalid version format`,
|
|
911
|
-
}],
|
|
912
|
-
};
|
|
854
|
+
return textResponse(`❌ **Error removing marketplace product**\n\n**Error:** ${errorMessage}\n\n` +
|
|
855
|
+
`**Common Issues:**\n- Must be a network admin of the product's workspace\n` +
|
|
856
|
+
`- Product cannot have existing purchases\n- Invalid product ID`);
|
|
913
857
|
}
|
|
914
858
|
}
|
|
915
859
|
};
|
|
916
|
-
//
|
|
917
|
-
//
|
|
918
|
-
//
|
|
919
|
-
const
|
|
920
|
-
|
|
921
|
-
|
|
860
|
+
// ============================================================================
|
|
861
|
+
// GET MARKETPLACE PRICING — report pricing; never charges (returns a link for paid)
|
|
862
|
+
// ============================================================================
|
|
863
|
+
const getMarketplacePricingDescription = `Report a marketplace product's pricing. This tool NEVER purchases or charges money — it only reads pricing ` +
|
|
864
|
+
`and, for paid products, returns a link the user can open to complete the purchase themselves.\n\n` +
|
|
865
|
+
`FREE products (no pricing configured, payment disabled, or no priced plan): tell the user it's free and ` +
|
|
866
|
+
`install it with \`install_marketplace\`. PAID products: tell the user it is paid, list the priced plans, ` +
|
|
867
|
+
`and give them the purchase link to open — do NOT attempt to install or pay.`;
|
|
868
|
+
function pricedPlans(pricing) {
|
|
869
|
+
if (!pricing || !pricing.paymentEnabled || !Array.isArray(pricing.types)) {
|
|
870
|
+
return [];
|
|
871
|
+
}
|
|
872
|
+
return pricing.types.filter((type) => typeof type.price === 'number' && type.price > 0);
|
|
873
|
+
}
|
|
874
|
+
exports.getMarketplacePricingTool = {
|
|
875
|
+
name: 'get_marketplace_pricing',
|
|
922
876
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
923
|
-
description:
|
|
877
|
+
description: getMarketplacePricingDescription,
|
|
924
878
|
schema: zod_1.z.object({
|
|
925
879
|
productId: zod_1.z
|
|
926
880
|
.string()
|
|
927
881
|
.length(24)
|
|
928
|
-
.describe(
|
|
929
|
-
workspaceId: zod_1.z
|
|
930
|
-
.string()
|
|
931
|
-
.optional()
|
|
932
|
-
.describe("Target workspace ID (defaults to current)"),
|
|
882
|
+
.describe('Marketplace product ID (24 chars) to report pricing for'),
|
|
933
883
|
}),
|
|
934
884
|
async execute(args, context) {
|
|
935
|
-
logger.debug('
|
|
885
|
+
logger.debug('Getting marketplace pricing', {
|
|
936
886
|
productId: args.productId,
|
|
937
887
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
938
888
|
});
|
|
939
889
|
try {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
error: checkError instanceof Error ? checkError.message : String(checkError)
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
// Get product details first
|
|
964
|
-
logger.debug('Fetching product details', { productId: args.productId });
|
|
965
|
-
let productName = 'Unknown';
|
|
966
|
-
try {
|
|
967
|
-
const productResult = await context.hailer.request('v3.app.product.get', [args.productId]);
|
|
968
|
-
productName = productResult?.name || productResult?.title || 'Unknown';
|
|
969
|
-
}
|
|
970
|
-
catch (productError) {
|
|
971
|
-
logger.debug('Could not fetch product details', {
|
|
972
|
-
error: productError instanceof Error ? productError.message : String(productError)
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
// Install the app
|
|
976
|
-
logger.debug('Calling v3.app.product.install', { productId: args.productId, workspaceId });
|
|
977
|
-
const installResult = await context.hailer.request('v3.app.product.install', [args.productId, workspaceId]);
|
|
978
|
-
logger.debug('Install result', { result: JSON.stringify(installResult) });
|
|
979
|
-
const installedAppId = installResult?.appId || installResult?.details?.appId || installResult?._id;
|
|
980
|
-
let responseText = `✅ **App Installed Successfully**\n\n`;
|
|
981
|
-
responseText += `**Product:** ${productName}\n`;
|
|
982
|
-
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
983
|
-
if (installedAppId) {
|
|
984
|
-
responseText += `**Installed App ID:** \`${installedAppId}\`\n`;
|
|
985
|
-
}
|
|
986
|
-
responseText += `**Workspace:** \`${workspaceId}\`\n`;
|
|
987
|
-
responseText += `\n💡 **Next Steps:**\n`;
|
|
988
|
-
responseText += `- Use \`list_apps()\` to see the installed app\n`;
|
|
989
|
-
responseText += `- Use \`add_app_member\` to share with workspace members\n`;
|
|
990
|
-
responseText += `- Open the app from Hailer workspace menu\n`;
|
|
991
|
-
return {
|
|
992
|
-
content: [{
|
|
993
|
-
type: "text",
|
|
994
|
-
text: responseText,
|
|
995
|
-
}],
|
|
996
|
-
};
|
|
890
|
+
logger.debug('Calling v3.payment.getPricing', { productId: args.productId });
|
|
891
|
+
const pricing = await context.hailer.request('v3.payment.getPricing', [{ productId: args.productId }]);
|
|
892
|
+
logger.debug('Pricing response', { pricing: JSON.stringify(pricing) });
|
|
893
|
+
const plans = pricedPlans(pricing);
|
|
894
|
+
if (plans.length === 0) {
|
|
895
|
+
return textResponse(`✅ **Free Product**\n\nProduct \`${args.productId}\` is FREE — no purchase needed.\n\n` +
|
|
896
|
+
`💡 Add it with \`install_marketplace({ productId: "${args.productId}" })\`.`);
|
|
897
|
+
}
|
|
898
|
+
const host = context.hailer.getClient().socket.host;
|
|
899
|
+
const purchaseLink = `${host}/p/${args.productId}`;
|
|
900
|
+
let responseText = `💳 **Paid Product**\n\nProduct \`${args.productId}\` is a PAID product. This tool ` +
|
|
901
|
+
`does not purchase it — open the link below to complete the purchase.\n\n`;
|
|
902
|
+
responseText += `**Plans:**\n`;
|
|
903
|
+
plans.forEach((plan) => {
|
|
904
|
+
const interval = plan.interval ? ` / ${plan.interval}` : '';
|
|
905
|
+
responseText += `- **${plan.planId}**: ${plan.price} ${plan.currency || ''}${interval}\n`;
|
|
906
|
+
});
|
|
907
|
+
responseText += `\n**Purchase link:** ${purchaseLink}\n\n`;
|
|
908
|
+
responseText += `Tell the user this product is paid and give them the link above to complete the purchase.`;
|
|
909
|
+
return textResponse(responseText);
|
|
997
910
|
}
|
|
998
911
|
catch (error) {
|
|
999
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1000
|
-
logger.error(
|
|
1001
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
1002
|
-
if (errorMessage.toLowerCase().includes('permission')) {
|
|
1003
|
-
return {
|
|
1004
|
-
content: [{
|
|
1005
|
-
type: "text",
|
|
1006
|
-
text: `❌ **Permission Denied**\n\nYou don't have permission to install apps. Only workspace administrators can install marketplace apps.\n\n**Error:** ${errorMessage}`,
|
|
1007
|
-
}],
|
|
1008
|
-
};
|
|
1009
|
-
}
|
|
1010
|
-
if (errorMessage.toLowerCase().includes('not found')) {
|
|
1011
|
-
return {
|
|
1012
|
-
content: [{
|
|
1013
|
-
type: "text",
|
|
1014
|
-
text: `❌ **Product Not Found**\n\nThe marketplace product \`${args.productId}\` was not found.\n\n**Tips:**\n- Verify the product ID is correct\n- Use \`get_product\` to check if the product exists\n\n**Error:** ${errorMessage}`,
|
|
1015
|
-
}],
|
|
1016
|
-
};
|
|
912
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
913
|
+
logger.error('Error getting marketplace pricing', error);
|
|
1017
914
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
text: `❌ **Error installing marketplace app**\n\n**Error:** ${errorMessage}\n\n**Common Issues:**\n- Invalid product ID\n- Product not found in marketplace\n- Insufficient permissions`,
|
|
1022
|
-
}],
|
|
1023
|
-
};
|
|
915
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
916
|
+
return textResponse(`❌ **Error getting marketplace pricing**\n\n**Error:** ${errorMessage}\n\n` +
|
|
917
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found`);
|
|
1024
918
|
}
|
|
1025
919
|
}
|
|
1026
920
|
};
|
|
1027
921
|
/** All app marketplace tools */
|
|
1028
922
|
exports.appMarketplaceTools = [
|
|
1029
|
-
exports.
|
|
1030
|
-
exports.
|
|
1031
|
-
exports.
|
|
1032
|
-
exports.
|
|
1033
|
-
exports.
|
|
1034
|
-
exports.
|
|
1035
|
-
exports.
|
|
1036
|
-
exports.publishAppTool,
|
|
1037
|
-
exports.installMarketplaceAppTool,
|
|
923
|
+
exports.browseMarketplaceTool,
|
|
924
|
+
exports.installMarketplaceTool,
|
|
925
|
+
exports.publishMarketplaceTool,
|
|
926
|
+
exports.getInstalledVersionTool,
|
|
927
|
+
exports.setMarketplaceVisibilityTool,
|
|
928
|
+
exports.removeMarketplaceProductTool,
|
|
929
|
+
exports.getMarketplacePricingTool,
|
|
1038
930
|
];
|
|
1039
931
|
//# sourceMappingURL=app-marketplace.js.map
|