@wirecat/drive-cli 0.44.0 → 0.45.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.
Files changed (166) hide show
  1. package/dist/bin/drive.js +35 -40
  2. package/dist/bundle/all-profiles-LTHNCWQW.js +26 -0
  3. package/dist/bundle/anthropic-NOJEF3V2.js +71 -0
  4. package/dist/bundle/bun-ADJVI4HY.js +169 -0
  5. package/dist/bundle/bun-sqlite-GNXLBF2A.js +70 -0
  6. package/dist/bundle/chunk-2FTZBZOB.js +2315 -0
  7. package/dist/bundle/chunk-2YU3CXFD.js +3391 -0
  8. package/dist/bundle/chunk-35GRI4DI.js +375 -0
  9. package/dist/bundle/chunk-37MAA6F2.js +5624 -0
  10. package/dist/bundle/chunk-3V6NPZY7.js +2352 -0
  11. package/dist/bundle/chunk-4TIC23D2.js +9 -0
  12. package/dist/bundle/chunk-4TQSNQVV.js +1071 -0
  13. package/dist/bundle/chunk-4UE7AVHZ.js +150 -0
  14. package/dist/bundle/chunk-5DPV7X27.js +663 -0
  15. package/dist/bundle/chunk-5FONRUG6.js +24805 -0
  16. package/dist/bundle/chunk-5ZVLM6YR.js +19 -0
  17. package/dist/bundle/chunk-64WJYT2F.js +3954 -0
  18. package/dist/bundle/chunk-65GGKAQ7.js +82 -0
  19. package/dist/bundle/chunk-66N2DGGC.js +515 -0
  20. package/dist/bundle/chunk-6KFA6HOM.js +2941 -0
  21. package/dist/bundle/chunk-6Y2BYFXQ.js +65 -0
  22. package/dist/bundle/chunk-7NCG2SHR.js +74 -0
  23. package/dist/bundle/chunk-7PVNJAQ2.js +73 -0
  24. package/dist/bundle/chunk-7XWUOCGW.js +190 -0
  25. package/dist/bundle/chunk-A6ZKTNTZ.js +168 -0
  26. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  27. package/dist/bundle/chunk-AH3SNVCV.js +498 -0
  28. package/dist/bundle/chunk-AN3GVZTU.js +76 -0
  29. package/dist/bundle/chunk-BPBIBVFH.js +166 -0
  30. package/dist/bundle/chunk-C4XP5T73.js +264 -0
  31. package/dist/bundle/chunk-C6SMAEED.js +18102 -0
  32. package/dist/bundle/chunk-CDI67JSB.js +1092 -0
  33. package/dist/bundle/chunk-CEO5HPRL.js +25 -0
  34. package/dist/bundle/chunk-CFT7UHF6.js +15572 -0
  35. package/dist/bundle/chunk-DC4T3FNP.js +1913 -0
  36. package/dist/bundle/chunk-DCTXOMOR.js +35 -0
  37. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  38. package/dist/bundle/chunk-EVWXODYV.js +754 -0
  39. package/dist/bundle/chunk-GKHM6I64.js +2356 -0
  40. package/dist/bundle/chunk-GNI7INK6.js +18 -0
  41. package/dist/bundle/chunk-GTYY6BIE.js +58 -0
  42. package/dist/bundle/chunk-GX4WEMAG.js +164 -0
  43. package/dist/bundle/chunk-HA3WCVGY.js +8179 -0
  44. package/dist/bundle/chunk-HLONHTSG.js +281 -0
  45. package/dist/bundle/chunk-HOIUIKWS.js +236 -0
  46. package/dist/bundle/chunk-HTQTIKWP.js +928 -0
  47. package/dist/bundle/chunk-I5EJHKNC.js +111 -0
  48. package/dist/bundle/chunk-ICKNJIGE.js +31 -0
  49. package/dist/bundle/chunk-IGB5CJCA.js +62 -0
  50. package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
  51. package/dist/bundle/chunk-IVQ6342B.js +2 -0
  52. package/dist/bundle/chunk-K4N2DKE5.js +17 -0
  53. package/dist/bundle/chunk-LNB7BIZL.js +844 -0
  54. package/dist/bundle/chunk-LVDHWNJF.js +193 -0
  55. package/dist/bundle/chunk-LW2G4U6W.js +570 -0
  56. package/dist/bundle/chunk-LWT55XC5.js +60 -0
  57. package/dist/bundle/chunk-LY26NW3I.js +6848 -0
  58. package/dist/bundle/chunk-MJR2OTO4.js +1714 -0
  59. package/dist/bundle/chunk-MWUITL6N.js +42 -0
  60. package/dist/bundle/chunk-N47CYWEM.js +454 -0
  61. package/dist/bundle/chunk-NKZ6V4JW.js +263 -0
  62. package/dist/bundle/chunk-NQ6LLDDC.js +161 -0
  63. package/dist/bundle/chunk-NZIHPYY5.js +215 -0
  64. package/dist/bundle/chunk-OECPFZLP.js +3541 -0
  65. package/dist/bundle/chunk-P5KGFT7U.js +18 -0
  66. package/dist/bundle/chunk-PDH2QQQV.js +484 -0
  67. package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
  68. package/dist/bundle/chunk-PJDO7AFZ.js +421 -0
  69. package/dist/bundle/chunk-PWKXHDBQ.js +18078 -0
  70. package/dist/bundle/chunk-QLZGLPJL.js +100 -0
  71. package/dist/bundle/chunk-SBZB7HMU.js +1055 -0
  72. package/dist/bundle/chunk-SGOPYPVW.js +835 -0
  73. package/dist/bundle/chunk-TDC6JGDA.js +630 -0
  74. package/dist/bundle/chunk-TOYPN2XX.js +288 -0
  75. package/dist/bundle/chunk-UC44ZMQV.js +78 -0
  76. package/dist/bundle/chunk-V7GN5BI7.js +99 -0
  77. package/dist/bundle/chunk-VO4KOLQZ.js +119 -0
  78. package/dist/bundle/chunk-WPGCDWPU.js +1855 -0
  79. package/dist/bundle/chunk-WQMVSQPP.js +886 -0
  80. package/dist/bundle/chunk-WZUJKUBK.js +384 -0
  81. package/dist/bundle/chunk-X5DFDGWS.js +2 -0
  82. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  83. package/dist/bundle/chunk-XPEWOPJR.js +431 -0
  84. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  85. package/dist/bundle/chunk-Y5EJSZXV.js +220 -0
  86. package/dist/bundle/chunk-YE3J6DLY.js +106 -0
  87. package/dist/bundle/chunk-YFLKH3NZ.js +48 -0
  88. package/dist/bundle/chunk-YJX4X564.js +138 -0
  89. package/dist/bundle/chunk-YJZBJ2TM.js +71 -0
  90. package/dist/bundle/chunk-Z4O6C7WR.js +1973 -0
  91. package/dist/bundle/chunk-ZIHLE7LG.js +15992 -0
  92. package/dist/bundle/chunk-ZPMLLONT.js +1054 -0
  93. package/dist/bundle/chunk-ZQNXKWUY.js +35584 -0
  94. package/dist/bundle/chunk-ZS635F4O.js +45 -0
  95. package/dist/bundle/chunk-ZU732VCC.js +122 -0
  96. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  97. package/dist/bundle/command-contract-HX35D7KV.js +38 -0
  98. package/dist/bundle/dist-MWTMOYWT.js +7577 -0
  99. package/dist/bundle/dist-PY3MVR3G.js +21 -0
  100. package/dist/bundle/drive.js +50 -0
  101. package/dist/bundle/echarts-RFTK737T.js +42501 -0
  102. package/dist/bundle/embed-5NAGJUMD.js +37 -0
  103. package/dist/bundle/embedder-EWXLIGBY.js +110 -0
  104. package/dist/bundle/entry-YCPJ6H6U.js +15 -0
  105. package/dist/bundle/failure-XBWHHBEW.js +37 -0
  106. package/dist/bundle/first-run-LNAZDBB4.js +24 -0
  107. package/dist/bundle/first-screen-P5NNFJD7.js +36 -0
  108. package/dist/bundle/google-5FFKRHHC.js +32 -0
  109. package/dist/bundle/google-api-TJCFOOAP.js +82 -0
  110. package/dist/bundle/identity-53ZMPL2O.js +10 -0
  111. package/dist/bundle/instructions-FHNL7CMW.js +9 -0
  112. package/dist/bundle/login-VXXZZR6G.js +158 -0
  113. package/dist/bundle/mcp-2CJCJXSW.js +95 -0
  114. package/dist/bundle/mcp-F4XZO76F.js +507 -0
  115. package/dist/bundle/mcp-IXFC2VVR.js +165 -0
  116. package/dist/bundle/mdast-util-from-markdown-FXEPSNER.js +1958 -0
  117. package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +2103 -0
  118. package/dist/bundle/micromark-extension-gfm-GRL24TU6.js +1838 -0
  119. package/dist/bundle/node-P4E63KXA.js +2340 -0
  120. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  121. package/dist/bundle/node-ZMCACJVS.js +176 -0
  122. package/dist/bundle/node-sqlite-QJQ5S7KS.js +46 -0
  123. package/dist/bundle/oauth-TZFDPAFE.js +18 -0
  124. package/dist/bundle/open-IYM25QTL.js +20 -0
  125. package/dist/bundle/process-ZPTLNVQS.js +91 -0
  126. package/dist/bundle/program-YX7DZMPR.js +24100 -0
  127. package/dist/bundle/prompt-TGWTVIEK.js +13 -0
  128. package/dist/bundle/reasons-Q5LOQESQ.js +11 -0
  129. package/dist/bundle/recognize-AGPMWKIY.js +191 -0
  130. package/dist/bundle/remote-QV7QSLAK.js +28 -0
  131. package/dist/bundle/rerank-HZKJJCS4.js +51 -0
  132. package/dist/bundle/serve-NRJQOVT4.js +20 -0
  133. package/dist/bundle/server-2UQDEWTS.js +818 -0
  134. package/dist/bundle/server-R4JUHFSW.js +56 -0
  135. package/dist/bundle/services-NZQWVMOE.js +333 -0
  136. package/dist/bundle/sqlite-runtime-6MXHTYYU.js +17 -0
  137. package/dist/bundle/state-IF2FLTSY.js +34 -0
  138. package/dist/bundle/store-HBD54IRL.js +142 -0
  139. package/dist/bundle/store-HVIBXOXS.js +125 -0
  140. package/dist/bundle/store-maintenance-command-U3F4RGJB.js +57 -0
  141. package/dist/bundle/terminal-TFCTWLOS.js +11 -0
  142. package/dist/bundle/tokens-5D5YUA2Q.js +103 -0
  143. package/dist/commands/mcp.d.ts.map +1 -1
  144. package/dist/commands/mcp.js +87 -37
  145. package/dist/commands/mcp.js.map +1 -1
  146. package/dist/contract-overrides.d.ts.map +1 -1
  147. package/dist/contract-overrides.js +78 -53
  148. package/dist/contract-overrides.js.map +1 -1
  149. package/dist/mcp.d.ts +13 -5
  150. package/dist/mcp.d.ts.map +1 -1
  151. package/dist/mcp.js +20 -10
  152. package/dist/mcp.js.map +1 -1
  153. package/dist/program.js +4 -4
  154. package/dist/program.js.map +1 -1
  155. package/dist/registry.d.ts +2 -2
  156. package/dist/registry.d.ts.map +1 -1
  157. package/dist/registry.js +3 -3
  158. package/dist/registry.js.map +1 -1
  159. package/dist/state.d.ts +5 -2
  160. package/dist/state.d.ts.map +1 -1
  161. package/dist/state.js +5 -2
  162. package/dist/state.js.map +1 -1
  163. package/dist/version.d.ts +1 -1
  164. package/dist/version.js +1 -1
  165. package/package.json +7 -5
  166. package/skills/drive-cli/SKILL.md +1 -0
@@ -0,0 +1,18 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // dist/terminal.js
8
+ var MACHINE_FLAGS = /* @__PURE__ */ new Set(["--json", "--jsonl"]);
9
+ var optionsOf = /* @__PURE__ */ __name((args) => {
10
+ const end = args.indexOf("--");
11
+ return end < 0 ? args : args.slice(0, end);
12
+ }, "optionsOf");
13
+ var interactiveOf = /* @__PURE__ */ __name((args, tty) => tty && !optionsOf(args).some((flag) => MACHINE_FLAGS.has(flag)), "interactiveOf");
14
+
15
+ export {
16
+ optionsOf,
17
+ interactiveOf
18
+ };
@@ -0,0 +1,58 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError
5
+ } from "./chunk-GKHM6I64.js";
6
+ import {
7
+ importFrom
8
+ } from "./chunk-Y5E2WNWB.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
+ import { readFileSync } from "node:fs";
15
+ var musl = /* @__PURE__ */ __name(() => {
16
+ if (process.platform !== "linux")
17
+ return false;
18
+ try {
19
+ return readFileSync("/proc/self/maps", "utf8").includes("ld-musl");
20
+ } catch {
21
+ return false;
22
+ }
23
+ }, "musl");
24
+ var found;
25
+ var vectorExtension = /* @__PURE__ */ __name(() => {
26
+ found ??= locate();
27
+ return found;
28
+ }, "vectorExtension");
29
+ var locate = /* @__PURE__ */ __name(async () => {
30
+ const onMusl = musl();
31
+ const target = `${process.platform}-${process.arch}${onMusl ? "-musl" : ""}`;
32
+ let path;
33
+ try {
34
+ const { extensionFor } = await importFrom(new URL("store/vector-extension.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-sqlite");
35
+ path = extensionFor({ musl: onMusl });
36
+ } catch {
37
+ path = void 0;
38
+ }
39
+ if (path === void 0) {
40
+ found = void 0;
41
+ throw new CliError("configuration_error", `the message store needs the sqlite-vec extension, and @wirecat/cli-core-sqlite has none for ${target} \u2014 reinstall the CLI so its dependencies install with it (an install that skips optional or native packages leaves it out)`, { reason: "store.vector-extension-missing", target });
42
+ }
43
+ return path;
44
+ }, "locate");
45
+ var loadVectorExtension = /* @__PURE__ */ __name((database, path) => {
46
+ try {
47
+ database.loadExtension(path);
48
+ } catch (error) {
49
+ throw new CliError("configuration_error", `the sqlite-vec extension did not load on ${process.platform}-${process.arch} \u2014 reinstall the CLI; on macOS under Bun, @wirecat/cli-core-sqlite's SQLite must be installed, since the system's cannot load extensions`, { reason: "store.vector-extension-failed", cause: error instanceof Error ? error.message : String(error) });
50
+ } finally {
51
+ database.enableLoadExtension?.(false);
52
+ }
53
+ }, "loadVectorExtension");
54
+
55
+ export {
56
+ vectorExtension,
57
+ loadVectorExtension
58
+ };
@@ -0,0 +1,164 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ botInstructions
5
+ } from "./chunk-IP4OK7RQ.js";
6
+ import {
7
+ answered,
8
+ normal,
9
+ registerCommands,
10
+ runCommandForAgent,
11
+ toolsFromCommands
12
+ } from "./chunk-2YU3CXFD.js";
13
+ import {
14
+ agentJson,
15
+ skillResource
16
+ } from "./chunk-AH3SNVCV.js";
17
+ import {
18
+ callerOf,
19
+ serveStdio
20
+ } from "./chunk-TDC6JGDA.js";
21
+ import {
22
+ McpServer
23
+ } from "./chunk-5FONRUG6.js";
24
+ import {
25
+ wholeList
26
+ } from "./chunk-ZPMLLONT.js";
27
+ import {
28
+ changesMessenger,
29
+ itemOf
30
+ } from "./chunk-Z4O6C7WR.js";
31
+ import {
32
+ flatten
33
+ } from "./chunk-64WJYT2F.js";
34
+ import {
35
+ MESSENGER_CHANGE_REFUSAL,
36
+ readOnlyLockOf,
37
+ readOnlyRefusal
38
+ } from "./chunk-CEO5HPRL.js";
39
+ import {
40
+ mcpErrorResult
41
+ } from "./chunk-6KFA6HOM.js";
42
+ import {
43
+ object
44
+ } from "./chunk-GKHM6I64.js";
45
+ import {
46
+ __name
47
+ } from "./chunk-ZVVMGPBJ.js";
48
+
49
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/mcp/bot/server.js
50
+ import { randomUUID } from "node:crypto";
51
+ 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");
52
+ var createBotServer = /* @__PURE__ */ __name((options) => {
53
+ const { bot, program, settings, env } = options;
54
+ const command = bot.app.command;
55
+ const levels = options.levels ?? (() => settings.permissions);
56
+ const authority = /* @__PURE__ */ __name((path) => options.authority?.(path) === true || path[0] === "config" && (path[1] === "set" || path[1] === "unset"), "authority");
57
+ const catalogue = {
58
+ includeUnavailable: true,
59
+ levels: settings.permissions,
60
+ currentLevels: levels,
61
+ readOnly: readOnlyLockOf(bot.app, env) !== void 0,
62
+ ...options.keyOf ? { keyOf: options.keyOf } : {},
63
+ authority,
64
+ ...options.fetchOnly ? { fetchOnly: options.fetchOnly } : {},
65
+ offline: true,
66
+ // Another bot's copy is this bot's to read only where `read_other_bots` says so.
67
+ ...settings.readOtherBots ? {} : { omit: ["all_bots", "bots"] }
68
+ };
69
+ const tools = [
70
+ ...toolsFromCommands(program.commands, { ...catalogue, root: ["bot"] }),
71
+ ...toolsFromCommands(program.commands.filter((one) => one.path[0] === "config"), {
72
+ ...catalogue,
73
+ omit: ["bot", "personal", "defaults"]
74
+ })
75
+ ];
76
+ const writes = tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command);
77
+ const skill = options.skill ? skillResource(bot.app, options.skill) : void 0;
78
+ let queue = Promise.resolve();
79
+ const invoke = /* @__PURE__ */ __name((path, input, caller) => {
80
+ const next = queue.then(() => runCommandForAgent(program, path, path[0] === "config" ? { ...input, bot: true } : input, {
81
+ profile: settings.profile,
82
+ readOnly: readOnlyLockOf(bot.app, env) !== void 0,
83
+ env,
84
+ levels,
85
+ ...options.keyOf ? { keyOf: options.keyOf } : {},
86
+ authority,
87
+ ...caller ? { caller } : {}
88
+ }));
89
+ queue = next.catch(() => void 0);
90
+ return next;
91
+ }, "invoke");
92
+ const build = /* @__PURE__ */ __name(() => {
93
+ const callers = { env, client: /* @__PURE__ */ __name(() => server.server.getClientVersion(), "client"), connectionId: randomUUID() };
94
+ const server = new McpServer({ name: `${command}-bot-${settings.profile}`, version: bot.app.version }, {
95
+ instructions: botInstructions({
96
+ command,
97
+ name: bot.name ?? command,
98
+ profile: settings.profile,
99
+ writes,
100
+ ...skill ? { skill: skill.instruction } : {}
101
+ })
102
+ });
103
+ if (skill) {
104
+ const { uri, name, title, description, mimeType, read } = skill;
105
+ server.registerResource(name, uri, { title, description, mimeType }, read);
106
+ }
107
+ const commands = Object.fromEntries(tools.map((tool) => [
108
+ tool.command,
109
+ {
110
+ title: tool.title,
111
+ description: tool.description,
112
+ writes: tool.writes,
113
+ availability: tool.availability,
114
+ input: tool.input,
115
+ run: /* @__PURE__ */ __name(async (args, ctx) => {
116
+ const caller = callerOf(ctx, `${command}_${tool.command.replaceAll(" ", "_")}`, callers);
117
+ const answer = await invoke(tool.path, args, caller);
118
+ return "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : answered(body(tool.command, answer.result));
119
+ }, "run")
120
+ }
121
+ ]));
122
+ commands.status = {
123
+ title: "This server's bot and profile",
124
+ 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.",
125
+ writes: false,
126
+ input: object({}),
127
+ run: /* @__PURE__ */ __name(async () => {
128
+ const auth = await invoke(["bot", "auth", "show"], {});
129
+ const shown = "error" in auth ? auth.error : auth.result?.item ?? auth.result;
130
+ return answered(itemOf({
131
+ profile: settings.profile,
132
+ kind: "bot",
133
+ auth: shown,
134
+ writes: tools.filter((tool) => tool.writes && tool.availability?.().available !== false).map((tool) => tool.command),
135
+ permissions: levels()
136
+ }));
137
+ }, "run")
138
+ };
139
+ registerCommands(server, `${command}_bot`, commands, void 0, (asked) => {
140
+ const lock = readOnlyLockOf(bot.app, env);
141
+ const one = flatten(program.commands).find((info) => info.path[0] === "bot" && normal(info.path.slice(1).join(" ")) === asked);
142
+ if (lock && one && changesMessenger(one))
143
+ throw readOnlyRefusal(lock, MESSENGER_CHANGE_REFUSAL);
144
+ }, bot.app.messenger);
145
+ return server;
146
+ }, "build");
147
+ return { build, tools, offered: tools.map((tool) => tool.command) };
148
+ }, "createBotServer");
149
+ var serveBotOverStdio = /* @__PURE__ */ __name(async (options, note) => {
150
+ const { build } = createBotServer(options);
151
+ const handle = serveStdio(build, { onerror: /* @__PURE__ */ __name((error) => note(`mcp: ${error.message}`), "onerror") });
152
+ await new Promise((resolve) => {
153
+ process.stdin.once("end", resolve);
154
+ process.stdin.once("close", resolve);
155
+ process.once("SIGINT", resolve);
156
+ process.once("SIGTERM", resolve);
157
+ });
158
+ await handle.close();
159
+ }, "serveBotOverStdio");
160
+
161
+ export {
162
+ createBotServer,
163
+ serveBotOverStdio
164
+ };