codeep 1.2.46 → 1.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/server.js +48 -11
- package/package.json +1 -1
package/dist/acp/server.js
CHANGED
|
@@ -4,7 +4,8 @@ import { randomUUID } from 'crypto';
|
|
|
4
4
|
import { StdioTransport } from './transport.js';
|
|
5
5
|
import { runAgentSession } from './session.js';
|
|
6
6
|
import { initWorkspace, loadWorkspace, handleCommand } from './commands.js';
|
|
7
|
-
import { autoSaveSession, config,
|
|
7
|
+
import { autoSaveSession, config, setProvider } from '../config/index.js';
|
|
8
|
+
import { PROVIDERS } from '../config/providers.js';
|
|
8
9
|
import { getCurrentVersion } from '../utils/update.js';
|
|
9
10
|
// ─── Slash commands advertised to Zed ────────────────────────────────────────
|
|
10
11
|
const AVAILABLE_COMMANDS = [
|
|
@@ -12,7 +13,6 @@ const AVAILABLE_COMMANDS = [
|
|
|
12
13
|
{ name: 'help', description: 'Show available commands' },
|
|
13
14
|
{ name: 'status', description: 'Show current config and session info' },
|
|
14
15
|
{ name: 'version', description: 'Show version and current model' },
|
|
15
|
-
{ name: 'provider', description: 'List or switch AI provider', input: { hint: '<provider-id>' } },
|
|
16
16
|
{ name: 'model', description: 'List or switch model', input: { hint: '<model-id>' } },
|
|
17
17
|
{ name: 'login', description: 'Set API key for a provider', input: { hint: '<providerId> <apiKey>' } },
|
|
18
18
|
{ name: 'apikey', description: 'Show or set API key for current provider', input: { hint: '<key>' } },
|
|
@@ -58,16 +58,43 @@ const AGENT_MODES = {
|
|
|
58
58
|
],
|
|
59
59
|
};
|
|
60
60
|
// ─── Config options ───────────────────────────────────────────────────────────
|
|
61
|
+
/** Check if a provider has an API key stored (reads config directly, no async) */
|
|
62
|
+
function providerHasKey(providerId) {
|
|
63
|
+
// Check environment variable first
|
|
64
|
+
const envKey = PROVIDERS[providerId]?.envKey;
|
|
65
|
+
if (envKey && process.env[envKey])
|
|
66
|
+
return true;
|
|
67
|
+
// Check stored providerApiKeys
|
|
68
|
+
const stored = (config.get('providerApiKeys') || []);
|
|
69
|
+
return stored.some(k => k.providerId === providerId && !!k.apiKey);
|
|
70
|
+
}
|
|
61
71
|
function buildConfigOptions() {
|
|
62
|
-
const models = getModelsForCurrentProvider();
|
|
63
72
|
const currentModel = config.get('model') ?? '';
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const currentProviderId = config.get('provider') ?? '';
|
|
74
|
+
// Only show providers that have an API key configured
|
|
75
|
+
const modelOptions = [];
|
|
76
|
+
for (const [providerId, provider] of Object.entries(PROVIDERS)) {
|
|
77
|
+
if (!providerHasKey(providerId))
|
|
78
|
+
continue;
|
|
79
|
+
for (const model of provider.models) {
|
|
80
|
+
modelOptions.push({
|
|
81
|
+
value: `${providerId}/${model.id}`,
|
|
82
|
+
name: model.name,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Always include current provider's models even if key is missing (avoids empty list)
|
|
87
|
+
if (modelOptions.length === 0) {
|
|
88
|
+
const fallback = PROVIDERS[currentProviderId];
|
|
89
|
+
if (fallback) {
|
|
90
|
+
for (const model of fallback.models) {
|
|
91
|
+
modelOptions.push({ value: `${currentProviderId}/${model.id}`, name: model.name });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const compositeValue = `${currentProviderId}/${currentModel}`;
|
|
96
|
+
const currentValue = modelOptions.some(o => o.value === compositeValue)
|
|
97
|
+
? compositeValue
|
|
71
98
|
: (modelOptions[0]?.value ?? '');
|
|
72
99
|
return [
|
|
73
100
|
{
|
|
@@ -252,7 +279,17 @@ export function startAcpServer() {
|
|
|
252
279
|
return;
|
|
253
280
|
}
|
|
254
281
|
if (configId === 'model' && typeof value === 'string') {
|
|
255
|
-
|
|
282
|
+
// value is "providerId/modelId" — split and switch both
|
|
283
|
+
const slashIdx = value.indexOf('/');
|
|
284
|
+
if (slashIdx !== -1) {
|
|
285
|
+
const providerId = value.slice(0, slashIdx);
|
|
286
|
+
const modelId = value.slice(slashIdx + 1);
|
|
287
|
+
setProvider(providerId); // sets provider + defaultModel + protocol
|
|
288
|
+
config.set('model', modelId);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
config.set('model', value);
|
|
292
|
+
}
|
|
256
293
|
}
|
|
257
294
|
transport.respond(msg.id, {});
|
|
258
295
|
// Confirm the new value back to Zed so its UI state stays in sync
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.48",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|