@wirecat/hubspot-cli 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +2 -2
- package/contracts/wirecat.json +40 -2
- package/dist/bin/hubspot.js +2 -2
- package/dist/bundle/agent-A7ARC3QB.js +40 -0
- package/dist/bundle/{all-profiles-64JAUYW4.js → all-profiles-6452VSJB.js} +64 -22
- package/dist/bundle/{anthropic-VJOS4OUM.js → anthropic-VQUOVYOW.js} +6 -6
- package/dist/bundle/{app-server-GXV2OFML.js → app-server-EQZUP4H4.js} +79 -68
- package/dist/bundle/{bun-M3J2QTR3.js → bun-AJPJ4ZUN.js} +2 -2
- package/dist/bundle/{bun-sqlite-IX3XYA5F.js → bun-sqlite-AGXGSF6D.js} +7 -7
- package/dist/bundle/{chunk-N2XADGL4.js → chunk-2A64XS22.js} +4 -4
- package/dist/bundle/{chunk-Q2OLOMHL.js → chunk-2HYGCLKN.js} +93 -565
- package/dist/bundle/{chunk-FOZYMDRL.js → chunk-2NCO4E4T.js} +6 -6
- package/dist/bundle/{chunk-FBCCBCFH.js → chunk-2PRVWEJC.js} +3 -3
- package/dist/bundle/{chunk-LOBVOGOE.js → chunk-3DIXAEGH.js} +4 -4
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3I2FGNWO.js} +1 -1
- package/dist/bundle/{chunk-65TWQ7BV.js → chunk-3PEKYGZ3.js} +2 -2
- package/dist/bundle/{chunk-DRWWJLI6.js → chunk-3R4KRNUZ.js} +8 -8
- package/dist/bundle/{chunk-2VGD63G6.js → chunk-3TEFE6YU.js} +7 -7
- package/dist/bundle/{chunk-TI46WQXQ.js → chunk-4DNHXRCJ.js} +7 -7
- package/dist/bundle/{chunk-QU25DA5N.js → chunk-5AYKCKSE.js} +11 -11
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-5K3FGXZH.js} +1 -1
- package/dist/bundle/{chunk-24ERVFJP.js → chunk-5YNAVVCW.js} +3 -3
- package/dist/bundle/{chunk-URX6YDUL.js → chunk-5ZV7REBE.js} +75 -66
- package/dist/bundle/{chunk-TLKEPUAV.js → chunk-6MFP47XC.js} +60 -50
- package/dist/bundle/{chunk-36ITRDYY.js → chunk-7LQRXVQ3.js} +783 -482
- package/dist/bundle/{chunk-E5WLE7BM.js → chunk-7NZT7Y55.js} +1 -1
- package/dist/bundle/{chunk-C32AKHTY.js → chunk-7UEL65GQ.js} +35 -12
- package/dist/bundle/chunk-7VHBS5BJ.js +108 -0
- package/dist/bundle/{chunk-O55RWNSH.js → chunk-A6UFH3QU.js} +4 -4
- package/dist/bundle/{chunk-WE4UFASG.js → chunk-ABXVU5O4.js} +8 -1
- package/dist/bundle/{chunk-4W6BMH45.js → chunk-AF7DANIR.js} +2 -100
- package/dist/bundle/{chunk-2VGZRYEH.js → chunk-ARTJLL7W.js} +6 -6
- package/dist/bundle/chunk-AVUMH42T.js +194 -0
- package/dist/bundle/{chunk-MFNMKHML.js → chunk-AWOJYRQW.js} +1024 -1639
- package/dist/bundle/chunk-B2W3C4N6.js +338 -0
- package/dist/bundle/{chunk-FKA7DOCK.js → chunk-B3EH22CO.js} +1 -1
- package/dist/bundle/{chunk-E52JAS35.js → chunk-BAUK2MD5.js} +6 -6
- package/dist/bundle/{chunk-LXZ66MCH.js → chunk-BHZUPOQY.js} +35 -29
- package/dist/bundle/{chunk-JLDBMEKZ.js → chunk-BN22EKQQ.js} +2 -2
- package/dist/bundle/{chunk-DB2XKHI4.js → chunk-BUGROVF3.js} +2 -2
- package/dist/bundle/{chunk-DSP36YHQ.js → chunk-CBCEMFCF.js} +2 -2
- package/dist/bundle/{chunk-HZRQLAHO.js → chunk-DQB5JMTY.js} +1 -1
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-DSRXCLPO.js} +1 -1
- package/dist/bundle/{chunk-UUMUL4L3.js → chunk-DW23LM47.js} +2 -2
- package/dist/bundle/{chunk-VOH7S5M4.js → chunk-E4FAMU2S.js} +3230 -3116
- package/dist/bundle/{chunk-TKVL2C3B.js → chunk-E4X7JAFC.js} +3 -3
- package/dist/bundle/{chunk-NUU4WZVL.js → chunk-EE4JSYGZ.js} +3 -3
- package/dist/bundle/{chunk-NWHEHV3K.js → chunk-EMOVVERN.js} +5 -5
- package/dist/bundle/{chunk-PVKF24ZW.js → chunk-FIVD4HM4.js} +8 -8
- package/dist/bundle/{chunk-QJW35N5V.js → chunk-GC6FLHZF.js} +12 -12
- package/dist/bundle/{chunk-TP7GDWVF.js → chunk-GRFICQTZ.js} +1 -1
- package/dist/bundle/{chunk-GPYCBYX5.js → chunk-GZZR5U3K.js} +12 -12
- package/dist/bundle/{chunk-X2M6NIQG.js → chunk-HPZRUY6S.js} +1 -1
- package/dist/bundle/{chunk-CLAN3FES.js → chunk-IBTMK5KD.js} +54 -34
- package/dist/bundle/{chunk-5A6ZYNAQ.js → chunk-IQ2XZ62J.js} +18 -18
- package/dist/bundle/{chunk-DBEQI5YM.js → chunk-ITGNDZRR.js} +3 -3
- package/dist/bundle/{chunk-W53EJOFQ.js → chunk-IXZLMFPO.js} +1 -1
- package/dist/bundle/{chunk-TOSCB4SO.js → chunk-J5P5VSRG.js} +16 -10
- package/dist/bundle/{chunk-RMIYKDUL.js → chunk-JK2SNLU5.js} +17 -17
- package/dist/bundle/{chunk-43EKCUBJ.js → chunk-JP2HJXFO.js} +3 -3
- package/dist/bundle/{chunk-DFCHHR5M.js → chunk-JUKAIXKY.js} +1 -1
- package/dist/bundle/{chunk-3WLYWRGG.js → chunk-K4X5ZHI2.js} +19 -17
- package/dist/bundle/{chunk-5GBUCHRU.js → chunk-KO4VR5NK.js} +4 -4
- package/dist/bundle/{chunk-PPHBRESD.js → chunk-KVXEEKBB.js} +2 -2
- package/dist/bundle/{chunk-SDQGB4KB.js → chunk-L433IDOX.js} +9 -9
- package/dist/bundle/chunk-LA3YU4K7.js +40 -0
- package/dist/bundle/{chunk-ECEZOLOD.js → chunk-LKSNISYV.js} +4 -4
- package/dist/bundle/{chunk-5K7QLJMM.js → chunk-LT5KE44Q.js} +226 -226
- package/dist/bundle/{chunk-YMCY7VRE.js → chunk-LTVYGXWT.js} +7 -7
- package/dist/bundle/chunk-M763RNWP.js +733 -0
- package/dist/bundle/{chunk-IMJQRPLN.js → chunk-NNMU2TDU.js} +1 -1
- package/dist/bundle/chunk-NTQBS2JL.js +52 -0
- package/dist/bundle/{chunk-HCAZV5NP.js → chunk-NZGI74GS.js} +6 -6
- package/dist/bundle/{chunk-W7HM2VGO.js → chunk-O3VM5PTJ.js} +1 -1
- package/dist/bundle/chunk-ODPU3II6.js +353 -0
- package/dist/bundle/chunk-OJIJVOOA.js +561 -0
- package/dist/bundle/{chunk-7ELMWE3P.js → chunk-PHXOL5HZ.js} +176 -160
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-B3MANLNK.js → chunk-PLRUUXK7.js} +19 -233
- package/dist/bundle/{chunk-RR5MX5TM.js → chunk-PMP37KLR.js} +4 -4
- package/dist/bundle/{chunk-FTFV3HFW.js → chunk-Q27QAB4X.js} +9 -9
- package/dist/bundle/{chunk-2QZK5BEP.js → chunk-RVWGFD32.js} +30 -15
- package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
- package/dist/bundle/{chunk-QGFX5MXL.js → chunk-SEELWPRD.js} +9 -9
- package/dist/bundle/{chunk-HC5ZWE5X.js → chunk-TIHDBKA7.js} +2 -2
- package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-U6XA3OOM.js} +2 -2
- package/dist/bundle/{chunk-IJADZW42.js → chunk-VNPC274V.js} +3 -3
- package/dist/bundle/{chunk-NXERIDPJ.js → chunk-VQEAZXTV.js} +7 -7
- package/dist/bundle/{chunk-P5BHKKBI.js → chunk-VW5F6FK3.js} +4 -4
- package/dist/bundle/{chunk-XRREFEIW.js → chunk-WCQW4GYO.js} +7 -7
- package/dist/bundle/{chunk-H3TNVEQX.js → chunk-WGBVRDY3.js} +29 -4
- package/dist/bundle/chunk-WRCKE5ND.js +80 -0
- package/dist/bundle/{chunk-TBJYLC5K.js → chunk-X5S5KUSU.js} +75 -75
- package/dist/bundle/{chunk-2UOJ7DLZ.js → chunk-XLDQTDF6.js} +3 -3
- package/dist/bundle/{chunk-Z73OL5HV.js → chunk-Z6ZQVYIE.js} +3 -3
- package/dist/bundle/command-contract-R2FGN7CQ.js +40 -0
- package/dist/bundle/{command-server-entry-DJKVVZCQ.js → command-server-entry-GJSMDSNE.js} +29 -29
- package/dist/bundle/{decode-FC65Y4IV.js → decode-6PLXHVHW.js} +6 -6
- package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-TAQ7635E.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-FVTUDXDU.js → echarts-UZ7QLRE2.js} +2 -2
- package/dist/bundle/{embed-VNBZFPYH.js → embed-AWLL4EBF.js} +7 -7
- package/dist/bundle/{embedder-6U4NOFRO.js → embedder-MM225YJ6.js} +10 -10
- package/dist/bundle/{failure-FZ6VYKEQ.js → failure-MR2XVHFP.js} +3 -3
- package/dist/bundle/first-run-KCZVNFJ7.js +29 -0
- package/dist/bundle/first-screen-SCDV7TXT.js +40 -0
- package/dist/bundle/hubspot.js +26 -26
- package/dist/bundle/{instructions-HET7BCYK.js → instructions-ZJ7U3QUE.js} +1 -1
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-CNV7F2XZ.js} +2 -2
- package/dist/bundle/meeting-combined-EL5XZIJ5.js +25 -0
- package/dist/bundle/meeting-model-OYXB2NOE.js +25 -0
- package/dist/bundle/{meeting-semantic-JY3OGCBS.js → meeting-semantic-S3DBB7XD.js} +7 -7
- package/dist/bundle/{node-CXZIFHZC.js → node-HGCZGZ4R.js} +2 -2
- package/dist/bundle/{node-sqlite-P3O7XN7Q.js → node-sqlite-RKYSRKEB.js} +8 -8
- package/dist/bundle/oauth-PYDCAQ7Y.js +20 -0
- package/dist/bundle/{open-F4P6YV54.js → open-UCDSQUN2.js} +6 -6
- package/dist/bundle/{openai-4AICLIK3.js → openai-Y4F5ZC7O.js} +16 -16
- package/dist/bundle/{process-5RUXWGYS.js → process-P7FB7YO7.js} +1 -1
- package/dist/bundle/{program-XA4C44Z4.js → program-O2A5L4S4.js} +683 -242
- package/dist/bundle/{prompt-NFMDVBZ4.js → prompt-E5TKZ37Q.js} +6 -6
- package/dist/bundle/{recognize-DKN3RY4V.js → recognize-5NYPTSLT.js} +5 -5
- package/dist/bundle/{remote-6QHAGQWY.js → remote-U4LUAHF2.js} +10 -10
- package/dist/bundle/{rerank-M4KHEHUZ.js → rerank-AJAVKK5L.js} +8 -8
- package/dist/bundle/{schemas-JRL3DLMP.js → schemas-QLQ2K6DL.js} +7 -33
- package/dist/bundle/{serve-DNU43ND6.js → serve-4UJ3R5IP.js} +11 -11
- package/dist/bundle/{server-ATG5KY7K.js → server-DUKWJUKD.js} +73 -61
- package/dist/bundle/server-UQVV2PPX.js +86 -0
- package/dist/bundle/{source-54HR4IWG.js → source-FCQDXCAD.js} +334 -78
- package/dist/bundle/{sqlite-runtime-EMQAC63N.js → sqlite-runtime-KLEA4XAU.js} +7 -7
- package/dist/bundle/{state-T45CX7VY.js → state-COGSYMVH.js} +7 -7
- package/dist/bundle/{store-6TZ2FCVA.js → store-BJXCSP26.js} +25 -24
- package/dist/bundle/store-CHH3G3SL.js +32 -0
- package/dist/bundle/{store-6LCEVBAZ.js → store-V5UMSWK4.js} +27 -22
- package/dist/bundle/store-maintenance-command-DQUBBWMD.js +73 -0
- package/dist/bundle/surface-IGBQUYE5.js +72 -0
- package/dist/bundle/writer-AQSEPEEN.js +86 -0
- package/dist/commands/session.js +2 -2
- package/dist/commands/session.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -5
- package/dist/config.js.map +1 -1
- package/dist/crm/activities.d.ts.map +1 -1
- package/dist/crm/activities.js +3 -13
- package/dist/crm/activities.js.map +1 -1
- package/dist/crm/records.d.ts +6 -0
- package/dist/crm/records.d.ts.map +1 -1
- package/dist/crm/records.js +6 -0
- package/dist/crm/records.js.map +1 -1
- package/dist/crm/source.d.ts +0 -6
- package/dist/crm/source.d.ts.map +1 -1
- package/dist/crm/source.js +1 -7
- package/dist/crm/source.js.map +1 -1
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +0 -115
- package/dist/generated/manifest.js.map +1 -1
- package/dist/generated/types.d.ts +160 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/hubspot/transport.js +1 -1
- package/dist/hubspot/transport.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/command-contract-C6CBFXZF.js +0 -40
- package/dist/bundle/first-run-UWAFSINQ.js +0 -29
- package/dist/bundle/first-screen-RTVMGHAE.js +0 -40
- package/dist/bundle/meeting-combined-L5AGBPYX.js +0 -25
- package/dist/bundle/meeting-model-NTB4RK3F.js +0 -25
- package/dist/bundle/oauth-HNCY4B2S.js +0 -20
- package/dist/bundle/server-VNWVVH7A.js +0 -77
- package/dist/bundle/store-DXWYNVVB.js +0 -32
- package/dist/bundle/store-maintenance-command-J57HCJYY.js +0 -68
- package/dist/bundle/writer-NLLI5YRM.js +0 -79
|
@@ -1,89 +1,47 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
UNTRUSTED,
|
|
5
|
-
UNTRUSTED_NEUTRAL,
|
|
6
|
-
agentArguments,
|
|
7
|
-
agentJson,
|
|
8
4
|
commandAvailability
|
|
9
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NTQBS2JL.js";
|
|
10
6
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
7
|
+
lentConnection
|
|
8
|
+
} from "./chunk-B2W3C4N6.js";
|
|
13
9
|
import {
|
|
14
|
-
QUERY_ARGUMENT
|
|
15
|
-
|
|
16
|
-
onlineDeps,
|
|
17
|
-
refuseLacking,
|
|
18
|
-
servicesFor,
|
|
19
|
-
storeModeDeps
|
|
20
|
-
} from "./chunk-VOH7S5M4.js";
|
|
10
|
+
QUERY_ARGUMENT
|
|
11
|
+
} from "./chunk-M763RNWP.js";
|
|
21
12
|
import {
|
|
22
|
-
DEFAULT_OUTPUT_BYTES,
|
|
23
|
-
ENTITIES,
|
|
24
|
-
LOCAL_WRITE,
|
|
25
|
-
REMOTE_WRITE,
|
|
26
|
-
answerSchema,
|
|
27
13
|
changesMessenger,
|
|
28
|
-
flatten
|
|
29
|
-
|
|
30
|
-
judgedEffects,
|
|
31
|
-
listOf,
|
|
32
|
-
refuseStoreChange,
|
|
33
|
-
sealed,
|
|
34
|
-
startRecording
|
|
35
|
-
} from "./chunk-7ELMWE3P.js";
|
|
14
|
+
flatten
|
|
15
|
+
} from "./chunk-PHXOL5HZ.js";
|
|
36
16
|
import {
|
|
37
|
-
currentCaller
|
|
38
|
-
|
|
39
|
-
runContextOf,
|
|
40
|
-
withCaller
|
|
41
|
-
} from "./chunk-PVKF24ZW.js";
|
|
17
|
+
currentCaller
|
|
18
|
+
} from "./chunk-FIVD4HM4.js";
|
|
42
19
|
import {
|
|
43
20
|
enclosingTraceId,
|
|
44
21
|
inRun,
|
|
45
22
|
newRunId,
|
|
46
23
|
traceOf
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import {
|
|
49
|
-
storeDamaged
|
|
50
|
-
} from "./chunk-UUMUL4L3.js";
|
|
51
|
-
import {
|
|
52
|
-
failureContext
|
|
53
|
-
} from "./chunk-H3TNVEQX.js";
|
|
24
|
+
} from "./chunk-IBTMK5KD.js";
|
|
54
25
|
import {
|
|
55
26
|
authorityAllowed,
|
|
56
|
-
botApiAllowed
|
|
57
|
-
|
|
58
|
-
keyForCommand,
|
|
59
|
-
levelFor,
|
|
60
|
-
readKeysForCommand
|
|
61
|
-
} from "./chunk-2VGD63G6.js";
|
|
27
|
+
botApiAllowed
|
|
28
|
+
} from "./chunk-3TEFE6YU.js";
|
|
62
29
|
import {
|
|
63
30
|
queryDescription
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
import {
|
|
66
|
-
MAX_BUFFERED_INPUT
|
|
67
|
-
} from "./chunk-PPHBRESD.js";
|
|
31
|
+
} from "./chunk-LT5KE44Q.js";
|
|
68
32
|
import {
|
|
69
|
-
captureStreams
|
|
70
|
-
|
|
71
|
-
} from "./chunk-TBJYLC5K.js";
|
|
33
|
+
captureStreams
|
|
34
|
+
} from "./chunk-X5S5KUSU.js";
|
|
72
35
|
import {
|
|
73
36
|
COMPACT_FLAG,
|
|
74
37
|
SNAKE_CASE,
|
|
75
38
|
duplicates,
|
|
76
39
|
errorObjectOf,
|
|
77
|
-
itemEnvelopeSchema,
|
|
78
|
-
listEnvelopeSchema,
|
|
79
|
-
mcpErrorResult,
|
|
80
40
|
parseRegistry,
|
|
81
41
|
text,
|
|
82
|
-
toJsonSchema,
|
|
83
|
-
toStandardJsonSchema,
|
|
84
42
|
word,
|
|
85
43
|
writes
|
|
86
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-J5P5VSRG.js";
|
|
87
45
|
import {
|
|
88
46
|
array,
|
|
89
47
|
boolean,
|
|
@@ -91,9 +49,6 @@ import {
|
|
|
91
49
|
integer,
|
|
92
50
|
isoDate,
|
|
93
51
|
literal,
|
|
94
|
-
looseObject,
|
|
95
|
-
maxLength,
|
|
96
|
-
maxValue,
|
|
97
52
|
minLength,
|
|
98
53
|
minValue,
|
|
99
54
|
number,
|
|
@@ -103,25 +58,22 @@ import {
|
|
|
103
58
|
pipe,
|
|
104
59
|
record,
|
|
105
60
|
regex,
|
|
106
|
-
safeParse,
|
|
107
61
|
strictObject,
|
|
108
62
|
string,
|
|
109
|
-
summarize,
|
|
110
63
|
union,
|
|
111
64
|
unknown
|
|
112
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-S4UUN6LD.js";
|
|
113
66
|
import {
|
|
114
|
-
CliError
|
|
115
|
-
|
|
116
|
-
} from "./chunk-DB2XKHI4.js";
|
|
67
|
+
CliError
|
|
68
|
+
} from "./chunk-BUGROVF3.js";
|
|
117
69
|
import {
|
|
118
70
|
__name
|
|
119
71
|
} from "./chunk-ZVVMGPBJ.js";
|
|
120
72
|
|
|
121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
122
74
|
import { Readable } from "node:stream";
|
|
123
75
|
|
|
124
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
76
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
|
|
125
77
|
var LINT_SEVERITIES = ["high", "medium", "low"];
|
|
126
78
|
var lintRuleSchema = strictObject({
|
|
127
79
|
id: word,
|
|
@@ -267,7 +219,7 @@ var overrideSchema = strictObject({
|
|
|
267
219
|
});
|
|
268
220
|
var overridesSchema = array(overrideSchema);
|
|
269
221
|
|
|
270
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
222
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
|
|
271
223
|
var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
|
|
272
224
|
var defineAuditRules = /* @__PURE__ */ __name((input) => parseRegistry("audit rules", array(auditRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineAuditRules");
|
|
273
225
|
var AUDIT_RULES = defineAuditRules([
|
|
@@ -322,17 +274,20 @@ var parityGroupSchema = strictObject({
|
|
|
322
274
|
absent: optional(word),
|
|
323
275
|
/** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
|
|
324
276
|
only: optional(word),
|
|
277
|
+
/** The one CLI whose value (a summary, a value name) differs by design; every other CLI compared must agree. */
|
|
278
|
+
differs: optional(word),
|
|
325
279
|
reason: pipe(text, minLength(10, "say why, in a sentence")),
|
|
326
280
|
/** Warns from 14 days before and fails 14 days after, as a lint override does. */
|
|
327
281
|
review_after: optional(pipe(string(), isoDate("a date, YYYY-MM-DD")))
|
|
328
282
|
}))
|
|
329
283
|
});
|
|
284
|
+
var kindOf = /* @__PURE__ */ __name((entry) => ["absent", "only", "differs"].filter((one) => entry[one] !== void 0), "kindOf");
|
|
330
285
|
var defineParityGroups = /* @__PURE__ */ __name((input) => parseRegistry("parity groups", array(parityGroupSchema), input, (groups) => [
|
|
331
286
|
...duplicates(groups.map((group) => group.name)).map((name) => `"${name}" is listed twice`),
|
|
332
287
|
...groups.flatMap((group) => [
|
|
333
288
|
...duplicates(group.differences.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `${group.name}: "${both}" is listed twice`),
|
|
334
|
-
...group.differences.filter((entry) => (entry.
|
|
335
|
-
...group.differences.filter((entry) => entry.
|
|
289
|
+
...group.differences.filter((entry) => kindOf(entry).length === 1 && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${kindOf(entry)[0]}\`, which measures the values itself; drop \`expected\``),
|
|
290
|
+
...group.differences.filter((entry) => kindOf(entry).length > 1).map((entry) => `${group.name}: "${entry.target}" has ${kindOf(entry).map((one) => `\`${one}\``).join(" and ")}; keep one`)
|
|
336
291
|
])
|
|
337
292
|
]), "defineParityGroups");
|
|
338
293
|
var MEMO_HAS_NO_PROFILES = [
|
|
@@ -347,6 +302,12 @@ var MEMO_HAS_NO_PROFILES = [
|
|
|
347
302
|
absent: "memo",
|
|
348
303
|
reason: "memo has no profiles: it reads other CLIs' stores and selects their accounts with --source and --account (https://github.com/WireCatLabs/cli-base/issues/390)"
|
|
349
304
|
}));
|
|
305
|
+
var MEMO_MCP_SUMMARIES = ["mcp", "mcp serve"].map((path) => ({
|
|
306
|
+
rule: "same-path-contract",
|
|
307
|
+
target: `${path}: summary`,
|
|
308
|
+
differs: "memo",
|
|
309
|
+
reason: "memo has no profiles, so its mcp commands serve memo's commands rather than a profile's"
|
|
310
|
+
}));
|
|
350
311
|
var MEMO_DOCTOR_DEEP = {
|
|
351
312
|
rule: "same-path-contract",
|
|
352
313
|
target: "doctor --deep",
|
|
@@ -377,7 +338,7 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
377
338
|
name: "all",
|
|
378
339
|
members: ["tg", "max", "memo", "drive", "zm", "wa"],
|
|
379
340
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
|
|
380
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
341
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
381
342
|
},
|
|
382
343
|
// mail's `search messages` is cli-core's mail search, not the messengers' command: --complete took their 20-odd
|
|
383
344
|
// differences as inherited (https://github.com/WireCatLabs/cli-base/issues/390). mail is compared everywhere else
|
|
@@ -386,7 +347,7 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
386
347
|
name: "mail-shared",
|
|
387
348
|
members: ["tg", "max", "memo", "drive", "zm", "wa", "mail"],
|
|
388
349
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
|
|
389
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
350
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
390
351
|
},
|
|
391
352
|
// gcal is compared on what it already shares with every CLI; doctor, mcp, search and skill wait until the published
|
|
392
353
|
// CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
|
|
@@ -398,28 +359,41 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
398
359
|
},
|
|
399
360
|
// bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
|
|
400
361
|
// recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
|
|
401
|
-
// amo-cli
|
|
402
|
-
// notion-cli joins here until its documents commands ship; then it moves next to drive.
|
|
362
|
+
// amo-cli and hubspot-cli share them too, and their CRM commands are compared with b24 in `crm` below.
|
|
363
|
+
// notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
|
|
364
|
+
// its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
|
|
365
|
+
// and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
|
|
403
366
|
{
|
|
404
367
|
name: "shared-roots",
|
|
405
|
-
members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion", "amo"],
|
|
368
|
+
members: ["tg", "max", "memo", "drive", "zm", "wa", "b24", "beeline", "pbx", "notion", "amo", "hubspot", "ydisk"],
|
|
406
369
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
|
|
407
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
370
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
408
371
|
},
|
|
409
|
-
// The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet
|
|
410
|
-
//
|
|
411
|
-
// later) and `deals delete` (amoCRM's
|
|
412
|
-
// https://www.amocrm.ru/developers/content/crm_platform/leads-api)
|
|
413
|
-
// these need no difference. `people`, `organizations`,
|
|
414
|
-
// is on cli-core's shared people and organizations
|
|
415
|
-
// in options, outputs and summaries.
|
|
372
|
+
// The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet and hubspot-cli is
|
|
373
|
+
// not in the family packages, so `audit --family` skips them, as beeline. Only b24 and hubspot have `leads` (amoCRM
|
|
374
|
+
// has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
|
|
375
|
+
// API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
|
|
376
|
+
// no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
|
|
377
|
+
// `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
|
|
378
|
+
// commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
|
|
416
379
|
{
|
|
417
380
|
name: "crm",
|
|
418
|
-
members: ["b24", "amo"],
|
|
381
|
+
members: ["b24", "amo", "hubspot"],
|
|
419
382
|
covers: ["deals", "sync", "search", "store", "schedule", "account"],
|
|
420
|
-
differences: [
|
|
383
|
+
differences: [
|
|
384
|
+
{
|
|
385
|
+
rule: "same-path-contract",
|
|
386
|
+
target: "schedule: summary",
|
|
387
|
+
differs: "hubspot",
|
|
388
|
+
reason: "cli-core cuts the summary to a fixed width after it puts in the CLI's name (src/cli/help/commands-text.ts), so hubspot's longer name ends it a word earlier than b24's and amo's",
|
|
389
|
+
review_after: "2026-12-01"
|
|
390
|
+
}
|
|
391
|
+
]
|
|
421
392
|
}
|
|
422
393
|
]);
|
|
394
|
+
var SHARED_DIFFERENCES = [
|
|
395
|
+
...new Map(PARITY_GROUPS.flatMap((group) => group.differences).filter((entry) => entry.rule === "same-entity-schema" || entry.rule === "same-error-reason").map((entry) => [`${entry.rule} ${entry.target}`, entry])).values()
|
|
396
|
+
];
|
|
423
397
|
var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
|
|
424
398
|
var defineRequiredRoots = /* @__PURE__ */ __name((input) => parseRegistry("required roots", array(requiredRootSchema), input, (roots2) => duplicates(roots2.map((root) => root.path.join(" "))).map((path) => `"${path}" is listed twice`)), "defineRequiredRoots");
|
|
425
399
|
var REQUIRED_ROOTS = defineRequiredRoots([
|
|
@@ -431,7 +405,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
|
|
|
431
405
|
{ path: ["upgrade"], meaning: "updates the CLI" }
|
|
432
406
|
]);
|
|
433
407
|
|
|
434
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
408
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
|
|
435
409
|
var fieldRuleSchema = strictObject({ id: word, rule: text });
|
|
436
410
|
var defineFieldRules = /* @__PURE__ */ __name((input) => parseRegistry("output field rules", array(fieldRuleSchema), input, (rules) => duplicates(rules.map((rule) => rule.id)).map((id) => `"${id}" is listed twice`)), "defineFieldRules");
|
|
437
411
|
var FIELD_RULES = defineFieldRules([
|
|
@@ -447,7 +421,7 @@ var FIELD_RULES = defineFieldRules([
|
|
|
447
421
|
}
|
|
448
422
|
]);
|
|
449
423
|
|
|
450
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
424
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
|
|
451
425
|
var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
|
|
452
426
|
var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
|
|
453
427
|
var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
|
|
@@ -469,7 +443,7 @@ var IDENTIFIERS = defineIdentifiers([
|
|
|
469
443
|
{ key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
|
|
470
444
|
]);
|
|
471
445
|
|
|
472
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
446
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
|
|
473
447
|
var ACCOUNT_FLAGS = [
|
|
474
448
|
{
|
|
475
449
|
name: "--client-id",
|
|
@@ -506,7 +480,7 @@ var ACCOUNT_FLAGS = [
|
|
|
506
480
|
{ name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
|
|
507
481
|
];
|
|
508
482
|
|
|
509
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
483
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
|
|
510
484
|
var CALENDAR_FLAGS = [
|
|
511
485
|
{ name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
|
|
512
486
|
{
|
|
@@ -594,7 +568,7 @@ var CALENDAR_FLAGS = [
|
|
|
594
568
|
}
|
|
595
569
|
];
|
|
596
570
|
|
|
597
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
571
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
|
|
598
572
|
var CRM_FLAGS = [
|
|
599
573
|
{
|
|
600
574
|
name: "--email",
|
|
@@ -758,7 +732,7 @@ var CRM_FLAGS = [
|
|
|
758
732
|
}
|
|
759
733
|
];
|
|
760
734
|
|
|
761
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
735
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
|
|
762
736
|
var HOW_FLAGS = [
|
|
763
737
|
{
|
|
764
738
|
name: "--limit",
|
|
@@ -1755,7 +1729,7 @@ var HOW_FLAGS = [
|
|
|
1755
1729
|
}
|
|
1756
1730
|
];
|
|
1757
1731
|
|
|
1758
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1732
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
|
|
1759
1733
|
var KNOWLEDGE_FLAGS = [
|
|
1760
1734
|
{
|
|
1761
1735
|
name: "--accept-terms",
|
|
@@ -1791,6 +1765,13 @@ var KNOWLEDGE_FLAGS = [
|
|
|
1791
1765
|
meaning: "at most this many characters read",
|
|
1792
1766
|
unit: "characters"
|
|
1793
1767
|
},
|
|
1768
|
+
{
|
|
1769
|
+
name: "--tab",
|
|
1770
|
+
value: "<id>",
|
|
1771
|
+
role: "target",
|
|
1772
|
+
type: "id",
|
|
1773
|
+
meaning: "one tab of a document, by its id: only its text is read"
|
|
1774
|
+
},
|
|
1794
1775
|
{
|
|
1795
1776
|
name: "--tag",
|
|
1796
1777
|
value: "<name>",
|
|
@@ -1807,7 +1788,7 @@ var KNOWLEDGE_FLAGS = [
|
|
|
1807
1788
|
}
|
|
1808
1789
|
];
|
|
1809
1790
|
|
|
1810
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1791
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
|
|
1811
1792
|
var MAIL_FLAGS = [
|
|
1812
1793
|
{
|
|
1813
1794
|
name: "--cc",
|
|
@@ -1837,7 +1818,7 @@ var MAIL_FLAGS = [
|
|
|
1837
1818
|
}
|
|
1838
1819
|
];
|
|
1839
1820
|
|
|
1840
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1821
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
|
|
1841
1822
|
var PRIVACY_FLAGS = [
|
|
1842
1823
|
{
|
|
1843
1824
|
name: "--about-text",
|
|
@@ -1898,7 +1879,7 @@ var PRIVACY_FLAGS = [
|
|
|
1898
1879
|
{ name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
|
|
1899
1880
|
];
|
|
1900
1881
|
|
|
1901
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1882
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
|
|
1902
1883
|
var SCHEDULE_FLAGS = [
|
|
1903
1884
|
{
|
|
1904
1885
|
name: "--locale",
|
|
@@ -1931,7 +1912,7 @@ var SCHEDULE_FLAGS = [
|
|
|
1931
1912
|
}
|
|
1932
1913
|
];
|
|
1933
1914
|
|
|
1934
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1915
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
|
|
1935
1916
|
var WHAT_FLAGS = [
|
|
1936
1917
|
{
|
|
1937
1918
|
name: "--analysis-provider",
|
|
@@ -2928,7 +2909,7 @@ var WHAT_FLAGS = [
|
|
|
2928
2909
|
}
|
|
2929
2910
|
];
|
|
2930
2911
|
|
|
2931
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
2912
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
|
|
2932
2913
|
var FLAG_TYPES = [
|
|
2933
2914
|
"switch",
|
|
2934
2915
|
"count",
|
|
@@ -3058,6 +3039,10 @@ var verbs = [
|
|
|
3058
3039
|
["export", "write from the store to a file"],
|
|
3059
3040
|
["import", "bring a file or list the user gives into the store or the messenger, once"],
|
|
3060
3041
|
["download", "save a file from the source to this machine"],
|
|
3042
|
+
["upload", "put a file from this machine on the source"],
|
|
3043
|
+
["publish", "open a thing to anyone who has its public link"],
|
|
3044
|
+
["unpublish", "close a thing's public link"],
|
|
3045
|
+
["stale", "mark a saved memory as out of date, keeping it"],
|
|
3061
3046
|
["transcribe", "turn speech into text"],
|
|
3062
3047
|
["extract", "read the text inside files already on this machine into the store"],
|
|
3063
3048
|
["migrate", "bring a file up to this build's schema"],
|
|
@@ -3200,6 +3185,10 @@ var collections = [
|
|
|
3200
3185
|
["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
|
|
3201
3186
|
["splits", "parts of one transaction, each with its own amount and category"],
|
|
3202
3187
|
["users", "people who work in the owner's account at a service, such as a CRM's employees"],
|
|
3188
|
+
["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
|
|
3189
|
+
["teams", "groups in a tracker that own issues, states and labels"],
|
|
3190
|
+
["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
|
|
3191
|
+
["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
|
|
3203
3192
|
["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
|
|
3204
3193
|
["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
|
|
3205
3194
|
["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
|
|
@@ -3351,7 +3340,7 @@ var VOCABULARY = defineVocabulary({
|
|
|
3351
3340
|
]
|
|
3352
3341
|
});
|
|
3353
3342
|
|
|
3354
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3343
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.699.0_@wirecat+cli-base@0.119.0_commander@15.0.0_esbuild@0.28.2_typ_13ea275dd452fd1070c59d86b8d8c388/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
3355
3344
|
var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
|
|
3356
3345
|
var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
|
|
3357
3346
|
var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
|
|
@@ -3522,7 +3511,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3522
3511
|
const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
|
|
3523
3512
|
const lend = ctx.connection;
|
|
3524
3513
|
let borrowed;
|
|
3525
|
-
let
|
|
3514
|
+
let answered = false;
|
|
3526
3515
|
let result;
|
|
3527
3516
|
let failure;
|
|
3528
3517
|
const streams = captureStreams();
|
|
@@ -3544,7 +3533,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3544
3533
|
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
3545
3534
|
agent: {
|
|
3546
3535
|
result: /* @__PURE__ */ __name((value) => {
|
|
3547
|
-
|
|
3536
|
+
answered = true;
|
|
3548
3537
|
result = value;
|
|
3549
3538
|
}, "result"),
|
|
3550
3539
|
failure: /* @__PURE__ */ __name((object2) => {
|
|
@@ -3566,7 +3555,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3566
3555
|
}));
|
|
3567
3556
|
if (failure)
|
|
3568
3557
|
return { error: failure };
|
|
3569
|
-
if (
|
|
3558
|
+
if (answered)
|
|
3570
3559
|
return { result };
|
|
3571
3560
|
if (code !== 0)
|
|
3572
3561
|
throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
|
|
@@ -3578,468 +3567,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3578
3567
|
}
|
|
3579
3568
|
}, "runCommandForAgent");
|
|
3580
3569
|
|
|
3581
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/tool.js
|
|
3582
|
-
var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
|
|
3583
|
-
var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
|
|
3584
|
-
var message = pipe(
|
|
3585
|
-
string(),
|
|
3586
|
-
maxLength(256),
|
|
3587
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
|
|
3588
|
-
regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
|
|
3589
|
-
description("message id")
|
|
3590
|
-
);
|
|
3591
|
-
var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
3592
|
-
var WRITE = {
|
|
3593
|
-
readOnlyHint: false,
|
|
3594
|
-
destructiveHint: true,
|
|
3595
|
-
idempotentHint: false,
|
|
3596
|
-
openWorldHint: true
|
|
3597
|
-
};
|
|
3598
|
-
var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
|
|
3599
|
-
var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
|
|
3600
|
-
var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
|
|
3601
|
-
if (definition.annotations.readOnlyHint === true)
|
|
3602
|
-
return "read";
|
|
3603
|
-
if (/^admin|_admin/.test(key2))
|
|
3604
|
-
return "admin";
|
|
3605
|
-
if (/delete|ban|kick|remove|purge|block/.test(key2))
|
|
3606
|
-
return "destructive";
|
|
3607
|
-
if (/draft/.test(key2))
|
|
3608
|
-
return "draft";
|
|
3609
|
-
if (key2 === "messages_pin" && messenger?.quietPins === false)
|
|
3610
|
-
return "write-public";
|
|
3611
|
-
if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
|
|
3612
|
-
return "write-private";
|
|
3613
|
-
return "write-public";
|
|
3614
|
-
}, "tierOf");
|
|
3615
|
-
var effectsOf = /* @__PURE__ */ __name((definition) => {
|
|
3616
|
-
if (definition.effects)
|
|
3617
|
-
return definition.effects;
|
|
3618
|
-
const { readOnlyHint, openWorldHint } = definition.annotations;
|
|
3619
|
-
if (readOnlyHint === true)
|
|
3620
|
-
return { remote: openWorldHint === false ? "none" : "read", local: "read" };
|
|
3621
|
-
return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
|
|
3622
|
-
}, "effectsOf");
|
|
3623
|
-
var outcomeOf = /* @__PURE__ */ __name((result) => {
|
|
3624
|
-
if (!result.isError)
|
|
3625
|
-
return { status: "ok" };
|
|
3626
|
-
const code = result.structuredContent?.error?.code;
|
|
3627
|
-
const error = typeof code === "string" ? code : "generic_failure";
|
|
3628
|
-
return { status: error === "permission_error" ? "refused" : "failed", error };
|
|
3629
|
-
}, "outcomeOf");
|
|
3630
|
-
var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
|
|
3631
|
-
var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
|
|
3632
|
-
var inputOf = /* @__PURE__ */ __name((definition, syncAllowed) => strictObject(syncAllowed || !("sync_first" in definition.input.entries) ? definition.input.entries : Object.fromEntries(Object.entries(definition.input.entries).filter(([name]) => !["sync_first", "sync_time", "max_chats", "max_messages"].includes(name)))), "inputOf");
|
|
3633
|
-
var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
|
|
3634
|
-
const permissions = defaults.settings.permissions ?? {};
|
|
3635
|
-
const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
|
|
3636
|
-
return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
|
|
3637
|
-
}, "syncAllowedFor");
|
|
3638
|
-
var entryRunner = /* @__PURE__ */ __name((registration) => {
|
|
3639
|
-
const run = callRunner(registration);
|
|
3640
|
-
const { log } = registration;
|
|
3641
|
-
return async (key2, definition, args, ctx) => {
|
|
3642
|
-
const startedAt = Date.now();
|
|
3643
|
-
const command = `mcp ${commandOf(key2, definition)}`;
|
|
3644
|
-
const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
|
|
3645
|
-
const app = registration.messenger?.app;
|
|
3646
|
-
const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
|
|
3647
|
-
const env = registration.defaults.env ?? process.env;
|
|
3648
|
-
const settings = registration.defaults.settings;
|
|
3649
|
-
const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
|
|
3650
|
-
app,
|
|
3651
|
-
command,
|
|
3652
|
-
...settings.profile === void 0 ? {} : { profile: settings.profile },
|
|
3653
|
-
env,
|
|
3654
|
-
record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
|
|
3655
|
-
keepFailed: true,
|
|
3656
|
-
trace: false,
|
|
3657
|
-
format: "json",
|
|
3658
|
-
context: runContextOf({ bin: app.command, command, env, caller }),
|
|
3659
|
-
...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
|
|
3660
|
-
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
3661
|
-
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
3662
|
-
...traceId === void 0 ? {} : { traceId }
|
|
3663
|
-
}) : void 0;
|
|
3664
|
-
const profile = registration.defaults.settings.profile;
|
|
3665
|
-
const scope = {
|
|
3666
|
-
runId: recording?.runId ?? newRunId(new Date(startedAt), command),
|
|
3667
|
-
command,
|
|
3668
|
-
startedAt,
|
|
3669
|
-
...profile === void 0 ? {} : { profile },
|
|
3670
|
-
...traceId === void 0 ? {} : { traceId },
|
|
3671
|
-
...recording ? { events: recording.events } : {}
|
|
3672
|
-
};
|
|
3673
|
-
const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
|
|
3674
|
-
const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
|
|
3675
|
-
const parsed = safeParse(input, args);
|
|
3676
|
-
return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
|
|
3677
|
-
arguments: toJsonSchema(input)
|
|
3678
|
-
}), app?.errors);
|
|
3679
|
-
}), "work");
|
|
3680
|
-
const result = await (caller ? withCaller(caller, work) : work());
|
|
3681
|
-
if (recording) {
|
|
3682
|
-
if (result.isError) {
|
|
3683
|
-
const error = result.structuredContent?.error;
|
|
3684
|
-
const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
|
|
3685
|
-
await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
|
|
3686
|
-
} else
|
|
3687
|
-
await recording.succeed(result.structuredContent).catch(() => void 0);
|
|
3688
|
-
}
|
|
3689
|
-
await log?.({
|
|
3690
|
-
tool: key2,
|
|
3691
|
-
tier: tierOf(key2, definition, registration.messenger),
|
|
3692
|
-
...outcomeOf(result),
|
|
3693
|
-
startedAt,
|
|
3694
|
-
finishedAt: Date.now()
|
|
3695
|
-
}, caller)?.catch(() => void 0);
|
|
3696
|
-
return result;
|
|
3697
|
-
};
|
|
3698
|
-
}, "entryRunner");
|
|
3699
|
-
var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
|
|
3700
|
-
const where = {
|
|
3701
|
-
profile: defaults.settings.profile,
|
|
3702
|
-
env: defaults.env,
|
|
3703
|
-
pictures: defaults.settings.pictureSearch,
|
|
3704
|
-
reranker: defaults.settings.searchReranker
|
|
3705
|
-
};
|
|
3706
|
-
return async (key2, definition, args, ctx) => {
|
|
3707
|
-
const path = commandOf(key2, definition).split(" ");
|
|
3708
|
-
const run = `mcp ${path.join(" ")}`;
|
|
3709
|
-
try {
|
|
3710
|
-
const execute = /* @__PURE__ */ __name(async () => {
|
|
3711
|
-
const syncAllowed = syncAllowedFor(key2, defaults);
|
|
3712
|
-
if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
|
|
3713
|
-
throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
|
|
3714
|
-
reason: "input.too-large",
|
|
3715
|
-
max_bytes: MAX_BUFFERED_INPUT,
|
|
3716
|
-
retryable: false
|
|
3717
|
-
});
|
|
3718
|
-
definition.check?.(args);
|
|
3719
|
-
if (definition.changesStore)
|
|
3720
|
-
refuseStoreChange(messenger.app, defaults.env);
|
|
3721
|
-
refuseLacking(messenger, path);
|
|
3722
|
-
for (const permission of readKeysForCommand(path)) {
|
|
3723
|
-
if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
|
|
3724
|
-
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
3725
|
-
}
|
|
3726
|
-
if (args.sync_first && !syncAllowed)
|
|
3727
|
-
throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
|
|
3728
|
-
if (definition.custom) {
|
|
3729
|
-
const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
|
|
3730
|
-
return answered(result2, definition.outputLimit?.(args, defaults), targets);
|
|
3731
|
-
}
|
|
3732
|
-
if (definition.local)
|
|
3733
|
-
return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
|
|
3734
|
-
const { online, stored: local, served } = definition;
|
|
3735
|
-
const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
|
|
3736
|
-
const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
|
|
3737
|
-
name: run
|
|
3738
|
-
}) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
|
|
3739
|
-
...storeModeDeps(messenger, store, account, defaults.guard),
|
|
3740
|
-
...where,
|
|
3741
|
-
embedders: defaults.embedders
|
|
3742
|
-
}), args, defaults, (work) => session.use(run, async (adapter, release) => {
|
|
3743
|
-
try {
|
|
3744
|
-
return await work(adapter);
|
|
3745
|
-
} finally {
|
|
3746
|
-
await release();
|
|
3747
|
-
}
|
|
3748
|
-
})), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
|
|
3749
|
-
try {
|
|
3750
|
-
return await work(adapter);
|
|
3751
|
-
} finally {
|
|
3752
|
-
await release();
|
|
3753
|
-
}
|
|
3754
|
-
})())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
|
|
3755
|
-
return answered(result, definition.outputLimit?.(args, defaults), targets);
|
|
3756
|
-
}, "execute");
|
|
3757
|
-
return around ? await around(key2, definition, execute) : await execute();
|
|
3758
|
-
} catch (error) {
|
|
3759
|
-
return failed(error, messenger?.app?.errors, effectsOf(definition));
|
|
3760
|
-
}
|
|
3761
|
-
};
|
|
3762
|
-
}, "callRunner");
|
|
3763
|
-
var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
|
|
3764
|
-
if (!definition.output)
|
|
3765
|
-
return looseObject({});
|
|
3766
|
-
const entity = ENTITIES[definition.output.entity];
|
|
3767
|
-
return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
|
|
3768
|
-
}, "outputSchemaOf");
|
|
3769
|
-
var Picture = class {
|
|
3770
|
-
static {
|
|
3771
|
-
__name(this, "Picture");
|
|
3772
|
-
}
|
|
3773
|
-
bytes;
|
|
3774
|
-
mimeType;
|
|
3775
|
-
about;
|
|
3776
|
-
constructor(bytes, mimeType, about) {
|
|
3777
|
-
this.bytes = bytes;
|
|
3778
|
-
this.mimeType = mimeType;
|
|
3779
|
-
this.about = about;
|
|
3780
|
-
}
|
|
3781
|
-
};
|
|
3782
|
-
var BinaryResource = class {
|
|
3783
|
-
static {
|
|
3784
|
-
__name(this, "BinaryResource");
|
|
3785
|
-
}
|
|
3786
|
-
base64;
|
|
3787
|
-
mimeType;
|
|
3788
|
-
uri;
|
|
3789
|
-
about;
|
|
3790
|
-
constructor(base64, mimeType, uri, about) {
|
|
3791
|
-
this.base64 = base64;
|
|
3792
|
-
this.mimeType = mimeType;
|
|
3793
|
-
this.uri = uri;
|
|
3794
|
-
this.about = about;
|
|
3795
|
-
}
|
|
3796
|
-
};
|
|
3797
|
-
var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
|
|
3798
|
-
const bounded = /* @__PURE__ */ __name((result) => {
|
|
3799
|
-
if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
|
|
3800
|
-
throw new CliError("invalid_response", "tool output exceeds its byte limit \u2014 reduce limit or use a narrower request", { reason: "output.too-large", max_bytes: maxBytes, retryable: false });
|
|
3801
|
-
return result;
|
|
3802
|
-
}, "bounded");
|
|
3803
|
-
if (answer === null || Array.isArray(answer) || typeof answer !== "object")
|
|
3804
|
-
throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
|
|
3805
|
-
const objectBody = /* @__PURE__ */ __name((value) => {
|
|
3806
|
-
const serialized = JSON.parse(agentJson(value));
|
|
3807
|
-
if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
|
|
3808
|
-
throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
|
|
3809
|
-
return serialized;
|
|
3810
|
-
}, "objectBody");
|
|
3811
|
-
if (answer instanceof BinaryResource) {
|
|
3812
|
-
const about = sealed(answer.about);
|
|
3813
|
-
return bounded({
|
|
3814
|
-
structuredContent: objectBody(about),
|
|
3815
|
-
content: [
|
|
3816
|
-
{ type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
|
|
3817
|
-
{ type: "text", text: agentJson(about) }
|
|
3818
|
-
]
|
|
3819
|
-
});
|
|
3820
|
-
}
|
|
3821
|
-
if (answer instanceof Picture) {
|
|
3822
|
-
const about = sealed(answer.about);
|
|
3823
|
-
return bounded({
|
|
3824
|
-
structuredContent: objectBody(about),
|
|
3825
|
-
content: [
|
|
3826
|
-
{ type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
|
|
3827
|
-
{ type: "text", text: agentJson(about) }
|
|
3828
|
-
]
|
|
3829
|
-
});
|
|
3830
|
-
}
|
|
3831
|
-
const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
|
|
3832
|
-
return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
|
|
3833
|
-
}, "answered");
|
|
3834
|
-
var failed = /* @__PURE__ */ __name((error, errors, effects) => {
|
|
3835
|
-
const judged = judgedEffects(effects);
|
|
3836
|
-
const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
|
|
3837
|
-
return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
|
|
3838
|
-
}, "failed");
|
|
3839
|
-
|
|
3840
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/surface.js
|
|
3841
|
-
import { randomUUID } from "node:crypto";
|
|
3842
|
-
var MATCHES = 8;
|
|
3843
|
-
var ANSWER = answerSchema();
|
|
3844
|
-
var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3845
|
-
const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
|
|
3846
|
-
const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
|
|
3847
|
-
return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
|
|
3848
|
-
items: optional(array(unknown())),
|
|
3849
|
-
item: optional(unknown()),
|
|
3850
|
-
page: optional(looseObject({ has_more: boolean() })),
|
|
3851
|
-
next,
|
|
3852
|
-
missing: optional(array(looseObject({ field: string(), why: string() }))),
|
|
3853
|
-
meta
|
|
3854
|
-
});
|
|
3855
|
-
}, "agentAnswer");
|
|
3856
|
-
var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3857
|
-
const checked = toStandardJsonSchema(ANSWER);
|
|
3858
|
-
const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
|
|
3859
|
-
return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
|
|
3860
|
-
}, "listedAs");
|
|
3861
|
-
var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
|
|
3862
|
-
var STOP_WORDS = new Set("a an the to of in on at by for from with into out about and or but is are be been was were it its this that these those which who whom whose what when where how do does did can could should would will my our your their his her them they we you i one some any all each every another other".split(" "));
|
|
3863
|
-
var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
|
|
3864
|
-
var stem = /* @__PURE__ */ __name((word2) => {
|
|
3865
|
-
const bare = word2.replace(/'s$/u, "");
|
|
3866
|
-
if (bare.length > 4 && bare.endsWith("ies"))
|
|
3867
|
-
return `${bare.slice(0, -3)}y`;
|
|
3868
|
-
for (const ending of ["ing", "ed", "es", "s"])
|
|
3869
|
-
if (bare.length - ending.length >= 3 && bare.endsWith(ending))
|
|
3870
|
-
return bare.slice(0, -ending.length);
|
|
3871
|
-
return bare;
|
|
3872
|
-
}, "stem");
|
|
3873
|
-
var sameWord = /* @__PURE__ */ __name((asked, known) => {
|
|
3874
|
-
if (asked === known)
|
|
3875
|
-
return true;
|
|
3876
|
-
const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
|
|
3877
|
-
return short.length >= 3 && long.startsWith(short);
|
|
3878
|
-
}, "sameWord");
|
|
3879
|
-
var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
|
|
3880
|
-
[4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
|
|
3881
|
-
[2, wordsOf(one.title)],
|
|
3882
|
-
[1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
|
|
3883
|
-
].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
|
|
3884
|
-
var search = /* @__PURE__ */ __name((commands, query) => {
|
|
3885
|
-
const named = normal(query);
|
|
3886
|
-
const all = Object.entries(commands);
|
|
3887
|
-
if (!named)
|
|
3888
|
-
return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
|
|
3889
|
-
const words = [
|
|
3890
|
-
...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
|
|
3891
|
-
];
|
|
3892
|
-
return all.map((entry) => {
|
|
3893
|
-
const fields = fieldsOf2(entry[0], entry[1]);
|
|
3894
|
-
const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
|
|
3895
|
-
const matched = weights.filter((weight) => weight > 0).length;
|
|
3896
|
-
const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
|
|
3897
|
-
return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
|
|
3898
|
-
}).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
|
|
3899
|
-
}, "search");
|
|
3900
|
-
var nearest = /* @__PURE__ */ __name((commands, asked) => {
|
|
3901
|
-
const words = normal(asked).split(" ");
|
|
3902
|
-
return Object.keys(commands).map((one) => ({ one, shared: words.filter((word2) => normal(one).split(" ").includes(word2)).length })).filter(({ shared }) => shared > 0).sort((a, b) => b.shared - a.shared).slice(0, 3).map(({ one }) => one);
|
|
3903
|
-
}, "nearest");
|
|
3904
|
-
var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
|
|
3905
|
-
const body = result.structuredContent;
|
|
3906
|
-
if (result.isError || !Array.isArray(body?.next))
|
|
3907
|
-
return result;
|
|
3908
|
-
const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
|
|
3909
|
-
const { next: _, ...rest } = body;
|
|
3910
|
-
const kept = next.length > 0 ? { ...rest, next } : rest;
|
|
3911
|
-
return {
|
|
3912
|
-
...result,
|
|
3913
|
-
structuredContent: kept,
|
|
3914
|
-
content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
|
|
3915
|
-
};
|
|
3916
|
-
}, "runnableOnly");
|
|
3917
|
-
var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
|
|
3918
|
-
var sampleOf = /* @__PURE__ */ __name((commands) => {
|
|
3919
|
-
const reading = Object.entries(commands).filter(([, one]) => !one.writes);
|
|
3920
|
-
const bare = reading.filter(([, one]) => takesNothing(one));
|
|
3921
|
-
return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
|
|
3922
|
-
}, "sampleOf");
|
|
3923
|
-
var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
|
|
3924
|
-
const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
|
|
3925
|
-
const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
|
|
3926
|
-
const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
|
|
3927
|
-
const sample = messenger ? "messages list" : sampleOf(commands);
|
|
3928
|
-
const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
|
|
3929
|
-
server.registerTool(`${prefix}_tools_search`, {
|
|
3930
|
-
outputSchema: toStandardJsonSchema(looseObject({})),
|
|
3931
|
-
title: "Find a command",
|
|
3932
|
-
description: `Find the command for a task \u2014 ${tasks} \u2014 before calling ${prefix}_read or ${prefix}_write with it. Each match gives its command, whether it writes, its arguments and the shape of its answer. With no words, lists every command and title, without arguments.`,
|
|
3933
|
-
inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
|
|
3934
|
-
annotations: { ...READ, openWorldHint: false, idempotentHint: true }
|
|
3935
|
-
}, async ({ query }) => {
|
|
3936
|
-
const found = search(commands, query ?? "");
|
|
3937
|
-
const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
|
|
3938
|
-
command,
|
|
3939
|
-
title: one.title,
|
|
3940
|
-
description: one.description,
|
|
3941
|
-
writes: one.writes,
|
|
3942
|
-
availability: one.availability?.() ?? { available: true },
|
|
3943
|
-
arguments: toJsonSchema(one.input),
|
|
3944
|
-
output: toJsonSchema(one.output ?? ANSWER)
|
|
3945
|
-
})) : found.map(([command, one]) => ({
|
|
3946
|
-
command,
|
|
3947
|
-
title: one.title,
|
|
3948
|
-
writes: one.writes,
|
|
3949
|
-
availability: one.availability?.() ?? { available: true }
|
|
3950
|
-
}));
|
|
3951
|
-
const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
|
|
3952
|
-
items,
|
|
3953
|
-
limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
|
|
3954
|
-
has_more: found.length > items.length
|
|
3955
|
-
});
|
|
3956
|
-
return answered(list);
|
|
3957
|
-
});
|
|
3958
|
-
const callers = {
|
|
3959
|
-
env: process.env,
|
|
3960
|
-
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
3961
|
-
connectionId: randomUUID()
|
|
3962
|
-
};
|
|
3963
|
-
const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
|
|
3964
|
-
try {
|
|
3965
|
-
const command = byNormal.get(normal(asked));
|
|
3966
|
-
const one = command === void 0 ? void 0 : commands[command];
|
|
3967
|
-
if (command === void 0 || !one) {
|
|
3968
|
-
withheld?.(normal(asked));
|
|
3969
|
-
const near = nearest(commands, asked);
|
|
3970
|
-
throw new CliError("validation_error", `no command "${asked}" here${near.length ? ` \u2014 did you mean ${near.map((name) => `"${name}"`).join(", ")}?` : ""}; ${prefix}_tools_search finds one`);
|
|
3971
|
-
}
|
|
3972
|
-
if (one.writes !== writing)
|
|
3973
|
-
throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
|
|
3974
|
-
const args = writing ? agentArguments(given ?? {}) : given ?? {};
|
|
3975
|
-
const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
|
|
3976
|
-
if (one.checked)
|
|
3977
|
-
return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
|
|
3978
|
-
const parsed = safeParse(strictObject(one.input.entries), args);
|
|
3979
|
-
if (!parsed.success)
|
|
3980
|
-
throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
|
|
3981
|
-
arguments: toJsonSchema(one.input)
|
|
3982
|
-
});
|
|
3983
|
-
return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
|
|
3984
|
-
} catch (error) {
|
|
3985
|
-
return failed(error, errors);
|
|
3986
|
-
}
|
|
3987
|
-
}, "runner");
|
|
3988
|
-
const call = strictObject({
|
|
3989
|
-
command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
|
|
3990
|
-
arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
|
|
3991
|
-
});
|
|
3992
|
-
server.registerTool(`${prefix}_read`, {
|
|
3993
|
-
outputSchema: listedAs(prefix, false),
|
|
3994
|
-
title: "Run a reading command",
|
|
3995
|
-
description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
3996
|
-
inputSchema: toStandardJsonSchema(call),
|
|
3997
|
-
annotations: READ
|
|
3998
|
-
}, runner(false));
|
|
3999
|
-
if (Object.values(commands).some((one) => one.writes))
|
|
4000
|
-
server.registerTool(`${prefix}_write`, {
|
|
4001
|
-
outputSchema: listedAs(prefix, true),
|
|
4002
|
-
title: "Run a writing command",
|
|
4003
|
-
description: `Run one command that changes something \u2014 ${messenger ? "sends, edits, deletes, joins" : "creates, edits, deletes"} \u2014 with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
4004
|
-
inputSchema: toStandardJsonSchema(call),
|
|
4005
|
-
annotations: WRITE
|
|
4006
|
-
}, runner(true));
|
|
4007
|
-
}, "registerCommands");
|
|
4008
|
-
var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
|
|
4009
|
-
const run = entryRunner(registration);
|
|
4010
|
-
return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
|
|
4011
|
-
commandOf(key2, definition),
|
|
4012
|
-
{
|
|
4013
|
-
title: definition.title,
|
|
4014
|
-
description: definition.description,
|
|
4015
|
-
writes: definition.annotations.readOnlyHint !== true,
|
|
4016
|
-
input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
|
|
4017
|
-
...definition.output ? { output: outputSchemaOf(definition) } : {},
|
|
4018
|
-
checked: true,
|
|
4019
|
-
run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
|
|
4020
|
-
}
|
|
4021
|
-
]));
|
|
4022
|
-
}, "surfaceCommands");
|
|
4023
|
-
var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
|
|
4024
|
-
|
|
4025
3570
|
export {
|
|
4026
3571
|
toolsFromCommands,
|
|
4027
|
-
runCommandForAgent
|
|
4028
|
-
message,
|
|
4029
|
-
READ,
|
|
4030
|
-
WRITE,
|
|
4031
|
-
tool,
|
|
4032
|
-
chatOf,
|
|
4033
|
-
tierOf,
|
|
4034
|
-
outcomeOf,
|
|
4035
|
-
commandOf,
|
|
4036
|
-
toolKey,
|
|
4037
|
-
Picture,
|
|
4038
|
-
BinaryResource,
|
|
4039
|
-
answered,
|
|
4040
|
-
failed,
|
|
4041
|
-
normal,
|
|
4042
|
-
registerCommands,
|
|
4043
|
-
surfaceCommands,
|
|
4044
|
-
outputOf
|
|
3572
|
+
runCommandForAgent
|
|
4045
3573
|
};
|