weaver-work-cli 0.1.65 → 0.1.66

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 (80) hide show
  1. package/dist/chunks/{attachment-content-QUM27QNB.js → attachment-content-NRBGS5XG.js} +3 -3
  2. package/dist/chunks/{chunk-F4ME3CGS.js → chunk-2BAZJCG7.js} +2 -2
  3. package/dist/chunks/{chunk-SHX7XBYR.js → chunk-4WCVRDC5.js} +83 -33
  4. package/dist/chunks/{chunk-IJDZ7VDC.js → chunk-5FQT7GSN.js} +2 -2
  5. package/dist/chunks/{chunk-E3OQSNF5.js → chunk-AAOYOPHW.js} +1 -1
  6. package/dist/chunks/{chunk-LRK7YND4.js → chunk-BZ6HAY2U.js} +7 -7
  7. package/dist/chunks/{chunk-6AW5LW4T.js → chunk-EYEJW5SG.js} +4 -4
  8. package/dist/chunks/{chunk-CUY64WP4.js → chunk-GOZ75GHU.js} +38 -38
  9. package/dist/chunks/{chunk-JDZOYHAL.js → chunk-M7IEDTRI.js} +1 -1
  10. package/dist/chunks/{chunk-NZLFKBEM.js → chunk-NNXZMBIB.js} +6 -6
  11. package/dist/chunks/{chunk-K7QKQRSL.js → chunk-NP3ZZFGI.js} +24 -24
  12. package/dist/chunks/{chunk-QT7GGCSY.js → chunk-SAADVUK6.js} +32 -32
  13. package/dist/chunks/{chunk-IT3SB7RV.js → chunk-VWQGF3KW.js} +15 -4
  14. package/dist/chunks/{chunk-D6SWOUUP.js → chunk-YFX5JKOY.js} +2 -2
  15. package/dist/chunks/{chunk-ZV3TYANI.js → chunk-YT73QQMS.js} +1 -1
  16. package/dist/chunks/{conflict-76ZUL3E7.js → conflict-LJYKIUJM.js} +2 -2
  17. package/dist/chunks/{contract-INMS7SYQ.js → contract-N5WNHKHI.js} +94 -30
  18. package/dist/chunks/{create-flow-7WGKLRHH.js → create-flow-75MCKXGI.js} +6 -6
  19. package/dist/chunks/{entry-mode-3UMMMK6Z.js → entry-mode-3PI6A7JD.js} +3 -3
  20. package/dist/chunks/{env-7EGXNZR2.js → env-FI62FOKK.js} +2 -2
  21. package/dist/chunks/{factory-BDERKTYX.js → factory-HLS4SDQM.js} +1 -1
  22. package/dist/chunks/{group-chat-4E7EZMTJ.js → group-chat-MFBVOLKY.js} +3 -3
  23. package/dist/chunks/{lazy-dispatch-4WOIL3ZQ.js → lazy-dispatch-K25LTKQY.js} +2 -2
  24. package/dist/chunks/{meeting-2FMYZXG5.js → meeting-ROWDB3DO.js} +11 -11
  25. package/dist/chunks/{minute-doc-3DHMYMBE.js → minute-doc-ABMO2UDX.js} +2 -2
  26. package/dist/chunks/{registry-6UGQO35C.js → registry-NLAO2W6T.js} +2 -2
  27. package/dist/chunks/{registry-XXFMYPBM.js → registry-QV6IPRVM.js} +11 -11
  28. package/dist/chunks/{room-recommend-7LD2OHL5.js → room-recommend-P54PQTCN.js} +4 -4
  29. package/dist/chunks/{schedule-ZAYMZKTQ.js → schedule-BEBFGMT6.js} +4 -4
  30. package/dist/chunks/{smart-extract-FOBSVNYW.js → smart-extract-DEBLJPCQ.js} +11 -11
  31. package/dist/chunks/{workflow-NYJJIT3D.js → workflow-LBFFZZN2.js} +2 -2
  32. package/dist/cmd/refs/index.js +24 -23
  33. package/dist/core/output.js +134 -41
  34. package/dist/index.js +7 -7
  35. package/dist/shortcuts/contract/manifest.js +11 -4
  36. package/dist/shortcuts/contract/operations/first-screen.js +41 -19
  37. package/dist/shortcuts/contract/operations/flow.js +2 -0
  38. package/dist/shortcuts/contract/operations/ledger.js +58 -8
  39. package/dist/shortcuts/contract/operations/quote-recognize.js +31 -9
  40. package/dist/shortcuts/contract/operations/quote-submit.js +4 -1
  41. package/dist/shortcuts/contract/operations/upload.js +21 -1
  42. package/dist/shortcuts/contract/upload-cache.js +2 -2
  43. package/dist/shortcuts/smart-extract/operations/fill.js +14 -14
  44. package/dist/shortcuts/workflow/index.js +2 -2
  45. package/dist/shortcuts/workflow/operations/form.js +28 -4
  46. package/docs/agent-io-channel-design.md +21 -10
  47. package/docs/smart-extract.md +1 -1
  48. package/docs/todo-smart-convert/data-contract.md +1 -1
  49. package/package.json +1 -1
  50. package/skills/weaver-e10-jinchengda/SKILL.md +67 -31
  51. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +18 -18
  52. package/skills/weaver-e10-jinchengda/references/contract-clause-insert.md +4 -4
  53. package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
  54. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +2 -2
  55. package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +6 -6
  56. package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +3 -3
  57. package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
  58. package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +6 -6
  59. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +7 -7
  60. package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +9 -9
  61. package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +3 -3
  62. package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +11 -11
  63. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +18 -18
  64. package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +4 -4
  65. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -15
  66. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +51 -28
  67. package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +6 -6
  68. package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +1 -1
  69. package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +20 -9
  70. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +18 -18
  71. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +9 -9
  72. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +4 -4
  73. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +42 -30
  74. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  75. package/skills/weaver-e10-jinchengda/references/contract-type-fingerprints.md +8 -8
  76. package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +1 -1
  77. package/skills/weaver-e10-jinchengda/references/orchestration.md +2 -2
  78. package/skills/weaver-e10-jucailin/references/recruit-interview-overview.md +1 -1
  79. package/skills/weaver-e10-shared/references/json-output-contract.md +4 -3
  80. package/skills/weaver-e10-smart-extract/SKILL.md +1 -1
@@ -5,9 +5,9 @@ import {
5
5
  meetingEntryOperations,
6
6
  readEntryChoice,
7
7
  verifyEntryToken
8
- } from "./chunk-D6SWOUUP.js";
9
- import "./chunk-E3OQSNF5.js";
10
- import "./chunk-JDZOYHAL.js";
8
+ } from "./chunk-YFX5JKOY.js";
9
+ import "./chunk-AAOYOPHW.js";
10
+ import "./chunk-M7IEDTRI.js";
11
11
  import "./chunk-7BDPM5ST.js";
12
12
  import "./chunk-UG5G54VL.js";
13
13
  import "./chunk-BUSC6UAE.js";
@@ -6,8 +6,8 @@ import {
6
6
  meetingStateDir,
7
7
  readCache,
8
8
  resolveMeetingEnvMode
9
- } from "./chunk-E3OQSNF5.js";
10
- import "./chunk-JDZOYHAL.js";
9
+ } from "./chunk-AAOYOPHW.js";
10
+ import "./chunk-M7IEDTRI.js";
11
11
  import "./chunk-7BDPM5ST.js";
12
12
  import "./chunk-UG5G54VL.js";
13
13
  import "./chunk-BUSC6UAE.js";
@@ -12,7 +12,7 @@ import {
12
12
  requireConfirm,
13
13
  verifyLease,
14
14
  writeBody
15
- } from "./chunk-JDZOYHAL.js";
15
+ } from "./chunk-M7IEDTRI.js";
16
16
  import "./chunk-7BDPM5ST.js";
17
17
  import "./chunk-UG5G54VL.js";
18
18
  import "./chunk-BUSC6UAE.js";
@@ -6,9 +6,9 @@ import {
6
6
  ensureMeetingGroupChat,
7
7
  meetingEbGroupChatOperations,
8
8
  savePendingForm
9
- } from "./chunk-LRK7YND4.js";
10
- import "./chunk-E3OQSNF5.js";
11
- import "./chunk-JDZOYHAL.js";
9
+ } from "./chunk-BZ6HAY2U.js";
10
+ import "./chunk-AAOYOPHW.js";
11
+ import "./chunk-M7IEDTRI.js";
12
12
  import "./chunk-7BDPM5ST.js";
13
13
  import "./chunk-UG5G54VL.js";
14
14
  import "./chunk-BUSC6UAE.js";
@@ -5,8 +5,8 @@ import {
5
5
  createProgram,
6
6
  registerCommands,
7
7
  toCommandMetadata
8
- } from "./chunk-K7QKQRSL.js";
9
- import "./chunk-SHX7XBYR.js";
8
+ } from "./chunk-NP3ZZFGI.js";
9
+ import "./chunk-4WCVRDC5.js";
10
10
  import "./chunk-AJ62BGAW.js";
11
11
  import "./chunk-WSHIOSGM.js";
12
12
  import "./chunk-6N4JPNFL.js";
@@ -3,21 +3,21 @@ const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  getMeetingOperation,
5
5
  meetingOperationDefinitions
6
- } from "./chunk-CUY64WP4.js";
7
- import "./chunk-QT7GGCSY.js";
8
- import "./chunk-NZLFKBEM.js";
9
- import "./chunk-F4ME3CGS.js";
6
+ } from "./chunk-GOZ75GHU.js";
7
+ import "./chunk-SAADVUK6.js";
8
+ import "./chunk-NNXZMBIB.js";
9
+ import "./chunk-2BAZJCG7.js";
10
10
  import "./chunk-WMRNO6IU.js";
11
- import "./chunk-LRK7YND4.js";
12
- import "./chunk-D6SWOUUP.js";
13
- import "./chunk-IJDZ7VDC.js";
14
- import "./chunk-6AW5LW4T.js";
15
- import "./chunk-ZV3TYANI.js";
11
+ import "./chunk-BZ6HAY2U.js";
12
+ import "./chunk-YFX5JKOY.js";
13
+ import "./chunk-5FQT7GSN.js";
14
+ import "./chunk-EYEJW5SG.js";
15
+ import "./chunk-YT73QQMS.js";
16
16
  import {
17
17
  degradeMeetingEnvToStandard,
18
18
  meetingStateDir,
19
19
  readCache
20
- } from "./chunk-E3OQSNF5.js";
20
+ } from "./chunk-AAOYOPHW.js";
21
21
  import {
22
22
  MeetingCliError,
23
23
  asObject,
@@ -25,7 +25,7 @@ import {
25
25
  meetingAuthError,
26
26
  meetingNetworkError,
27
27
  meetingValidationError
28
- } from "./chunk-JDZOYHAL.js";
28
+ } from "./chunk-M7IEDTRI.js";
29
29
  import {
30
30
  reportPlatformError
31
31
  } from "./chunk-6N4JPNFL.js";
@@ -65,8 +65,8 @@ async function ensureMinuteDoc(env, input) {
65
65
  const id = String(input.id ?? "").trim();
66
66
  const mtId = String(input.mtId ?? "").trim();
67
67
  if (!id || !mtId) return null;
68
- const { getMeetingOperation } = await import("./registry-XXFMYPBM.js");
69
- const { meetingStateDir } = await import("./env-7EGXNZR2.js");
68
+ const { getMeetingOperation } = await import("./registry-QV6IPRVM.js");
69
+ const { meetingStateDir } = await import("./env-FI62FOKK.js");
70
70
  const { mkdir, writeFile } = await import("node:fs/promises");
71
71
  const { join } = await import("node:path");
72
72
  const subject = String(input.subject ?? "").trim() || `\u4F1A\u8BAE\u7EAA\u8981-${mtId}`;
@@ -4,10 +4,10 @@ import {
4
4
  getWorkflowOperation,
5
5
  hasWorkflowOperation,
6
6
  workflowOperationDefinitions
7
- } from "./chunk-IT3SB7RV.js";
7
+ } from "./chunk-VWQGF3KW.js";
8
8
  import "./chunk-HP7JIYMT.js";
9
9
  import "./chunk-WRXSAVKO.js";
10
- import "./chunk-SHX7XBYR.js";
10
+ import "./chunk-4WCVRDC5.js";
11
11
  import "./chunk-AJ62BGAW.js";
12
12
  import "./chunk-7BDPM5ST.js";
13
13
  import "./chunk-TJN4PIYO.js";
@@ -4,18 +4,18 @@ import {
4
4
  getMeetingOperation,
5
5
  hasMeetingOperation,
6
6
  meetingOperationDefinitions
7
- } from "./chunk-CUY64WP4.js";
8
- import "./chunk-QT7GGCSY.js";
9
- import "./chunk-NZLFKBEM.js";
10
- import "./chunk-F4ME3CGS.js";
7
+ } from "./chunk-GOZ75GHU.js";
8
+ import "./chunk-SAADVUK6.js";
9
+ import "./chunk-NNXZMBIB.js";
10
+ import "./chunk-2BAZJCG7.js";
11
11
  import "./chunk-WMRNO6IU.js";
12
- import "./chunk-LRK7YND4.js";
13
- import "./chunk-D6SWOUUP.js";
14
- import "./chunk-IJDZ7VDC.js";
15
- import "./chunk-6AW5LW4T.js";
16
- import "./chunk-ZV3TYANI.js";
17
- import "./chunk-E3OQSNF5.js";
18
- import "./chunk-JDZOYHAL.js";
12
+ import "./chunk-BZ6HAY2U.js";
13
+ import "./chunk-YFX5JKOY.js";
14
+ import "./chunk-5FQT7GSN.js";
15
+ import "./chunk-EYEJW5SG.js";
16
+ import "./chunk-YT73QQMS.js";
17
+ import "./chunk-AAOYOPHW.js";
18
+ import "./chunk-M7IEDTRI.js";
19
19
  import "./chunk-7BDPM5ST.js";
20
20
  import "./chunk-FDBAFANU.js";
21
21
  import "./chunk-UG5G54VL.js";
@@ -7,10 +7,10 @@ import {
7
7
  loadRooms,
8
8
  recommendRooms,
9
9
  rememberFrequentRoom
10
- } from "./chunk-6AW5LW4T.js";
11
- import "./chunk-ZV3TYANI.js";
12
- import "./chunk-E3OQSNF5.js";
13
- import "./chunk-JDZOYHAL.js";
10
+ } from "./chunk-EYEJW5SG.js";
11
+ import "./chunk-YT73QQMS.js";
12
+ import "./chunk-AAOYOPHW.js";
13
+ import "./chunk-M7IEDTRI.js";
14
14
  import "./chunk-7BDPM5ST.js";
15
15
  import "./chunk-UG5G54VL.js";
16
16
  import "./chunk-BUSC6UAE.js";
@@ -8,10 +8,10 @@ import {
8
8
  resolveMeetingScheduleTypeIds,
9
9
  resolveMemberIdsByName,
10
10
  runScheduleConflictFlow
11
- } from "./chunk-IJDZ7VDC.js";
12
- import "./chunk-ZV3TYANI.js";
13
- import "./chunk-E3OQSNF5.js";
14
- import "./chunk-JDZOYHAL.js";
11
+ } from "./chunk-5FQT7GSN.js";
12
+ import "./chunk-YT73QQMS.js";
13
+ import "./chunk-AAOYOPHW.js";
14
+ import "./chunk-M7IEDTRI.js";
15
15
  import "./chunk-7BDPM5ST.js";
16
16
  import "./chunk-UG5G54VL.js";
17
17
  import "./chunk-BUSC6UAE.js";
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
- DEFAULT_RESULT_THRESHOLD_BYTES
5
- } from "./chunk-SHX7XBYR.js";
4
+ defaultResultThresholdChars
5
+ } from "./chunk-4WCVRDC5.js";
6
6
  import {
7
7
  stateRoot
8
8
  } from "./chunk-AJ62BGAW.js";
@@ -2034,8 +2034,8 @@ function shortId(prefix) {
2034
2034
  return `${prefix}${randomBytes3(12).toString("hex")}`;
2035
2035
  }
2036
2036
  var INLINE_BUDGET_RATIO = 0.95;
2037
- var ENVELOPE_RESERVE_BYTES = 400;
2038
- var MIN_INLINE_BYTES_PER_ATTACHMENT = 2400;
2037
+ var ENVELOPE_RESERVE_CHARS = 400;
2038
+ var MIN_INLINE_CHARS_PER_ATTACHMENT = 800;
2039
2039
  function fillNextHint(sessionFile) {
2040
2040
  return `\u6309 fields \u62BD\u53D6\uFF0Corigin \u7528\u300C\u9644\u4EF6ID#\u539F\u6587\u7247\u6BB5\u300D\uFF0C\u53EA\u586B\u6709\u503C\u7684\u5B57\u6BB5\u3002\u6B63\u6587\uFF1A\u6709 text \u7684\u76F4\u63A5\u7528\uFF1B\u53EA\u6709 textFile \u7684\u7528 read_file \u8BFB\u4E00\u6B21\uFF08\u5168\u6587\u5728\u91CC\u9762\uFF09\uFF1BPDF/\u56FE\u7247/Excel \u8BFB path\u3002\u4E0D\u8981\u7528 --input-ref / --pick-as\uFF0C\u4E0D\u8981\u91CD\u65B0\u4E0B\u8F7D\u9644\u4EF6\uFF0C\u4E0D\u8981\u81EA\u5DF1\u89E3\u6790 docx\u3002\u62BD\u5B8C\u8C03 smart-extract.fill.save --input-json '{"sessionFile":"${sessionFile}","result":{...}}'\uFF0C\u62FF\u5230 aiExtraId \u5373\u7ED3\u675F\u3002`;
2041
2041
  }
@@ -2233,21 +2233,21 @@ var fill = {
2233
2233
  resultContract: RESULT_CONTRACT,
2234
2234
  next: fillNextHint(sessionFile)
2235
2235
  };
2236
- const inlineBudgetBytes = Math.floor(DEFAULT_RESULT_THRESHOLD_BYTES * INLINE_BUDGET_RATIO) - Buffer.byteLength(JSON.stringify({ ...basePayload, attachments: [] }), "utf8") - ENVELOPE_RESERVE_BYTES;
2237
- const perAttachmentBytes = Math.floor(inlineBudgetBytes / Math.max(1, downloaded.items.length));
2238
- const inlineAllowed = perAttachmentBytes > MIN_INLINE_BYTES_PER_ATTACHMENT;
2236
+ const inlineBudgetChars = Math.floor(defaultResultThresholdChars() * INLINE_BUDGET_RATIO) - JSON.stringify({ ...basePayload, attachments: [] }).length - ENVELOPE_RESERVE_CHARS;
2237
+ const perAttachmentChars = Math.floor(inlineBudgetChars / Math.max(1, downloaded.items.length));
2238
+ const inlineAllowed = perAttachmentChars > MIN_INLINE_CHARS_PER_ATTACHMENT;
2239
2239
  const extractedItems = await Promise.all(downloaded.items.map(async (item) => ({
2240
2240
  item,
2241
2241
  ...await extractText(item)
2242
2242
  })));
2243
- const totalTextBytes = extractedItems.reduce(
2244
- (sum, entry) => sum + Buffer.byteLength(entry.text ?? "", "utf8"),
2243
+ const totalTextChars = extractedItems.reduce(
2244
+ (sum, entry) => sum + (entry.text ?? "").length,
2245
2245
  0
2246
2246
  );
2247
- const allInline = totalTextBytes <= inlineBudgetBytes;
2247
+ const allInline = totalTextChars <= inlineBudgetChars;
2248
2248
  const attachments = await Promise.all(extractedItems.map(async ({ item, text: extractedText, chars }) => {
2249
2249
  const text = extractedText ?? "";
2250
- const oversized = allInline ? false : !inlineAllowed || Buffer.byteLength(text, "utf8") > perAttachmentBytes;
2250
+ const oversized = allInline ? false : !inlineAllowed || text.length > perAttachmentChars;
2251
2251
  let textFile;
2252
2252
  if (oversized && item.path) {
2253
2253
  textFile = `${item.path}.txt`;
@@ -17,7 +17,7 @@ import {
17
17
  validateRuleFile,
18
18
  workflowOperationDefinitions,
19
19
  workflowSuccess
20
- } from "./chunk-IT3SB7RV.js";
20
+ } from "./chunk-VWQGF3KW.js";
21
21
  import {
22
22
  createWorkflowContinuationSigner
23
23
  } from "./chunk-HP7JIYMT.js";
@@ -26,7 +26,7 @@ import {
26
26
  WorkflowCliError,
27
27
  workflowValidationError
28
28
  } from "./chunk-WRXSAVKO.js";
29
- import "./chunk-SHX7XBYR.js";
29
+ import "./chunk-4WCVRDC5.js";
30
30
  import "./chunk-AJ62BGAW.js";
31
31
  import {
32
32
  reportPlatformError
@@ -1,7 +1,7 @@
1
1
  import { CliError, ExitCode } from '../../core/errors.js';
2
2
  import { listRefs, pickValue, pruneRefs, readRef, readTextWindow, readWindow } from '../../core/refs.js';
3
3
  import { refsDir } from '../../core/state.js';
4
- import { bytesOf, DEFAULT_RESULT_THRESHOLD_BYTES, refMaxBytes, refMaxCount, resultThresholdBytes, } from '../../core/output.js';
4
+ import { charsOf, defaultResultThresholdChars, refMaxBytes, refMaxCount, resultThresholdChars, } from '../../core/output.js';
5
5
  /** 解析 `7d` / `24h` / `30m` / `90s` / 纯毫秒数。 */
6
6
  function parseDuration(value) {
7
7
  const raw = value.trim().toLowerCase();
@@ -50,9 +50,9 @@ export const refsCommand = {
50
50
  if (!id)
51
51
  throw new CliError('refId 不能为空', ExitCode.UsageError);
52
52
  const record = readRef(ctx, id);
53
- const configuredLimit = resultThresholdBytes(ctx);
54
- const displayLimit = configuredLimit > 0 ? configuredLimit : DEFAULT_RESULT_THRESHOLD_BYTES;
55
- if (bytesOf(record.envelope) > displayLimit) {
53
+ const configuredLimit = resultThresholdChars(ctx);
54
+ const displayLimit = configuredLimit > 0 ? configuredLimit : defaultResultThresholdChars();
55
+ if (charsOf(record.envelope) > displayLimit) {
56
56
  throw new CliError(`结果太大,不能安全地一次显示。请用 refs get ${id} <json-path> 读取需要的字段。`, ExitCode.UsageError);
57
57
  }
58
58
  // 用户主动查看完整结果,不再二次落盘。
@@ -95,19 +95,20 @@ export const refsCommand = {
95
95
  }
96
96
  const record = readRef(ctx, id);
97
97
  const picked = pickValue(record.envelope, jsonPath);
98
- const configuredLimit = resultThresholdBytes(ctx);
99
- const displayLimit = configuredLimit > 0 ? configuredLimit : DEFAULT_RESULT_THRESHOLD_BYTES;
98
+ const configuredLimit = resultThresholdChars(ctx);
99
+ const displayLimit = configuredLimit > 0 ? configuredLimit : defaultResultThresholdChars();
100
100
  if (typeof picked === 'string') {
101
101
  if (hasArrayWindow) {
102
102
  throw new CliError('字符串请使用 --char-offset / --char-limit 分段读取', ExitCode.UsageError);
103
103
  }
104
- const bytes = bytesOf(picked);
105
- if (!hasTextWindow && bytes <= displayLimit) {
104
+ const chars = charsOf(picked);
105
+ if (!hasTextWindow && chars <= displayLimit) {
106
106
  ctx.output.write(picked, { json: true, persist: false });
107
107
  return;
108
108
  }
109
109
  const totalChars = Array.from(picked).length;
110
- const perChar = totalChars > 0 ? Math.max(1, Math.ceil(bytes / totalChars)) : 1;
110
+ // 源码字符 → 序列化字符的膨胀比(换行/引号要转义),用来把字符预算折算成分段长度。
111
+ const perChar = totalChars > 0 ? Math.max(1, Math.ceil(chars / totalChars)) : 1;
111
112
  const autoLimit = Math.max(1, Math.floor((displayLimit - 2048) / perChar));
112
113
  const pageOf = (size) => {
113
114
  const window = readTextWindow(picked, charOffset, size);
@@ -131,10 +132,10 @@ export const refsCommand = {
131
132
  let size = requestedCharLimit ?? autoLimit;
132
133
  let page = pageOf(size);
133
134
  for (let round = 0; round < 8; round += 1) {
134
- const pageBytes = bytesOf(page);
135
- if (pageBytes <= displayLimit || size <= 1)
135
+ const pageChars = charsOf(page);
136
+ if (pageChars <= displayLimit || size <= 1)
136
137
  break;
137
- size = Math.max(1, Math.floor((size * displayLimit) / pageBytes) - 1);
138
+ size = Math.max(1, Math.floor((size * displayLimit) / pageChars) - 1);
138
139
  page = pageOf(size);
139
140
  }
140
141
  ctx.output.write(page, { json: true, persist: false });
@@ -147,18 +148,18 @@ export const refsCommand = {
147
148
  if (hasArrayWindow) {
148
149
  throw new CliError('--offset / --limit 只能用于数组字段', ExitCode.UsageError);
149
150
  }
150
- const bytes = bytesOf(picked);
151
- if (bytes > displayLimit) {
152
- throw new CliError(`${jsonPath} 是单个非文本值,约 ${bytes} 字节,超过单次输出预算 ${displayLimit} 字节。`
151
+ const chars = charsOf(picked);
152
+ if (chars > displayLimit) {
153
+ throw new CliError(`${jsonPath} 是单个非文本值,约 ${chars} 字符,超过单次输出预算 ${displayLimit} 字符。`
153
154
  + '请改用更细的 JSON 路径取值,或走业务命令的导出能力。', ExitCode.UsageError);
154
155
  }
155
156
  ctx.output.write(picked, { json: true, persist: false });
156
157
  return;
157
158
  }
158
159
  const total = picked.length;
159
- const bytes = bytesOf(picked);
160
- // 未给 --limit 但整段装不下时,按"平均每条字节"估一个能装下的批量,自动只回一批。
161
- const perItem = total > 0 ? Math.max(1, Math.ceil(bytes / total)) : 1;
160
+ const chars = charsOf(picked);
161
+ // 未给 --limit 但整段装不下时,按"平均每条字符"估一个能装下的批量,自动只回一批。
162
+ const perItem = total > 0 ? Math.max(1, Math.ceil(chars / total)) : 1;
162
163
  const autoLimit = Math.max(1, Math.floor((displayLimit - 2048) / perItem));
163
164
  const pageOf = (size) => {
164
165
  const window = readWindow(picked, offset, size);
@@ -178,14 +179,14 @@ export const refsCommand = {
178
179
  ...(nextHint === undefined ? {} : { largeOutputNotice: nextHint }),
179
180
  };
180
181
  };
181
- // 平均字节估不准(条目长短不一、缩进空白),按实际序列化结果回压,最多收敛 4 轮。
182
- let size = requestedLimit ?? (bytes > displayLimit ? autoLimit : Math.max(total - offset, 1));
182
+ // 平均字符估不准(条目长短不一、缩进空白),按实际序列化结果回压,最多收敛 4 轮。
183
+ let size = requestedLimit ?? (chars > displayLimit ? autoLimit : Math.max(total - offset, 1));
183
184
  let page = pageOf(size);
184
185
  for (let round = 0; round < 4; round += 1) {
185
- const pageBytes = bytesOf(page);
186
- if (pageBytes <= displayLimit || size <= 1)
186
+ const pageChars = charsOf(page);
187
+ if (pageChars <= displayLimit || size <= 1)
187
188
  break;
188
- size = Math.max(1, Math.floor((size * displayLimit) / pageBytes) - 1);
189
+ size = Math.max(1, Math.floor((size * displayLimit) / pageChars) - 1);
189
190
  page = pageOf(size);
190
191
  }
191
192
  ctx.output.write(page, { json: true, persist: false });