reasonix 0.5.22 → 0.5.23
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/index.js +32 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +15 -6
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2645,10 +2645,41 @@ function formatLoopError(err) {
|
|
|
2645
2645
|
if (msg.includes("maximum context length")) {
|
|
2646
2646
|
const reqMatch = msg.match(/requested\s+(\d+)\s+tokens/);
|
|
2647
2647
|
const requested = reqMatch ? `${Number(reqMatch[1]).toLocaleString()} tokens` : "too many tokens";
|
|
2648
|
-
return `Context overflow (DeepSeek 400): session history is ${requested}, past the
|
|
2648
|
+
return `Context overflow (DeepSeek 400): session history is ${requested}, past the model's prompt limit (V4: 1M tokens; legacy chat/reasoner: 131k). Usually a single tool result grew too big. Reasonix caps new tool results at 8k tokens and auto-heals oversized history on session load \u2014 a restart often clears it. If it still overflows, run /forget (delete the session) or /clear (drop the displayed history) to start fresh.`;
|
|
2649
|
+
}
|
|
2650
|
+
const m = /^DeepSeek (\d{3}):\s*([\s\S]*)$/.exec(msg);
|
|
2651
|
+
if (!m) return msg;
|
|
2652
|
+
const status = m[1] ?? "";
|
|
2653
|
+
const body = m[2] ?? "";
|
|
2654
|
+
const inner = extractDeepSeekErrorMessage(body);
|
|
2655
|
+
if (status === "401") {
|
|
2656
|
+
return `Authentication failed (DeepSeek 401): ${inner}. Your API key is rejected. Fix with \`reasonix setup\` or \`export DEEPSEEK_API_KEY=sk-...\`. Get one at https://platform.deepseek.com/api_keys.`;
|
|
2657
|
+
}
|
|
2658
|
+
if (status === "402") {
|
|
2659
|
+
return `Out of balance (DeepSeek 402): ${inner}. Top up at https://platform.deepseek.com/top_up \u2014 the panel header shows your balance once it's non-zero.`;
|
|
2660
|
+
}
|
|
2661
|
+
if (status === "422") {
|
|
2662
|
+
return `Invalid parameter (DeepSeek 422): ${inner}`;
|
|
2663
|
+
}
|
|
2664
|
+
if (status === "400") {
|
|
2665
|
+
return `Bad request (DeepSeek 400): ${inner}`;
|
|
2649
2666
|
}
|
|
2650
2667
|
return msg;
|
|
2651
2668
|
}
|
|
2669
|
+
function extractDeepSeekErrorMessage(body) {
|
|
2670
|
+
const trimmed = body.trim();
|
|
2671
|
+
if (!trimmed) return "(no message)";
|
|
2672
|
+
try {
|
|
2673
|
+
const parsed = JSON.parse(trimmed);
|
|
2674
|
+
if (parsed && typeof parsed === "object") {
|
|
2675
|
+
const obj = parsed;
|
|
2676
|
+
if (obj.error && typeof obj.error.message === "string") return obj.error.message;
|
|
2677
|
+
if (typeof obj.message === "string") return obj.message;
|
|
2678
|
+
}
|
|
2679
|
+
} catch {
|
|
2680
|
+
}
|
|
2681
|
+
return trimmed;
|
|
2682
|
+
}
|
|
2652
2683
|
|
|
2653
2684
|
// src/at-mentions.ts
|
|
2654
2685
|
import { existsSync as existsSync4, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|