@wirecat/zoom-cli 0.80.0 → 0.81.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/contracts/wirecat.json +71 -3
- package/dist/answers.d.ts +44 -0
- package/dist/answers.d.ts.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/agent-VYAJCJLE.js +45 -0
- package/dist/bundle/{all-profiles-5GOKWOT4.js → all-profiles-3ASMN35R.js} +64 -22
- package/dist/bundle/answer-policy-PTH4F2DW.js +129 -0
- package/dist/bundle/{anthropic-NHXMOFYS.js → anthropic-XXI53VNI.js} +6 -6
- package/dist/bundle/{app-server-HFW5Z5PI.js → app-server-B7WLNZNQ.js} +90 -80
- package/dist/bundle/{bun-M5IGY2TG.js → bun-2FLR4IV4.js} +2 -2
- package/dist/bundle/{bun-sqlite-MTP5JJQ2.js → bun-sqlite-3NNHTOGM.js} +7 -7
- package/dist/bundle/{chunk-P2JTVRGU.js → chunk-2ELGSNX3.js} +17 -17
- package/dist/bundle/{chunk-5RVXXDN7.js → chunk-2GNGR265.js} +1 -1
- package/dist/bundle/{chunk-W2QDYMAM.js → chunk-2RFWRJFK.js} +7 -7
- package/dist/bundle/{chunk-4OAR7BGU.js → chunk-2Z7UOXFC.js} +1 -1
- package/dist/bundle/chunk-337ALCXQ.js +640 -0
- package/dist/bundle/{chunk-4F7Q5CET.js → chunk-35FVYRH5.js} +20 -18
- package/dist/bundle/{chunk-HH7GR6TN.js → chunk-3M436OO2.js} +6 -6
- package/dist/bundle/{chunk-5QXQIZJY.js → chunk-3UX4VJWD.js} +1 -1
- package/dist/bundle/{chunk-NRVMK5H3.js → chunk-437DLSB3.js} +1211 -615
- package/dist/bundle/{chunk-L2TURFT6.js → chunk-46EF6P2J.js} +3 -3
- package/dist/bundle/{chunk-GVKZZT7E.js → chunk-4B335BCJ.js} +7 -78
- package/dist/bundle/chunk-4BU3LRTB.js +561 -0
- package/dist/bundle/{chunk-W32HK7KG.js → chunk-4BXLHSXY.js} +2 -2
- package/dist/bundle/{chunk-JGSVWLL2.js → chunk-4FSH7K6N.js} +2 -2
- package/dist/bundle/{chunk-GCUOZ2OA.js → chunk-4VOCXLMJ.js} +6 -6
- package/dist/bundle/{chunk-XL4ND7CZ.js → chunk-4ZXJ4AZW.js} +26 -26
- package/dist/bundle/{chunk-6CDMGT6Q.js → chunk-5EWYDHBH.js} +2 -2
- package/dist/bundle/{chunk-HGSBLY6M.js → chunk-5SEBLX6B.js} +12 -12
- package/dist/bundle/{chunk-TDBVM2SS.js → chunk-77TJ3AJH.js} +3 -3
- package/dist/bundle/{chunk-5XO2AY6D.js → chunk-7JWVPJIP.js} +10 -10
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-AV2ZJ4WX.js} +1 -1
- package/dist/bundle/{chunk-PCPOO5FS.js → chunk-AWJQ6FAX.js} +2 -2
- package/dist/bundle/{chunk-N5YUHN6S.js → chunk-B2WBWKYN.js} +12 -12
- package/dist/bundle/{chunk-W7M4JYEE.js → chunk-BQBC2WIG.js} +1 -1
- package/dist/bundle/{chunk-NXFKZFTC.js → chunk-BZXHJKKI.js} +3 -3
- package/dist/bundle/{chunk-BPSURRAD.js → chunk-C4BBCSGK.js} +43 -64
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-CFQQTDSA.js} +1 -1
- package/dist/bundle/{chunk-2P6MQH4V.js → chunk-D26K6756.js} +6 -6
- package/dist/bundle/{chunk-XKLU5KV2.js → chunk-D7CDHBDX.js} +1 -1
- package/dist/bundle/{chunk-6LY4LBSD.js → chunk-DMJLJVD3.js} +7 -7
- package/dist/bundle/{chunk-K672XJ2P.js → chunk-EEBSKMEA.js} +12 -12
- package/dist/bundle/{chunk-SUG6YGAF.js → chunk-EPASOAEI.js} +166 -161
- package/dist/bundle/{chunk-M4LAF627.js → chunk-EWEQ7AXL.js} +19 -19
- package/dist/bundle/{chunk-ARL2TTPZ.js → chunk-F2J2FQUB.js} +9 -9
- package/dist/bundle/{chunk-RT7C3SSJ.js → chunk-F5ZAN7OC.js} +1 -1
- package/dist/bundle/{chunk-6QCBTBDA.js → chunk-FMMYBVCH.js} +1 -1
- package/dist/bundle/{chunk-EI37UXDR.js → chunk-FXCR4DGU.js} +1 -1
- package/dist/bundle/{chunk-D4HKTC2T.js → chunk-FXZPAGHT.js} +2 -2
- package/dist/bundle/{chunk-CW6CPQHI.js → chunk-G3DWMG7Y.js} +4 -4
- package/dist/bundle/{chunk-W3GZ7JUO.js → chunk-GCAJW4SR.js} +1 -1
- package/dist/bundle/chunk-GDRFVBCB.js +108 -0
- package/dist/bundle/{chunk-A3TUG2DP.js → chunk-GPRJXJC7.js} +15 -1
- package/dist/bundle/chunk-GW2A2FJH.js +209 -0
- package/dist/bundle/{chunk-3Z7CFQTI.js → chunk-HHQROAJQ.js} +1 -1
- package/dist/bundle/{chunk-BRMV33MO.js → chunk-HIFPHARA.js} +4 -4
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-HVXOA4FO.js} +1 -1
- package/dist/bundle/{chunk-ONJPUFLX.js → chunk-IBYGNUO7.js} +1 -1
- package/dist/bundle/{chunk-GGKEQQME.js → chunk-IDUKCXL7.js} +8 -8
- package/dist/bundle/{chunk-5CJ6AAUI.js → chunk-IFM4G4MT.js} +4 -4
- package/dist/bundle/chunk-IVZACJ6X.js +52 -0
- package/dist/bundle/{chunk-XIHENZW6.js → chunk-IYNICUCC.js} +4 -4
- package/dist/bundle/chunk-J5EHZBO5.js +68 -0
- package/dist/bundle/{chunk-FIJREKLA.js → chunk-JK24A3RP.js} +3 -3
- package/dist/bundle/{chunk-TNL3YQ33.js → chunk-JKEMW6E4.js} +2 -2
- package/dist/bundle/{chunk-3AOESMW6.js → chunk-K7CTCDYX.js} +18 -259
- package/dist/bundle/{chunk-OXPHJEJ2.js → chunk-KZ3B6HW5.js} +3 -3
- package/dist/bundle/{chunk-E3JVLVVB.js → chunk-L2ERFXB7.js} +30 -28
- package/dist/bundle/{chunk-DZ6H3YJH.js → chunk-L54I45OX.js} +19 -16
- package/dist/bundle/{chunk-475P3LWG.js → chunk-LECMHK2F.js} +1 -1
- package/dist/bundle/{chunk-6PIXP5IH.js → chunk-LGESUPKO.js} +20 -20
- package/dist/bundle/{chunk-75JW7X2W.js → chunk-LVCCZI5A.js} +71 -61
- package/dist/bundle/chunk-M7OYEMLI.js +340 -0
- package/dist/bundle/{chunk-O4ZBFATF.js → chunk-MA4UJNUI.js} +12 -12
- package/dist/bundle/{chunk-RFXJLG5V.js → chunk-MBBR7QHI.js} +3377 -2720
- package/dist/bundle/{chunk-BNEJKGG7.js → chunk-N5ROXGY4.js} +78 -76
- package/dist/bundle/{chunk-BW5JEOBE.js → chunk-N62P5FY4.js} +12 -12
- package/dist/bundle/{chunk-5K54M6RD.js → chunk-NM5XMKWO.js} +1 -1
- package/dist/bundle/{chunk-EMYRUJCV.js → chunk-NQGGTO3B.js} +8 -8
- package/dist/bundle/{chunk-7U5X37TE.js → chunk-NS3JWBDR.js} +6 -6
- package/dist/bundle/{chunk-QIK2IBJ4.js → chunk-NX3BLISW.js} +23 -7
- package/dist/bundle/{chunk-2XZ2YKW4.js → chunk-OEQNP56V.js} +2 -100
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-GCPO7T2X.js → chunk-PS7HQ5LQ.js} +3 -3
- package/dist/bundle/{chunk-MH4L5LL6.js → chunk-Q26UFIH4.js} +3 -3
- package/dist/bundle/{chunk-JXSEH64A.js → chunk-QFK52FG6.js} +3 -3
- package/dist/bundle/chunk-QNG27PGH.js +751 -0
- package/dist/bundle/{chunk-YR5TRWT2.js → chunk-R4CXFYQN.js} +139 -574
- package/dist/bundle/{chunk-YAA2D6RP.js → chunk-R6HP2XKD.js} +5 -5
- package/dist/bundle/{chunk-CHEHK6IW.js → chunk-RQFRXUI4.js} +77 -67
- package/dist/bundle/{chunk-CWCDCNXA.js → chunk-RRYHLP3A.js} +6 -6
- package/dist/bundle/{chunk-EPIA2UUM.js → chunk-SRUAUMBL.js} +12 -12
- package/dist/bundle/{chunk-TMYZKDQ7.js → chunk-T2BHIC37.js} +65 -65
- package/dist/bundle/{chunk-FSLR2YGR.js → chunk-T7QPZYRZ.js} +7 -7
- package/dist/bundle/{chunk-PKW3TPNP.js → chunk-TI4WJOEX.js} +13 -13
- package/dist/bundle/{chunk-ST3ZB7LS.js → chunk-UHMJSSQO.js} +1 -1
- package/dist/bundle/{chunk-GRYXOSN6.js → chunk-UMPUY77T.js} +10 -10
- package/dist/bundle/{chunk-Q5LUGY2V.js → chunk-UPR2S5IE.js} +9 -9
- package/dist/bundle/chunk-UUVWAVKN.js +80 -0
- package/dist/bundle/{chunk-DYRISFHZ.js → chunk-V3ZTAAJ6.js} +19 -9
- package/dist/bundle/{chunk-Q6MISDKJ.js → chunk-VAW7QGJA.js} +3 -3
- package/dist/bundle/{chunk-L6FM5RQY.js → chunk-VQTYJ6XH.js} +3 -3
- package/dist/bundle/{chunk-BIKHHFD2.js → chunk-VXD65V67.js} +1395 -1529
- package/dist/bundle/{chunk-XTCAWNBP.js → chunk-WHXYPLUE.js} +4 -4
- package/dist/bundle/chunk-WIX6BFRF.js +353 -0
- package/dist/bundle/{chunk-JJX4HKDV.js → chunk-WKNYNK7W.js} +4 -4
- package/dist/bundle/{chunk-NMETTKCV.js → chunk-XWKUGAG6.js} +14 -14
- package/dist/bundle/{chunk-3UONR5HW.js → chunk-XYQVVW4R.js} +1 -1
- package/dist/bundle/{chunk-RMX2WPWS.js → chunk-Y7XJA4EW.js} +4 -4
- package/dist/bundle/{chunk-Z3CPZ4I4.js → chunk-YIIGF643.js} +306 -306
- package/dist/bundle/{chunk-PMO2Z6DQ.js → chunk-YISJJNXT.js} +3 -3
- package/dist/bundle/{chunk-UX4JZMA4.js → chunk-YJKXCINQ.js} +28 -3
- package/dist/bundle/{chunk-U5N2PKKM.js → chunk-YNWBRDBX.js} +2 -2
- package/dist/bundle/{chunk-ZPZT46O6.js → chunk-YRDQ54G5.js} +33 -10
- package/dist/bundle/{chunk-VN7TKMOW.js → chunk-YUDVRFXN.js} +1 -1
- package/dist/bundle/{chunk-6I4C4ZFT.js → chunk-ZFRYFDZN.js} +2 -2
- package/dist/bundle/{chunk-IQWBGMCR.js → chunk-ZLYICF6A.js} +4 -4
- package/dist/bundle/{chunk-G5VH4WUF.js → chunk-ZMAPXIGC.js} +2 -2
- package/dist/bundle/{chunk-6MDL2LZA.js → chunk-ZNAX7GUV.js} +8 -8
- package/dist/bundle/{cli-QNBYDOKV.js → cli-WTGAGSXV.js} +142 -97
- package/dist/bundle/command-contract-3IKVWPDL.js +45 -0
- package/dist/bundle/{command-server-entry-WMA4SWJ5.js → command-server-entry-47CAYN3E.js} +35 -35
- package/dist/bundle/config-ZOGOKGTU.js +116 -0
- package/dist/bundle/{decode-7PXUXNIP.js → decode-2G7QS5IQ.js} +6 -6
- package/dist/bundle/{dispatch-AWDROXWN.js → dispatch-ZAP3KBVJ.js} +9 -9
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{dist-TSBH4FOU.js → dist-WY6R3WH7.js} +21 -21
- package/dist/bundle/{echarts-WIDIUEO6.js → echarts-YRRVLEX3.js} +2 -2
- package/dist/bundle/{embed-EIRVQF5E.js → embed-B5H3OW2O.js} +7 -7
- package/dist/bundle/{embedder-MXPM6OXK.js → embedder-3O73SP6Y.js} +10 -10
- package/dist/bundle/{failure-JZW73RP7.js → failure-EYGW7JMC.js} +3 -3
- package/dist/bundle/first-run-MPKMDEMA.js +29 -0
- package/dist/bundle/first-screen-AIAAC3KF.js +45 -0
- package/dist/bundle/{folders-TGFOE7DY.js → folders-4CGFWM6H.js} +5 -5
- package/dist/bundle/{instructions-D5LNE6NJ.js → instructions-AG7SRWTR.js} +1 -1
- package/dist/bundle/{main-OHW5Z56X.js → main-DOGY6FJP.js} +24 -24
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-YGOAUNC3.js} +2 -2
- package/dist/bundle/meeting-combined-YKPKTKGA.js +26 -0
- package/dist/bundle/meeting-model-HTXSGHNM.js +26 -0
- package/dist/bundle/{meeting-semantic-FYOVY4S2.js → meeting-semantic-FOEBWV3P.js} +8 -8
- package/dist/bundle/{meetings-WI4SXPBJ.js → meetings-PVE4C2NF.js} +7 -7
- package/dist/bundle/{node-UEWUFR7N.js → node-GJQYN4FT.js} +2 -2
- package/dist/bundle/{node-sqlite-FJWKJHYU.js → node-sqlite-MLRYKVCQ.js} +8 -8
- package/dist/bundle/oauth-AC55C6SG.js +20 -0
- package/dist/bundle/{open-EFYTWUGC.js → open-3LGTYP6M.js} +6 -6
- package/dist/bundle/openai-E2MSLVIX.js +28 -0
- package/dist/bundle/{output-file-J4SU6X4I.js → output-file-FXMTTLOI.js} +6 -6
- package/dist/bundle/{process-U5PLNIDC.js → process-MEKCZMX3.js} +1 -1
- package/dist/bundle/{program-3JICCSA6.js → program-E5BSSIGY.js} +164 -155
- package/dist/bundle/{prompt-YPDMSOKC.js → prompt-AIA6QSZK.js} +6 -6
- package/dist/bundle/{recognize-Z2SSWUKH.js → recognize-M57VNTEV.js} +5 -5
- package/dist/bundle/{remote-R5HMDHOG.js → remote-3OTENZ7Z.js} +11 -11
- package/dist/bundle/{rerank-6NGBEMQ2.js → rerank-P5WHDFDU.js} +8 -8
- package/dist/bundle/run-log-EOQ4EQDS.js +143 -0
- package/dist/bundle/{serve-CU3RMWU7.js → serve-BRLC2QVV.js} +11 -11
- package/dist/bundle/{server-SOQSVX2Q.js → server-25NF7DMS.js} +80 -69
- package/dist/bundle/server-EW2RL2EL.js +93 -0
- package/dist/bundle/{services-LROZ3RDT.js → services-MJE43OGD.js} +54 -52
- package/dist/bundle/{speech-AS77HFIF.js → speech-4AVCWTQH.js} +28 -28
- package/dist/bundle/{sqlite-runtime-U25NS6BK.js → sqlite-runtime-U4TQXWMC.js} +7 -7
- package/dist/bundle/{state-CPEVKK66.js → state-GNUGVMY7.js} +7 -7
- package/dist/bundle/{store-6CHRMJM7.js → store-KBFZVQWF.js} +31 -24
- package/dist/bundle/{store-QKHCZOYR.js → store-MHVBFUBB.js} +27 -26
- package/dist/bundle/store-connection-SKRUAI4L.js +109 -0
- package/dist/bundle/store-maintenance-command-G6EXJSHJ.js +81 -0
- package/dist/bundle/{streaming-VDJOYGMO.js → streaming-6F7AFEHD.js} +7 -7
- package/dist/bundle/surface-DWEWB5RG.js +79 -0
- package/dist/bundle/{tokens-JBN2OHQB.js → tokens-BB4MQBLH.js} +11 -10
- package/dist/bundle/zm.js +9 -9
- package/dist/bundle/{zoom-app-Q4IKYNG3.js → zoom-app-YTGOZ2FS.js} +8 -8
- package/dist/commands.d.ts +1 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +8 -2
- package/dist/commands.js.map +1 -1
- package/dist/setup-commands.d.ts +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +31 -5
- package/dist/setup-commands.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/zoom-api/types.d.ts +5 -0
- package/dist/zoom-api/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/bundle/answer-policy-7PYXHK2I.js +0 -122
- package/dist/bundle/chunk-3BTRJYIT.js +0 -729
- package/dist/bundle/command-contract-CT6MV6YG.js +0 -45
- package/dist/bundle/config-ZFQFDEVL.js +0 -109
- package/dist/bundle/first-run-K6EHRAIM.js +0 -29
- package/dist/bundle/first-screen-C6AF4KT4.js +0 -45
- package/dist/bundle/meeting-combined-3OKFXZNA.js +0 -26
- package/dist/bundle/meeting-model-4XNF725D.js +0 -26
- package/dist/bundle/oauth-KOONTGLW.js +0 -20
- package/dist/bundle/openai-6Y2JRDNY.js +0 -28
- package/dist/bundle/run-log-LG3TI3WI.js +0 -136
- package/dist/bundle/server-X7JYRMKX.js +0 -85
- package/dist/bundle/store-connection-FCDVOPWB.js +0 -102
- package/dist/bundle/store-maintenance-command-6HVOAHOZ.js +0 -77
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
UNTRUSTED,
|
|
5
|
+
UNTRUSTED_NEUTRAL,
|
|
6
|
+
agentArguments,
|
|
7
|
+
agentJson
|
|
8
|
+
} from "./chunk-GW2A2FJH.js";
|
|
9
|
+
import {
|
|
10
|
+
callerOf
|
|
11
|
+
} from "./chunk-GDRFVBCB.js";
|
|
12
|
+
import {
|
|
13
|
+
refuseLacking
|
|
14
|
+
} from "./chunk-J5EHZBO5.js";
|
|
15
|
+
import {
|
|
16
|
+
onlineDeps,
|
|
17
|
+
servicesFor,
|
|
18
|
+
storeModeDeps
|
|
19
|
+
} from "./chunk-MBBR7QHI.js";
|
|
20
|
+
import {
|
|
21
|
+
failureContext
|
|
22
|
+
} from "./chunk-YJKXCINQ.js";
|
|
23
|
+
import {
|
|
24
|
+
DEFAULT_OUTPUT_BYTES,
|
|
25
|
+
ENTITIES,
|
|
26
|
+
LOCAL_WRITE,
|
|
27
|
+
REMOTE_WRITE,
|
|
28
|
+
answerSchema,
|
|
29
|
+
judgedAnswer,
|
|
30
|
+
judgedEffects,
|
|
31
|
+
listOf,
|
|
32
|
+
refuseStoreChange,
|
|
33
|
+
sealed,
|
|
34
|
+
startRecording
|
|
35
|
+
} from "./chunk-EPASOAEI.js";
|
|
36
|
+
import {
|
|
37
|
+
currentCaller,
|
|
38
|
+
keepsSuccess,
|
|
39
|
+
runContextOf,
|
|
40
|
+
withCaller
|
|
41
|
+
} from "./chunk-T7QPZYRZ.js";
|
|
42
|
+
import {
|
|
43
|
+
fetchesAt,
|
|
44
|
+
keyForCommand,
|
|
45
|
+
levelFor,
|
|
46
|
+
readKeysForCommand
|
|
47
|
+
} from "./chunk-V3ZTAAJ6.js";
|
|
48
|
+
import {
|
|
49
|
+
MAX_BUFFERED_INPUT
|
|
50
|
+
} from "./chunk-5EWYDHBH.js";
|
|
51
|
+
import {
|
|
52
|
+
inRun,
|
|
53
|
+
newRunId
|
|
54
|
+
} from "./chunk-D26K6756.js";
|
|
55
|
+
import {
|
|
56
|
+
storeDamaged
|
|
57
|
+
} from "./chunk-ZFRYFDZN.js";
|
|
58
|
+
import {
|
|
59
|
+
traceIdOf
|
|
60
|
+
} from "./chunk-N5ROXGY4.js";
|
|
61
|
+
import {
|
|
62
|
+
array,
|
|
63
|
+
boolean,
|
|
64
|
+
description,
|
|
65
|
+
errorObjectOf,
|
|
66
|
+
integer,
|
|
67
|
+
itemEnvelopeSchema,
|
|
68
|
+
listEnvelopeSchema,
|
|
69
|
+
looseObject,
|
|
70
|
+
maxLength,
|
|
71
|
+
maxValue,
|
|
72
|
+
mcpErrorResult,
|
|
73
|
+
minLength,
|
|
74
|
+
minValue,
|
|
75
|
+
number,
|
|
76
|
+
optional,
|
|
77
|
+
pipe,
|
|
78
|
+
record,
|
|
79
|
+
regex,
|
|
80
|
+
safeParse,
|
|
81
|
+
strictObject,
|
|
82
|
+
string,
|
|
83
|
+
summarize,
|
|
84
|
+
toJsonSchema,
|
|
85
|
+
toStandardJsonSchema,
|
|
86
|
+
unknown
|
|
87
|
+
} from "./chunk-YRDQ54G5.js";
|
|
88
|
+
import {
|
|
89
|
+
CliError,
|
|
90
|
+
errorCodes
|
|
91
|
+
} from "./chunk-UHMJSSQO.js";
|
|
92
|
+
import {
|
|
93
|
+
__name
|
|
94
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
95
|
+
|
|
96
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/surface.js
|
|
97
|
+
import { randomUUID } from "node:crypto";
|
|
98
|
+
|
|
99
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/tool.js
|
|
100
|
+
var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
|
|
101
|
+
var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
|
|
102
|
+
var message = pipe(
|
|
103
|
+
string(),
|
|
104
|
+
maxLength(256),
|
|
105
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
|
|
106
|
+
regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
|
|
107
|
+
description("message id")
|
|
108
|
+
);
|
|
109
|
+
var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
110
|
+
var WRITE = {
|
|
111
|
+
readOnlyHint: false,
|
|
112
|
+
destructiveHint: true,
|
|
113
|
+
idempotentHint: false,
|
|
114
|
+
openWorldHint: true
|
|
115
|
+
};
|
|
116
|
+
var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
|
|
117
|
+
var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
|
|
118
|
+
var tierOf = /* @__PURE__ */ __name((key, definition, messenger) => {
|
|
119
|
+
if (definition.annotations.readOnlyHint === true)
|
|
120
|
+
return "read";
|
|
121
|
+
if (/^admin|_admin/.test(key))
|
|
122
|
+
return "admin";
|
|
123
|
+
if (/delete|ban|kick|remove|purge|block/.test(key))
|
|
124
|
+
return "destructive";
|
|
125
|
+
if (/draft/.test(key))
|
|
126
|
+
return "draft";
|
|
127
|
+
if (key === "messages_pin" && messenger?.quietPins === false)
|
|
128
|
+
return "write-public";
|
|
129
|
+
if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key))
|
|
130
|
+
return "write-private";
|
|
131
|
+
return "write-public";
|
|
132
|
+
}, "tierOf");
|
|
133
|
+
var effectsOf = /* @__PURE__ */ __name((definition) => {
|
|
134
|
+
if (definition.effects)
|
|
135
|
+
return definition.effects;
|
|
136
|
+
const { readOnlyHint, openWorldHint } = definition.annotations;
|
|
137
|
+
if (readOnlyHint === true)
|
|
138
|
+
return { remote: openWorldHint === false ? "none" : "read", local: "read" };
|
|
139
|
+
return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
|
|
140
|
+
}, "effectsOf");
|
|
141
|
+
var outcomeOf = /* @__PURE__ */ __name((result) => {
|
|
142
|
+
if (!result.isError)
|
|
143
|
+
return { status: "ok" };
|
|
144
|
+
const code = result.structuredContent?.error?.code;
|
|
145
|
+
const error = typeof code === "string" ? code : "generic_failure";
|
|
146
|
+
return { status: error === "permission_error" ? "refused" : "failed", error };
|
|
147
|
+
}, "outcomeOf");
|
|
148
|
+
var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
|
|
149
|
+
var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
|
|
150
|
+
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");
|
|
151
|
+
var syncAllowedFor = /* @__PURE__ */ __name((key, defaults) => {
|
|
152
|
+
const permissions = defaults.settings.permissions ?? {};
|
|
153
|
+
const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
|
|
154
|
+
return shared && (!key.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key.replaceAll("_", ".")}.sync-first`).level));
|
|
155
|
+
}, "syncAllowedFor");
|
|
156
|
+
var entryRunner = /* @__PURE__ */ __name((registration) => {
|
|
157
|
+
const run = callRunner(registration);
|
|
158
|
+
const { log } = registration;
|
|
159
|
+
return async (key, definition, args, ctx) => {
|
|
160
|
+
const startedAt = Date.now();
|
|
161
|
+
const command = `mcp ${commandOf(key, definition)}`;
|
|
162
|
+
const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
|
|
163
|
+
const app = registration.messenger?.app;
|
|
164
|
+
const caller = registration.callers ? callerOf(ctx, key, registration.callers) : currentCaller();
|
|
165
|
+
const env = registration.defaults.env ?? process.env;
|
|
166
|
+
const settings = registration.defaults.settings;
|
|
167
|
+
const recording = key !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
|
|
168
|
+
app,
|
|
169
|
+
command,
|
|
170
|
+
...settings.profile === void 0 ? {} : { profile: settings.profile },
|
|
171
|
+
env,
|
|
172
|
+
record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
|
|
173
|
+
keepFailed: true,
|
|
174
|
+
trace: false,
|
|
175
|
+
format: "json",
|
|
176
|
+
context: runContextOf({ bin: app.command, command, env, caller }),
|
|
177
|
+
...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
|
|
178
|
+
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
179
|
+
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
180
|
+
...traceId === void 0 ? {} : { traceId }
|
|
181
|
+
}) : void 0;
|
|
182
|
+
const profile = registration.defaults.settings.profile;
|
|
183
|
+
const scope = {
|
|
184
|
+
runId: recording?.runId ?? newRunId(new Date(startedAt), command),
|
|
185
|
+
command,
|
|
186
|
+
startedAt,
|
|
187
|
+
...profile === void 0 ? {} : { profile },
|
|
188
|
+
...traceId === void 0 ? {} : { traceId },
|
|
189
|
+
...recording ? { events: recording.events } : {}
|
|
190
|
+
};
|
|
191
|
+
const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
|
|
192
|
+
const input = inputOf(definition, syncAllowedFor(key, registration.defaults));
|
|
193
|
+
const parsed = safeParse(input, args);
|
|
194
|
+
return parsed.success ? run(key, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key, definition)}: ${summarize(parsed.issues)}`, {
|
|
195
|
+
arguments: toJsonSchema(input)
|
|
196
|
+
}), app?.errors);
|
|
197
|
+
}), "work");
|
|
198
|
+
const result = await (caller ? withCaller(caller, work) : work());
|
|
199
|
+
if (recording) {
|
|
200
|
+
if (result.isError) {
|
|
201
|
+
const error = result.structuredContent?.error;
|
|
202
|
+
const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
|
|
203
|
+
await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
|
|
204
|
+
} else
|
|
205
|
+
await recording.succeed(result.structuredContent).catch(() => void 0);
|
|
206
|
+
}
|
|
207
|
+
await log?.({
|
|
208
|
+
tool: key,
|
|
209
|
+
tier: tierOf(key, definition, registration.messenger),
|
|
210
|
+
...outcomeOf(result),
|
|
211
|
+
startedAt,
|
|
212
|
+
finishedAt: Date.now()
|
|
213
|
+
}, caller)?.catch(() => void 0);
|
|
214
|
+
return result;
|
|
215
|
+
};
|
|
216
|
+
}, "entryRunner");
|
|
217
|
+
var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
|
|
218
|
+
const where = {
|
|
219
|
+
profile: defaults.settings.profile,
|
|
220
|
+
env: defaults.env,
|
|
221
|
+
pictures: defaults.settings.pictureSearch,
|
|
222
|
+
reranker: defaults.settings.searchReranker
|
|
223
|
+
};
|
|
224
|
+
return async (key, definition, args, ctx) => {
|
|
225
|
+
const path = commandOf(key, definition).split(" ");
|
|
226
|
+
const run = `mcp ${path.join(" ")}`;
|
|
227
|
+
try {
|
|
228
|
+
const execute = /* @__PURE__ */ __name(async () => {
|
|
229
|
+
const syncAllowed = syncAllowedFor(key, defaults);
|
|
230
|
+
if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
|
|
231
|
+
throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
|
|
232
|
+
reason: "input.too-large",
|
|
233
|
+
max_bytes: MAX_BUFFERED_INPUT,
|
|
234
|
+
retryable: false
|
|
235
|
+
});
|
|
236
|
+
definition.check?.(args);
|
|
237
|
+
if (definition.changesStore)
|
|
238
|
+
refuseStoreChange(messenger.app, defaults.env);
|
|
239
|
+
refuseLacking(messenger, path);
|
|
240
|
+
for (const permission of readKeysForCommand(path)) {
|
|
241
|
+
if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
|
|
242
|
+
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
243
|
+
}
|
|
244
|
+
if (args.sync_first && !syncAllowed)
|
|
245
|
+
throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
|
|
246
|
+
if (definition.custom) {
|
|
247
|
+
const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
|
|
248
|
+
return answered(result2, definition.outputLimit?.(args, defaults), targets);
|
|
249
|
+
}
|
|
250
|
+
if (definition.local)
|
|
251
|
+
return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
|
|
252
|
+
const { online, stored: local, served } = definition;
|
|
253
|
+
const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
|
|
254
|
+
const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
|
|
255
|
+
name: run
|
|
256
|
+
}) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
|
|
257
|
+
...storeModeDeps(messenger, store, account, defaults.guard),
|
|
258
|
+
...where,
|
|
259
|
+
embedders: defaults.embedders
|
|
260
|
+
}), args, defaults, (work) => session.use(run, async (adapter, release) => {
|
|
261
|
+
try {
|
|
262
|
+
return await work(adapter);
|
|
263
|
+
} finally {
|
|
264
|
+
await release();
|
|
265
|
+
}
|
|
266
|
+
})), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
|
|
267
|
+
try {
|
|
268
|
+
return await work(adapter);
|
|
269
|
+
} finally {
|
|
270
|
+
await release();
|
|
271
|
+
}
|
|
272
|
+
})())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
|
|
273
|
+
return answered(result, definition.outputLimit?.(args, defaults), targets);
|
|
274
|
+
}, "execute");
|
|
275
|
+
return around ? await around(key, definition, execute) : await execute();
|
|
276
|
+
} catch (error) {
|
|
277
|
+
return failed(error, messenger?.app?.errors, effectsOf(definition));
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}, "callRunner");
|
|
281
|
+
var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
|
|
282
|
+
if (!definition.output)
|
|
283
|
+
return looseObject({});
|
|
284
|
+
const entity = ENTITIES[definition.output.entity];
|
|
285
|
+
return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
|
|
286
|
+
}, "outputSchemaOf");
|
|
287
|
+
var Picture = class {
|
|
288
|
+
static {
|
|
289
|
+
__name(this, "Picture");
|
|
290
|
+
}
|
|
291
|
+
bytes;
|
|
292
|
+
mimeType;
|
|
293
|
+
about;
|
|
294
|
+
constructor(bytes, mimeType, about) {
|
|
295
|
+
this.bytes = bytes;
|
|
296
|
+
this.mimeType = mimeType;
|
|
297
|
+
this.about = about;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
var BinaryResource = class {
|
|
301
|
+
static {
|
|
302
|
+
__name(this, "BinaryResource");
|
|
303
|
+
}
|
|
304
|
+
base64;
|
|
305
|
+
mimeType;
|
|
306
|
+
uri;
|
|
307
|
+
about;
|
|
308
|
+
constructor(base64, mimeType, uri, about) {
|
|
309
|
+
this.base64 = base64;
|
|
310
|
+
this.mimeType = mimeType;
|
|
311
|
+
this.uri = uri;
|
|
312
|
+
this.about = about;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
|
|
316
|
+
const bounded = /* @__PURE__ */ __name((result) => {
|
|
317
|
+
if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
|
|
318
|
+
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 });
|
|
319
|
+
return result;
|
|
320
|
+
}, "bounded");
|
|
321
|
+
if (answer === null || Array.isArray(answer) || typeof answer !== "object")
|
|
322
|
+
throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
|
|
323
|
+
const objectBody = /* @__PURE__ */ __name((value) => {
|
|
324
|
+
const serialized = JSON.parse(agentJson(value));
|
|
325
|
+
if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
|
|
326
|
+
throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
|
|
327
|
+
return serialized;
|
|
328
|
+
}, "objectBody");
|
|
329
|
+
if (answer instanceof BinaryResource) {
|
|
330
|
+
const about = sealed(answer.about);
|
|
331
|
+
return bounded({
|
|
332
|
+
structuredContent: objectBody(about),
|
|
333
|
+
content: [
|
|
334
|
+
{ type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
|
|
335
|
+
{ type: "text", text: agentJson(about) }
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (answer instanceof Picture) {
|
|
340
|
+
const about = sealed(answer.about);
|
|
341
|
+
return bounded({
|
|
342
|
+
structuredContent: objectBody(about),
|
|
343
|
+
content: [
|
|
344
|
+
{ type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
|
|
345
|
+
{ type: "text", text: agentJson(about) }
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
|
|
350
|
+
return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
|
|
351
|
+
}, "answered");
|
|
352
|
+
var failed = /* @__PURE__ */ __name((error, errors, effects) => {
|
|
353
|
+
const judged = judgedEffects(effects);
|
|
354
|
+
const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
|
|
355
|
+
return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
|
|
356
|
+
}, "failed");
|
|
357
|
+
|
|
358
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/mcp/surface.js
|
|
359
|
+
var MATCHES = 8;
|
|
360
|
+
var ANSWER = answerSchema();
|
|
361
|
+
var agentAnswer = /* @__PURE__ */ __name((prefix, writes) => {
|
|
362
|
+
const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
|
|
363
|
+
const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
|
|
364
|
+
return looseObject(writes ? { item: optional(unknown()), next, meta } : {
|
|
365
|
+
items: optional(array(unknown())),
|
|
366
|
+
item: optional(unknown()),
|
|
367
|
+
page: optional(looseObject({ has_more: boolean() })),
|
|
368
|
+
next,
|
|
369
|
+
missing: optional(array(looseObject({ field: string(), why: string() }))),
|
|
370
|
+
meta
|
|
371
|
+
});
|
|
372
|
+
}, "agentAnswer");
|
|
373
|
+
var listedAs = /* @__PURE__ */ __name((prefix, writes) => {
|
|
374
|
+
const checked = toStandardJsonSchema(ANSWER);
|
|
375
|
+
const shown = toStandardJsonSchema(agentAnswer(prefix, writes))["~standard"].jsonSchema;
|
|
376
|
+
return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
|
|
377
|
+
}, "listedAs");
|
|
378
|
+
var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
|
|
379
|
+
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(" "));
|
|
380
|
+
var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
|
|
381
|
+
var stem = /* @__PURE__ */ __name((word) => {
|
|
382
|
+
const bare = word.replace(/'s$/u, "");
|
|
383
|
+
if (bare.length > 4 && bare.endsWith("ies"))
|
|
384
|
+
return `${bare.slice(0, -3)}y`;
|
|
385
|
+
for (const ending of ["ing", "ed", "es", "s"])
|
|
386
|
+
if (bare.length - ending.length >= 3 && bare.endsWith(ending))
|
|
387
|
+
return bare.slice(0, -ending.length);
|
|
388
|
+
return bare;
|
|
389
|
+
}, "stem");
|
|
390
|
+
var sameWord = /* @__PURE__ */ __name((asked, known) => {
|
|
391
|
+
if (asked === known)
|
|
392
|
+
return true;
|
|
393
|
+
const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
|
|
394
|
+
return short.length >= 3 && long.startsWith(short);
|
|
395
|
+
}, "sameWord");
|
|
396
|
+
var fieldsOf = /* @__PURE__ */ __name((command, one) => [
|
|
397
|
+
[4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
|
|
398
|
+
[2, wordsOf(one.title)],
|
|
399
|
+
[1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
|
|
400
|
+
].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
|
|
401
|
+
var search = /* @__PURE__ */ __name((commands, query) => {
|
|
402
|
+
const named = normal(query);
|
|
403
|
+
const all = Object.entries(commands);
|
|
404
|
+
if (!named)
|
|
405
|
+
return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
|
|
406
|
+
const words = [
|
|
407
|
+
...new Set(wordsOf(query).filter((word) => word.length > 1 && !STOP_WORDS.has(word)).map(stem))
|
|
408
|
+
];
|
|
409
|
+
return all.map((entry) => {
|
|
410
|
+
const fields = fieldsOf(entry[0], entry[1]);
|
|
411
|
+
const weights = words.map((word) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word, one)) ? Math.max(best, weight) : best, 0));
|
|
412
|
+
const matched = weights.filter((weight) => weight > 0).length;
|
|
413
|
+
const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
|
|
414
|
+
return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
|
|
415
|
+
}).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || wordsOf(a.entry[0]).length - wordsOf(b.entry[0]).length || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
|
|
416
|
+
}, "search");
|
|
417
|
+
var nearest = /* @__PURE__ */ __name((commands, asked) => {
|
|
418
|
+
const words = normal(asked).split(" ");
|
|
419
|
+
return Object.keys(commands).map((one) => ({ one, shared: words.filter((word) => normal(one).split(" ").includes(word)).length })).filter(({ shared }) => shared > 0).sort((a, b) => b.shared - a.shared).slice(0, 3).map(({ one }) => one);
|
|
420
|
+
}, "nearest");
|
|
421
|
+
var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
|
|
422
|
+
const body = result.structuredContent;
|
|
423
|
+
if (result.isError || !Array.isArray(body?.next))
|
|
424
|
+
return result;
|
|
425
|
+
const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
|
|
426
|
+
const { next: _, ...rest } = body;
|
|
427
|
+
const kept = next.length > 0 ? { ...rest, next } : rest;
|
|
428
|
+
return {
|
|
429
|
+
...result,
|
|
430
|
+
structuredContent: kept,
|
|
431
|
+
content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
|
|
432
|
+
};
|
|
433
|
+
}, "runnableOnly");
|
|
434
|
+
var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
|
|
435
|
+
var sampleOf = /* @__PURE__ */ __name((commands) => {
|
|
436
|
+
const reading = Object.entries(commands).filter(([, one]) => !one.writes);
|
|
437
|
+
const bare = reading.filter(([, one]) => takesNothing(one));
|
|
438
|
+
return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
|
|
439
|
+
}, "sampleOf");
|
|
440
|
+
var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
|
|
441
|
+
const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
|
|
442
|
+
const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
|
|
443
|
+
const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
|
|
444
|
+
const sample = messenger ? "messages list" : sampleOf(commands);
|
|
445
|
+
const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
|
|
446
|
+
server.registerTool(`${prefix}_tools_search`, {
|
|
447
|
+
outputSchema: toStandardJsonSchema(looseObject({})),
|
|
448
|
+
title: "Find a command",
|
|
449
|
+
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.`,
|
|
450
|
+
inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
|
|
451
|
+
annotations: { ...READ, openWorldHint: false, idempotentHint: true }
|
|
452
|
+
}, async ({ query }) => {
|
|
453
|
+
const found = search(commands, query ?? "");
|
|
454
|
+
const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
|
|
455
|
+
command,
|
|
456
|
+
title: one.title,
|
|
457
|
+
description: one.description,
|
|
458
|
+
writes: one.writes,
|
|
459
|
+
availability: one.availability?.() ?? { available: true },
|
|
460
|
+
arguments: toJsonSchema(one.input),
|
|
461
|
+
output: toJsonSchema(one.output ?? ANSWER)
|
|
462
|
+
})) : found.map(([command, one]) => ({
|
|
463
|
+
command,
|
|
464
|
+
title: one.title,
|
|
465
|
+
writes: one.writes,
|
|
466
|
+
availability: one.availability?.() ?? { available: true }
|
|
467
|
+
}));
|
|
468
|
+
const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
|
|
469
|
+
items,
|
|
470
|
+
limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
|
|
471
|
+
has_more: found.length > items.length
|
|
472
|
+
});
|
|
473
|
+
return answered(list);
|
|
474
|
+
});
|
|
475
|
+
const callers = {
|
|
476
|
+
env: process.env,
|
|
477
|
+
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
478
|
+
connectionId: randomUUID()
|
|
479
|
+
};
|
|
480
|
+
const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
|
|
481
|
+
try {
|
|
482
|
+
const command = byNormal.get(normal(asked));
|
|
483
|
+
const one = command === void 0 ? void 0 : commands[command];
|
|
484
|
+
if (command === void 0 || !one) {
|
|
485
|
+
withheld?.(normal(asked));
|
|
486
|
+
const near = nearest(commands, asked);
|
|
487
|
+
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`);
|
|
488
|
+
}
|
|
489
|
+
if (one.writes !== writing)
|
|
490
|
+
throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
|
|
491
|
+
const args = writing ? agentArguments(given ?? {}) : given ?? {};
|
|
492
|
+
const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
|
|
493
|
+
if (one.checked)
|
|
494
|
+
return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
|
|
495
|
+
const parsed = safeParse(strictObject(one.input.entries), args);
|
|
496
|
+
if (!parsed.success)
|
|
497
|
+
throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
|
|
498
|
+
arguments: toJsonSchema(one.input)
|
|
499
|
+
});
|
|
500
|
+
return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
|
|
501
|
+
} catch (error) {
|
|
502
|
+
return failed(error, errors);
|
|
503
|
+
}
|
|
504
|
+
}, "runner");
|
|
505
|
+
const call = strictObject({
|
|
506
|
+
command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
|
|
507
|
+
arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
|
|
508
|
+
});
|
|
509
|
+
server.registerTool(`${prefix}_read`, {
|
|
510
|
+
outputSchema: listedAs(prefix, false),
|
|
511
|
+
title: "Run a reading command",
|
|
512
|
+
description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
513
|
+
inputSchema: toStandardJsonSchema(call),
|
|
514
|
+
annotations: READ
|
|
515
|
+
}, runner(false));
|
|
516
|
+
if (Object.values(commands).some((one) => one.writes))
|
|
517
|
+
server.registerTool(`${prefix}_write`, {
|
|
518
|
+
outputSchema: listedAs(prefix, true),
|
|
519
|
+
title: "Run a writing command",
|
|
520
|
+
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}`,
|
|
521
|
+
inputSchema: toStandardJsonSchema(call),
|
|
522
|
+
annotations: WRITE
|
|
523
|
+
}, runner(true));
|
|
524
|
+
}, "registerCommands");
|
|
525
|
+
var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
|
|
526
|
+
const run = entryRunner(registration);
|
|
527
|
+
return Object.fromEntries(Object.entries(tools).map(([key, definition]) => [
|
|
528
|
+
commandOf(key, definition),
|
|
529
|
+
{
|
|
530
|
+
title: definition.title,
|
|
531
|
+
description: definition.description,
|
|
532
|
+
writes: definition.annotations.readOnlyHint !== true,
|
|
533
|
+
input: inputOf(definition, syncAllowedFor(key, registration.defaults)),
|
|
534
|
+
...definition.output ? { output: outputSchemaOf(definition) } : {},
|
|
535
|
+
checked: true,
|
|
536
|
+
run: /* @__PURE__ */ __name((args, ctx) => run(key, definition, args, ctx), "run")
|
|
537
|
+
}
|
|
538
|
+
]));
|
|
539
|
+
}, "surfaceCommands");
|
|
540
|
+
var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
|
|
541
|
+
|
|
542
|
+
export {
|
|
543
|
+
message,
|
|
544
|
+
READ,
|
|
545
|
+
WRITE,
|
|
546
|
+
tool,
|
|
547
|
+
chatOf,
|
|
548
|
+
tierOf,
|
|
549
|
+
outcomeOf,
|
|
550
|
+
commandOf,
|
|
551
|
+
toolKey,
|
|
552
|
+
Picture,
|
|
553
|
+
BinaryResource,
|
|
554
|
+
answered,
|
|
555
|
+
failed,
|
|
556
|
+
normal,
|
|
557
|
+
search,
|
|
558
|
+
registerCommands,
|
|
559
|
+
surfaceCommands,
|
|
560
|
+
outputOf
|
|
561
|
+
};
|
|
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
parseReference
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TI4WJOEX.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/domain/links.js
|
|
11
11
|
var LINK_VERSION = "v1";
|
|
12
12
|
var DEFAULT_LINK_CONFIG = { base: "https://wirecat.dev/o", enabled: true };
|
|
13
13
|
var APP_PREFIX = "wirecat://open";
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
singleLine,
|
|
9
9
|
visibleControls
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2GNGR265.js";
|
|
11
11
|
import {
|
|
12
12
|
__name
|
|
13
13
|
} from "./chunk-ZVVMGPBJ.js";
|
|
14
14
|
|
|
15
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
16
16
|
import { styleText } from "node:util";
|
|
17
17
|
var TIME_WIDTH = 8;
|
|
18
18
|
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
@@ -3,15 +3,15 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
filesPresent,
|
|
5
5
|
sharedModelsDirectory
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G3DWMG7Y.js";
|
|
7
7
|
import {
|
|
8
8
|
readSharedSection,
|
|
9
9
|
sharedConfigPath,
|
|
10
10
|
writeSharedSection
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZNAX7GUV.js";
|
|
12
12
|
import {
|
|
13
13
|
storePath
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JKEMW6E4.js";
|
|
15
15
|
import {
|
|
16
16
|
array,
|
|
17
17
|
check,
|
|
@@ -32,15 +32,15 @@ import {
|
|
|
32
32
|
string,
|
|
33
33
|
trim,
|
|
34
34
|
url
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-YRDQ54G5.js";
|
|
36
36
|
import {
|
|
37
37
|
CliError
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-UHMJSSQO.js";
|
|
39
39
|
import {
|
|
40
40
|
__name
|
|
41
41
|
} from "./chunk-ZVVMGPBJ.js";
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/embeddings/models.js
|
|
44
44
|
import { existsSync } from "node:fs";
|
|
45
45
|
import { join } from "node:path";
|
|
46
46
|
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
|