careervivid 1.12.8 ā 1.12.11
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/commands/agent/configurator.d.ts.map +1 -1
- package/dist/commands/agent/configurator.js +54 -7
- package/dist/commands/agent/index.d.ts.map +1 -1
- package/dist/commands/agent/index.js +3 -5
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +8 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/configurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI3E,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,
|
|
1
|
+
{"version":3,"file":"configurator.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/configurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI3E,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,CA6HD"}
|
|
@@ -149,6 +149,9 @@ export async function promptForAgentModel(options = {}) {
|
|
|
149
149
|
})),
|
|
150
150
|
});
|
|
151
151
|
const picked = modelAnswer.model;
|
|
152
|
+
if (!picked) {
|
|
153
|
+
process.exit(0);
|
|
154
|
+
}
|
|
152
155
|
let selectedProvider;
|
|
153
156
|
let selectedModel;
|
|
154
157
|
let thinkingBudget;
|
|
@@ -162,7 +165,8 @@ export async function promptForAgentModel(options = {}) {
|
|
|
162
165
|
__custom__: "custom",
|
|
163
166
|
};
|
|
164
167
|
selectedProvider = providerMap[picked] || "openai";
|
|
165
|
-
const
|
|
168
|
+
const savedCfg = loadConfig();
|
|
169
|
+
const savedKey = savedCfg.llmApiKey;
|
|
166
170
|
if (!savedKey) {
|
|
167
171
|
console.log(chalk.yellow(`\nš BYO API key needed for ${selectedProvider}.`));
|
|
168
172
|
console.log(chalk.dim(" Run: cv agent config to save your key permanently.\n"));
|
|
@@ -173,17 +177,60 @@ export async function promptForAgentModel(options = {}) {
|
|
|
173
177
|
});
|
|
174
178
|
apiKey = keyAnswer.key.trim();
|
|
175
179
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
if (!apiKey) {
|
|
181
|
+
apiKey = savedKey; // Keep existing api key fallback
|
|
182
|
+
}
|
|
183
|
+
// Attempt to automatically fetch and display Free OpenRouter models that support tools
|
|
184
|
+
if (selectedProvider === "openrouter") {
|
|
185
|
+
try {
|
|
186
|
+
console.log(chalk.dim(" Fetching 100% free OpenRouter models with tool support..."));
|
|
187
|
+
// Using global fetch (available in Node 18+)
|
|
188
|
+
const res = await fetch("https://openrouter.ai/api/v1/models");
|
|
189
|
+
if (res.ok) {
|
|
190
|
+
const json = await res.json();
|
|
191
|
+
const freeToolModels = json.data
|
|
192
|
+
.filter((m) => m.pricing?.prompt === "0" &&
|
|
193
|
+
m.pricing?.completion === "0" &&
|
|
194
|
+
m.supported_parameters?.includes("tools"))
|
|
195
|
+
.map((m) => m.id);
|
|
196
|
+
if (freeToolModels.length > 0) {
|
|
197
|
+
const customChoice = "__custom__";
|
|
198
|
+
const orAnswer = await prompt({
|
|
199
|
+
type: "select",
|
|
200
|
+
name: "or_model",
|
|
201
|
+
message: "Select a free tool-compatible model:",
|
|
202
|
+
// @ts-ignore
|
|
203
|
+
limit: 15,
|
|
204
|
+
choices: [
|
|
205
|
+
{ name: customChoice, message: "āļø Type a custom/paid model name instead..." },
|
|
206
|
+
...freeToolModels.map((id) => ({ name: id, message: `š¤ ${id}` })),
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
if (orAnswer.or_model !== customChoice) {
|
|
210
|
+
return { selectedProvider, selectedModel: orAnswer.or_model, thinkingBudget: 0, apiKey };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
console.log(chalk.yellow(" Could not fetch models. Falling back to manual entry."));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Pre-fill with the saved model when provider matches, otherwise use sensible defaults
|
|
220
|
+
const defaultModel = savedCfg.llmProvider === selectedProvider && savedCfg.llmModel
|
|
221
|
+
? savedCfg.llmModel
|
|
222
|
+
: selectedProvider === "openai"
|
|
181
223
|
? "gpt-4o"
|
|
182
224
|
: selectedProvider === "anthropic"
|
|
183
225
|
? "claude-opus-4-5"
|
|
184
226
|
: selectedProvider === "gemini"
|
|
185
227
|
? "gemini-2.5-flash"
|
|
186
|
-
: "
|
|
228
|
+
: "google/gemma-4-31b-it:free";
|
|
229
|
+
const modelAnswer2 = await prompt({
|
|
230
|
+
type: "input",
|
|
231
|
+
name: "model",
|
|
232
|
+
message: "Model name:",
|
|
233
|
+
initial: defaultModel,
|
|
187
234
|
});
|
|
188
235
|
selectedModel = modelAnswer2.model.trim();
|
|
189
236
|
thinkingBudget = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAwHpD"}
|
|
@@ -58,16 +58,14 @@ export function registerAgentCommand(program) {
|
|
|
58
58
|
selectedProvider = "careervivid";
|
|
59
59
|
}
|
|
60
60
|
else if (options.provider && options.provider !== "careervivid") {
|
|
61
|
-
|
|
62
|
-
selectedModel = llmCfg.model;
|
|
63
|
-
thinkingBudget = 0;
|
|
64
|
-
}
|
|
65
|
-
else if (llmCfg.provider !== "careervivid") {
|
|
61
|
+
// User explicitly passed --provider on the CLI ā use it directly, no picker
|
|
66
62
|
selectedProvider = llmCfg.provider;
|
|
67
63
|
selectedModel = llmCfg.model;
|
|
68
64
|
thinkingBudget = 0;
|
|
69
65
|
}
|
|
70
66
|
else {
|
|
67
|
+
// Always show the picker. Saved config pre-fills BYO model inputs but does
|
|
68
|
+
// not bypass the prompt. This lets the user choose per-session.
|
|
71
69
|
const result = await promptForAgentModel(options);
|
|
72
70
|
selectedProvider = result.selectedProvider;
|
|
73
71
|
selectedModel = result.selectedModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwK3D"}
|
package/dist/commands/login.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createServer } from "http";
|
|
|
11
11
|
import chalk from "chalk";
|
|
12
12
|
import ora from "ora";
|
|
13
13
|
import boxen from "boxen";
|
|
14
|
-
import { saveConfig } from "../config.js";
|
|
14
|
+
import { saveConfig, loadConfig } from "../config.js";
|
|
15
15
|
import { verifyKey, isApiError } from "../api.js";
|
|
16
16
|
import { COLORS } from "../branding.js";
|
|
17
17
|
const TIMEOUT_MS = 120_000; // 2 minutes
|
|
@@ -110,8 +110,10 @@ export function registerLoginCommand(program) {
|
|
|
110
110
|
console.error(`\n ${chalk.red("ā")} ${chalk.bold.red("Login failed:")} ${result.message}\n`);
|
|
111
111
|
process.exit(1);
|
|
112
112
|
}
|
|
113
|
-
// Save the key
|
|
114
|
-
|
|
113
|
+
// Save the key while preserving other config
|
|
114
|
+
const cfg = loadConfig();
|
|
115
|
+
cfg.apiKey = apiKey;
|
|
116
|
+
saveConfig(cfg);
|
|
115
117
|
const adminBadge = result.isAdmin
|
|
116
118
|
? ` ${chalk.bgYellow.black(" ADMIN ")}`
|
|
117
119
|
: "";
|
|
@@ -144,7 +146,9 @@ export function registerLoginCommand(program) {
|
|
|
144
146
|
console.log(JSON.stringify({ success: false, error: result.message }));
|
|
145
147
|
process.exit(1);
|
|
146
148
|
}
|
|
147
|
-
|
|
149
|
+
const cfg = loadConfig();
|
|
150
|
+
cfg.apiKey = apiKey;
|
|
151
|
+
saveConfig(cfg);
|
|
148
152
|
console.log(JSON.stringify({ success: true, ...result }));
|
|
149
153
|
}
|
|
150
154
|
catch (err) {
|