@wirecat/drive-cli 0.64.0 → 0.65.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 (182) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bundle/{all-profiles-BPPT2AK5.js → all-profiles-PD7GJHFA.js} +14 -13
  3. package/dist/bundle/{anthropic-JW6GOJUD.js → anthropic-PJKFON5H.js} +20 -11
  4. package/dist/bundle/{app-server-KAQIOJMZ.js → app-server-6ELQA6FJ.js} +59 -56
  5. package/dist/bundle/{bun-UT7GNTPV.js → bun-P54TGES2.js} +2 -2
  6. package/dist/bundle/{bun-sqlite-2OIVV3LS.js → bun-sqlite-TND5ZRJH.js} +12 -8
  7. package/dist/bundle/chunk-2AFI4KGI.js +185 -0
  8. package/dist/bundle/{chunk-WWCYTMAV.js → chunk-3HXNDF6Q.js} +2 -2
  9. package/dist/bundle/{chunk-46CD64J2.js → chunk-3ONWN3IA.js} +166 -53
  10. package/dist/bundle/{chunk-4YRENUB5.js → chunk-42G2XNPN.js} +2 -2
  11. package/dist/bundle/chunk-4AOINPN2.js +66 -0
  12. package/dist/bundle/{chunk-ZF6GUZCE.js → chunk-4EDWLR22.js} +1 -1
  13. package/dist/bundle/{chunk-BEZJA44H.js → chunk-4Y5YBFMS.js} +7 -7
  14. package/dist/bundle/{chunk-B7XBIOMR.js → chunk-54V4H6PM.js} +16 -16
  15. package/dist/bundle/{chunk-4CNTID2X.js → chunk-5XSBCMAF.js} +4 -4
  16. package/dist/bundle/{chunk-IDAK4DDK.js → chunk-6DCLZLGX.js} +1 -1
  17. package/dist/bundle/{chunk-G4KEKKDE.js → chunk-7AQGVX5O.js} +20 -20
  18. package/dist/bundle/{chunk-34BIDKF4.js → chunk-7TAP7Y2E.js} +508 -155
  19. package/dist/bundle/{chunk-BZ2ZKILM.js → chunk-A27UVLPK.js} +3 -3
  20. package/dist/bundle/{chunk-SIOIMO62.js → chunk-A4QNADEX.js} +57 -51
  21. package/dist/bundle/{chunk-FXBHOCJK.js → chunk-ADLS6FVG.js} +1 -1
  22. package/dist/bundle/{chunk-66AF4FBW.js → chunk-B2LPCHQN.js} +4 -4
  23. package/dist/bundle/{chunk-M73NNJ3X.js → chunk-CGQRZRTH.js} +2 -2
  24. package/dist/bundle/{chunk-KVW4XNKB.js → chunk-CWLL63JD.js} +107 -48
  25. package/dist/bundle/{chunk-CPMRM3GQ.js → chunk-D6Z43SOG.js} +1592 -335
  26. package/dist/bundle/{chunk-QXCKJUZY.js → chunk-D7WB54P7.js} +111 -27
  27. package/dist/bundle/{chunk-VT2UFYPJ.js → chunk-DA63E2UM.js} +13 -9
  28. package/dist/bundle/{chunk-2FEZ24DK.js → chunk-ECEP4SO3.js} +20 -20
  29. package/dist/bundle/{chunk-ZSZJLJIA.js → chunk-EHU6EYGO.js} +38 -28
  30. package/dist/bundle/{chunk-EJ4PNHPP.js → chunk-ELJUBPY4.js} +1 -1
  31. package/dist/bundle/{chunk-F2VDAG32.js → chunk-EM7NL5ES.js} +3 -3
  32. package/dist/bundle/{chunk-O2QO5UZC.js → chunk-EU5MD24W.js} +13 -13
  33. package/dist/bundle/{chunk-KIN6PDFE.js → chunk-EZ2OLYEK.js} +4 -4
  34. package/dist/bundle/{chunk-OH3K2E7X.js → chunk-F56DRBGY.js} +655 -1220
  35. package/dist/bundle/{chunk-VIJ6ACYB.js → chunk-FA6JNXCC.js} +8 -8
  36. package/dist/bundle/{chunk-KE4XPPRQ.js → chunk-FBHSWQU7.js} +1531 -136
  37. package/dist/bundle/{chunk-ZRZ4HTCK.js → chunk-GW3LBY3T.js} +51 -67
  38. package/dist/bundle/{chunk-6B37XO6B.js → chunk-HP3NT6JJ.js} +3 -3
  39. package/dist/bundle/{chunk-IX7NQJLY.js → chunk-I272E6UR.js} +9 -8
  40. package/dist/bundle/{chunk-5HSRQ53R.js → chunk-IBO23OID.js} +2 -2
  41. package/dist/bundle/{chunk-EZ6O3ST3.js → chunk-II4S2DBJ.js} +3 -3
  42. package/dist/bundle/{chunk-3NULZGQU.js → chunk-IKHOIXJR.js} +2 -2
  43. package/dist/bundle/{chunk-JRXFW7HE.js → chunk-IMHW7VIV.js} +5 -5
  44. package/dist/bundle/{chunk-USLZE36C.js → chunk-JMJIH6JH.js} +6 -6
  45. package/dist/bundle/{chunk-C7WBNOYW.js → chunk-JPPPLKAO.js} +26 -1
  46. package/dist/bundle/{chunk-EQEGJVO2.js → chunk-LMKPP2JP.js} +1 -1
  47. package/dist/bundle/{chunk-G3NULXOM.js → chunk-M7ELUGU6.js} +4 -4
  48. package/dist/bundle/{chunk-6G53ZFUT.js → chunk-MCPOZNWG.js} +1 -1
  49. package/dist/bundle/{chunk-EWGVDFPT.js → chunk-NI5PD5KM.js} +39203 -35871
  50. package/dist/bundle/{chunk-AHB4OJCI.js → chunk-NQ5XMSLA.js} +3678 -2049
  51. package/dist/bundle/chunk-NQRTKYJB.js +257 -0
  52. package/dist/bundle/{chunk-3J5KAFNA.js → chunk-O6K2E7OA.js} +3917 -3005
  53. package/dist/bundle/{chunk-J62DI53V.js → chunk-O7ZDCOZE.js} +1 -1
  54. package/dist/bundle/{chunk-XPXKD63J.js → chunk-OFJXHEFT.js} +13 -13
  55. package/dist/bundle/chunk-OWMZUWCM.js +109 -0
  56. package/dist/bundle/chunk-PHOL2DZM.js +138 -0
  57. package/dist/bundle/{chunk-KG2XKEHL.js → chunk-PLP5527C.js} +5 -5
  58. package/dist/bundle/{chunk-5ZBR55US.js → chunk-RNHGQ35R.js} +1 -1
  59. package/dist/bundle/{chunk-IK6KH3RE.js → chunk-RX5CJ55S.js} +1 -1
  60. package/dist/bundle/{chunk-K6BSB53R.js → chunk-SE352DBY.js} +1 -1
  61. package/dist/bundle/chunk-SEQWBZYH.js +18 -0
  62. package/dist/bundle/{chunk-LOMW6F2E.js → chunk-SIWXYB4E.js} +3734 -3448
  63. package/dist/bundle/{chunk-GW3U6OLD.js → chunk-SNLSEYJO.js} +1 -1
  64. package/dist/bundle/{chunk-UJR272CP.js → chunk-SS4LKLD7.js} +52 -605
  65. package/dist/bundle/{chunk-BEUAICUD.js → chunk-TMHF4BCL.js} +2 -2
  66. package/dist/bundle/{chunk-BDYWZ7JE.js → chunk-TOVWMURV.js} +30 -6
  67. package/dist/bundle/{chunk-N622LRPM.js → chunk-TTP4NOP3.js} +4 -4
  68. package/dist/bundle/chunk-UTNRBOEN.js +53 -0
  69. package/dist/bundle/{chunk-36GPBPWM.js → chunk-VDZY3L7U.js} +3 -1
  70. package/dist/bundle/chunk-VHQYWFWV.js +13 -0
  71. package/dist/bundle/{chunk-VPLFD5RJ.js → chunk-VLXWAH5E.js} +4 -4
  72. package/dist/bundle/{chunk-UIEA6FIV.js → chunk-VMAMRFFC.js} +23 -23
  73. package/dist/bundle/{chunk-HW4UPST2.js → chunk-W2XY6C5S.js} +2 -2
  74. package/dist/bundle/{chunk-P7DEGRZA.js → chunk-WRAUO5EJ.js} +22 -24
  75. package/dist/bundle/{chunk-QEAD2LF4.js → chunk-WRMJN6UQ.js} +3 -3
  76. package/dist/bundle/{chunk-UD55VB2N.js → chunk-WVJHZIDH.js} +3 -3
  77. package/dist/bundle/{chunk-B67BLRAI.js → chunk-X7YGGWXI.js} +1 -59
  78. package/dist/bundle/{chunk-EC2XGDKJ.js → chunk-XPWZSW6Y.js} +4 -4
  79. package/dist/bundle/{chunk-E2LBCCTG.js → chunk-XYE7XZPB.js} +5 -5
  80. package/dist/bundle/{chunk-TNV2FXVK.js → chunk-Y5PKRITX.js} +5 -5
  81. package/dist/bundle/{chunk-5OFA5EXE.js → chunk-Z2ADO6UA.js} +2 -2
  82. package/dist/bundle/{chunk-PBMSBCVB.js → chunk-ZD4MB7NH.js} +1 -1
  83. package/dist/bundle/{chunk-2W464HAE.js → chunk-ZILALBYQ.js} +4 -4
  84. package/dist/bundle/{chunk-OEVHZOHC.js → chunk-ZR2EJPMQ.js} +44 -15
  85. package/dist/bundle/command-contract-25E4PYMD.js +40 -0
  86. package/dist/bundle/command-server-entry-36JXYIJB.js +170 -0
  87. package/dist/bundle/{decode-HTOQ6S3V.js → decode-T5ZW57WZ.js} +8 -8
  88. package/dist/bundle/{dispatch-SH5SP6LA.js → dispatch-RMA2XFYA.js} +9 -9
  89. package/dist/bundle/drive.js +11 -11
  90. package/dist/bundle/{echarts-KFHB6SLX.js → echarts-KQ44LPSF.js} +2 -2
  91. package/dist/bundle/{embed-YATFB2PN.js → embed-Q7XST53J.js} +9 -9
  92. package/dist/bundle/{embedder-MQPDFGTJ.js → embedder-RWZSBVW2.js} +12 -12
  93. package/dist/bundle/entry-HPLW4QL2.js +25 -0
  94. package/dist/bundle/{failure-4FQL4XJI.js → failure-7NP4QPIN.js} +4 -4
  95. package/dist/bundle/first-run-RL3RKYZW.js +30 -0
  96. package/dist/bundle/first-screen-NX3TM2VJ.js +38 -0
  97. package/dist/bundle/google-DPD5N6AQ.js +42 -0
  98. package/dist/bundle/{google-api-QMFGCXBM.js → google-api-P5DRHD7L.js} +61 -55
  99. package/dist/bundle/grants-TX4MHLI4.js +109 -0
  100. package/dist/bundle/{identity-FYVDK4M2.js → identity-VDV6CHRW.js} +6 -6
  101. package/dist/bundle/{instructions-D3GF3B7M.js → instructions-Q45FVY6H.js} +1 -1
  102. package/dist/bundle/{login-COFZ2IWP.js → login-XKN3NI6X.js} +67 -61
  103. package/dist/bundle/{mcp-RKJG22KM.js → mcp-7KQUJNFN.js} +2 -2
  104. package/dist/bundle/{node-OFICOKX3.js → node-MSW565D3.js} +2 -2
  105. package/dist/bundle/{node-KM3CUABH.js → node-P4E63KXA.js} +9 -9
  106. package/dist/bundle/{node-sqlite-DNBTDOXD.js → node-sqlite-S74XVVHL.js} +13 -9
  107. package/dist/bundle/oauth-6R7AWAES.js +22 -0
  108. package/dist/bundle/{open-PTPR2YWX.js → open-P7UQG7XJ.js} +8 -8
  109. package/dist/bundle/{openai-2KV5LUW4.js → openai-DDHJ57KZ.js} +19 -40
  110. package/dist/bundle/{process-EAW6NST2.js → process-NMUB5SHK.js} +1 -1
  111. package/dist/bundle/{program-6UV5Q5YN.js → program-PJNWP6JW.js} +294 -137
  112. package/dist/bundle/{prompt-634TPMJK.js → prompt-VOSMK4C2.js} +8 -8
  113. package/dist/bundle/{reasons-DDWCEYSQ.js → reasons-KDAXOC5S.js} +5 -5
  114. package/dist/bundle/{recognize-SJO6QUDW.js → recognize-GZIY63HS.js} +7 -7
  115. package/dist/bundle/{remote-6JXZITKF.js → remote-V3YGN7LN.js} +10 -10
  116. package/dist/bundle/{rerank-MD5VOPQ6.js → rerank-XRU6AVN7.js} +10 -10
  117. package/dist/bundle/{serve-LZTROA2M.js → serve-NDOAFA57.js} +12 -12
  118. package/dist/bundle/{server-NSA3UAFY.js → server-BKGWJYMC.js} +46 -44
  119. package/dist/bundle/server-QD2MUJJZ.js +72 -0
  120. package/dist/bundle/{services-F5A6XQCV.js → services-TYDMFQCA.js} +101 -41
  121. package/dist/bundle/{sqlite-runtime-7YF6REKS.js → sqlite-runtime-UAFJKSJR.js} +9 -9
  122. package/dist/bundle/{start-MUFLE6FA.js → start-2ZLDP2OE.js} +7 -7
  123. package/dist/bundle/{state-UC54F3YZ.js → state-6SP27J2K.js} +9 -9
  124. package/dist/bundle/{store-J53YNAH6.js → store-4UUY545Q.js} +25 -18
  125. package/dist/bundle/{store-F5FJGWMR.js → store-EJN27MXI.js} +61 -28
  126. package/dist/bundle/store-maintenance-command-LETURZDC.js +60 -0
  127. package/dist/bundle/tokens-MTFJPTYT.js +107 -0
  128. package/dist/commands/config.d.ts.map +1 -1
  129. package/dist/commands/config.js +6 -5
  130. package/dist/commands/config.js.map +1 -1
  131. package/dist/commands/context.d.ts +4 -2
  132. package/dist/commands/context.d.ts.map +1 -1
  133. package/dist/commands/context.js.map +1 -1
  134. package/dist/commands/documents.d.ts +2 -0
  135. package/dist/commands/documents.d.ts.map +1 -1
  136. package/dist/commands/documents.js +39 -3
  137. package/dist/commands/documents.js.map +1 -1
  138. package/dist/config.d.ts +13 -0
  139. package/dist/config.d.ts.map +1 -1
  140. package/dist/config.js +32 -2
  141. package/dist/config.js.map +1 -1
  142. package/dist/documents-add.d.ts +49 -0
  143. package/dist/documents-add.d.ts.map +1 -0
  144. package/dist/documents-add.js +122 -0
  145. package/dist/documents-add.js.map +1 -0
  146. package/dist/errors.d.ts +1 -0
  147. package/dist/errors.d.ts.map +1 -1
  148. package/dist/errors.js +9 -1
  149. package/dist/errors.js.map +1 -1
  150. package/dist/knowledge.d.ts +1 -1
  151. package/dist/knowledge.d.ts.map +1 -1
  152. package/dist/knowledge.js +15 -17
  153. package/dist/knowledge.js.map +1 -1
  154. package/dist/model.d.ts +3 -0
  155. package/dist/model.d.ts.map +1 -1
  156. package/dist/model.js.map +1 -1
  157. package/dist/program.d.ts.map +1 -1
  158. package/dist/program.js +22 -15
  159. package/dist/program.js.map +1 -1
  160. package/dist/reasons.d.ts.map +1 -1
  161. package/dist/reasons.js +25 -0
  162. package/dist/reasons.js.map +1 -1
  163. package/dist/store.d.ts.map +1 -1
  164. package/dist/store.js +20 -0
  165. package/dist/store.js.map +1 -1
  166. package/dist/version.d.ts +1 -1
  167. package/dist/version.js +1 -1
  168. package/package.json +4 -4
  169. package/dist/bundle/chunk-DD7EFG6B.js +0 -35
  170. package/dist/bundle/chunk-GSMYXGFR.js +0 -62
  171. package/dist/bundle/command-contract-H5OYJOPF.js +0 -38
  172. package/dist/bundle/entry-YZBB647C.js +0 -22
  173. package/dist/bundle/first-run-5JT3UQZB.js +0 -30
  174. package/dist/bundle/first-screen-BEMDEWO7.js +0 -36
  175. package/dist/bundle/google-DVADVICN.js +0 -36
  176. package/dist/bundle/grants-WKB2E4TA.js +0 -103
  177. package/dist/bundle/oauth-PDQHWFBF.js +0 -22
  178. package/dist/bundle/server-GT7X666D.js +0 -69
  179. package/dist/bundle/store-maintenance-command-GJVXLBAB.js +0 -58
  180. package/dist/bundle/tokens-H2EJKGA5.js +0 -101
  181. package/dist/bundle/{chunk-SW6C6WH5.js → chunk-YVNHQFLC.js} +0 -0
  182. package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-CE73EWJ2.js} +3 -3
@@ -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-EJ4PNHPP.js";
5
+ } from "./chunk-ELJUBPY4.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/attachments/limits.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/limits.js
11
11
  var MAX_FILE_BYTES = 50 * 1024 * 1024;
12
12
  var MAX_TEXT_CHARS = 2e6;
13
13
  var ATTACHMENT_LIMIT_ENV = [
@@ -33,7 +33,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
33
33
  return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
34
34
  }, "pdfPreviewLimits");
35
35
 
36
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
36
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
37
37
  var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
38
38
  var ID = /^[\w-]{10,}$/;
39
39
  var trimUrl = /* @__PURE__ */ __name((url) => {
@@ -1,61 +1,10 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
- import {
4
- CliError,
5
- errorCodes
6
- } from "./chunk-EJ4PNHPP.js";
7
3
  import {
8
4
  __name
9
5
  } from "./chunk-ZVVMGPBJ.js";
10
6
 
11
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/errors/failures.js
12
- var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
13
- var isCommanderFailure = /* @__PURE__ */ __name((value) => {
14
- const { code, exitCode } = value ?? {};
15
- return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
16
- }, "isCommanderFailure");
17
- var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
18
- var SQLITE_CORRUPT = 11;
19
- var SQLITE_NOTADB = 26;
20
- var DAMAGED_TEXT = /database disk image is malformed|file is not a database|fts5: corruption/i;
21
- var sqliteCode = /* @__PURE__ */ __name((error) => {
22
- const { errcode, errno, name } = error ?? {};
23
- const code = typeof errcode === "number" ? errcode : name === "SQLiteError" && typeof errno === "number" ? errno : null;
24
- return code === null ? void 0 : code & 255;
25
- }, "sqliteCode");
26
- var damageIn = /* @__PURE__ */ __name((error) => {
27
- if (isCliFailure(error) || isCommanderFailure(error))
28
- return void 0;
29
- let at = error;
30
- for (let depth = 0; depth < 5 && at instanceof Error; depth += 1) {
31
- const code = sqliteCode(at);
32
- if (code !== void 0 && [SQLITE_CORRUPT, SQLITE_NOTADB].includes(code) || DAMAGED_TEXT.test(at.message))
33
- return at;
34
- at = at.cause;
35
- }
36
- return void 0;
37
- }, "damageIn");
38
- var wrapping = /* @__PURE__ */ __name((error, original) => {
39
- Object.defineProperty(error, "cause", { value: original, configurable: true, writable: true });
40
- if (original instanceof Error && original.stack)
41
- error.stack = original.stack;
42
- return error;
43
- }, "wrapping");
44
- var storeDamaged = /* @__PURE__ */ __name((error, next) => damageIn(error) ? wrapping(new CliError("configuration_error", `the store file is damaged${next ? `; \`${next}\` says what is damaged and what to do` : ""}`, { reason: "store.damaged" }), error) : error, "storeDamaged");
45
- var damagedFile = /* @__PURE__ */ __name(async (files, work) => {
46
- try {
47
- return await work();
48
- } catch (error) {
49
- if (!damageIn(error))
50
- throw error;
51
- throw wrapping(new CliError("validation_error", `${files.join(" or ")} is damaged or not a database`, {
52
- reason: "store.file-damaged"
53
- }), error);
54
- }
55
- }, "damagedFile");
56
- var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
57
-
58
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/runs/secrets.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/runs/secrets.js
59
8
  var SECRET_WORDS = /* @__PURE__ */ new Set([
60
9
  "authorization",
61
10
  "cookie",
@@ -138,13 +87,6 @@ var RUN = /(?<![A-Za-z0-9_+/-])[A-Za-z0-9_+/-]{20,}/g;
138
87
  var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
139
88
 
140
89
  export {
141
- isCliFailure,
142
- isCommanderFailure,
143
- failureKey,
144
- sqliteCode,
145
- storeDamaged,
146
- damagedFile,
147
- isStoreDamage,
148
90
  secretNamed,
149
91
  holdsCredential,
150
92
  withoutSecrets
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  singleLine
5
- } from "./chunk-IDAK4DDK.js";
5
+ } from "./chunk-6DCLZLGX.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
10
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/names.js
11
11
  var FIRST_PARTY_TOOLS = [
12
12
  { name: "tg", package: "@wirecat/tg-cli" },
13
13
  { name: "max", package: "@wirecat/max-cli" },
@@ -31,7 +31,7 @@ var DESCRIBE_FLAG = "--wcat-describe";
31
31
  var DESCRIBE_MAX_BYTES = 64 * 1024;
32
32
  var DISPATCH_FLAG = "--wcat-dispatch";
33
33
 
34
- // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
34
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/describe.js
35
35
  var DESCRIBE_FORMAT = 1;
36
36
  var DESCRIBE_MANIFEST_FORMAT = 2;
37
37
  var describeAnswer = /* @__PURE__ */ __name((tool, manifest) => {
@@ -74,7 +74,7 @@ var parseDescribe = /* @__PURE__ */ __name((text) => {
74
74
  };
75
75
  }, "parseDescribe");
76
76
 
77
- // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
77
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/shim.js
78
78
  import { lstatSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
79
79
  import { join } from "node:path";
80
80
  var SHIM_FORMAT = 2;
@@ -8,22 +8,22 @@ import {
8
8
  XLSX,
9
9
  supported,
10
10
  tooManyEntries
11
- } from "./chunk-PBMSBCVB.js";
11
+ } from "./chunk-ZD4MB7NH.js";
12
12
  import {
13
13
  googleError
14
- } from "./chunk-GSMYXGFR.js";
14
+ } from "./chunk-NQRTKYJB.js";
15
15
  import {
16
16
  extractText
17
- } from "./chunk-KE4XPPRQ.js";
17
+ } from "./chunk-FBHSWQU7.js";
18
18
  import {
19
19
  MAX_TEXT_CHARS
20
- } from "./chunk-UD55VB2N.js";
20
+ } from "./chunk-WVJHZIDH.js";
21
21
  import {
22
22
  importFrom
23
23
  } from "./chunk-Y5E2WNWB.js";
24
24
  import {
25
25
  CliError
26
- } from "./chunk-EJ4PNHPP.js";
26
+ } from "./chunk-ELJUBPY4.js";
27
27
  import {
28
28
  __name
29
29
  } from "./chunk-ZVVMGPBJ.js";
@@ -6,21 +6,21 @@ import {
6
6
  answerSchema,
7
7
  describeOptions,
8
8
  metaOf
9
- } from "./chunk-LOMW6F2E.js";
9
+ } from "./chunk-SIWXYB4E.js";
10
10
  import {
11
11
  keyForCommand
12
- } from "./chunk-OH3K2E7X.js";
12
+ } from "./chunk-F56DRBGY.js";
13
13
  import {
14
14
  jsonSchemaOf
15
- } from "./chunk-BDYWZ7JE.js";
15
+ } from "./chunk-TOVWMURV.js";
16
16
  import {
17
17
  CliError
18
- } from "./chunk-EJ4PNHPP.js";
18
+ } from "./chunk-ELJUBPY4.js";
19
19
  import {
20
20
  __name
21
21
  } from "./chunk-ZVVMGPBJ.js";
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/command-contract.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/cli/command-contract.js
24
24
  var SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
25
25
  var outputOf = /* @__PURE__ */ __name((command) => {
26
26
  const entity = answerEntitySchema(command);
@@ -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-EJ4PNHPP.js";
5
+ } from "./chunk-ELJUBPY4.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/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();
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EJ4PNHPP.js";
5
+ } from "./chunk-ELJUBPY4.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
@@ -11,7 +11,7 @@ import {
11
11
  checkApiParameter,
12
12
  operations,
13
13
  parseApiJson
14
- } from "./chunk-AHB4OJCI.js";
14
+ } from "./chunk-NQ5XMSLA.js";
15
15
  import {
16
16
  array,
17
17
  boolean,
@@ -27,15 +27,15 @@ import {
27
27
  string,
28
28
  transform,
29
29
  unknown
30
- } from "./chunk-BDYWZ7JE.js";
30
+ } from "./chunk-TOVWMURV.js";
31
31
  import {
32
32
  CliError
33
- } from "./chunk-EJ4PNHPP.js";
33
+ } from "./chunk-ELJUBPY4.js";
34
34
  import {
35
35
  __name
36
36
  } from "./chunk-ZVVMGPBJ.js";
37
37
 
38
- // node_modules/.pnpm/@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/codegen/runtime.js
38
+ // node_modules/.pnpm/@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/codegen/runtime.js
39
39
  var isLossless = /* @__PURE__ */ __name((input) => typeof input === "object" && input !== null && input.isLosslessNumber === true && typeof input.value === "string", "isLossless");
40
40
  var INTEGER = /^-?\d+$/;
41
41
  var INT64_MIN = -(2n ** 63n);
@@ -3,11 +3,11 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  operations,
5
5
  privateFiles
6
- } from "./chunk-AHB4OJCI.js";
6
+ } from "./chunk-NQ5XMSLA.js";
7
7
  import {
8
8
  commandPathKey,
9
9
  commandPermissions
10
- } from "./chunk-UJR272CP.js";
10
+ } from "./chunk-SS4LKLD7.js";
11
11
  import {
12
12
  AI_ENTRIES,
13
13
  checkConfigText,
@@ -15,23 +15,23 @@ import {
15
15
  settingsFor,
16
16
  usableProfileName,
17
17
  withSettingDefaults
18
- } from "./chunk-LOMW6F2E.js";
18
+ } from "./chunk-SIWXYB4E.js";
19
19
  import {
20
20
  LEVELS
21
- } from "./chunk-OH3K2E7X.js";
21
+ } from "./chunk-F56DRBGY.js";
22
22
  import {
23
23
  MAX_TEXT_CHARS
24
- } from "./chunk-UD55VB2N.js";
24
+ } from "./chunk-WVJHZIDH.js";
25
25
  import {
26
26
  DRIVE_APP
27
- } from "./chunk-M73NNJ3X.js";
27
+ } from "./chunk-CGQRZRTH.js";
28
28
  import {
29
29
  BASE_CONSTANTS,
30
30
  baseConstantsSchema,
31
31
  loadConstants,
32
32
  resolvePaths,
33
33
  saveConfigFile
34
- } from "./chunk-G4KEKKDE.js";
34
+ } from "./chunk-7AQGVX5O.js";
35
35
  import {
36
36
  array,
37
37
  boolean,
@@ -54,15 +54,15 @@ import {
54
54
  transform,
55
55
  trim,
56
56
  union
57
- } from "./chunk-BDYWZ7JE.js";
57
+ } from "./chunk-TOVWMURV.js";
58
58
  import {
59
59
  CliError
60
- } from "./chunk-EJ4PNHPP.js";
60
+ } from "./chunk-ELJUBPY4.js";
61
61
  import {
62
62
  __name
63
63
  } from "./chunk-ZVVMGPBJ.js";
64
64
 
65
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/oauth/client-file.js
65
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/oauth/client-file.js
66
66
  import { readFileSync } from "node:fs";
67
67
  var readClientFile = /* @__PURE__ */ __name((location, options = {}) => {
68
68
  if (!options.shipped && typeof location === "string") {
@@ -83,7 +83,7 @@ var readClientFile = /* @__PURE__ */ __name((location, options = {}) => {
83
83
  }
84
84
  }, "readClientFile");
85
85
 
86
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/constants/obscure.js
86
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/constants/obscure.js
87
87
  import { createDecipheriv } from "node:crypto";
88
88
  var KEY = Buffer.from("d43012779aa2dded3e98092a3dbcf5d8980c564172f5ce0a5fd0574e5f740339", "hex");
89
89
  var reveal = /* @__PURE__ */ __name((obscured) => {
@@ -92,7 +92,7 @@ var reveal = /* @__PURE__ */ __name((obscured) => {
92
92
  return Buffer.concat([decipher.update(bytes.subarray(16)), decipher.final()]).toString("utf8");
93
93
  }, "reveal");
94
94
 
95
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/constants/index.js
95
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/constants/index.js
96
96
  var CORE_CONSTANTS = new URL("../../constants.json", new URL("constants/index.js", import.meta.resolve("@wirecat/cli-core")).href);
97
97
  var constantsSchema = object({
98
98
  ...baseConstantsSchema.entries,
@@ -227,13 +227,23 @@ var RunSettings = {
227
227
  runs_size_limit_mb: optional(pipe(number(), integer(), minValue(1))),
228
228
  record_input: optional(union([boolean(), literal("failed")]))
229
229
  };
230
+ var DEFAULT_ADD_PROFILES = 5;
231
+ var MOST_ADD_PROFILES = 50;
232
+ var AcrossProfiles = {
233
+ max_add_profiles: optional(pipe(number(), integer(), minValue(1), maxValue(MOST_ADD_PROFILES)))
234
+ };
230
235
  var SharedDefaults = {
231
236
  limit: optional(pipe(number(), integer(), minValue(1))),
232
237
  sends_per_hour: optional(pipe(number(), integer(), minValue(0))),
233
238
  update_check: optional(boolean()),
234
239
  skill_hint: optional(boolean())
235
240
  };
236
- var DEFAULTS_ONLY = /* @__PURE__ */ new Set([...Object.keys(RunSettings), "update_check", "skill_hint"]);
241
+ var DEFAULTS_ONLY = /* @__PURE__ */ new Set([
242
+ ...Object.keys(RunSettings),
243
+ ...Object.keys(AcrossProfiles),
244
+ "update_check",
245
+ "skill_hint"
246
+ ]);
237
247
  var SETTING_NAMES = /* @__PURE__ */ new Set([...Object.keys(Common), "picture_search", ...DEFAULTS_ONLY]);
238
248
  var Mirror = strictObject({
239
249
  id: pipe(string(), regex(/^[a-z0-9-]{1,40}$/)),
@@ -250,7 +260,7 @@ var Profile = strictObject({
250
260
  });
251
261
  var ConfigSchema = strictObject({
252
262
  profiles: optional(record(string(), Profile), {}),
253
- defaults: optional(strictObject({ ...Common, ...RunSettings, ...SharedDefaults }))
263
+ defaults: optional(strictObject({ ...Common, ...RunSettings, ...AcrossProfiles, ...SharedDefaults }))
254
264
  });
255
265
  var keyOf = /* @__PURE__ */ __name((path) => {
256
266
  if (path[0] !== "api" || path[1] === void 0)
@@ -277,6 +287,11 @@ var configuration = settingsFor(DRIVE_APP, {
277
287
  key: "max_text_chars",
278
288
  default: MAX_TEXT_CHARS,
279
289
  description: "the most characters of text one file may have to be imported"
290
+ },
291
+ {
292
+ key: "max_add_profiles",
293
+ default: DEFAULT_ADD_PROFILES,
294
+ description: "the most profiles documents add may try for one document"
280
295
  }
281
296
  ],
282
297
  permissions: commandPermissions({ keyOf, extra: [...permissionKeys([])], defaults: DEFAULT_LEVELS })
@@ -382,6 +397,16 @@ var application = /* @__PURE__ */ __name((env, choice = {}) => googleAppOf(env,
382
397
  var selectedFolders = /* @__PURE__ */ __name((env, profile, filter = {}) => activeProfile(env, profile).roots.flatMap((id) => filter.id === void 0 || id === filter.id ? [{ id }] : []), "selectedFolders");
383
398
  var configuredMirrors = /* @__PURE__ */ __name((env, profile, filter = {}) => (activeProfile(env, profile).mirrors ?? []).filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value)), "configuredMirrors");
384
399
  var configuredSessions = /* @__PURE__ */ __name((env, filter, knownPermissions) => Object.entries(readConfig(env, knownPermissions).profiles).flatMap(([name, row]) => (filter.profile === void 0 || filter.profile === name) && (filter.storage === void 0 || filter.storage === row.storage) ? [{ profile: name, selected_folders: row.roots.length, storage: row.storage }] : []), "configuredSessions");
400
+ var maxAddProfiles = /* @__PURE__ */ __name((env) => readConfig(env).defaults?.max_add_profiles ?? DEFAULT_ADD_PROFILES, "maxAddProfiles");
401
+ var checkAddProfiles = /* @__PURE__ */ __name((value) => {
402
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > MOST_ADD_PROFILES)
403
+ throw new CliError("validation_error", `max_add_profiles is a whole number from 1 to ${MOST_ADD_PROFILES}`);
404
+ return value;
405
+ }, "checkAddProfiles");
406
+ var profileLocked = /* @__PURE__ */ __name((lock, named) => new CliError("permission_error", `this process is locked to profile ${lock} (DRIVE_PROFILE_LOCK) \u2014 ${named} is refused`, {
407
+ reason: "profile.locked"
408
+ }), "profileLocked");
409
+ var profileRequired = /* @__PURE__ */ __name((choices, how = "drive <profile> \u2026") => new CliError("validation_error", choices.length ? `name a profile: ${how} \u2014 profiles here: ${choices.join(", ")} (or set DRIVE_PROFILE)` : "no profiles here yet; create one with drive personal session start (any name in place of personal)", { reason: "profile.required", profiles: [...choices] }), "profileRequired");
385
410
 
386
411
  export {
387
412
  oauthClientReport,
@@ -411,5 +436,9 @@ export {
411
436
  application,
412
437
  selectedFolders,
413
438
  configuredMirrors,
414
- configuredSessions
439
+ configuredSessions,
440
+ maxAddProfiles,
441
+ checkAddProfiles,
442
+ profileLocked,
443
+ profileRequired
415
444
  };
@@ -0,0 +1,40 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ SCHEMA_DIALECT,
5
+ commandContract,
6
+ commandPathOf,
7
+ findCommand,
8
+ outputOf
9
+ } from "./chunk-Y5PKRITX.js";
10
+ import "./chunk-SIWXYB4E.js";
11
+ import "./chunk-DA63E2UM.js";
12
+ import "./chunk-F56DRBGY.js";
13
+ import "./chunk-OWMZUWCM.js";
14
+ import "./chunk-VLXWAH5E.js";
15
+ import "./chunk-IKHOIXJR.js";
16
+ import "./chunk-O7ZDCOZE.js";
17
+ import "./chunk-A27UVLPK.js";
18
+ import "./chunk-B2LPCHQN.js";
19
+ import "./chunk-D6Z43SOG.js";
20
+ import "./chunk-ECEP4SO3.js";
21
+ import "./chunk-X7YGGWXI.js";
22
+ import "./chunk-4AOINPN2.js";
23
+ import "./chunk-4Y5YBFMS.js";
24
+ import "./chunk-YVNHQFLC.js";
25
+ import "./chunk-UTNRBOEN.js";
26
+ import "./chunk-7AQGVX5O.js";
27
+ import "./chunk-PLP5527C.js";
28
+ import "./chunk-Y5E2WNWB.js";
29
+ import "./chunk-6DCLZLGX.js";
30
+ import "./chunk-W2XY6C5S.js";
31
+ import "./chunk-TOVWMURV.js";
32
+ import "./chunk-ELJUBPY4.js";
33
+ import "./chunk-ZVVMGPBJ.js";
34
+ export {
35
+ SCHEMA_DIALECT,
36
+ commandContract,
37
+ commandPathOf,
38
+ findCommand,
39
+ outputOf
40
+ };
@@ -0,0 +1,170 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ COMMAND_SERVER_CONCURRENT,
5
+ enterCommandServer,
6
+ serveCommands
7
+ } from "./chunk-2AFI4KGI.js";
8
+ import "./chunk-SEQWBZYH.js";
9
+ import "./chunk-VHQYWFWV.js";
10
+ import {
11
+ ensureSqlite
12
+ } from "./chunk-TMHF4BCL.js";
13
+ import "./chunk-Y5PKRITX.js";
14
+ import {
15
+ commandServerRequest,
16
+ exitCodeSet,
17
+ inCommandServerRequest
18
+ } from "./chunk-SIWXYB4E.js";
19
+ import "./chunk-DA63E2UM.js";
20
+ import "./chunk-F56DRBGY.js";
21
+ import "./chunk-OWMZUWCM.js";
22
+ import "./chunk-VLXWAH5E.js";
23
+ import "./chunk-IKHOIXJR.js";
24
+ import "./chunk-O7ZDCOZE.js";
25
+ import "./chunk-A27UVLPK.js";
26
+ import "./chunk-B2LPCHQN.js";
27
+ import "./chunk-JMJIH6JH.js";
28
+ import {
29
+ asOwnProcess
30
+ } from "./chunk-D6Z43SOG.js";
31
+ import "./chunk-ECEP4SO3.js";
32
+ import "./chunk-X7YGGWXI.js";
33
+ import "./chunk-4AOINPN2.js";
34
+ import "./chunk-4Y5YBFMS.js";
35
+ import "./chunk-YVNHQFLC.js";
36
+ import "./chunk-VDZY3L7U.js";
37
+ import "./chunk-UTNRBOEN.js";
38
+ import "./chunk-7AQGVX5O.js";
39
+ import {
40
+ catchCrashes
41
+ } from "./chunk-PLP5527C.js";
42
+ import "./chunk-Y5E2WNWB.js";
43
+ import "./chunk-6DCLZLGX.js";
44
+ import "./chunk-W2XY6C5S.js";
45
+ import "./chunk-TOVWMURV.js";
46
+ import {
47
+ CliError
48
+ } from "./chunk-ELJUBPY4.js";
49
+ import {
50
+ __name
51
+ } from "./chunk-ZVVMGPBJ.js";
52
+
53
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/cli/command-server-entry.js
54
+ import { PassThrough } from "node:stream";
55
+ var route = /* @__PURE__ */ __name((stream, sink) => {
56
+ const original = stream.write;
57
+ stream.write = ((chunk, encoding, callback) => {
58
+ sink()(typeof chunk === "string" ? Buffer.from(chunk, typeof encoding === "string" ? encoding : "utf8") : Buffer.from(chunk));
59
+ const done = typeof encoding === "function" ? encoding : callback;
60
+ if (done)
61
+ process.nextTick(done);
62
+ return true;
63
+ });
64
+ return () => {
65
+ stream.write = original;
66
+ };
67
+ }, "route");
68
+ var closedStdin = /* @__PURE__ */ __name(() => {
69
+ const stdin = new PassThrough();
70
+ stdin.end();
71
+ return stdin;
72
+ }, "closedStdin");
73
+ var useStdin = /* @__PURE__ */ __name((outside) => Object.defineProperty(process, "stdin", {
74
+ get: /* @__PURE__ */ __name(() => commandServerRequest()?.stdin ?? outside, "get"),
75
+ configurable: true,
76
+ enumerable: true
77
+ }), "useStdin");
78
+ var roomFor = /* @__PURE__ */ __name((runs) => {
79
+ const emitters = [process, process.stdout, process.stderr];
80
+ const before = emitters.map((emitter) => emitter.getMaxListeners());
81
+ for (const emitter of emitters)
82
+ emitter.setMaxListeners(emitter.getMaxListeners() + 2 * runs);
83
+ return () => {
84
+ for (const [at, emitter] of emitters.entries())
85
+ emitter.setMaxListeners(before[at]);
86
+ };
87
+ }, "roomFor");
88
+ var serveEntry = /* @__PURE__ */ __name(async (entry, io, { firstRunAt, commanderExit }) => {
89
+ const release = catchCrashes({
90
+ cli: entry.app.command,
91
+ interactive: false,
92
+ ...entry.reasons ? { reasons: entry.reasons } : {},
93
+ target: io.signals
94
+ });
95
+ const stopper = new AbortController();
96
+ const stop = /* @__PURE__ */ __name(() => stopper.abort(new CliError("cancelled", "the command server was stopped", { retryable: false })), "stop");
97
+ const protocol = io.stdout.write.bind(io.stdout);
98
+ const ownStderr = io.stderr.write.bind(io.stderr);
99
+ const toStderr = /* @__PURE__ */ __name((chunk) => {
100
+ ownStderr(chunk);
101
+ }, "toStderr");
102
+ const sink = /* @__PURE__ */ __name((pick) => () => {
103
+ const request = commandServerRequest();
104
+ return request ? (chunk) => pick(request).push(chunk) : toStderr;
105
+ }, "sink");
106
+ const unrouteOut = route(process.stdout, sink((request) => request.stdout));
107
+ const unrouteErr = route(process.stderr, sink((request) => request.stderr));
108
+ const stdin = Object.getOwnPropertyDescriptor(process, "stdin");
109
+ const requests = io.stdin;
110
+ useStdin(closedStdin());
111
+ const unroom = roomFor(COMMAND_SERVER_CONCURRENT);
112
+ io.signals.on("SIGINT", stop).on("SIGTERM", stop);
113
+ io.stdout.on("error", stop);
114
+ const run = /* @__PURE__ */ __name(async (argv, alone) => {
115
+ const request = { stdout: [], stderr: [], stdin: closedStdin(), alone };
116
+ const requestIo = { ...io, argv: [...io.argv.slice(0, 2), ...argv], stdin: request.stdin };
117
+ const context = {
118
+ args: argv,
119
+ env: io.env,
120
+ tty: false,
121
+ signal: stopper.signal,
122
+ atStart: /* @__PURE__ */ __name(async (command) => {
123
+ await enterCommandServer(command, entry.app.command);
124
+ await firstRunAt(entry, requestIo, () => true)(command);
125
+ }, "atStart"),
126
+ ask: /* @__PURE__ */ __name(async () => false, "ask"),
127
+ openBrowser: /* @__PURE__ */ __name(async () => void 0, "openBrowser"),
128
+ outputClosed: /* @__PURE__ */ __name(() => false, "outputClosed"),
129
+ setExitCode: /* @__PURE__ */ __name((code2) => {
130
+ request.exitCode = code2;
131
+ }, "setExitCode")
132
+ };
133
+ const code = await inCommandServerRequest(request, () => asOwnProcess(async () => {
134
+ try {
135
+ const returned = await entry.run(context);
136
+ return typeof returned === "number" ? returned : exitCodeSet() ?? 0;
137
+ } catch (error) {
138
+ return commanderExit(error) ?? entry.fail(error, context);
139
+ }
140
+ }));
141
+ const text = /* @__PURE__ */ __name((chunks) => Buffer.concat(chunks).toString("utf8"), "text");
142
+ return { code, stdout: text(request.stdout), stderr: text(request.stderr) };
143
+ }, "run");
144
+ try {
145
+ if (entry.sqlite)
146
+ await ensureSqlite();
147
+ await serveCommands({
148
+ input: requests,
149
+ write: /* @__PURE__ */ __name((line) => new Promise((resolve) => protocol(line) ? resolve() : io.stdout.once("drain", resolve)), "write"),
150
+ run,
151
+ cli: entry.app.command,
152
+ concurrent: COMMAND_SERVER_CONCURRENT,
153
+ version: entry.app.version,
154
+ signal: stopper.signal
155
+ });
156
+ io.setExitCode(0);
157
+ } finally {
158
+ io.signals.off("SIGINT", stop).off("SIGTERM", stop);
159
+ unroom();
160
+ unrouteOut();
161
+ unrouteErr();
162
+ if (stdin)
163
+ Object.defineProperty(process, "stdin", stdin);
164
+ requests.destroy?.();
165
+ release();
166
+ }
167
+ }, "serveEntry");
168
+ export {
169
+ serveEntry
170
+ };
@@ -3,23 +3,23 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  SAMPLE_RATE,
5
5
  decodeOgg
6
- } from "./chunk-G3NULXOM.js";
7
- import "./chunk-G4KEKKDE.js";
8
- import "./chunk-KG2XKEHL.js";
6
+ } from "./chunk-M7ELUGU6.js";
7
+ import "./chunk-7AQGVX5O.js";
8
+ import "./chunk-PLP5527C.js";
9
9
  import {
10
10
  importFrom
11
11
  } from "./chunk-Y5E2WNWB.js";
12
- import "./chunk-IDAK4DDK.js";
13
- import "./chunk-HW4UPST2.js";
14
- import "./chunk-BDYWZ7JE.js";
12
+ import "./chunk-6DCLZLGX.js";
13
+ import "./chunk-W2XY6C5S.js";
14
+ import "./chunk-TOVWMURV.js";
15
15
  import {
16
16
  CliError
17
- } from "./chunk-EJ4PNHPP.js";
17
+ } from "./chunk-ELJUBPY4.js";
18
18
  import {
19
19
  __name
20
20
  } from "./chunk-ZVVMGPBJ.js";
21
21
 
22
- // node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/speech/decode.js
22
+ // node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/speech/decode.js
23
23
  import { spawn } from "node:child_process";
24
24
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
25
25
  import { createRequire } from "node:module";