@wirecat/tg-cli 0.133.0 → 0.134.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/contracts/wirecat.json +82 -2
- package/dist/bin/tg.js +2 -2
- package/dist/bot/generated/types.d.ts +188 -0
- package/dist/bot/generated/types.d.ts.map +1 -1
- package/dist/bundle/{adapter-GSGX3WBH.js → adapter-Y4IXTXAG.js} +104 -69
- package/dist/bundle/agent-G7VHOJMS.js +37 -0
- package/dist/bundle/{all-profiles-VOCJ55YH.js → all-profiles-SUGID6CX.js} +62 -20
- package/dist/bundle/{anthropic-J6CTLU3W.js → anthropic-4QKTXT4B.js} +5 -5
- package/dist/bundle/{app-server-GVFGA4TJ.js → app-server-TPOD6LIJ.js} +72 -62
- package/dist/bundle/{bot-api-LWONPIGK.js → bot-api-KBESP422.js} +73 -92
- package/dist/bundle/{bot-history-XOW7Y2GC.js → bot-history-3EORA23G.js} +23 -22
- package/dist/bundle/{bun-436CH6CP.js → bun-FL76M4M2.js} +2 -2
- package/dist/bundle/{bun-sqlite-ZLB5RK5Q.js → bun-sqlite-H37OSTAJ.js} +6 -6
- package/dist/bundle/{chunk-YY6FGKGD.js → chunk-2GT563YH.js} +2 -2
- package/dist/bundle/{chunk-5L44DSHV.js → chunk-2JWY7CXJ.js} +4 -4
- package/dist/bundle/{chunk-OX73ERZW.js → chunk-3O25FAPA.js} +3 -4
- package/dist/bundle/{chunk-TCI7I6YF.js → chunk-3PG6QVQZ.js} +11 -25
- package/dist/bundle/{chunk-NTWXL2QV.js → chunk-3QQWTP77.js} +2 -2
- package/dist/bundle/{chunk-TTDZVWDU.js → chunk-3ZNO27UE.js} +1 -1
- package/dist/bundle/{chunk-7NYP4RBO.js → chunk-4R2ZJGFF.js} +2125 -1179
- package/dist/bundle/{chunk-VGN5YXYI.js → chunk-4S2DHHJM.js} +2 -100
- package/dist/bundle/{chunk-H7ML7X3G.js → chunk-4X6BX3XP.js} +144 -10
- package/dist/bundle/{chunk-D2SJLZSH.js → chunk-6DGVK5KS.js} +2 -2
- package/dist/bundle/chunk-6DJJVFSG.js +388 -0
- package/dist/bundle/{chunk-M6QOM6SL.js → chunk-6MEHKUN6.js} +1 -1
- package/dist/bundle/{chunk-6CHIGUCY.js → chunk-6UNLEQA5.js} +31 -20
- package/dist/bundle/{chunk-WCYKVX3B.js → chunk-77E7Q4EQ.js} +7 -7
- package/dist/bundle/chunk-7GGDCQJ5.js +353 -0
- package/dist/bundle/{chunk-UIAKLELF.js → chunk-AHVWZDXO.js} +79 -64
- package/dist/bundle/{chunk-NO2LIHWA.js → chunk-ANBI3OXK.js} +1 -1
- package/dist/bundle/{chunk-LQQSDGQ6.js → chunk-AYWST6NA.js} +56 -46
- package/dist/bundle/{chunk-NAXOT35J.js → chunk-CA7DY2YU.js} +3 -3
- package/dist/bundle/{chunk-UKBK2VWZ.js → chunk-CDKXZLMP.js} +225 -175
- package/dist/bundle/{chunk-5HKPQPD4.js → chunk-CNGNR4CY.js} +6 -6
- package/dist/bundle/{chunk-KUA24HWG.js → chunk-CSXCCK6J.js} +2 -2
- package/dist/bundle/{chunk-VTQMR3XG.js → chunk-DG35TQ6P.js} +3 -3
- package/dist/bundle/{chunk-IPPCQ7IK.js → chunk-EXMAWEHC.js} +2 -2
- package/dist/bundle/{chunk-CEJYNB3I.js → chunk-FR3ATU5I.js} +4 -4
- package/dist/bundle/{chunk-XOX4BX5A.js → chunk-FR4Y5CGW.js} +4 -4
- package/dist/bundle/{chunk-JPNVEPS4.js → chunk-GIGZTI74.js} +2023 -1928
- package/dist/bundle/{chunk-UZ63ORMY.js → chunk-H3TLAYGY.js} +4 -4
- package/dist/bundle/{chunk-LBZEZO32.js → chunk-HD7DV5B2.js} +65 -43
- package/dist/bundle/{chunk-TPD37ECC.js → chunk-HETHFOHC.js} +3 -3
- package/dist/bundle/{chunk-JKSD43L7.js → chunk-HEZK4W3U.js} +6 -6
- package/dist/bundle/{chunk-SMU6NA7F.js → chunk-IJ7R2WMK.js} +4 -4
- package/dist/bundle/{chunk-7NF3V5L2.js → chunk-ITJ7DGNA.js} +4 -4
- package/dist/bundle/{chunk-JGMXBAGH.js → chunk-J5RB4ASI.js} +140 -433
- package/dist/bundle/{chunk-57KJ3TRS.js → chunk-JAL443BH.js} +9 -9
- package/dist/bundle/{chunk-IH4Z3KZU.js → chunk-JCDD5T3A.js} +2 -2
- package/dist/bundle/{chunk-BXVB42KJ.js → chunk-JHZJBNDO.js} +2 -2
- package/dist/bundle/chunk-JWLODUN3.js +555 -0
- package/dist/bundle/{chunk-54WLIPIQ.js → chunk-JWNSG5GI.js} +1 -1
- package/dist/bundle/{chunk-UGS57TT5.js → chunk-JXEO5EIN.js} +2 -2
- package/dist/bundle/{chunk-QYLZD4DS.js → chunk-K5FK6WWN.js} +1 -1
- package/dist/bundle/{chunk-QWO7L4UH.js → chunk-L47PFECD.js} +7 -7
- package/dist/bundle/{chunk-IYAXLLGR.js → chunk-L4PNDW4S.js} +6 -6
- package/dist/bundle/{chunk-ZHO3TPHM.js → chunk-M323L5SG.js} +30 -15
- package/dist/bundle/{chunk-6A44ZZFC.js → chunk-MMDFPBFZ.js} +43 -64
- package/dist/bundle/{chunk-OWY52JBO.js → chunk-MUV73B5A.js} +7 -7
- package/dist/bundle/{chunk-2KQDJHF3.js → chunk-MXA3FU2R.js} +29 -1
- package/dist/bundle/{chunk-6H2NW6HK.js → chunk-NUD4CBHK.js} +3 -3
- package/dist/bundle/{chunk-RABUG4KA.js → chunk-NYEVPAF2.js} +511 -472
- package/dist/bundle/{chunk-VWJTYAIQ.js → chunk-O3QBO6NW.js} +17 -17
- package/dist/bundle/{chunk-N7QREPZW.js → chunk-O4ZOQJ6W.js} +9 -9
- package/dist/bundle/{chunk-KEN4B57V.js → chunk-OJSPB4LA.js} +2 -2
- package/dist/bundle/{chunk-UQYL6TJ7.js → chunk-PCBVSHKD.js} +4 -4
- package/dist/bundle/{chunk-LIQMUDIZ.js → chunk-PK5WEGPJ.js} +2 -2
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-O6JUVATT.js → chunk-PRI2XTM7.js} +35 -12
- package/dist/bundle/chunk-PRM7GKBV.js +340 -0
- package/dist/bundle/{chunk-YAPDU3SV.js → chunk-PZ2ZFPGO.js} +1 -1
- package/dist/bundle/chunk-QYRK4XXH.js +727 -0
- package/dist/bundle/{chunk-XDQU5HBO.js → chunk-RVA3CRSY.js} +12 -12
- package/dist/bundle/{chunk-QVGEL66U.js → chunk-SPXNI53Z.js} +38 -9
- package/dist/bundle/{chunk-QGWISM4W.js → chunk-TI5U6AUT.js} +34 -28
- package/dist/bundle/{chunk-THYGLTRB.js → chunk-TKWYXM7L.js} +7 -7
- package/dist/bundle/{chunk-XKOMP3HV.js → chunk-TZCFJJEU.js} +6 -6
- package/dist/bundle/chunk-UTTEAOJ3.js +7 -0
- package/dist/bundle/chunk-V6G4LTXU.js +50 -0
- package/dist/bundle/{chunk-KVFUH5IT.js → chunk-VH4J7IIS.js} +1 -1
- package/dist/bundle/{chunk-VCAOH45X.js → chunk-VNJRWFHP.js} +1 -1
- package/dist/bundle/chunk-W2QSDPG6.js +80 -0
- package/dist/bundle/{chunk-LOS4D6ZB.js → chunk-WGGUKQE7.js} +113 -567
- package/dist/bundle/{chunk-ZYAHZKYF.js → chunk-WPXVJGSL.js} +3 -3
- package/dist/bundle/{chunk-IBCXEVNY.js → chunk-XLNV3U6N.js} +3 -3
- package/dist/bundle/{chunk-6S77EKZU.js → chunk-XS4EE7MO.js} +17 -15
- package/dist/bundle/{chunk-6VCSOQFL.js → chunk-XVRLD3LN.js} +2 -2
- package/dist/bundle/{chunk-HB5DP6L5.js → chunk-XZ6XEAJP.js} +18 -18
- package/dist/bundle/{chunk-N3JUHGKM.js → chunk-YHTSJMZ5.js} +3706 -3372
- package/dist/bundle/chunk-YPJCURT6.js +108 -0
- package/dist/bundle/{chunk-SMI2EUH4.js → chunk-Z77R76S2.js} +1 -1
- package/dist/bundle/{chunk-KHUXDSXN.js → chunk-ZC7OEYDX.js} +1 -1
- package/dist/bundle/{chunk-5LRTYBZW.js → chunk-ZW2N2GI2.js} +12 -12
- package/dist/bundle/command-contract-LEFXJAA3.js +37 -0
- package/dist/bundle/{command-server-entry-AE27QXTE.js → command-server-entry-WQAE5UGU.js} +27 -27
- package/dist/bundle/{decode-RQPPZ72F.js → decode-2J2DOVGV.js} +5 -5
- package/dist/bundle/{dispatch-KQO2MCSH.js → dispatch-IZ2TP5GW.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-FZRIACN4.js → echarts-GFIIHZ4U.js} +2 -2
- package/dist/bundle/{embed-TOSWWMDL.js → embed-AGOXADHW.js} +6 -6
- package/dist/bundle/{embedder-JHIQSBGD.js → embedder-PCIXGM2Y.js} +9 -9
- package/dist/bundle/{entry-DU4KRXTG.js → entry-HUQXUV52.js} +9 -9
- package/dist/bundle/{failure-3YC3YGYO.js → failure-JSRHZ2S6.js} +2 -2
- package/dist/bundle/{first-run-DQQT4FID.js → first-run-2LXN7B33.js} +12 -12
- package/dist/bundle/first-screen-VUE6RCSF.js +37 -0
- package/dist/bundle/{instructions-WI64CJQ6.js → instructions-RSLTJVFJ.js} +1 -1
- package/dist/bundle/{mcp-VMS6PBCU.js → mcp-MMENCB7I.js} +2 -2
- package/dist/bundle/meeting-combined-PBNPHOM3.js +23 -0
- package/dist/bundle/{meeting-model-XNRSREIK.js → meeting-model-SI77WMMK.js} +11 -11
- package/dist/bundle/{meeting-semantic-OOSCHQMB.js → meeting-semantic-WRXWUR4M.js} +6 -6
- package/dist/bundle/{node-JLKDNVKV.js → node-5XGMCUGQ.js} +2 -2
- package/dist/bundle/{node-sqlite-YOGH26O2.js → node-sqlite-ES7SQSIC.js} +7 -7
- package/dist/bundle/{oauth-FOMXM5HP.js → oauth-QFM4Y6N7.js} +8 -8
- package/dist/bundle/{open-SM2UXUKM.js → open-2MD2DKGQ.js} +5 -5
- package/dist/bundle/{openai-J2H7S6ZF.js → openai-6TMKJKYO.js} +15 -15
- package/dist/bundle/{process-HI7OZBOI.js → process-VA2DP7MY.js} +1 -1
- package/dist/bundle/{program-VY4HFU25.js → program-K3SLEA42.js} +70 -64
- package/dist/bundle/{prompt-NUUVFMOF.js → prompt-VZSPCE6E.js} +5 -5
- package/dist/bundle/{proxy-transport-AN4VMRRN.js → proxy-transport-OJU2EOOC.js} +5 -5
- package/dist/bundle/{recognize-MALJHPDI.js → recognize-LH3ZZEIL.js} +4 -4
- package/dist/bundle/{remote-QUDRSTS2.js → remote-JNW5HN2I.js} +9 -9
- package/dist/bundle/{rerank-2DSO3D3S.js → rerank-P23UJMII.js} +7 -7
- package/dist/bundle/{serve-NCJ52MY3.js → serve-VSLLMILH.js} +15 -15
- package/dist/bundle/{server-Y3M544AM.js → server-FBRRRKCS.js} +65 -54
- package/dist/bundle/server-TA4QP7PG.js +78 -0
- package/dist/bundle/{sqlite-runtime-NJUSXVKK.js → sqlite-runtime-LWATDAAU.js} +6 -6
- package/dist/bundle/{state-AVOWQVET.js → state-3AFJL2EL.js} +6 -6
- package/dist/bundle/{store-MMIYOL4H.js → store-6TLYL2VU.js} +28 -17
- package/dist/bundle/{store-BZ5ICDRP.js → store-PEXV5DNA.js} +20 -19
- package/dist/bundle/store-maintenance-command-IYJLUQ5X.js +65 -0
- package/dist/bundle/surface-L4VY4WFG.js +64 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/telegram/adapter.d.ts +9 -2
- package/dist/telegram/adapter.d.ts.map +1 -1
- package/dist/telegram/adapter.js +5 -6
- package/dist/telegram/adapter.js.map +1 -1
- package/dist/telegram/messages.d.ts +12 -0
- package/dist/telegram/messages.d.ts.map +1 -1
- package/dist/telegram/messages.js +40 -0
- package/dist/telegram/messages.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/tg-cli/SKILL.md +4 -2
- package/skills/tg-cli/references/messages.md +5 -1
- package/skills/tg-cli/references/search.md +2 -0
- package/dist/bundle/chunk-SHTHNBHG.js +0 -2
- package/dist/bundle/command-contract-TQIARAB4.js +0 -37
- package/dist/bundle/first-screen-7N4CTZSA.js +0 -37
- package/dist/bundle/meeting-combined-3RAOFQ7M.js +0 -23
- package/dist/bundle/server-CHGON5I2.js +0 -70
- package/dist/bundle/store-maintenance-command-VKZ4WHUB.js +0 -61
|
@@ -1,70 +1,35 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
agentArguments,
|
|
7
|
-
agentJson,
|
|
8
|
-
commandAvailability,
|
|
9
|
-
failureContext
|
|
10
|
-
} from "./chunk-JGMXBAGH.js";
|
|
4
|
+
commandAvailability
|
|
5
|
+
} from "./chunk-V6G4LTXU.js";
|
|
11
6
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
7
|
+
lentConnection
|
|
8
|
+
} from "./chunk-PRM7GKBV.js";
|
|
14
9
|
import {
|
|
15
|
-
QUERY_ARGUMENT
|
|
16
|
-
|
|
17
|
-
onlineDeps,
|
|
18
|
-
refuseLacking,
|
|
19
|
-
servicesFor,
|
|
20
|
-
storeModeDeps
|
|
21
|
-
} from "./chunk-N3JUHGKM.js";
|
|
10
|
+
QUERY_ARGUMENT
|
|
11
|
+
} from "./chunk-QYRK4XXH.js";
|
|
22
12
|
import {
|
|
23
|
-
MAX_BUFFERED_INPUT
|
|
24
|
-
} from "./chunk-UGS57TT5.js";
|
|
25
|
-
import {
|
|
26
|
-
DEFAULT_OUTPUT_BYTES,
|
|
27
|
-
ENTITIES,
|
|
28
|
-
LOCAL_WRITE,
|
|
29
|
-
REMOTE_WRITE,
|
|
30
|
-
answerSchema,
|
|
31
13
|
authorityAllowed,
|
|
32
14
|
botApiAllowed,
|
|
33
15
|
changesMessenger,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
judgedAnswer,
|
|
37
|
-
judgedEffects,
|
|
38
|
-
keyForCommand,
|
|
39
|
-
levelFor,
|
|
40
|
-
listOf,
|
|
41
|
-
readKeysForCommand,
|
|
42
|
-
refuseStoreChange,
|
|
43
|
-
sealed,
|
|
44
|
-
startRecording
|
|
45
|
-
} from "./chunk-UKBK2VWZ.js";
|
|
16
|
+
flatten
|
|
17
|
+
} from "./chunk-CDKXZLMP.js";
|
|
46
18
|
import {
|
|
47
|
-
currentCaller
|
|
48
|
-
|
|
49
|
-
runContextOf,
|
|
50
|
-
withCaller
|
|
51
|
-
} from "./chunk-QWO7L4UH.js";
|
|
19
|
+
currentCaller
|
|
20
|
+
} from "./chunk-L47PFECD.js";
|
|
52
21
|
import {
|
|
53
22
|
enclosingTraceId,
|
|
54
23
|
inRun,
|
|
55
24
|
newRunId,
|
|
56
25
|
traceOf
|
|
57
|
-
} from "./chunk-
|
|
58
|
-
import {
|
|
59
|
-
storeDamaged
|
|
60
|
-
} from "./chunk-ZYAHZKYF.js";
|
|
26
|
+
} from "./chunk-HD7DV5B2.js";
|
|
61
27
|
import {
|
|
62
28
|
queryDescription
|
|
63
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-NYEVPAF2.js";
|
|
64
30
|
import {
|
|
65
|
-
captureStreams
|
|
66
|
-
|
|
67
|
-
} from "./chunk-6CHIGUCY.js";
|
|
31
|
+
captureStreams
|
|
32
|
+
} from "./chunk-6UNLEQA5.js";
|
|
68
33
|
import {
|
|
69
34
|
COMPACT_FLAG,
|
|
70
35
|
SNAKE_CASE,
|
|
@@ -75,13 +40,7 @@ import {
|
|
|
75
40
|
errorObjectOf,
|
|
76
41
|
integer,
|
|
77
42
|
isoDate,
|
|
78
|
-
itemEnvelopeSchema,
|
|
79
|
-
listEnvelopeSchema,
|
|
80
43
|
literal,
|
|
81
|
-
looseObject,
|
|
82
|
-
maxLength,
|
|
83
|
-
maxValue,
|
|
84
|
-
mcpErrorResult,
|
|
85
44
|
minLength,
|
|
86
45
|
minValue,
|
|
87
46
|
number,
|
|
@@ -92,30 +51,25 @@ import {
|
|
|
92
51
|
pipe,
|
|
93
52
|
record,
|
|
94
53
|
regex,
|
|
95
|
-
safeParse,
|
|
96
54
|
strictObject,
|
|
97
55
|
string,
|
|
98
|
-
summarize,
|
|
99
56
|
text,
|
|
100
|
-
toJsonSchema,
|
|
101
|
-
toStandardJsonSchema,
|
|
102
57
|
union,
|
|
103
58
|
unknown,
|
|
104
59
|
word,
|
|
105
60
|
writes
|
|
106
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-SPXNI53Z.js";
|
|
107
62
|
import {
|
|
108
|
-
CliError
|
|
109
|
-
|
|
110
|
-
} from "./chunk-LIQMUDIZ.js";
|
|
63
|
+
CliError
|
|
64
|
+
} from "./chunk-PK5WEGPJ.js";
|
|
111
65
|
import {
|
|
112
66
|
__name
|
|
113
67
|
} from "./chunk-ZVVMGPBJ.js";
|
|
114
68
|
|
|
115
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
69
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.714.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.122.0_commander@15_dd9fedf917a0d541ef7fdcdb0be0e64b/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
116
70
|
import { Readable } from "node:stream";
|
|
117
71
|
|
|
118
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
72
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/lint.js
|
|
119
73
|
var LINT_SEVERITIES = ["high", "medium", "low"];
|
|
120
74
|
var lintRuleSchema = strictObject({
|
|
121
75
|
id: word,
|
|
@@ -261,7 +215,7 @@ var overrideSchema = strictObject({
|
|
|
261
215
|
});
|
|
262
216
|
var overridesSchema = array(overrideSchema);
|
|
263
217
|
|
|
264
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
218
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/audit.js
|
|
265
219
|
var auditRuleSchema = strictObject({ id: word, severity: picklist(LINT_SEVERITIES), summary: text });
|
|
266
220
|
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");
|
|
267
221
|
var AUDIT_RULES = defineAuditRules([
|
|
@@ -316,17 +270,20 @@ var parityGroupSchema = strictObject({
|
|
|
316
270
|
absent: optional(word),
|
|
317
271
|
/** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
|
|
318
272
|
only: optional(word),
|
|
273
|
+
/** The one CLI whose value (a summary, a value name) differs by design; every other CLI compared must agree. */
|
|
274
|
+
differs: optional(word),
|
|
319
275
|
reason: pipe(text, minLength(10, "say why, in a sentence")),
|
|
320
276
|
/** Warns from 14 days before and fails 14 days after, as a lint override does. */
|
|
321
277
|
review_after: optional(pipe(string(), isoDate("a date, YYYY-MM-DD")))
|
|
322
278
|
}))
|
|
323
279
|
});
|
|
280
|
+
var kindOf = /* @__PURE__ */ __name((entry) => ["absent", "only", "differs"].filter((one) => entry[one] !== void 0), "kindOf");
|
|
324
281
|
var defineParityGroups = /* @__PURE__ */ __name((input) => parseRegistry("parity groups", array(parityGroupSchema), input, (groups) => [
|
|
325
282
|
...duplicates(groups.map((group) => group.name)).map((name) => `"${name}" is listed twice`),
|
|
326
283
|
...groups.flatMap((group) => [
|
|
327
284
|
...duplicates(group.differences.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `${group.name}: "${both}" is listed twice`),
|
|
328
|
-
...group.differences.filter((entry) => (entry.
|
|
329
|
-
...group.differences.filter((entry) => entry.
|
|
285
|
+
...group.differences.filter((entry) => kindOf(entry).length === 1 && entry.expected).map((entry) => `${group.name}: "${entry.target}" has \`${kindOf(entry)[0]}\`, which measures the values itself; drop \`expected\``),
|
|
286
|
+
...group.differences.filter((entry) => kindOf(entry).length > 1).map((entry) => `${group.name}: "${entry.target}" has ${kindOf(entry).map((one) => `\`${one}\``).join(" and ")}; keep one`)
|
|
330
287
|
])
|
|
331
288
|
]), "defineParityGroups");
|
|
332
289
|
var MEMO_HAS_NO_PROFILES = [
|
|
@@ -341,6 +298,12 @@ var MEMO_HAS_NO_PROFILES = [
|
|
|
341
298
|
absent: "memo",
|
|
342
299
|
reason: "memo has no profiles: it reads other CLIs' stores and selects their accounts with --source and --account (https://github.com/WireCatLabs/cli-base/issues/390)"
|
|
343
300
|
}));
|
|
301
|
+
var MEMO_MCP_SUMMARIES = ["mcp", "mcp serve"].map((path) => ({
|
|
302
|
+
rule: "same-path-contract",
|
|
303
|
+
target: `${path}: summary`,
|
|
304
|
+
differs: "memo",
|
|
305
|
+
reason: "memo has no profiles, so its mcp commands serve memo's commands rather than a profile's"
|
|
306
|
+
}));
|
|
344
307
|
var MEMO_DOCTOR_DEEP = {
|
|
345
308
|
rule: "same-path-contract",
|
|
346
309
|
target: "doctor --deep",
|
|
@@ -371,7 +334,7 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
371
334
|
name: "all",
|
|
372
335
|
members: ["tg", "max", "memo", "drive", "zm", "wa"],
|
|
373
336
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
|
|
374
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
337
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
375
338
|
},
|
|
376
339
|
// mail's `search messages` is cli-core's mail search, not the messengers' command: --complete took their 20-odd
|
|
377
340
|
// differences as inherited (https://github.com/WireCatLabs/cli-base/issues/390). mail is compared everywhere else
|
|
@@ -380,7 +343,7 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
380
343
|
name: "mail-shared",
|
|
381
344
|
members: ["tg", "max", "memo", "drive", "zm", "wa", "mail"],
|
|
382
345
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
|
|
383
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
346
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
384
347
|
},
|
|
385
348
|
// gcal is compared on what it already shares with every CLI; doctor, mcp, search and skill wait until the published
|
|
386
349
|
// CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
|
|
@@ -392,27 +355,56 @@ var PARITY_GROUPS = defineParityGroups([
|
|
|
392
355
|
},
|
|
393
356
|
// bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
|
|
394
357
|
// recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
|
|
395
|
-
//
|
|
358
|
+
// amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
|
|
359
|
+
// notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
|
|
360
|
+
// its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
|
|
361
|
+
// and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
|
|
396
362
|
{
|
|
397
363
|
name: "shared-roots",
|
|
398
|
-
members: [
|
|
364
|
+
members: [
|
|
365
|
+
"tg",
|
|
366
|
+
"max",
|
|
367
|
+
"memo",
|
|
368
|
+
"drive",
|
|
369
|
+
"zm",
|
|
370
|
+
"wa",
|
|
371
|
+
"b24",
|
|
372
|
+
"beeline",
|
|
373
|
+
"pbx",
|
|
374
|
+
"notion",
|
|
375
|
+
"amo",
|
|
376
|
+
"hubspot",
|
|
377
|
+
"attio",
|
|
378
|
+
"ydisk"
|
|
379
|
+
],
|
|
399
380
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
|
|
400
|
-
differences: [...MEMO_HAS_NO_PROFILES, MEMO_DOCTOR_DEEP]
|
|
381
|
+
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP]
|
|
401
382
|
},
|
|
402
|
-
// The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet
|
|
403
|
-
//
|
|
404
|
-
// later) and `deals delete` (amoCRM's
|
|
405
|
-
// https://www.amocrm.ru/developers/content/crm_platform/leads-api)
|
|
406
|
-
// these need no difference. `people`, `organizations`,
|
|
407
|
-
// is on cli-core's shared people and organizations
|
|
408
|
-
// in options, outputs and summaries.
|
|
383
|
+
// The CRM CLIs on cli-core's shared CRM commands. amo-cli (amoCRM and Kommo) is not on npm yet and hubspot-cli is
|
|
384
|
+
// not in the family packages, so `audit --family` skips them, as beeline. Only b24 and hubspot have `leads` (amoCRM
|
|
385
|
+
// has no lead apart from a deal), only b24 has `products` (amo leaves them for later) and `deals delete` (amoCRM's
|
|
386
|
+
// API v4 cannot delete a lead, https://www.amocrm.ru/developers/content/crm_platform/leads-api), and hubspot writes
|
|
387
|
+
// no deals yet; a list of roots does not compare presence, so these need no difference. `people`, `organizations`,
|
|
388
|
+
// `users`, `api` and `session` join once b24's released tree is on cli-core's shared people and organizations
|
|
389
|
+
// commands: measured against b24 0.23.0 on 2026-11-16 they differ in options, outputs and summaries.
|
|
409
390
|
{
|
|
410
391
|
name: "crm",
|
|
411
|
-
members: ["b24", "amo"],
|
|
392
|
+
members: ["b24", "amo", "hubspot", "attio"],
|
|
412
393
|
covers: ["deals", "sync", "search", "store", "schedule", "account"],
|
|
413
|
-
differences: [
|
|
394
|
+
differences: [
|
|
395
|
+
{
|
|
396
|
+
rule: "same-path-contract",
|
|
397
|
+
target: "schedule: summary",
|
|
398
|
+
differs: "hubspot",
|
|
399
|
+
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",
|
|
400
|
+
review_after: "2026-12-01"
|
|
401
|
+
}
|
|
402
|
+
]
|
|
414
403
|
}
|
|
415
404
|
]);
|
|
405
|
+
var SHARED_DIFFERENCES = [
|
|
406
|
+
...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()
|
|
407
|
+
];
|
|
416
408
|
var requiredRootSchema = strictObject({ path: pipe(array(segment), minLength(1)), meaning: text });
|
|
417
409
|
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");
|
|
418
410
|
var REQUIRED_ROOTS = defineRequiredRoots([
|
|
@@ -424,7 +416,7 @@ var REQUIRED_ROOTS = defineRequiredRoots([
|
|
|
424
416
|
{ path: ["upgrade"], meaning: "updates the CLI" }
|
|
425
417
|
]);
|
|
426
418
|
|
|
427
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
419
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/fields.js
|
|
428
420
|
var fieldRuleSchema = strictObject({ id: word, rule: text });
|
|
429
421
|
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");
|
|
430
422
|
var FIELD_RULES = defineFieldRules([
|
|
@@ -440,7 +432,7 @@ var FIELD_RULES = defineFieldRules([
|
|
|
440
432
|
}
|
|
441
433
|
]);
|
|
442
434
|
|
|
443
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
435
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/identifiers.js
|
|
444
436
|
var key = pipe(string(), regex(SNAKE_CASE, "a snake_case key"));
|
|
445
437
|
var identifierSchema = strictObject({ key, meaning: text, replaces: optional(array(key)) });
|
|
446
438
|
var defineIdentifiers = /* @__PURE__ */ __name((input) => parseRegistry("identifiers", array(identifierSchema), input, (identifiers) => {
|
|
@@ -462,7 +454,7 @@ var IDENTIFIERS = defineIdentifiers([
|
|
|
462
454
|
{ key: "trace_id", meaning: "the distributed trace a run belongs to, from `traceparent`" }
|
|
463
455
|
]);
|
|
464
456
|
|
|
465
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
457
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-account.js
|
|
466
458
|
var ACCOUNT_FLAGS = [
|
|
467
459
|
{
|
|
468
460
|
name: "--client-id",
|
|
@@ -499,7 +491,7 @@ var ACCOUNT_FLAGS = [
|
|
|
499
491
|
{ name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" }
|
|
500
492
|
];
|
|
501
493
|
|
|
502
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
494
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-calendar.js
|
|
503
495
|
var CALENDAR_FLAGS = [
|
|
504
496
|
{ name: "--end-time", value: "<time>", role: "value", type: "time", meaning: "when it ends" },
|
|
505
497
|
{
|
|
@@ -587,7 +579,7 @@ var CALENDAR_FLAGS = [
|
|
|
587
579
|
}
|
|
588
580
|
];
|
|
589
581
|
|
|
590
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
582
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-crm.js
|
|
591
583
|
var CRM_FLAGS = [
|
|
592
584
|
{
|
|
593
585
|
name: "--email",
|
|
@@ -751,7 +743,7 @@ var CRM_FLAGS = [
|
|
|
751
743
|
}
|
|
752
744
|
];
|
|
753
745
|
|
|
754
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
746
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-how.js
|
|
755
747
|
var HOW_FLAGS = [
|
|
756
748
|
{
|
|
757
749
|
name: "--limit",
|
|
@@ -1131,13 +1123,7 @@ var HOW_FLAGS = [
|
|
|
1131
1123
|
type: "string",
|
|
1132
1124
|
meaning: "a person whose reply counts as an answer; repeat it for more"
|
|
1133
1125
|
},
|
|
1134
|
-
{
|
|
1135
|
-
name: "--browser",
|
|
1136
|
-
value: "<program>",
|
|
1137
|
-
role: "mode",
|
|
1138
|
-
type: "string",
|
|
1139
|
-
meaning: "the browser program to open for sign-in"
|
|
1140
|
-
},
|
|
1126
|
+
{ name: "--browser", value: "<program>", role: "mode", type: "string", meaning: "the browser to open for sign-in" },
|
|
1141
1127
|
{
|
|
1142
1128
|
name: "--credential-storage",
|
|
1143
1129
|
value: "<storage>",
|
|
@@ -1146,6 +1132,8 @@ var HOW_FLAGS = [
|
|
|
1146
1132
|
meaning: "where a sign-in is kept: keyring, which falls back to a private file by itself, or file (WC-SECR-4)"
|
|
1147
1133
|
},
|
|
1148
1134
|
{ name: "--checkpoint", value: "<file>", role: "mode", type: "path", meaning: "keep resume progress in this file" },
|
|
1135
|
+
{ name: "--site", value: "<address>", role: "mode", type: "string", meaning: "the owner's site a sign-in is for" },
|
|
1136
|
+
{ name: "--login", value: "<name>", role: "mode", type: "string", meaning: "the user name a password is for" },
|
|
1149
1137
|
{
|
|
1150
1138
|
name: "--expected-event-id",
|
|
1151
1139
|
value: "<id>",
|
|
@@ -1748,7 +1736,7 @@ var HOW_FLAGS = [
|
|
|
1748
1736
|
}
|
|
1749
1737
|
];
|
|
1750
1738
|
|
|
1751
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1739
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-knowledge.js
|
|
1752
1740
|
var KNOWLEDGE_FLAGS = [
|
|
1753
1741
|
{
|
|
1754
1742
|
name: "--accept-terms",
|
|
@@ -1784,6 +1772,13 @@ var KNOWLEDGE_FLAGS = [
|
|
|
1784
1772
|
meaning: "at most this many characters read",
|
|
1785
1773
|
unit: "characters"
|
|
1786
1774
|
},
|
|
1775
|
+
{
|
|
1776
|
+
name: "--tab",
|
|
1777
|
+
value: "<id>",
|
|
1778
|
+
role: "target",
|
|
1779
|
+
type: "id",
|
|
1780
|
+
meaning: "one tab of a document, by its id: only its text is read"
|
|
1781
|
+
},
|
|
1787
1782
|
{
|
|
1788
1783
|
name: "--tag",
|
|
1789
1784
|
value: "<name>",
|
|
@@ -1800,7 +1795,7 @@ var KNOWLEDGE_FLAGS = [
|
|
|
1800
1795
|
}
|
|
1801
1796
|
];
|
|
1802
1797
|
|
|
1803
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1798
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-mail.js
|
|
1804
1799
|
var MAIL_FLAGS = [
|
|
1805
1800
|
{
|
|
1806
1801
|
name: "--cc",
|
|
@@ -1830,7 +1825,7 @@ var MAIL_FLAGS = [
|
|
|
1830
1825
|
}
|
|
1831
1826
|
];
|
|
1832
1827
|
|
|
1833
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1828
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-privacy.js
|
|
1834
1829
|
var PRIVACY_FLAGS = [
|
|
1835
1830
|
{
|
|
1836
1831
|
name: "--about-text",
|
|
@@ -1891,7 +1886,7 @@ var PRIVACY_FLAGS = [
|
|
|
1891
1886
|
{ name: "--read-receipts", value: "<on|off>", role: "value", type: "choice", meaning: "send read receipts" }
|
|
1892
1887
|
];
|
|
1893
1888
|
|
|
1894
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1889
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-schedule.js
|
|
1895
1890
|
var SCHEDULE_FLAGS = [
|
|
1896
1891
|
{
|
|
1897
1892
|
name: "--locale",
|
|
@@ -1924,7 +1919,7 @@ var SCHEDULE_FLAGS = [
|
|
|
1924
1919
|
}
|
|
1925
1920
|
];
|
|
1926
1921
|
|
|
1927
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1922
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/flags-what.js
|
|
1928
1923
|
var WHAT_FLAGS = [
|
|
1929
1924
|
{
|
|
1930
1925
|
name: "--analysis-provider",
|
|
@@ -2921,7 +2916,7 @@ var WHAT_FLAGS = [
|
|
|
2921
2916
|
}
|
|
2922
2917
|
];
|
|
2923
2918
|
|
|
2924
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
2919
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.122.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/vocabulary.js
|
|
2925
2920
|
var FLAG_TYPES = [
|
|
2926
2921
|
"switch",
|
|
2927
2922
|
"count",
|
|
@@ -3051,6 +3046,10 @@ var verbs = [
|
|
|
3051
3046
|
["export", "write from the store to a file"],
|
|
3052
3047
|
["import", "bring a file or list the user gives into the store or the messenger, once"],
|
|
3053
3048
|
["download", "save a file from the source to this machine"],
|
|
3049
|
+
["upload", "put a file from this machine on the source"],
|
|
3050
|
+
["publish", "open a thing to anyone who has its public link"],
|
|
3051
|
+
["unpublish", "close a thing's public link"],
|
|
3052
|
+
["stale", "mark a saved memory as out of date, keeping it"],
|
|
3054
3053
|
["transcribe", "turn speech into text"],
|
|
3055
3054
|
["extract", "read the text inside files already on this machine into the store"],
|
|
3056
3055
|
["migrate", "bring a file up to this build's schema"],
|
|
@@ -3193,6 +3192,10 @@ var collections = [
|
|
|
3193
3192
|
["transactions", "money that moved in or out of a wallet, as the bank or the owner recorded it"],
|
|
3194
3193
|
["splits", "parts of one transaction, each with its own amount and category"],
|
|
3195
3194
|
["users", "people who work in the owner's account at a service, such as a CRM's employees"],
|
|
3195
|
+
["issues", "work items in an issue tracker, each in a team, a workflow state and maybe a project"],
|
|
3196
|
+
["teams", "groups in a tracker that own issues, states and labels"],
|
|
3197
|
+
["states", "the workflow steps a tracker team moves its issues through, each of a type such as started"],
|
|
3198
|
+
["labels", "a tracker's shared labels on issues, kept by the tracker and not by the owner"],
|
|
3196
3199
|
["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
|
|
3197
3200
|
["activities", "a CRM's calls, e-mails, meetings, to-dos and comments on its records"],
|
|
3198
3201
|
["changes", "what changed in a copied source over a time: records added, moved, closed or reassigned"],
|
|
@@ -3261,6 +3264,10 @@ var singulars = [
|
|
|
3261
3264
|
["privacy", "who may find, see, call or add the account"],
|
|
3262
3265
|
["metadata", "a profile's cached source attributes"],
|
|
3263
3266
|
["auth", "the credentials a bot profile uses: its token and the secrets beside it"],
|
|
3267
|
+
[
|
|
3268
|
+
"scheduled",
|
|
3269
|
+
"a chat's messages the messenger will send later; their ids are their own, never the ids of sent messages"
|
|
3270
|
+
],
|
|
3264
3271
|
[
|
|
3265
3272
|
"schedule",
|
|
3266
3273
|
"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"
|
|
@@ -3344,7 +3351,7 @@ var VOCABULARY = defineVocabulary({
|
|
|
3344
3351
|
]
|
|
3345
3352
|
});
|
|
3346
3353
|
|
|
3347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3354
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.714.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.122.0_commander@15_dd9fedf917a0d541ef7fdcdb0be0e64b/node_modules/@wirecat/cli-core/dist/mcp/agent.js
|
|
3348
3355
|
var TYPES = new Map(VOCABULARY.flags.map((flag) => [flag.name, flag.type]));
|
|
3349
3356
|
var snake = /* @__PURE__ */ __name((name) => name.replaceAll("|", "_or_").replace(/[^a-z0-9]+/gi, "_"), "snake");
|
|
3350
3357
|
var longOf = /* @__PURE__ */ __name((option) => option.flags.match(/--[a-z0-9][a-z0-9-]*/)?.[0], "longOf");
|
|
@@ -3515,7 +3522,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3515
3522
|
const { argv, stdin } = argvOf(info, input, ctx.profile, ctx.stdin);
|
|
3516
3523
|
const lend = ctx.connection;
|
|
3517
3524
|
let borrowed;
|
|
3518
|
-
let
|
|
3525
|
+
let answered = false;
|
|
3519
3526
|
let result;
|
|
3520
3527
|
let failure;
|
|
3521
3528
|
const streams = captureStreams();
|
|
@@ -3537,7 +3544,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3537
3544
|
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
3538
3545
|
agent: {
|
|
3539
3546
|
result: /* @__PURE__ */ __name((value) => {
|
|
3540
|
-
|
|
3547
|
+
answered = true;
|
|
3541
3548
|
result = value;
|
|
3542
3549
|
}, "result"),
|
|
3543
3550
|
failure: /* @__PURE__ */ __name((object2) => {
|
|
@@ -3559,7 +3566,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3559
3566
|
}));
|
|
3560
3567
|
if (failure)
|
|
3561
3568
|
return { error: failure };
|
|
3562
|
-
if (
|
|
3569
|
+
if (answered)
|
|
3563
3570
|
return { result };
|
|
3564
3571
|
if (code !== 0)
|
|
3565
3572
|
throw new CliError("invalid_response", `the command exited with ${code} and said nothing`);
|
|
@@ -3571,468 +3578,7 @@ var runCommandForAgent = /* @__PURE__ */ __name(async (program, path, input, ctx
|
|
|
3571
3578
|
}
|
|
3572
3579
|
}, "runCommandForAgent");
|
|
3573
3580
|
|
|
3574
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.681.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.106.0_commander@15_8d845c31697914d824aa80d8eec93941/node_modules/@wirecat/cli-core/dist/mcp/tool.js
|
|
3575
|
-
var limit = optional(pipe(number(), integer(), minValue(1), maxValue(100), description("how many")));
|
|
3576
|
-
var page = optional(pipe(number(), integer(), minValue(1), description("which page, from 1")));
|
|
3577
|
-
var message = pipe(
|
|
3578
|
-
string(),
|
|
3579
|
-
maxLength(256),
|
|
3580
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point
|
|
3581
|
-
regex(/^[^\s\x00-\x1F\x7F-\x9F]+$/, "a message id has no spaces or control characters"),
|
|
3582
|
-
description("message id")
|
|
3583
|
-
);
|
|
3584
|
-
var READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: true };
|
|
3585
|
-
var WRITE = {
|
|
3586
|
-
readOnlyHint: false,
|
|
3587
|
-
destructiveHint: true,
|
|
3588
|
-
idempotentHint: false,
|
|
3589
|
-
openWorldHint: true
|
|
3590
|
-
};
|
|
3591
|
-
var tool = /* @__PURE__ */ __name((definition) => definition, "tool");
|
|
3592
|
-
var chatOf = /* @__PURE__ */ __name((messenger) => pipe(string(), minLength(1), description(messenger.chatArgument)), "chatOf");
|
|
3593
|
-
var tierOf = /* @__PURE__ */ __name((key2, definition, messenger) => {
|
|
3594
|
-
if (definition.annotations.readOnlyHint === true)
|
|
3595
|
-
return "read";
|
|
3596
|
-
if (/^admin|_admin/.test(key2))
|
|
3597
|
-
return "admin";
|
|
3598
|
-
if (/delete|ban|kick|remove|purge|block/.test(key2))
|
|
3599
|
-
return "destructive";
|
|
3600
|
-
if (/draft/.test(key2))
|
|
3601
|
-
return "draft";
|
|
3602
|
-
if (key2 === "messages_pin" && messenger?.quietPins === false)
|
|
3603
|
-
return "write-public";
|
|
3604
|
-
if (/mark_read|mark_unread|read_mark|archive|mute|pin|tag|note|label|folder|alias|save|_(un)?star$/.test(key2))
|
|
3605
|
-
return "write-private";
|
|
3606
|
-
return "write-public";
|
|
3607
|
-
}, "tierOf");
|
|
3608
|
-
var effectsOf = /* @__PURE__ */ __name((definition) => {
|
|
3609
|
-
if (definition.effects)
|
|
3610
|
-
return definition.effects;
|
|
3611
|
-
const { readOnlyHint, openWorldHint } = definition.annotations;
|
|
3612
|
-
if (readOnlyHint === true)
|
|
3613
|
-
return { remote: openWorldHint === false ? "none" : "read", local: "read" };
|
|
3614
|
-
return openWorldHint === false ? LOCAL_WRITE : REMOTE_WRITE;
|
|
3615
|
-
}, "effectsOf");
|
|
3616
|
-
var outcomeOf = /* @__PURE__ */ __name((result) => {
|
|
3617
|
-
if (!result.isError)
|
|
3618
|
-
return { status: "ok" };
|
|
3619
|
-
const code = result.structuredContent?.error?.code;
|
|
3620
|
-
const error = typeof code === "string" ? code : "generic_failure";
|
|
3621
|
-
return { status: error === "permission_error" ? "refused" : "failed", error };
|
|
3622
|
-
}, "outcomeOf");
|
|
3623
|
-
var commandOf = /* @__PURE__ */ __name((name, definition) => definition.command ?? name.replaceAll("_", " "), "commandOf");
|
|
3624
|
-
var toolKey = /* @__PURE__ */ __name((name, definition) => definition.key !== void 0 ? definition.key : keyForCommand(commandOf(name, definition).split(" ")), "toolKey");
|
|
3625
|
-
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");
|
|
3626
|
-
var syncAllowedFor = /* @__PURE__ */ __name((key2, defaults) => {
|
|
3627
|
-
const permissions = defaults.settings.permissions ?? {};
|
|
3628
|
-
const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
|
|
3629
|
-
return shared && (!key2.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key2.replaceAll("_", ".")}.sync-first`).level));
|
|
3630
|
-
}, "syncAllowedFor");
|
|
3631
|
-
var entryRunner = /* @__PURE__ */ __name((registration) => {
|
|
3632
|
-
const run = callRunner(registration);
|
|
3633
|
-
const { log } = registration;
|
|
3634
|
-
return async (key2, definition, args, ctx) => {
|
|
3635
|
-
const startedAt = Date.now();
|
|
3636
|
-
const command = `mcp ${commandOf(key2, definition)}`;
|
|
3637
|
-
const traceId = traceIdOf(ctx?.mcpReq?._meta?.traceparent);
|
|
3638
|
-
const app = registration.messenger?.app;
|
|
3639
|
-
const caller = registration.callers ? callerOf(ctx, key2, registration.callers) : currentCaller();
|
|
3640
|
-
const env = registration.defaults.env ?? process.env;
|
|
3641
|
-
const settings = registration.defaults.settings;
|
|
3642
|
-
const recording = key2 !== "runs_search" && settings.keepFailedRuns !== false && app?.appName ? startRecording({
|
|
3643
|
-
app,
|
|
3644
|
-
command,
|
|
3645
|
-
...settings.profile === void 0 ? {} : { profile: settings.profile },
|
|
3646
|
-
env,
|
|
3647
|
-
record: keepsSuccess({ record: settings.record ?? true, fromFlag: false, env, caller }),
|
|
3648
|
-
keepFailed: true,
|
|
3649
|
-
trace: false,
|
|
3650
|
-
format: "json",
|
|
3651
|
-
context: runContextOf({ bin: app.command, command, env, caller }),
|
|
3652
|
-
...settings.keepRunsForDays === void 0 ? {} : { keepDays: settings.keepRunsForDays },
|
|
3653
|
-
...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
|
|
3654
|
-
...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
|
|
3655
|
-
...traceId === void 0 ? {} : { traceId }
|
|
3656
|
-
}) : void 0;
|
|
3657
|
-
const profile = registration.defaults.settings.profile;
|
|
3658
|
-
const scope = {
|
|
3659
|
-
runId: recording?.runId ?? newRunId(new Date(startedAt), command),
|
|
3660
|
-
command,
|
|
3661
|
-
startedAt,
|
|
3662
|
-
...profile === void 0 ? {} : { profile },
|
|
3663
|
-
...traceId === void 0 ? {} : { traceId },
|
|
3664
|
-
...recording ? { events: recording.events } : {}
|
|
3665
|
-
};
|
|
3666
|
-
const work = /* @__PURE__ */ __name(() => inRun(scope, () => {
|
|
3667
|
-
const input = inputOf(definition, syncAllowedFor(key2, registration.defaults));
|
|
3668
|
-
const parsed = safeParse(input, args);
|
|
3669
|
-
return parsed.success ? run(key2, definition, parsed.output, ctx) : failed(new CliError("validation_error", `${commandOf(key2, definition)}: ${summarize(parsed.issues)}`, {
|
|
3670
|
-
arguments: toJsonSchema(input)
|
|
3671
|
-
}), app?.errors);
|
|
3672
|
-
}), "work");
|
|
3673
|
-
const result = await (caller ? withCaller(caller, work) : work());
|
|
3674
|
-
if (recording) {
|
|
3675
|
-
if (result.isError) {
|
|
3676
|
-
const error = result.structuredContent?.error;
|
|
3677
|
-
const code = error?.code && errorCodes.includes(error.code) ? error.code : void 0;
|
|
3678
|
-
await recording.fail(code ? new CliError(code, "MCP operation failed") : new Error("MCP operation failed")).catch(() => void 0);
|
|
3679
|
-
} else
|
|
3680
|
-
await recording.succeed(result.structuredContent).catch(() => void 0);
|
|
3681
|
-
}
|
|
3682
|
-
await log?.({
|
|
3683
|
-
tool: key2,
|
|
3684
|
-
tier: tierOf(key2, definition, registration.messenger),
|
|
3685
|
-
...outcomeOf(result),
|
|
3686
|
-
startedAt,
|
|
3687
|
-
finishedAt: Date.now()
|
|
3688
|
-
}, caller)?.catch(() => void 0);
|
|
3689
|
-
return result;
|
|
3690
|
-
};
|
|
3691
|
-
}, "entryRunner");
|
|
3692
|
-
var callRunner = /* @__PURE__ */ __name(({ messenger, session, withStore, withServices, defaults, around, targets }) => {
|
|
3693
|
-
const where = {
|
|
3694
|
-
profile: defaults.settings.profile,
|
|
3695
|
-
env: defaults.env,
|
|
3696
|
-
pictures: defaults.settings.pictureSearch,
|
|
3697
|
-
reranker: defaults.settings.searchReranker
|
|
3698
|
-
};
|
|
3699
|
-
return async (key2, definition, args, ctx) => {
|
|
3700
|
-
const path = commandOf(key2, definition).split(" ");
|
|
3701
|
-
const run = `mcp ${path.join(" ")}`;
|
|
3702
|
-
try {
|
|
3703
|
-
const execute = /* @__PURE__ */ __name(async () => {
|
|
3704
|
-
const syncAllowed = syncAllowedFor(key2, defaults);
|
|
3705
|
-
if (Buffer.byteLength(JSON.stringify(args)) > MAX_BUFFERED_INPUT)
|
|
3706
|
-
throw new CliError("validation_error", "tool arguments exceed the buffered input limit", {
|
|
3707
|
-
reason: "input.too-large",
|
|
3708
|
-
max_bytes: MAX_BUFFERED_INPUT,
|
|
3709
|
-
retryable: false
|
|
3710
|
-
});
|
|
3711
|
-
definition.check?.(args);
|
|
3712
|
-
if (definition.changesStore)
|
|
3713
|
-
refuseStoreChange(messenger.app, defaults.env);
|
|
3714
|
-
refuseLacking(messenger, path);
|
|
3715
|
-
for (const permission of readKeysForCommand(path)) {
|
|
3716
|
-
if (levelFor(defaults.settings.permissions ?? {}, permission).level === "deny")
|
|
3717
|
-
throw new CliError("permission_error", `profile denies ${permission}`, { permission });
|
|
3718
|
-
}
|
|
3719
|
-
if (args.sync_first && !syncAllowed)
|
|
3720
|
-
throw new CliError("permission_error", "messages.sync-first is not allowed by this profile");
|
|
3721
|
-
if (definition.custom) {
|
|
3722
|
-
const result2 = await definition.custom(args, { ...defaults, signal: ctx.mcpReq.signal }, ctx);
|
|
3723
|
-
return answered(result2, definition.outputLimit?.(args, defaults), targets);
|
|
3724
|
-
}
|
|
3725
|
-
if (definition.local)
|
|
3726
|
-
return answered(await definition.local(args, defaults), definition.outputLimit?.(args, defaults), targets);
|
|
3727
|
-
const { online, stored: local, served } = definition;
|
|
3728
|
-
const stored = local && (!definition.storedWhen || definition.storedWhen(args)) ? local : void 0;
|
|
3729
|
-
const result = stored ? await withStore((store, account) => stored(store, account, args, { ...defaults, signal: ctx.mcpReq.signal }, (work) => session.use(run, work)), {
|
|
3730
|
-
name: run
|
|
3731
|
-
}) : served && withServices ? await withServices((services, connect) => served(services, args, defaults, connect), { name: run }) : served && messenger.history === "store" ? await withStore((store, account) => served(servicesFor({
|
|
3732
|
-
...storeModeDeps(messenger, store, account, defaults.guard),
|
|
3733
|
-
...where,
|
|
3734
|
-
embedders: defaults.embedders
|
|
3735
|
-
}), args, defaults, (work) => session.use(run, async (adapter, release) => {
|
|
3736
|
-
try {
|
|
3737
|
-
return await work(adapter);
|
|
3738
|
-
} finally {
|
|
3739
|
-
await release();
|
|
3740
|
-
}
|
|
3741
|
-
})), { name: run }) : served ? await session.use(run, (adapter, release) => served(servicesFor(onlineDeps(messenger, adapter, defaults.guard, where)), args, defaults, (work) => (async () => {
|
|
3742
|
-
try {
|
|
3743
|
-
return await work(adapter);
|
|
3744
|
-
} finally {
|
|
3745
|
-
await release();
|
|
3746
|
-
}
|
|
3747
|
-
})())) : await session.use(run, (adapter, release) => online(adapter, args, { ...defaults, release }));
|
|
3748
|
-
return answered(result, definition.outputLimit?.(args, defaults), targets);
|
|
3749
|
-
}, "execute");
|
|
3750
|
-
return around ? await around(key2, definition, execute) : await execute();
|
|
3751
|
-
} catch (error) {
|
|
3752
|
-
return failed(error, messenger?.app?.errors, effectsOf(definition));
|
|
3753
|
-
}
|
|
3754
|
-
};
|
|
3755
|
-
}, "callRunner");
|
|
3756
|
-
var outputSchemaOf = /* @__PURE__ */ __name((definition) => {
|
|
3757
|
-
if (!definition.output)
|
|
3758
|
-
return looseObject({});
|
|
3759
|
-
const entity = ENTITIES[definition.output.entity];
|
|
3760
|
-
return definition.output.list ? listEnvelopeSchema(entity) : itemEnvelopeSchema(entity);
|
|
3761
|
-
}, "outputSchemaOf");
|
|
3762
|
-
var Picture = class {
|
|
3763
|
-
static {
|
|
3764
|
-
__name(this, "Picture");
|
|
3765
|
-
}
|
|
3766
|
-
bytes;
|
|
3767
|
-
mimeType;
|
|
3768
|
-
about;
|
|
3769
|
-
constructor(bytes, mimeType, about) {
|
|
3770
|
-
this.bytes = bytes;
|
|
3771
|
-
this.mimeType = mimeType;
|
|
3772
|
-
this.about = about;
|
|
3773
|
-
}
|
|
3774
|
-
};
|
|
3775
|
-
var BinaryResource = class {
|
|
3776
|
-
static {
|
|
3777
|
-
__name(this, "BinaryResource");
|
|
3778
|
-
}
|
|
3779
|
-
base64;
|
|
3780
|
-
mimeType;
|
|
3781
|
-
uri;
|
|
3782
|
-
about;
|
|
3783
|
-
constructor(base64, mimeType, uri, about) {
|
|
3784
|
-
this.base64 = base64;
|
|
3785
|
-
this.mimeType = mimeType;
|
|
3786
|
-
this.uri = uri;
|
|
3787
|
-
this.about = about;
|
|
3788
|
-
}
|
|
3789
|
-
};
|
|
3790
|
-
var answered = /* @__PURE__ */ __name((answer, maxBytes = DEFAULT_OUTPUT_BYTES, targets) => {
|
|
3791
|
-
const bounded = /* @__PURE__ */ __name((result) => {
|
|
3792
|
-
if (maxBytes !== 0 && Buffer.byteLength(JSON.stringify(result.content)) > maxBytes)
|
|
3793
|
-
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 });
|
|
3794
|
-
return result;
|
|
3795
|
-
}, "bounded");
|
|
3796
|
-
if (answer === null || Array.isArray(answer) || typeof answer !== "object")
|
|
3797
|
-
throw new CliError("invalid_response", "tool result must be an object", { retryable: false });
|
|
3798
|
-
const objectBody = /* @__PURE__ */ __name((value) => {
|
|
3799
|
-
const serialized = JSON.parse(agentJson(value));
|
|
3800
|
-
if (serialized === null || Array.isArray(serialized) || typeof serialized !== "object")
|
|
3801
|
-
throw new CliError("invalid_response", "serialized tool result must be an object", { retryable: false });
|
|
3802
|
-
return serialized;
|
|
3803
|
-
}, "objectBody");
|
|
3804
|
-
if (answer instanceof BinaryResource) {
|
|
3805
|
-
const about = sealed(answer.about);
|
|
3806
|
-
return bounded({
|
|
3807
|
-
structuredContent: objectBody(about),
|
|
3808
|
-
content: [
|
|
3809
|
-
{ type: "resource", resource: { uri: answer.uri, mimeType: answer.mimeType, blob: answer.base64 } },
|
|
3810
|
-
{ type: "text", text: agentJson(about) }
|
|
3811
|
-
]
|
|
3812
|
-
});
|
|
3813
|
-
}
|
|
3814
|
-
if (answer instanceof Picture) {
|
|
3815
|
-
const about = sealed(answer.about);
|
|
3816
|
-
return bounded({
|
|
3817
|
-
structuredContent: objectBody(about),
|
|
3818
|
-
content: [
|
|
3819
|
-
{ type: "image", data: Buffer.from(answer.bytes).toString("base64"), mimeType: answer.mimeType },
|
|
3820
|
-
{ type: "text", text: agentJson(about) }
|
|
3821
|
-
]
|
|
3822
|
-
});
|
|
3823
|
-
}
|
|
3824
|
-
const body = objectBody(sealed(targets ? judgedAnswer(answer, targets) : answer));
|
|
3825
|
-
return bounded({ content: [{ type: "text", text: JSON.stringify(body) }], structuredContent: body });
|
|
3826
|
-
}, "answered");
|
|
3827
|
-
var failed = /* @__PURE__ */ __name((error, errors, effects) => {
|
|
3828
|
-
const judged = judgedEffects(effects);
|
|
3829
|
-
const context = { ...failureContext(errors), ...judged ? { effects: judged } : {} };
|
|
3830
|
-
return mcpErrorResult(JSON.parse(agentJson(errorObjectOf(storeDamaged(error), context))));
|
|
3831
|
-
}, "failed");
|
|
3832
|
-
|
|
3833
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.681.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.106.0_commander@15_8d845c31697914d824aa80d8eec93941/node_modules/@wirecat/cli-core/dist/mcp/surface.js
|
|
3834
|
-
import { randomUUID } from "node:crypto";
|
|
3835
|
-
var MATCHES = 8;
|
|
3836
|
-
var ANSWER = answerSchema();
|
|
3837
|
-
var agentAnswer = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3838
|
-
const meta = pipe(looseObject({}), description(`run facts; ${prefix}_tools_search shows the full answer`));
|
|
3839
|
-
const next = optional(pipe(array(looseObject({})), description("steps to run next: command and args")));
|
|
3840
|
-
return looseObject(writes2 ? { item: optional(unknown()), next, meta } : {
|
|
3841
|
-
items: optional(array(unknown())),
|
|
3842
|
-
item: optional(unknown()),
|
|
3843
|
-
page: optional(looseObject({ has_more: boolean() })),
|
|
3844
|
-
next,
|
|
3845
|
-
missing: optional(array(looseObject({ field: string(), why: string() }))),
|
|
3846
|
-
meta
|
|
3847
|
-
});
|
|
3848
|
-
}, "agentAnswer");
|
|
3849
|
-
var listedAs = /* @__PURE__ */ __name((prefix, writes2) => {
|
|
3850
|
-
const checked = toStandardJsonSchema(ANSWER);
|
|
3851
|
-
const shown = toStandardJsonSchema(agentAnswer(prefix, writes2))["~standard"].jsonSchema;
|
|
3852
|
-
return { "~standard": { ...checked["~standard"], jsonSchema: shown } };
|
|
3853
|
-
}, "listedAs");
|
|
3854
|
-
var normal = /* @__PURE__ */ __name((command) => command.trim().toLowerCase().split(/[\s_-]+/).join(" "), "normal");
|
|
3855
|
-
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(" "));
|
|
3856
|
-
var wordsOf = /* @__PURE__ */ __name((text3) => text3.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean), "wordsOf");
|
|
3857
|
-
var stem = /* @__PURE__ */ __name((word2) => {
|
|
3858
|
-
const bare = word2.replace(/'s$/u, "");
|
|
3859
|
-
if (bare.length > 4 && bare.endsWith("ies"))
|
|
3860
|
-
return `${bare.slice(0, -3)}y`;
|
|
3861
|
-
for (const ending of ["ing", "ed", "es", "s"])
|
|
3862
|
-
if (bare.length - ending.length >= 3 && bare.endsWith(ending))
|
|
3863
|
-
return bare.slice(0, -ending.length);
|
|
3864
|
-
return bare;
|
|
3865
|
-
}, "stem");
|
|
3866
|
-
var sameWord = /* @__PURE__ */ __name((asked, known) => {
|
|
3867
|
-
if (asked === known)
|
|
3868
|
-
return true;
|
|
3869
|
-
const [short, long] = asked.length <= known.length ? [asked, known] : [known, asked];
|
|
3870
|
-
return short.length >= 3 && long.startsWith(short);
|
|
3871
|
-
}, "sameWord");
|
|
3872
|
-
var fieldsOf2 = /* @__PURE__ */ __name((command, one) => [
|
|
3873
|
-
[4, [...wordsOf(command), ...(one.aliases ?? []).flatMap(wordsOf)]],
|
|
3874
|
-
[2, wordsOf(one.title)],
|
|
3875
|
-
[1, [...wordsOf(one.description), ...(one.keywords ?? []).flatMap(wordsOf), ...Object.keys(one.input.entries)]]
|
|
3876
|
-
].map(([weight, words]) => [weight, [...new Set(words.map(stem))]]), "fieldsOf");
|
|
3877
|
-
var search = /* @__PURE__ */ __name((commands, query) => {
|
|
3878
|
-
const named = normal(query);
|
|
3879
|
-
const all = Object.entries(commands);
|
|
3880
|
-
if (!named)
|
|
3881
|
-
return all.map((entry) => entry).sort((a, b) => a[0].localeCompare(b[0]));
|
|
3882
|
-
const words = [
|
|
3883
|
-
...new Set(wordsOf(query).filter((word2) => word2.length > 1 && !STOP_WORDS.has(word2)).map(stem))
|
|
3884
|
-
];
|
|
3885
|
-
return all.map((entry) => {
|
|
3886
|
-
const fields = fieldsOf2(entry[0], entry[1]);
|
|
3887
|
-
const weights = words.map((word2) => fields.reduce((best, [weight, known]) => known.some((one) => sameWord(word2, one)) ? Math.max(best, weight) : best, 0));
|
|
3888
|
-
const matched = weights.filter((weight) => weight > 0).length;
|
|
3889
|
-
const exact = normal(entry[0]) === named || (entry[1].aliases ?? []).some((alias) => normal(alias) === named);
|
|
3890
|
-
return { entry, matched, rank: (exact ? 1e3 : 0) + matched * 10 + weights.reduce((a, b) => a + b, 0) };
|
|
3891
|
-
}).filter(({ matched, rank }) => matched > 0 || rank >= 1e3).sort((a, b) => b.rank - a.rank || a.entry[0].localeCompare(b.entry[0])).map(({ entry }) => entry);
|
|
3892
|
-
}, "search");
|
|
3893
|
-
var nearest = /* @__PURE__ */ __name((commands, asked) => {
|
|
3894
|
-
const words = normal(asked).split(" ");
|
|
3895
|
-
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);
|
|
3896
|
-
}, "nearest");
|
|
3897
|
-
var runnableOnly = /* @__PURE__ */ __name((result, offered) => {
|
|
3898
|
-
const body = result.structuredContent;
|
|
3899
|
-
if (result.isError || !Array.isArray(body?.next))
|
|
3900
|
-
return result;
|
|
3901
|
-
const next = body.next.filter((step) => step.command === void 0 || offered(step.command));
|
|
3902
|
-
const { next: _, ...rest } = body;
|
|
3903
|
-
const kept = next.length > 0 ? { ...rest, next } : rest;
|
|
3904
|
-
return {
|
|
3905
|
-
...result,
|
|
3906
|
-
structuredContent: kept,
|
|
3907
|
-
content: result.content.map((part) => part.type === "text" ? { ...part, text: JSON.stringify(kept) } : part)
|
|
3908
|
-
};
|
|
3909
|
-
}, "runnableOnly");
|
|
3910
|
-
var takesNothing = /* @__PURE__ */ __name((one) => Object.values(one.input.entries).every((entry) => entry.type === "optional"), "takesNothing");
|
|
3911
|
-
var sampleOf = /* @__PURE__ */ __name((commands) => {
|
|
3912
|
-
const reading = Object.entries(commands).filter(([, one]) => !one.writes);
|
|
3913
|
-
const bare = reading.filter(([, one]) => takesNothing(one));
|
|
3914
|
-
return bare.find(([command]) => command.endsWith(" list"))?.[0] ?? bare[0]?.[0] ?? reading[0]?.[0] ?? Object.keys(commands)[0] ?? "";
|
|
3915
|
-
}, "sampleOf");
|
|
3916
|
-
var registerCommands = /* @__PURE__ */ __name((server, prefix, commands, errors, withheld, isMessenger) => {
|
|
3917
|
-
const byNormal = new Map(Object.keys(commands).map((command) => [normal(command), command]));
|
|
3918
|
-
const messenger = isMessenger ?? Object.keys(commands).some((command) => command.split(" ")[0] === "messages");
|
|
3919
|
-
const tasks = messenger ? '"unread", "send message", "chat members"' : '"list", "show", "change a setting"';
|
|
3920
|
-
const sample = messenger ? "messages list" : sampleOf(commands);
|
|
3921
|
-
const untrusted = messenger ? UNTRUSTED : UNTRUSTED_NEUTRAL;
|
|
3922
|
-
server.registerTool(`${prefix}_tools_search`, {
|
|
3923
|
-
outputSchema: toStandardJsonSchema(looseObject({})),
|
|
3924
|
-
title: "Find a command",
|
|
3925
|
-
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.`,
|
|
3926
|
-
inputSchema: toStandardJsonSchema(strictObject({ query: optional(pipe(string(), description("words that describe the task"))) })),
|
|
3927
|
-
annotations: { ...READ, openWorldHint: false, idempotentHint: true }
|
|
3928
|
-
}, async ({ query }) => {
|
|
3929
|
-
const found = search(commands, query ?? "");
|
|
3930
|
-
const items = query?.trim() ? found.slice(0, MATCHES).map(([command, one]) => ({
|
|
3931
|
-
command,
|
|
3932
|
-
title: one.title,
|
|
3933
|
-
description: one.description,
|
|
3934
|
-
writes: one.writes,
|
|
3935
|
-
availability: one.availability?.() ?? { available: true },
|
|
3936
|
-
arguments: toJsonSchema(one.input),
|
|
3937
|
-
output: toJsonSchema(one.output ?? ANSWER)
|
|
3938
|
-
})) : found.map(([command, one]) => ({
|
|
3939
|
-
command,
|
|
3940
|
-
title: one.title,
|
|
3941
|
-
writes: one.writes,
|
|
3942
|
-
availability: one.availability?.() ?? { available: true }
|
|
3943
|
-
}));
|
|
3944
|
-
const { next: _paging, ...list } = listOf(`${prefix}_tools_search`, {
|
|
3945
|
-
items,
|
|
3946
|
-
limit: Math.max(items.length, query?.trim() ? MATCHES : 1),
|
|
3947
|
-
has_more: found.length > items.length
|
|
3948
|
-
});
|
|
3949
|
-
return answered(list);
|
|
3950
|
-
});
|
|
3951
|
-
const callers = {
|
|
3952
|
-
env: process.env,
|
|
3953
|
-
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
3954
|
-
connectionId: randomUUID()
|
|
3955
|
-
};
|
|
3956
|
-
const runner = /* @__PURE__ */ __name((writing) => async ({ command: asked, arguments: given }, ctx) => {
|
|
3957
|
-
try {
|
|
3958
|
-
const command = byNormal.get(normal(asked));
|
|
3959
|
-
const one = command === void 0 ? void 0 : commands[command];
|
|
3960
|
-
if (command === void 0 || !one) {
|
|
3961
|
-
withheld?.(normal(asked));
|
|
3962
|
-
const near = nearest(commands, asked);
|
|
3963
|
-
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`);
|
|
3964
|
-
}
|
|
3965
|
-
if (one.writes !== writing)
|
|
3966
|
-
throw new CliError("validation_error", `"${command}" ${writing ? "only reads" : "writes"}: call it with ${prefix}_${writing ? "read" : "write"}`);
|
|
3967
|
-
const args = writing ? agentArguments(given ?? {}) : given ?? {};
|
|
3968
|
-
const caller = currentCaller() ?? callerOf(ctx, command.replace(/[ -]/g, "_"), callers);
|
|
3969
|
-
if (one.checked)
|
|
3970
|
-
return runnableOnly(await withCaller(caller, () => one.run(args, ctx)), (named) => byNormal.has(normal(named)));
|
|
3971
|
-
const parsed = safeParse(strictObject(one.input.entries), args);
|
|
3972
|
-
if (!parsed.success)
|
|
3973
|
-
throw new CliError("validation_error", `${command}: ${summarize(parsed.issues)}`, {
|
|
3974
|
-
arguments: toJsonSchema(one.input)
|
|
3975
|
-
});
|
|
3976
|
-
return runnableOnly(await withCaller(caller, () => one.run(parsed.output, ctx)), (named) => byNormal.has(normal(named)));
|
|
3977
|
-
} catch (error) {
|
|
3978
|
-
return failed(error, errors);
|
|
3979
|
-
}
|
|
3980
|
-
}, "runner");
|
|
3981
|
-
const call = strictObject({
|
|
3982
|
-
command: pipe(string(), minLength(1), description(`a command ${prefix}_tools_search returned: "${sample}"`)),
|
|
3983
|
-
arguments: optional(pipe(record(string(), unknown()), description("that command's arguments")))
|
|
3984
|
-
});
|
|
3985
|
-
server.registerTool(`${prefix}_read`, {
|
|
3986
|
-
outputSchema: listedAs(prefix, false),
|
|
3987
|
-
title: "Run a reading command",
|
|
3988
|
-
description: `Run one command that only reads, with the arguments ${prefix}_tools_search showed. ${untrusted}`,
|
|
3989
|
-
inputSchema: toStandardJsonSchema(call),
|
|
3990
|
-
annotations: READ
|
|
3991
|
-
}, runner(false));
|
|
3992
|
-
if (Object.values(commands).some((one) => one.writes))
|
|
3993
|
-
server.registerTool(`${prefix}_write`, {
|
|
3994
|
-
outputSchema: listedAs(prefix, true),
|
|
3995
|
-
title: "Run a writing command",
|
|
3996
|
-
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}`,
|
|
3997
|
-
inputSchema: toStandardJsonSchema(call),
|
|
3998
|
-
annotations: WRITE
|
|
3999
|
-
}, runner(true));
|
|
4000
|
-
}, "registerCommands");
|
|
4001
|
-
var surfaceCommands = /* @__PURE__ */ __name((tools, registration) => {
|
|
4002
|
-
const run = entryRunner(registration);
|
|
4003
|
-
return Object.fromEntries(Object.entries(tools).map(([key2, definition]) => [
|
|
4004
|
-
commandOf(key2, definition),
|
|
4005
|
-
{
|
|
4006
|
-
title: definition.title,
|
|
4007
|
-
description: definition.description,
|
|
4008
|
-
writes: definition.annotations.readOnlyHint !== true,
|
|
4009
|
-
input: inputOf(definition, syncAllowedFor(key2, registration.defaults)),
|
|
4010
|
-
...definition.output ? { output: outputSchemaOf(definition) } : {},
|
|
4011
|
-
checked: true,
|
|
4012
|
-
run: /* @__PURE__ */ __name((args, ctx) => run(key2, definition, args, ctx), "run")
|
|
4013
|
-
}
|
|
4014
|
-
]));
|
|
4015
|
-
}, "surfaceCommands");
|
|
4016
|
-
var outputOf = /* @__PURE__ */ __name(({ entity, view }) => answerSchema(ENTITIES[view ? `${entity}.${view}` : entity] ?? unknown()), "outputOf");
|
|
4017
|
-
|
|
4018
3581
|
export {
|
|
4019
3582
|
toolsFromCommands,
|
|
4020
|
-
runCommandForAgent
|
|
4021
|
-
message,
|
|
4022
|
-
READ,
|
|
4023
|
-
WRITE,
|
|
4024
|
-
tool,
|
|
4025
|
-
chatOf,
|
|
4026
|
-
tierOf,
|
|
4027
|
-
outcomeOf,
|
|
4028
|
-
commandOf,
|
|
4029
|
-
toolKey,
|
|
4030
|
-
Picture,
|
|
4031
|
-
BinaryResource,
|
|
4032
|
-
answered,
|
|
4033
|
-
failed,
|
|
4034
|
-
normal,
|
|
4035
|
-
registerCommands,
|
|
4036
|
-
surfaceCommands,
|
|
4037
|
-
outputOf
|
|
3583
|
+
runCommandForAgent
|
|
4038
3584
|
};
|