@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,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Calendar Plugin
|
|
3
|
+
*
|
|
4
|
+
* Read, create, update, and delete calendar events.
|
|
5
|
+
* Requires Google OAuth — stores access token as google / access_token.
|
|
6
|
+
*
|
|
7
|
+
* Scopes needed:
|
|
8
|
+
* https://www.googleapis.com/auth/calendar
|
|
9
|
+
* https://www.googleapis.com/auth/calendar.events
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Plugin, PluginTool } from '../manager.js';
|
|
13
|
+
import { Conductor } from '../../core/conductor.js';
|
|
14
|
+
import { Keychain } from '../../security/keychain.js';
|
|
15
|
+
|
|
16
|
+
const CAL_BASE = 'https://www.googleapis.com/calendar/v3';
|
|
17
|
+
|
|
18
|
+
export class GoogleCalendarPlugin implements Plugin {
|
|
19
|
+
name = 'gcal';
|
|
20
|
+
description = 'Read and manage Google Calendar events — requires Google OAuth';
|
|
21
|
+
version = '1.0.0';
|
|
22
|
+
|
|
23
|
+
configSchema = {
|
|
24
|
+
fields: [
|
|
25
|
+
{
|
|
26
|
+
key: 'access_token',
|
|
27
|
+
label: 'Google Access Token',
|
|
28
|
+
type: 'password' as const,
|
|
29
|
+
required: true,
|
|
30
|
+
secret: true,
|
|
31
|
+
service: 'google',
|
|
32
|
+
description: 'Shared with Gmail plugin. Run "conductor auth google" to setup.',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
private keychain!: Keychain;
|
|
38
|
+
|
|
39
|
+
async initialize(conductor: Conductor): Promise<void> {
|
|
40
|
+
this.keychain = new Keychain(conductor.getConfig().getConfigDir());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
isConfigured(): boolean {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async getContext(): Promise<string | null> {
|
|
48
|
+
try {
|
|
49
|
+
const now = new Date();
|
|
50
|
+
const endOfDay = new Date(now);
|
|
51
|
+
endOfDay.setHours(23, 59, 59, 999);
|
|
52
|
+
const data = await this.calFetch(
|
|
53
|
+
`/calendars/primary/events?timeMin=${encodeURIComponent(now.toISOString())}&timeMax=${encodeURIComponent(endOfDay.toISOString())}&singleEvents=true&orderBy=startTime&maxResults=5`,
|
|
54
|
+
);
|
|
55
|
+
const events = data?.items ?? [];
|
|
56
|
+
if (events.length === 0) return null;
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
const summaries = events.map((e: any) => e.summary ?? 'Untitled').join(', ');
|
|
59
|
+
return `[CALENDAR] Today: ${summaries}`;
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async getToken(): Promise<string> {
|
|
66
|
+
const token = await this.keychain.get('google', 'access_token');
|
|
67
|
+
if (!token) throw new Error('Google not authenticated. Run: conductor auth google');
|
|
68
|
+
return token;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private async calFetch(path: string, options: { method?: string; body?: any } = {}): Promise<any> {
|
|
72
|
+
const token = await this.getToken();
|
|
73
|
+
const res = await fetch(`${CAL_BASE}${path}`, {
|
|
74
|
+
method: options.method ?? 'GET',
|
|
75
|
+
headers: {
|
|
76
|
+
Authorization: `Bearer ${token}`,
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
},
|
|
79
|
+
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
80
|
+
});
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
const err = await res.text().catch(() => res.statusText);
|
|
83
|
+
if (res.status === 401) throw new Error('Google token expired. Re-authenticate: conductor auth google');
|
|
84
|
+
throw new Error(`Google Calendar API ${res.status}: ${err}`);
|
|
85
|
+
}
|
|
86
|
+
if (res.status === 204) return {};
|
|
87
|
+
return res.json();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Format a GCal event for output */
|
|
91
|
+
private formatEvent(e: any) {
|
|
92
|
+
return {
|
|
93
|
+
id: e.id,
|
|
94
|
+
summary: e.summary ?? '(no title)',
|
|
95
|
+
description: e.description ?? '',
|
|
96
|
+
location: e.location ?? '',
|
|
97
|
+
start: e.start?.dateTime ?? e.start?.date ?? '',
|
|
98
|
+
end: e.end?.dateTime ?? e.end?.date ?? '',
|
|
99
|
+
allDay: !!e.start?.date,
|
|
100
|
+
attendees: (e.attendees ?? []).map((a: any) => ({
|
|
101
|
+
email: a.email,
|
|
102
|
+
name: a.displayName ?? '',
|
|
103
|
+
status: a.responseStatus ?? 'needsAction',
|
|
104
|
+
})),
|
|
105
|
+
htmlLink: e.htmlLink ?? '',
|
|
106
|
+
status: e.status ?? 'confirmed',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getTools(): PluginTool[] {
|
|
111
|
+
return [
|
|
112
|
+
// ── gcal_list_calendars ─────────────────────────────────────────────────
|
|
113
|
+
{
|
|
114
|
+
name: 'gcal_list_calendars',
|
|
115
|
+
description: 'List all Google Calendars accessible to the user',
|
|
116
|
+
inputSchema: { type: 'object', properties: {} },
|
|
117
|
+
handler: async () => {
|
|
118
|
+
const res = await this.calFetch('/users/me/calendarList');
|
|
119
|
+
return {
|
|
120
|
+
count: res.items?.length ?? 0,
|
|
121
|
+
calendars: (res.items ?? []).map((c: any) => ({
|
|
122
|
+
id: c.id,
|
|
123
|
+
summary: c.summary,
|
|
124
|
+
primary: c.primary ?? false,
|
|
125
|
+
timeZone: c.timeZone ?? '',
|
|
126
|
+
color: c.colorId ?? '',
|
|
127
|
+
})),
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// ── gcal_list_events ────────────────────────────────────────────────────
|
|
133
|
+
{
|
|
134
|
+
name: 'gcal_list_events',
|
|
135
|
+
description: 'List upcoming calendar events',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
calendarId: {
|
|
140
|
+
type: 'string',
|
|
141
|
+
description: 'Calendar ID (default: "primary")',
|
|
142
|
+
},
|
|
143
|
+
timeMin: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'Start of time range (ISO 8601, default: now)',
|
|
146
|
+
},
|
|
147
|
+
timeMax: {
|
|
148
|
+
type: 'string',
|
|
149
|
+
description: 'End of time range (ISO 8601)',
|
|
150
|
+
},
|
|
151
|
+
maxResults: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
description: 'Max events to return (default: 10)',
|
|
154
|
+
},
|
|
155
|
+
q: {
|
|
156
|
+
type: 'string',
|
|
157
|
+
description: 'Free text search in event fields',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
handler: async ({ calendarId = 'primary', timeMin, timeMax, maxResults = 10, q }: any) => {
|
|
162
|
+
const params = new URLSearchParams({
|
|
163
|
+
singleEvents: 'true',
|
|
164
|
+
orderBy: 'startTime',
|
|
165
|
+
maxResults: String(Math.min(maxResults, 100)),
|
|
166
|
+
timeMin: timeMin ?? new Date().toISOString(),
|
|
167
|
+
});
|
|
168
|
+
if (timeMax) params.set('timeMax', timeMax);
|
|
169
|
+
if (q) params.set('q', q);
|
|
170
|
+
|
|
171
|
+
const res = await this.calFetch(`/calendars/${encodeURIComponent(calendarId)}/events?${params}`);
|
|
172
|
+
return {
|
|
173
|
+
count: res.items?.length ?? 0,
|
|
174
|
+
timeZone: res.timeZone ?? '',
|
|
175
|
+
events: (res.items ?? []).map(this.formatEvent.bind(this)),
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// ── gcal_get_event ──────────────────────────────────────────────────────
|
|
181
|
+
{
|
|
182
|
+
name: 'gcal_get_event',
|
|
183
|
+
description: 'Get full details of a specific calendar event',
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
eventId: { type: 'string', description: 'Event ID from gcal_list_events' },
|
|
188
|
+
calendarId: { type: 'string', description: 'Calendar ID (default: "primary")' },
|
|
189
|
+
},
|
|
190
|
+
required: ['eventId'],
|
|
191
|
+
},
|
|
192
|
+
handler: async ({ eventId, calendarId = 'primary' }: any) => {
|
|
193
|
+
const e = await this.calFetch(
|
|
194
|
+
`/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`,
|
|
195
|
+
);
|
|
196
|
+
return this.formatEvent(e);
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
// ── gcal_create_event ───────────────────────────────────────────────────
|
|
201
|
+
{
|
|
202
|
+
name: 'gcal_create_event',
|
|
203
|
+
description: 'Create a new Google Calendar event',
|
|
204
|
+
inputSchema: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
summary: { type: 'string', description: 'Event title' },
|
|
208
|
+
start: { type: 'string', description: 'Start time (ISO 8601)' },
|
|
209
|
+
end: { type: 'string', description: 'End time (ISO 8601)' },
|
|
210
|
+
description: { type: 'string', description: 'Event description' },
|
|
211
|
+
location: { type: 'string', description: 'Physical location or meeting link' },
|
|
212
|
+
attendees: {
|
|
213
|
+
type: 'array',
|
|
214
|
+
items: { type: 'string' },
|
|
215
|
+
description: 'List of attendee email addresses',
|
|
216
|
+
},
|
|
217
|
+
calendarId: { type: 'string', description: 'Calendar ID (default: "primary")' },
|
|
218
|
+
allDay: { type: 'boolean', description: 'Whether this is an all-day event' },
|
|
219
|
+
},
|
|
220
|
+
required: ['summary', 'start', 'end'],
|
|
221
|
+
},
|
|
222
|
+
handler: async ({
|
|
223
|
+
summary,
|
|
224
|
+
start,
|
|
225
|
+
end,
|
|
226
|
+
description,
|
|
227
|
+
location,
|
|
228
|
+
attendees = [],
|
|
229
|
+
calendarId = 'primary',
|
|
230
|
+
allDay = false,
|
|
231
|
+
}: any) => {
|
|
232
|
+
const body: any = {
|
|
233
|
+
summary,
|
|
234
|
+
description,
|
|
235
|
+
location,
|
|
236
|
+
attendees: attendees.map((email: string) => ({ email })),
|
|
237
|
+
start: allDay ? { date: start.split('T')[0] } : { dateTime: start },
|
|
238
|
+
end: allDay ? { date: end.split('T')[0] } : { dateTime: end },
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const e = await this.calFetch(`/calendars/${encodeURIComponent(calendarId)}/events`, {
|
|
242
|
+
method: 'POST',
|
|
243
|
+
body,
|
|
244
|
+
});
|
|
245
|
+
return { created: true, ...this.formatEvent(e) };
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
// ── gcal_update_event ───────────────────────────────────────────────────
|
|
250
|
+
{
|
|
251
|
+
name: 'gcal_update_event',
|
|
252
|
+
description: 'Update an existing Google Calendar event',
|
|
253
|
+
inputSchema: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
eventId: { type: 'string', description: 'Event ID to update' },
|
|
257
|
+
calendarId: { type: 'string', description: 'Calendar ID (default: "primary")' },
|
|
258
|
+
summary: { type: 'string', description: 'New title' },
|
|
259
|
+
start: { type: 'string', description: 'New start time (ISO 8601)' },
|
|
260
|
+
end: { type: 'string', description: 'New end time (ISO 8601)' },
|
|
261
|
+
description: { type: 'string', description: 'New description' },
|
|
262
|
+
location: { type: 'string', description: 'New location' },
|
|
263
|
+
},
|
|
264
|
+
required: ['eventId'],
|
|
265
|
+
},
|
|
266
|
+
handler: async ({ eventId, calendarId = 'primary', ...updates }: any) => {
|
|
267
|
+
// PATCH — only send provided fields
|
|
268
|
+
const patch: any = {};
|
|
269
|
+
if (updates.summary !== undefined) patch.summary = updates.summary;
|
|
270
|
+
if (updates.description !== undefined) patch.description = updates.description;
|
|
271
|
+
if (updates.location !== undefined) patch.location = updates.location;
|
|
272
|
+
if (updates.start !== undefined) patch.start = { dateTime: updates.start };
|
|
273
|
+
if (updates.end !== undefined) patch.end = { dateTime: updates.end };
|
|
274
|
+
|
|
275
|
+
const e = await this.calFetch(
|
|
276
|
+
`/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`,
|
|
277
|
+
{ method: 'PATCH', body: patch },
|
|
278
|
+
);
|
|
279
|
+
return { updated: true, ...this.formatEvent(e) };
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
// ── gcal_delete_event ───────────────────────────────────────────────────
|
|
284
|
+
{
|
|
285
|
+
name: 'gcal_delete_event',
|
|
286
|
+
description: 'Delete a Google Calendar event',
|
|
287
|
+
requiresApproval: true,
|
|
288
|
+
inputSchema: {
|
|
289
|
+
type: 'object',
|
|
290
|
+
properties: {
|
|
291
|
+
eventId: { type: 'string', description: 'Event ID to delete' },
|
|
292
|
+
calendarId: { type: 'string', description: 'Calendar ID (default: "primary")' },
|
|
293
|
+
},
|
|
294
|
+
required: ['eventId'],
|
|
295
|
+
},
|
|
296
|
+
handler: async ({ eventId, calendarId = 'primary' }: any) => {
|
|
297
|
+
await this.calFetch(`/calendars/${encodeURIComponent(calendarId)}/events/${encodeURIComponent(eventId)}`, {
|
|
298
|
+
method: 'DELETE',
|
|
299
|
+
});
|
|
300
|
+
return { deleted: true, eventId };
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Drive Plugin
|
|
3
|
+
*
|
|
4
|
+
* List, search, read, upload, and manage Google Drive files.
|
|
5
|
+
* Requires Google OAuth — google / access_token in keychain.
|
|
6
|
+
*
|
|
7
|
+
* Scopes needed:
|
|
8
|
+
* https://www.googleapis.com/auth/drive.readonly (for read-only)
|
|
9
|
+
* https://www.googleapis.com/auth/drive (for full access)
|
|
10
|
+
* https://www.googleapis.com/auth/drive.file (for files created by the app)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Plugin, PluginTool } from '../manager.js';
|
|
14
|
+
import { Conductor } from '../../core/conductor.js';
|
|
15
|
+
import { Keychain } from '../../security/keychain.js';
|
|
16
|
+
|
|
17
|
+
const DRIVE_BASE = 'https://www.googleapis.com/drive/v3';
|
|
18
|
+
const DRIVE_UPLOAD = 'https://www.googleapis.com/upload/drive/v3';
|
|
19
|
+
|
|
20
|
+
export class GoogleDrivePlugin implements Plugin {
|
|
21
|
+
name = 'gdrive';
|
|
22
|
+
description = 'List, search, read, and upload files in Google Drive — requires Google OAuth';
|
|
23
|
+
version = '1.0.0';
|
|
24
|
+
|
|
25
|
+
private keychain!: Keychain;
|
|
26
|
+
|
|
27
|
+
async initialize(conductor: Conductor): Promise<void> {
|
|
28
|
+
this.keychain = new Keychain(conductor.getConfig().getConfigDir());
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
isConfigured(): boolean {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private async getToken(): Promise<string> {
|
|
36
|
+
const token = await this.keychain.get('google', 'access_token');
|
|
37
|
+
if (!token) throw new Error('Google not authenticated. Run: conductor auth google');
|
|
38
|
+
return token;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private async driveFetch(
|
|
42
|
+
path: string,
|
|
43
|
+
options: {
|
|
44
|
+
method?: string;
|
|
45
|
+
body?: any;
|
|
46
|
+
base?: string;
|
|
47
|
+
rawBody?: Buffer | string;
|
|
48
|
+
contentType?: string;
|
|
49
|
+
} = {},
|
|
50
|
+
): Promise<any> {
|
|
51
|
+
const token = await this.getToken();
|
|
52
|
+
const base = options.base ?? DRIVE_BASE;
|
|
53
|
+
const isRaw = options.rawBody !== undefined;
|
|
54
|
+
|
|
55
|
+
const res = await fetch(`${base}${path}`, {
|
|
56
|
+
method: options.method ?? 'GET',
|
|
57
|
+
headers: {
|
|
58
|
+
Authorization: `Bearer ${token}`,
|
|
59
|
+
...(isRaw ? { 'Content-Type': options.contentType ?? 'text/plain' } : { 'Content-Type': 'application/json' }),
|
|
60
|
+
},
|
|
61
|
+
body: isRaw ? options.rawBody : options.body ? JSON.stringify(options.body) : undefined,
|
|
62
|
+
});
|
|
63
|
+
if (!res.ok) {
|
|
64
|
+
const err = await res.text().catch(() => res.statusText);
|
|
65
|
+
if (res.status === 401) throw new Error('Google token expired. Re-authenticate: conductor auth google');
|
|
66
|
+
throw new Error(`Google Drive API ${res.status}: ${err}`);
|
|
67
|
+
}
|
|
68
|
+
if (res.status === 204) return {};
|
|
69
|
+
const ct = res.headers.get('content-type') ?? '';
|
|
70
|
+
if (ct.includes('application/json')) return res.json();
|
|
71
|
+
return res.text();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private formatFile(f: any) {
|
|
75
|
+
return {
|
|
76
|
+
id: f.id,
|
|
77
|
+
name: f.name,
|
|
78
|
+
mimeType: f.mimeType,
|
|
79
|
+
size: f.size ? Number(f.size) : null,
|
|
80
|
+
modifiedTime: f.modifiedTime ?? '',
|
|
81
|
+
createdTime: f.createdTime ?? '',
|
|
82
|
+
webViewLink: f.webViewLink ?? '',
|
|
83
|
+
parents: f.parents ?? [],
|
|
84
|
+
shared: f.shared ?? false,
|
|
85
|
+
trashed: f.trashed ?? false,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getTools(): PluginTool[] {
|
|
90
|
+
return [
|
|
91
|
+
// ── gdrive_list ─────────────────────────────────────────────────────────
|
|
92
|
+
{
|
|
93
|
+
name: 'gdrive_list',
|
|
94
|
+
description: 'List files and folders in Google Drive',
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
folderId: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
description: 'Folder ID to list contents of (default: root)',
|
|
101
|
+
},
|
|
102
|
+
maxResults: { type: 'number', description: 'Max files to return (default: 20)' },
|
|
103
|
+
orderBy: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'Sort order e.g. "modifiedTime desc", "name"',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
handler: async ({ folderId = 'root', maxResults = 20, orderBy = 'modifiedTime desc' }: any) => {
|
|
110
|
+
const q = `'${folderId}' in parents and trashed = false`;
|
|
111
|
+
const fields = 'files(id,name,mimeType,size,modifiedTime,webViewLink,shared)';
|
|
112
|
+
const params = new URLSearchParams({
|
|
113
|
+
q,
|
|
114
|
+
fields,
|
|
115
|
+
pageSize: String(Math.min(maxResults, 100)),
|
|
116
|
+
orderBy,
|
|
117
|
+
});
|
|
118
|
+
const res = await this.driveFetch(`/files?${params}`);
|
|
119
|
+
return {
|
|
120
|
+
count: res.files?.length ?? 0,
|
|
121
|
+
files: (res.files ?? []).map(this.formatFile.bind(this)),
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
// ── gdrive_search ───────────────────────────────────────────────────────
|
|
127
|
+
{
|
|
128
|
+
name: 'gdrive_search',
|
|
129
|
+
description:
|
|
130
|
+
'Search Google Drive files by name or content. Supports Drive query syntax e.g. name contains "budget" mimeType="application/vnd.google-apps.spreadsheet"',
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
query: { type: 'string', description: 'Search query (file name or Drive query)' },
|
|
135
|
+
maxResults: { type: 'number', description: 'Max results (default: 10)' },
|
|
136
|
+
},
|
|
137
|
+
required: ['query'],
|
|
138
|
+
},
|
|
139
|
+
handler: async ({ query, maxResults = 10 }: any) => {
|
|
140
|
+
// If query looks like a plain name search (no Drive operators), wrap it
|
|
141
|
+
const q =
|
|
142
|
+
query.includes('=') || query.includes(' and ') || query.includes(' or ')
|
|
143
|
+
? `(${query}) and trashed = false`
|
|
144
|
+
: `name contains '${query.replace(/'/g, "\\'")}' and trashed = false`;
|
|
145
|
+
|
|
146
|
+
const fields = 'files(id,name,mimeType,size,modifiedTime,webViewLink,parents)';
|
|
147
|
+
const params = new URLSearchParams({
|
|
148
|
+
q,
|
|
149
|
+
fields,
|
|
150
|
+
pageSize: String(Math.min(maxResults, 50)),
|
|
151
|
+
});
|
|
152
|
+
const res = await this.driveFetch(`/files?${params}`);
|
|
153
|
+
return {
|
|
154
|
+
count: res.files?.length ?? 0,
|
|
155
|
+
files: (res.files ?? []).map(this.formatFile.bind(this)),
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
// ── gdrive_get ──────────────────────────────────────────────────────────
|
|
161
|
+
{
|
|
162
|
+
name: 'gdrive_get',
|
|
163
|
+
description: 'Get metadata about a specific Drive file',
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
fileId: { type: 'string', description: 'Google Drive file ID' },
|
|
168
|
+
},
|
|
169
|
+
required: ['fileId'],
|
|
170
|
+
},
|
|
171
|
+
handler: async ({ fileId }: any) => {
|
|
172
|
+
const fields = 'id,name,mimeType,size,modifiedTime,createdTime,webViewLink,parents,shared,trashed,owners';
|
|
173
|
+
const f = await this.driveFetch(`/files/${encodeURIComponent(fileId)}?fields=${fields}`);
|
|
174
|
+
return {
|
|
175
|
+
...this.formatFile(f),
|
|
176
|
+
owners: (f.owners ?? []).map((o: any) => ({ email: o.emailAddress, name: o.displayName })),
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
// ── gdrive_read ─────────────────────────────────────────────────────────
|
|
182
|
+
{
|
|
183
|
+
name: 'gdrive_read',
|
|
184
|
+
description:
|
|
185
|
+
'Read the text content of a Drive file. ' +
|
|
186
|
+
'Google Docs/Sheets/Slides are exported as plain text. ' +
|
|
187
|
+
'Binary files return an error.',
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: 'object',
|
|
190
|
+
properties: {
|
|
191
|
+
fileId: { type: 'string', description: 'Google Drive file ID' },
|
|
192
|
+
maxChars: { type: 'number', description: 'Max characters to return (default: 10000)' },
|
|
193
|
+
},
|
|
194
|
+
required: ['fileId'],
|
|
195
|
+
},
|
|
196
|
+
handler: async ({ fileId, maxChars = 10000 }: any) => {
|
|
197
|
+
// Get metadata first to determine how to export
|
|
198
|
+
const meta = await this.driveFetch(`/files/${encodeURIComponent(fileId)}?fields=name,mimeType,size`);
|
|
199
|
+
|
|
200
|
+
let content: string;
|
|
201
|
+
const mimeType: string = meta.mimeType ?? '';
|
|
202
|
+
|
|
203
|
+
const GOOGLE_EXPORTS: Record<string, string> = {
|
|
204
|
+
'application/vnd.google-apps.document': 'text/plain',
|
|
205
|
+
'application/vnd.google-apps.spreadsheet': 'text/csv',
|
|
206
|
+
'application/vnd.google-apps.presentation': 'text/plain',
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
if (GOOGLE_EXPORTS[mimeType]) {
|
|
210
|
+
content = await this.driveFetch(
|
|
211
|
+
`/files/${encodeURIComponent(fileId)}/export?mimeType=${encodeURIComponent(GOOGLE_EXPORTS[mimeType])}`,
|
|
212
|
+
);
|
|
213
|
+
} else if (mimeType.startsWith('text/') || mimeType === 'application/json') {
|
|
214
|
+
content = await this.driveFetch(`/files/${encodeURIComponent(fileId)}?alt=media`);
|
|
215
|
+
} else {
|
|
216
|
+
return {
|
|
217
|
+
error: `Cannot read binary file (${mimeType}). Use gdrive_get for metadata.`,
|
|
218
|
+
name: meta.name,
|
|
219
|
+
mimeType,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const text = String(content);
|
|
224
|
+
return {
|
|
225
|
+
name: meta.name,
|
|
226
|
+
mimeType,
|
|
227
|
+
length: text.length,
|
|
228
|
+
truncated: text.length > maxChars,
|
|
229
|
+
content: text.slice(0, maxChars),
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
// ── gdrive_create_folder ────────────────────────────────────────────────
|
|
235
|
+
{
|
|
236
|
+
name: 'gdrive_create_folder',
|
|
237
|
+
description: 'Create a new folder in Google Drive',
|
|
238
|
+
inputSchema: {
|
|
239
|
+
type: 'object',
|
|
240
|
+
properties: {
|
|
241
|
+
name: { type: 'string', description: 'Folder name' },
|
|
242
|
+
parentId: { type: 'string', description: 'Parent folder ID (default: root)' },
|
|
243
|
+
},
|
|
244
|
+
required: ['name'],
|
|
245
|
+
},
|
|
246
|
+
handler: async ({ name, parentId = 'root' }: any) => {
|
|
247
|
+
const f = await this.driveFetch('/files', {
|
|
248
|
+
method: 'POST',
|
|
249
|
+
body: {
|
|
250
|
+
name,
|
|
251
|
+
mimeType: 'application/vnd.google-apps.folder',
|
|
252
|
+
parents: [parentId],
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
return { created: true, id: f.id, name: f.name, webViewLink: f.webViewLink ?? '' };
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
// ── gdrive_upload_text ──────────────────────────────────────────────────
|
|
260
|
+
{
|
|
261
|
+
name: 'gdrive_upload_text',
|
|
262
|
+
description: 'Upload a text file to Google Drive',
|
|
263
|
+
inputSchema: {
|
|
264
|
+
type: 'object',
|
|
265
|
+
properties: {
|
|
266
|
+
name: { type: 'string', description: 'File name including extension' },
|
|
267
|
+
content: { type: 'string', description: 'Text content to upload' },
|
|
268
|
+
parentId: { type: 'string', description: 'Parent folder ID (default: root)' },
|
|
269
|
+
mimeType: {
|
|
270
|
+
type: 'string',
|
|
271
|
+
description: 'MIME type (default: text/plain)',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
required: ['name', 'content'],
|
|
275
|
+
},
|
|
276
|
+
handler: async ({ name, content, parentId = 'root', mimeType = 'text/plain' }: any) => {
|
|
277
|
+
// Multipart upload
|
|
278
|
+
const boundary = `conductor_${Date.now()}`;
|
|
279
|
+
const metadata = JSON.stringify({ name, parents: [parentId] });
|
|
280
|
+
const body = [
|
|
281
|
+
`--${boundary}`,
|
|
282
|
+
'Content-Type: application/json; charset=UTF-8',
|
|
283
|
+
'',
|
|
284
|
+
metadata,
|
|
285
|
+
`--${boundary}`,
|
|
286
|
+
`Content-Type: ${mimeType}`,
|
|
287
|
+
'',
|
|
288
|
+
content,
|
|
289
|
+
`--${boundary}--`,
|
|
290
|
+
].join('\r\n');
|
|
291
|
+
|
|
292
|
+
const token = await this.getToken();
|
|
293
|
+
const res = await fetch(`${DRIVE_UPLOAD}/files?uploadType=multipart`, {
|
|
294
|
+
method: 'POST',
|
|
295
|
+
headers: {
|
|
296
|
+
Authorization: `Bearer ${token}`,
|
|
297
|
+
'Content-Type': `multipart/related; boundary=${boundary}`,
|
|
298
|
+
},
|
|
299
|
+
body,
|
|
300
|
+
});
|
|
301
|
+
if (!res.ok) throw new Error(`Drive upload failed: ${res.status} ${res.statusText}`);
|
|
302
|
+
const f = (await res.json()) as any;
|
|
303
|
+
return { uploaded: true, id: f.id, name: f.name };
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
// ── gdrive_delete ───────────────────────────────────────────────────────
|
|
308
|
+
{
|
|
309
|
+
name: 'gdrive_delete',
|
|
310
|
+
description: 'Permanently delete a file from Google Drive',
|
|
311
|
+
requiresApproval: true,
|
|
312
|
+
inputSchema: {
|
|
313
|
+
type: 'object',
|
|
314
|
+
properties: {
|
|
315
|
+
fileId: { type: 'string', description: 'File ID to delete' },
|
|
316
|
+
},
|
|
317
|
+
required: ['fileId'],
|
|
318
|
+
},
|
|
319
|
+
handler: async ({ fileId }: any) => {
|
|
320
|
+
await this.driveFetch(`/files/${encodeURIComponent(fileId)}`, { method: 'DELETE' });
|
|
321
|
+
return { deleted: true, fileId };
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
}
|