@wirecat/drive-cli 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bin/drive.js +2 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/bundle/{chunk-ZWSG7OCA.js → all-profiles-WRN35CUF.js} +11 -6
- package/dist/bundle/{anthropic-KW6KU36Y.js → anthropic-DZASXWG3.js} +1 -1
- package/dist/bundle/{app-server-TCJZ333E.js → app-server-4VHT7QZN.js} +33 -41
- package/dist/bundle/{bun-sqlite-RI7DR6RZ.js → bun-sqlite-2GOM5PM3.js} +1 -1
- package/dist/bundle/{chunk-LONV6HIK.js → chunk-2HHOMN2G.js} +440 -25
- package/dist/bundle/{chunk-4A2PIGC6.js → chunk-2PVDFLJJ.js} +8 -3
- package/dist/bundle/{chunk-725OHXKR.js → chunk-3RYX7IB6.js} +2218 -30
- package/dist/bundle/{chunk-CB7SBYLO.js → chunk-54BYJQ77.js} +41 -21
- package/dist/bundle/{chunk-5FONRUG6.js → chunk-5D4AEUVA.js} +1 -23
- package/dist/bundle/{chunk-RNSP57TC.js → chunk-6BNALDGA.js} +1 -1
- package/dist/bundle/{chunk-H47W2J6S.js → chunk-6XYGTRMQ.js} +812 -381
- package/dist/bundle/{chunk-UR32UWTQ.js → chunk-7IUMHMTP.js} +11 -0
- package/dist/bundle/{chunk-W7IK7E4B.js → chunk-BEL4XZ3M.js} +5 -7
- package/dist/bundle/{chunk-43QVYW3K.js → chunk-CL4GVCXS.js} +230 -56
- package/dist/bundle/{chunk-PQYVPCJ2.js → chunk-CNKILAWA.js} +18 -24
- package/dist/bundle/chunk-DOZOLBXE.js +110 -0
- package/dist/bundle/{chunk-2AUXBJRX.js → chunk-DT2YCB2V.js} +84 -11
- package/dist/bundle/{chunk-HQVJK5E7.js → chunk-DZMK255Y.js} +210 -357
- package/dist/bundle/{chunk-G6QF5KWF.js → chunk-E6XDFMRZ.js} +22 -28
- package/dist/bundle/{chunk-DW46P2DY.js → chunk-EKFEY3KP.js} +1 -1
- package/dist/bundle/{chunk-54O62JWP.js → chunk-F3KHUJEE.js} +24 -5
- package/dist/bundle/{chunk-I7UH5CTA.js → chunk-FXWBUTR7.js} +7 -9
- package/dist/bundle/{chunk-ZNZUZGSV.js → chunk-GE4DP24O.js} +131 -4
- package/dist/bundle/{chunk-PEOCBV2Z.js → chunk-GPJEYW2J.js} +1 -1
- package/dist/bundle/{chunk-A4UNTWAX.js → chunk-HM352LJR.js} +84 -15
- package/dist/bundle/{chunk-KYVXMEBC.js → chunk-IAQ4L6SM.js} +1 -1
- package/dist/bundle/{chunk-PQJYM5ES.js → chunk-IJFZKQC4.js} +1 -1
- package/dist/bundle/{chunk-O6IOL6RX.js → chunk-KPBCGUJC.js} +1 -1
- package/dist/bundle/{chunk-XOLQSCMF.js → chunk-KXMJE3XC.js} +2 -2
- package/dist/bundle/{chunk-33NVQGUY.js → chunk-LSGAJYVN.js} +2 -2
- package/dist/bundle/{chunk-2UIMEMWU.js → chunk-MK3N7WX7.js} +1 -1
- package/dist/bundle/{chunk-IDUNJCFO.js → chunk-OQMK6WXQ.js} +1 -1
- package/dist/bundle/{chunk-CM7GAXGD.js → chunk-PC4UA6UN.js} +1 -1
- package/dist/bundle/{chunk-YNFELLNQ.js → chunk-PIMMF67N.js} +2 -2
- package/dist/bundle/{chunk-WBTVGFXI.js → chunk-PR3DA7KA.js} +9 -9
- package/dist/bundle/{chunk-VJZST5RD.js → chunk-QXYGK6G5.js} +1 -1
- package/dist/bundle/{chunk-WQJBAWQP.js → chunk-R4TE4ZSD.js} +549 -224
- package/dist/bundle/{chunk-BSSCTWWK.js → chunk-RNIHKIQP.js} +1 -1
- package/dist/bundle/{chunk-PAXKALHV.js → chunk-SIWBUGBU.js} +116 -5
- package/dist/bundle/{chunk-2623YE5I.js → chunk-SQHPJBNO.js} +6 -8
- package/dist/bundle/chunk-SVTYS36O.js +5305 -0
- package/dist/bundle/{chunk-WLFUBNFX.js → chunk-T334CFU4.js} +2 -2
- package/dist/bundle/{chunk-UC22Q5KU.js → chunk-TZLO3ZZF.js} +16 -16
- package/dist/bundle/{chunk-5PLJKSG4.js → chunk-UFWK3L5Z.js} +4 -6
- package/dist/bundle/{chunk-FCJAHD4R.js → chunk-VTWADVEQ.js} +2 -2
- package/dist/bundle/{chunk-HX7Y2ASG.js → chunk-WJRJBQIM.js} +26040 -15126
- package/dist/bundle/{chunk-VSOLLTYT.js → chunk-YLKQSVLI.js} +5 -0
- package/dist/bundle/{chunk-IWFBAWZK.js → chunk-YQOVVCIA.js} +282 -10
- package/dist/bundle/{chunk-7YMDL4JQ.js → chunk-ZG6X24ON.js} +4 -1
- package/dist/bundle/{command-contract-I2YB5IXI.js → command-contract-D4UG3D33.js} +12 -15
- package/dist/bundle/{decode-EDN2ARXZ.js → decode-WAPM2VBH.js} +1 -1
- package/dist/bundle/drive.js +10 -21
- package/dist/bundle/{embed-3GSQIQXE.js → embed-HW3N3KNP.js} +4 -4
- package/dist/bundle/{embedder-6ULWRG3R.js → embedder-7WNFXYYP.js} +4 -4
- package/dist/bundle/{entry-IPRJLFHO.js → entry-J7YIRDPD.js} +4 -4
- package/dist/bundle/{first-run-FGHGWHC2.js → first-run-53CL2IYH.js} +6 -6
- package/dist/bundle/{first-screen-M62KTPZG.js → first-screen-2KT7HM2K.js} +13 -16
- package/dist/bundle/{google-BD3ZNFVJ.js → google-5NNVARNR.js} +2 -2
- package/dist/bundle/{chunk-GR5GGZKH.js → google-api-EQQH53QD.js} +60 -4
- package/dist/bundle/grants-4NETZ4MR.js +98 -0
- package/dist/bundle/{identity-QLBSASO5.js → identity-LBTXDMTA.js} +4 -2
- package/dist/bundle/{login-VNZKRSAD.js → login-Y6ENYKC3.js} +50 -52
- package/dist/bundle/{node-sqlite-J3OODPYK.js → node-sqlite-FSQIKGED.js} +1 -1
- package/dist/bundle/{oauth-L4VTCBLF.js → oauth-HF5USWXY.js} +5 -5
- package/dist/bundle/{open-SGUN7ZVF.js → open-NHGJENCX.js} +2 -2
- package/dist/bundle/{openai-RLVISEDH.js → openai-3JCJYKNX.js} +6 -6
- package/dist/bundle/{program-6S5EH7BS.js → program-QAJ66K3Z.js} +715 -904
- package/dist/bundle/{prompt-AUWTBLO7.js → prompt-LQJBCCUF.js} +3 -3
- package/dist/bundle/{reasons-M5AKCNCU.js → reasons-J57GSRWN.js} +1 -1
- package/dist/bundle/{recognize-ORX2UBQW.js → recognize-QM3LN4ZF.js} +1 -1
- package/dist/bundle/{remote-AGIJY73X.js → remote-WREGEZJQ.js} +5 -5
- package/dist/bundle/{rerank-R6PE44M5.js → rerank-YFUB6J6M.js} +4 -4
- package/dist/bundle/{chunk-G7DCVJ4F.js → serve-7NFEZ564.js} +7 -4
- package/dist/bundle/{chunk-F7UUZATI.js → server-KBCFZ2AU.js} +38 -11
- package/dist/bundle/server-UYVL2CFI.js +63 -0
- package/dist/bundle/{services-HZFTTZSF.js → services-C3XWRA2W.js} +16 -21
- package/dist/bundle/{sqlite-runtime-DTGPR2T2.js → sqlite-runtime-H3TSAMIN.js} +3 -3
- package/dist/bundle/{state-WG3JKJM3.js → state-S2Q53L6L.js} +3 -3
- package/dist/bundle/{store-33VHIMEO.js → store-H345VQHP.js} +6 -8
- package/dist/bundle/{store-EV72MT5U.js → store-I27LAJPU.js} +7 -9
- package/dist/bundle/store-maintenance-command-3XA73XMC.js +52 -0
- package/dist/bundle/{chunk-GNI7INK6.js → terminal-DHJ4D3BC.js} +2 -3
- package/dist/bundle/tokens-7MUGKFEM.js +96 -0
- package/dist/commands/context.d.ts +14 -13
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +1 -4
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/mirrors.d.ts.map +1 -1
- package/dist/commands/mirrors.js +1 -2
- package/dist/commands/mirrors.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +2 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/upgrade.d.ts +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +4 -9
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/config.d.ts +182 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +38 -3
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +0 -3
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +0 -234
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.d.ts +3 -2
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +17 -22
- package/dist/first-screen.js.map +1 -1
- package/dist/grants.d.ts +9 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +30 -0
- package/dist/grants.js.map +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +2 -0
- package/dist/identity.js.map +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +7 -3
- package/dist/login.js.map +1 -1
- package/dist/policy-keys.d.ts +12 -0
- package/dist/policy-keys.d.ts.map +1 -0
- package/dist/policy-keys.js +107 -0
- package/dist/policy-keys.js.map +1 -0
- package/dist/policy.d.ts +1 -8
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +2 -105
- package/dist/policy.js.map +1 -1
- package/dist/program.d.ts +8 -4
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +251 -222
- package/dist/program.js.map +1 -1
- package/dist/reasons.js +1 -1
- package/dist/reasons.js.map +1 -1
- package/dist/testing/mcp.d.ts +28 -0
- package/dist/testing/mcp.d.ts.map +1 -0
- package/dist/testing/mcp.js +56 -0
- package/dist/testing/mcp.js.map +1 -0
- package/dist/tokens.d.ts +0 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -13
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/scenarios/agent-access.md +4 -2
- package/dist/bundle/all-profiles-CYW6XBBS.js +0 -26
- package/dist/bundle/chunk-234MHU76.js +0 -384
- package/dist/bundle/chunk-4CPLOMRK.js +0 -1714
- package/dist/bundle/chunk-4Z6TCU5T.js +0 -9
- package/dist/bundle/chunk-DO4PDQY5.js +0 -48
- package/dist/bundle/chunk-FDWYPONW.js +0 -1988
- package/dist/bundle/chunk-FQRJWVEB.js +0 -2
- package/dist/bundle/chunk-NPSZPUK6.js +0 -193
- package/dist/bundle/chunk-PDGECM5D.js +0 -138
- package/dist/bundle/chunk-Q765VPZY.js +0 -421
- package/dist/bundle/chunk-WQRGA75U.js +0 -256
- package/dist/bundle/chunk-X6ID5EAR.js +0 -522
- package/dist/bundle/chunk-YVPHJHIL.js +0 -15572
- package/dist/bundle/chunk-Z47LOJUS.js +0 -484
- package/dist/bundle/failure-4CVEVY45.js +0 -37
- package/dist/bundle/google-api-BDUWZMRV.js +0 -83
- package/dist/bundle/mcp-5SNSMI2M.js +0 -502
- package/dist/bundle/mcp-JZSYPQA4.js +0 -96
- package/dist/bundle/serve-VOBAQHAQ.js +0 -20
- package/dist/bundle/server-24PS4M7U.js +0 -70
- package/dist/bundle/server-G6HFZ2CK.js +0 -57
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +0 -58
- package/dist/bundle/terminal-TFCTWLOS.js +0 -11
- package/dist/bundle/tokens-XDQXUFDQ.js +0 -104
- package/dist/commands/doctor.d.ts +0 -56
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -75
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -6
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -156
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/skill.d.ts +0 -6
- package/dist/commands/skill.d.ts.map +0 -1
- package/dist/commands/skill.js +0 -34
- package/dist/commands/skill.js.map +0 -1
- package/dist/failure.d.ts +0 -88
- package/dist/failure.d.ts.map +0 -1
- package/dist/failure.js +0 -60
- package/dist/failure.js.map +0 -1
- package/dist/mcp.d.ts +0 -175
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -412
- package/dist/mcp.js.map +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
VERSION
|
|
5
|
+
} from "./chunk-2PVDFLJJ.js";
|
|
6
|
+
import {
|
|
7
|
+
annotate,
|
|
8
|
+
commandsDocument,
|
|
9
|
+
describeProgram,
|
|
10
|
+
flatten,
|
|
11
|
+
profileFree
|
|
12
|
+
} from "./chunk-3RYX7IB6.js";
|
|
13
|
+
import {
|
|
14
|
+
CliError
|
|
15
|
+
} from "./chunk-YKZ4IPLB.js";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
19
|
+
|
|
20
|
+
// dist/registry.js
|
|
21
|
+
var ACCOUNT_FREE_COMMANDS = /* @__PURE__ */ new Set([
|
|
22
|
+
"commands",
|
|
23
|
+
"commands info",
|
|
24
|
+
"models list",
|
|
25
|
+
"complete",
|
|
26
|
+
"doctor",
|
|
27
|
+
"upgrade",
|
|
28
|
+
"api show",
|
|
29
|
+
"api list",
|
|
30
|
+
"help",
|
|
31
|
+
"guide",
|
|
32
|
+
"skill show",
|
|
33
|
+
"skill install",
|
|
34
|
+
"skill status",
|
|
35
|
+
"models download",
|
|
36
|
+
"images models download",
|
|
37
|
+
"runs list",
|
|
38
|
+
"runs show",
|
|
39
|
+
"runs path"
|
|
40
|
+
]);
|
|
41
|
+
var PROFILE_SET_COMMANDS = /* @__PURE__ */ new Set([
|
|
42
|
+
"mcp serve",
|
|
43
|
+
"mcp revoke",
|
|
44
|
+
"mcp server start",
|
|
45
|
+
"mcp server stop",
|
|
46
|
+
"mcp server status"
|
|
47
|
+
]);
|
|
48
|
+
var ANY_PROFILE_COMMANDS = /* @__PURE__ */ new Set([
|
|
49
|
+
"commands",
|
|
50
|
+
"commands info",
|
|
51
|
+
"complete",
|
|
52
|
+
"config show",
|
|
53
|
+
"session list",
|
|
54
|
+
"store info"
|
|
55
|
+
]);
|
|
56
|
+
var PROFILE_FREE_COMMANDS = /* @__PURE__ */ new Set([...ACCOUNT_FREE_COMMANDS, ...ANY_PROFILE_COMMANDS]);
|
|
57
|
+
var GOOGLE_READ = { remote: "read", local: "none" };
|
|
58
|
+
var GOOGLE_WRITE = { remote: "write", local: "none" };
|
|
59
|
+
var examples = /* @__PURE__ */ __name((command, lines) => annotate(command, { examples: lines }), "examples");
|
|
60
|
+
var CONTRACT = 4;
|
|
61
|
+
var isProfileFree = /* @__PURE__ */ __name((info) => PROFILE_FREE_COMMANDS.has(info.path.join(" ")) || info.commands.length > 0 && info.commands.every(isProfileFree), "isProfileFree");
|
|
62
|
+
var markProfileFree = /* @__PURE__ */ __name((program) => {
|
|
63
|
+
for (const info of flatten(describeProgram(program))) {
|
|
64
|
+
if (!isProfileFree(info))
|
|
65
|
+
continue;
|
|
66
|
+
let command = program;
|
|
67
|
+
for (const word of info.path)
|
|
68
|
+
command = command.commands.find((one) => one.name() === word) ?? command;
|
|
69
|
+
profileFree(command);
|
|
70
|
+
}
|
|
71
|
+
}, "markProfileFree");
|
|
72
|
+
var describeDriveProgram = /* @__PURE__ */ __name((program) => {
|
|
73
|
+
const scoped = /* @__PURE__ */ __name((info) => ({
|
|
74
|
+
...info,
|
|
75
|
+
usage: isProfileFree(info) ? info.usage : info.usage.replace(/^drive /, "drive <profile> "),
|
|
76
|
+
commands: info.commands.map(scoped)
|
|
77
|
+
}), "scoped");
|
|
78
|
+
return describeProgram(program).map(scoped);
|
|
79
|
+
}, "describeDriveProgram");
|
|
80
|
+
var commandsDocument2 = /* @__PURE__ */ __name((program, path = []) => {
|
|
81
|
+
const all = describeDriveProgram(program);
|
|
82
|
+
const inherited = [];
|
|
83
|
+
let available = all;
|
|
84
|
+
let found;
|
|
85
|
+
for (const word of path) {
|
|
86
|
+
if (found?.options.length)
|
|
87
|
+
inherited.push({ path: [...found.path], options: [...found.options] });
|
|
88
|
+
found = available.find((command) => command.name === word);
|
|
89
|
+
if (!found)
|
|
90
|
+
throw new CliError("not_found", "command path was not found");
|
|
91
|
+
available = [...found.commands];
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
...commandsDocument(program, { cli: "drive", version: VERSION, contract: CONTRACT }),
|
|
95
|
+
...found ? { scope: [...found.path], inherited_options: inherited } : {},
|
|
96
|
+
commands: found ? [found] : all
|
|
97
|
+
};
|
|
98
|
+
}, "commandsDocument");
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
ACCOUNT_FREE_COMMANDS,
|
|
102
|
+
PROFILE_SET_COMMANDS,
|
|
103
|
+
ANY_PROFILE_COMMANDS,
|
|
104
|
+
GOOGLE_READ,
|
|
105
|
+
GOOGLE_WRITE,
|
|
106
|
+
examples,
|
|
107
|
+
markProfileFree,
|
|
108
|
+
describeDriveProgram,
|
|
109
|
+
commandsDocument2 as commandsDocument
|
|
110
|
+
};
|
|
@@ -3,28 +3,26 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
AUDIT_MIN_SCORE,
|
|
5
5
|
throughWrapper
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6XYGTRMQ.js";
|
|
7
7
|
import {
|
|
8
|
+
Command,
|
|
9
|
+
InvalidArgumentError,
|
|
10
|
+
Option,
|
|
11
|
+
annotate,
|
|
8
12
|
environmentOf,
|
|
9
13
|
itemOf,
|
|
10
14
|
listOf,
|
|
11
15
|
nextStep,
|
|
12
16
|
renderAnswer,
|
|
17
|
+
sharedCommand,
|
|
13
18
|
snakeKeys
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
Command,
|
|
17
|
-
InvalidArgumentError,
|
|
18
|
-
Option,
|
|
19
|
-
annotate,
|
|
20
|
-
sharedCommand
|
|
21
|
-
} from "./chunk-725OHXKR.js";
|
|
19
|
+
} from "./chunk-3RYX7IB6.js";
|
|
22
20
|
import {
|
|
23
21
|
readOnlyLockOf
|
|
24
22
|
} from "./chunk-ZDLIO76S.js";
|
|
25
23
|
import {
|
|
26
24
|
formatReference
|
|
27
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-R4TE4ZSD.js";
|
|
28
26
|
import {
|
|
29
27
|
EVENT_QUERY,
|
|
30
28
|
MEETING_PROJECT_EVIDENCE_QUERY,
|
|
@@ -47,7 +45,7 @@ import {
|
|
|
47
45
|
readMeetingProjectEvidence,
|
|
48
46
|
validateMeetingHitSearch,
|
|
49
47
|
validateMeetingPassage
|
|
50
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-GE4DP24O.js";
|
|
51
49
|
import {
|
|
52
50
|
OPERATORS_BY_TYPE,
|
|
53
51
|
dateRange,
|
|
@@ -949,6 +947,79 @@ var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) =
|
|
|
949
947
|
socket.end();
|
|
950
948
|
}
|
|
951
949
|
}, "serve");
|
|
950
|
+
var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
|
|
951
|
+
const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
|
|
952
|
+
const socket = createConnection(path);
|
|
953
|
+
let connected = false;
|
|
954
|
+
let settled = false;
|
|
955
|
+
let timer;
|
|
956
|
+
const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
|
|
957
|
+
const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
|
|
958
|
+
const brokenPipe = /* @__PURE__ */ __name((error) => {
|
|
959
|
+
if (error.code === "EPIPE")
|
|
960
|
+
finish({ code: 0 });
|
|
961
|
+
}, "brokenPipe");
|
|
962
|
+
const finish = /* @__PURE__ */ __name((outcome) => {
|
|
963
|
+
if (settled)
|
|
964
|
+
return;
|
|
965
|
+
settled = true;
|
|
966
|
+
if (timer)
|
|
967
|
+
clearTimeout(timer);
|
|
968
|
+
stdout.off("error", brokenPipe);
|
|
969
|
+
signal.removeEventListener("abort", aborted);
|
|
970
|
+
stdin.off("data", forward).off("end", ended);
|
|
971
|
+
stdin.pause();
|
|
972
|
+
socket.destroy();
|
|
973
|
+
if ("code" in outcome)
|
|
974
|
+
resolve(outcome.code);
|
|
975
|
+
else
|
|
976
|
+
reject(outcome.error);
|
|
977
|
+
}, "finish");
|
|
978
|
+
const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
|
|
979
|
+
const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
|
|
980
|
+
if (signal.aborted)
|
|
981
|
+
return aborted();
|
|
982
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
983
|
+
stdout.on("error", brokenPipe);
|
|
984
|
+
if (deadlineMs !== void 0)
|
|
985
|
+
timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
|
|
986
|
+
socket.on("connect", () => {
|
|
987
|
+
connected = true;
|
|
988
|
+
frame(socket, { v: RELAY_PROTOCOL, run: request });
|
|
989
|
+
if (request.stdinTty)
|
|
990
|
+
ended();
|
|
991
|
+
else {
|
|
992
|
+
stdin.on("data", forward).once("end", ended);
|
|
993
|
+
stdin.resume();
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
socket.on("error", (error) => {
|
|
997
|
+
if (connected)
|
|
998
|
+
return finish({ error: stopped() });
|
|
999
|
+
finish({
|
|
1000
|
+
error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
socket.on("close", () => finish({ error: stopped() }));
|
|
1004
|
+
lines2(socket, MAX_SERVE_LINE, (line) => {
|
|
1005
|
+
let message;
|
|
1006
|
+
try {
|
|
1007
|
+
message = JSON.parse(line);
|
|
1008
|
+
} catch {
|
|
1009
|
+
return finish({ error: stopped() });
|
|
1010
|
+
}
|
|
1011
|
+
if (typeof message.data === "string")
|
|
1012
|
+
streams.data(message.data);
|
|
1013
|
+
if (typeof message.diagnostic === "string")
|
|
1014
|
+
streams.diagnostic(message.diagnostic);
|
|
1015
|
+
if (typeof message.progress === "string")
|
|
1016
|
+
streams.progress?.(message.progress);
|
|
1017
|
+
if (typeof message.raw === "string")
|
|
1018
|
+
stdout.write(Buffer.from(message.raw, "base64"));
|
|
1019
|
+
if (typeof message.exit === "number")
|
|
1020
|
+
finish({ code: message.exit });
|
|
1021
|
+
}, () => finish({ error: stopped() }));
|
|
1022
|
+
}), "relayCommand");
|
|
952
1023
|
|
|
953
1024
|
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
954
1025
|
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
@@ -1039,6 +1110,8 @@ export {
|
|
|
1039
1110
|
lackedNeed,
|
|
1040
1111
|
refuseLacking,
|
|
1041
1112
|
hideNever,
|
|
1113
|
+
RELAY_PROTOCOL,
|
|
1114
|
+
relayCommand,
|
|
1042
1115
|
lentConnection,
|
|
1043
1116
|
serveRelay,
|
|
1044
1117
|
meetingPassageRequest,
|