@wirecat/amo-cli 0.0.0-stage → 0.1.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 +61 -0
- package/LICENSE +204 -0
- package/README.md +257 -2
- package/contracts/wirecat.json +1356 -0
- package/dist/amo/account.d.ts +18 -0
- package/dist/amo/account.d.ts.map +1 -0
- package/dist/amo/account.js +48 -0
- package/dist/amo/account.js.map +1 -0
- package/dist/amo/allow-list.d.ts +31 -0
- package/dist/amo/allow-list.d.ts.map +1 -0
- package/dist/amo/allow-list.js +106 -0
- package/dist/amo/allow-list.js.map +1 -0
- package/dist/amo/call.d.ts +24 -0
- package/dist/amo/call.d.ts.map +1 -0
- package/dist/amo/call.js +54 -0
- package/dist/amo/call.js.map +1 -0
- package/dist/amo/errors.d.ts +12 -0
- package/dist/amo/errors.d.ts.map +1 -0
- package/dist/amo/errors.js +72 -0
- package/dist/amo/errors.js.map +1 -0
- package/dist/amo/json.d.ts +3 -0
- package/dist/amo/json.d.ts.map +1 -0
- package/dist/amo/json.js +3 -0
- package/dist/amo/json.js.map +1 -0
- package/dist/amo/oauth.d.ts +55 -0
- package/dist/amo/oauth.d.ts.map +1 -0
- package/dist/amo/oauth.js +189 -0
- package/dist/amo/oauth.js.map +1 -0
- package/dist/amo/operation.d.ts +45 -0
- package/dist/amo/operation.d.ts.map +1 -0
- package/dist/amo/operation.js +119 -0
- package/dist/amo/operation.js.map +1 -0
- package/dist/amo/operations.d.ts +3 -0
- package/dist/amo/operations.d.ts.map +1 -0
- package/dist/amo/operations.js +1407 -0
- package/dist/amo/operations.js.map +1 -0
- package/dist/amo/routes.d.ts +67 -0
- package/dist/amo/routes.d.ts.map +1 -0
- package/dist/amo/routes.js +65 -0
- package/dist/amo/routes.js.map +1 -0
- package/dist/amo/transport.d.ts +62 -0
- package/dist/amo/transport.d.ts.map +1 -0
- package/dist/amo/transport.js +282 -0
- package/dist/amo/transport.js.map +1 -0
- package/dist/api-keys.d.ts +47 -0
- package/dist/api-keys.d.ts.map +1 -0
- package/dist/api-keys.js +224 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/bin/amo.d.ts +3 -0
- package/dist/bin/amo.d.ts.map +1 -0
- package/dist/bin/amo.js +40 -0
- package/dist/bin/amo.js.map +1 -0
- package/dist/bundle/all-profiles-3KQVWDV4.js +278 -0
- package/dist/bundle/amo.js +198 -0
- package/dist/bundle/anthropic-N5NOX7K7.js +90 -0
- package/dist/bundle/app-server-2MST5EZ5.js +245 -0
- package/dist/bundle/bun-4NHWOFX2.js +169 -0
- package/dist/bundle/bun-sqlite-DRSXPWPR.js +75 -0
- package/dist/bundle/chunk-2I5UVMLW.js +3232 -0
- package/dist/bundle/chunk-3IRJDH2U.js +731 -0
- package/dist/bundle/chunk-4ZAK773N.js +100 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5D4Z2B5B.js +334 -0
- package/dist/bundle/chunk-5E5R65CA.js +54 -0
- package/dist/bundle/chunk-5HGGG3QO.js +73 -0
- package/dist/bundle/chunk-5RLUHTK6.js +23 -0
- package/dist/bundle/chunk-5SBLU7D7.js +63 -0
- package/dist/bundle/chunk-5Z5PEEKP.js +206 -0
- package/dist/bundle/chunk-63F65DHU.js +29 -0
- package/dist/bundle/chunk-6RS7OYTD.js +64 -0
- package/dist/bundle/chunk-73CXFE36.js +88 -0
- package/dist/bundle/chunk-7GTUZY7M.js +170 -0
- package/dist/bundle/chunk-7PKFYX7V.js +189 -0
- package/dist/bundle/chunk-7U5HJEPZ.js +1400 -0
- package/dist/bundle/chunk-A33TIM5D.js +4172 -0
- package/dist/bundle/chunk-ADEWU4P4.js +38 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AHJ4W2IL.js +106 -0
- package/dist/bundle/chunk-AUBB72VF.js +2572 -0
- package/dist/bundle/chunk-BVMNXI53.js +1266 -0
- package/dist/bundle/chunk-CDY2NJFE.js +136 -0
- package/dist/bundle/chunk-CHUKWON6.js +244 -0
- package/dist/bundle/chunk-CUZRHF34.js +230 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DAY6TSPF.js +786 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DJD7TBYG.js +2791 -0
- package/dist/bundle/chunk-DOSJONCX.js +1197 -0
- package/dist/bundle/chunk-DQV2IKCF.js +72 -0
- package/dist/bundle/chunk-DTA5YV5O.js +25 -0
- package/dist/bundle/chunk-DXGGCGRP.js +218 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-EPOV5UIO.js +185 -0
- package/dist/bundle/chunk-EQ7A6NA6.js +53 -0
- package/dist/bundle/chunk-EQUKVVHX.js +353 -0
- package/dist/bundle/chunk-EROSAUNP.js +133 -0
- package/dist/bundle/chunk-ESZSMZKT.js +82 -0
- package/dist/bundle/chunk-FKR3M62D.js +407 -0
- package/dist/bundle/chunk-GNTJMB6X.js +142 -0
- package/dist/bundle/chunk-GQ7VFIYM.js +316 -0
- package/dist/bundle/chunk-JH3UOHRE.js +161 -0
- package/dist/bundle/chunk-JMDLPBXK.js +1068 -0
- package/dist/bundle/chunk-JR6TSMFX.js +9435 -0
- package/dist/bundle/chunk-K5UU3IOR.js +27955 -0
- package/dist/bundle/chunk-L6AFE73L.js +18 -0
- package/dist/bundle/chunk-LDEBZ3IX.js +238 -0
- package/dist/bundle/chunk-LGQXGOPJ.js +58 -0
- package/dist/bundle/chunk-LJQUYECN.js +6848 -0
- package/dist/bundle/chunk-LRBPT7LQ.js +95 -0
- package/dist/bundle/chunk-LSND5QYI.js +460 -0
- package/dist/bundle/chunk-NHXJYS4R.js +1334 -0
- package/dist/bundle/chunk-NJYAL3UW.js +92 -0
- package/dist/bundle/chunk-NTLSWCJ5.js +1718 -0
- package/dist/bundle/chunk-O2UCU52O.js +4065 -0
- package/dist/bundle/chunk-ODNQU7DH.js +1028 -0
- package/dist/bundle/chunk-P3WQRTYZ.js +24 -0
- package/dist/bundle/chunk-P5LYZRKW.js +63373 -0
- package/dist/bundle/chunk-PFO76YFP.js +2003 -0
- package/dist/bundle/chunk-PM77PRB6.js +12269 -0
- package/dist/bundle/chunk-Q2VNBY4Y.js +38109 -0
- package/dist/bundle/chunk-QDMXZZG4.js +604 -0
- package/dist/bundle/chunk-QRQYUHCZ.js +761 -0
- package/dist/bundle/chunk-RPWAJYI6.js +2336 -0
- package/dist/bundle/chunk-SMSTGO2G.js +58 -0
- package/dist/bundle/chunk-SZ2V62HB.js +72 -0
- package/dist/bundle/chunk-T2UDLX76.js +259 -0
- package/dist/bundle/chunk-TGEQNS6G.js +16 -0
- package/dist/bundle/chunk-TNUFLULO.js +2333 -0
- package/dist/bundle/chunk-U7RLVJ34.js +274 -0
- package/dist/bundle/chunk-UBRREVLJ.js +72 -0
- package/dist/bundle/chunk-ULXQ5MJM.js +76 -0
- package/dist/bundle/chunk-UMVRT7VQ.js +46 -0
- package/dist/bundle/chunk-V77XNPXG.js +360 -0
- package/dist/bundle/chunk-VVHRQ46X.js +193 -0
- package/dist/bundle/chunk-VX37MPTJ.js +7 -0
- package/dist/bundle/chunk-WCYCUTSK.js +362 -0
- package/dist/bundle/chunk-XEFAMLSD.js +288 -0
- package/dist/bundle/chunk-XQL7FEF4.js +721 -0
- package/dist/bundle/chunk-XRTD2GCU.js +627 -0
- package/dist/bundle/chunk-Y37A3232.js +804 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-ZM7I52EP.js +78 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/cli-KEGIR67U.js +1193 -0
- package/dist/bundle/command-contract-QBUQBXH7.js +39 -0
- package/dist/bundle/command-server-entry-5VL5U5EE.js +168 -0
- package/dist/bundle/decode-SQ5WGNDX.js +296 -0
- package/dist/bundle/dispatch-LA4DFXJD.js +411 -0
- package/dist/bundle/dist-XJGFOXYI.js +7577 -0
- package/dist/bundle/echarts-25Z3RINX.js +42501 -0
- package/dist/bundle/embed-BNOTNXMA.js +37 -0
- package/dist/bundle/embedder-BCUT7KKV.js +110 -0
- package/dist/bundle/failure-PKAC6XCT.js +24 -0
- package/dist/bundle/first-run-EO5K5GME.js +28 -0
- package/dist/bundle/first-screen-GMN3T6RW.js +39 -0
- package/dist/bundle/instructions-VLM3QAYB.js +11 -0
- package/dist/bundle/mcp-7ILNMJH5.js +167 -0
- package/dist/bundle/meeting-combined-LAMF7S2B.js +24 -0
- package/dist/bundle/meeting-model-GHMMUQ34.js +24 -0
- package/dist/bundle/meeting-semantic-BMP6323L.js +21 -0
- package/dist/bundle/node-CT3N3TNL.js +176 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-MELD2SBX.js +73 -0
- package/dist/bundle/oauth-YBH5OKC2.js +19 -0
- package/dist/bundle/open-WNSBWTAG.js +22 -0
- package/dist/bundle/openai-XSNMNLW6.js +237 -0
- package/dist/bundle/process-I2QKOMM7.js +91 -0
- package/dist/bundle/program-VQQTSSAF.js +4940 -0
- package/dist/bundle/prompt-SOG4AKPM.js +16 -0
- package/dist/bundle/recognize-WMQLWMXH.js +25 -0
- package/dist/bundle/remote-4BTFOLFY.js +30 -0
- package/dist/bundle/rerank-LJ3TWRNV.js +51 -0
- package/dist/bundle/serve-B6UANKXN.js +198 -0
- package/dist/bundle/server-S6XD6V6E.js +77 -0
- package/dist/bundle/server-YRH6GJ5Z.js +206 -0
- package/dist/bundle/source-DGFTA2TN.js +42 -0
- package/dist/bundle/sqlite-runtime-R7QFWFE7.js +19 -0
- package/dist/bundle/state-DIJ5YUOE.js +35 -0
- package/dist/bundle/store-6WFWW7EC.js +294 -0
- package/dist/bundle/store-BPNIM4BF.js +32 -0
- package/dist/bundle/store-MYTYDV6A.js +177 -0
- package/dist/bundle/store-maintenance-command-B5TMKFMG.js +68 -0
- package/dist/bundle/writer-GP7VIMAU.js +44 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +86 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +3 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +224 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm-shared.d.ts +8 -0
- package/dist/commands/crm-shared.d.ts.map +1 -0
- package/dist/commands/crm-shared.js +111 -0
- package/dist/commands/crm-shared.js.map +1 -0
- package/dist/commands/schedule.d.ts +3 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +9 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/session.d.ts +18 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +265 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/write.d.ts +14 -0
- package/dist/commands/write.d.ts.map +1 -0
- package/dist/commands/write.js +36 -0
- package/dist/commands/write.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +62 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +97 -0
- package/dist/context.js.map +1 -0
- package/dist/crm/activities.d.ts +32 -0
- package/dist/crm/activities.d.ts.map +1 -0
- package/dist/crm/activities.js +196 -0
- package/dist/crm/activities.js.map +1 -0
- package/dist/crm/records.d.ts +20 -0
- package/dist/crm/records.d.ts.map +1 -0
- package/dist/crm/records.js +175 -0
- package/dist/crm/records.js.map +1 -0
- package/dist/crm/source.d.ts +41 -0
- package/dist/crm/source.d.ts.map +1 -0
- package/dist/crm/source.js +673 -0
- package/dist/crm/source.js.map +1 -0
- package/dist/crm/writer.d.ts +14 -0
- package/dist/crm/writer.d.ts.map +1 -0
- package/dist/crm/writer.js +247 -0
- package/dist/crm/writer.js.map +1 -0
- package/dist/identity.d.ts +7 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +33 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +91 -0
- package/dist/program.js.map +1 -0
- package/dist/reasons.d.ts +10 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +35 -0
- package/dist/reasons.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/setup/flow.d.ts +2 -0
- package/dist/setup/flow.d.ts.map +1 -0
- package/dist/setup/flow.js +127 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/texts.en.json +25 -0
- package/dist/setup/texts.es.json +25 -0
- package/dist/setup/texts.ru.json +25 -0
- package/dist/store.d.ts +15 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +16 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/dist/whoami.d.ts +24 -0
- package/dist/whoami.d.ts.map +1 -0
- package/dist/whoami.js +33 -0
- package/dist/whoami.js.map +1 -0
- package/package.json +85 -4
- package/skills/amo-cli/SKILL.md +116 -0
- package/skills/amo-cli/references/mcp.md +38 -0
- package/skills/amo-cli/references/output.md +42 -0
- package/skills/amo-cli/references/reading.md +77 -0
- package/skills/amo-cli/references/setup.md +59 -0
- package/skills/amo-cli/references/writing.md +85 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
pasteHint,
|
|
5
|
+
readSecret
|
|
6
|
+
} from "./chunk-4ZAK773N.js";
|
|
7
|
+
import "./chunk-ESZSMZKT.js";
|
|
8
|
+
import "./chunk-DJD7TBYG.js";
|
|
9
|
+
import "./chunk-AUBB72VF.js";
|
|
10
|
+
import "./chunk-Y5E2WNWB.js";
|
|
11
|
+
import "./chunk-SZ2V62HB.js";
|
|
12
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
export {
|
|
14
|
+
pasteHint,
|
|
15
|
+
readSecret
|
|
16
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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-CUZRHF34.js";
|
|
12
|
+
import "./chunk-DJD7TBYG.js";
|
|
13
|
+
import "./chunk-AUBB72VF.js";
|
|
14
|
+
import "./chunk-Y5E2WNWB.js";
|
|
15
|
+
import "./chunk-SZ2V62HB.js";
|
|
16
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
17
|
+
export {
|
|
18
|
+
SAMPLE_RATE,
|
|
19
|
+
decodeOgg,
|
|
20
|
+
detector,
|
|
21
|
+
loadSherpa,
|
|
22
|
+
openRecognizer,
|
|
23
|
+
openSpeechCutter,
|
|
24
|
+
toModelRate
|
|
25
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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-EPOV5UIO.js";
|
|
12
|
+
import "./chunk-GQ7VFIYM.js";
|
|
13
|
+
import "./chunk-DOSJONCX.js";
|
|
14
|
+
import "./chunk-ODNQU7DH.js";
|
|
15
|
+
import "./chunk-U7RLVJ34.js";
|
|
16
|
+
import "./chunk-5E5R65CA.js";
|
|
17
|
+
import "./chunk-DJD7TBYG.js";
|
|
18
|
+
import "./chunk-AUBB72VF.js";
|
|
19
|
+
import "./chunk-Y5E2WNWB.js";
|
|
20
|
+
import "./chunk-SZ2V62HB.js";
|
|
21
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_OPENAI_MODEL,
|
|
24
|
+
OPENAI_MODELS,
|
|
25
|
+
OPENAI_URL,
|
|
26
|
+
isLocal,
|
|
27
|
+
openRemote,
|
|
28
|
+
remoteKey,
|
|
29
|
+
remoteModel
|
|
30
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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-ODNQU7DH.js";
|
|
8
|
+
import "./chunk-U7RLVJ34.js";
|
|
9
|
+
import "./chunk-5E5R65CA.js";
|
|
10
|
+
import "./chunk-DJD7TBYG.js";
|
|
11
|
+
import "./chunk-AUBB72VF.js";
|
|
12
|
+
import "./chunk-Y5E2WNWB.js";
|
|
13
|
+
import "./chunk-SZ2V62HB.js";
|
|
14
|
+
import {
|
|
15
|
+
__name
|
|
16
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
17
|
+
|
|
18
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/embeddings/rerank.js
|
|
19
|
+
var openReranker = /* @__PURE__ */ __name(async (model, directory, { threads = defaultThreads() } = {}) => {
|
|
20
|
+
const { ort, tokenizer, session } = await loadModel(model, directory, threads);
|
|
21
|
+
const typeIds = session.inputNames.includes("token_type_ids");
|
|
22
|
+
const output = session.outputNames[0];
|
|
23
|
+
const one = /* @__PURE__ */ __name(async (question, passage) => {
|
|
24
|
+
const encoded = tokenizer.encode(question, { text_pair: passage, return_token_type_ids: true });
|
|
25
|
+
const ids = truncated(encoded.ids, model.maxTokens);
|
|
26
|
+
const shape = [1, ids.length];
|
|
27
|
+
const feeds = {
|
|
28
|
+
input_ids: new ort.Tensor("int64", BigInt64Array.from(ids, BigInt), shape),
|
|
29
|
+
attention_mask: new ort.Tensor("int64", new BigInt64Array(ids.length).fill(1n), shape)
|
|
30
|
+
};
|
|
31
|
+
if (typeIds)
|
|
32
|
+
feeds.token_type_ids = new ort.Tensor("int64", BigInt64Array.from(truncated(encoded.token_type_ids, model.maxTokens), BigInt), shape);
|
|
33
|
+
const logit = (await session.run(feeds))[output]?.data[0];
|
|
34
|
+
if (typeof logit !== "number" || !Number.isFinite(logit))
|
|
35
|
+
throw new Error(`${model.id} gave no score`);
|
|
36
|
+
return logit;
|
|
37
|
+
}, "one");
|
|
38
|
+
return {
|
|
39
|
+
model,
|
|
40
|
+
score: /* @__PURE__ */ __name(async (question, passages) => {
|
|
41
|
+
const scores = [];
|
|
42
|
+
for (const passage of passages)
|
|
43
|
+
scores.push(await one(question, passage));
|
|
44
|
+
return scores;
|
|
45
|
+
}, "score"),
|
|
46
|
+
close: /* @__PURE__ */ __name(() => session.release(), "close")
|
|
47
|
+
};
|
|
48
|
+
}, "openReranker");
|
|
49
|
+
export {
|
|
50
|
+
openReranker
|
|
51
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
listen
|
|
5
|
+
} from "./chunk-ZM7I52EP.js";
|
|
6
|
+
import {
|
|
7
|
+
ownerLogin
|
|
8
|
+
} from "./chunk-XEFAMLSD.js";
|
|
9
|
+
import {
|
|
10
|
+
WebStandardStreamableHTTPServerTransport,
|
|
11
|
+
createMcpHandler,
|
|
12
|
+
getOAuthProtectedResourceMetadataUrl,
|
|
13
|
+
hostHeaderValidationResponse,
|
|
14
|
+
isLegacyRequest,
|
|
15
|
+
oauthMetadataResponse,
|
|
16
|
+
requireBearerAuth
|
|
17
|
+
} from "./chunk-5D4AEUVA.js";
|
|
18
|
+
import {
|
|
19
|
+
activityRecorder,
|
|
20
|
+
calledTools,
|
|
21
|
+
httpActivityFile,
|
|
22
|
+
httpLock
|
|
23
|
+
} from "./chunk-JH3UOHRE.js";
|
|
24
|
+
import "./chunk-5HGGG3QO.js";
|
|
25
|
+
import "./chunk-5SBLU7D7.js";
|
|
26
|
+
import "./chunk-DJD7TBYG.js";
|
|
27
|
+
import "./chunk-AUBB72VF.js";
|
|
28
|
+
import "./chunk-Y5E2WNWB.js";
|
|
29
|
+
import {
|
|
30
|
+
CliError
|
|
31
|
+
} from "./chunk-SZ2V62HB.js";
|
|
32
|
+
import {
|
|
33
|
+
__name
|
|
34
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
35
|
+
|
|
36
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/http/serve.js
|
|
37
|
+
import { randomUUID } from "node:crypto";
|
|
38
|
+
var MCP_PATH = "/mcp";
|
|
39
|
+
var AS_METADATA = "/.well-known/oauth-authorization-server";
|
|
40
|
+
var LOCAL = ["localhost", "127.0.0.1"];
|
|
41
|
+
var MAX_SESSIONS = 20;
|
|
42
|
+
var MAX_LOGIN_BODY = 64 * 1024;
|
|
43
|
+
var SESSION_IDLE_MS = 60 * 60 * 1e3;
|
|
44
|
+
var sessionMissing = /* @__PURE__ */ __name(() => new Response(JSON.stringify({ jsonrpc: "2.0", error: { code: -32001, message: "Session not found" }, id: null }), {
|
|
45
|
+
status: 404,
|
|
46
|
+
headers: { "content-type": "application/json" }
|
|
47
|
+
}), "sessionMissing");
|
|
48
|
+
var legacySessions = /* @__PURE__ */ __name((build, now) => {
|
|
49
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
50
|
+
const drop = /* @__PURE__ */ __name(async (id) => {
|
|
51
|
+
const one = sessions.get(id);
|
|
52
|
+
sessions.delete(id);
|
|
53
|
+
await one?.close();
|
|
54
|
+
}, "drop");
|
|
55
|
+
const handle = /* @__PURE__ */ __name(async (request, auth) => {
|
|
56
|
+
for (const [id2, one] of sessions)
|
|
57
|
+
if (now() - one.seen > SESSION_IDLE_MS)
|
|
58
|
+
await drop(id2);
|
|
59
|
+
const id = request.headers.get("mcp-session-id");
|
|
60
|
+
if (id) {
|
|
61
|
+
const known = sessions.get(id);
|
|
62
|
+
if (!known || known.clientId !== auth.clientId)
|
|
63
|
+
return sessionMissing();
|
|
64
|
+
known.seen = now();
|
|
65
|
+
return known.transport.handleRequest(request, { authInfo: auth });
|
|
66
|
+
}
|
|
67
|
+
const server = build();
|
|
68
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
69
|
+
sessionIdGenerator: /* @__PURE__ */ __name(() => randomUUID(), "sessionIdGenerator"),
|
|
70
|
+
onsessionclosed: /* @__PURE__ */ __name((closed) => void sessions.delete(closed), "onsessionclosed")
|
|
71
|
+
});
|
|
72
|
+
await server.connect(transport);
|
|
73
|
+
const response = await transport.handleRequest(request, { authInfo: auth });
|
|
74
|
+
if (!transport.sessionId) {
|
|
75
|
+
await server.close();
|
|
76
|
+
return response;
|
|
77
|
+
}
|
|
78
|
+
sessions.set(transport.sessionId, { transport, close: /* @__PURE__ */ __name(() => server.close(), "close"), clientId: auth.clientId, seen: now() });
|
|
79
|
+
while (sessions.size > MAX_SESSIONS)
|
|
80
|
+
await drop(sessions.keys().next().value);
|
|
81
|
+
return response;
|
|
82
|
+
}, "handle");
|
|
83
|
+
return {
|
|
84
|
+
handle,
|
|
85
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
86
|
+
for (const id of [...sessions.keys()])
|
|
87
|
+
await drop(id);
|
|
88
|
+
}, "close")
|
|
89
|
+
};
|
|
90
|
+
}, "legacySessions");
|
|
91
|
+
var metadataRequest = /* @__PURE__ */ __name((request, path, base) => {
|
|
92
|
+
const url = new URL(request.url);
|
|
93
|
+
const inserted = base && path === `${AS_METADATA}${base}`;
|
|
94
|
+
if (!inserted && url.pathname === path)
|
|
95
|
+
return request;
|
|
96
|
+
url.pathname = inserted ? AS_METADATA : path;
|
|
97
|
+
return new Request(url, { method: request.method, headers: request.headers });
|
|
98
|
+
}, "metadataRequest");
|
|
99
|
+
var toolsIn = /* @__PURE__ */ __name(async (request) => {
|
|
100
|
+
if (request.method !== "POST")
|
|
101
|
+
return [];
|
|
102
|
+
try {
|
|
103
|
+
return calledTools(await request.clone().json());
|
|
104
|
+
} catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
}, "toolsIn");
|
|
108
|
+
var serveOverHttp = /* @__PURE__ */ __name(async (build, options) => {
|
|
109
|
+
const { publicUrl, port, tokenFile, appName, reaches, onCode, onError, now, lockFile, version } = options;
|
|
110
|
+
const lock = lockFile ? httpLock(lockFile, {
|
|
111
|
+
pid: process.pid,
|
|
112
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
113
|
+
port,
|
|
114
|
+
publicUrl: publicUrl.href,
|
|
115
|
+
...version ? { version } : {}
|
|
116
|
+
}) : void 0;
|
|
117
|
+
if (lock?.held)
|
|
118
|
+
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})`);
|
|
119
|
+
const base = publicUrl.pathname === "/" ? "" : publicUrl.pathname.replace(/\/+$/, "");
|
|
120
|
+
const issuer = new URL(`${publicUrl.origin}${base}`);
|
|
121
|
+
const resource = new URL(`${base}${MCP_PATH}`, publicUrl.origin);
|
|
122
|
+
const mcpPath = resource.pathname;
|
|
123
|
+
const publicPath = /* @__PURE__ */ __name((path) => base && path !== base && !path.startsWith(`${base}/`) && !path.startsWith("/.well-known/") ? `${base}${path}` : path, "publicPath");
|
|
124
|
+
const login = ownerLogin({
|
|
125
|
+
issuer,
|
|
126
|
+
resource,
|
|
127
|
+
file: tokenFile,
|
|
128
|
+
appName,
|
|
129
|
+
...reaches ? { reaches } : {},
|
|
130
|
+
onCode: /* @__PURE__ */ __name((code, expires) => {
|
|
131
|
+
lock?.update({ loginCode: code, loginCodeExpiresAt: expires.toISOString() });
|
|
132
|
+
onCode(code, expires);
|
|
133
|
+
}, "onCode"),
|
|
134
|
+
...now ? { now } : {}
|
|
135
|
+
});
|
|
136
|
+
const insecure = issuer.protocol === "http:" && LOCAL.includes(issuer.hostname);
|
|
137
|
+
const mcp = createMcpHandler(build, { legacy: "reject", ...onError ? { onerror: onError } : {} });
|
|
138
|
+
const legacy = legacySessions(build, now ?? Date.now);
|
|
139
|
+
const bearer = requireBearerAuth({
|
|
140
|
+
verifier: login.verifier,
|
|
141
|
+
resourceMetadataUrl: getOAuthProtectedResourceMetadataUrl(resource)
|
|
142
|
+
});
|
|
143
|
+
const activity = activityRecorder(httpActivityFile(tokenFile), now);
|
|
144
|
+
const allowedHosts = [.../* @__PURE__ */ new Set([publicUrl.hostname, ...LOCAL])];
|
|
145
|
+
const allowedOrigins = [publicUrl.origin];
|
|
146
|
+
const listening = await listen(async (request) => {
|
|
147
|
+
const refused = hostHeaderValidationResponse(request, allowedHosts);
|
|
148
|
+
if (refused)
|
|
149
|
+
return refused;
|
|
150
|
+
const path = publicPath(new URL(request.url).pathname);
|
|
151
|
+
const discovery = oauthMetadataResponse(metadataRequest(request, path, base), {
|
|
152
|
+
oauthMetadata: login.metadata,
|
|
153
|
+
resourceServerUrl: resource,
|
|
154
|
+
resourceName: appName,
|
|
155
|
+
...insecure ? { dangerouslyAllowInsecureIssuerUrl: true } : {}
|
|
156
|
+
});
|
|
157
|
+
if (discovery)
|
|
158
|
+
return discovery;
|
|
159
|
+
if (Number(request.headers.get("content-length") ?? 0) > MAX_LOGIN_BODY && path !== mcpPath)
|
|
160
|
+
return new Response("Request too large", { status: 413 });
|
|
161
|
+
const origin = request.headers.get("origin");
|
|
162
|
+
if (origin && !allowedOrigins.includes(origin))
|
|
163
|
+
return new Response("Origin not allowed", { status: 403 });
|
|
164
|
+
const answered = await login.handle(request, path);
|
|
165
|
+
if (answered)
|
|
166
|
+
return answered;
|
|
167
|
+
if (path !== mcpPath)
|
|
168
|
+
return new Response("Not found", { status: 404 });
|
|
169
|
+
const auth = await bearer(request);
|
|
170
|
+
if (auth instanceof Response)
|
|
171
|
+
return auth;
|
|
172
|
+
activity.record(auth.clientId, await toolsIn(request));
|
|
173
|
+
return await isLegacyRequest(request) ? legacy.handle(request, auth) : mcp.fetch(request, { authInfo: auth });
|
|
174
|
+
}, { host: "127.0.0.1", port }).catch((error) => {
|
|
175
|
+
login.close();
|
|
176
|
+
lock?.release();
|
|
177
|
+
throw error;
|
|
178
|
+
});
|
|
179
|
+
lock?.update({ listeningAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
180
|
+
return {
|
|
181
|
+
url: listening.url,
|
|
182
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
183
|
+
login.close();
|
|
184
|
+
activity.flush();
|
|
185
|
+
try {
|
|
186
|
+
await listening.close();
|
|
187
|
+
await legacy.close();
|
|
188
|
+
await mcp.close();
|
|
189
|
+
} finally {
|
|
190
|
+
lock?.release();
|
|
191
|
+
}
|
|
192
|
+
}, "close")
|
|
193
|
+
};
|
|
194
|
+
}, "serveOverHttp");
|
|
195
|
+
export {
|
|
196
|
+
MCP_PATH,
|
|
197
|
+
serveOverHttp
|
|
198
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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-DAY6TSPF.js";
|
|
10
|
+
import "./chunk-NHXJYS4R.js";
|
|
11
|
+
import "./chunk-L6AFE73L.js";
|
|
12
|
+
import "./chunk-O2UCU52O.js";
|
|
13
|
+
import "./chunk-XRTD2GCU.js";
|
|
14
|
+
import "./chunk-3IRJDH2U.js";
|
|
15
|
+
import "./chunk-7U5HJEPZ.js";
|
|
16
|
+
import "./chunk-Q2VNBY4Y.js";
|
|
17
|
+
import "./chunk-FKR3M62D.js";
|
|
18
|
+
import "./chunk-2I5UVMLW.js";
|
|
19
|
+
import "./chunk-73CXFE36.js";
|
|
20
|
+
import "./chunk-GNTJMB6X.js";
|
|
21
|
+
import "./chunk-UMVRT7VQ.js";
|
|
22
|
+
import "./chunk-EQ7A6NA6.js";
|
|
23
|
+
import "./chunk-5D4AEUVA.js";
|
|
24
|
+
import "./chunk-ULXQ5MJM.js";
|
|
25
|
+
import "./chunk-T2UDLX76.js";
|
|
26
|
+
import "./chunk-V77XNPXG.js";
|
|
27
|
+
import "./chunk-7GTUZY7M.js";
|
|
28
|
+
import "./chunk-JH3UOHRE.js";
|
|
29
|
+
import "./chunk-5HGGG3QO.js";
|
|
30
|
+
import "./chunk-EROSAUNP.js";
|
|
31
|
+
import "./chunk-PM77PRB6.js";
|
|
32
|
+
import "./chunk-WCYCUTSK.js";
|
|
33
|
+
import "./chunk-SMSTGO2G.js";
|
|
34
|
+
import "./chunk-5D4Z2B5B.js";
|
|
35
|
+
import "./chunk-5SBLU7D7.js";
|
|
36
|
+
import "./chunk-JMDLPBXK.js";
|
|
37
|
+
import "./chunk-6RS7OYTD.js";
|
|
38
|
+
import "./chunk-P5LYZRKW.js";
|
|
39
|
+
import "./chunk-TNUFLULO.js";
|
|
40
|
+
import "./chunk-XQL7FEF4.js";
|
|
41
|
+
import "./chunk-BVMNXI53.js";
|
|
42
|
+
import "./chunk-UBRREVLJ.js";
|
|
43
|
+
import "./chunk-EPOV5UIO.js";
|
|
44
|
+
import "./chunk-GQ7VFIYM.js";
|
|
45
|
+
import "./chunk-DOSJONCX.js";
|
|
46
|
+
import "./chunk-ODNQU7DH.js";
|
|
47
|
+
import "./chunk-U7RLVJ34.js";
|
|
48
|
+
import "./chunk-Y37A3232.js";
|
|
49
|
+
import "./chunk-LSND5QYI.js";
|
|
50
|
+
import "./chunk-5RLUHTK6.js";
|
|
51
|
+
import "./chunk-QDMXZZG4.js";
|
|
52
|
+
import "./chunk-PFO76YFP.js";
|
|
53
|
+
import "./chunk-DQV2IKCF.js";
|
|
54
|
+
import "./chunk-TGEQNS6G.js";
|
|
55
|
+
import "./chunk-QRQYUHCZ.js";
|
|
56
|
+
import "./chunk-NJYAL3UW.js";
|
|
57
|
+
import "./chunk-63F65DHU.js";
|
|
58
|
+
import "./chunk-A33TIM5D.js";
|
|
59
|
+
import "./chunk-VX37MPTJ.js";
|
|
60
|
+
import "./chunk-D72URWJE.js";
|
|
61
|
+
import "./chunk-ESZSMZKT.js";
|
|
62
|
+
import "./chunk-5E5R65CA.js";
|
|
63
|
+
import "./chunk-LRBPT7LQ.js";
|
|
64
|
+
import "./chunk-ADEWU4P4.js";
|
|
65
|
+
import "./chunk-DJD7TBYG.js";
|
|
66
|
+
import "./chunk-AUBB72VF.js";
|
|
67
|
+
import "./chunk-Y5E2WNWB.js";
|
|
68
|
+
import "./chunk-SZ2V62HB.js";
|
|
69
|
+
import "./chunk-LJQUYECN.js";
|
|
70
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
71
|
+
export {
|
|
72
|
+
PER_RUN,
|
|
73
|
+
createServer,
|
|
74
|
+
envelope,
|
|
75
|
+
serveOverHttpUntilStopped,
|
|
76
|
+
serveOverStdio
|
|
77
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
botInstructions
|
|
5
|
+
} from "./chunk-P3WQRTYZ.js";
|
|
6
|
+
import {
|
|
7
|
+
answered,
|
|
8
|
+
normal,
|
|
9
|
+
registerCommands,
|
|
10
|
+
runCommandForAgent,
|
|
11
|
+
toolsFromCommands
|
|
12
|
+
} from "./chunk-O2UCU52O.js";
|
|
13
|
+
import {
|
|
14
|
+
agentJson,
|
|
15
|
+
skillResources
|
|
16
|
+
} from "./chunk-XRTD2GCU.js";
|
|
17
|
+
import {
|
|
18
|
+
StdioServerTransport,
|
|
19
|
+
answeredWire,
|
|
20
|
+
callerOf,
|
|
21
|
+
serveStdio
|
|
22
|
+
} from "./chunk-3IRJDH2U.js";
|
|
23
|
+
import {
|
|
24
|
+
wholeList
|
|
25
|
+
} from "./chunk-Q2VNBY4Y.js";
|
|
26
|
+
import "./chunk-FKR3M62D.js";
|
|
27
|
+
import "./chunk-2I5UVMLW.js";
|
|
28
|
+
import "./chunk-73CXFE36.js";
|
|
29
|
+
import "./chunk-GNTJMB6X.js";
|
|
30
|
+
import "./chunk-UMVRT7VQ.js";
|
|
31
|
+
import {
|
|
32
|
+
McpServer
|
|
33
|
+
} from "./chunk-5D4AEUVA.js";
|
|
34
|
+
import "./chunk-ULXQ5MJM.js";
|
|
35
|
+
import "./chunk-T2UDLX76.js";
|
|
36
|
+
import "./chunk-V77XNPXG.js";
|
|
37
|
+
import "./chunk-7GTUZY7M.js";
|
|
38
|
+
import {
|
|
39
|
+
MESSENGER_CHANGE_REFUSAL,
|
|
40
|
+
changesMessenger,
|
|
41
|
+
flatten,
|
|
42
|
+
itemOf,
|
|
43
|
+
readOnlyLockOf,
|
|
44
|
+
readOnlyRefusal
|
|
45
|
+
} from "./chunk-PM77PRB6.js";
|
|
46
|
+
import "./chunk-WCYCUTSK.js";
|
|
47
|
+
import "./chunk-SMSTGO2G.js";
|
|
48
|
+
import "./chunk-5D4Z2B5B.js";
|
|
49
|
+
import "./chunk-5SBLU7D7.js";
|
|
50
|
+
import "./chunk-JMDLPBXK.js";
|
|
51
|
+
import "./chunk-6RS7OYTD.js";
|
|
52
|
+
import "./chunk-P5LYZRKW.js";
|
|
53
|
+
import "./chunk-TNUFLULO.js";
|
|
54
|
+
import "./chunk-XQL7FEF4.js";
|
|
55
|
+
import "./chunk-BVMNXI53.js";
|
|
56
|
+
import "./chunk-UBRREVLJ.js";
|
|
57
|
+
import "./chunk-EPOV5UIO.js";
|
|
58
|
+
import "./chunk-GQ7VFIYM.js";
|
|
59
|
+
import "./chunk-DOSJONCX.js";
|
|
60
|
+
import "./chunk-ODNQU7DH.js";
|
|
61
|
+
import "./chunk-U7RLVJ34.js";
|
|
62
|
+
import "./chunk-Y37A3232.js";
|
|
63
|
+
import "./chunk-LSND5QYI.js";
|
|
64
|
+
import "./chunk-5RLUHTK6.js";
|
|
65
|
+
import "./chunk-QDMXZZG4.js";
|
|
66
|
+
import "./chunk-PFO76YFP.js";
|
|
67
|
+
import "./chunk-DQV2IKCF.js";
|
|
68
|
+
import "./chunk-TGEQNS6G.js";
|
|
69
|
+
import "./chunk-QRQYUHCZ.js";
|
|
70
|
+
import "./chunk-NJYAL3UW.js";
|
|
71
|
+
import "./chunk-63F65DHU.js";
|
|
72
|
+
import "./chunk-A33TIM5D.js";
|
|
73
|
+
import "./chunk-VX37MPTJ.js";
|
|
74
|
+
import "./chunk-D72URWJE.js";
|
|
75
|
+
import "./chunk-ESZSMZKT.js";
|
|
76
|
+
import "./chunk-5E5R65CA.js";
|
|
77
|
+
import "./chunk-LRBPT7LQ.js";
|
|
78
|
+
import "./chunk-ADEWU4P4.js";
|
|
79
|
+
import "./chunk-DJD7TBYG.js";
|
|
80
|
+
import {
|
|
81
|
+
mcpErrorResult,
|
|
82
|
+
object
|
|
83
|
+
} from "./chunk-AUBB72VF.js";
|
|
84
|
+
import "./chunk-Y5E2WNWB.js";
|
|
85
|
+
import "./chunk-SZ2V62HB.js";
|
|
86
|
+
import "./chunk-LJQUYECN.js";
|
|
87
|
+
import {
|
|
88
|
+
__name
|
|
89
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
90
|
+
|
|
91
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mcp/bot/server.js
|
|
92
|
+
import { randomUUID } from "node:crypto";
|
|
93
|
+
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");
|
|
94
|
+
var createBotServer = /* @__PURE__ */ __name((options) => {
|
|
95
|
+
const { bot, program, settings, env } = options;
|
|
96
|
+
const command = bot.app.command;
|
|
97
|
+
const levels = options.levels ?? (() => settings.permissions);
|
|
98
|
+
const authority = /* @__PURE__ */ __name((path) => options.authority?.(path) === true || path[0] === "config" && (path[1] === "set" || path[1] === "unset"), "authority");
|
|
99
|
+
const catalogue = {
|
|
100
|
+
includeUnavailable: true,
|
|
101
|
+
levels: settings.permissions,
|
|
102
|
+
currentLevels: levels,
|
|
103
|
+
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
104
|
+
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
105
|
+
authority,
|
|
106
|
+
...options.fetchOnly ? { fetchOnly: options.fetchOnly } : {},
|
|
107
|
+
...options.fetches ? { fetches: options.fetches } : {},
|
|
108
|
+
offline: true,
|
|
109
|
+
// Another bot's copy is this bot's to read only where `read_other_bots` says so.
|
|
110
|
+
...settings.readOtherBots ? {} : { omit: ["all_bots", "bots"] }
|
|
111
|
+
};
|
|
112
|
+
const tools = [
|
|
113
|
+
...toolsFromCommands(program.commands, { ...catalogue, root: ["bot"] }),
|
|
114
|
+
...toolsFromCommands(program.commands.filter((one) => one.path[0] === "config"), {
|
|
115
|
+
...catalogue,
|
|
116
|
+
omit: ["bot", "personal", "defaults"]
|
|
117
|
+
})
|
|
118
|
+
];
|
|
119
|
+
const writes = tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command);
|
|
120
|
+
const skills = options.skill ? skillResources(bot.app, options.skill) : [];
|
|
121
|
+
const skill = skills[0];
|
|
122
|
+
let queue = Promise.resolve();
|
|
123
|
+
const invoke = /* @__PURE__ */ __name((path, input, caller) => {
|
|
124
|
+
const next = queue.then(() => runCommandForAgent(program, path, path[0] === "config" ? { ...input, bot: true } : input, {
|
|
125
|
+
profile: settings.profile,
|
|
126
|
+
readOnly: readOnlyLockOf(bot.app, env) !== void 0,
|
|
127
|
+
env,
|
|
128
|
+
levels,
|
|
129
|
+
...options.keyOf ? { keyOf: options.keyOf } : {},
|
|
130
|
+
authority,
|
|
131
|
+
...options.fetches ? { fetches: options.fetches } : {},
|
|
132
|
+
...caller ? { caller } : {}
|
|
133
|
+
}));
|
|
134
|
+
queue = next.catch(() => void 0);
|
|
135
|
+
return next;
|
|
136
|
+
}, "invoke");
|
|
137
|
+
const build = /* @__PURE__ */ __name(() => {
|
|
138
|
+
const callers = { env, client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"), connectionId: randomUUID() };
|
|
139
|
+
const server = new McpServer({ name: `${command}-bot-${settings.profile}`, version: bot.app.version }, {
|
|
140
|
+
instructions: botInstructions({
|
|
141
|
+
command,
|
|
142
|
+
name: bot.name ?? command,
|
|
143
|
+
profile: settings.profile,
|
|
144
|
+
writes,
|
|
145
|
+
...skill ? { skill: skill.instruction } : {}
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
for (const { uri, name, title, description, mimeType, read } of skills)
|
|
149
|
+
server.registerResource(name, uri, { title, description, mimeType }, read);
|
|
150
|
+
const commands = Object.fromEntries(tools.map((tool) => [
|
|
151
|
+
tool.command,
|
|
152
|
+
{
|
|
153
|
+
title: tool.title,
|
|
154
|
+
description: tool.description,
|
|
155
|
+
writes: tool.writes,
|
|
156
|
+
availability: tool.availability,
|
|
157
|
+
input: tool.input,
|
|
158
|
+
run: /* @__PURE__ */ __name(async (args, ctx) => {
|
|
159
|
+
const caller = callerOf(ctx, `${command}_${tool.command.replaceAll(" ", "_")}`, callers);
|
|
160
|
+
const answer = await invoke(tool.path, args, caller);
|
|
161
|
+
return "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : answered(body(tool.command, answer.result));
|
|
162
|
+
}, "run")
|
|
163
|
+
}
|
|
164
|
+
]));
|
|
165
|
+
commands.status = {
|
|
166
|
+
title: "This server's bot and profile",
|
|
167
|
+
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.",
|
|
168
|
+
writes: false,
|
|
169
|
+
input: object({}),
|
|
170
|
+
run: /* @__PURE__ */ __name(async () => {
|
|
171
|
+
const auth = await invoke(["bot", "auth", "show"], {});
|
|
172
|
+
const shown = "error" in auth ? auth.error : auth.result?.item ?? auth.result;
|
|
173
|
+
return answered(itemOf({
|
|
174
|
+
profile: settings.profile,
|
|
175
|
+
kind: "bot",
|
|
176
|
+
auth: shown,
|
|
177
|
+
writes: tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command),
|
|
178
|
+
permissions: levels()
|
|
179
|
+
}));
|
|
180
|
+
}, "run")
|
|
181
|
+
};
|
|
182
|
+
registerCommands(server, `${command}_bot`, commands, void 0, (asked) => {
|
|
183
|
+
const lock = readOnlyLockOf(bot.app, env);
|
|
184
|
+
const one = flatten(program.commands).find((info) => info.path[0] === "bot" && normal(info.path.slice(1).join(" ")) === asked);
|
|
185
|
+
if (lock && one && changesMessenger(one))
|
|
186
|
+
throw readOnlyRefusal(lock, MESSENGER_CHANGE_REFUSAL);
|
|
187
|
+
}, bot.app.messenger);
|
|
188
|
+
return server;
|
|
189
|
+
}, "build");
|
|
190
|
+
return { build, tools, offered: tools.map((tool) => tool.command) };
|
|
191
|
+
}, "createBotServer");
|
|
192
|
+
var serveBotOverStdio = /* @__PURE__ */ __name(async (options, note) => {
|
|
193
|
+
const { build } = createBotServer(options);
|
|
194
|
+
const wire = answeredWire(process.stdin, process.stdout);
|
|
195
|
+
const handle = serveStdio(build, {
|
|
196
|
+
transport: new StdioServerTransport(wire.input, wire.output),
|
|
197
|
+
onerror: /* @__PURE__ */ __name((error) => note(`mcp: ${error.message}`), "onerror")
|
|
198
|
+
});
|
|
199
|
+
await wire.finished();
|
|
200
|
+
wire.release();
|
|
201
|
+
await handle.close();
|
|
202
|
+
}, "serveBotOverStdio");
|
|
203
|
+
export {
|
|
204
|
+
createBotServer,
|
|
205
|
+
serveBotOverStdio
|
|
206
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
amoCrmSource
|
|
5
|
+
} from "./chunk-RPWAJYI6.js";
|
|
6
|
+
import "./chunk-LDEBZ3IX.js";
|
|
7
|
+
import "./chunk-2I5UVMLW.js";
|
|
8
|
+
import "./chunk-PM77PRB6.js";
|
|
9
|
+
import "./chunk-WCYCUTSK.js";
|
|
10
|
+
import "./chunk-SMSTGO2G.js";
|
|
11
|
+
import "./chunk-5D4Z2B5B.js";
|
|
12
|
+
import "./chunk-5SBLU7D7.js";
|
|
13
|
+
import "./chunk-6RS7OYTD.js";
|
|
14
|
+
import "./chunk-P5LYZRKW.js";
|
|
15
|
+
import "./chunk-TNUFLULO.js";
|
|
16
|
+
import "./chunk-XQL7FEF4.js";
|
|
17
|
+
import "./chunk-BVMNXI53.js";
|
|
18
|
+
import "./chunk-UBRREVLJ.js";
|
|
19
|
+
import "./chunk-GQ7VFIYM.js";
|
|
20
|
+
import "./chunk-DOSJONCX.js";
|
|
21
|
+
import "./chunk-U7RLVJ34.js";
|
|
22
|
+
import "./chunk-QDMXZZG4.js";
|
|
23
|
+
import "./chunk-PFO76YFP.js";
|
|
24
|
+
import "./chunk-DQV2IKCF.js";
|
|
25
|
+
import "./chunk-TGEQNS6G.js";
|
|
26
|
+
import "./chunk-QRQYUHCZ.js";
|
|
27
|
+
import "./chunk-NJYAL3UW.js";
|
|
28
|
+
import "./chunk-63F65DHU.js";
|
|
29
|
+
import "./chunk-A33TIM5D.js";
|
|
30
|
+
import "./chunk-VX37MPTJ.js";
|
|
31
|
+
import "./chunk-5E5R65CA.js";
|
|
32
|
+
import "./chunk-LRBPT7LQ.js";
|
|
33
|
+
import "./chunk-ADEWU4P4.js";
|
|
34
|
+
import "./chunk-DJD7TBYG.js";
|
|
35
|
+
import "./chunk-AUBB72VF.js";
|
|
36
|
+
import "./chunk-Y5E2WNWB.js";
|
|
37
|
+
import "./chunk-SZ2V62HB.js";
|
|
38
|
+
import "./chunk-LJQUYECN.js";
|
|
39
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
40
|
+
export {
|
|
41
|
+
amoCrmSource
|
|
42
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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-AHJ4W2IL.js";
|
|
8
|
+
import "./chunk-LRBPT7LQ.js";
|
|
9
|
+
import "./chunk-ADEWU4P4.js";
|
|
10
|
+
import "./chunk-DJD7TBYG.js";
|
|
11
|
+
import "./chunk-AUBB72VF.js";
|
|
12
|
+
import "./chunk-Y5E2WNWB.js";
|
|
13
|
+
import "./chunk-SZ2V62HB.js";
|
|
14
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
15
|
+
export {
|
|
16
|
+
ensureSqlite,
|
|
17
|
+
nodeRuntime,
|
|
18
|
+
relay
|
|
19
|
+
};
|