@xopcai/xopcbot 0.1.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/README.md +132 -0
- package/README.zh-CN.md +130 -0
- package/dist/__tests__/core.test.d.ts +1 -0
- package/dist/__tests__/core.test.js +72 -0
- package/dist/__tests__/core.test.js.map +1 -0
- package/dist/agent/fallback/__tests__/index.test.d.ts +1 -0
- package/dist/agent/fallback/__tests__/index.test.js +111 -0
- package/dist/agent/fallback/__tests__/index.test.js.map +1 -0
- package/dist/agent/fallback/candidates.d.ts +23 -0
- package/dist/agent/fallback/candidates.js +62 -0
- package/dist/agent/fallback/candidates.js.map +1 -0
- package/dist/agent/fallback/error.d.ts +22 -0
- package/dist/agent/fallback/error.js +27 -0
- package/dist/agent/fallback/error.js.map +1 -0
- package/dist/agent/fallback/index.d.ts +6 -0
- package/dist/agent/fallback/index.js +5 -0
- package/dist/agent/fallback/index.js.map +1 -0
- package/dist/agent/fallback/reason.d.ts +7 -0
- package/dist/agent/fallback/reason.js +78 -0
- package/dist/agent/fallback/reason.js.map +1 -0
- package/dist/agent/fallback/runner.d.ts +22 -0
- package/dist/agent/fallback/runner.js +34 -0
- package/dist/agent/fallback/runner.js.map +1 -0
- package/dist/agent/helpers.d.ts +38 -0
- package/dist/agent/helpers.js +122 -0
- package/dist/agent/helpers.js.map +1 -0
- package/dist/agent/index.d.ts +7 -0
- package/dist/agent/index.js +7 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/memory/compaction.d.ts +63 -0
- package/dist/agent/memory/compaction.js +233 -0
- package/dist/agent/memory/compaction.js.map +1 -0
- package/dist/agent/memory/window.d.ts +29 -0
- package/dist/agent/memory/window.js +64 -0
- package/dist/agent/memory/window.js.map +1 -0
- package/dist/agent/model-manager.d.ts +80 -0
- package/dist/agent/model-manager.js +213 -0
- package/dist/agent/model-manager.js.map +1 -0
- package/dist/agent/prompt/heartbeat.d.ts +97 -0
- package/dist/agent/prompt/heartbeat.js +313 -0
- package/dist/agent/prompt/heartbeat.js.map +1 -0
- package/dist/agent/prompt/index.d.ts +65 -0
- package/dist/agent/prompt/index.js +215 -0
- package/dist/agent/prompt/index.js.map +1 -0
- package/dist/agent/prompt/memory/index.d.ts +37 -0
- package/dist/agent/prompt/memory/index.js +241 -0
- package/dist/agent/prompt/memory/index.js.map +1 -0
- package/dist/agent/prompt/modes.d.ts +44 -0
- package/dist/agent/prompt/modes.js +167 -0
- package/dist/agent/prompt/modes.js.map +1 -0
- package/dist/agent/prompt/safety.d.ts +88 -0
- package/dist/agent/prompt/safety.js +290 -0
- package/dist/agent/prompt/safety.js.map +1 -0
- package/dist/agent/service.d.ts +91 -0
- package/dist/agent/service.js +641 -0
- package/dist/agent/service.js.map +1 -0
- package/dist/agent/session-tracker.d.ts +73 -0
- package/dist/agent/session-tracker.js +137 -0
- package/dist/agent/session-tracker.js.map +1 -0
- package/dist/agent/skills/__tests__/test-framework.test.d.ts +4 -0
- package/dist/agent/skills/__tests__/test-framework.test.js +343 -0
- package/dist/agent/skills/__tests__/test-framework.test.js.map +1 -0
- package/dist/agent/skills/config.d.ts +58 -0
- package/dist/agent/skills/config.js +212 -0
- package/dist/agent/skills/config.js.map +1 -0
- package/dist/agent/skills/index.d.ts +25 -0
- package/dist/agent/skills/index.js +349 -0
- package/dist/agent/skills/index.js.map +1 -0
- package/dist/agent/skills/installer.d.ts +38 -0
- package/dist/agent/skills/installer.js +352 -0
- package/dist/agent/skills/installer.js.map +1 -0
- package/dist/agent/skills/scanner.d.ts +32 -0
- package/dist/agent/skills/scanner.js +265 -0
- package/dist/agent/skills/scanner.js.map +1 -0
- package/dist/agent/skills/test-framework.d.ts +107 -0
- package/dist/agent/skills/test-framework.js +607 -0
- package/dist/agent/skills/test-framework.js.map +1 -0
- package/dist/agent/skills/types.d.ts +181 -0
- package/dist/agent/skills/types.js +7 -0
- package/dist/agent/skills/types.js.map +1 -0
- package/dist/agent/skills/watcher.d.ts +37 -0
- package/dist/agent/skills/watcher.js +124 -0
- package/dist/agent/skills/watcher.js.map +1 -0
- package/dist/agent/tools/communication.d.ts +18 -0
- package/dist/agent/tools/communication.js +56 -0
- package/dist/agent/tools/communication.js.map +1 -0
- package/dist/agent/tools/edit-diff.d.ts +21 -0
- package/dist/agent/tools/edit-diff.js +69 -0
- package/dist/agent/tools/edit-diff.js.map +1 -0
- package/dist/agent/tools/edit.d.ts +13 -0
- package/dist/agent/tools/edit.js +65 -0
- package/dist/agent/tools/edit.js.map +1 -0
- package/dist/agent/tools/find.d.ts +24 -0
- package/dist/agent/tools/find.js +99 -0
- package/dist/agent/tools/find.js.map +1 -0
- package/dist/agent/tools/grep.d.ts +33 -0
- package/dist/agent/tools/grep.js +183 -0
- package/dist/agent/tools/grep.js.map +1 -0
- package/dist/agent/tools/index.d.ts +13 -0
- package/dist/agent/tools/index.js +18 -0
- package/dist/agent/tools/index.js.map +1 -0
- package/dist/agent/tools/list-dir.d.ts +6 -0
- package/dist/agent/tools/list-dir.js +37 -0
- package/dist/agent/tools/list-dir.js.map +1 -0
- package/dist/agent/tools/memory-tool.d.ts +14 -0
- package/dist/agent/tools/memory-tool.js +81 -0
- package/dist/agent/tools/memory-tool.js.map +1 -0
- package/dist/agent/tools/path-utils.d.ts +4 -0
- package/dist/agent/tools/path-utils.js +13 -0
- package/dist/agent/tools/path-utils.js.map +1 -0
- package/dist/agent/tools/read.d.ts +7 -0
- package/dist/agent/tools/read.js +47 -0
- package/dist/agent/tools/read.js.map +1 -0
- package/dist/agent/tools/send-media.d.ts +18 -0
- package/dist/agent/tools/send-media.js +104 -0
- package/dist/agent/tools/send-media.js.map +1 -0
- package/dist/agent/tools/shell.d.ts +13 -0
- package/dist/agent/tools/shell.js +114 -0
- package/dist/agent/tools/shell.js.map +1 -0
- package/dist/agent/tools/truncate.d.ts +36 -0
- package/dist/agent/tools/truncate.js +98 -0
- package/dist/agent/tools/truncate.js.map +1 -0
- package/dist/agent/tools/web.d.ts +14 -0
- package/dist/agent/tools/web.js +109 -0
- package/dist/agent/tools/web.js.map +1 -0
- package/dist/agent/tools/write.d.ts +7 -0
- package/dist/agent/tools/write.js +35 -0
- package/dist/agent/tools/write.js.map +1 -0
- package/dist/agent/types.d.ts +8 -0
- package/dist/agent/types.js +2 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent/typing.d.ts +9 -0
- package/dist/agent/typing.js +32 -0
- package/dist/agent/typing.js.map +1 -0
- package/dist/auth/index.d.ts +12 -0
- package/dist/auth/index.js +14 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth/anthropic.d.ts +7 -0
- package/dist/auth/oauth/anthropic.js +89 -0
- package/dist/auth/oauth/anthropic.js.map +1 -0
- package/dist/auth/oauth/github-copilot.d.ts +8 -0
- package/dist/auth/oauth/github-copilot.js +35 -0
- package/dist/auth/oauth/github-copilot.js.map +1 -0
- package/dist/auth/oauth/google-antigravity.d.ts +7 -0
- package/dist/auth/oauth/google-antigravity.js +27 -0
- package/dist/auth/oauth/google-antigravity.js.map +1 -0
- package/dist/auth/oauth/google-gemini-cli.d.ts +7 -0
- package/dist/auth/oauth/google-gemini-cli.js +28 -0
- package/dist/auth/oauth/google-gemini-cli.js.map +1 -0
- package/dist/auth/oauth/index.d.ts +14 -0
- package/dist/auth/oauth/index.js +15 -0
- package/dist/auth/oauth/index.js.map +1 -0
- package/dist/auth/oauth/kimi.d.ts +8 -0
- package/dist/auth/oauth/kimi.js +104 -0
- package/dist/auth/oauth/kimi.js.map +1 -0
- package/dist/auth/oauth/minimax.d.ts +8 -0
- package/dist/auth/oauth/minimax.js +109 -0
- package/dist/auth/oauth/minimax.js.map +1 -0
- package/dist/auth/oauth/openai-codex.d.ts +7 -0
- package/dist/auth/oauth/openai-codex.js +33 -0
- package/dist/auth/oauth/openai-codex.js.map +1 -0
- package/dist/auth/oauth/pkce.d.ts +8 -0
- package/dist/auth/oauth/pkce.js +22 -0
- package/dist/auth/oauth/pkce.js.map +1 -0
- package/dist/auth/oauth/qwen.d.ts +7 -0
- package/dist/auth/oauth/qwen.js +114 -0
- package/dist/auth/oauth/qwen.js.map +1 -0
- package/dist/auth/oauth/types.d.ts +46 -0
- package/dist/auth/oauth/types.js +7 -0
- package/dist/auth/oauth/types.js.map +1 -0
- package/dist/auth/profiles/index.d.ts +16 -0
- package/dist/auth/profiles/index.js +17 -0
- package/dist/auth/profiles/index.js.map +1 -0
- package/dist/auth/profiles/oauth.d.ts +12 -0
- package/dist/auth/profiles/oauth.js +106 -0
- package/dist/auth/profiles/oauth.js.map +1 -0
- package/dist/auth/profiles/order.d.ts +19 -0
- package/dist/auth/profiles/order.js +63 -0
- package/dist/auth/profiles/order.js.map +1 -0
- package/dist/auth/profiles/profiles.d.ts +27 -0
- package/dist/auth/profiles/profiles.js +110 -0
- package/dist/auth/profiles/profiles.js.map +1 -0
- package/dist/auth/profiles/store.d.ts +17 -0
- package/dist/auth/profiles/store.js +234 -0
- package/dist/auth/profiles/store.js.map +1 -0
- package/dist/auth/profiles/types.d.ts +64 -0
- package/dist/auth/profiles/types.js +7 -0
- package/dist/auth/profiles/types.js.map +1 -0
- package/dist/auth/profiles/usage.d.ts +24 -0
- package/dist/auth/profiles/usage.js +99 -0
- package/dist/auth/profiles/usage.js.map +1 -0
- package/dist/auth/storage.d.ts +99 -0
- package/dist/auth/storage.js +315 -0
- package/dist/auth/storage.js.map +1 -0
- package/dist/bus/index.d.ts +3 -0
- package/dist/bus/index.js +2 -0
- package/dist/bus/index.js.map +1 -0
- package/dist/bus/queue.d.ts +20 -0
- package/dist/bus/queue.js +57 -0
- package/dist/bus/queue.js.map +1 -0
- package/dist/channels/__tests__/access-control.test.d.ts +4 -0
- package/dist/channels/__tests__/access-control.test.js +310 -0
- package/dist/channels/__tests__/access-control.test.js.map +1 -0
- package/dist/channels/__tests__/draft-stream.test.d.ts +4 -0
- package/dist/channels/__tests__/draft-stream.test.js +243 -0
- package/dist/channels/__tests__/draft-stream.test.js.map +1 -0
- package/dist/channels/__tests__/format.test.d.ts +4 -0
- package/dist/channels/__tests__/format.test.js +146 -0
- package/dist/channels/__tests__/format.test.js.map +1 -0
- package/dist/channels/__tests__/manager.test.d.ts +6 -0
- package/dist/channels/__tests__/manager.test.js +34 -0
- package/dist/channels/__tests__/manager.test.js.map +1 -0
- package/dist/channels/__tests__/typing-controller.test.d.ts +4 -0
- package/dist/channels/__tests__/typing-controller.test.js +109 -0
- package/dist/channels/__tests__/typing-controller.test.js.map +1 -0
- package/dist/channels/__tests__/update-offset-store.test.d.ts +7 -0
- package/dist/channels/__tests__/update-offset-store.test.js +35 -0
- package/dist/channels/__tests__/update-offset-store.test.js.map +1 -0
- package/dist/channels/access-control.d.ts +93 -0
- package/dist/channels/access-control.js +201 -0
- package/dist/channels/access-control.js.map +1 -0
- package/dist/channels/draft-stream.d.ts +55 -0
- package/dist/channels/draft-stream.js +211 -0
- package/dist/channels/draft-stream.js.map +1 -0
- package/dist/channels/format.d.ts +38 -0
- package/dist/channels/format.js +187 -0
- package/dist/channels/format.js.map +1 -0
- package/dist/channels/index.d.ts +22 -0
- package/dist/channels/index.js +23 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/manager.d.ts +30 -0
- package/dist/channels/manager.js +125 -0
- package/dist/channels/manager.js.map +1 -0
- package/dist/channels/telegram/__tests__/index.test.d.ts +4 -0
- package/dist/channels/telegram/__tests__/index.test.js +153 -0
- package/dist/channels/telegram/__tests__/index.test.js.map +1 -0
- package/dist/channels/telegram/__tests__/inline-keyboards.test.d.ts +4 -0
- package/dist/channels/telegram/__tests__/inline-keyboards.test.js +99 -0
- package/dist/channels/telegram/__tests__/inline-keyboards.test.js.map +1 -0
- package/dist/channels/telegram/client.d.ts +48 -0
- package/dist/channels/telegram/client.js +177 -0
- package/dist/channels/telegram/client.js.map +1 -0
- package/dist/channels/telegram/command-handler.d.ts +28 -0
- package/dist/channels/telegram/command-handler.js +209 -0
- package/dist/channels/telegram/command-handler.js.map +1 -0
- package/dist/channels/telegram/index.d.ts +8 -0
- package/dist/channels/telegram/index.js +9 -0
- package/dist/channels/telegram/index.js.map +1 -0
- package/dist/channels/telegram/inline-keyboards.d.ts +20 -0
- package/dist/channels/telegram/inline-keyboards.js +38 -0
- package/dist/channels/telegram/inline-keyboards.js.map +1 -0
- package/dist/channels/telegram/plugin.d.ts +33 -0
- package/dist/channels/telegram/plugin.js +640 -0
- package/dist/channels/telegram/plugin.js.map +1 -0
- package/dist/channels/telegram/webhook.d.ts +31 -0
- package/dist/channels/telegram/webhook.js +129 -0
- package/dist/channels/telegram/webhook.js.map +1 -0
- package/dist/channels/types.d.ts +186 -0
- package/dist/channels/types.js +7 -0
- package/dist/channels/types.js.map +1 -0
- package/dist/channels/typing-controller.d.ts +47 -0
- package/dist/channels/typing-controller.js +117 -0
- package/dist/channels/typing-controller.js.map +1 -0
- package/dist/channels/update-offset-store.d.ts +37 -0
- package/dist/channels/update-offset-store.js +165 -0
- package/dist/channels/update-offset-store.js.map +1 -0
- package/dist/channels/whatsapp/index.d.ts +4 -0
- package/dist/channels/whatsapp/index.js +5 -0
- package/dist/channels/whatsapp/index.js.map +1 -0
- package/dist/channels/whatsapp/plugin.d.ts +27 -0
- package/dist/channels/whatsapp/plugin.js +66 -0
- package/dist/channels/whatsapp/plugin.js.map +1 -0
- package/dist/cli/__tests__/registry.test.d.ts +1 -0
- package/dist/cli/__tests__/registry.test.js +366 -0
- package/dist/cli/__tests__/registry.test.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +1 -0
- package/dist/cli/commands/agent.js +216 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +6 -0
- package/dist/cli/commands/auth.js +440 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/config.d.ts +1 -0
- package/dist/cli/commands/config.js +135 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/configure.d.ts +1 -0
- package/dist/cli/commands/configure.js +173 -0
- package/dist/cli/commands/configure.js.map +1 -0
- package/dist/cli/commands/cron.d.ts +1 -0
- package/dist/cli/commands/cron.js +81 -0
- package/dist/cli/commands/cron.js.map +1 -0
- package/dist/cli/commands/gateway.d.ts +1 -0
- package/dist/cli/commands/gateway.js +91 -0
- package/dist/cli/commands/gateway.js.map +1 -0
- package/dist/cli/commands/index.d.ts +0 -0
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/models.d.ts +1 -0
- package/dist/cli/commands/models.js +79 -0
- package/dist/cli/commands/models.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +1 -0
- package/dist/cli/commands/onboard.js +621 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/plugin.d.ts +1 -0
- package/dist/cli/commands/plugin.js +341 -0
- package/dist/cli/commands/plugin.js.map +1 -0
- package/dist/cli/commands/session.d.ts +1 -0
- package/dist/cli/commands/session.js +450 -0
- package/dist/cli/commands/session.js.map +1 -0
- package/dist/cli/commands/skills-test.d.ts +9 -0
- package/dist/cli/commands/skills-test.js +195 -0
- package/dist/cli/commands/skills-test.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +9 -0
- package/dist/cli/commands/skills.js +385 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/index.d.ts +19 -0
- package/dist/cli/index.js +40 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/registry.d.ts +43 -0
- package/dist/cli/registry.js +82 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/templates.d.ts +19 -0
- package/dist/cli/templates.js +191 -0
- package/dist/cli/templates.js.map +1 -0
- package/dist/cli/utils/colors.d.ts +13 -0
- package/dist/cli/utils/colors.js +16 -0
- package/dist/cli/utils/colors.js.map +1 -0
- package/dist/config/__tests__/diff.test.d.ts +1 -0
- package/dist/config/__tests__/diff.test.js +192 -0
- package/dist/config/__tests__/diff.test.js.map +1 -0
- package/dist/config/__tests__/loader.test.d.ts +1 -0
- package/dist/config/__tests__/loader.test.js +356 -0
- package/dist/config/__tests__/loader.test.js.map +1 -0
- package/dist/config/__tests__/paths.test.d.ts +1 -0
- package/dist/config/__tests__/paths.test.js +192 -0
- package/dist/config/__tests__/paths.test.js.map +1 -0
- package/dist/config/__tests__/reload.test.d.ts +1 -0
- package/dist/config/__tests__/reload.test.js +374 -0
- package/dist/config/__tests__/reload.test.js.map +1 -0
- package/dist/config/__tests__/rules.test.d.ts +1 -0
- package/dist/config/__tests__/rules.test.js +204 -0
- package/dist/config/__tests__/rules.test.js.map +1 -0
- package/dist/config/__tests__/schema.test.d.ts +1 -0
- package/dist/config/__tests__/schema.test.js +672 -0
- package/dist/config/__tests__/schema.test.js.map +1 -0
- package/dist/config/diff.d.ts +7 -0
- package/dist/config/diff.js +46 -0
- package/dist/config/diff.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +5 -0
- package/dist/config/loader.js +81 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/paths.d.ts +35 -0
- package/dist/config/paths.js +79 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/reload.d.ts +78 -0
- package/dist/config/reload.js +190 -0
- package/dist/config/reload.js.map +1 -0
- package/dist/config/rules.d.ts +42 -0
- package/dist/config/rules.js +114 -0
- package/dist/config/rules.js.map +1 -0
- package/dist/config/schema.d.ts +1340 -0
- package/dist/config/schema.js +611 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/cron/executor.d.ts +54 -0
- package/dist/cron/executor.js +364 -0
- package/dist/cron/executor.js.map +1 -0
- package/dist/cron/index.d.ts +5 -0
- package/dist/cron/index.js +6 -0
- package/dist/cron/index.js.map +1 -0
- package/dist/cron/persistence.d.ts +61 -0
- package/dist/cron/persistence.js +188 -0
- package/dist/cron/persistence.js.map +1 -0
- package/dist/cron/service.d.ts +94 -0
- package/dist/cron/service.js +382 -0
- package/dist/cron/service.js.map +1 -0
- package/dist/cron/types.d.ts +119 -0
- package/dist/cron/types.js +3 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/cron/validation.d.ts +144 -0
- package/dist/cron/validation.js +113 -0
- package/dist/cron/validation.js.map +1 -0
- package/dist/errors/__tests__/index.test.d.ts +1 -0
- package/dist/errors/__tests__/index.test.js +301 -0
- package/dist/errors/__tests__/index.test.js.map +1 -0
- package/dist/errors/index.d.ts +114 -0
- package/dist/errors/index.js +278 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/gateway/hono/app.d.ts +7 -0
- package/dist/gateway/hono/app.js +668 -0
- package/dist/gateway/hono/app.js.map +1 -0
- package/dist/gateway/hono/index.d.ts +2 -0
- package/dist/gateway/hono/index.js +3 -0
- package/dist/gateway/hono/index.js.map +1 -0
- package/dist/gateway/hono/middleware/auth.d.ts +18 -0
- package/dist/gateway/hono/middleware/auth.js +79 -0
- package/dist/gateway/hono/middleware/auth.js.map +1 -0
- package/dist/gateway/hono/middleware/logger.d.ts +1 -0
- package/dist/gateway/hono/middleware/logger.js +17 -0
- package/dist/gateway/hono/middleware/logger.js.map +1 -0
- package/dist/gateway/hono/sse.d.ts +55 -0
- package/dist/gateway/hono/sse.js +224 -0
- package/dist/gateway/hono/sse.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -0
- package/dist/gateway/index.js +5 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/protocol.d.ts +28 -0
- package/dist/gateway/protocol.js +14 -0
- package/dist/gateway/protocol.js.map +1 -0
- package/dist/gateway/server.d.ts +19 -0
- package/dist/gateway/server.js +64 -0
- package/dist/gateway/server.js.map +1 -0
- package/dist/gateway/service.d.ts +265 -0
- package/dist/gateway/service.js +621 -0
- package/dist/gateway/service.js.map +1 -0
- package/dist/gateway/static/root/assets/main-CfIxL-cL.js +2105 -0
- package/dist/gateway/static/root/assets/main-CfIxL-cL.js.map +1 -0
- package/dist/gateway/static/root/assets/main-DndcTCgX.css +1 -0
- package/dist/gateway/static/root/index.html +116 -0
- package/dist/heartbeat/index.d.ts +1 -0
- package/dist/heartbeat/index.js +2 -0
- package/dist/heartbeat/index.js.map +1 -0
- package/dist/heartbeat/service.d.ts +19 -0
- package/dist/heartbeat/service.js +61 -0
- package/dist/heartbeat/service.js.map +1 -0
- package/dist/plugin-sdk/index.d.ts +21 -0
- package/dist/plugin-sdk/index.js +12 -0
- package/dist/plugin-sdk/index.js.map +1 -0
- package/dist/plugins/__tests__/api.test.d.ts +1 -0
- package/dist/plugins/__tests__/api.test.js +164 -0
- package/dist/plugins/__tests__/api.test.js.map +1 -0
- package/dist/plugins/__tests__/hooks.test.d.ts +1 -0
- package/dist/plugins/__tests__/hooks.test.js +159 -0
- package/dist/plugins/__tests__/hooks.test.js.map +1 -0
- package/dist/plugins/__tests__/loader.test.d.ts +1 -0
- package/dist/plugins/__tests__/loader.test.js +120 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/api.d.ts +41 -0
- package/dist/plugins/api.js +131 -0
- package/dist/plugins/api.js.map +1 -0
- package/dist/plugins/hooks.d.ts +153 -0
- package/dist/plugins/hooks.js +172 -0
- package/dist/plugins/hooks.js.map +1 -0
- package/dist/plugins/index.d.ts +11 -0
- package/dist/plugins/index.js +16 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/install.d.ts +59 -0
- package/dist/plugins/install.js +324 -0
- package/dist/plugins/install.js.map +1 -0
- package/dist/plugins/loader.d.ts +84 -0
- package/dist/plugins/loader.js +545 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/types.d.ts +190 -0
- package/dist/plugins/types.js +7 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/providers/__tests__/registry.test.d.ts +1 -0
- package/dist/providers/__tests__/registry.test.js +110 -0
- package/dist/providers/__tests__/registry.test.js.map +1 -0
- package/dist/providers/api-strategies.d.ts +15 -0
- package/dist/providers/api-strategies.js +96 -0
- package/dist/providers/api-strategies.js.map +1 -0
- package/dist/providers/auto-discovery.d.ts +84 -0
- package/dist/providers/auto-discovery.js +236 -0
- package/dist/providers/auto-discovery.js.map +1 -0
- package/dist/providers/config.d.ts +25 -0
- package/dist/providers/config.js +42 -0
- package/dist/providers/config.js.map +1 -0
- package/dist/providers/index.d.ts +25 -0
- package/dist/providers/index.js +55 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/model-catalog.d.ts +205 -0
- package/dist/providers/model-catalog.js +1071 -0
- package/dist/providers/model-catalog.js.map +1 -0
- package/dist/providers/models-dev-data.d.ts +11 -0
- package/dist/providers/models-dev-data.js +1035 -0
- package/dist/providers/models-dev-data.js.map +1 -0
- package/dist/providers/models-dev.d.ts +30 -0
- package/dist/providers/models-dev.js +42 -0
- package/dist/providers/models-dev.js.map +1 -0
- package/dist/providers/pi-ai.d.ts +62 -0
- package/dist/providers/pi-ai.js +221 -0
- package/dist/providers/pi-ai.js.map +1 -0
- package/dist/providers/provider-catalog.d.ts +173 -0
- package/dist/providers/provider-catalog.js +834 -0
- package/dist/providers/provider-catalog.js.map +1 -0
- package/dist/providers/registry.d.ts +155 -0
- package/dist/providers/registry.js +524 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/types.d.ts +95 -0
- package/dist/providers/types.js +7 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/session/chat-manager.d.ts +49 -0
- package/dist/session/chat-manager.js +167 -0
- package/dist/session/chat-manager.js.map +1 -0
- package/dist/session/chat-types.d.ts +53 -0
- package/dist/session/chat-types.js +63 -0
- package/dist/session/chat-types.js.map +1 -0
- package/dist/session/index.d.ts +5 -0
- package/dist/session/index.js +5 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +103 -0
- package/dist/session/manager.js +200 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/store.d.ts +114 -0
- package/dist/session/store.js +687 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/types.d.ts +88 -0
- package/dist/session/types.js +10 -0
- package/dist/session/types.js.map +1 -0
- package/dist/types/index.d.ts +177 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/providers.d.ts +67 -0
- package/dist/types/providers.js +7 -0
- package/dist/types/providers.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +17 -0
- package/dist/utils/frontmatter.js +104 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/helpers.d.ts +5 -0
- package/dist/utils/helpers.js +36 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/log-store.d.ts +78 -0
- package/dist/utils/log-store.js +432 -0
- package/dist/utils/log-store.js.map +1 -0
- package/dist/utils/logger.d.ts +127 -0
- package/dist/utils/logger.js +481 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/logger.types.d.ts +152 -0
- package/dist/utils/logger.types.js +30 -0
- package/dist/utils/logger.types.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Catalog
|
|
3
|
+
*
|
|
4
|
+
* 统一的 Provider 定义中心
|
|
5
|
+
* - 合并 schema.ts、registry.ts、PROVIDER_INFO 中的 provider 定义
|
|
6
|
+
* - 支持动态 provider 扩展
|
|
7
|
+
* - 声明式能力配置
|
|
8
|
+
*/
|
|
9
|
+
// ============================================
|
|
10
|
+
// Provider 注册表
|
|
11
|
+
// ============================================
|
|
12
|
+
export const PROVIDER_CATALOG = {
|
|
13
|
+
// ============================================
|
|
14
|
+
// Native Providers
|
|
15
|
+
// ============================================
|
|
16
|
+
openai: {
|
|
17
|
+
id: 'openai',
|
|
18
|
+
name: 'OpenAI',
|
|
19
|
+
category: 'native',
|
|
20
|
+
description: 'OpenAI API - GPT-4, o1, o3 系列',
|
|
21
|
+
auth: {
|
|
22
|
+
type: 'api_key',
|
|
23
|
+
envKeys: ['OPENAI_API_KEY'],
|
|
24
|
+
headerPrefix: 'Bearer ',
|
|
25
|
+
supportsOAuth: false,
|
|
26
|
+
},
|
|
27
|
+
api: {
|
|
28
|
+
type: 'openai',
|
|
29
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
30
|
+
strategy: 'openai-completions',
|
|
31
|
+
},
|
|
32
|
+
capabilities: {
|
|
33
|
+
multimodal: true,
|
|
34
|
+
streaming: true,
|
|
35
|
+
functionCalling: true,
|
|
36
|
+
vision: true,
|
|
37
|
+
reasoning: true,
|
|
38
|
+
jsonMode: true,
|
|
39
|
+
systemPrompt: true,
|
|
40
|
+
tools: true,
|
|
41
|
+
imageGeneration: true,
|
|
42
|
+
},
|
|
43
|
+
defaults: {
|
|
44
|
+
temperature: 0.7,
|
|
45
|
+
maxTokens: 4096,
|
|
46
|
+
timeout: 60000,
|
|
47
|
+
contextWindow: 128000,
|
|
48
|
+
},
|
|
49
|
+
modelPrefixes: ['gpt-', 'o1', 'o3', 'o4'],
|
|
50
|
+
},
|
|
51
|
+
anthropic: {
|
|
52
|
+
id: 'anthropic',
|
|
53
|
+
name: 'Anthropic',
|
|
54
|
+
category: 'native',
|
|
55
|
+
description: 'Anthropic Claude 系列',
|
|
56
|
+
auth: {
|
|
57
|
+
type: 'api_key',
|
|
58
|
+
envKeys: ['ANTHROPIC_API_KEY'],
|
|
59
|
+
headerPrefix: 'Bearer ',
|
|
60
|
+
supportsOAuth: true,
|
|
61
|
+
},
|
|
62
|
+
api: {
|
|
63
|
+
type: 'anthropic',
|
|
64
|
+
baseUrl: 'https://api.anthropic.com',
|
|
65
|
+
strategy: 'anthropic-messages',
|
|
66
|
+
},
|
|
67
|
+
capabilities: {
|
|
68
|
+
multimodal: true,
|
|
69
|
+
streaming: true,
|
|
70
|
+
functionCalling: true,
|
|
71
|
+
vision: true,
|
|
72
|
+
reasoning: true,
|
|
73
|
+
jsonMode: false,
|
|
74
|
+
systemPrompt: true,
|
|
75
|
+
tools: true,
|
|
76
|
+
},
|
|
77
|
+
defaults: {
|
|
78
|
+
temperature: 0.7,
|
|
79
|
+
maxTokens: 8192,
|
|
80
|
+
timeout: 60000,
|
|
81
|
+
contextWindow: 200000,
|
|
82
|
+
},
|
|
83
|
+
modelPrefixes: ['claude-'],
|
|
84
|
+
},
|
|
85
|
+
google: {
|
|
86
|
+
id: 'google',
|
|
87
|
+
name: 'Google',
|
|
88
|
+
category: 'native',
|
|
89
|
+
description: 'Google Gemini 系列',
|
|
90
|
+
auth: {
|
|
91
|
+
type: 'api_key',
|
|
92
|
+
envKeys: ['GOOGLE_API_KEY', 'GEMINI_API_KEY'],
|
|
93
|
+
headerPrefix: '',
|
|
94
|
+
supportsOAuth: false,
|
|
95
|
+
},
|
|
96
|
+
api: {
|
|
97
|
+
type: 'google',
|
|
98
|
+
baseUrl: 'https://generativelanguage.googleapis.com/v1',
|
|
99
|
+
strategy: 'google-generative-ai',
|
|
100
|
+
},
|
|
101
|
+
capabilities: {
|
|
102
|
+
multimodal: true,
|
|
103
|
+
streaming: true,
|
|
104
|
+
functionCalling: true,
|
|
105
|
+
vision: true,
|
|
106
|
+
reasoning: true,
|
|
107
|
+
jsonMode: true,
|
|
108
|
+
systemPrompt: true,
|
|
109
|
+
tools: true,
|
|
110
|
+
},
|
|
111
|
+
defaults: {
|
|
112
|
+
temperature: 0.7,
|
|
113
|
+
maxTokens: 8192,
|
|
114
|
+
timeout: 60000,
|
|
115
|
+
contextWindow: 1000000,
|
|
116
|
+
},
|
|
117
|
+
modelPrefixes: ['gemini-', 'gemma-'],
|
|
118
|
+
},
|
|
119
|
+
// ============================================
|
|
120
|
+
// OpenAI-Compatible Providers
|
|
121
|
+
// ============================================
|
|
122
|
+
qwen: {
|
|
123
|
+
id: 'qwen',
|
|
124
|
+
name: 'Qwen (通义千问)',
|
|
125
|
+
category: 'openai-compatible',
|
|
126
|
+
description: '阿里云通义千问',
|
|
127
|
+
auth: {
|
|
128
|
+
type: 'api_key',
|
|
129
|
+
envKeys: ['QWEN_API_KEY', 'DASHSCOPE_API_KEY'],
|
|
130
|
+
headerPrefix: 'Bearer ',
|
|
131
|
+
supportsOAuth: true,
|
|
132
|
+
},
|
|
133
|
+
api: {
|
|
134
|
+
type: 'openai',
|
|
135
|
+
baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
|
136
|
+
strategy: 'openai-completions',
|
|
137
|
+
},
|
|
138
|
+
capabilities: {
|
|
139
|
+
multimodal: true,
|
|
140
|
+
streaming: true,
|
|
141
|
+
functionCalling: true,
|
|
142
|
+
vision: true,
|
|
143
|
+
reasoning: true,
|
|
144
|
+
jsonMode: true,
|
|
145
|
+
systemPrompt: true,
|
|
146
|
+
tools: true,
|
|
147
|
+
},
|
|
148
|
+
defaults: {
|
|
149
|
+
temperature: 0.7,
|
|
150
|
+
maxTokens: 4096,
|
|
151
|
+
timeout: 60000,
|
|
152
|
+
contextWindow: 128000,
|
|
153
|
+
},
|
|
154
|
+
modelPrefixes: ['qwen', 'qwq'],
|
|
155
|
+
},
|
|
156
|
+
kimi: {
|
|
157
|
+
id: 'kimi',
|
|
158
|
+
name: 'Kimi (月之暗面)',
|
|
159
|
+
category: 'openai-compatible',
|
|
160
|
+
description: 'Moonshot Kimi 系列',
|
|
161
|
+
auth: {
|
|
162
|
+
type: 'api_key',
|
|
163
|
+
envKeys: ['KIMI_API_KEY', 'MOONSHOT_API_KEY'],
|
|
164
|
+
headerPrefix: 'Bearer ',
|
|
165
|
+
supportsOAuth: true,
|
|
166
|
+
},
|
|
167
|
+
api: {
|
|
168
|
+
type: 'openai',
|
|
169
|
+
baseUrl: 'https://api.moonshot.cn/v1',
|
|
170
|
+
strategy: 'openai-completions',
|
|
171
|
+
},
|
|
172
|
+
capabilities: {
|
|
173
|
+
multimodal: false,
|
|
174
|
+
streaming: true,
|
|
175
|
+
functionCalling: true,
|
|
176
|
+
vision: false,
|
|
177
|
+
reasoning: true,
|
|
178
|
+
jsonMode: true,
|
|
179
|
+
systemPrompt: true,
|
|
180
|
+
tools: true,
|
|
181
|
+
},
|
|
182
|
+
defaults: {
|
|
183
|
+
temperature: 0.7,
|
|
184
|
+
maxTokens: 4096,
|
|
185
|
+
timeout: 60000,
|
|
186
|
+
contextWindow: 256000,
|
|
187
|
+
},
|
|
188
|
+
modelPrefixes: ['kimi'],
|
|
189
|
+
},
|
|
190
|
+
moonshot: {
|
|
191
|
+
id: 'moonshot',
|
|
192
|
+
name: 'Moonshot AI',
|
|
193
|
+
category: 'openai-compatible',
|
|
194
|
+
description: 'Moonshot AI',
|
|
195
|
+
auth: {
|
|
196
|
+
type: 'api_key',
|
|
197
|
+
envKeys: ['MOONSHOT_API_KEY'],
|
|
198
|
+
headerPrefix: 'Bearer ',
|
|
199
|
+
supportsOAuth: false,
|
|
200
|
+
},
|
|
201
|
+
api: {
|
|
202
|
+
type: 'openai',
|
|
203
|
+
baseUrl: 'https://api.moonshot.ai/v1',
|
|
204
|
+
strategy: 'openai-completions',
|
|
205
|
+
},
|
|
206
|
+
capabilities: {
|
|
207
|
+
multimodal: false,
|
|
208
|
+
streaming: true,
|
|
209
|
+
functionCalling: true,
|
|
210
|
+
vision: false,
|
|
211
|
+
reasoning: true,
|
|
212
|
+
jsonMode: true,
|
|
213
|
+
systemPrompt: true,
|
|
214
|
+
tools: true,
|
|
215
|
+
},
|
|
216
|
+
defaults: {
|
|
217
|
+
temperature: 0.7,
|
|
218
|
+
maxTokens: 4096,
|
|
219
|
+
timeout: 60000,
|
|
220
|
+
contextWindow: 128000,
|
|
221
|
+
},
|
|
222
|
+
modelPrefixes: ['moonshot'],
|
|
223
|
+
},
|
|
224
|
+
deepseek: {
|
|
225
|
+
id: 'deepseek',
|
|
226
|
+
name: 'DeepSeek',
|
|
227
|
+
category: 'openai-compatible',
|
|
228
|
+
description: 'DeepSeek 大模型',
|
|
229
|
+
auth: {
|
|
230
|
+
type: 'api_key',
|
|
231
|
+
envKeys: ['DEEPSEEK_API_KEY'],
|
|
232
|
+
headerPrefix: 'Bearer ',
|
|
233
|
+
supportsOAuth: false,
|
|
234
|
+
},
|
|
235
|
+
api: {
|
|
236
|
+
type: 'openai',
|
|
237
|
+
baseUrl: 'https://api.deepseek.com/v1',
|
|
238
|
+
strategy: 'openai-completions',
|
|
239
|
+
},
|
|
240
|
+
capabilities: {
|
|
241
|
+
multimodal: false,
|
|
242
|
+
streaming: true,
|
|
243
|
+
functionCalling: true,
|
|
244
|
+
vision: false,
|
|
245
|
+
reasoning: true,
|
|
246
|
+
jsonMode: true,
|
|
247
|
+
systemPrompt: true,
|
|
248
|
+
tools: true,
|
|
249
|
+
},
|
|
250
|
+
defaults: {
|
|
251
|
+
temperature: 0.7,
|
|
252
|
+
maxTokens: 8192,
|
|
253
|
+
timeout: 60000,
|
|
254
|
+
contextWindow: 64000,
|
|
255
|
+
},
|
|
256
|
+
modelPrefixes: ['deepseek', 'r1'],
|
|
257
|
+
},
|
|
258
|
+
groq: {
|
|
259
|
+
id: 'groq',
|
|
260
|
+
name: 'Groq',
|
|
261
|
+
category: 'openai-compatible',
|
|
262
|
+
description: 'Groq 高速推理',
|
|
263
|
+
auth: {
|
|
264
|
+
type: 'api_key',
|
|
265
|
+
envKeys: ['GROQ_API_KEY'],
|
|
266
|
+
headerPrefix: 'Bearer ',
|
|
267
|
+
supportsOAuth: false,
|
|
268
|
+
},
|
|
269
|
+
api: {
|
|
270
|
+
type: 'openai',
|
|
271
|
+
baseUrl: 'https://api.groq.com/openai/v1',
|
|
272
|
+
strategy: 'openai-completions',
|
|
273
|
+
},
|
|
274
|
+
capabilities: {
|
|
275
|
+
multimodal: false,
|
|
276
|
+
streaming: true,
|
|
277
|
+
functionCalling: true,
|
|
278
|
+
vision: false,
|
|
279
|
+
reasoning: false,
|
|
280
|
+
jsonMode: true,
|
|
281
|
+
systemPrompt: true,
|
|
282
|
+
tools: true,
|
|
283
|
+
},
|
|
284
|
+
defaults: {
|
|
285
|
+
temperature: 0.7,
|
|
286
|
+
maxTokens: 4096,
|
|
287
|
+
timeout: 30000,
|
|
288
|
+
contextWindow: 128000,
|
|
289
|
+
},
|
|
290
|
+
modelPrefixes: ['llama', 'mixtral', 'gemma'],
|
|
291
|
+
},
|
|
292
|
+
openrouter: {
|
|
293
|
+
id: 'openrouter',
|
|
294
|
+
name: 'OpenRouter',
|
|
295
|
+
category: 'openai-compatible',
|
|
296
|
+
description: 'OpenRouter 模型聚合',
|
|
297
|
+
auth: {
|
|
298
|
+
type: 'api_key',
|
|
299
|
+
envKeys: ['OPENROUTER_API_KEY'],
|
|
300
|
+
headerPrefix: 'Bearer ',
|
|
301
|
+
supportsOAuth: false,
|
|
302
|
+
},
|
|
303
|
+
api: {
|
|
304
|
+
type: 'openai',
|
|
305
|
+
baseUrl: 'https://openrouter.ai/api/v1',
|
|
306
|
+
strategy: 'openai-completions',
|
|
307
|
+
},
|
|
308
|
+
capabilities: {
|
|
309
|
+
multimodal: true,
|
|
310
|
+
streaming: true,
|
|
311
|
+
functionCalling: true,
|
|
312
|
+
vision: true,
|
|
313
|
+
reasoning: true,
|
|
314
|
+
jsonMode: true,
|
|
315
|
+
systemPrompt: true,
|
|
316
|
+
tools: true,
|
|
317
|
+
},
|
|
318
|
+
defaults: {
|
|
319
|
+
temperature: 0.7,
|
|
320
|
+
maxTokens: 4096,
|
|
321
|
+
timeout: 60000,
|
|
322
|
+
contextWindow: 128000,
|
|
323
|
+
},
|
|
324
|
+
modelPrefixes: [],
|
|
325
|
+
},
|
|
326
|
+
xai: {
|
|
327
|
+
id: 'xai',
|
|
328
|
+
name: 'xAI (Grok)',
|
|
329
|
+
category: 'openai-compatible',
|
|
330
|
+
description: 'xAI Grok 系列',
|
|
331
|
+
auth: {
|
|
332
|
+
type: 'api_key',
|
|
333
|
+
envKeys: ['XAI_API_KEY'],
|
|
334
|
+
headerPrefix: 'Bearer ',
|
|
335
|
+
supportsOAuth: false,
|
|
336
|
+
},
|
|
337
|
+
api: {
|
|
338
|
+
type: 'openai',
|
|
339
|
+
baseUrl: 'https://api.x.ai/v1',
|
|
340
|
+
strategy: 'openai-completions',
|
|
341
|
+
},
|
|
342
|
+
capabilities: {
|
|
343
|
+
multimodal: true,
|
|
344
|
+
streaming: true,
|
|
345
|
+
functionCalling: true,
|
|
346
|
+
vision: true,
|
|
347
|
+
reasoning: true,
|
|
348
|
+
jsonMode: true,
|
|
349
|
+
systemPrompt: true,
|
|
350
|
+
tools: true,
|
|
351
|
+
},
|
|
352
|
+
defaults: {
|
|
353
|
+
temperature: 0.7,
|
|
354
|
+
maxTokens: 4096,
|
|
355
|
+
timeout: 60000,
|
|
356
|
+
contextWindow: 128000,
|
|
357
|
+
},
|
|
358
|
+
modelPrefixes: ['grok'],
|
|
359
|
+
},
|
|
360
|
+
cerebras: {
|
|
361
|
+
id: 'cerebras',
|
|
362
|
+
name: 'Cerebras',
|
|
363
|
+
category: 'openai-compatible',
|
|
364
|
+
description: 'Cerebras 推理',
|
|
365
|
+
auth: {
|
|
366
|
+
type: 'api_key',
|
|
367
|
+
envKeys: ['CEREBRAS_API_KEY'],
|
|
368
|
+
headerPrefix: 'Bearer ',
|
|
369
|
+
supportsOAuth: false,
|
|
370
|
+
},
|
|
371
|
+
api: {
|
|
372
|
+
type: 'openai',
|
|
373
|
+
baseUrl: 'https://api.cerebras.ai/v1',
|
|
374
|
+
strategy: 'openai-completions',
|
|
375
|
+
},
|
|
376
|
+
capabilities: {
|
|
377
|
+
multimodal: false,
|
|
378
|
+
streaming: true,
|
|
379
|
+
functionCalling: false,
|
|
380
|
+
vision: false,
|
|
381
|
+
reasoning: false,
|
|
382
|
+
jsonMode: true,
|
|
383
|
+
systemPrompt: true,
|
|
384
|
+
tools: false,
|
|
385
|
+
},
|
|
386
|
+
defaults: {
|
|
387
|
+
temperature: 0.7,
|
|
388
|
+
maxTokens: 4096,
|
|
389
|
+
timeout: 30000,
|
|
390
|
+
contextWindow: 8192,
|
|
391
|
+
},
|
|
392
|
+
modelPrefixes: [],
|
|
393
|
+
},
|
|
394
|
+
mistral: {
|
|
395
|
+
id: 'mistral',
|
|
396
|
+
name: 'Mistral AI',
|
|
397
|
+
category: 'openai-compatible',
|
|
398
|
+
description: 'Mistral 大模型',
|
|
399
|
+
auth: {
|
|
400
|
+
type: 'api_key',
|
|
401
|
+
envKeys: ['MISTRAL_API_KEY'],
|
|
402
|
+
headerPrefix: 'Bearer ',
|
|
403
|
+
supportsOAuth: false,
|
|
404
|
+
},
|
|
405
|
+
api: {
|
|
406
|
+
type: 'openai',
|
|
407
|
+
baseUrl: 'https://api.mistral.ai/v1',
|
|
408
|
+
strategy: 'openai-completions',
|
|
409
|
+
},
|
|
410
|
+
capabilities: {
|
|
411
|
+
multimodal: false,
|
|
412
|
+
streaming: true,
|
|
413
|
+
functionCalling: true,
|
|
414
|
+
vision: false,
|
|
415
|
+
reasoning: false,
|
|
416
|
+
jsonMode: true,
|
|
417
|
+
systemPrompt: true,
|
|
418
|
+
tools: true,
|
|
419
|
+
},
|
|
420
|
+
defaults: {
|
|
421
|
+
temperature: 0.7,
|
|
422
|
+
maxTokens: 4096,
|
|
423
|
+
timeout: 60000,
|
|
424
|
+
contextWindow: 32000,
|
|
425
|
+
},
|
|
426
|
+
modelPrefixes: ['mistral'],
|
|
427
|
+
},
|
|
428
|
+
// ============================================
|
|
429
|
+
// Anthropic-Compatible Providers
|
|
430
|
+
// ============================================
|
|
431
|
+
minimax: {
|
|
432
|
+
id: 'minimax',
|
|
433
|
+
name: 'MiniMax',
|
|
434
|
+
category: 'anthropic-compatible',
|
|
435
|
+
description: 'MiniMax 海外版',
|
|
436
|
+
auth: {
|
|
437
|
+
type: 'api_key',
|
|
438
|
+
envKeys: ['MINIMAX_API_KEY'],
|
|
439
|
+
headerPrefix: 'Bearer ',
|
|
440
|
+
supportsOAuth: true,
|
|
441
|
+
},
|
|
442
|
+
api: {
|
|
443
|
+
type: 'openai',
|
|
444
|
+
baseUrl: 'https://api.minimax.io/anthropic',
|
|
445
|
+
strategy: 'anthropic-messages',
|
|
446
|
+
},
|
|
447
|
+
capabilities: {
|
|
448
|
+
multimodal: false,
|
|
449
|
+
streaming: true,
|
|
450
|
+
functionCalling: true,
|
|
451
|
+
vision: false,
|
|
452
|
+
reasoning: true,
|
|
453
|
+
jsonMode: true,
|
|
454
|
+
systemPrompt: true,
|
|
455
|
+
tools: true,
|
|
456
|
+
},
|
|
457
|
+
defaults: {
|
|
458
|
+
temperature: 0.7,
|
|
459
|
+
maxTokens: 4096,
|
|
460
|
+
timeout: 60000,
|
|
461
|
+
contextWindow: 1000000,
|
|
462
|
+
},
|
|
463
|
+
modelPrefixes: ['minimax'],
|
|
464
|
+
},
|
|
465
|
+
'minimax-cn': {
|
|
466
|
+
id: 'minimax-cn',
|
|
467
|
+
name: 'MiniMax CN',
|
|
468
|
+
category: 'anthropic-compatible',
|
|
469
|
+
description: 'MiniMax 国内版',
|
|
470
|
+
auth: {
|
|
471
|
+
type: 'api_key',
|
|
472
|
+
envKeys: ['MINIMAX_CN_API_KEY', 'MINIMAX_API_KEY'],
|
|
473
|
+
headerPrefix: 'Bearer ',
|
|
474
|
+
supportsOAuth: false,
|
|
475
|
+
},
|
|
476
|
+
api: {
|
|
477
|
+
type: 'openai',
|
|
478
|
+
baseUrl: 'https://api.minimaxi.com/anthropic',
|
|
479
|
+
strategy: 'anthropic-messages',
|
|
480
|
+
},
|
|
481
|
+
capabilities: {
|
|
482
|
+
multimodal: false,
|
|
483
|
+
streaming: true,
|
|
484
|
+
functionCalling: true,
|
|
485
|
+
vision: false,
|
|
486
|
+
reasoning: true,
|
|
487
|
+
jsonMode: true,
|
|
488
|
+
systemPrompt: true,
|
|
489
|
+
tools: true,
|
|
490
|
+
},
|
|
491
|
+
defaults: {
|
|
492
|
+
temperature: 0.7,
|
|
493
|
+
maxTokens: 4096,
|
|
494
|
+
timeout: 60000,
|
|
495
|
+
contextWindow: 1000000,
|
|
496
|
+
},
|
|
497
|
+
modelPrefixes: ['minimax-cn'],
|
|
498
|
+
},
|
|
499
|
+
zhipu: {
|
|
500
|
+
id: 'zhipu',
|
|
501
|
+
name: 'Zhipu (智谱)',
|
|
502
|
+
category: 'openai-compatible',
|
|
503
|
+
description: '智谱 GLM 系列',
|
|
504
|
+
auth: {
|
|
505
|
+
type: 'api_key',
|
|
506
|
+
envKeys: ['ZHIPU_API_KEY'],
|
|
507
|
+
headerPrefix: 'Bearer ',
|
|
508
|
+
supportsOAuth: false,
|
|
509
|
+
},
|
|
510
|
+
api: {
|
|
511
|
+
type: 'openai',
|
|
512
|
+
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
|
513
|
+
strategy: 'openai-completions',
|
|
514
|
+
},
|
|
515
|
+
capabilities: {
|
|
516
|
+
multimodal: true,
|
|
517
|
+
streaming: true,
|
|
518
|
+
functionCalling: true,
|
|
519
|
+
vision: true,
|
|
520
|
+
reasoning: false,
|
|
521
|
+
jsonMode: true,
|
|
522
|
+
systemPrompt: true,
|
|
523
|
+
tools: true,
|
|
524
|
+
},
|
|
525
|
+
defaults: {
|
|
526
|
+
temperature: 0.7,
|
|
527
|
+
maxTokens: 4096,
|
|
528
|
+
timeout: 60000,
|
|
529
|
+
contextWindow: 128000,
|
|
530
|
+
},
|
|
531
|
+
modelPrefixes: ['glm-'],
|
|
532
|
+
},
|
|
533
|
+
'zhipu-cn': {
|
|
534
|
+
id: 'zhipu-cn',
|
|
535
|
+
name: 'Zhipu CN',
|
|
536
|
+
category: 'openai-compatible',
|
|
537
|
+
description: '智谱国内版',
|
|
538
|
+
auth: {
|
|
539
|
+
type: 'api_key',
|
|
540
|
+
envKeys: ['ZHIPU_CN_API_KEY', 'ZHIPU_API_KEY'],
|
|
541
|
+
headerPrefix: 'Bearer ',
|
|
542
|
+
supportsOAuth: false,
|
|
543
|
+
},
|
|
544
|
+
api: {
|
|
545
|
+
type: 'openai',
|
|
546
|
+
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
|
547
|
+
strategy: 'openai-completions',
|
|
548
|
+
},
|
|
549
|
+
capabilities: {
|
|
550
|
+
multimodal: true,
|
|
551
|
+
streaming: true,
|
|
552
|
+
functionCalling: true,
|
|
553
|
+
vision: true,
|
|
554
|
+
reasoning: false,
|
|
555
|
+
jsonMode: true,
|
|
556
|
+
systemPrompt: true,
|
|
557
|
+
tools: true,
|
|
558
|
+
},
|
|
559
|
+
defaults: {
|
|
560
|
+
temperature: 0.7,
|
|
561
|
+
maxTokens: 4096,
|
|
562
|
+
timeout: 60000,
|
|
563
|
+
contextWindow: 128000,
|
|
564
|
+
},
|
|
565
|
+
modelPrefixes: ['glm-'],
|
|
566
|
+
},
|
|
567
|
+
// ============================================
|
|
568
|
+
// Local Providers
|
|
569
|
+
// ============================================
|
|
570
|
+
ollama: {
|
|
571
|
+
id: 'ollama',
|
|
572
|
+
name: 'Ollama',
|
|
573
|
+
category: 'local',
|
|
574
|
+
description: '本地 Ollama 模型',
|
|
575
|
+
auth: {
|
|
576
|
+
type: 'api_key',
|
|
577
|
+
envKeys: ['OLLAMA_API_KEY'],
|
|
578
|
+
headerPrefix: 'Bearer ',
|
|
579
|
+
supportsOAuth: false,
|
|
580
|
+
},
|
|
581
|
+
api: {
|
|
582
|
+
type: 'ollama',
|
|
583
|
+
baseUrl: 'http://127.0.0.1:11434/v1',
|
|
584
|
+
strategy: 'openai-completions',
|
|
585
|
+
},
|
|
586
|
+
capabilities: {
|
|
587
|
+
multimodal: true,
|
|
588
|
+
streaming: true,
|
|
589
|
+
functionCalling: true,
|
|
590
|
+
vision: true,
|
|
591
|
+
reasoning: true,
|
|
592
|
+
jsonMode: true,
|
|
593
|
+
systemPrompt: true,
|
|
594
|
+
tools: true,
|
|
595
|
+
},
|
|
596
|
+
defaults: {
|
|
597
|
+
temperature: 0.7,
|
|
598
|
+
maxTokens: 4096,
|
|
599
|
+
timeout: 60000,
|
|
600
|
+
contextWindow: 128000,
|
|
601
|
+
},
|
|
602
|
+
modelPrefixes: [],
|
|
603
|
+
},
|
|
604
|
+
// ============================================
|
|
605
|
+
// Special Providers
|
|
606
|
+
// ============================================
|
|
607
|
+
'github-copilot': {
|
|
608
|
+
id: 'github-copilot',
|
|
609
|
+
name: 'GitHub Copilot',
|
|
610
|
+
category: 'native',
|
|
611
|
+
description: 'GitHub Copilot Chat',
|
|
612
|
+
auth: {
|
|
613
|
+
type: 'token',
|
|
614
|
+
envKeys: ['GITHUB_COPILOT_TOKEN'],
|
|
615
|
+
headerPrefix: 'token ',
|
|
616
|
+
supportsOAuth: true,
|
|
617
|
+
},
|
|
618
|
+
api: {
|
|
619
|
+
type: 'custom',
|
|
620
|
+
baseUrl: '',
|
|
621
|
+
strategy: 'github-copilot',
|
|
622
|
+
},
|
|
623
|
+
capabilities: {
|
|
624
|
+
multimodal: false,
|
|
625
|
+
streaming: true,
|
|
626
|
+
functionCalling: false,
|
|
627
|
+
vision: false,
|
|
628
|
+
reasoning: false,
|
|
629
|
+
jsonMode: false,
|
|
630
|
+
systemPrompt: true,
|
|
631
|
+
tools: false,
|
|
632
|
+
},
|
|
633
|
+
defaults: {
|
|
634
|
+
temperature: 0.7,
|
|
635
|
+
maxTokens: 4096,
|
|
636
|
+
timeout: 60000,
|
|
637
|
+
contextWindow: 128000,
|
|
638
|
+
},
|
|
639
|
+
modelPrefixes: [],
|
|
640
|
+
},
|
|
641
|
+
// ============================================
|
|
642
|
+
// Bailian Coding Plan (百炼 Coding Plan)
|
|
643
|
+
// ============================================
|
|
644
|
+
bailian: {
|
|
645
|
+
id: 'bailian',
|
|
646
|
+
name: 'Bailian Coding Plan',
|
|
647
|
+
category: 'openai-compatible',
|
|
648
|
+
description: '阿里云百炼 Coding Plan 专属 API',
|
|
649
|
+
auth: {
|
|
650
|
+
type: 'api_key',
|
|
651
|
+
envKeys: ['BAILIAN_API_KEY', 'BAILIAN_CODING_API_KEY'],
|
|
652
|
+
headerPrefix: 'Bearer ',
|
|
653
|
+
supportsOAuth: false,
|
|
654
|
+
},
|
|
655
|
+
api: {
|
|
656
|
+
type: 'openai',
|
|
657
|
+
baseUrl: 'https://coding.dashscope.aliyuncs.com/v1',
|
|
658
|
+
strategy: 'openai-completions',
|
|
659
|
+
},
|
|
660
|
+
capabilities: {
|
|
661
|
+
multimodal: false,
|
|
662
|
+
streaming: true,
|
|
663
|
+
functionCalling: true,
|
|
664
|
+
vision: false,
|
|
665
|
+
reasoning: true,
|
|
666
|
+
jsonMode: true,
|
|
667
|
+
systemPrompt: true,
|
|
668
|
+
tools: true,
|
|
669
|
+
},
|
|
670
|
+
defaults: {
|
|
671
|
+
temperature: 0.7,
|
|
672
|
+
maxTokens: 65536,
|
|
673
|
+
timeout: 120000,
|
|
674
|
+
contextWindow: 262144,
|
|
675
|
+
},
|
|
676
|
+
modelPrefixes: ['qwen3'],
|
|
677
|
+
},
|
|
678
|
+
};
|
|
679
|
+
// ============================================
|
|
680
|
+
// 辅助函数
|
|
681
|
+
// ============================================
|
|
682
|
+
/**
|
|
683
|
+
* 获取 Provider 定义
|
|
684
|
+
*/
|
|
685
|
+
export function getProvider(id) {
|
|
686
|
+
return PROVIDER_CATALOG[id];
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* 获取所有 Providers
|
|
690
|
+
*/
|
|
691
|
+
export function getAllProviders() {
|
|
692
|
+
return Object.values(PROVIDER_CATALOG);
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* 根据模型 ID 自动检测 Provider
|
|
696
|
+
*/
|
|
697
|
+
export function detectProviderByModel(modelId) {
|
|
698
|
+
const lowerId = modelId.toLowerCase();
|
|
699
|
+
for (const [providerId, provider] of Object.entries(PROVIDER_CATALOG)) {
|
|
700
|
+
// 检查前缀匹配
|
|
701
|
+
if (provider.modelPrefixes?.some(prefix => lowerId.startsWith(prefix.toLowerCase()))) {
|
|
702
|
+
return providerId;
|
|
703
|
+
}
|
|
704
|
+
// 检查 provider 名称是否在模型 ID 中
|
|
705
|
+
if (lowerId.includes(providerId.toLowerCase())) {
|
|
706
|
+
return providerId;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return undefined;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* 检查 Provider 是否有配置(环境变量)
|
|
713
|
+
*/
|
|
714
|
+
export function isProviderConfigured(id) {
|
|
715
|
+
const provider = PROVIDER_CATALOG[id];
|
|
716
|
+
if (!provider)
|
|
717
|
+
return false;
|
|
718
|
+
return provider.auth.envKeys.some(key => {
|
|
719
|
+
const value = process.env[key];
|
|
720
|
+
return value && value.length > 0;
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* 获取所有已配置的 Providers
|
|
725
|
+
*/
|
|
726
|
+
export function getConfiguredProviders() {
|
|
727
|
+
return getAllProviders().filter(p => isProviderConfigured(p.id));
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* 获取 Provider 的 API Key
|
|
731
|
+
*/
|
|
732
|
+
export function getProviderApiKey(id) {
|
|
733
|
+
const provider = PROVIDER_CATALOG[id];
|
|
734
|
+
if (!provider)
|
|
735
|
+
return undefined;
|
|
736
|
+
for (const key of provider.auth.envKeys) {
|
|
737
|
+
const value = process.env[key];
|
|
738
|
+
if (value && value.length > 0)
|
|
739
|
+
return value;
|
|
740
|
+
}
|
|
741
|
+
return undefined;
|
|
742
|
+
}
|
|
743
|
+
export function getProviderDisplayInfo(id) {
|
|
744
|
+
const provider = PROVIDER_CATALOG[id];
|
|
745
|
+
if (!provider)
|
|
746
|
+
return undefined;
|
|
747
|
+
return {
|
|
748
|
+
id: provider.id,
|
|
749
|
+
name: provider.name,
|
|
750
|
+
description: provider.description || '',
|
|
751
|
+
envKeys: provider.auth.envKeys,
|
|
752
|
+
authType: provider.auth.type,
|
|
753
|
+
supportsOAuth: provider.auth.supportsOAuth || false,
|
|
754
|
+
baseUrl: provider.api.baseUrl,
|
|
755
|
+
logo: provider.logo,
|
|
756
|
+
configured: isProviderConfigured(id),
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* 获取所有 Provider 显示信息
|
|
761
|
+
*/
|
|
762
|
+
export function getAllProviderDisplayInfo() {
|
|
763
|
+
return getAllProviders()
|
|
764
|
+
.map(p => getProviderDisplayInfo(p.id))
|
|
765
|
+
.filter((p) => p !== undefined);
|
|
766
|
+
}
|
|
767
|
+
export function parseModelRef(modelRef) {
|
|
768
|
+
// 检查是否为完整引用格式 provider/model
|
|
769
|
+
if (modelRef.includes('/')) {
|
|
770
|
+
const [provider, ...modelParts] = modelRef.split('/');
|
|
771
|
+
return {
|
|
772
|
+
provider,
|
|
773
|
+
model: modelParts.join('/'),
|
|
774
|
+
isFullRef: true,
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
// 尝试自动检测 provider
|
|
778
|
+
const detected = detectProviderByModel(modelRef);
|
|
779
|
+
if (detected) {
|
|
780
|
+
return {
|
|
781
|
+
provider: detected,
|
|
782
|
+
model: modelRef,
|
|
783
|
+
isFullRef: false,
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
// 默认使用 openai
|
|
787
|
+
return {
|
|
788
|
+
provider: 'openai',
|
|
789
|
+
model: modelRef,
|
|
790
|
+
isFullRef: false,
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* 注册自定义 Provider(运行时扩展)
|
|
795
|
+
*/
|
|
796
|
+
export function registerCustomProvider(definition) {
|
|
797
|
+
PROVIDER_CATALOG[definition.id] = definition;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* 从配置创建自定义 Provider
|
|
801
|
+
*/
|
|
802
|
+
export function createCustomProviderFromConfig(id, name, config) {
|
|
803
|
+
return {
|
|
804
|
+
id,
|
|
805
|
+
name,
|
|
806
|
+
category: config.category || 'openai-compatible',
|
|
807
|
+
auth: {
|
|
808
|
+
type: 'api_key',
|
|
809
|
+
envKeys: config.envKey ? [config.envKey] : [`${id.toUpperCase().replace(/-/g, '_')}_API_KEY`],
|
|
810
|
+
headerPrefix: 'Bearer ',
|
|
811
|
+
},
|
|
812
|
+
api: {
|
|
813
|
+
type: 'openai',
|
|
814
|
+
baseUrl: config.baseUrl,
|
|
815
|
+
strategy: config.strategy || 'openai-completions',
|
|
816
|
+
},
|
|
817
|
+
capabilities: {
|
|
818
|
+
multimodal: false,
|
|
819
|
+
streaming: true,
|
|
820
|
+
functionCalling: true,
|
|
821
|
+
vision: false,
|
|
822
|
+
reasoning: false,
|
|
823
|
+
jsonMode: true,
|
|
824
|
+
systemPrompt: true,
|
|
825
|
+
tools: true,
|
|
826
|
+
},
|
|
827
|
+
defaults: {
|
|
828
|
+
temperature: 0.7,
|
|
829
|
+
maxTokens: 4096,
|
|
830
|
+
timeout: 60000,
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
//# sourceMappingURL=provider-catalog.js.map
|