@wirecat/drive-cli 0.50.0 → 0.52.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 (148) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bundle/{all-profiles-WQTVOCIS.js → all-profiles-CYW6XBBS.js} +8 -8
  3. package/dist/bundle/{anthropic-YCA2AWIJ.js → anthropic-KW6KU36Y.js} +5 -5
  4. package/dist/bundle/{app-server-ZQOYUQJH.js → app-server-TCJZ333E.js} +53 -52
  5. package/dist/bundle/{bun-5NFIDHGM.js → bun-7SYKSCLA.js} +2 -2
  6. package/dist/bundle/{bun-sqlite-OAQE4M2E.js → bun-sqlite-RI7DR6RZ.js} +4 -4
  7. package/dist/bundle/{chunk-KZEOWOZV.js → chunk-234MHU76.js} +7 -7
  8. package/dist/bundle/{chunk-IGG4RBIZ.js → chunk-2623YE5I.js} +109 -98
  9. package/dist/bundle/{chunk-POD2GHQB.js → chunk-2AUXBJRX.js} +19 -19
  10. package/dist/bundle/{chunk-KEQ35HQQ.js → chunk-2UIMEMWU.js} +3 -3
  11. package/dist/bundle/{chunk-LNWRRK2H.js → chunk-33NVQGUY.js} +6 -6
  12. package/dist/bundle/{chunk-ZXD2I5ZQ.js → chunk-43QVYW3K.js} +49 -49
  13. package/dist/bundle/{chunk-BUALWXBT.js → chunk-4A2PIGC6.js} +1 -1
  14. package/dist/bundle/{chunk-3HNUH632.js → chunk-4CPLOMRK.js} +6 -6
  15. package/dist/bundle/{chunk-E656DAZT.js → chunk-4Z6TCU5T.js} +1 -1
  16. package/dist/bundle/{chunk-INVF3GXW.js → chunk-54O62JWP.js} +10 -10
  17. package/dist/bundle/{chunk-JA2YY7D4.js → chunk-5PLJKSG4.js} +7 -7
  18. package/dist/bundle/{chunk-XEETGCOC.js → chunk-6DHQTUB2.js} +1 -1
  19. package/dist/bundle/{chunk-ZKGYW63J.js → chunk-725OHXKR.js} +9 -9
  20. package/dist/bundle/chunk-7SH4JHYW.js +379 -0
  21. package/dist/bundle/{chunk-AO3NCZNT.js → chunk-7XKAVMCF.js} +8 -8
  22. package/dist/bundle/{chunk-PNUS224S.js → chunk-7YMDL4JQ.js} +8 -6
  23. package/dist/bundle/{chunk-CEUEXMIR.js → chunk-A4UNTWAX.js} +31 -27
  24. package/dist/bundle/{chunk-KYMGVMOS.js → chunk-ALJWBGD5.js} +1 -1
  25. package/dist/bundle/{chunk-QY3LK3OT.js → chunk-BSSCTWWK.js} +12 -12
  26. package/dist/bundle/{chunk-CCEVICWU.js → chunk-C6Z25IBJ.js} +49 -24
  27. package/dist/bundle/{chunk-ZJBRKR42.js → chunk-CB7SBYLO.js} +27 -27
  28. package/dist/bundle/{chunk-4VLUX3V5.js → chunk-CITFEQ6S.js} +1 -1
  29. package/dist/bundle/{chunk-Y73IZWRI.js → chunk-CKBHR7QO.js} +1 -1
  30. package/dist/bundle/{chunk-M2D4FXKY.js → chunk-CM7GAXGD.js} +5 -5
  31. package/dist/bundle/{chunk-OKSS7YUN.js → chunk-DLAFGSTN.js} +1 -1
  32. package/dist/bundle/{chunk-T7UZHKAS.js → chunk-DO4PDQY5.js} +2 -2
  33. package/dist/bundle/{chunk-P3T2SZW2.js → chunk-DW46P2DY.js} +1 -1
  34. package/dist/bundle/{chunk-Q3VG3UYV.js → chunk-F7UUZATI.js} +11 -11
  35. package/dist/bundle/{chunk-7SYSC7KX.js → chunk-FCJAHD4R.js} +2 -2
  36. package/dist/bundle/{chunk-QBECV7NO.js → chunk-FDWYPONW.js} +46 -34
  37. package/dist/bundle/{chunk-4SSUKRO4.js → chunk-FG4XXZZE.js} +2 -2
  38. package/dist/bundle/{chunk-DTHWL5YU.js → chunk-FJW3DDCF.js} +5 -5
  39. package/dist/bundle/{chunk-JHBX53SK.js → chunk-G6QF5KWF.js} +35 -35
  40. package/dist/bundle/{chunk-4J7UGHPK.js → chunk-G7DCVJ4F.js} +5 -5
  41. package/dist/bundle/{chunk-ZP735UUT.js → chunk-GR5GGZKH.js} +3 -3
  42. package/dist/bundle/{chunk-OL22OOIW.js → chunk-GVCN3GLZ.js} +16 -4
  43. package/dist/bundle/{chunk-2M5XEGVE.js → chunk-H47W2J6S.js} +638 -809
  44. package/dist/bundle/{chunk-HGWMX7BM.js → chunk-HQVJK5E7.js} +44 -22
  45. package/dist/bundle/{chunk-M6FQOGUW.js → chunk-HX7Y2ASG.js} +351 -282
  46. package/dist/bundle/{chunk-FSAM4Y2S.js → chunk-I7UH5CTA.js} +8 -8
  47. package/dist/bundle/{chunk-FABKIQ24.js → chunk-IDUNJCFO.js} +2 -2
  48. package/dist/bundle/{chunk-652YTDT5.js → chunk-IWFBAWZK.js} +15 -15
  49. package/dist/bundle/{chunk-3XX52F42.js → chunk-JEOYFKUK.js} +2 -2
  50. package/dist/bundle/{chunk-RTIMGPLN.js → chunk-KYVXMEBC.js} +3 -3
  51. package/dist/bundle/{chunk-IFM2APQB.js → chunk-LJAX6YCF.js} +2 -2
  52. package/dist/bundle/{chunk-R7XMCREL.js → chunk-LONV6HIK.js} +20 -20
  53. package/dist/bundle/{chunk-G75FZQAZ.js → chunk-NHBUTCNR.js} +10 -10
  54. package/dist/bundle/{chunk-5ZJHQ4TN.js → chunk-NPSZPUK6.js} +2 -2
  55. package/dist/bundle/{chunk-53UWCVSU.js → chunk-NSIFQ5OP.js} +1 -1
  56. package/dist/bundle/{chunk-HURI56SB.js → chunk-O6IOL6RX.js} +21 -21
  57. package/dist/bundle/{chunk-IA6LNKCF.js → chunk-PAXKALHV.js} +5 -5
  58. package/dist/bundle/{chunk-Z54E5LKF.js → chunk-PDGECM5D.js} +7 -7
  59. package/dist/bundle/{chunk-5OMLYNYB.js → chunk-PEOCBV2Z.js} +8 -8
  60. package/dist/bundle/{chunk-TATRMMOG.js → chunk-PQJYM5ES.js} +3 -3
  61. package/dist/bundle/{chunk-XGJUEH5C.js → chunk-PQYVPCJ2.js} +26 -26
  62. package/dist/bundle/{chunk-3CQNJKJT.js → chunk-PSNHPFSK.js} +1 -1
  63. package/dist/bundle/{chunk-6DDXB5WB.js → chunk-Q765VPZY.js} +2 -2
  64. package/dist/bundle/{chunk-YOABRW2M.js → chunk-R276546S.js} +1 -1
  65. package/dist/bundle/{chunk-QSDXVUJG.js → chunk-RNSP57TC.js} +4 -4
  66. package/dist/bundle/{chunk-VAETCXRI.js → chunk-UC22Q5KU.js} +11 -11
  67. package/dist/bundle/{chunk-EXYEDKTX.js → chunk-UR32UWTQ.js} +2 -2
  68. package/dist/bundle/{chunk-YROVFHPJ.js → chunk-VJZST5RD.js} +2 -2
  69. package/dist/bundle/{chunk-MMOG7ZVF.js → chunk-VSOLLTYT.js} +2 -2
  70. package/dist/bundle/{chunk-IUZ4PT2V.js → chunk-VZ2I62HN.js} +2 -2
  71. package/dist/bundle/{chunk-CTIQ77AB.js → chunk-W7IK7E4B.js} +17 -17
  72. package/dist/bundle/{chunk-C4PNAHI4.js → chunk-WBTVGFXI.js} +11 -11
  73. package/dist/bundle/{chunk-P6VN5UB4.js → chunk-WLFUBNFX.js} +4 -4
  74. package/dist/bundle/{chunk-Q27HCATD.js → chunk-WQJBAWQP.js} +534 -348
  75. package/dist/bundle/{chunk-4OLWMHS6.js → chunk-WQRGA75U.js} +15 -3
  76. package/dist/bundle/{chunk-5WN7JHQE.js → chunk-WUX7AUOQ.js} +26 -26
  77. package/dist/bundle/{chunk-VAK2Q2XG.js → chunk-X6ID5EAR.js} +16 -16
  78. package/dist/bundle/{chunk-5Z63NTC7.js → chunk-XOLQSCMF.js} +6 -6
  79. package/dist/bundle/{chunk-EY4CUQW2.js → chunk-YKZ4IPLB.js} +26 -9
  80. package/dist/bundle/{chunk-24TOKSZE.js → chunk-YNFELLNQ.js} +2 -2
  81. package/dist/bundle/{chunk-JSMPSOEM.js → chunk-YVPHJHIL.js} +3 -3
  82. package/dist/bundle/{chunk-QNLD7Y6Z.js → chunk-Z47LOJUS.js} +7 -7
  83. package/dist/bundle/{chunk-NHRJW3PH.js → chunk-ZDLIO76S.js} +2 -2
  84. package/dist/bundle/{chunk-OQEBGY74.js → chunk-ZNZUZGSV.js} +54 -47
  85. package/dist/bundle/{chunk-6E4PFCQ4.js → chunk-ZSXRDF6I.js} +1 -1
  86. package/dist/bundle/{chunk-UVPKSZSC.js → chunk-ZWSG7OCA.js} +4 -4
  87. package/dist/bundle/command-contract-I2YB5IXI.js +38 -0
  88. package/dist/bundle/{decode-YZRTP54O.js → decode-EDN2ARXZ.js} +19 -17
  89. package/dist/bundle/drive.js +7 -7
  90. package/dist/bundle/{echarts-C6HUK2FL.js → echarts-GXY34GHA.js} +2 -2
  91. package/dist/bundle/{embed-QRQ7ITFC.js → embed-3GSQIQXE.js} +5 -5
  92. package/dist/bundle/{embedder-EZDB3JPA.js → embedder-6ULWRG3R.js} +8 -8
  93. package/dist/bundle/{entry-4WQQKSYG.js → entry-IPRJLFHO.js} +6 -6
  94. package/dist/bundle/failure-4CVEVY45.js +37 -0
  95. package/dist/bundle/{first-run-ZAS4OV3T.js → first-run-FGHGWHC2.js} +9 -9
  96. package/dist/bundle/first-screen-M62KTPZG.js +36 -0
  97. package/dist/bundle/{google-KNILTIDW.js → google-BD3ZNFVJ.js} +9 -9
  98. package/dist/bundle/google-api-BDUWZMRV.js +83 -0
  99. package/dist/bundle/{identity-VBCGUXT5.js → identity-QLBSASO5.js} +2 -2
  100. package/dist/bundle/{instructions-II4M2WL3.js → instructions-K5BEQM4C.js} +1 -1
  101. package/dist/bundle/{login-4JACQVMD.js → login-VNZKRSAD.js} +65 -64
  102. package/dist/bundle/{mcp-6ZIAWU3N.js → mcp-5SNSMI2M.js} +82 -81
  103. package/dist/bundle/mcp-JZSYPQA4.js +96 -0
  104. package/dist/bundle/{mcp-ZYZ4DFW2.js → mcp-WSGVVZWI.js} +2 -2
  105. package/dist/bundle/{node-LIN7L4VQ.js → node-ZYWB7IET.js} +2 -2
  106. package/dist/bundle/{node-sqlite-VAH4KZN3.js → node-sqlite-J3OODPYK.js} +4 -4
  107. package/dist/bundle/{oauth-QUE3VCTU.js → oauth-L4VTCBLF.js} +6 -6
  108. package/dist/bundle/{open-DQ3EVYPB.js → open-SGUN7ZVF.js} +3 -3
  109. package/dist/bundle/openai-RLVISEDH.js +251 -0
  110. package/dist/bundle/{process-46XDWPVW.js → process-ZXO2MWRJ.js} +1 -1
  111. package/dist/bundle/{program-X3CZ4XDN.js → program-6S5EH7BS.js} +105 -103
  112. package/dist/bundle/{prompt-SAZYCZV3.js → prompt-AUWTBLO7.js} +4 -4
  113. package/dist/bundle/{reasons-366PI7OV.js → reasons-M5AKCNCU.js} +3 -3
  114. package/dist/bundle/{recognize-SSBOHOTW.js → recognize-ORX2UBQW.js} +5 -3
  115. package/dist/bundle/{remote-EL3FWCQE.js → remote-AGIJY73X.js} +6 -6
  116. package/dist/bundle/{rerank-RPIQRJIW.js → rerank-R6PE44M5.js} +6 -6
  117. package/dist/bundle/{serve-AX44DIKK.js → serve-VOBAQHAQ.js} +8 -8
  118. package/dist/bundle/server-24PS4M7U.js +70 -0
  119. package/dist/bundle/server-G6HFZ2CK.js +57 -0
  120. package/dist/bundle/{services-K4UOEMQD.js → services-HZFTTZSF.js} +35 -28
  121. package/dist/bundle/{sqlite-runtime-N7N3EYGH.js → sqlite-runtime-DTGPR2T2.js} +4 -4
  122. package/dist/bundle/{state-C3S5FD7V.js → state-WG3JKJM3.js} +5 -5
  123. package/dist/bundle/{store-4N3NBUGX.js → store-33VHIMEO.js} +14 -14
  124. package/dist/bundle/{store-QV4ZNEQ3.js → store-EV72MT5U.js} +16 -16
  125. package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +58 -0
  126. package/dist/bundle/tokens-XDQXUFDQ.js +104 -0
  127. package/dist/commands/search.js +1 -1
  128. package/dist/commands/search.js.map +1 -1
  129. package/dist/contract-overrides.js +1 -1
  130. package/dist/contract-overrides.js.map +1 -1
  131. package/dist/knowledge-query.d.ts +1 -1
  132. package/dist/store.d.ts.map +1 -1
  133. package/dist/store.js +1 -0
  134. package/dist/store.js.map +1 -1
  135. package/dist/version.d.ts +1 -1
  136. package/dist/version.js +1 -1
  137. package/package.json +3 -3
  138. package/dist/bundle/command-contract-TAWVO2G3.js +0 -38
  139. package/dist/bundle/failure-EEJGMWEP.js +0 -37
  140. package/dist/bundle/first-screen-6ICWD2N3.js +0 -36
  141. package/dist/bundle/google-api-CZACYX5T.js +0 -82
  142. package/dist/bundle/mcp-2BR2EX7L.js +0 -95
  143. package/dist/bundle/server-DCJIGUW2.js +0 -56
  144. package/dist/bundle/server-WWQSQBFT.js +0 -69
  145. package/dist/bundle/store-maintenance-command-QL4AECBD.js +0 -57
  146. package/dist/bundle/tokens-Y7HCOXOA.js +0 -103
  147. /package/dist/bundle/{chunk-2WNDZFGG.js → chunk-62EDJKGP.js} +0 -0
  148. /package/dist/bundle/{chunk-VDZZ46RT.js → chunk-FQRJWVEB.js} +0 -0
@@ -2,13 +2,13 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  failureContext
5
- } from "./chunk-4OLWMHS6.js";
5
+ } from "./chunk-WQRGA75U.js";
6
6
  import {
7
7
  VERSION
8
- } from "./chunk-E656DAZT.js";
8
+ } from "./chunk-4Z6TCU5T.js";
9
9
  import {
10
10
  REASONS
11
- } from "./chunk-P3T2SZW2.js";
11
+ } from "./chunk-DW46P2DY.js";
12
12
  import {
13
13
  interactiveOf,
14
14
  optionsOf
@@ -16,18 +16,18 @@ import {
16
16
  import {
17
17
  CommanderError,
18
18
  metaOf
19
- } from "./chunk-ZKGYW63J.js";
19
+ } from "./chunk-725OHXKR.js";
20
20
  import {
21
21
  errorObjectOf,
22
22
  errorRecordOf,
23
23
  exitCodeOfError,
24
24
  mcpErrorResult,
25
25
  renderError
26
- } from "./chunk-HGWMX7BM.js";
26
+ } from "./chunk-HQVJK5E7.js";
27
27
  import {
28
28
  CliError,
29
29
  defineSteps
30
- } from "./chunk-EY4CUQW2.js";
30
+ } from "./chunk-YKZ4IPLB.js";
31
31
  import {
32
32
  __name
33
33
  } from "./chunk-ZVVMGPBJ.js";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
 
4
4
  // dist/version.js
5
- var VERSION = "0.50.0";
5
+ var VERSION = "0.52.0";
6
6
 
7
7
  export {
8
8
  VERSION
@@ -3,31 +3,31 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  envName,
5
5
  readOnlyLockOf
6
- } from "./chunk-NHRJW3PH.js";
6
+ } from "./chunk-ZDLIO76S.js";
7
7
  import {
8
8
  ensureSqlite
9
- } from "./chunk-FABKIQ24.js";
9
+ } from "./chunk-IDUNJCFO.js";
10
10
  import {
11
11
  catchCrashes
12
- } from "./chunk-HGWMX7BM.js";
12
+ } from "./chunk-HQVJK5E7.js";
13
13
  import {
14
14
  CliError
15
- } from "./chunk-EY4CUQW2.js";
15
+ } from "./chunk-YKZ4IPLB.js";
16
16
  import {
17
17
  __name
18
18
  } from "./chunk-ZVVMGPBJ.js";
19
19
 
20
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/entry.js
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/entry.js
21
21
  import { spawn } from "node:child_process";
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/argv-log.js
23
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/argv-log.js
24
24
  import { appendFileSync } from "node:fs";
25
25
  var logVersion = /* @__PURE__ */ __name((file) => {
26
26
  appendFileSync(file, `${JSON.stringify({ command: "", options: ["--version"] })}
27
27
  `);
28
28
  }, "logVersion");
29
29
 
30
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/entry.js
30
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/entry.js
31
31
  var processIo = /* @__PURE__ */ __name(() => ({
32
32
  argv: process.argv,
33
33
  env: process.env,
@@ -81,8 +81,8 @@ var startCli = /* @__PURE__ */ __name(async (entry) => {
81
81
  if (command.optsWithGlobals().dryRun === true)
82
82
  return;
83
83
  const [{ setupAtStart }, { commandPathOf }] = await Promise.all([
84
- import("./first-run-ZAS4OV3T.js"),
85
- import("./command-contract-TAWVO2G3.js")
84
+ import("./first-run-FGHGWHC2.js"),
85
+ import("./command-contract-I2YB5IXI.js")
86
86
  ]);
87
87
  await setupAtStart({
88
88
  command: entry.app.command,
@@ -97,7 +97,7 @@ var startCli = /* @__PURE__ */ __name(async (entry) => {
97
97
  ask: /* @__PURE__ */ __name(async (question, command) => {
98
98
  if (headless(command) || io.stdin.isTTY !== true)
99
99
  return false;
100
- const { readSecret } = await import("./prompt-SAZYCZV3.js");
100
+ const { readSecret } = await import("./prompt-AUWTBLO7.js");
101
101
  const answer = await readSecret(`${question} [y/N] `, {
102
102
  input: io.stdin,
103
103
  output: io.stderr,
@@ -2,27 +2,27 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  ENTITIES
5
- } from "./chunk-IGG4RBIZ.js";
5
+ } from "./chunk-2623YE5I.js";
6
6
  import {
7
7
  answerSchema
8
- } from "./chunk-QBECV7NO.js";
8
+ } from "./chunk-FDWYPONW.js";
9
9
  import {
10
10
  annotate,
11
11
  describeOptions,
12
12
  metaOf
13
- } from "./chunk-ZKGYW63J.js";
13
+ } from "./chunk-725OHXKR.js";
14
14
  import {
15
15
  keyForCommand
16
- } from "./chunk-6DDXB5WB.js";
16
+ } from "./chunk-Q765VPZY.js";
17
17
  import {
18
18
  CliError,
19
19
  jsonSchemaOf
20
- } from "./chunk-EY4CUQW2.js";
20
+ } from "./chunk-YKZ4IPLB.js";
21
21
  import {
22
22
  __name
23
23
  } from "./chunk-ZVVMGPBJ.js";
24
24
 
25
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/answer-entity.js
25
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/answer-entity.js
26
26
  var schemas = /* @__PURE__ */ new WeakMap();
27
27
  var answerEntity = /* @__PURE__ */ __name((command, name, schema, options = {}) => {
28
28
  if (Object.hasOwn(ENTITIES, name))
@@ -52,7 +52,7 @@ var answerProjectionSchema = /* @__PURE__ */ __name((command) => {
52
52
  return own && metaOf(command).output?.entity === own.name ? own.project : void 0;
53
53
  }, "answerProjectionSchema");
54
54
 
55
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/command-contract.js
55
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/command-contract.js
56
56
  var SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
57
57
  var outputOf = /* @__PURE__ */ __name((command) => {
58
58
  const entity = answerEntitySchema(command);
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/http/listen.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/http/listen.js
8
8
  import { createServer } from "node:http";
9
9
  import { Readable } from "node:stream";
10
10
  var MAX_BODY = 4 * 1024 * 1024;
@@ -4,7 +4,7 @@ import {
4
4
  FIELD_TYPES,
5
5
  QUERY_BACKENDS,
6
6
  describeQuery
7
- } from "./chunk-G75FZQAZ.js";
7
+ } from "./chunk-NHBUTCNR.js";
8
8
  import {
9
9
  EXIT_CODES,
10
10
  GENERIC_FAILURE,
@@ -13,7 +13,7 @@ import {
13
13
  processStreams,
14
14
  projectFields,
15
15
  singleLine
16
- } from "./chunk-HGWMX7BM.js";
16
+ } from "./chunk-HQVJK5E7.js";
17
17
  import {
18
18
  CliError,
19
19
  array,
@@ -33,12 +33,12 @@ import {
33
33
  strictObject,
34
34
  string,
35
35
  unknown
36
- } from "./chunk-EY4CUQW2.js";
36
+ } from "./chunk-YKZ4IPLB.js";
37
37
  import {
38
38
  __name
39
39
  } from "./chunk-ZVVMGPBJ.js";
40
40
 
41
- // node_modules/.pnpm/@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/registry.js
41
+ // node_modules/.pnpm/@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/registry.js
42
42
  var labels = /* @__PURE__ */ new WeakMap();
43
43
  var annotate = /* @__PURE__ */ __name((command, meta) => {
44
44
  labels.set(command, { ...labels.get(command), ...meta });
@@ -3539,7 +3539,7 @@ __name(useColor, "useColor");
3539
3539
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
3540
3540
  var program = new Command();
3541
3541
 
3542
- // node_modules/.pnpm/@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/contracts.js
3542
+ // node_modules/.pnpm/@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/contracts.js
3543
3543
  import { isDeepStrictEqual } from "node:util";
3544
3544
  var protectedCommands = /* @__PURE__ */ new WeakMap();
3545
3545
  var hasSharedContract = /* @__PURE__ */ __name((command) => protectedCommands.has(command), "hasSharedContract");
@@ -3741,7 +3741,7 @@ var customizeSharedCommand = /* @__PURE__ */ __name((reference, reason, build, e
3741
3741
  return command;
3742
3742
  }, "customizeSharedCommand");
3743
3743
 
3744
- // node_modules/.pnpm/@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/document.js
3744
+ // node_modules/.pnpm/@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/document.js
3745
3745
  var argumentInfoSchema = object({
3746
3746
  name: string(),
3747
3747
  required: boolean(),
@@ -3823,7 +3823,7 @@ var commandsDocument = /* @__PURE__ */ __name((root, about) => ({
3823
3823
  exit_codes: { ok: 0, internal_error: GENERIC_FAILURE, ...EXIT_CODES }
3824
3824
  }), "commandsDocument");
3825
3825
 
3826
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
3826
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
3827
3827
  var named = /* @__PURE__ */ __name((work) => {
3828
3828
  try {
3829
3829
  return work();
@@ -3850,7 +3850,7 @@ var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
3850
3850
  return projectFields(value, fields);
3851
3851
  }), "projectFields");
3852
3852
 
3853
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/output-detail.js
3853
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/output-detail.js
3854
3854
  var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
3855
3855
  var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
3856
3856
  var isHit = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && typeof value.locator === "string" && typeof value.text === "string", "isHit");
@@ -3880,7 +3880,7 @@ var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
3880
3880
  return value;
3881
3881
  }, "atDetail");
3882
3882
 
3883
- // node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/output.js
3883
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/output.js
3884
3884
  var resolveOutput = /* @__PURE__ */ __name(({ json, jsonl, quiet, streams = processStreams, tty, color, fields, hitDetail, env = process.env, capture } = {}) => {
3885
3885
  const interactive = tty ?? process.stdout.isTTY === true;
3886
3886
  const format = jsonl ? "jsonl" : json || !interactive ? "json" : "pretty";
@@ -0,0 +1,379 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError
5
+ } from "./chunk-YKZ4IPLB.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-ZVVMGPBJ.js";
9
+
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/atomic-write.js
11
+ import { randomUUID } from "node:crypto";
12
+ import { constants } from "node:fs";
13
+ import { link, open, realpath, rename, unlink } from "node:fs/promises";
14
+ import { basename, dirname, join } from "node:path";
15
+ var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open(folder, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0)), "openFolder");
16
+ var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
17
+ signal?.throwIfAborted();
18
+ const folder = await realpath(dirname(path));
19
+ const target = join(folder, basename(path));
20
+ const directory = await openFolder(folder);
21
+ try {
22
+ const temporary = join(folder, `.${basename(path)}.${randomUUID()}.tmp`);
23
+ let handle = await open(temporary, "wx", mode);
24
+ let published = false;
25
+ try {
26
+ await handle.writeFile(content);
27
+ await handle.sync();
28
+ await handle.close();
29
+ handle = void 0;
30
+ signal?.throwIfAborted();
31
+ await beforePublish?.();
32
+ if (overwrite)
33
+ await rename(temporary, target);
34
+ else
35
+ await link(temporary, target);
36
+ published = overwrite;
37
+ await directory?.sync();
38
+ } finally {
39
+ await handle?.close().catch(() => void 0);
40
+ if (!published)
41
+ await unlink(temporary).catch(() => void 0);
42
+ }
43
+ } finally {
44
+ await directory?.close().catch(() => void 0);
45
+ }
46
+ }, "writeFileAtomic");
47
+
48
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/ordinary-file.js
49
+ import { constants as constants2 } from "node:fs";
50
+ import { lstat, open as open2 } from "node:fs/promises";
51
+ var deviceOf = /* @__PURE__ */ __name((dev) => process.platform === "win32" ? BigInt.asUintN(32, dev) : dev, "deviceOf");
52
+ var sameIdentity = /* @__PURE__ */ __name((left, right) => left.ino === right.ino && deviceOf(left.dev) === deviceOf(right.dev), "sameIdentity");
53
+ var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
54
+ const before = await lstat(path, { bigint: true });
55
+ if (before.isSymbolicLink())
56
+ throw new CliError("validation_error", "archive path must be an ordinary file without a symlink");
57
+ if (!before.isFile())
58
+ throw new CliError("validation_error", "archive path must be an ordinary file");
59
+ const access = options.writable ? constants2.O_RDWR : constants2.O_RDONLY;
60
+ const flags = process.platform === "win32" ? access : access | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
61
+ const file = await open2(path, flags);
62
+ try {
63
+ const opened = await file.stat({ bigint: true });
64
+ const after = await lstat(path, { bigint: true });
65
+ if (!opened.isFile() || !after.isFile() || before.ino !== opened.ino || before.ino !== after.ino)
66
+ throw new CliError("validation_error", "archive file changed while opening");
67
+ if (process.platform === "win32" && before.dev === 0n && after.dev === 0n) {
68
+ const witness = await open2(path, flags);
69
+ try {
70
+ const identified = await witness.stat({ bigint: true });
71
+ const final = await lstat(path, { bigint: true });
72
+ if (opened.dev === 0n || !identified.isFile() || !final.isFile() || !sameIdentity(identified, opened) || final.ino !== before.ino || final.dev !== 0n && deviceOf(final.dev) !== deviceOf(opened.dev))
73
+ throw new CliError("validation_error", "archive file changed while opening");
74
+ } finally {
75
+ await witness.close();
76
+ }
77
+ } else if (deviceOf(before.dev) !== deviceOf(opened.dev) || deviceOf(before.dev) !== deviceOf(after.dev)) {
78
+ throw new CliError("validation_error", "archive file changed while opening");
79
+ }
80
+ return file;
81
+ } catch (error) {
82
+ await file.close();
83
+ throw error;
84
+ }
85
+ }, "openOrdinaryFile");
86
+ var sameOrdinaryFile = /* @__PURE__ */ __name(async (path, created) => {
87
+ let file;
88
+ try {
89
+ file = await openOrdinaryFile(path);
90
+ } catch (error) {
91
+ if (error instanceof CliError || typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
92
+ return false;
93
+ throw error;
94
+ }
95
+ try {
96
+ return sameIdentity(created, await file.stat({ bigint: true }));
97
+ } finally {
98
+ await file.close();
99
+ }
100
+ }, "sameOrdinaryFile");
101
+ var syncDirectory = /* @__PURE__ */ __name(async (path) => {
102
+ if (process.platform === "win32")
103
+ return;
104
+ const directory = await open2(path, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0));
105
+ try {
106
+ if (!(await directory.stat()).isDirectory())
107
+ throw new CliError("validation_error", "archive publication directory must be ordinary");
108
+ await directory.sync();
109
+ } finally {
110
+ await directory.close();
111
+ }
112
+ }, "syncDirectory");
113
+
114
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/lock.js
115
+ import { mkdir as mkdir2 } from "node:fs/promises";
116
+ import { basename as basename2, dirname as dirname2 } from "node:path";
117
+
118
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
119
+ import { randomUUID as randomUUID2 } from "node:crypto";
120
+ import { lstat as lstat3, mkdir, open as open3, realpath as realpath3, rmdir as rmdir2, unlink as unlink4 } from "node:fs/promises";
121
+ import { hostname as hostname2 } from "node:os";
122
+ import { join as join3 } from "node:path";
123
+
124
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
125
+ import { lstat as lstat2, readdir, realpath as realpath2, unlink as unlink2 } from "node:fs/promises";
126
+ import { join as join2 } from "node:path";
127
+
128
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-lease-owner.js
129
+ import { hostname } from "node:os";
130
+ var missingLeaseFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingLeaseFile");
131
+ var readLeaseOwner = /* @__PURE__ */ __name(async (path, name, signal) => {
132
+ signal?.throwIfAborted();
133
+ try {
134
+ const file = await openOrdinaryFile(path);
135
+ try {
136
+ if ((await file.stat()).size > 4096)
137
+ return null;
138
+ const buffer = Buffer.alloc(4097);
139
+ let size = 0;
140
+ while (size < buffer.length) {
141
+ signal?.throwIfAborted();
142
+ const { bytesRead } = await file.read(buffer, size, buffer.length - size, size);
143
+ if (bytesRead === 0)
144
+ break;
145
+ size += bytesRead;
146
+ }
147
+ signal?.throwIfAborted();
148
+ if (size > 4096)
149
+ return null;
150
+ const owner = JSON.parse(buffer.subarray(0, size).toString("utf8"));
151
+ if (owner?.version !== 1 || !Number.isSafeInteger(owner.pid) || owner.pid <= 0 || typeof owner.host !== "string" || !owner.host.trim() || !/^[a-f0-9-]{36}$/.test(owner.nonce) || name !== `${owner.pid}-${owner.nonce}.json`)
152
+ return null;
153
+ return owner;
154
+ } finally {
155
+ await file.close();
156
+ }
157
+ } catch {
158
+ signal?.throwIfAborted();
159
+ return null;
160
+ }
161
+ }, "readLeaseOwner");
162
+ var leaseOwnerStatus = /* @__PURE__ */ __name((owner) => {
163
+ if (owner.host !== hostname())
164
+ return "foreign";
165
+ try {
166
+ process.kill(owner.pid, 0);
167
+ return "active";
168
+ } catch (error) {
169
+ return typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH" ? "stale" : "active";
170
+ }
171
+ }, "leaseOwnerStatus");
172
+
173
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
174
+ var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
175
+ const inspect = /* @__PURE__ */ __name(async (destination, options = {}) => {
176
+ options.signal?.throwIfAborted();
177
+ const root = await realpath2(destination);
178
+ options.signal?.throwIfAborted();
179
+ const folder = join2(root, markerDirectory);
180
+ let names;
181
+ try {
182
+ if ((await lstat2(folder)).isSymbolicLink())
183
+ throw new Error("symlink");
184
+ names = await readdir(folder);
185
+ } catch (error) {
186
+ options.signal?.throwIfAborted();
187
+ if (missingLeaseFile(error))
188
+ return [];
189
+ throw new CliError("configuration_error", "archive lock directory could not be read");
190
+ }
191
+ options.signal?.throwIfAborted();
192
+ const result = [];
193
+ for (const name of names.sort()) {
194
+ options.signal?.throwIfAborted();
195
+ const owner = await readLeaseOwner(join2(folder, name), name, options.signal);
196
+ result.push({
197
+ name,
198
+ status: owner ? leaseOwnerStatus(owner) : "unrecognized",
199
+ pid: owner?.pid ?? null,
200
+ host: owner?.host ?? null
201
+ });
202
+ }
203
+ return result;
204
+ }, "inspect");
205
+ const recover = /* @__PURE__ */ __name(async (destination, options = {}) => {
206
+ options.signal?.throwIfAborted();
207
+ const root = await realpath2(destination);
208
+ const locks = await inspect(root, options);
209
+ const removed = [];
210
+ if (options.apply)
211
+ for (const lock of locks) {
212
+ options.signal?.throwIfAborted();
213
+ if (lock.status !== "stale")
214
+ continue;
215
+ const path = join2(root, markerDirectory, lock.name);
216
+ const owner = await readLeaseOwner(path, lock.name, options.signal);
217
+ if (!owner || leaseOwnerStatus(owner) !== "stale")
218
+ continue;
219
+ try {
220
+ await unlink2(path);
221
+ removed.push(lock.name);
222
+ } catch (error) {
223
+ if (!missingLeaseFile(error))
224
+ throw new CliError("configuration_error", "stale archive lock could not be removed");
225
+ }
226
+ }
227
+ return { locks, removed };
228
+ }, "recover");
229
+ return { inspect, recover };
230
+ }, "leaseInspection");
231
+
232
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-lease-release.js
233
+ import { rmdir, unlink as unlink3 } from "node:fs/promises";
234
+ var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identity) => {
235
+ let releasing;
236
+ const held = /* @__PURE__ */ __name(async () => {
237
+ if (!await sameOrdinaryFile(path, identity))
238
+ return false;
239
+ const current = await readLeaseOwner(path, name);
240
+ return current?.host === owner.host && current.pid === owner.pid && current.nonce === owner.nonce;
241
+ }, "held");
242
+ const release = /* @__PURE__ */ __name(async () => {
243
+ if (!await held())
244
+ throw new CliError("configuration_error", "owned archive lock changed before release");
245
+ await unlink3(path);
246
+ await rmdir(folder).catch(() => void 0);
247
+ }, "release");
248
+ return {
249
+ held,
250
+ release: /* @__PURE__ */ __name(() => releasing ??= release().catch((error) => {
251
+ releasing = void 0;
252
+ throw error;
253
+ }), "release")
254
+ };
255
+ }, "ownedNativeLease");
256
+
257
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
258
+ var validName = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !/[\\/\0:]/.test(value), "validName");
259
+ var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
260
+ const { markerDirectory, legacyMarker } = layout;
261
+ if (!validName(markerDirectory) || legacyMarker !== void 0 && (!validName(legacyMarker) || legacyMarker === markerDirectory))
262
+ throw new CliError("validation_error", "archive lock layout requires distinct ordinary entry names");
263
+ const inspection = leaseInspection(markerDirectory);
264
+ return {
265
+ ...inspection,
266
+ acquire: /* @__PURE__ */ __name(async (destination, { signal } = {}) => {
267
+ signal?.throwIfAborted();
268
+ const root = await realpath3(destination);
269
+ signal?.throwIfAborted();
270
+ const folder = join3(root, markerDirectory);
271
+ const owner = { version: 1, pid: process.pid, host: hostname2(), nonce: randomUUID2() };
272
+ const name = `${owner.pid}-${owner.nonce}.json`;
273
+ const path = join3(folder, name);
274
+ const marker = /* @__PURE__ */ __name(async (attempt = 1) => {
275
+ await mkdir(folder, { recursive: true });
276
+ try {
277
+ if ((await lstat3(folder)).isSymbolicLink())
278
+ throw new CliError("validation_error", "archive lock directory must not be a symlink");
279
+ await inspection.recover(root, { apply: true, signal });
280
+ signal?.throwIfAborted();
281
+ return await open3(path, "wx", 384);
282
+ } catch (error) {
283
+ if (attempt < 5 && missingLeaseFile(error))
284
+ return marker(attempt + 1);
285
+ throw error;
286
+ }
287
+ }, "marker");
288
+ const file = await marker();
289
+ let retained = false;
290
+ let identity;
291
+ try {
292
+ identity = await file.stat({ bigint: true });
293
+ await file.writeFile(JSON.stringify(owner));
294
+ await file.sync();
295
+ await file.close();
296
+ signal?.throwIfAborted();
297
+ const inspected = await inspection.inspect(root, { signal });
298
+ const own = inspected.find((lock) => lock.name === name);
299
+ if (own?.status !== "active" || own.pid !== owner.pid || own.host !== owner.host)
300
+ throw new CliError("configuration_error", "archive writer lost its lock before acquisition");
301
+ const locks = inspected.filter((lock) => lock.name !== name);
302
+ if (locks.length)
303
+ return { status: "busy", locks };
304
+ if (legacyMarker) {
305
+ try {
306
+ await lstat3(join3(root, legacyMarker));
307
+ return { status: "legacy" };
308
+ } catch (error) {
309
+ if (!missingLeaseFile(error))
310
+ throw error;
311
+ }
312
+ }
313
+ signal?.throwIfAborted();
314
+ retained = true;
315
+ return { status: "acquired", lease: ownedNativeLease(path, name, owner, folder, identity) };
316
+ } finally {
317
+ await file.close().catch(() => void 0);
318
+ if (!retained) {
319
+ if (identity && await sameOrdinaryFile(path, identity))
320
+ await unlink4(path).catch(() => void 0);
321
+ await rmdir2(folder).catch(() => void 0);
322
+ }
323
+ }
324
+ }, "acquire")
325
+ };
326
+ }, "nativeWriterLeaseStore");
327
+
328
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/lock.js
329
+ var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
330
+ const folder = dirname2(path);
331
+ await mkdir2(folder, { recursive: true, mode: 448 });
332
+ const acquired = await nativeWriterLeaseStore({ markerDirectory: basename2(path) }).acquire(folder, {
333
+ ...signal ? { signal } : {}
334
+ });
335
+ if (acquired.status === "acquired")
336
+ return acquired.lease;
337
+ throw new CliError("validation_error", `${basename2(path)} is locked by another process`, {
338
+ reason: "file.locked",
339
+ ...acquired.status === "busy" ? { holders: acquired.locks } : {}
340
+ });
341
+ }, "acquireLock");
342
+
343
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
344
+ var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
345
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 16 * 1024 * 1024)
346
+ throw new CliError("validation_error", "file maxBytes takes 1\u201316777216 bytes");
347
+ const file = await openOrdinaryFile(path);
348
+ try {
349
+ if ((await file.stat()).size > maxBytes)
350
+ throw new CliError("validation_error", "input file exceeds its byte budget");
351
+ const chunks = [], buffer = Buffer.alloc(Math.min(65536, maxBytes + 1));
352
+ let bytes = 0;
353
+ for (; ; ) {
354
+ const { bytesRead } = await file.read(buffer, 0, Math.min(buffer.length, maxBytes - bytes + 1), null);
355
+ if (bytesRead === 0)
356
+ break;
357
+ bytes += bytesRead;
358
+ if (bytes > maxBytes)
359
+ throw new CliError("validation_error", "input file exceeds its byte budget");
360
+ chunks.push(Buffer.from(buffer.subarray(0, bytesRead)));
361
+ }
362
+ try {
363
+ return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes));
364
+ } catch {
365
+ throw new CliError("validation_error", "input file must contain valid UTF-8");
366
+ }
367
+ } finally {
368
+ await file.close();
369
+ }
370
+ }, "readBoundedUtf8File");
371
+
372
+ export {
373
+ writeFileAtomic,
374
+ openOrdinaryFile,
375
+ sameOrdinaryFile,
376
+ syncDirectory,
377
+ readBoundedUtf8File,
378
+ acquireLock
379
+ };