@phuetz/code-buddy 1.1.0 → 1.2.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 +160 -165
- package/dist/agent/autonomous/agentic-coding-contract.d.ts +6 -6
- 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/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/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 +130 -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 +1 -0
- 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 +1 -1
- package/dist/codebuddy/tools.js +27 -24
- package/dist/commands/cli/hermes-commands.js +108 -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 +1 -1
- 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/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/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/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/context-manager-v2.js +1 -0
- package/dist/daemon/autonomous-daemon.d.ts +1 -1
- package/dist/daemon/autonomous-daemon.js +3 -3
- package/dist/daemon/autonomous-loop.js +11 -2
- 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/hooks/user-hooks.js +17 -3
- package/dist/index.js +464 -25
- 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-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/server/index.js +17 -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 +1 -0
- package/dist/services/prompt-builder.js +49 -8
- 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/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/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/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/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 +7 -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
|
@@ -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
|
|
@@ -163,7 +163,8 @@ function pickStory(store, projectId, explicitId) {
|
|
|
163
163
|
}
|
|
164
164
|
return story;
|
|
165
165
|
}
|
|
166
|
-
const approved = store.listStories(projectId, 'approved')
|
|
166
|
+
const approved = store.listStories(projectId, 'approved')
|
|
167
|
+
.sort((a, b) => a.createdAt - b.createdAt || a.id.localeCompare(b.id));
|
|
167
168
|
const first = approved[0];
|
|
168
169
|
if (!first) {
|
|
169
170
|
console.log('No approved stories. Approve one with: buddy spec story approve <id> --by <name>');
|
|
@@ -18,7 +18,7 @@ import { Command } from 'commander';
|
|
|
18
18
|
import { getSpecStore } from '../spec/spec-store.js';
|
|
19
19
|
import { startSpecPlan, advanceSpecPlan, runSpecPlanToCompletion, } from '../spec/spec-plan-runner.js';
|
|
20
20
|
import { getSettingsManager } from '../utils/settings-manager.js';
|
|
21
|
-
import {
|
|
21
|
+
import { resolveCommandProvider } from './llm-provider-resolution.js';
|
|
22
22
|
/**
|
|
23
23
|
* Build the `plan` sub-command group.
|
|
24
24
|
* @param llmProvider override for tests; defaults to a real CodeBuddyClient.
|
|
@@ -150,23 +150,12 @@ function printAdvanceResult(store, projectId, result) {
|
|
|
150
150
|
// ============================================================================
|
|
151
151
|
async function defaultLlmProvider() {
|
|
152
152
|
const settingsManager = getSettingsManager();
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const providerInfo = PROVIDERS[providerKey];
|
|
156
|
-
let apiKey = process.env[providerInfo?.envVar || ''] || '';
|
|
157
|
-
if (!apiKey) {
|
|
158
|
-
apiKey =
|
|
159
|
-
process.env.GROK_API_KEY ||
|
|
160
|
-
process.env.ANTHROPIC_API_KEY ||
|
|
161
|
-
process.env.OPENAI_API_KEY ||
|
|
162
|
-
process.env.GEMINI_API_KEY ||
|
|
163
|
-
'';
|
|
164
|
-
}
|
|
165
|
-
if (!apiKey)
|
|
153
|
+
const resolved = resolveCommandProvider();
|
|
154
|
+
if (!resolved)
|
|
166
155
|
throw new Error('No API key configured. Run: buddy onboard');
|
|
167
156
|
const { CodeBuddyClient } = await import('../codebuddy/client.js');
|
|
168
|
-
const model = settingsManager.getCurrentModel() ||
|
|
169
|
-
const client = new CodeBuddyClient(apiKey, model,
|
|
157
|
+
const model = settingsManager.getCurrentModel() || resolved.model;
|
|
158
|
+
const client = new CodeBuddyClient(resolved.apiKey, model, resolved.baseURL);
|
|
170
159
|
return async (system, user) => {
|
|
171
160
|
const response = await client.chat([
|
|
172
161
|
{ role: 'system', content: system },
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { TunnelManager } from '../server/tunnel-manager.js';
|
|
3
|
+
import { logger } from '../utils/logger.js';
|
|
4
|
+
export function createTunnelCommand() {
|
|
5
|
+
const cmd = new Command('tunnel')
|
|
6
|
+
.description('Manage ngrok tunnels for the Code Buddy remote gateway');
|
|
7
|
+
cmd.command('start')
|
|
8
|
+
.description('Start an ngrok tunnel')
|
|
9
|
+
.option('-p, --port <number>', 'Port to tunnel to', '3000')
|
|
10
|
+
.option('--domain <string>', 'Custom ngrok domain')
|
|
11
|
+
.option('--authtoken <string>', 'ngrok authtoken (or set NGROK_AUTHTOKEN env var)')
|
|
12
|
+
.option('--server', 'Start the local HTTP server along with the tunnel')
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
const port = parseInt(opts.port, 10);
|
|
15
|
+
if (opts.server) {
|
|
16
|
+
// dynamically import server to start it
|
|
17
|
+
try {
|
|
18
|
+
const { startServer } = await import('../server/index.js');
|
|
19
|
+
await startServer({ port });
|
|
20
|
+
logger.info(`Local server started on port ${port}`);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger.error('Failed to start local server', { error });
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const url = await TunnelManager.startTunnel({
|
|
29
|
+
port,
|
|
30
|
+
domain: opts.domain,
|
|
31
|
+
authtoken: opts.authtoken,
|
|
32
|
+
});
|
|
33
|
+
console.log(`\nTunnel started successfully!`);
|
|
34
|
+
console.log(`Forwarding: ${url} -> http://localhost:${port}\n`);
|
|
35
|
+
// Keep process alive if just tunneling
|
|
36
|
+
process.on('SIGINT', async () => {
|
|
37
|
+
await TunnelManager.stopTunnel();
|
|
38
|
+
process.exit(0);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Failed to start tunnel:', error instanceof Error ? error.message : String(error));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return cmd;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=tunnel.js.map
|
|
@@ -44,9 +44,10 @@ export declare class ConfigResolver extends EventEmitter {
|
|
|
44
44
|
private resolveFromProfile;
|
|
45
45
|
/**
|
|
46
46
|
* Resolve from environment variables
|
|
47
|
-
* Priority
|
|
47
|
+
* Priority comes from the runtime provider catalog.
|
|
48
48
|
*/
|
|
49
49
|
private resolveFromEnv;
|
|
50
|
+
private normalizeDetectedProvider;
|
|
50
51
|
/**
|
|
51
52
|
* Get built-in default configuration
|
|
52
53
|
*/
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { EventEmitter } from 'events';
|
|
13
13
|
import { logger } from '../utils/logger.js';
|
|
14
|
+
import { detectProviderFromEnv } from '../utils/provider-detector.js';
|
|
14
15
|
import { DEFAULT_PROFILES, DEFAULT_CONNECTION_CONFIG, } from './types.js';
|
|
15
16
|
// ============================================================================
|
|
16
17
|
// Config Resolver
|
|
@@ -121,49 +122,16 @@ export class ConfigResolver extends EventEmitter {
|
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* Resolve from environment variables
|
|
124
|
-
* Priority
|
|
125
|
+
* Priority comes from the runtime provider catalog.
|
|
125
126
|
*/
|
|
126
127
|
resolveFromEnv() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (geminiKey) {
|
|
128
|
+
const detected = detectProviderFromEnv();
|
|
129
|
+
if (detected) {
|
|
130
130
|
return {
|
|
131
|
-
baseURL:
|
|
132
|
-
apiKey:
|
|
133
|
-
model:
|
|
134
|
-
provider:
|
|
135
|
-
source: 'environment',
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
// Check Grok
|
|
139
|
-
const grokKey = process.env.GROK_API_KEY || process.env.XAI_API_KEY;
|
|
140
|
-
if (grokKey) {
|
|
141
|
-
const baseURL = process.env.GROK_BASE_URL || 'https://api.x.ai/v1';
|
|
142
|
-
return {
|
|
143
|
-
baseURL,
|
|
144
|
-
apiKey: grokKey,
|
|
145
|
-
model: process.env.GROK_MODEL || 'grok-code-fast-1',
|
|
146
|
-
provider: 'grok',
|
|
147
|
-
source: 'environment',
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
// Check OpenAI
|
|
151
|
-
if (process.env.OPENAI_API_KEY) {
|
|
152
|
-
return {
|
|
153
|
-
baseURL: 'https://api.openai.com/v1',
|
|
154
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
155
|
-
model: process.env.OPENAI_MODEL || 'gpt-4o',
|
|
156
|
-
provider: 'openai',
|
|
157
|
-
source: 'environment',
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
// Check Anthropic
|
|
161
|
-
if (process.env.ANTHROPIC_API_KEY) {
|
|
162
|
-
return {
|
|
163
|
-
baseURL: 'https://api.anthropic.com/v1',
|
|
164
|
-
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
165
|
-
model: process.env.ANTHROPIC_MODEL || 'claude-sonnet-4-20250514',
|
|
166
|
-
provider: 'claude',
|
|
131
|
+
baseURL: detected.baseURL,
|
|
132
|
+
apiKey: detected.apiKey,
|
|
133
|
+
model: detected.defaultModel,
|
|
134
|
+
provider: this.normalizeDetectedProvider(detected.provider),
|
|
167
135
|
source: 'environment',
|
|
168
136
|
};
|
|
169
137
|
}
|
|
@@ -177,6 +145,13 @@ export class ConfigResolver extends EventEmitter {
|
|
|
177
145
|
source: 'environment',
|
|
178
146
|
};
|
|
179
147
|
}
|
|
148
|
+
normalizeDetectedProvider(provider) {
|
|
149
|
+
if (provider === 'anthropic')
|
|
150
|
+
return 'claude';
|
|
151
|
+
if (provider === 'unknown')
|
|
152
|
+
return 'grok';
|
|
153
|
+
return provider;
|
|
154
|
+
}
|
|
180
155
|
/**
|
|
181
156
|
* Get built-in default configuration
|
|
182
157
|
*/
|
|
@@ -215,6 +190,44 @@ export class ConfigResolver extends EventEmitter {
|
|
|
215
190
|
return 'together';
|
|
216
191
|
if (urlLower.includes('fireworks.ai'))
|
|
217
192
|
return 'fireworks';
|
|
193
|
+
if (urlLower.includes('openrouter.ai'))
|
|
194
|
+
return 'openrouter';
|
|
195
|
+
if (urlLower.includes('novita.ai'))
|
|
196
|
+
return 'novita';
|
|
197
|
+
if (urlLower.includes('z.ai') || urlLower.includes('bigmodel'))
|
|
198
|
+
return 'zai';
|
|
199
|
+
if (urlLower.includes('moonshot.ai'))
|
|
200
|
+
return 'kimi-coding';
|
|
201
|
+
if (urlLower.includes('moonshot.cn'))
|
|
202
|
+
return 'kimi-coding-cn';
|
|
203
|
+
if (urlLower.includes('arcee.ai'))
|
|
204
|
+
return 'arcee';
|
|
205
|
+
if (urlLower.includes('gmi-serving.com'))
|
|
206
|
+
return 'gmi';
|
|
207
|
+
if (urlLower.includes('minimax.io'))
|
|
208
|
+
return 'minimax';
|
|
209
|
+
if (urlLower.includes('minimaxi.com'))
|
|
210
|
+
return 'minimax-cn';
|
|
211
|
+
if (urlLower.includes('dashscope') || urlLower.includes('aliyuncs.com'))
|
|
212
|
+
return 'alibaba';
|
|
213
|
+
if (urlLower.includes('kilo.ai'))
|
|
214
|
+
return 'kilocode';
|
|
215
|
+
if (urlLower.includes('xiaomimimo.com'))
|
|
216
|
+
return 'xiaomi';
|
|
217
|
+
if (urlLower.includes('tencentmaas.com'))
|
|
218
|
+
return 'tencent-tokenhub';
|
|
219
|
+
if (urlLower.includes('opencode.ai/zen/go'))
|
|
220
|
+
return 'opencode-go';
|
|
221
|
+
if (urlLower.includes('opencode.ai/zen'))
|
|
222
|
+
return 'opencode-zen';
|
|
223
|
+
if (urlLower.includes('router.huggingface.co') || urlLower.includes('huggingface.co'))
|
|
224
|
+
return 'huggingface';
|
|
225
|
+
if (urlLower.includes('api.nvidia.com'))
|
|
226
|
+
return 'nvidia';
|
|
227
|
+
if (urlLower.includes('ollama.com'))
|
|
228
|
+
return 'ollama-cloud';
|
|
229
|
+
if (urlLower.includes('stepfun.ai'))
|
|
230
|
+
return 'stepfun';
|
|
218
231
|
// Local providers (by port)
|
|
219
232
|
if (urlLower.includes(':1234'))
|
|
220
233
|
return 'lmstudio';
|
|
@@ -393,7 +406,7 @@ export class ConfigResolver extends EventEmitter {
|
|
|
393
406
|
};
|
|
394
407
|
}
|
|
395
408
|
}
|
|
396
|
-
catch (
|
|
409
|
+
catch (_error) {
|
|
397
410
|
// Server not available on this port, try next
|
|
398
411
|
continue;
|
|
399
412
|
}
|
|
@@ -282,10 +282,38 @@ export declare const SUPPORTED_MODELS: {
|
|
|
282
282
|
readonly maxTokens: 32768;
|
|
283
283
|
readonly provider: "ollama";
|
|
284
284
|
};
|
|
285
|
+
readonly 'qwen3.5-ctx32k': {
|
|
286
|
+
readonly maxTokens: 32768;
|
|
287
|
+
readonly provider: "ollama";
|
|
288
|
+
};
|
|
289
|
+
readonly 'qwen3.5:35b': {
|
|
290
|
+
readonly maxTokens: 32768;
|
|
291
|
+
readonly provider: "ollama";
|
|
292
|
+
};
|
|
293
|
+
readonly 'qwen3.6:27b': {
|
|
294
|
+
readonly maxTokens: 32768;
|
|
295
|
+
readonly provider: "ollama";
|
|
296
|
+
};
|
|
297
|
+
readonly 'qwen3.6:35b-a3b-q4_K_M': {
|
|
298
|
+
readonly maxTokens: 32768;
|
|
299
|
+
readonly provider: "ollama";
|
|
300
|
+
};
|
|
301
|
+
readonly 'devstral-small-2': {
|
|
302
|
+
readonly maxTokens: 131072;
|
|
303
|
+
readonly provider: "ollama";
|
|
304
|
+
};
|
|
305
|
+
readonly 'devstral-small-2:24b-instruct-2512-q4_K_M': {
|
|
306
|
+
readonly maxTokens: 131072;
|
|
307
|
+
readonly provider: "ollama";
|
|
308
|
+
};
|
|
285
309
|
readonly phi3: {
|
|
286
310
|
readonly maxTokens: 4096;
|
|
287
311
|
readonly provider: "ollama";
|
|
288
312
|
};
|
|
313
|
+
readonly 'gemma4:12b': {
|
|
314
|
+
readonly maxTokens: 8192;
|
|
315
|
+
readonly provider: "ollama";
|
|
316
|
+
};
|
|
289
317
|
readonly gemma2: {
|
|
290
318
|
readonly maxTokens: 8192;
|
|
291
319
|
readonly provider: "ollama";
|
package/dist/config/constants.js
CHANGED
|
@@ -149,7 +149,14 @@ export const SUPPORTED_MODELS = {
|
|
|
149
149
|
'deepseek-coder-v2': { maxTokens: 131072, provider: 'ollama' },
|
|
150
150
|
'qwen2.5': { maxTokens: 32768, provider: 'ollama' },
|
|
151
151
|
'qwen2.5-coder:7b': { maxTokens: 32768, provider: 'ollama' },
|
|
152
|
+
'qwen3.5-ctx32k': { maxTokens: 32768, provider: 'ollama' },
|
|
153
|
+
'qwen3.5:35b': { maxTokens: 32768, provider: 'ollama' },
|
|
154
|
+
'qwen3.6:27b': { maxTokens: 32768, provider: 'ollama' },
|
|
155
|
+
'qwen3.6:35b-a3b-q4_K_M': { maxTokens: 32768, provider: 'ollama' },
|
|
156
|
+
'devstral-small-2': { maxTokens: 131072, provider: 'ollama' },
|
|
157
|
+
'devstral-small-2:24b-instruct-2512-q4_K_M': { maxTokens: 131072, provider: 'ollama' },
|
|
152
158
|
'phi3': { maxTokens: 4096, provider: 'ollama' },
|
|
159
|
+
'gemma4:12b': { maxTokens: 8192, provider: 'ollama' },
|
|
153
160
|
'gemma2': { maxTokens: 8192, provider: 'ollama' },
|
|
154
161
|
'command-r': { maxTokens: 131072, provider: 'ollama' },
|
|
155
162
|
};
|