@bty/customer-service-cli 0.4.6 → 0.4.8

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.
Files changed (3) hide show
  1. package/README.md +7 -0
  2. package/dist/bin.js +38 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -316,6 +316,7 @@ Agent 关联的通用规则知识库(`suffix_type=_common`),与 FAQ / 商
316
316
  | `conversation list [--agent <id>] [--equipment-id <设备ID>] [--user <用户名>] [--start <日期>] [--end <日期>]` | 搜索会话 |
317
317
  | `conversation records <conversation_id> [--page-size N] [--direction prev|next]` | 获取会话聊天记录 |
318
318
  | `conversation context-search --query <文本> [--start <时间>] [--end <时间>]` | 通过上下文内容模糊搜索对话记录(返回匹配消息详情,时间范围最多 3 天) |
319
+ | `conversation transfer-human --agent <customer_agent_config_id> --start <时间> --end <时间> [--page N]` | 查询转人工会话及对应转人工消息记录(时间范围最多 7 天,分页大小固定 100) |
319
320
 
320
321
 
321
322
  ### Agent 调试 (`debug`)
@@ -647,6 +648,12 @@ cs-cli product add --agent <id> --data @products.json --source batch --no-identi
647
648
  # 通过上下文内容模糊搜索对话记录(自动使用当前工作空间,查询窗口最多 3 天)
648
649
  cs-cli conversation context-search --query "退款问题" --start 2026-03-22T00:00:00 --end 2026-03-22T23:59:59
649
650
 
651
+ # 查询转人工会话及对应转人工消息记录(按 MANUAL_TAKEOVER_REQUIRED 事件时间过滤,查询窗口最多 7 天)
652
+ cs-cli conversation transfer-human --agent <customer_agent_config_id> --start 2026-05-24T00:00:00 --end 2026-05-24T23:59:59
653
+
654
+ # 查询第 2 页转人工会话
655
+ cs-cli conversation transfer-human --agent <customer_agent_config_id> --start 2026-05-24T00:00:00 --end 2026-05-24T23:59:59 --page 2
656
+
650
657
  # 复现某条回复(自动获取上下文、原始用户名、Agent 配置)
651
658
  cs-cli debug reproduce <record_id>
652
659
 
package/dist/bin.js CHANGED
@@ -1004,6 +1004,7 @@ function registerConfigCommand(program2) {
1004
1004
 
1005
1005
  // src/client/conversation-api.ts
1006
1006
  var MAX_CONTEXT_SEARCH_RANGE_MS = 3 * 24 * 60 * 60 * 1e3;
1007
+ var MAX_TRANSFER_HUMAN_RANGE_MS = 7 * 24 * 60 * 60 * 1e3;
1007
1008
  function parseSearchTime(value, fieldName) {
1008
1009
  const parsed = new Date(value);
1009
1010
  if (Number.isNaN(parsed.getTime())) {
@@ -1022,6 +1023,16 @@ function validateContextSearchRange(startTime, endTime) {
1022
1023
  throw new Error("\u67E5\u8BE2\u65F6\u95F4\u8303\u56F4\u4E0D\u80FD\u8D85\u8FC73\u5929");
1023
1024
  }
1024
1025
  }
1026
+ function validateTransferHumanRange(startTime, endTime) {
1027
+ const start = parseSearchTime(startTime, "\u5F00\u59CB\u65F6\u95F4");
1028
+ const end = parseSearchTime(endTime, "\u7ED3\u675F\u65F6\u95F4");
1029
+ if (end.getTime() < start.getTime()) {
1030
+ throw new Error("\u7ED3\u675F\u65F6\u95F4\u4E0D\u80FD\u65E9\u4E8E\u5F00\u59CB\u65F6\u95F4");
1031
+ }
1032
+ if (end.getTime() - start.getTime() > MAX_TRANSFER_HUMAN_RANGE_MS) {
1033
+ throw new Error("\u67E5\u8BE2\u65F6\u95F4\u8303\u56F4\u4E0D\u80FD\u8D85\u8FC77\u5929");
1034
+ }
1035
+ }
1025
1036
  async function contextSearchRecords(opts) {
1026
1037
  validateContextSearchRange(opts.startTime, opts.endTime);
1027
1038
  const wsId = getWorkspaceId(opts.workspaceId);
@@ -1063,6 +1074,19 @@ async function listConversations(opts) {
1063
1074
  }
1064
1075
  });
1065
1076
  }
1077
+ async function listTransferHumanConversations(opts) {
1078
+ validateTransferHumanRange(opts.startDate, opts.endDate);
1079
+ const request = createRequest();
1080
+ return request(getCustomerServiceUrl(), "/v1/chat/conversations/transfer-human", {
1081
+ method: "GET",
1082
+ query: {
1083
+ customer_agent_config_id: opts.customerAgentConfigId,
1084
+ start_date: opts.startDate,
1085
+ end_date: opts.endDate,
1086
+ page: opts.page ?? 1
1087
+ }
1088
+ });
1089
+ }
1066
1090
 
1067
1091
  // src/commands/conversation.ts
1068
1092
  function registerConversationCommand(program2) {
@@ -1117,6 +1141,20 @@ function registerConversationCommand(program2) {
1117
1141
  process.exit(toExitCode(err));
1118
1142
  }
1119
1143
  });
1144
+ conversation.command("transfer-human").description("\u67E5\u8BE2\u8F6C\u4EBA\u5DE5\u4F1A\u8BDD\u53CA\u5BF9\u5E94\u8F6C\u4EBA\u5DE5\u6D88\u606F\u8BB0\u5F55").requiredOption("--agent <config_id>", "Agent \u914D\u7F6E ID\uFF08customer_agent_config_id\uFF09").requiredOption("--start <date>", "\u5F00\u59CB\u65F6\u95F4\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-05-20T00:00:00\uFF09").requiredOption("--end <date>", "\u7ED3\u675F\u65F6\u95F4\uFF08ISO \u683C\u5F0F\uFF0C\u5982 2026-05-20T23:59:59\uFF09").option("--page <number>", "\u9875\u7801", "1").action(async (opts) => {
1145
+ try {
1146
+ const data = await listTransferHumanConversations({
1147
+ customerAgentConfigId: opts.agent,
1148
+ startDate: opts.start,
1149
+ endDate: opts.end,
1150
+ page: Number(opts.page)
1151
+ });
1152
+ formatOutput({ success: true, data }, program2.opts().table);
1153
+ } catch (err) {
1154
+ reportCaughtError(err);
1155
+ process.exit(toExitCode(err));
1156
+ }
1157
+ });
1120
1158
  }
1121
1159
 
1122
1160
  // src/client/debug-api.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bty/customer-service-cli",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "AI Customer Service CLI - Agent friendly",
5
5
  "type": "module",
6
6
  "main": "./dist/bin.js",