@wirecat/tg-cli 0.133.0 → 0.135.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 (153) hide show
  1. package/README.md +2 -3
  2. package/contracts/wirecat.json +82 -2
  3. package/dist/bin/tg.js +2 -2
  4. package/dist/bot/generated/types.d.ts +188 -0
  5. package/dist/bot/generated/types.d.ts.map +1 -1
  6. package/dist/bundle/{adapter-GSGX3WBH.js → adapter-OHJF6PB5.js} +104 -69
  7. package/dist/bundle/agent-QPF2KU4I.js +37 -0
  8. package/dist/bundle/{all-profiles-VOCJ55YH.js → all-profiles-LQ73BIFB.js} +62 -20
  9. package/dist/bundle/{anthropic-J6CTLU3W.js → anthropic-YYBMT2HD.js} +5 -5
  10. package/dist/bundle/{app-server-GVFGA4TJ.js → app-server-HV4C4CSA.js} +72 -62
  11. package/dist/bundle/{bot-api-LWONPIGK.js → bot-api-URQXWMVR.js} +73 -92
  12. package/dist/bundle/{bot-history-XOW7Y2GC.js → bot-history-FRLCHPDQ.js} +23 -22
  13. package/dist/bundle/{bun-436CH6CP.js → bun-J3ML43BO.js} +2 -2
  14. package/dist/bundle/{bun-sqlite-ZLB5RK5Q.js → bun-sqlite-ZNB2B2DL.js} +6 -6
  15. package/dist/bundle/{chunk-UGS57TT5.js → chunk-24G3SEXH.js} +2 -2
  16. package/dist/bundle/chunk-27F6QBPY.js +555 -0
  17. package/dist/bundle/{chunk-6VCSOQFL.js → chunk-2OFCIF2W.js} +2 -2
  18. package/dist/bundle/{chunk-VGN5YXYI.js → chunk-2U7XA4IH.js} +2 -100
  19. package/dist/bundle/{chunk-LBZEZO32.js → chunk-4CLSIEWN.js} +65 -43
  20. package/dist/bundle/chunk-5CEKH6R6.js +340 -0
  21. package/dist/bundle/{chunk-SMI2EUH4.js → chunk-5WEEK65F.js} +1 -1
  22. package/dist/bundle/{chunk-OX73ERZW.js → chunk-6VWVYPH2.js} +3 -4
  23. package/dist/bundle/{chunk-5HKPQPD4.js → chunk-6WS474NQ.js} +6 -6
  24. package/dist/bundle/{chunk-IYAXLLGR.js → chunk-7GWOGEWJ.js} +6 -6
  25. package/dist/bundle/{chunk-TPD37ECC.js → chunk-AMRMU23L.js} +16 -3
  26. package/dist/bundle/{chunk-ZHO3TPHM.js → chunk-B2UXNYCD.js} +30 -15
  27. package/dist/bundle/{chunk-YY6FGKGD.js → chunk-B4ZMFU5I.js} +2 -2
  28. package/dist/bundle/{chunk-54WLIPIQ.js → chunk-BFKPMG5T.js} +1 -1
  29. package/dist/bundle/{chunk-KHUXDSXN.js → chunk-BQSODAU3.js} +1 -1
  30. package/dist/bundle/{chunk-N3JUHGKM.js → chunk-BXUMZWMN.js} +3786 -3364
  31. package/dist/bundle/{chunk-VTQMR3XG.js → chunk-E2VIO7RY.js} +3 -3
  32. package/dist/bundle/{chunk-UZ63ORMY.js → chunk-F5FOS64B.js} +4 -4
  33. package/dist/bundle/{chunk-LIQMUDIZ.js → chunk-GCUFGDKE.js} +2 -2
  34. package/dist/bundle/chunk-GUERS64O.js +108 -0
  35. package/dist/bundle/{chunk-5LRTYBZW.js → chunk-HILS2UL7.js} +12 -12
  36. package/dist/bundle/{chunk-6S77EKZU.js → chunk-IOJOLV25.js} +17 -15
  37. package/dist/bundle/{chunk-IBCXEVNY.js → chunk-JBS4VPAX.js} +3 -3
  38. package/dist/bundle/{chunk-5L44DSHV.js → chunk-K5QGBYDL.js} +4 -4
  39. package/dist/bundle/{chunk-NO2LIHWA.js → chunk-KKXF6TSS.js} +1 -1
  40. package/dist/bundle/chunk-L2ZQDTDU.js +7 -0
  41. package/dist/bundle/{chunk-HB5DP6L5.js → chunk-LFPUW7DR.js} +18 -18
  42. package/dist/bundle/{chunk-QWO7L4UH.js → chunk-LGYATGQI.js} +7 -7
  43. package/dist/bundle/{chunk-IH4Z3KZU.js → chunk-MA27675E.js} +2 -2
  44. package/dist/bundle/{chunk-6H2NW6HK.js → chunk-MDI7554C.js} +3 -3
  45. package/dist/bundle/{chunk-KVFUH5IT.js → chunk-MMZ4QAKJ.js} +1 -1
  46. package/dist/bundle/{chunk-XOX4BX5A.js → chunk-MOPBEBVS.js} +4 -4
  47. package/dist/bundle/{chunk-XKOMP3HV.js → chunk-MPRXUTIK.js} +6 -6
  48. package/dist/bundle/{chunk-QYLZD4DS.js → chunk-N7F5KT6U.js} +1 -1
  49. package/dist/bundle/{chunk-KUA24HWG.js → chunk-NBP6LXSY.js} +2 -2
  50. package/dist/bundle/{chunk-UQYL6TJ7.js → chunk-NP46ZKQW.js} +4 -4
  51. package/dist/bundle/{chunk-QGWISM4W.js → chunk-NRSJXUUO.js} +34 -28
  52. package/dist/bundle/{chunk-7NYP4RBO.js → chunk-NVWZ7S3I.js} +2294 -1221
  53. package/dist/bundle/chunk-OBIMTRA7.js +80 -0
  54. package/dist/bundle/{chunk-VWJTYAIQ.js → chunk-OQJURSRL.js} +17 -17
  55. package/dist/bundle/chunk-OU3WN4YH.js +50 -0
  56. package/dist/bundle/{chunk-VCAOH45X.js → chunk-PBK2ECXT.js} +1 -1
  57. package/dist/bundle/{chunk-TTDZVWDU.js → chunk-PHAFT2BO.js} +1 -1
  58. package/dist/bundle/{chunk-NTWXL2QV.js → chunk-PKIGE4NE.js} +2 -2
  59. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  60. package/dist/bundle/{chunk-NAXOT35J.js → chunk-QBRQLOZA.js} +3 -3
  61. package/dist/bundle/{chunk-RABUG4KA.js → chunk-QD4MTOI7.js} +511 -472
  62. package/dist/bundle/{chunk-LOS4D6ZB.js → chunk-QHQ52UMF.js} +159 -569
  63. package/dist/bundle/{chunk-6CHIGUCY.js → chunk-R2G3MWEF.js} +31 -20
  64. package/dist/bundle/{chunk-THYGLTRB.js → chunk-RCEP5OXD.js} +7 -7
  65. package/dist/bundle/chunk-RHJ2VGHV.js +353 -0
  66. package/dist/bundle/{chunk-QVGEL66U.js → chunk-RXBKVNOK.js} +53 -11
  67. package/dist/bundle/{chunk-ZYAHZKYF.js → chunk-RZ7POTFA.js} +3 -3
  68. package/dist/bundle/{chunk-KEN4B57V.js → chunk-S7PIM4GG.js} +2 -2
  69. package/dist/bundle/{chunk-BXVB42KJ.js → chunk-SIDGH56R.js} +2 -2
  70. package/dist/bundle/{chunk-XDQU5HBO.js → chunk-SRMELB6Q.js} +12 -12
  71. package/dist/bundle/{chunk-SMU6NA7F.js → chunk-SVPNU7PD.js} +4 -4
  72. package/dist/bundle/{chunk-JPNVEPS4.js → chunk-TB2MG6PE.js} +2351 -2028
  73. package/dist/bundle/{chunk-JGMXBAGH.js → chunk-UN5TH2CG.js} +156 -434
  74. package/dist/bundle/{chunk-YAPDU3SV.js → chunk-V3ZWYMXT.js} +1 -1
  75. package/dist/bundle/{chunk-7NF3V5L2.js → chunk-VFU25P57.js} +4 -4
  76. package/dist/bundle/{chunk-LQQSDGQ6.js → chunk-VJEMCJPL.js} +56 -46
  77. package/dist/bundle/{chunk-UIAKLELF.js → chunk-VK2NDTBS.js} +94 -64
  78. package/dist/bundle/{chunk-UKBK2VWZ.js → chunk-W6A2OZ3C.js} +232 -176
  79. package/dist/bundle/{chunk-IPPCQ7IK.js → chunk-WDI6LA4X.js} +2 -2
  80. package/dist/bundle/{chunk-N7QREPZW.js → chunk-WTGRQGQL.js} +16 -9
  81. package/dist/bundle/{chunk-57KJ3TRS.js → chunk-WUCTF2XE.js} +9 -9
  82. package/dist/bundle/{chunk-JKSD43L7.js → chunk-WZCRCCOZ.js} +6 -6
  83. package/dist/bundle/{chunk-H7ML7X3G.js → chunk-XB6O445X.js} +144 -10
  84. package/dist/bundle/{chunk-O6JUVATT.js → chunk-XKFES4EM.js} +35 -12
  85. package/dist/bundle/chunk-YBUX6EAK.js +388 -0
  86. package/dist/bundle/{chunk-WCYKVX3B.js → chunk-YMRL7MYS.js} +7 -7
  87. package/dist/bundle/{chunk-M6QOM6SL.js → chunk-Z6M6NZUX.js} +1 -1
  88. package/dist/bundle/chunk-ZCDRXKCR.js +727 -0
  89. package/dist/bundle/{chunk-6A44ZZFC.js → chunk-ZJ3S4S6H.js} +43 -64
  90. package/dist/bundle/{chunk-TCI7I6YF.js → chunk-ZL7TJXFL.js} +11 -25
  91. package/dist/bundle/{chunk-2KQDJHF3.js → chunk-ZMBVZWUW.js} +29 -1
  92. package/dist/bundle/{chunk-OWY52JBO.js → chunk-ZMTASSIB.js} +7 -7
  93. package/dist/bundle/{chunk-D2SJLZSH.js → chunk-ZQ5ERQHO.js} +2 -2
  94. package/dist/bundle/{chunk-CEJYNB3I.js → chunk-ZWVDXVG3.js} +4 -4
  95. package/dist/bundle/command-contract-K4MU32K6.js +37 -0
  96. package/dist/bundle/{command-server-entry-AE27QXTE.js → command-server-entry-XP6BVJIK.js} +27 -27
  97. package/dist/bundle/{decode-RQPPZ72F.js → decode-TUB45ALX.js} +5 -5
  98. package/dist/bundle/{dispatch-KQO2MCSH.js → dispatch-ICPUKMEG.js} +8 -8
  99. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  100. package/dist/bundle/{echarts-FZRIACN4.js → echarts-HJ7D7XTM.js} +2 -2
  101. package/dist/bundle/{embed-TOSWWMDL.js → embed-4QDN36YF.js} +6 -6
  102. package/dist/bundle/{embedder-JHIQSBGD.js → embedder-Q7ID2LEG.js} +9 -9
  103. package/dist/bundle/{entry-DU4KRXTG.js → entry-Z6VRZP7F.js} +9 -9
  104. package/dist/bundle/{failure-3YC3YGYO.js → failure-PEPNEEK7.js} +2 -2
  105. package/dist/bundle/{first-run-DQQT4FID.js → first-run-GKBEHAAX.js} +12 -12
  106. package/dist/bundle/first-screen-IA3ONZ75.js +37 -0
  107. package/dist/bundle/{instructions-WI64CJQ6.js → instructions-26ZXYYMY.js} +1 -1
  108. package/dist/bundle/{mcp-VMS6PBCU.js → mcp-KGWT6TGO.js} +2 -2
  109. package/dist/bundle/meeting-combined-KUV2HP52.js +23 -0
  110. package/dist/bundle/{meeting-model-XNRSREIK.js → meeting-model-JB7X4CA3.js} +11 -11
  111. package/dist/bundle/{meeting-semantic-OOSCHQMB.js → meeting-semantic-MQNUVG33.js} +6 -6
  112. package/dist/bundle/{node-JLKDNVKV.js → node-RIANITAT.js} +2 -2
  113. package/dist/bundle/{node-sqlite-YOGH26O2.js → node-sqlite-I2P26Z3S.js} +7 -7
  114. package/dist/bundle/{oauth-FOMXM5HP.js → oauth-GFMJL2ZZ.js} +8 -8
  115. package/dist/bundle/{open-SM2UXUKM.js → open-CWVYEFNN.js} +5 -5
  116. package/dist/bundle/{openai-J2H7S6ZF.js → openai-PQLK7YTJ.js} +15 -15
  117. package/dist/bundle/{process-HI7OZBOI.js → process-P4D4KFWE.js} +1 -1
  118. package/dist/bundle/{program-VY4HFU25.js → program-MF4QZJKH.js} +70 -64
  119. package/dist/bundle/{prompt-NUUVFMOF.js → prompt-JWIOYU53.js} +5 -5
  120. package/dist/bundle/{proxy-transport-AN4VMRRN.js → proxy-transport-DWY6ABVT.js} +5 -5
  121. package/dist/bundle/{recognize-MALJHPDI.js → recognize-IPJL4CQZ.js} +4 -4
  122. package/dist/bundle/{remote-QUDRSTS2.js → remote-DVY6F6YO.js} +9 -9
  123. package/dist/bundle/{rerank-2DSO3D3S.js → rerank-XSPWLBIO.js} +7 -7
  124. package/dist/bundle/{serve-NCJ52MY3.js → serve-AJAVEH2M.js} +15 -15
  125. package/dist/bundle/server-GGXUR5BZ.js +78 -0
  126. package/dist/bundle/{server-Y3M544AM.js → server-GII7NIKF.js} +65 -54
  127. package/dist/bundle/{sqlite-runtime-NJUSXVKK.js → sqlite-runtime-KFDYJTUO.js} +6 -6
  128. package/dist/bundle/{state-AVOWQVET.js → state-76OJSCQC.js} +6 -6
  129. package/dist/bundle/{store-MMIYOL4H.js → store-2KJS4YMH.js} +28 -17
  130. package/dist/bundle/{store-BZ5ICDRP.js → store-FBP2J23G.js} +20 -19
  131. package/dist/bundle/store-maintenance-command-NUWOUZ62.js +65 -0
  132. package/dist/bundle/surface-EGSHCISG.js +64 -0
  133. package/dist/bundle/tg.js +13 -13
  134. package/dist/telegram/adapter.d.ts +9 -2
  135. package/dist/telegram/adapter.d.ts.map +1 -1
  136. package/dist/telegram/adapter.js +5 -6
  137. package/dist/telegram/adapter.js.map +1 -1
  138. package/dist/telegram/messages.d.ts +12 -0
  139. package/dist/telegram/messages.d.ts.map +1 -1
  140. package/dist/telegram/messages.js +40 -0
  141. package/dist/telegram/messages.js.map +1 -1
  142. package/dist/version.d.ts +1 -1
  143. package/dist/version.js +1 -1
  144. package/package.json +3 -3
  145. package/skills/tg-cli/SKILL.md +7 -4
  146. package/skills/tg-cli/references/messages.md +5 -1
  147. package/skills/tg-cli/references/search.md +2 -0
  148. package/dist/bundle/chunk-SHTHNBHG.js +0 -2
  149. package/dist/bundle/command-contract-TQIARAB4.js +0 -37
  150. package/dist/bundle/first-screen-7N4CTZSA.js +0 -37
  151. package/dist/bundle/meeting-combined-3RAOFQ7M.js +0 -23
  152. package/dist/bundle/server-CHGON5I2.js +0 -70
  153. package/dist/bundle/store-maintenance-command-VKZ4WHUB.js +0 -61
@@ -19,11 +19,11 @@ import {
19
19
  string,
20
20
  text,
21
21
  unknown
22
- } from "./chunk-QVGEL66U.js";
22
+ } from "./chunk-RXBKVNOK.js";
23
23
  import {
24
24
  CliError,
25
25
  visibleControls
26
- } from "./chunk-LIQMUDIZ.js";
26
+ } from "./chunk-GCUFGDKE.js";
27
27
  import {
28
28
  __commonJS,
29
29
  __name,
@@ -1896,7 +1896,7 @@ var require_cli_table3 = __commonJS({
1896
1896
  }
1897
1897
  });
1898
1898
 
1899
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
1899
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
1900
1900
  var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
1901
1901
  if (signal?.aborted)
1902
1902
  return Promise.reject(signal.reason);
@@ -1924,7 +1924,7 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
1924
1924
  });
1925
1925
  }, "waitForDrain");
1926
1926
 
1927
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
1927
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
1928
1928
  var processStreams = {
1929
1929
  drain: /* @__PURE__ */ __name(async (signal) => {
1930
1930
  await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
@@ -1953,7 +1953,7 @@ var captureStreams = /* @__PURE__ */ __name(() => {
1953
1953
  };
1954
1954
  }, "captureStreams");
1955
1955
 
1956
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
1956
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
1957
1957
  var DEFAULT_RETRY = {
1958
1958
  retries: 1,
1959
1959
  baseDelayMs: 250,
@@ -1965,7 +1965,7 @@ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
1965
1965
  return Math.round(random() * ceiling);
1966
1966
  }, "backoffMs");
1967
1967
 
1968
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
1968
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
1969
1969
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
1970
1970
  var validate = /* @__PURE__ */ __name((paths) => {
1971
1971
  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))))
@@ -2030,7 +2030,7 @@ var projectFields = /* @__PURE__ */ __name((value, fields) => {
2030
2030
  return project(value, fields);
2031
2031
  }, "projectFields");
2032
2032
 
2033
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2033
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2034
2034
  var BATCH_LIMITS = Object.freeze({
2035
2035
  requests: 32,
2036
2036
  input_bytes: 262144,
@@ -2157,7 +2157,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2157
2157
  };
2158
2158
  }, "runBatch");
2159
2159
 
2160
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2160
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2161
2161
  import { randomBytes } from "node:crypto";
2162
2162
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2163
2163
  import { dirname, join } from "node:path";
@@ -2201,16 +2201,16 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
2201
2201
  `, 384);
2202
2202
  }, "saveConfigFile");
2203
2203
 
2204
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
2204
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
2205
2205
  var BASE_CONSTANTS = new URL("../constants.json", new URL("constants.js", import.meta.resolve("@wirecat/cli-base")).href);
2206
2206
  var baseConstantsSchema = object({});
2207
2207
  var LayerSchema = record(string(), unknown());
2208
2208
 
2209
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2209
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2210
2210
  import { readFileSync as readFileSync2 } from "node:fs";
2211
2211
  import { join as join3, resolve } from "node:path";
2212
2212
 
2213
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2213
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2214
2214
  import { createRequire } from "node:module";
2215
2215
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
2216
2216
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -2236,7 +2236,7 @@ var systemKeyring = {
2236
2236
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
2237
2237
  };
2238
2238
 
2239
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2239
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2240
2240
  import { realpathSync } from "node:fs";
2241
2241
  import { homedir, userInfo } from "node:os";
2242
2242
  import { join as join2, posix, win32 } from "node:path";
@@ -2310,7 +2310,7 @@ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = proces
2310
2310
  var isMovedRun = /* @__PURE__ */ __name((options) => pathsAreOverridden(options) || homeIsMoved(options), "isMovedRun");
2311
2311
  var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join2(configDir, fileName), "configFilePath");
2312
2312
 
2313
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2313
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2314
2314
  var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
2315
2315
  var warnedRuns = /* @__PURE__ */ new WeakSet();
2316
2316
  var Credentials = class {
@@ -2349,7 +2349,12 @@ var Credentials = class {
2349
2349
  return { secret: fromFile, source: "file" };
2350
2350
  if (this.#storage !== "file") {
2351
2351
  const temporary = this.#temporaryService;
2352
- const fromKeyring = this.#tryKeyring(() => temporary && this.#keyring.get(temporary, account) || this.#keyring.get(this.#service, account));
2352
+ let fromKeyring;
2353
+ try {
2354
+ fromKeyring = temporary && this.#keyring.get(temporary, account) || this.#keyring.get(this.#service, account);
2355
+ } catch (error) {
2356
+ throw this.#unreachable(account, error);
2357
+ }
2353
2358
  if (fromKeyring)
2354
2359
  return { secret: fromKeyring, source: "keyring" };
2355
2360
  }
@@ -2430,6 +2435,10 @@ var Credentials = class {
2430
2435
  writeSecurely(this.#path(), `${JSON.stringify(store, null, 2)}
2431
2436
  `, 384);
2432
2437
  }
2438
+ #unreachable(account, error) {
2439
+ const where = this.#storage === "keyring" ? "" : `, and ${this.#path()} holds no sign-in for ${account}`;
2440
+ return new CliError("configuration_error", `the OS keyring did not answer (${error instanceof Error ? error.message : String(error)})${where}. On Linux a restarted session bus is a known cause: log out and back in, or set DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus. On a machine with no keyring, sign in with file storage.`, { reason: "keyring.unreachable" });
2441
+ }
2433
2442
  #tryKeyring(operation) {
2434
2443
  if (this.#storage === "keyring")
2435
2444
  return operation();
@@ -2445,7 +2454,7 @@ var Credentials = class {
2445
2454
  }
2446
2455
  };
2447
2456
 
2448
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2457
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2449
2458
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
2450
2459
  var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
2451
2460
  if (signal?.aborted) {
@@ -2458,11 +2467,12 @@ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, re
2458
2467
  reject(abortError());
2459
2468
  }, { once: true });
2460
2469
  }), "realSleep");
2470
+ var wallClock = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "wallClock");
2461
2471
 
2462
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2472
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2463
2473
  import { appendFileSync } from "node:fs";
2464
2474
 
2465
- // node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2475
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2466
2476
  var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
2467
2477
  var logRecordSchema = strictObject({
2468
2478
  time: isoTime,
@@ -2540,7 +2550,7 @@ var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
2540
2550
  return traceId;
2541
2551
  }, "traceIdOf");
2542
2552
 
2543
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2553
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2544
2554
  var REDACTED_FIELDS = [
2545
2555
  "authorization",
2546
2556
  "Authorization",
@@ -2634,7 +2644,7 @@ var silent = {
2634
2644
  }, "error")
2635
2645
  };
2636
2646
 
2637
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2647
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2638
2648
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
2639
2649
  import { styleText } from "node:util";
2640
2650
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -2709,7 +2719,7 @@ var BORDERLESS = {
2709
2719
  middle: ""
2710
2720
  };
2711
2721
 
2712
- // node_modules/.pnpm/@wirecat+cli-base@0.106.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
2722
+ // node_modules/.pnpm/@wirecat+cli-base@0.126.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
2713
2723
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
2714
2724
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
2715
2725
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -2762,6 +2772,7 @@ export {
2762
2772
  configFilePath,
2763
2773
  Credentials,
2764
2774
  realSleep,
2775
+ wallClock,
2765
2776
  defineLogEvents,
2766
2777
  isContentKey,
2767
2778
  traceIdOf,
@@ -5,11 +5,11 @@ import {
5
5
  } from "./chunk-2ABQZVK4.js";
6
6
  import {
7
7
  WIRECAT_TOOLS
8
- } from "./chunk-2KQDJHF3.js";
8
+ } from "./chunk-ZMBVZWUW.js";
9
9
  import {
10
10
  commandPathOf,
11
11
  outputOf
12
- } from "./chunk-SMU6NA7F.js";
12
+ } from "./chunk-SVPNU7PD.js";
13
13
  import {
14
14
  Command,
15
15
  Help,
@@ -20,18 +20,18 @@ import {
20
20
  environmentOf,
21
21
  metaOf,
22
22
  takesProfile
23
- } from "./chunk-UKBK2VWZ.js";
23
+ } from "./chunk-W6A2OZ3C.js";
24
24
  import {
25
25
  writes
26
- } from "./chunk-QVGEL66U.js";
26
+ } from "./chunk-RXBKVNOK.js";
27
27
  import {
28
28
  CliError
29
- } from "./chunk-LIQMUDIZ.js";
29
+ } from "./chunk-GCUFGDKE.js";
30
30
  import {
31
31
  __name
32
32
  } from "./chunk-ZVVMGPBJ.js";
33
33
 
34
- // node_modules/.pnpm/@wirecat+cli-core@0.681.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.106.0_commander@15_8d845c31697914d824aa80d8eec93941/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
34
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.126.1_commander@15_05e4e157d64d32ce6fc62270b9552a1d/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
35
35
  var ARGUMENT_KINDS = {
36
36
  chat: "chat",
37
37
  chats: "chat",
@@ -224,7 +224,7 @@ var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {
224
224
  command.addHelpText("after", () => commandHelpText(command));
225
225
  }, "installCommandHelp");
226
226
 
227
- // node_modules/.pnpm/@wirecat+cli-core@0.681.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.106.0_commander@15_8d845c31697914d824aa80d8eec93941/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
227
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.126.1_commander@15_05e4e157d64d32ce6fc62270b9552a1d/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
228
228
  var WIDTH = 100;
229
229
  var widest = /* @__PURE__ */ __name((texts) => texts.reduce((most, text) => Math.max(most, text.length), 0), "widest");
230
230
  var block = /* @__PURE__ */ __name((title, rows, column) => rows.length === 0 ? [] : ["", `${title}:`, ...rows.map(([left, right]) => ` ${left.padEnd(column)}${right}`)], "block");
@@ -0,0 +1,353 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ AUDIT_MIN_SCORE
5
+ } from "./chunk-BXUMZWMN.js";
6
+ import {
7
+ LIST_QUERY_GUIDE,
8
+ nativeTerms
9
+ } from "./chunk-ZCDRXKCR.js";
10
+ import {
11
+ DEFAULT_CONFIG,
12
+ environmentOf,
13
+ itemOf,
14
+ listOf,
15
+ nextStep,
16
+ renderAnswer,
17
+ snakeKeys,
18
+ withAgentLevels
19
+ } from "./chunk-W6A2OZ3C.js";
20
+ import {
21
+ formatReference
22
+ } from "./chunk-4CLSIEWN.js";
23
+ import {
24
+ queryError
25
+ } from "./chunk-QD4MTOI7.js";
26
+ import {
27
+ CliError
28
+ } from "./chunk-GCUFGDKE.js";
29
+ import {
30
+ __name
31
+ } from "./chunk-ZVVMGPBJ.js";
32
+
33
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.126.1_commander@15_05e4e157d64d32ce6fc62270b9552a1d/node_modules/@wirecat/cli-core/dist/cli/paging.js
34
+ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
35
+ if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
36
+ throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
37
+ return Number(value);
38
+ }, "positiveCount");
39
+ var configuredLimit = /* @__PURE__ */ __name((command, most = Number.POSITIVE_INFINITY) => {
40
+ const { resolveSettings, env } = environmentOf(command);
41
+ const { limit: _typed, ...flags } = command.optsWithGlobals();
42
+ const configured = resolveSettings?.(flags, { needsProfile: false, ...env ? { env } : {} }).limit ?? DEFAULT_CONFIG.defaults.limit;
43
+ return Math.min(configured, most);
44
+ }, "configuredLimit");
45
+ var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
46
+ var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
47
+ var pagingOf = /* @__PURE__ */ __name((command) => {
48
+ const environment = environmentOf(command);
49
+ const flags = command.optsWithGlobals();
50
+ if (!environment.resolveSettings)
51
+ return { limit: flags.limit ?? DEFAULT_CONFIG.defaults.limit, page: flags.page ?? 1 };
52
+ const { limit, page } = environment.resolveSettings(withAgentLevels(command, command.optsWithGlobals()), {
53
+ env: environment.env ?? process.env,
54
+ needsProfile: false,
55
+ readOnly: true
56
+ });
57
+ return { limit: limit ?? DEFAULT_CONFIG.defaults.limit, page: page ?? 1 };
58
+ }, "pagingOf");
59
+
60
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.126.1_commander@15_05e4e157d64d32ce6fc62270b9552a1d/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
61
+ var defined = /* @__PURE__ */ __name((record) => Object.fromEntries(Object.entries(record).filter(([, value]) => value !== void 0)), "defined");
62
+ var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
63
+ var settingsOf = /* @__PURE__ */ __name((settings) => defined({
64
+ all_can_pin: settings.allCanPin,
65
+ only_admins_add: settings.onlyAdminsAdd,
66
+ only_admins_call: settings.onlyAdminsCall,
67
+ only_owner_edits_info: settings.onlyOwnerEditsInfo,
68
+ members_see_link: settings.membersSeeLink,
69
+ join_approval: settings.joinApproval,
70
+ only_admins_send: settings.onlyAdminsSend,
71
+ only_admins_edit_info: settings.onlyAdminsEditInfo,
72
+ disappearing_seconds: settings.disappearingSeconds
73
+ }), "settingsOf");
74
+ var chatAnswer = /* @__PURE__ */ __name((account, chat) => defined({
75
+ ref: chatRef(account, chat.id),
76
+ id: chat.id,
77
+ title: chat.title,
78
+ kind: chat.kind,
79
+ unread_count: chat.unreadCount,
80
+ unread_mentions: chat.unreadMentions,
81
+ last_message_at: chat.lastMessageAt,
82
+ participants_count: chat.participantsCount,
83
+ muted: chat.muted,
84
+ muted_until: chat.mutedUntil ?? void 0,
85
+ archived: chat.archived,
86
+ marked_unread: chat.markedUnread,
87
+ membership_state: chat.membershipState,
88
+ parent_chat_id: chat.parentChatId ?? void 0,
89
+ scope: chat.scope,
90
+ provider_metadata: chat.providerMetadata,
91
+ description: chat.description,
92
+ invite_link: chat.link,
93
+ settings: chat.settings ? settingsOf(chat.settings) : void 0,
94
+ members: chat.members?.map(memberAnswer)
95
+ }), "chatAnswer");
96
+ var memberAnswer = /* @__PURE__ */ __name((member) => {
97
+ const group = member;
98
+ return defined({
99
+ id: member.id,
100
+ name: member.name,
101
+ username: member.username,
102
+ role: group.role,
103
+ last_seen_at: group.lastSeenAt,
104
+ registered_at: group.registeredAt,
105
+ joined_at: group.joinedAt,
106
+ invited_by: group.invitedBy,
107
+ is_bot: group.isBot,
108
+ deleted: group.deleted,
109
+ flagged: group.flagged,
110
+ has_photo: group.hasPhoto,
111
+ score: group.score,
112
+ reasons: group.reasons,
113
+ check: group.check ? snakeKeys(group.check) : void 0
114
+ });
115
+ }, "memberAnswer");
116
+ var contactRef = /* @__PURE__ */ __name((provider, id) => formatReference({ type: "contact", provider, id }), "contactRef");
117
+ var contactAnswer = /* @__PURE__ */ __name((account, contact) => {
118
+ const card = contact;
119
+ return defined({
120
+ ref: contactRef(account.provider, contact.id),
121
+ id: contact.id,
122
+ name: contact.name,
123
+ username: contact.username,
124
+ alias: contact.alias,
125
+ display_name: contact.displayName,
126
+ description: contact.description,
127
+ last_messaged_at: contact.lastMessagedAt,
128
+ chats: card.chats?.map((chat) => ({
129
+ ref: chatRef(account, chat.id),
130
+ id: chat.id,
131
+ title: chat.title,
132
+ kind: chat.kind,
133
+ last_message_at: chat.lastMessageAt
134
+ })),
135
+ notes: card.notes?.map(({ id, text, revision, createdAt, updatedAt }) => ({
136
+ id,
137
+ text,
138
+ revision,
139
+ created_at: createdAt,
140
+ updated_at: updatedAt
141
+ }))
142
+ });
143
+ }, "contactAnswer");
144
+ var contactShown = /* @__PURE__ */ __name((account, card, profile) => {
145
+ const { id: _id, name: _name, bio, chats, ...facts } = profile;
146
+ const listed = new Map(card.chats.map((chat) => [chat.id, chat]));
147
+ const active = new Set(chats.map(({ id }) => id));
148
+ const shared = [
149
+ ...chats.map((chat) => ({
150
+ ref: chatRef(account, chat.id),
151
+ id: chat.id,
152
+ title: chat.title,
153
+ kind: chat.kind,
154
+ last_message_at: listed.get(chat.id)?.lastMessageAt ?? chat.lastAt,
155
+ their_messages: chat.theirMessages,
156
+ first_at: chat.firstAt,
157
+ last_at: chat.lastAt,
158
+ complete: chat.complete
159
+ })),
160
+ ...card.chats.filter(({ id }) => !active.has(id)).map((chat) => ({
161
+ ref: chatRef(account, chat.id),
162
+ id: chat.id,
163
+ title: chat.title,
164
+ kind: chat.kind,
165
+ last_message_at: chat.lastMessageAt
166
+ }))
167
+ ];
168
+ const answer = contactAnswer(account, card);
169
+ return {
170
+ ...answer,
171
+ ...snakeKeys(facts),
172
+ description: answer.description ?? bio,
173
+ chats: shared
174
+ };
175
+ }, "contactShown");
176
+ var chatEventAnswer = /* @__PURE__ */ __name((chatId, event) => defined({
177
+ chat_id: chatId,
178
+ time: event.timestamp,
179
+ type: event.event,
180
+ message_id: event.messageId,
181
+ by: event.by,
182
+ people: event.people,
183
+ title: event.title
184
+ }), "chatEventAnswer");
185
+ var HISTORY_TYPES = { joined: "join", left: "leave", changed: "profile" };
186
+ var memberEventAnswer = /* @__PURE__ */ __name((chatId, event) => defined({
187
+ chat_id: chatId,
188
+ time: event.at,
189
+ type: HISTORY_TYPES[event.event],
190
+ by: event.invitedBy === void 0 ? void 0 : { id: event.invitedBy, name: null },
191
+ people: [{ id: event.id, name: event.name, username: event.username }],
192
+ before: event.before ? { name: event.before.name, username: event.before.username } : void 0
193
+ }), "memberEventAnswer");
194
+ var inviteLinkAnswer = /* @__PURE__ */ __name((link) => defined({
195
+ link: link.link,
196
+ approval: link.approval,
197
+ expires_at: link.expiresAt,
198
+ max_uses: link.maxUses,
199
+ primary: link.primary,
200
+ revoked: link.revoked,
201
+ pending_count: link.pending,
202
+ joined_count: link.joined
203
+ }), "inviteLinkAnswer");
204
+ var joinRequestAnswer = /* @__PURE__ */ __name((request) => defined({
205
+ person_id: request.person.id,
206
+ name: request.person.name,
207
+ username: request.person.username,
208
+ requested_at: request.requestedAt,
209
+ about: request.about
210
+ }), "joinRequestAnswer");
211
+ var pollVoteAnswer = /* @__PURE__ */ __name((vote) => ({
212
+ person_id: vote.person.id,
213
+ name: vote.person.name,
214
+ username: vote.person.username,
215
+ answers: vote.answers,
216
+ voted_at: vote.votedAt
217
+ }), "pollVoteAnswer");
218
+ var reactorAnswer = /* @__PURE__ */ __name((reactor) => ({
219
+ person: { id: reactor.person.id, name: reactor.person.name, username: reactor.person.username },
220
+ reaction: reactor.reaction,
221
+ reacted_at: reactor.reactedAt
222
+ }), "reactorAnswer");
223
+ var topicAnswer = /* @__PURE__ */ __name((topic) => defined({
224
+ id: topic.id,
225
+ title: topic.title,
226
+ closed: topic.closed,
227
+ pinned: topic.pinned,
228
+ hidden: topic.hidden,
229
+ unread_count: topic.unreadCount,
230
+ last_message_at: topic.lastMessageAt,
231
+ created_at: topic.createdAt,
232
+ untrusted: ["title"]
233
+ }), "topicAnswer");
234
+ var folderAnswer = /* @__PURE__ */ __name((folder) => {
235
+ const shown = "chats" in folder ? folder : void 0;
236
+ const listed = shown ? void 0 : folder;
237
+ return defined({
238
+ id: folder.id,
239
+ title: folder.title,
240
+ chat_ids: listed ? listed.chatIds : shown?.chats.map((chat) => chat.id) ?? [],
241
+ emoji: folder.emoji,
242
+ include: folder.include,
243
+ skip: folder.skip,
244
+ excluded_chat_ids: listed?.excludedChatIds ?? shown?.excluded.map((chat) => chat.id),
245
+ pinned_chat_ids: listed?.pinnedChatIds ?? shown?.pinned.map((chat) => chat.id),
246
+ chats: shown?.chats,
247
+ pinned_chats: shown?.pinned,
248
+ excluded_chats: shown?.excluded
249
+ });
250
+ }, "folderAnswer");
251
+ var lines = /* @__PURE__ */ __name((line) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((item) => `${line(item).trimEnd()}
252
+ `).join(""), "lines");
253
+ var pageOf = /* @__PURE__ */ __name(({ limit, page, all }, { items, hasMore }) => all ? { limit: Math.max(1, items.length), has_more: false, page: 1 } : { limit, has_more: hasMore, page }, "pageOf");
254
+ var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
255
+ var chatShown = /* @__PURE__ */ __name((account, card) => {
256
+ const listed = card.members?.length;
257
+ const short = listed !== void 0 && card.participantsCount !== null && listed < card.participantsCount;
258
+ return itemOf(chatAnswer(account, card), short ? {
259
+ missing: [
260
+ {
261
+ field: "members",
262
+ why: `${listed} listed; the chat reports ${card.participantsCount} \u2014 the list may omit your account or be partial`,
263
+ step: "chats.members"
264
+ }
265
+ ],
266
+ next: [nextStep("chats.members", { args: { chat: card.id } })]
267
+ } : {});
268
+ }, "chatShown");
269
+ var scoreFloor = /* @__PURE__ */ __name((ast) => {
270
+ const term = nativeTerms(ast, "chats members check").get("score");
271
+ if (!term)
272
+ return AUDIT_MIN_SCORE;
273
+ const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
274
+ if (term.operator !== "range" || upper !== "*")
275
+ queryError("query.unsupported-operator", term.span, "score takes a lower bound: score>=3", {
276
+ command: "chats members check",
277
+ guide: LIST_QUERY_GUIDE
278
+ });
279
+ const floor = Number(term.value);
280
+ return Math.ceil(term.lower_inclusive === false ? floor + 1 : floor);
281
+ }, "scoreFloor");
282
+ var auditAnswer = /* @__PURE__ */ __name((audit) => wholeList("chats members check", audit.items.map(memberAnswer), {
283
+ ...audit.more ? { meta: { truncated: true } } : {},
284
+ ...audit.completeness && audit.completeness.state !== "complete" ? {
285
+ missing: [
286
+ {
287
+ field: "reasons",
288
+ why: "never_wrote counts only stored messages, and the store does not hold the chat whole",
289
+ ...audit.fetch ? { step: "messages.sync" } : {}
290
+ }
291
+ ],
292
+ ...audit.fetch ? { next: [nextStep("messages.sync", { args: { chat: audit.chatId } })] } : {}
293
+ } : {}
294
+ }), "auditAnswer");
295
+ var renderItem = /* @__PURE__ */ __name((command, output, value, next = []) => renderAnswer(command, output, itemOf(snakeKeys(value), { next })), "renderItem");
296
+ var withPage = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")), "withPage");
297
+ var documentLinkAnswer = /* @__PURE__ */ __name(({ url, documentId, title, inStore, locator, sentAt, sender }) => ({
298
+ url,
299
+ document_id: documentId,
300
+ title,
301
+ in_store: inStore,
302
+ ref: locator,
303
+ sent_at: sentAt,
304
+ sender
305
+ }), "documentLinkAnswer");
306
+ var accountAnswer = /* @__PURE__ */ __name((provider, { id, name, username, phone }) => ({
307
+ provider,
308
+ id,
309
+ name,
310
+ username,
311
+ ...phone === void 0 ? {} : { phone }
312
+ }), "accountAnswer");
313
+ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location, lastActiveAt, createdAt }) => ({
314
+ current,
315
+ client,
316
+ device,
317
+ location,
318
+ last_active_at: lastActiveAt,
319
+ ...createdAt === void 0 ? {} : { created_at: createdAt }
320
+ }), "sessionAnswer");
321
+
322
+ export {
323
+ positiveCount,
324
+ configuredLimit,
325
+ withPaging,
326
+ window,
327
+ pagingOf,
328
+ chatRef,
329
+ chatAnswer,
330
+ memberAnswer,
331
+ contactRef,
332
+ contactAnswer,
333
+ contactShown,
334
+ chatEventAnswer,
335
+ memberEventAnswer,
336
+ inviteLinkAnswer,
337
+ joinRequestAnswer,
338
+ pollVoteAnswer,
339
+ reactorAnswer,
340
+ topicAnswer,
341
+ folderAnswer,
342
+ lines,
343
+ pageOf,
344
+ wholeList,
345
+ chatShown,
346
+ scoreFloor,
347
+ auditAnswer,
348
+ renderItem,
349
+ withPage,
350
+ documentLinkAnswer,
351
+ accountAnswer,
352
+ sessionAnswer
353
+ };