careervivid 1.12.25 ā 1.12.26
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/configurator.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"configurator.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/configurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0D,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI3G,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKpD,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;GAyBrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;GA+BtB,CAAC;AAEF,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAsEpD;AAED,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,GAAQ,GAAG,OAAO,CAAC;IACpE,gBAAgB,EAAE,WAAW,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAwJD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import pkg from "enquirer";
|
|
3
|
-
import { loadConfig, saveConfig } from "../../config.js";
|
|
3
|
+
import { loadConfig, saveConfig, setProviderKey, getProviderKey } from "../../config.js";
|
|
4
4
|
const { prompt } = pkg;
|
|
5
5
|
export const MODEL_CREDIT_COST = {
|
|
6
6
|
"gemini-3.1-flash-lite-preview": 0.5,
|
|
@@ -165,20 +165,42 @@ export async function promptForAgentModel(options = {}) {
|
|
|
165
165
|
__custom__: "custom",
|
|
166
166
|
};
|
|
167
167
|
selectedProvider = providerMap[picked] || "openai";
|
|
168
|
-
const
|
|
169
|
-
|
|
168
|
+
const providerLabels = {
|
|
169
|
+
openai: "OpenAI",
|
|
170
|
+
anthropic: "Anthropic",
|
|
171
|
+
gemini: "Gemini (Google AI Studio)",
|
|
172
|
+
openrouter: "OpenRouter",
|
|
173
|
+
custom: "Custom endpoint",
|
|
174
|
+
};
|
|
175
|
+
const providerKeyUrls = {
|
|
176
|
+
openai: "https://platform.openai.com/api-keys",
|
|
177
|
+
anthropic: "https://console.anthropic.com/settings/keys",
|
|
178
|
+
gemini: "https://aistudio.google.com/app/apikey",
|
|
179
|
+
openrouter: "https://openrouter.ai/settings/keys",
|
|
180
|
+
custom: "your custom endpoint's documentation",
|
|
181
|
+
};
|
|
182
|
+
// Check for this specific provider's saved key ā NOT a shared key
|
|
183
|
+
const savedKey = getProviderKey(selectedProvider);
|
|
170
184
|
if (!savedKey) {
|
|
171
|
-
console.log(
|
|
172
|
-
console.log(chalk.
|
|
185
|
+
console.log();
|
|
186
|
+
console.log(chalk.bold.yellow(`š API key required for ${providerLabels[selectedProvider] ?? selectedProvider}`) +
|
|
187
|
+
chalk.dim("\n Your key will be saved locally ā you only need to enter it once."));
|
|
188
|
+
console.log(chalk.dim(`\n Get your key at: `) + chalk.cyan(providerKeyUrls[selectedProvider] ?? "the provider's website"));
|
|
189
|
+
console.log();
|
|
173
190
|
const keyAnswer = await prompt({
|
|
174
191
|
type: "password",
|
|
175
192
|
name: "key",
|
|
176
|
-
message: `Enter your ${selectedProvider} API key:`,
|
|
193
|
+
message: `Enter your ${providerLabels[selectedProvider] ?? selectedProvider} API key:`,
|
|
177
194
|
});
|
|
178
195
|
apiKey = keyAnswer.key.trim();
|
|
196
|
+
if (apiKey) {
|
|
197
|
+
setProviderKey(selectedProvider, apiKey);
|
|
198
|
+
console.log(chalk.green(`\nā Key saved for ${providerLabels[selectedProvider] ?? selectedProvider}\n`));
|
|
199
|
+
}
|
|
179
200
|
}
|
|
180
|
-
|
|
181
|
-
apiKey = savedKey;
|
|
201
|
+
else {
|
|
202
|
+
apiKey = savedKey;
|
|
203
|
+
console.log(chalk.dim(`\n Using saved ${providerLabels[selectedProvider] ?? selectedProvider} key (ā¢ā¢ā¢ā¢${savedKey.slice(-4)})\n`));
|
|
182
204
|
}
|
|
183
205
|
// Attempt to automatically fetch and display Free OpenRouter models that support tools
|
|
184
206
|
if (selectedProvider === "openrouter") {
|
|
@@ -217,6 +239,7 @@ export async function promptForAgentModel(options = {}) {
|
|
|
217
239
|
}
|
|
218
240
|
}
|
|
219
241
|
// Pre-fill with the saved model when provider matches, otherwise use sensible defaults
|
|
242
|
+
const savedCfg = loadConfig();
|
|
220
243
|
const defaultModel = savedCfg.llmProvider === selectedProvider && savedCfg.llmModel
|
|
221
244
|
? savedCfg.llmModel
|
|
222
245
|
: selectedProvider === "openai"
|
package/dist/config.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export interface CareerVividConfig {
|
|
|
20
20
|
llmProvider?: LLMProvider;
|
|
21
21
|
/** BYO model identifier (e.g. "gpt-4o", "claude-opus-4-5", "gemini-2.5-pro") */
|
|
22
22
|
llmModel?: string;
|
|
23
|
-
/**
|
|
23
|
+
/** @deprecated use llmKeys[provider] instead ā kept for migration */
|
|
24
24
|
llmApiKey?: string;
|
|
25
|
+
/** Per-provider API keys ā keyed by provider name */
|
|
26
|
+
llmKeys?: Partial<Record<LLMProvider, string>>;
|
|
25
27
|
/** Custom base URL for OpenAI-compatible endpoints (OpenRouter, Kimi, GLM, Qwen, etc.) */
|
|
26
28
|
llmBaseUrl?: string;
|
|
27
29
|
}
|
|
@@ -36,6 +38,10 @@ export declare function saveConfig(config: CareerVividConfig): void;
|
|
|
36
38
|
export declare function getApiKey(): string | undefined;
|
|
37
39
|
/** Gemini API key used by `cv agent`. Priority: GEMINI_API_KEY env var > geminiKey in config. */
|
|
38
40
|
export declare function getGeminiKey(): string | undefined;
|
|
41
|
+
/** Get the saved API key for a specific BYO provider */
|
|
42
|
+
export declare function getProviderKey(provider: LLMProvider): string | undefined;
|
|
43
|
+
/** Save the API key for a specific BYO provider */
|
|
44
|
+
export declare function setProviderKey(provider: LLMProvider, key: string): void;
|
|
39
45
|
export declare function getApiUrl(): string;
|
|
40
46
|
export declare function setConfigValue(key: keyof CareerVividConfig, value: string): void;
|
|
41
47
|
/** How long a CLI session stays valid (90 days in ms) */
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,WAAW,QAAyC,CAAC;AAElE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEtG,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,WAAW,QAAyC,CAAC;AAElE,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEtG,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CA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ACxD,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,mFAAmF;AACnF,wBAAgB,YAAY,IAAI,IAAI,CAInC;AAED,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,IAAI,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE;IACrC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,SAAS,CA6BZ"}
|
package/dist/config.js
CHANGED
|
@@ -32,6 +32,22 @@ export function getApiKey() {
|
|
|
32
32
|
export function getGeminiKey() {
|
|
33
33
|
return process.env.GEMINI_API_KEY || loadConfig().geminiKey;
|
|
34
34
|
}
|
|
35
|
+
/** Get the saved API key for a specific BYO provider */
|
|
36
|
+
export function getProviderKey(provider) {
|
|
37
|
+
const cfg = loadConfig();
|
|
38
|
+
// Per-provider key takes priority, fallback to old llmApiKey (migration)
|
|
39
|
+
return cfg.llmKeys?.[provider] ?? (cfg.llmProvider === provider ? cfg.llmApiKey : undefined);
|
|
40
|
+
}
|
|
41
|
+
/** Save the API key for a specific BYO provider */
|
|
42
|
+
export function setProviderKey(provider, key) {
|
|
43
|
+
const cfg = loadConfig();
|
|
44
|
+
cfg.llmKeys = cfg.llmKeys ?? {};
|
|
45
|
+
cfg.llmKeys[provider] = key;
|
|
46
|
+
// Also write to llmApiKey for backwards compat when this is the active provider
|
|
47
|
+
cfg.llmApiKey = key;
|
|
48
|
+
cfg.llmProvider = provider;
|
|
49
|
+
saveConfig(cfg);
|
|
50
|
+
}
|
|
35
51
|
export function getApiUrl() {
|
|
36
52
|
return process.env.CV_API_URL || loadConfig().apiUrl || DEFAULT_API_URL;
|
|
37
53
|
}
|
|
@@ -83,7 +99,7 @@ export function getLlmConfig(overrides) {
|
|
|
83
99
|
'gemini-2.5-flash';
|
|
84
100
|
const apiKey = overrides?.apiKey ??
|
|
85
101
|
process.env.CV_LLM_API_KEY ??
|
|
86
|
-
|
|
102
|
+
getProviderKey(provider) ??
|
|
87
103
|
cfg.geminiKey ??
|
|
88
104
|
process.env.GEMINI_API_KEY;
|
|
89
105
|
const baseUrl = overrides?.baseUrl ??
|
package/package.json
CHANGED