@ai-matrx/agents 0.43.18 → 0.43.19
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.md +6 -0
- package/dist/content-transfer/index.cjs +26 -10
- package/dist/content-transfer/index.cjs.map +1 -1
- package/dist/content-transfer/index.js +26 -10
- package/dist/content-transfer/index.js.map +1 -1
- package/dist/content-transfer/react/index.cjs +26 -10
- package/dist/content-transfer/react/index.cjs.map +1 -1
- package/dist/content-transfer/react/index.js +26 -10
- package/dist/content-transfer/react/index.js.map +1 -1
- package/dist/index.cjs +75 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +75 -74
- package/dist/index.js.map +1 -1
- package/dist/{keys.generated-BzkXY1sO.d.cts → keys.generated-DX8nj5xZ.d.cts} +4 -4
- package/dist/{keys.generated-BzkXY1sO.d.ts → keys.generated-DX8nj5xZ.d.ts} +4 -4
- package/dist/mandates/index.cjs +2 -2
- package/dist/mandates/index.cjs.map +1 -1
- package/dist/mandates/index.d.cts +2 -2
- package/dist/mandates/index.d.ts +2 -2
- package/dist/mandates/index.js +2 -2
- package/dist/mandates/index.js.map +1 -1
- package/dist/matrx/index.cjs +75 -74
- package/dist/matrx/index.cjs.map +1 -1
- package/dist/matrx/index.d.cts +1 -1
- package/dist/matrx/index.d.ts +1 -1
- package/dist/matrx/index.js +75 -74
- package/dist/matrx/index.js.map +1 -1
- package/dist/portable/index.cjs +26 -10
- package/dist/portable/index.cjs.map +1 -1
- package/dist/portable/index.js +26 -10
- package/dist/portable/index.js.map +1 -1
- package/dist/portable/mcp.cjs +24 -10
- package/dist/portable/mcp.cjs.map +1 -1
- package/dist/portable/mcp.js +24 -10
- package/dist/portable/mcp.js.map +1 -1
- package/dist/react/index.cjs +60 -46
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +60 -46
- package/dist/react/index.js.map +1 -1
- package/mandates/snapshots/keys.0.43.19.json +653 -0
- package/package.json +4 -4
package/dist/react/index.cjs
CHANGED
|
@@ -223,6 +223,55 @@ function projectAgentEvent(current, event) {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
// matrx/backend-errors.ts
|
|
227
|
+
var BackendApiError = class extends Error {
|
|
228
|
+
/** Machine-readable error code */
|
|
229
|
+
code;
|
|
230
|
+
/** Developer-facing detail */
|
|
231
|
+
detail;
|
|
232
|
+
/** Safe to display directly in the UI */
|
|
233
|
+
userMessage;
|
|
234
|
+
/** Extra info (validation errors, etc.) */
|
|
235
|
+
details;
|
|
236
|
+
/** Unique request ID for support/debugging */
|
|
237
|
+
requestId;
|
|
238
|
+
/** HTTP status code (if from an HTTP response) */
|
|
239
|
+
status;
|
|
240
|
+
constructor(data) {
|
|
241
|
+
super(data.userMessage);
|
|
242
|
+
this.name = "BackendApiError";
|
|
243
|
+
this.code = data.code;
|
|
244
|
+
this.detail = data.detail;
|
|
245
|
+
this.userMessage = data.userMessage;
|
|
246
|
+
this.details = data.details ?? null;
|
|
247
|
+
this.requestId = data.requestId ?? "";
|
|
248
|
+
this.status = data.status ?? null;
|
|
249
|
+
}
|
|
250
|
+
/** Convert to the wire format for logging */
|
|
251
|
+
toJSON() {
|
|
252
|
+
return {
|
|
253
|
+
error: this.code,
|
|
254
|
+
message: this.detail,
|
|
255
|
+
user_message: this.userMessage,
|
|
256
|
+
details: this.details,
|
|
257
|
+
request_id: this.requestId
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var GENERIC_MESSAGE_PATTERNS = [
|
|
262
|
+
/failed unexpectedly/i,
|
|
263
|
+
/^\s*something went wrong/i,
|
|
264
|
+
/please try again(\s+later)?\.?\s*$/i,
|
|
265
|
+
/^\s*request failed\b/i,
|
|
266
|
+
/^\s*unknown (streaming )?error/i,
|
|
267
|
+
/^\s*internal server error\.?\s*$/i
|
|
268
|
+
];
|
|
269
|
+
function isGenericUserMessage(message) {
|
|
270
|
+
const value = (message ?? "").trim();
|
|
271
|
+
if (!value) return true;
|
|
272
|
+
return GENERIC_MESSAGE_PATTERNS.some((pattern) => pattern.test(value));
|
|
273
|
+
}
|
|
274
|
+
|
|
226
275
|
// matrx/transport.ts
|
|
227
276
|
var MatrxApiError = class extends Error {
|
|
228
277
|
name = "MatrxApiError";
|
|
@@ -252,10 +301,12 @@ function nonBlankString(value) {
|
|
|
252
301
|
}
|
|
253
302
|
function extractMatrxErrorMessage(serverDetail) {
|
|
254
303
|
if (!isRecord(serverDetail)) return void 0;
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
304
|
+
const candidates = [];
|
|
305
|
+
const push = (value) => {
|
|
306
|
+
if (value) candidates.push(value);
|
|
307
|
+
};
|
|
308
|
+
push(nonBlankString(serverDetail.user_message));
|
|
309
|
+
push(nonBlankString(serverDetail.message));
|
|
259
310
|
if (Array.isArray(serverDetail.details)) {
|
|
260
311
|
const messages = serverDetail.details.map((entry) => {
|
|
261
312
|
if (!isRecord(entry)) return void 0;
|
|
@@ -264,21 +315,20 @@ function extractMatrxErrorMessage(serverDetail) {
|
|
|
264
315
|
const field = nonBlankString(entry.field);
|
|
265
316
|
return field ? `${field}: ${detailMessage}` : detailMessage;
|
|
266
317
|
}).filter((m) => typeof m === "string");
|
|
267
|
-
if (messages.length > 0)
|
|
318
|
+
if (messages.length > 0) push(messages.join("; "));
|
|
268
319
|
}
|
|
269
320
|
const detail = serverDetail.detail;
|
|
270
321
|
if (isRecord(detail)) {
|
|
271
|
-
|
|
272
|
-
if (detailMessage) return detailMessage;
|
|
322
|
+
push(nonBlankString(detail.message) ?? nonBlankString(detail.user_message));
|
|
273
323
|
}
|
|
274
|
-
if (typeof detail === "string" && detail.trim())
|
|
324
|
+
if (typeof detail === "string" && detail.trim()) push(detail);
|
|
275
325
|
if (Array.isArray(detail)) {
|
|
276
326
|
const messages = detail.map(
|
|
277
327
|
(entry) => isRecord(entry) ? nonBlankString(entry.msg) : void 0
|
|
278
328
|
).filter((m) => typeof m === "string");
|
|
279
|
-
if (messages.length > 0)
|
|
329
|
+
if (messages.length > 0) push(messages.join("; "));
|
|
280
330
|
}
|
|
281
|
-
return
|
|
331
|
+
return candidates.find((c) => !isGenericUserMessage(c)) ?? candidates[0];
|
|
282
332
|
}
|
|
283
333
|
function extractMatrxErrorCode(serverDetail) {
|
|
284
334
|
if (!isRecord(serverDetail)) return null;
|
|
@@ -297,42 +347,6 @@ var import_data = require("@ai-matrx/data");
|
|
|
297
347
|
var import_data2 = require("@ai-matrx/data");
|
|
298
348
|
var import_net = require("@ai-matrx/data/net");
|
|
299
349
|
|
|
300
|
-
// matrx/backend-errors.ts
|
|
301
|
-
var BackendApiError = class extends Error {
|
|
302
|
-
/** Machine-readable error code */
|
|
303
|
-
code;
|
|
304
|
-
/** Developer-facing detail */
|
|
305
|
-
detail;
|
|
306
|
-
/** Safe to display directly in the UI */
|
|
307
|
-
userMessage;
|
|
308
|
-
/** Extra info (validation errors, etc.) */
|
|
309
|
-
details;
|
|
310
|
-
/** Unique request ID for support/debugging */
|
|
311
|
-
requestId;
|
|
312
|
-
/** HTTP status code (if from an HTTP response) */
|
|
313
|
-
status;
|
|
314
|
-
constructor(data) {
|
|
315
|
-
super(data.userMessage);
|
|
316
|
-
this.name = "BackendApiError";
|
|
317
|
-
this.code = data.code;
|
|
318
|
-
this.detail = data.detail;
|
|
319
|
-
this.userMessage = data.userMessage;
|
|
320
|
-
this.details = data.details ?? null;
|
|
321
|
-
this.requestId = data.requestId ?? "";
|
|
322
|
-
this.status = data.status ?? null;
|
|
323
|
-
}
|
|
324
|
-
/** Convert to the wire format for logging */
|
|
325
|
-
toJSON() {
|
|
326
|
-
return {
|
|
327
|
-
error: this.code,
|
|
328
|
-
message: this.detail,
|
|
329
|
-
user_message: this.userMessage,
|
|
330
|
-
details: this.details,
|
|
331
|
-
request_id: this.requestId
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
|
|
336
350
|
// stream/ndjson.ts
|
|
337
351
|
var DEFAULT_MATRX_NDJSON_READ_AHEAD = 64;
|
|
338
352
|
function isRecord2(value) {
|