@wirecat/drive-cli 0.52.0 → 0.53.0
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/README.md +2 -2
- package/dist/bin/drive.js +2 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/bundle/{chunk-ZWSG7OCA.js → all-profiles-WRN35CUF.js} +11 -6
- package/dist/bundle/{anthropic-KW6KU36Y.js → anthropic-DZASXWG3.js} +1 -1
- package/dist/bundle/{app-server-TCJZ333E.js → app-server-4VHT7QZN.js} +33 -41
- package/dist/bundle/{bun-sqlite-RI7DR6RZ.js → bun-sqlite-2GOM5PM3.js} +1 -1
- package/dist/bundle/{chunk-LONV6HIK.js → chunk-2HHOMN2G.js} +440 -25
- package/dist/bundle/{chunk-4A2PIGC6.js → chunk-2PVDFLJJ.js} +8 -3
- package/dist/bundle/{chunk-725OHXKR.js → chunk-3RYX7IB6.js} +2218 -30
- package/dist/bundle/{chunk-CB7SBYLO.js → chunk-54BYJQ77.js} +41 -21
- package/dist/bundle/{chunk-5FONRUG6.js → chunk-5D4AEUVA.js} +1 -23
- package/dist/bundle/{chunk-RNSP57TC.js → chunk-6BNALDGA.js} +1 -1
- package/dist/bundle/{chunk-H47W2J6S.js → chunk-6XYGTRMQ.js} +812 -381
- package/dist/bundle/{chunk-UR32UWTQ.js → chunk-7IUMHMTP.js} +11 -0
- package/dist/bundle/{chunk-W7IK7E4B.js → chunk-BEL4XZ3M.js} +5 -7
- package/dist/bundle/{chunk-43QVYW3K.js → chunk-CL4GVCXS.js} +230 -56
- package/dist/bundle/{chunk-PQYVPCJ2.js → chunk-CNKILAWA.js} +18 -24
- package/dist/bundle/chunk-DOZOLBXE.js +110 -0
- package/dist/bundle/{chunk-2AUXBJRX.js → chunk-DT2YCB2V.js} +84 -11
- package/dist/bundle/{chunk-HQVJK5E7.js → chunk-DZMK255Y.js} +210 -357
- package/dist/bundle/{chunk-G6QF5KWF.js → chunk-E6XDFMRZ.js} +22 -28
- package/dist/bundle/{chunk-DW46P2DY.js → chunk-EKFEY3KP.js} +1 -1
- package/dist/bundle/{chunk-54O62JWP.js → chunk-F3KHUJEE.js} +24 -5
- package/dist/bundle/{chunk-I7UH5CTA.js → chunk-FXWBUTR7.js} +7 -9
- package/dist/bundle/{chunk-ZNZUZGSV.js → chunk-GE4DP24O.js} +131 -4
- package/dist/bundle/{chunk-PEOCBV2Z.js → chunk-GPJEYW2J.js} +1 -1
- package/dist/bundle/{chunk-A4UNTWAX.js → chunk-HM352LJR.js} +84 -15
- package/dist/bundle/{chunk-KYVXMEBC.js → chunk-IAQ4L6SM.js} +1 -1
- package/dist/bundle/{chunk-PQJYM5ES.js → chunk-IJFZKQC4.js} +1 -1
- package/dist/bundle/{chunk-O6IOL6RX.js → chunk-KPBCGUJC.js} +1 -1
- package/dist/bundle/{chunk-XOLQSCMF.js → chunk-KXMJE3XC.js} +2 -2
- package/dist/bundle/{chunk-33NVQGUY.js → chunk-LSGAJYVN.js} +2 -2
- package/dist/bundle/{chunk-2UIMEMWU.js → chunk-MK3N7WX7.js} +1 -1
- package/dist/bundle/{chunk-IDUNJCFO.js → chunk-OQMK6WXQ.js} +1 -1
- package/dist/bundle/{chunk-CM7GAXGD.js → chunk-PC4UA6UN.js} +1 -1
- package/dist/bundle/{chunk-YNFELLNQ.js → chunk-PIMMF67N.js} +2 -2
- package/dist/bundle/{chunk-WBTVGFXI.js → chunk-PR3DA7KA.js} +9 -9
- package/dist/bundle/{chunk-VJZST5RD.js → chunk-QXYGK6G5.js} +1 -1
- package/dist/bundle/{chunk-WQJBAWQP.js → chunk-R4TE4ZSD.js} +549 -224
- package/dist/bundle/{chunk-BSSCTWWK.js → chunk-RNIHKIQP.js} +1 -1
- package/dist/bundle/{chunk-PAXKALHV.js → chunk-SIWBUGBU.js} +116 -5
- package/dist/bundle/{chunk-2623YE5I.js → chunk-SQHPJBNO.js} +6 -8
- package/dist/bundle/chunk-SVTYS36O.js +5305 -0
- package/dist/bundle/{chunk-WLFUBNFX.js → chunk-T334CFU4.js} +2 -2
- package/dist/bundle/{chunk-UC22Q5KU.js → chunk-TZLO3ZZF.js} +16 -16
- package/dist/bundle/{chunk-5PLJKSG4.js → chunk-UFWK3L5Z.js} +4 -6
- package/dist/bundle/{chunk-FCJAHD4R.js → chunk-VTWADVEQ.js} +2 -2
- package/dist/bundle/{chunk-HX7Y2ASG.js → chunk-WJRJBQIM.js} +26040 -15126
- package/dist/bundle/{chunk-VSOLLTYT.js → chunk-YLKQSVLI.js} +5 -0
- package/dist/bundle/{chunk-IWFBAWZK.js → chunk-YQOVVCIA.js} +282 -10
- package/dist/bundle/{chunk-7YMDL4JQ.js → chunk-ZG6X24ON.js} +4 -1
- package/dist/bundle/{command-contract-I2YB5IXI.js → command-contract-D4UG3D33.js} +12 -15
- package/dist/bundle/{decode-EDN2ARXZ.js → decode-WAPM2VBH.js} +1 -1
- package/dist/bundle/drive.js +10 -21
- package/dist/bundle/{embed-3GSQIQXE.js → embed-HW3N3KNP.js} +4 -4
- package/dist/bundle/{embedder-6ULWRG3R.js → embedder-7WNFXYYP.js} +4 -4
- package/dist/bundle/{entry-IPRJLFHO.js → entry-J7YIRDPD.js} +4 -4
- package/dist/bundle/{first-run-FGHGWHC2.js → first-run-53CL2IYH.js} +6 -6
- package/dist/bundle/{first-screen-M62KTPZG.js → first-screen-2KT7HM2K.js} +13 -16
- package/dist/bundle/{google-BD3ZNFVJ.js → google-5NNVARNR.js} +2 -2
- package/dist/bundle/{chunk-GR5GGZKH.js → google-api-EQQH53QD.js} +60 -4
- package/dist/bundle/grants-4NETZ4MR.js +98 -0
- package/dist/bundle/{identity-QLBSASO5.js → identity-LBTXDMTA.js} +4 -2
- package/dist/bundle/{login-VNZKRSAD.js → login-Y6ENYKC3.js} +50 -52
- package/dist/bundle/{node-sqlite-J3OODPYK.js → node-sqlite-FSQIKGED.js} +1 -1
- package/dist/bundle/{oauth-L4VTCBLF.js → oauth-HF5USWXY.js} +5 -5
- package/dist/bundle/{open-SGUN7ZVF.js → open-NHGJENCX.js} +2 -2
- package/dist/bundle/{openai-RLVISEDH.js → openai-3JCJYKNX.js} +6 -6
- package/dist/bundle/{program-6S5EH7BS.js → program-QAJ66K3Z.js} +715 -904
- package/dist/bundle/{prompt-AUWTBLO7.js → prompt-LQJBCCUF.js} +3 -3
- package/dist/bundle/{reasons-M5AKCNCU.js → reasons-J57GSRWN.js} +1 -1
- package/dist/bundle/{recognize-ORX2UBQW.js → recognize-QM3LN4ZF.js} +1 -1
- package/dist/bundle/{remote-AGIJY73X.js → remote-WREGEZJQ.js} +5 -5
- package/dist/bundle/{rerank-R6PE44M5.js → rerank-YFUB6J6M.js} +4 -4
- package/dist/bundle/{chunk-G7DCVJ4F.js → serve-7NFEZ564.js} +7 -4
- package/dist/bundle/{chunk-F7UUZATI.js → server-KBCFZ2AU.js} +38 -11
- package/dist/bundle/server-UYVL2CFI.js +63 -0
- package/dist/bundle/{services-HZFTTZSF.js → services-C3XWRA2W.js} +16 -21
- package/dist/bundle/{sqlite-runtime-DTGPR2T2.js → sqlite-runtime-H3TSAMIN.js} +3 -3
- package/dist/bundle/{state-WG3JKJM3.js → state-S2Q53L6L.js} +3 -3
- package/dist/bundle/{store-33VHIMEO.js → store-H345VQHP.js} +6 -8
- package/dist/bundle/{store-EV72MT5U.js → store-I27LAJPU.js} +7 -9
- package/dist/bundle/store-maintenance-command-3XA73XMC.js +52 -0
- package/dist/bundle/{chunk-GNI7INK6.js → terminal-DHJ4D3BC.js} +2 -3
- package/dist/bundle/tokens-7MUGKFEM.js +96 -0
- package/dist/commands/context.d.ts +14 -13
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +1 -4
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/mirrors.d.ts.map +1 -1
- package/dist/commands/mirrors.js +1 -2
- package/dist/commands/mirrors.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +2 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/upgrade.d.ts +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +4 -9
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/config.d.ts +182 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +38 -3
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +0 -3
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +0 -234
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.d.ts +3 -2
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +17 -22
- package/dist/first-screen.js.map +1 -1
- package/dist/grants.d.ts +9 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +30 -0
- package/dist/grants.js.map +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +2 -0
- package/dist/identity.js.map +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +7 -3
- package/dist/login.js.map +1 -1
- package/dist/policy-keys.d.ts +12 -0
- package/dist/policy-keys.d.ts.map +1 -0
- package/dist/policy-keys.js +107 -0
- package/dist/policy-keys.js.map +1 -0
- package/dist/policy.d.ts +1 -8
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +2 -105
- package/dist/policy.js.map +1 -1
- package/dist/program.d.ts +8 -4
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +251 -222
- package/dist/program.js.map +1 -1
- package/dist/reasons.js +1 -1
- package/dist/reasons.js.map +1 -1
- package/dist/testing/mcp.d.ts +28 -0
- package/dist/testing/mcp.d.ts.map +1 -0
- package/dist/testing/mcp.js +56 -0
- package/dist/testing/mcp.js.map +1 -0
- package/dist/tokens.d.ts +0 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -13
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/scenarios/agent-access.md +4 -2
- package/dist/bundle/all-profiles-CYW6XBBS.js +0 -26
- package/dist/bundle/chunk-234MHU76.js +0 -384
- package/dist/bundle/chunk-4CPLOMRK.js +0 -1714
- package/dist/bundle/chunk-4Z6TCU5T.js +0 -9
- package/dist/bundle/chunk-DO4PDQY5.js +0 -48
- package/dist/bundle/chunk-FDWYPONW.js +0 -1988
- package/dist/bundle/chunk-FQRJWVEB.js +0 -2
- package/dist/bundle/chunk-NPSZPUK6.js +0 -193
- package/dist/bundle/chunk-PDGECM5D.js +0 -138
- package/dist/bundle/chunk-Q765VPZY.js +0 -421
- package/dist/bundle/chunk-WQRGA75U.js +0 -256
- package/dist/bundle/chunk-X6ID5EAR.js +0 -522
- package/dist/bundle/chunk-YVPHJHIL.js +0 -15572
- package/dist/bundle/chunk-Z47LOJUS.js +0 -484
- package/dist/bundle/failure-4CVEVY45.js +0 -37
- package/dist/bundle/google-api-BDUWZMRV.js +0 -83
- package/dist/bundle/mcp-5SNSMI2M.js +0 -502
- package/dist/bundle/mcp-JZSYPQA4.js +0 -96
- package/dist/bundle/serve-VOBAQHAQ.js +0 -20
- package/dist/bundle/server-24PS4M7U.js +0 -70
- package/dist/bundle/server-G6HFZ2CK.js +0 -57
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +0 -58
- package/dist/bundle/terminal-TFCTWLOS.js +0 -11
- package/dist/bundle/tokens-XDQXUFDQ.js +0 -104
- package/dist/commands/doctor.d.ts +0 -56
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -75
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -6
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -156
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/skill.d.ts +0 -6
- package/dist/commands/skill.d.ts.map +0 -1
- package/dist/commands/skill.js +0 -34
- package/dist/commands/skill.js.map +0 -1
- package/dist/failure.d.ts +0 -88
- package/dist/failure.d.ts.map +0 -1
- package/dist/failure.js +0 -60
- package/dist/failure.js.map +0 -1
- package/dist/mcp.d.ts +0 -175
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -412
- package/dist/mcp.js.map +0 -1
|
@@ -1,1988 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
currentCaller,
|
|
5
|
-
endpointTemplate,
|
|
6
|
-
errorDetailOf,
|
|
7
|
-
framesOf,
|
|
8
|
-
keepsSuccess,
|
|
9
|
-
providerErrorKey,
|
|
10
|
-
renderEvent,
|
|
11
|
-
runContextOf
|
|
12
|
-
} from "./chunk-PEOCBV2Z.js";
|
|
13
|
-
import {
|
|
14
|
-
Option,
|
|
15
|
-
annotate,
|
|
16
|
-
annotateOption,
|
|
17
|
-
metaOf,
|
|
18
|
-
resolveOutput,
|
|
19
|
-
stepTargets
|
|
20
|
-
} from "./chunk-725OHXKR.js";
|
|
21
|
-
import {
|
|
22
|
-
DEFAULT_RERANK_MODEL,
|
|
23
|
-
KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
|
|
24
|
-
LOG_ATTRIBUTES,
|
|
25
|
-
RERANK_MODELS,
|
|
26
|
-
RUNS_SIZE_LIMIT_MB,
|
|
27
|
-
currentRun,
|
|
28
|
-
enclosingTraceId,
|
|
29
|
-
inRun,
|
|
30
|
-
logAttributes,
|
|
31
|
-
newRunId,
|
|
32
|
-
parseDuration,
|
|
33
|
-
runsDirFor,
|
|
34
|
-
snakeLogger,
|
|
35
|
-
startRun,
|
|
36
|
-
stopWrites,
|
|
37
|
-
traceOf,
|
|
38
|
-
typedCommand,
|
|
39
|
-
useAsProcessRun,
|
|
40
|
-
withWriteScope
|
|
41
|
-
} from "./chunk-LONV6HIK.js";
|
|
42
|
-
import {
|
|
43
|
-
isCliFailure
|
|
44
|
-
} from "./chunk-VSOLLTYT.js";
|
|
45
|
-
import {
|
|
46
|
-
CEILING_KEY,
|
|
47
|
-
COMMAND_PATH_KEY,
|
|
48
|
-
LEVELS,
|
|
49
|
-
RESOURCES,
|
|
50
|
-
RESOURCE_KEY,
|
|
51
|
-
assertOverridesTighten,
|
|
52
|
-
keyForCommand,
|
|
53
|
-
layerPermissions,
|
|
54
|
-
permissionOverrides
|
|
55
|
-
} from "./chunk-Q765VPZY.js";
|
|
56
|
-
import {
|
|
57
|
-
count,
|
|
58
|
-
text
|
|
59
|
-
} from "./chunk-GVCN3GLZ.js";
|
|
60
|
-
import {
|
|
61
|
-
permissionCeiling
|
|
62
|
-
} from "./chunk-WLFUBNFX.js";
|
|
63
|
-
import {
|
|
64
|
-
envName,
|
|
65
|
-
readOnlyLockOf,
|
|
66
|
-
readOnlyRefusal
|
|
67
|
-
} from "./chunk-ZDLIO76S.js";
|
|
68
|
-
import {
|
|
69
|
-
sharedConfigPath
|
|
70
|
-
} from "./chunk-XOLQSCMF.js";
|
|
71
|
-
import {
|
|
72
|
-
storePath
|
|
73
|
-
} from "./chunk-VJZST5RD.js";
|
|
74
|
-
import {
|
|
75
|
-
configFilePath,
|
|
76
|
-
createRecordLog,
|
|
77
|
-
exitCodeOfAnswer,
|
|
78
|
-
processStreams,
|
|
79
|
-
resolvePaths,
|
|
80
|
-
saveConfigFile,
|
|
81
|
-
writeSecurely
|
|
82
|
-
} from "./chunk-HQVJK5E7.js";
|
|
83
|
-
import {
|
|
84
|
-
CliError,
|
|
85
|
-
MAX_NEXT_STEPS,
|
|
86
|
-
STEPS,
|
|
87
|
-
array,
|
|
88
|
-
boolean,
|
|
89
|
-
check,
|
|
90
|
-
defineLogEvents,
|
|
91
|
-
defineSteps,
|
|
92
|
-
getDotPath,
|
|
93
|
-
integer,
|
|
94
|
-
itemEnvelopeSchema,
|
|
95
|
-
jsonlOf,
|
|
96
|
-
listEnvelopeSchema,
|
|
97
|
-
literal,
|
|
98
|
-
maxLength,
|
|
99
|
-
maxValue,
|
|
100
|
-
minLength,
|
|
101
|
-
minValue,
|
|
102
|
-
nullable,
|
|
103
|
-
number,
|
|
104
|
-
optional,
|
|
105
|
-
picklist,
|
|
106
|
-
pipe,
|
|
107
|
-
record,
|
|
108
|
-
regex,
|
|
109
|
-
safeParse,
|
|
110
|
-
stepOf,
|
|
111
|
-
strictObject,
|
|
112
|
-
string,
|
|
113
|
-
trim,
|
|
114
|
-
union,
|
|
115
|
-
unknown,
|
|
116
|
-
writes
|
|
117
|
-
} from "./chunk-YKZ4IPLB.js";
|
|
118
|
-
import {
|
|
119
|
-
__name
|
|
120
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
121
|
-
|
|
122
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/execution.js
|
|
123
|
-
var DEFAULT_COOPERATIVE_MS = 5 * 6e4;
|
|
124
|
-
var DEFAULT_SYNC_MS = 15 * 6e4;
|
|
125
|
-
var DEFAULT_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
126
|
-
var withAbort = /* @__PURE__ */ __name(async (signal, body) => {
|
|
127
|
-
if (!signal)
|
|
128
|
-
return body();
|
|
129
|
-
if (signal.aborted)
|
|
130
|
-
throw signal.reason;
|
|
131
|
-
let abort = /* @__PURE__ */ __name(() => {
|
|
132
|
-
}, "abort");
|
|
133
|
-
const interrupted = new Promise((_, reject) => {
|
|
134
|
-
abort = /* @__PURE__ */ __name(() => reject(signal.reason), "abort");
|
|
135
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
136
|
-
});
|
|
137
|
-
try {
|
|
138
|
-
return await Promise.race([body(), interrupted]);
|
|
139
|
-
} finally {
|
|
140
|
-
signal.removeEventListener("abort", abort);
|
|
141
|
-
}
|
|
142
|
-
}, "withAbort");
|
|
143
|
-
|
|
144
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/profile.js
|
|
145
|
-
var asFirstWord = /* @__PURE__ */ __name((profile) => `${profile} `, "asFirstWord");
|
|
146
|
-
var PLAIN_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
147
|
-
var isProfileName = /* @__PURE__ */ __name((word) => PLAIN_NAME.test(word), "isProfileName");
|
|
148
|
-
var usableProfileName = /* @__PURE__ */ __name((profile) => {
|
|
149
|
-
if (!isProfileName(profile)) {
|
|
150
|
-
throw new CliError("validation_error", `"${profile}" cannot be a profile name \u2014 letters, digits, dot, dash and underscore only, starting with a letter or a digit`);
|
|
151
|
-
}
|
|
152
|
-
return profile;
|
|
153
|
-
}, "usableProfileName");
|
|
154
|
-
var PROFILE_FREE = /* @__PURE__ */ new Set(["commands", "complete", "guide", "help", "skill", "upgrade"]);
|
|
155
|
-
var freeOfProfile = /* @__PURE__ */ new WeakSet();
|
|
156
|
-
var profileFree = /* @__PURE__ */ __name((command) => {
|
|
157
|
-
freeOfProfile.add(command);
|
|
158
|
-
return command;
|
|
159
|
-
}, "profileFree");
|
|
160
|
-
var takesProfile = /* @__PURE__ */ __name((command) => {
|
|
161
|
-
let top;
|
|
162
|
-
for (let at = command; at?.parent; at = at.parent) {
|
|
163
|
-
if (freeOfProfile.has(at))
|
|
164
|
-
return false;
|
|
165
|
-
top = at;
|
|
166
|
-
}
|
|
167
|
-
return top !== void 0 && !PROFILE_FREE.has(top.name());
|
|
168
|
-
}, "takesProfile");
|
|
169
|
-
var commandWords = /* @__PURE__ */ __name((program) => /* @__PURE__ */ new Set(["help", ...program.commands.flatMap((command) => [command.name(), ...command.aliases()])]), "commandWords");
|
|
170
|
-
var liftProfile = /* @__PURE__ */ __name((argv, words, valued = /* @__PURE__ */ new Set()) => {
|
|
171
|
-
let at = 0;
|
|
172
|
-
while (argv[at]?.startsWith("-") && argv[at] !== "--")
|
|
173
|
-
at += valued.has(argv[at]) ? 2 : 1;
|
|
174
|
-
const first2 = argv[at];
|
|
175
|
-
if (first2 === void 0 || first2.startsWith("-") || words.has(first2))
|
|
176
|
-
return { rest: argv };
|
|
177
|
-
return { profile: first2, rest: [...argv.slice(0, at), ...argv.slice(at + 1)] };
|
|
178
|
-
}, "liftProfile");
|
|
179
|
-
var refuseCommandName = /* @__PURE__ */ __name((profile, words, command) => {
|
|
180
|
-
if (words.has(profile)) {
|
|
181
|
-
throw new CliError("validation_error", `"${profile}" is a command, so \`${command} ${profile} \u2026\` would always mean the command and never this profile. Pick a name that is not one of: ` + [...words].sort().join(", "));
|
|
182
|
-
}
|
|
183
|
-
}, "refuseCommandName");
|
|
184
|
-
var rootOf = /* @__PURE__ */ __name((command) => {
|
|
185
|
-
let root = command;
|
|
186
|
-
while (root.parent)
|
|
187
|
-
root = root.parent;
|
|
188
|
-
return root;
|
|
189
|
-
}, "rootOf");
|
|
190
|
-
|
|
191
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/messenger/accounts.js
|
|
192
|
-
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
193
|
-
import { join } from "node:path";
|
|
194
|
-
var accountFileFor = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "accounts", `${profile}.json`), "accountFileFor");
|
|
195
|
-
var rememberAccount = /* @__PURE__ */ __name((app, profile, id, env) => writeSecurely(accountFileFor(app, profile, env), `${JSON.stringify({ account: id })}
|
|
196
|
-
`, 384), "rememberAccount");
|
|
197
|
-
var recalledAccount = /* @__PURE__ */ __name((app, provider, profile, env) => {
|
|
198
|
-
try {
|
|
199
|
-
const { account } = JSON.parse(readFileSync(accountFileFor(app, profile, env), "utf8"));
|
|
200
|
-
return typeof account === "string" ? { provider, account } : void 0;
|
|
201
|
-
} catch {
|
|
202
|
-
return void 0;
|
|
203
|
-
}
|
|
204
|
-
}, "recalledAccount");
|
|
205
|
-
var profilesWithAccounts = /* @__PURE__ */ __name((app, env) => {
|
|
206
|
-
const dir = join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "accounts");
|
|
207
|
-
if (!existsSync(dir))
|
|
208
|
-
return [];
|
|
209
|
-
return readdirSync(dir).filter((name) => name.endsWith(".json")).map((name) => name.slice(0, -".json".length));
|
|
210
|
-
}, "profilesWithAccounts");
|
|
211
|
-
var profilesHere = /* @__PURE__ */ __name((app, configured, env) => [.../* @__PURE__ */ new Set([...configured, ...profilesWithAccounts(app, env)])].sort(), "profilesHere");
|
|
212
|
-
|
|
213
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/runs/log-events.js
|
|
214
|
-
var CORE_LOG_EVENTS = defineLogEvents([
|
|
215
|
-
{ id: "provider.request", meaning: "a request went to the messenger", keys: ["operation"] },
|
|
216
|
-
{ id: "provider.response", meaning: "the messenger answered the request, or it failed", keys: ["operation"] },
|
|
217
|
-
{ id: "client.warning", meaning: "the client noticed something unexpected and went on", keys: ["code"] },
|
|
218
|
-
{
|
|
219
|
-
id: "cache.answered",
|
|
220
|
-
meaning: "a read was answered from what was kept, without asking the messenger",
|
|
221
|
-
keys: ["operation", "reason"]
|
|
222
|
-
},
|
|
223
|
-
{ id: "command.crashed", meaning: "a command failed on a bug; where, never what", keys: ["error_class", "frames"] },
|
|
224
|
-
{
|
|
225
|
-
id: "events.dropped",
|
|
226
|
-
meaning: "the run reached its cap and counted the rest instead of writing them",
|
|
227
|
-
keys: ["dropped", "counts"]
|
|
228
|
-
},
|
|
229
|
-
{ id: "send.recorded", meaning: "a write the send guard saw, and how it ended", keys: ["outcome"] },
|
|
230
|
-
{ id: "job.start", meaning: "a background job started", keys: ["job"] },
|
|
231
|
-
{ id: "job.exit", meaning: "a background job ended", keys: ["job", "outcome"] },
|
|
232
|
-
{ id: "schedule.start", meaning: "a scheduled run started", keys: ["schedule", "kind"] },
|
|
233
|
-
{ id: "schedule.exit", meaning: "a scheduled run ended", keys: ["schedule", "kind", "exit_code"] },
|
|
234
|
-
{ id: "agent.action", meaning: "one MCP tool call, from the agent log", keys: ["tool", "tier", "outcome"] },
|
|
235
|
-
{ id: "serve.note", meaning: "serve reports what it is doing", keys: [] },
|
|
236
|
-
{ id: "serve.success", meaning: "serve finished something", keys: [] },
|
|
237
|
-
{ id: "serve.warning", meaning: "serve went on past a problem", keys: [] },
|
|
238
|
-
{ id: "serve.failure", meaning: "serve could not do something", keys: [] }
|
|
239
|
-
]);
|
|
240
|
-
var DIAGNOSTIC_LOG_EVENTS = {
|
|
241
|
-
request: "provider.request",
|
|
242
|
-
response: "provider.response",
|
|
243
|
-
warning: "client.warning",
|
|
244
|
-
cache: "cache.answered"
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/runs/recording.js
|
|
248
|
-
var recorded = /* @__PURE__ */ __name(async (options, body) => {
|
|
249
|
-
const recording = startRecording(options);
|
|
250
|
-
try {
|
|
251
|
-
const scope = {
|
|
252
|
-
runId: recording.runId,
|
|
253
|
-
command: options.command,
|
|
254
|
-
startedAt: Date.now(),
|
|
255
|
-
...options.profile === void 0 ? {} : { profile: options.profile },
|
|
256
|
-
...recording.traceId ? { traceId: recording.traceId } : {},
|
|
257
|
-
events: recording.events
|
|
258
|
-
};
|
|
259
|
-
if (options.processRun)
|
|
260
|
-
useAsProcessRun(scope);
|
|
261
|
-
const answer = await inRun(scope, () => body(recording.events));
|
|
262
|
-
await recording.succeed(answer);
|
|
263
|
-
return answer;
|
|
264
|
-
} catch (error) {
|
|
265
|
-
await recording.fail(error);
|
|
266
|
-
throw error;
|
|
267
|
-
}
|
|
268
|
-
}, "recorded");
|
|
269
|
-
var startRecording = /* @__PURE__ */ __name((options) => {
|
|
270
|
-
const streams = options.streams ?? processStreams;
|
|
271
|
-
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
272
|
-
const startedAt = now();
|
|
273
|
-
const runId = newRunId(startedAt, options.command);
|
|
274
|
-
const traceId = options.traceId ?? enclosingTraceId() ?? traceOf(options.env ?? process.env).traceId;
|
|
275
|
-
const { argvIfFailed, ...context } = options.context ?? {};
|
|
276
|
-
const open = /* @__PURE__ */ __name((extra = {}) => startRun({
|
|
277
|
-
runsDir: options.runsDir ?? runsDirFor(options.app, options.env),
|
|
278
|
-
runId,
|
|
279
|
-
command: options.command,
|
|
280
|
-
...options.profile === void 0 ? {} : { profile: options.profile },
|
|
281
|
-
service: options.app.command,
|
|
282
|
-
cliVersion: options.app.version,
|
|
283
|
-
...traceId === void 0 ? {} : { traceId },
|
|
284
|
-
...options.context ? { context } : {},
|
|
285
|
-
// The operation has happened or is under way, and failing the command now invites a retry
|
|
286
|
-
// that sends twice.
|
|
287
|
-
onError: /* @__PURE__ */ __name((error) => {
|
|
288
|
-
const warning = `this run is not recorded past this point: ${error.message}`;
|
|
289
|
-
streams.diagnostic(options.format === "pretty" ? warning : JSON.stringify({ warning }));
|
|
290
|
-
}, "onError"),
|
|
291
|
-
...options.keepDays === void 0 ? {} : { keepDays: options.keepDays },
|
|
292
|
-
...options.keepSuccessDays === void 0 ? {} : { keepSuccessDays: options.keepSuccessDays },
|
|
293
|
-
...options.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes },
|
|
294
|
-
now,
|
|
295
|
-
...extra
|
|
296
|
-
}), "open");
|
|
297
|
-
const run = options.record ? open({ startedAt, lazy: true }) : void 0;
|
|
298
|
-
const held = !run && options.keepFailed ? [] : void 0;
|
|
299
|
-
const counted = { wire: 0, operation: 0 };
|
|
300
|
-
let refused;
|
|
301
|
-
const cap = capped();
|
|
302
|
-
const requests = /* @__PURE__ */ __name(() => counted.wire > 0 ? counted.wire : counted.operation, "requests");
|
|
303
|
-
const events = /* @__PURE__ */ __name((event) => {
|
|
304
|
-
if (event.event === "request")
|
|
305
|
-
counted[event.level === "wire" ? "wire" : "operation"] += 1;
|
|
306
|
-
if (event.event === "response" && event.outcome === "error")
|
|
307
|
-
refused = event;
|
|
308
|
-
if (options.trace)
|
|
309
|
-
streams.diagnostic(options.format === "pretty" ? renderEvent(event) : JSON.stringify(logAttributes(event)));
|
|
310
|
-
if (run)
|
|
311
|
-
cap.log(run, event);
|
|
312
|
-
if (held) {
|
|
313
|
-
held.push(event);
|
|
314
|
-
if (held.length > HELD_AT_MOST)
|
|
315
|
-
held.shift();
|
|
316
|
-
}
|
|
317
|
-
}, "events");
|
|
318
|
-
const keep = /* @__PURE__ */ __name((kept) => {
|
|
319
|
-
for (const event of held ?? [])
|
|
320
|
-
cap.log(kept, event);
|
|
321
|
-
return kept;
|
|
322
|
-
}, "keep");
|
|
323
|
-
return {
|
|
324
|
-
runId,
|
|
325
|
-
...traceId === void 0 ? {} : { traceId },
|
|
326
|
-
events,
|
|
327
|
-
succeed: /* @__PURE__ */ __name(async (answer) => {
|
|
328
|
-
const partial = partialOutcome(answer);
|
|
329
|
-
const kept = run ?? (partial && held ? keep(open({ startedAt })) : void 0);
|
|
330
|
-
if (kept)
|
|
331
|
-
cap.close(kept);
|
|
332
|
-
await kept?.finish(partial ? "partial" : "success", {
|
|
333
|
-
requests: requests(),
|
|
334
|
-
...cap.dropped(),
|
|
335
|
-
...partial ? { partial } : {}
|
|
336
|
-
});
|
|
337
|
-
}, "succeed"),
|
|
338
|
-
fail: /* @__PURE__ */ __name(async (error) => {
|
|
339
|
-
const failed = run ?? (held ? keep(open({ startedAt })) : void 0);
|
|
340
|
-
if (failed) {
|
|
341
|
-
if (!isCliFailure(error))
|
|
342
|
-
failed.logger.error(crashOf(error));
|
|
343
|
-
cap.close(failed);
|
|
344
|
-
await failed.finish("failed", {
|
|
345
|
-
requests: requests(),
|
|
346
|
-
...cap.dropped(),
|
|
347
|
-
...outcomeOf(error),
|
|
348
|
-
error: errorDetailOf(error, refused),
|
|
349
|
-
...argvIfFailed ? { argv: argvIfFailed } : {},
|
|
350
|
-
...run ? {} : { keptBecauseFailed: true }
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
if (typeof error === "object" && error !== null)
|
|
354
|
-
settled.add(error);
|
|
355
|
-
}, "fail")
|
|
356
|
-
};
|
|
357
|
-
}, "startRecording");
|
|
358
|
-
var settled = /* @__PURE__ */ new WeakSet();
|
|
359
|
-
var wasSettled = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && settled.has(error), "wasSettled");
|
|
360
|
-
var HELD_AT_MOST = 500;
|
|
361
|
-
var EVENTS_AT_MOST = 2e3;
|
|
362
|
-
var EVENT_BYTES_AT_MOST = 1024 * 1024;
|
|
363
|
-
var capped = /* @__PURE__ */ __name(() => {
|
|
364
|
-
let lines = 0;
|
|
365
|
-
let bytes = 0;
|
|
366
|
-
let dropped = 0;
|
|
367
|
-
const byOperation = {};
|
|
368
|
-
return {
|
|
369
|
-
log: /* @__PURE__ */ __name((run, event) => {
|
|
370
|
-
const size = JSON.stringify(logAttributes(event)).length + 200;
|
|
371
|
-
if (lines >= EVENTS_AT_MOST || bytes + size > EVENT_BYTES_AT_MOST) {
|
|
372
|
-
dropped += 1;
|
|
373
|
-
const operation = "operation" in event && event.operation ? event.operation : event.event;
|
|
374
|
-
byOperation[operation] = (byOperation[operation] ?? 0) + 1;
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
lines += 1;
|
|
378
|
-
bytes += size;
|
|
379
|
-
logEvent(run, event);
|
|
380
|
-
}, "log"),
|
|
381
|
-
close: /* @__PURE__ */ __name((run) => {
|
|
382
|
-
if (dropped > 0)
|
|
383
|
-
run.logger.warn({ event: "events.dropped", dropped, counts: byOperation });
|
|
384
|
-
}, "close"),
|
|
385
|
-
dropped: /* @__PURE__ */ __name(() => dropped > 0 ? { eventsDropped: dropped } : {}, "dropped")
|
|
386
|
-
};
|
|
387
|
-
}, "capped");
|
|
388
|
-
var logEvent = /* @__PURE__ */ __name((run, event) => {
|
|
389
|
-
const record2 = {
|
|
390
|
-
...event,
|
|
391
|
-
event: DIAGNOSTIC_LOG_EVENTS[event.event],
|
|
392
|
-
..."endpointTemplate" in event && event.endpointTemplate !== void 0 ? { endpointTemplate: endpointTemplate(event.endpointTemplate) } : {}
|
|
393
|
-
};
|
|
394
|
-
if (event.event === "warning")
|
|
395
|
-
run.logger.warn(record2);
|
|
396
|
-
else if (event.event !== "cache" && event.outcome === "error")
|
|
397
|
-
run.logger.error(record2);
|
|
398
|
-
else
|
|
399
|
-
run.logger.info(record2);
|
|
400
|
-
}, "logEvent");
|
|
401
|
-
var outcomeOf = /* @__PURE__ */ __name((error) => {
|
|
402
|
-
if (!isCliFailure(error))
|
|
403
|
-
return { errorCode: "generic_failure" };
|
|
404
|
-
const providerError = providerErrorKey(error.details?.provider_error);
|
|
405
|
-
return { errorCode: error.code, ...providerError ? { providerError } : {} };
|
|
406
|
-
}, "outcomeOf");
|
|
407
|
-
var crashOf = /* @__PURE__ */ __name((error) => ({
|
|
408
|
-
event: "command.crashed",
|
|
409
|
-
errorClass: error instanceof Error ? error.name : typeof error,
|
|
410
|
-
frames: framesOf(error, 10)
|
|
411
|
-
}), "crashOf");
|
|
412
|
-
var partialOutcome = /* @__PURE__ */ __name((answer) => {
|
|
413
|
-
if (!answer || typeof answer !== "object")
|
|
414
|
-
return void 0;
|
|
415
|
-
const body = "item" in answer ? answer.item : answer;
|
|
416
|
-
if (body.batch?.failed)
|
|
417
|
-
return {
|
|
418
|
-
failed: body.batch.failed,
|
|
419
|
-
...body.batch.stopReason ? { stopReason: body.batch.stopReason } : {},
|
|
420
|
-
failures: (body.batch.failures ?? []).map((failure) => ({
|
|
421
|
-
id: failure.id,
|
|
422
|
-
stage: failure.stage,
|
|
423
|
-
errorCode: failure.error.code,
|
|
424
|
-
...failure.attachment === void 0 ? {} : { attachment: failure.attachment }
|
|
425
|
-
}))
|
|
426
|
-
};
|
|
427
|
-
if (body.issue)
|
|
428
|
-
return { failed: 1, failures: [{ id: body.chat ?? "history", stage: "history", errorCode: body.issue.code }] };
|
|
429
|
-
return void 0;
|
|
430
|
-
}, "partialOutcome");
|
|
431
|
-
|
|
432
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/deadline.js
|
|
433
|
-
var withDeadline = /* @__PURE__ */ __name(async (ms, closeables, body) => {
|
|
434
|
-
if (ms === void 0)
|
|
435
|
-
return body();
|
|
436
|
-
let timer;
|
|
437
|
-
let timedOut;
|
|
438
|
-
const writes2 = /* @__PURE__ */ new Set();
|
|
439
|
-
const expired = new Promise((_, reject) => {
|
|
440
|
-
timer = setTimeout(() => {
|
|
441
|
-
const pending = [...writes2];
|
|
442
|
-
const cut = pending.filter((write) => !write.preparing);
|
|
443
|
-
timedOut = cut.length > 0 ? new CliError("outcome_unknown", `\`--timeout\` ended the command after ${ms}ms with ${cut.length === 1 ? "a write" : `${cut.length} writes`} in flight; the messenger may or may not have carried it out \u2014 check before repeating it`, { operation_ids: cut.map((write) => write.operationId), retryable: false }) : new CliError("timeout", `the command did not finish within ${ms}ms \u2014 \`--timeout\` ended it`);
|
|
444
|
-
stopWrites(writes2, timedOut);
|
|
445
|
-
void Promise.allSettled(closeables.map((closeable) => closeable.close())).then(() => reject(timedOut));
|
|
446
|
-
}, ms);
|
|
447
|
-
});
|
|
448
|
-
try {
|
|
449
|
-
return await Promise.race([withWriteScope(writes2, body), expired]);
|
|
450
|
-
} catch (error) {
|
|
451
|
-
throw timedOut ?? error;
|
|
452
|
-
} finally {
|
|
453
|
-
if (timer)
|
|
454
|
-
clearTimeout(timer);
|
|
455
|
-
}
|
|
456
|
-
}, "withDeadline");
|
|
457
|
-
|
|
458
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/settings.js
|
|
459
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
460
|
-
|
|
461
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/models/endpoint.js
|
|
462
|
-
var endpoint = /* @__PURE__ */ __name((value) => {
|
|
463
|
-
try {
|
|
464
|
-
const url2 = new URL(value);
|
|
465
|
-
return ["https:", "http:"].includes(url2.protocol) && !url2.username && !url2.password && !url2.search && !url2.hash;
|
|
466
|
-
} catch {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
}, "endpoint");
|
|
470
|
-
|
|
471
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/models/settings.js
|
|
472
|
-
var MODEL_FIELDS = ["provider", "model", "base_url"];
|
|
473
|
-
var modelSettingsShape = record(pipe(string(), regex(/^[a-z][a-z0-9-]*$/)), strictObject({
|
|
474
|
-
provider: optional(picklist(["off", "openai", "anthropic"])),
|
|
475
|
-
model: optional(pipe(string(), trim(), minLength(1), maxLength(200))),
|
|
476
|
-
base_url: optional(pipe(string(), check((value) => endpoint(value), "use an HTTP/S endpoint without credentials, query or fragment")))
|
|
477
|
-
}));
|
|
478
|
-
var resolveModelSettings = /* @__PURE__ */ __name((prefix, layers, env) => {
|
|
479
|
-
const configured = layers.map(([from, scope]) => [from, scope?.models ?? {}]);
|
|
480
|
-
const purposes = /* @__PURE__ */ new Set([
|
|
481
|
-
"default",
|
|
482
|
-
"analysis",
|
|
483
|
-
"replies",
|
|
484
|
-
...configured.flatMap(([, models2]) => Object.keys(models2))
|
|
485
|
-
]);
|
|
486
|
-
for (const name of Object.keys(env)) {
|
|
487
|
-
const match = new RegExp(`^${prefix}_MODELS_([A-Z][A-Z0-9_]*)_(PROVIDER|MODEL|BASE_URL)$`).exec(name);
|
|
488
|
-
if (match?.[1])
|
|
489
|
-
purposes.add(match[1].toLowerCase().replaceAll("_", "-"));
|
|
490
|
-
}
|
|
491
|
-
const models = {};
|
|
492
|
-
const sources = {};
|
|
493
|
-
for (const purpose of purposes) {
|
|
494
|
-
const resolved = {};
|
|
495
|
-
for (const field of MODEL_FIELDS) {
|
|
496
|
-
const variable = `${prefix}_MODELS_${purpose.replaceAll("-", "_").toUpperCase()}_${field.toUpperCase()}`;
|
|
497
|
-
const candidates = [
|
|
498
|
-
[variable, env[variable]?.trim() || void 0],
|
|
499
|
-
...configured.map(([from, model2]) => [
|
|
500
|
-
`${from}: models.${purpose}.${field}`,
|
|
501
|
-
model2[purpose]?.[field]
|
|
502
|
-
]),
|
|
503
|
-
...purpose === "default" ? [] : [
|
|
504
|
-
[
|
|
505
|
-
`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`,
|
|
506
|
-
env[`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`]?.trim() || void 0
|
|
507
|
-
],
|
|
508
|
-
...configured.map(([from, model2]) => [
|
|
509
|
-
`${from}: models.default.${field}`,
|
|
510
|
-
model2.default?.[field]
|
|
511
|
-
])
|
|
512
|
-
]
|
|
513
|
-
];
|
|
514
|
-
const selected = candidates.find(([, value]) => value !== void 0);
|
|
515
|
-
if (selected)
|
|
516
|
-
resolved[field] = selected[1];
|
|
517
|
-
sources[`models.${purpose}.${field}`] = selected?.[0] ?? "default";
|
|
518
|
-
}
|
|
519
|
-
if (Object.keys(resolved).length)
|
|
520
|
-
models[purpose] = resolved;
|
|
521
|
-
}
|
|
522
|
-
const checked = safeParse(modelSettingsShape, models);
|
|
523
|
-
if (!checked.success)
|
|
524
|
-
throw new CliError("configuration_error", `models.${getDotPath(checked.issues[0]) ?? "settings"} is invalid`);
|
|
525
|
-
return { models: checked.output, sources };
|
|
526
|
-
}, "resolveModelSettings");
|
|
527
|
-
var modelTarget = /* @__PURE__ */ __name((settings, purpose) => {
|
|
528
|
-
const configured = { ...settings.models?.default, ...settings.models?.[purpose] };
|
|
529
|
-
if (configured.provider === void 0 || configured.provider === "off")
|
|
530
|
-
return void 0;
|
|
531
|
-
if (!configured.model)
|
|
532
|
-
throw new CliError("configuration_error", `set models.${purpose}.model before calling its provider`);
|
|
533
|
-
return {
|
|
534
|
-
provider: configured.provider,
|
|
535
|
-
model: configured.model,
|
|
536
|
-
...configured.base_url === void 0 ? {} : { baseUrl: configured.base_url }
|
|
537
|
-
};
|
|
538
|
-
}, "modelTarget");
|
|
539
|
-
|
|
540
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/analysis/settings.js
|
|
541
|
-
var model = pipe(string(), trim(), minLength(1), maxLength(200));
|
|
542
|
-
var url = pipe(string(), check(endpoint, "use an HTTP/S endpoint without credentials, query or fragment"));
|
|
543
|
-
var AI_FIELDS = {
|
|
544
|
-
embeddingProvider: optional(picklist(["local", "openai"])),
|
|
545
|
-
embeddingModel: optional(model),
|
|
546
|
-
embeddingBaseUrl: optional(url),
|
|
547
|
-
embeddingDims: optional(pipe(number(), integer(), minValue(1), maxValue(65536))),
|
|
548
|
-
models: optional(modelSettingsShape)
|
|
549
|
-
};
|
|
550
|
-
var fileKey = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "fileKey");
|
|
551
|
-
var AI_ENTRIES = Object.fromEntries(Object.entries(AI_FIELDS).map(([key, schema]) => [fileKey(key), schema]));
|
|
552
|
-
var AI_DEFAULTS = { embeddingProvider: "local" };
|
|
553
|
-
var AI_SETTING_KEYS = Object.keys(AI_FIELDS);
|
|
554
|
-
var resolveAISettings = /* @__PURE__ */ __name((prefix, layers, env) => {
|
|
555
|
-
const resolved = Object.entries(AI_FIELDS).filter(([key]) => key !== "models").map(([key, schema]) => {
|
|
556
|
-
const variable = `${prefix}_${fileKey(key).toUpperCase()}`;
|
|
557
|
-
const raw = env[variable]?.trim() || void 0;
|
|
558
|
-
const candidates = [
|
|
559
|
-
[variable, raw === void 0 ? void 0 : key === "embeddingDims" ? Number(raw) : raw],
|
|
560
|
-
...layers.map(([from2, scope]) => [from2, scope?.[fileKey(key)]])
|
|
561
|
-
];
|
|
562
|
-
const [from, value] = candidates.find(([, value2]) => value2 !== void 0) ?? [
|
|
563
|
-
"default",
|
|
564
|
-
AI_DEFAULTS[key]
|
|
565
|
-
];
|
|
566
|
-
const checked = safeParse(schema, value);
|
|
567
|
-
if (!checked.success)
|
|
568
|
-
throw new CliError("configuration_error", `${fileKey(key)} from ${from} is invalid`);
|
|
569
|
-
return { key, value: checked.output, from };
|
|
570
|
-
});
|
|
571
|
-
const values = Object.fromEntries(resolved.map(({ key, value }) => [key, value]));
|
|
572
|
-
const sources = Object.fromEntries(resolved.map(({ key, from }) => [key, from]));
|
|
573
|
-
const models = resolveModelSettings(prefix, layers, env);
|
|
574
|
-
return {
|
|
575
|
-
values: { ...values, models: models.models },
|
|
576
|
-
sources: {
|
|
577
|
-
...sources,
|
|
578
|
-
...models.sources,
|
|
579
|
-
models: Object.values(models.sources).some((source) => source !== "default") ? "resolved per purpose" : "default"
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
}, "resolveAISettings");
|
|
583
|
-
|
|
584
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/config-issues.js
|
|
585
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
586
|
-
var isNode = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isNode");
|
|
587
|
-
var SECTIONS = ["personal", "bot"];
|
|
588
|
-
var SHELL_SAFE = /^[A-Za-z0-9_.:@-]*$/;
|
|
589
|
-
var scopeOf = /* @__PURE__ */ __name((at) => {
|
|
590
|
-
const [first2, second, third] = at;
|
|
591
|
-
if (first2 === "profiles" && second !== void 0 && at.length > 2)
|
|
592
|
-
return { profile: second, flags: "", rest: at.slice(2) };
|
|
593
|
-
if (first2 === "defaults" && at.length > 1)
|
|
594
|
-
return { flags: " --defaults", rest: at.slice(1) };
|
|
595
|
-
if (SECTIONS.includes(first2)) {
|
|
596
|
-
if (second === "profiles" && third !== void 0 && at.length > 3)
|
|
597
|
-
return { profile: third, flags: ` --${first2}`, rest: at.slice(3) };
|
|
598
|
-
if (second === "defaults" && at.length > 2)
|
|
599
|
-
return { flags: ` --defaults --${first2}`, rest: at.slice(2) };
|
|
600
|
-
}
|
|
601
|
-
return { flags: "", rest: [...at] };
|
|
602
|
-
}, "scopeOf");
|
|
603
|
-
var settingPath = /* @__PURE__ */ __name((rest) => {
|
|
604
|
-
if (rest[0] === "permissions" && rest.length > 1)
|
|
605
|
-
return rest.slice(0, 2);
|
|
606
|
-
if (rest[0] === "models" && rest.length > 1)
|
|
607
|
-
return rest.slice(0, 3);
|
|
608
|
-
return rest.slice(0, 1);
|
|
609
|
-
}, "settingPath");
|
|
610
|
-
var settingOf = /* @__PURE__ */ __name((path) => path[0] === "permissions" && path.length > 1 ? `permissions.${path[1]}` : path.join("."), "settingOf");
|
|
611
|
-
var locate = /* @__PURE__ */ __name((kind, at, context, what) => {
|
|
612
|
-
const { profile, flags, rest } = scopeOf(at);
|
|
613
|
-
const inScope = rest.length < at.length;
|
|
614
|
-
const setting = inScope ? settingPath(rest) : [...rest];
|
|
615
|
-
const key = inScope ? settingOf(setting) : setting.join(".");
|
|
616
|
-
const prefix = at.slice(0, at.length - rest.length);
|
|
617
|
-
return {
|
|
618
|
-
kind,
|
|
619
|
-
file: context.file,
|
|
620
|
-
...profile === void 0 ? {} : { profile },
|
|
621
|
-
key,
|
|
622
|
-
what: what(key),
|
|
623
|
-
// A fix runs exactly as written; a name a shell would split or expand gets none.
|
|
624
|
-
...[key, profile ?? ""].every((word) => SHELL_SAFE.test(word)) ? { fix: `${context.tool}${profile === void 0 ? "" : ` ${profile}`} config unset${flags} ${key}` } : {},
|
|
625
|
-
at: [...prefix, ...setting]
|
|
626
|
-
};
|
|
627
|
-
}, "locate");
|
|
628
|
-
var failureOffset = /* @__PURE__ */ __name((text2) => {
|
|
629
|
-
let at = 0;
|
|
630
|
-
const fail = /* @__PURE__ */ __name(() => {
|
|
631
|
-
throw at;
|
|
632
|
-
}, "fail");
|
|
633
|
-
const space = /* @__PURE__ */ __name(() => {
|
|
634
|
-
while (/[ \t\n\r]/.test(text2[at] ?? ""))
|
|
635
|
-
at++;
|
|
636
|
-
}, "space");
|
|
637
|
-
const expect = /* @__PURE__ */ __name((char) => {
|
|
638
|
-
space();
|
|
639
|
-
if (text2[at] !== char)
|
|
640
|
-
fail();
|
|
641
|
-
at++;
|
|
642
|
-
}, "expect");
|
|
643
|
-
const string2 = /* @__PURE__ */ __name(() => {
|
|
644
|
-
expect('"');
|
|
645
|
-
while (text2[at] !== '"') {
|
|
646
|
-
if (at >= text2.length || text2.charCodeAt(at) < 32)
|
|
647
|
-
fail();
|
|
648
|
-
at += text2[at] === "\\" ? 2 : 1;
|
|
649
|
-
}
|
|
650
|
-
at++;
|
|
651
|
-
}, "string");
|
|
652
|
-
const items = /* @__PURE__ */ __name((close, item) => {
|
|
653
|
-
at++;
|
|
654
|
-
space();
|
|
655
|
-
if (text2[at] === close) {
|
|
656
|
-
at++;
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
for (; ; ) {
|
|
660
|
-
item();
|
|
661
|
-
space();
|
|
662
|
-
if (text2[at] === close)
|
|
663
|
-
break;
|
|
664
|
-
expect(",");
|
|
665
|
-
}
|
|
666
|
-
at++;
|
|
667
|
-
}, "items");
|
|
668
|
-
const value = /* @__PURE__ */ __name(() => {
|
|
669
|
-
space();
|
|
670
|
-
const char = text2[at] ?? "";
|
|
671
|
-
if (char === "{")
|
|
672
|
-
items("}", () => {
|
|
673
|
-
string2();
|
|
674
|
-
expect(":");
|
|
675
|
-
value();
|
|
676
|
-
});
|
|
677
|
-
else if (char === "[")
|
|
678
|
-
items("]", value);
|
|
679
|
-
else if (char === '"')
|
|
680
|
-
string2();
|
|
681
|
-
else {
|
|
682
|
-
const word = /^(true|false|null|-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?)/.exec(text2.slice(at));
|
|
683
|
-
if (!word)
|
|
684
|
-
fail();
|
|
685
|
-
at += word?.[0].length ?? 0;
|
|
686
|
-
}
|
|
687
|
-
}, "value");
|
|
688
|
-
try {
|
|
689
|
-
value();
|
|
690
|
-
space();
|
|
691
|
-
return at;
|
|
692
|
-
} catch (stopped) {
|
|
693
|
-
return typeof stopped === "number" ? stopped : at;
|
|
694
|
-
}
|
|
695
|
-
}, "failureOffset");
|
|
696
|
-
var parseConfigText = /* @__PURE__ */ __name((text2, file) => {
|
|
697
|
-
try {
|
|
698
|
-
return { raw: JSON.parse(text2) };
|
|
699
|
-
} catch {
|
|
700
|
-
const before = text2.slice(0, failureOffset(text2)).split("\n");
|
|
701
|
-
const line = before.length;
|
|
702
|
-
const column = (before.at(-1)?.length ?? 0) + 1;
|
|
703
|
-
return {
|
|
704
|
-
issue: {
|
|
705
|
-
kind: "invalid_json",
|
|
706
|
-
file,
|
|
707
|
-
line,
|
|
708
|
-
column,
|
|
709
|
-
what: `the file is not valid JSON at line ${line}, column ${column}`,
|
|
710
|
-
at: []
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
}, "parseConfigText");
|
|
715
|
-
var keyOfPath = /* @__PURE__ */ __name((issue) => (issue.path ?? []).map((item) => String(item.key)), "keyOfPath");
|
|
716
|
-
var isUnknownKey = /* @__PURE__ */ __name((issue) => issue.expected === "never", "isUnknownKey");
|
|
717
|
-
var isPermissionKey = /* @__PURE__ */ __name((issue, at) => {
|
|
718
|
-
const last = issue.path?.at(-1);
|
|
719
|
-
return at.at(-2) === "permissions" && last !== void 0 && "origin" in last && last.origin === "key";
|
|
720
|
-
}, "isPermissionKey");
|
|
721
|
-
var isMissing = /* @__PURE__ */ __name((issue) => {
|
|
722
|
-
const last = issue.path?.at(-1);
|
|
723
|
-
return last !== void 0 && "origin" in last && last.origin === "key" && issue.input === void 0;
|
|
724
|
-
}, "isMissing");
|
|
725
|
-
var ruleOf = /* @__PURE__ */ __name((issue) => {
|
|
726
|
-
const own = /^(has to be [\s\S]*?)(, not [\s\S]*)?$/.exec(issue.message);
|
|
727
|
-
if (own?.[1])
|
|
728
|
-
return own[1];
|
|
729
|
-
if (issue.type === "picklist")
|
|
730
|
-
return `has to be one of ${issue.expected}`;
|
|
731
|
-
if (!issue.message.startsWith("Invalid "))
|
|
732
|
-
return `is refused: ${issue.message}`;
|
|
733
|
-
if (issue.kind === "schema")
|
|
734
|
-
return `has to be of type ${issue.expected}`;
|
|
735
|
-
return issue.expected === null ? "has a value it does not take" : `has to be ${issue.expected}`;
|
|
736
|
-
}, "ruleOf");
|
|
737
|
-
var onePass = /* @__PURE__ */ __name((raw, schema, context, original) => {
|
|
738
|
-
const result = safeParse(schema, raw);
|
|
739
|
-
if (result.success)
|
|
740
|
-
return [];
|
|
741
|
-
return result.issues.map((issue) => {
|
|
742
|
-
const at = original(keyOfPath(issue));
|
|
743
|
-
const located = isPermissionKey(issue, at) ? locate("unknown_permission", at, context, (key) => `${key} names no command`) : isUnknownKey(issue) ? locate("unknown_setting", at, context, (key) => `setting ${key} is not a setting of ${context.tool}`) : isMissing(issue) ? locate("missing_setting", at, context, (key) => `setting ${key} is missing`) : locate("invalid_value", at, context, (key) => at.length === 0 ? "the file has to be an object, in braces" : `setting ${key} ${ruleOf(issue)}`);
|
|
744
|
-
if (located.kind === "missing_setting" || at.length === 0)
|
|
745
|
-
delete located.fix;
|
|
746
|
-
if (at.length === 0)
|
|
747
|
-
delete located.key;
|
|
748
|
-
return located;
|
|
749
|
-
});
|
|
750
|
-
}, "onePass");
|
|
751
|
-
var schemaIssues = /* @__PURE__ */ __name((raw, schema, context) => {
|
|
752
|
-
const found = /* @__PURE__ */ new Map();
|
|
753
|
-
for (; ; ) {
|
|
754
|
-
const { pruned, original } = prune(raw, [...found.values()].map(({ at }) => at));
|
|
755
|
-
const fresh = onePass(pruned, schema, context, original).filter((issue) => !found.has(issue.at.join("\0")));
|
|
756
|
-
if (fresh.length === 0)
|
|
757
|
-
return [...found.values()];
|
|
758
|
-
for (const issue of fresh)
|
|
759
|
-
found.set(issue.at.join("\0"), issue);
|
|
760
|
-
if (fresh.every((issue) => issue.kind === "missing_setting" || issue.at.length === 0))
|
|
761
|
-
return [...found.values()];
|
|
762
|
-
}
|
|
763
|
-
}, "schemaIssues");
|
|
764
|
-
var scopes = /* @__PURE__ */ __name((raw) => {
|
|
765
|
-
if (!isNode(raw))
|
|
766
|
-
return [];
|
|
767
|
-
const out = [];
|
|
768
|
-
const add = /* @__PURE__ */ __name((path, node) => {
|
|
769
|
-
if (isNode(node))
|
|
770
|
-
out.push([path, node]);
|
|
771
|
-
}, "add");
|
|
772
|
-
const addSection = /* @__PURE__ */ __name((path, section) => {
|
|
773
|
-
if (!isNode(section))
|
|
774
|
-
return;
|
|
775
|
-
add([...path, "defaults"], section.defaults);
|
|
776
|
-
if (isNode(section.profiles))
|
|
777
|
-
for (const [name, scope] of Object.entries(section.profiles))
|
|
778
|
-
add([...path, "profiles", name], scope);
|
|
779
|
-
}, "addSection");
|
|
780
|
-
add([], raw);
|
|
781
|
-
addSection([], raw);
|
|
782
|
-
for (const name of SECTIONS)
|
|
783
|
-
addSection([name], raw[name]);
|
|
784
|
-
return out;
|
|
785
|
-
}, "scopes");
|
|
786
|
-
var savedPermissionKeys = /* @__PURE__ */ __name((raw) => scopes(raw).flatMap(([path, scope]) => isNode(scope.permissions) ? Object.keys(scope.permissions).map((key) => ({ key, at: [...path, "permissions", key] })) : []), "savedPermissionKeys");
|
|
787
|
-
var permissionIssues = /* @__PURE__ */ __name((saved, known, context) => saved.filter(({ key }) => !known.has(key)).map(({ at }) => locate("unknown_permission", at, context, (key) => `${key} names no command`)), "permissionIssues");
|
|
788
|
-
var pathId = /* @__PURE__ */ __name((path) => path.join("\0"), "pathId");
|
|
789
|
-
var prune = /* @__PURE__ */ __name((raw, paths) => {
|
|
790
|
-
const drop = new Set(paths.map(pathId));
|
|
791
|
-
const kept = /* @__PURE__ */ new Map();
|
|
792
|
-
const walk = /* @__PURE__ */ __name((node, at) => {
|
|
793
|
-
if (Array.isArray(node)) {
|
|
794
|
-
const indices = node.flatMap((_, index) => drop.has(pathId([...at, String(index)])) ? [] : [index]);
|
|
795
|
-
kept.set(pathId(at), indices);
|
|
796
|
-
return indices.map((index) => walk(node[index], [...at, String(index)]));
|
|
797
|
-
}
|
|
798
|
-
if (!isNode(node))
|
|
799
|
-
return node;
|
|
800
|
-
return Object.fromEntries(Object.entries(node).flatMap(([key, item]) => drop.has(pathId([...at, key])) ? [] : [[key, walk(item, [...at, key])]]));
|
|
801
|
-
}, "walk");
|
|
802
|
-
const pruned = drop.has("") ? {} : walk(raw, []);
|
|
803
|
-
const original = /* @__PURE__ */ __name((path) => {
|
|
804
|
-
const at = [];
|
|
805
|
-
for (const part of path) {
|
|
806
|
-
const indices = kept.get(pathId(at));
|
|
807
|
-
at.push(indices ? String(indices[Number(part)] ?? part) : part);
|
|
808
|
-
}
|
|
809
|
-
return at;
|
|
810
|
-
}, "original");
|
|
811
|
-
return { pruned, original };
|
|
812
|
-
}, "prune");
|
|
813
|
-
var withoutIssues = /* @__PURE__ */ __name((raw, issues) => prune(raw, issues.map(({ at }) => at)).pruned, "withoutIssues");
|
|
814
|
-
var settingPathOf = /* @__PURE__ */ __name((setting) => setting.startsWith("permissions.") ? ["permissions", setting.slice("permissions.".length)] : setting.split("."), "settingPathOf");
|
|
815
|
-
var withoutPath = /* @__PURE__ */ __name((raw, at) => {
|
|
816
|
-
const valueAt2 = /* @__PURE__ */ __name((path) => path.reduce((node, key) => isNode(node) || Array.isArray(node) ? node[key] : void 0, raw), "valueAt");
|
|
817
|
-
if (at.length === 0 || valueAt2(at) === void 0)
|
|
818
|
-
return { config: raw, removed: false };
|
|
819
|
-
let gone = [...at];
|
|
820
|
-
for (let parent = at.slice(0, -1); parent.length > 0; parent = parent.slice(0, -1)) {
|
|
821
|
-
if (Array.isArray(valueAt2(parent.slice(0, -1))))
|
|
822
|
-
break;
|
|
823
|
-
const node = valueAt2(parent);
|
|
824
|
-
if (!isNode(node) || Object.keys(node).some((key) => pathId([...parent, key]) !== pathId(gone)))
|
|
825
|
-
break;
|
|
826
|
-
gone = parent;
|
|
827
|
-
}
|
|
828
|
-
return { config: prune(raw, [gone]).pruned, removed: true };
|
|
829
|
-
}, "withoutPath");
|
|
830
|
-
var publicIssue = /* @__PURE__ */ __name(({ at: _, ...issue }) => issue, "publicIssue");
|
|
831
|
-
var issueMessage = /* @__PURE__ */ __name((issues, doctor = "doctor") => {
|
|
832
|
-
const [first2] = issues;
|
|
833
|
-
if (!first2)
|
|
834
|
-
return "";
|
|
835
|
-
const more = issues.length - 1;
|
|
836
|
-
return `${first2.file}: ${first2.what}` + (first2.fix ? ` \u2014 remove it with \`${first2.fix}\`` : "") + (more === 0 ? "" : ` (and ${more} more problem${more === 1 ? "" : "s"} \u2014 \`${doctor}\` lists them all)`);
|
|
837
|
-
}, "issueMessage");
|
|
838
|
-
var checkConfigText = /* @__PURE__ */ __name((text2, { file, tool, schema, knownPermissions }) => {
|
|
839
|
-
const parsed = parseConfigText(text2, file);
|
|
840
|
-
if ("issue" in parsed)
|
|
841
|
-
return { issues: [publicIssue(parsed.issue)], config: void 0 };
|
|
842
|
-
if (!isNode(parsed.raw))
|
|
843
|
-
return { issues: [wholeFile(file, "the file must hold a JSON object")], config: void 0 };
|
|
844
|
-
const context = { file, tool };
|
|
845
|
-
const located = schemaIssues(parsed.raw, schema, context);
|
|
846
|
-
const loaded = safeParse(schema, withoutIssues(parsed.raw, located));
|
|
847
|
-
const config = loaded.success ? loaded.output : void 0;
|
|
848
|
-
const unknown2 = knownPermissions ? permissionIssues(savedPermissionKeys(config), knownPermissions, context) : [];
|
|
849
|
-
return { issues: [...located, ...unknown2].map(publicIssue), config };
|
|
850
|
-
}, "checkConfigText");
|
|
851
|
-
var wholeFile = /* @__PURE__ */ __name((file, what) => ({ kind: "invalid_value", file, what }), "wholeFile");
|
|
852
|
-
var readConfigText = /* @__PURE__ */ __name((path) => {
|
|
853
|
-
try {
|
|
854
|
-
return { text: readFileSync2(path, "utf8") };
|
|
855
|
-
} catch (error) {
|
|
856
|
-
const code = error.code;
|
|
857
|
-
if (code === "ENOENT")
|
|
858
|
-
return { text: void 0 };
|
|
859
|
-
return {
|
|
860
|
-
issue: wholeFile(path, code === "EISDIR" ? "the path is a folder, not a file" : "the file could not be read")
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
}, "readConfigText");
|
|
864
|
-
var readConfigFile = /* @__PURE__ */ __name((path) => {
|
|
865
|
-
const read = readConfigText(path);
|
|
866
|
-
if ("issue" in read)
|
|
867
|
-
return read;
|
|
868
|
-
if (read.text === void 0)
|
|
869
|
-
return { raw: void 0 };
|
|
870
|
-
const parsed = parseConfigText(read.text, path);
|
|
871
|
-
return "issue" in parsed ? { issue: publicIssue(parsed.issue) } : parsed;
|
|
872
|
-
}, "readConfigFile");
|
|
873
|
-
|
|
874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/default-config.js
|
|
875
|
-
import { existsSync as existsSync2, linkSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
876
|
-
import { dirname, join as join2 } from "node:path";
|
|
877
|
-
var DEFAULT_CONFIG = {
|
|
878
|
-
defaults: { limit: 20, keep_runs_for_days: 30, sends_per_hour: 30, update_check: true, skill_hint: true },
|
|
879
|
-
profiles: {}
|
|
880
|
-
};
|
|
881
|
-
function ensureDefaultConfig(path, config = DEFAULT_CONFIG) {
|
|
882
|
-
if (existsSync2(path))
|
|
883
|
-
return;
|
|
884
|
-
const directory = dirname(path);
|
|
885
|
-
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
886
|
-
const temporary = mkdtempSync(join2(directory, ".config-"));
|
|
887
|
-
const candidate = join2(temporary, "config.json");
|
|
888
|
-
try {
|
|
889
|
-
writeFileSync(candidate, `${JSON.stringify(config, null, 2)}
|
|
890
|
-
`, { flag: "wx", mode: 384 });
|
|
891
|
-
try {
|
|
892
|
-
linkSync(candidate, path);
|
|
893
|
-
} catch (error) {
|
|
894
|
-
if (error.code !== "EEXIST")
|
|
895
|
-
throw error;
|
|
896
|
-
}
|
|
897
|
-
} finally {
|
|
898
|
-
rmSync(temporary, { recursive: true, force: true });
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
__name(ensureDefaultConfig, "ensureDefaultConfig");
|
|
902
|
-
|
|
903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/settings.js
|
|
904
|
-
var DEFAULT_LIMIT = DEFAULT_CONFIG.defaults.limit;
|
|
905
|
-
var DEFAULT_KEEP_RUNS_FOR_DAYS = DEFAULT_CONFIG.defaults.keep_runs_for_days;
|
|
906
|
-
var DEFAULT_SENDS_PER_HOUR = DEFAULT_CONFIG.defaults.sends_per_hour;
|
|
907
|
-
var withCeiling = /* @__PURE__ */ __name((permissions, env) => {
|
|
908
|
-
const ceiling = permissionCeiling(sharedConfigPath(storePath(env), env));
|
|
909
|
-
return ceiling ? {
|
|
910
|
-
levels: { ...permissions.levels, [CEILING_KEY]: ceiling },
|
|
911
|
-
sources: { ...permissions.sources, [CEILING_KEY]: "setup answer" }
|
|
912
|
-
} : permissions;
|
|
913
|
-
}, "withCeiling");
|
|
914
|
-
var plain = /* @__PURE__ */ __name((rule) => (issue) => `${rule}, not ${issue.received}`, "plain");
|
|
915
|
-
var wholeNumber = plain("has to be a whole number, 1 or more");
|
|
916
|
-
var count2 = pipe(number(wholeNumber), integer(wholeNumber), minValue(1, wholeNumber));
|
|
917
|
-
var zeroOrMore = plain("has to be a whole number, 0 or more");
|
|
918
|
-
var countOrZero = pipe(number(zeroOrMore), integer(zeroOrMore), minValue(0, zeroOrMore));
|
|
919
|
-
var flag = boolean(plain("has to be true or false"));
|
|
920
|
-
var recordInputSetting = union([boolean(), literal("failed")], plain('has to be true, false or "failed"'));
|
|
921
|
-
var wholeOrZero = /* @__PURE__ */ __name((text2, name) => {
|
|
922
|
-
const value = Number(text2);
|
|
923
|
-
if (!Number.isInteger(value) || value < 0)
|
|
924
|
-
throw new CliError("validation_error", `${name} has to be a whole number, 0 or more`);
|
|
925
|
-
return value;
|
|
926
|
-
}, "wholeOrZero");
|
|
927
|
-
var levelsOf = /* @__PURE__ */ __name((key, example) => record(key, picklist(LEVELS, (issue) => `has to be one of ${LEVELS.join(", ")}, not ${issue.received}`), plain(`has to be an object of command paths and levels, like {"${example}": "ask"}`)), "levelsOf");
|
|
928
|
-
var permissionLevels = levelsOf(pipe(string(), regex(RESOURCE_KEY, (issue) => `${issue.input} is not a command path \u2014 it starts with one of ${RESOURCES.join(", ")}`)), "messages.delete");
|
|
929
|
-
var commandPathLevels = levelsOf(pipe(string(), regex(COMMAND_PATH_KEY, (issue) => `${issue.input} is not a command path, like api or events.delete`)), "events.delete");
|
|
930
|
-
var objectMessage = /* @__PURE__ */ __name((issue) => issue.expected === "never" ? "unknown setting" : "has to be an object, in braces", "objectMessage");
|
|
931
|
-
var SHARED_PROFILE_ENTRIES = {
|
|
932
|
-
limit: optional(count2),
|
|
933
|
-
timeout_ms: optional(count2),
|
|
934
|
-
color: optional(flag),
|
|
935
|
-
sender_colors: optional(flag),
|
|
936
|
-
record: optional(flag),
|
|
937
|
-
record_input: optional(recordInputSetting),
|
|
938
|
-
keep_runs_for_days: optional(count2),
|
|
939
|
-
keep_successful_runs_for_days: optional(count2),
|
|
940
|
-
runs_size_limit_mb: optional(count2),
|
|
941
|
-
permissions: optional(permissionLevels),
|
|
942
|
-
sends_per_hour: optional(count2),
|
|
943
|
-
requests_per_minute: optional(countOrZero),
|
|
944
|
-
transcribe_with: optional(picklist(["auto", "messenger", "local"], plain("has to be auto, messenger or local"))),
|
|
945
|
-
speech_model: optional(string(plain("has to be a model id from `models list`, in quotes"))),
|
|
946
|
-
search_catch_up: optional(flag),
|
|
947
|
-
picture_search: optional(flag),
|
|
948
|
-
search_reranker: optional(picklist([...RERANK_MODELS.map((model2) => model2.id), "off"], plain(`has to be off or a reranker id: ${RERANK_MODELS.map((model2) => model2.id).join(", ")}`))),
|
|
949
|
-
...AI_ENTRIES
|
|
950
|
-
};
|
|
951
|
-
var BOT_ONLY_ENTRIES = {
|
|
952
|
-
read_other_bots: optional(union([flag, array(string(), plain("has to be a list of profile names"))], plain("has to be true, false or a list of profile names")))
|
|
953
|
-
};
|
|
954
|
-
var MESSENGER_ONLY_SETTINGS = [
|
|
955
|
-
"sender_colors",
|
|
956
|
-
"sends_per_hour",
|
|
957
|
-
"transcribe_with",
|
|
958
|
-
"search_catch_up",
|
|
959
|
-
"read_other_bots"
|
|
960
|
-
];
|
|
961
|
-
var SHARED_DEFAULTS_ONLY = {
|
|
962
|
-
update_check: optional(flag),
|
|
963
|
-
skill_hint: optional(flag)
|
|
964
|
-
};
|
|
965
|
-
var NONE_NAMED = "none named";
|
|
966
|
-
var NO_PROFILE = "default";
|
|
967
|
-
var namedProfile = /* @__PURE__ */ __name((settings) => settings.sources?.profile === NONE_NAMED ? void 0 : settings.profile, "namedProfile");
|
|
968
|
-
var NoProfileHere = class extends CliError {
|
|
969
|
-
static {
|
|
970
|
-
__name(this, "NoProfileHere");
|
|
971
|
-
}
|
|
972
|
-
app;
|
|
973
|
-
constructor(app) {
|
|
974
|
-
super("validation_error", `name a profile: there is none on this computer yet \u2014 create one with \`${app.command} personal setup\` (any name in place of personal)`, { profiles: [] });
|
|
975
|
-
this.app = app;
|
|
976
|
-
}
|
|
977
|
-
/** `words`: the command that was typed, without its arguments, so the suggestion runs as written. */
|
|
978
|
-
withoutSetup(words) {
|
|
979
|
-
const command = words ? `${this.app.command} personal ${words}` : `${this.app.command} personal \u2026`;
|
|
980
|
-
return new CliError("validation_error", `name a profile: there is none on this computer yet \u2014 any name works, such as \`${command}\` (or set ${envName(this.app, "PROFILE")})`, { profiles: [] });
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
var first = /* @__PURE__ */ __name((candidates, fallback) => {
|
|
984
|
-
for (const [from, value] of candidates)
|
|
985
|
-
if (value !== void 0)
|
|
986
|
-
return { value, from };
|
|
987
|
-
return { value: fallback, from: "default" };
|
|
988
|
-
}, "first");
|
|
989
|
-
var fromFile = /* @__PURE__ */ __name((settings, key, fallback) => first([
|
|
990
|
-
["config file", settings.configured[key]],
|
|
991
|
-
["config defaults", settings.shared[key]]
|
|
992
|
-
], fallback), "fromFile");
|
|
993
|
-
var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
|
|
994
|
-
const declared = extension.permissions;
|
|
995
|
-
const profileEntries = {
|
|
996
|
-
...SHARED_PROFILE_ENTRIES,
|
|
997
|
-
...declared ? { permissions: optional(commandPathLevels) } : {},
|
|
998
|
-
...extension.profile
|
|
999
|
-
};
|
|
1000
|
-
const defaultsOnly = { ...SHARED_DEFAULTS_ONLY, ...extension.defaults };
|
|
1001
|
-
const defaultsEntries = { ...profileEntries, ...defaultsOnly };
|
|
1002
|
-
const strictOf = /* @__PURE__ */ __name((entries) => strictObject(entries, objectMessage), "strictOf");
|
|
1003
|
-
const kindSection = /* @__PURE__ */ __name((entries) => strictObject({
|
|
1004
|
-
defaults: optional(strictOf(entries)),
|
|
1005
|
-
profiles: optional(record(string(), strictOf(entries), "has to be an object of profiles, by name"))
|
|
1006
|
-
}, objectMessage), "kindSection");
|
|
1007
|
-
const configEntries = {
|
|
1008
|
-
defaults: optional(strictOf(defaultsEntries)),
|
|
1009
|
-
profiles: optional(record(string(), strictOf(profileEntries), "has to be an object of profiles, by name"), {}),
|
|
1010
|
-
personal: optional(kindSection(profileEntries)),
|
|
1011
|
-
bot: optional(kindSection({ ...profileEntries, ...BOT_ONLY_ENTRIES }))
|
|
1012
|
-
};
|
|
1013
|
-
const schema = strictOf(configEntries);
|
|
1014
|
-
const defaultsOnlyKeys = Object.keys(defaultsOnly);
|
|
1015
|
-
const botOnlyKeys = Object.keys(BOT_ONLY_ENTRIES);
|
|
1016
|
-
const allSettings = [...Object.keys(profileEntries), ...botOnlyKeys, ...defaultsOnlyKeys].filter((setting) => app.messenger !== false || !MESSENGER_ONLY_SETTINGS.includes(setting));
|
|
1017
|
-
const PROFILE = envName(app, "PROFILE");
|
|
1018
|
-
const PROFILE_LOCK = envName(app, "PROFILE_LOCK");
|
|
1019
|
-
const TIMEOUT = envName(app, "TIMEOUT");
|
|
1020
|
-
const REQUESTS_PER_MINUTE = envName(app, "REQUESTS_PER_MINUTE");
|
|
1021
|
-
const configPathFor = /* @__PURE__ */ __name(({ env = process.env, configDir }) => configFilePath(configDir ?? resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).config), "configPathFor");
|
|
1022
|
-
const readSchema = extension.schema ?? schema;
|
|
1023
|
-
const context = /* @__PURE__ */ __name((file) => ({ file, tool: app.command }), "context");
|
|
1024
|
-
const loadConfig = /* @__PURE__ */ __name((path) => {
|
|
1025
|
-
const read = readConfigText(path);
|
|
1026
|
-
if ("issue" in read)
|
|
1027
|
-
return { config: { profiles: {} }, issues: [read.issue] };
|
|
1028
|
-
if (read.text === void 0)
|
|
1029
|
-
return { config: { profiles: {} }, issues: [] };
|
|
1030
|
-
const { config, issues } = checkConfigText(read.text, { file: path, tool: app.command, schema: readSchema });
|
|
1031
|
-
return { config: config ?? { profiles: {} }, issues };
|
|
1032
|
-
}, "loadConfig");
|
|
1033
|
-
const locked = /* @__PURE__ */ __name((profile, lock) => {
|
|
1034
|
-
if (lock === void 0)
|
|
1035
|
-
return profile;
|
|
1036
|
-
usableProfileName(lock);
|
|
1037
|
-
if (profile.value === lock)
|
|
1038
|
-
return profile;
|
|
1039
|
-
if (profile.from === "first word" || profile.from === PROFILE) {
|
|
1040
|
-
throw new CliError("permission_error", `this process is locked to profile ${lock} (${PROFILE_LOCK}) \u2014 profile "${profile.value}" is refused`);
|
|
1041
|
-
}
|
|
1042
|
-
return { value: lock, from: PROFILE_LOCK };
|
|
1043
|
-
}, "locked");
|
|
1044
|
-
const unnamed = /* @__PURE__ */ __name((config, env, needed) => {
|
|
1045
|
-
if (!needed)
|
|
1046
|
-
return { value: NO_PROFILE, from: NONE_NAMED };
|
|
1047
|
-
const here = profilesOf(config, env);
|
|
1048
|
-
if (here.length === 0)
|
|
1049
|
-
throw new NoProfileHere(app);
|
|
1050
|
-
throw new CliError("validation_error", `name a profile: \`${app.command} <profile> \u2026\` \u2014 profiles here: ${here.join(", ")} (or set ${PROFILE})`, { profiles: here });
|
|
1051
|
-
}, "unnamed");
|
|
1052
|
-
const profilesOf = /* @__PURE__ */ __name((config, env) => profilesHere(app, [...namedProfiles(config), ...extension.profiles?.(env) ?? []], env), "profilesOf");
|
|
1053
|
-
const resolveSettings = /* @__PURE__ */ __name((flags = {}, options = {}) => {
|
|
1054
|
-
const env = options.env ?? process.env;
|
|
1055
|
-
const configPath = configPathFor(options);
|
|
1056
|
-
try {
|
|
1057
|
-
if (!options.readOnly)
|
|
1058
|
-
ensureDefaultConfig(configPath);
|
|
1059
|
-
} catch (error) {
|
|
1060
|
-
throw new CliError("configuration_error", error instanceof Error ? error.message : String(error));
|
|
1061
|
-
}
|
|
1062
|
-
const loaded = loadConfig(configPath);
|
|
1063
|
-
if (loaded.issues.length > 0 && !options.withIssues)
|
|
1064
|
-
throw new CliError("configuration_error", issueMessage(loaded.issues));
|
|
1065
|
-
const { config } = loaded;
|
|
1066
|
-
const lock = given(env[PROFILE_LOCK]);
|
|
1067
|
-
const named = first([
|
|
1068
|
-
["first word", flags.profile],
|
|
1069
|
-
[PROFILE, given(env[PROFILE])],
|
|
1070
|
-
[PROFILE_LOCK, lock]
|
|
1071
|
-
], void 0);
|
|
1072
|
-
const profile = locked(named.value === void 0 ? unnamed(config, env, options.needsProfile !== false) : { value: named.value, from: named.from }, lock);
|
|
1073
|
-
const kind = options.kind ?? "personal";
|
|
1074
|
-
const name = usableProfileName(profile.value);
|
|
1075
|
-
const configured = config.profiles[name] ?? {};
|
|
1076
|
-
const shared = config.defaults ?? {};
|
|
1077
|
-
const section = config[kind];
|
|
1078
|
-
const layers = [
|
|
1079
|
-
[`config file: ${kind}.profiles.${name}`, section?.profiles?.[name]],
|
|
1080
|
-
[extension.sourcePaths ? `config file: profiles.${name}` : "config file", configured],
|
|
1081
|
-
[`config file: ${kind}.defaults`, section?.defaults],
|
|
1082
|
-
[extension.sourcePaths ? "config file: defaults" : "config defaults", shared]
|
|
1083
|
-
];
|
|
1084
|
-
const fromLayers = /* @__PURE__ */ __name((key, fallback, only = layers) => first(only.map(([from, scope]) => [from, scope?.[key]]), fallback), "fromLayers");
|
|
1085
|
-
const kindLayers = layers.filter(([from]) => from.startsWith(`config file: ${kind}.`));
|
|
1086
|
-
const limit = flags.limit === void 0 ? fromLayers("limit", DEFAULT_LIMIT) : { value: flags.limit, from: "flag" };
|
|
1087
|
-
const record2 = flags.record === void 0 ? fromLayers("record", true) : { value: flags.record, from: "flag" };
|
|
1088
|
-
const timeoutMs = fromLayers("timeout_ms", void 0);
|
|
1089
|
-
const color = fromLayers("color", void 0);
|
|
1090
|
-
const senderColors = fromLayers("sender_colors", false);
|
|
1091
|
-
const searchCatchUp = fromLayers("search_catch_up", false);
|
|
1092
|
-
const pictureSearch = fromLayers("picture_search", false);
|
|
1093
|
-
const searchReranker = fromLayers("search_reranker", DEFAULT_RERANK_MODEL);
|
|
1094
|
-
const recordInput = fromLayers("record_input", true);
|
|
1095
|
-
const keepRunsForDays = fromLayers("keep_runs_for_days", DEFAULT_KEEP_RUNS_FOR_DAYS);
|
|
1096
|
-
const keepSuccessfulRunsForDays = fromLayers("keep_successful_runs_for_days", KEEP_SUCCESSFUL_RUNS_FOR_DAYS);
|
|
1097
|
-
const runsSizeLimitMb = fromLayers("runs_size_limit_mb", RUNS_SIZE_LIMIT_MB);
|
|
1098
|
-
const readOnlyLock = readOnlyLockOf(app, env);
|
|
1099
|
-
const sendsPerHour = kind === "bot" ? fromLayers("sends_per_hour", Number.POSITIVE_INFINITY, kindLayers) : fromLayers("sends_per_hour", DEFAULT_SENDS_PER_HOUR);
|
|
1100
|
-
const paceFromEnv = given(env[REQUESTS_PER_MINUTE]);
|
|
1101
|
-
const requestsPerMinute = paceFromEnv === void 0 ? fromLayers("requests_per_minute", void 0) : { value: wholeOrZero(paceFromEnv, REQUESTS_PER_MINUTE), from: REQUESTS_PER_MINUTE };
|
|
1102
|
-
const readOtherBots = kind === "bot" ? fromLayers("read_other_bots", false, kindLayers) : { value: false, from: "default" };
|
|
1103
|
-
const fileLayers = layers.map(([from, scope]) => [
|
|
1104
|
-
from,
|
|
1105
|
-
scope?.permissions
|
|
1106
|
-
]);
|
|
1107
|
-
const overrides = permissionOverrides(flags.permission, declared ? COMMAND_PATH_KEY : RESOURCE_KEY);
|
|
1108
|
-
assertOverridesTighten(overrides, layerPermissions(fileLayers).levels, declared?.defaults);
|
|
1109
|
-
const permissions = withCeiling(layerPermissions([["flag", overrides], ...fileLayers]), env);
|
|
1110
|
-
const updateCheck = first([
|
|
1111
|
-
[
|
|
1112
|
-
extension.sourcePaths ? "config file: defaults" : "config defaults",
|
|
1113
|
-
shared.update_check
|
|
1114
|
-
]
|
|
1115
|
-
], true);
|
|
1116
|
-
const skillHint = first([[extension.sourcePaths ? "config file: defaults" : "config defaults", shared.skill_hint]], true);
|
|
1117
|
-
const timeout = first([
|
|
1118
|
-
["flag", flags.timeout],
|
|
1119
|
-
[TIMEOUT, given(env[TIMEOUT])]
|
|
1120
|
-
], void 0);
|
|
1121
|
-
const ai = resolveAISettings(app.envPrefix, layers, env);
|
|
1122
|
-
const settings = {
|
|
1123
|
-
...ai.values,
|
|
1124
|
-
profile: usableProfileName(profile.value),
|
|
1125
|
-
json: flags.json === true,
|
|
1126
|
-
jsonl: flags.jsonl === true,
|
|
1127
|
-
quiet: flags.quiet === true,
|
|
1128
|
-
detail: Math.min(2, Math.max(0, flags.verbose ?? 0)),
|
|
1129
|
-
trace: flags.trace === true,
|
|
1130
|
-
offline: flags.offline === true,
|
|
1131
|
-
color: color.value,
|
|
1132
|
-
senderColors: senderColors.value,
|
|
1133
|
-
searchCatchUp: searchCatchUp.value,
|
|
1134
|
-
pictureSearch: pictureSearch.value,
|
|
1135
|
-
searchReranker: searchReranker.value,
|
|
1136
|
-
limit: limit.value,
|
|
1137
|
-
page: flags.page ?? 1,
|
|
1138
|
-
all: flags.all === true,
|
|
1139
|
-
timeoutMs: timeoutMs.value,
|
|
1140
|
-
commandTimeoutMs: timeout.value === void 0 ? void 0 : (extension.parseDuration ?? parseDuration)(timeout.value, timeout.from === TIMEOUT ? TIMEOUT : "--timeout"),
|
|
1141
|
-
record: record2.value,
|
|
1142
|
-
recordInput: recordInput.value,
|
|
1143
|
-
keepFailedRuns: record2.value || record2.from !== "flag",
|
|
1144
|
-
keepRunsForDays: keepRunsForDays.value,
|
|
1145
|
-
keepSuccessfulRunsForDays: keepSuccessfulRunsForDays.value,
|
|
1146
|
-
runsSizeLimitMb: runsSizeLimitMb.value,
|
|
1147
|
-
...readOnlyLock ? { readOnlyLock } : {},
|
|
1148
|
-
permissions: permissions.levels,
|
|
1149
|
-
permissionSources: permissions.sources,
|
|
1150
|
-
sendsPerHour: sendsPerHour.value,
|
|
1151
|
-
...requestsPerMinute.value === void 0 ? {} : { requestsPerMinute: requestsPerMinute.value },
|
|
1152
|
-
kind,
|
|
1153
|
-
readOtherBots: readOtherBots.value,
|
|
1154
|
-
updateCheck: updateCheck.value,
|
|
1155
|
-
skillHint: skillHint.value,
|
|
1156
|
-
configPath,
|
|
1157
|
-
configFound: existsSync3(configPath),
|
|
1158
|
-
configuredProfiles: namedProfiles(config),
|
|
1159
|
-
profilesHere: profilesOf(config, env),
|
|
1160
|
-
sources: {
|
|
1161
|
-
...ai.sources,
|
|
1162
|
-
profile: profile.from,
|
|
1163
|
-
limit: limit.from,
|
|
1164
|
-
timeoutMs: timeoutMs.from,
|
|
1165
|
-
commandTimeoutMs: timeout.from,
|
|
1166
|
-
color: color.from,
|
|
1167
|
-
senderColors: senderColors.from,
|
|
1168
|
-
searchCatchUp: searchCatchUp.from,
|
|
1169
|
-
pictureSearch: pictureSearch.from,
|
|
1170
|
-
searchReranker: searchReranker.from,
|
|
1171
|
-
record: record2.from,
|
|
1172
|
-
recordInput: recordInput.from,
|
|
1173
|
-
keepRunsForDays: keepRunsForDays.from,
|
|
1174
|
-
keepSuccessfulRunsForDays: keepSuccessfulRunsForDays.from,
|
|
1175
|
-
runsSizeLimitMb: runsSizeLimitMb.from,
|
|
1176
|
-
sendsPerHour: sendsPerHour.from,
|
|
1177
|
-
requestsPerMinute: requestsPerMinute.from,
|
|
1178
|
-
readOtherBots: readOtherBots.from,
|
|
1179
|
-
updateCheck: updateCheck.from,
|
|
1180
|
-
skillHint: skillHint.from
|
|
1181
|
-
},
|
|
1182
|
-
configured,
|
|
1183
|
-
shared,
|
|
1184
|
-
configIssues: loaded.issues,
|
|
1185
|
-
savedPermissions: savedPermissionKeys(config)
|
|
1186
|
-
};
|
|
1187
|
-
if (!Number.isInteger(settings.limit) || settings.limit < 1) {
|
|
1188
|
-
throw new CliError("validation_error", `--limit takes a whole number from 1 upwards, not ${flags.limit}`);
|
|
1189
|
-
}
|
|
1190
|
-
if (!Number.isInteger(settings.page) || settings.page < 1) {
|
|
1191
|
-
throw new CliError("validation_error", `--page takes a whole number from 1 upwards, not ${flags.page}`);
|
|
1192
|
-
}
|
|
1193
|
-
if (settings.all && flags.page !== void 0) {
|
|
1194
|
-
throw new CliError("validation_error", "--all and --page ask for different things; use one or the other");
|
|
1195
|
-
}
|
|
1196
|
-
const extra = extension.resolve?.({ flags, settings, layers, fromLayers });
|
|
1197
|
-
return { ...settings, ...extra?.values, sources: { ...settings.sources, ...extra?.sources } };
|
|
1198
|
-
}, "resolveSettings");
|
|
1199
|
-
const configuredProfiles = /* @__PURE__ */ __name((options = {}) => {
|
|
1200
|
-
const { config, issues } = loadConfig(configPathFor(options));
|
|
1201
|
-
if (issues.length > 0 && !options.withIssues)
|
|
1202
|
-
throw new CliError("configuration_error", issueMessage(issues));
|
|
1203
|
-
return namedProfiles(config);
|
|
1204
|
-
}, "configuredProfiles");
|
|
1205
|
-
const changeSetting = /* @__PURE__ */ __name((path, { profile, setting, value, kind, root = false }) => {
|
|
1206
|
-
const [name = setting, ...rest] = setting.split(".");
|
|
1207
|
-
const level = name === "permissions" && rest.length > 0 ? rest.join(".") : void 0;
|
|
1208
|
-
const modelField = /^models\.([a-z][a-z0-9-]*)\.(provider|model|base_url)$/.exec(setting);
|
|
1209
|
-
const known = allSettings.includes(setting) || level !== void 0 || modelField !== null;
|
|
1210
|
-
const read = readConfigFile(path);
|
|
1211
|
-
if ("issue" in read)
|
|
1212
|
-
throw new CliError("configuration_error", issueMessage([read.issue]));
|
|
1213
|
-
const raw = read.raw === void 0 ? {} : read.raw;
|
|
1214
|
-
if (!isScope(raw))
|
|
1215
|
-
throw new CliError("configuration_error", `${path}: the file has to be an object, in braces`);
|
|
1216
|
-
const scopePath = root ? [] : [...kind === void 0 ? [] : [kind], ...profile === void 0 ? ["defaults"] : ["profiles", profile]];
|
|
1217
|
-
const keyPath = root ? settingPathOf(setting) : level !== void 0 ? ["permissions", level] : modelField ? ["models", modelField[1], modelField[2]] : [setting];
|
|
1218
|
-
const at = [...scopePath, ...keyPath];
|
|
1219
|
-
const before = schemaIssues(raw, readSchema, context(path));
|
|
1220
|
-
if (value === void 0) {
|
|
1221
|
-
if (root && !before.some((issue) => issue.at.join(".") === at.join(".")))
|
|
1222
|
-
throw new CliError("validation_error", `${setting} has no problem to remove \u2014 name the profile, or add --defaults, to unset a setting`);
|
|
1223
|
-
if (!known && valueAt(raw, at) === void 0)
|
|
1224
|
-
throw new CliError("validation_error", `no setting called "${setting}" \u2014 one of: ${allSettings.join(", ")}`);
|
|
1225
|
-
saveConfigFile(path, withoutPath(raw, at).config);
|
|
1226
|
-
return null;
|
|
1227
|
-
}
|
|
1228
|
-
if (!known)
|
|
1229
|
-
throw new CliError("validation_error", `no setting called "${setting}" \u2014 one of: ${allSettings.join(", ")}`);
|
|
1230
|
-
if (profile !== void 0 && defaultsOnlyKeys.includes(setting)) {
|
|
1231
|
-
throw new CliError("validation_error", `${setting} is one setting for the whole program, not per profile \u2014 add --defaults`);
|
|
1232
|
-
}
|
|
1233
|
-
if (kind !== void 0 && defaultsOnlyKeys.includes(setting)) {
|
|
1234
|
-
throw new CliError("validation_error", `${setting} is one setting for the whole program, not per side`);
|
|
1235
|
-
}
|
|
1236
|
-
if (kind !== "bot" && botOnlyKeys.includes(setting)) {
|
|
1237
|
-
throw new CliError("validation_error", `${setting} is a bot's setting \u2014 add --bot`);
|
|
1238
|
-
}
|
|
1239
|
-
const changed = structuredClone(raw);
|
|
1240
|
-
setAt(changed, at, level === void 0 ? parseValue(value) : value.trim());
|
|
1241
|
-
const had = new Set(before.map((issue) => issue.at.join(".")));
|
|
1242
|
-
const added = schemaIssues(changed, readSchema, context(path)).find((issue) => !had.has(issue.at.join(".")) || issue.at.join(".") === at.join("."));
|
|
1243
|
-
if (added)
|
|
1244
|
-
throw new CliError("validation_error", `${setting} cannot be "${value}": ${added.what}`);
|
|
1245
|
-
const checked = safeParse(readSchema, changed);
|
|
1246
|
-
saveConfigFile(path, checked.success ? checked.output : changed);
|
|
1247
|
-
return valueAt(checked.success ? checked.output : changed, at) ?? null;
|
|
1248
|
-
}, "changeSetting");
|
|
1249
|
-
return {
|
|
1250
|
-
resolveSettings,
|
|
1251
|
-
configuredProfiles,
|
|
1252
|
-
changeSetting,
|
|
1253
|
-
allSettings,
|
|
1254
|
-
defaultsOnlyKeys,
|
|
1255
|
-
schema,
|
|
1256
|
-
...declared ? { permissions: declared } : {}
|
|
1257
|
-
};
|
|
1258
|
-
}, "settingsFor");
|
|
1259
|
-
var isScope = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isScope");
|
|
1260
|
-
var valueAt = /* @__PURE__ */ __name((node, path) => path.reduce((at, key) => isScope(at) || Array.isArray(at) ? at[key] : void 0, node), "valueAt");
|
|
1261
|
-
var setAt = /* @__PURE__ */ __name((node, path, value) => {
|
|
1262
|
-
let at = node;
|
|
1263
|
-
for (const key of path.slice(0, -1)) {
|
|
1264
|
-
if (!isScope(at[key]))
|
|
1265
|
-
at[key] = {};
|
|
1266
|
-
at = at[key];
|
|
1267
|
-
}
|
|
1268
|
-
at[path.at(-1)] = value;
|
|
1269
|
-
}, "setAt");
|
|
1270
|
-
var namedProfiles = /* @__PURE__ */ __name((config) => [
|
|
1271
|
-
.../* @__PURE__ */ new Set([
|
|
1272
|
-
...Object.keys(config.profiles),
|
|
1273
|
-
...Object.keys(config.personal?.profiles ?? {}),
|
|
1274
|
-
...Object.keys(config.bot?.profiles ?? {})
|
|
1275
|
-
])
|
|
1276
|
-
].sort(), "namedProfiles");
|
|
1277
|
-
var parseValue = /* @__PURE__ */ __name((value) => {
|
|
1278
|
-
const trimmed = value.trim();
|
|
1279
|
-
if (/^[^[{"]/.test(trimmed) && trimmed.includes(",")) {
|
|
1280
|
-
return trimmed.split(",").map((item) => item.trim()).filter(Boolean);
|
|
1281
|
-
}
|
|
1282
|
-
try {
|
|
1283
|
-
return JSON.parse(value);
|
|
1284
|
-
} catch {
|
|
1285
|
-
return value;
|
|
1286
|
-
}
|
|
1287
|
-
}, "parseValue");
|
|
1288
|
-
var given = /* @__PURE__ */ __name((value) => {
|
|
1289
|
-
const trimmed = value?.trim();
|
|
1290
|
-
return trimmed === void 0 || trimmed === "" ? void 0 : trimmed;
|
|
1291
|
-
}, "given");
|
|
1292
|
-
|
|
1293
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/context.js
|
|
1294
|
-
var setExitCode = /* @__PURE__ */ __name((command, code) => {
|
|
1295
|
-
const slot = environmentOf(command).exit;
|
|
1296
|
-
if (slot)
|
|
1297
|
-
slot.code = code;
|
|
1298
|
-
else
|
|
1299
|
-
process.exitCode = code;
|
|
1300
|
-
}, "setExitCode");
|
|
1301
|
-
var environments = /* @__PURE__ */ new WeakMap();
|
|
1302
|
-
var provide = /* @__PURE__ */ __name((program, environment) => {
|
|
1303
|
-
environments.set(program, environment);
|
|
1304
|
-
}, "provide");
|
|
1305
|
-
var environmentOf = /* @__PURE__ */ __name((command) => environments.get(rootOf(command)) ?? {}, "environmentOf");
|
|
1306
|
-
var secretInputOf = /* @__PURE__ */ __name((command) => {
|
|
1307
|
-
const { stdin, stderr } = environmentOf(command);
|
|
1308
|
-
return { ...stdin ? { input: stdin } : {}, ...stderr ? { output: stderr } : {} };
|
|
1309
|
-
}, "secretInputOf");
|
|
1310
|
-
var outputFor = /* @__PURE__ */ __name((command) => {
|
|
1311
|
-
const { streams, tty, env, agent } = environmentOf(command);
|
|
1312
|
-
return resolveOutput({
|
|
1313
|
-
...command.optsWithGlobals(),
|
|
1314
|
-
...agent ? { capture: agent.result } : {},
|
|
1315
|
-
...streams ? { streams } : {},
|
|
1316
|
-
...env ? { env } : {},
|
|
1317
|
-
...tty === void 0 ? {} : { tty }
|
|
1318
|
-
});
|
|
1319
|
-
}, "outputFor");
|
|
1320
|
-
var detailOf = /* @__PURE__ */ __name(({ brief, full }) => {
|
|
1321
|
-
if (brief && full)
|
|
1322
|
-
throw new CliError("validation_error", "--brief and --full ask for opposite things \u2014 pick one");
|
|
1323
|
-
return brief ? { hitDetail: "brief" } : full ? { hitDetail: "full" } : {};
|
|
1324
|
-
}, "detailOf");
|
|
1325
|
-
var baseContext = /* @__PURE__ */ __name((command, resolveSettings) => {
|
|
1326
|
-
const environment = environmentOf(command);
|
|
1327
|
-
const env = environment.env ?? process.env;
|
|
1328
|
-
const flags = command.optsWithGlobals();
|
|
1329
|
-
const overrides = environment.agent?.overrides ?? [];
|
|
1330
|
-
const settings = resolveSettings(overrides.length > 0 ? { ...flags, permission: [...overrides, ...flags.permission ?? []] } : flags, { env });
|
|
1331
|
-
const { renderer, format, color, streams } = resolveOutput({
|
|
1332
|
-
...settings,
|
|
1333
|
-
env,
|
|
1334
|
-
...detailOf(command.optsWithGlobals()),
|
|
1335
|
-
...command.optsWithGlobals().fields ? { fields: command.optsWithGlobals().fields } : {},
|
|
1336
|
-
...environment.agent ? { capture: environment.agent.result } : {},
|
|
1337
|
-
...environment.streams ? { streams: environment.streams } : {},
|
|
1338
|
-
...environment.tty === void 0 ? {} : { tty: environment.tty }
|
|
1339
|
-
});
|
|
1340
|
-
const closeables = [];
|
|
1341
|
-
const ranFor = namedProfile(settings);
|
|
1342
|
-
return {
|
|
1343
|
-
settings,
|
|
1344
|
-
renderer,
|
|
1345
|
-
format,
|
|
1346
|
-
color,
|
|
1347
|
-
streams,
|
|
1348
|
-
env,
|
|
1349
|
-
...environment.keyring ? { keyring: environment.keyring } : {},
|
|
1350
|
-
// The deadline inside the record, so a timeout finishes the run as failed rather than leaving it running.
|
|
1351
|
-
run: /* @__PURE__ */ __name((body, { unbounded = false, name } = {}) => {
|
|
1352
|
-
if (!environment.app)
|
|
1353
|
-
return withAbort(environment.commandSignal, () => withDeadline(unbounded ? void 0 : settings.commandTimeoutMs, closeables, () => body(() => {
|
|
1354
|
-
})));
|
|
1355
|
-
const runName = name ?? `${environment.agent ? "mcp " : ""}${commandPath(command)}`;
|
|
1356
|
-
return recorded({
|
|
1357
|
-
app: environment.app,
|
|
1358
|
-
command: runName,
|
|
1359
|
-
context: runContextOf({
|
|
1360
|
-
bin: environment.app.command,
|
|
1361
|
-
command: runName,
|
|
1362
|
-
program: rootOf(command),
|
|
1363
|
-
...environment.argv ? { argv: environment.argv } : {},
|
|
1364
|
-
env,
|
|
1365
|
-
recordInput: settings.recordInput ?? true,
|
|
1366
|
-
caller: environment.agent?.caller ?? currentCaller()
|
|
1367
|
-
}),
|
|
1368
|
-
...ranFor === void 0 ? {} : { profile: ranFor },
|
|
1369
|
-
record: keepsSuccess({
|
|
1370
|
-
record: settings.record,
|
|
1371
|
-
fromFlag: settings.sources?.record === "flag",
|
|
1372
|
-
env,
|
|
1373
|
-
caller: environment.agent?.caller ?? currentCaller(),
|
|
1374
|
-
persistent: metaOf(command).lifetime === "persistent"
|
|
1375
|
-
}),
|
|
1376
|
-
keepFailed: settings.keepFailedRuns,
|
|
1377
|
-
trace: settings.trace,
|
|
1378
|
-
keepDays: settings.keepRunsForDays,
|
|
1379
|
-
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
1380
|
-
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
1381
|
-
processRun: !environment.agent,
|
|
1382
|
-
format,
|
|
1383
|
-
streams,
|
|
1384
|
-
env
|
|
1385
|
-
}, (events) => withAbort(environment.commandSignal, () => withDeadline(unbounded ? void 0 : settings.commandTimeoutMs, closeables, () => body(events))));
|
|
1386
|
-
}, "run"),
|
|
1387
|
-
track: /* @__PURE__ */ __name((closeable) => {
|
|
1388
|
-
closeables.push(closeable);
|
|
1389
|
-
environment.trackCloseable?.(closeable);
|
|
1390
|
-
}, "track")
|
|
1391
|
-
};
|
|
1392
|
-
}, "baseContext");
|
|
1393
|
-
var commandPath = /* @__PURE__ */ __name((command) => {
|
|
1394
|
-
const words = [];
|
|
1395
|
-
for (let current = command; current?.parent; current = current.parent)
|
|
1396
|
-
words.unshift(current.name());
|
|
1397
|
-
return words.join(" ");
|
|
1398
|
-
}, "commandPath");
|
|
1399
|
-
|
|
1400
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/effects.js
|
|
1401
|
-
var REMOTE_READ = { remote: "read", local: "read" };
|
|
1402
|
-
var FETCH = { remote: "read", local: "write" };
|
|
1403
|
-
var REMOTE_WRITE = { remote: "write", local: "write" };
|
|
1404
|
-
var LOCAL_READ = { remote: "none", local: "read" };
|
|
1405
|
-
var LOCAL_WRITE = { remote: "none", local: "write" };
|
|
1406
|
-
var NO_EFFECTS = { remote: "none", local: "none" };
|
|
1407
|
-
var AUTHORITY = /* @__PURE__ */ new WeakMap();
|
|
1408
|
-
var grantsAuthority = /* @__PURE__ */ __name((command, { unless } = {}) => {
|
|
1409
|
-
AUTHORITY.set(command, unless);
|
|
1410
|
-
return command;
|
|
1411
|
-
}, "grantsAuthority");
|
|
1412
|
-
var changesAuthority = /* @__PURE__ */ __name((command) => AUTHORITY.has(command), "changesAuthority");
|
|
1413
|
-
var changesAuthorityAt = /* @__PURE__ */ __name((root) => (path) => {
|
|
1414
|
-
let at = root;
|
|
1415
|
-
for (const word of path)
|
|
1416
|
-
at = at?.commands.find((one) => one.name() === word);
|
|
1417
|
-
return at !== void 0 && changesAuthority(at);
|
|
1418
|
-
}, "changesAuthorityAt");
|
|
1419
|
-
var KEPT_UNDER_LOCK = /* @__PURE__ */ new WeakSet();
|
|
1420
|
-
var destroysNothing = /* @__PURE__ */ __name((command) => {
|
|
1421
|
-
KEPT_UNDER_LOCK.add(command);
|
|
1422
|
-
return command;
|
|
1423
|
-
}, "destroysNothing");
|
|
1424
|
-
var STORE_WRITES = /* @__PURE__ */ new WeakSet();
|
|
1425
|
-
var changesStore = /* @__PURE__ */ __name((command) => {
|
|
1426
|
-
STORE_WRITES.add(command);
|
|
1427
|
-
return command;
|
|
1428
|
-
}, "changesStore");
|
|
1429
|
-
var savesFiles = /* @__PURE__ */ __name((command) => command.name() === "download" || [...command.options.map((option) => option.attributeName()), ...command.registeredArguments.map((one) => one.name())].map((name) => name.toLowerCase()).some((name) => name === "dir" || name.endsWith("dir") || name === "output"), "savesFiles");
|
|
1430
|
-
var fetchesOnly = /* @__PURE__ */ __name((command) => {
|
|
1431
|
-
const effects = metaOf(command).effects;
|
|
1432
|
-
return effects?.remote === "read" && effects.local === "write" && !STORE_WRITES.has(command) && !changesAuthority(command) && !OTHER_SERVICE.has(command) && !savesFiles(command);
|
|
1433
|
-
}, "fetchesOnly");
|
|
1434
|
-
var fetchesOnlyAt = /* @__PURE__ */ __name((root) => (path) => {
|
|
1435
|
-
let at = root;
|
|
1436
|
-
for (const word of path)
|
|
1437
|
-
at = at?.commands.find((one) => one.name() === word);
|
|
1438
|
-
return at !== void 0 && fetchesOnly(at);
|
|
1439
|
-
}, "fetchesOnlyAt");
|
|
1440
|
-
var STORE_CHANGE_REFUSAL = "change the message store";
|
|
1441
|
-
var previewFlag = /* @__PURE__ */ __name((program) => program.options.some((option) => option.long === "--dry-run") ? " --dry-run" : "", "previewFlag");
|
|
1442
|
-
var storeChangeRefusal = /* @__PURE__ */ __name((app) => app.messenger === false ? "change the local store" : STORE_CHANGE_REFUSAL, "storeChangeRefusal");
|
|
1443
|
-
var refuseStoreChange = /* @__PURE__ */ __name((app, env) => {
|
|
1444
|
-
const lock = readOnlyLockOf(app, env);
|
|
1445
|
-
if (lock)
|
|
1446
|
-
throw readOnlyRefusal(lock, storeChangeRefusal(app));
|
|
1447
|
-
}, "refuseStoreChange");
|
|
1448
|
-
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
1449
|
-
const words = [];
|
|
1450
|
-
for (let at = command; at.parent; at = at.parent)
|
|
1451
|
-
words.unshift(at.name());
|
|
1452
|
-
return words;
|
|
1453
|
-
}, "pathOf");
|
|
1454
|
-
var changesMessenger = /* @__PURE__ */ __name((command) => {
|
|
1455
|
-
const { path, effects, lifetime, reaches } = "path" in command ? command : { path: pathOf(command), ...metaOf(command) };
|
|
1456
|
-
return effects?.remote === "write" && lifetime !== "persistent" && reaches !== "other_service" && Boolean(keyForCommand(path));
|
|
1457
|
-
}, "changesMessenger");
|
|
1458
|
-
var OTHER_SERVICE = /* @__PURE__ */ new WeakSet();
|
|
1459
|
-
var reachesOtherService = /* @__PURE__ */ __name((command) => {
|
|
1460
|
-
OTHER_SERVICE.add(command);
|
|
1461
|
-
return annotate(command, { reaches: "other_service" });
|
|
1462
|
-
}, "reachesOtherService");
|
|
1463
|
-
var ownerOnlyOption = /* @__PURE__ */ __name((flags, description) => annotateOption(new Option(flags, description), { mcp: false }), "ownerOnlyOption");
|
|
1464
|
-
var judgedEffects = /* @__PURE__ */ __name((effects) => effects && { remote: effects.remote, local: "none" }, "judgedEffects");
|
|
1465
|
-
var judgedStepEffects = /* @__PURE__ */ __name((effects) => effects?.remote === "none" ? effects : judgedEffects(effects), "judgedStepEffects");
|
|
1466
|
-
var judgedTargets = /* @__PURE__ */ __name((root) => {
|
|
1467
|
-
const targets = stepTargets(root);
|
|
1468
|
-
return (command) => {
|
|
1469
|
-
const target = targets(command);
|
|
1470
|
-
if (!target)
|
|
1471
|
-
return void 0;
|
|
1472
|
-
const effects = judgedStepEffects(target.effects);
|
|
1473
|
-
return { names: target.names, ...effects ? { effects } : {} };
|
|
1474
|
-
};
|
|
1475
|
-
}, "judgedTargets");
|
|
1476
|
-
var refuseUnderReadOnly = /* @__PURE__ */ __name((command, what) => {
|
|
1477
|
-
const { app, env } = environmentOf(command);
|
|
1478
|
-
if (!app)
|
|
1479
|
-
throw new Error("refuseUnderReadOnly runs inside run(), which says whose lock to read");
|
|
1480
|
-
const lock = readOnlyLockOf(app, env ?? process.env);
|
|
1481
|
-
if (lock)
|
|
1482
|
-
throw readOnlyRefusal(lock, what);
|
|
1483
|
-
}, "refuseUnderReadOnly");
|
|
1484
|
-
|
|
1485
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/steps.js
|
|
1486
|
-
var STEPS2 = defineSteps([
|
|
1487
|
-
...STEPS,
|
|
1488
|
-
{
|
|
1489
|
-
id: "messages.sync",
|
|
1490
|
-
command: "messages sync",
|
|
1491
|
-
args: [
|
|
1492
|
-
{ name: "chat", required: false },
|
|
1493
|
-
{ name: "all", required: false },
|
|
1494
|
-
{ name: "since_time", required: false },
|
|
1495
|
-
{ name: "background", required: false }
|
|
1496
|
-
],
|
|
1497
|
-
why: "the local copy is missing messages; syncing brings them in"
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
id: "messages.transcribe",
|
|
1501
|
-
command: "messages transcribe",
|
|
1502
|
-
args: [
|
|
1503
|
-
{ name: "chat", required: true },
|
|
1504
|
-
{ name: "message", required: true }
|
|
1505
|
-
],
|
|
1506
|
-
why: "a voice message is not heard yet; this hears it"
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
id: "messages.scheduled",
|
|
1510
|
-
command: "messages scheduled",
|
|
1511
|
-
args: [{ name: "chat", required: true }],
|
|
1512
|
-
why: "it is waiting to be sent and gets a new id then; this lists what is still waiting"
|
|
1513
|
-
},
|
|
1514
|
-
{
|
|
1515
|
-
id: "messages.download",
|
|
1516
|
-
command: "messages download",
|
|
1517
|
-
args: [
|
|
1518
|
-
{ name: "chat", required: true },
|
|
1519
|
-
{ name: "all", required: false },
|
|
1520
|
-
{ name: "output_dir", required: false }
|
|
1521
|
-
],
|
|
1522
|
-
why: "it stopped before the whole chat; running it again goes on where it stopped"
|
|
1523
|
-
},
|
|
1524
|
-
{
|
|
1525
|
-
id: "messages.list",
|
|
1526
|
-
command: "messages list",
|
|
1527
|
-
args: [{ name: "chat", required: true }],
|
|
1528
|
-
why: "only the newest were read here; this reads the chat itself"
|
|
1529
|
-
},
|
|
1530
|
-
{
|
|
1531
|
-
id: "inbox.all",
|
|
1532
|
-
command: "inbox",
|
|
1533
|
-
args: [{ name: "all", required: true }],
|
|
1534
|
-
why: "muted and archived chats were left out; --all reads them too"
|
|
1535
|
-
},
|
|
1536
|
-
{
|
|
1537
|
-
id: "review.all",
|
|
1538
|
-
command: "review",
|
|
1539
|
-
args: [{ name: "all", required: true }],
|
|
1540
|
-
why: "muted and archived chats were left out; --all reads them too"
|
|
1541
|
-
},
|
|
1542
|
-
{
|
|
1543
|
-
id: "review.next",
|
|
1544
|
-
command: "review",
|
|
1545
|
-
args: [{ name: "query", required: true }],
|
|
1546
|
-
why: "the next review starts where this one ended"
|
|
1547
|
-
},
|
|
1548
|
-
{
|
|
1549
|
-
id: "chats.members",
|
|
1550
|
-
command: "chats members list",
|
|
1551
|
-
args: [{ name: "chat", required: true }],
|
|
1552
|
-
why: "the chat's member list has everyone it lets you see"
|
|
1553
|
-
},
|
|
1554
|
-
{
|
|
1555
|
-
id: "chats.members-fetch",
|
|
1556
|
-
command: "chats members fetch",
|
|
1557
|
-
args: [
|
|
1558
|
-
{ name: "chat", required: true },
|
|
1559
|
-
{ name: "track", required: false }
|
|
1560
|
-
],
|
|
1561
|
-
why: "nothing is recorded yet; a fetch records the members, and --track keeps doing it daily"
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
id: "models.download",
|
|
1565
|
-
command: "models download",
|
|
1566
|
-
args: [{ name: "model", required: true }],
|
|
1567
|
-
why: "{model} is not downloaded, so nothing is searched by meaning"
|
|
1568
|
-
},
|
|
1569
|
-
{
|
|
1570
|
-
id: "models.download-image",
|
|
1571
|
-
command: "images models download",
|
|
1572
|
-
args: [{ name: "model", required: true }],
|
|
1573
|
-
why: "{model} is not downloaded, so pictures are not searched by what they show"
|
|
1574
|
-
},
|
|
1575
|
-
{
|
|
1576
|
-
id: "store.migrate",
|
|
1577
|
-
command: "store migrate",
|
|
1578
|
-
args: [],
|
|
1579
|
-
why: "a search index is still being built; this finishes it"
|
|
1580
|
-
},
|
|
1581
|
-
{
|
|
1582
|
-
id: "attachments.extract",
|
|
1583
|
-
command: "attachments extract",
|
|
1584
|
-
args: [
|
|
1585
|
-
{ name: "cursor", required: true },
|
|
1586
|
-
{ name: "chat", required: false }
|
|
1587
|
-
],
|
|
1588
|
-
why: "it stopped before every file was read; this goes on where it stopped"
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
id: "store.job",
|
|
1592
|
-
command: "store jobs show",
|
|
1593
|
-
args: [{ name: "job", required: false }],
|
|
1594
|
-
why: "it runs in the background; this shows how far it got"
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
id: "store.reindex",
|
|
1598
|
-
command: "store rebuild",
|
|
1599
|
-
args: [],
|
|
1600
|
-
why: "the stems were built by another stemmer; this builds them again"
|
|
1601
|
-
},
|
|
1602
|
-
{
|
|
1603
|
-
id: "mentions.rebuild",
|
|
1604
|
-
command: "mentions rebuild",
|
|
1605
|
-
args: [{ name: "kind", required: false }],
|
|
1606
|
-
why: "phone numbers already found were read by the old phone_countries; this reads them again"
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
id: "mentions.review",
|
|
1610
|
-
command: "mentions list",
|
|
1611
|
-
args: [{ name: "new", required: true }],
|
|
1612
|
-
why: "{shown} mentions found since the last review wait to be confirmed or rejected"
|
|
1613
|
-
},
|
|
1614
|
-
{
|
|
1615
|
-
id: "conversations.build",
|
|
1616
|
-
command: "conversations links rebuild",
|
|
1617
|
-
args: [{ name: "chat", required: false }],
|
|
1618
|
-
why: "conversations are missing or older than the messages; this builds them"
|
|
1619
|
-
},
|
|
1620
|
-
{
|
|
1621
|
-
id: "conversations.embed",
|
|
1622
|
-
command: "conversations embed",
|
|
1623
|
-
args: [{ name: "chat", required: true }],
|
|
1624
|
-
why: "the chat's conversations are not searchable by meaning yet; this embeds them"
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
id: "conversations.rebuild",
|
|
1628
|
-
command: "conversations rebuild",
|
|
1629
|
-
args: [],
|
|
1630
|
-
why: "messages have no vectors yet, so discovery searched by words alone; this embeds them, a bounded batch a run"
|
|
1631
|
-
},
|
|
1632
|
-
{
|
|
1633
|
-
id: "stats.evidence",
|
|
1634
|
-
command: "*",
|
|
1635
|
-
args: [
|
|
1636
|
-
{ name: "message", required: false },
|
|
1637
|
-
{ name: "person", required: false },
|
|
1638
|
-
{ name: "selection", required: true },
|
|
1639
|
-
{ name: "component", required: true }
|
|
1640
|
-
],
|
|
1641
|
-
why: "the messages behind the top row's {component}"
|
|
1642
|
-
},
|
|
1643
|
-
{
|
|
1644
|
-
id: "messages.show",
|
|
1645
|
-
command: "messages show",
|
|
1646
|
-
args: [{ name: "chat", required: true }],
|
|
1647
|
-
why: "the message in full"
|
|
1648
|
-
},
|
|
1649
|
-
{
|
|
1650
|
-
id: "messages.context",
|
|
1651
|
-
command: "messages context",
|
|
1652
|
-
args: [{ name: "chat", required: true }],
|
|
1653
|
-
why: "the messages around it"
|
|
1654
|
-
},
|
|
1655
|
-
{
|
|
1656
|
-
id: "doctor.online",
|
|
1657
|
-
command: "doctor",
|
|
1658
|
-
args: [{ name: "online", required: true }],
|
|
1659
|
-
why: "the login was not checked; --online logs in once and sends nothing"
|
|
1660
|
-
},
|
|
1661
|
-
{
|
|
1662
|
-
id: "doctor.report-create",
|
|
1663
|
-
command: "doctor reports create",
|
|
1664
|
-
args: [{ name: "run", required: false }],
|
|
1665
|
-
why: "writes the report to a file to read and send; it holds no message text"
|
|
1666
|
-
},
|
|
1667
|
-
{
|
|
1668
|
-
id: "mcp.config",
|
|
1669
|
-
command: "mcp config",
|
|
1670
|
-
args: [{ name: "profiles", required: false }],
|
|
1671
|
-
why: "the entry names one Node version's path; after switching or upgrading Node, print it again"
|
|
1672
|
-
},
|
|
1673
|
-
{
|
|
1674
|
-
id: "bot.mcp-config",
|
|
1675
|
-
command: "bot mcp config",
|
|
1676
|
-
args: [],
|
|
1677
|
-
why: "the entry names one Node version's path; after switching or upgrading Node, print it again"
|
|
1678
|
-
},
|
|
1679
|
-
{
|
|
1680
|
-
id: "server.restart",
|
|
1681
|
-
command: "server restart",
|
|
1682
|
-
args: [],
|
|
1683
|
-
why: "serve still runs an older version; a restart runs the one installed now"
|
|
1684
|
-
},
|
|
1685
|
-
{
|
|
1686
|
-
id: "search.meetings",
|
|
1687
|
-
command: "*",
|
|
1688
|
-
args: [{ name: "max_meetings", required: true }],
|
|
1689
|
-
why: "stopped after {scanned} meetings; more may match"
|
|
1690
|
-
}
|
|
1691
|
-
]);
|
|
1692
|
-
var nextStep = /* @__PURE__ */ __name((id, input) => {
|
|
1693
|
-
const definition = STEPS2.find((step) => step.id === id);
|
|
1694
|
-
if (!definition)
|
|
1695
|
-
throw new Error(`no step "${id}"`);
|
|
1696
|
-
const args = Object.fromEntries(Object.entries(input.args ?? {}).filter(([, value]) => value !== void 0));
|
|
1697
|
-
return stepOf(definition, { ...input, args });
|
|
1698
|
-
}, "nextStep");
|
|
1699
|
-
var lineOf = /* @__PURE__ */ __name((command, words) => {
|
|
1700
|
-
const root = rootOf2(command);
|
|
1701
|
-
const profile = root.getOptionValue("profile");
|
|
1702
|
-
return typedCommand(root.name(), words, typeof profile === "string" && profile !== "" ? profile : void 0);
|
|
1703
|
-
}, "lineOf");
|
|
1704
|
-
var rootOf2 = /* @__PURE__ */ __name((command) => {
|
|
1705
|
-
let root = command;
|
|
1706
|
-
while (root.parent)
|
|
1707
|
-
root = root.parent;
|
|
1708
|
-
return root;
|
|
1709
|
-
}, "rootOf");
|
|
1710
|
-
var commandAt = /* @__PURE__ */ __name((root, path) => {
|
|
1711
|
-
let at = root;
|
|
1712
|
-
for (const word of path.split(" "))
|
|
1713
|
-
at = at?.commands.find((one) => one.name() === word || one.aliases().includes(word));
|
|
1714
|
-
return at === root ? void 0 : at;
|
|
1715
|
-
}, "commandAt");
|
|
1716
|
-
var runnable = /* @__PURE__ */ __name((root, steps) => withSafety((steps ?? []).filter((step) => step.kind === "user_action" || commandAt(root, step.command) !== void 0).slice(0, MAX_NEXT_STEPS), judgedTargets(root)), "runnable");
|
|
1717
|
-
var withSafety = /* @__PURE__ */ __name((steps, targets) => steps.map((step) => {
|
|
1718
|
-
if (step.kind === "user_action")
|
|
1719
|
-
return step;
|
|
1720
|
-
const effects = targets(step.command)?.effects;
|
|
1721
|
-
return { ...step, safe_to_auto_execute: effects !== void 0 && !writes(effects) };
|
|
1722
|
-
}), "withSafety");
|
|
1723
|
-
var withLines = /* @__PURE__ */ __name((root, steps) => steps.map((step) => step.kind === "command" ? { ...step, line: stepLine(root, step) } : step), "withLines");
|
|
1724
|
-
var kebab = /* @__PURE__ */ __name((name) => name.replaceAll("_", "-"), "kebab");
|
|
1725
|
-
var quoted = /* @__PURE__ */ __name((value) => {
|
|
1726
|
-
const text2 = String(value);
|
|
1727
|
-
return /^[\w@:./+-]+$/.test(text2) ? text2 : JSON.stringify(text2);
|
|
1728
|
-
}, "quoted");
|
|
1729
|
-
var stepLine = /* @__PURE__ */ __name((root, step) => {
|
|
1730
|
-
const command = commandAt(root, step.command);
|
|
1731
|
-
const positional = new Set(command?.registeredArguments.map((argument) => argument.name()) ?? []);
|
|
1732
|
-
const args = Object.entries(step.args).filter(([, value]) => value !== void 0 && value !== false);
|
|
1733
|
-
const profile = root.getOptionValue("profile");
|
|
1734
|
-
return [
|
|
1735
|
-
root.name(),
|
|
1736
|
-
...typeof profile === "string" && profile !== "" ? [quoted(profile)] : [],
|
|
1737
|
-
step.command,
|
|
1738
|
-
...(command?.registeredArguments ?? []).flatMap((argument) => step.args[argument.name()] === void 0 ? [] : [quoted(step.args[argument.name()])]),
|
|
1739
|
-
...args.filter(([name]) => !positional.has(name)).map(([name, value]) => value === true ? `--${kebab(name)}` : `--${kebab(name)} ${quoted(value)}`)
|
|
1740
|
-
].join(" ");
|
|
1741
|
-
}, "stepLine");
|
|
1742
|
-
|
|
1743
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/provider-refs.js
|
|
1744
|
-
var HIDDEN = /* @__PURE__ */ new Set(["providerRef", "provider_ref"]);
|
|
1745
|
-
var withoutProviderRefs = /* @__PURE__ */ __name((value) => strip(value), "withoutProviderRefs");
|
|
1746
|
-
var strip = /* @__PURE__ */ __name((value) => {
|
|
1747
|
-
if (Array.isArray(value))
|
|
1748
|
-
return value.map(strip);
|
|
1749
|
-
if (value === null || typeof value !== "object")
|
|
1750
|
-
return value;
|
|
1751
|
-
const prototype = Object.getPrototypeOf(value);
|
|
1752
|
-
if (prototype !== Object.prototype && prototype !== null)
|
|
1753
|
-
return value;
|
|
1754
|
-
return Object.fromEntries(Object.entries(value).flatMap(([key, inner]) => HIDDEN.has(key) ? [] : [[key, strip(inner)]]));
|
|
1755
|
-
}, "strip");
|
|
1756
|
-
|
|
1757
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/envelope.js
|
|
1758
|
-
var answerSchema = /* @__PURE__ */ __name((item = unknown()) => union([listEnvelopeSchema(item), itemEnvelopeSchema(item)]), "answerSchema");
|
|
1759
|
-
var capped2 = /* @__PURE__ */ __name((steps) => steps.length > 0 ? { next: steps.slice(0, MAX_NEXT_STEPS) } : {}, "capped");
|
|
1760
|
-
var listOf = /* @__PURE__ */ __name((command, input) => {
|
|
1761
|
-
const { items, limit, has_more, cursor, paging, page, total, args = {}, next = [], missing, meta } = input;
|
|
1762
|
-
const byCursor = paging === "cursor" || cursor !== void 0;
|
|
1763
|
-
const more = has_more ? [
|
|
1764
|
-
nextStep("page.next", {
|
|
1765
|
-
command,
|
|
1766
|
-
args: { ...args, ...cursor === void 0 ? { page: (page ?? 1) + 1, limit } : { cursor, limit } },
|
|
1767
|
-
values: { shown: items.length }
|
|
1768
|
-
})
|
|
1769
|
-
] : [];
|
|
1770
|
-
const body = {
|
|
1771
|
-
items,
|
|
1772
|
-
page: byCursor ? {
|
|
1773
|
-
mode: "cursor",
|
|
1774
|
-
limit,
|
|
1775
|
-
has_more,
|
|
1776
|
-
...has_more && cursor !== void 0 ? { next_cursor: cursor } : {},
|
|
1777
|
-
...total ? { total } : {}
|
|
1778
|
-
} : {
|
|
1779
|
-
mode: "page",
|
|
1780
|
-
limit,
|
|
1781
|
-
has_more,
|
|
1782
|
-
...has_more ? { next_page: (page ?? 1) + 1 } : {},
|
|
1783
|
-
...total ? { total } : {}
|
|
1784
|
-
},
|
|
1785
|
-
...capped2([...more, ...next]),
|
|
1786
|
-
...missing && missing.length > 0 ? { missing } : {},
|
|
1787
|
-
...meta ? { meta } : {}
|
|
1788
|
-
};
|
|
1789
|
-
return body;
|
|
1790
|
-
}, "listOf");
|
|
1791
|
-
var itemOf = /* @__PURE__ */ __name((item, { next = [], missing, meta } = {}) => {
|
|
1792
|
-
const body = {
|
|
1793
|
-
item,
|
|
1794
|
-
...capped2(next),
|
|
1795
|
-
...missing && missing.length > 0 ? { missing } : {},
|
|
1796
|
-
...meta ? { meta } : {}
|
|
1797
|
-
};
|
|
1798
|
-
return body;
|
|
1799
|
-
}, "itemOf");
|
|
1800
|
-
var snake = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
|
|
1801
|
-
var snakeKeysKeeping = /* @__PURE__ */ __name((verbatim) => {
|
|
1802
|
-
const kept = new Set(verbatim);
|
|
1803
|
-
const convert = /* @__PURE__ */ __name((value) => {
|
|
1804
|
-
if (Array.isArray(value))
|
|
1805
|
-
return value.map(convert);
|
|
1806
|
-
if (value === null || typeof value !== "object" || value.constructor !== Object)
|
|
1807
|
-
return value;
|
|
1808
|
-
return Object.fromEntries(Object.entries(value).flatMap(([key, inner]) => {
|
|
1809
|
-
if (inner === void 0)
|
|
1810
|
-
return [];
|
|
1811
|
-
const name = snake(key);
|
|
1812
|
-
return [[name, kept.has(key) || kept.has(name) ? inner : convert(inner)]];
|
|
1813
|
-
}));
|
|
1814
|
-
}, "convert");
|
|
1815
|
-
return convert;
|
|
1816
|
-
}, "snakeKeysKeeping");
|
|
1817
|
-
var snakeKeys = snakeKeysKeeping([]);
|
|
1818
|
-
var isBody = /* @__PURE__ */ __name((value) => {
|
|
1819
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
1820
|
-
return false;
|
|
1821
|
-
if ("item" in value)
|
|
1822
|
-
return true;
|
|
1823
|
-
return "items" in value && Array.isArray(value.items) && "page" in value && typeof value.page === "object" && value.page !== null;
|
|
1824
|
-
}, "isBody");
|
|
1825
|
-
var refuse = /* @__PURE__ */ __name((value) => {
|
|
1826
|
-
const keys = typeof value === "object" && value !== null ? Object.keys(value).join(", ") : typeof value;
|
|
1827
|
-
throw new Error(`not an answer envelope (keys: ${keys}) \u2014 build it with itemOf or listOf`);
|
|
1828
|
-
}, "refuse");
|
|
1829
|
-
var judgedAnswer = /* @__PURE__ */ __name((value, targets) => {
|
|
1830
|
-
if (!isBody(value))
|
|
1831
|
-
return refuse(value);
|
|
1832
|
-
if (!value.next)
|
|
1833
|
-
return value;
|
|
1834
|
-
return { ...value, next: withSafety(value.next, targets) };
|
|
1835
|
-
}, "judgedAnswer");
|
|
1836
|
-
var metaNow = /* @__PURE__ */ __name((extra = {}) => {
|
|
1837
|
-
const run = currentRun();
|
|
1838
|
-
return {
|
|
1839
|
-
run_id: run.runId,
|
|
1840
|
-
duration_ms: Math.max(0, Math.round(Date.now() - (run.startedAt ?? Date.now()))),
|
|
1841
|
-
...extra,
|
|
1842
|
-
complete: extra.complete ?? !extra.issues?.length
|
|
1843
|
-
};
|
|
1844
|
-
}, "metaNow");
|
|
1845
|
-
var sealed = /* @__PURE__ */ __name((value) => {
|
|
1846
|
-
if (!isBody(value))
|
|
1847
|
-
return refuse(value);
|
|
1848
|
-
const { meta, ...rest } = withoutProviderRefs(value);
|
|
1849
|
-
return { ...rest, meta: metaNow(meta) };
|
|
1850
|
-
}, "sealed");
|
|
1851
|
-
var linesOf = /* @__PURE__ */ __name((body) => jsonlOf("items" in body ? body : { items: [body.item], page: { mode: "page", limit: 1, has_more: false }, meta: body.meta }), "linesOf");
|
|
1852
|
-
var jsonlRecords = /* @__PURE__ */ __name((body) => linesOf(sealed(body)).split("\n").map((line) => JSON.parse(line)), "jsonlRecords");
|
|
1853
|
-
var renderAnswer = /* @__PURE__ */ __name((command, { renderer, format, streams }, body, view) => {
|
|
1854
|
-
if (!isBody(body))
|
|
1855
|
-
refuse(body);
|
|
1856
|
-
const root = rootOf2(command);
|
|
1857
|
-
const runnableSteps = runnable(root, body.next);
|
|
1858
|
-
const next = environmentOf(command).agent ? runnableSteps : withLines(root, runnableSteps);
|
|
1859
|
-
const kept = withoutProviderRefs({ ...body, ...next.length > 0 ? { next } : {} });
|
|
1860
|
-
if (next.length === 0)
|
|
1861
|
-
delete kept.next;
|
|
1862
|
-
const whole = sealed(kept);
|
|
1863
|
-
if (format === "json")
|
|
1864
|
-
renderer.result(whole);
|
|
1865
|
-
else if (format === "jsonl")
|
|
1866
|
-
for (const line of linesOf(whole).split("\n"))
|
|
1867
|
-
streams.data(line);
|
|
1868
|
-
else if (view)
|
|
1869
|
-
streams.data(view(kept));
|
|
1870
|
-
else
|
|
1871
|
-
renderer.result("items" in kept ? kept.items : kept.item);
|
|
1872
|
-
const code = exitCodeOfAnswer(whole.meta, metaOf(command).partial === true);
|
|
1873
|
-
if (code !== 0)
|
|
1874
|
-
setExitCode(command, code);
|
|
1875
|
-
if (format === "json")
|
|
1876
|
-
return;
|
|
1877
|
-
for (const step of next)
|
|
1878
|
-
renderer.note(step.kind === "command" ? `\u2192 ${step.why}: ${stepLine(root, step)}` : `\u2192 ${step.why}`);
|
|
1879
|
-
}, "renderAnswer");
|
|
1880
|
-
var renderDocument = /* @__PURE__ */ __name(({ renderer }, document) => renderer.result(document), "renderDocument");
|
|
1881
|
-
var itemAnswer = /* @__PURE__ */ __name((item) => sealed(itemOf(item)), "itemAnswer");
|
|
1882
|
-
var printItem = /* @__PURE__ */ __name(({ renderer, format }, item) => {
|
|
1883
|
-
if (format === "json")
|
|
1884
|
-
renderer.result(itemAnswer(item));
|
|
1885
|
-
else if (format === "jsonl")
|
|
1886
|
-
renderer.stream(jsonlRecords(itemOf(item)));
|
|
1887
|
-
else
|
|
1888
|
-
renderer.result(item);
|
|
1889
|
-
}, "printItem");
|
|
1890
|
-
|
|
1891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/entities/store-table.js
|
|
1892
|
-
var TABLE_KINDS = ["data", "search_index", "search_index_part", "internal"];
|
|
1893
|
-
var storeTable = strictObject({
|
|
1894
|
-
name: text,
|
|
1895
|
-
kind: picklist(TABLE_KINDS),
|
|
1896
|
-
rows: nullable(count),
|
|
1897
|
-
bytes: optional(nullable(count))
|
|
1898
|
-
});
|
|
1899
|
-
|
|
1900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/runs/record-log.js
|
|
1901
|
-
var recordLogFor = /* @__PURE__ */ __name((to, app, { traceId, command } = {}) => {
|
|
1902
|
-
const run = currentRun();
|
|
1903
|
-
const trace = traceId ?? run.traceId;
|
|
1904
|
-
return snakeLogger(createRecordLog({
|
|
1905
|
-
to,
|
|
1906
|
-
runId: run.runId,
|
|
1907
|
-
command: command ?? run.command,
|
|
1908
|
-
...trace === void 0 ? {} : { traceId: trace },
|
|
1909
|
-
resource: { service: app.command, version: app.version },
|
|
1910
|
-
allow: LOG_ATTRIBUTES
|
|
1911
|
-
}));
|
|
1912
|
-
}, "recordLogFor");
|
|
1913
|
-
|
|
1914
|
-
export {
|
|
1915
|
-
startRecording,
|
|
1916
|
-
wasSettled,
|
|
1917
|
-
DEFAULT_OUTPUT_BYTES,
|
|
1918
|
-
asFirstWord,
|
|
1919
|
-
usableProfileName,
|
|
1920
|
-
PROFILE_FREE,
|
|
1921
|
-
profileFree,
|
|
1922
|
-
takesProfile,
|
|
1923
|
-
commandWords,
|
|
1924
|
-
liftProfile,
|
|
1925
|
-
refuseCommandName,
|
|
1926
|
-
rootOf,
|
|
1927
|
-
endpoint,
|
|
1928
|
-
modelTarget,
|
|
1929
|
-
AI_ENTRIES,
|
|
1930
|
-
resolveAISettings,
|
|
1931
|
-
permissionIssues,
|
|
1932
|
-
publicIssue,
|
|
1933
|
-
issueMessage,
|
|
1934
|
-
checkConfigText,
|
|
1935
|
-
rememberAccount,
|
|
1936
|
-
recalledAccount,
|
|
1937
|
-
NONE_NAMED,
|
|
1938
|
-
namedProfile,
|
|
1939
|
-
NoProfileHere,
|
|
1940
|
-
fromFile,
|
|
1941
|
-
settingsFor,
|
|
1942
|
-
setExitCode,
|
|
1943
|
-
provide,
|
|
1944
|
-
environmentOf,
|
|
1945
|
-
secretInputOf,
|
|
1946
|
-
outputFor,
|
|
1947
|
-
baseContext,
|
|
1948
|
-
REMOTE_READ,
|
|
1949
|
-
FETCH,
|
|
1950
|
-
REMOTE_WRITE,
|
|
1951
|
-
LOCAL_READ,
|
|
1952
|
-
LOCAL_WRITE,
|
|
1953
|
-
NO_EFFECTS,
|
|
1954
|
-
grantsAuthority,
|
|
1955
|
-
changesAuthority,
|
|
1956
|
-
changesAuthorityAt,
|
|
1957
|
-
destroysNothing,
|
|
1958
|
-
changesStore,
|
|
1959
|
-
fetchesOnlyAt,
|
|
1960
|
-
previewFlag,
|
|
1961
|
-
refuseStoreChange,
|
|
1962
|
-
changesMessenger,
|
|
1963
|
-
reachesOtherService,
|
|
1964
|
-
ownerOnlyOption,
|
|
1965
|
-
judgedEffects,
|
|
1966
|
-
judgedTargets,
|
|
1967
|
-
refuseUnderReadOnly,
|
|
1968
|
-
withoutProviderRefs,
|
|
1969
|
-
nextStep,
|
|
1970
|
-
lineOf,
|
|
1971
|
-
rootOf2,
|
|
1972
|
-
commandAt,
|
|
1973
|
-
runnable,
|
|
1974
|
-
stepLine,
|
|
1975
|
-
answerSchema,
|
|
1976
|
-
listOf,
|
|
1977
|
-
itemOf,
|
|
1978
|
-
snakeKeys,
|
|
1979
|
-
judgedAnswer,
|
|
1980
|
-
metaNow,
|
|
1981
|
-
sealed,
|
|
1982
|
-
jsonlRecords,
|
|
1983
|
-
renderAnswer,
|
|
1984
|
-
renderDocument,
|
|
1985
|
-
printItem,
|
|
1986
|
-
recordLogFor,
|
|
1987
|
-
storeTable
|
|
1988
|
-
};
|