@bty/customer-service-cli 0.6.12 → 0.6.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/CHANGELOG.md +8 -0
- package/README.md +15 -0
- package/dist/bin.js +38 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.14 (2026-09-02)
|
|
4
|
+
|
|
5
|
+
- `agent fork` 新增 `--copy-authorized-shop-id`:与 `--clone-tools` 同用时,克隆的工具沿用来源工具的店铺授权 `authorized_shop_id`;默认关闭(清空),仅在用户明确要求全量复制工具时开启。
|
|
6
|
+
|
|
7
|
+
## 0.6.13 (2026-08-31)
|
|
8
|
+
|
|
9
|
+
- 新增 `agent fork`,对接 `customer-servhub-api /v1/customer-agent/fork_agent`,复制 Agent 时必须显式指定 `--source-customer-config-id` 与 `--target-workspace-id`;同空间按当前用户的 workspace 权限校验,跨空间仅系统管理员可用。`--clone-tools` 用于复制来源 Agent 当前已绑定的全部工具(含系统工具和自定义工作流工具),多数场景建议开启。
|
|
10
|
+
|
|
3
11
|
## 0.6.12 (2026-08-31)
|
|
4
12
|
|
|
5
13
|
- `channel-metric query` 新增 `--format json|markdown|table`(默认 json):markdown 输出适合贴文档/群消息,table 输出终端表格;json 保持原结构不变。
|
package/README.md
CHANGED
|
@@ -204,6 +204,9 @@ cs-cli workspace points-consumes-daily --start 2026-04-01 --end 2026-04-23
|
|
|
204
204
|
| `agent list [--page N] [--page-size N]` | 列出 Agent 列表 |
|
|
205
205
|
| `agent get <config_id>` | 获取 Agent 详情 |
|
|
206
206
|
| `agent update <config_id> --data <json|@file>` | 更新 Agent 配置 |
|
|
207
|
+
| `agent fork --source-customer-config-id <id> --target-workspace-id <id> [选项]` | 复制 Agent;同空间校验当前用户权限,跨空间仅系统管理员可用 |
|
|
208
|
+
|
|
209
|
+
`agent fork` 必须显式指定来源 Agent 配置 ID 和目标工作空间 ID。`--copy-product-data`、`--copy-activity-data` 默认开启,可分别用 `--no-copy-product-data` / `--no-copy-activity-data` 关闭。`--clone-tools` 会复制来源 Agent 当前已绑定的全部工具(包括系统工具和自定义工作流工具),默认不复制;多数场景建议开启。`--copy-authorized-shop-id` 让克隆的工具沿用来源工具的店铺授权 `authorized_shop_id`,默认清空;仅与 `--clone-tools` 同用生效,只在用户明确要求全量复制工具时开启。`--shop-id` 可显式指定目标店铺 ID。
|
|
207
210
|
|
|
208
211
|
|
|
209
212
|
### 场景动作 (`sa`)
|
|
@@ -858,6 +861,18 @@ cs-cli sa versions --agent <id> --id 3
|
|
|
858
861
|
# 使用 JSON 文件更新 Agent
|
|
859
862
|
cs-cli agent update <config_id> --data @config.json
|
|
860
863
|
|
|
864
|
+
# 在明确指定来源 Agent 与目标空间后复制 Agent
|
|
865
|
+
cs-cli agent fork \
|
|
866
|
+
--source-customer-config-id <source_config_id> \
|
|
867
|
+
--target-workspace-id <target_workspace_id> \
|
|
868
|
+
--clone-tools
|
|
869
|
+
|
|
870
|
+
# 全量复制工具(含店铺授权)
|
|
871
|
+
cs-cli agent fork \
|
|
872
|
+
--source-customer-config-id <source_config_id> \
|
|
873
|
+
--target-workspace-id <target_workspace_id> \
|
|
874
|
+
--clone-tools --copy-authorized-shop-id
|
|
875
|
+
|
|
861
876
|
# 更新商品卖点
|
|
862
877
|
cs-cli product update --agent <id> --product-id 977691714398 --update '{"卖点":"新卖点"}'
|
|
863
878
|
|
package/dist/bin.js
CHANGED
|
@@ -753,6 +753,21 @@ async function updateAgent(configId, data) {
|
|
|
753
753
|
body: data
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
|
+
async function forkAgent(opts) {
|
|
757
|
+
const request = createRequest();
|
|
758
|
+
return request(getCustomerServiceUrl(), "/v1/customer-agent/fork_agent", {
|
|
759
|
+
method: "POST",
|
|
760
|
+
body: {
|
|
761
|
+
source_customer_config_id: opts.sourceCustomerConfigId,
|
|
762
|
+
target_workspace_id: opts.targetWorkspaceId,
|
|
763
|
+
copy_product_data: opts.copyProductData ?? true,
|
|
764
|
+
copy_activity_data: opts.copyActivityData ?? true,
|
|
765
|
+
shop_id: opts.shopId,
|
|
766
|
+
clone_tools: opts.cloneTools ?? false,
|
|
767
|
+
copy_authorized_shop_id: opts.copyAuthorizedShopId ?? false
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
}
|
|
756
771
|
|
|
757
772
|
// src/commands/agent.ts
|
|
758
773
|
function registerAgentCommand(program2) {
|
|
@@ -799,6 +814,29 @@ function registerAgentCommand(program2) {
|
|
|
799
814
|
process.exit(toExitCode(err));
|
|
800
815
|
}
|
|
801
816
|
});
|
|
817
|
+
agent.command("fork").description("\u590D\u5236 Agent\uFF1B\u540C\u7A7A\u95F4\u9700\u5F53\u524D\u7528\u6237\u62E5\u6709\u8BE5\u7A7A\u95F4\uFF0C\u8DE8\u7A7A\u95F4\u4EC5\u7CFB\u7EDF\u7BA1\u7406\u5458\u53EF\u7528").requiredOption("--source-customer-config-id <id>", "\u6765\u6E90 Agent \u914D\u7F6E ID\uFF08\u5FC5\u987B\u660E\u786E\u6307\u5B9A\uFF09").requiredOption("--target-workspace-id <id>", "\u76EE\u6807\u5DE5\u4F5C\u7A7A\u95F4 ID\uFF08\u5FC5\u987B\u660E\u786E\u6307\u5B9A\uFF09").option("--no-copy-product-data", "\u4E0D\u590D\u5236\u5546\u54C1\u6570\u636E").option("--no-copy-activity-data", "\u4E0D\u590D\u5236\u6D3B\u52A8\u6570\u636E").option("--shop-id <id>", "\u76EE\u6807\u5E97\u94FA ID\uFF1B\u4E0D\u4F20\u5219\u7531\u670D\u52A1\u7AEF\u81EA\u52A8\u751F\u6210").option(
|
|
818
|
+
"--clone-tools",
|
|
819
|
+
"\u590D\u5236\u6765\u6E90 Agent \u5F53\u524D\u7ED1\u5B9A\u7684\u5168\u90E8\u5DE5\u5177\uFF08\u542B\u7CFB\u7EDF\u5DE5\u5177\u548C\u81EA\u5B9A\u4E49\u5DE5\u4F5C\u6D41\u5DE5\u5177\uFF1B\u591A\u6570\u573A\u666F\u5EFA\u8BAE\u5F00\u542F\uFF09"
|
|
820
|
+
).option(
|
|
821
|
+
"--copy-authorized-shop-id",
|
|
822
|
+
"\u590D\u5236\u5DE5\u5177\u65F6\u6CBF\u7528\u6765\u6E90\u5DE5\u5177\u7684\u5E97\u94FA\u6388\u6743 authorized_shop_id\uFF08\u9ED8\u8BA4\u6E05\u7A7A\uFF1B\u4EC5\u4E0E --clone-tools \u540C\u7528\u751F\u6548\uFF0C\u7528\u6237\u660E\u786E\u8981\u6C42\u5168\u91CF\u590D\u5236\u5DE5\u5177\u65F6\u624D\u5F00\u542F\uFF09"
|
|
823
|
+
).action(async (opts) => {
|
|
824
|
+
try {
|
|
825
|
+
const data = await forkAgent({
|
|
826
|
+
sourceCustomerConfigId: opts.sourceCustomerConfigId,
|
|
827
|
+
targetWorkspaceId: opts.targetWorkspaceId,
|
|
828
|
+
copyProductData: opts.copyProductData,
|
|
829
|
+
copyActivityData: opts.copyActivityData,
|
|
830
|
+
shopId: opts.shopId,
|
|
831
|
+
cloneTools: opts.cloneTools,
|
|
832
|
+
copyAuthorizedShopId: opts.copyAuthorizedShopId
|
|
833
|
+
});
|
|
834
|
+
formatOutput({ success: true, data }, program2.opts().table);
|
|
835
|
+
} catch (err) {
|
|
836
|
+
reportCaughtError(err);
|
|
837
|
+
process.exit(toExitCode(err));
|
|
838
|
+
}
|
|
839
|
+
});
|
|
802
840
|
}
|
|
803
841
|
|
|
804
842
|
// src/client/auth-api.ts
|