@wirecat/tg-cli 0.101.0 → 0.103.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/dist/bin/tg.js +31 -19
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +14 -17
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-A3VD4Y6Z.js → adapter-QG3YFFOY.js} +101 -38
- package/dist/bundle/{all-profiles-UPVNHXB2.js → all-profiles-ECXH3TBF.js} +32 -11
- package/dist/bundle/{anthropic-IRKNWPIB.js → anthropic-5MKO3QX7.js} +10 -10
- package/dist/bundle/{bot-api-UNTQG2M5.js → bot-api-4DQPIOMK.js} +55 -58
- package/dist/bundle/{bot-history-V4RTY5K7.js → bot-history-UN74XXLU.js} +19 -19
- package/dist/bundle/{bun-2JZPG2NL.js → bun-PS73VF2C.js} +5 -5
- package/dist/bundle/{bun-sqlite-TZHKM225.js → bun-sqlite-RAWGPH23.js} +8 -8
- package/dist/bundle/{chunk-ZZLKX62Z.js → chunk-2ABQZVK4.js} +3 -3
- package/dist/bundle/{chunk-MLLJ74LM.js → chunk-3CP7RK5R.js} +4 -4
- package/dist/bundle/{chunk-BXQS5RCE.js → chunk-3IXKDIPH.js} +258 -83
- package/dist/bundle/{chunk-W2336E7Y.js → chunk-3QX6SOEO.js} +9 -9
- package/dist/bundle/{chunk-F7TDFWXY.js → chunk-537O7OVE.js} +6 -6
- package/dist/bundle/{chunk-N5UFBWDM.js → chunk-57XGUIXA.js} +9 -11
- package/dist/bundle/{chunk-3KHKYYCR.js → chunk-5D4AEUVA.js} +4 -3
- package/dist/bundle/{chunk-ODSVNH3H.js → chunk-5HPAPVCB.js} +2415 -1292
- package/dist/bundle/{chunk-OEJ5DMCX.js → chunk-67SRVSPU.js} +10 -10
- package/dist/bundle/{chunk-XCKD54TN.js → chunk-6N25NZOE.js} +9 -9
- package/dist/bundle/chunk-AAMJZJYC.js +922 -0
- package/dist/bundle/{chunk-AVWK4NCW.js → chunk-ADLS6FVG.js} +13 -13
- package/dist/bundle/{chunk-ZV24I2UJ.js → chunk-AUKAZRF6.js} +5 -5
- package/dist/bundle/{chunk-S7ZNLLY5.js → chunk-BV4N333Y.js} +6 -6
- package/dist/bundle/{chunk-UN6CKIBN.js → chunk-BYYSVINK.js} +11 -8
- package/dist/bundle/{chunk-54R2GDQ3.js → chunk-CMQ34EZL.js} +6 -6
- package/dist/bundle/{chunk-G2US6LJB.js → chunk-COZ74WW4.js} +4 -4
- package/dist/bundle/{chunk-7BFO3DY6.js → chunk-DFDN6AUB.js} +2 -2
- package/dist/bundle/{chunk-VA5YEJS3.js → chunk-DLF3H6NP.js} +7 -7
- package/dist/bundle/{chunk-QOWSVDPZ.js → chunk-DWQ4QT6X.js} +111 -100
- package/dist/bundle/chunk-EMC57SOZ.js +440 -0
- package/dist/bundle/{chunk-RVCS7Q3A.js → chunk-EQHQ2AX3.js} +1390 -522
- package/dist/bundle/{chunk-64DK7S4F.js → chunk-F27OI4J2.js} +4 -4
- package/dist/bundle/{chunk-2XBSVRT2.js → chunk-FG2QTYEF.js} +4 -4
- package/dist/bundle/{chunk-BX6HH4F6.js → chunk-FSPDODVT.js} +14 -14
- package/dist/bundle/{chunk-4ZS73HTJ.js → chunk-G5IMOOPB.js} +4 -4
- package/dist/bundle/{chunk-VCGL2ETF.js → chunk-GO354DJ5.js} +4 -4
- package/dist/bundle/{chunk-5TPT2S2Z.js → chunk-H2UTBYFC.js} +4 -4
- package/dist/bundle/{chunk-U46UNBMT.js → chunk-HCDZWFXO.js} +244 -21
- package/dist/bundle/{chunk-TGREFJVA.js → chunk-KCVDWZWS.js} +11 -11
- package/dist/bundle/{chunk-PUBS2F5J.js → chunk-KQ5BUI5T.js} +248 -248
- package/dist/bundle/{chunk-ACGTFLEB.js → chunk-LAYPLF7G.js} +35 -282
- package/dist/bundle/{chunk-5KU4UQBM.js → chunk-MFS52LTZ.js} +4 -4
- package/dist/bundle/{chunk-DYNSP6FW.js → chunk-MHHDVR4G.js} +1449 -832
- package/dist/bundle/{chunk-S2JSZWEC.js → chunk-NIVZHTN4.js} +15 -15
- package/dist/bundle/{chunk-A5JSTZZZ.js → chunk-NKN54EDN.js} +6 -6
- package/dist/bundle/chunk-O5EHUB2V.js +2 -0
- package/dist/bundle/{chunk-5GKXETRP.js → chunk-OGVBRRWY.js} +615 -56
- package/dist/bundle/{chunk-VYDTI254.js → chunk-Q2LBOPKO.js} +99 -50
- package/dist/bundle/{chunk-LPB2MDUW.js → chunk-QF7VVIF4.js} +11 -11
- package/dist/bundle/{chunk-VRSN7VLO.js → chunk-RD7SSY7H.js} +4 -4
- package/dist/bundle/{chunk-ZEOCU24Z.js → chunk-RKQIEJFR.js} +5 -5
- package/dist/bundle/chunk-RMC2S3F4.js +264 -0
- package/dist/bundle/{chunk-2DGOFLDA.js → chunk-S5M4HFOZ.js} +6 -6
- package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-SSALGKMJ.js} +94 -5
- package/dist/bundle/{chunk-G3ZRY436.js → chunk-SSV37M5T.js} +59 -59
- package/dist/bundle/{chunk-DG62L57H.js → chunk-T4SDOYPY.js} +20 -20
- package/dist/bundle/{chunk-6IPY2QRG.js → chunk-TEO2KP52.js} +5 -5
- package/dist/bundle/{chunk-G77QOTXE.js → chunk-TPFLD4OM.js} +5 -5
- package/dist/bundle/{chunk-PYTOIDSM.js → chunk-VMU4SGCE.js} +7 -7
- package/dist/bundle/{chunk-QYVVRQTN.js → chunk-VZN5LD26.js} +6 -6
- package/dist/bundle/{chunk-ZJVZXJOG.js → chunk-WAGDZB62.js} +5 -5
- package/dist/bundle/{chunk-7CBUCTB6.js → chunk-WULARSC4.js} +33 -39
- package/dist/bundle/{chunk-BJG6JA5U.js → chunk-Y5E2WNWB.js} +4 -4
- package/dist/bundle/{chunk-H6OXALTJ.js → chunk-YI72UVTJ.js} +5 -5
- package/dist/bundle/{chunk-NC5WS7OP.js → chunk-Z2DPNTSU.js} +5 -5
- package/dist/bundle/{chunk-RF54YDBB.js → chunk-ZHXSRYJ5.js} +6 -6
- package/dist/bundle/{chunk-AFV74GK3.js → chunk-ZVVMGPBJ.js} +2 -2
- package/dist/bundle/command-contract-ZGFJTLB2.js +32 -0
- package/dist/bundle/{dist-RJMT44PL.js → dist-I7OZPHAZ.js} +3 -3
- package/dist/bundle/{echarts-QZ6PR3VC.js → echarts-UEQDIHVQ.js} +5 -5
- package/dist/bundle/{embed-UBXCXSRD.js → embed-5DPZKRW5.js} +9 -8
- package/dist/bundle/{embedder-B4ZTKC23.js → embedder-NBQXDXAO.js} +12 -11
- package/dist/bundle/entry-EE6YRAP4.js +14 -0
- package/dist/bundle/first-run-OSEVVWNT.js +24 -0
- package/dist/bundle/first-screen-753THOU6.js +30 -0
- package/dist/bundle/identity-LNH33PN3.js +11 -0
- package/dist/bundle/instructions-PYGVIT7I.js +9 -0
- package/dist/bundle/{mcp-4Y37G2UY.js → mcp-OQBZXELQ.js} +5 -5
- package/dist/bundle/{node-LZZX22VR.js → node-3OBKCX6M.js} +5 -5
- package/dist/bundle/{node-IUL5HSYI.js → node-P4E63KXA.js} +5 -5
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/{node-sqlite-BPGT6T5U.js → node-sqlite-DMMTDRFB.js} +8 -8
- package/dist/bundle/oauth-FX5DDCRS.js +18 -0
- package/dist/bundle/open-G6QRQAAL.js +20 -0
- package/dist/bundle/{process-GPUXC4PG.js → process-47MMIFIJ.js} +5 -5
- package/dist/bundle/{program-NEXEAL7T.js → program-LBHBWRK5.js} +67 -71
- package/dist/bundle/prompt-CJ6Y4JYC.js +13 -0
- package/dist/bundle/proxy-transport-YSBYG26I.js +17 -0
- package/dist/bundle/{recognize-UJBXORVD.js → recognize-7BLTOI45.js} +9 -9
- package/dist/bundle/remote-Q4A4JY6U.js +27 -0
- package/dist/bundle/{rerank-3Y2VZM3J.js → rerank-CQAR46L3.js} +10 -9
- package/dist/bundle/{serve-VDZIVOPR.js → serve-2UO2YMMG.js} +13 -13
- package/dist/bundle/{server-BERXP4GW.js → server-6XYURULQ.js} +80 -68
- package/dist/bundle/{server-ZFHN4GUF.js → server-FMKC4RLL.js} +46 -41
- package/dist/bundle/{state-DGR4EE3E.js → state-RNWN2RDY.js} +9 -9
- package/dist/bundle/{store-MRCFSCZD.js → store-BBHTR477.js} +14 -14
- package/dist/bundle/store-maintenance-command-GD6OLRXH.js +44 -0
- package/dist/bundle/tg.js +8 -8
- package/dist/telegram/sending.d.ts.map +1 -1
- package/dist/telegram/sending.js +52 -3
- package/dist/telegram/sending.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/bundle/chunk-22PQUX72.js +0 -190
- package/dist/bundle/chunk-2SJOUK6J.js +0 -2
- package/dist/bundle/chunk-CJ6IYCYP.js +0 -583
- package/dist/bundle/chunk-NKJJJAIJ.js +0 -237
- package/dist/bundle/chunk-NMGO6LW6.js +0 -1950
- package/dist/bundle/chunk-OILBDLWL.js +0 -724
- package/dist/bundle/chunk-OPBTNQ35.js +0 -1007
- package/dist/bundle/command-contract-TKDI7E56.js +0 -31
- package/dist/bundle/entry-BTUTHO5M.js +0 -14
- package/dist/bundle/first-run-UC4HRIFV.js +0 -24
- package/dist/bundle/first-screen-SMCX6YKY.js +0 -29
- package/dist/bundle/identity-QSDEGDH7.js +0 -11
- package/dist/bundle/instructions-BBGLZKO3.js +0 -9
- package/dist/bundle/node-UPPL626U.js +0 -21
- package/dist/bundle/oauth-XNE2KPKJ.js +0 -18
- package/dist/bundle/open-SXGYZLB5.js +0 -20
- package/dist/bundle/prompt-SORGLEYI.js +0 -13
- package/dist/bundle/proxy-transport-G4MA6BGU.js +0 -17
- package/dist/bundle/remote-W72AR7KH.js +0 -26
- package/dist/bundle/store-maintenance-command-DCMZDMYS.js +0 -46
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
checkProxy,
|
|
5
|
+
proxiedTransport,
|
|
6
|
+
proxyFailure
|
|
7
|
+
} from "./chunk-WAGDZB62.js";
|
|
8
|
+
import "./chunk-FG2QTYEF.js";
|
|
9
|
+
import "./chunk-T4SDOYPY.js";
|
|
10
|
+
import "./chunk-67SRVSPU.js";
|
|
11
|
+
import "./chunk-Y5E2WNWB.js";
|
|
12
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
export {
|
|
14
|
+
checkProxy,
|
|
15
|
+
proxiedTransport,
|
|
16
|
+
proxyFailure
|
|
17
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { createRequire as
|
|
2
|
-
const require =
|
|
3
|
-
import "./chunk-
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import "./chunk-T4SDOYPY.js";
|
|
4
4
|
import {
|
|
5
5
|
CliError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-67SRVSPU.js";
|
|
7
7
|
import {
|
|
8
8
|
importFrom
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
15
15
|
import { createRequire } from "node:module";
|
|
16
16
|
|
|
17
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
18
18
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
19
19
|
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
20
20
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -71,7 +71,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
|
71
71
|
throw invalid();
|
|
72
72
|
}, "checkOggDuration");
|
|
73
73
|
|
|
74
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
74
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
75
75
|
var SAMPLE_RATE = 16e3;
|
|
76
76
|
var LEAD = SAMPLE_RATE / 2;
|
|
77
77
|
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_OPENAI_MODEL,
|
|
5
|
+
OPENAI_MODELS,
|
|
6
|
+
OPENAI_URL,
|
|
7
|
+
isLocal,
|
|
8
|
+
openRemote,
|
|
9
|
+
remoteKey,
|
|
10
|
+
remoteModel
|
|
11
|
+
} from "./chunk-NKN54EDN.js";
|
|
12
|
+
import "./chunk-LAYPLF7G.js";
|
|
13
|
+
import "./chunk-RMC2S3F4.js";
|
|
14
|
+
import "./chunk-TPFLD4OM.js";
|
|
15
|
+
import "./chunk-T4SDOYPY.js";
|
|
16
|
+
import "./chunk-67SRVSPU.js";
|
|
17
|
+
import "./chunk-Y5E2WNWB.js";
|
|
18
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
19
|
+
export {
|
|
20
|
+
DEFAULT_OPENAI_MODEL,
|
|
21
|
+
OPENAI_MODELS,
|
|
22
|
+
OPENAI_URL,
|
|
23
|
+
isLocal,
|
|
24
|
+
openRemote,
|
|
25
|
+
remoteKey,
|
|
26
|
+
remoteModel
|
|
27
|
+
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { createRequire as
|
|
2
|
-
const require =
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
defaultThreads,
|
|
5
5
|
loadModel,
|
|
6
6
|
truncated
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-LAYPLF7G.js";
|
|
8
|
+
import "./chunk-RMC2S3F4.js";
|
|
9
|
+
import "./chunk-TPFLD4OM.js";
|
|
10
|
+
import "./chunk-T4SDOYPY.js";
|
|
11
|
+
import "./chunk-67SRVSPU.js";
|
|
12
|
+
import "./chunk-Y5E2WNWB.js";
|
|
12
13
|
import {
|
|
13
14
|
__name
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
15
16
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/embeddings/rerank.js
|
|
17
18
|
var openReranker = /* @__PURE__ */ __name(async (model, directory, { threads = defaultThreads() } = {}) => {
|
|
18
19
|
const { ort, tokenizer, session } = await loadModel(model, directory, threads);
|
|
19
20
|
const typeIds = session.inputNames.includes("token_type_ids");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createRequire as
|
|
2
|
-
const require =
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
listen
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GO354DJ5.js";
|
|
6
6
|
import {
|
|
7
7
|
ownerLogin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BYYSVINK.js";
|
|
9
9
|
import {
|
|
10
10
|
WebStandardStreamableHTTPServerTransport,
|
|
11
11
|
createMcpHandler,
|
|
@@ -14,25 +14,25 @@ import {
|
|
|
14
14
|
isLegacyRequest,
|
|
15
15
|
oauthMetadataResponse,
|
|
16
16
|
requireBearerAuth
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5D4AEUVA.js";
|
|
18
18
|
import {
|
|
19
19
|
activityRecorder,
|
|
20
20
|
calledTools,
|
|
21
21
|
httpActivityFile,
|
|
22
22
|
httpLock
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-DLF3H6NP.js";
|
|
24
|
+
import "./chunk-VZN5LD26.js";
|
|
25
|
+
import "./chunk-RD7SSY7H.js";
|
|
26
|
+
import "./chunk-T4SDOYPY.js";
|
|
27
27
|
import {
|
|
28
28
|
CliError
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-67SRVSPU.js";
|
|
30
|
+
import "./chunk-Y5E2WNWB.js";
|
|
31
31
|
import {
|
|
32
32
|
__name
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
34
34
|
|
|
35
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/http/serve.js
|
|
36
36
|
import { randomUUID } from "node:crypto";
|
|
37
37
|
var MCP_PATH = "/mcp";
|
|
38
38
|
var AS_METADATA = "/.well-known/oauth-authorization-server";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRequire as
|
|
2
|
-
const require =
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
CHART_KINDS,
|
|
5
5
|
CHART_SIZE,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
registerPrompts,
|
|
14
14
|
stdinFieldOf,
|
|
15
15
|
syncsFirst
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WULARSC4.js";
|
|
17
17
|
import {
|
|
18
18
|
answeredWire
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-F27OI4J2.js";
|
|
20
20
|
import {
|
|
21
21
|
BinaryResource,
|
|
22
22
|
Picture,
|
|
@@ -37,26 +37,24 @@ import {
|
|
|
37
37
|
tool,
|
|
38
38
|
toolKey,
|
|
39
39
|
toolsFromCommands
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-Q2LBOPKO.js";
|
|
41
41
|
import {
|
|
42
42
|
agentJson,
|
|
43
43
|
skillResource
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-NKJJJAIJ.js";
|
|
44
|
+
} from "./chunk-HCDZWFXO.js";
|
|
46
45
|
import {
|
|
47
46
|
StdioServerTransport,
|
|
47
|
+
callerOf,
|
|
48
48
|
serveStdio
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-SSALGKMJ.js";
|
|
50
50
|
import {
|
|
51
51
|
McpServer,
|
|
52
52
|
ResourceTemplate
|
|
53
|
-
} from "./chunk-
|
|
54
|
-
import {
|
|
55
|
-
connectedFor
|
|
56
|
-
} from "./chunk-5GKXETRP.js";
|
|
53
|
+
} from "./chunk-5D4AEUVA.js";
|
|
57
54
|
import {
|
|
55
|
+
connectedFor,
|
|
58
56
|
guardFor
|
|
59
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-OGVBRRWY.js";
|
|
60
58
|
import {
|
|
61
59
|
capability,
|
|
62
60
|
dateWindow,
|
|
@@ -65,69 +63,71 @@ import {
|
|
|
65
63
|
servicesFor,
|
|
66
64
|
storedDeps,
|
|
67
65
|
wholeList
|
|
68
|
-
} from "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import "./chunk-RF54YDBB.js";
|
|
66
|
+
} from "./chunk-MHHDVR4G.js";
|
|
67
|
+
import "./chunk-ZHXSRYJ5.js";
|
|
71
68
|
import {
|
|
72
69
|
findCommand
|
|
73
|
-
} from "./chunk-
|
|
74
|
-
import "./chunk-
|
|
70
|
+
} from "./chunk-57XGUIXA.js";
|
|
71
|
+
import "./chunk-DWQ4QT6X.js";
|
|
75
72
|
import {
|
|
76
73
|
DEFAULT_OUTPUT_BYTES,
|
|
77
74
|
changesAuthorityAt,
|
|
78
75
|
describeProgram,
|
|
79
76
|
environmentOf,
|
|
80
|
-
|
|
77
|
+
fetchesOnlyAt,
|
|
81
78
|
itemOf,
|
|
82
79
|
judgedTargets,
|
|
80
|
+
levelFor,
|
|
81
|
+
readKeysForCommand,
|
|
83
82
|
recalledAccount,
|
|
84
83
|
rootOf2 as rootOf,
|
|
85
84
|
sealed,
|
|
86
|
-
snakeKeys
|
|
87
|
-
} from "./chunk-RVCS7Q3A.js";
|
|
88
|
-
import {
|
|
89
|
-
levelFor,
|
|
90
|
-
readKeysForCommand,
|
|
85
|
+
snakeKeys,
|
|
91
86
|
typedCommand
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
94
|
-
import
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
} from "./chunk-EQHQ2AX3.js";
|
|
88
|
+
import "./chunk-CMQ34EZL.js";
|
|
89
|
+
import {
|
|
90
|
+
isCliFailure,
|
|
91
|
+
withCaller
|
|
92
|
+
} from "./chunk-EMC57SOZ.js";
|
|
93
|
+
import "./chunk-VMU4SGCE.js";
|
|
94
|
+
import "./chunk-MFS52LTZ.js";
|
|
95
|
+
import "./chunk-BV4N333Y.js";
|
|
97
96
|
import {
|
|
98
97
|
readOnlyLockOf
|
|
99
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-AUKAZRF6.js";
|
|
100
99
|
import {
|
|
101
100
|
mcpHttpMarker
|
|
102
|
-
} from "./chunk-
|
|
103
|
-
import "./chunk-
|
|
104
|
-
import "./chunk-
|
|
101
|
+
} from "./chunk-DLF3H6NP.js";
|
|
102
|
+
import "./chunk-VZN5LD26.js";
|
|
103
|
+
import "./chunk-RD7SSY7H.js";
|
|
105
104
|
import {
|
|
106
105
|
instructions
|
|
107
|
-
} from "./chunk-
|
|
108
|
-
import "./chunk-
|
|
109
|
-
import "./chunk-
|
|
106
|
+
} from "./chunk-COZ74WW4.js";
|
|
107
|
+
import "./chunk-YI72UVTJ.js";
|
|
108
|
+
import "./chunk-NKN54EDN.js";
|
|
110
109
|
import {
|
|
111
110
|
warmEmbedders
|
|
112
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-LAYPLF7G.js";
|
|
112
|
+
import "./chunk-RMC2S3F4.js";
|
|
113
113
|
import {
|
|
114
114
|
openStore,
|
|
115
115
|
pdfPreviewLimits
|
|
116
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-KQ5BUI5T.js";
|
|
117
117
|
import {
|
|
118
118
|
timezoneOf
|
|
119
|
-
} from "./chunk-
|
|
120
|
-
import "./chunk-
|
|
121
|
-
import "./chunk-
|
|
122
|
-
import "./chunk-
|
|
123
|
-
import "./chunk-
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-
|
|
126
|
-
import "./chunk-
|
|
119
|
+
} from "./chunk-SSV37M5T.js";
|
|
120
|
+
import "./chunk-KCVDWZWS.js";
|
|
121
|
+
import "./chunk-3QX6SOEO.js";
|
|
122
|
+
import "./chunk-O5EHUB2V.js";
|
|
123
|
+
import "./chunk-TPFLD4OM.js";
|
|
124
|
+
import "./chunk-6N25NZOE.js";
|
|
125
|
+
import "./chunk-G5IMOOPB.js";
|
|
126
|
+
import "./chunk-TEO2KP52.js";
|
|
127
127
|
import {
|
|
128
128
|
mcpErrorResult,
|
|
129
129
|
visibleControls
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-T4SDOYPY.js";
|
|
131
131
|
import {
|
|
132
132
|
CliError,
|
|
133
133
|
description,
|
|
@@ -143,13 +143,16 @@ import {
|
|
|
143
143
|
regex,
|
|
144
144
|
strictObject,
|
|
145
145
|
string
|
|
146
|
-
} from "./chunk-
|
|
147
|
-
import "./chunk-
|
|
146
|
+
} from "./chunk-67SRVSPU.js";
|
|
147
|
+
import "./chunk-Y5E2WNWB.js";
|
|
148
148
|
import {
|
|
149
149
|
__name
|
|
150
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
151
151
|
|
|
152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
152
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/server.js
|
|
153
|
+
import { randomUUID } from "node:crypto";
|
|
154
|
+
|
|
155
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/agent-log.js
|
|
153
156
|
var agentLog = /* @__PURE__ */ __name((open) => {
|
|
154
157
|
let held;
|
|
155
158
|
return {
|
|
@@ -168,7 +171,7 @@ var agentLog = /* @__PURE__ */ __name((open) => {
|
|
|
168
171
|
};
|
|
169
172
|
}, "agentLog");
|
|
170
173
|
|
|
171
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
174
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/resources.js
|
|
172
175
|
var LISTED = 100;
|
|
173
176
|
var registerResources = /* @__PURE__ */ __name((server, session, { command, name, limit, recorded, withStore, messenger, guard, assertRead }) => {
|
|
174
177
|
server.registerResource("chat", new ResourceTemplate(`${command}://chat/{id}`, {
|
|
@@ -206,7 +209,7 @@ var registerResources = /* @__PURE__ */ __name((server, session, { command, name
|
|
|
206
209
|
});
|
|
207
210
|
}, "registerResources");
|
|
208
211
|
|
|
209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
212
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/session.js
|
|
210
213
|
var HARMLESS = /* @__PURE__ */ new Set(["validation_error", "not_found", "permission_error", "confirmation_required", "rate_limited"]);
|
|
211
214
|
var harmless = /* @__PURE__ */ __name((code) => HARMLESS.has(code), "harmless");
|
|
212
215
|
var MessengerSession = class {
|
|
@@ -281,7 +284,7 @@ var MessengerSession = class {
|
|
|
281
284
|
}
|
|
282
285
|
};
|
|
283
286
|
|
|
284
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
287
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/tools/attachments.js
|
|
285
288
|
var attachmentsTools = /* @__PURE__ */ __name((messenger) => {
|
|
286
289
|
const _command = messenger.app.command;
|
|
287
290
|
return {
|
|
@@ -335,7 +338,7 @@ var attachmentsTools = /* @__PURE__ */ __name((messenger) => {
|
|
|
335
338
|
};
|
|
336
339
|
}, "attachmentsTools");
|
|
337
340
|
|
|
338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
341
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/tools/messages-photo.js
|
|
339
342
|
var PHOTO_LIMIT = 512 * 1024;
|
|
340
343
|
var IMAGE_TYPES = [
|
|
341
344
|
["image/jpeg", (b) => b[0] === 255 && b[1] === 216 && b[2] === 255],
|
|
@@ -389,7 +392,7 @@ var readUpTo = /* @__PURE__ */ __name(async (file, limit, saveIt) => {
|
|
|
389
392
|
return new Uint8Array(Buffer.concat(chunks));
|
|
390
393
|
}, "readUpTo");
|
|
391
394
|
|
|
392
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
395
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/tools/stats.js
|
|
393
396
|
var statsTools = /* @__PURE__ */ __name((messenger) => ({
|
|
394
397
|
stats_charts: tool({
|
|
395
398
|
title: "A chart from a chat's statistics",
|
|
@@ -426,14 +429,14 @@ var statsTools = /* @__PURE__ */ __name((messenger) => ({
|
|
|
426
429
|
})
|
|
427
430
|
}), "statsTools");
|
|
428
431
|
|
|
429
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
432
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/tools.js
|
|
430
433
|
var pictureTools = /* @__PURE__ */ __name((messenger) => Object.fromEntries(Object.entries({
|
|
431
434
|
...messagesPhotoTools(messenger),
|
|
432
435
|
...attachmentsTools(messenger),
|
|
433
436
|
...statsTools(messenger)
|
|
434
437
|
}).map(([name, definition]) => [name, { ...definition, input: strictObject(definition.input.entries) }])), "pictureTools");
|
|
435
438
|
|
|
436
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
439
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/server.js
|
|
437
440
|
var PER_RUN = /* @__PURE__ */ new Set([
|
|
438
441
|
"streams",
|
|
439
442
|
"stdin",
|
|
@@ -503,6 +506,7 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
503
506
|
readOnly: readOnlyLockOf(app, context.env) !== void 0,
|
|
504
507
|
keyOf,
|
|
505
508
|
authority,
|
|
509
|
+
fetchOnly: fetchesOnlyAt(root),
|
|
506
510
|
offline: true,
|
|
507
511
|
stdin
|
|
508
512
|
}).map((one) => "sync_first" in one.input.entries && !syncAllowed(one.path) ? {
|
|
@@ -562,7 +566,7 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
562
566
|
embedders,
|
|
563
567
|
...sessionOptions.spawnJob ? { spawnJob: sessionOptions.spawnJob } : {}
|
|
564
568
|
};
|
|
565
|
-
const invoke = /* @__PURE__ */ __name((one, input, env) => new Promise((resolve) => {
|
|
569
|
+
const invoke = /* @__PURE__ */ __name((one, input, env, caller) => new Promise((resolve) => {
|
|
566
570
|
let finish;
|
|
567
571
|
let held;
|
|
568
572
|
const connection = /* @__PURE__ */ __name(() => new Promise((lend, refuse) => {
|
|
@@ -585,7 +589,8 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
585
589
|
authority,
|
|
586
590
|
stdin,
|
|
587
591
|
connection,
|
|
588
|
-
environment: agentEnvironment
|
|
592
|
+
environment: agentEnvironment,
|
|
593
|
+
caller
|
|
589
594
|
}).then(async (answer) => {
|
|
590
595
|
finish?.("error" in answer && !harmless(answer.error.error.code));
|
|
591
596
|
await held?.catch(() => void 0);
|
|
@@ -593,12 +598,12 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
593
598
|
});
|
|
594
599
|
}), "invoke");
|
|
595
600
|
let queue = Promise.resolve();
|
|
596
|
-
const queued = /* @__PURE__ */ __name((one, input, env) => {
|
|
597
|
-
const next = queue.then(() => invoke(one, input, env));
|
|
601
|
+
const queued = /* @__PURE__ */ __name((one, input, env, caller) => {
|
|
602
|
+
const next = queue.then(() => invoke(one, input, env, caller));
|
|
598
603
|
queue = next.catch(() => void 0);
|
|
599
604
|
return next;
|
|
600
605
|
}, "queued");
|
|
601
|
-
const asCommand = /* @__PURE__ */ __name((one) => ({
|
|
606
|
+
const asCommand = /* @__PURE__ */ __name((one, source) => ({
|
|
602
607
|
title: one.title,
|
|
603
608
|
description: one.description,
|
|
604
609
|
writes: one.writes,
|
|
@@ -609,7 +614,8 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
609
614
|
const startedAt = Date.now();
|
|
610
615
|
const traceparent = ctx?.mcpReq?._meta?.traceparent;
|
|
611
616
|
const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
|
|
612
|
-
const
|
|
617
|
+
const caller = callerOf(ctx, keyOfCommand(one.command), source);
|
|
618
|
+
const answer = await withCaller(caller, () => queued(one, args, env, caller));
|
|
613
619
|
const result = "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : (() => {
|
|
614
620
|
try {
|
|
615
621
|
return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
|
|
@@ -628,6 +634,11 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
628
634
|
}, "run")
|
|
629
635
|
}), "asCommand");
|
|
630
636
|
const build = /* @__PURE__ */ __name(() => {
|
|
637
|
+
const callers = {
|
|
638
|
+
env: context.env,
|
|
639
|
+
client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"),
|
|
640
|
+
connectionId: randomUUID()
|
|
641
|
+
};
|
|
631
642
|
const server = new McpServer({ name: app.command, version: app.version }, {
|
|
632
643
|
instructions: instructions({
|
|
633
644
|
command: app.command,
|
|
@@ -667,11 +678,12 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
|
|
|
667
678
|
env: context.env,
|
|
668
679
|
...context.keyring ? { keyring: context.keyring } : {},
|
|
669
680
|
embedders,
|
|
670
|
-
history: settings.
|
|
671
|
-
}
|
|
681
|
+
history: settings.record
|
|
682
|
+
},
|
|
683
|
+
callers
|
|
672
684
|
};
|
|
673
685
|
registerCommands(server, app.command, {
|
|
674
|
-
...Object.fromEntries(commands.map((one) => [one.command, asCommand(one)])),
|
|
686
|
+
...Object.fromEntries(commands.map((one) => [one.command, asCommand(one, callers)])),
|
|
675
687
|
...Object.fromEntries(Object.entries(surfaceCommands({ ...pictures, status }, registration)).map(([name2, one]) => [
|
|
676
688
|
name2,
|
|
677
689
|
{
|
|
@@ -748,7 +760,7 @@ var serveOverStdio = /* @__PURE__ */ __name(async (command, context, messenger,
|
|
|
748
760
|
}, "serveOverStdio");
|
|
749
761
|
var serveOverHttpUntilStopped = /* @__PURE__ */ __name(async (command, context, messenger, options, http) => {
|
|
750
762
|
const { session, embedders, build, log } = createServer(command, context, messenger, options);
|
|
751
|
-
const { serveOverHttp } = await import("./serve-
|
|
763
|
+
const { serveOverHttp } = await import("./serve-2UO2YMMG.js");
|
|
752
764
|
const appName = messenger.app.command;
|
|
753
765
|
const appEnvPrefix = messenger.app.envPrefix;
|
|
754
766
|
const listening = await serveOverHttp(build, {
|
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
import { createRequire as
|
|
2
|
-
const require =
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
botInstructions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3CP7RK5R.js";
|
|
6
6
|
import {
|
|
7
7
|
answered,
|
|
8
8
|
normal,
|
|
9
9
|
registerCommands,
|
|
10
10
|
runCommandForAgent,
|
|
11
11
|
toolsFromCommands
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Q2LBOPKO.js";
|
|
13
13
|
import {
|
|
14
14
|
agentJson,
|
|
15
15
|
skillResource
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-NKJJJAIJ.js";
|
|
16
|
+
} from "./chunk-HCDZWFXO.js";
|
|
18
17
|
import {
|
|
18
|
+
callerOf,
|
|
19
19
|
serveStdio
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SSALGKMJ.js";
|
|
21
21
|
import {
|
|
22
22
|
McpServer
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5D4AEUVA.js";
|
|
24
24
|
import {
|
|
25
25
|
wholeList
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-QOWSVDPZ.js";
|
|
26
|
+
} from "./chunk-MHHDVR4G.js";
|
|
27
|
+
import "./chunk-ZHXSRYJ5.js";
|
|
28
|
+
import "./chunk-DWQ4QT6X.js";
|
|
30
29
|
import {
|
|
31
30
|
changesMessenger,
|
|
32
31
|
flatten,
|
|
33
32
|
itemOf
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-EQHQ2AX3.js";
|
|
34
|
+
import "./chunk-CMQ34EZL.js";
|
|
35
|
+
import "./chunk-EMC57SOZ.js";
|
|
36
|
+
import "./chunk-VMU4SGCE.js";
|
|
37
|
+
import "./chunk-MFS52LTZ.js";
|
|
38
|
+
import "./chunk-BV4N333Y.js";
|
|
40
39
|
import {
|
|
41
40
|
MESSENGER_CHANGE_REFUSAL,
|
|
42
41
|
readOnlyLockOf,
|
|
43
42
|
readOnlyRefusal
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-AUKAZRF6.js";
|
|
44
|
+
import "./chunk-RD7SSY7H.js";
|
|
45
|
+
import "./chunk-YI72UVTJ.js";
|
|
46
|
+
import "./chunk-NKN54EDN.js";
|
|
47
|
+
import "./chunk-LAYPLF7G.js";
|
|
48
|
+
import "./chunk-RMC2S3F4.js";
|
|
49
|
+
import "./chunk-KQ5BUI5T.js";
|
|
50
|
+
import "./chunk-SSV37M5T.js";
|
|
51
|
+
import "./chunk-KCVDWZWS.js";
|
|
52
|
+
import "./chunk-3QX6SOEO.js";
|
|
53
|
+
import "./chunk-O5EHUB2V.js";
|
|
54
|
+
import "./chunk-TPFLD4OM.js";
|
|
55
|
+
import "./chunk-6N25NZOE.js";
|
|
56
|
+
import "./chunk-G5IMOOPB.js";
|
|
57
|
+
import "./chunk-TEO2KP52.js";
|
|
58
58
|
import {
|
|
59
59
|
mcpErrorResult
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-T4SDOYPY.js";
|
|
61
61
|
import {
|
|
62
62
|
object
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import "./chunk-
|
|
63
|
+
} from "./chunk-67SRVSPU.js";
|
|
64
|
+
import "./chunk-Y5E2WNWB.js";
|
|
65
65
|
import {
|
|
66
66
|
__name
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
68
68
|
|
|
69
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
69
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/bot/server.js
|
|
70
|
+
import { randomUUID } from "node:crypto";
|
|
70
71
|
var body = /* @__PURE__ */ __name((command, value) => Array.isArray(value) ? wholeList(`bot ${command}`, value) : value !== null && typeof value === "object" && ("item" in value || "items" in value) ? value : itemOf(value !== null && typeof value === "object" ? value : { value }), "body");
|
|
71
72
|
var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
72
73
|
const { bot, program, settings, env } = options;
|
|
@@ -80,6 +81,7 @@ var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
|
80
81
|
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
81
82
|
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
82
83
|
authority,
|
|
84
|
+
...options.fetchOnly ? { fetchOnly: options.fetchOnly } : {},
|
|
83
85
|
offline: true,
|
|
84
86
|
// Another bot's copy is this bot's to read only where `read_other_bots` says so.
|
|
85
87
|
...settings.readOtherBots ? {} : { omit: ["all_bots", "bots"] }
|
|
@@ -94,19 +96,21 @@ var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
|
94
96
|
const writes = tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command);
|
|
95
97
|
const skill = options.skill ? skillResource(bot.app, options.skill) : void 0;
|
|
96
98
|
let queue = Promise.resolve();
|
|
97
|
-
const invoke = /* @__PURE__ */ __name((path, input) => {
|
|
99
|
+
const invoke = /* @__PURE__ */ __name((path, input, caller) => {
|
|
98
100
|
const next = queue.then(() => runCommandForAgent(program, path, path[0] === "config" ? { ...input, bot: true } : input, {
|
|
99
101
|
profile: settings.profile,
|
|
100
102
|
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
101
103
|
env,
|
|
102
104
|
levels,
|
|
103
105
|
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
104
|
-
authority
|
|
106
|
+
authority,
|
|
107
|
+
...caller ? { caller } : {}
|
|
105
108
|
}));
|
|
106
109
|
queue = next.catch(() => void 0);
|
|
107
110
|
return next;
|
|
108
111
|
}, "invoke");
|
|
109
112
|
const build = /* @__PURE__ */ __name(() => {
|
|
113
|
+
const callers = { env, client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"), connectionId: randomUUID() };
|
|
110
114
|
const server = new McpServer({ name: `${command}-bot-${settings.profile}`, version: bot.app.version }, {
|
|
111
115
|
instructions: botInstructions({
|
|
112
116
|
command,
|
|
@@ -128,8 +132,9 @@ var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
|
128
132
|
writes: tool.writes,
|
|
129
133
|
availability: tool.availability,
|
|
130
134
|
input: tool.input,
|
|
131
|
-
run: /* @__PURE__ */ __name(async (args) => {
|
|
132
|
-
const
|
|
135
|
+
run: /* @__PURE__ */ __name(async (args, ctx) => {
|
|
136
|
+
const caller = callerOf(ctx, `${command}_${tool.command.replaceAll(" ", "_")}`, callers);
|
|
137
|
+
const answer = await invoke(tool.path, args, caller);
|
|
133
138
|
return "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : answered(body(tool.command, answer.result));
|
|
134
139
|
}, "run")
|
|
135
140
|
}
|