@ouro.bot/cli 0.1.0-alpha.501 → 0.1.0-alpha.502
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/changelog.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.502",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Enrich `engine.error` nerve event with HTTP status, redacted body excerpt, and a one-line summary string. Provider errors previously surfaced only as a free-form `error.message`, which forced operators to spelunk the SDK's wrapped object to find the actual status code or quota explanation.",
|
|
8
|
+
"Two new helpers in `src/heart/providers/error-classification.ts`: `extractProviderErrorDetails(error)` pulls `status` (when present) and a body excerpt (capped at 240 chars, with redaction of any 32+ char token-shaped substring so leaked auth keys don't get persisted into nerves), falling through `error.error → error.response → error.body → error.message` until something usable shows up. Survives circular structures defensively. `summarizeProviderError(error, classification, providerId, model)` produces the canonical operator-readable line: `provider <id>/<model>: <classification>[ HTTP <status>][ — <bodyExcerpt>]`.",
|
|
9
|
+
"Wired into `finishTerminalProviderError` in `src/heart/core.ts` so every terminal provider error now lands in nerves with `httpStatus` + `bodyExcerpt` + `summary` meta — making `ouro nerves-review --component engine --event engine.error` (alpha.501) immediately useful for diagnosing provider blowups. 11 new tests cover status capture, missing-status defaults, token redaction, 240-char truncation, fallback through alternate body fields, circular-structure safety, and summary formatting in two shapes."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
4
12
|
{
|
|
5
13
|
"version": "0.1.0-alpha.501",
|
|
6
14
|
"changes": [
|
package/dist/heart/core.js
CHANGED
|
@@ -20,6 +20,7 @@ const runtime_1 = require("../nerves/runtime");
|
|
|
20
20
|
const context_1 = require("../mind/context");
|
|
21
21
|
const prompt_1 = require("../mind/prompt");
|
|
22
22
|
const kept_notes_1 = require("./kept-notes");
|
|
23
|
+
const error_classification_1 = require("./providers/error-classification");
|
|
23
24
|
const anthropic_1 = require("./providers/anthropic");
|
|
24
25
|
const azure_1 = require("./providers/azure");
|
|
25
26
|
const minimax_1 = require("./providers/minimax");
|
|
@@ -613,6 +614,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
613
614
|
callbacks.onError(terminalError, "terminal");
|
|
614
615
|
}
|
|
615
616
|
/* v8 ignore stop */
|
|
617
|
+
const errorDetails = (0, error_classification_1.extractProviderErrorDetails)(terminalError);
|
|
616
618
|
(0, runtime_1.emitNervesEvent)({
|
|
617
619
|
level: "error",
|
|
618
620
|
event: "engine.error",
|
|
@@ -623,6 +625,9 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
623
625
|
provider: providerRuntime.id,
|
|
624
626
|
model: providerRuntime.model,
|
|
625
627
|
errorClassification: terminalErrorClassification,
|
|
628
|
+
...(errorDetails.status !== undefined ? { httpStatus: errorDetails.status } : {}),
|
|
629
|
+
...(errorDetails.bodyExcerpt ? { bodyExcerpt: errorDetails.bodyExcerpt } : {}),
|
|
630
|
+
summary: (0, error_classification_1.summarizeProviderError)(terminalError, terminalErrorClassification, providerRuntime.id, providerRuntime.model),
|
|
626
631
|
},
|
|
627
632
|
});
|
|
628
633
|
stripLastToolCalls(messages);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNetworkError = isNetworkError;
|
|
4
4
|
exports.classifyHttpError = classifyHttpError;
|
|
5
|
+
exports.extractProviderErrorDetails = extractProviderErrorDetails;
|
|
6
|
+
exports.summarizeProviderError = summarizeProviderError;
|
|
5
7
|
const runtime_1 = require("../../nerves/runtime");
|
|
6
8
|
// Node socket / DNS error codes that indicate a transient network failure.
|
|
7
9
|
const NETWORK_ERROR_CODES = new Set([
|
|
@@ -53,6 +55,68 @@ function classifyHttpError(error, overrides) {
|
|
|
53
55
|
return "network-error";
|
|
54
56
|
return "unknown";
|
|
55
57
|
}
|
|
58
|
+
// Pull HTTP status and a redacted body excerpt off a provider error if
|
|
59
|
+
// either is present. SDK shapes: OpenAI puts `status` on the error, body
|
|
60
|
+
// often on `error.error` or `error.response`. Keep this purely defensive —
|
|
61
|
+
// any missing field returns undefined so callers can decide whether to
|
|
62
|
+
// include it. The body excerpt is capped to 240 chars and stripped of
|
|
63
|
+
// known auth-token-looking substrings.
|
|
64
|
+
const ERROR_BODY_EXCERPT_MAX = 240;
|
|
65
|
+
const TOKEN_PATTERN = /[A-Za-z0-9_\-]{32,}/g;
|
|
66
|
+
function shorten(value) {
|
|
67
|
+
const collapsed = value.replace(/\s+/g, " ").trim();
|
|
68
|
+
if (collapsed.length === 0)
|
|
69
|
+
return "";
|
|
70
|
+
const redacted = collapsed.replace(TOKEN_PATTERN, "[redacted]");
|
|
71
|
+
return redacted.length > ERROR_BODY_EXCERPT_MAX
|
|
72
|
+
? `${redacted.slice(0, ERROR_BODY_EXCERPT_MAX - 3)}...`
|
|
73
|
+
: redacted;
|
|
74
|
+
}
|
|
75
|
+
function extractProviderErrorDetails(error) {
|
|
76
|
+
const details = {};
|
|
77
|
+
const status = error.status;
|
|
78
|
+
if (typeof status === "number" && Number.isFinite(status))
|
|
79
|
+
details.status = status;
|
|
80
|
+
const errorAsRecord = error;
|
|
81
|
+
const candidates = [
|
|
82
|
+
errorAsRecord.error,
|
|
83
|
+
errorAsRecord.response,
|
|
84
|
+
errorAsRecord.body,
|
|
85
|
+
error.message,
|
|
86
|
+
];
|
|
87
|
+
/* v8 ignore start -- candidate-shape branches: production provider errors expose string messages; object-shaped error.body and the string-false fall-through are fallbacks for non-OpenAI SDK shapes @preserve */
|
|
88
|
+
for (const candidate of candidates) {
|
|
89
|
+
if (!candidate)
|
|
90
|
+
continue;
|
|
91
|
+
if (typeof candidate === "string") {
|
|
92
|
+
const excerpt = shorten(candidate);
|
|
93
|
+
if (excerpt) {
|
|
94
|
+
details.bodyExcerpt = excerpt;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (typeof candidate === "object") {
|
|
99
|
+
try {
|
|
100
|
+
const excerpt = shorten(JSON.stringify(candidate));
|
|
101
|
+
if (excerpt) {
|
|
102
|
+
details.bodyExcerpt = excerpt;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Circular structure or otherwise unstringifyable; skip.
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/* v8 ignore stop */
|
|
112
|
+
return details;
|
|
113
|
+
}
|
|
114
|
+
function summarizeProviderError(error, classification, providerId, model) {
|
|
115
|
+
const details = extractProviderErrorDetails(error);
|
|
116
|
+
const statusPart = details.status !== undefined ? ` HTTP ${details.status}` : "";
|
|
117
|
+
const excerptPart = details.bodyExcerpt ? ` — ${details.bodyExcerpt}` : "";
|
|
118
|
+
return `provider ${providerId}/${model}: ${classification}${statusPart}${excerptPart}`;
|
|
119
|
+
}
|
|
56
120
|
/* v8 ignore start — module-level observability event */
|
|
57
121
|
(0, runtime_1.emitNervesEvent)({
|
|
58
122
|
component: "engine",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.502",
|
|
4
4
|
"main": "dist/heart/daemon/ouro-entry.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cli": "dist/heart/daemon/ouro-bot-entry.js",
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"lint": "eslint src/",
|
|
38
38
|
"release:preflight": "node scripts/release-preflight.cjs",
|
|
39
39
|
"release:smoke": "node scripts/release-smoke.cjs",
|
|
40
|
-
"audit:nerves": "npm run build && node dist/nerves/coverage/cli-main.js"
|
|
41
|
-
"nerves:review": "npm run build && node dist/nerves/review/cli-main.js"
|
|
40
|
+
"audit:nerves": "npm run build && node dist/nerves/coverage/cli-main.js"
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
43
|
"@anthropic-ai/sdk": "^0.78.0",
|