@robinpath/cli 1.78.0 → 1.79.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/dist/cli.mjs +39 -8
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -18598,7 +18598,7 @@ function getNativeModules() {
|
|
|
18598
18598
|
import { join as join3, basename as basename2 } from "node:path";
|
|
18599
18599
|
import { homedir as homedir2, platform as platform2 } from "node:os";
|
|
18600
18600
|
import { existsSync as existsSync2 } from "node:fs";
|
|
18601
|
-
var CLI_VERSION = true ? "1.
|
|
18601
|
+
var CLI_VERSION = true ? "1.79.0" : "1.79.0";
|
|
18602
18602
|
var FLAG_QUIET = false;
|
|
18603
18603
|
var FLAG_VERBOSE = false;
|
|
18604
18604
|
var FLAG_AUTO_ACCEPT = false;
|
|
@@ -21904,7 +21904,8 @@ async function fetchBrainStream(prompt, { onToken, conversationHistory, provider
|
|
|
21904
21904
|
});
|
|
21905
21905
|
if (!response.ok) {
|
|
21906
21906
|
logVerbose("Brain stream returned", response.status);
|
|
21907
|
-
|
|
21907
|
+
const errorHint = response.status === 401 ? "Invalid API key." : response.status === 429 ? "Rate limited. Wait a moment and try again." : response.status >= 500 ? "Brain server error. Try again." : `Brain returned HTTP ${response.status}.`;
|
|
21908
|
+
return { code: "", sources: [], context: {}, validation: null, usage: null, error: errorHint };
|
|
21908
21909
|
}
|
|
21909
21910
|
let fullText = "";
|
|
21910
21911
|
let metadata = null;
|
|
@@ -21964,8 +21965,19 @@ async function fetchBrainStream(prompt, { onToken, conversationHistory, provider
|
|
|
21964
21965
|
usage: doneData?.usage || null
|
|
21965
21966
|
};
|
|
21966
21967
|
} catch (err) {
|
|
21967
|
-
|
|
21968
|
-
|
|
21968
|
+
const msg = err.message || "";
|
|
21969
|
+
logVerbose("Brain stream unreachable:", msg);
|
|
21970
|
+
let errorHint;
|
|
21971
|
+
if (msg.includes("fetch failed") || msg.includes("ENOTFOUND") || msg.includes("ECONNREFUSED") || msg.includes("NetworkError") || msg.includes("getaddrinfo")) {
|
|
21972
|
+
errorHint = "No internet connection. Check your network and try again.";
|
|
21973
|
+
} else if (msg.includes("abort") || msg.includes("timeout") || msg.includes("TimeoutError")) {
|
|
21974
|
+
errorHint = "Request timed out. The server might be slow \u2014 try again.";
|
|
21975
|
+
} else if (msg.includes("CERT") || msg.includes("SSL") || msg.includes("certificate")) {
|
|
21976
|
+
errorHint = "SSL/certificate error. Check your network or proxy settings.";
|
|
21977
|
+
} else {
|
|
21978
|
+
errorHint = `Connection failed: ${msg.slice(0, 100)}`;
|
|
21979
|
+
}
|
|
21980
|
+
return { code: "", sources: [], context: {}, validation: null, usage: null, error: errorHint };
|
|
21969
21981
|
}
|
|
21970
21982
|
}
|
|
21971
21983
|
async function resolveBrainModules(prompt) {
|
|
@@ -23941,9 +23953,20 @@ ${readFileSync9(rpJson, "utf-8")}
|
|
|
23941
23953
|
if (pending.length > 0 && !insideMemory && !insideCmd) {
|
|
23942
23954
|
process.stdout.write(pending);
|
|
23943
23955
|
}
|
|
23944
|
-
if (!brainResult
|
|
23956
|
+
if (!brainResult) {
|
|
23957
|
+
spinner.stop();
|
|
23958
|
+
log(color.red("\n No internet connection. Check your network and try again."));
|
|
23959
|
+
break;
|
|
23960
|
+
}
|
|
23961
|
+
if (brainResult.error) {
|
|
23945
23962
|
spinner.stop();
|
|
23946
|
-
log(color.red(
|
|
23963
|
+
log(color.red(`
|
|
23964
|
+
${brainResult.error}`));
|
|
23965
|
+
break;
|
|
23966
|
+
}
|
|
23967
|
+
if (!brainResult.code) {
|
|
23968
|
+
spinner.stop();
|
|
23969
|
+
log(color.red("\n No response from AI. Try again."));
|
|
23947
23970
|
break;
|
|
23948
23971
|
}
|
|
23949
23972
|
if (brainResult.usage) {
|
|
@@ -24332,8 +24355,16 @@ async function startInkREPL(initialPrompt, resumeSessionId, opts = {}) {
|
|
|
24332
24355
|
cliContext
|
|
24333
24356
|
}
|
|
24334
24357
|
);
|
|
24335
|
-
if (!result
|
|
24336
|
-
finalResponse =
|
|
24358
|
+
if (!result) {
|
|
24359
|
+
finalResponse = "No internet connection. Check your network and try again.";
|
|
24360
|
+
break;
|
|
24361
|
+
}
|
|
24362
|
+
if (result.error) {
|
|
24363
|
+
finalResponse = result.error;
|
|
24364
|
+
break;
|
|
24365
|
+
}
|
|
24366
|
+
if (!result.code) {
|
|
24367
|
+
finalResponse = fullText || "No response from AI. Try again.";
|
|
24337
24368
|
break;
|
|
24338
24369
|
}
|
|
24339
24370
|
if (result.usage) {
|