careervivid 1.12.15 → 1.12.16
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":"repl.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/repl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI7E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,GAAE,MAAM,GAAG,IAAW,QAwBtF;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,WAAW,GAAG,sBAAsB,GAAG,IAAI,EACnD,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAC9K,gBAAgB,EAAE,WAAW,EAC7B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,GAAG,EAAE,GACX,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/repl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI7E,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,GAAE,MAAM,GAAG,IAAW,QAwBtF;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,WAAW,GAAG,sBAAsB,GAAG,IAAI,EACnD,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAC9K,gBAAgB,EAAE,WAAW,EAC7B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,GAAG,EAAE,GACX,OAAO,CAAC,IAAI,CAAC,CA4Yf"}
|
|
@@ -31,6 +31,29 @@ export async function askLoop(engine, options, selectedProvider, selectedModel,
|
|
|
31
31
|
let currentModel = selectedModel;
|
|
32
32
|
let pasteBuffer = [];
|
|
33
33
|
let byoHistory = []; // Track history for BYO providers
|
|
34
|
+
// ── SIGINT handler: Ctrl+C cancels current operation and returns to prompt ──
|
|
35
|
+
let activeAbort = null;
|
|
36
|
+
const handleSigInt = () => {
|
|
37
|
+
const ab = activeAbort;
|
|
38
|
+
if (ab !== null && !ab.signal.aborted) {
|
|
39
|
+
ab.abort();
|
|
40
|
+
process.stdout.write("\n" + chalk.yellow("⚡ Interrupted. Press Ctrl+C again or type 'exit' to quit.\n"));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Second Ctrl+C exits
|
|
44
|
+
console.log(chalk.gray("\nGoodbye! 👋\n"));
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
process.on("SIGINT", handleSigInt);
|
|
49
|
+
/** Wraps a promise with a timeout. Rejects with a friendly timeout error. */
|
|
50
|
+
function withTimeout(p, ms, label) {
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms / 1000}s. Press Ctrl+C if stuck.`)), ms);
|
|
53
|
+
p.then(v => { clearTimeout(timer); resolve(v); })
|
|
54
|
+
.catch(e => { clearTimeout(timer); reject(e); });
|
|
55
|
+
});
|
|
56
|
+
}
|
|
34
57
|
const ask = async () => {
|
|
35
58
|
try {
|
|
36
59
|
const promptStartTime = Date.now();
|
|
@@ -311,13 +334,7 @@ export async function askLoop(engine, options, selectedProvider, selectedModel,
|
|
|
311
334
|
let userTurn = { role: "user", parts: [{ text: userInput }] };
|
|
312
335
|
let round = 0;
|
|
313
336
|
while (round < 10) {
|
|
314
|
-
const result = await provider.generate({
|
|
315
|
-
model: currentModel,
|
|
316
|
-
history: byoHistory,
|
|
317
|
-
userTurn,
|
|
318
|
-
tools,
|
|
319
|
-
systemInstruction,
|
|
320
|
-
});
|
|
337
|
+
const result = await withTimeout(provider.generate({ model: currentModel, history: byoHistory, userTurn, tools, systemInstruction }), 45_000, "LLM generate()");
|
|
321
338
|
if (round === 0) {
|
|
322
339
|
process.stdout.write("\r\x1b[K"); // clear initial thinking spinner
|
|
323
340
|
}
|
|
@@ -339,10 +356,17 @@ export async function askLoop(engine, options, selectedProvider, selectedModel,
|
|
|
339
356
|
const tool = tools.find((t) => t.name === fc.name);
|
|
340
357
|
let out;
|
|
341
358
|
try {
|
|
342
|
-
out = tool
|
|
359
|
+
out = tool
|
|
360
|
+
? await withTimeout(tool.execute(fc.args), 45_000, `tool:${fc.name}`)
|
|
361
|
+
: { error: "Tool not found" };
|
|
343
362
|
}
|
|
344
363
|
catch (e) {
|
|
345
|
-
|
|
364
|
+
if (e.message?.includes("No API key configured")) {
|
|
365
|
+
out = { error: "CareerVivid API key not found. Run 'cv login' to authenticate." };
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
out = { error: e.message };
|
|
369
|
+
}
|
|
346
370
|
}
|
|
347
371
|
handleToolResult(fc.name, out);
|
|
348
372
|
fnResponses.push({ functionResponse: { id: fc.id, name: fc.name, response: out } });
|