oc-browser-relay 1.0.13 → 1.0.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.
@@ -23005,6 +23005,9 @@ function buildEffectiveDailyPeriod(now = /* @__PURE__ */ new Date()) {
23005
23005
  function normalizeMetricPeriodLabel(value) {
23006
23006
  return typeof value === "string" ? value.replace(/\s+/g, "") : "";
23007
23007
  }
23008
+ function truncateByCharacters(value, maxLength) {
23009
+ return Array.from(value).slice(0, maxLength).join("");
23010
+ }
23008
23011
  var TemplateExecutor = class _TemplateExecutor {
23009
23012
  static isPublishItemTemplate(template) {
23010
23013
  return template.platform === "xiaohongshu" && ["publish_note", "save_note_draft"].includes(template.taskType);
@@ -23190,9 +23193,23 @@ ${topicLine}`;
23190
23193
  content: mergedContent
23191
23194
  };
23192
23195
  }
23196
+ normalizeXiaohongshuPublishData(template, data) {
23197
+ if (template.platform !== "xiaohongshu" || !["publish_note", "save_note_draft"].includes(template.taskType)) {
23198
+ return data;
23199
+ }
23200
+ const nextData = { ...data };
23201
+ if (typeof nextData.title === "string") {
23202
+ nextData.title = truncateByCharacters(nextData.title, 20);
23203
+ }
23204
+ if (Array.isArray(nextData.topics)) {
23205
+ nextData.topics = nextData.topics.map((topic) => typeof topic === "string" ? topic.trim() : "").filter(Boolean).slice(0, 10);
23206
+ }
23207
+ return nextData;
23208
+ }
23193
23209
  async execute(template, data) {
23194
23210
  let resolvedData = this.applyDefaults(template, data);
23195
23211
  this.coerceArrayFields(template, resolvedData);
23212
+ resolvedData = this.normalizeXiaohongshuPublishData(template, resolvedData);
23196
23213
  resolvedData = this.mergeXiaohongshuTopicsIntoContent(template, resolvedData);
23197
23214
  this.validateRequiredFields(template, resolvedData);
23198
23215
  this.validateRules(template, resolvedData);
@@ -44,17 +44,17 @@
44
44
  "visibleLocators": [
45
45
  {
46
46
  "kind": "css",
47
- "value": ".drag-text",
47
+ "value": ".image-upload-buttons .upload-button.bg-red",
48
48
  "priority": 1
49
49
  },
50
50
  {
51
51
  "kind": "css",
52
- "value": ".image-upload-buttons",
52
+ "value": "button.upload-button.bg-red",
53
53
  "priority": 2
54
54
  },
55
55
  {
56
- "kind": "text",
57
- "value": "上传图片",
56
+ "kind": "css",
57
+ "value": ".image-upload-buttons button.upload-button",
58
58
  "priority": 3
59
59
  }
60
60
  ]
@@ -223,6 +223,7 @@
223
223
  ".edit-container input[type='text'][placeholder*='填写标题']",
224
224
  "input[type='text'][placeholder*='填写标题']"
225
225
  ],
226
+ "successSettleDelayMs": 3000,
226
227
  "countSelectors": [
227
228
  ".img-preview-area .img-container",
228
229
  ".img-preview-area .pr[data-draggable='true']",
@@ -33,12 +33,13 @@
33
33
  { "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]", "priority": 2 }
34
34
  ],
35
35
  "menuItemLocators": [
36
- { "kind": "xpath", "value": "//div[contains(@class,'dropdownItem')]//div[contains(@class,'container')][.//span[normalize-space()='上传图文']]", "priority": 1 },
37
- { "kind": "text", "value": "上传图文", "priority": 2 }
36
+ { "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]//div[contains(@class,'container')][./span[normalize-space()='上传图文']]", "priority": 1 },
37
+ { "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]//div[contains(@class,'container')][.//span[normalize-space()='上传图文']]", "priority": 2 }
38
38
  ],
39
- "hoverDelayMs": 300,
40
- "menuWaitTimeoutMs": 2500,
41
- "settleDelayMs": 1200,
39
+ "hoverDelayMs": 3000,
40
+ "menuWaitTimeoutMs": 3000,
41
+ "settleDelayMs": 3000,
42
+ "maxAttempts": 3,
42
43
  "readyTimeoutMs": 8000
43
44
  }
44
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-browser-relay",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Expose a local ChromeAgent/Relay Tool API to OpenClaw as agent tools.",
5
5
  "main": "index.js",
6
6
  "openclaw": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: oc-browser-relay-douyin-fxg
3
- description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具采集抖店商家后台首页经营看板数据。仅在用户明确提到抖店、抖音小店、抖音电商后台、doudian、fxg、巨量电商后台、商家后台首页、经营看板、经营卡片、首页概览、经营数据导出或抖店连接检查时使用;不用于抖音视频发布、草稿保存或生意参谋数据。
3
+ description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具采集抖店商家后台首页经营看板数据。仅在用户明确提到抖店、抖音小店、抖音电商后台、doudian、fxg、巨量电商后台、抖店连接检查时使用;不用于抖音视频发布、草稿保存或生意参谋数据。
4
4
  ---
5
5
 
6
6
  # 抖店平台技能
@@ -28,12 +28,16 @@ description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具采集抖
28
28
 
29
29
  - `pageUrl` 可选,默认抖店首页
30
30
  - `metricPeriodValue` 可选,默认 `Day`,支持 `Real`、`Day`、`Week`、`Month`、`Promotion`
31
- - `saveToFile` 默认 `true`,保存到 workspace `douyin-fxg/`
31
+ - `saveToFile` 默认 `true`,默认保存为 CSV 到 workspace `douyin-fxg/`
32
32
  - 用户明确要求调整等待时间时,才传 `timeoutMs`、`inactivityTimeoutMs`、`pollIntervalMs`
33
33
 
34
34
  规则:
35
35
 
36
- - 默认返回经营看板原始 JSON,不做字段重命名或换算
36
+ - 默认在会话中以表格形式完整展示接口返回的所有原始数据,不截断、不省略、不只返回摘要
37
+ - 会话表格固定使用这 4 个表头:`指标`、`数值`、`环比`、`同行对比`
38
+ - 表格逐行展示接口里实际返回的指标项;不要合并、改名、删行,也不要只挑部分字段做摘要
39
+ - 默认保存为 CSV;除非用户明确要求 JSON 或其他格式,不要默认保存成 JSON
40
+ - 导出 CSV 时,按接口原始返回展开导出,不做字段重命名、删减或换算
37
41
  - 用户只说”经营数据””经营卡片”但没有提平台时,先确认是抖店还是生意参谋/拼多多
38
42
  - 用户提到”实时””近1天””近7天””近30天””大促”时,对应传 `metricPeriodValue`
39
43
  - 用户没有明确提时间周期时,固定使用 `Day`;不要根据上一轮对话、历史抓取结果或文件名推断成 `Real`、`Week`、`Month`
@@ -34,6 +34,9 @@ description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具采集拼
34
34
  规则:
35
35
 
36
36
  - 默认返回首页概览卡片原始 JSON
37
+ - 会话中默认以表格形式展示返回的全部指标,不截断、不省略、不只返回摘要
38
+ - 会话表格固定使用这 3 个表头:`指标`、`实时`、`昨日`
39
+ - `实时` 和 `昨日` 两列只展示数值,不附加其他说明文本
37
40
  - 不做字段重命名、删减或换算
38
41
  - 用户没有明确要求切回其他站点时,不要补 `returnHostPatterns`
39
42
  - 连续多轮里,如果用户本轮仍然只是说“抓拼多多后台数据”“再抓一次”,保持同一个首页概览采集意图,不要漂移到其他平台或其他页面
@@ -47,31 +47,54 @@ description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具采集生
47
47
 
48
48
  默认行为:
49
49
 
50
- - 只要工具成功抓到字段,就直接分析
51
50
  - 不需要等待用户追加“分析一下”“解读一下”等指令
52
51
  - 除非用户明确要求只返回原始结果,否则分析不能省略
53
52
 
54
53
  分析这些字段:
55
54
 
56
- - `uv` `pv` `cltItmCnt` `cartByrCnt` `cartItemCnt`
57
- - `payAmt` `netPaymentAmount` `payByrCnt` `payRate` `payOrdCnt` `payItmCnt` `payPct`
58
- - `p4pExpendAmt` `cubeAmt` `adStrategyAmt` `admCostFamtQzt` `tkExpendAmt`
59
- - `rfdSucAmt` `payShopRfdAmt` `ordRfdRate` `payAmtRfdRate` `realPayrealRfdRate`
55
+ - `uv` `pv` `cltItmCnt` `cartByrCnt` `cartItemCnt` `payAmt` `netPaymentAmount` `payByrCnt` `payRate` `payOrdCnt` `payItmCnt` `payPct` `p4pExpendAmt` `cubeAmt` `adStrategyAmt` `admCostFamtQzt` `tkExpendAmt` `rfdSucAmt` `payShopRfdAmt` `ordRfdRate` `payAmtRfdRate` `realPayrealRfdRate`
60
56
 
61
- 默认按以下维度组织分析:
62
57
 
63
- - 流量与兴趣
64
- - 成交转化
65
- - 老客复购
66
- - 投放成本
67
- - 退款风险
68
- - 客服与履约
69
58
 
70
59
  输出要求:
71
60
 
61
+ - 会话中默认以表格形式展示抓取到的指标
62
+ - 表头固定为 `指标`、`数值`、`环比`
63
+ - `指标` 列严格使用 `references/sycm-field-mapping.md` 中提供的中文名,不做任何改动,不展示英文字段名或参数名
64
+ - `数值` 列取字段 `value`
65
+ - `环比` 列取字段 `cycleCrc` 必须乘100 加 %号展示;如果 `cycleCrc` 为空、缺失或未返回,则该列显示为“-”,而不是直接省略整行
66
+ - 只取自己的数据,不展示竞品、行业、同行或其他外部对比数据
67
+ - 会话表格中只允许展示这些字段对应的指标:`uv` `pv` `cltItmCnt` `cartByrCnt` `cartItemCnt` `payAmt` `netPaymentAmount` `payByrCnt` `payRate` `payOrdCnt` `payItmCnt` `payPct` `p4pExpendAmt` `cubeAmt` `adStrategyAmt` `admCostFamtQzt` `tkExpendAmt` `rfdSucAmt` `payShopRfdAmt` `ordRfdRate` `payAmtRfdRate` `realPayrealRfdRate`,不能增加其他字段
68
+ - 即使某个字段数据为空、缺失或未返回,也要按映射名称保留该行展示,值可为空,不能直接省略整行
69
+ - 输出结果严格限制为以下表格中的指标,不要加其他任何数据:
70
+
71
+ | 字段 | 指标 |
72
+ | --- | --- |
73
+ | `uv` | 访客 |
74
+ | `pv` | 浏览量 |
75
+ | `cltItmCnt` | 商品收藏人数 |
76
+ | `cartByrCnt` | 加购人数 |
77
+ | `cartItemCnt` | 加购件数 |
78
+ | `payAmt` | 支付金额 |
79
+ | `netPaymentAmount` | 净支付金额 |
80
+ | `payByrCnt` | 支付买家数 |
81
+ | `payRate` | 支付转化率 |
82
+ | `payOrdCnt` | 支付子订单数 |
83
+ | `payItmCnt` | 支付件数 |
84
+ | `payPct` | 客单价 |
85
+ | `p4pExpendAmt` | 关键词推广花费 |
86
+ | `cubeAmt` | 精准人群推广花费 |
87
+ | `adStrategyAmt` | 智能场景花费 |
88
+ | `admCostFamtQzt` | 全站推广花费 |
89
+ | `tkExpendAmt` | 淘宝客佣金 |
90
+ | `rfdSucAmt` | 退款金额(完结时间) |
91
+ | `payShopRfdAmt` | 退款金额(支付时间) |
92
+ | `ordRfdRate` | 订单退款率 |
93
+ | `payAmtRfdRate` | 金额退款率 |
94
+ | `realPayrealRfdRate` | 签售退款率 |
72
95
  - 没抓到任何字段的维度直接跳过
73
96
  - 用中文小标题分段
74
- - 每行一个指标,格式为 `中文名: 值`
97
+ - 每行一个指标,按表格行展示
75
98
  - 最后补一句简短结论,但只能基于已抓到的数据,不做无依据推断
76
99
 
77
100
  ## 意图分流
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: oc-browser-relay-xiaohongshu
3
- description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具处理小红书任务,包括打开小红书首页、打开创作者中心、发布图文笔记、保存草稿、搜索笔记、抓取笔记列表与详情、导出搜索结果。仅在用户明确提到小红书、RED、xhs、笔记、图文、种草笔记、创作者中心、搜索帖子、对标内容、小红书达人、小红书博主、采集小红书、爆款笔记或小红书连接检查时使用;不用于淘宝商品、抖音视频、抖店后台、生意参谋、拼多多后台或通用文章链接。
3
+ description: 通过本地 ChromeAgent Relay 的 OpenClaw 插件工具处理小红书任务,包括打开小红书首页、打开创作者中心、发布图文笔记、保存草稿、搜索笔记、抓取笔记列表与详情、导出搜索结果。仅在用户明确提到小红书、RED、xhs、笔记、图文、种草笔记、创作者中心、搜索帖子、对标内容、小红书达人、小红书博主、采集小红书小红书连接检查时使用;不用于淘宝商品、抖音视频、抖店后台、生意参谋、拼多多后台或通用文章链接。
4
4
  ---
5
5
 
6
6
  # 小红书平台技能
7
-
7
+
8
8
  ## 默认工具
9
9
 
10
10
  - `xiaohongshu_open_home`