@automatalabs/acp-agents 0.24.2 → 0.24.3
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/errors-map.d.ts.map +1 -1
- package/dist/errors-map.js +27 -0
- package/package.json +1 -1
package/dist/errors-map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-map.d.ts","sourceRoot":"","sources":["../src/errors-map.ts"],"names":[],"mappings":"AAYA,OAAO,EAA0C,aAAa,EAAqB,MAAM,4BAA4B,CAAC;AAEtH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAO,MAAM,4BAA4B,SAAS,CAAC;AAQnD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"errors-map.d.ts","sourceRoot":"","sources":["../src/errors-map.ts"],"names":[],"mappings":"AAYA,OAAO,EAA0C,aAAa,EAAqB,MAAM,4BAA4B,CAAC;AAEtH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,eAAO,MAAM,4BAA4B,SAAS,CAAC;AAQnD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CACrC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWhD;AA6BD,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,aAAa,CAsCvG"}
|
package/dist/errors-map.js
CHANGED
|
@@ -18,6 +18,19 @@ export const ACP_AUTH_REQUIRED_ERROR_CODE = -32000;
|
|
|
18
18
|
// jsonrpc.js:818-823) and is matched code-only above the fallback.
|
|
19
19
|
const OTHER_RESERVED = new Set([-32700, -32600, -32601, -32602, -32603, -32800, -32002]);
|
|
20
20
|
export function errorText(error) {
|
|
21
|
+
const base = baseErrorText(error);
|
|
22
|
+
// A JSON-RPC RequestError can carry only a generic channel label in `.message` ("Internal error")
|
|
23
|
+
// while the provider's real text lives in the structured `.data` (codex-acp's usageLimitExceeded
|
|
24
|
+
// wraps the quota/reset text as RequestError.internalError({ message }) => code -32603, message
|
|
25
|
+
// "Internal error", text in `.data.message`). That `.data` is still the ERROR channel — a rejected
|
|
26
|
+
// request's payload, never task output — so fold its `message`/`details` into the classifiable
|
|
27
|
+
// text. Backend-generic: any ACP agent that stuffs detail into `.data` benefits.
|
|
28
|
+
const detail = errorDataText(error);
|
|
29
|
+
if (detail && !base.includes(detail))
|
|
30
|
+
return base ? `${base}: ${detail}` : detail;
|
|
31
|
+
return base;
|
|
32
|
+
}
|
|
33
|
+
function baseErrorText(error) {
|
|
21
34
|
if (error instanceof Error)
|
|
22
35
|
return error.message;
|
|
23
36
|
if (typeof error === "string")
|
|
@@ -35,6 +48,20 @@ export function errorText(error) {
|
|
|
35
48
|
}
|
|
36
49
|
return String(error);
|
|
37
50
|
}
|
|
51
|
+
function errorDataText(error) {
|
|
52
|
+
if (!error || typeof error !== "object")
|
|
53
|
+
return "";
|
|
54
|
+
const data = error.data;
|
|
55
|
+
if (!data || typeof data !== "object")
|
|
56
|
+
return "";
|
|
57
|
+
const parts = [];
|
|
58
|
+
for (const key of ["message", "details"]) {
|
|
59
|
+
const value = data[key];
|
|
60
|
+
if (typeof value === "string" && value.trim())
|
|
61
|
+
parts.push(value.trim());
|
|
62
|
+
}
|
|
63
|
+
return parts.join(": ");
|
|
64
|
+
}
|
|
38
65
|
/** Map any thrown error from the run path onto a seam-level WorkflowError. */
|
|
39
66
|
export function mapThrownError(error, labelOrContext) {
|
|
40
67
|
// Already a seam error (e.g. SCHEMA_NONCOMPLIANCE / AGENT_EMPTY_OUTPUT raised in-band).
|