@wirecat/drive-cli 0.52.1 → 0.54.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 (218) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bin/drive.js.map +1 -1
  3. package/dist/bundle/{chunk-ZWSG7OCA.js → all-profiles-LFIPUPZI.js} +13 -8
  4. package/dist/bundle/{anthropic-KW6KU36Y.js → anthropic-G5ZRRWG4.js} +5 -5
  5. package/dist/bundle/{app-server-TCJZ333E.js → app-server-UVWATOQC.js} +48 -56
  6. package/dist/bundle/{bun-7SYKSCLA.js → bun-DNEFTPTR.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-RI7DR6RZ.js → bun-sqlite-FWBYHIXB.js} +4 -4
  8. package/dist/bundle/{chunk-CM7GAXGD.js → chunk-2CQT2WWN.js} +5 -5
  9. package/dist/bundle/{chunk-HQVJK5E7.js → chunk-2D6AAGBP.js} +246 -383
  10. package/dist/bundle/{chunk-FG4XXZZE.js → chunk-2FFXRWI2.js} +2 -2
  11. package/dist/bundle/{chunk-2UIMEMWU.js → chunk-2HQPJ366.js} +3 -3
  12. package/dist/bundle/{chunk-CB7SBYLO.js → chunk-2HWOGSTA.js} +57 -37
  13. package/dist/bundle/{chunk-7XKAVMCF.js → chunk-2MSJVFAS.js} +8 -8
  14. package/dist/bundle/{chunk-NSIFQ5OP.js → chunk-2NWFZ43Q.js} +1 -1
  15. package/dist/bundle/{chunk-H47W2J6S.js → chunk-2Q3S47BC.js} +1312 -626
  16. package/dist/bundle/{chunk-O6IOL6RX.js → chunk-47MEPBWG.js} +21 -21
  17. package/dist/bundle/{chunk-725OHXKR.js → chunk-4RDXCE45.js} +2226 -37
  18. package/dist/bundle/{chunk-UR32UWTQ.js → chunk-5BPOAHVD.js} +13 -2
  19. package/dist/bundle/{chunk-5FONRUG6.js → chunk-5D4AEUVA.js} +1 -23
  20. package/dist/bundle/{chunk-VZ2I62HN.js → chunk-5LNOVPOR.js} +2 -2
  21. package/dist/bundle/{chunk-EKFEY3KP.js → chunk-5WQN2TUM.js} +1 -1
  22. package/dist/bundle/{chunk-ALJWBGD5.js → chunk-6MGSFYGL.js} +1 -1
  23. package/dist/bundle/{chunk-WUX7AUOQ.js → chunk-6RAEXK7Y.js} +26 -26
  24. package/dist/bundle/{chunk-BSSCTWWK.js → chunk-6SOQJRGI.js} +4 -4
  25. package/dist/bundle/{chunk-CKBHR7QO.js → chunk-75DSLCPC.js} +1 -1
  26. package/dist/bundle/{chunk-VSOLLTYT.js → chunk-76JIVDKC.js} +7 -2
  27. package/dist/bundle/{chunk-33NVQGUY.js → chunk-7WCZ2OZ5.js} +6 -6
  28. package/dist/bundle/{chunk-IDUNJCFO.js → chunk-7XU3TR7K.js} +2 -2
  29. package/dist/bundle/{chunk-7SH4JHYW.js → chunk-A4FTLORC.js} +12 -12
  30. package/dist/bundle/{chunk-CITFEQ6S.js → chunk-AACQA2CO.js} +1 -1
  31. package/dist/bundle/{chunk-PSNHPFSK.js → chunk-AAHIBA36.js} +1 -1
  32. package/dist/bundle/{chunk-PEOCBV2Z.js → chunk-BWBVBW5T.js} +8 -8
  33. package/dist/bundle/{chunk-A4UNTWAX.js → chunk-CVALO727.js} +99 -30
  34. package/dist/bundle/{chunk-G6QF5KWF.js → chunk-FHW4ENRF.js} +37 -43
  35. package/dist/bundle/{chunk-LONV6HIK.js → chunk-HAHARAJD.js} +455 -40
  36. package/dist/bundle/{chunk-2623YE5I.js → chunk-IBRXVPBI.js} +97 -99
  37. package/dist/bundle/{chunk-IWFBAWZK.js → chunk-IKODUUQG.js} +292 -19
  38. package/dist/bundle/{chunk-PQJYM5ES.js → chunk-IOMSC4ZG.js} +3 -3
  39. package/dist/bundle/{chunk-YKZ4IPLB.js → chunk-JKEAZBEZ.js} +7 -7
  40. package/dist/bundle/{chunk-FCJAHD4R.js → chunk-KIQIF5M7.js} +3 -3
  41. package/dist/bundle/{chunk-KYVXMEBC.js → chunk-KT5G3KVS.js} +3 -3
  42. package/dist/bundle/{chunk-W7IK7E4B.js → chunk-L3RV42O3.js} +20 -22
  43. package/dist/bundle/{chunk-NHBUTCNR.js → chunk-LQXLWHKM.js} +9 -9
  44. package/dist/bundle/{chunk-WBTVGFXI.js → chunk-MATUQFYL.js} +11 -11
  45. package/dist/bundle/{chunk-54O62JWP.js → chunk-MULPNGM2.js} +29 -10
  46. package/dist/bundle/{chunk-FJW3DDCF.js → chunk-N4OO3SPQ.js} +5 -5
  47. package/dist/bundle/{chunk-6DHQTUB2.js → chunk-NDWWGBSM.js} +1 -1
  48. package/dist/bundle/{chunk-DLAFGSTN.js → chunk-NHDSJMAR.js} +1 -1
  49. package/dist/bundle/{chunk-PQYVPCJ2.js → chunk-O6YYFVDD.js} +38 -37
  50. package/dist/bundle/{chunk-I7UH5CTA.js → chunk-OYGEBFFO.js} +12 -14
  51. package/dist/bundle/chunk-P7E7K467.js +110 -0
  52. package/dist/bundle/{chunk-ZNZUZGSV.js → chunk-PKNTBZXN.js} +176 -49
  53. package/dist/bundle/{chunk-YNFELLNQ.js → chunk-PU4GANCD.js} +3 -3
  54. package/dist/bundle/{chunk-5PLJKSG4.js → chunk-Q46JLJ5O.js} +7 -9
  55. package/dist/bundle/{chunk-R276546S.js → chunk-QKHFQHE7.js} +1 -1
  56. package/dist/bundle/{chunk-RNSP57TC.js → chunk-QUJCD5U7.js} +4 -4
  57. package/dist/bundle/{chunk-43QVYW3K.js → chunk-RIYXQFKU.js} +262 -88
  58. package/dist/bundle/{chunk-2AUXBJRX.js → chunk-RWEFKLXJ.js} +104 -29
  59. package/dist/bundle/{chunk-WQJBAWQP.js → chunk-SBOTSSYV.js} +879 -508
  60. package/dist/bundle/{chunk-PAXKALHV.js → chunk-U3BOQ63L.js} +118 -7
  61. package/dist/bundle/{chunk-VJZST5RD.js → chunk-UBJX5D2O.js} +2 -2
  62. package/dist/bundle/{chunk-HX7Y2ASG.js → chunk-VCGQMTHW.js} +26318 -15143
  63. package/dist/bundle/{chunk-7YMDL4JQ.js → chunk-VKYCMXEQ.js} +8 -5
  64. package/dist/bundle/{chunk-ZSXRDF6I.js → chunk-VX4RAT3A.js} +1 -1
  65. package/dist/bundle/{chunk-NYOPEHEU.js → chunk-W5SYBHRX.js} +8 -3
  66. package/dist/bundle/{chunk-XOLQSCMF.js → chunk-WGSTTWM5.js} +6 -6
  67. package/dist/bundle/{chunk-WLFUBNFX.js → chunk-WJRE45Z6.js} +4 -4
  68. package/dist/bundle/{chunk-IEXPOEEO.js → chunk-WQPTZHHR.js} +17 -26
  69. package/dist/bundle/{chunk-JEOYFKUK.js → chunk-WSX5UQNT.js} +2 -2
  70. package/dist/bundle/{chunk-LJAX6YCF.js → chunk-WYDYSQ7T.js} +2 -2
  71. package/dist/bundle/{chunk-C6Z25IBJ.js → chunk-XCUUYQN7.js} +4 -4
  72. package/dist/bundle/{chunk-GVCN3GLZ.js → chunk-YOHOQ6ZR.js} +4 -4
  73. package/dist/bundle/chunk-YZ5VMR2S.js +5305 -0
  74. package/dist/bundle/{chunk-ZDLIO76S.js → chunk-ZMMOVTUB.js} +2 -2
  75. package/dist/bundle/command-contract-VZ3ZJLEF.js +35 -0
  76. package/dist/bundle/{decode-EDN2ARXZ.js → decode-DN2DDFET.js} +4 -4
  77. package/dist/bundle/drive.js +11 -22
  78. package/dist/bundle/{echarts-GXY34GHA.js → echarts-VMHZ2UYP.js} +2 -2
  79. package/dist/bundle/{embed-3GSQIQXE.js → embed-MDN7R7BA.js} +5 -5
  80. package/dist/bundle/{embedder-6ULWRG3R.js → embedder-KEVEDNDJ.js} +8 -8
  81. package/dist/bundle/{entry-IPRJLFHO.js → entry-HTNK5TJQ.js} +6 -6
  82. package/dist/bundle/{first-run-FGHGWHC2.js → first-run-QNMCMP67.js} +9 -9
  83. package/dist/bundle/first-screen-RQBEHUQC.js +33 -0
  84. package/dist/bundle/{google-BD3ZNFVJ.js → google-QAKMV57Q.js} +9 -9
  85. package/dist/bundle/{chunk-GR5GGZKH.js → google-api-UJJS7ECO.js} +62 -6
  86. package/dist/bundle/grants-VMPKFEC2.js +98 -0
  87. package/dist/bundle/{identity-U7IHZEMR.js → identity-UODE3QAL.js} +4 -2
  88. package/dist/bundle/{instructions-K5BEQM4C.js → instructions-IWLHCDC7.js} +1 -1
  89. package/dist/bundle/{login-7HRYPZMM.js → login-GIZXEN7I.js} +60 -68
  90. package/dist/bundle/{mcp-WSGVVZWI.js → mcp-RUYPQVYS.js} +2 -2
  91. package/dist/bundle/{node-ZYWB7IET.js → node-25IJLDBZ.js} +2 -2
  92. package/dist/bundle/{node-sqlite-J3OODPYK.js → node-sqlite-DYR4FEI4.js} +4 -4
  93. package/dist/bundle/{oauth-L4VTCBLF.js → oauth-FLHXEDDY.js} +7 -7
  94. package/dist/bundle/{open-SGUN7ZVF.js → open-FWDZB7KX.js} +3 -3
  95. package/dist/bundle/{openai-RLVISEDH.js → openai-HB7UGKPW.js} +13 -13
  96. package/dist/bundle/{process-ZXO2MWRJ.js → process-P6TW37HQ.js} +1 -1
  97. package/dist/bundle/{program-YVLXSKZV.js → program-DVUNLXXS.js} +730 -919
  98. package/dist/bundle/{prompt-AUWTBLO7.js → prompt-MKWMYO3B.js} +4 -4
  99. package/dist/bundle/{reasons-J57GSRWN.js → reasons-25BEO2NE.js} +3 -3
  100. package/dist/bundle/{recognize-ORX2UBQW.js → recognize-VXGNPROM.js} +3 -3
  101. package/dist/bundle/{remote-AGIJY73X.js → remote-H5ZWLJHR.js} +6 -6
  102. package/dist/bundle/{rerank-R6PE44M5.js → rerank-5A3JDK7O.js} +6 -6
  103. package/dist/bundle/{chunk-G7DCVJ4F.js → serve-QNPNEZVR.js} +10 -7
  104. package/dist/bundle/{chunk-F7UUZATI.js → server-GWBVIRLY.js} +42 -15
  105. package/dist/bundle/server-QJU3HEGM.js +63 -0
  106. package/dist/bundle/{services-HZFTTZSF.js → services-PFXEWHJG.js} +30 -31
  107. package/dist/bundle/{sqlite-runtime-DTGPR2T2.js → sqlite-runtime-RGFISYXM.js} +4 -4
  108. package/dist/bundle/{state-WG3JKJM3.js → state-BUSX5BXF.js} +5 -5
  109. package/dist/bundle/{store-EV72MT5U.js → store-FIEE5HHG.js} +14 -16
  110. package/dist/bundle/{store-33VHIMEO.js → store-HFF5KQ44.js} +12 -14
  111. package/dist/bundle/store-maintenance-command-Z4SPEQUM.js +52 -0
  112. package/dist/bundle/{chunk-GNI7INK6.js → terminal-DHJ4D3BC.js} +2 -3
  113. package/dist/bundle/tokens-B6MUZRFM.js +96 -0
  114. package/dist/commands/context.d.ts +14 -13
  115. package/dist/commands/context.d.ts.map +1 -1
  116. package/dist/commands/context.js.map +1 -1
  117. package/dist/commands/documents.d.ts.map +1 -1
  118. package/dist/commands/documents.js +1 -4
  119. package/dist/commands/documents.js.map +1 -1
  120. package/dist/commands/mirrors.d.ts.map +1 -1
  121. package/dist/commands/mirrors.js +1 -2
  122. package/dist/commands/mirrors.js.map +1 -1
  123. package/dist/commands/upgrade.d.ts +1 -1
  124. package/dist/commands/upgrade.d.ts.map +1 -1
  125. package/dist/commands/upgrade.js +4 -9
  126. package/dist/commands/upgrade.js.map +1 -1
  127. package/dist/config.d.ts +182 -0
  128. package/dist/config.d.ts.map +1 -1
  129. package/dist/config.js +38 -3
  130. package/dist/config.js.map +1 -1
  131. package/dist/contract-overrides.d.ts +0 -3
  132. package/dist/contract-overrides.d.ts.map +1 -1
  133. package/dist/contract-overrides.js +0 -234
  134. package/dist/contract-overrides.js.map +1 -1
  135. package/dist/first-screen.d.ts +3 -2
  136. package/dist/first-screen.d.ts.map +1 -1
  137. package/dist/first-screen.js +17 -22
  138. package/dist/first-screen.js.map +1 -1
  139. package/dist/grants.d.ts +9 -0
  140. package/dist/grants.d.ts.map +1 -0
  141. package/dist/grants.js +30 -0
  142. package/dist/grants.js.map +1 -0
  143. package/dist/identity.d.ts.map +1 -1
  144. package/dist/identity.js +2 -0
  145. package/dist/identity.js.map +1 -1
  146. package/dist/login.d.ts.map +1 -1
  147. package/dist/login.js +2 -4
  148. package/dist/login.js.map +1 -1
  149. package/dist/policy-keys.d.ts +12 -0
  150. package/dist/policy-keys.d.ts.map +1 -0
  151. package/dist/policy-keys.js +107 -0
  152. package/dist/policy-keys.js.map +1 -0
  153. package/dist/policy.d.ts +1 -8
  154. package/dist/policy.d.ts.map +1 -1
  155. package/dist/policy.js +2 -105
  156. package/dist/policy.js.map +1 -1
  157. package/dist/program.d.ts +8 -4
  158. package/dist/program.d.ts.map +1 -1
  159. package/dist/program.js +251 -222
  160. package/dist/program.js.map +1 -1
  161. package/dist/testing/mcp.d.ts +28 -0
  162. package/dist/testing/mcp.d.ts.map +1 -0
  163. package/dist/testing/mcp.js +56 -0
  164. package/dist/testing/mcp.js.map +1 -0
  165. package/dist/tokens.d.ts.map +1 -1
  166. package/dist/tokens.js +0 -9
  167. package/dist/tokens.js.map +1 -1
  168. package/dist/version.d.ts +1 -1
  169. package/dist/version.js +1 -1
  170. package/package.json +6 -5
  171. package/scenarios/agent-access.md +4 -2
  172. package/dist/bundle/all-profiles-CYW6XBBS.js +0 -26
  173. package/dist/bundle/chunk-234MHU76.js +0 -384
  174. package/dist/bundle/chunk-BBYD2FA3.js +0 -9
  175. package/dist/bundle/chunk-DO4PDQY5.js +0 -48
  176. package/dist/bundle/chunk-FDWYPONW.js +0 -1988
  177. package/dist/bundle/chunk-FQRJWVEB.js +0 -2
  178. package/dist/bundle/chunk-GJN5B5JK.js +0 -522
  179. package/dist/bundle/chunk-NPSZPUK6.js +0 -193
  180. package/dist/bundle/chunk-PDGECM5D.js +0 -138
  181. package/dist/bundle/chunk-Q765VPZY.js +0 -421
  182. package/dist/bundle/chunk-QYUHS6DE.js +0 -1714
  183. package/dist/bundle/chunk-WQRGA75U.js +0 -256
  184. package/dist/bundle/chunk-YVPHJHIL.js +0 -15572
  185. package/dist/bundle/chunk-Z47LOJUS.js +0 -484
  186. package/dist/bundle/command-contract-I2YB5IXI.js +0 -38
  187. package/dist/bundle/failure-IXS2ZHA5.js +0 -37
  188. package/dist/bundle/first-screen-M62KTPZG.js +0 -36
  189. package/dist/bundle/google-api-BDUWZMRV.js +0 -83
  190. package/dist/bundle/mcp-F67RATLF.js +0 -502
  191. package/dist/bundle/mcp-JZSYPQA4.js +0 -96
  192. package/dist/bundle/serve-VOBAQHAQ.js +0 -20
  193. package/dist/bundle/server-24PS4M7U.js +0 -70
  194. package/dist/bundle/server-G6HFZ2CK.js +0 -57
  195. package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +0 -58
  196. package/dist/bundle/terminal-TFCTWLOS.js +0 -11
  197. package/dist/bundle/tokens-XMOGQFI6.js +0 -102
  198. package/dist/commands/doctor.d.ts +0 -56
  199. package/dist/commands/doctor.d.ts.map +0 -1
  200. package/dist/commands/doctor.js +0 -75
  201. package/dist/commands/doctor.js.map +0 -1
  202. package/dist/commands/mcp.d.ts +0 -6
  203. package/dist/commands/mcp.d.ts.map +0 -1
  204. package/dist/commands/mcp.js +0 -156
  205. package/dist/commands/mcp.js.map +0 -1
  206. package/dist/commands/skill.d.ts +0 -6
  207. package/dist/commands/skill.d.ts.map +0 -1
  208. package/dist/commands/skill.js +0 -34
  209. package/dist/commands/skill.js.map +0 -1
  210. package/dist/failure.d.ts +0 -88
  211. package/dist/failure.d.ts.map +0 -1
  212. package/dist/failure.js +0 -60
  213. package/dist/failure.js.map +0 -1
  214. package/dist/mcp.d.ts +0 -175
  215. package/dist/mcp.d.ts.map +0 -1
  216. package/dist/mcp.js +0 -412
  217. package/dist/mcp.js.map +0 -1
  218. /package/dist/bundle/{chunk-62EDJKGP.js → chunk-HEA3XVAJ.js} +0 -0
package/dist/failure.d.ts DELETED
@@ -1,88 +0,0 @@
1
- import { type Streams } from "@wirecat/cli-base";
2
- import { type Effects } from "@wirecat/cli-base/standards";
3
- import { type Command } from "commander";
4
- import { REASONS } from "./reasons.js";
5
- import { interactiveOf } from "./terminal.js";
6
- export { interactiveOf, REASONS };
7
- export declare const errorObject: (error: unknown, invalidArguments?: string, effects?: Effects) => {
8
- error: {
9
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
10
- reason: string;
11
- message: string;
12
- param?: string | undefined;
13
- details?: {
14
- [x: string]: unknown;
15
- } | undefined;
16
- next?: ({
17
- kind: "command";
18
- step: string;
19
- command: string;
20
- args: {
21
- [x: string]: unknown;
22
- };
23
- line?: string | undefined;
24
- why: string;
25
- safe_to_auto_execute: boolean;
26
- } | {
27
- kind: "user_action";
28
- step: string;
29
- why: string;
30
- safe_to_auto_execute: false;
31
- })[] | undefined;
32
- retry: {
33
- safe: boolean;
34
- after_ms?: number | undefined;
35
- };
36
- run_id?: string | undefined;
37
- };
38
- };
39
- export declare const mcpFailure: (error: unknown, effects?: Effects) => {
40
- content: {
41
- type: "text";
42
- text: string;
43
- }[];
44
- structuredContent: {
45
- error: {
46
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
47
- reason: string;
48
- message: string;
49
- param?: string | undefined;
50
- details?: {
51
- [x: string]: unknown;
52
- } | undefined;
53
- next?: ({
54
- kind: "command";
55
- step: string;
56
- command: string;
57
- args: {
58
- [x: string]: unknown;
59
- };
60
- line?: string | undefined;
61
- why: string;
62
- safe_to_auto_execute: boolean;
63
- } | {
64
- kind: "user_action";
65
- step: string;
66
- why: string;
67
- safe_to_auto_execute: false;
68
- })[] | undefined;
69
- retry: {
70
- safe: boolean;
71
- after_ms?: number | undefined;
72
- };
73
- run_id?: string | undefined;
74
- };
75
- };
76
- isError: true;
77
- };
78
- export interface ReportOptions {
79
- /** The arguments after the program name. */
80
- args: readonly string[];
81
- /** To name the failed command in the `--debug` record. */
82
- program?: Command;
83
- streams: Streams;
84
- tty: boolean;
85
- }
86
- /** One error object on stderr, `✗ message` at a terminal; returns the exit code. */
87
- export declare const reportFailure: (error: unknown, { args, program, streams, tty }: ReportOptions) => number;
88
- //# sourceMappingURL=failure.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAa,MAAM,eAAe,CAAA;AAGxD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA;AA6BjC,eAAO,MAAM,WAAW,UACf,OAAO,uCAEJ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAC0D,CAAA;AAE7E,eAAO,MAAM,UAAU,UAAW,OAAO,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACW,CAAA;AAevE,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb;AAED,oFAAoF;AACpF,eAAO,MAAM,aAAa,UAAW,OAAO,mCAAmC,aAAa,KAAG,MAW9F,CAAA"}
package/dist/failure.js DELETED
@@ -1,60 +0,0 @@
1
- import { CliError, errorObjectOf, errorRecordOf, exitCodeOfError, mcpErrorResult, renderError, } from "@wirecat/cli-base";
2
- import { metaOf } from "@wirecat/cli-base/commands";
3
- import { defineSteps } from "@wirecat/cli-base/standards";
4
- import { failureContext } from "@wirecat/cli-core";
5
- import { CommanderError } from "commander";
6
- import { REASONS } from "./reasons.js";
7
- import { interactiveOf, optionsOf } from "./terminal.js";
8
- import { VERSION } from "./version.js";
9
- export { interactiveOf, REASONS };
10
- // A Google sign-in opens a browser on the computer running drive; an agent over MCP cannot do it for the owner.
11
- const STEPS = defineSteps([
12
- {
13
- id: "owner.sign-in",
14
- kind: "user_action",
15
- why: "the owner runs drive <profile> session start or signs in from WireCat Desktop; an agent cannot do it over MCP",
16
- },
17
- ]);
18
- // Commander words the cause itself: unknown command with a suggestion, missing argument, missing option.
19
- const parseMessage = (error, fallback) => error.code === "commander.help"
20
- ? "no command given after the profile name; list them with drive --help"
21
- : error.message
22
- .replace(/^error: /, "")
23
- .replace(/\s*\n\s*/g, " ")
24
- .trim() || fallback;
25
- const recognisable = (error, invalidArguments) => error instanceof CommanderError ? new CliError("validation_error", parseMessage(error, invalidArguments)) : error;
26
- const contextOf = (effects) => ({
27
- ...failureContext({ reasons: REASONS }),
28
- steps: STEPS,
29
- ...(effects ? { effects } : {}),
30
- });
31
- export const errorObject = (error, invalidArguments = "invalid command arguments; use drive --help", effects) => errorObjectOf(recognisable(error, invalidArguments), contextOf(effects));
32
- export const mcpFailure = (error, effects) => mcpErrorResult(errorObject(error, "invalid tool arguments", effects));
33
- const commandOf = (program, args) => {
34
- const path = [];
35
- if (!program)
36
- return { name: "drive", effects: undefined };
37
- let at = program;
38
- for (const arg of args) {
39
- const child = at.commands.find((command) => command.name() === arg);
40
- if (!child)
41
- continue;
42
- path.push(child.name());
43
- at = child;
44
- }
45
- return { name: path.join(" ") || "drive", effects: path.length ? metaOf(at).effects : undefined };
46
- };
47
- /** One error object on stderr, `✗ message` at a terminal; returns the exit code. */
48
- export const reportFailure = (error, { args, program, streams, tty }) => {
49
- const failure = recognisable(error, "invalid command arguments; use drive --help");
50
- const flags = optionsOf(args);
51
- const command = commandOf(program, flags);
52
- const object = errorObjectOf(failure, contextOf(command.effects));
53
- const record = flags.includes("--debug")
54
- ? errorRecordOf(failure, object, { command: command.name, service: "drive", version: VERSION })
55
- : undefined;
56
- const interactive = interactiveOf(args, tty);
57
- streams.diagnostic(renderError(object, { cli: "drive", interactive, ...(record ? { record } : {}) }));
58
- return exitCodeOfError(object);
59
- };
60
- //# sourceMappingURL=failure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,WAAW,GAEZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACnD,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAgB,cAAc,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA;AAEjC,gHAAgH;AAChH,MAAM,KAAK,GAAG,WAAW,CAAC;IACxB;QACE,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,aAAa;QACnB,GAAG,EAAE,+GAA+G;KACrH;CACF,CAAC,CAAA;AAEF,yGAAyG;AACzG,MAAM,YAAY,GAAG,CAAC,KAAqB,EAAE,QAAgB,EAAE,EAAE,CAC/D,KAAK,CAAC,IAAI,KAAK,gBAAgB;IAC7B,CAAC,CAAC,sEAAsE;IACxE,CAAC,CAAC,KAAK,CAAC,OAAO;SACV,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;SACzB,IAAI,EAAE,IAAI,QAAQ,CAAA;AA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,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACrG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC,CAAA"}
package/dist/mcp.d.ts DELETED
@@ -1,175 +0,0 @@
1
- import { McpServer } from "@modelcontextprotocol/server";
2
- import { type CommandInfo } from "@wirecat/cli-base/commands";
3
- import { type CommandAvailability } from "@wirecat/cli-core/mcp";
4
- import type { Command } from "commander";
5
- import type { ProgramOptions } from "./commands/context.js";
6
- import { type PolicyFlags } from "./policy.js";
7
- import { type ProfileSet } from "./state.js";
8
- interface ToolDefinition {
9
- availability?: () => CommandAvailability;
10
- name: string;
11
- command: CommandInfo;
12
- schema: Record<string, unknown>;
13
- }
14
- /** `program.ts` passes its own `createProgram`: importing it here would close a loop with the `mcp` command. */
15
- export type BuildProgram = (options: ProgramOptions) => Command;
16
- export declare const mcpTools: (build: BuildProgram, options: ProgramOptions, profile: string, flags?: PolicyFlags) => ToolDefinition[];
17
- export declare const toolArgv: (tool: ToolDefinition, input: Record<string, unknown>) => string[];
18
- export declare const invokeTool: (build: BuildProgram, tool: ToolDefinition, input: Record<string, unknown>, options: ProgramOptions, profile: string, flags?: PolicyFlags) => Promise<{
19
- content: {
20
- type: "text";
21
- text: string;
22
- }[];
23
- structuredContent: {
24
- error: {
25
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
26
- reason: string;
27
- message: string;
28
- param?: string | undefined;
29
- details?: {
30
- [x: string]: unknown;
31
- } | undefined;
32
- next?: ({
33
- kind: "command";
34
- step: string;
35
- command: string;
36
- args: {
37
- [x: string]: unknown;
38
- };
39
- line?: string | undefined;
40
- why: string;
41
- safe_to_auto_execute: boolean;
42
- } | {
43
- kind: "user_action";
44
- step: string;
45
- why: string;
46
- safe_to_auto_execute: false;
47
- })[] | undefined;
48
- retry: {
49
- safe: boolean;
50
- after_ms?: number | undefined;
51
- };
52
- run_id?: string | undefined;
53
- };
54
- };
55
- isError: true;
56
- } | {
57
- content: {
58
- type: "text";
59
- text: string;
60
- }[];
61
- structuredContent: Record<string, unknown>;
62
- } | {
63
- isError: true;
64
- structuredContent: {
65
- missing: unknown[];
66
- } | {
67
- error: {
68
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
69
- reason: string;
70
- message: string;
71
- param?: string | undefined;
72
- details?: {
73
- [x: string]: unknown;
74
- } | undefined;
75
- next?: ({
76
- kind: "command";
77
- step: string;
78
- command: string;
79
- args: {
80
- [x: string]: unknown;
81
- };
82
- line?: string | undefined;
83
- why: string;
84
- safe_to_auto_execute: boolean;
85
- } | {
86
- kind: "user_action";
87
- step: string;
88
- why: string;
89
- safe_to_auto_execute: false;
90
- })[] | undefined;
91
- retry: {
92
- safe: boolean;
93
- after_ms?: number | undefined;
94
- };
95
- run_id?: string | undefined;
96
- };
97
- missing: unknown[];
98
- };
99
- content: {
100
- type: "text";
101
- text: string;
102
- }[];
103
- } | {
104
- structuredContent: {
105
- missing: unknown[];
106
- } | {
107
- error: {
108
- code: "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "internal_error" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
109
- reason: string;
110
- message: string;
111
- param?: string | undefined;
112
- details?: {
113
- [x: string]: unknown;
114
- } | undefined;
115
- next?: ({
116
- kind: "command";
117
- step: string;
118
- command: string;
119
- args: {
120
- [x: string]: unknown;
121
- };
122
- line?: string | undefined;
123
- why: string;
124
- safe_to_auto_execute: boolean;
125
- } | {
126
- kind: "user_action";
127
- step: string;
128
- why: string;
129
- safe_to_auto_execute: false;
130
- })[] | undefined;
131
- retry: {
132
- safe: boolean;
133
- after_ms?: number | undefined;
134
- };
135
- run_id?: string | undefined;
136
- };
137
- missing: unknown[];
138
- };
139
- content: {
140
- type: "text";
141
- text: string;
142
- }[];
143
- }>;
144
- export declare const buildMcpServer: (build: BuildProgram, options: ProgramOptions, profile: string, flags?: PolicyFlags) => {
145
- server: McpServer;
146
- tools: ToolDefinition[];
147
- };
148
- export declare const serveMcp: (build: BuildProgram, options: ProgramOptions, profile: string, flags?: PolicyFlags) => Promise<void>;
149
- /** Where `mcp serve --http` keeps the hashes of the logins it gave out, per profile. */
150
- export { httpTokenFile } from "./state.js";
151
- export interface HttpServing {
152
- publicUrl: URL;
153
- port: number;
154
- note: (text: string) => void;
155
- }
156
- /** The same server as stdio, one per browser session, behind cli-core's owner login; ends on Ctrl-C or --timeout. */
157
- export declare const serveMcpOverHttp: (build: BuildProgram, options: ProgramOptions, profile: string, flags: PolicyFlags, { publicUrl, port, note }: HttpServing) => Promise<void>;
158
- export interface ServedProfiles {
159
- env: NodeJS.ProcessEnv;
160
- set: ProfileSet;
161
- /** `--permission` entries, passed on to each profile's server: they only tighten. */
162
- permissions: readonly string[];
163
- note: (text: string) => void;
164
- signal?: AbortSignal;
165
- http?: {
166
- publicUrl: URL;
167
- port: number;
168
- };
169
- }
170
- /**
171
- * `drive mcp serve --profiles <a,b|all>`: one server for those profiles, each call run in that profile's own
172
- * `drive <profile> mcp serve` (cli-core's all-profiles module). Nothing picks a profile: every tool takes one.
173
- */
174
- export declare const serveProfiles: ({ env, set, permissions, note, signal, http }: ServedProfiles) => Promise<void>;
175
- //# sourceMappingURL=mcp.d.ts.map
package/dist/mcp.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGxE,OAAO,EAAE,K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