@wirecat/attio-cli 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/contracts/wirecat.json +1 -0
- package/dist/bin/attio.js +11 -11
- package/dist/bundle/attio.js +5 -166
- package/dist/bundle/{chunk-UXJZISVL.js → chunk-OGWKDPR5.js} +2 -1
- package/dist/bundle/chunk-TQAECZFO.js +13 -0
- package/dist/bundle/{definitions-FODOIPM2.js → definitions-J73IBAHT.js} +1 -1
- package/dist/bundle/program-NSBWZ25F.js +6201 -0
- package/dist/bundle/{schemas-YGSTNU6F.js → schemas-G3HFAS45.js} +576 -29
- package/dist/commands/api.js +1 -2
- package/dist/commands/crm.js +1 -4
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -1
- package/dist/identity.js +1 -0
- package/dist/program.js +1 -2
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/activities.d.ts +0 -4
- package/dist/activities.d.ts.map +0 -1
- package/dist/activities.js.map +0 -1
- package/dist/bin/attio.d.ts +0 -3
- package/dist/bin/attio.d.ts.map +0 -1
- package/dist/bin/attio.js.map +0 -1
- package/dist/bundle/agent-GUXXSLT5.js +0 -38
- package/dist/bundle/all-profiles-63N3EQ46.js +0 -320
- package/dist/bundle/anthropic-B4W7MZQE.js +0 -91
- package/dist/bundle/app-server-EXNGTHWO.js +0 -250
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-NBAY7FR2.js +0 -76
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2QDUP74I.js +0 -794
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3MSHGNVE.js +0 -1243
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-4RBMCXZT.js +0 -1337
- package/dist/bundle/chunk-4RSWOPKL.js +0 -323
- package/dist/bundle/chunk-5JKTVAXX.js +0 -2788
- package/dist/bundle/chunk-5N2V6XO7.js +0 -119
- package/dist/bundle/chunk-5WD22IXQ.js +0 -66
- package/dist/bundle/chunk-6K4Z6CAM.js +0 -43997
- package/dist/bundle/chunk-6TD3DCWC.js +0 -106
- package/dist/bundle/chunk-7Z53MLQP.js +0 -388
- package/dist/bundle/chunk-AATTOFNY.js +0 -2045
- package/dist/bundle/chunk-APARYILG.js +0 -743
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DM7KWVDZ.js +0 -3752
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPD4FMHN.js +0 -388
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DURNR4RO.js +0 -353
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EVUMQKV7.js +0 -76
- package/dist/bundle/chunk-EY36BTKZ.js +0 -108
- package/dist/bundle/chunk-FH6OEGGN.js +0 -557
- package/dist/bundle/chunk-FOP6G45D.js +0 -358
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GTEX4IUO.js +0 -334
- package/dist/bundle/chunk-HZ3C4WXD.js +0 -142
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-J6GVVISK.js +0 -185
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JIGEJZ4I.js +0 -68943
- package/dist/bundle/chunk-KVTNYRDO.js +0 -1007
- package/dist/bundle/chunk-L45WN3AR.js +0 -80
- package/dist/bundle/chunk-L72WUJAS.js +0 -54
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-LM3W7YOM.js +0 -274
- package/dist/bundle/chunk-M4AC55ZB.js +0 -12733
- package/dist/bundle/chunk-MCLQTCGH.js +0 -1202
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-OYEVYOCL.js +0 -259
- package/dist/bundle/chunk-P7G5HFY3.js +0 -288
- package/dist/bundle/chunk-PAEKXVJW.js +0 -188
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-PLPBEWD4.js +0 -170
- package/dist/bundle/chunk-PMQ7GP6X.js +0 -95
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QPPOIWPY.js +0 -1246
- package/dist/bundle/chunk-QSJKSPWF.js +0 -131
- package/dist/bundle/chunk-RDVTHFPP.js +0 -338
- package/dist/bundle/chunk-RQORQN2V.js +0 -4072
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S4UUN6LD.js +0 -1410
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-SCI7QEHF.js +0 -362
- package/dist/bundle/chunk-SSA6JBPA.js +0 -778
- package/dist/bundle/chunk-T4J7XFXT.js +0 -9667
- package/dist/bundle/chunk-TTF5DP4V.js +0 -1197
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-UKHF37ZU.js +0 -1068
- package/dist/bundle/chunk-V57E7PJQ.js +0 -161
- package/dist/bundle/chunk-V7IF2K3P.js +0 -52
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-WXQGA6XK.js +0 -50
- package/dist/bundle/chunk-XQGN2D44.js +0 -86
- package/dist/bundle/chunk-XQUUANA2.js +0 -24600
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YNGU36GW.js +0 -218
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/chunk-ZZD2YPOX.js +0 -156
- package/dist/bundle/command-contract-KCCW4LNI.js +0 -37
- package/dist/bundle/command-server-entry-3NPPABQQ.js +0 -166
- package/dist/bundle/decode-26M7XE2B.js +0 -297
- package/dist/bundle/dispatch-2FTOHA5D.js +0 -411
- package/dist/bundle/dist-EM7KLEG4.js +0 -7577
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-XJLEAWXE.js +0 -38
- package/dist/bundle/embedder-OEL6PXEH.js +0 -111
- package/dist/bundle/failure-OHIXWTR6.js +0 -25
- package/dist/bundle/first-run-CIXGBXY6.js +0 -29
- package/dist/bundle/first-screen-5FK4D45F.js +0 -38
- package/dist/bundle/instructions-AMH5RWVJ.js +0 -11
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-DMVGQNJ7.js +0 -24
- package/dist/bundle/meeting-model-2THAT7OH.js +0 -25
- package/dist/bundle/meeting-semantic-Q6XYFYUD.js +0 -22
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-KM3CUABH.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-2SWWGW6H.js +0 -74
- package/dist/bundle/oauth-V5LGTXF2.js +0 -20
- package/dist/bundle/open-25EKOTZA.js +0 -23
- package/dist/bundle/openai-VX3OLIHM.js +0 -238
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-Z5NUNXME.js +0 -34214
- package/dist/bundle/prompt-2VSPX5S7.js +0 -17
- package/dist/bundle/recognize-NA5XUFKK.js +0 -26
- package/dist/bundle/remote-BOME6XOE.js +0 -31
- package/dist/bundle/rerank-NG3XMFCV.js +0 -52
- package/dist/bundle/serve-MR67OBED.js +0 -199
- package/dist/bundle/server-4BWAGJQO.js +0 -80
- package/dist/bundle/server-OP2HJNXD.js +0 -213
- package/dist/bundle/sqlite-runtime-V5U6F5EB.js +0 -20
- package/dist/bundle/state-L4MWAATO.js +0 -36
- package/dist/bundle/store-2ALTEH55.js +0 -181
- package/dist/bundle/store-CXZFRG5D.js +0 -297
- package/dist/bundle/store-maintenance-command-LC55DRQA.js +0 -67
- package/dist/bundle/surface-3GRJ7473.js +0 -66
- package/dist/commands/api.d.ts +0 -12
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm.d.ts +0 -7
- package/dist/commands/crm.d.ts.map +0 -1
- package/dist/commands/crm.js.map +0 -1
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.d.ts.map +0 -1
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/session.d.ts +0 -8
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/config.d.ts +0 -13
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -37
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/generated/definitions.d.ts +0 -3
- package/dist/generated/definitions.d.ts.map +0 -1
- package/dist/generated/definitions.js.map +0 -1
- package/dist/generated/manifest.d.ts +0 -6
- package/dist/generated/manifest.d.ts.map +0 -1
- package/dist/generated/manifest.js.map +0 -1
- package/dist/generated/schemas.d.ts +0 -383
- package/dist/generated/schemas.d.ts.map +0 -1
- package/dist/generated/schemas.js.map +0 -1
- package/dist/generated/types.d.ts +0 -10166
- package/dist/generated/types.d.ts.map +0 -1
- package/dist/generated/types.js.map +0 -1
- package/dist/generated/wirecat-config.d.ts +0 -15
- package/dist/generated/wirecat-config.d.ts.map +0 -1
- package/dist/generated/wirecat-config.js.map +0 -1
- package/dist/hooks.d.ts +0 -33
- package/dist/hooks.d.ts.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/identity.d.ts +0 -33
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/links.d.ts +0 -10
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js.map +0 -1
- package/dist/meetings.d.ts +0 -57
- package/dist/meetings.d.ts.map +0 -1
- package/dist/meetings.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
pasteHint,
|
|
5
|
-
readSecret
|
|
6
|
-
} from "./chunk-IA7LLLEI.js";
|
|
7
|
-
import "./chunk-YWDFYQOU.js";
|
|
8
|
-
import "./chunk-5JKTVAXX.js";
|
|
9
|
-
import "./chunk-QPPOIWPY.js";
|
|
10
|
-
import "./chunk-S4UUN6LD.js";
|
|
11
|
-
import "./chunk-Y5E2WNWB.js";
|
|
12
|
-
import "./chunk-S6JG4YUH.js";
|
|
13
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
14
|
-
export {
|
|
15
|
-
pasteHint,
|
|
16
|
-
readSecret
|
|
17
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
SAMPLE_RATE,
|
|
5
|
-
decodeOgg,
|
|
6
|
-
detector,
|
|
7
|
-
loadSherpa,
|
|
8
|
-
openRecognizer,
|
|
9
|
-
openSpeechCutter,
|
|
10
|
-
toModelRate
|
|
11
|
-
} from "./chunk-LKH3UKLO.js";
|
|
12
|
-
import "./chunk-5JKTVAXX.js";
|
|
13
|
-
import "./chunk-QPPOIWPY.js";
|
|
14
|
-
import "./chunk-S4UUN6LD.js";
|
|
15
|
-
import "./chunk-Y5E2WNWB.js";
|
|
16
|
-
import "./chunk-S6JG4YUH.js";
|
|
17
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
18
|
-
export {
|
|
19
|
-
SAMPLE_RATE,
|
|
20
|
-
decodeOgg,
|
|
21
|
-
detector,
|
|
22
|
-
loadSherpa,
|
|
23
|
-
openRecognizer,
|
|
24
|
-
openSpeechCutter,
|
|
25
|
-
toModelRate
|
|
26
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
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-J6GVVISK.js";
|
|
12
|
-
import "./chunk-7Z53MLQP.js";
|
|
13
|
-
import "./chunk-TTF5DP4V.js";
|
|
14
|
-
import "./chunk-KVTNYRDO.js";
|
|
15
|
-
import "./chunk-LM3W7YOM.js";
|
|
16
|
-
import "./chunk-L72WUJAS.js";
|
|
17
|
-
import "./chunk-5JKTVAXX.js";
|
|
18
|
-
import "./chunk-QPPOIWPY.js";
|
|
19
|
-
import "./chunk-S4UUN6LD.js";
|
|
20
|
-
import "./chunk-Y5E2WNWB.js";
|
|
21
|
-
import "./chunk-S6JG4YUH.js";
|
|
22
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
23
|
-
export {
|
|
24
|
-
DEFAULT_OPENAI_MODEL,
|
|
25
|
-
OPENAI_MODELS,
|
|
26
|
-
OPENAI_URL,
|
|
27
|
-
isLocal,
|
|
28
|
-
openRemote,
|
|
29
|
-
remoteKey,
|
|
30
|
-
remoteModel
|
|
31
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
defaultThreads,
|
|
5
|
-
loadModel,
|
|
6
|
-
truncated
|
|
7
|
-
} from "./chunk-KVTNYRDO.js";
|
|
8
|
-
import "./chunk-LM3W7YOM.js";
|
|
9
|
-
import "./chunk-L72WUJAS.js";
|
|
10
|
-
import "./chunk-5JKTVAXX.js";
|
|
11
|
-
import "./chunk-QPPOIWPY.js";
|
|
12
|
-
import "./chunk-S4UUN6LD.js";
|
|
13
|
-
import "./chunk-Y5E2WNWB.js";
|
|
14
|
-
import "./chunk-S6JG4YUH.js";
|
|
15
|
-
import {
|
|
16
|
-
__name
|
|
17
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
18
|
-
|
|
19
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/embeddings/rerank.js
|
|
20
|
-
var openReranker = /* @__PURE__ */ __name(async (model, directory, { threads = defaultThreads() } = {}) => {
|
|
21
|
-
const { ort, tokenizer, session } = await loadModel(model, directory, threads);
|
|
22
|
-
const typeIds = session.inputNames.includes("token_type_ids");
|
|
23
|
-
const output = session.outputNames[0];
|
|
24
|
-
const one = /* @__PURE__ */ __name(async (question, passage) => {
|
|
25
|
-
const encoded = tokenizer.encode(question, { text_pair: passage, return_token_type_ids: true });
|
|
26
|
-
const ids = truncated(encoded.ids, model.maxTokens);
|
|
27
|
-
const shape = [1, ids.length];
|
|
28
|
-
const feeds = {
|
|
29
|
-
input_ids: new ort.Tensor("int64", BigInt64Array.from(ids, BigInt), shape),
|
|
30
|
-
attention_mask: new ort.Tensor("int64", new BigInt64Array(ids.length).fill(1n), shape)
|
|
31
|
-
};
|
|
32
|
-
if (typeIds)
|
|
33
|
-
feeds.token_type_ids = new ort.Tensor("int64", BigInt64Array.from(truncated(encoded.token_type_ids, model.maxTokens), BigInt), shape);
|
|
34
|
-
const logit = (await session.run(feeds))[output]?.data[0];
|
|
35
|
-
if (typeof logit !== "number" || !Number.isFinite(logit))
|
|
36
|
-
throw new Error(`${model.id} gave no score`);
|
|
37
|
-
return logit;
|
|
38
|
-
}, "one");
|
|
39
|
-
return {
|
|
40
|
-
model,
|
|
41
|
-
score: /* @__PURE__ */ __name(async (question, passages) => {
|
|
42
|
-
const scores = [];
|
|
43
|
-
for (const passage of passages)
|
|
44
|
-
scores.push(await one(question, passage));
|
|
45
|
-
return scores;
|
|
46
|
-
}, "score"),
|
|
47
|
-
close: /* @__PURE__ */ __name(() => session.release(), "close")
|
|
48
|
-
};
|
|
49
|
-
}, "openReranker");
|
|
50
|
-
export {
|
|
51
|
-
openReranker
|
|
52
|
-
};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
listen
|
|
5
|
-
} from "./chunk-VZ5PPYDG.js";
|
|
6
|
-
import {
|
|
7
|
-
ownerLogin
|
|
8
|
-
} from "./chunk-P7G5HFY3.js";
|
|
9
|
-
import {
|
|
10
|
-
WebStandardStreamableHTTPServerTransport,
|
|
11
|
-
createMcpHandler,
|
|
12
|
-
getOAuthProtectedResourceMetadataUrl,
|
|
13
|
-
hostHeaderValidationResponse,
|
|
14
|
-
isLegacyRequest,
|
|
15
|
-
oauthMetadataResponse,
|
|
16
|
-
requireBearerAuth
|
|
17
|
-
} from "./chunk-PL5P7UKW.js";
|
|
18
|
-
import {
|
|
19
|
-
activityRecorder,
|
|
20
|
-
calledTools,
|
|
21
|
-
httpActivityFile,
|
|
22
|
-
httpLock
|
|
23
|
-
} from "./chunk-V57E7PJQ.js";
|
|
24
|
-
import "./chunk-XQGN2D44.js";
|
|
25
|
-
import "./chunk-3YM4B2GT.js";
|
|
26
|
-
import "./chunk-5JKTVAXX.js";
|
|
27
|
-
import "./chunk-QPPOIWPY.js";
|
|
28
|
-
import "./chunk-S4UUN6LD.js";
|
|
29
|
-
import "./chunk-Y5E2WNWB.js";
|
|
30
|
-
import {
|
|
31
|
-
CliError
|
|
32
|
-
} from "./chunk-S6JG4YUH.js";
|
|
33
|
-
import {
|
|
34
|
-
__name
|
|
35
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
36
|
-
|
|
37
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/mcp/http/serve.js
|
|
38
|
-
import { randomUUID } from "node:crypto";
|
|
39
|
-
var MCP_PATH = "/mcp";
|
|
40
|
-
var AS_METADATA = "/.well-known/oauth-authorization-server";
|
|
41
|
-
var LOCAL = ["localhost", "127.0.0.1"];
|
|
42
|
-
var MAX_SESSIONS = 20;
|
|
43
|
-
var MAX_LOGIN_BODY = 64 * 1024;
|
|
44
|
-
var SESSION_IDLE_MS = 60 * 60 * 1e3;
|
|
45
|
-
var sessionMissing = /* @__PURE__ */ __name(() => new Response(JSON.stringify({ jsonrpc: "2.0", error: { code: -32001, message: "Session not found" }, id: null }), {
|
|
46
|
-
status: 404,
|
|
47
|
-
headers: { "content-type": "application/json" }
|
|
48
|
-
}), "sessionMissing");
|
|
49
|
-
var legacySessions = /* @__PURE__ */ __name((build, now) => {
|
|
50
|
-
const sessions = /* @__PURE__ */ new Map();
|
|
51
|
-
const drop = /* @__PURE__ */ __name(async (id) => {
|
|
52
|
-
const one = sessions.get(id);
|
|
53
|
-
sessions.delete(id);
|
|
54
|
-
await one?.close();
|
|
55
|
-
}, "drop");
|
|
56
|
-
const handle = /* @__PURE__ */ __name(async (request, auth) => {
|
|
57
|
-
for (const [id2, one] of sessions)
|
|
58
|
-
if (now() - one.seen > SESSION_IDLE_MS)
|
|
59
|
-
await drop(id2);
|
|
60
|
-
const id = request.headers.get("mcp-session-id");
|
|
61
|
-
if (id) {
|
|
62
|
-
const known = sessions.get(id);
|
|
63
|
-
if (!known || known.clientId !== auth.clientId)
|
|
64
|
-
return sessionMissing();
|
|
65
|
-
known.seen = now();
|
|
66
|
-
return known.transport.handleRequest(request, { authInfo: auth });
|
|
67
|
-
}
|
|
68
|
-
const server = build();
|
|
69
|
-
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
70
|
-
sessionIdGenerator: /* @__PURE__ */ __name(() => randomUUID(), "sessionIdGenerator"),
|
|
71
|
-
onsessionclosed: /* @__PURE__ */ __name((closed) => void sessions.delete(closed), "onsessionclosed")
|
|
72
|
-
});
|
|
73
|
-
await server.connect(transport);
|
|
74
|
-
const response = await transport.handleRequest(request, { authInfo: auth });
|
|
75
|
-
if (!transport.sessionId) {
|
|
76
|
-
await server.close();
|
|
77
|
-
return response;
|
|
78
|
-
}
|
|
79
|
-
sessions.set(transport.sessionId, { transport, close: /* @__PURE__ */ __name(() => server.close(), "close"), clientId: auth.clientId, seen: now() });
|
|
80
|
-
while (sessions.size > MAX_SESSIONS)
|
|
81
|
-
await drop(sessions.keys().next().value);
|
|
82
|
-
return response;
|
|
83
|
-
}, "handle");
|
|
84
|
-
return {
|
|
85
|
-
handle,
|
|
86
|
-
close: /* @__PURE__ */ __name(async () => {
|
|
87
|
-
for (const id of [...sessions.keys()])
|
|
88
|
-
await drop(id);
|
|
89
|
-
}, "close")
|
|
90
|
-
};
|
|
91
|
-
}, "legacySessions");
|
|
92
|
-
var metadataRequest = /* @__PURE__ */ __name((request, path, base) => {
|
|
93
|
-
const url = new URL(request.url);
|
|
94
|
-
const inserted = base && path === `${AS_METADATA}${base}`;
|
|
95
|
-
if (!inserted && url.pathname === path)
|
|
96
|
-
return request;
|
|
97
|
-
url.pathname = inserted ? AS_METADATA : path;
|
|
98
|
-
return new Request(url, { method: request.method, headers: request.headers });
|
|
99
|
-
}, "metadataRequest");
|
|
100
|
-
var toolsIn = /* @__PURE__ */ __name(async (request) => {
|
|
101
|
-
if (request.method !== "POST")
|
|
102
|
-
return [];
|
|
103
|
-
try {
|
|
104
|
-
return calledTools(await request.clone().json());
|
|
105
|
-
} catch {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
}, "toolsIn");
|
|
109
|
-
var serveOverHttp = /* @__PURE__ */ __name(async (build, options) => {
|
|
110
|
-
const { publicUrl, port, tokenFile, appName, reaches, onCode, onError, now, lockFile, version } = options;
|
|
111
|
-
const lock = lockFile ? httpLock(lockFile, {
|
|
112
|
-
pid: process.pid,
|
|
113
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
114
|
-
port,
|
|
115
|
-
publicUrl: publicUrl.href,
|
|
116
|
-
...version ? { version } : {}
|
|
117
|
-
}) : void 0;
|
|
118
|
-
if (lock?.held)
|
|
119
|
-
throw new CliError("validation_error", `${appName} already serves MCP over HTTP for this profile on port ${lock.held.port} (PID ${lock.held.pid}, since ${lock.held.startedAt})`);
|
|
120
|
-
const base = publicUrl.pathname === "/" ? "" : publicUrl.pathname.replace(/\/+$/, "");
|
|
121
|
-
const issuer = new URL(`${publicUrl.origin}${base}`);
|
|
122
|
-
const resource = new URL(`${base}${MCP_PATH}`, publicUrl.origin);
|
|
123
|
-
const mcpPath = resource.pathname;
|
|
124
|
-
const publicPath = /* @__PURE__ */ __name((path) => base && path !== base && !path.startsWith(`${base}/`) && !path.startsWith("/.well-known/") ? `${base}${path}` : path, "publicPath");
|
|
125
|
-
const login = ownerLogin({
|
|
126
|
-
issuer,
|
|
127
|
-
resource,
|
|
128
|
-
file: tokenFile,
|
|
129
|
-
appName,
|
|
130
|
-
...reaches ? { reaches } : {},
|
|
131
|
-
onCode: /* @__PURE__ */ __name((code, expires) => {
|
|
132
|
-
lock?.update({ loginCode: code, loginCodeExpiresAt: expires.toISOString() });
|
|
133
|
-
onCode(code, expires);
|
|
134
|
-
}, "onCode"),
|
|
135
|
-
...now ? { now } : {}
|
|
136
|
-
});
|
|
137
|
-
const insecure = issuer.protocol === "http:" && LOCAL.includes(issuer.hostname);
|
|
138
|
-
const mcp = createMcpHandler(build, { legacy: "reject", ...onError ? { onerror: onError } : {} });
|
|
139
|
-
const legacy = legacySessions(build, now ?? Date.now);
|
|
140
|
-
const bearer = requireBearerAuth({
|
|
141
|
-
verifier: login.verifier,
|
|
142
|
-
resourceMetadataUrl: getOAuthProtectedResourceMetadataUrl(resource)
|
|
143
|
-
});
|
|
144
|
-
const activity = activityRecorder(httpActivityFile(tokenFile), now);
|
|
145
|
-
const allowedHosts = [.../* @__PURE__ */ new Set([publicUrl.hostname, ...LOCAL])];
|
|
146
|
-
const allowedOrigins = [publicUrl.origin];
|
|
147
|
-
const listening = await listen(async (request) => {
|
|
148
|
-
const refused = hostHeaderValidationResponse(request, allowedHosts);
|
|
149
|
-
if (refused)
|
|
150
|
-
return refused;
|
|
151
|
-
const path = publicPath(new URL(request.url).pathname);
|
|
152
|
-
const discovery = oauthMetadataResponse(metadataRequest(request, path, base), {
|
|
153
|
-
oauthMetadata: login.metadata,
|
|
154
|
-
resourceServerUrl: resource,
|
|
155
|
-
resourceName: appName,
|
|
156
|
-
...insecure ? { dangerouslyAllowInsecureIssuerUrl: true } : {}
|
|
157
|
-
});
|
|
158
|
-
if (discovery)
|
|
159
|
-
return discovery;
|
|
160
|
-
if (Number(request.headers.get("content-length") ?? 0) > MAX_LOGIN_BODY && path !== mcpPath)
|
|
161
|
-
return new Response("Request too large", { status: 413 });
|
|
162
|
-
const origin = request.headers.get("origin");
|
|
163
|
-
if (origin && !allowedOrigins.includes(origin))
|
|
164
|
-
return new Response("Origin not allowed", { status: 403 });
|
|
165
|
-
const answered = await login.handle(request, path);
|
|
166
|
-
if (answered)
|
|
167
|
-
return answered;
|
|
168
|
-
if (path !== mcpPath)
|
|
169
|
-
return new Response("Not found", { status: 404 });
|
|
170
|
-
const auth = await bearer(request);
|
|
171
|
-
if (auth instanceof Response)
|
|
172
|
-
return auth;
|
|
173
|
-
activity.record(auth.clientId, await toolsIn(request));
|
|
174
|
-
return await isLegacyRequest(request) ? legacy.handle(request, auth) : mcp.fetch(request, { authInfo: auth });
|
|
175
|
-
}, { host: "127.0.0.1", port }).catch((error) => {
|
|
176
|
-
login.close();
|
|
177
|
-
lock?.release();
|
|
178
|
-
throw error;
|
|
179
|
-
});
|
|
180
|
-
lock?.update({ listeningAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
181
|
-
return {
|
|
182
|
-
url: listening.url,
|
|
183
|
-
close: /* @__PURE__ */ __name(async () => {
|
|
184
|
-
login.close();
|
|
185
|
-
activity.flush();
|
|
186
|
-
try {
|
|
187
|
-
await listening.close();
|
|
188
|
-
await legacy.close();
|
|
189
|
-
await mcp.close();
|
|
190
|
-
} finally {
|
|
191
|
-
lock?.release();
|
|
192
|
-
}
|
|
193
|
-
}, "close")
|
|
194
|
-
};
|
|
195
|
-
}, "serveOverHttp");
|
|
196
|
-
export {
|
|
197
|
-
MCP_PATH,
|
|
198
|
-
serveOverHttp
|
|
199
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
PER_RUN,
|
|
5
|
-
createServer,
|
|
6
|
-
envelope,
|
|
7
|
-
serveOverHttpUntilStopped,
|
|
8
|
-
serveOverStdio
|
|
9
|
-
} from "./chunk-2QDUP74I.js";
|
|
10
|
-
import "./chunk-4RBMCXZT.js";
|
|
11
|
-
import "./chunk-DPD4FMHN.js";
|
|
12
|
-
import "./chunk-VB7FZOYX.js";
|
|
13
|
-
import "./chunk-Q7ICVP25.js";
|
|
14
|
-
import "./chunk-3MSHGNVE.js";
|
|
15
|
-
import "./chunk-DURNR4RO.js";
|
|
16
|
-
import "./chunk-DM7KWVDZ.js";
|
|
17
|
-
import "./chunk-WXQGA6XK.js";
|
|
18
|
-
import "./chunk-RDVTHFPP.js";
|
|
19
|
-
import "./chunk-2XBDILVW.js";
|
|
20
|
-
import "./chunk-FH6OEGGN.js";
|
|
21
|
-
import "./chunk-MCLQTCGH.js";
|
|
22
|
-
import "./chunk-6K4Z6CAM.js";
|
|
23
|
-
import "./chunk-JG6LCSEX.js";
|
|
24
|
-
import "./chunk-5N2V6XO7.js";
|
|
25
|
-
import "./chunk-NB7EOAUZ.js";
|
|
26
|
-
import "./chunk-HZ3C4WXD.js";
|
|
27
|
-
import "./chunk-TY7NDMFY.js";
|
|
28
|
-
import "./chunk-EY36BTKZ.js";
|
|
29
|
-
import "./chunk-APARYILG.js";
|
|
30
|
-
import "./chunk-WOPVBRPV.js";
|
|
31
|
-
import "./chunk-PL5P7UKW.js";
|
|
32
|
-
import "./chunk-EVUMQKV7.js";
|
|
33
|
-
import "./chunk-OYEVYOCL.js";
|
|
34
|
-
import "./chunk-FOP6G45D.js";
|
|
35
|
-
import "./chunk-PLPBEWD4.js";
|
|
36
|
-
import "./chunk-V57E7PJQ.js";
|
|
37
|
-
import "./chunk-XQGN2D44.js";
|
|
38
|
-
import "./chunk-QSJKSPWF.js";
|
|
39
|
-
import "./chunk-M4AC55ZB.js";
|
|
40
|
-
import "./chunk-SCI7QEHF.js";
|
|
41
|
-
import "./chunk-V7IF2K3P.js";
|
|
42
|
-
import "./chunk-GTEX4IUO.js";
|
|
43
|
-
import "./chunk-3YM4B2GT.js";
|
|
44
|
-
import "./chunk-YWDFYQOU.js";
|
|
45
|
-
import "./chunk-UKHF37ZU.js";
|
|
46
|
-
import "./chunk-5WD22IXQ.js";
|
|
47
|
-
import "./chunk-JIGEJZ4I.js";
|
|
48
|
-
import "./chunk-UDSL3MUU.js";
|
|
49
|
-
import "./chunk-L45WN3AR.js";
|
|
50
|
-
import "./chunk-SSA6JBPA.js";
|
|
51
|
-
import "./chunk-2JHVQMVC.js";
|
|
52
|
-
import "./chunk-AATTOFNY.js";
|
|
53
|
-
import "./chunk-ZZD2YPOX.js";
|
|
54
|
-
import "./chunk-RRTMPSQR.js";
|
|
55
|
-
import "./chunk-RQORQN2V.js";
|
|
56
|
-
import "./chunk-DNCLQPOM.js";
|
|
57
|
-
import "./chunk-J6GVVISK.js";
|
|
58
|
-
import "./chunk-7Z53MLQP.js";
|
|
59
|
-
import "./chunk-TTF5DP4V.js";
|
|
60
|
-
import "./chunk-KVTNYRDO.js";
|
|
61
|
-
import "./chunk-LM3W7YOM.js";
|
|
62
|
-
import "./chunk-TXDR6YSF.js";
|
|
63
|
-
import "./chunk-D72URWJE.js";
|
|
64
|
-
import "./chunk-L72WUJAS.js";
|
|
65
|
-
import "./chunk-PMQ7GP6X.js";
|
|
66
|
-
import "./chunk-GGMAIIVE.js";
|
|
67
|
-
import "./chunk-5JKTVAXX.js";
|
|
68
|
-
import "./chunk-QPPOIWPY.js";
|
|
69
|
-
import "./chunk-S4UUN6LD.js";
|
|
70
|
-
import "./chunk-Y5E2WNWB.js";
|
|
71
|
-
import "./chunk-S6JG4YUH.js";
|
|
72
|
-
import "./chunk-4N7PP76S.js";
|
|
73
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
74
|
-
export {
|
|
75
|
-
PER_RUN,
|
|
76
|
-
createServer,
|
|
77
|
-
envelope,
|
|
78
|
-
serveOverHttpUntilStopped,
|
|
79
|
-
serveOverStdio
|
|
80
|
-
};
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
botInstructions
|
|
5
|
-
} from "./chunk-3HC5F3P7.js";
|
|
6
|
-
import {
|
|
7
|
-
skillResources
|
|
8
|
-
} from "./chunk-DPD4FMHN.js";
|
|
9
|
-
import {
|
|
10
|
-
StdioServerTransport,
|
|
11
|
-
answeredWire,
|
|
12
|
-
serveStdio
|
|
13
|
-
} from "./chunk-VB7FZOYX.js";
|
|
14
|
-
import {
|
|
15
|
-
wholeList
|
|
16
|
-
} from "./chunk-DURNR4RO.js";
|
|
17
|
-
import {
|
|
18
|
-
runCommandForAgent,
|
|
19
|
-
toolsFromCommands
|
|
20
|
-
} from "./chunk-DM7KWVDZ.js";
|
|
21
|
-
import "./chunk-WXQGA6XK.js";
|
|
22
|
-
import "./chunk-RDVTHFPP.js";
|
|
23
|
-
import {
|
|
24
|
-
answered,
|
|
25
|
-
normal,
|
|
26
|
-
registerCommands
|
|
27
|
-
} from "./chunk-FH6OEGGN.js";
|
|
28
|
-
import {
|
|
29
|
-
agentJson
|
|
30
|
-
} from "./chunk-MCLQTCGH.js";
|
|
31
|
-
import "./chunk-6K4Z6CAM.js";
|
|
32
|
-
import "./chunk-JG6LCSEX.js";
|
|
33
|
-
import "./chunk-5N2V6XO7.js";
|
|
34
|
-
import "./chunk-NB7EOAUZ.js";
|
|
35
|
-
import "./chunk-HZ3C4WXD.js";
|
|
36
|
-
import "./chunk-TY7NDMFY.js";
|
|
37
|
-
import {
|
|
38
|
-
callerOf
|
|
39
|
-
} from "./chunk-EY36BTKZ.js";
|
|
40
|
-
import "./chunk-APARYILG.js";
|
|
41
|
-
import "./chunk-WOPVBRPV.js";
|
|
42
|
-
import {
|
|
43
|
-
McpServer
|
|
44
|
-
} from "./chunk-PL5P7UKW.js";
|
|
45
|
-
import "./chunk-EVUMQKV7.js";
|
|
46
|
-
import "./chunk-OYEVYOCL.js";
|
|
47
|
-
import "./chunk-FOP6G45D.js";
|
|
48
|
-
import "./chunk-PLPBEWD4.js";
|
|
49
|
-
import {
|
|
50
|
-
MESSENGER_CHANGE_REFUSAL,
|
|
51
|
-
changesMessenger,
|
|
52
|
-
flatten,
|
|
53
|
-
itemOf,
|
|
54
|
-
readOnlyLockOf,
|
|
55
|
-
readOnlyRefusal
|
|
56
|
-
} from "./chunk-M4AC55ZB.js";
|
|
57
|
-
import "./chunk-SCI7QEHF.js";
|
|
58
|
-
import "./chunk-V7IF2K3P.js";
|
|
59
|
-
import "./chunk-GTEX4IUO.js";
|
|
60
|
-
import "./chunk-3YM4B2GT.js";
|
|
61
|
-
import "./chunk-YWDFYQOU.js";
|
|
62
|
-
import "./chunk-UKHF37ZU.js";
|
|
63
|
-
import "./chunk-5WD22IXQ.js";
|
|
64
|
-
import "./chunk-JIGEJZ4I.js";
|
|
65
|
-
import "./chunk-UDSL3MUU.js";
|
|
66
|
-
import "./chunk-L45WN3AR.js";
|
|
67
|
-
import "./chunk-SSA6JBPA.js";
|
|
68
|
-
import "./chunk-2JHVQMVC.js";
|
|
69
|
-
import "./chunk-AATTOFNY.js";
|
|
70
|
-
import "./chunk-ZZD2YPOX.js";
|
|
71
|
-
import "./chunk-RRTMPSQR.js";
|
|
72
|
-
import "./chunk-RQORQN2V.js";
|
|
73
|
-
import "./chunk-DNCLQPOM.js";
|
|
74
|
-
import "./chunk-J6GVVISK.js";
|
|
75
|
-
import "./chunk-7Z53MLQP.js";
|
|
76
|
-
import "./chunk-TTF5DP4V.js";
|
|
77
|
-
import "./chunk-KVTNYRDO.js";
|
|
78
|
-
import "./chunk-LM3W7YOM.js";
|
|
79
|
-
import "./chunk-TXDR6YSF.js";
|
|
80
|
-
import "./chunk-D72URWJE.js";
|
|
81
|
-
import "./chunk-L72WUJAS.js";
|
|
82
|
-
import "./chunk-PMQ7GP6X.js";
|
|
83
|
-
import "./chunk-GGMAIIVE.js";
|
|
84
|
-
import "./chunk-5JKTVAXX.js";
|
|
85
|
-
import {
|
|
86
|
-
mcpErrorResult
|
|
87
|
-
} from "./chunk-QPPOIWPY.js";
|
|
88
|
-
import {
|
|
89
|
-
object
|
|
90
|
-
} from "./chunk-S4UUN6LD.js";
|
|
91
|
-
import "./chunk-Y5E2WNWB.js";
|
|
92
|
-
import "./chunk-S6JG4YUH.js";
|
|
93
|
-
import "./chunk-4N7PP76S.js";
|
|
94
|
-
import {
|
|
95
|
-
__name
|
|
96
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
97
|
-
|
|
98
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/mcp/bot/server.js
|
|
99
|
-
import { randomUUID } from "node:crypto";
|
|
100
|
-
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");
|
|
101
|
-
var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
102
|
-
const { bot, program, settings, env } = options;
|
|
103
|
-
const command = bot.app.command;
|
|
104
|
-
const levels = options.levels ?? (() => settings.permissions);
|
|
105
|
-
const authority = /* @__PURE__ */ __name((path) => options.authority?.(path) === true || path[0] === "config" && (path[1] === "set" || path[1] === "unset"), "authority");
|
|
106
|
-
const catalogue = {
|
|
107
|
-
includeUnavailable: true,
|
|
108
|
-
levels: settings.permissions,
|
|
109
|
-
currentLevels: levels,
|
|
110
|
-
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
111
|
-
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
112
|
-
authority,
|
|
113
|
-
...options.fetchOnly ? { fetchOnly: options.fetchOnly } : {},
|
|
114
|
-
...options.fetches ? { fetches: options.fetches } : {},
|
|
115
|
-
offline: true,
|
|
116
|
-
// Another bot's copy is this bot's to read only where `read_other_bots` says so.
|
|
117
|
-
...settings.readOtherBots ? {} : { omit: ["all_bots", "bots"] }
|
|
118
|
-
};
|
|
119
|
-
const tools = [
|
|
120
|
-
...toolsFromCommands(program.commands, { ...catalogue, root: ["bot"] }),
|
|
121
|
-
...toolsFromCommands(program.commands.filter((one) => one.path[0] === "config"), {
|
|
122
|
-
...catalogue,
|
|
123
|
-
omit: ["bot", "personal", "defaults"]
|
|
124
|
-
})
|
|
125
|
-
];
|
|
126
|
-
const writes = tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command);
|
|
127
|
-
const skills = options.skill ? skillResources(bot.app, options.skill) : [];
|
|
128
|
-
const skill = skills[0];
|
|
129
|
-
let queue = Promise.resolve();
|
|
130
|
-
const invoke = /* @__PURE__ */ __name((path, input, caller) => {
|
|
131
|
-
const next = queue.then(() => runCommandForAgent(program, path, path[0] === "config" ? { ...input, bot: true } : input, {
|
|
132
|
-
profile: settings.profile,
|
|
133
|
-
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
134
|
-
env,
|
|
135
|
-
levels,
|
|
136
|
-
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
137
|
-
authority,
|
|
138
|
-
...options.fetches ? { fetches: options.fetches } : {},
|
|
139
|
-
...caller ? { caller } : {}
|
|
140
|
-
}));
|
|
141
|
-
queue = next.catch(() => void 0);
|
|
142
|
-
return next;
|
|
143
|
-
}, "invoke");
|
|
144
|
-
const build = /* @__PURE__ */ __name(() => {
|
|
145
|
-
const callers = { env, client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"), connectionId: randomUUID() };
|
|
146
|
-
const server = new McpServer({ name: `${command}-bot-${settings.profile}`, version: bot.app.version }, {
|
|
147
|
-
instructions: botInstructions({
|
|
148
|
-
command,
|
|
149
|
-
name: bot.name ?? command,
|
|
150
|
-
profile: settings.profile,
|
|
151
|
-
writes,
|
|
152
|
-
...skill ? { skill: skill.instruction } : {}
|
|
153
|
-
})
|
|
154
|
-
});
|
|
155
|
-
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
156
|
-
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
157
|
-
const commands = Object.fromEntries(tools.map((tool) => [
|
|
158
|
-
tool.command,
|
|
159
|
-
{
|
|
160
|
-
title: tool.title,
|
|
161
|
-
description: tool.description,
|
|
162
|
-
writes: tool.writes,
|
|
163
|
-
availability: tool.availability,
|
|
164
|
-
input: tool.input,
|
|
165
|
-
run: /* @__PURE__ */ __name(async (args, ctx) => {
|
|
166
|
-
const caller = callerOf(ctx, `${command}_${tool.command.replaceAll(" ", "_")}`, callers);
|
|
167
|
-
const answer = await invoke(tool.path, args, caller);
|
|
168
|
-
return "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : answered(body(tool.command, answer.result));
|
|
169
|
-
}, "run")
|
|
170
|
-
}
|
|
171
|
-
]));
|
|
172
|
-
commands.status = {
|
|
173
|
-
title: "This server's bot and profile",
|
|
174
|
-
description: "Which profile this server speaks for, where its bot token comes from, which bot it is, and which writing commands are on. Sends nothing.",
|
|
175
|
-
writes: false,
|
|
176
|
-
input: object({}),
|
|
177
|
-
run: /* @__PURE__ */ __name(async () => {
|
|
178
|
-
const auth = await invoke(["bot", "auth", "show"], {});
|
|
179
|
-
const shown = "error" in auth ? auth.error : auth.result?.item ?? auth.result;
|
|
180
|
-
return answered(itemOf({
|
|
181
|
-
profile: settings.profile,
|
|
182
|
-
kind: "bot",
|
|
183
|
-
auth: shown,
|
|
184
|
-
writes: tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command),
|
|
185
|
-
permissions: levels()
|
|
186
|
-
}));
|
|
187
|
-
}, "run")
|
|
188
|
-
};
|
|
189
|
-
registerCommands(server, `${command}_bot`, commands, void 0, (asked) => {
|
|
190
|
-
const lock = readOnlyLockOf(bot.app, env);
|
|
191
|
-
const one = flatten(program.commands).find((info) => info.path[0] === "bot" && normal(info.path.slice(1).join(" ")) === asked);
|
|
192
|
-
if (lock && one && changesMessenger(one))
|
|
193
|
-
throw readOnlyRefusal(lock, MESSENGER_CHANGE_REFUSAL);
|
|
194
|
-
}, bot.app.messenger);
|
|
195
|
-
return server;
|
|
196
|
-
}, "build");
|
|
197
|
-
return { build, tools, offered: tools.map((tool) => tool.command) };
|
|
198
|
-
}, "createBotServer");
|
|
199
|
-
var serveBotOverStdio = /* @__PURE__ */ __name(async (options, note) => {
|
|
200
|
-
const { build } = createBotServer(options);
|
|
201
|
-
const wire = answeredWire(process.stdin, process.stdout);
|
|
202
|
-
const handle = serveStdio(build, {
|
|
203
|
-
transport: new StdioServerTransport(wire.input, wire.output),
|
|
204
|
-
onerror: /* @__PURE__ */ __name((error) => note(`mcp: ${error.message}`), "onerror")
|
|
205
|
-
});
|
|
206
|
-
await wire.finished();
|
|
207
|
-
wire.release();
|
|
208
|
-
await handle.close();
|
|
209
|
-
}, "serveBotOverStdio");
|
|
210
|
-
export {
|
|
211
|
-
createBotServer,
|
|
212
|
-
serveBotOverStdio
|
|
213
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
ensureSqlite,
|
|
5
|
-
nodeRuntime,
|
|
6
|
-
relay
|
|
7
|
-
} from "./chunk-6TD3DCWC.js";
|
|
8
|
-
import "./chunk-PMQ7GP6X.js";
|
|
9
|
-
import "./chunk-GGMAIIVE.js";
|
|
10
|
-
import "./chunk-5JKTVAXX.js";
|
|
11
|
-
import "./chunk-QPPOIWPY.js";
|
|
12
|
-
import "./chunk-S4UUN6LD.js";
|
|
13
|
-
import "./chunk-Y5E2WNWB.js";
|
|
14
|
-
import "./chunk-S6JG4YUH.js";
|
|
15
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
16
|
-
export {
|
|
17
|
-
ensureSqlite,
|
|
18
|
-
nodeRuntime,
|
|
19
|
-
relay
|
|
20
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
ACCESS_SECONDS,
|
|
5
|
-
REFRESH_SECONDS,
|
|
6
|
-
httpLaunchFile,
|
|
7
|
-
httpLock,
|
|
8
|
-
httpLockFile,
|
|
9
|
-
httpLogFile,
|
|
10
|
-
mcpHttpMarker,
|
|
11
|
-
readHttpLaunch,
|
|
12
|
-
readHttpLock,
|
|
13
|
-
readStored,
|
|
14
|
-
signedInClients
|
|
15
|
-
} from "./chunk-V57E7PJQ.js";
|
|
16
|
-
import "./chunk-XQGN2D44.js";
|
|
17
|
-
import "./chunk-3YM4B2GT.js";
|
|
18
|
-
import "./chunk-5JKTVAXX.js";
|
|
19
|
-
import "./chunk-QPPOIWPY.js";
|
|
20
|
-
import "./chunk-S4UUN6LD.js";
|
|
21
|
-
import "./chunk-Y5E2WNWB.js";
|
|
22
|
-
import "./chunk-S6JG4YUH.js";
|
|
23
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
24
|
-
export {
|
|
25
|
-
ACCESS_SECONDS,
|
|
26
|
-
REFRESH_SECONDS,
|
|
27
|
-
httpLaunchFile,
|
|
28
|
-
httpLock,
|
|
29
|
-
httpLockFile,
|
|
30
|
-
httpLogFile,
|
|
31
|
-
mcpHttpMarker,
|
|
32
|
-
readHttpLaunch,
|
|
33
|
-
readHttpLock,
|
|
34
|
-
readStored,
|
|
35
|
-
signedInClients
|
|
36
|
-
};
|