@wirecat/tg-cli 0.120.0 → 0.122.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 +25 -3
- package/dist/bin/tg.js +2 -2
- package/dist/bundle/{adapter-OJKHXGBC.js → adapter-ZI57T2L5.js} +53 -49
- package/dist/bundle/{all-profiles-URIWNL23.js → all-profiles-7VXJF42C.js} +6 -6
- package/dist/bundle/{anthropic-YUKNB63B.js → anthropic-DKRXIWVV.js} +13 -4
- package/dist/bundle/{app-server-H5QNHGH4.js → app-server-F5MKHZ7S.js} +43 -42
- package/dist/bundle/{bot-api-27GN4Y3D.js → bot-api-F24NWJT3.js} +47 -44
- package/dist/bundle/{bot-history-VVSWLVZM.js → bot-history-U3WM3A7S.js} +12 -12
- package/dist/bundle/{bun-PAAJX3GU.js → bun-OMTJAXGK.js} +2 -2
- package/dist/bundle/{bun-sqlite-TPEBWFZH.js → bun-sqlite-HSYLO46A.js} +2 -2
- package/dist/bundle/{chunk-WLBPNLDF.js → chunk-27SVHRHV.js} +2 -2
- package/dist/bundle/{chunk-3FPFRDG2.js → chunk-2FXA32RJ.js} +6 -6
- package/dist/bundle/{chunk-4JATS2J5.js → chunk-2UHANFLM.js} +2 -2
- package/dist/bundle/{chunk-FPWXG53C.js → chunk-33ELXJRR.js} +37 -121
- package/dist/bundle/{chunk-KP26Y5OA.js → chunk-4MFMUBHH.js} +4901 -4827
- package/dist/bundle/{chunk-HDSKBXAF.js → chunk-4N2WJYLE.js} +2 -2
- package/dist/bundle/{chunk-7WS3ULOO.js → chunk-6DLRATDC.js} +1159 -801
- package/dist/bundle/{chunk-YQKEPT22.js → chunk-6LMEIELG.js} +1 -1
- package/dist/bundle/{chunk-DH7VKHTZ.js → chunk-7FWU4RON.js} +3 -3
- package/dist/bundle/{chunk-4OWY7QBE.js → chunk-7GCVON7M.js} +5 -5
- package/dist/bundle/{chunk-HIBYYKGO.js → chunk-7X6YLKTK.js} +1 -1
- package/dist/bundle/{chunk-D2WNQJUQ.js → chunk-ALW7ROTM.js} +1 -1
- package/dist/bundle/{chunk-6XHZV7AQ.js → chunk-ARKB3M5X.js} +3 -3
- package/dist/bundle/{chunk-KTV5Y5EX.js → chunk-C5CB6RIX.js} +1 -1
- package/dist/bundle/{chunk-7VNV426X.js → chunk-CB6AHU6H.js} +44 -22
- package/dist/bundle/{chunk-CGUDXNJE.js → chunk-CW3C7FSO.js} +1 -1
- package/dist/bundle/{chunk-3SANNNWS.js → chunk-D3ODL4P7.js} +2 -2
- package/dist/bundle/{chunk-34DSPJNN.js → chunk-DCGGZUNJ.js} +2 -2
- package/dist/bundle/{chunk-CYWV2RLN.js → chunk-DDSAJKPO.js} +4 -4
- package/dist/bundle/{chunk-KRCMKFUV.js → chunk-DTTONQW7.js} +1 -1
- package/dist/bundle/{chunk-PDYTNTQI.js → chunk-E3MFMMVY.js} +5 -5
- package/dist/bundle/{chunk-ZON7K5QE.js → chunk-FHWUOFWX.js} +2 -2
- package/dist/bundle/{chunk-ZRRZTPSB.js → chunk-FYHFAOPM.js} +2219 -1052
- package/dist/bundle/{chunk-H5XC2WYO.js → chunk-FZKHFTKH.js} +22 -22
- package/dist/bundle/{chunk-THJHYMFR.js → chunk-GJBGZQHN.js} +3626 -3596
- package/dist/bundle/{chunk-DDKFAUQD.js → chunk-GJFICFQB.js} +1 -1
- package/dist/bundle/{chunk-CLURRDNU.js → chunk-HAR76KJG.js} +4 -4
- package/dist/bundle/{chunk-JJY3TQTM.js → chunk-LQRZUNYF.js} +2 -2
- package/dist/bundle/{chunk-LLCGOZ44.js → chunk-MFWWZ6XL.js} +2 -2
- package/dist/bundle/{chunk-LS72R7DN.js → chunk-N7WDVH2O.js} +37 -35
- package/dist/bundle/chunk-NE3EGYPD.js +109 -0
- package/dist/bundle/{chunk-YBOVL25O.js → chunk-NU4RMUMQ.js} +16 -16
- package/dist/bundle/{chunk-JQLGS3SG.js → chunk-O5A4IS2D.js} +1 -1
- package/dist/bundle/{chunk-DE7QIEUP.js → chunk-PG3V225O.js} +30 -49
- package/dist/bundle/{chunk-WQ55F4Y3.js → chunk-QROAXWDU.js} +7 -7
- package/dist/bundle/{chunk-U2TPRUWK.js → chunk-R2IW6JBV.js} +81 -81
- package/dist/bundle/{chunk-CLTMVPGT.js → chunk-RFFU6KQ5.js} +12 -12
- package/dist/bundle/{chunk-DQTQO6PB.js → chunk-SODUFMDW.js} +1651 -948
- package/dist/bundle/{chunk-KW6JZGG3.js → chunk-TKJZENAZ.js} +1 -1
- package/dist/bundle/{chunk-B7B65ZLU.js → chunk-UGEYQWEO.js} +1 -1
- package/dist/bundle/chunk-V4BPS7MH.js +185 -0
- package/dist/bundle/{chunk-3GLLWDM6.js → chunk-VC6J7X76.js} +16 -16
- package/dist/bundle/{chunk-S6OC367D.js → chunk-VDFEWSCS.js} +2 -2
- package/dist/bundle/{chunk-KLHOQ6XQ.js → chunk-VQL4RVXZ.js} +3 -1
- package/dist/bundle/{chunk-JSEIT2WO.js → chunk-W34QQMBK.js} +1 -1
- package/dist/bundle/{chunk-MMPISXSU.js → chunk-Y52T5EMB.js} +1 -1
- package/dist/bundle/{chunk-MTD6WZKV.js → chunk-Y74WJL3M.js} +6 -6
- package/dist/bundle/chunk-YDMKP7PO.js +18 -0
- package/dist/bundle/{chunk-VUUR2SRS.js → chunk-YFEH7OWG.js} +33 -16
- package/dist/bundle/{chunk-YDROJG2Y.js → chunk-ZKHXWSKD.js} +4 -4
- package/dist/bundle/{chunk-7N4IUEX3.js → chunk-ZNPRTCUO.js} +6 -6
- package/dist/bundle/{command-contract-KW6FNOJO.js → command-contract-247AKZTE.js} +12 -12
- package/dist/bundle/command-server-entry-N32NX4QW.js +162 -0
- package/dist/bundle/{decode-RVWSCZW4.js → decode-ZKJWSFXF.js} +2 -2
- package/dist/bundle/{echarts-6VNUD3JF.js → echarts-QLVLIP73.js} +2 -2
- package/dist/bundle/{embed-LWLCQKIK.js → embed-LC6K7P3S.js} +3 -3
- package/dist/bundle/{embedder-CXKHLRJT.js → embedder-6C3OQBOV.js} +6 -6
- package/dist/bundle/{entry-HV4NSX3Z.js → entry-5H6LB3MP.js} +7 -4
- package/dist/bundle/{first-run-OPI6NIWQ.js → first-run-IOYQ4XQK.js} +5 -5
- package/dist/bundle/{first-screen-BVQLF4LN.js → first-screen-NVK7PFX4.js} +13 -13
- package/dist/bundle/{instructions-TK4HXL3A.js → instructions-SZUMEDY3.js} +1 -1
- package/dist/bundle/{node-WFPNBUCU.js → node-V76RRFIA.js} +2 -2
- package/dist/bundle/{node-sqlite-L5BRGJLK.js → node-sqlite-2DTVOT7L.js} +3 -3
- package/dist/bundle/{oauth-CGVWL35B.js → oauth-CT7EBDRY.js} +4 -4
- package/dist/bundle/{open-HLL55C5S.js → open-G3VHOOMV.js} +2 -2
- package/dist/bundle/{openai-YFCNXIJ4.js → openai-F4K7MVTZ.js} +13 -13
- package/dist/bundle/{process-4A5JP5LO.js → process-XH3KEHSF.js} +1 -1
- package/dist/bundle/{program-IFGQGSUF.js → program-FLGIHTHM.js} +63 -60
- package/dist/bundle/{prompt-B5FYE2DQ.js → prompt-JWQ6UQ6R.js} +2 -2
- package/dist/bundle/{recognize-ZHMHGIV3.js → recognize-Z26T3SYD.js} +1 -1
- package/dist/bundle/{remote-A3W5HE52.js → remote-7KHT6V3O.js} +4 -4
- package/dist/bundle/{rerank-HWJAQOZM.js → rerank-6QVI74QY.js} +4 -4
- package/dist/bundle/{serve-PP326Q2F.js → serve-WYDZTONY.js} +11 -11
- package/dist/bundle/server-UXQT7LZT.js +61 -0
- package/dist/bundle/{server-MV6CL63L.js → server-Y4J2NCFA.js} +32 -32
- package/dist/bundle/{state-Y3RJ7ZXB.js → state-YCXBKOD2.js} +3 -3
- package/dist/bundle/{store-EVNI2MHZ.js → store-QECSDJRP.js} +9 -9
- package/dist/bundle/store-maintenance-command-5YW6TRJA.js +49 -0
- package/dist/bundle/tg.js +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/bundle/server-TZGGOJ26.js +0 -60
- package/dist/bundle/store-maintenance-command-XPQE47RE.js +0 -49
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isCliFailure,
|
|
5
5
|
secretNamed,
|
|
6
6
|
withoutSecrets
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-27SVHRHV.js";
|
|
8
8
|
import {
|
|
9
9
|
isContentKey
|
|
10
10
|
} from "./chunk-U6HEZPCR.js";
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
__name
|
|
13
13
|
} from "./chunk-ZVVMGPBJ.js";
|
|
14
14
|
|
|
15
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/run-context.js
|
|
16
16
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
18
18
|
|
|
19
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
|
|
20
20
|
import { homedir } from "node:os";
|
|
21
21
|
|
|
22
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/events.js
|
|
23
23
|
var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
|
|
24
24
|
var renderEvent = /* @__PURE__ */ __name((event) => {
|
|
25
25
|
if (event.event === "store")
|
|
@@ -69,7 +69,7 @@ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!
|
|
|
69
69
|
var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
|
|
70
70
|
var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
|
|
71
71
|
|
|
72
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
72
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
|
|
73
73
|
var MESSAGE_AT_MOST = 500;
|
|
74
74
|
var CAUSES_AT_MOST = 5;
|
|
75
75
|
var FRAMES_AT_MOST = 15;
|
|
@@ -178,7 +178,7 @@ var redactText = /* @__PURE__ */ __name((text) => {
|
|
|
178
178
|
return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
|
|
179
179
|
}, "redactText");
|
|
180
180
|
|
|
181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
181
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/runs/run-context.js
|
|
182
182
|
var REDACTED = "[redacted]";
|
|
183
183
|
var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
|
|
184
184
|
if (!record)
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
id,
|
|
6
6
|
text,
|
|
7
7
|
time
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4MFMUBHH.js";
|
|
9
9
|
import {
|
|
10
10
|
array,
|
|
11
11
|
nullable,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
unknown
|
|
19
19
|
} from "./chunk-WGGSFGNZ.js";
|
|
20
20
|
|
|
21
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/entities/note.js
|
|
22
22
|
var link = {
|
|
23
23
|
target_text: nullable(text),
|
|
24
24
|
kind: text,
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ensureSqlite,
|
|
5
|
+
isCommandServer
|
|
6
|
+
} from "./chunk-NE3EGYPD.js";
|
|
3
7
|
import {
|
|
4
8
|
envName,
|
|
5
9
|
readOnlyLockOf
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
CAPABILITY_STATEMENTS,
|
|
9
|
-
storeCapable
|
|
10
|
-
} from "./chunk-PDYTNTQI.js";
|
|
10
|
+
} from "./chunk-GJFICFQB.js";
|
|
11
11
|
import {
|
|
12
12
|
catchCrashes
|
|
13
13
|
} from "./chunk-WGGSFGNZ.js";
|
|
14
|
-
import {
|
|
15
|
-
importFrom
|
|
16
|
-
} from "./chunk-Y5E2WNWB.js";
|
|
17
14
|
import {
|
|
18
15
|
CliError
|
|
19
16
|
} from "./chunk-VUBZFMGP.js";
|
|
@@ -21,98 +18,10 @@ import {
|
|
|
21
18
|
__name
|
|
22
19
|
} from "./chunk-ZVVMGPBJ.js";
|
|
23
20
|
|
|
24
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25
|
-
import { spawn
|
|
21
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/cli/entry.js
|
|
22
|
+
import { spawn } from "node:child_process";
|
|
26
23
|
|
|
27
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
29
|
-
import { readFileSync } from "node:fs";
|
|
30
|
-
import { dirname } from "node:path";
|
|
31
|
-
var RESTARTED = "CLI_MESSAGING_SQLITE_RESTARTED";
|
|
32
|
-
var USER_LIBRARY_PATH = "CLI_MESSAGING_USER_LD_LIBRARY_PATH";
|
|
33
|
-
var FORWARDED = ["SIGTERM", "SIGHUP", "SIGQUIT"];
|
|
34
|
-
var ensureSqlite = /* @__PURE__ */ __name(async (runtime = nodeRuntime()) => {
|
|
35
|
-
const { env } = runtime;
|
|
36
|
-
if (env[RESTARTED]) {
|
|
37
|
-
if (env[USER_LIBRARY_PATH] === void 0)
|
|
38
|
-
delete env.LD_LIBRARY_PATH;
|
|
39
|
-
else
|
|
40
|
-
env.LD_LIBRARY_PATH = env[USER_LIBRARY_PATH];
|
|
41
|
-
delete env[USER_LIBRARY_PATH];
|
|
42
|
-
delete env[RESTARTED];
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (runtime.bun || runtime.platform !== "linux")
|
|
46
|
-
return;
|
|
47
|
-
const maps = runtime.maps();
|
|
48
|
-
if (!maps.includes("libsqlite3"))
|
|
49
|
-
return;
|
|
50
|
-
if (await runtime.capable())
|
|
51
|
-
return;
|
|
52
|
-
const library = await runtime.library(maps.includes("ld-musl"));
|
|
53
|
-
if (!library)
|
|
54
|
-
return;
|
|
55
|
-
const restarted = {
|
|
56
|
-
...env,
|
|
57
|
-
LD_LIBRARY_PATH: [dirname(library.path), env.LD_LIBRARY_PATH].filter(Boolean).join(":"),
|
|
58
|
-
[RESTARTED]: "1"
|
|
59
|
-
};
|
|
60
|
-
if (env.LD_LIBRARY_PATH !== void 0)
|
|
61
|
-
restarted[USER_LIBRARY_PATH] = env.LD_LIBRARY_PATH;
|
|
62
|
-
if (!runtime.works(restarted, library.version))
|
|
63
|
-
return;
|
|
64
|
-
await runtime.restart(restarted);
|
|
65
|
-
}, "ensureSqlite");
|
|
66
|
-
var trialScript = /* @__PURE__ */ __name((version) => `
|
|
67
|
-
const { DatabaseSync } = await import("node:sqlite")
|
|
68
|
-
const database = new DatabaseSync(":memory:")
|
|
69
|
-
if (database.prepare("SELECT sqlite_version() AS v").get().v !== ${JSON.stringify(version)}) process.exit(1)
|
|
70
|
-
for (const statement of ${JSON.stringify(CAPABILITY_STATEMENTS)}) database.exec(statement)
|
|
71
|
-
`, "trialScript");
|
|
72
|
-
var nodeRuntime = /* @__PURE__ */ __name(() => ({
|
|
73
|
-
env: process.env,
|
|
74
|
-
platform: process.platform,
|
|
75
|
-
bun: "Bun" in globalThis,
|
|
76
|
-
maps: /* @__PURE__ */ __name(() => {
|
|
77
|
-
try {
|
|
78
|
-
return readFileSync("/proc/self/maps", "utf8");
|
|
79
|
-
} catch {
|
|
80
|
-
return "";
|
|
81
|
-
}
|
|
82
|
-
}, "maps"),
|
|
83
|
-
capable: /* @__PURE__ */ __name(() => storeCapable().then(() => true, () => false), "capable"),
|
|
84
|
-
library: /* @__PURE__ */ __name(async (musl) => {
|
|
85
|
-
try {
|
|
86
|
-
const { libraryFor, SQLITE_VERSION } = await importFrom(new URL("sqlite-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
|
|
87
|
-
const path = libraryFor({ musl });
|
|
88
|
-
return path === void 0 ? void 0 : { path, version: SQLITE_VERSION };
|
|
89
|
-
} catch {
|
|
90
|
-
return void 0;
|
|
91
|
-
}
|
|
92
|
-
}, "library"),
|
|
93
|
-
works: /* @__PURE__ */ __name((env, version) => spawnSync(process.execPath, ["--no-warnings", "--input-type=module", "-e", trialScript(version)], {
|
|
94
|
-
env,
|
|
95
|
-
stdio: "ignore",
|
|
96
|
-
timeout: 1e4
|
|
97
|
-
}).status === 0, "works"),
|
|
98
|
-
restart: /* @__PURE__ */ __name((env) => relay(spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], { env, stdio: "inherit" })), "restart")
|
|
99
|
-
}), "nodeRuntime");
|
|
100
|
-
var relay = /* @__PURE__ */ __name((child, host = process) => new Promise(() => {
|
|
101
|
-
for (const signal of FORWARDED)
|
|
102
|
-
host.on(signal, () => child.kill(signal));
|
|
103
|
-
host.on("SIGINT", () => {
|
|
104
|
-
});
|
|
105
|
-
child.on("error", () => host.exit(1));
|
|
106
|
-
child.on("exit", (code, signal) => {
|
|
107
|
-
if (signal) {
|
|
108
|
-
host.removeAllListeners(signal);
|
|
109
|
-
host.kill(host.pid, signal);
|
|
110
|
-
} else
|
|
111
|
-
host.exit(code ?? 1);
|
|
112
|
-
});
|
|
113
|
-
}), "relay");
|
|
114
|
-
|
|
115
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/argv-log.js
|
|
24
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/cli/argv-log.js
|
|
116
25
|
import { appendFileSync } from "node:fs";
|
|
117
26
|
var logParsedArgv = /* @__PURE__ */ __name((file, action) => {
|
|
118
27
|
const words = [];
|
|
@@ -136,7 +45,7 @@ var logVersion = /* @__PURE__ */ __name((file) => {
|
|
|
136
45
|
`);
|
|
137
46
|
}, "logVersion");
|
|
138
47
|
|
|
139
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
48
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._c57a4ca23893bad5bbd6c181f9c73774/node_modules/@wirecat/cli-core/dist/cli/entry.js
|
|
140
49
|
var processIo = /* @__PURE__ */ __name(() => ({
|
|
141
50
|
argv: process.argv,
|
|
142
51
|
env: process.env,
|
|
@@ -148,13 +57,17 @@ var processIo = /* @__PURE__ */ __name(() => ({
|
|
|
148
57
|
setExitCode: /* @__PURE__ */ __name((code) => {
|
|
149
58
|
process.exitCode = code;
|
|
150
59
|
}, "setExitCode"),
|
|
151
|
-
spawn
|
|
60
|
+
spawn
|
|
152
61
|
}), "processIo");
|
|
153
62
|
var startCli = /* @__PURE__ */ __name(async (entry) => {
|
|
154
63
|
const io = { ...processIo(), ...entry.io };
|
|
155
64
|
const args = io.argv.slice(2);
|
|
156
65
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-V"))
|
|
157
66
|
return printVersion(entry.app, io);
|
|
67
|
+
if (isCommandServer(args)) {
|
|
68
|
+
const { serveEntry } = await import("./command-server-entry-N32NX4QW.js");
|
|
69
|
+
return serveEntry(entry, io, { firstRunAt, commanderExit });
|
|
70
|
+
}
|
|
158
71
|
const tty = io.stdout.isTTY === true;
|
|
159
72
|
const release = catchCrashes({
|
|
160
73
|
cli: entry.app.command,
|
|
@@ -186,27 +99,11 @@ var startCli = /* @__PURE__ */ __name(async (entry) => {
|
|
|
186
99
|
env: io.env,
|
|
187
100
|
tty,
|
|
188
101
|
signal: controller.signal,
|
|
189
|
-
atStart:
|
|
190
|
-
if (command.optsWithGlobals().dryRun === true)
|
|
191
|
-
return;
|
|
192
|
-
const [{ setupAtStart }, { commandPathOf }] = await Promise.all([
|
|
193
|
-
import("./first-run-OPI6NIWQ.js"),
|
|
194
|
-
import("./command-contract-KW6FNOJO.js")
|
|
195
|
-
]);
|
|
196
|
-
await setupAtStart({
|
|
197
|
-
command: entry.app.command,
|
|
198
|
-
env: io.env,
|
|
199
|
-
contentLanguages: entry.app.contentLanguages,
|
|
200
|
-
path: commandPathOf(command),
|
|
201
|
-
headless: headless(command),
|
|
202
|
-
readOnlyLock: readOnlyLockOf(entry.app, io.env),
|
|
203
|
-
input: io.stdin
|
|
204
|
-
});
|
|
205
|
-
}, "atStart"),
|
|
102
|
+
atStart: firstRunAt(entry, io, headless),
|
|
206
103
|
ask: /* @__PURE__ */ __name(async (question, command) => {
|
|
207
104
|
if (headless(command) || io.stdin.isTTY !== true)
|
|
208
105
|
return false;
|
|
209
|
-
const { readSecret } = await import("./prompt-
|
|
106
|
+
const { readSecret } = await import("./prompt-JWQ6UQ6R.js");
|
|
210
107
|
const answer = await readSecret(`${question} [y/N] `, {
|
|
211
108
|
input: io.stdin,
|
|
212
109
|
output: io.stderr,
|
|
@@ -219,7 +116,8 @@ var startCli = /* @__PURE__ */ __name(async (entry) => {
|
|
|
219
116
|
if (!headless(command))
|
|
220
117
|
await openBrowser(url, browser, io);
|
|
221
118
|
}, "openBrowser"),
|
|
222
|
-
outputClosed: /* @__PURE__ */ __name(() => closed, "outputClosed")
|
|
119
|
+
outputClosed: /* @__PURE__ */ __name(() => closed, "outputClosed"),
|
|
120
|
+
setExitCode: io.setExitCode
|
|
223
121
|
};
|
|
224
122
|
let code;
|
|
225
123
|
try {
|
|
@@ -244,6 +142,23 @@ var startCli = /* @__PURE__ */ __name(async (entry) => {
|
|
|
244
142
|
else if (code !== void 0)
|
|
245
143
|
io.setExitCode(code);
|
|
246
144
|
}, "startCli");
|
|
145
|
+
var firstRunAt = /* @__PURE__ */ __name((entry, io, headless) => async (command) => {
|
|
146
|
+
if (command.optsWithGlobals().dryRun === true)
|
|
147
|
+
return;
|
|
148
|
+
const [{ setupAtStart }, { commandPathOf }] = await Promise.all([
|
|
149
|
+
import("./first-run-IOYQ4XQK.js"),
|
|
150
|
+
import("./command-contract-247AKZTE.js")
|
|
151
|
+
]);
|
|
152
|
+
await setupAtStart({
|
|
153
|
+
command: entry.app.command,
|
|
154
|
+
env: io.env,
|
|
155
|
+
contentLanguages: entry.app.contentLanguages,
|
|
156
|
+
path: commandPathOf(command),
|
|
157
|
+
headless: headless(command),
|
|
158
|
+
readOnlyLock: readOnlyLockOf(entry.app, io.env),
|
|
159
|
+
input: io.stdin
|
|
160
|
+
});
|
|
161
|
+
}, "firstRunAt");
|
|
247
162
|
var printVersion = /* @__PURE__ */ __name((app, io) => {
|
|
248
163
|
const argvLog = io.env[envName(app, "TEST_ARGV_LOG")];
|
|
249
164
|
if (argvLog)
|
|
@@ -261,7 +176,7 @@ var commanderExit = /* @__PURE__ */ __name((error) => {
|
|
|
261
176
|
return 0;
|
|
262
177
|
return code === "commander.help" ? 2 : void 0;
|
|
263
178
|
}, "commanderExit");
|
|
264
|
-
var openBrowser = /* @__PURE__ */ __name((url, browser, io = { platform: process.platform, spawn
|
|
179
|
+
var openBrowser = /* @__PURE__ */ __name((url, browser, io = { platform: process.platform, spawn }) => {
|
|
265
180
|
const [command, prefix] = browser !== void 0 ? [browser, []] : io.platform === "darwin" ? ["open", []] : io.platform === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler"]] : ["xdg-open", []];
|
|
266
181
|
return new Promise((resolve, reject) => {
|
|
267
182
|
const child = io.spawn(command, [...prefix, url], { detached: true, stdio: "ignore", windowsHide: true });
|
|
@@ -277,5 +192,6 @@ export {
|
|
|
277
192
|
logParsedArgv,
|
|
278
193
|
logVersion,
|
|
279
194
|
startCli,
|
|
195
|
+
firstRunAt,
|
|
280
196
|
openBrowser
|
|
281
197
|
};
|