opencode-feishu 0.7.11 → 0.7.13

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 CHANGED
@@ -99239,17 +99239,26 @@ function extractErrorFields(error) {
99239
99239
  if (typeof error === "string") return [error];
99240
99240
  if (error && typeof error === "object") {
99241
99241
  const e = error;
99242
- const fields = [e.type, e.name, e.message].filter(Boolean).map(String);
99242
+ const explicit = [e.message, e.type, e.name];
99243
+ const enumerable = Object.values(e);
99244
+ const fields = [...explicit, ...enumerable].filter((v) => typeof v === "string" && v.length > 0);
99243
99245
  if (e.data && typeof e.data === "object" && "message" in e.data) {
99244
99246
  const dataMsg = e.data.message;
99245
- if (dataMsg) fields.push(String(dataMsg));
99247
+ if (typeof dataMsg === "string" && dataMsg.length > 0) fields.push(dataMsg);
99246
99248
  }
99247
- return fields;
99249
+ if (e.data && typeof e.data === "object" && "error" in e.data) {
99250
+ const dataErr = e.data.error;
99251
+ if (dataErr && typeof dataErr === "object") {
99252
+ const errStrings = Object.values(dataErr).filter((v) => typeof v === "string" && v.length > 0);
99253
+ fields.push(...errStrings);
99254
+ }
99255
+ }
99256
+ return [...new Set(fields)];
99248
99257
  }
99249
99258
  return [String(error)];
99250
99259
  }
99251
99260
  function isModelError(fields) {
99252
- const patterns = ["model not found", "modelnotfound", "model not supported", "model_not_supported"];
99261
+ const patterns = ["model not found", "modelnotfound", "model not supported", "model_not_supported", "model is not supported"];
99253
99262
  return fields.some((f) => {
99254
99263
  const l = f.toLowerCase();
99255
99264
  return patterns.some((p) => l.includes(p));
@@ -99499,6 +99508,13 @@ async function handleChat(ctx, deps) {
99499
99508
  }
99500
99509
  }
99501
99510
  }
99511
+ if (sessionError) {
99512
+ log("info", "\u9519\u8BEF\u5B57\u6BB5\u68C0\u67E5", {
99513
+ sessionKey,
99514
+ fields: sessionError.fields,
99515
+ isModel: isModelError(sessionError.fields)
99516
+ });
99517
+ }
99502
99518
  if (sessionError && isModelError(sessionError.fields)) {
99503
99519
  const attempts = getRetryAttempts(sessionKey);
99504
99520
  if (attempts < MAX_RETRY_ATTEMPTS) {