@hailer/mcp 1.2.1 → 2.0.0-beta.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 +119 -148
- package/.claude/skills/hailer-app-builder/SKILL.md +24 -2
- package/.claude/skills/hailer-ui-guide/SKILL.md +265 -0
- package/.env.example +50 -1
- package/CLAUDE.md +141 -10
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +3 -0
- package/dist/app.js.map +1 -1
- package/dist/bot/bot-manager.d.ts +9 -6
- package/dist/bot/bot-manager.d.ts.map +1 -1
- package/dist/bot/bot-manager.js +142 -31
- package/dist/bot/bot-manager.js.map +1 -1
- package/dist/bot/bot.d.ts +59 -16
- package/dist/bot/bot.d.ts.map +1 -1
- package/dist/bot/bot.js +889 -142
- package/dist/bot/bot.js.map +1 -1
- package/dist/bot/operation-logger.d.ts.map +1 -1
- package/dist/bot/operation-logger.js +24 -12
- package/dist/bot/operation-logger.js.map +1 -1
- package/dist/bot/services/bot-permissions.d.ts +2 -2
- package/dist/bot/services/bot-permissions.d.ts.map +1 -1
- package/dist/bot/services/bot-permissions.js +28 -9
- package/dist/bot/services/bot-permissions.js.map +1 -1
- package/dist/bot/services/conversation-manager.d.ts +23 -23
- package/dist/bot/services/conversation-manager.d.ts.map +1 -1
- package/dist/bot/services/conversation-manager.js +52 -49
- package/dist/bot/services/conversation-manager.js.map +1 -1
- package/dist/bot/services/helper-prompt.d.ts +8 -0
- package/dist/bot/services/helper-prompt.d.ts.map +1 -0
- package/dist/bot/services/helper-prompt.js +177 -0
- package/dist/bot/services/helper-prompt.js.map +1 -0
- package/dist/bot/services/message-classifier.d.ts +16 -16
- package/dist/bot/services/message-classifier.d.ts.map +1 -1
- package/dist/bot/services/message-classifier.js +55 -49
- package/dist/bot/services/message-classifier.js.map +1 -1
- package/dist/bot/services/message-formatter.d.ts +38 -38
- package/dist/bot/services/message-formatter.d.ts.map +1 -1
- package/dist/bot/services/message-formatter.js +81 -74
- package/dist/bot/services/message-formatter.js.map +1 -1
- package/dist/bot/services/permission-guard.d.ts.map +1 -1
- package/dist/bot/services/permission-guard.js +20 -10
- package/dist/bot/services/permission-guard.js.map +1 -1
- package/dist/bot/services/signal-router.d.ts.map +1 -1
- package/dist/bot/services/signal-router.js +11 -6
- package/dist/bot/services/signal-router.js.map +1 -1
- package/dist/bot/services/system-prompt.d.ts +14 -0
- package/dist/bot/services/system-prompt.d.ts.map +1 -1
- package/dist/bot/services/system-prompt.js +179 -4
- package/dist/bot/services/system-prompt.js.map +1 -1
- package/dist/bot/services/token-billing.d.ts +23 -23
- package/dist/bot/services/token-billing.d.ts.map +1 -1
- package/dist/bot/services/token-billing.js +51 -36
- package/dist/bot/services/token-billing.js.map +1 -1
- package/dist/bot/services/types.d.ts +3 -1
- package/dist/bot/services/types.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.d.ts +8 -8
- package/dist/bot/services/typing-indicator.d.ts.map +1 -1
- package/dist/bot/services/typing-indicator.js +12 -10
- package/dist/bot/services/typing-indicator.js.map +1 -1
- package/dist/bot/services/workspace-refresh.d.ts +3 -3
- package/dist/bot/services/workspace-refresh.d.ts.map +1 -1
- package/dist/bot/services/workspace-refresh.js +23 -13
- package/dist/bot/services/workspace-refresh.js.map +1 -1
- package/dist/bot/tool-executor.d.ts +10 -6
- package/dist/bot/tool-executor.d.ts.map +1 -1
- package/dist/bot/tool-executor.js +12 -6
- package/dist/bot/tool-executor.js.map +1 -1
- package/dist/bot/workspace-overview.d.ts.map +1 -1
- package/dist/bot/workspace-overview.js +6 -3
- package/dist/bot/workspace-overview.js.map +1 -1
- package/dist/bot-config/activity-error.d.ts +47 -0
- package/dist/bot-config/activity-error.d.ts.map +1 -0
- package/dist/bot-config/activity-error.js +67 -0
- package/dist/bot-config/activity-error.js.map +1 -0
- package/dist/bot-config/context.d.ts +4 -4
- package/dist/bot-config/context.d.ts.map +1 -1
- package/dist/bot-config/context.js +18 -14
- package/dist/bot-config/context.js.map +1 -1
- package/dist/bot-config/events.d.ts +45 -0
- package/dist/bot-config/events.d.ts.map +1 -0
- package/dist/bot-config/events.js +51 -0
- package/dist/bot-config/events.js.map +1 -0
- package/dist/bot-config/index.d.ts +3 -0
- package/dist/bot-config/index.d.ts.map +1 -1
- package/dist/bot-config/index.js +8 -1
- package/dist/bot-config/index.js.map +1 -1
- package/dist/bot-config/loader.d.ts +3 -0
- package/dist/bot-config/loader.d.ts.map +1 -1
- package/dist/bot-config/loader.js +45 -20
- package/dist/bot-config/loader.js.map +1 -1
- package/dist/bot-config/persistence.js.map +1 -1
- package/dist/bot-config/reconciler.d.ts +11 -0
- package/dist/bot-config/reconciler.d.ts.map +1 -0
- package/dist/bot-config/reconciler.js +121 -0
- package/dist/bot-config/reconciler.js.map +1 -0
- package/dist/bot-config/state.d.ts.map +1 -1
- package/dist/bot-config/state.js.map +1 -1
- package/dist/bot-config/types.d.ts +32 -0
- package/dist/bot-config/types.d.ts.map +1 -1
- package/dist/bot-config/webhooks.d.ts.map +1 -1
- package/dist/bot-config/webhooks.js.map +1 -1
- package/dist/bot-config/workflow-installer.d.ts +37 -0
- package/dist/bot-config/workflow-installer.d.ts.map +1 -0
- package/dist/bot-config/workflow-installer.js +346 -0
- package/dist/bot-config/workflow-installer.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +54 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -19
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +65 -27
- package/dist/config.js.map +1 -1
- package/dist/core.d.ts +6 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -16
- package/dist/core.js.map +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +7 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/request-logger.d.ts +19 -19
- package/dist/lib/request-logger.d.ts.map +1 -1
- package/dist/lib/request-logger.js +19 -19
- package/dist/lib/request-logger.js.map +1 -1
- package/dist/mcp/UserContextCache.d.ts +28 -22
- package/dist/mcp/UserContextCache.d.ts.map +1 -1
- package/dist/mcp/UserContextCache.js +23 -23
- package/dist/mcp/UserContextCache.js.map +1 -1
- package/dist/mcp/auth.js.map +1 -1
- package/dist/mcp/hailer-clients.d.ts +5 -4
- package/dist/mcp/hailer-clients.d.ts.map +1 -1
- package/dist/mcp/hailer-clients.js +61 -27
- package/dist/mcp/hailer-clients.js.map +1 -1
- package/dist/mcp/hailer-rpc.d.ts +40 -0
- package/dist/mcp/hailer-rpc.d.ts.map +1 -0
- package/dist/mcp/hailer-rpc.js +43 -0
- package/dist/mcp/hailer-rpc.js.map +1 -0
- package/dist/mcp/publish-auth-injector.d.ts +22 -0
- package/dist/mcp/publish-auth-injector.d.ts.map +1 -0
- package/dist/mcp/publish-auth-injector.js +100 -0
- package/dist/mcp/publish-auth-injector.js.map +1 -0
- package/dist/mcp/session-store.d.ts +16 -16
- package/dist/mcp/session-store.d.ts.map +1 -1
- package/dist/mcp/session-store.js +16 -16
- package/dist/mcp/session-store.js.map +1 -1
- package/dist/mcp/tool-profiles.d.ts +69 -0
- package/dist/mcp/tool-profiles.d.ts.map +1 -0
- package/dist/mcp/tool-profiles.js +176 -0
- package/dist/mcp/tool-profiles.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +16 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +91 -39
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/activity.d.ts.map +1 -1
- package/dist/mcp/tools/activity.js +398 -198
- package/dist/mcp/tools/activity.js.map +1 -1
- package/dist/mcp/tools/aliases.d.ts +11 -0
- package/dist/mcp/tools/aliases.d.ts.map +1 -0
- package/dist/mcp/tools/aliases.js +176 -0
- package/dist/mcp/tools/aliases.js.map +1 -0
- package/dist/mcp/tools/app-core.d.ts +6 -8
- package/dist/mcp/tools/app-core.d.ts.map +1 -1
- package/dist/mcp/tools/app-core.js +355 -254
- package/dist/mcp/tools/app-core.js.map +1 -1
- package/dist/mcp/tools/app-marketplace.d.ts +8 -16
- package/dist/mcp/tools/app-marketplace.d.ts.map +1 -1
- package/dist/mcp/tools/app-marketplace.js +604 -930
- package/dist/mcp/tools/app-marketplace.js.map +1 -1
- package/dist/mcp/tools/app.d.ts +4 -7
- package/dist/mcp/tools/app.d.ts.map +1 -1
- package/dist/mcp/tools/app.js +4 -7
- package/dist/mcp/tools/app.js.map +1 -1
- package/dist/mcp/tools/bot-self.d.ts +21 -0
- package/dist/mcp/tools/bot-self.d.ts.map +1 -0
- package/dist/mcp/tools/bot-self.js +174 -0
- package/dist/mcp/tools/bot-self.js.map +1 -0
- package/dist/mcp/tools/calendar.d.ts +21 -0
- package/dist/mcp/tools/calendar.d.ts.map +1 -0
- package/dist/mcp/tools/calendar.js +741 -0
- package/dist/mcp/tools/calendar.js.map +1 -0
- package/dist/mcp/tools/company.d.ts.map +1 -1
- package/dist/mcp/tools/company.js +2 -1
- package/dist/mcp/tools/company.js.map +1 -1
- package/dist/mcp/tools/date.js.map +1 -1
- package/dist/mcp/tools/discussion.d.ts +23 -3
- package/dist/mcp/tools/discussion.d.ts.map +1 -1
- package/dist/mcp/tools/discussion.js +417 -534
- package/dist/mcp/tools/discussion.js.map +1 -1
- package/dist/mcp/tools/file.d.ts.map +1 -1
- package/dist/mcp/tools/file.js +18 -16
- package/dist/mcp/tools/file.js.map +1 -1
- package/dist/mcp/tools/index.js +4 -4
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/insight.d.ts +7 -5
- package/dist/mcp/tools/insight.d.ts.map +1 -1
- package/dist/mcp/tools/insight.js +419 -477
- package/dist/mcp/tools/insight.js.map +1 -1
- package/dist/mcp/tools/user.d.ts.map +1 -1
- package/dist/mcp/tools/user.js +15 -13
- package/dist/mcp/tools/user.js.map +1 -1
- package/dist/mcp/tools/workflow-permissions.d.ts +2 -4
- package/dist/mcp/tools/workflow-permissions.d.ts.map +1 -1
- package/dist/mcp/tools/workflow-permissions.js +88 -97
- package/dist/mcp/tools/workflow-permissions.js.map +1 -1
- package/dist/mcp/tools/workflow.d.ts +2 -7
- package/dist/mcp/tools/workflow.d.ts.map +1 -1
- package/dist/mcp/tools/workflow.js +817 -850
- package/dist/mcp/tools/workflow.js.map +1 -1
- package/dist/mcp/utils/api-errors.d.ts.map +1 -1
- package/dist/mcp/utils/api-errors.js +2 -2
- package/dist/mcp/utils/api-errors.js.map +1 -1
- package/dist/mcp/utils/data-transformers.d.ts.map +1 -1
- package/dist/mcp/utils/data-transformers.js +8 -4
- package/dist/mcp/utils/data-transformers.js.map +1 -1
- package/dist/mcp/utils/file-upload.d.ts.map +1 -1
- package/dist/mcp/utils/file-upload.js +1 -1
- package/dist/mcp/utils/file-upload.js.map +1 -1
- package/dist/mcp/utils/hailer-api-client.d.ts +81 -81
- package/dist/mcp/utils/hailer-api-client.d.ts.map +1 -1
- package/dist/mcp/utils/hailer-api-client.js +103 -101
- package/dist/mcp/utils/hailer-api-client.js.map +1 -1
- package/dist/mcp/utils/index.d.ts.map +1 -1
- package/dist/mcp/utils/index.js.map +1 -1
- package/dist/mcp/utils/logger.d.ts.map +1 -1
- package/dist/mcp/utils/logger.js.map +1 -1
- package/dist/mcp/utils/response-builder.d.ts.map +1 -1
- package/dist/mcp/utils/response-builder.js +8 -4
- package/dist/mcp/utils/response-builder.js.map +1 -1
- package/dist/mcp/utils/role-utils.d.ts.map +1 -1
- package/dist/mcp/utils/role-utils.js +6 -3
- package/dist/mcp/utils/role-utils.js.map +1 -1
- package/dist/mcp/utils/tool-helpers.d.ts.map +1 -1
- package/dist/mcp/utils/tool-helpers.js +2 -2
- package/dist/mcp/utils/tool-helpers.js.map +1 -1
- package/dist/mcp/utils/types.d.ts +1 -1
- package/dist/mcp/utils/types.d.ts.map +1 -1
- package/dist/mcp/utils/types.js.map +1 -1
- package/dist/mcp/webhook-handler.d.ts +43 -8
- package/dist/mcp/webhook-handler.d.ts.map +1 -1
- package/dist/mcp/webhook-handler.js +861 -116
- package/dist/mcp/webhook-handler.js.map +1 -1
- package/dist/mcp/workspace-admin-store.d.ts +49 -0
- package/dist/mcp/workspace-admin-store.d.ts.map +1 -0
- package/dist/mcp/workspace-admin-store.js +168 -0
- package/dist/mcp/workspace-admin-store.js.map +1 -0
- package/dist/mcp/workspace-cache.d.ts +2 -2
- package/dist/mcp/workspace-cache.d.ts.map +1 -1
- package/dist/mcp/workspace-cache.js +9 -5
- package/dist/mcp/workspace-cache.js.map +1 -1
- package/dist/mcp-server.d.ts +26 -11
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +360 -36
- package/dist/mcp-server.js.map +1 -1
- package/dist/plugins/vipunen/client.d.ts +41 -41
- package/dist/plugins/vipunen/client.d.ts.map +1 -1
- package/dist/plugins/vipunen/client.js +53 -48
- package/dist/plugins/vipunen/client.js.map +1 -1
- package/dist/plugins/vipunen/index.js.map +1 -1
- package/dist/plugins/vipunen/tools.d.ts.map +1 -1
- package/dist/plugins/vipunen/tools.js +6 -3
- package/dist/plugins/vipunen/tools.js.map +1 -1
- package/dist/public-chat/graduate.d.ts +29 -0
- package/dist/public-chat/graduate.d.ts.map +1 -0
- package/dist/public-chat/graduate.js +593 -0
- package/dist/public-chat/graduate.js.map +1 -0
- package/dist/public-chat/handler.d.ts +12 -0
- package/dist/public-chat/handler.d.ts.map +1 -0
- package/dist/public-chat/handler.js +179 -0
- package/dist/public-chat/handler.js.map +1 -0
- package/dist/public-chat/index.d.ts +16 -0
- package/dist/public-chat/index.d.ts.map +1 -0
- package/dist/public-chat/index.js +74 -0
- package/dist/public-chat/index.js.map +1 -0
- package/dist/public-chat/knowledge.d.ts +3 -0
- package/dist/public-chat/knowledge.d.ts.map +1 -0
- package/dist/public-chat/knowledge.js +1341 -0
- package/dist/public-chat/knowledge.js.map +1 -0
- package/dist/public-chat/rate-limit.d.ts +16 -0
- package/dist/public-chat/rate-limit.d.ts.map +1 -0
- package/dist/public-chat/rate-limit.js +51 -0
- package/dist/public-chat/rate-limit.js.map +1 -0
- package/dist/public-chat/session-store.d.ts +41 -0
- package/dist/public-chat/session-store.d.ts.map +1 -0
- package/dist/public-chat/session-store.js +95 -0
- package/dist/public-chat/session-store.js.map +1 -0
- package/dist/public-chat/studio-prewarm.d.ts +61 -0
- package/dist/public-chat/studio-prewarm.d.ts.map +1 -0
- package/dist/public-chat/studio-prewarm.js +162 -0
- package/dist/public-chat/studio-prewarm.js.map +1 -0
- package/dist/public-chat/system-prompt.d.ts +22 -0
- package/dist/public-chat/system-prompt.d.ts.map +1 -0
- package/dist/public-chat/system-prompt.js +428 -0
- package/dist/public-chat/system-prompt.js.map +1 -0
- package/package.json +14 -7
- package/scripts/build-public-chat-knowledge.py +101 -0
- package/scripts/probe-mcp-pricing.ts +52 -0
- package/scripts/smoke-public-chat-live.ts +148 -0
- package/scripts/smoke-public-chat.ts +110 -0
- package/.claude/CLAUDE.md +0 -126
- package/.claude/commands/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,370 @@
|
|
|
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.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
|
+
if (showPublic) {
|
|
125
|
+
responseText += `💡 Try \`browse_marketplace()\` without \`publicOnly: true\` to see private workspace products.\n`;
|
|
126
|
+
}
|
|
127
|
+
if (!showPublic) {
|
|
128
|
+
responseText += `💡 Use \`publish_marketplace\` to publish an app or template.\n`;
|
|
129
|
+
}
|
|
130
|
+
return textResponse(responseText);
|
|
131
|
+
}
|
|
132
|
+
responseText += `**Total Products:** ${products.length}\n\n`;
|
|
133
|
+
products.forEach((product, index) => {
|
|
134
|
+
responseText += `### ${index + 1}. ${product.name || 'Unnamed Product'}\n`;
|
|
135
|
+
responseText += `- **ID:** \`${product._id || product.id || 'N/A'}\`\n`;
|
|
136
|
+
if (product.type) {
|
|
137
|
+
responseText += `- **Type:** ${product.type}\n`;
|
|
157
138
|
}
|
|
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`;
|
|
139
|
+
if (product.description) {
|
|
140
|
+
responseText += `- **Description:** ${product.description}\n`;
|
|
181
141
|
}
|
|
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
|
-
};
|
|
142
|
+
if (product.creator) {
|
|
143
|
+
responseText += `- **Creator:** ${product.creator}\n`;
|
|
200
144
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
145
|
+
if (product.version) {
|
|
146
|
+
responseText += `- **Version:** ${product.version}\n`;
|
|
147
|
+
}
|
|
148
|
+
if (product.icon) {
|
|
149
|
+
responseText += `- **Icon:** \`${product.icon}\`\n`;
|
|
150
|
+
}
|
|
151
|
+
if (product.images && product.images.length > 0) {
|
|
152
|
+
responseText += `- **Images:** ${product.images.map((img) => `\`${img}\``).join(', ')}\n`;
|
|
153
|
+
}
|
|
154
|
+
responseText += `\n`;
|
|
155
|
+
});
|
|
156
|
+
responseText += `💡 **Next Steps:**\n`;
|
|
157
|
+
responseText += `- Use \`browse_marketplace({ productId })\` to see product details\n`;
|
|
158
|
+
responseText += `- Use \`install_marketplace({ productId })\` to install a product`;
|
|
159
|
+
return textResponse(responseText);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
163
|
+
logger.error('Error listing marketplace products', error);
|
|
164
|
+
}
|
|
165
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
166
|
+
return textResponse(`❌ **Error listing marketplace products**\n\n**Error:** ${errorMessage}\n\n` +
|
|
167
|
+
`**Common Issues:**\n- API endpoint not available\n- Permission issues`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function buildManifestSection(productId, source, context) {
|
|
171
|
+
try {
|
|
172
|
+
const manifest = await fetchProductManifest(productId, source, context);
|
|
173
|
+
logger.debug('Product manifest response', { manifest: JSON.stringify(manifest) });
|
|
174
|
+
if (!manifest) {
|
|
175
|
+
return '';
|
|
176
|
+
}
|
|
177
|
+
return `\n**Manifest:**\n\`\`\`json\n${JSON.stringify(manifest, null, 2)}\n\`\`\`\n`;
|
|
178
|
+
}
|
|
179
|
+
catch (manifestError) {
|
|
180
|
+
logger.debug('Could not fetch manifest', { error: manifestError });
|
|
181
|
+
return `\n⚠️ Manifest could not be fetched for this product.\n`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function checkTemplateInstalled(productId, context) {
|
|
185
|
+
if (!context.workspaceCache) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const workspaceId = context.workspaceCache.currentWorkspace._id;
|
|
190
|
+
const installed = await context.hailer.request('v2.network.product.isProductInstalled', [
|
|
191
|
+
productId,
|
|
192
|
+
workspaceId
|
|
193
|
+
]);
|
|
194
|
+
logger.debug('Template installation check', { installed: JSON.stringify(installed) });
|
|
195
|
+
return installed || null;
|
|
196
|
+
}
|
|
197
|
+
catch (installCheckError) {
|
|
198
|
+
logger.debug('Could not check installation status', { error: installCheckError });
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function buildInstalledSection(installedInfo) {
|
|
203
|
+
if (!installedInfo) {
|
|
204
|
+
return '';
|
|
205
|
+
}
|
|
206
|
+
if (!installedInfo.installed) {
|
|
207
|
+
return `\n⚪ **Status:** Not installed in current workspace\n`;
|
|
208
|
+
}
|
|
209
|
+
if (installedInfo.appId) {
|
|
210
|
+
return `\n✅ **Status:** Installed in current workspace\n**App ID:** \`${installedInfo.appId}\`\n`;
|
|
211
|
+
}
|
|
212
|
+
return `\n✅ **Status:** Installed in current workspace\n`;
|
|
213
|
+
}
|
|
214
|
+
async function executeProductDetail(args, context) {
|
|
215
|
+
const productId = args.productId;
|
|
216
|
+
logger.debug('Getting marketplace product details', {
|
|
217
|
+
productId,
|
|
218
|
+
includeManifest: args.includeManifest,
|
|
219
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
220
|
+
});
|
|
221
|
+
try {
|
|
222
|
+
const detail = await fetchProductDetail(productId, context);
|
|
223
|
+
const product = detail.product;
|
|
224
|
+
logger.debug('Product detail response', {
|
|
225
|
+
source: detail.source,
|
|
226
|
+
result: JSON.stringify(product)
|
|
227
|
+
});
|
|
228
|
+
let responseText = `✅ **Product Details**\n\n`;
|
|
229
|
+
responseText += `**Product ID:** \`${productId}\`\n`;
|
|
230
|
+
if (product?.name) {
|
|
231
|
+
responseText += `**Name:** ${product.name}\n`;
|
|
232
|
+
}
|
|
233
|
+
if (product?.description) {
|
|
234
|
+
responseText += `**Description:** ${product.description}\n`;
|
|
235
|
+
}
|
|
236
|
+
if (product?.type) {
|
|
237
|
+
responseText += `**Type:** ${product.type}\n`;
|
|
238
|
+
}
|
|
239
|
+
if (product?.version) {
|
|
240
|
+
responseText += `**Version:** ${product.version}\n`;
|
|
241
|
+
}
|
|
242
|
+
if (product?.versions?.length) {
|
|
243
|
+
responseText += `**Versions:** ${product.versions.length}\n`;
|
|
244
|
+
}
|
|
245
|
+
if (detail.source === 'v2') {
|
|
246
|
+
responseText += `**Source:** Legacy template (v2)\n`;
|
|
247
|
+
}
|
|
248
|
+
if (args.includeManifest) {
|
|
249
|
+
responseText += await buildManifestSection(productId, detail.source, context);
|
|
250
|
+
}
|
|
251
|
+
if (detail.source === 'v2') {
|
|
252
|
+
responseText += buildInstalledSection(await checkTemplateInstalled(productId, context));
|
|
253
|
+
}
|
|
254
|
+
responseText += `\n💡 **Next Steps:**\n`;
|
|
255
|
+
responseText += `- Use \`install_marketplace({ productId: "${productId}" })\` to install this product\n`;
|
|
256
|
+
responseText += `- Use \`browse_marketplace()\` to see other products`;
|
|
257
|
+
return textResponse(responseText);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
261
|
+
logger.error('Error getting marketplace product', error);
|
|
262
|
+
}
|
|
263
|
+
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
264
|
+
if (errorMessage.toLowerCase().includes('not found')) {
|
|
265
|
+
return textResponse(`❌ **Product Not Found**\n\nProduct ID \`${productId}\` not found in marketplace.\n\n` +
|
|
266
|
+
`**Check:**\n- Product ID is correct\n- Product exists and is published\n\n` +
|
|
267
|
+
`💡 Use \`browse_marketplace()\` to see available products.`);
|
|
207
268
|
}
|
|
269
|
+
return textResponse(`❌ **Error getting product**\n\n**Error:** ${errorMessage}\n\n` +
|
|
270
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.browseMarketplaceTool = {
|
|
274
|
+
name: 'browse_marketplace',
|
|
275
|
+
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
276
|
+
description: browseMarketplaceDescription,
|
|
277
|
+
schema: browseMarketplaceSchema,
|
|
278
|
+
async execute(args, context) {
|
|
279
|
+
if (!args.productId) {
|
|
280
|
+
return executeListProducts(args, context);
|
|
281
|
+
}
|
|
282
|
+
return executeProductDetail(args, context);
|
|
208
283
|
}
|
|
209
284
|
};
|
|
210
285
|
// ============================================================================
|
|
211
|
-
// INSTALL
|
|
286
|
+
// INSTALL MARKETPLACE — install app or template products
|
|
212
287
|
// ============================================================================
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
288
|
+
const installMarketplaceDescription = `Install a marketplace product into a workspace. Handles both product types automatically: apps are installed ` +
|
|
289
|
+
`via the v3 app install; templates (packaged workflows) via the v2 template install, which adds the ` +
|
|
290
|
+
`template's workflows to the workspace. The product type is detected from the marketplace entry — legacy v2 ` +
|
|
291
|
+
`template IDs route to the template path. Already-installed products are reported instead of reinstalled.`;
|
|
292
|
+
async function persistInstallAdminCredentials(productId, workspaceId, context) {
|
|
293
|
+
try {
|
|
294
|
+
const identity = await (0, workspace_admin_store_1.resolveAdminIdentity)(context.hailer.getClient());
|
|
295
|
+
// Only persist the admin key for a verified admin — an unverified
|
|
296
|
+
// admin's key triggers the bot-invite doom loop downstream.
|
|
297
|
+
if (!identity.emailVerified) {
|
|
298
|
+
logger.warn('Marketplace install: admin email not verified — not persisting admin credentials', {
|
|
299
|
+
workspaceId,
|
|
300
|
+
adminUid: identity.uid
|
|
301
|
+
});
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
(0, workspace_admin_store_1.persistAdminCredentials)(workspaceId, context.apiKey, identity);
|
|
305
|
+
}
|
|
306
|
+
catch (persistError) {
|
|
307
|
+
// Install already succeeded — surface the failure with enough context to trace
|
|
308
|
+
// popup-auth breakage back to this install instead of swallowing it.
|
|
309
|
+
logger.warn('Marketplace install: failed to persist admin credentials — popup auth may need admin re-authorization', {
|
|
310
|
+
workspaceId,
|
|
311
|
+
productId,
|
|
312
|
+
error: persistError instanceof Error ? persistError.message : String(persistError)
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async function findExistingInstall(productId, workspaceId, context) {
|
|
317
|
+
logger.debug('Checking if product is already installed', { productId, workspaceId });
|
|
318
|
+
try {
|
|
319
|
+
const isInstalledResult = await context.hailer.request('v3.app.product.isProductInstalled', [
|
|
320
|
+
productId,
|
|
321
|
+
workspaceId
|
|
322
|
+
]);
|
|
323
|
+
return isInstalledResult || null;
|
|
324
|
+
}
|
|
325
|
+
catch (checkError) {
|
|
326
|
+
// Ignore check errors and proceed with installation
|
|
327
|
+
logger.debug('Could not check installation status, proceeding', {
|
|
328
|
+
error: checkError instanceof Error ? checkError.message : String(checkError)
|
|
329
|
+
});
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async function installTemplateProduct(productId, workspaceId, context) {
|
|
334
|
+
logger.debug('Calling v2.network.product.install', { productId, workspaceId });
|
|
335
|
+
const result = await context.hailer.request('v2.network.product.install', [productId, workspaceId]);
|
|
336
|
+
logger.debug('Template installation response', { result: JSON.stringify(result) });
|
|
337
|
+
// Invalidate user context cache so subsequent workflow listings get fresh data
|
|
338
|
+
UserContextCache_1.UserContextCache.clearContext(context.apiKey);
|
|
339
|
+
logger.debug('Cleared user context cache after template install', {
|
|
340
|
+
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
341
|
+
});
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
async function installAppProduct(productId, workspaceId, context) {
|
|
345
|
+
logger.debug('Calling v3.app.product.install', { productId, workspaceId });
|
|
346
|
+
const installResult = await context.hailer.request('v3.app.product.install', [productId, workspaceId]);
|
|
347
|
+
logger.debug('Install result', { result: JSON.stringify(installResult) });
|
|
348
|
+
await persistInstallAdminCredentials(productId, workspaceId, context);
|
|
349
|
+
return installResult;
|
|
350
|
+
}
|
|
351
|
+
exports.installMarketplaceTool = {
|
|
352
|
+
name: 'install_marketplace',
|
|
216
353
|
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
217
|
-
description:
|
|
354
|
+
description: installMarketplaceDescription,
|
|
218
355
|
schema: zod_1.z.object({
|
|
219
|
-
|
|
356
|
+
productId: zod_1.z
|
|
220
357
|
.string()
|
|
221
358
|
.min(1)
|
|
222
|
-
.describe(
|
|
359
|
+
.describe('Marketplace product ID to install'),
|
|
223
360
|
workspaceId: zod_1.z
|
|
224
361
|
.string()
|
|
225
362
|
.optional()
|
|
226
|
-
.describe(
|
|
363
|
+
.describe('Target workspace ID (defaults to current)'),
|
|
227
364
|
}),
|
|
228
365
|
async execute(args, context) {
|
|
229
|
-
logger.debug('Installing marketplace
|
|
230
|
-
|
|
231
|
-
workspaceId: args.workspaceId,
|
|
366
|
+
logger.debug('Installing marketplace product', {
|
|
367
|
+
productId: args.productId,
|
|
232
368
|
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
233
369
|
});
|
|
234
370
|
try {
|
|
@@ -236,242 +372,205 @@ exports.installTemplateTool = {
|
|
|
236
372
|
if (!workspaceId) {
|
|
237
373
|
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
238
374
|
}
|
|
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`;
|
|
375
|
+
const existing = await findExistingInstall(args.productId, workspaceId, context);
|
|
376
|
+
if (existing?.installed) {
|
|
377
|
+
return textResponse(`ℹ️ **Product Already Installed**\n\nThis product is already installed in your workspace.\n\n` +
|
|
378
|
+
`**App ID:** \`${existing.appId || 'unknown'}\`\n\n**Tips:**\n- Use \`list_apps()\` to see installed apps\n` +
|
|
379
|
+
`- Use \`browse_marketplace({ productId: "${args.productId}" })\` to view product details`);
|
|
261
380
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
};
|
|
291
|
-
}
|
|
292
|
-
if (errorMessage.toLowerCase().includes('already installed')) {
|
|
293
|
-
return {
|
|
294
|
-
content: [{
|
|
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
|
|
381
|
+
// Detect product type to route v2 template install vs v3 app install
|
|
382
|
+
let productName = 'Unknown';
|
|
383
|
+
let productType = 'app';
|
|
354
384
|
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 });
|
|
385
|
+
const detail = await fetchProductDetail(args.productId, context);
|
|
386
|
+
productName = detail.product?.name || detail.product?.title || 'Unknown';
|
|
387
|
+
productType = resolveProductType(detail.source, detail.product);
|
|
365
388
|
}
|
|
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
|
-
}
|
|
389
|
+
catch (productError) {
|
|
390
|
+
logger.debug('Could not fetch product details, defaulting to app install', {
|
|
391
|
+
error: productError instanceof Error ? productError.message : String(productError)
|
|
392
|
+
});
|
|
387
393
|
}
|
|
388
|
-
|
|
389
|
-
|
|
394
|
+
const installResult = productType === 'template'
|
|
395
|
+
? await installTemplateProduct(args.productId, workspaceId, context)
|
|
396
|
+
: await installAppProduct(args.productId, workspaceId, context);
|
|
397
|
+
const installedAppId = installResult?.appId || installResult?.details?.appId || installResult?._id;
|
|
398
|
+
let responseText = `✅ **${productType === 'template' ? 'Template' : 'App'} Installed Successfully**\n\n`;
|
|
399
|
+
responseText += `**Product:** ${productName}\n`;
|
|
400
|
+
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
401
|
+
if (installedAppId) {
|
|
402
|
+
responseText += `**Installed App ID:** \`${installedAppId}\`\n`;
|
|
390
403
|
}
|
|
404
|
+
responseText += `**Workspace:** \`${workspaceId}\`\n`;
|
|
391
405
|
responseText += `\n💡 **Next Steps:**\n`;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}],
|
|
399
|
-
};
|
|
406
|
+
if (productType === 'template') {
|
|
407
|
+
responseText += `- Use \`list_workflows\` to see new workflow(s)\n`;
|
|
408
|
+
}
|
|
409
|
+
responseText += `- Use \`list_apps()\` to see installed app(s)\n`;
|
|
410
|
+
responseText += `- Use \`manage_app\` with action 'add_member' to share with workspace members\n`;
|
|
411
|
+
return textResponse(responseText);
|
|
400
412
|
}
|
|
401
413
|
catch (error) {
|
|
402
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
403
|
-
logger.error(
|
|
414
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
415
|
+
logger.error('Error installing marketplace product', error);
|
|
416
|
+
}
|
|
404
417
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
418
|
+
if (errorMessage.toLowerCase().includes('permission')) {
|
|
419
|
+
return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to install marketplace products. ` +
|
|
420
|
+
`Only workspace administrators can install.\n\n**Error:** ${errorMessage}`);
|
|
421
|
+
}
|
|
405
422
|
if (errorMessage.toLowerCase().includes('not found')) {
|
|
406
|
-
return {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}],
|
|
411
|
-
};
|
|
423
|
+
return textResponse(`❌ **Product Not Found**\n\nThe marketplace product \`${args.productId}\` was not found.\n\n` +
|
|
424
|
+
`**Tips:**\n- Verify the product ID is correct\n` +
|
|
425
|
+
`- Use \`browse_marketplace({ productId: "${args.productId}" })\` to check if the product exists\n\n` +
|
|
426
|
+
`**Error:** ${errorMessage}`);
|
|
412
427
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
428
|
+
if (errorMessage.toLowerCase().includes('already installed')) {
|
|
429
|
+
return textResponse(`⚠️ **Product Already Installed**\n\nThis product is already installed in the workspace.\n\n` +
|
|
430
|
+
`**Product ID:** \`${args.productId}\`\n\n💡 Use \`list_apps\` to see installed apps.`);
|
|
431
|
+
}
|
|
432
|
+
return textResponse(`❌ **Error installing marketplace product**\n\n**Error:** ${errorMessage}\n\n` +
|
|
433
|
+
`**Common Issues:**\n- Invalid product ID\n- Product not found in marketplace\n- Insufficient permissions`);
|
|
419
434
|
}
|
|
420
435
|
}
|
|
421
436
|
};
|
|
422
437
|
// ============================================================================
|
|
423
|
-
// PUBLISH
|
|
438
|
+
// PUBLISH MARKETPLACE — publish/update app or template listings
|
|
424
439
|
// ============================================================================
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
440
|
+
const publishMarketplaceDescription = `Publish an app or workspace template to the Hailer marketplace, or update an existing listing.\n\n` +
|
|
441
|
+
`type 'app': requires the appId of a production app (empty url — dev/localhost apps are rejected). Creating ` +
|
|
442
|
+
`a NEW app listing also requires versionId — the targetId written to public/manifest.json by ` +
|
|
443
|
+
`\`npm run publish-production -- --market\`. type 'template': packages the current workspace as an installable template (step 1 ` +
|
|
444
|
+
`creates the v2 template manifest, step 2 the marketplace listing).\n\n` +
|
|
445
|
+
`Pass productId to UPDATE an existing listing's metadata (name, description, publisher, icon, images, ` +
|
|
446
|
+
`externalUrl) — no version bump needed. Omit productId to CREATE a new listing. Upload iconFileId / ` +
|
|
447
|
+
`imageFileIds via \`upload_files\` first.`;
|
|
448
|
+
const publishMarketplaceSchema = zod_1.z.object({
|
|
449
|
+
type: zod_1.z
|
|
450
|
+
.enum(['app', 'template'])
|
|
451
|
+
.describe("What to publish: 'app' (requires appId; new listings also need versionId) or 'template' (packages the current workspace)"),
|
|
452
|
+
appId: zod_1.z
|
|
453
|
+
.string()
|
|
454
|
+
.length(24)
|
|
455
|
+
.optional()
|
|
456
|
+
.describe("App ID to publish (24 chars). Required when type is 'app'"),
|
|
457
|
+
productId: zod_1.z
|
|
458
|
+
.string()
|
|
459
|
+
.length(24)
|
|
460
|
+
.optional()
|
|
461
|
+
.describe('Existing marketplace product ID to UPDATE (omit to create a new listing)'),
|
|
462
|
+
versionId: zod_1.z
|
|
463
|
+
.string()
|
|
464
|
+
.length(24)
|
|
465
|
+
.optional()
|
|
466
|
+
.describe('App version ID used as the listing targetId — written to public/manifest.json by ' +
|
|
467
|
+
'`npm run publish-production -- --market`. Required for NEW app listings'),
|
|
468
|
+
title: zod_1.z
|
|
469
|
+
.string()
|
|
470
|
+
.min(1)
|
|
471
|
+
.max(64)
|
|
472
|
+
.describe('Marketplace listing name (max 64 chars)'),
|
|
473
|
+
description: zod_1.z
|
|
474
|
+
.string()
|
|
475
|
+
.min(1)
|
|
476
|
+
.max(4096)
|
|
477
|
+
.describe('Full listing description (max 4096 chars)'),
|
|
478
|
+
version: zod_1.z
|
|
479
|
+
.string()
|
|
480
|
+
.min(1)
|
|
481
|
+
.describe("Version string (e.g. '1.0.0')"),
|
|
482
|
+
versionDescription: zod_1.z
|
|
483
|
+
.string()
|
|
484
|
+
.min(1)
|
|
485
|
+
.describe('Release notes for this version'),
|
|
486
|
+
publisher: zod_1.z
|
|
487
|
+
.string()
|
|
488
|
+
.min(1)
|
|
489
|
+
.describe('Publishing company or person name'),
|
|
490
|
+
iconFileId: zod_1.z
|
|
491
|
+
.string()
|
|
492
|
+
.length(24)
|
|
493
|
+
.describe('Icon file ID (24 chars). Upload with upload_files first'),
|
|
494
|
+
imageFileIds: zod_1.z
|
|
495
|
+
.array(zod_1.z.string().length(24))
|
|
496
|
+
.optional()
|
|
497
|
+
.describe('Optional array of preview image file IDs'),
|
|
498
|
+
externalUrl: zod_1.z
|
|
499
|
+
.string()
|
|
500
|
+
.url()
|
|
501
|
+
.optional()
|
|
502
|
+
.describe('Optional external website/documentation URL'),
|
|
503
|
+
workflowId: zod_1.z
|
|
504
|
+
.string()
|
|
505
|
+
.optional()
|
|
506
|
+
.describe('Template creation only: source workflow ID. Note: the API manifests the whole workspace; ' +
|
|
507
|
+
'workflow attachment is finalized in the Hailer UI'),
|
|
508
|
+
});
|
|
509
|
+
async function verifyPublishableApp(appId, context) {
|
|
510
|
+
logger.debug('Fetching app details', { appId });
|
|
511
|
+
const appResult = await context.hailer.request('v3.app.list', [{}]);
|
|
512
|
+
const apps = appResult?.apps || appResult?.details?.apps || (Array.isArray(appResult) ? appResult : []);
|
|
513
|
+
const app = Array.isArray(apps) ? apps.find((entry) => entry._id === appId) : null;
|
|
514
|
+
if (!app) {
|
|
515
|
+
return {
|
|
516
|
+
errorResponse: textResponse(`❌ **App Not Found**\n\nApp ID \`${appId}\` was not found in the current workspace.\n\n` +
|
|
517
|
+
`**Tips:**\n- Use \`list_apps()\` to see available apps\n- Ensure the app exists and you have access`)
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
// Dev apps (localhost URL) can't be listed on the marketplace
|
|
521
|
+
if (app.url && app.url.includes('localhost')) {
|
|
522
|
+
return {
|
|
523
|
+
errorResponse: textResponse(`⚠️ **Cannot Publish Development App**\n\nApp "${app.name}" is a development app (URL: ${app.url}).\n\n` +
|
|
524
|
+
`**To publish to marketplace:**\n1. First publish the app code: \`npm run publish-production -- --market\`\n` +
|
|
525
|
+
`2. Or create a production app with empty URL\n3. Then call \`publish_marketplace\` again`)
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
return { appName: app.name };
|
|
529
|
+
}
|
|
530
|
+
async function createTemplateManifest(args, workspaceId, context) {
|
|
531
|
+
// Note: versionDescription is required and cannot be empty
|
|
532
|
+
const publishData = {
|
|
533
|
+
workspaceId,
|
|
534
|
+
version: args.version,
|
|
535
|
+
versionDescription: args.versionDescription,
|
|
536
|
+
title: args.title,
|
|
537
|
+
description: args.description
|
|
538
|
+
};
|
|
539
|
+
logger.debug('Calling v2.network.product.publishTemplate', { publishData });
|
|
540
|
+
const publishResult = await context.hailer.request('v2.network.product.publishTemplate', [publishData]);
|
|
541
|
+
logger.debug('Publish template response', { result: JSON.stringify(publishResult) });
|
|
542
|
+
const targetId = publishResult?.productId || publishResult?._id || publishResult?.id;
|
|
543
|
+
if (!targetId) {
|
|
544
|
+
return {
|
|
545
|
+
errorResponse: textResponse(`❌ **Error**: publishTemplate succeeded but no product ID returned.\n\n` +
|
|
546
|
+
`**Response:**\n\`\`\`json\n${JSON.stringify(publishResult, null, 2)}\n\`\`\``)
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
return { targetId };
|
|
550
|
+
}
|
|
551
|
+
function buildListingData(args) {
|
|
552
|
+
const productData = {
|
|
553
|
+
name: args.title,
|
|
554
|
+
description: args.description,
|
|
555
|
+
publisher: args.publisher,
|
|
556
|
+
icon: args.iconFileId,
|
|
557
|
+
images: args.imageFileIds || [args.iconFileId]
|
|
558
|
+
};
|
|
559
|
+
if (args.externalUrl) {
|
|
560
|
+
productData.externalUrl = args.externalUrl;
|
|
561
|
+
}
|
|
562
|
+
return productData;
|
|
563
|
+
}
|
|
564
|
+
exports.publishMarketplaceTool = {
|
|
565
|
+
name: 'publish_marketplace',
|
|
428
566
|
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
|
-
}),
|
|
567
|
+
description: publishMarketplaceDescription,
|
|
568
|
+
schema: publishMarketplaceSchema,
|
|
472
569
|
async execute(args, context) {
|
|
473
570
|
const isUpdate = !!args.productId;
|
|
474
|
-
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'}
|
|
571
|
+
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} marketplace listing`, {
|
|
572
|
+
type: args.type,
|
|
573
|
+
appId: args.appId,
|
|
475
574
|
title: args.title,
|
|
476
575
|
version: args.version,
|
|
477
576
|
productId: args.productId,
|
|
@@ -482,558 +581,133 @@ exports.publishTemplateTool = {
|
|
|
482
581
|
if (!workspaceId) {
|
|
483
582
|
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
484
583
|
}
|
|
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
|
-
};
|
|
584
|
+
if (args.type === 'app' && !args.appId) {
|
|
585
|
+
return textResponse(`❌ **Missing appId**\n\n\`appId\` is required when \`type\` is 'app'.`);
|
|
586
|
+
}
|
|
587
|
+
let appName = '';
|
|
588
|
+
if (args.type === 'app') {
|
|
589
|
+
const appCheck = await verifyPublishableApp(args.appId, context);
|
|
590
|
+
if (appCheck.errorResponse) {
|
|
591
|
+
return appCheck.errorResponse;
|
|
592
|
+
}
|
|
593
|
+
appName = appCheck.appName || '';
|
|
594
|
+
}
|
|
595
|
+
// For new app listings we need the targetId from a --market publish
|
|
596
|
+
if (args.type === 'app' && !isUpdate && !args.versionId) {
|
|
597
|
+
return textResponse(`❌ **Error**: Missing required IDs.\n\n**To create a new app marketplace listing:**\n` +
|
|
598
|
+
`1. Run \`npm run publish-production -- --market\` — the targetId is saved to public/manifest.json\n` +
|
|
599
|
+
`2. Then run \`publish_marketplace\` with \`type: 'app'\` and the \`versionId\` (targetId)\n\n` +
|
|
600
|
+
`**To update existing listing metadata (icon, name, etc.):**\n` +
|
|
601
|
+
`Include the \`productId\` parameter - no version bump needed.`);
|
|
602
|
+
}
|
|
603
|
+
// Step 1 (template create only): manifest the current workspace via v2
|
|
604
|
+
let targetId = args.versionId;
|
|
605
|
+
if (args.type === 'template' && !isUpdate) {
|
|
606
|
+
const stepOne = await createTemplateManifest(args, workspaceId, context);
|
|
607
|
+
if (stepOne.errorResponse) {
|
|
608
|
+
return stepOne.errorResponse;
|
|
512
609
|
}
|
|
610
|
+
targetId = stepOne.targetId;
|
|
513
611
|
}
|
|
514
|
-
// Step 2:
|
|
515
|
-
|
|
516
|
-
let apiMethod;
|
|
517
|
-
let apiArgs;
|
|
612
|
+
// Step 2: create or update the marketplace listing via v3
|
|
613
|
+
const productData = buildListingData(args);
|
|
614
|
+
let apiMethod = 'v3.product.create';
|
|
615
|
+
let apiArgs = [{ cid: workspaceId, targetId, type: args.type, ...productData }];
|
|
518
616
|
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
617
|
apiMethod = 'v3.product.update';
|
|
531
|
-
apiArgs = [productId, productData];
|
|
618
|
+
apiArgs = [args.productId, productData];
|
|
532
619
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
620
|
+
logger.debug(`Calling ${apiMethod}`, {
|
|
621
|
+
productId: args.productId,
|
|
622
|
+
workspaceId,
|
|
623
|
+
appId: args.appId,
|
|
624
|
+
targetId,
|
|
625
|
+
iconFileId: args.iconFileId
|
|
626
|
+
});
|
|
627
|
+
let apiResult;
|
|
628
|
+
try {
|
|
629
|
+
apiResult = await context.hailer.request(apiMethod, apiArgs);
|
|
630
|
+
}
|
|
631
|
+
catch (stepTwoError) {
|
|
632
|
+
const stepTwoMessage = (0, tool_helpers_1.extractErrorMessage)(stepTwoError);
|
|
633
|
+
// Fail-safe for the two-step template publish: step 1 (v2 manifest) succeeded,
|
|
634
|
+
// step 2 (v3 listing) failed — report the orphan instead of hiding it.
|
|
635
|
+
if (args.type === 'template' && !isUpdate) {
|
|
636
|
+
logger.error('publish_marketplace: v3 listing creation failed after v2 template manifest was created', {
|
|
637
|
+
orphanedV2ProductId: targetId,
|
|
638
|
+
workspaceId,
|
|
639
|
+
error: stepTwoMessage
|
|
640
|
+
});
|
|
641
|
+
return textResponse(`❌ **Marketplace listing creation failed after the template manifest was created**\n\n` +
|
|
642
|
+
`Step 1 (v2 template manifest) succeeded, but step 2 (v3 marketplace listing) failed.\n\n` +
|
|
643
|
+
`**Orphaned v2 product ID:** \`${targetId}\`\n` +
|
|
644
|
+
`**Step 2 error:** ${stepTwoMessage}\n\n` +
|
|
645
|
+
`**What to do:**\n` +
|
|
646
|
+
`- Fix the cause above, then re-run \`publish_marketplace\` — it will create a fresh manifest\n` +
|
|
647
|
+
`- The orphaned manifest \`${targetId}\` never appears in the marketplace; it is harmless ` +
|
|
648
|
+
`but can be cleaned up via the Hailer UI or support`);
|
|
547
649
|
}
|
|
548
|
-
|
|
549
|
-
apiArgs = [productData];
|
|
650
|
+
throw stepTwoError;
|
|
550
651
|
}
|
|
551
|
-
logger.debug(`Calling ${apiMethod}`, { productId, workspaceId, iconFileId: args.iconFileId });
|
|
552
|
-
const apiResult = await context.hailer.request(apiMethod, apiArgs);
|
|
553
652
|
logger.debug(`${apiMethod} response`, {
|
|
554
653
|
result: JSON.stringify(apiResult)
|
|
555
654
|
});
|
|
556
|
-
// Get the final product ID from the v3 API response (this is the
|
|
557
|
-
const finalProductId = apiResult?._id || apiResult?.id || productId;
|
|
558
|
-
|
|
655
|
+
// Get the final product ID from the v3 API response (this is the marketplace ID)
|
|
656
|
+
const finalProductId = apiResult?._id || apiResult?.id || args.productId || targetId;
|
|
657
|
+
const typeLabel = args.type === 'app' ? 'App' : 'Template';
|
|
658
|
+
let responseText = `✅ **${typeLabel} ${isUpdate ? 'Updated' : 'Published'} Successfully**\n\n`;
|
|
659
|
+
if (args.type === 'app') {
|
|
660
|
+
responseText += `**App:** ${appName} (\`${args.appId}\`)\n`;
|
|
661
|
+
}
|
|
559
662
|
responseText += `**Title:** ${args.title}\n`;
|
|
560
663
|
responseText += `**Publisher:** ${args.publisher}\n`;
|
|
561
664
|
responseText += `**Version:** ${args.version}\n`;
|
|
562
665
|
responseText += `**Workspace:** ${workspaceId}\n`;
|
|
563
666
|
responseText += `**Product ID:** \`${finalProductId}\`\n`;
|
|
564
667
|
responseText += `**Release Notes:** ${args.versionDescription}\n`;
|
|
668
|
+
if (args.type === 'template' && args.workflowId) {
|
|
669
|
+
responseText += `\n⚠️ **Note:** The publish API manifests the whole workspace — ` +
|
|
670
|
+
`attaching a specific workflow must be done via the Hailer UI.\n`;
|
|
671
|
+
}
|
|
565
672
|
responseText += `\n💡 **Next Steps:**\n`;
|
|
566
|
-
responseText += `- Use \`
|
|
673
|
+
responseText += `- Use \`browse_marketplace()\` to see it in the marketplace\n`;
|
|
567
674
|
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
|
-
};
|
|
675
|
+
responseText += `- They can install with \`install_marketplace({ productId: "${finalProductId}" })\`\n`;
|
|
676
|
+
responseText += `- To update this listing, include \`productId: "${finalProductId}"\` in the next publish\n`;
|
|
677
|
+
return textResponse(responseText);
|
|
575
678
|
}
|
|
576
679
|
catch (error) {
|
|
577
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
578
|
-
logger.error(
|
|
680
|
+
if (!request_logger_1.RequestLogger.getCurrent()) {
|
|
681
|
+
logger.error('Error publishing to marketplace', error);
|
|
682
|
+
}
|
|
579
683
|
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
580
684
|
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
|
-
};
|
|
685
|
+
return textResponse(`❌ **Permission Denied**\n\nYou don't have permission to publish to the marketplace. ` +
|
|
686
|
+
`Only workspace administrators can publish.\n\n**Error:** ${errorMessage}`);
|
|
587
687
|
}
|
|
588
688
|
// Always include debug info for troubleshooting
|
|
589
|
-
const debugWorkspaceId = context.workspaceCache?.currentWorkspace._id || 'unknown';
|
|
590
689
|
const debugInfo = {
|
|
591
|
-
|
|
690
|
+
type: args.type,
|
|
691
|
+
isUpdate,
|
|
592
692
|
requestData: {
|
|
593
|
-
workspaceId:
|
|
693
|
+
workspaceId: context.workspaceCache?.currentWorkspace._id || 'unknown',
|
|
594
694
|
version: args.version,
|
|
595
695
|
versionDescription: args.versionDescription,
|
|
596
696
|
title: args.title,
|
|
597
697
|
description: args.description
|
|
598
698
|
}
|
|
599
699
|
};
|
|
600
|
-
return {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}],
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
// =============================================================================
|
|
610
|
-
// GET PRODUCT (v3) TOOL
|
|
611
|
-
// =============================================================================
|
|
612
|
-
const getProductDescription = `Get product details from marketplace`;
|
|
613
|
-
exports.getProductTool = {
|
|
614
|
-
name: 'get_product',
|
|
615
|
-
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
616
|
-
description: getProductDescription,
|
|
617
|
-
schema: zod_1.z.object({
|
|
618
|
-
productId: zod_1.z
|
|
619
|
-
.string()
|
|
620
|
-
.length(24)
|
|
621
|
-
.describe("Product ID to get details for (24 characters)"),
|
|
622
|
-
}),
|
|
623
|
-
async execute(args, context) {
|
|
624
|
-
logger.debug('Getting product details (v3)', {
|
|
625
|
-
productId: args.productId,
|
|
626
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
627
|
-
});
|
|
628
|
-
try {
|
|
629
|
-
logger.debug('Calling v3.app.product.get', {
|
|
630
|
-
productId: args.productId
|
|
631
|
-
});
|
|
632
|
-
const result = await context.hailer.request('v3.app.product.get', [args.productId]);
|
|
633
|
-
logger.debug('Product get response', {
|
|
634
|
-
result: JSON.stringify(result)
|
|
635
|
-
});
|
|
636
|
-
const product = result;
|
|
637
|
-
let responseText = `✅ **Product Details (v3)**\n\n`;
|
|
638
|
-
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
639
|
-
if (product?.name) {
|
|
640
|
-
responseText += `**Name:** ${product.name}\n`;
|
|
641
|
-
}
|
|
642
|
-
if (product?.description) {
|
|
643
|
-
responseText += `**Description:** ${product.description}\n`;
|
|
644
|
-
}
|
|
645
|
-
if (product?.type) {
|
|
646
|
-
responseText += `**Type:** ${product.type}\n`;
|
|
647
|
-
}
|
|
648
|
-
if (product?.versions?.length) {
|
|
649
|
-
responseText += `**Versions:** ${product.versions.length}\n`;
|
|
650
|
-
}
|
|
651
|
-
return {
|
|
652
|
-
content: [{
|
|
653
|
-
type: "text",
|
|
654
|
-
text: responseText,
|
|
655
|
-
}],
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
catch (error) {
|
|
659
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
660
|
-
logger.error("Error getting product", error);
|
|
661
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
662
|
-
return {
|
|
663
|
-
content: [{
|
|
664
|
-
type: "text",
|
|
665
|
-
text: `❌ **Error getting product**\n\n**Error:** ${errorMessage}`,
|
|
666
|
-
}],
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
// =============================================================================
|
|
672
|
-
// GET PRODUCT MANIFEST (v3) TOOL
|
|
673
|
-
// =============================================================================
|
|
674
|
-
const getProductManifestDescription = `Get product manifest from marketplace`;
|
|
675
|
-
exports.getProductManifestTool = {
|
|
676
|
-
name: 'get_product_manifest',
|
|
677
|
-
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
678
|
-
description: getProductManifestDescription,
|
|
679
|
-
schema: zod_1.z.object({
|
|
680
|
-
productId: zod_1.z
|
|
681
|
-
.string()
|
|
682
|
-
.length(24)
|
|
683
|
-
.describe("Product ID to get manifest for (24 characters)"),
|
|
684
|
-
}),
|
|
685
|
-
async execute(args, context) {
|
|
686
|
-
logger.debug('Getting product manifest (v3)', {
|
|
687
|
-
productId: args.productId,
|
|
688
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
689
|
-
});
|
|
690
|
-
try {
|
|
691
|
-
logger.debug('Calling v3.app.product.getManifest', {
|
|
692
|
-
productId: args.productId
|
|
693
|
-
});
|
|
694
|
-
const result = await context.hailer.request('v3.app.product.getManifest', [args.productId]);
|
|
695
|
-
logger.debug('Product manifest response', {
|
|
696
|
-
result: JSON.stringify(result)
|
|
697
|
-
});
|
|
698
|
-
const manifest = result;
|
|
699
|
-
let responseText = `✅ **Product Manifest (v3)**\n\n`;
|
|
700
|
-
responseText += `**Product ID:** \`${args.productId}\`\n`;
|
|
701
|
-
if (manifest?.version) {
|
|
702
|
-
responseText += `**Version:** ${manifest.version}\n`;
|
|
703
|
-
}
|
|
704
|
-
if (manifest?.workflows?.length) {
|
|
705
|
-
responseText += `**Workflows:** ${manifest.workflows.length}\n`;
|
|
706
|
-
}
|
|
707
|
-
return {
|
|
708
|
-
content: [{
|
|
709
|
-
type: "text",
|
|
710
|
-
text: responseText,
|
|
711
|
-
}],
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
catch (error) {
|
|
715
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
716
|
-
logger.error("Error getting product manifest", error);
|
|
717
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
718
|
-
return {
|
|
719
|
-
content: [{
|
|
720
|
-
type: "text",
|
|
721
|
-
text: `❌ **Error getting product manifest**\n\n**Error:** ${errorMessage}`,
|
|
722
|
-
}],
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
// =============================================================================
|
|
728
|
-
// PUBLISH APP TO MARKETPLACE TOOL
|
|
729
|
-
// =============================================================================
|
|
730
|
-
const publishAppDescription = `Publish app to Hailer marketplace`;
|
|
731
|
-
exports.publishAppTool = {
|
|
732
|
-
name: 'publish_app',
|
|
733
|
-
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
734
|
-
description: publishAppDescription,
|
|
735
|
-
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
|
-
productId: zod_1.z
|
|
746
|
-
.string()
|
|
747
|
-
.length(24)
|
|
748
|
-
.optional()
|
|
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"),
|
|
785
|
-
}),
|
|
786
|
-
async execute(args, context) {
|
|
787
|
-
const isUpdate = !!args.productId;
|
|
788
|
-
logger.debug(`${isUpdate ? 'Updating' : 'Publishing'} app to marketplace`, {
|
|
789
|
-
appId: args.appId,
|
|
790
|
-
title: args.title,
|
|
791
|
-
version: args.version,
|
|
792
|
-
productId: args.productId,
|
|
793
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
794
|
-
});
|
|
795
|
-
try {
|
|
796
|
-
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)({}, context);
|
|
797
|
-
if (!workspaceId) {
|
|
798
|
-
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
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
|
-
};
|
|
894
|
-
}
|
|
895
|
-
catch (error) {
|
|
896
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
897
|
-
logger.error("Error publishing app to marketplace", error);
|
|
898
|
-
const errorMessage = (0, tool_helpers_1.extractErrorMessage)(error);
|
|
899
|
-
if (errorMessage.toLowerCase().includes('permission')) {
|
|
900
|
-
return {
|
|
901
|
-
content: [{
|
|
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
|
-
};
|
|
906
|
-
}
|
|
907
|
-
return {
|
|
908
|
-
content: [{
|
|
909
|
-
type: "text",
|
|
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
|
-
};
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
// =============================================================================
|
|
917
|
-
// INSTALL MARKETPLACE APP TOOL
|
|
918
|
-
// =============================================================================
|
|
919
|
-
const installMarketplaceAppDescription = `Install app from marketplace`;
|
|
920
|
-
exports.installMarketplaceAppTool = {
|
|
921
|
-
name: 'install_marketplace_app',
|
|
922
|
-
group: tool_registry_1.ToolGroup.PLAYGROUND,
|
|
923
|
-
description: installMarketplaceAppDescription,
|
|
924
|
-
schema: zod_1.z.object({
|
|
925
|
-
productId: zod_1.z
|
|
926
|
-
.string()
|
|
927
|
-
.length(24)
|
|
928
|
-
.describe("Marketplace product ID to install (24 characters)"),
|
|
929
|
-
workspaceId: zod_1.z
|
|
930
|
-
.string()
|
|
931
|
-
.optional()
|
|
932
|
-
.describe("Target workspace ID (defaults to current)"),
|
|
933
|
-
}),
|
|
934
|
-
async execute(args, context) {
|
|
935
|
-
logger.debug('Installing marketplace app', {
|
|
936
|
-
productId: args.productId,
|
|
937
|
-
apiKey: context.apiKey.substring(0, 8) + '...'
|
|
938
|
-
});
|
|
939
|
-
try {
|
|
940
|
-
const workspaceId = (0, tool_helpers_1.getResolvedWorkspaceId)(args, context);
|
|
941
|
-
if (!workspaceId) {
|
|
942
|
-
return (0, tool_helpers_1.missingWorkspaceCacheResponse)();
|
|
943
|
-
}
|
|
944
|
-
// Check if already installed
|
|
945
|
-
logger.debug('Checking if product is already installed', { productId: args.productId, workspaceId });
|
|
946
|
-
try {
|
|
947
|
-
const isInstalledResult = await context.hailer.request('v3.app.product.isProductInstalled', [args.productId, workspaceId]);
|
|
948
|
-
if (isInstalledResult?.installed) {
|
|
949
|
-
return {
|
|
950
|
-
content: [{
|
|
951
|
-
type: "text",
|
|
952
|
-
text: `ℹ️ **App Already Installed**\n\nThis app is already installed in your workspace.\n\n**App ID:** \`${isInstalledResult.appId || 'unknown'}\`\n\n**Tips:**\n- Use \`list_apps()\` to see installed apps\n- Use \`get_product({ productId: "${args.productId}" })\` to view product details`,
|
|
953
|
-
}],
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
catch (checkError) {
|
|
958
|
-
// Ignore check errors and proceed with installation
|
|
959
|
-
logger.debug('Could not check installation status, proceeding', {
|
|
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
|
-
};
|
|
997
|
-
}
|
|
998
|
-
catch (error) {
|
|
999
|
-
if (!request_logger_1.RequestLogger.getCurrent())
|
|
1000
|
-
logger.error("Error installing marketplace app", 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
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
return {
|
|
1019
|
-
content: [{
|
|
1020
|
-
type: "text",
|
|
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
|
-
};
|
|
700
|
+
return textResponse(`❌ **Error publishing to marketplace**\n\n**Error:** ${errorMessage}\n\n` +
|
|
701
|
+
`**Debug Info:**\n\`\`\`json\n${JSON.stringify(debugInfo, null, 2)}\n\`\`\`\n\n` +
|
|
702
|
+
`**Common Issues:**\n- Must be workspace administrator\n- Icon file must be uploaded first\n` +
|
|
703
|
+
`- App must be a production app (not dev/localhost)\n- Invalid version format`);
|
|
1024
704
|
}
|
|
1025
705
|
}
|
|
1026
706
|
};
|
|
1027
707
|
/** All app marketplace tools */
|
|
1028
708
|
exports.appMarketplaceTools = [
|
|
1029
|
-
exports.
|
|
1030
|
-
exports.
|
|
1031
|
-
exports.
|
|
1032
|
-
exports.getTemplateTool,
|
|
1033
|
-
exports.publishTemplateTool,
|
|
1034
|
-
exports.getProductTool,
|
|
1035
|
-
exports.getProductManifestTool,
|
|
1036
|
-
exports.publishAppTool,
|
|
1037
|
-
exports.installMarketplaceAppTool,
|
|
709
|
+
exports.browseMarketplaceTool,
|
|
710
|
+
exports.installMarketplaceTool,
|
|
711
|
+
exports.publishMarketplaceTool,
|
|
1038
712
|
];
|
|
1039
713
|
//# sourceMappingURL=app-marketplace.js.map
|