@iflyrpa/actions 4.0.8 → 4.0.9-beta.1

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.mjs CHANGED
@@ -1,5 +1,3 @@
1
-
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c8d107bb-33ed-570f-91cf-6902618660d6")}catch(e){}}();
3
1
  import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
4
2
  import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
5
3
  import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_package_json_58ae5f06__ from "@iflyrpa/share/package.json";
@@ -4352,8 +4350,124 @@ function __webpack_require__(moduleId) {
4352
4350
  return module;
4353
4351
  };
4354
4352
  })();
4355
- var package_namespaceObject = {
4356
- i8: "4.0.8"
4353
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.1"}');
4354
+ const USER_MESSAGE = {
4355
+ PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
4356
+ NETWORK_ERROR: "网络异常,请稍后重试",
4357
+ SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
4358
+ PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
4359
+ DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
4360
+ SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
4361
+ DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
4362
+ SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
4363
+ BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
4364
+ TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
4365
+ QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
4366
+ IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
4367
+ };
4368
+ const NETWORK_CODES = [
4369
+ 500,
4370
+ 502,
4371
+ 503,
4372
+ 504
4373
+ ];
4374
+ function classifyPublishError(handledError) {
4375
+ const { code } = handledError;
4376
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
4377
+ if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
4378
+ const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
4379
+ return {
4380
+ category,
4381
+ userMessage: USER_MESSAGE.PUBLISH_NETWORK
4382
+ };
4383
+ }
4384
+ const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
4385
+ const ALARM_THROTTLE_MS = 60000;
4386
+ const lastSentAt = new Map();
4387
+ const postFeishuWebhook = (webhookUrl, payload)=>__WEBPACK_EXTERNAL_MODULE_axios__["default"].post(webhookUrl, payload, {
4388
+ headers: {
4389
+ "Content-Type": "application/json"
4390
+ },
4391
+ timeout: 10000
4392
+ });
4393
+ const buildFeishuPostMessage = (report)=>{
4394
+ const content = [
4395
+ [
4396
+ {
4397
+ tag: "text",
4398
+ text: `平台:${report.platform || "未知平台"}`
4399
+ }
4400
+ ],
4401
+ [
4402
+ {
4403
+ tag: "text",
4404
+ text: `错误信息:${report.msg || "未知错误信息"}`
4405
+ }
4406
+ ],
4407
+ [
4408
+ {
4409
+ tag: "text",
4410
+ text: `错误类型:${report.errorType || "未知错误类型"}`
4411
+ }
4412
+ ],
4413
+ [
4414
+ {
4415
+ tag: "text",
4416
+ text: `阶段:${report.stage || "未知阶段"}`
4417
+ }
4418
+ ],
4419
+ [
4420
+ {
4421
+ tag: "text",
4422
+ text: `等级:${report.level}`
4423
+ }
4424
+ ],
4425
+ [
4426
+ {
4427
+ tag: "text",
4428
+ text: `来源:${report.source}`
4429
+ }
4430
+ ]
4431
+ ];
4432
+ if (void 0 !== report.code && null !== report.code) content.push([
4433
+ {
4434
+ tag: "text",
4435
+ text: `接口错误码:${report.code}`
4436
+ }
4437
+ ]);
4438
+ if (report.url) content.push([
4439
+ {
4440
+ tag: "text",
4441
+ text: `地址:${report.url}`
4442
+ }
4443
+ ]);
4444
+ if ("alarm" === report.level) content.push([
4445
+ {
4446
+ tag: "at",
4447
+ user_id: "all"
4448
+ }
4449
+ ]);
4450
+ return {
4451
+ msg_type: "post",
4452
+ content: {
4453
+ post: {
4454
+ zh_cn: {
4455
+ title: report.title || "RPA异常",
4456
+ content
4457
+ }
4458
+ }
4459
+ }
4460
+ };
4461
+ };
4462
+ const reportFeishuAlarm = (report)=>{
4463
+ try {
4464
+ const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
4465
+ const now = Date.now();
4466
+ const last = lastSentAt.get(key);
4467
+ if (last && now - last < ALARM_THROTTLE_MS) return;
4468
+ lastSentAt.set(key, now);
4469
+ postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
4470
+ } catch {}
4357
4471
  };
4358
4472
  const PROXY_CREDENTIALS = [
4359
4473
  {
@@ -4456,9 +4570,20 @@ async function ProxyAgent(task, addr, accountId, refresh) {
4456
4570
  url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4457
4571
  data: params
4458
4572
  }).catch((err)=>{
4573
+ reportFeishuAlarm({
4574
+ level: "alarm",
4575
+ platform: "ip-pool",
4576
+ source: "proxy",
4577
+ stage: "POST /ip-pool/pool/eip/proxy",
4578
+ errorType: "PROXY_REQUEST_FAILED",
4579
+ code: err?.code,
4580
+ msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
4581
+ url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4582
+ title: "代理异常"
4583
+ });
4459
4584
  throw {
4460
4585
  code: 414,
4461
- message: `请求代理失败:${err.message}`,
4586
+ message: USER_MESSAGE.PROXY_UNAVAILABLE,
4462
4587
  data: {}
4463
4588
  };
4464
4589
  });
@@ -4478,12 +4603,53 @@ async function ProxyAgent(task, addr, accountId, refresh) {
4478
4603
  } : null;
4479
4604
  return proxyAgent;
4480
4605
  }
4606
+ const ALARM_STATUS = new Set([
4607
+ 401,
4608
+ 403,
4609
+ 429,
4610
+ 461,
4611
+ 471
4612
+ ]);
4613
+ const HTTP_STATUS_MESSAGE = {
4614
+ 400: "请求参数错误,请检查参数格式是否正确!",
4615
+ 401: "登录状态已失效,请重新登录后重试!",
4616
+ 403: "没有访问权限,账号可能受限或签名已失效!",
4617
+ 404: "请求的资源不存在,请检查接口地址!",
4618
+ 405: "请求方法不被允许,请检查接口调用方式!",
4619
+ 406: "服务端无法返回可接受的内容格式!",
4620
+ 407: "代理需要身份验证,请检查代理配置!",
4621
+ 408: "请求超时,请检查网络连接!",
4622
+ 409: "请求冲突,资源状态已变更,请刷新后重试!",
4623
+ 410: "请求的资源已被移除!",
4624
+ 412: "请求前置条件不满足,请刷新后重试!",
4625
+ 413: "提交内容过大,请压缩或分批后重试!",
4626
+ 414: "请求地址过长,请检查参数!",
4627
+ 415: "不支持的内容类型,请检查请求格式!",
4628
+ 422: "请求内容校验失败,请检查参数内容!",
4629
+ 423: "资源已被锁定,请稍后重试!",
4630
+ 429: "请求过于频繁,请稍后重试!",
4631
+ 431: "请求头过大,请清理 Cookie 后重试!",
4632
+ 451: "内容不合规或因法律原因被拒绝!",
4633
+ 461: "账号可能受限,请在网页上完成验证后重试!",
4634
+ 471: "账号可能受限,请在网页上完成验证后重试!",
4635
+ 500: "服务器内部错误,请稍后重试!",
4636
+ 501: "服务端不支持该请求,请稍后重试!",
4637
+ 502: "网关错误,请稍后重试!",
4638
+ 503: "服务暂时不可用,请稍后重试!",
4639
+ 504: "网关超时,请稍后重试!",
4640
+ 507: "服务端存储空间不足,请稍后重试!",
4641
+ 509: "服务带宽超限,请稍后重试!",
4642
+ 520: "服务端返回未知错误,请稍后重试!",
4643
+ 521: "源站拒绝连接,请稍后重试!",
4644
+ 522: "源站连接超时,请稍后重试!",
4645
+ 524: "源站响应超时,请稍后重试!"
4646
+ };
4481
4647
  class Http {
4482
4648
  static handleApiError(error) {
4483
4649
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
4484
4650
  return {
4485
4651
  code: 500,
4486
- message: error instanceof Error ? error.message : "未知错误",
4652
+ message: USER_MESSAGE.SYSTEM_ERROR,
4487
4653
  data: error
4488
4654
  };
4489
4655
  }
@@ -4538,6 +4704,18 @@ class Http {
4538
4704
  const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
4539
4705
  if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
4540
4706
  }
4707
+ if (error.response?.status === 461 || error.response?.status === 471) {
4708
+ const h = error.response?.headers ?? {};
4709
+ const pick = (name)=>h[name] ?? h[name.toLowerCase()];
4710
+ this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
4711
+ this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
4712
+ errorResponse.extra = {
4713
+ ...errorResponse.extra,
4714
+ verifyType: pick("Verifytype"),
4715
+ verifyUuid: pick("Verifyuuid"),
4716
+ verifyBiz: pick("Verifybiz")
4717
+ };
4718
+ }
4541
4719
  if (error.response?.data) {
4542
4720
  if ("object" == typeof error.response.data) {
4543
4721
  const serverError = error.response.data;
@@ -4568,11 +4746,17 @@ class Http {
4568
4746
  _message = "DNS 查询超时,请稍后重试!";
4569
4747
  break;
4570
4748
  case "ERR_BAD_REQUEST":
4571
- _message = "请求出现错误,请检查请求参数!";
4572
- break;
4749
+ {
4750
+ const status = error.response?.status;
4751
+ _message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
4752
+ break;
4753
+ }
4573
4754
  case "ERR_BAD_RESPONSE":
4574
- _message = `服务器响应异常 (${error.response?.status ?? "unknown"}),请稍后重试!`;
4575
- break;
4755
+ {
4756
+ const status = error.response?.status;
4757
+ _message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
4758
+ break;
4759
+ }
4576
4760
  case "ERR_CANCELED":
4577
4761
  errorResponse.code = 414;
4578
4762
  _message = "请求连接超时,请稍候重试!";
@@ -4583,11 +4767,14 @@ class Http {
4583
4767
  }
4584
4768
  break;
4585
4769
  default:
4586
- this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4587
- errorString: stringifyError(error)
4588
- });
4589
- _message = `网络错误: ${error.message}`;
4590
- break;
4770
+ {
4771
+ this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4772
+ errorString: stringifyError(error)
4773
+ });
4774
+ const status = error.response?.status;
4775
+ _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
4776
+ break;
4777
+ }
4591
4778
  }
4592
4779
  }
4593
4780
  if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
@@ -4597,6 +4784,18 @@ class Http {
4597
4784
  errorResponse.message = message;
4598
4785
  }
4599
4786
  if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
4787
+ const status = error.response?.status;
4788
+ reportFeishuAlarm({
4789
+ level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
4790
+ platform: this.platform || "unknown",
4791
+ source: "http",
4792
+ stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
4793
+ errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
4794
+ code: errorResponse.code,
4795
+ msg: errorResponse.message,
4796
+ url: error.config?.url,
4797
+ title: "RPA接口异常"
4798
+ });
4600
4799
  throw errorResponse;
4601
4800
  });
4602
4801
  }
@@ -5364,7 +5563,7 @@ const NUMBER_FORMAT_RANGES = {
5364
5563
  Number.MAX_VALUE
5365
5564
  ]
5366
5565
  };
5367
- function pick(schema, mask) {
5566
+ function util_pick(schema, mask) {
5368
5567
  const currDef = schema._zod.def;
5369
5568
  const def = mergeDefs(schema._zod.def, {
5370
5569
  get shape () {
@@ -8345,7 +8544,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
8345
8544
  inst.extend = (incoming)=>extend(inst, incoming);
8346
8545
  inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
8347
8546
  inst.merge = (other)=>merge(inst, other);
8348
- inst.pick = (mask)=>pick(inst, mask);
8547
+ inst.pick = (mask)=>util_pick(inst, mask);
8349
8548
  inst.omit = (mask)=>omit(inst, mask);
8350
8549
  inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
8351
8550
  inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
@@ -12334,7 +12533,7 @@ const douyinGetVerifyQrCode = async (task, params)=>{
12334
12533
  });
12335
12534
  const qrData = qrCodeResponse?.data;
12336
12535
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
12337
- if (qrData?.error_code !== 0) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
12536
+ if (qrData?.error_code !== 0) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12338
12537
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(0, "获取二维码成功", {
12339
12538
  qrcode: qrData.qrcode,
12340
12539
  token: qrData.token,
@@ -12349,7 +12548,7 @@ const douyinGetVerifyQrCode = async (task, params)=>{
12349
12548
  } catch (err) {
12350
12549
  const msg = err instanceof Error ? err.message : String(err);
12351
12550
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
12352
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, `获取二维码失败: ${msg}`, "");
12551
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12353
12552
  }
12354
12553
  };
12355
12554
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -13664,18 +13863,10 @@ const mock_mockAction = async (task, params)=>{
13664
13863
  });
13665
13864
  } catch (error) {
13666
13865
  const handledError = Http.handleApiError(error);
13667
- const isProxyOrNetworkError = [
13668
- 599,
13669
- 500,
13670
- 502,
13671
- 503,
13672
- 504
13673
- ].includes(handledError.code);
13674
- if (isProxyOrNetworkError) {
13675
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
13676
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13677
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13678
- task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
13866
+ const classified = classifyPublishError(handledError);
13867
+ if (classified) {
13868
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13869
+ task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
13679
13870
  await updateTaskState?.({
13680
13871
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13681
13872
  error: message
@@ -15393,7 +15584,7 @@ async function getDouyinData(_task, params) {
15393
15584
  }
15394
15585
  const errMsg = error instanceof Error ? error.message : String(error);
15395
15586
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
15396
- return types_errorResponse(errMsg || "抖音账号数据获取失败");
15587
+ return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
15397
15588
  }
15398
15589
  }
15399
15590
  async function getShipinhaoData(_task, params) {
@@ -15524,7 +15715,7 @@ async function getShipinhaoData(_task, params) {
15524
15715
  }
15525
15716
  const errMsg = error instanceof Error ? error.message : String(error);
15526
15717
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
15527
- return types_errorResponse(errMsg || "视频号账号数据获取失败");
15718
+ return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
15528
15719
  }
15529
15720
  }
15530
15721
  async function getToutiaoData(_task, params) {
@@ -15963,7 +16154,9 @@ async function handleBaijiahaoData(_task, params) {
15963
16154
  } : null
15964
16155
  }, "百家号文章数据获取成功");
15965
16156
  } catch (error) {
15966
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
16157
+ const errMsg = error instanceof Error ? error.message : String(error);
16158
+ _task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
16159
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
15967
16160
  }
15968
16161
  }
15969
16162
  async function handleDouyinData(_task, params) {
@@ -16058,7 +16251,9 @@ async function handleDouyinData(_task, params) {
16058
16251
  } : null
16059
16252
  }, "抖音数据获取成功");
16060
16253
  } catch (error) {
16061
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
16254
+ const errMsg = error instanceof Error ? error.message : String(error);
16255
+ _task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
16256
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
16062
16257
  }
16063
16258
  }
16064
16259
  async function handleShipinhaoData(_task, params) {
@@ -16223,8 +16418,9 @@ async function handleShipinhaoData(_task, params) {
16223
16418
  }, "视频号数据获取成功");
16224
16419
  } catch (error) {
16225
16420
  const errMsg = error instanceof Error ? error.message : String(error);
16421
+ _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
16226
16422
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
16227
- return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
16423
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
16228
16424
  }
16229
16425
  }
16230
16426
  async function handleToutiaoData(_task, params) {
@@ -16309,7 +16505,9 @@ async function handleToutiaoData(_task, params) {
16309
16505
  } : null
16310
16506
  }, "头条号文章文章获取成功");
16311
16507
  } catch (error) {
16312
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
16508
+ const errMsg = error instanceof Error ? error.message : String(error);
16509
+ _task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
16510
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
16313
16511
  }
16314
16512
  }
16315
16513
  async function handleWeixinData(_task, params) {
@@ -18684,18 +18882,10 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18684
18882
  });
18685
18883
  } catch (error) {
18686
18884
  const handledError = Http.handleApiError(error);
18687
- const isProxyOrNetworkError = [
18688
- 599,
18689
- 500,
18690
- 502,
18691
- 503,
18692
- 504
18693
- ].includes(handledError.code);
18694
- if (isProxyOrNetworkError) {
18695
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
18696
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
18697
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18698
- task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
18885
+ const classified = classifyPublishError(handledError);
18886
+ if (classified) {
18887
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18888
+ task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
18699
18889
  await updateTaskState?.({
18700
18890
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
18701
18891
  error: message
@@ -19527,7 +19717,8 @@ const shipinhaoSendMsg = async (_task, params)=>{
19527
19717
  imageBuffer = Buffer.from(await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].promises.readFile(filePath));
19528
19718
  }
19529
19719
  } catch (err) {
19530
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
19720
+ _task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
19721
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
19531
19722
  }
19532
19723
  const md5 = (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)("md5").update(imageBuffer).digest("hex");
19533
19724
  const timestamp = Date.now().toString();
@@ -22038,18 +22229,10 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
22038
22229
  });
22039
22230
  } catch (error) {
22040
22231
  const handledError = Http.handleApiError(error);
22041
- const isProxyOrNetworkError = [
22042
- 599,
22043
- 500,
22044
- 502,
22045
- 503,
22046
- 504
22047
- ].includes(handledError.code);
22048
- if (isProxyOrNetworkError) {
22049
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
22050
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
22051
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22052
- task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
22232
+ const classified = classifyPublishError(handledError);
22233
+ if (classified) {
22234
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22235
+ task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
22053
22236
  await updateTaskState?.({
22054
22237
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
22055
22238
  error: message
@@ -23517,6 +23700,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
23517
23700
  });
23518
23701
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, message);
23519
23702
  }
23703
+ task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
23520
23704
  let publishResult;
23521
23705
  try {
23522
23706
  publishResult = await proxyHttp.api({
@@ -23527,23 +23711,15 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
23527
23711
  defaultErrorMsg: "文章发布异常,请稍后重试。"
23528
23712
  }, {
23529
23713
  retries: 2,
23530
- retryDelay: 500,
23531
- timeout: 12000
23714
+ retryDelay: 3000,
23715
+ timeout: 30000
23532
23716
  });
23533
23717
  } catch (error) {
23534
23718
  const handledError = Http.handleApiError(error);
23535
- const isProxyOrNetworkError = [
23536
- 599,
23537
- 500,
23538
- 502,
23539
- 503,
23540
- 504
23541
- ].includes(handledError.code);
23542
- if (isProxyOrNetworkError) {
23543
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
23544
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
23545
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23546
- task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
23719
+ const classified = classifyPublishError(handledError);
23720
+ if (classified) {
23721
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23722
+ task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
23547
23723
  await updateTaskState?.({
23548
23724
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
23549
23725
  error: message
@@ -25517,5 +25693,4 @@ class Action {
25517
25693
  var __webpack_exports__version = package_namespaceObject.i8;
25518
25694
  export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, douyinConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, shipinhaoConfigDataSchema, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
25519
25695
 
25520
- //# sourceMappingURL=index.mjs.map
25521
- //# debugId=c8d107bb-33ed-570f-91cf-6902618660d6
25696
+ //# sourceMappingURL=index.mjs.map