@wirecat/tg-cli 0.108.0 → 0.110.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 (104) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bundle/{adapter-YFWRJWL5.js → adapter-JWUCHTXU.js} +45 -44
  3. package/dist/bundle/{all-profiles-GQIZSF4W.js → all-profiles-OMRCKP54.js} +8 -8
  4. package/dist/bundle/{anthropic-BKWEDKPU.js → anthropic-WXFHH74P.js} +5 -5
  5. package/dist/bundle/{app-server-RJV7ICLH.js → app-server-ILIPNO6T.js} +40 -39
  6. package/dist/bundle/{bot-api-2PAH2JZ3.js → bot-api-KV765AZK.js} +46 -45
  7. package/dist/bundle/{bot-history-DPPZ43F4.js → bot-history-3P6EIM5L.js} +15 -15
  8. package/dist/bundle/{bun-Q7COX3Z5.js → bun-MJOYPPEN.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-YI4AYZXO.js → bun-sqlite-GFRVRRDZ.js} +4 -4
  10. package/dist/bundle/{chunk-BOSMBW4I.js → chunk-2YWQEG2P.js} +11 -11
  11. package/dist/bundle/{chunk-4RDMNNVO.js → chunk-32HEOKI2.js} +27 -14
  12. package/dist/bundle/{chunk-3GXKJKIC.js → chunk-3KOF5T4N.js} +4 -4
  13. package/dist/bundle/{chunk-AOUB2QFP.js → chunk-3L2JTAVD.js} +2 -2
  14. package/dist/bundle/{chunk-26PWIQPP.js → chunk-3XTMVGTS.js} +2338 -1174
  15. package/dist/bundle/{chunk-5P27JGGA.js → chunk-4BMXELWN.js} +5 -5
  16. package/dist/bundle/{chunk-VK2YLSK7.js → chunk-4GOF43MW.js} +1 -1
  17. package/dist/bundle/{chunk-5HPXENE5.js → chunk-4I6HTOCM.js} +1 -1
  18. package/dist/bundle/{chunk-LY2LFJMU.js → chunk-4YOPRYEY.js} +117 -94
  19. package/dist/bundle/{chunk-ON67U6WV.js → chunk-54CWOD7V.js} +6 -6
  20. package/dist/bundle/chunk-5ASW5BNM.js +379 -0
  21. package/dist/bundle/{chunk-OB5PPPXH.js → chunk-5CMOXHQS.js} +7 -7
  22. package/dist/bundle/{chunk-WEDWIXIC.js → chunk-6KESAYMZ.js} +2 -2
  23. package/dist/bundle/{chunk-3562DVQ7.js → chunk-6WTLP2SI.js} +8 -8
  24. package/dist/bundle/{chunk-BT6PWDM6.js → chunk-7ABA4EXC.js} +3 -3
  25. package/dist/bundle/{chunk-WKSLGPZQ.js → chunk-7LZBMZQM.js} +16 -4
  26. package/dist/bundle/{chunk-VMU4SGCE.js → chunk-ABVHA4K6.js} +8 -6
  27. package/dist/bundle/{chunk-YJ6GFFEE.js → chunk-AXNBGLO5.js} +1 -1
  28. package/dist/bundle/{chunk-LYLGLFWY.js → chunk-AZYVTDAE.js} +3 -3
  29. package/dist/bundle/{chunk-T4SDOYPY.js → chunk-BWRCPMMC.js} +138 -81
  30. package/dist/bundle/{chunk-DNOJKQXQ.js → chunk-BYOEVYY2.js} +678 -325
  31. package/dist/bundle/{chunk-FG2QTYEF.js → chunk-EB44Z44U.js} +1 -1
  32. package/dist/bundle/{chunk-67SRVSPU.js → chunk-EO563SUX.js} +26 -9
  33. package/dist/bundle/{chunk-F67VPIJL.js → chunk-F24EAGOU.js} +32 -31
  34. package/dist/bundle/{chunk-ZHHVNTBJ.js → chunk-F7RWNBC2.js} +2 -2
  35. package/dist/bundle/{chunk-REI5TPS3.js → chunk-FYAHTTOB.js} +11 -11
  36. package/dist/bundle/{chunk-CZANI3DM.js → chunk-GPIORQAD.js} +22 -22
  37. package/dist/bundle/{chunk-76OSISA3.js → chunk-HCAYTAJN.js} +2 -2
  38. package/dist/bundle/{chunk-SONKULUF.js → chunk-JDOSIWPN.js} +3 -3
  39. package/dist/bundle/{chunk-KZPZFPGB.js → chunk-KLOFBUXA.js} +81 -30
  40. package/dist/bundle/{chunk-6MZ2ZBX4.js → chunk-L3YDXUDK.js} +12 -3
  41. package/dist/bundle/{chunk-AS2BVZU3.js → chunk-M3XIME74.js} +49 -24
  42. package/dist/bundle/{chunk-WUF64WOG.js → chunk-MXIBRT6W.js} +4 -4
  43. package/dist/bundle/{chunk-D6DBVPES.js → chunk-MZRD776E.js} +3 -3
  44. package/dist/bundle/{chunk-6QTUYMGX.js → chunk-NDT22GBK.js} +2 -2
  45. package/dist/bundle/{chunk-3HYDKCXB.js → chunk-NFBOZT7H.js} +12 -12
  46. package/dist/bundle/{chunk-WAGDZB62.js → chunk-ONHHBPV3.js} +2 -2
  47. package/dist/bundle/{chunk-DUWTG2GE.js → chunk-Q35J5LCO.js} +8 -8
  48. package/dist/bundle/{chunk-77OOX2OE.js → chunk-QRH2AWBZ.js} +81 -57
  49. package/dist/bundle/{chunk-PQHYM2XC.js → chunk-RARYRHQA.js} +1 -1
  50. package/dist/bundle/{chunk-ZYBDAZFO.js → chunk-RSZEEWOW.js} +2 -2
  51. package/dist/bundle/{chunk-QVIT6SQ5.js → chunk-RXWG7OWT.js} +705 -425
  52. package/dist/bundle/{chunk-R5YOKYTE.js → chunk-SD5J5T7M.js} +11 -11
  53. package/dist/bundle/{chunk-NCXCBVHO.js → chunk-SLAPUEMZ.js} +6 -6
  54. package/dist/bundle/{chunk-KQFR7ZAA.js → chunk-TDQVVXPF.js} +43 -25
  55. package/dist/bundle/{chunk-BL72ZIBV.js → chunk-TJA3BWY3.js} +1 -1
  56. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-UIPT6IAU.js} +1 -1
  57. package/dist/bundle/{chunk-EBB7RFCW.js → chunk-VM7I5VKX.js} +2 -2
  58. package/dist/bundle/{chunk-CVWF3BFK.js → chunk-VOBMR7E5.js} +45 -45
  59. package/dist/bundle/{chunk-B7TFWNKJ.js → chunk-W3B6EEZU.js} +1 -1
  60. package/dist/bundle/{chunk-PCMW3PW6.js → chunk-XLNYDJKG.js} +2 -2
  61. package/dist/bundle/{chunk-TVA3NXXO.js → chunk-YPEAEEHF.js} +2 -2
  62. package/dist/bundle/{chunk-XZXOGHU5.js → chunk-YPLL3Q3M.js} +71 -60
  63. package/dist/bundle/{chunk-EWL3ZFOI.js → chunk-YWSNUUW5.js} +6 -6
  64. package/dist/bundle/command-contract-TNSW7W6G.js +32 -0
  65. package/dist/bundle/{decode-ZFAFVFWX.js → decode-3KBXZCFM.js} +19 -17
  66. package/dist/bundle/{echarts-SVXNTKGV.js → echarts-24TVPFGC.js} +2 -2
  67. package/dist/bundle/{embed-V755YE7O.js → embed-3BDPZ4Q7.js} +5 -5
  68. package/dist/bundle/{embedder-MQAPNQBH.js → embedder-EMVDEZFR.js} +8 -8
  69. package/dist/bundle/{entry-ULQ3VOMQ.js → entry-NQD6Z2BM.js} +5 -5
  70. package/dist/bundle/{first-run-64BTWXDR.js → first-run-ZBIO6C67.js} +9 -9
  71. package/dist/bundle/first-screen-4HRCG7OX.js +30 -0
  72. package/dist/bundle/{identity-PW45VBUU.js → identity-EDGOOTOM.js} +3 -3
  73. package/dist/bundle/{instructions-G3ZUIRRH.js → instructions-N2WVMNFZ.js} +1 -1
  74. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-EMNFFY4N.js} +2 -2
  75. package/dist/bundle/{node-IDJXLZSX.js → node-VBZAZHUS.js} +2 -2
  76. package/dist/bundle/{node-sqlite-W22J37MG.js → node-sqlite-C3V64OAL.js} +4 -4
  77. package/dist/bundle/{oauth-Q52LBXDE.js → oauth-NZXELYDA.js} +6 -6
  78. package/dist/bundle/{open-YLD7VHEC.js → open-2XRUGMV7.js} +3 -3
  79. package/dist/bundle/openai-OLGTN3ZB.js +250 -0
  80. package/dist/bundle/{process-OBESF2XG.js → process-CASPZ2DH.js} +1 -1
  81. package/dist/bundle/{program-EBMWHOKQ.js → program-QPQDSGYA.js} +50 -47
  82. package/dist/bundle/{prompt-FHHQF3MG.js → prompt-ESZL7SGX.js} +4 -4
  83. package/dist/bundle/{proxy-transport-YSBYG26I.js → proxy-transport-OROEVBCG.js} +4 -4
  84. package/dist/bundle/{recognize-QNHKHGKM.js → recognize-LQ7QOG4T.js} +5 -3
  85. package/dist/bundle/{remote-RVZWRCCT.js → remote-34XP4EDN.js} +6 -6
  86. package/dist/bundle/{rerank-KG2USEME.js → rerank-7F6NLBCW.js} +6 -6
  87. package/dist/bundle/{serve-I4MJKEQ4.js → serve-M6TTKXI4.js} +8 -8
  88. package/dist/bundle/{server-GV7SV3L6.js → server-GLZ5M7PE.js} +32 -31
  89. package/dist/bundle/server-KOW7OKE2.js +56 -0
  90. package/dist/bundle/{state-AJKHWFBU.js → state-UKKPLMHS.js} +5 -5
  91. package/dist/bundle/{store-L3HFSSGJ.js → store-J2MBIDJK.js} +10 -10
  92. package/dist/bundle/store-maintenance-command-64B57C3U.js +45 -0
  93. package/dist/bundle/tg.js +4 -4
  94. package/dist/program.d.ts.map +1 -1
  95. package/dist/program.js +2 -1
  96. package/dist/program.js.map +1 -1
  97. package/dist/version.d.ts +1 -1
  98. package/dist/version.js +1 -1
  99. package/package.json +3 -3
  100. package/dist/bundle/command-contract-5GJV6EHG.js +0 -32
  101. package/dist/bundle/first-screen-YZCH4TEV.js +0 -30
  102. package/dist/bundle/server-AXMWFPNT.js +0 -55
  103. package/dist/bundle/store-maintenance-command-Y22ARSDR.js +0 -44
  104. /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-NPGVOZVK.js} +0 -0
@@ -4,25 +4,23 @@ import {
4
4
  executableEnvironment,
5
5
  executableOnPath,
6
6
  require_cross_spawn
7
- } from "./chunk-MFS52LTZ.js";
7
+ } from "./chunk-UIPT6IAU.js";
8
8
  import {
9
9
  loadConfigFile,
10
10
  saveConfigFile
11
- } from "./chunk-T4SDOYPY.js";
11
+ } from "./chunk-BWRCPMMC.js";
12
12
  import {
13
13
  number,
14
14
  object,
15
15
  optional,
16
16
  string
17
- } from "./chunk-67SRVSPU.js";
17
+ } from "./chunk-EO563SUX.js";
18
18
  import {
19
19
  __name,
20
20
  __toESM
21
21
  } from "./chunk-ZVVMGPBJ.js";
22
22
 
23
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
24
- var import_cross_spawn = __toESM(require_cross_spawn(), 1);
25
- import { existsSync } from "node:fs";
23
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/installer.js
26
24
  var installerOf = /* @__PURE__ */ __name((scriptPath) => {
27
25
  const path = scriptPath.replaceAll("\\", "/");
28
26
  if (path.includes("/_npx/"))
@@ -35,6 +33,10 @@ var installerOf = /* @__PURE__ */ __name((scriptPath) => {
35
33
  return "npm";
36
34
  return path.includes("/dist/") ? "checkout" : "unknown";
37
35
  }, "installerOf");
36
+
37
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
38
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
39
+ import { existsSync } from "node:fs";
38
40
  var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
39
41
  const target = `${packageName}@latest`;
40
42
  switch (installer) {
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
8
8
  var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
9
9
  `The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
10
10
  "Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  unit
5
- } from "./chunk-EWL3ZFOI.js";
5
+ } from "./chunk-YWSNUUW5.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-67SRVSPU.js";
8
+ } from "./chunk-EO563SUX.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
14
14
  import { setTimeout } from "node:timers/promises";
15
15
  var OPENAI_URL = "https://api.openai.com/v1";
16
16
  var OPENAI_MODELS = {
@@ -14,7 +14,7 @@ import {
14
14
  safeParse,
15
15
  stepOf,
16
16
  writes
17
- } from "./chunk-67SRVSPU.js";
17
+ } from "./chunk-EO563SUX.js";
18
18
  import {
19
19
  __commonJS,
20
20
  __name,
@@ -1887,7 +1887,7 @@ var require_cli_table3 = __commonJS({
1887
1887
  }
1888
1888
  });
1889
1889
 
1890
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
1890
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
1891
1891
  var EXIT_CODES = {
1892
1892
  validation_error: 2,
1893
1893
  configuration_error: 3,
@@ -1907,7 +1907,7 @@ var EXIT_CODES = {
1907
1907
  var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
1908
1908
  var GENERIC_FAILURE = 1;
1909
1909
 
1910
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
1910
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
1911
1911
  var CONTROL = (
1912
1912
  // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
1913
1913
  /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
@@ -1931,7 +1931,7 @@ var visibleControls = /* @__PURE__ */ __name((text) => {
1931
1931
  }, "visibleControls");
1932
1932
  var singleLine = /* @__PURE__ */ __name((text) => visibleControls(text).replace(LINE_BREAKS, escaped), "singleLine");
1933
1933
 
1934
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
1934
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
1935
1935
  var recognise = /* @__PURE__ */ __name((failure) => {
1936
1936
  if (isCliError(failure))
1937
1937
  return failure;
@@ -2078,7 +2078,7 @@ var catchCrashes = /* @__PURE__ */ __name((options) => {
2078
2078
  };
2079
2079
  }, "catchCrashes");
2080
2080
 
2081
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
2081
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
2082
2082
  var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2083
2083
  if (signal?.aborted)
2084
2084
  return Promise.reject(signal.reason);
@@ -2086,14 +2086,14 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2086
2086
  return Promise.reject(new Error("output stream closed"));
2087
2087
  if (!stream.writableNeedDrain)
2088
2088
  return Promise.resolve();
2089
- return new Promise((resolve, reject) => {
2089
+ return new Promise((resolve2, reject) => {
2090
2090
  const cleanup = /* @__PURE__ */ __name(() => {
2091
2091
  stream.off("drain", drained).off("error", failed).off("close", closed);
2092
2092
  signal?.removeEventListener("abort", aborted);
2093
2093
  }, "cleanup");
2094
2094
  const drained = /* @__PURE__ */ __name(() => {
2095
2095
  cleanup();
2096
- resolve();
2096
+ resolve2();
2097
2097
  }, "drained");
2098
2098
  const failed = /* @__PURE__ */ __name((error) => {
2099
2099
  cleanup();
@@ -2106,7 +2106,7 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2106
2106
  });
2107
2107
  }, "waitForDrain");
2108
2108
 
2109
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
2109
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
2110
2110
  var processStreams = {
2111
2111
  drain: /* @__PURE__ */ __name(async (signal) => {
2112
2112
  await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
@@ -2135,7 +2135,19 @@ var captureStreams = /* @__PURE__ */ __name(() => {
2135
2135
  };
2136
2136
  }, "captureStreams");
2137
2137
 
2138
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
2138
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
2139
+ var DEFAULT_RETRY = {
2140
+ retries: 1,
2141
+ baseDelayMs: 250,
2142
+ maxDelayMs: 1e4,
2143
+ maxRetryAfterMs: 3e4
2144
+ };
2145
+ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
2146
+ const ceiling = Math.min(config.maxDelayMs, config.baseDelayMs * 2 ** (attempt - 1));
2147
+ return Math.round(random() * ceiling);
2148
+ }, "backoffMs");
2149
+
2150
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
2139
2151
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
2140
2152
  var validate = /* @__PURE__ */ __name((paths) => {
2141
2153
  if (paths.length === 0 || paths.length > 128 || paths.some((path) => path.length > 256 || !/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(path) || path.split(".").some((part) => forbidden.has(part))))
@@ -2200,7 +2212,7 @@ var projectFields = /* @__PURE__ */ __name((value, fields) => {
2200
2212
  return project(value, fields);
2201
2213
  }, "projectFields");
2202
2214
 
2203
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2215
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2204
2216
  var BATCH_LIMITS = Object.freeze({
2205
2217
  requests: 32,
2206
2218
  input_bytes: 262144,
@@ -2327,7 +2339,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2327
2339
  };
2328
2340
  }, "runBatch");
2329
2341
 
2330
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2342
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2331
2343
  import { randomBytes } from "node:crypto";
2332
2344
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2333
2345
  import { dirname, join } from "node:path";
@@ -2371,11 +2383,11 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
2371
2383
  `, 384);
2372
2384
  }, "saveConfigFile");
2373
2385
 
2374
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2386
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2375
2387
  import { readFileSync as readFileSync2 } from "node:fs";
2376
- import { join as join2 } from "node:path";
2388
+ import { join as join3, resolve } from "node:path";
2377
2389
 
2378
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2390
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2379
2391
  import { createRequire } from "node:module";
2380
2392
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
2381
2393
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -2395,8 +2407,60 @@ var systemKeyring = {
2395
2407
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
2396
2408
  };
2397
2409
 
2398
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2399
- var keyringService = /* @__PURE__ */ __name((service, configDir, isolated = false) => isolated ? `${service}:${configDir}` : service, "keyringService");
2410
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
2411
+ import { homedir, userInfo } from "node:os";
2412
+ import { join as join2, posix, win32 } from "node:path";
2413
+ var PATH_KINDS = ["config", "state", "cache"];
2414
+ var OVERRIDES = { config: "CONFIG_DIR", state: "STATE_DIR", cache: "CACHE_DIR" };
2415
+ var overrideName = /* @__PURE__ */ __name((appName, prefix, kind) => `${prefix ?? appName.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_${OVERRIDES[kind]}`, "overrideName");
2416
+ var defaultPaths = /* @__PURE__ */ __name(({ appName, env = process.env, platform = process.platform }) => {
2417
+ if (platform === "win32") {
2418
+ const home2 = env.USERPROFILE || homedir();
2419
+ const roaming = env.APPDATA || win32.join(home2, "AppData", "Roaming");
2420
+ const local = env.LOCALAPPDATA || win32.join(home2, "AppData", "Local");
2421
+ return {
2422
+ config: win32.join(roaming, appName, "Config"),
2423
+ state: win32.join(local, appName, "Data"),
2424
+ cache: win32.join(local, appName, "Cache")
2425
+ };
2426
+ }
2427
+ const home = env.HOME || homedir();
2428
+ return {
2429
+ config: posix.join(env.XDG_CONFIG_HOME || posix.join(home, ".config"), appName),
2430
+ state: posix.join(env.XDG_DATA_HOME || posix.join(home, ".local", "share"), appName),
2431
+ cache: posix.join(env.XDG_CACHE_HOME || posix.join(home, ".cache"), appName)
2432
+ };
2433
+ }, "defaultPaths");
2434
+ var resolvePaths = /* @__PURE__ */ __name((options) => {
2435
+ const { appName, prefix, env = process.env } = options;
2436
+ const base = defaultPaths(options);
2437
+ return {
2438
+ config: env[overrideName(appName, prefix, "config")] ?? base.config,
2439
+ state: env[overrideName(appName, prefix, "state")] ?? base.state,
2440
+ cache: env[overrideName(appName, prefix, "cache")] ?? base.cache
2441
+ };
2442
+ }, "resolvePaths");
2443
+ var pathsAreOverridden = /* @__PURE__ */ __name(({ appName, prefix, env = process.env }) => PATH_KINDS.some((kind) => env[overrideName(appName, prefix, kind)] !== void 0), "pathsAreOverridden");
2444
+ var accountHome = /* @__PURE__ */ __name(() => {
2445
+ try {
2446
+ return userInfo().homedir;
2447
+ } catch {
2448
+ return void 0;
2449
+ }
2450
+ }, "accountHome");
2451
+ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = process.platform, home = accountHome() } = {}) => {
2452
+ if (home === void 0)
2453
+ return true;
2454
+ const appName = "app";
2455
+ const actual = defaultPaths({ appName, env, platform });
2456
+ const owners = defaultPaths({ appName, env: { HOME: home, USERPROFILE: home }, platform });
2457
+ return PATH_KINDS.some((kind) => actual[kind] !== owners[kind]);
2458
+ }, "homeIsMoved");
2459
+ var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join2(configDir, fileName), "configFilePath");
2460
+
2461
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2462
+ var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
2463
+ var warnedRuns = /* @__PURE__ */ new WeakSet();
2400
2464
  var Credentials = class {
2401
2465
  static {
2402
2466
  __name(this, "Credentials");
@@ -2409,7 +2473,8 @@ var Credentials = class {
2409
2473
  #envVar;
2410
2474
  #fileName;
2411
2475
  #warn;
2412
- #warned = false;
2476
+ /** Set only for a moved run with the system keyring. */
2477
+ #temporaryService;
2413
2478
  constructor(options) {
2414
2479
  this.#configDir = options.configDir;
2415
2480
  this.#storage = options.storage ?? "auto";
@@ -2419,28 +2484,37 @@ var Credentials = class {
2419
2484
  this.#fileName = options.fileName ?? "credentials.json";
2420
2485
  this.#warn = options.warn ?? ((message) => process.stderr.write(`${message}
2421
2486
  `));
2422
- this.#service = keyringService(options.service, options.configDir, options.isolated);
2487
+ this.#service = options.service;
2488
+ const moved = this.#keyring === systemKeyring && (options.isolated === true || homeIsMoved({ env: this.#env }));
2489
+ this.#temporaryService = moved ? movedRunService(options.service, options.configDir) : void 0;
2423
2490
  }
2424
2491
  read(account) {
2425
2492
  const fromEnv = this.#envVar ? this.#env[this.#envVar]?.trim() : void 0;
2426
2493
  if (fromEnv)
2427
2494
  return { secret: fromEnv, source: "environment" };
2495
+ const fromFile = this.#storage === "keyring" ? void 0 : this.#readFile()?.[account]?.secret;
2496
+ if (fromFile)
2497
+ return { secret: fromFile, source: "file" };
2428
2498
  if (this.#storage !== "file") {
2429
- const fromKeyring = this.#tryKeyring(() => this.#keyring.get(this.#service, account));
2499
+ const temporary = this.#temporaryService;
2500
+ const fromKeyring = this.#tryKeyring(() => temporary && this.#keyring.get(temporary, account) || this.#keyring.get(this.#service, account));
2430
2501
  if (fromKeyring)
2431
2502
  return { secret: fromKeyring, source: "keyring" };
2432
2503
  }
2433
- const fromFile = this.#readFile()?.[account]?.secret;
2434
- return fromFile ? { secret: fromFile, source: "file" } : void 0;
2504
+ return void 0;
2435
2505
  }
2436
- write(account, secret) {
2437
- if (this.#storage !== "file") {
2506
+ write(account, secret, options = {}) {
2507
+ const inFile = this.#storage === "auto" && this.#readFile()?.[account] !== void 0;
2508
+ if (this.#storage === "keyring" || this.#storage === "auto" && (options.signIn || !inFile)) {
2438
2509
  const stored = this.#tryKeyring(() => {
2439
- this.#keyring.set(this.#service, account, secret);
2510
+ this.#keyring.set(this.#temporaryService ?? this.#service, account, secret);
2440
2511
  return true;
2441
2512
  });
2442
- if (stored)
2513
+ if (stored) {
2514
+ if (inFile)
2515
+ this.#removeFromFile(account);
2443
2516
  return "keyring";
2517
+ }
2444
2518
  }
2445
2519
  const store = this.#readFile();
2446
2520
  if (!store) {
@@ -2452,19 +2526,36 @@ var Credentials = class {
2452
2526
  }
2453
2527
  remove(account) {
2454
2528
  const removed = [];
2455
- if (this.#storage !== "file" && this.#tryKeyring(() => this.#keyring.delete(this.#service, account))) {
2456
- removed.push("keyring");
2529
+ if (this.#storage !== "file") {
2530
+ if (this.#tryKeyring(() => this.#keyring.delete(this.#temporaryService ?? this.#service, account))) {
2531
+ removed.push("keyring");
2532
+ }
2533
+ if (this.#temporaryService && this.#ownersEntryExists(account)) {
2534
+ this.#warn(removed.includes("keyring") ? `removed this run's own sign-in of ${account} from the OS keyring and kept the owner's: a run with moved folders never removes it` : `kept ${account} in the OS keyring: it is the owner's sign-in, shared with every run, and a run with moved folders never removes it`);
2535
+ }
2457
2536
  }
2458
- const store = this.#readFile();
2459
- if (store?.[account] !== void 0) {
2460
- delete store[account];
2461
- this.#writeFile(store);
2537
+ if (this.#storage !== "keyring" && this.#removeFromFile(account))
2462
2538
  removed.push("file");
2463
- }
2464
2539
  return removed;
2465
2540
  }
2541
+ #removeFromFile(account) {
2542
+ const store = this.#readFile();
2543
+ if (store?.[account] === void 0)
2544
+ return false;
2545
+ delete store[account];
2546
+ this.#writeFile(store);
2547
+ return true;
2548
+ }
2549
+ /** Only for the warning: a keyring that fails here must not fail a removal that already happened. */
2550
+ #ownersEntryExists(account) {
2551
+ try {
2552
+ return this.#keyring.get(this.#service, account) !== null;
2553
+ } catch {
2554
+ return false;
2555
+ }
2556
+ }
2466
2557
  #path() {
2467
- return join2(this.#configDir, this.#fileName);
2558
+ return join3(this.#configDir, this.#fileName);
2468
2559
  }
2469
2560
  /** `undefined` when the file exists but is not a store: writing would replace what it holds. */
2470
2561
  #readFile() {
@@ -2493,8 +2584,8 @@ var Credentials = class {
2493
2584
  try {
2494
2585
  return operation();
2495
2586
  } catch (error) {
2496
- if (!this.#warned) {
2497
- this.#warned = true;
2587
+ if (!warnedRuns.has(this.#env)) {
2588
+ warnedRuns.add(this.#env);
2498
2589
  this.#warn(`could not reach the OS keyring \u2014 it may be locked, or no keyring service is running (${error instanceof Error ? error.message : String(error)}); using ${this.#path()} instead, readable only by you`);
2499
2590
  }
2500
2591
  return void 0;
@@ -2502,21 +2593,21 @@ var Credentials = class {
2502
2593
  }
2503
2594
  };
2504
2595
 
2505
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2596
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2506
2597
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
2507
- var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve, reject) => {
2598
+ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
2508
2599
  if (signal?.aborted) {
2509
2600
  reject(abortError());
2510
2601
  return;
2511
2602
  }
2512
- const timer = setTimeout(resolve, ms);
2603
+ const timer = setTimeout(resolve2, ms);
2513
2604
  signal?.addEventListener("abort", () => {
2514
2605
  clearTimeout(timer);
2515
2606
  reject(abortError());
2516
2607
  }, { once: true });
2517
2608
  }), "realSleep");
2518
2609
 
2519
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2610
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2520
2611
  import { appendFileSync } from "node:fs";
2521
2612
  var REDACTED_FIELDS = [
2522
2613
  "authorization",
@@ -2611,43 +2702,7 @@ var silent = {
2611
2702
  }, "error")
2612
2703
  };
2613
2704
 
2614
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
2615
- import { homedir } from "node:os";
2616
- import { join as join3, posix, win32 } from "node:path";
2617
- var PATH_KINDS = ["config", "state", "cache"];
2618
- var OVERRIDES = { config: "CONFIG_DIR", state: "STATE_DIR", cache: "CACHE_DIR" };
2619
- var overrideName = /* @__PURE__ */ __name((appName, prefix, kind) => `${prefix ?? appName.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_${OVERRIDES[kind]}`, "overrideName");
2620
- var defaultPaths = /* @__PURE__ */ __name(({ appName, env = process.env, platform = process.platform }) => {
2621
- if (platform === "win32") {
2622
- const home2 = env.USERPROFILE || homedir();
2623
- const roaming = env.APPDATA || win32.join(home2, "AppData", "Roaming");
2624
- const local = env.LOCALAPPDATA || win32.join(home2, "AppData", "Local");
2625
- return {
2626
- config: win32.join(roaming, appName, "Config"),
2627
- state: win32.join(local, appName, "Data"),
2628
- cache: win32.join(local, appName, "Cache")
2629
- };
2630
- }
2631
- const home = env.HOME || homedir();
2632
- return {
2633
- config: posix.join(env.XDG_CONFIG_HOME || posix.join(home, ".config"), appName),
2634
- state: posix.join(env.XDG_DATA_HOME || posix.join(home, ".local", "share"), appName),
2635
- cache: posix.join(env.XDG_CACHE_HOME || posix.join(home, ".cache"), appName)
2636
- };
2637
- }, "defaultPaths");
2638
- var resolvePaths = /* @__PURE__ */ __name((options) => {
2639
- const { appName, prefix, env = process.env } = options;
2640
- const base = defaultPaths(options);
2641
- return {
2642
- config: env[overrideName(appName, prefix, "config")] ?? base.config,
2643
- state: env[overrideName(appName, prefix, "state")] ?? base.state,
2644
- cache: env[overrideName(appName, prefix, "cache")] ?? base.cache
2645
- };
2646
- }, "resolvePaths");
2647
- var pathsAreOverridden = /* @__PURE__ */ __name(({ appName, prefix, env = process.env }) => PATH_KINDS.some((kind) => env[overrideName(appName, prefix, kind)] !== void 0), "pathsAreOverridden");
2648
- var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join3(configDir, fileName), "configFilePath");
2649
-
2650
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2705
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2651
2706
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
2652
2707
  import { styleText } from "node:util";
2653
2708
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -2722,7 +2777,7 @@ var BORDERLESS = {
2722
2777
  middle: ""
2723
2778
  };
2724
2779
 
2725
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2780
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2726
2781
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
2727
2782
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
2728
2783
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -2780,16 +2835,18 @@ export {
2780
2835
  writeSecurely,
2781
2836
  loadConfigFile,
2782
2837
  saveConfigFile,
2838
+ resolvePaths,
2839
+ pathsAreOverridden,
2840
+ configFilePath,
2783
2841
  Credentials,
2784
2842
  realSleep,
2785
2843
  logRecordOf,
2786
2844
  createRecordLog,
2787
- resolvePaths,
2788
- pathsAreOverridden,
2789
- configFilePath,
2790
2845
  renderPretty,
2791
2846
  indent,
2792
2847
  processStreams,
2793
2848
  captureStreams,
2794
- createRenderer
2849
+ createRenderer,
2850
+ DEFAULT_RETRY,
2851
+ backoffMs
2795
2852
  };