opc-agent 4.1.2 → 4.1.4
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/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/channels/dingtalk.d.ts.map +1 -0
- package/dist/channels/dingtalk.js.map +1 -0
- package/dist/channels/discord.d.ts.map +1 -0
- package/dist/channels/discord.js.map +1 -0
- package/dist/channels/email.d.ts.map +1 -0
- package/dist/channels/email.js.map +1 -0
- package/dist/channels/feishu.d.ts.map +1 -0
- package/dist/channels/feishu.js.map +1 -0
- package/dist/channels/googlechat.d.ts.map +1 -0
- package/dist/channels/googlechat.js.map +1 -0
- package/dist/channels/imessage.d.ts.map +1 -0
- package/dist/channels/imessage.js.map +1 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/irc.d.ts.map +1 -0
- package/dist/channels/irc.js.map +1 -0
- package/dist/channels/line.d.ts.map +1 -0
- package/dist/channels/line.js.map +1 -0
- package/dist/channels/matrix.d.ts.map +1 -0
- package/dist/channels/matrix.js.map +1 -0
- package/dist/channels/mattermost.d.ts.map +1 -0
- package/dist/channels/mattermost.js.map +1 -0
- package/dist/channels/msteams.d.ts.map +1 -0
- package/dist/channels/msteams.js.map +1 -0
- package/dist/channels/nostr.d.ts.map +1 -0
- package/dist/channels/nostr.js.map +1 -0
- package/dist/channels/qq.d.ts.map +1 -0
- package/dist/channels/qq.js.map +1 -0
- package/dist/channels/signal.d.ts.map +1 -0
- package/dist/channels/signal.js.map +1 -0
- package/dist/channels/slack.d.ts.map +1 -0
- package/dist/channels/slack.js.map +1 -0
- package/dist/channels/sms.d.ts.map +1 -0
- package/dist/channels/sms.js.map +1 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/twitch.d.ts.map +1 -0
- package/dist/channels/twitch.js.map +1 -0
- package/dist/channels/voice-call.d.ts.map +1 -0
- package/dist/channels/voice-call.js.map +1 -0
- package/dist/channels/voice.d.ts.map +1 -0
- package/dist/channels/voice.js.map +1 -0
- package/dist/channels/web.d.ts.map +1 -0
- package/dist/channels/web.js.map +1 -0
- package/dist/channels/webhook.d.ts.map +1 -0
- package/dist/channels/webhook.js.map +1 -0
- package/dist/channels/websocket.d.ts.map +1 -0
- package/dist/channels/websocket.js.map +1 -0
- package/dist/channels/wechat.d.ts.map +1 -0
- package/dist/channels/wechat.js.map +1 -0
- package/dist/channels/whatsapp.d.ts.map +1 -0
- package/dist/channels/whatsapp.js.map +1 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +108 -11
- package/dist/cli.js.map +1 -0
- package/dist/core/a2a.d.ts.map +1 -0
- package/dist/core/a2a.js.map +1 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/analytics-engine.d.ts.map +1 -0
- package/dist/core/analytics-engine.js.map +1 -0
- package/dist/core/api-server.d.ts.map +1 -0
- package/dist/core/api-server.js.map +1 -0
- package/dist/core/audio.d.ts.map +1 -0
- package/dist/core/audio.js.map +1 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/collaboration.d.ts.map +1 -0
- package/dist/core/collaboration.js.map +1 -0
- package/dist/core/compose.d.ts.map +1 -0
- package/dist/core/compose.js.map +1 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/context-discovery.d.ts.map +1 -0
- package/dist/core/context-discovery.js.map +1 -0
- package/dist/core/context-refs.d.ts.map +1 -0
- package/dist/core/context-refs.js.map +1 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/gateway.d.ts.map +1 -0
- package/dist/core/gateway.js.map +1 -0
- package/dist/core/heartbeat.d.ts.map +1 -0
- package/dist/core/heartbeat.js.map +1 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/ide-bridge.d.ts.map +1 -0
- package/dist/core/ide-bridge.js.map +1 -0
- package/dist/core/knowledge.d.ts.map +1 -0
- package/dist/core/knowledge.js.map +1 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/model-recommender.d.ts +40 -0
- package/dist/core/model-recommender.d.ts.map +1 -0
- package/dist/core/model-recommender.js +186 -0
- package/dist/core/model-recommender.js.map +1 -0
- package/dist/core/node-network.d.ts.map +1 -0
- package/dist/core/node-network.js.map +1 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/performance.d.ts.map +1 -0
- package/dist/core/performance.js.map +1 -0
- package/dist/core/profiles.d.ts.map +1 -0
- package/dist/core/profiles.js.map +1 -0
- package/dist/core/rate-limiter.d.ts.map +1 -0
- package/dist/core/rate-limiter.js.map +1 -0
- package/dist/core/room.d.ts.map +1 -0
- package/dist/core/room.js.map +1 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/sandbox.d.ts.map +1 -0
- package/dist/core/sandbox.js.map +1 -0
- package/dist/core/scheduler.d.ts.map +1 -0
- package/dist/core/scheduler.js.map +1 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/streaming.d.ts.map +1 -0
- package/dist/core/streaming.js.map +1 -0
- package/dist/core/subagent.d.ts.map +1 -0
- package/dist/core/subagent.js.map +1 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/versioning.d.ts.map +1 -0
- package/dist/core/versioning.js.map +1 -0
- package/dist/core/vision.d.ts.map +1 -0
- package/dist/core/vision.js.map +1 -0
- package/dist/core/watch.d.ts.map +1 -0
- package/dist/core/watch.js.map +1 -0
- package/dist/core/workflow-graph.d.ts.map +1 -0
- package/dist/core/workflow-graph.js.map +1 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js.map +1 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js.map +1 -0
- package/dist/deploy/hermes.d.ts.map +1 -0
- package/dist/deploy/hermes.js.map +1 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/deploy/openclaw.d.ts.map +1 -0
- package/dist/deploy/openclaw.js.map +1 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js.map +1 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/hub/brain-seed.d.ts.map +1 -0
- package/dist/hub/brain-seed.js.map +1 -0
- package/dist/hub/client.d.ts.map +1 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -0
- package/dist/mcp/servers/calculator-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/calculator-mcp.js.map +1 -0
- package/dist/mcp/servers/crypto-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/crypto-mcp.js.map +1 -0
- package/dist/mcp/servers/database-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/database-mcp.js.map +1 -0
- package/dist/mcp/servers/datetime-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/datetime-mcp.js.map +1 -0
- package/dist/mcp/servers/filesystem.d.ts.map +1 -0
- package/dist/mcp/servers/filesystem.js.map +1 -0
- package/dist/mcp/servers/github-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/github-mcp.js.map +1 -0
- package/dist/mcp/servers/index.d.ts.map +1 -0
- package/dist/mcp/servers/index.js.map +1 -0
- package/dist/mcp/servers/json-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/json-mcp.js.map +1 -0
- package/dist/mcp/servers/memory-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/memory-mcp.js.map +1 -0
- package/dist/mcp/servers/regex-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/regex-mcp.js.map +1 -0
- package/dist/mcp/servers/web-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/web-mcp.js.map +1 -0
- package/dist/memory/context-compressor.d.ts.map +1 -0
- package/dist/memory/context-compressor.js.map +1 -0
- package/dist/memory/deepbrain.d.ts.map +1 -0
- package/dist/memory/deepbrain.js.map +1 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/seed-loader.d.ts.map +1 -0
- package/dist/memory/seed-loader.js.map +1 -0
- package/dist/memory/user-profiler.d.ts.map +1 -0
- package/dist/memory/user-profiler.js.map +1 -0
- package/dist/plugins/content-filter.d.ts.map +1 -0
- package/dist/plugins/content-filter.js.map +1 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/logger.d.ts.map +1 -0
- package/dist/plugins/logger.js.map +1 -0
- package/dist/plugins/rate-limiter.d.ts.map +1 -0
- package/dist/plugins/rate-limiter.js.map +1 -0
- package/dist/protocols/a2a/client.d.ts.map +1 -0
- package/dist/protocols/a2a/client.js.map +1 -0
- package/dist/protocols/a2a/index.d.ts.map +1 -0
- package/dist/protocols/a2a/index.js.map +1 -0
- package/dist/protocols/a2a/server.d.ts.map +1 -0
- package/dist/protocols/a2a/server.js.map +1 -0
- package/dist/protocols/a2a/types.d.ts.map +1 -0
- package/dist/protocols/a2a/types.js.map +1 -0
- package/dist/protocols/a2a/utils.d.ts.map +1 -0
- package/dist/protocols/a2a/utils.js.map +1 -0
- package/dist/protocols/agui/client.d.ts.map +1 -0
- package/dist/protocols/agui/client.js.map +1 -0
- package/dist/protocols/agui/index.d.ts.map +1 -0
- package/dist/protocols/agui/index.js.map +1 -0
- package/dist/protocols/agui/server.d.ts.map +1 -0
- package/dist/protocols/agui/server.js.map +1 -0
- package/dist/protocols/agui/types.d.ts.map +1 -0
- package/dist/protocols/agui/types.js.map +1 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/protocols/mcp/agent-tools.d.ts.map +1 -0
- package/dist/protocols/mcp/agent-tools.js.map +1 -0
- package/dist/protocols/mcp/index.d.ts.map +1 -0
- package/dist/protocols/mcp/index.js.map +1 -0
- package/dist/protocols/mcp/server.d.ts.map +1 -0
- package/dist/protocols/mcp/server.js.map +1 -0
- package/dist/protocols/mcp/types.d.ts.map +1 -0
- package/dist/protocols/mcp/types.js.map +1 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/scheduler/cron-engine.d.ts.map +1 -0
- package/dist/scheduler/cron-engine.js.map +1 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/schema/oad.d.ts.map +1 -0
- package/dist/schema/oad.js.map +1 -0
- package/dist/security/approval.d.ts.map +1 -0
- package/dist/security/approval.js.map +1 -0
- package/dist/security/approvals.d.ts.map +1 -0
- package/dist/security/approvals.js.map +1 -0
- package/dist/security/elevated.d.ts.map +1 -0
- package/dist/security/elevated.js.map +1 -0
- package/dist/security/guardrails.d.ts.map +1 -0
- package/dist/security/guardrails.js.map +1 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/keys.d.ts.map +1 -0
- package/dist/security/keys.js.map +1 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/secrets.js.map +1 -0
- package/dist/skills/auto-learn.d.ts.map +1 -0
- package/dist/skills/auto-learn.js.map +1 -0
- package/dist/skills/base.d.ts.map +1 -0
- package/dist/skills/base.js.map +1 -0
- package/dist/skills/builtin/index.d.ts.map +1 -0
- package/dist/skills/builtin/index.js.map +1 -0
- package/dist/skills/document.d.ts.map +1 -0
- package/dist/skills/document.js.map +1 -0
- package/dist/skills/http.d.ts.map +1 -0
- package/dist/skills/http.js.map +1 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/marketplace.d.ts.map +1 -0
- package/dist/skills/marketplace.js.map +1 -0
- package/dist/skills/scheduler.d.ts.map +1 -0
- package/dist/skills/scheduler.js.map +1 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/webhook-trigger.d.ts.map +1 -0
- package/dist/skills/webhook-trigger.js.map +1 -0
- package/dist/studio/server.d.ts.map +1 -0
- package/dist/studio/server.js.map +1 -0
- package/dist/studio/templates-data.d.ts.map +1 -0
- package/dist/studio/templates-data.js.map +1 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/templates/code-reviewer.d.ts.map +1 -0
- package/dist/templates/code-reviewer.js.map +1 -0
- package/dist/templates/content-writer.d.ts.map +1 -0
- package/dist/templates/content-writer.js.map +1 -0
- package/dist/templates/customer-service.d.ts.map +1 -0
- package/dist/templates/customer-service.js.map +1 -0
- package/dist/templates/data-analyst.d.ts.map +1 -0
- package/dist/templates/data-analyst.js.map +1 -0
- package/dist/templates/executive-assistant.d.ts.map +1 -0
- package/dist/templates/executive-assistant.js.map +1 -0
- package/dist/templates/financial-advisor.d.ts.map +1 -0
- package/dist/templates/financial-advisor.js.map +1 -0
- package/dist/templates/hr-recruiter.d.ts.map +1 -0
- package/dist/templates/hr-recruiter.js.map +1 -0
- package/dist/templates/knowledge-base.d.ts.map +1 -0
- package/dist/templates/knowledge-base.js.map +1 -0
- package/dist/templates/legal-assistant.d.ts.map +1 -0
- package/dist/templates/legal-assistant.js.map +1 -0
- package/dist/templates/project-manager.d.ts.map +1 -0
- package/dist/templates/project-manager.js.map +1 -0
- package/dist/templates/sales-assistant.d.ts.map +1 -0
- package/dist/templates/sales-assistant.js.map +1 -0
- package/dist/templates/teacher.d.ts.map +1 -0
- package/dist/templates/teacher.js.map +1 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tools/builtin/browser.d.ts.map +1 -0
- package/dist/tools/builtin/browser.js.map +1 -0
- package/dist/tools/builtin/datetime.d.ts.map +1 -0
- package/dist/tools/builtin/datetime.js.map +1 -0
- package/dist/tools/builtin/file.d.ts.map +1 -0
- package/dist/tools/builtin/file.js.map +1 -0
- package/dist/tools/builtin/home-assistant.d.ts.map +1 -0
- package/dist/tools/builtin/home-assistant.js.map +1 -0
- package/dist/tools/builtin/index.d.ts.map +1 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/rl-tools.d.ts.map +1 -0
- package/dist/tools/builtin/rl-tools.js.map +1 -0
- package/dist/tools/builtin/shell.d.ts.map +1 -0
- package/dist/tools/builtin/shell.js.map +1 -0
- package/dist/tools/builtin/vision.d.ts.map +1 -0
- package/dist/tools/builtin/vision.js.map +1 -0
- package/dist/tools/builtin/web-search.d.ts.map +1 -0
- package/dist/tools/builtin/web-search.js.map +1 -0
- package/dist/tools/builtin/web.d.ts.map +1 -0
- package/dist/tools/builtin/web.js.map +1 -0
- package/dist/tools/calculator.d.ts.map +1 -0
- package/dist/tools/calculator.js.map +1 -0
- package/dist/tools/datetime.d.ts.map +1 -0
- package/dist/tools/datetime.js.map +1 -0
- package/dist/tools/document-processor.d.ts.map +1 -0
- package/dist/tools/document-processor.js.map +1 -0
- package/dist/tools/gateway.d.ts.map +1 -0
- package/dist/tools/gateway.js.map +1 -0
- package/dist/tools/image-generator.d.ts.map +1 -0
- package/dist/tools/image-generator.js.map +1 -0
- package/dist/tools/integrations/calendar.d.ts.map +1 -0
- package/dist/tools/integrations/calendar.js.map +1 -0
- package/dist/tools/integrations/code-exec.d.ts.map +1 -0
- package/dist/tools/integrations/code-exec.js.map +1 -0
- package/dist/tools/integrations/csv-analyzer.d.ts.map +1 -0
- package/dist/tools/integrations/csv-analyzer.js.map +1 -0
- package/dist/tools/integrations/database.d.ts.map +1 -0
- package/dist/tools/integrations/database.js.map +1 -0
- package/dist/tools/integrations/email-send.d.ts.map +1 -0
- package/dist/tools/integrations/email-send.js.map +1 -0
- package/dist/tools/integrations/git-tool.d.ts.map +1 -0
- package/dist/tools/integrations/git-tool.js.map +1 -0
- package/dist/tools/integrations/github-tool.d.ts.map +1 -0
- package/dist/tools/integrations/github-tool.js.map +1 -0
- package/dist/tools/integrations/image-gen.d.ts.map +1 -0
- package/dist/tools/integrations/image-gen.js.map +1 -0
- package/dist/tools/integrations/index.d.ts.map +1 -0
- package/dist/tools/integrations/index.js.map +1 -0
- package/dist/tools/integrations/jira.d.ts.map +1 -0
- package/dist/tools/integrations/jira.js.map +1 -0
- package/dist/tools/integrations/notion.d.ts.map +1 -0
- package/dist/tools/integrations/notion.js.map +1 -0
- package/dist/tools/integrations/npm-tool.d.ts.map +1 -0
- package/dist/tools/integrations/npm-tool.js.map +1 -0
- package/dist/tools/integrations/pdf-reader.d.ts.map +1 -0
- package/dist/tools/integrations/pdf-reader.js.map +1 -0
- package/dist/tools/integrations/slack.d.ts.map +1 -0
- package/dist/tools/integrations/slack.js.map +1 -0
- package/dist/tools/integrations/summarizer.d.ts.map +1 -0
- package/dist/tools/integrations/summarizer.js.map +1 -0
- package/dist/tools/integrations/translator.d.ts.map +1 -0
- package/dist/tools/integrations/translator.js.map +1 -0
- package/dist/tools/integrations/trello.d.ts.map +1 -0
- package/dist/tools/integrations/trello.js.map +1 -0
- package/dist/tools/integrations/vector-search.d.ts.map +1 -0
- package/dist/tools/integrations/vector-search.js.map +1 -0
- package/dist/tools/integrations/web-scraper.d.ts.map +1 -0
- package/dist/tools/integrations/web-scraper.js.map +1 -0
- package/dist/tools/integrations/web-search.d.ts.map +1 -0
- package/dist/tools/integrations/web-search.js.map +1 -0
- package/dist/tools/integrations/webhook.d.ts.map +1 -0
- package/dist/tools/integrations/webhook.js.map +1 -0
- package/dist/tools/json-transform.d.ts.map +1 -0
- package/dist/tools/json-transform.js.map +1 -0
- package/dist/tools/mcp-client.d.ts.map +1 -0
- package/dist/tools/mcp-client.js.map +1 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/text-analysis.d.ts.map +1 -0
- package/dist/tools/text-analysis.js.map +1 -0
- package/dist/tools/web-scraper.d.ts.map +1 -0
- package/dist/tools/web-scraper.js.map +1 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/traces/index.d.ts.map +1 -0
- package/dist/traces/index.js.map +1 -0
- package/dist/ui/components.d.ts.map +1 -0
- package/dist/ui/components.js.map +1 -0
- package/models.json +164 -0
- package/package.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -20
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -14
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -13
- package/.github/workflows/ci.yml +0 -24
- package/USABILITY-ISSUES.md +0 -73
- package/docs/.vitepress/config.ts +0 -103
- package/docs/api/cli.md +0 -48
- package/docs/api/oad-schema.md +0 -64
- package/docs/api/sdk.md +0 -80
- package/docs/guide/concepts.md +0 -51
- package/docs/guide/configuration.md +0 -79
- package/docs/guide/deployment.md +0 -42
- package/docs/guide/getting-started.md +0 -44
- package/docs/guide/templates.md +0 -28
- package/docs/guide/testing.md +0 -84
- package/docs/index.md +0 -27
- package/docs/zh/api/cli.md +0 -54
- package/docs/zh/api/oad-schema.md +0 -87
- package/docs/zh/api/sdk.md +0 -102
- package/docs/zh/guide/concepts.md +0 -104
- package/docs/zh/guide/configuration.md +0 -135
- package/docs/zh/guide/deployment.md +0 -81
- package/docs/zh/guide/getting-started.md +0 -82
- package/docs/zh/guide/templates.md +0 -84
- package/docs/zh/guide/testing.md +0 -88
- package/docs/zh/index.md +0 -27
- package/fix-sidebar.mjs +0 -188
- package/serve-studio.js +0 -13
- package/serve-test.js +0 -25
- package/src/analytics/index.ts +0 -66
- package/src/channels/dingtalk.ts +0 -46
- package/src/channels/discord.ts +0 -192
- package/src/channels/email.ts +0 -351
- package/src/channels/feishu.ts +0 -349
- package/src/channels/googlechat.ts +0 -42
- package/src/channels/imessage.ts +0 -32
- package/src/channels/index.ts +0 -15
- package/src/channels/irc.ts +0 -82
- package/src/channels/line.ts +0 -33
- package/src/channels/matrix.ts +0 -34
- package/src/channels/mattermost.ts +0 -57
- package/src/channels/msteams.ts +0 -33
- package/src/channels/nostr.ts +0 -33
- package/src/channels/qq.ts +0 -34
- package/src/channels/signal.ts +0 -33
- package/src/channels/slack.ts +0 -217
- package/src/channels/sms.ts +0 -34
- package/src/channels/telegram.ts +0 -616
- package/src/channels/twitch.ts +0 -65
- package/src/channels/voice-call.ts +0 -100
- package/src/channels/voice.ts +0 -471
- package/src/channels/web.ts +0 -638
- package/src/channels/webhook.ts +0 -199
- package/src/channels/websocket.ts +0 -399
- package/src/channels/wechat.ts +0 -329
- package/src/channels/whatsapp.ts +0 -33
- package/src/cli/chat.ts +0 -99
- package/src/cli/setup.ts +0 -314
- package/src/cli.ts +0 -2826
- package/src/core/a2a.ts +0 -203
- package/src/core/agent.ts +0 -476
- package/src/core/analytics-engine.ts +0 -186
- package/src/core/api-server.ts +0 -277
- package/src/core/audio.ts +0 -98
- package/src/core/auth.ts +0 -57
- package/src/core/cache.ts +0 -141
- package/src/core/collaboration.ts +0 -275
- package/src/core/compose.ts +0 -77
- package/src/core/config.ts +0 -14
- package/src/core/context-discovery.ts +0 -85
- package/src/core/context-refs.ts +0 -140
- package/src/core/errors.ts +0 -148
- package/src/core/gateway.ts +0 -106
- package/src/core/heartbeat.ts +0 -51
- package/src/core/hitl.ts +0 -138
- package/src/core/hooks.ts +0 -105
- package/src/core/ide-bridge.ts +0 -133
- package/src/core/knowledge.ts +0 -255
- package/src/core/logger.ts +0 -57
- package/src/core/node-network.ts +0 -86
- package/src/core/orchestrator.ts +0 -215
- package/src/core/performance.ts +0 -187
- package/src/core/profiles.ts +0 -122
- package/src/core/rate-limiter.ts +0 -128
- package/src/core/room.ts +0 -109
- package/src/core/runtime.ts +0 -435
- package/src/core/sandbox.ts +0 -344
- package/src/core/scheduler.ts +0 -187
- package/src/core/security.ts +0 -171
- package/src/core/session-manager.ts +0 -137
- package/src/core/streaming.ts +0 -195
- package/src/core/subagent.ts +0 -98
- package/src/core/types.ts +0 -68
- package/src/core/versioning.ts +0 -106
- package/src/core/vision.ts +0 -180
- package/src/core/watch.ts +0 -178
- package/src/core/workflow-graph.ts +0 -365
- package/src/core/workflow.ts +0 -235
- package/src/daemon.ts +0 -96
- package/src/deploy/hermes.ts +0 -156
- package/src/deploy/index.ts +0 -255
- package/src/deploy/openclaw.ts +0 -190
- package/src/doctor.ts +0 -243
- package/src/eval/index.ts +0 -211
- package/src/eval/suites/basic.json +0 -16
- package/src/eval/suites/memory.json +0 -12
- package/src/eval/suites/safety.json +0 -14
- package/src/hub/brain-seed.ts +0 -54
- package/src/hub/client.ts +0 -60
- package/src/i18n/index.ts +0 -216
- package/src/index.ts +0 -283
- package/src/mcp/servers/calculator-mcp.ts +0 -65
- package/src/mcp/servers/crypto-mcp.ts +0 -73
- package/src/mcp/servers/database-mcp.ts +0 -72
- package/src/mcp/servers/datetime-mcp.ts +0 -69
- package/src/mcp/servers/filesystem.ts +0 -66
- package/src/mcp/servers/github-mcp.ts +0 -58
- package/src/mcp/servers/index.ts +0 -63
- package/src/mcp/servers/json-mcp.ts +0 -102
- package/src/mcp/servers/memory-mcp.ts +0 -56
- package/src/mcp/servers/regex-mcp.ts +0 -53
- package/src/mcp/servers/web-mcp.ts +0 -49
- package/src/memory/context-compressor.ts +0 -189
- package/src/memory/deepbrain.ts +0 -202
- package/src/memory/index.ts +0 -41
- package/src/memory/seed-loader.ts +0 -212
- package/src/memory/user-profiler.ts +0 -215
- package/src/plugins/content-filter.ts +0 -23
- package/src/plugins/index.ts +0 -339
- package/src/plugins/logger.ts +0 -18
- package/src/plugins/rate-limiter.ts +0 -38
- package/src/protocols/a2a/client.ts +0 -132
- package/src/protocols/a2a/index.ts +0 -8
- package/src/protocols/a2a/server.ts +0 -333
- package/src/protocols/a2a/types.ts +0 -88
- package/src/protocols/a2a/utils.ts +0 -50
- package/src/protocols/agui/client.ts +0 -83
- package/src/protocols/agui/index.ts +0 -4
- package/src/protocols/agui/server.ts +0 -218
- package/src/protocols/agui/types.ts +0 -153
- package/src/protocols/index.ts +0 -2
- package/src/protocols/mcp/agent-tools.ts +0 -134
- package/src/protocols/mcp/index.ts +0 -8
- package/src/protocols/mcp/server.ts +0 -262
- package/src/protocols/mcp/types.ts +0 -69
- package/src/providers/index.ts +0 -632
- package/src/publish/index.ts +0 -376
- package/src/scheduler/cron-engine.ts +0 -191
- package/src/scheduler/index.ts +0 -2
- package/src/schema/oad.ts +0 -217
- package/src/security/approval.ts +0 -131
- package/src/security/approvals.ts +0 -143
- package/src/security/elevated.ts +0 -105
- package/src/security/guardrails.ts +0 -248
- package/src/security/index.ts +0 -9
- package/src/security/keys.ts +0 -87
- package/src/security/secrets.ts +0 -129
- package/src/skills/auto-learn.ts +0 -262
- package/src/skills/base.ts +0 -16
- package/src/skills/builtin/index.ts +0 -408
- package/src/skills/document.ts +0 -100
- package/src/skills/http.ts +0 -35
- package/src/skills/index.ts +0 -27
- package/src/skills/marketplace.ts +0 -113
- package/src/skills/scheduler.ts +0 -80
- package/src/skills/types.ts +0 -42
- package/src/skills/webhook-trigger.ts +0 -59
- package/src/studio/server.ts +0 -1791
- package/src/studio/templates-data.ts +0 -178
- package/src/studio-ui/index.html +0 -3076
- package/src/telemetry/index.ts +0 -324
- package/src/templates/code-reviewer.ts +0 -30
- package/src/templates/content-writer.ts +0 -58
- package/src/templates/customer-service.ts +0 -76
- package/src/templates/data-analyst.ts +0 -66
- package/src/templates/executive-assistant.ts +0 -71
- package/src/templates/financial-advisor.ts +0 -60
- package/src/templates/hr-recruiter.ts +0 -58
- package/src/templates/knowledge-base.ts +0 -27
- package/src/templates/legal-assistant.ts +0 -71
- package/src/templates/project-manager.ts +0 -58
- package/src/templates/sales-assistant.ts +0 -75
- package/src/templates/teacher.ts +0 -75
- package/src/testing/index.ts +0 -181
- package/src/tools/builtin/browser.ts +0 -299
- package/src/tools/builtin/datetime.ts +0 -41
- package/src/tools/builtin/file.ts +0 -107
- package/src/tools/builtin/home-assistant.ts +0 -116
- package/src/tools/builtin/index.ts +0 -37
- package/src/tools/builtin/rl-tools.ts +0 -243
- package/src/tools/builtin/shell.ts +0 -43
- package/src/tools/builtin/vision.ts +0 -64
- package/src/tools/builtin/web-search.ts +0 -126
- package/src/tools/builtin/web.ts +0 -35
- package/src/tools/calculator.ts +0 -73
- package/src/tools/datetime.ts +0 -149
- package/src/tools/document-processor.ts +0 -213
- package/src/tools/gateway.ts +0 -220
- package/src/tools/image-generator.ts +0 -150
- package/src/tools/integrations/calendar.ts +0 -73
- package/src/tools/integrations/code-exec.ts +0 -39
- package/src/tools/integrations/csv-analyzer.ts +0 -92
- package/src/tools/integrations/database.ts +0 -44
- package/src/tools/integrations/email-send.ts +0 -76
- package/src/tools/integrations/git-tool.ts +0 -42
- package/src/tools/integrations/github-tool.ts +0 -76
- package/src/tools/integrations/image-gen.ts +0 -56
- package/src/tools/integrations/index.ts +0 -92
- package/src/tools/integrations/jira.ts +0 -83
- package/src/tools/integrations/notion.ts +0 -71
- package/src/tools/integrations/npm-tool.ts +0 -48
- package/src/tools/integrations/pdf-reader.ts +0 -58
- package/src/tools/integrations/slack.ts +0 -65
- package/src/tools/integrations/summarizer.ts +0 -49
- package/src/tools/integrations/translator.ts +0 -48
- package/src/tools/integrations/trello.ts +0 -60
- package/src/tools/integrations/vector-search.ts +0 -42
- package/src/tools/integrations/web-scraper.ts +0 -47
- package/src/tools/integrations/web-search.ts +0 -58
- package/src/tools/integrations/webhook.ts +0 -38
- package/src/tools/json-transform.ts +0 -187
- package/src/tools/mcp-client.ts +0 -131
- package/src/tools/mcp.ts +0 -76
- package/src/tools/text-analysis.ts +0 -116
- package/src/tools/web-scraper.ts +0 -179
- package/src/tools/web-search.ts +0 -180
- package/src/traces/index.ts +0 -132
- package/src/types/agent-workstation.d.ts +0 -2
- package/src/ui/components.ts +0 -127
- package/srv-err.txt +0 -0
- package/srv-out.txt +0 -1
- package/test-agent/Dockerfile +0 -9
- package/test-agent/README.md +0 -50
- package/test-agent/agent.yaml +0 -23
- package/test-agent/docker-compose.yml +0 -11
- package/test-agent/oad.yaml +0 -31
- package/test-agent/package-lock.json +0 -1492
- package/test-agent/package.json +0 -18
- package/test-agent/src/index.ts +0 -24
- package/test-agent/src/skills/echo.ts +0 -15
- package/test-agent/tsconfig.json +0 -25
- package/test-full.js +0 -43
- package/test-sidebar.js +0 -22
- package/test-studio3.js +0 -75
- package/test-studio4.js +0 -41
- package/tests/a2a-protocol.test.ts +0 -285
- package/tests/a2a.test.ts +0 -66
- package/tests/agent.test.ts +0 -72
- package/tests/agui-protocol.test.ts +0 -246
- package/tests/analytics.test.ts +0 -50
- package/tests/api-server.test.ts +0 -148
- package/tests/approvals.test.ts +0 -89
- package/tests/audio.test.ts +0 -40
- package/tests/auto-learn.test.ts +0 -105
- package/tests/brain-seed-extended.test.ts +0 -490
- package/tests/brain-seed.test.ts +0 -239
- package/tests/browser.test.ts +0 -179
- package/tests/builtin-tools.test.ts +0 -83
- package/tests/channel.test.ts +0 -39
- package/tests/channels/discord.test.ts +0 -79
- package/tests/channels/email.test.ts +0 -148
- package/tests/channels/feishu.test.ts +0 -123
- package/tests/channels/telegram.test.ts +0 -129
- package/tests/channels/websocket.test.ts +0 -53
- package/tests/channels/wechat.test.ts +0 -170
- package/tests/channels-extra.test.ts +0 -45
- package/tests/chat-cli.test.ts +0 -160
- package/tests/cli.test.ts +0 -46
- package/tests/collaboration.test.ts +0 -319
- package/tests/context-compressor.test.ts +0 -172
- package/tests/context-refs.test.ts +0 -121
- package/tests/cron-engine.test.ts +0 -101
- package/tests/daemon.test.ts +0 -135
- package/tests/deepbrain-wire.test.ts +0 -234
- package/tests/deploy-and-dag.test.ts +0 -196
- package/tests/doctor.test.ts +0 -38
- package/tests/document-processor.test.ts +0 -69
- package/tests/e2e-nocode.test.ts +0 -442
- package/tests/e2e.test.ts +0 -134
- package/tests/elevated.test.ts +0 -69
- package/tests/errors.test.ts +0 -83
- package/tests/eval.test.ts +0 -173
- package/tests/gateway.test.ts +0 -63
- package/tests/guardrails.test.ts +0 -177
- package/tests/hitl.test.ts +0 -71
- package/tests/home-assistant.test.ts +0 -40
- package/tests/hooks.test.ts +0 -79
- package/tests/i18n.test.ts +0 -41
- package/tests/ide-bridge.test.ts +0 -38
- package/tests/image-generator.test.ts +0 -84
- package/tests/init-role.test.ts +0 -124
- package/tests/integrations.test.ts +0 -249
- package/tests/mcp-client.test.ts +0 -92
- package/tests/mcp-server.test.ts +0 -178
- package/tests/mcp-servers.test.ts +0 -260
- package/tests/mcp.test.ts +0 -54
- package/tests/node-network.test.ts +0 -74
- package/tests/oad.test.ts +0 -68
- package/tests/performance.test.ts +0 -115
- package/tests/plugin-a2a-enhanced.test.ts +0 -230
- package/tests/plugin.test.ts +0 -74
- package/tests/profiles.test.ts +0 -61
- package/tests/publish.test.ts +0 -231
- package/tests/rl-tools.test.ts +0 -93
- package/tests/room.test.ts +0 -106
- package/tests/runtime.test.ts +0 -42
- package/tests/sandbox-manager.test.ts +0 -46
- package/tests/sandbox.test.ts +0 -46
- package/tests/scheduler.test.ts +0 -200
- package/tests/secrets.test.ts +0 -107
- package/tests/security-enhanced.test.ts +0 -233
- package/tests/security.test.ts +0 -60
- package/tests/settings-api.test.ts +0 -148
- package/tests/setup.test.ts +0 -73
- package/tests/skill-learner.test.ts +0 -161
- package/tests/streaming.test.ts +0 -109
- package/tests/studio.test.ts +0 -402
- package/tests/subagent.test.ts +0 -193
- package/tests/telegram-discord.test.ts +0 -60
- package/tests/telemetry.test.ts +0 -186
- package/tests/templates.test.ts +0 -77
- package/tests/tools/builtin-extended.test.ts +0 -138
- package/tests/user-profiler.test.ts +0 -169
- package/tests/v070.test.ts +0 -76
- package/tests/v090-features.test.ts +0 -254
- package/tests/versioning.test.ts +0 -75
- package/tests/vision.test.ts +0 -61
- package/tests/voice-call.test.ts +0 -47
- package/tests/voice-enhanced.test.ts +0 -169
- package/tests/voice-interaction.test.ts +0 -38
- package/tests/voice.test.ts +0 -61
- package/tests/web-search.test.ts +0 -155
- package/tests/webhook.test.ts +0 -29
- package/tests/workflow-graph.test.ts +0 -279
- package/tests/workflow.test.ts +0 -143
- package/tmp-js-test.js +0 -1532
- package/tmp-sc.js +0 -1716
- package/tutorial/customer-service-agent/README.md +0 -612
- package/tutorial/customer-service-agent/SOUL.md +0 -26
- package/tutorial/customer-service-agent/agent.yaml +0 -63
- package/tutorial/customer-service-agent/package.json +0 -19
- package/tutorial/customer-service-agent/src/index.ts +0 -69
- package/tutorial/customer-service-agent/src/skills/faq.ts +0 -27
- package/tutorial/customer-service-agent/src/skills/ticket.ts +0 -22
- package/tutorial/customer-service-agent/tsconfig.json +0 -14
- package/vitest.config.ts +0 -9
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image Generator — multi-backend image generation tool.
|
|
3
|
-
* Supports DALL·E (OpenAI), Stable Diffusion (local), and Replicate.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface ImageGenConfig {
|
|
7
|
-
provider?: 'dalle' | 'stable-diffusion' | 'replicate';
|
|
8
|
-
openaiApiKey?: string;
|
|
9
|
-
replicateApiKey?: string;
|
|
10
|
-
sdApiUrl?: string;
|
|
11
|
-
defaultModel?: string;
|
|
12
|
-
defaultSize?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ImageGenResult {
|
|
16
|
-
success: boolean;
|
|
17
|
-
url?: string;
|
|
18
|
-
base64?: string;
|
|
19
|
-
error?: string;
|
|
20
|
-
provider: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class ImageGenerator {
|
|
24
|
-
private config: ImageGenConfig;
|
|
25
|
-
|
|
26
|
-
constructor(config?: ImageGenConfig) {
|
|
27
|
-
this.config = {
|
|
28
|
-
provider: config?.provider,
|
|
29
|
-
openaiApiKey: config?.openaiApiKey || process.env.OPENAI_API_KEY,
|
|
30
|
-
replicateApiKey: config?.replicateApiKey || process.env.REPLICATE_API_TOKEN,
|
|
31
|
-
sdApiUrl: config?.sdApiUrl || process.env.SD_API_URL,
|
|
32
|
-
defaultModel: config?.defaultModel || 'dall-e-3',
|
|
33
|
-
defaultSize: config?.defaultSize || '1024x1024',
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Auto-detect best available provider */
|
|
38
|
-
detectProvider(): string | null {
|
|
39
|
-
if (this.config.openaiApiKey) return 'dalle';
|
|
40
|
-
if (this.config.sdApiUrl) return 'stable-diffusion';
|
|
41
|
-
if (this.config.replicateApiKey) return 'replicate';
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Get configuration status for the settings UI */
|
|
46
|
-
getStatus(): { configured: boolean; providers: { name: string; configured: boolean }[] } {
|
|
47
|
-
return {
|
|
48
|
-
configured: !!this.detectProvider(),
|
|
49
|
-
providers: [
|
|
50
|
-
{ name: 'dalle', configured: !!this.config.openaiApiKey },
|
|
51
|
-
{ name: 'stable-diffusion', configured: !!this.config.sdApiUrl },
|
|
52
|
-
{ name: 'replicate', configured: !!this.config.replicateApiKey },
|
|
53
|
-
],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async generate(prompt: string, options?: { provider?: string; size?: string; model?: string }): Promise<ImageGenResult> {
|
|
58
|
-
const provider = options?.provider || this.config.provider || this.detectProvider();
|
|
59
|
-
if (!provider) {
|
|
60
|
-
return { success: false, error: 'No image generation provider configured. Please set OPENAI_API_KEY, SD_API_URL, or REPLICATE_API_TOKEN.', provider: 'none' };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
switch (provider) {
|
|
64
|
-
case 'dalle': return this.generateDalle(prompt, options);
|
|
65
|
-
case 'stable-diffusion': return this.generateSD(prompt, options);
|
|
66
|
-
case 'replicate': return this.generateReplicate(prompt, options);
|
|
67
|
-
default: return { success: false, error: `Unknown provider: ${provider}`, provider };
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private async generateDalle(prompt: string, options?: { size?: string; model?: string }): Promise<ImageGenResult> {
|
|
72
|
-
const apiKey = this.config.openaiApiKey;
|
|
73
|
-
if (!apiKey) return { success: false, error: 'OPENAI_API_KEY not configured', provider: 'dalle' };
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const res = await fetch('https://api.openai.com/v1/images/generations', {
|
|
77
|
-
method: 'POST',
|
|
78
|
-
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
79
|
-
body: JSON.stringify({
|
|
80
|
-
model: options?.model || this.config.defaultModel || 'dall-e-3',
|
|
81
|
-
prompt,
|
|
82
|
-
size: options?.size || this.config.defaultSize || '1024x1024',
|
|
83
|
-
n: 1,
|
|
84
|
-
}),
|
|
85
|
-
});
|
|
86
|
-
const data = await res.json() as { data?: Array<{ url: string }>; error?: { message: string } };
|
|
87
|
-
if (data.error) return { success: false, error: data.error.message, provider: 'dalle' };
|
|
88
|
-
const url = data.data?.[0]?.url;
|
|
89
|
-
return url ? { success: true, url, provider: 'dalle' } : { success: false, error: 'No image returned', provider: 'dalle' };
|
|
90
|
-
} catch (err) {
|
|
91
|
-
return { success: false, error: (err as Error).message, provider: 'dalle' };
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private async generateSD(prompt: string, options?: { size?: string }): Promise<ImageGenResult> {
|
|
96
|
-
const apiUrl = this.config.sdApiUrl;
|
|
97
|
-
if (!apiUrl) return { success: false, error: 'SD_API_URL not configured', provider: 'stable-diffusion' };
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
const [w, h] = (options?.size || '1024x1024').split('x').map(Number);
|
|
101
|
-
const res = await fetch(`${apiUrl}/sdapi/v1/txt2img`, {
|
|
102
|
-
method: 'POST',
|
|
103
|
-
headers: { 'Content-Type': 'application/json' },
|
|
104
|
-
body: JSON.stringify({ prompt, width: w || 1024, height: h || 1024 }),
|
|
105
|
-
});
|
|
106
|
-
const data = await res.json() as { images?: string[] };
|
|
107
|
-
if (data.images?.length) {
|
|
108
|
-
return { success: true, base64: data.images[0], provider: 'stable-diffusion' };
|
|
109
|
-
}
|
|
110
|
-
return { success: false, error: 'No image generated', provider: 'stable-diffusion' };
|
|
111
|
-
} catch (err) {
|
|
112
|
-
return { success: false, error: (err as Error).message, provider: 'stable-diffusion' };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private async generateReplicate(prompt: string, _options?: { model?: string }): Promise<ImageGenResult> {
|
|
117
|
-
const apiKey = this.config.replicateApiKey;
|
|
118
|
-
if (!apiKey) return { success: false, error: 'REPLICATE_API_TOKEN not configured', provider: 'replicate' };
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const res = await fetch('https://api.replicate.com/v1/predictions', {
|
|
122
|
-
method: 'POST',
|
|
123
|
-
headers: { 'Authorization': `Token ${apiKey}`, 'Content-Type': 'application/json' },
|
|
124
|
-
body: JSON.stringify({
|
|
125
|
-
version: 'stability-ai/sdxl:39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b',
|
|
126
|
-
input: { prompt },
|
|
127
|
-
}),
|
|
128
|
-
});
|
|
129
|
-
const prediction = await res.json() as { id: string; urls?: { get: string }; error?: string };
|
|
130
|
-
if (prediction.error) return { success: false, error: prediction.error, provider: 'replicate' };
|
|
131
|
-
|
|
132
|
-
// Poll for completion (max 60s)
|
|
133
|
-
const getUrl = prediction.urls?.get || `https://api.replicate.com/v1/predictions/${prediction.id}`;
|
|
134
|
-
for (let i = 0; i < 30; i++) {
|
|
135
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
136
|
-
const poll = await fetch(getUrl, { headers: { 'Authorization': `Token ${apiKey}` } });
|
|
137
|
-
const result = await poll.json() as { status: string; output?: string[]; error?: string };
|
|
138
|
-
if (result.status === 'succeeded' && result.output?.length) {
|
|
139
|
-
return { success: true, url: result.output[0], provider: 'replicate' };
|
|
140
|
-
}
|
|
141
|
-
if (result.status === 'failed') {
|
|
142
|
-
return { success: false, error: result.error || 'Generation failed', provider: 'replicate' };
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return { success: false, error: 'Timeout waiting for image generation', provider: 'replicate' };
|
|
146
|
-
} catch (err) {
|
|
147
|
-
return { success: false, error: (err as Error).message, provider: 'replicate' };
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
|
|
3
|
-
export const CalendarTool: MCPTool = {
|
|
4
|
-
name: 'calendar',
|
|
5
|
-
description: 'Google Calendar integration: create events, list events, check availability. Requires GOOGLE_CALENDAR_API_KEY or GOOGLE_ACCESS_TOKEN env var.',
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: 'object',
|
|
8
|
-
properties: {
|
|
9
|
-
action: { type: 'string', enum: ['create_event', 'list_events', 'check_availability'], description: 'Action' },
|
|
10
|
-
calendar_id: { type: 'string', description: 'Calendar ID (default: primary)' },
|
|
11
|
-
summary: { type: 'string', description: 'Event title' },
|
|
12
|
-
start: { type: 'string', description: 'Start time (ISO 8601)' },
|
|
13
|
-
end: { type: 'string', description: 'End time (ISO 8601)' },
|
|
14
|
-
description: { type: 'string', description: 'Event description' },
|
|
15
|
-
time_min: { type: 'string', description: 'Start of time range (ISO 8601)' },
|
|
16
|
-
time_max: { type: 'string', description: 'End of time range (ISO 8601)' },
|
|
17
|
-
},
|
|
18
|
-
required: ['action'],
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
22
|
-
const token = process.env.GOOGLE_ACCESS_TOKEN;
|
|
23
|
-
if (!token) return { content: 'Error: GOOGLE_ACCESS_TOKEN required', isError: true };
|
|
24
|
-
|
|
25
|
-
const calId = encodeURIComponent(String(input.calendar_id ?? 'primary'));
|
|
26
|
-
const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' };
|
|
27
|
-
const action = String(input.action ?? '');
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
if (action === 'create_event') {
|
|
31
|
-
if (!input.summary || !input.start || !input.end) return { content: 'Error: summary, start, end required', isError: true };
|
|
32
|
-
const res = await fetch(`https://www.googleapis.com/calendar/v3/calendars/${calId}/events`, {
|
|
33
|
-
method: 'POST', headers,
|
|
34
|
-
body: JSON.stringify({
|
|
35
|
-
summary: input.summary,
|
|
36
|
-
description: input.description ?? '',
|
|
37
|
-
start: { dateTime: input.start },
|
|
38
|
-
end: { dateTime: input.end },
|
|
39
|
-
}),
|
|
40
|
-
});
|
|
41
|
-
const data = await res.json() as Record<string, unknown>;
|
|
42
|
-
return { content: `Event created: ${data.htmlLink ?? data.id}` };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (action === 'list_events') {
|
|
46
|
-
const now = new Date().toISOString();
|
|
47
|
-
const timeMin = String(input.time_min ?? now);
|
|
48
|
-
const timeMax = input.time_max ? `&timeMax=${encodeURIComponent(String(input.time_max))}` : '';
|
|
49
|
-
const res = await fetch(`https://www.googleapis.com/calendar/v3/calendars/${calId}/events?timeMin=${encodeURIComponent(timeMin)}${timeMax}&maxResults=20&singleEvents=true&orderBy=startTime`, { headers });
|
|
50
|
-
const data = await res.json() as Record<string, unknown>;
|
|
51
|
-
return { content: JSON.stringify(data, null, 2).slice(0, 4000) };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (action === 'check_availability') {
|
|
55
|
-
if (!input.time_min || !input.time_max) return { content: 'Error: time_min, time_max required', isError: true };
|
|
56
|
-
const res = await fetch('https://www.googleapis.com/calendar/v3/freeBusy', {
|
|
57
|
-
method: 'POST', headers,
|
|
58
|
-
body: JSON.stringify({
|
|
59
|
-
timeMin: input.time_min,
|
|
60
|
-
timeMax: input.time_max,
|
|
61
|
-
items: [{ id: String(input.calendar_id ?? 'primary') }],
|
|
62
|
-
}),
|
|
63
|
-
});
|
|
64
|
-
const data = await res.json() as Record<string, unknown>;
|
|
65
|
-
return { content: JSON.stringify(data, null, 2).slice(0, 4000) };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return { content: `Unknown action: ${action}`, isError: true };
|
|
69
|
-
} catch (err) {
|
|
70
|
-
return { content: `Calendar error: ${(err as Error).message}`, isError: true };
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
|
|
4
|
-
export const CodeExecutionTool: MCPTool = {
|
|
5
|
-
name: 'code-exec',
|
|
6
|
-
description: 'Execute JavaScript or Python code in a sandboxed subprocess.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
language: { type: 'string', enum: ['javascript', 'python'], description: 'Language to execute' },
|
|
11
|
-
code: { type: 'string', description: 'Code to execute' },
|
|
12
|
-
timeout: { type: 'number', description: 'Timeout in seconds (default: 10)' },
|
|
13
|
-
},
|
|
14
|
-
required: ['language', 'code'],
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
18
|
-
const language = String(input.language ?? '');
|
|
19
|
-
const code = String(input.code ?? '');
|
|
20
|
-
if (!code) return { content: 'Error: code required', isError: true };
|
|
21
|
-
|
|
22
|
-
const timeout = Math.min(Number(input.timeout ?? 10), 30) * 1000;
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
let result: string;
|
|
26
|
-
if (language === 'javascript') {
|
|
27
|
-
result = execSync(`node -e ${JSON.stringify(code)}`, { timeout, encoding: 'utf-8', maxBuffer: 1024 * 1024 });
|
|
28
|
-
} else if (language === 'python') {
|
|
29
|
-
result = execSync(`python -c ${JSON.stringify(code)}`, { timeout, encoding: 'utf-8', maxBuffer: 1024 * 1024 });
|
|
30
|
-
} else {
|
|
31
|
-
return { content: `Unsupported language: ${language}`, isError: true };
|
|
32
|
-
}
|
|
33
|
-
return { content: result.slice(0, 4000) || '(no output)' };
|
|
34
|
-
} catch (err) {
|
|
35
|
-
const msg = (err as Error & { stderr?: string }).stderr || (err as Error).message;
|
|
36
|
-
return { content: `Execution error: ${String(msg).slice(0, 2000)}`, isError: true };
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
|
|
4
|
-
export const CSVAnalyzerTool: MCPTool = {
|
|
5
|
-
name: 'csv-analyzer',
|
|
6
|
-
description: 'Parse, filter, and aggregate CSV data from a file or inline text.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
file_path: { type: 'string', description: 'Path to CSV file' },
|
|
11
|
-
data: { type: 'string', description: 'Inline CSV data (alternative to file_path)' },
|
|
12
|
-
action: { type: 'string', enum: ['parse', 'filter', 'aggregate'], description: 'Action (default: parse)' },
|
|
13
|
-
column: { type: 'string', description: 'Column name (for filter/aggregate)' },
|
|
14
|
-
value: { type: 'string', description: 'Filter value' },
|
|
15
|
-
operation: { type: 'string', enum: ['sum', 'avg', 'min', 'max', 'count'], description: 'Aggregate operation' },
|
|
16
|
-
},
|
|
17
|
-
required: [],
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
21
|
-
try {
|
|
22
|
-
let csvText: string;
|
|
23
|
-
if (input.file_path) {
|
|
24
|
-
csvText = fs.readFileSync(String(input.file_path), 'utf-8');
|
|
25
|
-
} else if (input.data) {
|
|
26
|
-
csvText = String(input.data);
|
|
27
|
-
} else {
|
|
28
|
-
return { content: 'Error: file_path or data required', isError: true };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const lines = csvText.trim().split(/\r?\n/);
|
|
32
|
-
if (lines.length < 2) return { content: 'Error: CSV must have at least a header and one data row', isError: true };
|
|
33
|
-
|
|
34
|
-
const headers = parseCsvLine(lines[0]);
|
|
35
|
-
const rows = lines.slice(1).map(parseCsvLine);
|
|
36
|
-
const action = String(input.action ?? 'parse');
|
|
37
|
-
|
|
38
|
-
if (action === 'parse') {
|
|
39
|
-
const preview = rows.slice(0, 20).map((r) => {
|
|
40
|
-
const obj: Record<string, string> = {};
|
|
41
|
-
headers.forEach((h, i) => obj[h] = r[i] ?? '');
|
|
42
|
-
return obj;
|
|
43
|
-
});
|
|
44
|
-
return { content: `${headers.join(', ')}\n${rows.length} rows\n\n${JSON.stringify(preview, null, 2).slice(0, 3000)}` };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (action === 'filter') {
|
|
48
|
-
const col = String(input.column ?? '');
|
|
49
|
-
const colIdx = headers.indexOf(col);
|
|
50
|
-
if (colIdx === -1) return { content: `Column not found: ${col}. Available: ${headers.join(', ')}`, isError: true };
|
|
51
|
-
const filtered = rows.filter((r) => r[colIdx] === String(input.value ?? ''));
|
|
52
|
-
return { content: `${filtered.length} matching rows\n${JSON.stringify(filtered.slice(0, 20), null, 2).slice(0, 3000)}` };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (action === 'aggregate') {
|
|
56
|
-
const col = String(input.column ?? '');
|
|
57
|
-
const colIdx = headers.indexOf(col);
|
|
58
|
-
if (colIdx === -1) return { content: `Column not found: ${col}`, isError: true };
|
|
59
|
-
const values = rows.map((r) => parseFloat(r[colIdx])).filter((v) => !isNaN(v));
|
|
60
|
-
const op = String(input.operation ?? 'count');
|
|
61
|
-
let result: number;
|
|
62
|
-
switch (op) {
|
|
63
|
-
case 'sum': result = values.reduce((a, b) => a + b, 0); break;
|
|
64
|
-
case 'avg': result = values.reduce((a, b) => a + b, 0) / values.length; break;
|
|
65
|
-
case 'min': result = Math.min(...values); break;
|
|
66
|
-
case 'max': result = Math.max(...values); break;
|
|
67
|
-
case 'count': result = values.length; break;
|
|
68
|
-
default: return { content: `Unknown operation: ${op}`, isError: true };
|
|
69
|
-
}
|
|
70
|
-
return { content: `${op}(${col}) = ${result}` };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return { content: `Unknown action: ${action}`, isError: true };
|
|
74
|
-
} catch (err) {
|
|
75
|
-
return { content: `CSV error: ${(err as Error).message}`, isError: true };
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
function parseCsvLine(line: string): string[] {
|
|
81
|
-
const result: string[] = [];
|
|
82
|
-
let current = '';
|
|
83
|
-
let inQuotes = false;
|
|
84
|
-
for (let i = 0; i < line.length; i++) {
|
|
85
|
-
const ch = line[i];
|
|
86
|
-
if (ch === '"') { inQuotes = !inQuotes; }
|
|
87
|
-
else if (ch === ',' && !inQuotes) { result.push(current.trim()); current = ''; }
|
|
88
|
-
else { current += ch; }
|
|
89
|
-
}
|
|
90
|
-
result.push(current.trim());
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
|
|
4
|
-
export const DatabaseTool: MCPTool = {
|
|
5
|
-
name: 'database',
|
|
6
|
-
description: 'Execute SQL queries against a database. Supports SQLite (via CLI), PostgreSQL, MySQL via connection URL. Set DATABASE_URL env var.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
query: { type: 'string', description: 'SQL query to execute' },
|
|
11
|
-
connection_url: { type: 'string', description: 'Connection URL (overrides DATABASE_URL)' },
|
|
12
|
-
},
|
|
13
|
-
required: ['query'],
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
17
|
-
const query = String(input.query ?? '');
|
|
18
|
-
if (!query) return { content: 'Error: query required', isError: true };
|
|
19
|
-
|
|
20
|
-
// Safety check: block destructive operations unless explicitly allowed
|
|
21
|
-
const dangerous = /^\s*(DROP|DELETE|TRUNCATE|ALTER)\s/i;
|
|
22
|
-
if (dangerous.test(query) && !process.env.DATABASE_ALLOW_DESTRUCTIVE) {
|
|
23
|
-
return { content: 'Error: Destructive queries blocked. Set DATABASE_ALLOW_DESTRUCTIVE=1 to allow.', isError: true };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const url = String(input.connection_url ?? process.env.DATABASE_URL ?? '');
|
|
27
|
-
if (!url) return { content: 'Error: connection_url or DATABASE_URL required', isError: true };
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
if (url.startsWith('sqlite:') || url.endsWith('.db') || url.endsWith('.sqlite')) {
|
|
31
|
-
const dbPath = url.replace(/^sqlite:\/\//, '').replace(/^sqlite:/, '');
|
|
32
|
-
const result = execSync(`sqlite3 -header -csv "${dbPath}" "${query.replace(/"/g, '\\"')}"`, {
|
|
33
|
-
timeout: 30000, encoding: 'utf-8', maxBuffer: 1024 * 1024,
|
|
34
|
-
});
|
|
35
|
-
return { content: result.slice(0, 4000) || '(no results)' };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// For Postgres/MySQL, attempt using native TCP (simplified — real impl would need protocol handling)
|
|
39
|
-
return { content: 'Error: Only SQLite is supported without external packages. For Postgres/MySQL, install appropriate drivers.', isError: true };
|
|
40
|
-
} catch (err) {
|
|
41
|
-
return { content: `Database error: ${(err as Error).message}`, isError: true };
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
import * as net from 'net';
|
|
3
|
-
import * as tls from 'tls';
|
|
4
|
-
|
|
5
|
-
export const EmailSendTool: MCPTool = {
|
|
6
|
-
name: 'email-send',
|
|
7
|
-
description: 'Send email via SMTP. Requires SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS env vars.',
|
|
8
|
-
inputSchema: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
to: { type: 'string', description: 'Recipient email address' },
|
|
12
|
-
subject: { type: 'string', description: 'Email subject' },
|
|
13
|
-
body: { type: 'string', description: 'Email body (plain text)' },
|
|
14
|
-
from: { type: 'string', description: 'Sender email (defaults to SMTP_USER)' },
|
|
15
|
-
},
|
|
16
|
-
required: ['to', 'subject', 'body'],
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
20
|
-
const host = process.env.SMTP_HOST;
|
|
21
|
-
const port = parseInt(process.env.SMTP_PORT || '587', 10);
|
|
22
|
-
const user = process.env.SMTP_USER;
|
|
23
|
-
const pass = process.env.SMTP_PASS;
|
|
24
|
-
|
|
25
|
-
if (!host || !user || !pass) {
|
|
26
|
-
return { content: 'Error: SMTP_HOST, SMTP_USER, SMTP_PASS env vars required', isError: true };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const to = String(input.to ?? '');
|
|
30
|
-
const subject = String(input.subject ?? '');
|
|
31
|
-
const body = String(input.body ?? '');
|
|
32
|
-
const from = String(input.from ?? user);
|
|
33
|
-
|
|
34
|
-
if (!to || !subject) return { content: 'Error: to and subject are required', isError: true };
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
await sendSmtp(host, port, user, pass, from, to, subject, body);
|
|
38
|
-
return { content: `Email sent to ${to}` };
|
|
39
|
-
} catch (err) {
|
|
40
|
-
return { content: `SMTP error: ${(err as Error).message}`, isError: true };
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function sendSmtp(host: string, port: number, user: string, pass: string, from: string, to: string, subject: string, body: string): Promise<void> {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
const commands = [
|
|
48
|
-
`EHLO localhost`,
|
|
49
|
-
`AUTH LOGIN`,
|
|
50
|
-
Buffer.from(user).toString('base64'),
|
|
51
|
-
Buffer.from(pass).toString('base64'),
|
|
52
|
-
`MAIL FROM:<${from}>`,
|
|
53
|
-
`RCPT TO:<${to}>`,
|
|
54
|
-
`DATA`,
|
|
55
|
-
`From: ${from}\r\nTo: ${to}\r\nSubject: ${subject}\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n${body}\r\n.`,
|
|
56
|
-
`QUIT`,
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
let idx = 0;
|
|
60
|
-
const socket = port === 465
|
|
61
|
-
? tls.connect({ host, port, rejectUnauthorized: false })
|
|
62
|
-
: net.createConnection({ host, port });
|
|
63
|
-
|
|
64
|
-
const timeout = setTimeout(() => { socket.destroy(); reject(new Error('SMTP timeout')); }, 30000);
|
|
65
|
-
|
|
66
|
-
socket.setEncoding('utf8');
|
|
67
|
-
socket.on('data', () => {
|
|
68
|
-
if (idx < commands.length) {
|
|
69
|
-
socket.write(commands[idx] + '\r\n');
|
|
70
|
-
idx++;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
socket.on('end', () => { clearTimeout(timeout); resolve(); });
|
|
74
|
-
socket.on('error', (err) => { clearTimeout(timeout); reject(err); });
|
|
75
|
-
});
|
|
76
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
|
|
4
|
-
export const GitTool: MCPTool = {
|
|
5
|
-
name: 'git',
|
|
6
|
-
description: 'Run git commands on a local repository: status, diff, commit, log.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: {
|
|
10
|
-
action: { type: 'string', enum: ['status', 'diff', 'commit', 'log'], description: 'Git action' },
|
|
11
|
-
cwd: { type: 'string', description: 'Repository directory path' },
|
|
12
|
-
message: { type: 'string', description: 'Commit message (for commit)' },
|
|
13
|
-
args: { type: 'string', description: 'Additional git arguments' },
|
|
14
|
-
},
|
|
15
|
-
required: ['action'],
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
19
|
-
const action = String(input.action ?? '');
|
|
20
|
-
const cwd = String(input.cwd ?? process.cwd());
|
|
21
|
-
const args = String(input.args ?? '');
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
let cmd: string;
|
|
25
|
-
switch (action) {
|
|
26
|
-
case 'status': cmd = `git status --short ${args}`; break;
|
|
27
|
-
case 'diff': cmd = `git diff ${args}`; break;
|
|
28
|
-
case 'commit':
|
|
29
|
-
if (!input.message) return { content: 'Error: message required for commit', isError: true };
|
|
30
|
-
cmd = `git add -A && git commit -m ${JSON.stringify(String(input.message))} ${args}`;
|
|
31
|
-
break;
|
|
32
|
-
case 'log': cmd = `git log --oneline -20 ${args}`; break;
|
|
33
|
-
default: return { content: `Unknown action: ${action}`, isError: true };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const result = execSync(cmd, { cwd, timeout: 30000, encoding: 'utf-8', maxBuffer: 1024 * 1024 });
|
|
37
|
-
return { content: result.slice(0, 4000) || '(clean)' };
|
|
38
|
-
} catch (err) {
|
|
39
|
-
return { content: `Git error: ${(err as Error).message.slice(0, 1000)}`, isError: true };
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
|
|
3
|
-
export const GitHubTool: MCPTool = {
|
|
4
|
-
name: 'github',
|
|
5
|
-
description: 'Interact with GitHub API: create issues, list issues, create PRs, search code. Requires GITHUB_TOKEN env var.',
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: 'object',
|
|
8
|
-
properties: {
|
|
9
|
-
action: { type: 'string', enum: ['create_issue', 'list_issues', 'create_pr', 'search_code'], description: 'Action to perform' },
|
|
10
|
-
owner: { type: 'string', description: 'Repository owner' },
|
|
11
|
-
repo: { type: 'string', description: 'Repository name' },
|
|
12
|
-
title: { type: 'string', description: 'Issue/PR title' },
|
|
13
|
-
body: { type: 'string', description: 'Issue/PR body' },
|
|
14
|
-
head: { type: 'string', description: 'PR head branch' },
|
|
15
|
-
base: { type: 'string', description: 'PR base branch (default: main)' },
|
|
16
|
-
query: { type: 'string', description: 'Search query' },
|
|
17
|
-
},
|
|
18
|
-
required: ['action'],
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
22
|
-
const token = process.env.GITHUB_TOKEN;
|
|
23
|
-
if (!token) return { content: 'Error: GITHUB_TOKEN required', isError: true };
|
|
24
|
-
|
|
25
|
-
const action = String(input.action ?? '');
|
|
26
|
-
const owner = String(input.owner ?? '');
|
|
27
|
-
const repo = String(input.repo ?? '');
|
|
28
|
-
const headers = {
|
|
29
|
-
'Authorization': `Bearer ${token}`,
|
|
30
|
-
'Accept': 'application/vnd.github+json',
|
|
31
|
-
'Content-Type': 'application/json',
|
|
32
|
-
'X-GitHub-Api-Version': '2022-11-28',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
if (action === 'create_issue') {
|
|
37
|
-
if (!owner || !repo || !input.title) return { content: 'Error: owner, repo, title required', isError: true };
|
|
38
|
-
const res = await fetch(`https://api.github.com/repos/${owner}/${repo}/issues`, {
|
|
39
|
-
method: 'POST', headers,
|
|
40
|
-
body: JSON.stringify({ title: input.title, body: input.body ?? '' }),
|
|
41
|
-
});
|
|
42
|
-
const data = await res.json() as Record<string, unknown>;
|
|
43
|
-
return { content: `Issue created: #${data.number} ${data.html_url}` };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (action === 'list_issues') {
|
|
47
|
-
if (!owner || !repo) return { content: 'Error: owner, repo required', isError: true };
|
|
48
|
-
const res = await fetch(`https://api.github.com/repos/${owner}/${repo}/issues?per_page=20`, { headers });
|
|
49
|
-
const data = await res.json() as Array<Record<string, unknown>>;
|
|
50
|
-
const summary = Array.isArray(data) ? data.map((i) => `#${i.number} ${i.title}`).join('\n') : JSON.stringify(data);
|
|
51
|
-
return { content: summary };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (action === 'create_pr') {
|
|
55
|
-
if (!owner || !repo || !input.title || !input.head) return { content: 'Error: owner, repo, title, head required', isError: true };
|
|
56
|
-
const res = await fetch(`https://api.github.com/repos/${owner}/${repo}/pulls`, {
|
|
57
|
-
method: 'POST', headers,
|
|
58
|
-
body: JSON.stringify({ title: input.title, body: input.body ?? '', head: input.head, base: input.base ?? 'main' }),
|
|
59
|
-
});
|
|
60
|
-
const data = await res.json() as Record<string, unknown>;
|
|
61
|
-
return { content: `PR created: #${data.number} ${data.html_url}` };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (action === 'search_code') {
|
|
65
|
-
if (!input.query) return { content: 'Error: query required', isError: true };
|
|
66
|
-
const res = await fetch(`https://api.github.com/search/code?q=${encodeURIComponent(String(input.query))}`, { headers });
|
|
67
|
-
const data = await res.json() as Record<string, unknown>;
|
|
68
|
-
return { content: JSON.stringify(data, null, 2).slice(0, 4000) };
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return { content: `Unknown action: ${action}`, isError: true };
|
|
72
|
-
} catch (err) {
|
|
73
|
-
return { content: `GitHub error: ${(err as Error).message}`, isError: true };
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { MCPTool, MCPToolResult } from '../mcp';
|
|
2
|
-
|
|
3
|
-
export const ImageGenerationTool: MCPTool = {
|
|
4
|
-
name: 'image-gen',
|
|
5
|
-
description: 'Generate images via DALL-E or StableDiffusion API. Requires OPENAI_API_KEY or SD_API_URL env var.',
|
|
6
|
-
inputSchema: {
|
|
7
|
-
type: 'object',
|
|
8
|
-
properties: {
|
|
9
|
-
prompt: { type: 'string', description: 'Image generation prompt' },
|
|
10
|
-
provider: { type: 'string', enum: ['dalle', 'stable-diffusion'], description: 'Provider (auto-detects)' },
|
|
11
|
-
size: { type: 'string', description: 'Image size (default: 1024x1024)' },
|
|
12
|
-
model: { type: 'string', description: 'Model name (default: dall-e-3)' },
|
|
13
|
-
},
|
|
14
|
-
required: ['prompt'],
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
async execute(input: Record<string, unknown>): Promise<MCPToolResult> {
|
|
18
|
-
const prompt = String(input.prompt ?? '');
|
|
19
|
-
if (!prompt) return { content: 'Error: prompt required', isError: true };
|
|
20
|
-
|
|
21
|
-
const provider = String(input.provider ?? '');
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
if (provider === 'stable-diffusion' || process.env.SD_API_URL) {
|
|
25
|
-
const url = process.env.SD_API_URL;
|
|
26
|
-
if (!url) return { content: 'Error: SD_API_URL required', isError: true };
|
|
27
|
-
const res = await fetch(`${url}/sdapi/v1/txt2img`, {
|
|
28
|
-
method: 'POST',
|
|
29
|
-
headers: { 'Content-Type': 'application/json' },
|
|
30
|
-
body: JSON.stringify({ prompt, width: 1024, height: 1024 }),
|
|
31
|
-
});
|
|
32
|
-
const data = await res.json() as { images?: string[] };
|
|
33
|
-
return { content: `Generated ${data.images?.length ?? 0} image(s)`, metadata: { images: data.images } };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Default: DALL-E
|
|
37
|
-
const apiKey = process.env.OPENAI_API_KEY;
|
|
38
|
-
if (!apiKey) return { content: 'Error: OPENAI_API_KEY or SD_API_URL required', isError: true };
|
|
39
|
-
const res = await fetch('https://api.openai.com/v1/images/generations', {
|
|
40
|
-
method: 'POST',
|
|
41
|
-
headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
42
|
-
body: JSON.stringify({
|
|
43
|
-
model: String(input.model ?? 'dall-e-3'),
|
|
44
|
-
prompt,
|
|
45
|
-
size: String(input.size ?? '1024x1024'),
|
|
46
|
-
n: 1,
|
|
47
|
-
}),
|
|
48
|
-
});
|
|
49
|
-
const data = await res.json() as { data?: Array<{ url: string }> };
|
|
50
|
-
const url = data.data?.[0]?.url;
|
|
51
|
-
return { content: url ? `Image generated: ${url}` : 'Error generating image', metadata: { url } };
|
|
52
|
-
} catch (err) {
|
|
53
|
-
return { content: `Image gen error: ${(err as Error).message}`, isError: true };
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
};
|