weaver-work-cli 0.1.60 → 0.1.62

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 (139) hide show
  1. package/dist/chunks/{archive-4SQAVTIB.js → archive-S2VKZWQ3.js} +2 -2
  2. package/dist/chunks/{archive-oa-W2UEJ67L.js → archive-oa-HEDSIUUY.js} +2 -2
  3. package/dist/chunks/{asset-EGZEABBI.js → asset-HYH4W357.js} +2 -2
  4. package/dist/chunks/{asset-idle-EBUZBB6M.js → asset-idle-N7REBNGL.js} +2 -2
  5. package/dist/chunks/{attachment-content-I6WHKGR2.js → attachment-content-VYYA75FR.js} +3 -3
  6. package/dist/chunks/{blog-2YKMWOWI.js → blog-SLMZZICV.js} +2 -2
  7. package/dist/chunks/{caizhilian-5NM4X5HG.js → caizhilian-RV43KKBT.js} +4 -4
  8. package/dist/chunks/{calendar-H4QTJCUY.js → calendar-DMVZ4OLY.js} +2 -2
  9. package/dist/chunks/{chunk-VLL6JOB4.js → chunk-6XSSAUNW.js} +4 -4
  10. package/dist/chunks/{chunk-VQWPQTEY.js → chunk-BIA2NKUG.js} +4 -4
  11. package/dist/chunks/{chunk-VMCCRWFO.js → chunk-BQYX2UX5.js} +2 -2
  12. package/dist/chunks/{chunk-XF7S6FQW.js → chunk-DTCQFTHW.js} +1 -1
  13. package/dist/chunks/{chunk-CPG6NLN4.js → chunk-E5YD5JWR.js} +1 -1
  14. package/dist/chunks/{chunk-PH7N4UFT.js → chunk-EGANE35F.js} +1 -1
  15. package/dist/chunks/{chunk-Z4IPY5GV.js → chunk-H6YOMI3U.js} +2 -2
  16. package/dist/chunks/{chunk-HHH4K3YY.js → chunk-ILALC2N6.js} +1 -1
  17. package/dist/chunks/{chunk-WINR2Q6K.js → chunk-KXJA42EA.js} +86 -19
  18. package/dist/chunks/{chunk-CQ4OVCKG.js → chunk-KY3R42RS.js} +2 -2
  19. package/dist/chunks/{chunk-WVH5ESDA.js → chunk-NRYDJN4J.js} +1 -1
  20. package/dist/chunks/{chunk-TGM7BWEH.js → chunk-P6TXQK75.js} +2 -2
  21. package/dist/chunks/{chunk-6YWHRXEQ.js → chunk-QBDXJS2W.js} +119 -9
  22. package/dist/chunks/{chunk-2IGZUMNG.js → chunk-SHX7XBYR.js} +180 -18
  23. package/dist/chunks/{chunk-P7RXQDCA.js → chunk-T2KVJFWJ.js} +4 -4
  24. package/dist/chunks/{chunk-FMNCSYIG.js → chunk-TEZHIB6T.js} +2 -2
  25. package/dist/chunks/{chunk-HMIIVM2L.js → chunk-UBGWIXU3.js} +97 -45
  26. package/dist/chunks/{chunk-5N222HK6.js → chunk-UBRWONP4.js} +2 -2
  27. package/dist/chunks/{chunk-7U5YHCW7.js → chunk-UQFPF4EX.js} +2 -2
  28. package/dist/chunks/{chunk-4GG72JAT.js → chunk-V2LASYKO.js} +2 -2
  29. package/dist/chunks/{chunk-BDBTZVYA.js → chunk-VBFBMM7G.js} +55 -55
  30. package/dist/chunks/{chunk-YHSOCGKO.js → chunk-VNYOUAWV.js} +11 -11
  31. package/dist/chunks/{chunk-SFM3M2L3.js → chunk-WIWDVETN.js} +19 -3
  32. package/dist/chunks/{chunk-44KJ7WFA.js → chunk-XT77MP54.js} +2 -2
  33. package/dist/chunks/{chunk-JFKMPRZB.js → chunk-YI2YMW5N.js} +50 -3
  34. package/dist/chunks/{conflict-QMDLS2EW.js → conflict-GFJRS6I7.js} +2 -2
  35. package/dist/chunks/{contract-LLRKMLQQ.js → contract-U3ZGNRWB.js} +2 -2
  36. package/dist/chunks/{cowork-2RDFBZWB.js → cowork-EX7PKIDK.js} +2 -2
  37. package/dist/chunks/{create-flow-5ODJ7WJO.js → create-flow-EJZD434E.js} +6 -6
  38. package/dist/chunks/{data-LVDFIRNG.js → data-FOODGAMF.js} +278 -121
  39. package/dist/chunks/{ebuilder-form-7WA6X6ZI.js → ebuilder-form-I2EOKODG.js} +3 -3
  40. package/dist/chunks/{ehr-52GBKNJR.js → ehr-TE4RFNID.js} +2 -2
  41. package/dist/chunks/{entry-mode-73BJML22.js → entry-mode-ZOLSXEGX.js} +9 -5
  42. package/dist/chunks/{env-OHFS76HV.js → env-TID5NFR6.js} +2 -2
  43. package/dist/chunks/{esb-HJSXCEOM.js → esb-7L6MHYLB.js} +4 -4
  44. package/dist/chunks/{factory-FRTA2LP4.js → factory-OG7BPMH5.js} +1 -1
  45. package/dist/chunks/{fna-OBACRT3J.js → fna-6V2ENR3Y.js} +2 -2
  46. package/dist/chunks/{group-chat-KBFRPCR2.js → group-chat-5DKPWIHL.js} +3 -3
  47. package/dist/chunks/{host-TTSGY5NZ.js → host-3DLYA54R.js} +3 -3
  48. package/dist/chunks/{host-KJT3G5D2.js → host-GOJHHTPY.js} +3 -3
  49. package/dist/chunks/{host-KOWUMNAY.js → host-OGBHL75G.js} +3 -3
  50. package/dist/chunks/{host-MFXRA2MY.js → host-ONZC6AE7.js} +3 -3
  51. package/dist/chunks/{host-W4JCNRFS.js → host-TJ5VVHM7.js} +3 -3
  52. package/dist/chunks/{host-2BKMPWDH.js → host-VTPAWDZV.js} +3 -3
  53. package/dist/chunks/{hrm-AK3WGBMN.js → hrm-2N7NFQDZ.js} +3 -3
  54. package/dist/chunks/{im-JZSBPO4Z.js → im-XCH47ZBN.js} +3 -3
  55. package/dist/chunks/{invoice-6XDMPCWB.js → invoice-5KJ7T774.js} +198 -331
  56. package/dist/chunks/{jiuchuanhui-K4EQU6GK.js → jiuchuanhui-PL6DRPBM.js} +2 -2
  57. package/dist/chunks/{lazy-dispatch-GCA6HDOB.js → lazy-dispatch-UATEN7H7.js} +5 -5
  58. package/dist/chunks/{mail-IKVCQCVZ.js → mail-Q7Z4CQ4D.js} +2 -2
  59. package/dist/chunks/{meeting-ARHVWK7G.js → meeting-5E3BNARL.js} +13 -13
  60. package/dist/chunks/{minute-doc-547KSYKR.js → minute-doc-NXRE5C77.js} +4 -4
  61. package/dist/chunks/{okr-KV43FPPX.js → okr-3O3XNYOK.js} +2 -2
  62. package/dist/chunks/{operations-6NXJ7RTE.js → operations-EZWG72FH.js} +4 -4
  63. package/dist/chunks/performance-Y7CPNSOR.js +1295 -0
  64. package/dist/chunks/{plan-WOYR4WEG.js → plan-BLGPZF5M.js} +2 -2
  65. package/dist/chunks/{project-CQJKBUIL.js → project-6MZMLJMP.js} +2 -2
  66. package/dist/chunks/{reception-MPBU3JXC.js → reception-F2VT2X52.js} +2 -2
  67. package/dist/chunks/{recruit-stage-USTTRHOX.js → recruit-stage-4ETIBMIW.js} +2 -2
  68. package/dist/chunks/{registry-GURQG4ZV.js → registry-3FYSWV3U.js} +3 -3
  69. package/dist/chunks/{registry-SS5J2FZQ.js → registry-7RS74TCK.js} +4 -4
  70. package/dist/chunks/{registry-H5HQ5QNH.js → registry-I4DVPDMU.js} +11 -11
  71. package/dist/chunks/{room-recommend-3UBROMZE.js → room-recommend-GWCVKCXW.js} +4 -4
  72. package/dist/chunks/{schedule-FTUQML6O.js → schedule-6AN63MJQ.js} +4 -4
  73. package/dist/chunks/{smart-extract-APX2PNIN.js → smart-extract-SR4SJJKN.js} +3 -3
  74. package/dist/chunks/{workflow-WMPW3WSB.js → workflow-KF7FA2UQ.js} +7 -7
  75. package/dist/cmd/refs/index.js +124 -4
  76. package/dist/core/output.js +199 -26
  77. package/dist/core/refs.js +36 -0
  78. package/dist/index.js +38 -33
  79. package/dist/internal/e10/auth/xiaoe.js +25 -3
  80. package/dist/shortcuts/caizhilian/operations/files.js +86 -15
  81. package/dist/shortcuts/data/index.js +12 -2
  82. package/dist/shortcuts/data/manifest.js +4 -2
  83. package/dist/shortcuts/data/operations/attribution.js +229 -0
  84. package/dist/shortcuts/data/operations/ds.js +87 -90
  85. package/dist/shortcuts/data/operations/index.js +3 -1
  86. package/dist/shortcuts/index.js +5 -0
  87. package/dist/shortcuts/invoice/manifest.js +30 -62
  88. package/dist/shortcuts/invoice/operations/registry.js +2 -2
  89. package/dist/shortcuts/invoice/operations/reim-customer.js +111 -0
  90. package/dist/shortcuts/invoice/operations/shared.js +0 -204
  91. package/dist/shortcuts/meeting/operations/eb/create-flow.js +84 -16
  92. package/dist/shortcuts/meeting/operations/eb/entry-mode.js +61 -7
  93. package/dist/shortcuts/performance/continuation.js +74 -0
  94. package/dist/shortcuts/performance/errors.js +65 -0
  95. package/dist/shortcuts/performance/host.js +105 -0
  96. package/dist/shortcuts/performance/index.js +109 -0
  97. package/dist/shortcuts/performance/manifest.js +30 -0
  98. package/dist/shortcuts/performance/operations/hrm-resolve.js +114 -0
  99. package/dist/shortcuts/performance/operations/registry.js +44 -0
  100. package/dist/shortcuts/performance/operations/scheme-detail.js +70 -0
  101. package/dist/shortcuts/performance/operations/scheme-draft.js +116 -0
  102. package/dist/shortcuts/performance/operations/scheme-publish.js +158 -0
  103. package/dist/shortcuts/performance/operations/types.js +32 -0
  104. package/dist/shortcuts/performance/scheme-validate.js +307 -0
  105. package/dist/shortcuts/performance/shared.js +158 -0
  106. package/docs/agent-invoice.md +1 -1
  107. package/docs/agent-io-channel-design.md +67 -3
  108. package/docs/data.md +2 -1
  109. package/docs/invoice.md +0 -2
  110. package/package.json +1 -1
  111. package/scripts/xiaoe_env.py +6 -1
  112. package/skill-template/business-info.json +19 -0
  113. package/skill-template/domains/performance.md +18 -0
  114. package/skill-template/domains/yepiaotong.md +0 -1
  115. package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
  116. package/skills/weaver-e10-data/references/datasource.md +2 -1
  117. package/skills/weaver-e10-meeting/SKILL.md +5 -3
  118. package/skills/weaver-e10-performance/SKILL.md +202 -0
  119. package/skills/weaver-e10-performance/agents/openai.yaml +74 -0
  120. package/skills/weaver-e10-performance/references/default-assembly.md +108 -0
  121. package/skills/weaver-e10-performance/references/entity-resolution.md +69 -0
  122. package/skills/weaver-e10-performance/references/enums-and-normalization.md +80 -0
  123. package/skills/weaver-e10-performance/references/examples.md +146 -0
  124. package/skills/weaver-e10-performance/references/extraction-guide.md +144 -0
  125. package/skills/weaver-e10-performance/references/scheme-edit-req-fields.md +185 -0
  126. package/skills/weaver-e10-performance/references/scheme-setting-page.md +62 -0
  127. package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +483 -0
  128. package/skills/weaver-e10-shared/references/json-output-contract.md +5 -0
  129. package/skills/weaver-e10-yepiaotong/SKILL.md +16 -9
  130. package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +9 -7
  131. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +15 -11
  132. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +29 -25
  133. package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +89 -0
  134. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +35 -37
  135. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +66 -63
  136. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +50 -71
  137. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +34 -95
  138. package/dist/shortcuts/invoice/operations/browse-field.js +0 -17
  139. package/skills/weaver-e10-yepiaotong/references/invoice-browse-field-data.md +0 -204
@@ -12,11 +12,11 @@ import {
12
12
  createE10RequestRuntime,
13
13
  isE10SessionExpiredResponse,
14
14
  requireE10Session
15
- } from "./chunk-WVH5ESDA.js";
15
+ } from "./chunk-NRYDJN4J.js";
16
16
  import {
17
17
  E10_SESSION_EXPIRED_MESSAGE,
18
18
  getActiveProfile
19
- } from "./chunk-SFM3M2L3.js";
19
+ } from "./chunk-WIWDVETN.js";
20
20
  import "./chunk-SHYQUBY3.js";
21
21
  import {
22
22
  CliError,
@@ -11,11 +11,11 @@ import {
11
11
  createE10RequestRuntime,
12
12
  isE10SessionExpiredResponse,
13
13
  requireE10Session
14
- } from "./chunk-WVH5ESDA.js";
14
+ } from "./chunk-NRYDJN4J.js";
15
15
  import {
16
16
  E10_SESSION_EXPIRED_MESSAGE,
17
17
  getActiveProfile
18
- } from "./chunk-SFM3M2L3.js";
18
+ } from "./chunk-WIWDVETN.js";
19
19
  import "./chunk-SHYQUBY3.js";
20
20
  import {
21
21
  CliError,
@@ -7,8 +7,8 @@ import {
7
7
  E10ApiError,
8
8
  createE10RequestRuntime,
9
9
  getE10Session
10
- } from "./chunk-WVH5ESDA.js";
11
- import "./chunk-SFM3M2L3.js";
10
+ } from "./chunk-NRYDJN4J.js";
11
+ import "./chunk-WIWDVETN.js";
12
12
  import "./chunk-SHYQUBY3.js";
13
13
  import {
14
14
  CliError,
@@ -12,11 +12,11 @@ import {
12
12
  createE10RequestRuntime,
13
13
  isE10SessionExpiredResponse,
14
14
  requireE10Session
15
- } from "./chunk-WVH5ESDA.js";
15
+ } from "./chunk-NRYDJN4J.js";
16
16
  import {
17
17
  E10_SESSION_EXPIRED_MESSAGE,
18
18
  getActiveProfile
19
- } from "./chunk-SFM3M2L3.js";
19
+ } from "./chunk-WIWDVETN.js";
20
20
  import "./chunk-SHYQUBY3.js";
21
21
  import {
22
22
  CliError,
@@ -4,13 +4,13 @@ import {
4
4
  getWorkflowOperation,
5
5
  hasWorkflowOperation,
6
6
  workflowOperationDefinitions
7
- } from "./chunk-44KJ7WFA.js";
7
+ } from "./chunk-XT77MP54.js";
8
8
  import "./chunk-HP7JIYMT.js";
9
9
  import "./chunk-WRXSAVKO.js";
10
- import "./chunk-2IGZUMNG.js";
10
+ import "./chunk-SHX7XBYR.js";
11
11
  import "./chunk-AJ62BGAW.js";
12
12
  import "./chunk-7BDPM5ST.js";
13
- import "./chunk-SFM3M2L3.js";
13
+ import "./chunk-WIWDVETN.js";
14
14
  import "./chunk-SHYQUBY3.js";
15
15
  import "./chunk-UG5G54VL.js";
16
16
  import "./chunk-BUSC6UAE.js";
@@ -4,12 +4,12 @@ import {
4
4
  esbOperationDefinitions,
5
5
  getEsbOperation,
6
6
  hasEsbOperation
7
- } from "./chunk-PH7N4UFT.js";
8
- import "./chunk-CQ4OVCKG.js";
7
+ } from "./chunk-EGANE35F.js";
8
+ import "./chunk-KY3R42RS.js";
9
9
  import "./chunk-TXUG266F.js";
10
10
  import "./chunk-7BDPM5ST.js";
11
- import "./chunk-WVH5ESDA.js";
12
- import "./chunk-SFM3M2L3.js";
11
+ import "./chunk-NRYDJN4J.js";
12
+ import "./chunk-WIWDVETN.js";
13
13
  import "./chunk-SHYQUBY3.js";
14
14
  import "./chunk-UG5G54VL.js";
15
15
  import "./chunk-BUSC6UAE.js";
@@ -4,18 +4,18 @@ import {
4
4
  getMeetingOperation,
5
5
  hasMeetingOperation,
6
6
  meetingOperationDefinitions
7
- } from "./chunk-BDBTZVYA.js";
8
- import "./chunk-7U5YHCW7.js";
7
+ } from "./chunk-VBFBMM7G.js";
8
+ import "./chunk-UBGWIXU3.js";
9
+ import "./chunk-6XSSAUNW.js";
10
+ import "./chunk-UQFPF4EX.js";
9
11
  import "./chunk-WMRNO6IU.js";
10
- import "./chunk-YHSOCGKO.js";
11
- import "./chunk-JFKMPRZB.js";
12
- import "./chunk-HMIIVM2L.js";
13
- import "./chunk-VLL6JOB4.js";
14
- import "./chunk-VQWPQTEY.js";
15
- import "./chunk-P7RXQDCA.js";
16
- import "./chunk-HHH4K3YY.js";
17
- import "./chunk-CPG6NLN4.js";
18
- import "./chunk-XF7S6FQW.js";
12
+ import "./chunk-VNYOUAWV.js";
13
+ import "./chunk-YI2YMW5N.js";
14
+ import "./chunk-BIA2NKUG.js";
15
+ import "./chunk-T2KVJFWJ.js";
16
+ import "./chunk-ILALC2N6.js";
17
+ import "./chunk-E5YD5JWR.js";
18
+ import "./chunk-DTCQFTHW.js";
19
19
  import "./chunk-7BDPM5ST.js";
20
20
  import "./chunk-SHYQUBY3.js";
21
21
  import "./chunk-UG5G54VL.js";
@@ -7,10 +7,10 @@ import {
7
7
  loadRooms,
8
8
  recommendRooms,
9
9
  rememberFrequentRoom
10
- } from "./chunk-P7RXQDCA.js";
11
- import "./chunk-HHH4K3YY.js";
12
- import "./chunk-CPG6NLN4.js";
13
- import "./chunk-XF7S6FQW.js";
10
+ } from "./chunk-T2KVJFWJ.js";
11
+ import "./chunk-ILALC2N6.js";
12
+ import "./chunk-E5YD5JWR.js";
13
+ import "./chunk-DTCQFTHW.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-VQWPQTEY.js";
12
- import "./chunk-HHH4K3YY.js";
13
- import "./chunk-CPG6NLN4.js";
14
- import "./chunk-XF7S6FQW.js";
11
+ } from "./chunk-BIA2NKUG.js";
12
+ import "./chunk-ILALC2N6.js";
13
+ import "./chunk-E5YD5JWR.js";
14
+ import "./chunk-DTCQFTHW.js";
15
15
  import "./chunk-7BDPM5ST.js";
16
16
  import "./chunk-UG5G54VL.js";
17
17
  import "./chunk-BUSC6UAE.js";
@@ -2,7 +2,7 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
3
  import {
4
4
  DEFAULT_RESULT_THRESHOLD_BYTES
5
- } from "./chunk-2IGZUMNG.js";
5
+ } from "./chunk-SHX7XBYR.js";
6
6
  import {
7
7
  stateRoot
8
8
  } from "./chunk-AJ62BGAW.js";
@@ -15,10 +15,10 @@ import {
15
15
  createE10RequestRuntime,
16
16
  isE10SessionExpiredResponse,
17
17
  requireE10Session
18
- } from "./chunk-WVH5ESDA.js";
18
+ } from "./chunk-NRYDJN4J.js";
19
19
  import {
20
20
  getActiveProfile
21
- } from "./chunk-SFM3M2L3.js";
21
+ } from "./chunk-WIWDVETN.js";
22
22
  import "./chunk-SHYQUBY3.js";
23
23
  import {
24
24
  CliError,
@@ -14,26 +14,26 @@ import {
14
14
  validateRuleFile,
15
15
  workflowOperationDefinitions,
16
16
  workflowSuccess
17
- } from "./chunk-44KJ7WFA.js";
18
- import {
19
- createWorkflowHost
20
- } from "./chunk-TGM7BWEH.js";
17
+ } from "./chunk-XT77MP54.js";
21
18
  import {
22
19
  createWorkflowContinuationSigner
23
20
  } from "./chunk-HP7JIYMT.js";
21
+ import {
22
+ createWorkflowHost
23
+ } from "./chunk-P6TXQK75.js";
24
24
  import {
25
25
  CLARIFICATION_SUBTYPE,
26
26
  WorkflowCliError,
27
27
  workflowValidationError
28
28
  } from "./chunk-WRXSAVKO.js";
29
- import "./chunk-2IGZUMNG.js";
29
+ import "./chunk-SHX7XBYR.js";
30
30
  import "./chunk-AJ62BGAW.js";
31
31
  import {
32
32
  reportPlatformError
33
33
  } from "./chunk-6N4JPNFL.js";
34
34
  import "./chunk-7BDPM5ST.js";
35
- import "./chunk-WVH5ESDA.js";
36
- import "./chunk-SFM3M2L3.js";
35
+ import "./chunk-NRYDJN4J.js";
36
+ import "./chunk-WIWDVETN.js";
37
37
  import "./chunk-SHYQUBY3.js";
38
38
  import {
39
39
  isCliError,
@@ -1,5 +1,5 @@
1
1
  import { CliError, ExitCode } from '../../core/errors.js';
2
- import { listRefs, pickValue, pruneRefs, readRef } from '../../core/refs.js';
2
+ import { listRefs, pickValue, pruneRefs, readRef, readTextWindow, readWindow } from '../../core/refs.js';
3
3
  import { refsDir } from '../../core/state.js';
4
4
  import { bytesOf, DEFAULT_RESULT_THRESHOLD_BYTES, refMaxBytes, refMaxCount, resultThresholdBytes, } from '../../core/output.js';
5
5
  /** 解析 `7d` / `24h` / `30m` / `90s` / 纯毫秒数。 */
@@ -59,16 +59,136 @@ export const refsCommand = {
59
59
  ctx.output.write(record.envelope, { json: true, persist: false });
60
60
  }));
61
61
  refs.command('get')
62
- .description('Print one value from a persisted result by JSON path')
62
+ .description('Print one value from a persisted result by JSON path (large arrays/text are paged)')
63
63
  .argument('<refId>', 'reference id')
64
64
  .argument('<path>', 'JSON path, e.g. data.items[0].fid')
65
- .action(action((ctx, refId, path) => {
65
+ .option('--offset <n>', 'array start index, default 0')
66
+ .option('--limit <n>', 'how many array items to print')
67
+ .option('--char-offset <n>', 'text start position in Unicode characters, default 0')
68
+ .option('--char-limit <n>', 'how many Unicode characters to print')
69
+ .action(action((ctx, refId, path, options) => {
66
70
  const id = String(refId ?? '').trim();
67
71
  const jsonPath = String(path ?? '').trim();
68
72
  if (!id || !jsonPath)
69
73
  throw new CliError('refId 和 JSON 路径不能为空', ExitCode.UsageError);
74
+ const opts = asOptions(options);
75
+ const hasArrayWindow = opts.offset !== undefined || opts.limit !== undefined;
76
+ const hasTextWindow = opts.charOffset !== undefined || opts.charLimit !== undefined;
77
+ if (hasArrayWindow && hasTextWindow) {
78
+ throw new CliError('数组分页参数与文本分段参数不能同时使用', ExitCode.UsageError);
79
+ }
80
+ const offset = opts.offset === undefined ? 0 : Number(opts.offset);
81
+ const requestedLimit = opts.limit === undefined ? undefined : Number(opts.limit);
82
+ const charOffset = opts.charOffset === undefined ? 0 : Number(opts.charOffset);
83
+ const requestedCharLimit = opts.charLimit === undefined ? undefined : Number(opts.charLimit);
84
+ if (!Number.isInteger(offset) || offset < 0) {
85
+ throw new CliError('--offset 必须是非负整数', ExitCode.UsageError);
86
+ }
87
+ if (requestedLimit !== undefined && (!Number.isInteger(requestedLimit) || requestedLimit < 1)) {
88
+ throw new CliError('--limit 必须是正整数', ExitCode.UsageError);
89
+ }
90
+ if (!Number.isInteger(charOffset) || charOffset < 0) {
91
+ throw new CliError('--char-offset 必须是非负整数', ExitCode.UsageError);
92
+ }
93
+ if (requestedCharLimit !== undefined && (!Number.isInteger(requestedCharLimit) || requestedCharLimit < 1)) {
94
+ throw new CliError('--char-limit 必须是正整数', ExitCode.UsageError);
95
+ }
70
96
  const record = readRef(ctx, id);
71
- ctx.output.write(pickValue(record.envelope, jsonPath));
97
+ const picked = pickValue(record.envelope, jsonPath);
98
+ const configuredLimit = resultThresholdBytes(ctx);
99
+ const displayLimit = configuredLimit > 0 ? configuredLimit : DEFAULT_RESULT_THRESHOLD_BYTES;
100
+ if (typeof picked === 'string') {
101
+ if (hasArrayWindow) {
102
+ throw new CliError('字符串请使用 --char-offset / --char-limit 分段读取', ExitCode.UsageError);
103
+ }
104
+ const bytes = bytesOf(picked);
105
+ if (!hasTextWindow && bytes <= displayLimit) {
106
+ ctx.output.write(picked, { json: true, persist: false });
107
+ return;
108
+ }
109
+ const totalChars = Array.from(picked).length;
110
+ const perChar = totalChars > 0 ? Math.max(1, Math.ceil(bytes / totalChars)) : 1;
111
+ const autoLimit = Math.max(1, Math.floor((displayLimit - 2048) / perChar));
112
+ const pageOf = (size) => {
113
+ const window = readTextWindow(picked, charOffset, size);
114
+ const nextHint = window.hasMore
115
+ ? `还有 ${window.totalChars - window.charOffset - window.returnedChars} 字符:`
116
+ + `refs get ${id} ${jsonPath} --char-offset ${window.nextCharOffset} --char-limit ${size}`
117
+ : undefined;
118
+ return {
119
+ operation: 'refs.get',
120
+ path: jsonPath,
121
+ unit: 'chars',
122
+ totalChars: window.totalChars,
123
+ charOffset: window.charOffset,
124
+ returnedChars: window.returnedChars,
125
+ hasMore: window.hasMore,
126
+ ...(window.nextCharOffset === undefined ? {} : { nextCharOffset: window.nextCharOffset }),
127
+ data: window.text,
128
+ ...(nextHint === undefined ? {} : { largeOutputNotice: nextHint }),
129
+ };
130
+ };
131
+ let size = requestedCharLimit ?? autoLimit;
132
+ let page = pageOf(size);
133
+ for (let round = 0; round < 8; round += 1) {
134
+ const pageBytes = bytesOf(page);
135
+ if (pageBytes <= displayLimit || size <= 1)
136
+ break;
137
+ size = Math.max(1, Math.floor((size * displayLimit) / pageBytes) - 1);
138
+ page = pageOf(size);
139
+ }
140
+ ctx.output.write(page, { json: true, persist: false });
141
+ return;
142
+ }
143
+ if (hasTextWindow) {
144
+ throw new CliError('--char-offset / --char-limit 只能用于字符串字段', ExitCode.UsageError);
145
+ }
146
+ if (!Array.isArray(picked)) {
147
+ if (hasArrayWindow) {
148
+ throw new CliError('--offset / --limit 只能用于数组字段', ExitCode.UsageError);
149
+ }
150
+ const bytes = bytesOf(picked);
151
+ if (bytes > displayLimit) {
152
+ throw new CliError(`${jsonPath} 是单个非文本值,约 ${bytes} 字节,超过单次输出预算 ${displayLimit} 字节。`
153
+ + '请改用更细的 JSON 路径取值,或走业务命令的导出能力。', ExitCode.UsageError);
154
+ }
155
+ ctx.output.write(picked, { json: true, persist: false });
156
+ return;
157
+ }
158
+ const total = picked.length;
159
+ const bytes = bytesOf(picked);
160
+ // 未给 --limit 但整段装不下时,按"平均每条字节"估一个能装下的批量,自动只回一批。
161
+ const perItem = total > 0 ? Math.max(1, Math.ceil(bytes / total)) : 1;
162
+ const autoLimit = Math.max(1, Math.floor((displayLimit - 2048) / perItem));
163
+ const pageOf = (size) => {
164
+ const window = readWindow(picked, offset, size);
165
+ const nextHint = window.hasMore
166
+ ? `还有 ${window.total - window.offset - window.returned} 条:`
167
+ + `refs get ${id} ${jsonPath} --offset ${window.nextOffset} --limit ${size}`
168
+ : undefined;
169
+ return {
170
+ operation: 'refs.get',
171
+ path: jsonPath,
172
+ total: window.total,
173
+ offset: window.offset,
174
+ returned: window.returned,
175
+ hasMore: window.hasMore,
176
+ ...(window.nextOffset === undefined ? {} : { nextOffset: window.nextOffset }),
177
+ data: window.items,
178
+ ...(nextHint === undefined ? {} : { largeOutputNotice: nextHint }),
179
+ };
180
+ };
181
+ // 平均字节估不准(条目长短不一、缩进空白),按实际序列化结果回压,最多收敛 4 轮。
182
+ let size = requestedLimit ?? (bytes > displayLimit ? autoLimit : Math.max(total - offset, 1));
183
+ let page = pageOf(size);
184
+ for (let round = 0; round < 4; round += 1) {
185
+ const pageBytes = bytesOf(page);
186
+ if (pageBytes <= displayLimit || size <= 1)
187
+ break;
188
+ size = Math.max(1, Math.floor((size * displayLimit) / pageBytes) - 1);
189
+ page = pageOf(size);
190
+ }
191
+ ctx.output.write(page, { json: true, persist: false });
72
192
  }));
73
193
  refs.command('prune')
74
194
  .description('Prune persisted results')