@phuetz/code-buddy 1.1.0 → 1.3.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 +211 -163
- package/dist/agent/autonomous/agentic-coding-contract.d.ts +12 -12
- package/dist/agent/base-agent.d.ts +4 -0
- package/dist/agent/base-agent.js +6 -0
- package/dist/agent/codebuddy-agent.d.ts +1 -1
- package/dist/agent/codebuddy-agent.js +69 -14
- package/dist/agent/execution/agent-executor.js +122 -12
- package/dist/agent/execution/tool-dependency-graph.js +7 -0
- package/dist/agent/execution/tool-hooks.d.ts +6 -0
- package/dist/agent/execution/tool-hooks.js +13 -5
- package/dist/agent/execution/tool-selection-strategy.d.ts +11 -2
- package/dist/agent/execution/tool-selection-strategy.js +67 -10
- package/dist/agent/extended-thinking.d.ts +8 -0
- package/dist/agent/extended-thinking.js +27 -0
- package/dist/agent/facades/infrastructure-facade.d.ts +9 -2
- package/dist/agent/facades/infrastructure-facade.js +15 -6
- package/dist/agent/hermes-browser-backends.js +151 -11
- package/dist/agent/hermes-claw-migrate.d.ts +59 -0
- package/dist/agent/hermes-claw-migrate.js +427 -26
- package/dist/agent/hermes-parity-manifest.js +78 -71
- package/dist/agent/hermes-runtime-lifecycle.d.ts +67 -0
- package/dist/agent/hermes-runtime-lifecycle.js +468 -0
- package/dist/agent/middleware/index.d.ts +1 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/visual-validation-middleware.d.ts +17 -0
- package/dist/agent/middleware/visual-validation-middleware.js +67 -0
- package/dist/agent/model-benchmark.d.ts +77 -0
- package/dist/agent/model-benchmark.js +309 -0
- package/dist/agent/model-tier.d.ts +14 -0
- package/dist/agent/model-tier.js +71 -0
- package/dist/agent/multi-agent/agents/orchestrator-agent.js +17 -6
- package/dist/agent/multi-agent/multi-agent-system.js +3 -1
- package/dist/agent/multi-agent/session-fleet-bridge.d.ts +2 -0
- package/dist/agent/multi-agent/session-fleet-bridge.js +9 -1
- package/dist/agent/multi-agent/session-tools.js +22 -5
- package/dist/agent/reasoning/mcts.js +20 -6
- package/dist/agent/self-improvement/authored-artifact-gate.d.ts +18 -0
- package/dist/agent/self-improvement/authored-artifact-gate.js +42 -0
- package/dist/agent/self-improvement/authored-tool-runtime.d.ts +27 -0
- package/dist/agent/self-improvement/authored-tool-runtime.js +57 -0
- package/dist/agent/self-improvement/authored-tool-store.d.ts +24 -0
- package/dist/agent/self-improvement/authored-tool-store.js +57 -0
- package/dist/agent/self-improvement/llm-tool-proposer.d.ts +41 -0
- package/dist/agent/self-improvement/llm-tool-proposer.js +136 -0
- package/dist/agent/self-improvement/sandbox-scorer.d.ts +17 -0
- package/dist/agent/self-improvement/sandbox-scorer.js +43 -0
- package/dist/agent/self-improvement/self-knowledge.d.ts +8 -0
- package/dist/agent/self-improvement/self-knowledge.js +24 -0
- package/dist/agent/self-improvement/skill-benchmark.d.ts +9 -0
- package/dist/agent/self-improvement/skill-benchmark.js +22 -0
- package/dist/agent/self-improvement/skill-consolidator.d.ts +71 -0
- package/dist/agent/self-improvement/skill-consolidator.js +137 -0
- package/dist/agent/self-improvement/skill-engine.d.ts +42 -0
- package/dist/agent/self-improvement/skill-engine.js +87 -0
- package/dist/agent/self-improvement/skill-gate.d.ts +19 -0
- package/dist/agent/self-improvement/skill-gate.js +62 -0
- package/dist/agent/self-improvement/skill-mutator.d.ts +74 -0
- package/dist/agent/self-improvement/skill-mutator.js +223 -0
- package/dist/agent/self-improvement/skill-proposer.d.ts +40 -0
- package/dist/agent/self-improvement/skill-proposer.js +82 -0
- package/dist/agent/self-improvement/skill-types.d.ts +41 -0
- package/dist/agent/self-improvement/skill-types.js +13 -0
- package/dist/agent/self-improvement/tool-benchmark.d.ts +10 -0
- package/dist/agent/self-improvement/tool-benchmark.js +37 -0
- package/dist/agent/self-improvement/tool-engine.d.ts +54 -0
- package/dist/agent/self-improvement/tool-engine.js +101 -0
- package/dist/agent/self-improvement/tool-gate.d.ts +20 -0
- package/dist/agent/self-improvement/tool-gate.js +78 -0
- package/dist/agent/self-improvement/tool-proposer.d.ts +31 -0
- package/dist/agent/self-improvement/tool-proposer.js +34 -0
- package/dist/agent/self-improvement/tool-skill-mutator.d.ts +40 -0
- package/dist/agent/self-improvement/tool-skill-mutator.js +79 -0
- package/dist/agent/self-improvement/tool-types.d.ts +48 -0
- package/dist/agent/self-improvement/tool-types.js +9 -0
- package/dist/agent/self-improvement/types.d.ts +3 -1
- package/dist/agent/session-end-flush.d.ts +6 -1
- package/dist/agent/session-end-flush.js +20 -4
- package/dist/agent/streaming/streaming-handler.d.ts +7 -0
- package/dist/agent/streaming/streaming-handler.js +8 -1
- package/dist/agent/tool-executor.js +1 -0
- package/dist/agent/tool-handler.d.ts +5 -0
- package/dist/agent/tool-handler.js +133 -4
- package/dist/browser-automation/browser-operator-executor.js +15 -0
- package/dist/browser-automation/browser-use-runner.d.ts +96 -0
- package/dist/browser-automation/browser-use-runner.js +492 -0
- package/dist/browser-automation/camofox-runner.d.ts +107 -0
- package/dist/browser-automation/camofox-runner.js +287 -0
- package/dist/channels/dingtalk/index.js +3 -0
- package/dist/channels/discord/client.d.ts +9 -0
- package/dist/channels/discord/client.js +12 -0
- package/dist/channels/feishu/index.d.ts +167 -1
- package/dist/channels/feishu/index.js +432 -7
- package/dist/channels/gateway-lifecycle.d.ts +132 -0
- package/dist/channels/gateway-lifecycle.js +219 -0
- package/dist/channels/google-chat/index.d.ts +5 -1
- package/dist/channels/google-chat/index.js +5 -1
- package/dist/channels/imessage/index.d.ts +14 -0
- package/dist/channels/imessage/index.js +64 -17
- package/dist/channels/index.d.ts +4 -0
- package/dist/channels/index.js +4 -0
- package/dist/channels/irc/index.d.ts +73 -3
- package/dist/channels/irc/index.js +446 -11
- package/dist/channels/line/index.js +3 -0
- package/dist/channels/mattermost/index.d.ts +51 -4
- package/dist/channels/mattermost/index.js +303 -20
- package/dist/channels/nextcloud-talk/index.d.ts +89 -8
- package/dist/channels/nextcloud-talk/index.js +367 -16
- package/dist/channels/nostr/index.d.ts +121 -1
- package/dist/channels/nostr/index.js +396 -8
- package/dist/channels/ntfy/index.js +3 -0
- package/dist/channels/qq/index.js +3 -0
- package/dist/channels/slash-parity.d.ts +117 -0
- package/dist/channels/slash-parity.js +185 -0
- package/dist/channels/synology-chat/index.js +3 -0
- package/dist/channels/teams/index.d.ts +3 -0
- package/dist/channels/teams/index.js +3 -0
- package/dist/channels/telegram/client.d.ts +9 -0
- package/dist/channels/telegram/client.js +12 -0
- package/dist/channels/twilio-voice/index.js +3 -0
- package/dist/channels/webchat/index.d.ts +7 -1
- package/dist/channels/webchat/index.js +7 -1
- package/dist/channels/wecom/index.js +3 -0
- package/dist/channels/weixin/index.js +3 -0
- package/dist/channels/zalo/index.js +3 -0
- package/dist/cli/config-loader.js +1 -1
- package/dist/codebuddy/client.d.ts +30 -1
- package/dist/codebuddy/client.js +167 -20
- package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +5 -0
- package/dist/codebuddy/providers/provider-chatgpt-responses.js +7 -1
- package/dist/codebuddy/providers/provider-gemini-native.js +1 -1
- package/dist/codebuddy/providers/provider-openai-compat.d.ts +5 -0
- package/dist/codebuddy/providers/provider-openai-compat.js +82 -2
- package/dist/codebuddy/tool-definitions/computer-control-tools.js +32 -2
- package/dist/codebuddy/tool-definitions/core-tools.js +3 -3
- package/dist/codebuddy/tool-definitions/index.d.ts +2 -1
- package/dist/codebuddy/tool-definitions/index.js +2 -1
- package/dist/codebuddy/tool-definitions/multimodal-tools.d.ts +1 -0
- package/dist/codebuddy/tool-definitions/multimodal-tools.js +44 -1
- package/dist/codebuddy/tool-definitions/windows-tools.d.ts +2 -0
- package/dist/codebuddy/tool-definitions/windows-tools.js +34 -0
- package/dist/codebuddy/tools.d.ts +8 -1
- package/dist/codebuddy/tools.js +67 -24
- package/dist/commands/cli/hermes-commands.js +108 -0
- package/dist/commands/cli/improve-command.js +123 -0
- package/dist/commands/cli/native-engine-commands.js +102 -3
- package/dist/commands/cli/utility-commands.js +45 -0
- package/dist/commands/enhanced-command-handler.js +2 -2
- package/dist/commands/goal-cli.d.ts +30 -0
- package/dist/commands/goal-cli.js +210 -27
- package/dist/commands/handlers/goal-handler.d.ts +9 -2
- package/dist/commands/handlers/goal-handler.js +36 -9
- package/dist/commands/handlers/infra-handlers.js +36 -0
- package/dist/commands/handlers/memory-handlers.js +96 -1
- package/dist/commands/handlers/missing-handlers.d.ts +1 -1
- package/dist/commands/handlers/missing-handlers.js +26 -3
- package/dist/commands/headless-slash.d.ts +2 -0
- package/dist/commands/headless-slash.js +12 -0
- package/dist/commands/llm-provider-resolution.d.ts +5 -3
- package/dist/commands/llm-provider-resolution.js +87 -33
- package/dist/commands/ollama.d.ts +25 -0
- package/dist/commands/ollama.js +100 -0
- package/dist/commands/provider.d.ts +5 -0
- package/dist/commands/provider.js +106 -55
- package/dist/commands/skills-cli/index.js +123 -0
- package/dist/commands/slash/builtin-commands.js +1 -1
- package/dist/commands/spec-next.js +2 -1
- package/dist/commands/spec-plan.js +5 -16
- package/dist/commands/tunnel.d.ts +2 -0
- package/dist/commands/tunnel.js +48 -0
- package/dist/companion/percepts.js +11 -1
- package/dist/config/config-resolver.d.ts +2 -1
- package/dist/config/config-resolver.js +54 -41
- package/dist/config/constants.d.ts +28 -0
- package/dist/config/constants.js +7 -0
- package/dist/config/env-schema.js +756 -0
- package/dist/config/model-tools.js +4 -4
- package/dist/config/toml-config.d.ts +16 -0
- package/dist/config/toml-config.js +3 -0
- package/dist/context/bootstrap-loader.js +6 -23
- package/dist/context/context-manager-v2.js +1 -0
- package/dist/context/import-directive-parser.d.ts +4 -0
- package/dist/context/import-directive-parser.js +51 -6
- package/dist/context/instruction-excludes.d.ts +30 -1
- package/dist/context/instruction-excludes.js +71 -1
- package/dist/context/jit-context.d.ts +8 -10
- package/dist/context/jit-context.js +28 -106
- package/dist/context/project-context.d.ts +90 -0
- package/dist/context/project-context.js +295 -0
- package/dist/daemon/autonomous-daemon.d.ts +1 -1
- package/dist/daemon/autonomous-daemon.js +3 -3
- package/dist/daemon/autonomous-loop.d.ts +31 -1
- package/dist/daemon/autonomous-loop.js +91 -4
- package/dist/daemon/colab-goal.js +9 -1
- package/dist/daemon/cron-agent-bridge.d.ts +12 -3
- package/dist/daemon/cron-agent-bridge.js +25 -9
- package/dist/desktop/codebuddy-engine-adapter.d.ts +32 -0
- package/dist/desktop/codebuddy-engine-adapter.js +257 -80
- package/dist/desktop/engine-adapter.d.ts +14 -0
- package/dist/desktop-automation/automation-manager.js +16 -0
- package/dist/desktop-automation/omniparser-runner.d.ts +63 -0
- package/dist/desktop-automation/omniparser-runner.js +115 -0
- package/dist/desktop-automation/smart-snapshot.d.ts +11 -0
- package/dist/desktop-automation/smart-snapshot.js +72 -5
- package/dist/doctor/index.js +40 -23
- package/dist/events/types.d.ts +11 -0
- package/dist/fleet/colab-store.js +14 -2
- package/dist/fleet/peer-session-bridge.js +50 -12
- package/dist/fleet/peer-tool-bridge.js +14 -0
- package/dist/goals/goal-decomposer.d.ts +27 -0
- package/dist/goals/goal-decomposer.js +293 -0
- package/dist/goals/goal-judge-client.d.ts +15 -0
- package/dist/goals/goal-judge-client.js +45 -0
- package/dist/goals/goal-judge.d.ts +2 -0
- package/dist/goals/goal-judge.js +35 -6
- package/dist/goals/goal-loop.d.ts +14 -0
- package/dist/goals/goal-loop.js +47 -2
- package/dist/goals/goal-manager.d.ts +6 -0
- package/dist/goals/goal-manager.js +67 -14
- package/dist/goals/goal-state.d.ts +13 -0
- package/dist/goals/goal-state.js +83 -13
- package/dist/goals/goal-store.d.ts +3 -0
- package/dist/goals/goal-store.js +31 -15
- package/dist/harness/contract.d.ts +28 -28
- package/dist/hooks/user-hooks.js +17 -3
- package/dist/identity/identity-manager.js +3 -2
- package/dist/index.js +481 -26
- package/dist/input/text-to-speech.d.ts +2 -6
- package/dist/input/text-to-speech.js +2 -27
- package/dist/integrations/screenpipe/screenpipe-client.d.ts +10 -0
- package/dist/integrations/screenpipe/screenpipe-client.js +12 -2
- package/dist/integrations/tailscale.d.ts +13 -0
- package/dist/integrations/tailscale.js +87 -34
- package/dist/knowledge/workspace-indexer.js +53 -9
- package/dist/mcp/client.js +1 -0
- package/dist/mcp/mcp-desktop-tools.d.ts +23 -0
- package/dist/mcp/mcp-desktop-tools.js +158 -0
- package/dist/mcp/mcp-resources.js +2 -3
- package/dist/mcp/mcp-server.js +2 -0
- package/dist/memory/enhanced-memory.d.ts +10 -0
- package/dist/memory/enhanced-memory.js +33 -2
- package/dist/memory/index.d.ts +3 -1
- package/dist/memory/index.js +4 -1
- package/dist/memory/memory-auto-proposer.d.ts +23 -0
- package/dist/memory/memory-auto-proposer.js +308 -0
- package/dist/memory/memory-candidate-queue.d.ts +92 -0
- package/dist/memory/memory-candidate-queue.js +261 -0
- package/dist/memory/persistent-memory.d.ts +45 -2
- package/dist/memory/persistent-memory.js +236 -40
- package/dist/ml/bayesian-qualifier.d.ts +1 -1
- package/dist/ml/bayesian-qualifier.js +35 -2
- package/dist/openclaw/gateway-bridge.js +5 -0
- package/dist/plugins/marketplace.d.ts +1 -0
- package/dist/plugins/marketplace.js +7 -0
- package/dist/prompts/execution-discipline.d.ts +14 -0
- package/dist/prompts/execution-discipline.js +29 -0
- package/dist/prompts/variation-injector.js +9 -2
- package/dist/protocols/acp/acp-agentic-runner.d.ts +7 -6
- package/dist/protocols/acp/acp-agentic-runner.js +115 -18
- package/dist/protocols/acp/acp-session-store.d.ts +23 -0
- package/dist/protocols/acp/acp-session-store.js +77 -0
- package/dist/protocols/acp/acp-stdio-server.d.ts +7 -0
- package/dist/protocols/acp/acp-stdio-server.js +71 -16
- package/dist/providers/active-llm-registry.d.ts +37 -0
- package/dist/providers/active-llm-registry.js +186 -0
- package/dist/providers/auxiliary-provider.d.ts +25 -0
- package/dist/providers/auxiliary-provider.js +192 -0
- package/dist/providers/codex-oauth.d.ts +1 -1
- package/dist/providers/codex-oauth.js +27 -4
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/provider-catalog.d.ts +70 -0
- package/dist/providers/provider-catalog.js +738 -0
- package/dist/providers/provider-fallback.d.ts +35 -0
- package/dist/providers/provider-fallback.js +171 -0
- package/dist/providers/xai-oauth.d.ts +128 -0
- package/dist/providers/xai-oauth.js +735 -0
- package/dist/scheduler/cron-scheduler.d.ts +15 -3
- package/dist/scheduler/cron-scheduler.js +53 -7
- package/dist/scheduler/script-runner.d.ts +2 -0
- package/dist/scheduler/script-runner.js +19 -4
- package/dist/scheduler/watchdog-handlers.js +7 -20
- package/dist/search/usearch-index.js +7 -2
- package/dist/security/tool-policy/tool-groups.js +2 -0
- package/dist/sensory/dreaming.d.ts +45 -0
- package/dist/sensory/dreaming.js +114 -0
- package/dist/sensory/heartbeat-scheduler.d.ts +38 -0
- package/dist/sensory/heartbeat-scheduler.js +72 -0
- package/dist/sensory/reactions.d.ts +24 -0
- package/dist/sensory/reactions.js +31 -0
- package/dist/sensory/screen-reaction.d.ts +23 -0
- package/dist/sensory/screen-reaction.js +59 -0
- package/dist/sensory/sensory-bridge.d.ts +23 -0
- package/dist/sensory/sensory-bridge.js +85 -0
- package/dist/sensory/sensory-memory.d.ts +20 -0
- package/dist/sensory/sensory-memory.js +39 -0
- package/dist/sensory/speech-reaction.d.ts +21 -0
- package/dist/sensory/speech-reaction.js +83 -0
- package/dist/sensory/vision-reaction.d.ts +31 -0
- package/dist/sensory/vision-reaction.js +74 -0
- package/dist/server/index.js +106 -2
- package/dist/server/routes/mobile.d.ts +12 -4
- package/dist/server/routes/mobile.js +116 -1
- package/dist/server/tls-config.d.ts +35 -0
- package/dist/server/tls-config.js +142 -0
- package/dist/server/tunnel-manager.d.ts +20 -0
- package/dist/server/tunnel-manager.js +58 -0
- package/dist/server/websocket/fleet-bridge.js +5 -0
- package/dist/services/prompt-builder.d.ts +11 -0
- package/dist/services/prompt-builder.js +124 -17
- package/dist/shared/engine-types.d.ts +15 -1
- package/dist/sidecar/sidecar-bridge.d.ts +1 -0
- package/dist/sidecar/sidecar-bridge.js +21 -10
- package/dist/skills/parser.js +3 -0
- package/dist/skills/skill-importer.d.ts +58 -0
- package/dist/skills/skill-importer.js +261 -0
- package/dist/skills/skill-sources.d.ts +20 -0
- package/dist/skills/skill-sources.js +102 -0
- package/dist/skills/types.d.ts +6 -0
- package/dist/spec/spec-store.js +8 -1
- package/dist/talk-mode/providers/audioreader-tts.d.ts +1 -1
- package/dist/talk-mode/providers/audioreader-tts.js +8 -8
- package/dist/templates/project-scaffolding.js +3 -2
- package/dist/themes/theme-schema.d.ts +10 -10
- package/dist/tools/application-profiles.js +38 -0
- package/dist/tools/bash/bash-tool.d.ts +1 -0
- package/dist/tools/bash/bash-tool.js +16 -2
- package/dist/tools/bash/command-validator.js +3 -0
- package/dist/tools/bash/rtk-rewrite.d.ts +16 -0
- package/dist/tools/bash/rtk-rewrite.js +100 -0
- package/dist/tools/bash/streaming-executor.js +14 -1
- package/dist/tools/computer-control-tool.d.ts +16 -1
- package/dist/tools/computer-control-tool.js +317 -5
- package/dist/tools/document-generator.d.ts +14 -0
- package/dist/tools/document-generator.js +79 -0
- package/dist/tools/execute-code-rpc-invoker.d.ts +26 -2
- package/dist/tools/execute-code-rpc-invoker.js +46 -5
- package/dist/tools/metadata.js +28 -0
- package/dist/tools/office-macro-tool.d.ts +10 -0
- package/dist/tools/office-macro-tool.js +93 -0
- package/dist/tools/register-tool-handler.d.ts +25 -0
- package/dist/tools/register-tool-handler.js +100 -0
- package/dist/tools/registry/index.d.ts +2 -1
- package/dist/tools/registry/index.js +2 -1
- package/dist/tools/registry/memory-tools.d.ts +20 -0
- package/dist/tools/registry/memory-tools.js +225 -3
- package/dist/tools/registry/multimodal-tools.js +2 -2
- package/dist/tools/registry/vision-tools.d.ts +33 -0
- package/dist/tools/registry/vision-tools.js +308 -6
- package/dist/tools/registry/windows-tools.d.ts +2 -0
- package/dist/tools/registry/windows-tools.js +47 -0
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/registry.js +8 -0
- package/dist/tools/route-peer-tool.js +14 -0
- package/dist/tools/screenshot-tool.js +14 -2
- package/dist/tools/text-to-speech-tool.d.ts +1 -1
- package/dist/tools/text-to-speech-tool.js +2 -12
- package/dist/tools/tool-selector.js +3 -59
- package/dist/utils/config-validation/schema.d.ts +40 -7
- package/dist/utils/config-validation/schema.js +130 -1
- package/dist/utils/cost-tracker.js +21 -1
- package/dist/utils/disk-guard.d.ts +180 -0
- package/dist/utils/disk-guard.js +404 -0
- package/dist/utils/init-project.d.ts +7 -0
- package/dist/utils/init-project.js +37 -0
- package/dist/utils/interactive-setup.js +35 -2
- package/dist/utils/model-utils.js +11 -2
- package/dist/utils/output-sanitizer.js +11 -0
- package/dist/utils/provider-detector.d.ts +8 -7
- package/dist/utils/provider-detector.js +19 -77
- package/dist/utils/settings-manager.d.ts +19 -0
- package/dist/utils/token-display.d.ts +3 -3
- package/dist/utils/token-display.js +22 -4
- package/dist/wizard/onboarding.d.ts +39 -0
- package/dist/wizard/onboarding.js +433 -21
- package/dist/wizard/provider-onboarding.d.ts +8 -23
- package/dist/wizard/provider-onboarding.js +39 -158
- package/package.json +4 -2
- package/dist/plugins/provider-onboarding.d.ts +0 -23
- package/dist/plugins/provider-onboarding.js +0 -116
- package/dist/utils/kokoro-tts.d.ts +0 -8
- package/dist/utils/kokoro-tts.js +0 -67
|
@@ -55,6 +55,18 @@ export async function executeHeadlessSlashToken(token, args, allow, ctx = {}) {
|
|
|
55
55
|
if (ctx.client)
|
|
56
56
|
handler.setCodeBuddyClient(ctx.client);
|
|
57
57
|
try {
|
|
58
|
+
if (ctx.goalSessionKey && (token === '__GOAL__' || token === '__SUBGOAL__')) {
|
|
59
|
+
const { handleGoal, handleSubgoal } = await import('./handlers/goal-handler.js');
|
|
60
|
+
const result = token === '__GOAL__'
|
|
61
|
+
? await handleGoal(args, { sessionKey: ctx.goalSessionKey, client: ctx.client ?? null })
|
|
62
|
+
: await handleSubgoal(args, { sessionKey: ctx.goalSessionKey });
|
|
63
|
+
return {
|
|
64
|
+
handled: result.handled,
|
|
65
|
+
output: result.entry?.content,
|
|
66
|
+
prompt: result.prompt,
|
|
67
|
+
passToAI: result.passToAI,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
58
70
|
const result = await handler.handleCommand(token, args, [token, ...args].join(" "));
|
|
59
71
|
return {
|
|
60
72
|
handled: result.handled,
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* provider + the `PROVIDERS` map (paid keys), so a machine running on
|
|
7
7
|
* local Ollama (`CODEBUDDY_PROVIDER=ollama`, $0) hit the "no API key"
|
|
8
8
|
* exit even though the rest of Code Buddy — including the autonomous
|
|
9
|
-
* daemon — runs fine there. This resolver keeps the legacy path
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* daemon — runs fine there. This resolver keeps the legacy path for
|
|
10
|
+
* ambient paid-key defaults, but honors explicit local / ChatGPT
|
|
11
|
+
* subscription model choices before a cloud key can hijack them. It
|
|
12
|
+
* falls back to {@link detectProviderFromEnv} (ollama / chatgpt-oauth /
|
|
13
|
+
* env-detected providers) when either:
|
|
12
14
|
* - `CODEBUDDY_PROVIDER` is explicitly set (operator intent wins), or
|
|
13
15
|
* - the legacy path found no key.
|
|
14
16
|
*/
|
|
@@ -6,58 +6,69 @@
|
|
|
6
6
|
* provider + the `PROVIDERS` map (paid keys), so a machine running on
|
|
7
7
|
* local Ollama (`CODEBUDDY_PROVIDER=ollama`, $0) hit the "no API key"
|
|
8
8
|
* exit even though the rest of Code Buddy — including the autonomous
|
|
9
|
-
* daemon — runs fine there. This resolver keeps the legacy path
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* daemon — runs fine there. This resolver keeps the legacy path for
|
|
10
|
+
* ambient paid-key defaults, but honors explicit local / ChatGPT
|
|
11
|
+
* subscription model choices before a cloud key can hijack them. It
|
|
12
|
+
* falls back to {@link detectProviderFromEnv} (ollama / chatgpt-oauth /
|
|
13
|
+
* env-detected providers) when either:
|
|
12
14
|
* - `CODEBUDDY_PROVIDER` is explicitly set (operator intent wins), or
|
|
13
15
|
* - the legacy path found no key.
|
|
14
16
|
*/
|
|
15
17
|
import { getSettingsManager } from '../utils/settings-manager.js';
|
|
16
18
|
import { detectProviderFromEnv } from '../utils/provider-detector.js';
|
|
17
|
-
import {
|
|
19
|
+
import { inferProvider } from '../config/resolve-model.js';
|
|
20
|
+
import { hasCodexCredentials } from '../providers/codex-oauth.js';
|
|
21
|
+
import { resolveProviderFromCatalog } from '../providers/provider-catalog.js';
|
|
22
|
+
import { PROVIDERS, resolveProviderCommandKey } from './provider.js';
|
|
18
23
|
export function resolveCommandProvider(options = {}) {
|
|
24
|
+
const settingsManager = getSettingsManager();
|
|
25
|
+
const settings = settingsManager.loadUserSettings();
|
|
26
|
+
const configuredModel = options.explicitModel || settingsManager.getCurrentModel();
|
|
19
27
|
const detectFirst = Boolean(process.env.CODEBUDDY_PROVIDER);
|
|
20
28
|
if (detectFirst) {
|
|
21
29
|
const detected = fromEnvDetection(options.explicitModel);
|
|
22
30
|
if (detected)
|
|
23
31
|
return detected;
|
|
24
32
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
const explicitLocal = resolveExplicitOllamaModel(configuredModel);
|
|
34
|
+
if (explicitLocal)
|
|
35
|
+
return explicitLocal;
|
|
36
|
+
const explicitChatGpt = resolveExplicitChatGptModel(configuredModel);
|
|
37
|
+
if (explicitChatGpt)
|
|
38
|
+
return explicitChatGpt;
|
|
27
39
|
const currentProviderKey = settings.provider || 'grok';
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const providerInfoKey = resolveProviderCommandKey(currentProviderKey) || currentProviderKey;
|
|
41
|
+
const providerInfo = PROVIDERS[providerInfoKey];
|
|
42
|
+
if (providerInfo) {
|
|
43
|
+
const configuredProvider = resolveProviderFromCatalog({
|
|
44
|
+
providerOverride: providerInfo.providerId,
|
|
45
|
+
hasChatGptOAuth: hasCodexCredentials(),
|
|
46
|
+
requireConfigured: providerInfo.authMode === 'api-key',
|
|
47
|
+
});
|
|
48
|
+
if (configuredProvider) {
|
|
49
|
+
return {
|
|
50
|
+
apiKey: configuredProvider.apiKey,
|
|
51
|
+
baseURL: configuredProvider.baseURL,
|
|
52
|
+
model: configuredModel || configuredProvider.defaultModel,
|
|
53
|
+
providerLabel: configuredProvider.provider,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
41
56
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
gemini: process.env.GEMINI_BASE_URL,
|
|
48
|
-
};
|
|
57
|
+
const ambientProvider = resolveProviderFromCatalog({
|
|
58
|
+
hasChatGptOAuth: hasCodexCredentials(),
|
|
59
|
+
requireConfigured: true,
|
|
60
|
+
});
|
|
61
|
+
if (ambientProvider) {
|
|
49
62
|
return {
|
|
50
|
-
apiKey,
|
|
51
|
-
baseURL:
|
|
52
|
-
model:
|
|
53
|
-
|
|
54
|
-
providerInfo?.defaultModel,
|
|
55
|
-
providerLabel: providerInfo?.name || currentProviderKey,
|
|
63
|
+
apiKey: ambientProvider.apiKey,
|
|
64
|
+
baseURL: ambientProvider.baseURL,
|
|
65
|
+
model: configuredModel || ambientProvider.defaultModel,
|
|
66
|
+
providerLabel: ambientProvider.provider,
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
// Legacy path found nothing — fall back to env detection (local
|
|
59
70
|
// Ollama, ChatGPT OAuth, …) so a $0 local machine can still run.
|
|
60
|
-
return fromEnvDetection(
|
|
71
|
+
return fromEnvDetection(configuredModel);
|
|
61
72
|
}
|
|
62
73
|
function fromEnvDetection(explicitModel) {
|
|
63
74
|
const detected = detectProviderFromEnv();
|
|
@@ -70,4 +81,47 @@ function fromEnvDetection(explicitModel) {
|
|
|
70
81
|
providerLabel: detected.provider,
|
|
71
82
|
};
|
|
72
83
|
}
|
|
84
|
+
function resolveExplicitOllamaModel(explicitModel) {
|
|
85
|
+
const model = explicitModel?.trim();
|
|
86
|
+
if (!model || !isLocalOllamaModel(model))
|
|
87
|
+
return null;
|
|
88
|
+
let host = process.env.OLLAMA_HOST || 'http://localhost:11434';
|
|
89
|
+
if (!/^https?:\/\//i.test(host))
|
|
90
|
+
host = `http://${host}`;
|
|
91
|
+
if (!host.endsWith('/v1'))
|
|
92
|
+
host = host.replace(/\/+$/, '') + '/v1';
|
|
93
|
+
return {
|
|
94
|
+
apiKey: 'ollama',
|
|
95
|
+
baseURL: host,
|
|
96
|
+
model,
|
|
97
|
+
providerLabel: 'ollama',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function isLocalOllamaModel(model) {
|
|
101
|
+
const normalized = model.trim().toLowerCase();
|
|
102
|
+
return inferProvider(normalized) === 'ollama' || normalized.startsWith('devstral-small-2');
|
|
103
|
+
}
|
|
104
|
+
function resolveExplicitChatGptModel(explicitModel) {
|
|
105
|
+
const model = explicitModel?.trim();
|
|
106
|
+
if (!model || !isChatGptSubscriptionModel(model))
|
|
107
|
+
return null;
|
|
108
|
+
const detected = detectProviderFromEnv();
|
|
109
|
+
if (detected?.provider !== 'chatgpt')
|
|
110
|
+
return null;
|
|
111
|
+
return {
|
|
112
|
+
apiKey: detected.apiKey,
|
|
113
|
+
baseURL: detected.baseURL,
|
|
114
|
+
model,
|
|
115
|
+
providerLabel: detected.provider,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function isChatGptSubscriptionModel(model) {
|
|
119
|
+
const m = model.trim().toLowerCase();
|
|
120
|
+
return (m === 'gpt-5.2' ||
|
|
121
|
+
m === 'gpt-5.5' ||
|
|
122
|
+
m.startsWith('gpt-5.5-') ||
|
|
123
|
+
m.includes('-codex') ||
|
|
124
|
+
m === 'codex-1' ||
|
|
125
|
+
m.startsWith('codex-mini'));
|
|
126
|
+
}
|
|
73
127
|
//# sourceMappingURL=llm-provider-resolution.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface OllamaStatus {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
reachable: boolean;
|
|
4
|
+
version: string | null;
|
|
5
|
+
models: string[];
|
|
6
|
+
error: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface OllamaUpdatePlan {
|
|
9
|
+
supported: boolean;
|
|
10
|
+
platform: NodeJS.Platform;
|
|
11
|
+
repoRoot: string;
|
|
12
|
+
scriptPath: string;
|
|
13
|
+
scriptUrl: string;
|
|
14
|
+
command?: string;
|
|
15
|
+
args?: string[];
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function normalizeOllamaBaseUrl(rawUrl?: string): string;
|
|
19
|
+
export declare function fetchOllamaStatus(baseUrl?: string): Promise<OllamaStatus>;
|
|
20
|
+
export declare function buildOllamaUpdatePlan(options: {
|
|
21
|
+
platform?: NodeJS.Platform;
|
|
22
|
+
repoRoot: string;
|
|
23
|
+
scriptUrl?: string;
|
|
24
|
+
}): OllamaUpdatePlan;
|
|
25
|
+
export declare function runOllamaUpdatePlan(plan: OllamaUpdatePlan): Promise<void>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
export function normalizeOllamaBaseUrl(rawUrl) {
|
|
5
|
+
const value = (rawUrl || 'http://localhost:11434').trim();
|
|
6
|
+
const withoutV1 = value.replace(/\/v1\/?$/, '');
|
|
7
|
+
return withoutV1.replace(/\/+$/, '');
|
|
8
|
+
}
|
|
9
|
+
export async function fetchOllamaStatus(baseUrl) {
|
|
10
|
+
const normalizedBaseUrl = normalizeOllamaBaseUrl(baseUrl);
|
|
11
|
+
const apiBase = `${normalizedBaseUrl}/api`;
|
|
12
|
+
try {
|
|
13
|
+
const [versionResponse, tagsResponse] = await Promise.all([
|
|
14
|
+
fetch(`${apiBase}/version`, { signal: AbortSignal.timeout(5000) }),
|
|
15
|
+
fetch(`${apiBase}/tags`, { signal: AbortSignal.timeout(5000) }),
|
|
16
|
+
]);
|
|
17
|
+
const versionJson = (await versionResponse.json());
|
|
18
|
+
const tagsJson = (await tagsResponse.json());
|
|
19
|
+
return {
|
|
20
|
+
baseUrl: normalizedBaseUrl,
|
|
21
|
+
reachable: versionResponse.ok && tagsResponse.ok,
|
|
22
|
+
version: typeof versionJson.version === 'string' ? versionJson.version : null,
|
|
23
|
+
models: Array.isArray(tagsJson.models)
|
|
24
|
+
? tagsJson.models
|
|
25
|
+
.map((model) => (typeof model.name === 'string' ? model.name : null))
|
|
26
|
+
.filter((name) => Boolean(name))
|
|
27
|
+
: [],
|
|
28
|
+
error: versionResponse.ok && tagsResponse.ok ? null : `HTTP ${versionResponse.status}/${tagsResponse.status}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
baseUrl: normalizedBaseUrl,
|
|
34
|
+
reachable: false,
|
|
35
|
+
version: null,
|
|
36
|
+
models: [],
|
|
37
|
+
error: error instanceof Error ? error.message : String(error),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function buildOllamaUpdatePlan(options) {
|
|
42
|
+
const platform = options.platform ?? process.platform;
|
|
43
|
+
const repoRoot = resolve(options.repoRoot);
|
|
44
|
+
const scriptPath = resolve(repoRoot, 'scripts', 'update-ollama-windows.ps1');
|
|
45
|
+
const scriptUrl = options.scriptUrl ?? 'https://ollama.com/install.ps1';
|
|
46
|
+
const supported = platform === 'win32';
|
|
47
|
+
if (!supported) {
|
|
48
|
+
return {
|
|
49
|
+
supported,
|
|
50
|
+
platform,
|
|
51
|
+
repoRoot,
|
|
52
|
+
scriptPath,
|
|
53
|
+
scriptUrl,
|
|
54
|
+
message: 'Ollama update automation is implemented for Windows. Use the official install script on this platform.',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const command = 'powershell';
|
|
58
|
+
const args = [
|
|
59
|
+
'-ExecutionPolicy',
|
|
60
|
+
'Bypass',
|
|
61
|
+
'-File',
|
|
62
|
+
scriptPath,
|
|
63
|
+
'-InstallerScriptUrl',
|
|
64
|
+
scriptUrl,
|
|
65
|
+
];
|
|
66
|
+
return {
|
|
67
|
+
supported,
|
|
68
|
+
platform,
|
|
69
|
+
repoRoot,
|
|
70
|
+
scriptPath,
|
|
71
|
+
scriptUrl,
|
|
72
|
+
command,
|
|
73
|
+
args,
|
|
74
|
+
message: `Windows update script ready: ${scriptPath}`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export async function runOllamaUpdatePlan(plan) {
|
|
78
|
+
if (!plan.supported || !plan.command || !plan.args) {
|
|
79
|
+
throw new Error(plan.message);
|
|
80
|
+
}
|
|
81
|
+
if (!existsSync(plan.scriptPath)) {
|
|
82
|
+
throw new Error(`Missing Ollama update script: ${plan.scriptPath}`);
|
|
83
|
+
}
|
|
84
|
+
await new Promise((resolvePromise, rejectPromise) => {
|
|
85
|
+
const child = spawn(plan.command, plan.args, {
|
|
86
|
+
stdio: 'inherit',
|
|
87
|
+
cwd: plan.repoRoot,
|
|
88
|
+
shell: false,
|
|
89
|
+
});
|
|
90
|
+
child.once('error', rejectPromise);
|
|
91
|
+
child.once('exit', (code) => {
|
|
92
|
+
if (code === 0) {
|
|
93
|
+
resolvePromise();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
rejectPromise(new Error(`Ollama update script exited with code ${code ?? 'unknown'}`));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=ollama.js.map
|
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
* CLI commands for managing AI providers (Claude, ChatGPT, Grok, Gemini)
|
|
5
5
|
*/
|
|
6
6
|
import { Command } from 'commander';
|
|
7
|
+
import { type RuntimeProviderCatalogEntry, type RuntimeProviderId } from '../providers/provider-catalog.js';
|
|
7
8
|
interface ProviderInfo {
|
|
8
9
|
name: string;
|
|
9
10
|
envVar: string;
|
|
11
|
+
envVars: string[];
|
|
10
12
|
models: string[];
|
|
11
13
|
defaultModel: string;
|
|
12
14
|
baseURL?: string;
|
|
15
|
+
providerId: RuntimeProviderId;
|
|
16
|
+
authMode: RuntimeProviderCatalogEntry['authMode'];
|
|
13
17
|
}
|
|
14
18
|
export declare const PROVIDERS: Record<string, ProviderInfo>;
|
|
15
19
|
export declare function createProviderCommand(): Command;
|
|
20
|
+
export declare function resolveProviderCommandKey(provider: string): string | null;
|
|
16
21
|
export default createProviderCommand;
|
|
@@ -7,61 +7,85 @@ import { Command } from 'commander';
|
|
|
7
7
|
import { logger } from "../utils/logger.js";
|
|
8
8
|
import { getSettingsManager } from '../utils/settings-manager.js';
|
|
9
9
|
import { hasCodexCredentials } from '../providers/codex-oauth.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
baseURL: 'https://generativelanguage.googleapis.com/v1beta',
|
|
50
|
-
},
|
|
10
|
+
import { findRuntimeProvider, getPluginNativeRuntimeProviderCatalog, getProviderEnvSummary, getRuntimeProviderCatalog, isProviderConfigured, resolvePluginRuntimeProvider, } from '../providers/provider-catalog.js';
|
|
11
|
+
const PROVIDER_COMMAND_KEYS = {
|
|
12
|
+
chatgpt: 'chatgpt',
|
|
13
|
+
ollama: 'ollama',
|
|
14
|
+
'ollama-cloud': 'ollama-cloud',
|
|
15
|
+
lmstudio: 'lmstudio',
|
|
16
|
+
grok: 'grok',
|
|
17
|
+
gemini: 'gemini',
|
|
18
|
+
openai: 'openai',
|
|
19
|
+
anthropic: 'claude',
|
|
20
|
+
mistral: 'mistral',
|
|
21
|
+
groq: 'groq',
|
|
22
|
+
together: 'together',
|
|
23
|
+
fireworks: 'fireworks',
|
|
24
|
+
openrouter: 'openrouter',
|
|
25
|
+
novita: 'novita',
|
|
26
|
+
zai: 'zai',
|
|
27
|
+
'kimi-coding': 'kimi-coding',
|
|
28
|
+
'kimi-coding-cn': 'kimi-coding-cn',
|
|
29
|
+
arcee: 'arcee',
|
|
30
|
+
gmi: 'gmi',
|
|
31
|
+
minimax: 'minimax',
|
|
32
|
+
'minimax-cn': 'minimax-cn',
|
|
33
|
+
alibaba: 'alibaba',
|
|
34
|
+
'alibaba-coding-plan': 'alibaba-coding-plan',
|
|
35
|
+
kilocode: 'kilocode',
|
|
36
|
+
xiaomi: 'xiaomi',
|
|
37
|
+
'tencent-tokenhub': 'tencent-tokenhub',
|
|
38
|
+
'opencode-zen': 'opencode-zen',
|
|
39
|
+
'opencode-go': 'opencode-go',
|
|
40
|
+
deepseek: 'deepseek',
|
|
41
|
+
huggingface: 'huggingface',
|
|
42
|
+
nvidia: 'nvidia',
|
|
43
|
+
stepfun: 'stepfun',
|
|
44
|
+
vllm: 'vllm',
|
|
45
|
+
custom: 'custom',
|
|
46
|
+
azure: 'azure',
|
|
47
|
+
bedrock: 'bedrock',
|
|
48
|
+
copilot: 'copilot',
|
|
51
49
|
};
|
|
50
|
+
export const PROVIDERS = Object.fromEntries(getRuntimeProviderCatalog()
|
|
51
|
+
.filter((entry) => entry.runtimeSupport === 'direct')
|
|
52
|
+
.map((entry) => {
|
|
53
|
+
const key = PROVIDER_COMMAND_KEYS[entry.id];
|
|
54
|
+
return [
|
|
55
|
+
key,
|
|
56
|
+
{
|
|
57
|
+
name: entry.label,
|
|
58
|
+
envVar: getProviderEnvSummary(entry),
|
|
59
|
+
envVars: entry.id === 'chatgpt'
|
|
60
|
+
? ['CODEBUDDY_CHATGPT_OAUTH']
|
|
61
|
+
: [...entry.apiKeyEnvKeys, ...entry.baseUrlEnvKeys],
|
|
62
|
+
models: entry.models,
|
|
63
|
+
defaultModel: entry.defaultModel,
|
|
64
|
+
baseURL: entry.defaultBaseURL,
|
|
65
|
+
providerId: entry.id,
|
|
66
|
+
authMode: entry.authMode,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
}));
|
|
52
70
|
function getConfiguredProviders() {
|
|
53
71
|
const configured = [];
|
|
54
72
|
for (const [key, info] of Object.entries(PROVIDERS)) {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
(key === 'gemini' && process.env.GEMINI_API_KEY) ||
|
|
58
|
-
(key === 'chatgpt' && hasCodexCredentials());
|
|
59
|
-
if (hasKey) {
|
|
73
|
+
const entry = findRuntimeProvider(info.providerId);
|
|
74
|
+
if (entry && isProviderConfigured(entry, process.env, hasCodexCredentials())) {
|
|
60
75
|
configured.push(key);
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
return configured;
|
|
64
79
|
}
|
|
80
|
+
function getConfiguredPluginNativeProviders() {
|
|
81
|
+
const configured = [];
|
|
82
|
+
for (const entry of getPluginNativeRuntimeProviderCatalog()) {
|
|
83
|
+
if (isProviderConfigured(entry, process.env, hasCodexCredentials())) {
|
|
84
|
+
configured.push(entry.id);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return configured;
|
|
88
|
+
}
|
|
65
89
|
function getCurrentProvider() {
|
|
66
90
|
const manager = getSettingsManager();
|
|
67
91
|
const settings = manager.loadUserSettings();
|
|
@@ -90,7 +114,7 @@ function setCurrentModel(model) {
|
|
|
90
114
|
}
|
|
91
115
|
export function createProviderCommand() {
|
|
92
116
|
const provider = new Command('provider')
|
|
93
|
-
.description('Manage AI providers
|
|
117
|
+
.description('Manage AI providers');
|
|
94
118
|
// List providers
|
|
95
119
|
provider
|
|
96
120
|
.command('list')
|
|
@@ -98,7 +122,8 @@ export function createProviderCommand() {
|
|
|
98
122
|
.description('List available AI providers')
|
|
99
123
|
.action(() => {
|
|
100
124
|
const configured = getConfiguredProviders();
|
|
101
|
-
const
|
|
125
|
+
const configuredPluginProviders = getConfiguredPluginNativeProviders();
|
|
126
|
+
const current = resolveProviderCommandKey(getCurrentProvider()) || getCurrentProvider();
|
|
102
127
|
console.log('\nAvailable AI Providers:\n');
|
|
103
128
|
for (const [key, info] of Object.entries(PROVIDERS)) {
|
|
104
129
|
const isConfigured = configured.includes(key);
|
|
@@ -111,7 +136,21 @@ export function createProviderCommand() {
|
|
|
111
136
|
console.log(` Models: ${info.models.slice(0, 3).join(', ')}${info.models.length > 3 ? '...' : ''}`);
|
|
112
137
|
console.log('');
|
|
113
138
|
}
|
|
114
|
-
|
|
139
|
+
const pluginProviders = getPluginNativeRuntimeProviderCatalog();
|
|
140
|
+
if (pluginProviders.length > 0) {
|
|
141
|
+
console.log('Plugin-native providers (available through bundled transports):\n');
|
|
142
|
+
for (const entry of pluginProviders) {
|
|
143
|
+
const status = configuredPluginProviders.includes(entry.id) ? '✅' : '❌';
|
|
144
|
+
const runtime = resolvePluginRuntimeProvider(entry.id);
|
|
145
|
+
console.log(` ${status} ${entry.label}`);
|
|
146
|
+
console.log(` Key: ${PROVIDER_COMMAND_KEYS[entry.id]}`);
|
|
147
|
+
console.log(` Env: ${getProviderEnvSummary(entry)}`);
|
|
148
|
+
console.log(` Transport: ${runtime?.pluginId ?? 'bundled plugin'}`);
|
|
149
|
+
console.log(` Models: ${entry.models.slice(0, 3).join(', ')}${entry.models.length > 3 ? '...' : ''}`);
|
|
150
|
+
console.log('');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (configured.length === 0 && configuredPluginProviders.length === 0) {
|
|
115
154
|
console.log('⚠️ No providers configured. Set an API key environment variable.');
|
|
116
155
|
console.log(' Example: export ANTHROPIC_API_KEY="your-key"');
|
|
117
156
|
}
|
|
@@ -124,11 +163,12 @@ export function createProviderCommand() {
|
|
|
124
163
|
.action(() => {
|
|
125
164
|
const current = getCurrentProvider();
|
|
126
165
|
const model = getCurrentModel();
|
|
127
|
-
const
|
|
166
|
+
const key = resolveProviderCommandKey(current) || current;
|
|
167
|
+
const info = PROVIDERS[key];
|
|
128
168
|
console.log(`\nActive Provider: ${info?.name || current}`);
|
|
129
169
|
console.log(`Model: ${model || info?.defaultModel || 'default'}`);
|
|
130
170
|
const configured = getConfiguredProviders();
|
|
131
|
-
if (!configured.includes(
|
|
171
|
+
if (!configured.includes(key)) {
|
|
132
172
|
console.log(`\n⚠️ Warning: ${info?.envVar || 'API key'} not set`);
|
|
133
173
|
}
|
|
134
174
|
});
|
|
@@ -139,8 +179,8 @@ export function createProviderCommand() {
|
|
|
139
179
|
.description('Set the active AI provider')
|
|
140
180
|
.option('-m, --model <model>', 'Also set the model')
|
|
141
181
|
.action((providerKey, options) => {
|
|
142
|
-
const key = providerKey
|
|
143
|
-
if (!PROVIDERS[key]) {
|
|
182
|
+
const key = resolveProviderCommandKey(providerKey);
|
|
183
|
+
if (!key || !PROVIDERS[key]) {
|
|
144
184
|
logger.error(`❌ Unknown provider: ${providerKey}`);
|
|
145
185
|
logger.error(` Available: ${Object.keys(PROVIDERS).join(', ')}`);
|
|
146
186
|
process.exit(1);
|
|
@@ -167,8 +207,8 @@ export function createProviderCommand() {
|
|
|
167
207
|
.command('models [provider]')
|
|
168
208
|
.description('List available models for a provider')
|
|
169
209
|
.action((providerKey) => {
|
|
170
|
-
const key = (providerKey || getCurrentProvider())
|
|
171
|
-
if (!PROVIDERS[key]) {
|
|
210
|
+
const key = resolveProviderCommandKey(providerKey || getCurrentProvider());
|
|
211
|
+
if (!key || !PROVIDERS[key]) {
|
|
172
212
|
logger.error(`❌ Unknown provider: ${providerKey}`);
|
|
173
213
|
process.exit(1);
|
|
174
214
|
}
|
|
@@ -197,5 +237,16 @@ export function createProviderCommand() {
|
|
|
197
237
|
});
|
|
198
238
|
return provider;
|
|
199
239
|
}
|
|
240
|
+
export function resolveProviderCommandKey(provider) {
|
|
241
|
+
const normalized = provider.toLowerCase();
|
|
242
|
+
if (PROVIDERS[normalized])
|
|
243
|
+
return normalized;
|
|
244
|
+
const entry = findRuntimeProvider(normalized);
|
|
245
|
+
if (!entry)
|
|
246
|
+
return null;
|
|
247
|
+
if (entry.runtimeSupport !== 'direct')
|
|
248
|
+
return null;
|
|
249
|
+
return PROVIDER_COMMAND_KEYS[entry.id] ?? null;
|
|
250
|
+
}
|
|
200
251
|
export default createProviderCommand;
|
|
201
252
|
//# sourceMappingURL=provider.js.map
|