@wirecat/amo-cli 0.1.1 → 0.3.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/CHANGELOG.md +36 -0
- package/README.md +15 -10
- package/contracts/wirecat.json +55 -6
- package/dist/amo/button.d.ts +53 -0
- package/dist/amo/button.d.ts.map +1 -0
- package/dist/amo/button.js +234 -0
- package/dist/amo/button.js.map +1 -0
- package/dist/amo/oauth.d.ts +12 -3
- package/dist/amo/oauth.d.ts.map +1 -1
- package/dist/amo/oauth.js +19 -6
- package/dist/amo/oauth.js.map +1 -1
- package/dist/bin/amo.js +2 -2
- package/dist/bundle/agent-FDNP27SW.js +40 -0
- package/dist/bundle/{all-profiles-3KQVWDV4.js → all-profiles-PPUN52SP.js} +63 -21
- package/dist/bundle/amo.js +28 -26
- package/dist/bundle/{anthropic-N5NOX7K7.js → anthropic-RDNDT6ZP.js} +5 -5
- package/dist/bundle/{app-server-2MST5EZ5.js → app-server-MMALJDBP.js} +79 -68
- package/dist/bundle/{bun-4NHWOFX2.js → bun-Y4FRPURU.js} +2 -2
- package/dist/bundle/{bun-sqlite-DRSXPWPR.js → bun-sqlite-7NXJGZCO.js} +6 -6
- package/dist/bundle/{chunk-GNTJMB6X.js → chunk-2YEDK2XV.js} +4 -4
- package/dist/bundle/chunk-3NDMVXGS.js +80 -0
- package/dist/bundle/{chunk-Y37A3232.js → chunk-3RP57VDS.js} +114 -7
- package/dist/bundle/{chunk-ODNQU7DH.js → chunk-3YOZTGZ6.js} +43 -64
- package/dist/bundle/{chunk-ESZSMZKT.js → chunk-4EYPFFTN.js} +2 -2
- package/dist/bundle/{chunk-TZSUZGWM.js → chunk-4MVTSMWP.js} +2 -2
- package/dist/bundle/{chunk-LJQUYECN.js → chunk-5DPMNYQT.js} +1 -1
- package/dist/bundle/{chunk-7PKFYX7V.js → chunk-5POLHHDZ.js} +8 -8
- package/dist/bundle/{chunk-A33TIM5D.js → chunk-5RXH35ZA.js} +225 -225
- package/dist/bundle/{chunk-BVMNXI53.js → chunk-77FP6AWC.js} +25 -25
- package/dist/bundle/{chunk-L6AFE73L.js → chunk-7E6QSIRQ.js} +1 -1
- package/dist/bundle/chunk-7SBAHYZW.js +734 -0
- package/dist/bundle/{chunk-GQ7VFIYM.js → chunk-7USADF2W.js} +23 -7
- package/dist/bundle/{chunk-AHJ4W2IL.js → chunk-7VSYOMEH.js} +2 -2
- package/dist/bundle/chunk-7Z6NYSAN.js +52 -0
- package/dist/bundle/chunk-AYR6FIXN.js +30 -0
- package/dist/bundle/{chunk-ADEWU4P4.js → chunk-B4ITT55D.js} +1 -1
- package/dist/bundle/{chunk-AUBB72VF.js → chunk-BKTLAXUK.js} +41 -10
- package/dist/bundle/{chunk-63F65DHU.js → chunk-BYVDMPLX.js} +2 -2
- package/dist/bundle/{chunk-V77XNPXG.js → chunk-CQ472K6W.js} +11 -11
- package/dist/bundle/{chunk-FKR3M62D.js → chunk-CUZISGWH.js} +13 -13
- package/dist/bundle/{chunk-LDEBZ3IX.js → chunk-D6UPCAPD.js} +1 -1
- package/dist/bundle/{chunk-P3WQRTYZ.js → chunk-E2DLRLJ5.js} +1 -1
- package/dist/bundle/{chunk-NJYAL3UW.js → chunk-EHULZEXQ.js} +1 -1
- package/dist/bundle/chunk-EKNP326Q.js +108 -0
- package/dist/bundle/{chunk-DJD7TBYG.js → chunk-ELJGALVX.js} +76 -74
- package/dist/bundle/{chunk-RPWAJYI6.js → chunk-FI2TP6TY.js} +3 -3
- package/dist/bundle/{chunk-CDY2NJFE.js → chunk-FPDTIQOK.js} +2 -2
- package/dist/bundle/{chunk-NC76INB2.js → chunk-FPIUFSWK.js} +3099 -2266
- package/dist/bundle/{chunk-SZ2V62HB.js → chunk-GCUFGDKE.js} +2 -2
- package/dist/bundle/{chunk-LRBPT7LQ.js → chunk-GKP7CKW2.js} +6 -6
- package/dist/bundle/chunk-H34RBRS3.js +209 -0
- package/dist/bundle/{chunk-O2UCU52O.js → chunk-HQH4YPO5.js} +134 -569
- package/dist/bundle/{chunk-TNUFLULO.js → chunk-I4QCJZW7.js} +8 -8
- package/dist/bundle/{chunk-DXGGCGRP.js → chunk-IDQ7BNCZ.js} +14 -14
- package/dist/bundle/{chunk-JMDLPBXK.js → chunk-IEAPNTHT.js} +17 -17
- package/dist/bundle/{chunk-XQL7FEF4.js → chunk-ILUREFWJ.js} +9 -9
- package/dist/bundle/{chunk-QRQYUHCZ.js → chunk-IYUWVMGP.js} +12 -12
- package/dist/bundle/chunk-JTFAG3BX.js +338 -0
- package/dist/bundle/{chunk-CHUKWON6.js → chunk-JZ2AITOE.js} +3 -3
- package/dist/bundle/{chunk-JR6TSMFX.js → chunk-KEOKH2OZ.js} +103 -70
- package/dist/bundle/{chunk-UMVRT7VQ.js → chunk-KKXF6TSS.js} +1 -1
- package/dist/bundle/{chunk-5E5R65CA.js → chunk-KTLCQ7GC.js} +2 -2
- package/dist/bundle/{chunk-QDMXZZG4.js → chunk-KZDBO2FT.js} +18 -8
- package/dist/bundle/{chunk-VX37MPTJ.js → chunk-L2ZQDTDU.js} +1 -1
- package/dist/bundle/{chunk-CUZRHF34.js → chunk-L3JDQNBC.js} +4 -4
- package/dist/bundle/{chunk-3IRJDH2U.js → chunk-L72UALL5.js} +2 -100
- package/dist/bundle/{chunk-XRTD2GCU.js → chunk-LOSOWTAZ.js} +19 -258
- package/dist/bundle/{chunk-LGQXGOPJ.js → chunk-LYRICHEK.js} +2 -2
- package/dist/bundle/{chunk-UBRREVLJ.js → chunk-MMOEAH5G.js} +2 -2
- package/dist/bundle/{chunk-EQ7A6NA6.js → chunk-MPXKBF37.js} +1 -1
- package/dist/bundle/{chunk-SMSTGO2G.js → chunk-MYMBPQPQ.js} +4 -4
- package/dist/bundle/chunk-N4A6E2LL.js +559 -0
- package/dist/bundle/{chunk-5HGGG3QO.js → chunk-NJ2LJKNH.js} +16 -3
- package/dist/bundle/{chunk-TGEQNS6G.js → chunk-OMH3WP7F.js} +1 -1
- package/dist/bundle/{chunk-ULXQ5MJM.js → chunk-ORFLQGWH.js} +4 -4
- package/dist/bundle/{chunk-DQV2IKCF.js → chunk-PFZ7WG2B.js} +10 -3
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-6RS7OYTD.js → chunk-Q2YVY7IR.js} +3 -3
- package/dist/bundle/{chunk-DOSJONCX.js → chunk-QHA33ZS6.js} +7 -7
- package/dist/bundle/{chunk-JH3UOHRE.js → chunk-QQT7WUR4.js} +4 -4
- package/dist/bundle/{chunk-EROSAUNP.js → chunk-R23DRW2T.js} +5 -5
- package/dist/bundle/{chunk-WCYCUTSK.js → chunk-SBQ5MFHM.js} +7 -7
- package/dist/bundle/{chunk-DAY6TSPF.js → chunk-SJYVKR54.js} +62 -50
- package/dist/bundle/{chunk-T2UDLX76.js → chunk-SJZ52MZE.js} +6 -6
- package/dist/bundle/{chunk-ZM7I52EP.js → chunk-T6D34X5S.js} +3 -4
- package/dist/bundle/{chunk-P5LYZRKW.js → chunk-TCDER3G7.js} +1586 -749
- package/dist/bundle/{chunk-2I5UVMLW.js → chunk-TWZF7VO6.js} +1726 -1159
- package/dist/bundle/{chunk-VVHRQ46X.js → chunk-UA7C57IB.js} +2 -2
- package/dist/bundle/{chunk-5SBLU7D7.js → chunk-UM6SDFB6.js} +1 -1
- package/dist/bundle/{chunk-7U5HJEPZ.js → chunk-UOPP6ORQ.js} +21 -19
- package/dist/bundle/{chunk-U7RLVJ34.js → chunk-UT3ODJMI.js} +4 -4
- package/dist/bundle/{chunk-7GTUZY7M.js → chunk-UZLT6VSP.js} +3 -3
- package/dist/bundle/{chunk-5RLUHTK6.js → chunk-V3ZWYMXT.js} +1 -1
- package/dist/bundle/{chunk-LSND5QYI.js → chunk-VD7HD25M.js} +9 -9
- package/dist/bundle/{chunk-PFO76YFP.js → chunk-VEGNZPQU.js} +18 -18
- package/dist/bundle/{chunk-5Z5PEEKP.js → chunk-VFU25P57.js} +4 -4
- package/dist/bundle/{chunk-4ZAK773N.js → chunk-VJHOBOJR.js} +3 -3
- package/dist/bundle/{chunk-PM77PRB6.js → chunk-VPBSZ4HQ.js} +185 -162
- package/dist/bundle/{chunk-Q2VNBY4Y.js → chunk-VY27K2SH.js} +746 -1205
- package/dist/bundle/{chunk-XEFAMLSD.js → chunk-W4KY5JF5.js} +3 -3
- package/dist/bundle/{chunk-73CXFE36.js → chunk-WBWVBEHH.js} +29 -1
- package/dist/bundle/{chunk-NHXJYS4R.js → chunk-XDT74W5P.js} +32 -28
- package/dist/bundle/{chunk-EPOV5UIO.js → chunk-XI75EKLG.js} +11 -11
- package/dist/bundle/{chunk-2B24PDH7.js → chunk-XM2G62YF.js} +8 -6
- package/dist/bundle/{chunk-5D4Z2B5B.js → chunk-YSOGGUK3.js} +9 -9
- package/dist/bundle/chunk-YVO2YGML.js +353 -0
- package/dist/bundle/{chunk-EQUKVVHX.js → chunk-ZIFEIJRK.js} +7 -7
- package/dist/bundle/{cli-QVWTXADI.js → cli-GAO7LDDA.js} +150 -103
- package/dist/bundle/command-contract-RLIBGIDT.js +39 -0
- package/dist/bundle/{command-server-entry-5VL5U5EE.js → command-server-entry-BCDJP7XE.js} +28 -28
- package/dist/bundle/{decode-SQ5WGNDX.js → decode-OY2GR442.js} +5 -5
- package/dist/bundle/{dispatch-LA4DFXJD.js → dispatch-JWEJCBTF.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-25Z3RINX.js → echarts-AHEPEA5P.js} +2 -2
- package/dist/bundle/{embed-BNOTNXMA.js → embed-RVSUV54Z.js} +6 -6
- package/dist/bundle/{embedder-BCUT7KKV.js → embedder-GRZXZUXR.js} +9 -9
- package/dist/bundle/{failure-PKAC6XCT.js → failure-DDCSR54L.js} +2 -2
- package/dist/bundle/{first-run-EO5K5GME.js → first-run-G3WI4DH4.js} +12 -12
- package/dist/bundle/first-screen-6MLCMW2U.js +39 -0
- package/dist/bundle/{instructions-VLM3QAYB.js → instructions-NWQC5IP4.js} +1 -1
- package/dist/bundle/{mcp-7ILNMJH5.js → mcp-KGWT6TGO.js} +2 -2
- package/dist/bundle/meeting-combined-SVTFVZNJ.js +24 -0
- package/dist/bundle/{meeting-model-GHMMUQ34.js → meeting-model-I6T5HIZ5.js} +11 -11
- package/dist/bundle/{meeting-semantic-BMP6323L.js → meeting-semantic-47UA5JBF.js} +6 -6
- package/dist/bundle/{node-CT3N3TNL.js → node-7VXN7F4B.js} +2 -2
- package/dist/bundle/{node-sqlite-MELD2SBX.js → node-sqlite-BSEON57L.js} +7 -7
- package/dist/bundle/{oauth-YBH5OKC2.js → oauth-V6UAT4YD.js} +8 -8
- package/dist/bundle/{open-WNSBWTAG.js → open-7LVAY7ZU.js} +5 -5
- package/dist/bundle/{openai-XSNMNLW6.js → openai-OIEH342H.js} +15 -15
- package/dist/bundle/{process-I2QKOMM7.js → process-PTUCNLZ7.js} +1 -1
- package/dist/bundle/{program-DV73CIGP.js → program-S5WY5IZP.js} +643 -852
- package/dist/bundle/{prompt-SOG4AKPM.js → prompt-7XWTEQ62.js} +5 -5
- package/dist/bundle/{recognize-WMQLWMXH.js → recognize-HGIAJXDR.js} +4 -4
- package/dist/bundle/{remote-4BTFOLFY.js → remote-X4SVEMHS.js} +9 -9
- package/dist/bundle/{rerank-LJ3TWRNV.js → rerank-QWM3DQMU.js} +7 -7
- package/dist/bundle/{serve-B6UANKXN.js → serve-VVG3TXYT.js} +10 -10
- package/dist/bundle/{server-YRH6GJ5Z.js → server-EHYK62BJ.js} +73 -61
- package/dist/bundle/server-WRPTBVNW.js +86 -0
- package/dist/bundle/source-YISMYLBQ.js +44 -0
- package/dist/bundle/{sqlite-runtime-R7QFWFE7.js → sqlite-runtime-MCKXDNYC.js} +6 -6
- package/dist/bundle/{state-DIJ5YUOE.js → state-MYNYQJCT.js} +6 -6
- package/dist/bundle/store-A7R2SZVD.js +34 -0
- package/dist/bundle/{store-MYTYDV6A.js → store-B7O3F3QB.js} +28 -21
- package/dist/bundle/{store-6WFWW7EC.js → store-FPIU2546.js} +24 -23
- package/dist/bundle/store-maintenance-command-D55FRTIK.js +73 -0
- package/dist/bundle/surface-3EX6IGHW.js +72 -0
- package/dist/bundle/writer-XDHZ54JD.js +46 -0
- package/dist/commands/session.d.ts +23 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +115 -45
- package/dist/commands/session.js.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/identity.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +3 -1
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +2 -0
- package/dist/reasons.js.map +1 -1
- package/dist/setup/flow.d.ts.map +1 -1
- package/dist/setup/flow.js +74 -4
- package/dist/setup/flow.js.map +1 -1
- package/dist/setup/texts.en.json +22 -1
- package/dist/setup/texts.es.json +22 -1
- package/dist/setup/texts.ru.json +22 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -3
- package/scenarios/first-sync.md +23 -0
- package/scenarios/keep-in-sync.md +18 -0
- package/scenarios/safe-agent-writes.md +21 -0
- package/skills/amo-cli/SKILL.md +1 -1
- package/skills/amo-cli/references/mcp.md +1 -1
- package/skills/amo-cli/references/setup.md +9 -3
- package/dist/bundle/command-contract-QBUQBXH7.js +0 -39
- package/dist/bundle/first-screen-GMN3T6RW.js +0 -39
- package/dist/bundle/meeting-combined-LAMF7S2B.js +0 -24
- package/dist/bundle/server-S6XD6V6E.js +0 -77
- package/dist/bundle/source-DGFTA2TN.js +0 -42
- package/dist/bundle/store-FJCNZULV.js +0 -32
- package/dist/bundle/store-maintenance-command-B5TMKFMG.js +0 -68
- package/dist/bundle/writer-GP7VIMAU.js +0 -44
|
@@ -1,76 +1,37 @@
|
|
|
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-7Z6NYSAN.js";
|
|
10
6
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
lentConnection,
|
|
15
|
-
onlineDeps,
|
|
16
|
-
refuseLacking,
|
|
17
|
-
servicesFor,
|
|
18
|
-
storeModeDeps
|
|
19
|
-
} from "./chunk-Q2VNBY4Y.js";
|
|
7
|
+
lentConnection
|
|
8
|
+
} from "./chunk-JTFAG3BX.js";
|
|
20
9
|
import {
|
|
21
10
|
QUERY_ARGUMENT
|
|
22
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7SBAHYZW.js";
|
|
23
12
|
import {
|
|
24
|
-
DEFAULT_OUTPUT_BYTES,
|
|
25
|
-
ENTITIES,
|
|
26
|
-
LOCAL_WRITE,
|
|
27
|
-
REMOTE_WRITE,
|
|
28
|
-
answerSchema,
|
|
29
13
|
changesMessenger,
|
|
30
|
-
flatten
|
|
31
|
-
|
|
32
|
-
judgedEffects,
|
|
33
|
-
listOf,
|
|
34
|
-
refuseStoreChange,
|
|
35
|
-
sealed,
|
|
36
|
-
startRecording
|
|
37
|
-
} from "./chunk-PM77PRB6.js";
|
|
14
|
+
flatten
|
|
15
|
+
} from "./chunk-VPBSZ4HQ.js";
|
|
38
16
|
import {
|
|
39
|
-
currentCaller
|
|
40
|
-
|
|
41
|
-
runContextOf,
|
|
42
|
-
withCaller
|
|
43
|
-
} from "./chunk-WCYCUTSK.js";
|
|
17
|
+
currentCaller
|
|
18
|
+
} from "./chunk-SBQ5MFHM.js";
|
|
44
19
|
import {
|
|
45
20
|
enclosingTraceId,
|
|
46
21
|
inRun,
|
|
47
22
|
newRunId,
|
|
48
23
|
traceOf
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import {
|
|
51
|
-
storeDamaged
|
|
52
|
-
} from "./chunk-UBRREVLJ.js";
|
|
53
|
-
import {
|
|
54
|
-
failureContext
|
|
55
|
-
} from "./chunk-Y37A3232.js";
|
|
24
|
+
} from "./chunk-77FP6AWC.js";
|
|
56
25
|
import {
|
|
57
26
|
authorityAllowed,
|
|
58
|
-
botApiAllowed
|
|
59
|
-
|
|
60
|
-
keyForCommand,
|
|
61
|
-
levelFor,
|
|
62
|
-
readKeysForCommand
|
|
63
|
-
} from "./chunk-QDMXZZG4.js";
|
|
27
|
+
botApiAllowed
|
|
28
|
+
} from "./chunk-KZDBO2FT.js";
|
|
64
29
|
import {
|
|
65
30
|
queryDescription
|
|
66
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5RXH35ZA.js";
|
|
67
32
|
import {
|
|
68
|
-
|
|
69
|
-
} from "./chunk-
|
|
70
|
-
import {
|
|
71
|
-
captureStreams,
|
|
72
|
-
traceIdOf
|
|
73
|
-
} from "./chunk-DJD7TBYG.js";
|
|
33
|
+
captureStreams
|
|
34
|
+
} from "./chunk-ELJGALVX.js";
|
|
74
35
|
import {
|
|
75
36
|
COMPACT_FLAG,
|
|
76
37
|
SNAKE_CASE,
|
|
@@ -81,13 +42,7 @@ import {
|
|
|
81
42
|
errorObjectOf,
|
|
82
43
|
integer,
|
|
83
44
|
isoDate,
|
|
84
|
-
itemEnvelopeSchema,
|
|
85
|
-
listEnvelopeSchema,
|
|
86
45
|
literal,
|
|
87
|
-
looseObject,
|
|
88
|
-
maxLength,
|
|
89
|
-
maxValue,
|
|
90
|
-
mcpErrorResult,
|
|
91
46
|
minLength,
|
|
92
47
|
minValue,
|
|
93
48
|
number,
|
|
@@ -98,30 +53,25 @@ import {
|
|
|
98
53
|
pipe,
|
|
99
54
|
record,
|
|
100
55
|
regex,
|
|
101
|
-
safeParse,
|
|
102
56
|
strictObject,
|
|
103
57
|
string,
|
|
104
|
-
summarize,
|
|
105
58
|
text,
|
|
106
|
-
toJsonSchema,
|
|
107
|
-
toStandardJsonSchema,
|
|
108
59
|
union,
|
|
109
60
|
unknown,
|
|
110
61
|
word,
|
|
111
62
|
writes
|
|
112
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-BKTLAXUK.js";
|
|
113
64
|
import {
|
|
114
|
-
CliError
|
|
115
|
-
|
|
116
|
-
} from "./chunk-SZ2V62HB.js";
|
|
65
|
+
CliError
|
|
66
|
+
} from "./chunk-GCUFGDKE.js";
|
|
117
67
|
import {
|
|
118
68
|
__name
|
|
119
69
|
} from "./chunk-ZVVMGPBJ.js";
|
|
120
70
|
|
|
121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
71
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
122
72
|
import { Readable } from "node:stream";
|
|
123
73
|
|
|
124
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
74
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
75
|
var LINT_SEVERITIES = ["high", "medium", "low"];
|
|
126
76
|
var lintRuleSchema = strictObject({
|
|
127
77
|
id: word,
|
|
@@ -267,7 +217,7 @@ var overrideSchema = strictObject({
|
|
|
267
217
|
});
|
|
268
218
|
var overridesSchema = array(overrideSchema);
|
|
269
219
|
|
|
270
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
220
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
221
|
var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
|
|
272
222
|
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
223
|
var AUDIT_RULES = defineAuditRules([
|
|
@@ -378,7 +328,13 @@ var FAMILY_SINCE_0_98 = [
|
|
|
378
328
|
review(ENTITY, "entity lead", "b24's CRM lead and memo's differ (measured 2026-11-13)"),
|
|
379
329
|
review(ENTITY, "entity product", "b24's CRM product and memo's differ (measured 2026-11-13)"),
|
|
380
330
|
review(REASON, "reason ai.address-refused=model.address-refused", "one failure under two names; cli-core 0.650.0 keeps one"),
|
|
381
|
-
review(REASON, "reason profile.unknown: code", "b24 gives it not_found, drive validation_error (measured 2026-11-13)")
|
|
331
|
+
review(REASON, "reason profile.unknown: code", "b24 gives it not_found, drive validation_error (measured 2026-11-13)"),
|
|
332
|
+
{
|
|
333
|
+
rule: REASON,
|
|
334
|
+
target: "reason account-remove.unknown-profile=account-rename.unknown-profile",
|
|
335
|
+
reason: "one failure under two names in cli-core 0.715\u20130.716; 0.717.0 gives account rename profile.unknown",
|
|
336
|
+
review_after: "2026-12-10"
|
|
337
|
+
}
|
|
382
338
|
];
|
|
383
339
|
var PARITY_GROUPS = defineParityGroups([
|
|
384
340
|
{ name: "messengers", members: ["tg", "max"], covers: "tree", differences: MESSENGERS_SINCE_0_98 },
|
|
@@ -407,28 +363,60 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
407
363
|
},
|
|
408
364
|
// bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
|
|
409
365
|
// recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
|
|
410
|
-
// amo-cli
|
|
411
|
-
//
|
|
366
|
+
// amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
|
|
367
|
+
// wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
|
|
368
|
+
// linear-cli shares only these roots too: it is the first tracker CLI, so its issues commands have no group yet.
|
|
369
|
+
// notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
|
|
370
|
+
// its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
|
|
371
|
+
// and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
|
|
412
372
|
{
|
|
413
373
|
name: "shared-roots",
|
|
414
|
-
members: [
|
|
374
|
+
members: [
|
|
375
|
+
"tg",
|
|
376
|
+
"max",
|
|
377
|
+
"memo",
|
|
378
|
+
"drive",
|
|
379
|
+
"zm",
|
|
380
|
+
"wa",
|
|
381
|
+
"b24",
|
|
382
|
+
"beeline",
|
|
383
|
+
"pbx",
|
|
384
|
+
"notion",
|
|
385
|
+
"amo",
|
|
386
|
+
"hubspot",
|
|
387
|
+
"attio",
|
|
388
|
+
"ydisk",
|
|
389
|
+
"wordpress",
|
|
390
|
+
"linear"
|
|
391
|
+
],
|
|
415
392
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
|
|
416
393
|
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
417
394
|
},
|
|
418
|
-
// The CRM CLIs on cli-core's shared CRM commands.
|
|
419
|
-
// skips it, as beeline. Only b24
|
|
420
|
-
// later) and `deals delete` (amoCRM's
|
|
421
|
-
// https://www.amocrm.ru/developers/content/crm_platform/leads-api)
|
|
422
|
-
// these need no difference. `people`, `organizations`,
|
|
423
|
-
// is on cli-core's shared people and organizations
|
|
424
|
-
// in options, outputs and summaries.
|
|
395
|
+
// The CRM CLIs on cli-core's shared CRM commands. hubspot-cli is not in the family packages, so `audit --family`
|
|
396
|
+
// skips it, as beeline. Only b24 and hubspot have `leads` (amoCRM
|
|
397
|
+
// has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
|
|
398
|
+
// API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
|
|
399
|
+
// no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
|
|
400
|
+
// `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
|
|
401
|
+
// commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
|
|
425
402
|
{
|
|
426
403
|
name: "crm",
|
|
427
|
-
members: ["b24", "amo"],
|
|
404
|
+
members: ["b24", "amo", "hubspot", "attio"],
|
|
428
405
|
covers: ["deals", "sync", "search", "store", "schedule", "account"],
|
|
429
|
-
differences: [
|
|
406
|
+
differences: [
|
|
407
|
+
{
|
|
408
|
+
rule: "same-path-contract",
|
|
409
|
+
target: "schedule: summary",
|
|
410
|
+
differs: "hubspot",
|
|
411
|
+
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",
|
|
412
|
+
review_after: "2026-12-01"
|
|
413
|
+
}
|
|
414
|
+
]
|
|
430
415
|
}
|
|
431
416
|
]);
|
|
417
|
+
var SHARED_DIFFERENCES = [
|
|
418
|
+
...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()
|
|
419
|
+
];
|
|
432
420
|
var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
|
|
433
421
|
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");
|
|
434
422
|
var REQUIRED_ROOTS = defineRequiredRoots([
|
|
@@ -440,7 +428,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
|
|
|
440
428
|
{ path: ["upgrade"], meaning: "updates the CLI" }
|
|
441
429
|
]);
|
|
442
430
|
|
|
443
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
431
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
444
432
|
var fieldRuleSchema = strictObject({ id: word, rule: text });
|
|
445
433
|
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");
|
|
446
434
|
var FIELD_RULES = defineFieldRules([
|
|
@@ -456,7 +444,7 @@ var FIELD_RULES = defineFieldRules([
|
|
|
456
444
|
}
|
|
457
445
|
]);
|
|
458
446
|
|
|
459
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
447
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
460
448
|
var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
|
|
461
449
|
var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
|
|
462
450
|
var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
|
|
@@ -478,7 +466,7 @@ var IDENTIFIERS = defineIdentifiers([
|
|
|
478
466
|
{ key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
|
|
479
467
|
]);
|
|
480
468
|
|
|
481
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
469
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
482
470
|
var ACCOUNT_FLAGS = [
|
|
483
471
|
{
|
|
484
472
|
name: "--client-id",
|
|
@@ -515,7 +503,7 @@ var ACCOUNT_FLAGS = [
|
|
|
515
503
|
{ name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
|
|
516
504
|
];
|
|
517
505
|
|
|
518
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
506
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
519
507
|
var CALENDAR_FLAGS = [
|
|
520
508
|
{ name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
|
|
521
509
|
{
|
|
@@ -603,7 +591,25 @@ var CALENDAR_FLAGS = [
|
|
|
603
591
|
}
|
|
604
592
|
];
|
|
605
593
|
|
|
606
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
594
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-content.js
|
|
595
|
+
var CONTENT_FLAGS = [
|
|
596
|
+
{ name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
|
|
597
|
+
{
|
|
598
|
+
name: "--tags",
|
|
599
|
+
value: "<ids>",
|
|
600
|
+
role: "value",
|
|
601
|
+
type: "list",
|
|
602
|
+
meaning: "its tags and categories, by comma-separated ids; replaces the ones it has"
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: "--replace-body",
|
|
606
|
+
role: "mode",
|
|
607
|
+
type: "switch",
|
|
608
|
+
meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show"
|
|
609
|
+
}
|
|
610
|
+
];
|
|
611
|
+
|
|
612
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
607
613
|
var CRM_FLAGS = [
|
|
608
614
|
{
|
|
609
615
|
name: "--email",
|
|
@@ -767,7 +773,7 @@ var CRM_FLAGS = [
|
|
|
767
773
|
}
|
|
768
774
|
];
|
|
769
775
|
|
|
770
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
776
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
771
777
|
var HOW_FLAGS = [
|
|
772
778
|
{
|
|
773
779
|
name: "--limit",
|
|
@@ -1147,13 +1153,7 @@ var HOW_FLAGS = [
|
|
|
1147
1153
|
type: "string",
|
|
1148
1154
|
meaning: "a person whose reply counts as an answer; repeat it for more"
|
|
1149
1155
|
},
|
|
1150
|
-
{
|
|
1151
|
-
name: "--browser",
|
|
1152
|
-
value: "<program>",
|
|
1153
|
-
role: "mode",
|
|
1154
|
-
type: "string",
|
|
1155
|
-
meaning: "the browser program to open for sign-in"
|
|
1156
|
-
},
|
|
1156
|
+
{ name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
|
|
1157
1157
|
{
|
|
1158
1158
|
name: "--credential-storage",
|
|
1159
1159
|
value: "<storage>",
|
|
@@ -1162,6 +1162,8 @@ var HOW_FLAGS = [
|
|
|
1162
1162
|
meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
|
|
1163
1163
|
},
|
|
1164
1164
|
{ name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
|
|
1165
|
+
{ name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
|
|
1166
|
+
{ name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
|
|
1165
1167
|
{
|
|
1166
1168
|
name: "--expected-event-id",
|
|
1167
1169
|
value: "<id>",
|
|
@@ -1764,7 +1766,7 @@ var HOW_FLAGS = [
|
|
|
1764
1766
|
}
|
|
1765
1767
|
];
|
|
1766
1768
|
|
|
1767
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1769
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
1768
1770
|
var KNOWLEDGE_FLAGS = [
|
|
1769
1771
|
{
|
|
1770
1772
|
name: "--accept-terms",
|
|
@@ -1823,7 +1825,7 @@ var KNOWLEDGE_FLAGS = [
|
|
|
1823
1825
|
}
|
|
1824
1826
|
];
|
|
1825
1827
|
|
|
1826
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1828
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
1827
1829
|
var MAIL_FLAGS = [
|
|
1828
1830
|
{
|
|
1829
1831
|
name: "--cc",
|
|
@@ -1853,7 +1855,7 @@ var MAIL_FLAGS = [
|
|
|
1853
1855
|
}
|
|
1854
1856
|
];
|
|
1855
1857
|
|
|
1856
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1858
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
1857
1859
|
var PRIVACY_FLAGS = [
|
|
1858
1860
|
{
|
|
1859
1861
|
name: "--about-text",
|
|
@@ -1914,7 +1916,7 @@ var PRIVACY_FLAGS = [
|
|
|
1914
1916
|
{ name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
|
|
1915
1917
|
];
|
|
1916
1918
|
|
|
1917
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1919
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
1918
1920
|
var SCHEDULE_FLAGS = [
|
|
1919
1921
|
{
|
|
1920
1922
|
name: "--locale",
|
|
@@ -1947,7 +1949,18 @@ var SCHEDULE_FLAGS = [
|
|
|
1947
1949
|
}
|
|
1948
1950
|
];
|
|
1949
1951
|
|
|
1950
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1952
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-search.js
|
|
1953
|
+
var SEARCH_FLAGS = [
|
|
1954
|
+
{
|
|
1955
|
+
name: "--like",
|
|
1956
|
+
value: "<text>",
|
|
1957
|
+
role: "query",
|
|
1958
|
+
type: "string",
|
|
1959
|
+
meaning: "a made-up example of the text sought, such as a reply that would answer the question, searched by meaning beside the query"
|
|
1960
|
+
}
|
|
1961
|
+
];
|
|
1962
|
+
|
|
1963
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
1951
1964
|
var WHAT_FLAGS = [
|
|
1952
1965
|
{
|
|
1953
1966
|
name: "--analysis-provider",
|
|
@@ -2944,7 +2957,7 @@ var WHAT_FLAGS = [
|
|
|
2944
2957
|
}
|
|
2945
2958
|
];
|
|
2946
2959
|
|
|
2947
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
2960
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.126.1_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
|
|
2948
2961
|
var FLAG_TYPES = [
|
|
2949
2962
|
"switch",
|
|
2950
2963
|
"count",
|
|
@@ -3174,6 +3187,8 @@ var collections = [
|
|
|
3174
3187
|
["messages", "posts in a messenger chat, or emails"],
|
|
3175
3188
|
["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
|
|
3176
3189
|
["polls", "polls in a chat"],
|
|
3190
|
+
["posts", "posts and pages on a site or blog the owner publishes"],
|
|
3191
|
+
["channels", "the sites and social accounts the owner publishes posts on"],
|
|
3177
3192
|
["reactions", "reactions to a message"],
|
|
3178
3193
|
["recipients", "who a message goes to"],
|
|
3179
3194
|
["replies", "the automatic replies of a profile"],
|
|
@@ -3220,6 +3235,10 @@ var collections = [
|
|
|
3220
3235
|
["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
|
|
3221
3236
|
["splits", "parts of one transaction, each with its own amount and category"],
|
|
3222
3237
|
["users", "people who work in the owner's account at a service, such as a CRM's employees"],
|
|
3238
|
+
["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
|
|
3239
|
+
["teams", "groups in a tracker that own issues, states and labels"],
|
|
3240
|
+
["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
|
|
3241
|
+
["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
|
|
3223
3242
|
["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
|
|
3224
3243
|
["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
|
|
3225
3244
|
["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
|
|
@@ -3288,6 +3307,10 @@ var singulars = [
|
|
|
3288
3307
|
["privacy", "who may find, see, call or add the account"],
|
|
3289
3308
|
["metadata", "a profile's cached source attributes"],
|
|
3290
3309
|
["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
|
|
3310
|
+
[
|
|
3311
|
+
"scheduled",
|
|
3312
|
+
"a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
|
|
3313
|
+
],
|
|
3291
3314
|
[
|
|
3292
3315
|
"schedule",
|
|
3293
3316
|
"a profile's timers the owner saved, each running a command of this tool or an agent; the tool's own background work is jobs"
|
|
@@ -3295,6 +3318,7 @@ var singulars = [
|
|
|
3295
3318
|
];
|
|
3296
3319
|
var views = [
|
|
3297
3320
|
["tree", "the parent and child hierarchy of stored sources"],
|
|
3321
|
+
["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
|
|
3298
3322
|
["logs", "the log of a running process"],
|
|
3299
3323
|
["events", "what happened in a thing over time"],
|
|
3300
3324
|
["scheduled", "what is scheduled to happen"],
|
|
@@ -3367,11 +3391,13 @@ var VOCABULARY = defineVocabulary({
|
|
|
3367
3391
|
...MAIL_FLAGS,
|
|
3368
3392
|
...KNOWLEDGE_FLAGS,
|
|
3369
3393
|
...CRM_FLAGS,
|
|
3370
|
-
...SCHEDULE_FLAGS
|
|
3394
|
+
...SCHEDULE_FLAGS,
|
|
3395
|
+
...CONTENT_FLAGS,
|
|
3396
|
+
...SEARCH_FLAGS
|
|
3371
3397
|
]
|
|
3372
3398
|
});
|
|
3373
3399
|
|
|
3374
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3400
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
3375
3401
|
var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
|
|
3376
3402
|
var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
|
|
3377
3403
|
var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
|
|
@@ -3542,7 +3568,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3542
3568
|
const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
|
|
3543
3569
|
const lend = ctx.connection;
|
|
3544
3570
|
let borrowed;
|
|
3545
|
-
let
|
|
3571
|
+
let answered = false;
|
|
3546
3572
|
let result;
|
|
3547
3573
|
let failure;
|
|
3548
3574
|
const streams = captureStreams();
|
|
@@ -3564,7 +3590,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3564
3590
|
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
3565
3591
|
agent: {
|
|
3566
3592
|
result: /* @__PURE__ */ __name((value) => {
|
|
3567
|
-
|
|
3593
|
+
answered = true;
|
|
3568
3594
|
result = value;
|
|
3569
3595
|
}, "result"),
|
|
3570
3596
|
failure: /* @__PURE__ */ __name((object2) => {
|
|
@@ -3586,7 +3612,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3586
3612
|
}));
|
|
3587
3613
|
if (failure)
|
|
3588
3614
|
return { error: failure };
|
|
3589
|
-
if (
|
|
3615
|
+
if (answered)
|
|
3590
3616
|
return { result };
|
|
3591
3617
|
if (code !== 0)
|
|
3592
3618
|
throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
|
|
@@ -3598,468 +3624,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3598
3624
|
}
|
|
3599
3625
|
}, "runCommandForAgent");
|
|
3600
3626
|
|
|
3601
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/tool.js
|
|
3602
|
-
var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
|
|
3603
|
-
var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
|
|
3604
|
-
var message = pipe(
|
|
3605
|
-
string(),
|
|
3606
|
-
maxLength(256),
|
|
3607
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
|
|
3608
|
-
regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
|
|
3609
|
-
description("message id")
|
|
3610
|
-
);
|
|
3611
|
-
var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
3612
|
-
var WRITE = {
|
|
3613
|
-
readOnlyHint: false,
|
|
3614
|
-
destructiveHint: true,
|
|
3615
|
-
idempotentHint: false,
|
|
3616
|
-
openWorldHint: true
|
|
3617
|
-
};
|
|
3618
|
-
var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
|
|
3619
|
-
var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
|
|
3620
|
-
var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
|
|
3621
|
-
if (definition.annotations.readOnlyHint === true)
|
|
3622
|
-
return "read";
|
|
3623
|
-
if (/^admin|_admin/.test(key2))
|
|
3624
|
-
return "admin";
|
|
3625
|
-
if (/delete|ban|kick|remove|purge|block/.test(key2))
|
|
3626
|
-
return "destructive";
|
|
3627
|
-
if (/draft/.test(key2))
|
|
3628
|
-
return "draft";
|
|
3629
|
-
if (key2 === "messages_pin" && messenger?.quietPins === false)
|
|
3630
|
-
return "write-public";
|
|
3631
|
-
if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
|
|
3632
|
-
return "write-private";
|
|
3633
|
-
return "write-public";
|
|
3634
|
-
}, "tierOf");
|
|
3635
|
-
var effectsOf = /* @__PURE__ */ __name((definition) => {
|
|
3636
|
-
if (definition.effects)
|
|
3637
|
-
return definition.effects;
|
|
3638
|
-
const { readOnlyHint, openWorldHint } = definition.annotations;
|
|
3639
|
-
if (readOnlyHint === true)
|
|
3640
|
-
return { remote: openWorldHint === false ? "none" : "read", local: "read" };
|
|
3641
|
-
return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
|
|
3642
|
-
}, "effectsOf");
|
|
3643
|
-
var outcomeOf = /* @__PURE__ */ __name((result) => {
|
|
3644
|
-
if (!result.isError)
|
|
3645
|
-
return { status: "ok" };
|
|
3646
|
-
const code = result.structuredContent?.error?.code;
|
|
3647
|
-
const error = typeof code === "string" ? code : "generic_failure";
|
|
3648
|
-
return { status: error === "permission_error" ? "refused" : "failed", error };
|
|
3649
|
-
}, "outcomeOf");
|
|
3650
|
-
var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
|
|
3651
|
-
var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
|
|
3652
|
-
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");
|
|
3653
|
-
var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
|
|
3654
|
-
const permissions = defaults.settings.permissions ?? {};
|
|
3655
|
-
const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
|
|
3656
|
-
return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
|
|
3657
|
-
}, "syncAllowedFor");
|
|
3658
|
-
var entryRunner = /* @__PURE__ */ __name((registration) => {
|
|
3659
|
-
const run = callRunner(registration);
|
|
3660
|
-
const { log } = registration;
|
|
3661
|
-
return async (key2, definition, args, ctx) => {
|
|
3662
|
-
const startedAt = Date.now();
|
|
3663
|
-
const command = `mcp ${commandOf(key2, definition)}`;
|
|
3664
|
-
const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
|
|
3665
|
-
const app = registration.messenger?.app;
|
|
3666
|
-
const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
|
|
3667
|
-
const env = registration.defaults.env ?? process.env;
|
|
3668
|
-
const settings = registration.defaults.settings;
|
|
3669
|
-
const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
|
|
3670
|
-
app,
|
|
3671
|
-
command,
|
|
3672
|
-
...settings.profile === void 0 ? {} : { profile: settings.profile },
|
|
3673
|
-
env,
|
|
3674
|
-
record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
|
|
3675
|
-
keepFailed: true,
|
|
3676
|
-
trace: false,
|
|
3677
|
-
format: "json",
|
|
3678
|
-
context: runContextOf({ bin: app.command, command, env, caller }),
|
|
3679
|
-
...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
|
|
3680
|
-
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
3681
|
-
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
3682
|
-
...traceId === void 0 ? {} : { traceId }
|
|
3683
|
-
}) : void 0;
|
|
3684
|
-
const profile = registration.defaults.settings.profile;
|
|
3685
|
-
const scope = {
|
|
3686
|
-
runId: recording?.runId ?? newRunId(new Date(startedAt), command),
|
|
3687
|
-
command,
|
|
3688
|
-
startedAt,
|
|
3689
|
-
...profile === void 0 ? {} : { profile },
|
|
3690
|
-
...traceId === void 0 ? {} : { traceId },
|
|
3691
|
-
...recording ? { events: recording.events } : {}
|
|
3692
|
-
};
|
|
3693
|
-
const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
|
|
3694
|
-
const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
|
|
3695
|
-
const parsed = safeParse(input, args);
|
|
3696
|
-
return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
|
|
3697
|
-
arguments: toJsonSchema(input)
|
|
3698
|
-
}), app?.errors);
|
|
3699
|
-
}), "work");
|
|
3700
|
-
const result = await (caller ? withCaller(caller, work) : work());
|
|
3701
|
-
if (recording) {
|
|
3702
|
-
if (result.isError) {
|
|
3703
|
-
const error = result.structuredContent?.error;
|
|
3704
|
-
const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
|
|
3705
|
-
await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
|
|
3706
|
-
} else
|
|
3707
|
-
await recording.succeed(result.structuredContent).catch(() => void 0);
|
|
3708
|
-
}
|
|
3709
|
-
await log?.({
|
|
3710
|
-
tool: key2,
|
|
3711
|
-
tier: tierOf(key2, definition, registration.messenger),
|
|
3712
|
-
...outcomeOf(result),
|
|
3713
|
-
startedAt,
|
|
3714
|
-
finishedAt: Date.now()
|
|
3715
|
-
}, caller)?.catch(() => void 0);
|
|
3716
|
-
return result;
|
|
3717
|
-
};
|
|
3718
|
-
}, "entryRunner");
|
|
3719
|
-
var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
|
|
3720
|
-
const where = {
|
|
3721
|
-
profile: defaults.settings.profile,
|
|
3722
|
-
env: defaults.env,
|
|
3723
|
-
pictures: defaults.settings.pictureSearch,
|
|
3724
|
-
reranker: defaults.settings.searchReranker
|
|
3725
|
-
};
|
|
3726
|
-
return async (key2, definition, args, ctx) => {
|
|
3727
|
-
const path = commandOf(key2, definition).split(" ");
|
|
3728
|
-
const run = `mcp ${path.join(" ")}`;
|
|
3729
|
-
try {
|
|
3730
|
-
const execute = /* @__PURE__ */ __name(async () => {
|
|
3731
|
-
const syncAllowed = syncAllowedFor(key2, defaults);
|
|
3732
|
-
if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
|
|
3733
|
-
throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
|
|
3734
|
-
reason: "input.too-large",
|
|
3735
|
-
max_bytes: MAX_BUFFERED_INPUT,
|
|
3736
|
-
retryable: false
|
|
3737
|
-
});
|
|
3738
|
-
definition.check?.(args);
|
|
3739
|
-
if (definition.changesStore)
|
|
3740
|
-
refuseStoreChange(messenger.app, defaults.env);
|
|
3741
|
-
refuseLacking(messenger, path);
|
|
3742
|
-
for (const permission of readKeysForCommand(path)) {
|
|
3743
|
-
if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
|
|
3744
|
-
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
3745
|
-
}
|
|
3746
|
-
if (args.sync_first && !syncAllowed)
|
|
3747
|
-
throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
|
|
3748
|
-
if (definition.custom) {
|
|
3749
|
-
const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
|
|
3750
|
-
return answered(result2, definition.outputLimit?.(args, defaults), targets);
|
|
3751
|
-
}
|
|
3752
|
-
if (definition.local)
|
|
3753
|
-
return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
|
|
3754
|
-
const { online, stored: local, served } = definition;
|
|
3755
|
-
const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
|
|
3756
|
-
const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
|
|
3757
|
-
name: run
|
|
3758
|
-
}) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
|
|
3759
|
-
...storeModeDeps(messenger, store, account, defaults.guard),
|
|
3760
|
-
...where,
|
|
3761
|
-
embedders: defaults.embedders
|
|
3762
|
-
}), args, defaults, (work) => session.use(run, async (adapter, release) => {
|
|
3763
|
-
try {
|
|
3764
|
-
return await work(adapter);
|
|
3765
|
-
} finally {
|
|
3766
|
-
await release();
|
|
3767
|
-
}
|
|
3768
|
-
})), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
|
|
3769
|
-
try {
|
|
3770
|
-
return await work(adapter);
|
|
3771
|
-
} finally {
|
|
3772
|
-
await release();
|
|
3773
|
-
}
|
|
3774
|
-
})())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
|
|
3775
|
-
return answered(result, definition.outputLimit?.(args, defaults), targets);
|
|
3776
|
-
}, "execute");
|
|
3777
|
-
return around ? await around(key2, definition, execute) : await execute();
|
|
3778
|
-
} catch (error) {
|
|
3779
|
-
return failed(error, messenger?.app?.errors, effectsOf(definition));
|
|
3780
|
-
}
|
|
3781
|
-
};
|
|
3782
|
-
}, "callRunner");
|
|
3783
|
-
var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
|
|
3784
|
-
if (!definition.output)
|
|
3785
|
-
return looseObject({});
|
|
3786
|
-
const entity = ENTITIES[definition.output.entity];
|
|
3787
|
-
return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
|
|
3788
|
-
}, "outputSchemaOf");
|
|
3789
|
-
var Picture = class {
|
|
3790
|
-
static {
|
|
3791
|
-
__name(this, "Picture");
|
|
3792
|
-
}
|
|
3793
|
-
bytes;
|
|
3794
|
-
mimeType;
|
|
3795
|
-
about;
|
|
3796
|
-
constructor(bytes, mimeType, about) {
|
|
3797
|
-
this.bytes = bytes;
|
|
3798
|
-
this.mimeType = mimeType;
|
|
3799
|
-
this.about = about;
|
|
3800
|
-
}
|
|
3801
|
-
};
|
|
3802
|
-
var BinaryResource = class {
|
|
3803
|
-
static {
|
|
3804
|
-
__name(this, "BinaryResource");
|
|
3805
|
-
}
|
|
3806
|
-
base64;
|
|
3807
|
-
mimeType;
|
|
3808
|
-
uri;
|
|
3809
|
-
about;
|
|
3810
|
-
constructor(base64, mimeType, uri, about) {
|
|
3811
|
-
this.base64 = base64;
|
|
3812
|
-
this.mimeType = mimeType;
|
|
3813
|
-
this.uri = uri;
|
|
3814
|
-
this.about = about;
|
|
3815
|
-
}
|
|
3816
|
-
};
|
|
3817
|
-
var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
|
|
3818
|
-
const bounded = /* @__PURE__ */ __name((result) => {
|
|
3819
|
-
if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
|
|
3820
|
-
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 });
|
|
3821
|
-
return result;
|
|
3822
|
-
}, "bounded");
|
|
3823
|
-
if (answer === null || Array.isArray(answer) || typeof answer !== "object")
|
|
3824
|
-
throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
|
|
3825
|
-
const objectBody = /* @__PURE__ */ __name((value) => {
|
|
3826
|
-
const serialized = JSON.parse(agentJson(value));
|
|
3827
|
-
if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
|
|
3828
|
-
throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
|
|
3829
|
-
return serialized;
|
|
3830
|
-
}, "objectBody");
|
|
3831
|
-
if (answer instanceof BinaryResource) {
|
|
3832
|
-
const about = sealed(answer.about);
|
|
3833
|
-
return bounded({
|
|
3834
|
-
structuredContent: objectBody(about),
|
|
3835
|
-
content: [
|
|
3836
|
-
{ type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
|
|
3837
|
-
{ type: "text", text: agentJson(about) }
|
|
3838
|
-
]
|
|
3839
|
-
});
|
|
3840
|
-
}
|
|
3841
|
-
if (answer instanceof Picture) {
|
|
3842
|
-
const about = sealed(answer.about);
|
|
3843
|
-
return bounded({
|
|
3844
|
-
structuredContent: objectBody(about),
|
|
3845
|
-
content: [
|
|
3846
|
-
{ type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
|
|
3847
|
-
{ type: "text", text: agentJson(about) }
|
|
3848
|
-
]
|
|
3849
|
-
});
|
|
3850
|
-
}
|
|
3851
|
-
const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
|
|
3852
|
-
return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
|
|
3853
|
-
}, "answered");
|
|
3854
|
-
var failed = /* @__PURE__ */ __name((error, errors, effects) => {
|
|
3855
|
-
const judged = judgedEffects(effects);
|
|
3856
|
-
const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
|
|
3857
|
-
return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
|
|
3858
|
-
}, "failed");
|
|
3859
|
-
|
|
3860
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/surface.js
|
|
3861
|
-
import { randomUUID } from "node:crypto";
|
|
3862
|
-
var MATCHES = 8;
|
|
3863
|
-
var ANSWER = answerSchema();
|
|
3864
|
-
var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3865
|
-
const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
|
|
3866
|
-
const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
|
|
3867
|
-
return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
|
|
3868
|
-
items: optional(array(unknown())),
|
|
3869
|
-
item: optional(unknown()),
|
|
3870
|
-
page: optional(looseObject({ has_more: boolean() })),
|
|
3871
|
-
next,
|
|
3872
|
-
missing: optional(array(looseObject({ field: string(), why: string() }))),
|
|
3873
|
-
meta
|
|
3874
|
-
});
|
|
3875
|
-
}, "agentAnswer");
|
|
3876
|
-
var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3877
|
-
const checked = toStandardJsonSchema(ANSWER);
|
|
3878
|
-
const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
|
|
3879
|
-
return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
|
|
3880
|
-
}, "listedAs");
|
|
3881
|
-
var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
|
|
3882
|
-
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(" "));
|
|
3883
|
-
var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
|
|
3884
|
-
var stem = /* @__PURE__ */ __name((word2) => {
|
|
3885
|
-
const bare = word2.replace(/'s$/u, "");
|
|
3886
|
-
if (bare.length > 4 && bare.endsWith("ies"))
|
|
3887
|
-
return `${bare.slice(0, -3)}y`;
|
|
3888
|
-
for (const ending of ["ing", "ed", "es", "s"])
|
|
3889
|
-
if (bare.length - ending.length >= 3 && bare.endsWith(ending))
|
|
3890
|
-
return bare.slice(0, -ending.length);
|
|
3891
|
-
return bare;
|
|
3892
|
-
}, "stem");
|
|
3893
|
-
var sameWord = /* @__PURE__ */ __name((asked, known) => {
|
|
3894
|
-
if (asked === known)
|
|
3895
|
-
return true;
|
|
3896
|
-
const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
|
|
3897
|
-
return short.length >= 3 && long.startsWith(short);
|
|
3898
|
-
}, "sameWord");
|
|
3899
|
-
var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
|
|
3900
|
-
[4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
|
|
3901
|
-
[2, wordsOf(one.title)],
|
|
3902
|
-
[1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
|
|
3903
|
-
].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
|
|
3904
|
-
var search = /* @__PURE__ */ __name((commands, query) => {
|
|
3905
|
-
const named = normal(query);
|
|
3906
|
-
const all = Object.entries(commands);
|
|
3907
|
-
if (!named)
|
|
3908
|
-
return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
|
|
3909
|
-
const words = [
|
|
3910
|
-
...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
|
|
3911
|
-
];
|
|
3912
|
-
return all.map((entry) => {
|
|
3913
|
-
const fields = fieldsOf2(entry[0], entry[1]);
|
|
3914
|
-
const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
|
|
3915
|
-
const matched = weights.filter((weight) => weight > 0).length;
|
|
3916
|
-
const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
|
|
3917
|
-
return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
|
|
3918
|
-
}).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
|
|
3919
|
-
}, "search");
|
|
3920
|
-
var nearest = /* @__PURE__ */ __name((commands, asked) => {
|
|
3921
|
-
const words = normal(asked).split(" ");
|
|
3922
|
-
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);
|
|
3923
|
-
}, "nearest");
|
|
3924
|
-
var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
|
|
3925
|
-
const body = result.structuredContent;
|
|
3926
|
-
if (result.isError || !Array.isArray(body?.next))
|
|
3927
|
-
return result;
|
|
3928
|
-
const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
|
|
3929
|
-
const { next: _, ...rest } = body;
|
|
3930
|
-
const kept = next.length > 0 ? { ...rest, next } : rest;
|
|
3931
|
-
return {
|
|
3932
|
-
...result,
|
|
3933
|
-
structuredContent: kept,
|
|
3934
|
-
content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
|
|
3935
|
-
};
|
|
3936
|
-
}, "runnableOnly");
|
|
3937
|
-
var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
|
|
3938
|
-
var sampleOf = /* @__PURE__ */ __name((commands) => {
|
|
3939
|
-
const reading = Object.entries(commands).filter(([, one]) => !one.writes);
|
|
3940
|
-
const bare = reading.filter(([, one]) => takesNothing(one));
|
|
3941
|
-
return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
|
|
3942
|
-
}, "sampleOf");
|
|
3943
|
-
var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
|
|
3944
|
-
const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
|
|
3945
|
-
const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
|
|
3946
|
-
const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
|
|
3947
|
-
const sample = messenger ? "messages list" : sampleOf(commands);
|
|
3948
|
-
const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
|
|
3949
|
-
server.registerTool(`${prefix}_tools_search`, {
|
|
3950
|
-
outputSchema: toStandardJsonSchema(looseObject({})),
|
|
3951
|
-
title: "Find a command",
|
|
3952
|
-
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.`,
|
|
3953
|
-
inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
|
|
3954
|
-
annotations: { ...READ, openWorldHint: false, idempotentHint: true }
|
|
3955
|
-
}, async ({ query }) => {
|
|
3956
|
-
const found = search(commands, query ?? "");
|
|
3957
|
-
const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
|
|
3958
|
-
command,
|
|
3959
|
-
title: one.title,
|
|
3960
|
-
description: one.description,
|
|
3961
|
-
writes: one.writes,
|
|
3962
|
-
availability: one.availability?.() ?? { available: true },
|
|
3963
|
-
arguments: toJsonSchema(one.input),
|
|
3964
|
-
output: toJsonSchema(one.output ?? ANSWER)
|
|
3965
|
-
})) : found.map(([command, one]) => ({
|
|
3966
|
-
command,
|
|
3967
|
-
title: one.title,
|
|
3968
|
-
writes: one.writes,
|
|
3969
|
-
availability: one.availability?.() ?? { available: true }
|
|
3970
|
-
}));
|
|
3971
|
-
const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
|
|
3972
|
-
items,
|
|
3973
|
-
limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
|
|
3974
|
-
has_more: found.length > items.length
|
|
3975
|
-
});
|
|
3976
|
-
return answered(list);
|
|
3977
|
-
});
|
|
3978
|
-
const callers = {
|
|
3979
|
-
env: process.env,
|
|
3980
|
-
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
3981
|
-
connectionId: randomUUID()
|
|
3982
|
-
};
|
|
3983
|
-
const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
|
|
3984
|
-
try {
|
|
3985
|
-
const command = byNormal.get(normal(asked));
|
|
3986
|
-
const one = command === void 0 ? void 0 : commands[command];
|
|
3987
|
-
if (command === void 0 || !one) {
|
|
3988
|
-
withheld?.(normal(asked));
|
|
3989
|
-
const near = nearest(commands, asked);
|
|
3990
|
-
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`);
|
|
3991
|
-
}
|
|
3992
|
-
if (one.writes !== writing)
|
|
3993
|
-
throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
|
|
3994
|
-
const args = writing ? agentArguments(given ?? {}) : given ?? {};
|
|
3995
|
-
const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
|
|
3996
|
-
if (one.checked)
|
|
3997
|
-
return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
|
|
3998
|
-
const parsed = safeParse(strictObject(one.input.entries), args);
|
|
3999
|
-
if (!parsed.success)
|
|
4000
|
-
throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
|
|
4001
|
-
arguments: toJsonSchema(one.input)
|
|
4002
|
-
});
|
|
4003
|
-
return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
|
|
4004
|
-
} catch (error) {
|
|
4005
|
-
return failed(error, errors);
|
|
4006
|
-
}
|
|
4007
|
-
}, "runner");
|
|
4008
|
-
const call = strictObject({
|
|
4009
|
-
command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
|
|
4010
|
-
arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
|
|
4011
|
-
});
|
|
4012
|
-
server.registerTool(`${prefix}_read`, {
|
|
4013
|
-
outputSchema: listedAs(prefix, false),
|
|
4014
|
-
title: "Run a reading command",
|
|
4015
|
-
description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
4016
|
-
inputSchema: toStandardJsonSchema(call),
|
|
4017
|
-
annotations: READ
|
|
4018
|
-
}, runner(false));
|
|
4019
|
-
if (Object.values(commands).some((one) => one.writes))
|
|
4020
|
-
server.registerTool(`${prefix}_write`, {
|
|
4021
|
-
outputSchema: listedAs(prefix, true),
|
|
4022
|
-
title: "Run a writing command",
|
|
4023
|
-
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}`,
|
|
4024
|
-
inputSchema: toStandardJsonSchema(call),
|
|
4025
|
-
annotations: WRITE
|
|
4026
|
-
}, runner(true));
|
|
4027
|
-
}, "registerCommands");
|
|
4028
|
-
var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
|
|
4029
|
-
const run = entryRunner(registration);
|
|
4030
|
-
return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
|
|
4031
|
-
commandOf(key2, definition),
|
|
4032
|
-
{
|
|
4033
|
-
title: definition.title,
|
|
4034
|
-
description: definition.description,
|
|
4035
|
-
writes: definition.annotations.readOnlyHint !== true,
|
|
4036
|
-
input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
|
|
4037
|
-
...definition.output ? { output: outputSchemaOf(definition) } : {},
|
|
4038
|
-
checked: true,
|
|
4039
|
-
run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
|
|
4040
|
-
}
|
|
4041
|
-
]));
|
|
4042
|
-
}, "surfaceCommands");
|
|
4043
|
-
var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
|
|
4044
|
-
|
|
4045
3627
|
export {
|
|
4046
3628
|
toolsFromCommands,
|
|
4047
|
-
runCommandForAgent
|
|
4048
|
-
message,
|
|
4049
|
-
READ,
|
|
4050
|
-
WRITE,
|
|
4051
|
-
tool,
|
|
4052
|
-
chatOf,
|
|
4053
|
-
tierOf,
|
|
4054
|
-
outcomeOf,
|
|
4055
|
-
commandOf,
|
|
4056
|
-
toolKey,
|
|
4057
|
-
Picture,
|
|
4058
|
-
BinaryResource,
|
|
4059
|
-
answered,
|
|
4060
|
-
failed,
|
|
4061
|
-
normal,
|
|
4062
|
-
registerCommands,
|
|
4063
|
-
surfaceCommands,
|
|
4064
|
-
outputOf
|
|
3629
|
+
runCommandForAgent
|
|
4065
3630
|
};
|