@useconductor/conductor 1.0.0
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-plugin/marketplace.json +33 -0
- package/.claude-plugin/plugin.json +23 -0
- package/.eslintrc.json +23 -0
- package/.gitattributes +6 -0
- package/.github/FUNDING.yml +15 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +91 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +63 -0
- package/.github/ISSUE_TEMPLATE/plugin_request.yml +71 -0
- package/.github/README.md +13 -0
- package/.github/workflows/README.md +22 -0
- package/.github/workflows/auto-release.yml +112 -0
- package/.github/workflows/ci.yml +49 -0
- package/.github/workflows/claude-code-review.yml +44 -0
- package/.github/workflows/claude.yml +36 -0
- package/.github/workflows/sync-install.yml +47 -0
- package/.mcp.json +9 -0
- package/.prettierrc.json +7 -0
- package/C.png +0 -0
- package/CHANGELOG.md +74 -0
- package/CLAUDE.md +118 -0
- package/CONTRIBUTING.md +231 -0
- package/LICENSE +201 -0
- package/README.md +179 -0
- package/SECURITY.md +47 -0
- package/commands/conductor-setup.md +11 -0
- package/commands/conductor-status.md +7 -0
- package/dist/ai/base.d.ts +44 -0
- package/dist/ai/base.d.ts.map +1 -0
- package/dist/ai/base.js +47 -0
- package/dist/ai/base.js.map +1 -0
- package/dist/ai/claude.d.ts +11 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +149 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/gemini.d.ts +15 -0
- package/dist/ai/gemini.d.ts.map +1 -0
- package/dist/ai/gemini.js +156 -0
- package/dist/ai/gemini.js.map +1 -0
- package/dist/ai/maestro.d.ts +22 -0
- package/dist/ai/maestro.d.ts.map +1 -0
- package/dist/ai/maestro.js +142 -0
- package/dist/ai/maestro.js.map +1 -0
- package/dist/ai/manager.d.ts +47 -0
- package/dist/ai/manager.d.ts.map +1 -0
- package/dist/ai/manager.js +450 -0
- package/dist/ai/manager.js.map +1 -0
- package/dist/ai/ollama.d.ts +16 -0
- package/dist/ai/ollama.d.ts.map +1 -0
- package/dist/ai/ollama.js +151 -0
- package/dist/ai/ollama.js.map +1 -0
- package/dist/ai/openai.d.ts +11 -0
- package/dist/ai/openai.d.ts.map +1 -0
- package/dist/ai/openai.js +132 -0
- package/dist/ai/openai.js.map +1 -0
- package/dist/ai/openrouter.d.ts +11 -0
- package/dist/ai/openrouter.d.ts.map +1 -0
- package/dist/ai/openrouter.js +139 -0
- package/dist/ai/openrouter.js.map +1 -0
- package/dist/bot/slack.d.ts +17 -0
- package/dist/bot/slack.d.ts.map +1 -0
- package/dist/bot/slack.js +144 -0
- package/dist/bot/slack.js.map +1 -0
- package/dist/bot/telegram.d.ts +19 -0
- package/dist/bot/telegram.d.ts.map +1 -0
- package/dist/bot/telegram.js +157 -0
- package/dist/bot/telegram.js.map +1 -0
- package/dist/cli/commands/ai.d.ts +4 -0
- package/dist/cli/commands/ai.d.ts.map +1 -0
- package/dist/cli/commands/ai.js +161 -0
- package/dist/cli/commands/ai.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +213 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +281 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +16 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +750 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts +4 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/lifecycle.js +84 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/marketplace.d.ts +13 -0
- package/dist/cli/commands/marketplace.d.ts.map +1 -0
- package/dist/cli/commands/marketplace.js +197 -0
- package/dist/cli/commands/marketplace.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +83 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +10 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +207 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/plugin-create.d.ts +13 -0
- package/dist/cli/commands/plugin-create.d.ts.map +1 -0
- package/dist/cli/commands/plugin-create.js +122 -0
- package/dist/cli/commands/plugin-create.js.map +1 -0
- package/dist/cli/commands/plugins.d.ts +5 -0
- package/dist/cli/commands/plugins.d.ts.map +1 -0
- package/dist/cli/commands/plugins.js +30 -0
- package/dist/cli/commands/plugins.js.map +1 -0
- package/dist/cli/commands/release.d.ts +13 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +243 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/telegram.d.ts +3 -0
- package/dist/cli/commands/telegram.d.ts.map +1 -0
- package/dist/cli/commands/telegram.js +20 -0
- package/dist/cli/commands/telegram.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +402 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/oauth.d.ts +8 -0
- package/dist/config/oauth.d.ts.map +1 -0
- package/dist/config/oauth.js +13 -0
- package/dist/config/oauth.js.map +1 -0
- package/dist/core/audit.d.ts +91 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +233 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/circuit-breaker.d.ts +56 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -0
- package/dist/core/circuit-breaker.js +107 -0
- package/dist/core/circuit-breaker.js.map +1 -0
- package/dist/core/conductor.d.ts +44 -0
- package/dist/core/conductor.d.ts.map +1 -0
- package/dist/core/conductor.js +200 -0
- package/dist/core/conductor.js.map +1 -0
- package/dist/core/config.d.ts +66 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +86 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/database.d.ts +59 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +342 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/errors.d.ts +231 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +254 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/health.d.ts +72 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +116 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/interfaces.d.ts +62 -0
- package/dist/core/interfaces.d.ts.map +1 -0
- package/dist/core/interfaces.js +8 -0
- package/dist/core/interfaces.js.map +1 -0
- package/dist/core/logger.d.ts +15 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +30 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/rbac.d.ts +132 -0
- package/dist/core/rbac.d.ts.map +1 -0
- package/dist/core/rbac.js +230 -0
- package/dist/core/rbac.js.map +1 -0
- package/dist/core/retry.d.ts +22 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +41 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/webhooks.d.ts +92 -0
- package/dist/core/webhooks.d.ts.map +1 -0
- package/dist/core/webhooks.js +176 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/core/zero-config.d.ts +22 -0
- package/dist/core/zero-config.d.ts.map +1 -0
- package/dist/core/zero-config.js +59 -0
- package/dist/core/zero-config.js.map +1 -0
- package/dist/dashboard/cli.d.ts +6 -0
- package/dist/dashboard/cli.d.ts.map +1 -0
- package/dist/dashboard/cli.js +42 -0
- package/dist/dashboard/cli.js.map +1 -0
- package/dist/dashboard/index.html +3426 -0
- package/dist/dashboard/server.d.ts +7 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +1427 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +380 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/misc.d.ts +15 -0
- package/dist/mcp/tools/misc.d.ts.map +1 -0
- package/dist/mcp/tools/misc.js +49 -0
- package/dist/mcp/tools/misc.js.map +1 -0
- package/dist/plugins/builtin/calculator.d.ts +11 -0
- package/dist/plugins/builtin/calculator.d.ts.map +1 -0
- package/dist/plugins/builtin/calculator.js +166 -0
- package/dist/plugins/builtin/calculator.js.map +1 -0
- package/dist/plugins/builtin/colors.d.ts +15 -0
- package/dist/plugins/builtin/colors.d.ts.map +1 -0
- package/dist/plugins/builtin/colors.js +193 -0
- package/dist/plugins/builtin/colors.js.map +1 -0
- package/dist/plugins/builtin/cron.d.ts +40 -0
- package/dist/plugins/builtin/cron.d.ts.map +1 -0
- package/dist/plugins/builtin/cron.js +578 -0
- package/dist/plugins/builtin/cron.js.map +1 -0
- package/dist/plugins/builtin/crypto.d.ts +11 -0
- package/dist/plugins/builtin/crypto.d.ts.map +1 -0
- package/dist/plugins/builtin/crypto.js +83 -0
- package/dist/plugins/builtin/crypto.js.map +1 -0
- package/dist/plugins/builtin/database.d.ts +29 -0
- package/dist/plugins/builtin/database.d.ts.map +1 -0
- package/dist/plugins/builtin/database.js +230 -0
- package/dist/plugins/builtin/database.js.map +1 -0
- package/dist/plugins/builtin/docker.d.ts +12 -0
- package/dist/plugins/builtin/docker.d.ts.map +1 -0
- package/dist/plugins/builtin/docker.js +436 -0
- package/dist/plugins/builtin/docker.js.map +1 -0
- package/dist/plugins/builtin/fun.d.ts +11 -0
- package/dist/plugins/builtin/fun.d.ts.map +1 -0
- package/dist/plugins/builtin/fun.js +114 -0
- package/dist/plugins/builtin/fun.js.map +1 -0
- package/dist/plugins/builtin/gcal.d.ts +38 -0
- package/dist/plugins/builtin/gcal.d.ts.map +1 -0
- package/dist/plugins/builtin/gcal.js +280 -0
- package/dist/plugins/builtin/gcal.js.map +1 -0
- package/dist/plugins/builtin/gdrive.d.ts +26 -0
- package/dist/plugins/builtin/gdrive.d.ts.map +1 -0
- package/dist/plugins/builtin/gdrive.js +295 -0
- package/dist/plugins/builtin/gdrive.js.map +1 -0
- package/dist/plugins/builtin/github-actions.d.ts +38 -0
- package/dist/plugins/builtin/github-actions.d.ts.map +1 -0
- package/dist/plugins/builtin/github-actions.js +629 -0
- package/dist/plugins/builtin/github-actions.js.map +1 -0
- package/dist/plugins/builtin/github.d.ts +26 -0
- package/dist/plugins/builtin/github.d.ts.map +1 -0
- package/dist/plugins/builtin/github.js +800 -0
- package/dist/plugins/builtin/github.js.map +1 -0
- package/dist/plugins/builtin/gmail.d.ts +50 -0
- package/dist/plugins/builtin/gmail.d.ts.map +1 -0
- package/dist/plugins/builtin/gmail.js +445 -0
- package/dist/plugins/builtin/gmail.js.map +1 -0
- package/dist/plugins/builtin/hash.d.ts +11 -0
- package/dist/plugins/builtin/hash.d.ts.map +1 -0
- package/dist/plugins/builtin/hash.js +95 -0
- package/dist/plugins/builtin/hash.js.map +1 -0
- package/dist/plugins/builtin/homekit.d.ts +53 -0
- package/dist/plugins/builtin/homekit.d.ts.map +1 -0
- package/dist/plugins/builtin/homekit.js +341 -0
- package/dist/plugins/builtin/homekit.js.map +1 -0
- package/dist/plugins/builtin/index.d.ts +4 -0
- package/dist/plugins/builtin/index.d.ts.map +1 -0
- package/dist/plugins/builtin/index.js +96 -0
- package/dist/plugins/builtin/index.js.map +1 -0
- package/dist/plugins/builtin/jira.d.ts +50 -0
- package/dist/plugins/builtin/jira.d.ts.map +1 -0
- package/dist/plugins/builtin/jira.js +353 -0
- package/dist/plugins/builtin/jira.js.map +1 -0
- package/dist/plugins/builtin/linear.d.ts +35 -0
- package/dist/plugins/builtin/linear.d.ts.map +1 -0
- package/dist/plugins/builtin/linear.js +397 -0
- package/dist/plugins/builtin/linear.js.map +1 -0
- package/dist/plugins/builtin/lumen.d.ts +21 -0
- package/dist/plugins/builtin/lumen.d.ts.map +1 -0
- package/dist/plugins/builtin/lumen.js +404 -0
- package/dist/plugins/builtin/lumen.js.map +1 -0
- package/dist/plugins/builtin/memory.d.ts +22 -0
- package/dist/plugins/builtin/memory.d.ts.map +1 -0
- package/dist/plugins/builtin/memory.js +184 -0
- package/dist/plugins/builtin/memory.js.map +1 -0
- package/dist/plugins/builtin/n8n.d.ts +60 -0
- package/dist/plugins/builtin/n8n.d.ts.map +1 -0
- package/dist/plugins/builtin/n8n.js +519 -0
- package/dist/plugins/builtin/n8n.js.map +1 -0
- package/dist/plugins/builtin/network.d.ts +11 -0
- package/dist/plugins/builtin/network.d.ts.map +1 -0
- package/dist/plugins/builtin/network.js +88 -0
- package/dist/plugins/builtin/network.js.map +1 -0
- package/dist/plugins/builtin/notes.d.ts +47 -0
- package/dist/plugins/builtin/notes.d.ts.map +1 -0
- package/dist/plugins/builtin/notes.js +641 -0
- package/dist/plugins/builtin/notes.js.map +1 -0
- package/dist/plugins/builtin/notion.d.ts +47 -0
- package/dist/plugins/builtin/notion.d.ts.map +1 -0
- package/dist/plugins/builtin/notion.js +317 -0
- package/dist/plugins/builtin/notion.js.map +1 -0
- package/dist/plugins/builtin/shell.d.ts +12 -0
- package/dist/plugins/builtin/shell.d.ts.map +1 -0
- package/dist/plugins/builtin/shell.js +310 -0
- package/dist/plugins/builtin/shell.js.map +1 -0
- package/dist/plugins/builtin/slack.d.ts +31 -0
- package/dist/plugins/builtin/slack.d.ts.map +1 -0
- package/dist/plugins/builtin/slack.js +295 -0
- package/dist/plugins/builtin/slack.js.map +1 -0
- package/dist/plugins/builtin/spotify.d.ts +55 -0
- package/dist/plugins/builtin/spotify.d.ts.map +1 -0
- package/dist/plugins/builtin/spotify.js +623 -0
- package/dist/plugins/builtin/spotify.js.map +1 -0
- package/dist/plugins/builtin/stripe.d.ts +35 -0
- package/dist/plugins/builtin/stripe.d.ts.map +1 -0
- package/dist/plugins/builtin/stripe.js +376 -0
- package/dist/plugins/builtin/stripe.js.map +1 -0
- package/dist/plugins/builtin/system.d.ts +11 -0
- package/dist/plugins/builtin/system.d.ts.map +1 -0
- package/dist/plugins/builtin/system.js +91 -0
- package/dist/plugins/builtin/system.js.map +1 -0
- package/dist/plugins/builtin/text-tools.d.ts +11 -0
- package/dist/plugins/builtin/text-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/text-tools.js +146 -0
- package/dist/plugins/builtin/text-tools.js.map +1 -0
- package/dist/plugins/builtin/timezone.d.ts +13 -0
- package/dist/plugins/builtin/timezone.d.ts.map +1 -0
- package/dist/plugins/builtin/timezone.js +164 -0
- package/dist/plugins/builtin/timezone.js.map +1 -0
- package/dist/plugins/builtin/todoist.d.ts +49 -0
- package/dist/plugins/builtin/todoist.d.ts.map +1 -0
- package/dist/plugins/builtin/todoist.js +540 -0
- package/dist/plugins/builtin/todoist.js.map +1 -0
- package/dist/plugins/builtin/translate.d.ts +11 -0
- package/dist/plugins/builtin/translate.d.ts.map +1 -0
- package/dist/plugins/builtin/translate.js +42 -0
- package/dist/plugins/builtin/translate.js.map +1 -0
- package/dist/plugins/builtin/url-tools.d.ts +11 -0
- package/dist/plugins/builtin/url-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/url-tools.js +70 -0
- package/dist/plugins/builtin/url-tools.js.map +1 -0
- package/dist/plugins/builtin/vercel.d.ts +55 -0
- package/dist/plugins/builtin/vercel.d.ts.map +1 -0
- package/dist/plugins/builtin/vercel.js +514 -0
- package/dist/plugins/builtin/vercel.js.map +1 -0
- package/dist/plugins/builtin/weather.d.ts +13 -0
- package/dist/plugins/builtin/weather.d.ts.map +1 -0
- package/dist/plugins/builtin/weather.js +103 -0
- package/dist/plugins/builtin/weather.js.map +1 -0
- package/dist/plugins/builtin/x.d.ts +54 -0
- package/dist/plugins/builtin/x.d.ts.map +1 -0
- package/dist/plugins/builtin/x.js +402 -0
- package/dist/plugins/builtin/x.js.map +1 -0
- package/dist/plugins/manager.d.ts +77 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +141 -0
- package/dist/plugins/manager.js.map +1 -0
- package/dist/plugins/validation.d.ts +18 -0
- package/dist/plugins/validation.d.ts.map +1 -0
- package/dist/plugins/validation.js +81 -0
- package/dist/plugins/validation.js.map +1 -0
- package/dist/security/auth.d.ts +23 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +56 -0
- package/dist/security/auth.js.map +1 -0
- package/dist/security/keychain.d.ts +60 -0
- package/dist/security/keychain.d.ts.map +1 -0
- package/dist/security/keychain.js +213 -0
- package/dist/security/keychain.js.map +1 -0
- package/dist/utils/google-auth.d.ts +21 -0
- package/dist/utils/google-auth.d.ts.map +1 -0
- package/dist/utils/google-auth.js +135 -0
- package/dist/utils/google-auth.js.map +1 -0
- package/dist/utils/retry.d.ts +5 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +34 -0
- package/dist/utils/retry.js.map +1 -0
- package/docs/README.md +13 -0
- package/docs/api.md +210 -0
- package/docs/getting-started.md +100 -0
- package/docs/plugins.md +306 -0
- package/docs-site/.vitepress/config.ts +59 -0
- package/docs-site/README.md +12 -0
- package/docs-site/index.md +30 -0
- package/eslint.config.js +29 -0
- package/install.ps1 +334 -0
- package/install.sh +1119 -0
- package/local-install.sh +304 -0
- package/package.json +90 -0
- package/packages/README.md +11 -0
- package/packages/plugin-sdk/README.md +12 -0
- package/packages/plugin-sdk/package.json +22 -0
- package/packages/plugin-sdk/src/README.md +11 -0
- package/packages/plugin-sdk/src/index.ts +191 -0
- package/sdks/README.md +26 -0
- package/sdks/csharp/ConductorClient.cs +65 -0
- package/sdks/csharp/README.md +11 -0
- package/sdks/go/README.md +11 -0
- package/sdks/go/conductor.go +257 -0
- package/sdks/java/ConductorClient.java +27 -0
- package/sdks/java/README.md +11 -0
- package/sdks/php/README.md +11 -0
- package/sdks/php/src/Client.php +72 -0
- package/sdks/python/README.md +12 -0
- package/sdks/python/conductor/__init__.py +227 -0
- package/sdks/python/pyproject.toml +30 -0
- package/sdks/ruby/README.md +11 -0
- package/sdks/ruby/lib/conductor.rb +46 -0
- package/sdks/rust/Cargo.toml +14 -0
- package/sdks/rust/README.md +11 -0
- package/sdks/swift/README.md +11 -0
- package/sdks/swift/Sources/Conductor/ConductorClient.swift +65 -0
- package/skills/conductor-mcp/SKILL.md +38 -0
- package/src/README.md +20 -0
- package/src/ai/README.md +18 -0
- package/src/ai/base.ts +93 -0
- package/src/ai/claude.ts +162 -0
- package/src/ai/gemini.ts +188 -0
- package/src/ai/maestro.ts +168 -0
- package/src/ai/manager.ts +537 -0
- package/src/ai/ollama.ts +186 -0
- package/src/ai/openai.ts +147 -0
- package/src/ai/openrouter.ts +152 -0
- package/src/bot/README.md +12 -0
- package/src/bot/slack.ts +164 -0
- package/src/bot/telegram.ts +185 -0
- package/src/cli/README.md +24 -0
- package/src/cli/commands/README.md +20 -0
- package/src/cli/commands/ai.ts +170 -0
- package/src/cli/commands/doctor.ts +221 -0
- package/src/cli/commands/init.ts +348 -0
- package/src/cli/commands/install.ts +792 -0
- package/src/cli/commands/lifecycle.ts +95 -0
- package/src/cli/commands/marketplace.ts +253 -0
- package/src/cli/commands/mcp.ts +92 -0
- package/src/cli/commands/onboard.ts +248 -0
- package/src/cli/commands/plugin-create.ts +130 -0
- package/src/cli/commands/plugins.ts +36 -0
- package/src/cli/commands/release.ts +251 -0
- package/src/cli/commands/telegram.ts +25 -0
- package/src/cli/index.ts +450 -0
- package/src/config/README.md +11 -0
- package/src/config/oauth.ts +26 -0
- package/src/core/README.md +22 -0
- package/src/core/audit.ts +291 -0
- package/src/core/circuit-breaker.ts +129 -0
- package/src/core/conductor.ts +240 -0
- package/src/core/config.ts +149 -0
- package/src/core/database.ts +411 -0
- package/src/core/errors.ts +275 -0
- package/src/core/health.ts +159 -0
- package/src/core/interfaces.ts +75 -0
- package/src/core/logger.ts +33 -0
- package/src/core/rbac.ts +321 -0
- package/src/core/retry.ts +61 -0
- package/src/core/webhooks.ts +234 -0
- package/src/core/zero-config.ts +72 -0
- package/src/dashboard/README.md +15 -0
- package/src/dashboard/cli.ts +48 -0
- package/src/dashboard/index.html +3426 -0
- package/src/dashboard/server.ts +1544 -0
- package/src/mcp/README.md +20 -0
- package/src/mcp/server.ts +475 -0
- package/src/mcp/tools/README.md +11 -0
- package/src/mcp/tools/misc.ts +61 -0
- package/src/plugins/README.md +28 -0
- package/src/plugins/builtin/README.md +23 -0
- package/src/plugins/builtin/calculator.ts +178 -0
- package/src/plugins/builtin/colors.ts +201 -0
- package/src/plugins/builtin/cron.ts +649 -0
- package/src/plugins/builtin/crypto.ts +85 -0
- package/src/plugins/builtin/database.ts +235 -0
- package/src/plugins/builtin/docker.ts +426 -0
- package/src/plugins/builtin/fun.ts +118 -0
- package/src/plugins/builtin/gcal.ts +305 -0
- package/src/plugins/builtin/gdrive.ts +326 -0
- package/src/plugins/builtin/github-actions.ts +666 -0
- package/src/plugins/builtin/github.ts +912 -0
- package/src/plugins/builtin/gmail.ts +492 -0
- package/src/plugins/builtin/hash.ts +98 -0
- package/src/plugins/builtin/homekit.ts +389 -0
- package/src/plugins/builtin/index.ts +116 -0
- package/src/plugins/builtin/jira.ts +380 -0
- package/src/plugins/builtin/linear.ts +448 -0
- package/src/plugins/builtin/lumen.ts +497 -0
- package/src/plugins/builtin/memory.ts +200 -0
- package/src/plugins/builtin/n8n.ts +565 -0
- package/src/plugins/builtin/network.ts +92 -0
- package/src/plugins/builtin/notes.ts +689 -0
- package/src/plugins/builtin/notion.ts +348 -0
- package/src/plugins/builtin/shell.ts +334 -0
- package/src/plugins/builtin/slack.ts +327 -0
- package/src/plugins/builtin/spotify.ts +665 -0
- package/src/plugins/builtin/stripe.ts +388 -0
- package/src/plugins/builtin/system.ts +93 -0
- package/src/plugins/builtin/text-tools.ts +150 -0
- package/src/plugins/builtin/timezone.ts +173 -0
- package/src/plugins/builtin/todoist.ts +625 -0
- package/src/plugins/builtin/translate.ts +47 -0
- package/src/plugins/builtin/url-tools.ts +73 -0
- package/src/plugins/builtin/vercel.ts +546 -0
- package/src/plugins/builtin/weather.ts +112 -0
- package/src/plugins/builtin/x.ts +440 -0
- package/src/plugins/manager.ts +213 -0
- package/src/plugins/validation.ts +94 -0
- package/src/security/README.md +12 -0
- package/src/security/auth.ts +72 -0
- package/src/security/keychain.ts +226 -0
- package/src/utils/README.md +12 -0
- package/src/utils/google-auth.ts +159 -0
- package/src/utils/retry.ts +41 -0
- package/test-all.mjs +1256 -0
- package/test.mjs +633 -0
- package/tests/README.md +19 -0
- package/tests/calculator.test.ts +54 -0
- package/tests/docker.test.ts +42 -0
- package/tests/load.test.ts +129 -0
- package/tests/mcp.test.ts +14 -0
- package/tests/shell.test.ts +42 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spotify Plugin — TheAlxLabs / Conductor
|
|
3
|
+
*
|
|
4
|
+
* Full Spotify control: playback, search, playlists, queue, recommendations.
|
|
5
|
+
* Uses Spotify Web API with OAuth 2.0 (Authorization Code + PKCE).
|
|
6
|
+
*
|
|
7
|
+
* Setup:
|
|
8
|
+
* 1. https://developer.spotify.com/dashboard → Create App
|
|
9
|
+
* 2. Add redirect URI: http://localhost:4839/spotify/callback
|
|
10
|
+
* 3. Copy Client ID
|
|
11
|
+
* 4. Run: conductor plugins auth spotify
|
|
12
|
+
* (opens browser for one-click OAuth — no client secret needed with PKCE)
|
|
13
|
+
*
|
|
14
|
+
* Keychain entries: spotify/access_token, spotify/refresh_token, spotify/client_id
|
|
15
|
+
*
|
|
16
|
+
* Auto-refreshes expired tokens transparently.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Plugin, PluginTool } from '../manager.js';
|
|
20
|
+
import { Conductor } from '../../core/conductor.js';
|
|
21
|
+
import { Keychain } from '../../security/keychain.js';
|
|
22
|
+
|
|
23
|
+
const SPOTIFY_BASE = 'https://api.spotify.com/v1';
|
|
24
|
+
const SPOTIFY_AUTH = 'https://accounts.spotify.com';
|
|
25
|
+
const _SCOPES = [
|
|
26
|
+
'user-read-playback-state',
|
|
27
|
+
'user-modify-playback-state',
|
|
28
|
+
'user-read-currently-playing',
|
|
29
|
+
'playlist-read-private',
|
|
30
|
+
'playlist-read-collaborative',
|
|
31
|
+
'playlist-modify-public',
|
|
32
|
+
'playlist-modify-private',
|
|
33
|
+
'user-library-read',
|
|
34
|
+
'user-library-modify',
|
|
35
|
+
'user-top-read',
|
|
36
|
+
'user-read-recently-played',
|
|
37
|
+
'user-follow-read',
|
|
38
|
+
].join(' ');
|
|
39
|
+
|
|
40
|
+
export class SpotifyPlugin implements Plugin {
|
|
41
|
+
name = 'spotify';
|
|
42
|
+
description = 'Full Spotify control — playback, search, playlists, queue, recommendations, top tracks';
|
|
43
|
+
version = '1.0.0';
|
|
44
|
+
|
|
45
|
+
configSchema = {
|
|
46
|
+
fields: [
|
|
47
|
+
{
|
|
48
|
+
key: 'client_id',
|
|
49
|
+
label: 'Spotify Client ID',
|
|
50
|
+
type: 'string' as const,
|
|
51
|
+
required: true,
|
|
52
|
+
secret: false,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'client_secret',
|
|
56
|
+
label: 'Spotify Client Secret',
|
|
57
|
+
type: 'password' as const,
|
|
58
|
+
required: true,
|
|
59
|
+
secret: true,
|
|
60
|
+
service: 'spotify',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
setupInstructions:
|
|
64
|
+
'Create an app in the Spotify Developer Dashboard. Set Redirect URI to http://localhost:8888/callback',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
private keychain!: Keychain;
|
|
68
|
+
private configDir!: string;
|
|
69
|
+
|
|
70
|
+
async initialize(conductor: Conductor): Promise<void> {
|
|
71
|
+
this.configDir = conductor.getConfig().getConfigDir();
|
|
72
|
+
this.keychain = new Keychain(this.configDir);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
isConfigured(): boolean {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ── Auth helpers ────────────────────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
private async getToken(): Promise<string> {
|
|
82
|
+
let token = await this.keychain.get('spotify', 'access_token');
|
|
83
|
+
if (!token) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
'Spotify not authenticated.\n' +
|
|
86
|
+
'Run: conductor plugins auth spotify\n' +
|
|
87
|
+
'Or manually set: conductor plugins config spotify access_token <TOKEN>',
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return token;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Refresh the access token using the stored refresh token. */
|
|
94
|
+
private async refreshToken(): Promise<string | null> {
|
|
95
|
+
const refreshToken = await this.keychain.get('spotify', 'refresh_token');
|
|
96
|
+
const clientId = await this.keychain.get('spotify', 'client_id');
|
|
97
|
+
if (!refreshToken || !clientId) return null;
|
|
98
|
+
|
|
99
|
+
const res = await fetch(`${SPOTIFY_AUTH}/api/token`, {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
102
|
+
body: new URLSearchParams({
|
|
103
|
+
grant_type: 'refresh_token',
|
|
104
|
+
refresh_token: refreshToken,
|
|
105
|
+
client_id: clientId,
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
if (!res.ok) return null;
|
|
109
|
+
const data = (await res.json()) as any;
|
|
110
|
+
if (data.access_token) {
|
|
111
|
+
await this.keychain.set('spotify', 'access_token', data.access_token);
|
|
112
|
+
if (data.refresh_token) {
|
|
113
|
+
await this.keychain.set('spotify', 'refresh_token', data.refresh_token);
|
|
114
|
+
}
|
|
115
|
+
return data.access_token;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ── API fetch with auto-refresh ─────────────────────────────────────────────
|
|
121
|
+
|
|
122
|
+
private async spotifyFetch(
|
|
123
|
+
path: string,
|
|
124
|
+
options: { method?: string; body?: any; params?: Record<string, string> } = {},
|
|
125
|
+
retry = true,
|
|
126
|
+
): Promise<any> {
|
|
127
|
+
const token = await this.getToken();
|
|
128
|
+
const url = new URL(`${SPOTIFY_BASE}${path}`);
|
|
129
|
+
if (options.params) {
|
|
130
|
+
for (const [k, v] of Object.entries(options.params)) url.searchParams.set(k, v);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const res = await fetch(url.toString(), {
|
|
134
|
+
method: options.method ?? 'GET',
|
|
135
|
+
headers: {
|
|
136
|
+
Authorization: `Bearer ${token}`,
|
|
137
|
+
'Content-Type': 'application/json',
|
|
138
|
+
},
|
|
139
|
+
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Auto-refresh on 401
|
|
143
|
+
if (res.status === 401 && retry) {
|
|
144
|
+
const newToken = await this.refreshToken();
|
|
145
|
+
if (newToken) {
|
|
146
|
+
return this.spotifyFetch(path, options, false);
|
|
147
|
+
}
|
|
148
|
+
throw new Error('Spotify token expired and refresh failed. Run: conductor plugins auth spotify');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (res.status === 204 || res.status === 202) return {};
|
|
152
|
+
if (!res.ok) {
|
|
153
|
+
const err = (await res.json().catch(() => ({}))) as any;
|
|
154
|
+
throw new Error(`Spotify API ${res.status}: ${err.error?.message ?? res.statusText}`);
|
|
155
|
+
}
|
|
156
|
+
return res.json();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ── Formatting helpers ──────────────────────────────────────────────────────
|
|
160
|
+
|
|
161
|
+
private formatTrack(t: any) {
|
|
162
|
+
return {
|
|
163
|
+
id: t.id,
|
|
164
|
+
name: t.name,
|
|
165
|
+
artists: (t.artists ?? []).map((a: any) => a.name).join(', '),
|
|
166
|
+
album: t.album?.name ?? '',
|
|
167
|
+
duration: this.msToTime(t.duration_ms),
|
|
168
|
+
popularity: t.popularity ?? 0,
|
|
169
|
+
uri: t.uri,
|
|
170
|
+
url: t.external_urls?.spotify ?? '',
|
|
171
|
+
explicit: t.explicit ?? false,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private formatPlaylist(p: any) {
|
|
176
|
+
return {
|
|
177
|
+
id: p.id,
|
|
178
|
+
name: p.name,
|
|
179
|
+
description: p.description ?? '',
|
|
180
|
+
owner: p.owner?.display_name ?? '',
|
|
181
|
+
tracks: p.tracks?.total ?? 0,
|
|
182
|
+
public: p.public ?? false,
|
|
183
|
+
url: p.external_urls?.spotify ?? '',
|
|
184
|
+
uri: p.uri,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private msToTime(ms: number): string {
|
|
189
|
+
const total = Math.floor(ms / 1000);
|
|
190
|
+
const m = Math.floor(total / 60);
|
|
191
|
+
const s = total % 60;
|
|
192
|
+
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ── Tools ───────────────────────────────────────────────────────────────────
|
|
196
|
+
|
|
197
|
+
getTools(): PluginTool[] {
|
|
198
|
+
return [
|
|
199
|
+
// ── spotify_now_playing ────────────────────────────────────────────────
|
|
200
|
+
{
|
|
201
|
+
name: 'spotify_now_playing',
|
|
202
|
+
description: 'Get the currently playing track and playback state',
|
|
203
|
+
inputSchema: { type: 'object', properties: {} },
|
|
204
|
+
handler: async () => {
|
|
205
|
+
const data = await this.spotifyFetch('/me/player');
|
|
206
|
+
if (!data || !data.item) return { playing: false, message: 'Nothing currently playing.' };
|
|
207
|
+
return {
|
|
208
|
+
playing: data.is_playing,
|
|
209
|
+
track: this.formatTrack(data.item),
|
|
210
|
+
device: {
|
|
211
|
+
name: data.device?.name ?? 'Unknown',
|
|
212
|
+
type: data.device?.type ?? '',
|
|
213
|
+
volume: data.device?.volume_percent ?? 0,
|
|
214
|
+
},
|
|
215
|
+
shuffle: data.shuffle_state,
|
|
216
|
+
repeat: data.repeat_state,
|
|
217
|
+
progress: this.msToTime(data.progress_ms ?? 0),
|
|
218
|
+
context: data.context?.type ?? null,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
// ── spotify_search ─────────────────────────────────────────────────────
|
|
224
|
+
{
|
|
225
|
+
name: 'spotify_search',
|
|
226
|
+
description: 'Search Spotify for tracks, albums, artists, or playlists',
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: 'object',
|
|
229
|
+
properties: {
|
|
230
|
+
query: { type: 'string', description: 'Search query' },
|
|
231
|
+
type: {
|
|
232
|
+
type: 'string',
|
|
233
|
+
enum: ['track', 'album', 'artist', 'playlist'],
|
|
234
|
+
description: 'Type of result (default: track)',
|
|
235
|
+
},
|
|
236
|
+
limit: { type: 'number', description: 'Max results (default: 10)' },
|
|
237
|
+
},
|
|
238
|
+
required: ['query'],
|
|
239
|
+
},
|
|
240
|
+
handler: async ({ query, type = 'track', limit = 10 }: any) => {
|
|
241
|
+
const data = await this.spotifyFetch('/search', {
|
|
242
|
+
params: { q: query, type, limit: String(Math.min(limit, 50)) },
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
if (type === 'track') {
|
|
246
|
+
return {
|
|
247
|
+
count: data.tracks?.items?.length ?? 0,
|
|
248
|
+
tracks: (data.tracks?.items ?? []).map(this.formatTrack.bind(this)),
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
if (type === 'artist') {
|
|
252
|
+
return {
|
|
253
|
+
count: data.artists?.items?.length ?? 0,
|
|
254
|
+
artists: (data.artists?.items ?? []).map((a: any) => ({
|
|
255
|
+
id: a.id,
|
|
256
|
+
name: a.name,
|
|
257
|
+
genres: a.genres ?? [],
|
|
258
|
+
followers: a.followers?.total ?? 0,
|
|
259
|
+
popularity: a.popularity ?? 0,
|
|
260
|
+
uri: a.uri,
|
|
261
|
+
url: a.external_urls?.spotify ?? '',
|
|
262
|
+
})),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
if (type === 'album') {
|
|
266
|
+
return {
|
|
267
|
+
count: data.albums?.items?.length ?? 0,
|
|
268
|
+
albums: (data.albums?.items ?? []).map((a: any) => ({
|
|
269
|
+
id: a.id,
|
|
270
|
+
name: a.name,
|
|
271
|
+
artists: (a.artists ?? []).map((x: any) => x.name).join(', '),
|
|
272
|
+
releaseDate: a.release_date ?? '',
|
|
273
|
+
tracks: a.total_tracks ?? 0,
|
|
274
|
+
uri: a.uri,
|
|
275
|
+
url: a.external_urls?.spotify ?? '',
|
|
276
|
+
})),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (type === 'playlist') {
|
|
280
|
+
return {
|
|
281
|
+
count: data.playlists?.items?.length ?? 0,
|
|
282
|
+
playlists: (data.playlists?.items ?? []).filter(Boolean).map(this.formatPlaylist.bind(this)),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return data;
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
// ── spotify_play ───────────────────────────────────────────────────────
|
|
290
|
+
{
|
|
291
|
+
name: 'spotify_play',
|
|
292
|
+
description:
|
|
293
|
+
'Start or resume playback. Can play a specific track, album, playlist, or artist by URI or search query.',
|
|
294
|
+
inputSchema: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
uri: {
|
|
298
|
+
type: 'string',
|
|
299
|
+
description: 'Spotify URI (e.g. spotify:track:xxx, spotify:album:xxx)',
|
|
300
|
+
},
|
|
301
|
+
query: {
|
|
302
|
+
type: 'string',
|
|
303
|
+
description: 'Search for and play this track/artist/album (used if no URI given)',
|
|
304
|
+
},
|
|
305
|
+
deviceId: { type: 'string', description: 'Target device ID (optional)' },
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
handler: async ({ uri, query, deviceId }: any) => {
|
|
309
|
+
let playUri = uri;
|
|
310
|
+
|
|
311
|
+
// Auto-search if only query given
|
|
312
|
+
if (!playUri && query) {
|
|
313
|
+
const results = await this.spotifyFetch('/search', {
|
|
314
|
+
params: { q: query, type: 'track', limit: '1' },
|
|
315
|
+
});
|
|
316
|
+
const track = results.tracks?.items?.[0];
|
|
317
|
+
if (!track) return { error: `No track found for: "${query}"` };
|
|
318
|
+
playUri = track.uri;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const body: any = {};
|
|
322
|
+
if (playUri) {
|
|
323
|
+
if (playUri.startsWith('spotify:track:')) {
|
|
324
|
+
body.uris = [playUri];
|
|
325
|
+
} else {
|
|
326
|
+
body.context_uri = playUri;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const params: Record<string, string> = {};
|
|
331
|
+
if (deviceId) params.device_id = deviceId;
|
|
332
|
+
|
|
333
|
+
await this.spotifyFetch('/me/player/play', {
|
|
334
|
+
method: 'PUT',
|
|
335
|
+
body,
|
|
336
|
+
params,
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
// Fetch what's now playing to confirm
|
|
340
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
341
|
+
const now = await this.spotifyFetch('/me/player/currently-playing').catch(() => null);
|
|
342
|
+
return {
|
|
343
|
+
playing: true,
|
|
344
|
+
track: now?.item ? this.formatTrack(now.item) : null,
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
// ── spotify_pause ──────────────────────────────────────────────────────
|
|
350
|
+
{
|
|
351
|
+
name: 'spotify_pause',
|
|
352
|
+
description: 'Pause Spotify playback',
|
|
353
|
+
inputSchema: { type: 'object', properties: {} },
|
|
354
|
+
handler: async () => {
|
|
355
|
+
await this.spotifyFetch('/me/player/pause', { method: 'PUT' });
|
|
356
|
+
return { paused: true };
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
// ── spotify_skip ───────────────────────────────────────────────────────
|
|
361
|
+
{
|
|
362
|
+
name: 'spotify_skip',
|
|
363
|
+
description: 'Skip to next or previous track',
|
|
364
|
+
inputSchema: {
|
|
365
|
+
type: 'object',
|
|
366
|
+
properties: {
|
|
367
|
+
direction: {
|
|
368
|
+
type: 'string',
|
|
369
|
+
enum: ['next', 'previous'],
|
|
370
|
+
description: 'next or previous (default: next)',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
handler: async ({ direction = 'next' }: any) => {
|
|
375
|
+
const endpoint = direction === 'previous' ? '/me/player/previous' : '/me/player/next';
|
|
376
|
+
await this.spotifyFetch(endpoint, { method: 'POST' });
|
|
377
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
378
|
+
const now = await this.spotifyFetch('/me/player/currently-playing').catch(() => null);
|
|
379
|
+
return {
|
|
380
|
+
skipped: direction,
|
|
381
|
+
now: now?.item ? this.formatTrack(now.item) : null,
|
|
382
|
+
};
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
// ── spotify_volume ─────────────────────────────────────────────────────
|
|
387
|
+
{
|
|
388
|
+
name: 'spotify_volume',
|
|
389
|
+
description: 'Set Spotify playback volume (0–100)',
|
|
390
|
+
inputSchema: {
|
|
391
|
+
type: 'object',
|
|
392
|
+
properties: {
|
|
393
|
+
volume: { type: 'number', description: 'Volume 0–100' },
|
|
394
|
+
},
|
|
395
|
+
required: ['volume'],
|
|
396
|
+
},
|
|
397
|
+
handler: async ({ volume }: any) => {
|
|
398
|
+
const vol = Math.max(0, Math.min(100, Math.round(volume)));
|
|
399
|
+
await this.spotifyFetch('/me/player/volume', {
|
|
400
|
+
method: 'PUT',
|
|
401
|
+
params: { volume_percent: String(vol) },
|
|
402
|
+
});
|
|
403
|
+
return { volume: vol };
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
// ── spotify_queue ──────────────────────────────────────────────────────
|
|
408
|
+
{
|
|
409
|
+
name: 'spotify_queue',
|
|
410
|
+
description: 'Add a track to the playback queue by URI or search query',
|
|
411
|
+
inputSchema: {
|
|
412
|
+
type: 'object',
|
|
413
|
+
properties: {
|
|
414
|
+
uri: { type: 'string', description: 'Spotify track URI' },
|
|
415
|
+
query: { type: 'string', description: 'Search for and queue this track' },
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
handler: async ({ uri, query }: any) => {
|
|
419
|
+
let trackUri = uri;
|
|
420
|
+
if (!trackUri && query) {
|
|
421
|
+
const results = await this.spotifyFetch('/search', {
|
|
422
|
+
params: { q: query, type: 'track', limit: '1' },
|
|
423
|
+
});
|
|
424
|
+
const track = results.tracks?.items?.[0];
|
|
425
|
+
if (!track) return { error: `No track found for: "${query}"` };
|
|
426
|
+
trackUri = track.uri;
|
|
427
|
+
}
|
|
428
|
+
if (!trackUri) return { error: 'Provide uri or query.' };
|
|
429
|
+
await this.spotifyFetch('/me/player/queue', {
|
|
430
|
+
method: 'POST',
|
|
431
|
+
params: { uri: trackUri },
|
|
432
|
+
});
|
|
433
|
+
return { queued: true, uri: trackUri };
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
|
|
437
|
+
// ── spotify_playlists ──────────────────────────────────────────────────
|
|
438
|
+
{
|
|
439
|
+
name: 'spotify_playlists',
|
|
440
|
+
description: "Get the current user's playlists",
|
|
441
|
+
inputSchema: {
|
|
442
|
+
type: 'object',
|
|
443
|
+
properties: {
|
|
444
|
+
limit: { type: 'number', description: 'Max playlists to return (default: 20)' },
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
handler: async ({ limit = 20 }: any) => {
|
|
448
|
+
const data = await this.spotifyFetch('/me/playlists', {
|
|
449
|
+
params: { limit: String(Math.min(limit, 50)) },
|
|
450
|
+
});
|
|
451
|
+
return {
|
|
452
|
+
count: data.items?.length ?? 0,
|
|
453
|
+
total: data.total ?? 0,
|
|
454
|
+
playlists: (data.items ?? []).map(this.formatPlaylist.bind(this)),
|
|
455
|
+
};
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
// ── spotify_playlist_tracks ────────────────────────────────────────────
|
|
460
|
+
{
|
|
461
|
+
name: 'spotify_playlist_tracks',
|
|
462
|
+
description: 'Get tracks from a playlist',
|
|
463
|
+
inputSchema: {
|
|
464
|
+
type: 'object',
|
|
465
|
+
properties: {
|
|
466
|
+
playlistId: { type: 'string', description: 'Spotify playlist ID' },
|
|
467
|
+
limit: { type: 'number', description: 'Max tracks (default: 20)' },
|
|
468
|
+
},
|
|
469
|
+
required: ['playlistId'],
|
|
470
|
+
},
|
|
471
|
+
handler: async ({ playlistId, limit = 20 }: any) => {
|
|
472
|
+
const data = await this.spotifyFetch(`/playlists/${playlistId}/tracks`, {
|
|
473
|
+
params: {
|
|
474
|
+
limit: String(Math.min(limit, 100)),
|
|
475
|
+
fields: 'items(track(id,name,artists,album,duration_ms,popularity,uri,external_urls)),total',
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
return {
|
|
479
|
+
total: data.total ?? 0,
|
|
480
|
+
tracks: (data.items ?? []).filter((i: any) => i.track).map((i: any) => this.formatTrack(i.track)),
|
|
481
|
+
};
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
// ── spotify_top_tracks ─────────────────────────────────────────────────
|
|
486
|
+
{
|
|
487
|
+
name: 'spotify_top_tracks',
|
|
488
|
+
description: "Get the user's top tracks or artists",
|
|
489
|
+
inputSchema: {
|
|
490
|
+
type: 'object',
|
|
491
|
+
properties: {
|
|
492
|
+
type: {
|
|
493
|
+
type: 'string',
|
|
494
|
+
enum: ['tracks', 'artists'],
|
|
495
|
+
description: 'tracks or artists (default: tracks)',
|
|
496
|
+
},
|
|
497
|
+
timeRange: {
|
|
498
|
+
type: 'string',
|
|
499
|
+
enum: ['short_term', 'medium_term', 'long_term'],
|
|
500
|
+
description: 'short_term=4wk, medium_term=6mo, long_term=all time (default: medium_term)',
|
|
501
|
+
},
|
|
502
|
+
limit: { type: 'number', description: 'Max results (default: 10)' },
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
handler: async ({ type = 'tracks', timeRange = 'medium_term', limit = 10 }: any) => {
|
|
506
|
+
const data = await this.spotifyFetch(`/me/top/${type}`, {
|
|
507
|
+
params: { time_range: timeRange, limit: String(Math.min(limit, 50)) },
|
|
508
|
+
});
|
|
509
|
+
if (type === 'artists') {
|
|
510
|
+
return {
|
|
511
|
+
count: data.items?.length ?? 0,
|
|
512
|
+
timeRange,
|
|
513
|
+
artists: (data.items ?? []).map((a: any) => ({
|
|
514
|
+
rank: (data.items as any[]).indexOf(a) + 1,
|
|
515
|
+
name: a.name,
|
|
516
|
+
genres: a.genres?.slice(0, 3) ?? [],
|
|
517
|
+
popularity: a.popularity,
|
|
518
|
+
url: a.external_urls?.spotify ?? '',
|
|
519
|
+
})),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
return {
|
|
523
|
+
count: data.items?.length ?? 0,
|
|
524
|
+
timeRange,
|
|
525
|
+
tracks: (data.items ?? []).map((t: any, i: number) => ({
|
|
526
|
+
rank: i + 1,
|
|
527
|
+
...this.formatTrack(t),
|
|
528
|
+
})),
|
|
529
|
+
};
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
|
|
533
|
+
// ── spotify_recommendations ────────────────────────────────────────────
|
|
534
|
+
{
|
|
535
|
+
name: 'spotify_recommendations',
|
|
536
|
+
description: 'Get personalized track recommendations based on seed tracks, artists, or genres',
|
|
537
|
+
inputSchema: {
|
|
538
|
+
type: 'object',
|
|
539
|
+
properties: {
|
|
540
|
+
seedTracks: {
|
|
541
|
+
type: 'array',
|
|
542
|
+
items: { type: 'string' },
|
|
543
|
+
description: 'Up to 2 Spotify track IDs as seeds',
|
|
544
|
+
},
|
|
545
|
+
seedArtists: {
|
|
546
|
+
type: 'array',
|
|
547
|
+
items: { type: 'string' },
|
|
548
|
+
description: 'Up to 2 Spotify artist IDs as seeds',
|
|
549
|
+
},
|
|
550
|
+
seedGenres: {
|
|
551
|
+
type: 'array',
|
|
552
|
+
items: { type: 'string' },
|
|
553
|
+
description: 'Up to 2 genre strings (e.g. "pop", "hip-hop", "indie")',
|
|
554
|
+
},
|
|
555
|
+
limit: { type: 'number', description: 'Number of recommendations (default: 10)' },
|
|
556
|
+
energy: { type: 'number', description: 'Target energy 0.0–1.0' },
|
|
557
|
+
valence: { type: 'number', description: 'Target positivity/mood 0.0–1.0' },
|
|
558
|
+
tempo: { type: 'number', description: 'Target BPM' },
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
handler: async ({
|
|
562
|
+
seedTracks = [],
|
|
563
|
+
seedArtists = [],
|
|
564
|
+
seedGenres = [],
|
|
565
|
+
limit = 10,
|
|
566
|
+
energy,
|
|
567
|
+
valence,
|
|
568
|
+
tempo,
|
|
569
|
+
}: any) => {
|
|
570
|
+
const totalSeeds = seedTracks.length + seedArtists.length + seedGenres.length;
|
|
571
|
+
if (totalSeeds === 0) {
|
|
572
|
+
// Use user's current top track as seed
|
|
573
|
+
const top = await this.spotifyFetch('/me/top/tracks', {
|
|
574
|
+
params: { limit: '1', time_range: 'short_term' },
|
|
575
|
+
});
|
|
576
|
+
const topTrack = top.items?.[0];
|
|
577
|
+
if (topTrack) seedTracks = [topTrack.id];
|
|
578
|
+
else return { error: 'Provide at least one seed (track, artist, or genre).' };
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const params: Record<string, string> = {
|
|
582
|
+
limit: String(Math.min(limit, 100)),
|
|
583
|
+
};
|
|
584
|
+
if (seedTracks.length) params.seed_tracks = seedTracks.slice(0, 2).join(',');
|
|
585
|
+
if (seedArtists.length) params.seed_artists = seedArtists.slice(0, 2).join(',');
|
|
586
|
+
if (seedGenres.length) params.seed_genres = seedGenres.slice(0, 2).join(',');
|
|
587
|
+
if (energy !== undefined) params.target_energy = String(energy);
|
|
588
|
+
if (valence !== undefined) params.target_valence = String(valence);
|
|
589
|
+
if (tempo !== undefined) params.target_tempo = String(tempo);
|
|
590
|
+
|
|
591
|
+
const data = await this.spotifyFetch('/recommendations', { params });
|
|
592
|
+
return {
|
|
593
|
+
count: data.tracks?.length ?? 0,
|
|
594
|
+
tracks: (data.tracks ?? []).map(this.formatTrack.bind(this)),
|
|
595
|
+
};
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
// ── spotify_devices ────────────────────────────────────────────────────
|
|
600
|
+
{
|
|
601
|
+
name: 'spotify_devices',
|
|
602
|
+
description: 'List available Spotify playback devices',
|
|
603
|
+
inputSchema: { type: 'object', properties: {} },
|
|
604
|
+
handler: async () => {
|
|
605
|
+
const data = await this.spotifyFetch('/me/player/devices');
|
|
606
|
+
return {
|
|
607
|
+
count: data.devices?.length ?? 0,
|
|
608
|
+
devices: (data.devices ?? []).map((d: any) => ({
|
|
609
|
+
id: d.id,
|
|
610
|
+
name: d.name,
|
|
611
|
+
type: d.type,
|
|
612
|
+
active: d.is_active,
|
|
613
|
+
volume: d.volume_percent,
|
|
614
|
+
restricted: d.is_restricted,
|
|
615
|
+
})),
|
|
616
|
+
};
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
|
|
620
|
+
// ── spotify_shuffle ────────────────────────────────────────────────────
|
|
621
|
+
{
|
|
622
|
+
name: 'spotify_shuffle',
|
|
623
|
+
description: 'Toggle shuffle on or off',
|
|
624
|
+
inputSchema: {
|
|
625
|
+
type: 'object',
|
|
626
|
+
properties: {
|
|
627
|
+
state: { type: 'boolean', description: 'true = shuffle on, false = shuffle off' },
|
|
628
|
+
},
|
|
629
|
+
required: ['state'],
|
|
630
|
+
},
|
|
631
|
+
handler: async ({ state }: any) => {
|
|
632
|
+
await this.spotifyFetch('/me/player/shuffle', {
|
|
633
|
+
method: 'PUT',
|
|
634
|
+
params: { state: String(state) },
|
|
635
|
+
});
|
|
636
|
+
return { shuffle: state };
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
// ── spotify_recently_played ────────────────────────────────────────────
|
|
641
|
+
{
|
|
642
|
+
name: 'spotify_recently_played',
|
|
643
|
+
description: "Get the user's recently played tracks",
|
|
644
|
+
inputSchema: {
|
|
645
|
+
type: 'object',
|
|
646
|
+
properties: {
|
|
647
|
+
limit: { type: 'number', description: 'Number of tracks (default: 10, max: 50)' },
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
handler: async ({ limit = 10 }: any) => {
|
|
651
|
+
const data = await this.spotifyFetch('/me/player/recently-played', {
|
|
652
|
+
params: { limit: String(Math.min(limit, 50)) },
|
|
653
|
+
});
|
|
654
|
+
return {
|
|
655
|
+
count: data.items?.length ?? 0,
|
|
656
|
+
tracks: (data.items ?? []).map((i: any) => ({
|
|
657
|
+
...this.formatTrack(i.track),
|
|
658
|
+
playedAt: i.played_at,
|
|
659
|
+
})),
|
|
660
|
+
};
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
];
|
|
664
|
+
}
|
|
665
|
+
}
|