@bty/customer-service-cli 0.6.10 → 0.6.11

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.11 (2026-08-27)
4
+
5
+ - `workspace points-consumes` 改用 `customer-observability-api` 备库 Cursor 接口,支持 `--cursor`、`--start`、`--end`、`--limit`,可继续读取超过 10000 条的历史积分流水。
6
+
3
7
  ## 0.6.10 (2026-08-26)
4
8
 
5
9
  - `context-search`:`query_content` 增加最少 2 个字符的本地校验,避免过短关键词触发服务端全量扫描。
package/dist/bin.js CHANGED
@@ -1258,16 +1258,31 @@ async function getDailyDeduction(opts) {
1258
1258
  }
1259
1259
  );
1260
1260
  }
1261
+ var MAX_POINTS_CURSOR_PAGES = 500;
1261
1262
  async function getPointsConsumes(opts) {
1262
1263
  const request = createRequest();
1263
- return request(
1264
- getCustomerServiceUrl(),
1265
- "/v1/workspace/points_consumes",
1266
- {
1267
- method: "POST",
1268
- body: { page: opts.page, page_size: opts.pageSize, debug: true }
1264
+ const items = [];
1265
+ let cursor = opts.cursor;
1266
+ let fetchedPages = 0;
1267
+ while (fetchedPages < MAX_POINTS_CURSOR_PAGES) {
1268
+ fetchedPages += 1;
1269
+ const page = await request(getObservabilityUrl(), "/v1/points/consumes", {
1270
+ method: "GET",
1271
+ query: {
1272
+ cursor,
1273
+ start_time: opts.startTime,
1274
+ end_time: opts.endTime,
1275
+ limit: opts.limit
1276
+ }
1277
+ });
1278
+ items.push(...page.items);
1279
+ const nextCursor = page.has_more && page.next_cursor ? page.next_cursor : void 0;
1280
+ if (!nextCursor) {
1281
+ return { ...page, items, next_cursor: null, has_more: false, fetched_pages: fetchedPages };
1269
1282
  }
1270
- );
1283
+ cursor = nextCursor;
1284
+ }
1285
+ throw new Error(`\u79EF\u5206\u6D41\u6C34\u5206\u9875\u8D85\u8FC7 ${MAX_POINTS_CURSOR_PAGES} \u9875\uFF0C\u8BF7\u7F29\u5C0F\u65F6\u95F4\u8303\u56F4`);
1271
1286
  }
1272
1287
 
1273
1288
  // src/commands/config.ts
@@ -7511,17 +7526,18 @@ function registerWorkspaceCommand(program2) {
7511
7526
  process.exit(toExitCode(err));
7512
7527
  }
7513
7528
  });
7514
- workspace.command("points-consumes").description("\u5206\u9875\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u7A7A\u95F4\u7684\u79EF\u5206\u8D26\u6237\u6D88\u8017\u6D41\u6C34\uFF0C\u56FA\u5B9A\u8FD4\u56DE extra \u8C03\u8BD5\u5B57\u6BB5").option("--page <number>", "\u9875\u7801\uFF0C\u9ED8\u8BA4 1", "1").option("--page-size <number>", "\u6BCF\u9875\u6570\u91CF\uFF0C\u9ED8\u8BA4 20", "20").action(async (opts) => {
7529
+ workspace.command("points-consumes").description("\u4F7F\u7528\u6E38\u6807\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u7A7A\u95F4\u7684\u79EF\u5206\u6D41\u6C34\uFF08\u8BFB\u53D6\u89C2\u6D4B\u670D\u52A1\u5907\u5E93\uFF09").option("--cursor <token>", "\u4E0B\u4E00\u9875\u6E38\u6807").option("--start <ISO>", "\u8D77\u59CB\u65F6\u95F4\uFF08\u542B\uFF09").option("--end <ISO>", "\u7ED3\u675F\u65F6\u95F4\uFF08\u4E0D\u542B\uFF09").option("--limit <number>", "\u6BCF\u6279\u6570\u91CF\uFF0C\u9ED8\u8BA4 100", "100").action(async (opts) => {
7515
7530
  try {
7516
- const page = Number(opts.page);
7517
- const pageSize = Number(opts.pageSize);
7518
- if (!Number.isInteger(page) || page <= 0) {
7519
- throw new Error("--page \u5FC5\u987B\u4E3A\u6B63\u6574\u6570");
7531
+ const limit = Number(opts.limit);
7532
+ if (!Number.isInteger(limit) || limit <= 0 || limit > 500) {
7533
+ throw new Error("--limit \u5FC5\u987B\u4E3A 1-500 \u7684\u6574\u6570");
7520
7534
  }
7521
- if (!Number.isInteger(pageSize) || pageSize <= 0) {
7522
- throw new Error("--page-size \u5FC5\u987B\u4E3A\u6B63\u6574\u6570");
7523
- }
7524
- const data = await getPointsConsumes({ page, pageSize });
7535
+ const data = await getPointsConsumes({
7536
+ cursor: opts.cursor,
7537
+ startTime: opts.start,
7538
+ endTime: opts.end,
7539
+ limit
7540
+ });
7525
7541
  formatOutput({ success: true, data }, program2.opts().table);
7526
7542
  } catch (err) {
7527
7543
  reportCaughtError(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bty/customer-service-cli",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "AI Customer Service CLI - Agent friendly",
5
5
  "type": "module",
6
6
  "main": "./dist/bin.js",