@ai-matrx/agents 0.43.18 → 0.43.20
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 +13 -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/generated/api-types.cjs.map +1 -1
- package/dist/generated/api-types.d.cts +16 -0
- package/dist/generated/api-types.d.ts +16 -0
- 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-BuyboLUH.d.cts} +4 -4
- package/dist/{keys.generated-BzkXY1sO.d.ts → keys.generated-BuyboLUH.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/generated/api-types.ts +16 -0
- package/mandates/snapshots/keys.0.43.19.json +653 -0
- package/mandates/snapshots/keys.0.43.20.json +653 -0
- package/package.json +3 -3
package/dist/react/index.js
CHANGED
|
@@ -197,6 +197,55 @@ function projectAgentEvent(current, event) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
// matrx/backend-errors.ts
|
|
201
|
+
var BackendApiError = class extends Error {
|
|
202
|
+
/** Machine-readable error code */
|
|
203
|
+
code;
|
|
204
|
+
/** Developer-facing detail */
|
|
205
|
+
detail;
|
|
206
|
+
/** Safe to display directly in the UI */
|
|
207
|
+
userMessage;
|
|
208
|
+
/** Extra info (validation errors, etc.) */
|
|
209
|
+
details;
|
|
210
|
+
/** Unique request ID for support/debugging */
|
|
211
|
+
requestId;
|
|
212
|
+
/** HTTP status code (if from an HTTP response) */
|
|
213
|
+
status;
|
|
214
|
+
constructor(data) {
|
|
215
|
+
super(data.userMessage);
|
|
216
|
+
this.name = "BackendApiError";
|
|
217
|
+
this.code = data.code;
|
|
218
|
+
this.detail = data.detail;
|
|
219
|
+
this.userMessage = data.userMessage;
|
|
220
|
+
this.details = data.details ?? null;
|
|
221
|
+
this.requestId = data.requestId ?? "";
|
|
222
|
+
this.status = data.status ?? null;
|
|
223
|
+
}
|
|
224
|
+
/** Convert to the wire format for logging */
|
|
225
|
+
toJSON() {
|
|
226
|
+
return {
|
|
227
|
+
error: this.code,
|
|
228
|
+
message: this.detail,
|
|
229
|
+
user_message: this.userMessage,
|
|
230
|
+
details: this.details,
|
|
231
|
+
request_id: this.requestId
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
var GENERIC_MESSAGE_PATTERNS = [
|
|
236
|
+
/failed unexpectedly/i,
|
|
237
|
+
/^\s*something went wrong/i,
|
|
238
|
+
/please try again(\s+later)?\.?\s*$/i,
|
|
239
|
+
/^\s*request failed\b/i,
|
|
240
|
+
/^\s*unknown (streaming )?error/i,
|
|
241
|
+
/^\s*internal server error\.?\s*$/i
|
|
242
|
+
];
|
|
243
|
+
function isGenericUserMessage(message) {
|
|
244
|
+
const value = (message ?? "").trim();
|
|
245
|
+
if (!value) return true;
|
|
246
|
+
return GENERIC_MESSAGE_PATTERNS.some((pattern) => pattern.test(value));
|
|
247
|
+
}
|
|
248
|
+
|
|
200
249
|
// matrx/transport.ts
|
|
201
250
|
var MatrxApiError = class extends Error {
|
|
202
251
|
name = "MatrxApiError";
|
|
@@ -226,10 +275,12 @@ function nonBlankString(value) {
|
|
|
226
275
|
}
|
|
227
276
|
function extractMatrxErrorMessage(serverDetail) {
|
|
228
277
|
if (!isRecord(serverDetail)) return void 0;
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
278
|
+
const candidates = [];
|
|
279
|
+
const push = (value) => {
|
|
280
|
+
if (value) candidates.push(value);
|
|
281
|
+
};
|
|
282
|
+
push(nonBlankString(serverDetail.user_message));
|
|
283
|
+
push(nonBlankString(serverDetail.message));
|
|
233
284
|
if (Array.isArray(serverDetail.details)) {
|
|
234
285
|
const messages = serverDetail.details.map((entry) => {
|
|
235
286
|
if (!isRecord(entry)) return void 0;
|
|
@@ -238,21 +289,20 @@ function extractMatrxErrorMessage(serverDetail) {
|
|
|
238
289
|
const field = nonBlankString(entry.field);
|
|
239
290
|
return field ? `${field}: ${detailMessage}` : detailMessage;
|
|
240
291
|
}).filter((m) => typeof m === "string");
|
|
241
|
-
if (messages.length > 0)
|
|
292
|
+
if (messages.length > 0) push(messages.join("; "));
|
|
242
293
|
}
|
|
243
294
|
const detail = serverDetail.detail;
|
|
244
295
|
if (isRecord(detail)) {
|
|
245
|
-
|
|
246
|
-
if (detailMessage) return detailMessage;
|
|
296
|
+
push(nonBlankString(detail.message) ?? nonBlankString(detail.user_message));
|
|
247
297
|
}
|
|
248
|
-
if (typeof detail === "string" && detail.trim())
|
|
298
|
+
if (typeof detail === "string" && detail.trim()) push(detail);
|
|
249
299
|
if (Array.isArray(detail)) {
|
|
250
300
|
const messages = detail.map(
|
|
251
301
|
(entry) => isRecord(entry) ? nonBlankString(entry.msg) : void 0
|
|
252
302
|
).filter((m) => typeof m === "string");
|
|
253
|
-
if (messages.length > 0)
|
|
303
|
+
if (messages.length > 0) push(messages.join("; "));
|
|
254
304
|
}
|
|
255
|
-
return
|
|
305
|
+
return candidates.find((c) => !isGenericUserMessage(c)) ?? candidates[0];
|
|
256
306
|
}
|
|
257
307
|
function extractMatrxErrorCode(serverDetail) {
|
|
258
308
|
if (!isRecord(serverDetail)) return null;
|
|
@@ -271,42 +321,6 @@ import { isNetError } from "@ai-matrx/data";
|
|
|
271
321
|
import { credentialToHeaders } from "@ai-matrx/data";
|
|
272
322
|
import { extractErrorMessage } from "@ai-matrx/data/net";
|
|
273
323
|
|
|
274
|
-
// matrx/backend-errors.ts
|
|
275
|
-
var BackendApiError = class extends Error {
|
|
276
|
-
/** Machine-readable error code */
|
|
277
|
-
code;
|
|
278
|
-
/** Developer-facing detail */
|
|
279
|
-
detail;
|
|
280
|
-
/** Safe to display directly in the UI */
|
|
281
|
-
userMessage;
|
|
282
|
-
/** Extra info (validation errors, etc.) */
|
|
283
|
-
details;
|
|
284
|
-
/** Unique request ID for support/debugging */
|
|
285
|
-
requestId;
|
|
286
|
-
/** HTTP status code (if from an HTTP response) */
|
|
287
|
-
status;
|
|
288
|
-
constructor(data) {
|
|
289
|
-
super(data.userMessage);
|
|
290
|
-
this.name = "BackendApiError";
|
|
291
|
-
this.code = data.code;
|
|
292
|
-
this.detail = data.detail;
|
|
293
|
-
this.userMessage = data.userMessage;
|
|
294
|
-
this.details = data.details ?? null;
|
|
295
|
-
this.requestId = data.requestId ?? "";
|
|
296
|
-
this.status = data.status ?? null;
|
|
297
|
-
}
|
|
298
|
-
/** Convert to the wire format for logging */
|
|
299
|
-
toJSON() {
|
|
300
|
-
return {
|
|
301
|
-
error: this.code,
|
|
302
|
-
message: this.detail,
|
|
303
|
-
user_message: this.userMessage,
|
|
304
|
-
details: this.details,
|
|
305
|
-
request_id: this.requestId
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
324
|
// stream/ndjson.ts
|
|
311
325
|
var DEFAULT_MATRX_NDJSON_READ_AHEAD = 64;
|
|
312
326
|
function isRecord2(value) {
|