@wirecat/drive-cli 0.64.0 → 0.66.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/contracts/wirecat.json +2871 -0
- package/dist/bin/drive.js +2 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/browse.d.ts +1 -1
- package/dist/browse.d.ts.map +1 -1
- package/dist/browse.js +1 -1
- package/dist/bundle/{all-profiles-BPPT2AK5.js → all-profiles-WCQLIHUG.js} +14 -13
- package/dist/bundle/{anthropic-JW6GOJUD.js → anthropic-5RJMB6O7.js} +32 -16
- package/dist/bundle/{app-server-KAQIOJMZ.js → app-server-3RGYXPKG.js} +72 -58
- package/dist/bundle/{bun-UT7GNTPV.js → bun-L34VEKGG.js} +2 -2
- package/dist/bundle/{bun-sqlite-2OIVV3LS.js → bun-sqlite-H6IAXQXI.js} +12 -8
- package/dist/bundle/chunk-2AF77WMH.js +13 -0
- package/dist/bundle/{chunk-KVW4XNKB.js → chunk-2S3E2HVV.js} +107 -48
- package/dist/bundle/{chunk-IX7NQJLY.js → chunk-3NYH756U.js} +49 -116
- package/dist/bundle/chunk-3QFUDXMQ.js +53 -0
- package/dist/bundle/{chunk-5ZBR55US.js → chunk-3SDJIMZB.js} +1 -1
- package/dist/bundle/{chunk-AHB4OJCI.js → chunk-4UHBJSMI.js} +21735 -27143
- package/dist/bundle/chunk-5HVJK3ZJ.js +101 -0
- package/dist/bundle/{chunk-GSMYXGFR.js → chunk-5K54RZBK.js} +13 -5
- package/dist/bundle/{chunk-LOMW6F2E.js → chunk-5PLINHEY.js} +5403 -4847
- package/dist/bundle/{chunk-J62DI53V.js → chunk-5VDVGDOC.js} +1 -1
- package/dist/bundle/{chunk-66AF4FBW.js → chunk-5XLU4NN6.js} +4 -4
- package/dist/bundle/{chunk-4CNTID2X.js → chunk-6UJCCOZC.js} +4 -4
- package/dist/bundle/{chunk-G4KEKKDE.js → chunk-6X3KUFRQ.js} +60 -29
- package/dist/bundle/{chunk-QEAD2LF4.js → chunk-7EP4AU6A.js} +3 -3
- package/dist/bundle/{chunk-ZRZ4HTCK.js → chunk-7LT2G5BC.js} +171 -174
- package/dist/bundle/{chunk-2W464HAE.js → chunk-7ZGJRVBH.js} +7 -5
- package/dist/bundle/{chunk-FXBHOCJK.js → chunk-ADLS6FVG.js} +1 -1
- package/dist/bundle/{chunk-KG2XKEHL.js → chunk-ALE67WRR.js} +5 -5
- package/dist/bundle/{chunk-ZSZJLJIA.js → chunk-AP4MX247.js} +38 -28
- package/dist/bundle/{chunk-EWGVDFPT.js → chunk-BIJW6AYA.js} +41873 -36466
- package/dist/bundle/{chunk-B7XBIOMR.js → chunk-BQXSE645.js} +16 -16
- package/dist/bundle/{chunk-F2VDAG32.js → chunk-COGWKO2T.js} +3 -3
- package/dist/bundle/{chunk-EZ6O3ST3.js → chunk-D4MIMH2N.js} +12 -6
- package/dist/bundle/{chunk-4YRENUB5.js → chunk-D7KOAPG6.js} +2 -2
- package/dist/bundle/chunk-E2F2XIX6.js +224 -0
- package/dist/bundle/{chunk-36GPBPWM.js → chunk-FA2TNA5X.js} +3 -1
- package/dist/bundle/{chunk-SIOIMO62.js → chunk-FHBTQPA3.js} +69 -63
- package/dist/bundle/{chunk-34BIDKF4.js → chunk-FKKPVPZR.js} +649 -212
- package/dist/bundle/chunk-G4TNKBDX.js +185 -0
- package/dist/bundle/{chunk-2FEZ24DK.js → chunk-GVA3KTCD.js} +20 -20
- package/dist/bundle/chunk-GY4DAJSK.js +167 -0
- package/dist/bundle/{chunk-5OFA5EXE.js → chunk-H7XL6WTW.js} +2 -2
- package/dist/bundle/{chunk-K6BSB53R.js → chunk-HHRJPLFO.js} +1 -1
- package/dist/bundle/{chunk-P7DEGRZA.js → chunk-HPKE2GDP.js} +49 -28
- package/dist/bundle/{chunk-QXCKJUZY.js → chunk-HPSHQVJU.js} +633 -465
- package/dist/bundle/{chunk-BEZJA44H.js → chunk-HQBLJLYH.js} +7 -7
- package/dist/bundle/{chunk-JRXFW7HE.js → chunk-I5R5CMQR.js} +5 -5
- package/dist/bundle/{chunk-EJ4PNHPP.js → chunk-IIHZTV6V.js} +1 -1
- package/dist/bundle/{chunk-G3NULXOM.js → chunk-IRNDYNQX.js} +4 -4
- package/dist/bundle/{chunk-N622LRPM.js → chunk-JCHF7LZT.js} +4 -4
- package/dist/bundle/{chunk-WWCYTMAV.js → chunk-JHMEETXI.js} +2 -2
- package/dist/bundle/{chunk-ZF6GUZCE.js → chunk-JLCR24UM.js} +1 -1
- package/dist/bundle/{chunk-IDAK4DDK.js → chunk-JQXK3M5M.js} +1 -1
- package/dist/bundle/{chunk-KIN6PDFE.js → chunk-KOY5HUBY.js} +14 -5
- package/dist/bundle/{chunk-5HSRQ53R.js → chunk-KRG5X5PH.js} +2 -2
- package/dist/bundle/{chunk-VIJ6ACYB.js → chunk-LVAPSAHF.js} +8 -8
- package/dist/bundle/{chunk-OEVHZOHC.js → chunk-M7543RUJ.js} +50 -18
- package/dist/bundle/{chunk-BZ2ZKILM.js → chunk-MZWXTJ4O.js} +3 -3
- package/dist/bundle/{chunk-EC2XGDKJ.js → chunk-NK4GVFJH.js} +4 -4
- package/dist/bundle/chunk-NYECVHFH.js +10283 -0
- package/dist/bundle/{chunk-HW4UPST2.js → chunk-NYZS2LKF.js} +2 -2
- package/dist/bundle/chunk-O53WLYX3.js +72 -0
- package/dist/bundle/{chunk-IK6KH3RE.js → chunk-OIF4B526.js} +1 -1
- package/dist/bundle/{chunk-UJR272CP.js → chunk-OT7SQQJK.js} +359 -903
- package/dist/bundle/chunk-OZOQLAWK.js +72 -0
- package/dist/bundle/{chunk-VT2UFYPJ.js → chunk-P7HQFII6.js} +22 -15
- package/dist/bundle/{chunk-6G53ZFUT.js → chunk-PJGOQSE5.js} +1 -1
- package/dist/bundle/{chunk-OH3K2E7X.js → chunk-PKM55ZRR.js} +704 -1214
- package/dist/bundle/{chunk-GW3U6OLD.js → chunk-PUMDOCAF.js} +1 -1
- package/dist/bundle/{chunk-EQEGJVO2.js → chunk-QF7VL4C3.js} +1 -1
- package/dist/bundle/{chunk-CPMRM3GQ.js → chunk-QJ57PV55.js} +1941 -662
- package/dist/bundle/{chunk-O2QO5UZC.js → chunk-QSELSDWE.js} +13 -13
- package/dist/bundle/{chunk-BEUAICUD.js → chunk-SOOU5WO6.js} +2 -2
- package/dist/bundle/{chunk-46CD64J2.js → chunk-SZ6JFOL4.js} +269 -64
- package/dist/bundle/{chunk-UD55VB2N.js → chunk-T3ULDA7C.js} +3 -3
- package/dist/bundle/{chunk-E2LBCCTG.js → chunk-TAHISPDE.js} +5 -5
- package/dist/bundle/{chunk-6B37XO6B.js → chunk-TYLEICTX.js} +3 -3
- package/dist/bundle/{chunk-TNV2FXVK.js → chunk-UAKX6DP4.js} +5 -5
- package/dist/bundle/{chunk-VPLFD5RJ.js → chunk-UG3GHFGY.js} +4 -4
- package/dist/bundle/{chunk-B67BLRAI.js → chunk-ULXEW6FT.js} +3 -60
- package/dist/bundle/{chunk-C7WBNOYW.js → chunk-UNTIVT47.js} +26 -2
- package/dist/bundle/chunk-UQPW42HF.js +18 -0
- package/dist/bundle/{chunk-USLZE36C.js → chunk-V2WXTILT.js} +6 -6
- package/dist/bundle/{chunk-BDYWZ7JE.js → chunk-VQKNKJYL.js} +46 -7
- package/dist/bundle/{chunk-XPXKD63J.js → chunk-VR3YKXHL.js} +93 -31
- package/dist/bundle/{chunk-UIEA6FIV.js → chunk-VUUPFDRU.js} +27 -28
- package/dist/bundle/{chunk-KE4XPPRQ.js → chunk-WYTYHUFH.js} +1750 -138
- package/dist/bundle/{chunk-PBMSBCVB.js → chunk-XLGDNI4S.js} +1 -1
- package/dist/bundle/{chunk-3J5KAFNA.js → chunk-XVZNFA2P.js} +4935 -3623
- package/dist/bundle/chunk-Y5U4HIZS.js +71 -0
- package/dist/bundle/chunk-YTIPTHEE.js +47 -0
- package/dist/bundle/cli-KW6QQVS5.js +1101 -0
- package/dist/bundle/command-contract-CE543JBN.js +41 -0
- package/dist/bundle/command-server-entry-OC4E4DED.js +171 -0
- package/dist/bundle/{decode-HTOQ6S3V.js → decode-AH5ZLLDK.js} +8 -8
- package/dist/bundle/{dispatch-SH5SP6LA.js → dispatch-CDWZZ54Q.js} +9 -9
- package/dist/bundle/drive.js +13 -13
- package/dist/bundle/{echarts-KFHB6SLX.js → echarts-VC7MTXWY.js} +2 -2
- package/dist/bundle/{embed-YATFB2PN.js → embed-EPSQY6QG.js} +9 -9
- package/dist/bundle/{embedder-MQPDFGTJ.js → embedder-TK4U4TJR.js} +12 -12
- package/dist/bundle/entry-3VN23M7M.js +25 -0
- package/dist/bundle/{failure-4FQL4XJI.js → failure-WSVZOPFE.js} +4 -4
- package/dist/bundle/first-run-7ZYJ7EB3.js +30 -0
- package/dist/bundle/first-screen-CZDH7QY3.js +39 -0
- package/dist/bundle/google-OBZMWA7J.js +45 -0
- package/dist/bundle/{google-api-QMFGCXBM.js → google-api-AV4X2JH3.js} +68 -57
- package/dist/bundle/grants-WTRLN4ZI.js +111 -0
- package/dist/bundle/{identity-FYVDK4M2.js → identity-CGHHF7AK.js} +8 -6
- package/dist/bundle/{instructions-D3GF3B7M.js → instructions-24PHDBBE.js} +1 -1
- package/dist/bundle/{login-COFZ2IWP.js → login-XHFESAFM.js} +73 -64
- package/dist/bundle/{mcp-RKJG22KM.js → mcp-M5YCSWJJ.js} +2 -2
- package/dist/bundle/{node-OFICOKX3.js → node-GIDULTV5.js} +2 -2
- package/dist/bundle/{node-KM3CUABH.js → node-P4E63KXA.js} +9 -9
- package/dist/bundle/{node-sqlite-DNBTDOXD.js → node-sqlite-LINBOAWK.js} +13 -9
- package/dist/bundle/oauth-JHUX3KE3.js +22 -0
- package/dist/bundle/{open-PTPR2YWX.js → open-RYFKPNCJ.js} +8 -8
- package/dist/bundle/{openai-2KV5LUW4.js → openai-Q7YYUHJF.js} +28 -42
- package/dist/bundle/{process-EAW6NST2.js → process-VPIZTIJR.js} +1 -1
- package/dist/bundle/{program-6UV5Q5YN.js → program-IUXFRBZA.js} +419 -604
- package/dist/bundle/{prompt-634TPMJK.js → prompt-LF4KX3XL.js} +8 -8
- package/dist/bundle/{reasons-DDWCEYSQ.js → reasons-JPYOU5GV.js} +5 -5
- package/dist/bundle/{recognize-SJO6QUDW.js → recognize-KEWTJXFH.js} +7 -7
- package/dist/bundle/{remote-6JXZITKF.js → remote-HGGLB76S.js} +13 -10
- package/dist/bundle/{rerank-MD5VOPQ6.js → rerank-TDUKETFT.js} +10 -10
- package/dist/bundle/{serve-LZTROA2M.js → serve-XFYMKW5W.js} +12 -12
- package/dist/bundle/server-BDEV3CZJ.js +74 -0
- package/dist/bundle/{server-NSA3UAFY.js → server-PXIPSGFP.js} +48 -44
- package/dist/bundle/{services-F5A6XQCV.js → services-2BOCGMJU.js} +111 -41
- package/dist/bundle/{sqlite-runtime-7YF6REKS.js → sqlite-runtime-R7M5XUMW.js} +9 -9
- package/dist/bundle/{start-MUFLE6FA.js → start-YRLT4MQZ.js} +7 -7
- package/dist/bundle/{state-UC54F3YZ.js → state-NZ7WRJWH.js} +9 -9
- package/dist/bundle/{store-F5FJGWMR.js → store-7LCVDO7G.js} +63 -28
- package/dist/bundle/{store-J53YNAH6.js → store-ICDGPSEN.js} +27 -18
- package/dist/bundle/store-maintenance-command-SJPLY6IH.js +65 -0
- package/dist/bundle/tokens-FGTBE7VW.js +111 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +6 -5
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context.d.ts +4 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/discovery.d.ts +0 -1
- package/dist/commands/discovery.d.ts.map +1 -1
- package/dist/commands/discovery.js +6 -26
- package/dist/commands/discovery.js.map +1 -1
- package/dist/commands/documents.d.ts +2 -0
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +39 -3
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +7 -6
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +11 -8
- package/dist/commands/search.js.map +1 -1
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -4
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +16 -4
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +86 -410
- package/dist/contract-overrides.js.map +1 -1
- package/dist/documents-add.d.ts +49 -0
- package/dist/documents-add.d.ts.map +1 -0
- package/dist/documents-add.js +122 -0
- package/dist/documents-add.js.map +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -1
- package/dist/errors.js.map +1 -1
- package/dist/google-api.d.ts.map +1 -1
- package/dist/google-api.js +4 -1
- package/dist/google-api.js.map +1 -1
- package/dist/identity.d.ts +4 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +22 -0
- package/dist/identity.js.map +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +17 -19
- package/dist/knowledge.js.map +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +2 -2
- package/dist/login.js.map +1 -1
- package/dist/model.d.ts +3 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +30 -21
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +25 -1
- package/dist/reasons.js.map +1 -1
- package/dist/store-transition.js +2 -2
- package/dist/store-transition.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +27 -7
- package/dist/store.js.map +1 -1
- package/dist/tokens.d.ts +9 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +18 -15
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- 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/package.json +8 -8
- package/dist/bundle/chunk-3NULZGQU.js +0 -27
- package/dist/bundle/chunk-DD7EFG6B.js +0 -35
- package/dist/bundle/chunk-M73NNJ3X.js +0 -26
- package/dist/bundle/chunk-SBZB7HMU.js +0 -1055
- package/dist/bundle/command-contract-H5OYJOPF.js +0 -38
- package/dist/bundle/dist-PY3MVR3G.js +0 -21
- package/dist/bundle/entry-YZBB647C.js +0 -22
- package/dist/bundle/first-run-5JT3UQZB.js +0 -30
- package/dist/bundle/first-screen-BEMDEWO7.js +0 -36
- package/dist/bundle/google-DVADVICN.js +0 -36
- package/dist/bundle/grants-WKB2E4TA.js +0 -103
- package/dist/bundle/oauth-PDQHWFBF.js +0 -22
- package/dist/bundle/server-GT7X666D.js +0 -69
- package/dist/bundle/store-maintenance-command-GJVXLBAB.js +0 -58
- package/dist/bundle/tokens-H2EJKGA5.js +0 -101
- package/dist/bundle/{chunk-SW6C6WH5.js → chunk-HVJJWJYQ.js} +0 -0
- package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-CE73EWJ2.js} +3 -3
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
stdinFieldOf
|
|
5
|
+
} from "./chunk-UQPW42HF.js";
|
|
6
|
+
import {
|
|
7
|
+
isCommandServer
|
|
8
|
+
} from "./chunk-2AF77WMH.js";
|
|
9
|
+
import {
|
|
10
|
+
commandPathOf
|
|
11
|
+
} from "./chunk-UAKX6DP4.js";
|
|
12
|
+
import {
|
|
13
|
+
commandServerRequest,
|
|
14
|
+
metaOf
|
|
15
|
+
} from "./chunk-5PLINHEY.js";
|
|
16
|
+
import {
|
|
17
|
+
errorObjectOf,
|
|
18
|
+
renderError
|
|
19
|
+
} from "./chunk-ALE67WRR.js";
|
|
20
|
+
import {
|
|
21
|
+
CliError
|
|
22
|
+
} from "./chunk-IIHZTV6V.js";
|
|
23
|
+
import {
|
|
24
|
+
__name
|
|
25
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/command-server.js
|
|
28
|
+
import { createInterface } from "node:readline";
|
|
29
|
+
var COMMAND_SERVER_PROTOCOL = 1;
|
|
30
|
+
var COMMAND_SERVER_IDLE_MS = 10 * 6e4;
|
|
31
|
+
var COMMAND_SERVER_CONCURRENT = 8;
|
|
32
|
+
var runsAlone = /* @__PURE__ */ __name((command) => commandPathOf(command)[0] === "store", "runsAlone");
|
|
33
|
+
var enterCommandServer = /* @__PURE__ */ __name(async (command, cli) => {
|
|
34
|
+
const request = commandServerRequest();
|
|
35
|
+
if (!request)
|
|
36
|
+
return;
|
|
37
|
+
refuseInCommandServer(command, cli);
|
|
38
|
+
if (runsAlone(command))
|
|
39
|
+
await request.alone();
|
|
40
|
+
}, "enterCommandServer");
|
|
41
|
+
var refuseInCommandServer = /* @__PURE__ */ __name((command, cli) => {
|
|
42
|
+
if (!commandServerRequest())
|
|
43
|
+
return;
|
|
44
|
+
const typed = [cli, ...commandPathOf(command)].join(" ");
|
|
45
|
+
const { lifetime } = metaOf(command);
|
|
46
|
+
if (lifetime)
|
|
47
|
+
throw new CliError("validation_error", `\`${typed}\` ${lifetime === "persistent" ? "runs until it is stopped" : "waits on a person"}; the command server runs only commands that return \u2014 start it as a process of its own`);
|
|
48
|
+
if (stdinFieldOf(command))
|
|
49
|
+
throw new CliError("validation_error", `\`${typed}\` reads its input on stdin, which the command server does not pass on \u2014 start it as a process of its own`);
|
|
50
|
+
}, "refuseInCommandServer");
|
|
51
|
+
var refusal = /* @__PURE__ */ __name((cli, message) => `${renderError(errorObjectOf(new CliError("validation_error", message)), { cli, interactive: false })}
|
|
52
|
+
`, "refusal");
|
|
53
|
+
var requestOf = /* @__PURE__ */ __name((line, cli) => {
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = JSON.parse(line);
|
|
57
|
+
} catch {
|
|
58
|
+
return { id: null, error: "a request is one JSON object per line" };
|
|
59
|
+
}
|
|
60
|
+
const { id, argv } = parsed ?? {};
|
|
61
|
+
const known = typeof id === "number" && Number.isFinite(id) ? id : null;
|
|
62
|
+
if (known === null)
|
|
63
|
+
return { id: null, error: 'a request needs a numeric "id"' };
|
|
64
|
+
if (!Array.isArray(argv) || !argv.every((word) => typeof word === "string"))
|
|
65
|
+
return { id: known, error: '"argv" is a list of strings' };
|
|
66
|
+
if (isCommandServer(argv))
|
|
67
|
+
return { id: known, error: `\`${cli} commands --serve\` cannot run inside itself` };
|
|
68
|
+
return { id: known, argv };
|
|
69
|
+
}, "requestOf");
|
|
70
|
+
var serveCommands = /* @__PURE__ */ __name(async ({ input, write, run, cli, version, idleMs = COMMAND_SERVER_IDLE_MS, concurrent = COMMAND_SERVER_CONCURRENT, signal }) => {
|
|
71
|
+
const send = /* @__PURE__ */ __name((value) => write(`${JSON.stringify(value)}
|
|
72
|
+
`), "send");
|
|
73
|
+
await send({ ready: true, protocol: COMMAND_SERVER_PROTOCOL, version, concurrent });
|
|
74
|
+
const lines = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY });
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
const waiting = [];
|
|
77
|
+
let active = 0;
|
|
78
|
+
let running = 0;
|
|
79
|
+
let gated = false;
|
|
80
|
+
let drained;
|
|
81
|
+
let turns = Promise.resolve();
|
|
82
|
+
let timer;
|
|
83
|
+
let ending = false;
|
|
84
|
+
let done = false;
|
|
85
|
+
const finish = /* @__PURE__ */ __name(() => {
|
|
86
|
+
if (done)
|
|
87
|
+
return;
|
|
88
|
+
done = true;
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
lines.close();
|
|
91
|
+
resolve(0);
|
|
92
|
+
}, "finish");
|
|
93
|
+
const settle = /* @__PURE__ */ __name(() => {
|
|
94
|
+
if (running === 0 && drained) {
|
|
95
|
+
const go = drained;
|
|
96
|
+
drained = void 0;
|
|
97
|
+
go();
|
|
98
|
+
}
|
|
99
|
+
pump();
|
|
100
|
+
if (active > 0 || waiting.length > 0 || done)
|
|
101
|
+
return;
|
|
102
|
+
if (ending)
|
|
103
|
+
finish();
|
|
104
|
+
else {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
timer = setTimeout(finish, idleMs);
|
|
107
|
+
}
|
|
108
|
+
}, "settle");
|
|
109
|
+
const start = /* @__PURE__ */ __name((line) => {
|
|
110
|
+
active += 1;
|
|
111
|
+
running += 1;
|
|
112
|
+
let holdsPlace = true;
|
|
113
|
+
let ended = false;
|
|
114
|
+
let turn;
|
|
115
|
+
let release;
|
|
116
|
+
const alone = /* @__PURE__ */ __name(() => {
|
|
117
|
+
if (turn)
|
|
118
|
+
return turn;
|
|
119
|
+
holdsPlace = false;
|
|
120
|
+
running -= 1;
|
|
121
|
+
turn = turns.then(() => new Promise((go) => {
|
|
122
|
+
if (ended)
|
|
123
|
+
return go();
|
|
124
|
+
gated = true;
|
|
125
|
+
drained = /* @__PURE__ */ __name(() => {
|
|
126
|
+
if (ended)
|
|
127
|
+
gated = false;
|
|
128
|
+
else {
|
|
129
|
+
holdsPlace = true;
|
|
130
|
+
running += 1;
|
|
131
|
+
}
|
|
132
|
+
go();
|
|
133
|
+
}, "drained");
|
|
134
|
+
settle();
|
|
135
|
+
}));
|
|
136
|
+
turns = turn.then(() => ended && !holdsPlace ? void 0 : new Promise((free) => release = free));
|
|
137
|
+
return turn;
|
|
138
|
+
}, "alone");
|
|
139
|
+
const answer = /* @__PURE__ */ __name(async () => {
|
|
140
|
+
const request = requestOf(line, cli);
|
|
141
|
+
if ("error" in request)
|
|
142
|
+
return send({ id: request.id, code: 2, stdout: "", stderr: refusal(cli, request.error) });
|
|
143
|
+
const answered = await run(request.argv, alone);
|
|
144
|
+
return send({ id: request.id, ...answered });
|
|
145
|
+
}, "answer");
|
|
146
|
+
answer().catch(finish).finally(() => {
|
|
147
|
+
ended = true;
|
|
148
|
+
active -= 1;
|
|
149
|
+
if (holdsPlace)
|
|
150
|
+
running -= 1;
|
|
151
|
+
if (release) {
|
|
152
|
+
gated = false;
|
|
153
|
+
release();
|
|
154
|
+
}
|
|
155
|
+
settle();
|
|
156
|
+
});
|
|
157
|
+
}, "start");
|
|
158
|
+
const pump = /* @__PURE__ */ __name(() => {
|
|
159
|
+
while (!done && !gated && running < concurrent && waiting.length > 0)
|
|
160
|
+
start(waiting.shift());
|
|
161
|
+
}, "pump");
|
|
162
|
+
lines.on("line", (line) => {
|
|
163
|
+
if (done || ending || line.trim() === "")
|
|
164
|
+
return;
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
waiting.push(line);
|
|
167
|
+
pump();
|
|
168
|
+
});
|
|
169
|
+
const end = /* @__PURE__ */ __name(() => {
|
|
170
|
+
ending = true;
|
|
171
|
+
settle();
|
|
172
|
+
}, "end");
|
|
173
|
+
lines.on("close", end);
|
|
174
|
+
if (signal?.aborted)
|
|
175
|
+
end();
|
|
176
|
+
signal?.addEventListener("abort", end, { once: true });
|
|
177
|
+
settle();
|
|
178
|
+
});
|
|
179
|
+
}, "serveCommands");
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
COMMAND_SERVER_CONCURRENT,
|
|
183
|
+
enterCommandServer,
|
|
184
|
+
serveCommands
|
|
185
|
+
};
|
|
@@ -19,16 +19,16 @@ import {
|
|
|
19
19
|
reference,
|
|
20
20
|
string,
|
|
21
21
|
variant
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VQKNKJYL.js";
|
|
23
23
|
import {
|
|
24
24
|
CliError,
|
|
25
25
|
isCliError
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IIHZTV6V.js";
|
|
27
27
|
import {
|
|
28
28
|
__name
|
|
29
29
|
} from "./chunk-ZVVMGPBJ.js";
|
|
30
30
|
|
|
31
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
31
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
|
|
32
32
|
var QUERY_LIMITS = {
|
|
33
33
|
bytes: 8192,
|
|
34
34
|
depth: 32,
|
|
@@ -72,7 +72,7 @@ function queryError(reason, span, alternative, context = {}, details = {}) {
|
|
|
72
72
|
__name(queryError, "queryError");
|
|
73
73
|
var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
|
|
74
74
|
|
|
75
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
75
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
|
|
76
76
|
var timezoneOf = /* @__PURE__ */ __name((given) => {
|
|
77
77
|
const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
|
|
78
78
|
try {
|
|
@@ -217,7 +217,7 @@ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclu
|
|
|
217
217
|
};
|
|
218
218
|
}, "dateRange");
|
|
219
219
|
|
|
220
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
220
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
|
|
221
221
|
var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
|
|
222
222
|
var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
|
|
223
223
|
var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
|
|
@@ -272,7 +272,7 @@ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
|
|
|
272
272
|
}, "matches");
|
|
273
273
|
var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
|
|
274
274
|
|
|
275
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
275
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
|
|
276
276
|
var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
|
|
277
277
|
var OPERATORS_BY_TYPE = {
|
|
278
278
|
kw: ["term", "phrase", "wildcard"],
|
|
@@ -351,7 +351,7 @@ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
|
|
|
351
351
|
return [...own, ...relations, ...states];
|
|
352
352
|
}, "queryFieldsOf");
|
|
353
353
|
|
|
354
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
354
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
|
|
355
355
|
var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
|
|
356
356
|
var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
|
|
357
357
|
var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
|
|
@@ -388,7 +388,7 @@ var queryDescription = /* @__PURE__ */ __name((registry) => {
|
|
|
388
388
|
return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
|
|
389
389
|
}, "queryDescription");
|
|
390
390
|
|
|
391
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
391
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
|
|
392
392
|
var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
|
|
393
393
|
var reserved = /* @__PURE__ */ new Set([
|
|
394
394
|
"+",
|
|
@@ -697,7 +697,7 @@ var implicitTextTerms = /* @__PURE__ */ __name((text) => {
|
|
|
697
697
|
return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
|
|
698
698
|
}, "implicitTextTerms");
|
|
699
699
|
|
|
700
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
700
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
|
|
701
701
|
var inContext = /* @__PURE__ */ __name((context, run) => {
|
|
702
702
|
try {
|
|
703
703
|
run();
|
|
@@ -772,7 +772,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
|
|
|
772
772
|
}, "validateQuery");
|
|
773
773
|
var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
|
|
774
774
|
|
|
775
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
775
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
|
|
776
776
|
var describeQuery = /* @__PURE__ */ __name((registry) => ({
|
|
777
777
|
entity: registry.entity,
|
|
778
778
|
backend: registry.backend,
|
|
@@ -844,26 +844,26 @@ var QUERY_REASONS = defineReasons([
|
|
|
844
844
|
})));
|
|
845
845
|
|
|
846
846
|
export {
|
|
847
|
+
FIELD_TYPES,
|
|
848
|
+
OPERATORS_BY_TYPE,
|
|
849
|
+
QUERY_BACKENDS,
|
|
850
|
+
queryFieldsOf,
|
|
847
851
|
QUERY_LIMITS,
|
|
848
852
|
queryAstSchema,
|
|
849
853
|
queryError,
|
|
850
854
|
walkQuery,
|
|
855
|
+
parseLucene,
|
|
856
|
+
implicitTextTerms,
|
|
851
857
|
timezoneOf,
|
|
852
858
|
dayBoundary,
|
|
853
859
|
zonedMoment,
|
|
854
860
|
dateRange,
|
|
855
|
-
evaluate,
|
|
856
|
-
FIELD_TYPES,
|
|
857
|
-
OPERATORS_BY_TYPE,
|
|
858
|
-
QUERY_BACKENDS,
|
|
859
|
-
queryFieldsOf,
|
|
860
|
-
fieldsHelp,
|
|
861
|
-
queryDescription,
|
|
862
|
-
parseLucene,
|
|
863
|
-
implicitTextTerms,
|
|
864
861
|
validateQuery,
|
|
865
862
|
fieldsNamed,
|
|
866
863
|
describeQuery,
|
|
867
864
|
defineQuery,
|
|
868
|
-
QUERY_REASONS
|
|
865
|
+
QUERY_REASONS,
|
|
866
|
+
evaluate,
|
|
867
|
+
fieldsHelp,
|
|
868
|
+
queryDescription
|
|
869
869
|
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError,
|
|
5
|
+
isCliError
|
|
6
|
+
} from "./chunk-IIHZTV6V.js";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
10
|
+
|
|
11
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/hosts.js
|
|
12
|
+
var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
13
|
+
var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
|
|
14
|
+
var hostProblems = /* @__PURE__ */ __name((hosts) => [
|
|
15
|
+
...hosts.filter((host) => !HOST_PATTERN.test(host) || host.length > 253).map((host) => `${JSON.stringify(host)} is not a host: a lower-case hostname with no scheme, port or path, or one leading *. before two labels or more`),
|
|
16
|
+
...hosts.filter((host, at) => hosts.indexOf(host) !== at).map((host) => `${JSON.stringify(host)} is listed twice`)
|
|
17
|
+
], "hostProblems");
|
|
18
|
+
var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
|
|
19
|
+
const name = hostname.toLowerCase().replace(/\.$/, "");
|
|
20
|
+
return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
|
|
21
|
+
}, "hostCovered");
|
|
22
|
+
|
|
23
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/fetch.js
|
|
24
|
+
var HOST_FETCH_TIMEOUT_MS = 3e4;
|
|
25
|
+
var REDIRECTS = 5;
|
|
26
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
27
|
+
var CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
|
|
28
|
+
var NO_BODY = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
29
|
+
var deadline = /* @__PURE__ */ __name((ms) => {
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
|
|
32
|
+
timer.unref?.();
|
|
33
|
+
return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
|
|
34
|
+
}, "deadline");
|
|
35
|
+
var released = /* @__PURE__ */ __name((response, clear) => {
|
|
36
|
+
if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
|
|
37
|
+
clear();
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
const { status, statusText, headers, url, redirected } = response;
|
|
41
|
+
const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
|
|
42
|
+
status,
|
|
43
|
+
statusText,
|
|
44
|
+
headers
|
|
45
|
+
});
|
|
46
|
+
return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
|
|
47
|
+
}, "released");
|
|
48
|
+
var undeclared = /* @__PURE__ */ __name((url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false }), "undeclared");
|
|
49
|
+
var checked = /* @__PURE__ */ __name((url, hosts) => {
|
|
50
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
51
|
+
throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
|
|
52
|
+
sent: false
|
|
53
|
+
});
|
|
54
|
+
if (!hostCovered(url.hostname, hosts))
|
|
55
|
+
throw undeclared(url);
|
|
56
|
+
return url;
|
|
57
|
+
}, "checked");
|
|
58
|
+
var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
59
|
+
const problems = hostProblems(options.hosts);
|
|
60
|
+
if (problems.length > 0)
|
|
61
|
+
throw new CliError("configuration_error", problems.join("; "));
|
|
62
|
+
const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
|
|
63
|
+
return async (input, init = {}) => {
|
|
64
|
+
const request = input instanceof Request ? input : void 0;
|
|
65
|
+
let url = checked(new URL(request?.url ?? String(input)), hosts);
|
|
66
|
+
const caller = init.signal ?? request?.signal;
|
|
67
|
+
const timeout = deadline(timeoutMs);
|
|
68
|
+
const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
|
|
69
|
+
const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
|
|
70
|
+
let method = (init.method ?? request?.method ?? "GET").toUpperCase();
|
|
71
|
+
let body = init.body ?? request?.body ?? void 0;
|
|
72
|
+
const headers = new Headers(init.headers ?? request?.headers);
|
|
73
|
+
try {
|
|
74
|
+
let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
|
|
75
|
+
for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
|
|
76
|
+
const location = response.headers.get("location");
|
|
77
|
+
if (!location)
|
|
78
|
+
return released(response, timeout.clear);
|
|
79
|
+
if (hop >= redirects)
|
|
80
|
+
throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
|
|
81
|
+
void response.body?.cancel().catch(() => {
|
|
82
|
+
});
|
|
83
|
+
const next = checked(new URL(location, url), hosts);
|
|
84
|
+
if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
|
|
85
|
+
method = method === "HEAD" ? "HEAD" : "GET";
|
|
86
|
+
body = void 0;
|
|
87
|
+
headers.delete("content-type");
|
|
88
|
+
headers.delete("content-length");
|
|
89
|
+
} else if (body instanceof ReadableStream)
|
|
90
|
+
throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
|
|
91
|
+
if (next.origin !== url.origin)
|
|
92
|
+
for (const name of CREDENTIAL_HEADERS)
|
|
93
|
+
headers.delete(name);
|
|
94
|
+
url = next;
|
|
95
|
+
response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
|
|
96
|
+
}
|
|
97
|
+
return released(response, timeout.clear);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
timeout.clear();
|
|
100
|
+
if (isCliError(error))
|
|
101
|
+
throw error;
|
|
102
|
+
if (caller?.aborted)
|
|
103
|
+
throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
|
|
104
|
+
if (timeout.signal.aborted)
|
|
105
|
+
throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
106
|
+
throw new CliError("network_error", `${url.hostname} could not be reached`, { retryable: true });
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, "hostFetch");
|
|
110
|
+
|
|
111
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
|
|
112
|
+
var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
|
|
113
|
+
if (!header)
|
|
114
|
+
return void 0;
|
|
115
|
+
const trimmed = header.trim();
|
|
116
|
+
if (/^\d+$/.test(trimmed))
|
|
117
|
+
return Number(trimmed) * 1e3;
|
|
118
|
+
const at = Date.parse(trimmed);
|
|
119
|
+
if (Number.isNaN(at))
|
|
120
|
+
return void 0;
|
|
121
|
+
const delta = at - now().getTime();
|
|
122
|
+
return delta > 0 ? delta : void 0;
|
|
123
|
+
}, "parseRetryAfter");
|
|
124
|
+
var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
|
|
125
|
+
if (!header)
|
|
126
|
+
return void 0;
|
|
127
|
+
const seconds = Number(header.trim());
|
|
128
|
+
if (!Number.isFinite(seconds))
|
|
129
|
+
return void 0;
|
|
130
|
+
const delta = seconds * 1e3 - now().getTime();
|
|
131
|
+
return delta > 0 ? delta : void 0;
|
|
132
|
+
}, "parseRateLimitReset");
|
|
133
|
+
var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
|
|
134
|
+
|
|
135
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/models/endpoint.js
|
|
136
|
+
var endpoint = /* @__PURE__ */ __name((value) => {
|
|
137
|
+
try {
|
|
138
|
+
const url = new URL(value);
|
|
139
|
+
return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password && !url.search && !url.hash;
|
|
140
|
+
} catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}, "endpoint");
|
|
144
|
+
var loopback = /* @__PURE__ */ __name((hostname) => hostname === "localhost" || hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname), "loopback");
|
|
145
|
+
var onThisComputer = /* @__PURE__ */ __name((value) => {
|
|
146
|
+
try {
|
|
147
|
+
return loopback(new URL(value).hostname);
|
|
148
|
+
} catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}, "onThisComputer");
|
|
152
|
+
var modelAddressAllowed = /* @__PURE__ */ __name((value) => endpoint(value) && (new URL(value).protocol === "https:" || onThisComputer(value)), "modelAddressAllowed");
|
|
153
|
+
var PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
|
|
154
|
+
var endpointFetch = /* @__PURE__ */ __name((address, timeoutMs) => {
|
|
155
|
+
const { hostname } = new URL(address);
|
|
156
|
+
return hostname === "[::1]" ? fetch : hostFetch({ hosts: [hostname], timeoutMs });
|
|
157
|
+
}, "endpointFetch");
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
hostFetch,
|
|
161
|
+
providerWaitMs,
|
|
162
|
+
endpoint,
|
|
163
|
+
onThisComputer,
|
|
164
|
+
modelAddressAllowed,
|
|
165
|
+
PLAIN_HTTP_REFUSED,
|
|
166
|
+
endpointFetch
|
|
167
|
+
};
|
|
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
CliError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IIHZTV6V.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
|
|
11
11
|
var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
|
|
12
12
|
var MAX_SECRET_INPUT = 64 * 1024;
|
|
13
13
|
var policies = /* @__PURE__ */ new WeakMap();
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
|
|
8
8
|
var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
|
|
9
9
|
`The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
|
|
10
10
|
"Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",
|