weaver-work-cli 0.1.59 → 0.1.61
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/dist/chunks/{archive-4SQAVTIB.js → archive-S2VKZWQ3.js} +2 -2
- package/dist/chunks/{archive-oa-W2UEJ67L.js → archive-oa-HEDSIUUY.js} +2 -2
- package/dist/chunks/{asset-EGZEABBI.js → asset-HYH4W357.js} +2 -2
- package/dist/chunks/{asset-idle-EBUZBB6M.js → asset-idle-N7REBNGL.js} +2 -2
- package/dist/chunks/{attachment-content-TP6WDNC6.js → attachment-content-VYYA75FR.js} +3 -3
- package/dist/chunks/{blog-2YKMWOWI.js → blog-SLMZZICV.js} +2 -2
- package/dist/chunks/{caizhilian-5NM4X5HG.js → caizhilian-RV43KKBT.js} +4 -4
- package/dist/chunks/{calendar-H4QTJCUY.js → calendar-DMVZ4OLY.js} +2 -2
- package/dist/chunks/{chunk-QNPIY5R6.js → chunk-6XSSAUNW.js} +4 -4
- package/dist/chunks/{chunk-AQOPPNTR.js → chunk-BIA2NKUG.js} +4 -4
- package/dist/chunks/{chunk-VMCCRWFO.js → chunk-BQYX2UX5.js} +2 -2
- package/dist/chunks/{chunk-CI2RF3AJ.js → chunk-DTCQFTHW.js} +1 -1
- package/dist/chunks/{chunk-I3BFBBP2.js → chunk-E5YD5JWR.js} +1 -1
- package/dist/chunks/{chunk-PH7N4UFT.js → chunk-EGANE35F.js} +1 -1
- package/dist/chunks/{chunk-Z4IPY5GV.js → chunk-H6YOMI3U.js} +2 -2
- package/dist/chunks/{chunk-U2DWV6JC.js → chunk-ILALC2N6.js} +1 -1
- package/dist/chunks/{chunk-WINR2Q6K.js → chunk-KXJA42EA.js} +86 -19
- package/dist/chunks/{chunk-CQ4OVCKG.js → chunk-KY3R42RS.js} +2 -2
- package/dist/chunks/{chunk-WVH5ESDA.js → chunk-NRYDJN4J.js} +1 -1
- package/dist/chunks/{chunk-TGM7BWEH.js → chunk-P6TXQK75.js} +2 -2
- package/dist/chunks/{chunk-6YWHRXEQ.js → chunk-QBDXJS2W.js} +119 -9
- package/dist/chunks/{chunk-2IGZUMNG.js → chunk-SHX7XBYR.js} +180 -18
- package/dist/chunks/{chunk-XR5BGFNT.js → chunk-T2KVJFWJ.js} +10 -4
- package/dist/chunks/{chunk-FMNCSYIG.js → chunk-TEZHIB6T.js} +2 -2
- package/dist/chunks/{chunk-2FHP4PYS.js → chunk-UBGWIXU3.js} +116 -40
- package/dist/chunks/{chunk-5N222HK6.js → chunk-UBRWONP4.js} +2 -2
- package/dist/chunks/{chunk-MQBMMJUV.js → chunk-UQFPF4EX.js} +2 -2
- package/dist/chunks/{chunk-4GG72JAT.js → chunk-V2LASYKO.js} +2 -2
- package/dist/chunks/{chunk-FM7B5BIR.js → chunk-VBFBMM7G.js} +61 -53
- package/dist/chunks/{chunk-ZHPCNM2S.js → chunk-VNYOUAWV.js} +11 -11
- package/dist/chunks/{chunk-SFM3M2L3.js → chunk-WIWDVETN.js} +19 -3
- package/dist/chunks/{chunk-44KJ7WFA.js → chunk-XT77MP54.js} +2 -2
- package/dist/chunks/chunk-YI2YMW5N.js +111 -0
- package/dist/chunks/{conflict-Y3ESXYIA.js → conflict-GFJRS6I7.js} +2 -2
- package/dist/chunks/{contract-LLRKMLQQ.js → contract-U3ZGNRWB.js} +2 -2
- package/dist/chunks/{cowork-2RDFBZWB.js → cowork-EX7PKIDK.js} +2 -2
- package/dist/chunks/{create-flow-JHQSA6JF.js → create-flow-EJZD434E.js} +6 -6
- package/dist/chunks/{data-ZVS3BWPT.js → data-FOODGAMF.js} +278 -123
- package/dist/chunks/{ebuilder-form-TWSXS5NA.js → ebuilder-form-I2EOKODG.js} +5 -5
- package/dist/chunks/{ehr-52GBKNJR.js → ehr-TE4RFNID.js} +2 -2
- package/dist/chunks/entry-mode-ZOLSXEGX.js +19 -0
- package/dist/chunks/{env-LQBLL3MZ.js → env-TID5NFR6.js} +2 -2
- package/dist/chunks/{esb-HJSXCEOM.js → esb-7L6MHYLB.js} +4 -4
- package/dist/chunks/{factory-X7PN6B3B.js → factory-OG7BPMH5.js} +1 -1
- package/dist/chunks/{fna-OBACRT3J.js → fna-6V2ENR3Y.js} +2 -2
- package/dist/chunks/{group-chat-PPFY7SPV.js → group-chat-5DKPWIHL.js} +3 -3
- package/dist/chunks/{host-TTSGY5NZ.js → host-3DLYA54R.js} +3 -3
- package/dist/chunks/{host-KJT3G5D2.js → host-GOJHHTPY.js} +3 -3
- package/dist/chunks/{host-KOWUMNAY.js → host-OGBHL75G.js} +3 -3
- package/dist/chunks/{host-MFXRA2MY.js → host-ONZC6AE7.js} +3 -3
- package/dist/chunks/{host-W4JCNRFS.js → host-TJ5VVHM7.js} +3 -3
- package/dist/chunks/{host-2BKMPWDH.js → host-VTPAWDZV.js} +3 -3
- package/dist/chunks/{hrm-AK3WGBMN.js → hrm-2N7NFQDZ.js} +3 -3
- package/dist/chunks/{im-JZSBPO4Z.js → im-XCH47ZBN.js} +3 -3
- package/dist/chunks/{invoice-6XDMPCWB.js → invoice-XQRKMGNY.js} +3 -3
- package/dist/chunks/{jiuchuanhui-K4EQU6GK.js → jiuchuanhui-PL6DRPBM.js} +2 -2
- package/dist/chunks/{lazy-dispatch-GCA6HDOB.js → lazy-dispatch-UATEN7H7.js} +5 -5
- package/dist/chunks/{mail-IKVCQCVZ.js → mail-Q7Z4CQ4D.js} +2 -2
- package/dist/chunks/{meeting-GMRQZFJP.js → meeting-5E3BNARL.js} +13 -12
- package/dist/chunks/{minute-doc-JXH3MNC7.js → minute-doc-NXRE5C77.js} +4 -4
- package/dist/chunks/{okr-KV43FPPX.js → okr-3O3XNYOK.js} +2 -2
- package/dist/chunks/{operations-6NXJ7RTE.js → operations-EZWG72FH.js} +4 -4
- package/dist/chunks/performance-Y7CPNSOR.js +1295 -0
- package/dist/chunks/{plan-WOYR4WEG.js → plan-BLGPZF5M.js} +2 -2
- package/dist/chunks/{project-CQJKBUIL.js → project-6MZMLJMP.js} +2 -2
- package/dist/chunks/{reception-MPBU3JXC.js → reception-F2VT2X52.js} +2 -2
- package/dist/chunks/{recruit-stage-USTTRHOX.js → recruit-stage-4ETIBMIW.js} +2 -2
- package/dist/chunks/{registry-GURQG4ZV.js → registry-3FYSWV3U.js} +3 -3
- package/dist/chunks/{registry-SS5J2FZQ.js → registry-7RS74TCK.js} +4 -4
- package/dist/chunks/{registry-WZCCBI5L.js → registry-I4DVPDMU.js} +11 -10
- package/dist/chunks/{room-recommend-CKU5NF2E.js → room-recommend-GWCVKCXW.js} +4 -4
- package/dist/chunks/{schedule-DEFAO2RY.js → schedule-6AN63MJQ.js} +4 -4
- package/dist/chunks/{smart-extract-APX2PNIN.js → smart-extract-SR4SJJKN.js} +3 -3
- package/dist/chunks/{workflow-WMPW3WSB.js → workflow-KF7FA2UQ.js} +7 -7
- package/dist/cmd/refs/index.js +124 -4
- package/dist/core/output.js +199 -26
- package/dist/core/refs.js +36 -0
- package/dist/index.js +38 -33
- package/dist/internal/e10/auth/xiaoe.js +25 -3
- package/dist/shortcuts/caizhilian/operations/files.js +86 -15
- package/dist/shortcuts/data/index.js +12 -2
- package/dist/shortcuts/data/manifest.js +4 -2
- package/dist/shortcuts/data/operations/attribution.js +229 -0
- package/dist/shortcuts/data/operations/ds.js +87 -92
- package/dist/shortcuts/data/operations/index.js +3 -1
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +111 -12
- package/dist/shortcuts/meeting/operations/eb/entry-mode.js +116 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +11 -0
- package/dist/shortcuts/meeting/operations/registry.js +4 -0
- package/dist/shortcuts/performance/continuation.js +74 -0
- package/dist/shortcuts/performance/errors.js +65 -0
- package/dist/shortcuts/performance/host.js +105 -0
- package/dist/shortcuts/performance/index.js +109 -0
- package/dist/shortcuts/performance/manifest.js +30 -0
- package/dist/shortcuts/performance/operations/hrm-resolve.js +114 -0
- package/dist/shortcuts/performance/operations/registry.js +44 -0
- package/dist/shortcuts/performance/operations/scheme-detail.js +70 -0
- package/dist/shortcuts/performance/operations/scheme-draft.js +116 -0
- package/dist/shortcuts/performance/operations/scheme-publish.js +158 -0
- package/dist/shortcuts/performance/operations/types.js +32 -0
- package/dist/shortcuts/performance/scheme-validate.js +307 -0
- package/dist/shortcuts/performance/shared.js +158 -0
- package/docs/agent-io-channel-design.md +67 -3
- package/docs/data.md +2 -1
- package/package.json +1 -1
- package/scripts/xiaoe_env.py +6 -1
- package/skill-template/business-info.json +19 -0
- package/skill-template/domains/performance.md +18 -0
- package/skills/weaver-e10-caizhilian/SKILL.md +1 -1
- package/skills/weaver-e10-data/references/datasource.md +2 -1
- package/skills/weaver-e10-meeting/SKILL.md +16 -3
- package/skills/weaver-e10-performance/SKILL.md +202 -0
- package/skills/weaver-e10-performance/agents/openai.yaml +74 -0
- package/skills/weaver-e10-performance/references/default-assembly.md +108 -0
- package/skills/weaver-e10-performance/references/entity-resolution.md +69 -0
- package/skills/weaver-e10-performance/references/enums-and-normalization.md +80 -0
- package/skills/weaver-e10-performance/references/examples.md +146 -0
- package/skills/weaver-e10-performance/references/extraction-guide.md +144 -0
- package/skills/weaver-e10-performance/references/scheme-edit-req-fields.md +185 -0
- package/skills/weaver-e10-performance/references/scheme-setting-page.md +62 -0
- package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +483 -0
- package/skills/weaver-e10-shared/references/json-output-contract.md +5 -0
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
createE10RequestRuntime,
|
|
13
13
|
isE10SessionExpiredResponse,
|
|
14
14
|
requireE10Session
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NRYDJN4J.js";
|
|
16
16
|
import {
|
|
17
17
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
18
18
|
getActiveProfile
|
|
19
|
-
} from "./chunk-
|
|
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-
|
|
14
|
+
} from "./chunk-NRYDJN4J.js";
|
|
15
15
|
import {
|
|
16
16
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
17
17
|
getActiveProfile
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WIWDVETN.js";
|
|
19
19
|
import "./chunk-SHYQUBY3.js";
|
|
20
20
|
import {
|
|
21
21
|
CliError,
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
createE10RequestRuntime,
|
|
13
13
|
isE10SessionExpiredResponse,
|
|
14
14
|
requireE10Session
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NRYDJN4J.js";
|
|
16
16
|
import {
|
|
17
17
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
18
18
|
getActiveProfile
|
|
19
|
-
} from "./chunk-
|
|
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-
|
|
7
|
+
} from "./chunk-XT77MP54.js";
|
|
8
8
|
import "./chunk-HP7JIYMT.js";
|
|
9
9
|
import "./chunk-WRXSAVKO.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-SHX7XBYR.js";
|
|
11
11
|
import "./chunk-AJ62BGAW.js";
|
|
12
12
|
import "./chunk-7BDPM5ST.js";
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
8
|
-
import "./chunk-
|
|
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-
|
|
12
|
-
import "./chunk-
|
|
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,17 +4,18 @@ import {
|
|
|
4
4
|
getMeetingOperation,
|
|
5
5
|
hasMeetingOperation,
|
|
6
6
|
meetingOperationDefinitions
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
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-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-CI2RF3AJ.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";
|
|
18
19
|
import "./chunk-7BDPM5ST.js";
|
|
19
20
|
import "./chunk-SHYQUBY3.js";
|
|
20
21
|
import "./chunk-UG5G54VL.js";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
loadRooms,
|
|
8
8
|
recommendRooms,
|
|
9
9
|
rememberFrequentRoom
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
18
|
+
} from "./chunk-NRYDJN4J.js";
|
|
19
19
|
import {
|
|
20
20
|
getActiveProfile
|
|
21
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
36
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-NRYDJN4J.js";
|
|
36
|
+
import "./chunk-WIWDVETN.js";
|
|
37
37
|
import "./chunk-SHYQUBY3.js";
|
|
38
38
|
import {
|
|
39
39
|
isCliError,
|
package/dist/cmd/refs/index.js
CHANGED
|
@@ -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
|
-
.
|
|
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
|
-
|
|
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')
|