@iflyrpa/actions 4.0.9-beta.4 → 4.0.9

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.d.ts CHANGED
@@ -73,20 +73,6 @@ export declare const BetaFlag = "HuiwenCanary";
73
73
  export declare class Action {
74
74
  private task;
75
75
  constructor(task: AutomateTask);
76
- /**
77
- * 【测试专用】获取当前 Action 类的版本标识
78
- *
79
- * 用于验证热更新后内存中的 Action 实例是否真的被替换了。
80
- * 每个版本的 @iflyrpa/actions 包应该返回不同的标识。
81
- *
82
- * @returns 包含版本号和时间戳的对象
83
- */
84
- getActionVersionMarker(): {
85
- version: string;
86
- shareVersion: string;
87
- marker: string;
88
- timestamp: string;
89
- };
90
76
  private bindTask;
91
77
  xiaohongshuWebSearch(params: XhsWebSearchParams): Promise<ResponseData<Record<string, unknown>>>;
92
78
  xiaohongshuWebCommentAction(params: xiaohongshuWebCommentActionParams): Promise<ResponseData<Record<string, never> | import("./actions/xiaohongshuWebCommentAction").ActionResponse>>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
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]="3b831ac8-2f97-5984-b6b4-868d0748d2c6")}catch(e){}}();
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]="4505f4f9-b586-5fae-8a9f-3ce0ceb72967")}catch(e){}}();
3
3
  var __webpack_modules__ = {
4
4
  "./src/utils/XhsXsCommonEnc.js": function(module) {
5
5
  var encrypt_lookup = [
@@ -4402,7 +4402,9 @@ var __webpack_exports__ = {};
4402
4402
  });
4403
4403
  const package_json_namespaceObject = require("@iflyrpa/share/package.json");
4404
4404
  var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
4405
- var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.4"}');
4405
+ var package_namespaceObject = {
4406
+ i8: "4.0.9"
4407
+ };
4406
4408
  const share_namespaceObject = require("@iflyrpa/share");
4407
4409
  const external_node_fs_namespaceObject = require("node:fs");
4408
4410
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -4418,124 +4420,6 @@ var __webpack_exports__ = {};
4418
4420
  var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
4419
4421
  const external_axios_namespaceObject = require("axios");
4420
4422
  var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
4421
- const USER_MESSAGE = {
4422
- PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
4423
- NETWORK_ERROR: "网络异常,请稍后重试",
4424
- SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
4425
- PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
4426
- DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
4427
- SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
4428
- DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
4429
- SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
4430
- BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
4431
- TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
4432
- QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
4433
- IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
4434
- };
4435
- const NETWORK_CODES = [
4436
- 500,
4437
- 502,
4438
- 503,
4439
- 504
4440
- ];
4441
- function classifyPublishError(handledError) {
4442
- const { code } = handledError;
4443
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
4444
- if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
4445
- const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
4446
- return {
4447
- category,
4448
- userMessage: USER_MESSAGE.PUBLISH_NETWORK
4449
- };
4450
- }
4451
- const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
4452
- const ALARM_THROTTLE_MS = 60000;
4453
- const lastSentAt = new Map();
4454
- const postFeishuWebhook = (webhookUrl, payload)=>external_axios_default().post(webhookUrl, payload, {
4455
- headers: {
4456
- "Content-Type": "application/json"
4457
- },
4458
- timeout: 10000
4459
- });
4460
- const buildFeishuPostMessage = (report)=>{
4461
- const content = [
4462
- [
4463
- {
4464
- tag: "text",
4465
- text: `平台:${report.platform || "未知平台"}`
4466
- }
4467
- ],
4468
- [
4469
- {
4470
- tag: "text",
4471
- text: `错误信息:${report.msg || "未知错误信息"}`
4472
- }
4473
- ],
4474
- [
4475
- {
4476
- tag: "text",
4477
- text: `错误类型:${report.errorType || "未知错误类型"}`
4478
- }
4479
- ],
4480
- [
4481
- {
4482
- tag: "text",
4483
- text: `阶段:${report.stage || "未知阶段"}`
4484
- }
4485
- ],
4486
- [
4487
- {
4488
- tag: "text",
4489
- text: `等级:${report.level}`
4490
- }
4491
- ],
4492
- [
4493
- {
4494
- tag: "text",
4495
- text: `来源:${report.source}`
4496
- }
4497
- ]
4498
- ];
4499
- if (void 0 !== report.code && null !== report.code) content.push([
4500
- {
4501
- tag: "text",
4502
- text: `接口错误码:${report.code}`
4503
- }
4504
- ]);
4505
- if (report.url) content.push([
4506
- {
4507
- tag: "text",
4508
- text: `地址:${report.url}`
4509
- }
4510
- ]);
4511
- if ("alarm" === report.level) content.push([
4512
- {
4513
- tag: "at",
4514
- user_id: "all"
4515
- }
4516
- ]);
4517
- return {
4518
- msg_type: "post",
4519
- content: {
4520
- post: {
4521
- zh_cn: {
4522
- title: report.title || "RPA异常",
4523
- content
4524
- }
4525
- }
4526
- }
4527
- };
4528
- };
4529
- const reportFeishuAlarm = (report)=>{
4530
- try {
4531
- const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
4532
- const now = Date.now();
4533
- const last = lastSentAt.get(key);
4534
- if (last && now - last < ALARM_THROTTLE_MS) return;
4535
- lastSentAt.set(key, now);
4536
- postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
4537
- } catch {}
4538
- };
4539
4423
  const external_socks_proxy_agent_namespaceObject = require("socks-proxy-agent");
4540
4424
  const PROXY_CREDENTIALS = [
4541
4425
  {
@@ -4638,20 +4522,9 @@ var __webpack_exports__ = {};
4638
4522
  url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4639
4523
  data: params
4640
4524
  }).catch((err)=>{
4641
- reportFeishuAlarm({
4642
- level: "alarm",
4643
- platform: "ip-pool",
4644
- source: "proxy",
4645
- stage: "POST /ip-pool/pool/eip/proxy",
4646
- errorType: "PROXY_REQUEST_FAILED",
4647
- code: err?.code,
4648
- msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
4649
- url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
4650
- title: "代理异常"
4651
- });
4652
4525
  throw {
4653
4526
  code: 414,
4654
- message: USER_MESSAGE.PROXY_UNAVAILABLE,
4527
+ message: `请求代理失败:${err.message}`,
4655
4528
  data: {}
4656
4529
  };
4657
4530
  });
@@ -4671,53 +4544,12 @@ var __webpack_exports__ = {};
4671
4544
  } : null;
4672
4545
  return proxyAgent;
4673
4546
  }
4674
- const ALARM_STATUS = new Set([
4675
- 401,
4676
- 403,
4677
- 429,
4678
- 461,
4679
- 471
4680
- ]);
4681
- const HTTP_STATUS_MESSAGE = {
4682
- 400: "请求参数错误,请检查参数格式是否正确!",
4683
- 401: "登录状态已失效,请重新登录后重试!",
4684
- 403: "没有访问权限,账号可能受限或签名已失效!",
4685
- 404: "请求的资源不存在,请检查接口地址!",
4686
- 405: "请求方法不被允许,请检查接口调用方式!",
4687
- 406: "服务端无法返回可接受的内容格式!",
4688
- 407: "代理需要身份验证,请检查代理配置!",
4689
- 408: "请求超时,请检查网络连接!",
4690
- 409: "请求冲突,资源状态已变更,请刷新后重试!",
4691
- 410: "请求的资源已被移除!",
4692
- 412: "请求前置条件不满足,请刷新后重试!",
4693
- 413: "提交内容过大,请压缩或分批后重试!",
4694
- 414: "请求地址过长,请检查参数!",
4695
- 415: "不支持的内容类型,请检查请求格式!",
4696
- 422: "请求内容校验失败,请检查参数内容!",
4697
- 423: "资源已被锁定,请稍后重试!",
4698
- 429: "请求过于频繁,请稍后重试!",
4699
- 431: "请求头过大,请清理 Cookie 后重试!",
4700
- 451: "内容不合规或因法律原因被拒绝!",
4701
- 461: "账号可能受限,请在网页上完成验证后重试!",
4702
- 471: "账号可能受限,请在网页上完成验证后重试!",
4703
- 500: "服务器内部错误,请稍后重试!",
4704
- 501: "服务端不支持该请求,请稍后重试!",
4705
- 502: "网关错误,请稍后重试!",
4706
- 503: "服务暂时不可用,请稍后重试!",
4707
- 504: "网关超时,请稍后重试!",
4708
- 507: "服务端存储空间不足,请稍后重试!",
4709
- 509: "服务带宽超限,请稍后重试!",
4710
- 520: "服务端返回未知错误,请稍后重试!",
4711
- 521: "源站拒绝连接,请稍后重试!",
4712
- 522: "源站连接超时,请稍后重试!",
4713
- 524: "源站响应超时,请稍后重试!"
4714
- };
4715
4547
  class Http {
4716
4548
  static handleApiError(error) {
4717
4549
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
4718
4550
  return {
4719
4551
  code: 500,
4720
- message: USER_MESSAGE.SYSTEM_ERROR,
4552
+ message: error instanceof Error ? error.message : "未知错误",
4721
4553
  data: error
4722
4554
  };
4723
4555
  }
@@ -4772,18 +4604,6 @@ var __webpack_exports__ = {};
4772
4604
  const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
4773
4605
  if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
4774
4606
  }
4775
- if (error.response?.status === 461 || error.response?.status === 471) {
4776
- const h = error.response?.headers ?? {};
4777
- const pick = (name)=>h[name] ?? h[name.toLowerCase()];
4778
- this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
4779
- this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
4780
- errorResponse.extra = {
4781
- ...errorResponse.extra,
4782
- verifyType: pick("Verifytype"),
4783
- verifyUuid: pick("Verifyuuid"),
4784
- verifyBiz: pick("Verifybiz")
4785
- };
4786
- }
4787
4607
  if (error.response?.data) {
4788
4608
  if ("object" == typeof error.response.data) {
4789
4609
  const serverError = error.response.data;
@@ -4814,17 +4634,11 @@ var __webpack_exports__ = {};
4814
4634
  _message = "DNS 查询超时,请稍后重试!";
4815
4635
  break;
4816
4636
  case "ERR_BAD_REQUEST":
4817
- {
4818
- const status = error.response?.status;
4819
- _message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
4820
- break;
4821
- }
4637
+ _message = "请求出现错误,请检查请求参数!";
4638
+ break;
4822
4639
  case "ERR_BAD_RESPONSE":
4823
- {
4824
- const status = error.response?.status;
4825
- _message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
4826
- break;
4827
- }
4640
+ _message = `服务器响应异常 (${error.response?.status ?? "unknown"}),请稍后重试!`;
4641
+ break;
4828
4642
  case "ERR_CANCELED":
4829
4643
  errorResponse.code = 414;
4830
4644
  _message = "请求连接超时,请稍候重试!";
@@ -4835,14 +4649,11 @@ var __webpack_exports__ = {};
4835
4649
  }
4836
4650
  break;
4837
4651
  default:
4838
- {
4839
- this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4840
- errorString: stringifyError(error)
4841
- });
4842
- const status = error.response?.status;
4843
- _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
4844
- break;
4845
- }
4652
+ this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4653
+ errorString: stringifyError(error)
4654
+ });
4655
+ _message = `网络错误: ${error.message}`;
4656
+ break;
4846
4657
  }
4847
4658
  }
4848
4659
  if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
@@ -4852,18 +4663,6 @@ var __webpack_exports__ = {};
4852
4663
  errorResponse.message = message;
4853
4664
  }
4854
4665
  if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
4855
- const status = error.response?.status;
4856
- reportFeishuAlarm({
4857
- level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
4858
- platform: this.platform || "unknown",
4859
- source: "http",
4860
- stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
4861
- errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
4862
- code: errorResponse.code,
4863
- msg: errorResponse.message,
4864
- url: error.config?.url,
4865
- title: "RPA接口异常"
4866
- });
4867
4666
  throw errorResponse;
4868
4667
  });
4869
4668
  }
@@ -5633,7 +5432,7 @@ var __webpack_exports__ = {};
5633
5432
  Number.MAX_VALUE
5634
5433
  ]
5635
5434
  };
5636
- function util_pick(schema, mask) {
5435
+ function pick(schema, mask) {
5637
5436
  const currDef = schema._zod.def;
5638
5437
  const def = mergeDefs(schema._zod.def, {
5639
5438
  get shape () {
@@ -8614,7 +8413,7 @@ var __webpack_exports__ = {};
8614
8413
  inst.extend = (incoming)=>extend(inst, incoming);
8615
8414
  inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
8616
8415
  inst.merge = (other)=>merge(inst, other);
8617
- inst.pick = (mask)=>util_pick(inst, mask);
8416
+ inst.pick = (mask)=>pick(inst, mask);
8618
8417
  inst.omit = (mask)=>omit(inst, mask);
8619
8418
  inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
8620
8419
  inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
@@ -9321,7 +9120,7 @@ var __webpack_exports__ = {};
9321
9120
  ".png"
9322
9121
  ].includes(ext)) throw {
9323
9122
  code: 414,
9324
- message: `图片格式不支持:${fileName}。百家号仅支持 jpg、png 格式,请转换后重试。`,
9123
+ message: "图片格式不支持,百家号仅支持 jpg、png 格式,请转换后重试。",
9325
9124
  data: ""
9326
9125
  };
9327
9126
  const image = await (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
@@ -12608,7 +12407,7 @@ var __webpack_exports__ = {};
12608
12407
  });
12609
12408
  const qrData = qrCodeResponse?.data;
12610
12409
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
12611
- if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12410
+ if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
12612
12411
  return (0, share_namespaceObject.response)(0, "获取二维码成功", {
12613
12412
  qrcode: qrData.qrcode,
12614
12413
  token: qrData.token,
@@ -12623,7 +12422,7 @@ var __webpack_exports__ = {};
12623
12422
  } catch (err) {
12624
12423
  const msg = err instanceof Error ? err.message : String(err);
12625
12424
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
12626
- return (0, share_namespaceObject.response)(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
12425
+ return (0, share_namespaceObject.response)(500, `获取二维码失败: ${msg}`, "");
12627
12426
  }
12628
12427
  };
12629
12428
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -13942,10 +13741,18 @@ var __webpack_exports__ = {};
13942
13741
  });
13943
13742
  } catch (error) {
13944
13743
  const handledError = Http.handleApiError(error);
13945
- const classified = classifyPublishError(handledError);
13946
- if (classified) {
13947
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13948
- task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
13744
+ const isProxyOrNetworkError = [
13745
+ 599,
13746
+ 500,
13747
+ 502,
13748
+ 503,
13749
+ 504
13750
+ ].includes(handledError.code);
13751
+ if (isProxyOrNetworkError) {
13752
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
13753
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13754
+ const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13755
+ task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
13949
13756
  await updateTaskState?.({
13950
13757
  state: share_namespaceObject.TaskState.FAILED,
13951
13758
  error: message
@@ -15663,7 +15470,7 @@ var __webpack_exports__ = {};
15663
15470
  }
15664
15471
  const errMsg = error instanceof Error ? error.message : String(error);
15665
15472
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
15666
- return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
15473
+ return types_errorResponse(errMsg || "抖音账号数据获取失败");
15667
15474
  }
15668
15475
  }
15669
15476
  async function getShipinhaoData(_task, params) {
@@ -15794,7 +15601,7 @@ var __webpack_exports__ = {};
15794
15601
  }
15795
15602
  const errMsg = error instanceof Error ? error.message : String(error);
15796
15603
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
15797
- return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
15604
+ return types_errorResponse(errMsg || "视频号账号数据获取失败");
15798
15605
  }
15799
15606
  }
15800
15607
  async function getToutiaoData(_task, params) {
@@ -16235,9 +16042,7 @@ var __webpack_exports__ = {};
16235
16042
  } : null
16236
16043
  }, "百家号文章数据获取成功");
16237
16044
  } catch (error) {
16238
- const errMsg = error instanceof Error ? error.message : String(error);
16239
- _task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
16240
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
16045
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
16241
16046
  }
16242
16047
  }
16243
16048
  async function handleDouyinData(_task, params) {
@@ -16332,9 +16137,7 @@ var __webpack_exports__ = {};
16332
16137
  } : null
16333
16138
  }, "抖音数据获取成功");
16334
16139
  } catch (error) {
16335
- const errMsg = error instanceof Error ? error.message : String(error);
16336
- _task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
16337
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
16140
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
16338
16141
  }
16339
16142
  }
16340
16143
  async function handleShipinhaoData(_task, params) {
@@ -16499,9 +16302,8 @@ var __webpack_exports__ = {};
16499
16302
  }, "视频号数据获取成功");
16500
16303
  } catch (error) {
16501
16304
  const errMsg = error instanceof Error ? error.message : String(error);
16502
- _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
16503
16305
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
16504
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
16306
+ return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
16505
16307
  }
16506
16308
  }
16507
16309
  async function handleToutiaoData(_task, params) {
@@ -16586,9 +16388,7 @@ var __webpack_exports__ = {};
16586
16388
  } : null
16587
16389
  }, "头条号文章文章获取成功");
16588
16390
  } catch (error) {
16589
- const errMsg = error instanceof Error ? error.message : String(error);
16590
- _task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
16591
- return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
16391
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
16592
16392
  }
16593
16393
  }
16594
16394
  const external_node_vm_namespaceObject = require("node:vm");
@@ -18809,7 +18609,7 @@ var __webpack_exports__ = {};
18809
18609
  name: params.music.name,
18810
18610
  artist: params.music.authorName,
18811
18611
  mediaStreamingUrl: params.music.url,
18812
- docType: params.music.raw.playableInfo.type
18612
+ docType: 2 === params.music.raw.bgmSource ? 0 : 1
18813
18613
  },
18814
18614
  groupId: params.music.id,
18815
18615
  hasBgm: 1,
@@ -18965,10 +18765,18 @@ var __webpack_exports__ = {};
18965
18765
  });
18966
18766
  } catch (error) {
18967
18767
  const handledError = Http.handleApiError(error);
18968
- const classified = classifyPublishError(handledError);
18969
- if (classified) {
18970
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18971
- task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
18768
+ const isProxyOrNetworkError = [
18769
+ 599,
18770
+ 500,
18771
+ 502,
18772
+ 503,
18773
+ 504
18774
+ ].includes(handledError.code);
18775
+ if (isProxyOrNetworkError) {
18776
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
18777
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
18778
+ const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
18779
+ task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
18972
18780
  await updateTaskState?.({
18973
18781
  state: share_namespaceObject.TaskState.FAILED,
18974
18782
  error: message
@@ -19800,8 +19608,7 @@ var __webpack_exports__ = {};
19800
19608
  imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
19801
19609
  }
19802
19610
  } catch (err) {
19803
- _task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
19804
- return (0, share_namespaceObject.response)(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
19611
+ return (0, share_namespaceObject.response)(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
19805
19612
  }
19806
19613
  const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
19807
19614
  const timestamp = Date.now().toString();
@@ -22312,10 +22119,18 @@ var __webpack_exports__ = {};
22312
22119
  });
22313
22120
  } catch (error) {
22314
22121
  const handledError = Http.handleApiError(error);
22315
- const classified = classifyPublishError(handledError);
22316
- if (classified) {
22317
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22318
- task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
22122
+ const isProxyOrNetworkError = [
22123
+ 599,
22124
+ 500,
22125
+ 502,
22126
+ 503,
22127
+ 504
22128
+ ].includes(handledError.code);
22129
+ if (isProxyOrNetworkError) {
22130
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
22131
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
22132
+ const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
22133
+ task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
22319
22134
  await updateTaskState?.({
22320
22135
  state: share_namespaceObject.TaskState.FAILED,
22321
22136
  error: message
@@ -23783,7 +23598,6 @@ var __webpack_exports__ = {};
23783
23598
  });
23784
23599
  return (0, share_namespaceObject.success)(data, message);
23785
23600
  }
23786
- task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
23787
23601
  let publishResult;
23788
23602
  try {
23789
23603
  publishResult = await proxyHttp.api({
@@ -23794,15 +23608,23 @@ var __webpack_exports__ = {};
23794
23608
  defaultErrorMsg: "文章发布异常,请稍后重试。"
23795
23609
  }, {
23796
23610
  retries: 2,
23797
- retryDelay: 3000,
23798
- timeout: 30000
23611
+ retryDelay: 500,
23612
+ timeout: 12000
23799
23613
  });
23800
23614
  } catch (error) {
23801
23615
  const handledError = Http.handleApiError(error);
23802
- const classified = classifyPublishError(handledError);
23803
- if (classified) {
23804
- const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23805
- task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
23616
+ const isProxyOrNetworkError = [
23617
+ 599,
23618
+ 500,
23619
+ 502,
23620
+ 503,
23621
+ 504
23622
+ ].includes(handledError.code);
23623
+ if (isProxyOrNetworkError) {
23624
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
23625
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
23626
+ const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
23627
+ task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
23806
23628
  await updateTaskState?.({
23807
23629
  state: share_namespaceObject.TaskState.FAILED,
23808
23630
  error: message
@@ -25498,14 +25320,6 @@ var __webpack_exports__ = {};
25498
25320
  this.task = task;
25499
25321
  this.task.logger.info(`当前包版本:Share=>${package_json_default().version} Action=>${package_namespaceObject.i8}`);
25500
25322
  }
25501
- getActionVersionMarker() {
25502
- return {
25503
- version: package_namespaceObject.i8,
25504
- shareVersion: package_json_default().version,
25505
- marker: `Action_${package_namespaceObject.i8}_${package_json_default().version}`,
25506
- timestamp: new Date().toLocaleString()
25507
- };
25508
- }
25509
25323
  async bindTask(func, params) {
25510
25324
  let responseData;
25511
25325
  this.task.isBeta = this.task?.isFeatOn ? this.task?.isFeatOn(BetaFlag) : false;
@@ -25789,4 +25603,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
25789
25603
  });
25790
25604
 
25791
25605
  //# sourceMappingURL=index.js.map
25792
- //# debugId=3b831ac8-2f97-5984-b6b4-868d0748d2c6
25606
+ //# debugId=4505f4f9-b586-5fae-8a9f-3ce0ceb72967