opencode-feishu 0.7.12 → 0.7.14
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/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99238,23 +99238,41 @@ function unregisterPending(sessionId) {
|
|
|
99238
99238
|
function extractErrorFields(error) {
|
|
99239
99239
|
if (typeof error === "string") return [error];
|
|
99240
99240
|
if (error && typeof error === "object") {
|
|
99241
|
-
const
|
|
99242
|
-
|
|
99243
|
-
const enumerable = Object.values(e);
|
|
99244
|
-
const fields = [...explicit, ...enumerable].filter((v) => typeof v === "string" && v.length > 0);
|
|
99245
|
-
if (e.data && typeof e.data === "object" && "message" in e.data) {
|
|
99246
|
-
const dataMsg = e.data.message;
|
|
99247
|
-
if (typeof dataMsg === "string" && dataMsg.length > 0) fields.push(dataMsg);
|
|
99248
|
-
}
|
|
99241
|
+
const fields = [];
|
|
99242
|
+
collectStrings(error, fields, 3);
|
|
99249
99243
|
return [...new Set(fields)];
|
|
99250
99244
|
}
|
|
99251
99245
|
return [String(error)];
|
|
99252
99246
|
}
|
|
99247
|
+
function collectStrings(obj, out, maxDepth) {
|
|
99248
|
+
if (maxDepth <= 0 || !obj || typeof obj !== "object") return;
|
|
99249
|
+
const e = obj;
|
|
99250
|
+
for (const key of ["message", "type", "name"]) {
|
|
99251
|
+
const v = e[key];
|
|
99252
|
+
if (typeof v === "string" && v.length > 0) out.push(v);
|
|
99253
|
+
}
|
|
99254
|
+
for (const v of Object.values(e)) {
|
|
99255
|
+
if (typeof v === "string" && v.length > 0) out.push(v);
|
|
99256
|
+
else if (Array.isArray(v)) {
|
|
99257
|
+
for (const item of v) collectStrings(item, out, maxDepth - 1);
|
|
99258
|
+
} else if (v && typeof v === "object") collectStrings(v, out, maxDepth - 1);
|
|
99259
|
+
}
|
|
99260
|
+
}
|
|
99253
99261
|
function isModelError(fields) {
|
|
99254
|
-
const
|
|
99262
|
+
const exactPatterns = [
|
|
99263
|
+
"model not found",
|
|
99264
|
+
"modelnotfound",
|
|
99265
|
+
"model_not_found",
|
|
99266
|
+
"model not supported",
|
|
99267
|
+
"model_not_supported",
|
|
99268
|
+
"model is not supported"
|
|
99269
|
+
];
|
|
99270
|
+
const negativeWords = ["not", "unsupported", "invalid", "unavailable", "unknown", "does not", "doesn't", "cannot", "\u4E0D\u652F\u6301", "\u4E0D\u5B58\u5728", "\u65E0\u6548"];
|
|
99255
99271
|
return fields.some((f) => {
|
|
99256
99272
|
const l = f.toLowerCase();
|
|
99257
|
-
|
|
99273
|
+
if (exactPatterns.some((p) => l.includes(p))) return true;
|
|
99274
|
+
if (l.includes("model") && negativeWords.some((w) => l.includes(w))) return true;
|
|
99275
|
+
return false;
|
|
99258
99276
|
});
|
|
99259
99277
|
}
|
|
99260
99278
|
async function handleEvent(event, deps) {
|