@wirecat/tg-cli 0.101.0 → 0.103.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 (126) hide show
  1. package/dist/bin/tg.js +31 -19
  2. package/dist/bot/transport.d.ts.map +1 -1
  3. package/dist/bot/transport.js +14 -17
  4. package/dist/bot/transport.js.map +1 -1
  5. package/dist/bundle/{adapter-A3VD4Y6Z.js → adapter-QG3YFFOY.js} +101 -38
  6. package/dist/bundle/{all-profiles-UPVNHXB2.js → all-profiles-ECXH3TBF.js} +32 -11
  7. package/dist/bundle/{anthropic-IRKNWPIB.js → anthropic-5MKO3QX7.js} +10 -10
  8. package/dist/bundle/{bot-api-UNTQG2M5.js → bot-api-4DQPIOMK.js} +55 -58
  9. package/dist/bundle/{bot-history-V4RTY5K7.js → bot-history-UN74XXLU.js} +19 -19
  10. package/dist/bundle/{bun-2JZPG2NL.js → bun-PS73VF2C.js} +5 -5
  11. package/dist/bundle/{bun-sqlite-TZHKM225.js → bun-sqlite-RAWGPH23.js} +8 -8
  12. package/dist/bundle/{chunk-ZZLKX62Z.js → chunk-2ABQZVK4.js} +3 -3
  13. package/dist/bundle/{chunk-MLLJ74LM.js → chunk-3CP7RK5R.js} +4 -4
  14. package/dist/bundle/{chunk-BXQS5RCE.js → chunk-3IXKDIPH.js} +258 -83
  15. package/dist/bundle/{chunk-W2336E7Y.js → chunk-3QX6SOEO.js} +9 -9
  16. package/dist/bundle/{chunk-F7TDFWXY.js → chunk-537O7OVE.js} +6 -6
  17. package/dist/bundle/{chunk-N5UFBWDM.js → chunk-57XGUIXA.js} +9 -11
  18. package/dist/bundle/{chunk-3KHKYYCR.js → chunk-5D4AEUVA.js} +4 -3
  19. package/dist/bundle/{chunk-ODSVNH3H.js → chunk-5HPAPVCB.js} +2415 -1292
  20. package/dist/bundle/{chunk-OEJ5DMCX.js → chunk-67SRVSPU.js} +10 -10
  21. package/dist/bundle/{chunk-XCKD54TN.js → chunk-6N25NZOE.js} +9 -9
  22. package/dist/bundle/chunk-AAMJZJYC.js +922 -0
  23. package/dist/bundle/{chunk-AVWK4NCW.js → chunk-ADLS6FVG.js} +13 -13
  24. package/dist/bundle/{chunk-ZV24I2UJ.js → chunk-AUKAZRF6.js} +5 -5
  25. package/dist/bundle/{chunk-S7ZNLLY5.js → chunk-BV4N333Y.js} +6 -6
  26. package/dist/bundle/{chunk-UN6CKIBN.js → chunk-BYYSVINK.js} +11 -8
  27. package/dist/bundle/{chunk-54R2GDQ3.js → chunk-CMQ34EZL.js} +6 -6
  28. package/dist/bundle/{chunk-G2US6LJB.js → chunk-COZ74WW4.js} +4 -4
  29. package/dist/bundle/{chunk-7BFO3DY6.js → chunk-DFDN6AUB.js} +2 -2
  30. package/dist/bundle/{chunk-VA5YEJS3.js → chunk-DLF3H6NP.js} +7 -7
  31. package/dist/bundle/{chunk-QOWSVDPZ.js → chunk-DWQ4QT6X.js} +111 -100
  32. package/dist/bundle/chunk-EMC57SOZ.js +440 -0
  33. package/dist/bundle/{chunk-RVCS7Q3A.js → chunk-EQHQ2AX3.js} +1390 -522
  34. package/dist/bundle/{chunk-64DK7S4F.js → chunk-F27OI4J2.js} +4 -4
  35. package/dist/bundle/{chunk-2XBSVRT2.js → chunk-FG2QTYEF.js} +4 -4
  36. package/dist/bundle/{chunk-BX6HH4F6.js → chunk-FSPDODVT.js} +14 -14
  37. package/dist/bundle/{chunk-4ZS73HTJ.js → chunk-G5IMOOPB.js} +4 -4
  38. package/dist/bundle/{chunk-VCGL2ETF.js → chunk-GO354DJ5.js} +4 -4
  39. package/dist/bundle/{chunk-5TPT2S2Z.js → chunk-H2UTBYFC.js} +4 -4
  40. package/dist/bundle/{chunk-U46UNBMT.js → chunk-HCDZWFXO.js} +244 -21
  41. package/dist/bundle/{chunk-TGREFJVA.js → chunk-KCVDWZWS.js} +11 -11
  42. package/dist/bundle/{chunk-PUBS2F5J.js → chunk-KQ5BUI5T.js} +248 -248
  43. package/dist/bundle/{chunk-ACGTFLEB.js → chunk-LAYPLF7G.js} +35 -282
  44. package/dist/bundle/{chunk-5KU4UQBM.js → chunk-MFS52LTZ.js} +4 -4
  45. package/dist/bundle/{chunk-DYNSP6FW.js → chunk-MHHDVR4G.js} +1449 -832
  46. package/dist/bundle/{chunk-S2JSZWEC.js → chunk-NIVZHTN4.js} +15 -15
  47. package/dist/bundle/{chunk-A5JSTZZZ.js → chunk-NKN54EDN.js} +6 -6
  48. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  49. package/dist/bundle/{chunk-5GKXETRP.js → chunk-OGVBRRWY.js} +615 -56
  50. package/dist/bundle/{chunk-VYDTI254.js → chunk-Q2LBOPKO.js} +99 -50
  51. package/dist/bundle/{chunk-LPB2MDUW.js → chunk-QF7VVIF4.js} +11 -11
  52. package/dist/bundle/{chunk-VRSN7VLO.js → chunk-RD7SSY7H.js} +4 -4
  53. package/dist/bundle/{chunk-ZEOCU24Z.js → chunk-RKQIEJFR.js} +5 -5
  54. package/dist/bundle/chunk-RMC2S3F4.js +264 -0
  55. package/dist/bundle/{chunk-2DGOFLDA.js → chunk-S5M4HFOZ.js} +6 -6
  56. package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-SSALGKMJ.js} +94 -5
  57. package/dist/bundle/{chunk-G3ZRY436.js → chunk-SSV37M5T.js} +59 -59
  58. package/dist/bundle/{chunk-DG62L57H.js → chunk-T4SDOYPY.js} +20 -20
  59. package/dist/bundle/{chunk-6IPY2QRG.js → chunk-TEO2KP52.js} +5 -5
  60. package/dist/bundle/{chunk-G77QOTXE.js → chunk-TPFLD4OM.js} +5 -5
  61. package/dist/bundle/{chunk-PYTOIDSM.js → chunk-VMU4SGCE.js} +7 -7
  62. package/dist/bundle/{chunk-QYVVRQTN.js → chunk-VZN5LD26.js} +6 -6
  63. package/dist/bundle/{chunk-ZJVZXJOG.js → chunk-WAGDZB62.js} +5 -5
  64. package/dist/bundle/{chunk-7CBUCTB6.js → chunk-WULARSC4.js} +33 -39
  65. package/dist/bundle/{chunk-BJG6JA5U.js → chunk-Y5E2WNWB.js} +4 -4
  66. package/dist/bundle/{chunk-H6OXALTJ.js → chunk-YI72UVTJ.js} +5 -5
  67. package/dist/bundle/{chunk-NC5WS7OP.js → chunk-Z2DPNTSU.js} +5 -5
  68. package/dist/bundle/{chunk-RF54YDBB.js → chunk-ZHXSRYJ5.js} +6 -6
  69. package/dist/bundle/{chunk-AFV74GK3.js → chunk-ZVVMGPBJ.js} +2 -2
  70. package/dist/bundle/command-contract-ZGFJTLB2.js +32 -0
  71. package/dist/bundle/{dist-RJMT44PL.js → dist-I7OZPHAZ.js} +3 -3
  72. package/dist/bundle/{echarts-QZ6PR3VC.js → echarts-UEQDIHVQ.js} +5 -5
  73. package/dist/bundle/{embed-UBXCXSRD.js → embed-5DPZKRW5.js} +9 -8
  74. package/dist/bundle/{embedder-B4ZTKC23.js → embedder-NBQXDXAO.js} +12 -11
  75. package/dist/bundle/entry-EE6YRAP4.js +14 -0
  76. package/dist/bundle/first-run-OSEVVWNT.js +24 -0
  77. package/dist/bundle/first-screen-753THOU6.js +30 -0
  78. package/dist/bundle/identity-LNH33PN3.js +11 -0
  79. package/dist/bundle/instructions-PYGVIT7I.js +9 -0
  80. package/dist/bundle/{mcp-4Y37G2UY.js → mcp-OQBZXELQ.js} +5 -5
  81. package/dist/bundle/{node-LZZX22VR.js → node-3OBKCX6M.js} +5 -5
  82. package/dist/bundle/{node-IUL5HSYI.js → node-P4E63KXA.js} +5 -5
  83. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  84. package/dist/bundle/{node-sqlite-BPGT6T5U.js → node-sqlite-DMMTDRFB.js} +8 -8
  85. package/dist/bundle/oauth-FX5DDCRS.js +18 -0
  86. package/dist/bundle/open-G6QRQAAL.js +20 -0
  87. package/dist/bundle/{process-GPUXC4PG.js → process-47MMIFIJ.js} +5 -5
  88. package/dist/bundle/{program-NEXEAL7T.js → program-LBHBWRK5.js} +67 -71
  89. package/dist/bundle/prompt-CJ6Y4JYC.js +13 -0
  90. package/dist/bundle/proxy-transport-YSBYG26I.js +17 -0
  91. package/dist/bundle/{recognize-UJBXORVD.js → recognize-7BLTOI45.js} +9 -9
  92. package/dist/bundle/remote-Q4A4JY6U.js +27 -0
  93. package/dist/bundle/{rerank-3Y2VZM3J.js → rerank-CQAR46L3.js} +10 -9
  94. package/dist/bundle/{serve-VDZIVOPR.js → serve-2UO2YMMG.js} +13 -13
  95. package/dist/bundle/{server-BERXP4GW.js → server-6XYURULQ.js} +80 -68
  96. package/dist/bundle/{server-ZFHN4GUF.js → server-FMKC4RLL.js} +46 -41
  97. package/dist/bundle/{state-DGR4EE3E.js → state-RNWN2RDY.js} +9 -9
  98. package/dist/bundle/{store-MRCFSCZD.js → store-BBHTR477.js} +14 -14
  99. package/dist/bundle/store-maintenance-command-GD6OLRXH.js +44 -0
  100. package/dist/bundle/tg.js +8 -8
  101. package/dist/telegram/sending.d.ts.map +1 -1
  102. package/dist/telegram/sending.js +52 -3
  103. package/dist/telegram/sending.js.map +1 -1
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +4 -4
  107. package/dist/bundle/chunk-22PQUX72.js +0 -190
  108. package/dist/bundle/chunk-2SJOUK6J.js +0 -2
  109. package/dist/bundle/chunk-CJ6IYCYP.js +0 -583
  110. package/dist/bundle/chunk-NKJJJAIJ.js +0 -237
  111. package/dist/bundle/chunk-NMGO6LW6.js +0 -1950
  112. package/dist/bundle/chunk-OILBDLWL.js +0 -724
  113. package/dist/bundle/chunk-OPBTNQ35.js +0 -1007
  114. package/dist/bundle/command-contract-TKDI7E56.js +0 -31
  115. package/dist/bundle/entry-BTUTHO5M.js +0 -14
  116. package/dist/bundle/first-run-UC4HRIFV.js +0 -24
  117. package/dist/bundle/first-screen-SMCX6YKY.js +0 -29
  118. package/dist/bundle/identity-QSDEGDH7.js +0 -11
  119. package/dist/bundle/instructions-BBGLZKO3.js +0 -9
  120. package/dist/bundle/node-UPPL626U.js +0 -21
  121. package/dist/bundle/oauth-XNE2KPKJ.js +0 -18
  122. package/dist/bundle/open-SXGYZLB5.js +0 -20
  123. package/dist/bundle/prompt-SORGLEYI.js +0 -13
  124. package/dist/bundle/proxy-transport-G4MA6BGU.js +0 -17
  125. package/dist/bundle/remote-W72AR7KH.js +0 -26
  126. package/dist/bundle/store-maintenance-command-DCMZDMYS.js +0 -46
@@ -1,47 +1,34 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
3
- import {
4
- CEILING_KEY,
5
- COMMAND_PATH_KEY,
6
- LEVELS,
7
- LOG_ATTRIBUTES,
8
- RESOURCES,
9
- RESOURCE_KEY,
10
- assertOverridesTighten,
11
- currentRun,
12
- enclosingTraceId,
13
- fieldsOf,
14
- inRun,
15
- keyForCommand,
16
- layerPermissions,
17
- logAttributes,
18
- newRunId,
19
- permissionOverrides,
20
- projectFields,
21
- resolveOutput,
22
- runsDirFor,
23
- snakeLogger,
24
- startRun,
25
- stopWrites,
26
- traceOf,
27
- typedCommand,
28
- useAsProcessRun,
29
- withWriteScope
30
- } from "./chunk-OPBTNQ35.js";
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
31
3
  import {
32
4
  count,
33
5
  id,
34
6
  text,
35
7
  time
36
- } from "./chunk-54R2GDQ3.js";
8
+ } from "./chunk-CMQ34EZL.js";
9
+ import {
10
+ currentCaller,
11
+ endpointTemplate,
12
+ errorDetailOf,
13
+ framesOf,
14
+ isCliFailure,
15
+ keepsSuccess,
16
+ providerErrorKey,
17
+ renderEvent,
18
+ runContextOf
19
+ } from "./chunk-EMC57SOZ.js";
37
20
  import {
38
21
  permissionCeiling
39
- } from "./chunk-S7ZNLLY5.js";
22
+ } from "./chunk-BV4N333Y.js";
40
23
  import {
41
24
  envName,
42
25
  readOnlyLockOf,
43
26
  readOnlyRefusal
44
- } from "./chunk-ZV24I2UJ.js";
27
+ } from "./chunk-AUKAZRF6.js";
28
+ import {
29
+ filesPresent,
30
+ sharedModelsDirectory
31
+ } from "./chunk-RMC2S3F4.js";
45
32
  import {
46
33
  FIELD_TYPES,
47
34
  QUERY_BACKENDS,
@@ -50,22 +37,26 @@ import {
50
37
  TASK_STATES,
51
38
  TASK_TYPES,
52
39
  describeQuery
53
- } from "./chunk-G3ZRY436.js";
40
+ } from "./chunk-SSV37M5T.js";
54
41
  import {
55
42
  sharedConfigPath
56
- } from "./chunk-W2336E7Y.js";
43
+ } from "./chunk-3QX6SOEO.js";
57
44
  import {
58
45
  storePath
59
- } from "./chunk-G77QOTXE.js";
46
+ } from "./chunk-TPFLD4OM.js";
60
47
  import {
61
48
  configFilePath,
62
49
  createRecordLog,
50
+ createRenderer,
63
51
  exitCodeOfAnswer,
52
+ fieldsOf,
64
53
  processStreams,
54
+ projectFields,
65
55
  resolvePaths,
66
56
  saveConfigFile,
57
+ singleLine,
67
58
  writeSecurely
68
- } from "./chunk-DG62L57H.js";
59
+ } from "./chunk-T4SDOYPY.js";
69
60
  import {
70
61
  CliError,
71
62
  MAX_NEXT_STEPS,
@@ -76,10 +67,9 @@ import {
76
67
  defineLogEvents,
77
68
  defineSteps,
78
69
  effectsSchema,
79
- errorCodes,
80
70
  getDotPath,
81
71
  integer,
82
- isContentKey,
72
+ isCliError,
83
73
  itemEnvelopeSchema,
84
74
  jsonlOf,
85
75
  lazy,
@@ -103,16 +93,17 @@ import {
103
93
  stepOf,
104
94
  strictObject,
105
95
  string,
96
+ traceIdOf,
106
97
  trim,
107
98
  union,
108
99
  unknown,
109
100
  writes
110
- } from "./chunk-OEJ5DMCX.js";
101
+ } from "./chunk-67SRVSPU.js";
111
102
  import {
112
103
  __name
113
- } from "./chunk-AFV74GK3.js";
104
+ } from "./chunk-ZVVMGPBJ.js";
114
105
 
115
- // node_modules/.pnpm/@wirecat+cli-base@0.64.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
106
+ // 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/commands/registry.js
116
107
  var labels = /* @__PURE__ */ new WeakMap();
117
108
  var annotate = /* @__PURE__ */ __name((command, meta) => {
118
109
  labels.set(command, { ...labels.get(command), ...meta });
@@ -132,8 +123,8 @@ var snake = /* @__PURE__ */ __name((name) => name.replace(/[A-Z]/g, (letter) =>
132
123
  var stepTargets = /* @__PURE__ */ __name((root) => {
133
124
  const found = /* @__PURE__ */ new Map();
134
125
  const optionName = /* @__PURE__ */ __name((option) => snake((option.long ?? option.attributeName()).replace(/^--/, "")), "optionName");
135
- const visit2 = /* @__PURE__ */ __name((command, parents, above) => {
136
- const path2 = [...parents, command.name()];
126
+ const visit2 = /* @__PURE__ */ __name((command, parents2, above) => {
127
+ const path2 = [...parents2, command.name()];
137
128
  const options = [...above, ...command.options];
138
129
  const { effects } = metaOf(command);
139
130
  found.set(path2.join(" "), {
@@ -155,8 +146,8 @@ var describeAlone = /* @__PURE__ */ __name((command, known) => {
155
146
  }
156
147
  return found;
157
148
  }, "describeAlone");
158
- var describe = /* @__PURE__ */ __name((command, cli, parents, above, known) => {
159
- const path2 = [...parents, command.name()];
149
+ var describe = /* @__PURE__ */ __name((command, cli, parents2, above, known) => {
150
+ const path2 = [...parents2, command.name()];
160
151
  const args = command.registeredArguments.map(describeArgument);
161
152
  const options = describeOptions(command);
162
153
  const { origin = "handwritten", query, mcp, offline, ...meta } = metaOf(command);
@@ -3613,7 +3604,7 @@ __name(useColor, "useColor");
3613
3604
  // node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
3614
3605
  var program = new Command();
3615
3606
 
3616
- // node_modules/.pnpm/@wirecat+cli-base@0.64.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
3607
+ // 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/commands/contracts.js
3617
3608
  import { isDeepStrictEqual } from "node:util";
3618
3609
  var protectedCommands = /* @__PURE__ */ new WeakMap();
3619
3610
  var hasSharedContract = /* @__PURE__ */ __name((command) => protectedCommands.has(command), "hasSharedContract");
@@ -3815,7 +3806,7 @@ var customizeSharedCommand = /* @__PURE__ */ __name((reference2, reason, build,
3815
3806
  return command;
3816
3807
  }, "customizeSharedCommand");
3817
3808
 
3818
- // node_modules/.pnpm/@wirecat+cli-base@0.64.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
3809
+ // 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/commands/document.js
3819
3810
  var argumentInfoSchema = object({
3820
3811
  name: string(),
3821
3812
  required: boolean(),
@@ -3888,7 +3879,7 @@ var commandsDocumentSchema = strictObject({
3888
3879
  exit_codes: record(string(), pipe(number(), integer()))
3889
3880
  });
3890
3881
 
3891
- // node_modules/.pnpm/@wirecat+cli-base@0.64.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/commands/index.js
3882
+ // 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/commands/index.js
3892
3883
  var refuseJoinedPath = /* @__PURE__ */ __name((root, args, prefix = []) => {
3893
3884
  let command = root;
3894
3885
  const path2 = [];
@@ -3906,7 +3897,140 @@ var refuseJoinedPath = /* @__PURE__ */ __name((root, args, prefix = []) => {
3906
3897
  }
3907
3898
  }, "refuseJoinedPath");
3908
3899
 
3909
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/execution.js
3900
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/sends/guarded.js
3901
+ import { AsyncLocalStorage } from "node:async_hooks";
3902
+ var sentIds = /* @__PURE__ */ __name((typed, message) => ({
3903
+ messageId: message.id,
3904
+ ...message.chatId && message.chatId !== typed ? { resultChatId: message.chatId } : {}
3905
+ }), "sentIds");
3906
+ var current = new AsyncLocalStorage();
3907
+ var writesInFlight = new AsyncLocalStorage();
3908
+ var parents = /* @__PURE__ */ new WeakMap();
3909
+ var stopped = /* @__PURE__ */ new WeakMap();
3910
+ var scopesFor = /* @__PURE__ */ __name((scope = writesInFlight.getStore()) => {
3911
+ const result = [];
3912
+ for (let at = scope; at; at = parents.get(at))
3913
+ result.push(at);
3914
+ return result;
3915
+ }, "scopesFor");
3916
+ var withWriteScope = /* @__PURE__ */ __name((scope, body) => {
3917
+ const parent = writesInFlight.getStore();
3918
+ if (parent && parent !== scope)
3919
+ parents.set(scope, parent);
3920
+ return writesInFlight.run(scope, body);
3921
+ }, "withWriteScope");
3922
+ var stopWrites = /* @__PURE__ */ __name((scope, reason) => {
3923
+ stopped.set(scope, reason);
3924
+ for (const write of scope)
3925
+ write.cut();
3926
+ }, "stopWrites");
3927
+ var refuseStopped = /* @__PURE__ */ __name((scopes3) => {
3928
+ for (const scope of scopes3)
3929
+ if (stopped.has(scope))
3930
+ throw stopped.get(scope);
3931
+ }, "refuseStopped");
3932
+ var currentOperation = /* @__PURE__ */ __name(() => current.getStore(), "currentOperation");
3933
+ var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled2 = () => ({}), prepare) => {
3934
+ const scopes3 = scopesFor();
3935
+ refuseStopped(scopes3);
3936
+ try {
3937
+ await guard.ask?.(attempt);
3938
+ refuseStopped(scopes3);
3939
+ if (guard.reserve) {
3940
+ guard.check(attempt, { reserve: false });
3941
+ await guard.reserve(attempt);
3942
+ } else
3943
+ guard.check(attempt);
3944
+ } catch (error) {
3945
+ guard.record({ ...attempt, outcome: "refused", errorCode: codeOf(error) });
3946
+ throw error;
3947
+ }
3948
+ try {
3949
+ refuseStopped(scopes3);
3950
+ } catch (error) {
3951
+ guard.record({ ...attempt, outcome: "failed", errorCode: codeOf(error) });
3952
+ throw error;
3953
+ }
3954
+ let recorded2 = false;
3955
+ const once = /* @__PURE__ */ __name((entry) => {
3956
+ if (recorded2)
3957
+ return;
3958
+ recorded2 = true;
3959
+ guard.record(entry);
3960
+ }, "once");
3961
+ let cancelled = false;
3962
+ const flight = {
3963
+ operationId: attempt.operationId,
3964
+ preparing: prepare !== void 0,
3965
+ cut: /* @__PURE__ */ __name(() => {
3966
+ cancelled = true;
3967
+ once({
3968
+ ...attempt,
3969
+ outcome: flight.preparing ? "failed" : "outcome_unknown",
3970
+ errorCode: flight.preparing ? "timeout" : "outcome_unknown"
3971
+ });
3972
+ }, "cut")
3973
+ };
3974
+ for (const scope of scopes3)
3975
+ scope.add(flight);
3976
+ try {
3977
+ if (prepare !== void 0)
3978
+ await prepare();
3979
+ if (cancelled)
3980
+ throw new CliError("timeout", "the command ended before sending; nothing was sent", { sent: false });
3981
+ flight.preparing = false;
3982
+ const done = await current.run(attempt.operationId, act);
3983
+ if (cancelled)
3984
+ throw new CliError("outcome_unknown", "the command ended with a write in flight; check its result before continuing", { operation_id: attempt.operationId });
3985
+ once({ ...attempt, ...settled2(done), outcome: "sent" });
3986
+ return done;
3987
+ } catch (error) {
3988
+ const code = codeOf(error);
3989
+ once({ ...attempt, outcome: code === "outcome_unknown" ? "outcome_unknown" : "failed", errorCode: code });
3990
+ if (code === "outcome_unknown" && error instanceof Error)
3991
+ throw new CliError("outcome_unknown", error.message, {
3992
+ ...error.details,
3993
+ operation_id: attempt.operationId,
3994
+ retryable: false
3995
+ });
3996
+ if (flight.preparing && isCliError(error) && error.details.sent === void 0)
3997
+ throw new CliError(error.code, error.message, { ...error.details, sent: false });
3998
+ throw error;
3999
+ } finally {
4000
+ for (const scope of scopes3)
4001
+ scope.delete(flight);
4002
+ }
4003
+ }, "guardedWrite");
4004
+ var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
4005
+
4006
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/result-fields.js
4007
+ var named = /* @__PURE__ */ __name((work) => {
4008
+ try {
4009
+ return work();
4010
+ } catch (error) {
4011
+ if (error instanceof CliError && error.code === "validation_error")
4012
+ throw new CliError("validation_error", "--json takes comma-separated field paths, for example --json=id,text", {
4013
+ param: "--json"
4014
+ });
4015
+ throw error;
4016
+ }
4017
+ }, "named");
4018
+ var fieldsOf2 = /* @__PURE__ */ __name((value) => named(() => fieldsOf(value)), "fieldsOf");
4019
+ var projectCommands = /* @__PURE__ */ __name((commands, fields) => commands.map((command) => ({
4020
+ ...projectFields(command, fields),
4021
+ path: command.path,
4022
+ name: command.name,
4023
+ origin: command.origin,
4024
+ effects: command.effects,
4025
+ commands: projectCommands(command.commands, fields)
4026
+ })), "projectCommands");
4027
+ var projectFields2 = /* @__PURE__ */ __name((value, fields) => named(() => {
4028
+ if (value && typeof value === "object" && "cli" in value && typeof value.cli === "string" && "contract" in value && "commands" in value && Array.isArray(value.commands))
4029
+ return { ...value, commands: projectCommands(value.commands, fields) };
4030
+ return projectFields(value, fields);
4031
+ }), "projectFields");
4032
+
4033
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/execution.js
3910
4034
  var DEFAULT_COMMAND_MS = 3e4;
3911
4035
  var DEFAULT_COOPERATIVE_MS = 5 * 6e4;
3912
4036
  var DEFAULT_AGENT_COOPERATIVE_MS = 45e3;
@@ -3923,7 +4047,7 @@ var execution = /* @__PURE__ */ __name((streams, { timeoutMs, fields, maxOutputB
3923
4047
  const closeables = /* @__PURE__ */ new Set();
3924
4048
  const closing = /* @__PURE__ */ new WeakMap();
3925
4049
  const originals = /* @__PURE__ */ new Map();
3926
- let paths = fields === void 0 ? void 0 : fieldsOf(fields);
4050
+ let paths = fields === void 0 ? void 0 : fieldsOf2(fields);
3927
4051
  let active = true;
3928
4052
  let bytes = 0;
3929
4053
  let timer;
@@ -3964,7 +4088,7 @@ var execution = /* @__PURE__ */ __name((streams, { timeoutMs, fields, maxOutputB
3964
4088
  start(timeoutMs);
3965
4089
  return {
3966
4090
  configure: /* @__PURE__ */ __name((options) => {
3967
- paths = options.fields === void 0 ? void 0 : fieldsOf(options.fields);
4091
+ paths = options.fields === void 0 ? void 0 : fieldsOf2(options.fields);
3968
4092
  maxOutputBytes = options.maxOutputBytes;
3969
4093
  }, "configure"),
3970
4094
  start,
@@ -3994,7 +4118,7 @@ var execution = /* @__PURE__ */ __name((streams, { timeoutMs, fields, maxOutputB
3994
4118
  let result = text2;
3995
4119
  if (paths) {
3996
4120
  try {
3997
- result = JSON.stringify(projectFields(JSON.parse(text2), paths));
4121
+ result = JSON.stringify(projectFields2(JSON.parse(text2), paths));
3998
4122
  } catch (error) {
3999
4123
  if (error instanceof CliError)
4000
4124
  throw error;
@@ -4004,8 +4128,8 @@ var execution = /* @__PURE__ */ __name((streams, { timeoutMs, fields, maxOutputB
4004
4128
  });
4005
4129
  }
4006
4130
  }
4007
- const size2 = Buffer.byteLength(result) + 1;
4008
- if (maxOutputBytes !== 0 && bytes + size2 > maxOutputBytes)
4131
+ const size = Buffer.byteLength(result) + 1;
4132
+ if (maxOutputBytes !== 0 && bytes + size > maxOutputBytes)
4009
4133
  throw new CliError("invalid_response", `machine output exceeds ${maxOutputBytes} bytes \u2014 reduce --limit, pick fields with --json=a,b or raise --max-output-bytes`, {
4010
4134
  retryable: false,
4011
4135
  reason: "output.too-large",
@@ -4013,7 +4137,7 @@ var execution = /* @__PURE__ */ __name((streams, { timeoutMs, fields, maxOutputB
4013
4137
  emitted_bytes: bytes,
4014
4138
  partial_output: bytes > 0
4015
4139
  });
4016
- bytes += size2;
4140
+ bytes += size;
4017
4141
  streams.data(result);
4018
4142
  }, "data"),
4019
4143
  diagnostic: /* @__PURE__ */ __name((text2) => {
@@ -4087,7 +4211,396 @@ var withAbort = /* @__PURE__ */ __name(async (signal, body) => {
4087
4211
  }
4088
4212
  }, "withAbort");
4089
4213
 
4090
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/messenger/accounts.js
4214
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/sends/permissions.js
4215
+ var LEVELS = ["deny", "readonly", "ask", "allow"];
4216
+ var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
4217
+ var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
4218
+ var DEFAULT_PERMISSIONS = {
4219
+ "messages.delete": "ask",
4220
+ "account.sessions.end": "ask",
4221
+ "bot.messages.delete": "ask",
4222
+ "topics.enable": "ask",
4223
+ "topics.delete": "ask",
4224
+ "chats.delete": "ask",
4225
+ "chats.clear": "ask",
4226
+ // NEED-568: a rule writes to people with nobody typing a command; it waits for the owner's own allow.
4227
+ "replies.send": "deny",
4228
+ // NEED-1662: an agent that changes settings, schedules or recipients could lift its own limits; the owner opts in.
4229
+ "mcp.authority": "deny",
4230
+ // NEED-1663: writes no level stopped before, so MCP could not offer them; over MCP `ask` goes ahead.
4231
+ "store.backup": "ask",
4232
+ "store.restore": "ask",
4233
+ "store.migrate": "ask",
4234
+ "store.repair": "ask",
4235
+ "store.reset": "ask",
4236
+ "store.clear": "ask",
4237
+ "store.decrypt": "ask",
4238
+ "store.copies.delete": "ask",
4239
+ "server.start": "ask",
4240
+ "server.stop": "ask",
4241
+ "server.restart": "ask",
4242
+ "models.download": "ask",
4243
+ "images.models.download": "ask",
4244
+ "schedule.run": "ask",
4245
+ "schedule.exec": "ask",
4246
+ "doctor.reports.create": "ask"
4247
+ };
4248
+ var KEYED_UNDER_HOUSEKEEPING = new Set(Object.keys(DEFAULT_PERMISSIONS).filter((key) => /^(store|server|models|images|schedule|doctor)\./.test(key)));
4249
+ var AUTHORITY_KEY = "mcp.authority";
4250
+ var authorityAllowed = /* @__PURE__ */ __name((levels) => {
4251
+ const { level } = levelFor(levels, AUTHORITY_KEY);
4252
+ return level === "allow" || level === "ask";
4253
+ }, "authorityAllowed");
4254
+ var BOT_API_KEY = "bot.api";
4255
+ var isBotApi = /* @__PURE__ */ __name((path2) => path2[0] === "bot" && path2[1] === "api", "isBotApi");
4256
+ var botApiAllowed = /* @__PURE__ */ __name((levels) => {
4257
+ const { level } = levelFor(levels, BOT_API_KEY, { ...DEFAULT_PERMISSIONS, [BOT_API_KEY]: "deny" });
4258
+ return level === "allow" || level === "ask";
4259
+ }, "botApiAllowed");
4260
+ var RESOURCES = [
4261
+ "messages",
4262
+ "drafts",
4263
+ "reactions",
4264
+ "polls",
4265
+ "topics",
4266
+ "chats",
4267
+ "contacts",
4268
+ "account",
4269
+ "bot",
4270
+ "conversations",
4271
+ "tags",
4272
+ "mentions",
4273
+ "search",
4274
+ "searches",
4275
+ "tasks",
4276
+ "replies",
4277
+ "attachments",
4278
+ "stats",
4279
+ "store",
4280
+ "metadata",
4281
+ "mcp",
4282
+ "server",
4283
+ "models",
4284
+ "schedule",
4285
+ "doctor",
4286
+ "images"
4287
+ ];
4288
+ var layerPermissions = /* @__PURE__ */ __name((layers) => {
4289
+ const levels = {};
4290
+ const sources = {};
4291
+ for (const [from, layer] of layers) {
4292
+ const nearer = Object.keys(levels);
4293
+ for (const [key, level] of Object.entries(layer ?? {})) {
4294
+ if (nearer.some((named2) => key === named2 || key.startsWith(`${named2}.`)))
4295
+ continue;
4296
+ levels[key] = level;
4297
+ sources[key] = from;
4298
+ }
4299
+ }
4300
+ return { levels, sources };
4301
+ }, "layerPermissions");
4302
+ var CEILING_KEY = "*";
4303
+ var ALLOWED = { level: "allow", key: null };
4304
+ var ORDER = { deny: 0, readonly: 1, ask: 2, allow: 3 };
4305
+ var nearest = /* @__PURE__ */ __name((levels, key) => {
4306
+ for (let parts = key.split("."); parts.length > 0; parts = parts.slice(0, -1)) {
4307
+ const named2 = parts.join(".");
4308
+ const level = levels[named2];
4309
+ if (level)
4310
+ return { level, key: named2, depth: parts.length };
4311
+ }
4312
+ return void 0;
4313
+ }, "nearest");
4314
+ var levelFor = /* @__PURE__ */ __name((permissions, key, defaults = DEFAULT_PERMISSIONS) => {
4315
+ const found = profileLevel(permissions, key, defaults);
4316
+ const ceiling = permissions[CEILING_KEY];
4317
+ return ceiling && ORDER[ceiling] < ORDER[found.level] ? { level: ceiling, key: CEILING_KEY } : found;
4318
+ }, "levelFor");
4319
+ var profileLevel = /* @__PURE__ */ __name((permissions, key, defaults) => {
4320
+ const own = nearest(permissions, key);
4321
+ const builtIn = nearest(defaults, key);
4322
+ if (!builtIn || own && own.depth >= builtIn.depth)
4323
+ return own ? { level: own.level, key: own.key } : ALLOWED;
4324
+ if (!own || ORDER[builtIn.level] <= ORDER[own.level])
4325
+ return { level: builtIn.level, key: builtIn.key };
4326
+ return { level: own.level, key: own.key };
4327
+ }, "profileLevel");
4328
+ var CHAT_KEYS = {
4329
+ settings: "chats.update",
4330
+ "requests.accept": "chats.requests.confirm",
4331
+ "requests.decline": "chats.requests.reject",
4332
+ "link.create": "chats.links.create",
4333
+ "link.reset": "chats.links.reset",
4334
+ "link.revoke": "chats.links.remove",
4335
+ "link.update": "chats.links.update"
4336
+ };
4337
+ var ACCOUNT_KEYS = {
4338
+ "contact-add": "contacts.add",
4339
+ "contact-remove": "contacts.remove",
4340
+ "contact-import": "contacts.import",
4341
+ "contact-rename": "contacts.rename",
4342
+ "contact-block": "contacts.block",
4343
+ "contact-unblock": "contacts.unblock",
4344
+ profile: "account.update",
4345
+ "folder-create": "chats.folders.create",
4346
+ "folder-update": "chats.folders.update",
4347
+ "folder-delete": "chats.folders.delete",
4348
+ "folder-order": "chats.folders.order",
4349
+ "folder-join": "chats.folders.join",
4350
+ "sessions-end": "account.sessions.end",
4351
+ "chat-mute": "chats.mute",
4352
+ "chat-unmute": "chats.unmute",
4353
+ "chat-archive": "chats.archive",
4354
+ "chat-unarchive": "chats.unarchive",
4355
+ "chat-pin": "chats.pin",
4356
+ "chat-unpin": "chats.unpin",
4357
+ "chat-mark-unread": "chats.mark-unread",
4358
+ "message-star": "messages.star",
4359
+ "message-unstar": "messages.unstar",
4360
+ privacy: "account.privacy.set"
4361
+ };
4362
+ var KIND_KEYS = {
4363
+ message: "messages.send",
4364
+ forward: "messages.forward",
4365
+ edit: "messages.edit",
4366
+ pin: "messages.pin",
4367
+ reaction: "reactions",
4368
+ read: "chats.mark-read",
4369
+ delete: "messages.delete"
4370
+ };
4371
+ var keyForWrite = /* @__PURE__ */ __name((kind, action) => {
4372
+ if (kind === "chat")
4373
+ return CHAT_KEYS[action] ?? `chats.${action ?? "update"}`;
4374
+ if (kind === "account") {
4375
+ const key = ACCOUNT_KEYS[action];
4376
+ if (!key)
4377
+ throw new Error(`an account change without a known action: ${action}`);
4378
+ return key;
4379
+ }
4380
+ return KIND_KEYS[kind];
4381
+ }, "keyForWrite");
4382
+ var writeOfKey = /* @__PURE__ */ __name((key) => {
4383
+ const account = Object.entries(ACCOUNT_KEYS).find(([, named2]) => named2 === key)?.[0];
4384
+ if (account)
4385
+ return { kind: "account", action: account };
4386
+ const kind = Object.entries(KIND_KEYS).find(([, named2]) => named2 === key || key.startsWith(`${named2}.`))?.[0];
4387
+ if (kind)
4388
+ return { kind };
4389
+ if (key === "messages.unpin")
4390
+ return { kind: "pin" };
4391
+ if (key.startsWith("chats.")) {
4392
+ const action = Object.entries(CHAT_KEYS).find(([, named2]) => named2 === key)?.[0] ?? key.slice("chats.".length);
4393
+ return { kind: "chat", action };
4394
+ }
4395
+ return {};
4396
+ }, "writeOfKey");
4397
+ var NAMED_WRITE_KEYS = [
4398
+ "drafts",
4399
+ "store.gaps.repair",
4400
+ "messages.sync-first",
4401
+ "messages.server-search",
4402
+ "messages.press",
4403
+ "chats.start",
4404
+ "chats.app",
4405
+ "stats.messages.counters.sync",
4406
+ "stats.messages.show.sync-first",
4407
+ "stats.messages.top.sync-first",
4408
+ "stats.contacts.top.sync-first",
4409
+ "account.sessions.list",
4410
+ "attachments.extract",
4411
+ "attachments.move",
4412
+ "attachments.update",
4413
+ "bot.callbacks.answer",
4414
+ "bot.chats.action",
4415
+ "bot.chats.admins.add",
4416
+ "bot.chats.admins.remove",
4417
+ "bot.chats.leave",
4418
+ "bot.chats.members.remove",
4419
+ "bot.chats.moderate",
4420
+ "bot.messages.delete",
4421
+ "bot.messages.edit",
4422
+ "bot.messages.pin",
4423
+ "bot.messages.send",
4424
+ "bot.messages.unpin",
4425
+ "chats.admins.add",
4426
+ "chats.admins.remove",
4427
+ "chats.links.create",
4428
+ "chats.links.reset",
4429
+ "chats.links.remove",
4430
+ "chats.links.update",
4431
+ "chats.members.add",
4432
+ "chats.members.remove",
4433
+ "chats.moderate",
4434
+ "conversations.embeddings",
4435
+ "conversations.links",
4436
+ "polls.close",
4437
+ "polls.create",
4438
+ "polls.vote",
4439
+ "searches.clear",
4440
+ "searches.create",
4441
+ "searches.delete",
4442
+ "contacts.aliases.set",
4443
+ "contacts.aliases.remove",
4444
+ "contacts.notes.add",
4445
+ "contacts.notes.edit",
4446
+ "contacts.notes.remove",
4447
+ "tags.rebuild",
4448
+ "metadata.sync",
4449
+ "mentions.rebuild",
4450
+ "mentions.confirm",
4451
+ "mentions.reject",
4452
+ "tags.add",
4453
+ "tags.remove",
4454
+ "tasks.add",
4455
+ "tasks.claim",
4456
+ "tasks.close",
4457
+ "tasks.duplicates.defer",
4458
+ "tasks.duplicates.reject",
4459
+ "tasks.link",
4460
+ "tasks.merge",
4461
+ "tasks.update",
4462
+ "tasks.release",
4463
+ "tasks.scan",
4464
+ "tasks.unmerge",
4465
+ "topics.create",
4466
+ "topics.edit",
4467
+ "topics.enable"
4468
+ ];
4469
+ var WRITE_KEYS = [
4470
+ .../* @__PURE__ */ new Set([
4471
+ ...NAMED_WRITE_KEYS,
4472
+ ...Object.keys(DEFAULT_PERMISSIONS),
4473
+ ...Object.values(KIND_KEYS),
4474
+ ...Object.values(ACCOUNT_KEYS),
4475
+ ...Object.values(CHAT_KEYS)
4476
+ ])
4477
+ ];
4478
+ var HOUSEKEEPING = /* @__PURE__ */ new Set([
4479
+ "help",
4480
+ "guide",
4481
+ "config",
4482
+ "session",
4483
+ "doctor",
4484
+ "commands",
4485
+ "complete",
4486
+ "upgrade",
4487
+ "skill",
4488
+ "models",
4489
+ "server",
4490
+ // What a schedule runs is checked by its own key when it runs; an agent runs read-only.
4491
+ "schedule",
4492
+ "runs",
4493
+ "sends",
4494
+ "recipients",
4495
+ "flood",
4496
+ "mcp",
4497
+ // Its commands read the rules or flip the pause switch; what a rule sends is checked as `replies.send`.
4498
+ "replies"
4499
+ ]);
4500
+ var BOT_HOUSEKEEPING = /* @__PURE__ */ new Set(["auth", "list", "sends", "recipients", "mcp"]);
4501
+ var STORE_MAINTENANCE = /* @__PURE__ */ new Set(["info", "check", "copies"]);
4502
+ var SHOW_MESSAGES = /* @__PURE__ */ new Set(["inbox", "review", "watch", "serve", "store", "conversations"]);
4503
+ var readKeysForCommand = /* @__PURE__ */ __name((path2) => {
4504
+ if (path2[0] === "bot")
4505
+ return readKeysForCommand(path2.slice(1)).map((key2) => `bot.${key2}`);
4506
+ const key = keyForCommand(path2);
4507
+ if (!key)
4508
+ return [];
4509
+ if (path2[0] === "attachments" && path2[1] === "download")
4510
+ return [key, "messages", "chats"];
4511
+ if (path2[0] === "attachments" && (path2[1] === "extract" || path2[1] === "show"))
4512
+ return [key, "messages"];
4513
+ if (path2[0] === "store" && path2[1] === "gaps" && path2[2] === "repair")
4514
+ return [key, "messages"];
4515
+ if (path2[0] === "store" && ["reset", "clear", "decrypt"].includes(path2[1] ?? ""))
4516
+ return [key, "messages"];
4517
+ if (path2[0] === "search") {
4518
+ if (path2[1] === "notes")
4519
+ return [key];
4520
+ if (path2[1] === "topics")
4521
+ return [key, "topics"];
4522
+ if (path2[1] === "conversations")
4523
+ return [key, "messages", "conversations"];
4524
+ return [key, "messages"];
4525
+ }
4526
+ if (path2[0] !== "stats")
4527
+ return [key];
4528
+ const resource = path2[1] === "charts" ? "chats" : path2[1];
4529
+ return [
4530
+ .../* @__PURE__ */ new Set([
4531
+ key,
4532
+ "messages",
4533
+ ...["chats", "contacts", "tasks"].includes(resource ?? "") ? [resource] : []
4534
+ ])
4535
+ ];
4536
+ }, "readKeysForCommand");
4537
+ var keyForCommand = /* @__PURE__ */ __name((path2) => {
4538
+ if (path2.length === 0)
4539
+ return null;
4540
+ const [top, next] = path2;
4541
+ if (top === "bot") {
4542
+ if (next === void 0 || BOT_HOUSEKEEPING.has(next))
4543
+ return null;
4544
+ const inner = keyForCommand(path2.slice(1));
4545
+ return `bot.${inner ?? path2.slice(1).join(".")}`;
4546
+ }
4547
+ if (KEYED_UNDER_HOUSEKEEPING.has(path2.join(".")))
4548
+ return path2.join(".");
4549
+ if (top === void 0 || HOUSEKEEPING.has(top) || top === "search" && next === "runs")
4550
+ return null;
4551
+ if (top === "images" && next === "models")
4552
+ return null;
4553
+ if (top === "attachments" && (next === "check" || next === "jobs"))
4554
+ return null;
4555
+ if (top === "attachments" && next === "download")
4556
+ return "messages";
4557
+ if (top === "store" && next !== void 0 && STORE_MAINTENANCE.has(next))
4558
+ return null;
4559
+ if (top === "conversations" && next === "links")
4560
+ return path2[2] === "rebuild" ? "conversations.links.rebuild" : "conversations.links";
4561
+ if (top === "conversations" && (next === "embeddings" || next === "embed") || top === "images" && next === "embed" || top === "conversations" && next === "rebuild")
4562
+ return "conversations.embeddings";
4563
+ if (top === "attachments" && next === "list" || top === "chats" && next === "documents")
4564
+ return "messages";
4565
+ if (top === "mentions")
4566
+ return next === "rebuild" || next === "confirm" || next === "reject" ? `mentions.${next}` : "messages";
4567
+ if (top === "store" && (next === "gaps" || next === "jobs"))
4568
+ return path2.join(".");
4569
+ if (SHOW_MESSAGES.has(top) || top === "contacts" && (next === "context" || next === "prepare" || next === "events"))
4570
+ return "messages";
4571
+ if (RESOURCES.includes(top))
4572
+ return path2.join(".");
4573
+ return void 0;
4574
+ }, "keyForCommand");
4575
+ var RESOURCE_KEY = new RegExp(`^(${RESOURCES.join("|")})(\\.[a-z][a-z-]*)*$`);
4576
+ var COMMAND_PATH_KEY = /^[a-z][a-z-]*(\.[a-zA-Z][a-zA-Z-]*)*$/;
4577
+ var permissionOverrides = /* @__PURE__ */ __name((entries = [], shape = RESOURCE_KEY) => {
4578
+ const levels = {};
4579
+ const example = shape === RESOURCE_KEY ? "messages.send=allow" : "api=readonly";
4580
+ for (const entry of entries) {
4581
+ const [key = "", level = "", extra] = entry.split("=");
4582
+ if (!shape.test(key) || !LEVELS.includes(level) || extra !== void 0)
4583
+ throw new CliError("validation_error", `--permission takes a command path and level, e.g. ${example} (deny, readonly, ask, allow)`);
4584
+ levels[key] = level;
4585
+ }
4586
+ return levels;
4587
+ }, "permissionOverrides");
4588
+ var assertOverridesTighten = /* @__PURE__ */ __name((overrides, profile, defaults = DEFAULT_PERMISSIONS) => {
4589
+ for (const [key, level] of Object.entries(overrides)) {
4590
+ const under = Object.keys(profile).filter((named2) => named2.startsWith(`${key}.`));
4591
+ const lifted = [key, ...under].find((named2) => ORDER[level] > ORDER[levelFor(profile, named2, defaults).level]);
4592
+ if (lifted !== void 0)
4593
+ throw new CliError("validation_error", `--permission ${key}=${level} would loosen ${lifted} from ${levelFor(profile, lifted, defaults).level}; it only tightens \u2014 change the profile's permissions to loosen it`, { key, lifted });
4594
+ }
4595
+ }, "assertOverridesTighten");
4596
+ var assertRetentionEvidenceRead = /* @__PURE__ */ __name((permissions) => {
4597
+ for (const permission of ["stats.chats.retention", "chats"]) {
4598
+ if (levelFor(permissions, permission).level === "deny")
4599
+ throw new CliError("permission_error", `profile denies ${permission}`, { permission });
4600
+ }
4601
+ }, "assertRetentionEvidenceRead");
4602
+
4603
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/messenger/accounts.js
4091
4604
  import { existsSync, readdirSync, readFileSync } from "node:fs";
4092
4605
  import { join } from "node:path";
4093
4606
  var accountFileFor = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "accounts", `${profile}.json`), "accountFileFor");
@@ -4109,249 +4622,85 @@ var profilesWithAccounts = /* @__PURE__ */ __name((app, env) => {
4109
4622
  }, "profilesWithAccounts");
4110
4623
  var profilesHere = /* @__PURE__ */ __name((app, configured, env) => [.../* @__PURE__ */ new Set([...configured, ...profilesWithAccounts(app, env)])].sort(), "profilesHere");
4111
4624
 
4112
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/errors/failures.js
4113
- var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
4114
- var isCommanderFailure = /* @__PURE__ */ __name((value) => {
4115
- const { code, exitCode } = value ?? {};
4116
- return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
4117
- }, "isCommanderFailure");
4118
- var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
4119
-
4120
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
4121
- import { homedir } from "node:os";
4122
-
4123
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/events.js
4124
- var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
4125
- var renderEvent = /* @__PURE__ */ __name((event) => {
4126
- if (event.event === "warning") {
4127
- const counts = Object.entries(event.counts ?? {}).map(([field, count3]) => `${count3} ${field}`);
4128
- return [`${MARK.warning} ${(event.operation ?? "").padEnd(16)} ${event.code}`, ...counts, event.detail].filter(Boolean).join(" ");
4129
- }
4130
- const parts = [];
4131
- if (event.event === "cache") {
4132
- parts.push(event.reason);
4133
- if (event.ageMs !== void 0)
4134
- parts.push(`cached ${age(event.ageMs)}`);
4135
- } else {
4136
- if (event.opcode !== void 0)
4137
- parts.push(`op ${event.opcode}`, `seq ${event.seq}`);
4138
- if (event.method !== void 0 || event.endpointTemplate !== void 0)
4139
- parts.push([event.method, event.endpointTemplate].filter(Boolean).join(" "));
4140
- if (event.status !== void 0)
4141
- parts.push(`${event.status}`);
4142
- }
4143
- if (event.ids)
4144
- for (const [name, value] of Object.entries(event.ids))
4145
- parts.push(`${name} ${value}`);
4146
- if (event.event !== "cache") {
4147
- if (event.durationMs !== void 0)
4148
- parts.push(`${event.durationMs}ms`);
4149
- if (event.bytes !== void 0)
4150
- parts.push(size(event.bytes));
4151
- }
4152
- if (event.counts)
4153
- for (const [field, count3] of Object.entries(event.counts))
4154
- parts.push(`${count3} ${field}`);
4155
- if (event.event !== "cache") {
4156
- if (event.errorCode)
4157
- parts.push(event.errorCode);
4158
- if (event.providerError)
4159
- parts.push(event.providerError);
4160
- }
4161
- return `${MARK[event.event]} ${event.operation.padEnd(16)} ${parts.join(" ")}`.trimEnd();
4162
- }, "renderEvent");
4163
- var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!" };
4164
- var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
4165
- var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
4166
-
4167
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/secrets.js
4168
- var SECRET_WORDS = /* @__PURE__ */ new Set([
4169
- "authorization",
4170
- "cookie",
4171
- "credential",
4172
- "credentials",
4173
- "passphrase",
4174
- "password",
4175
- "passwd",
4176
- "pwd",
4177
- "pass",
4178
- "passcode",
4179
- "pin",
4180
- "otp",
4181
- "2fa",
4182
- "secret",
4183
- "token",
4184
- "contrase\xF1a",
4185
- "contrasena",
4186
- "clave",
4187
- "\u043F\u0430\u0440\u043E\u043B\u044C",
4188
- "\u043F\u0438\u043D",
4189
- "\u043A\u043E\u0434",
4190
- ...["api", "auth", "service", "account", "db", "database", "priv", "private", "client"].map((word) => `${word}key`),
4191
- ...["db", "database", "key"].map((word) => `${word}pass`)
4192
- ]);
4193
- var secretNamed = /* @__PURE__ */ __name((name) => {
4194
- const words = name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).map((word) => word.toLowerCase());
4195
- return words.some((word, at) => SECRET_WORDS.has(word) || SECRET_WORDS.has(word + (words[at + 1] ?? "")));
4196
- }, "secretNamed");
4197
- var START = "(?<![A-Za-z0-9_-])";
4198
- var END = "(?![A-Za-z0-9_-])";
4199
- var KNOWN_TOKENS = new RegExp(`${[
4200
- "gh[pousr]_[A-Za-z0-9]{36,}",
4201
- "github_pat_[A-Za-z0-9_]{22,}",
4202
- "sk-[A-Za-z0-9_-]{20,}",
4203
- "xox[abprs]-[A-Za-z0-9-]{10,}",
4204
- "(?:AKIA|ASIA)[A-Z0-9]{16}",
4205
- "AIza[A-Za-z0-9_-]{35}",
4206
- "(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{10,}",
4207
- "npm_[A-Za-z0-9]{36}",
4208
- "eyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]*"
4209
- ].map((pattern) => `${START}${pattern}${END}`).join("|")}|(?<!\\d)\\d{8,10}:[A-Za-z0-9_-]{35}${END}`, "g");
4210
- var PRIVATE_KEY = /-----BEGIN[A-Z ]* PRIVATE KEY-----[\s\S]*?(?:-----END[A-Z ]* PRIVATE KEY-----|$)/g;
4211
- var SCHEME = /(?<![A-Za-z])(Bearer|Basic)(\s+)(?![A-Z]?[a-z]+(?![A-Za-z0-9]))[A-Za-z0-9._~+/=-]{8,}/g;
4212
- var NAMED_PAIR = /(?<![\p{L}\p{N}])([\p{L}\p{N}_.-]*(?:token|pass|pwd|pin|otp|2fa|secret|credential|cookie|authorization|key|contrase|clave|пароль|пин|код)[\p{L}\p{N}_.-]*)(["']?\s*(?:=>|[:=])\s*["']?|\s+(?![\p{L}]+(?![\p{L}\p{N}])))((?:Bearer\s+|Basic\s+)?)([^\s"'&,;]+)/giu;
4213
- var looksRandom = /* @__PURE__ */ __name((run) => {
4214
- if (run.length < 20)
4215
- return false;
4216
- const classes = [/[a-z]/, /[A-Z]/, /\d/, /[^A-Za-z0-9]/].filter((kind) => kind.test(run)).length;
4217
- if (classes < 3)
4218
- return false;
4219
- let switches = 0;
4220
- for (let at = 1; at < run.length; at++) {
4221
- const [before, after] = [run[at - 1], run[at]];
4222
- if (/[a-z]/.test(before) && /[A-Z]/.test(after) || /[A-Z]/.test(before) && /[a-z]/.test(after))
4223
- switches += 1;
4224
- }
4225
- if (switches / run.length < 0.15)
4226
- return false;
4227
- const pieces = run.match(/[A-Z]?[a-z]+|[A-Z]+(?![a-z])|\d+/g) ?? [];
4228
- if (pieces.join("").length / Math.max(pieces.length, 1) >= 2.75)
4229
- return false;
4230
- return entropy(run) >= 3.5;
4231
- }, "looksRandom");
4232
- var entropy = /* @__PURE__ */ __name((text2) => {
4233
- const counts = /* @__PURE__ */ new Map();
4234
- for (const char of text2)
4235
- counts.set(char, (counts.get(char) ?? 0) + 1);
4236
- let bits = 0;
4237
- for (const count3 of counts.values())
4238
- bits -= count3 / text2.length * Math.log2(count3 / text2.length);
4239
- return bits;
4240
- }, "entropy");
4241
- var withoutSecrets = /* @__PURE__ */ __name((text2, mark = "[redacted]") => text2.replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
4242
- // A URL or a path is somebody's address, not a key; a credential in one is caught by the rules above.
4243
- token.includes("://") || /^(?:\/|~\/|\.\.?\/)/.test(token) ? token : token.replace(RUN, (run) => looksRandom(run) ? mark : run.replace(HEX, (hex) => entropy(hex) >= 3 ? mark : hex))
4244
- )), "withoutSecrets");
4245
- var RUN = /(?<![A-Za-z0-9_+/-])[A-Za-z0-9_+/-]{20,}/g;
4246
- var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
4247
-
4248
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
4249
- var MESSAGE_AT_MOST = 500;
4250
- var CAUSES_AT_MOST = 5;
4251
- var FRAMES_AT_MOST = 15;
4252
- var errorDetailOf = /* @__PURE__ */ __name((error, response) => {
4253
- const details = isCliFailure(error) ? { ...error.details } : {};
4254
- const thrown = error instanceof Error ? error : void 0;
4255
- const code = isCliFailure(error) ? error.code : codeOf(error);
4256
- const reason = typeof details.reason === "string" ? details.reason : void 0;
4257
- const message = thrown ? redactText(thrown.message) : void 0;
4258
- const operation = stringOf(details.operation) ?? response?.operation;
4259
- const status = numberOf(details.status) ?? response?.status;
4260
- const method = stringOf(details.method) ?? response?.method;
4261
- const endpoint2 = stringOf(details.endpoint) ?? response?.endpointTemplate;
4262
- const key = providerErrorKey(details.provider_error) ?? providerErrorKey(response?.providerError);
4263
- const protocol = key !== void 0 && method === void 0 && endpoint2 === void 0;
4264
- const http = method !== void 0 || endpoint2 !== void 0 || status !== void 0 && !protocol ? {
4265
- ...method === void 0 ? {} : { method: method.toUpperCase().slice(0, 16) },
4266
- ...endpoint2 === void 0 ? {} : { endpoint_template: endpointTemplate(endpoint2) },
4267
- ...status === void 0 ? {} : { status }
4268
- } : void 0;
4269
- const causes = causesOf(thrown?.cause ?? details.cause);
4270
- const stack = framesOf(thrown);
4625
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/output-detail.js
4626
+ var RARELY_SET = ["editedAt", "replyTo", "forwardedFrom", "reactions"];
4627
+ var BRIEF = ["locator", "chatTitle", "timestamp", "senderName", "excerpt", "score"];
4628
+ var isHit = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && typeof value.locator === "string" && typeof value.text === "string", "isHit");
4629
+ var shaped = /* @__PURE__ */ __name((hit, detail) => {
4630
+ if (detail === "brief")
4631
+ return Object.fromEntries(BRIEF.flatMap((key) => hit[key] === void 0 || hit[key] === null ? [] : [[key, hit[key]]]));
4632
+ const { text: text2, providerMetadata, ...rest } = hit;
4633
+ for (const key of RARELY_SET)
4634
+ if (rest[key] === null)
4635
+ delete rest[key];
4636
+ const metadata = rest.email ? void 0 : providerMetadata;
4271
4637
  return {
4272
- class: classOf(error),
4273
- ...code === void 0 ? {} : { code },
4274
- ...reason === void 0 ? {} : { reason },
4275
- ...message ? { message } : {},
4276
- ...operation === void 0 ? {} : { operation },
4277
- ...http ? { http } : {},
4278
- ...key === void 0 ? {} : { provider: { key, ...protocol && status !== void 0 ? { code: status } : {} } },
4279
- ...causes.length > 0 ? { causes } : {},
4280
- ...stack.length > 0 ? { stack } : {}
4638
+ ...rest,
4639
+ ...typeof rest.excerpt === "string" ? {} : { text: text2 },
4640
+ ...metadata === void 0 ? {} : { providerMetadata: metadata }
4281
4641
  };
4282
- }, "errorDetailOf");
4283
- var stringOf = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" ? value.trim() : void 0, "stringOf");
4284
- var numberOf = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isInteger(value) ? value : void 0, "numberOf");
4285
- var classOf = /* @__PURE__ */ __name((error) => {
4286
- if (!(error instanceof Error))
4287
- return error === null ? "null" : typeof error;
4288
- const constructed = error.constructor?.name;
4289
- return constructed && constructed !== "Error" && constructed !== error.name ? constructed : error.name;
4290
- }, "classOf");
4291
- var codeOf = /* @__PURE__ */ __name((error) => {
4292
- const code = error?.code;
4293
- return typeof code === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(code) ? code : void 0;
4294
- }, "codeOf");
4295
- var causesOf = /* @__PURE__ */ __name((first2) => {
4296
- const causes = [];
4297
- const seen = /* @__PURE__ */ new Set();
4298
- for (let cause = first2; cause !== void 0 && cause !== null && causes.length < CAUSES_AT_MOST; ) {
4299
- if (seen.has(cause))
4300
- break;
4301
- seen.add(cause);
4302
- const message = cause instanceof Error ? redactText(cause.message) : void 0;
4303
- causes.push({ class: classOf(cause), ...message ? { message } : {} });
4304
- cause = cause instanceof Error ? cause.cause : void 0;
4305
- }
4306
- return causes;
4307
- }, "causesOf");
4308
- var framesOf = /* @__PURE__ */ __name((error, limit = FRAMES_AT_MOST) => {
4309
- const stack = error instanceof Error && typeof error.stack === "string" ? error.stack : "";
4310
- return stack.split("\n").filter((line) => line.trimStart().startsWith("at ")).flatMap((line) => {
4311
- const match = /^\s*at (?:async )?(?:(.+?) \()?(.+?):(\d+):\d+\)?$/.exec(line);
4312
- if (!match)
4313
- return [];
4314
- const [, fn, path2 = "", lineNumber] = match;
4315
- if (path2.startsWith("node:"))
4316
- return [];
4317
- return [`${fn ?? "<anonymous>"} ${fileOf(path2)}:${lineNumber}`];
4318
- }).slice(0, limit);
4319
- }, "framesOf");
4320
- var fileOf = /* @__PURE__ */ __name((path2) => {
4321
- const plain2 = path2.replace(/^file:\/\//, "");
4322
- const packaged = /\/node_modules\/((?:@[^/]+\/)?[^/]+\/.+)$/.exec(plain2)?.[1];
4323
- if (packaged)
4324
- return packaged.replace(/\/(?:dist|src)\//, "/");
4325
- return /(?:^|\/)(?:dist|src)\/(.+)$/.exec(plain2)?.[1] ?? plain2.split("/").at(-1) ?? "?";
4326
- }, "fileOf");
4327
- var endpointTemplate = /* @__PURE__ */ __name((raw) => {
4328
- const trimmed = raw.trim().split(/[?#]/)[0] ?? "";
4329
- const origin = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]*@)?([^/]*)/i.exec(trimmed);
4330
- const path2 = origin ? trimmed.slice(origin[0].length) : trimmed;
4331
- const scheme = origin ? `${trimmed.slice(0, trimmed.indexOf("://"))}://${origin[1]}` : "";
4332
- const segments = path2.split("/").map((segment) => {
4333
- if (segment === "" || /^[:{].+/.test(segment))
4334
- return segment;
4335
- if (/^bot\d+:/.test(segment) || /^\d{6,}:[\w-]{20,}$/.test(segment))
4336
- return ":token";
4337
- if (/^-?\d+$/.test(segment) || /^[0-9a-f-]{16,}$/i.test(segment))
4338
- return ":id";
4339
- if (!/^[A-Za-z0-9._~-]{1,40}$/.test(segment))
4340
- return ":value";
4341
- return segment;
4342
- });
4343
- return `${scheme}${segments.join("/")}`.slice(0, 300);
4344
- }, "endpointTemplate");
4345
- var INTERNATIONAL_PHONE = /\+\d[\d\s()-]{6,}\d/.source;
4346
- var BARE_PHONE = /(^|[^\w-])\d{11,15}\b/.source;
4347
- var redactText = /* @__PURE__ */ __name((text2) => {
4348
- const home = homedir();
4349
- let out = home && home !== "/" ? text2.split(home).join("~") : text2;
4350
- out = withoutSecrets(out.replace(/"[^"\n]*"|“[^”\n]*”|«[^»\n]*»/g, '"[redacted]"')).replace(/\b(bearer|basic|token|key|password|secret)(\s*[:=]\s*|\s+)[^\s'"]+/gi, "$1$2[redacted]").replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g, "[email]").replace(new RegExp(INTERNATIONAL_PHONE, "g"), "[number]").replace(new RegExp(BARE_PHONE, "g"), "$1[number]").replace(/\bbot\d+:[\w-]+/g, "bot[token]").replace(/\b\d{6,}:[\w-]{20,}\b/g, "[token]").replace(/(\?|&)[^\s#]*/g, "$1[redacted]").replace(/\b[A-Za-z0-9_-]{40,}\b/g, "[redacted]");
4351
- return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
4352
- }, "redactText");
4642
+ }, "shaped");
4643
+ var atDetail = /* @__PURE__ */ __name((value, detail = "default") => {
4644
+ if (detail === "full")
4645
+ return value;
4646
+ if (Array.isArray(value))
4647
+ return value.map((item) => isHit(item) ? shaped(item, detail) : item);
4648
+ if (isHit(value))
4649
+ return shaped(value, detail);
4650
+ if (typeof value === "object" && value !== null && Array.isArray(value.items))
4651
+ return { ...value, items: atDetail(value.items, detail) };
4652
+ return value;
4653
+ }, "atDetail");
4654
+
4655
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/output.js
4656
+ var resolveOutput = /* @__PURE__ */ __name(({ json, jsonl, quiet, streams = processStreams, tty, color, fields, hitDetail, env = process.env, capture } = {}) => {
4657
+ const interactive = tty ?? process.stdout.isTTY === true;
4658
+ const format = jsonl ? "jsonl" : json || !interactive ? "json" : "pretty";
4659
+ const painted = format === "pretty" && (color ?? (env.NO_COLOR === void 0 && env.TERM !== "dumb" && !env.CI));
4660
+ const printing = createRenderer({ format, color: painted, streams });
4661
+ const rendered = capture ? { ...printing, result: capture, stream: /* @__PURE__ */ __name((items) => capture([...items]), "stream") } : printing;
4662
+ const level = hitDetail ?? (fields === void 0 ? "default" : "full");
4663
+ const standard = format === "pretty" ? rendered : {
4664
+ ...rendered,
4665
+ result: /* @__PURE__ */ __name((value) => rendered.result(atDetail(value, level)), "result"),
4666
+ stream: /* @__PURE__ */ __name((items) => rendered.stream(atDetail([...items], level)), "stream")
4667
+ };
4668
+ const created = standard;
4669
+ const paths = fields === void 0 ? void 0 : fieldsOf2(fields);
4670
+ const renderer = format === "pretty" ? oneLineFields(created) : paths ? {
4671
+ ...created,
4672
+ result: /* @__PURE__ */ __name((value) => created.result(projectFields2(value, paths)), "result"),
4673
+ stream: /* @__PURE__ */ __name((items) => created.stream([...items].map((item) => projectFields2(item, paths))), "stream")
4674
+ } : created;
4675
+ return { format, color: painted, streams, renderer: quiet ? silence(renderer) : renderer };
4676
+ }, "resolveOutput");
4677
+ var MULTI_LINE = /* @__PURE__ */ new Set(["text", "description"]);
4678
+ var oneLineFields = /* @__PURE__ */ __name((renderer) => ({
4679
+ ...renderer,
4680
+ result: /* @__PURE__ */ __name((value) => renderer.result(oneLine(value)), "result"),
4681
+ stream: /* @__PURE__ */ __name((items) => renderer.stream([...items].map((item) => oneLine(item))), "stream")
4682
+ }), "oneLineFields");
4683
+ var oneLine = /* @__PURE__ */ __name((value, key) => {
4684
+ if (typeof value === "string")
4685
+ return key !== void 0 && MULTI_LINE.has(key) ? value : singleLine(value);
4686
+ if (Array.isArray(value))
4687
+ return value.map((item) => oneLine(item, key));
4688
+ if (value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype) {
4689
+ return Object.fromEntries(Object.entries(value).map(([field, item]) => [field, oneLine(item, field)]));
4690
+ }
4691
+ return value;
4692
+ }, "oneLine");
4693
+ var silence = /* @__PURE__ */ __name((renderer) => ({
4694
+ ...renderer,
4695
+ note: /* @__PURE__ */ __name(() => {
4696
+ }, "note"),
4697
+ success: /* @__PURE__ */ __name(() => {
4698
+ }, "success"),
4699
+ warn: /* @__PURE__ */ __name(() => {
4700
+ }, "warn")
4701
+ }), "silence");
4353
4702
 
4354
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/log-events.js
4703
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/log-events.js
4355
4704
  var CORE_LOG_EVENTS = defineLogEvents([
4356
4705
  { id: "provider.request", meaning: "a request went to the messenger", keys: ["operation"] },
4357
4706
  { id: "provider.response", meaning: "the messenger answered the request, or it failed", keys: ["operation"] },
@@ -4362,6 +4711,11 @@ var CORE_LOG_EVENTS = defineLogEvents([
4362
4711
  keys: ["operation", "reason"]
4363
4712
  },
4364
4713
  { id: "command.crashed", meaning: "a command failed on a bug; where, never what", keys: ["error_class", "frames"] },
4714
+ {
4715
+ id: "events.dropped",
4716
+ meaning: "the run reached its cap and counted the rest instead of writing them",
4717
+ keys: ["dropped", "counts"]
4718
+ },
4365
4719
  { id: "send.recorded", meaning: "a write the send guard saw, and how it ended", keys: ["outcome"] },
4366
4720
  { id: "job.start", meaning: "a background job started", keys: ["job"] },
4367
4721
  { id: "job.exit", meaning: "a background job ended", keys: ["job", "outcome"] },
@@ -4380,7 +4734,487 @@ var DIAGNOSTIC_LOG_EVENTS = {
4380
4734
  cache: "cache.answered"
4381
4735
  };
4382
4736
 
4383
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/recording.js
4737
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/log-keys.js
4738
+ var snake2 = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
4739
+ var camel = /* @__PURE__ */ __name((key) => key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase()), "camel");
4740
+ var renamed = /* @__PURE__ */ __name((record2, name) => Object.fromEntries(Object.entries(record2).map(([key, value]) => [name(key), value])), "renamed");
4741
+ var logAttributes = /* @__PURE__ */ __name((event) => renamed(event, snake2), "logAttributes");
4742
+ var fromLogAttributes = /* @__PURE__ */ __name((attributes) => renamed(attributes, camel), "fromLogAttributes");
4743
+ var snakeLogger = /* @__PURE__ */ __name((logger) => ({
4744
+ debug: /* @__PURE__ */ __name((event, message) => logger.debug(logAttributes(event), message), "debug"),
4745
+ info: /* @__PURE__ */ __name((event, message) => logger.info(logAttributes(event), message), "info"),
4746
+ warn: /* @__PURE__ */ __name((event, message) => logger.warn(logAttributes(event), message), "warn"),
4747
+ error: /* @__PURE__ */ __name((event, message) => logger.error(logAttributes(event), message), "error")
4748
+ }), "snakeLogger");
4749
+
4750
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/run.js
4751
+ import { randomUUID } from "node:crypto";
4752
+ import { appendFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "node:fs";
4753
+ import { userInfo } from "node:os";
4754
+ import { join as join2, sep } from "node:path";
4755
+
4756
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/log-attributes.js
4757
+ var diagnostic = {
4758
+ event: true,
4759
+ operation: true,
4760
+ opcode: true,
4761
+ seq: true,
4762
+ status: true,
4763
+ method: true,
4764
+ endpointTemplate: true,
4765
+ bytes: true,
4766
+ ids: true,
4767
+ counts: true,
4768
+ durationMs: true,
4769
+ outcome: true,
4770
+ errorCode: true,
4771
+ providerError: true,
4772
+ level: true,
4773
+ transport: true,
4774
+ attempt: true,
4775
+ waitMs: true,
4776
+ code: true,
4777
+ detail: true,
4778
+ reason: true,
4779
+ ageMs: true
4780
+ };
4781
+ var send = {
4782
+ profile: true,
4783
+ chatId: true,
4784
+ outcome: true,
4785
+ kind: true,
4786
+ action: true,
4787
+ people: true,
4788
+ messageId: true,
4789
+ key: true,
4790
+ count: true,
4791
+ forEveryone: true,
4792
+ sendId: true,
4793
+ operationId: true,
4794
+ parentOperationId: true,
4795
+ replyTo: true,
4796
+ threadId: true,
4797
+ sendAs: true,
4798
+ resultChatId: true,
4799
+ length: true,
4800
+ attachments: true,
4801
+ scheduledFor: true,
4802
+ notify: true,
4803
+ origin: true,
4804
+ reservation: true,
4805
+ errorCode: true
4806
+ };
4807
+ var background = [
4808
+ "job",
4809
+ "pid",
4810
+ "schedule",
4811
+ "exitCode",
4812
+ "tool",
4813
+ "tier",
4814
+ "actorType",
4815
+ "actorId",
4816
+ "agent",
4817
+ "targetType",
4818
+ "targetId"
4819
+ ];
4820
+ var crash = ["errorClass", "frames"];
4821
+ var dropped = ["dropped"];
4822
+ var LOG_ATTRIBUTES = [
4823
+ ...new Set([...Object.keys(diagnostic), ...Object.keys(send), ...background, ...crash, ...dropped].map((key) => Object.keys(logAttributes({ [key]: true }))[0]))
4824
+ ].sort();
4825
+
4826
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/run.js
4827
+ var KEEP_RUNS_FOR_DAYS = 30;
4828
+ var KEEP_SUCCESSFUL_RUNS_FOR_DAYS = 7;
4829
+ var RUNS_SIZE_LIMIT_MB = 200;
4830
+ var runsDirFor = /* @__PURE__ */ __name((app, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "runs"), "runsDirFor");
4831
+ var startRun = /* @__PURE__ */ __name((options) => {
4832
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
4833
+ const startedAt = options.startedAt ?? now();
4834
+ const id2 = options.runId ?? newRunId(startedAt, options.command);
4835
+ const dir = join2(options.runsDir, day(startedAt), id2);
4836
+ pruneRuns(options.runsDir, {
4837
+ keepDays: options.keepDays ?? KEEP_RUNS_FOR_DAYS,
4838
+ keepSuccessDays: options.keepSuccessDays ?? KEEP_SUCCESSFUL_RUNS_FOR_DAYS,
4839
+ maxBytes: options.maxBytes ?? RUNS_SIZE_LIMIT_MB * 1024 * 1024,
4840
+ now: startedAt
4841
+ });
4842
+ refuseRealStateInTests(dir);
4843
+ const metadata = {
4844
+ runId: id2,
4845
+ command: options.command,
4846
+ ...options.profile === void 0 ? {} : { profile: options.profile },
4847
+ startedAt: startedAt.toISOString(),
4848
+ status: "running",
4849
+ cliVersion: options.cliVersion,
4850
+ runtime: runtime(),
4851
+ platform: process.platform,
4852
+ arch: process.arch,
4853
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4854
+ ...options.context
4855
+ };
4856
+ let file;
4857
+ const opened = /* @__PURE__ */ __name(() => {
4858
+ if (file)
4859
+ return file;
4860
+ mkdirSync(dir, { recursive: true, mode: 448 });
4861
+ const events = join2(dir, "events.jsonl");
4862
+ writeFileSync(events, "", { flag: "a", mode: 384 });
4863
+ file = snakeLogger(createRecordLog({
4864
+ to: events,
4865
+ runId: id2,
4866
+ command: options.command,
4867
+ resource: { service: options.service, version: options.cliVersion },
4868
+ allow: LOG_ATTRIBUTES,
4869
+ ...options.traceId === void 0 ? {} : { traceId: options.traceId },
4870
+ ...options.onError === void 0 ? {} : { onError: options.onError }
4871
+ }));
4872
+ writeRunFile(dir, metadata);
4873
+ return file;
4874
+ }, "opened");
4875
+ if (!options.lazy)
4876
+ opened();
4877
+ let finished = false;
4878
+ const operations = /* @__PURE__ */ new Set();
4879
+ const codes = /* @__PURE__ */ new Set();
4880
+ const noted = /* @__PURE__ */ __name((level) => (event, message) => {
4881
+ const { operation, errorCode, error_code, code } = event;
4882
+ if (typeof operation === "string")
4883
+ operations.add(operation);
4884
+ for (const value of [errorCode, error_code, code])
4885
+ if (typeof value === "string")
4886
+ codes.add(value);
4887
+ if (finished)
4888
+ return;
4889
+ opened()[level](event, message);
4890
+ }, "noted");
4891
+ const logger = { debug: noted("debug"), info: noted("info"), warn: noted("warn"), error: noted("error") };
4892
+ return {
4893
+ id: id2,
4894
+ dir,
4895
+ logger,
4896
+ finish: /* @__PURE__ */ __name(async (status, extra = {}) => {
4897
+ if (finished)
4898
+ return;
4899
+ finished = true;
4900
+ const completedAt = now();
4901
+ const final = {
4902
+ ...metadata,
4903
+ ...extra,
4904
+ status,
4905
+ completedAt: completedAt.toISOString(),
4906
+ durationMs: completedAt.getTime() - startedAt.getTime(),
4907
+ operations: [...operations].sort(),
4908
+ codes: [...codes].sort()
4909
+ };
4910
+ if (file || status !== "success") {
4911
+ opened();
4912
+ writeRunFile(dir, final);
4913
+ return;
4914
+ }
4915
+ try {
4916
+ mkdirSync(join2(dir, ".."), { recursive: true, mode: 448 });
4917
+ appendIndex(join2(dir, ".."), runFileOf(final));
4918
+ } catch (error) {
4919
+ options.onError?.(error);
4920
+ }
4921
+ }, "finish")
4922
+ };
4923
+ }, "startRun");
4924
+ var refuseRealStateInTests = /* @__PURE__ */ __name((dir, env = process.env) => {
4925
+ if (env.VITEST === void 0)
4926
+ return;
4927
+ let home;
4928
+ try {
4929
+ home = userInfo().homedir;
4930
+ } catch {
4931
+ return;
4932
+ }
4933
+ if (dir.startsWith(join2(home, ".local", "share") + sep))
4934
+ throw new Error(`a test opened a run in the real data folder: ${dir}`);
4935
+ }, "refuseRealStateInTests");
4936
+ var runtime = /* @__PURE__ */ __name(() => {
4937
+ const bun = process.versions.bun;
4938
+ return bun ? `bun ${bun}` : `node ${process.versions.node}`;
4939
+ }, "runtime");
4940
+ var newRunId = /* @__PURE__ */ __name((startedAt, command) => {
4941
+ const stamp = startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
4942
+ const slug = command.replace(/[^a-z0-9]+/gi, "-").toLowerCase();
4943
+ return `${stamp}-${slug}-${randomUUID().slice(0, 6)}`;
4944
+ }, "newRunId");
4945
+ var INDEX = "index.jsonl";
4946
+ var appendIndex = /* @__PURE__ */ __name((dayDir, written) => {
4947
+ appendFileSync(join2(dayDir, INDEX), `${JSON.stringify(written)}
4948
+ `, { mode: 384 });
4949
+ }, "appendIndex");
4950
+ var writeRunFile = /* @__PURE__ */ __name((dir, metadata) => {
4951
+ const written = runFileOf(metadata);
4952
+ writeSecurely(join2(dir, "run.json"), `${JSON.stringify(written, null, 2)}
4953
+ `, 384);
4954
+ try {
4955
+ appendIndex(join2(dir, ".."), written);
4956
+ } catch {
4957
+ }
4958
+ }, "writeRunFile");
4959
+ var matchesListFilter = /* @__PURE__ */ __name((run, filter) => (filter.runId === void 0 || run.runId === filter.runId) && (filter.command === void 0 || run.command === filter.command) && (filter.profile === void 0 || run.profile === filter.profile) && (filter.status === void 0 || run.status === filter.status) && (filter.errorCode === void 0 || run.errorCode === filter.errorCode), "matchesListFilter");
4960
+ var listRuns = /* @__PURE__ */ __name((runsDir, { since, atLeast = Number.POSITIVE_INFINITY, filter = {} } = {}) => {
4961
+ const first2 = since === void 0 ? void 0 : day(new Date(since));
4962
+ const runs = [];
4963
+ for (const date of days(runsDir).sort().reverse()) {
4964
+ if (first2 !== void 0 && date < first2 || runs.length >= atLeast)
4965
+ break;
4966
+ for (const metadata of runsOfDay(join2(runsDir, date))) {
4967
+ if (matchesListFilter(metadata, filter))
4968
+ runs.push(metadata);
4969
+ }
4970
+ }
4971
+ return runs;
4972
+ }, "listRuns");
4973
+ var indexedRuns = /* @__PURE__ */ __name((dayDir) => {
4974
+ const latest = /* @__PURE__ */ new Map();
4975
+ let raw = "";
4976
+ try {
4977
+ raw = readFileSync2(join2(dayDir, INDEX), "utf8");
4978
+ } catch {
4979
+ }
4980
+ for (const line of raw.split("\n")) {
4981
+ if (line.trim() === "")
4982
+ continue;
4983
+ try {
4984
+ const metadata = metadataOf(JSON.parse(line));
4985
+ if (typeof metadata.runId === "string")
4986
+ latest.set(metadata.runId, metadata);
4987
+ } catch {
4988
+ }
4989
+ }
4990
+ return latest;
4991
+ }, "indexedRuns");
4992
+ var runsOfDay = /* @__PURE__ */ __name((dayDir) => {
4993
+ const latest = indexedRuns(dayDir);
4994
+ for (const entry of safeReaddir(dayDir)) {
4995
+ if (entry === INDEX || entry.startsWith(".") || latest.has(entry))
4996
+ continue;
4997
+ const metadata = readRun(join2(dayDir, entry));
4998
+ if (metadata)
4999
+ latest.set(metadata.runId, metadata);
5000
+ }
5001
+ return [...latest.values()].sort((a, b) => a.runId < b.runId ? 1 : a.runId > b.runId ? -1 : 0);
5002
+ }, "runsOfDay");
5003
+ var findRun = /* @__PURE__ */ __name((runsDir, id2) => {
5004
+ const stamped = /^(\d{4})(\d{2})(\d{2})T/.exec(id2);
5005
+ const likely = stamped ? [`${stamped[1]}-${stamped[2]}-${stamped[3]}`] : [];
5006
+ const dates = [.../* @__PURE__ */ new Set([...likely, ...days(runsDir)])];
5007
+ for (const date of dates) {
5008
+ const dir = join2(runsDir, date, id2);
5009
+ const metadata = readRun(dir);
5010
+ if (metadata)
5011
+ return { dir, metadata };
5012
+ }
5013
+ for (const date of dates) {
5014
+ const metadata = indexedRuns(join2(runsDir, date)).get(id2);
5015
+ if (metadata)
5016
+ return { dir: join2(runsDir, date, id2), metadata };
5017
+ }
5018
+ return void 0;
5019
+ }, "findRun");
5020
+ var readEvents = /* @__PURE__ */ __name((dir) => {
5021
+ let raw;
5022
+ try {
5023
+ raw = readFileSync2(join2(dir, "events.jsonl"), "utf8");
5024
+ } catch {
5025
+ return [];
5026
+ }
5027
+ const events = [];
5028
+ for (const line of raw.split("\n")) {
5029
+ if (line.trim() === "")
5030
+ continue;
5031
+ try {
5032
+ const parsed = JSON.parse(line);
5033
+ if (parsed !== null && typeof parsed === "object")
5034
+ events.push(eventOf(parsed));
5035
+ } catch {
5036
+ }
5037
+ }
5038
+ return events;
5039
+ }, "readEvents");
5040
+ var eventOf = /* @__PURE__ */ __name((line) => {
5041
+ const { attributes, time: time2, severity } = line;
5042
+ if (attributes === null || typeof attributes !== "object")
5043
+ return logAttributes(line);
5044
+ return { time: time2, severity, ...logAttributes(attributes) };
5045
+ }, "eventOf");
5046
+ var pruneRuns = /* @__PURE__ */ __name((runsDir, { keepDays, keepSuccessDays = keepDays, maxBytes, now }) => {
5047
+ const cutoff = day(new Date(now.getTime() - keepDays * DAY_MS));
5048
+ const successCutoff = day(new Date(now.getTime() - Math.min(keepSuccessDays, keepDays) * DAY_MS));
5049
+ let removed = 0;
5050
+ for (const date of days(runsDir)) {
5051
+ if (date >= cutoff) {
5052
+ if (date < successCutoff)
5053
+ dropSuccesses(join2(runsDir, date));
5054
+ continue;
5055
+ }
5056
+ try {
5057
+ rmSync(join2(runsDir, date), { recursive: true, force: true });
5058
+ removed += 1;
5059
+ } catch {
5060
+ }
5061
+ }
5062
+ if (maxBytes !== void 0)
5063
+ removed += fitSize(runsDir, maxBytes, now);
5064
+ return removed;
5065
+ }, "pruneRuns");
5066
+ var DAY_MS = 24 * 60 * 60 * 1e3;
5067
+ var SUCCESSES_DROPPED = ".successes-dropped";
5068
+ var SIZE_CHECKED = ".size-checked";
5069
+ var dropSuccesses = /* @__PURE__ */ __name((dayDir) => {
5070
+ const marker = join2(dayDir, SUCCESSES_DROPPED);
5071
+ try {
5072
+ statSync(marker);
5073
+ return;
5074
+ } catch {
5075
+ }
5076
+ try {
5077
+ const kept = [];
5078
+ for (const [id2, metadata] of indexedRuns(dayDir)) {
5079
+ if (metadata.status === "success")
5080
+ rmSync(join2(dayDir, id2), { recursive: true, force: true });
5081
+ else
5082
+ kept.push(JSON.stringify(runFileOf(metadata)));
5083
+ }
5084
+ for (const entry of safeReaddir(dayDir)) {
5085
+ if (entry === INDEX || entry.startsWith("."))
5086
+ continue;
5087
+ if (readRun(join2(dayDir, entry))?.status === "success")
5088
+ rmSync(join2(dayDir, entry), { recursive: true, force: true });
5089
+ }
5090
+ writeSecurely(join2(dayDir, INDEX), kept.map((line) => `${line}
5091
+ `).join(""), 384);
5092
+ writeFileSync(marker, "", { mode: 384 });
5093
+ } catch {
5094
+ }
5095
+ }, "dropSuccesses");
5096
+ var sizeOf = /* @__PURE__ */ __name((path2) => {
5097
+ let total = 0;
5098
+ for (const entry of safeReaddir(path2)) {
5099
+ const full = join2(path2, entry);
5100
+ try {
5101
+ const stat = statSync(full);
5102
+ total += stat.isDirectory() ? sizeOf(full) : stat.size;
5103
+ } catch {
5104
+ }
5105
+ }
5106
+ return total;
5107
+ }, "sizeOf");
5108
+ var fitSize = /* @__PURE__ */ __name((runsDir, maxBytes, now) => {
5109
+ const stamp = join2(runsDir, SIZE_CHECKED);
5110
+ const today = day(now);
5111
+ try {
5112
+ if (readFileSync2(stamp, "utf8").trim() === today)
5113
+ return 0;
5114
+ } catch {
5115
+ }
5116
+ const dates = days(runsDir).sort();
5117
+ const sizes = new Map(dates.map((date) => [date, sizeOf(join2(runsDir, date))]));
5118
+ let total = [...sizes.values()].reduce((sum, size) => sum + size, 0);
5119
+ let removed = 0;
5120
+ for (const date of dates) {
5121
+ if (total <= maxBytes || date === today)
5122
+ break;
5123
+ dropSuccesses(join2(runsDir, date));
5124
+ const after = sizeOf(join2(runsDir, date));
5125
+ total -= (sizes.get(date) ?? 0) - after;
5126
+ sizes.set(date, after);
5127
+ }
5128
+ for (const date of dates) {
5129
+ if (total <= maxBytes || date === today)
5130
+ break;
5131
+ try {
5132
+ rmSync(join2(runsDir, date), { recursive: true, force: true });
5133
+ total -= sizes.get(date) ?? 0;
5134
+ removed += 1;
5135
+ } catch {
5136
+ }
5137
+ }
5138
+ try {
5139
+ mkdirSync(runsDir, { recursive: true, mode: 448 });
5140
+ writeFileSync(stamp, today, { mode: 384 });
5141
+ } catch {
5142
+ }
5143
+ return removed;
5144
+ }, "fitSize");
5145
+ var day = /* @__PURE__ */ __name((date) => date.toISOString().slice(0, 10), "day");
5146
+ var days = /* @__PURE__ */ __name((runsDir) => safeReaddir(runsDir).filter((entry) => /^\d{4}-\d{2}-\d{2}$/.test(entry)), "days");
5147
+ var readRun = /* @__PURE__ */ __name((dir) => {
5148
+ try {
5149
+ return metadataOf(JSON.parse(readFileSync2(join2(dir, "run.json"), "utf8")));
5150
+ } catch {
5151
+ return void 0;
5152
+ }
5153
+ }, "readRun");
5154
+ var safeReaddir = /* @__PURE__ */ __name((dir) => {
5155
+ try {
5156
+ return readdirSync2(dir);
5157
+ } catch {
5158
+ return [];
5159
+ }
5160
+ }, "safeReaddir");
5161
+ var runFileOf = /* @__PURE__ */ __name(({ partial, ...metadata }) => ({
5162
+ ...logAttributes(metadata),
5163
+ ...partial ? { partial: { ...logAttributes(partial), failures: partial.failures.map((failure) => logAttributes(failure)) } } : {}
5164
+ }), "runFileOf");
5165
+ var metadataOf = /* @__PURE__ */ __name((parsed) => {
5166
+ const { partial, ...metadata } = fromLogAttributes(parsed);
5167
+ if (partial === null || typeof partial !== "object")
5168
+ return metadata;
5169
+ const { failures, ...rest } = fromLogAttributes(partial);
5170
+ return {
5171
+ ...metadata,
5172
+ partial: {
5173
+ ...rest,
5174
+ failures: Array.isArray(failures) ? failures.map((failure) => fromLogAttributes(failure)) : []
5175
+ }
5176
+ };
5177
+ }, "metadataOf");
5178
+
5179
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/scope.js
5180
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
5181
+ import { randomBytes } from "node:crypto";
5182
+ var scopes = new AsyncLocalStorage2();
5183
+ var processScope;
5184
+ var currentRun = /* @__PURE__ */ __name(() => {
5185
+ const scope = scopes.getStore();
5186
+ if (scope)
5187
+ return scope;
5188
+ processScope ??= {
5189
+ runId: newRunId(/* @__PURE__ */ new Date(), "process"),
5190
+ command: "",
5191
+ startedAt: Date.now(),
5192
+ ...traceOf(process.env)
5193
+ };
5194
+ return processScope;
5195
+ }, "currentRun");
5196
+ var inRun = /* @__PURE__ */ __name((scope, body) => scopes.run(scope, body), "inRun");
5197
+ var runEvent = /* @__PURE__ */ __name((event) => scopes.getStore()?.events?.(event), "runEvent");
5198
+ var typedCommand = /* @__PURE__ */ __name((tool, words, profile = currentRun().profile) => [tool, profile, words].filter((part) => part !== void 0 && part !== "").join(" "), "typedCommand");
5199
+ var useAsProcessRun = /* @__PURE__ */ __name((scope) => {
5200
+ processScope = scope;
5201
+ }, "useAsProcessRun");
5202
+ var processRun = /* @__PURE__ */ __name(() => processScope, "processRun");
5203
+ var enclosingTraceId = /* @__PURE__ */ __name(() => scopes.getStore()?.traceId, "enclosingTraceId");
5204
+ var traceOf = /* @__PURE__ */ __name((env) => {
5205
+ const traceId = traceIdOf(env.TRACEPARENT);
5206
+ return traceId === void 0 ? {} : { traceId };
5207
+ }, "traceOf");
5208
+ var childTrace = /* @__PURE__ */ __name(() => {
5209
+ const hex = /* @__PURE__ */ __name((bytes) => randomBytes(bytes).toString("hex"), "hex");
5210
+ const traceId = hex(16);
5211
+ return { traceId, traceparent: `00-${traceId}-${hex(8)}-01` };
5212
+ }, "childTrace");
5213
+ var attempts = new AsyncLocalStorage2();
5214
+ var withAttempt = /* @__PURE__ */ __name((attempt, work) => attempts.run(attempt, work), "withAttempt");
5215
+ var currentAttempt = /* @__PURE__ */ __name(() => attempts.getStore(), "currentAttempt");
5216
+
5217
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/recording.js
4384
5218
  var recorded = /* @__PURE__ */ __name(async (options, body) => {
4385
5219
  const recording = startRecording(options);
4386
5220
  try {
@@ -4389,7 +5223,8 @@ var recorded = /* @__PURE__ */ __name(async (options, body) => {
4389
5223
  command: options.command,
4390
5224
  startedAt: Date.now(),
4391
5225
  ...options.profile === void 0 ? {} : { profile: options.profile },
4392
- ...recording.traceId ? { traceId: recording.traceId } : {}
5226
+ ...recording.traceId ? { traceId: recording.traceId } : {},
5227
+ events: recording.events
4393
5228
  };
4394
5229
  if (options.processRun)
4395
5230
  useAsProcessRun(scope);
@@ -4407,6 +5242,7 @@ var startRecording = /* @__PURE__ */ __name((options) => {
4407
5242
  const startedAt = now();
4408
5243
  const runId = newRunId(startedAt, options.command);
4409
5244
  const traceId = options.traceId ?? enclosingTraceId() ?? traceOf(options.env ?? process.env).traceId;
5245
+ const { argvIfFailed, ...context } = options.context ?? {};
4410
5246
  const open = /* @__PURE__ */ __name((extra = {}) => startRun({
4411
5247
  runsDir: options.runsDir ?? runsDirFor(options.app, options.env),
4412
5248
  runId,
@@ -4415,7 +5251,7 @@ var startRecording = /* @__PURE__ */ __name((options) => {
4415
5251
  service: options.app.command,
4416
5252
  cliVersion: options.app.version,
4417
5253
  ...traceId === void 0 ? {} : { traceId },
4418
- ...options.context ? { context: options.context } : {},
5254
+ ...options.context ? { context } : {},
4419
5255
  // The operation has happened or is under way, and failing the command now invites a retry
4420
5256
  // that sends twice.
4421
5257
  onError: /* @__PURE__ */ __name((error) => {
@@ -4423,46 +5259,64 @@ var startRecording = /* @__PURE__ */ __name((options) => {
4423
5259
  streams.diagnostic(options.format === "pretty" ? warning : JSON.stringify({ warning }));
4424
5260
  }, "onError"),
4425
5261
  ...options.keepDays === void 0 ? {} : { keepDays: options.keepDays },
5262
+ ...options.keepSuccessDays === void 0 ? {} : { keepSuccessDays: options.keepSuccessDays },
5263
+ ...options.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes },
4426
5264
  now,
4427
5265
  ...extra
4428
5266
  }), "open");
4429
- const run = options.record ? open({ startedAt }) : void 0;
5267
+ const run = options.record ? open({ startedAt, lazy: true }) : void 0;
4430
5268
  const held = !run && options.keepFailed ? [] : void 0;
4431
- let requests = 0;
5269
+ const counted = { wire: 0, operation: 0 };
4432
5270
  let refused;
5271
+ const cap = capped();
5272
+ const requests = /* @__PURE__ */ __name(() => counted.wire > 0 ? counted.wire : counted.operation, "requests");
4433
5273
  const events = /* @__PURE__ */ __name((event) => {
4434
5274
  if (event.event === "request")
4435
- requests += 1;
5275
+ counted[event.level === "wire" ? "wire" : "operation"] += 1;
4436
5276
  if (event.event === "response" && event.outcome === "error")
4437
5277
  refused = event;
4438
5278
  if (options.trace)
4439
5279
  streams.diagnostic(options.format === "pretty" ? renderEvent(event) : JSON.stringify(logAttributes(event)));
4440
5280
  if (run)
4441
- logEvent(run, event);
5281
+ cap.log(run, event);
4442
5282
  if (held) {
4443
5283
  held.push(event);
4444
5284
  if (held.length > HELD_AT_MOST)
4445
5285
  held.shift();
4446
5286
  }
4447
5287
  }, "events");
5288
+ const keep = /* @__PURE__ */ __name((kept) => {
5289
+ for (const event of held ?? [])
5290
+ cap.log(kept, event);
5291
+ return kept;
5292
+ }, "keep");
4448
5293
  return {
4449
5294
  runId,
4450
5295
  ...traceId === void 0 ? {} : { traceId },
4451
5296
  events,
4452
5297
  succeed: /* @__PURE__ */ __name(async (answer) => {
4453
5298
  const partial = partialOutcome(answer);
4454
- const kept = run ?? (partial && held ? keep(open({ startedAt }), held) : void 0);
4455
- await kept?.finish(partial ? "partial" : "success", { requests, ...partial ? { partial } : {} });
5299
+ const kept = run ?? (partial && held ? keep(open({ startedAt })) : void 0);
5300
+ if (kept)
5301
+ cap.close(kept);
5302
+ await kept?.finish(partial ? "partial" : "success", {
5303
+ requests: requests(),
5304
+ ...cap.dropped(),
5305
+ ...partial ? { partial } : {}
5306
+ });
4456
5307
  }, "succeed"),
4457
5308
  fail: /* @__PURE__ */ __name(async (error) => {
4458
- const failed = run ?? (held ? keep(open({ startedAt }), held) : void 0);
5309
+ const failed = run ?? (held ? keep(open({ startedAt })) : void 0);
4459
5310
  if (failed) {
4460
5311
  if (!isCliFailure(error))
4461
5312
  failed.logger.error(crashOf(error));
5313
+ cap.close(failed);
4462
5314
  await failed.finish("failed", {
4463
- requests,
5315
+ requests: requests(),
5316
+ ...cap.dropped(),
4464
5317
  ...outcomeOf(error),
4465
5318
  error: errorDetailOf(error, refused),
5319
+ ...argvIfFailed ? { argv: argvIfFailed } : {},
4466
5320
  ...run ? {} : { keptBecauseFailed: true }
4467
5321
  });
4468
5322
  }
@@ -4474,11 +5328,33 @@ var startRecording = /* @__PURE__ */ __name((options) => {
4474
5328
  var settled = /* @__PURE__ */ new WeakSet();
4475
5329
  var wasSettled = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && settled.has(error), "wasSettled");
4476
5330
  var HELD_AT_MOST = 500;
4477
- var keep = /* @__PURE__ */ __name((run, events) => {
4478
- for (const event of events)
4479
- logEvent(run, event);
4480
- return run;
4481
- }, "keep");
5331
+ var EVENTS_AT_MOST = 2e3;
5332
+ var EVENT_BYTES_AT_MOST = 1024 * 1024;
5333
+ var capped = /* @__PURE__ */ __name(() => {
5334
+ let lines = 0;
5335
+ let bytes = 0;
5336
+ let dropped2 = 0;
5337
+ const byOperation = {};
5338
+ return {
5339
+ log: /* @__PURE__ */ __name((run, event) => {
5340
+ const size = JSON.stringify(logAttributes(event)).length + 200;
5341
+ if (lines >= EVENTS_AT_MOST || bytes + size > EVENT_BYTES_AT_MOST) {
5342
+ dropped2 += 1;
5343
+ const operation = "operation" in event && event.operation ? event.operation : event.event;
5344
+ byOperation[operation] = (byOperation[operation] ?? 0) + 1;
5345
+ return;
5346
+ }
5347
+ lines += 1;
5348
+ bytes += size;
5349
+ logEvent(run, event);
5350
+ }, "log"),
5351
+ close: /* @__PURE__ */ __name((run) => {
5352
+ if (dropped2 > 0)
5353
+ run.logger.warn({ event: "events.dropped", dropped: dropped2, counts: byOperation });
5354
+ }, "close"),
5355
+ dropped: /* @__PURE__ */ __name(() => dropped2 > 0 ? { eventsDropped: dropped2 } : {}, "dropped")
5356
+ };
5357
+ }, "capped");
4482
5358
  var logEvent = /* @__PURE__ */ __name((run, event) => {
4483
5359
  const record2 = {
4484
5360
  ...event,
@@ -4523,151 +5399,7 @@ var partialOutcome = /* @__PURE__ */ __name((answer) => {
4523
5399
  return void 0;
4524
5400
  }, "partialOutcome");
4525
5401
 
4526
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/run-context.js
4527
- var REDACTED = "[redacted]";
4528
- var agentOf = /* @__PURE__ */ __name((env) => {
4529
- const named = env.AI_AGENT?.trim().split("_")[0];
4530
- const kind = (named && plainWord(named) ? named.toLowerCase() : void 0) ?? (env.CLAUDECODE ? "claude-code" : void 0) ?? (env.CODEX_THREAD_ID || env.CODEX_SESSION_ID || env.CODEX_SANDBOX ? "codex" : void 0) ?? (env.GEMINI_CLI ? "gemini-cli" : void 0) ?? (env.OPENCODE ? "opencode" : void 0) ?? (env.CURSOR_AGENT ? "cursor" : void 0) ?? // Only `exec` is the agent's own command: OpenClaw also sets `tui-local` for what the owner types in its TUI.
4531
- (env.OPENCLAW_SHELL?.trim() === "exec" ? "openclaw" : void 0);
4532
- if (!kind)
4533
- return void 0;
4534
- const session = sessionOf(kind, env);
4535
- return {
4536
- kind,
4537
- session_id: session && SESSION.test(session) ? session : null,
4538
- // OpenClaw passes the sender and chat ids of a chat-started run in this variable; only its presence is kept.
4539
- ...kind === "openclaw" && env.OPENCLAW_CHANNEL_CONTEXT?.trim() ? { from_chat: true } : {}
4540
- };
4541
- }, "agentOf");
4542
- var SESSION = /^[A-Za-z0-9._:-]{1,128}$/;
4543
- var SESSION_VARIABLE = {
4544
- "claude-code": "CLAUDE_CODE_SESSION_ID",
4545
- codex: "CODEX_THREAD_ID",
4546
- opencode: "OPENCODE_SESSION_ID",
4547
- "hermes-agent": "HERMES_SESSION_ID"
4548
- };
4549
- var sessionOf = /* @__PURE__ */ __name((kind, env) => {
4550
- const variable = SESSION_VARIABLE[kind];
4551
- return (variable === void 0 ? void 0 : env[variable]?.trim()) || void 0;
4552
- }, "sessionOf");
4553
- var plainWord = /* @__PURE__ */ __name((word) => /^[A-Za-z][A-Za-z0-9.-]{0,39}$/.test(word), "plainWord");
4554
- var secretInputs = /* @__PURE__ */ new WeakSet();
4555
- var secretInput = /* @__PURE__ */ __name((input) => {
4556
- secretInputs.add(input);
4557
- return input;
4558
- }, "secretInput");
4559
- var secretShaped = /* @__PURE__ */ __name((word) => /:\/\/[^/@\s:]+:[^/@\s]+@/.test(word) || /(^|[^A-Za-z0-9_-])[A-Za-z0-9_-]{40,}($|[^A-Za-z0-9_-])/.test(word), "secretShaped");
4560
- var withoutPhones = /* @__PURE__ */ __name((word) => word.replace(new RegExp(INTERNATIONAL_PHONE, "g"), REDACTED).replace(new RegExp(BARE_PHONE, "g"), `$1${REDACTED}`), "withoutPhones");
4561
- var maskArgv = /* @__PURE__ */ __name((program2, words, { keep: keep2 = false } = {}) => {
4562
- const argv = [];
4563
- let unknownCommand;
4564
- let current = program2;
4565
- let positional = 0;
4566
- let profileSeen = false;
4567
- let lost = false;
4568
- const raw = /* @__PURE__ */ __name((word) => keep2 && !secretShaped(word) ? withoutPhones(withoutSecrets(word, REDACTED)) : REDACTED, "raw");
4569
- const keptValue = /* @__PURE__ */ __name((name, value, input) => keep2 ? input && secretInputs.has(input) || secretNamed(name) ? REDACTED : raw(value) : maskedValue(name, value, input?.argChoices), "keptValue");
4570
- const optionFor = /* @__PURE__ */ __name((flag2) => {
4571
- for (let at = current; at; at = at.parent) {
4572
- const found = at.options.find((option) => option.long === flag2 || option.short === flag2);
4573
- if (found)
4574
- return found;
4575
- }
4576
- return void 0;
4577
- }, "optionFor");
4578
- for (let at = 0; at < words.length; at++) {
4579
- const word = words[at];
4580
- if (word === "--") {
4581
- argv.push("--");
4582
- for (let after = at + 1; after < words.length; after++)
4583
- argv.push(raw(words[after]));
4584
- break;
4585
- }
4586
- if (word.startsWith("-") && word.length > 1 && !NUMBER.test(word)) {
4587
- const equals = word.indexOf("=");
4588
- const flag2 = equals > 0 ? word.slice(0, equals) : word;
4589
- if (!/^--?[A-Za-z0-9][A-Za-z0-9-]*$/.test(flag2)) {
4590
- argv.push(raw(word));
4591
- continue;
4592
- }
4593
- const option = optionFor(flag2);
4594
- const name = option?.attributeName() ?? flag2.replace(/^-+/, "");
4595
- if (equals > 0) {
4596
- argv.push(`${flag2}=${keptValue(name, word.slice(equals + 1), option)}`);
4597
- continue;
4598
- }
4599
- argv.push(flag2);
4600
- if (!option && keep2 && secretNamed(name) && words[at + 1] !== void 0 && !words[at + 1]?.startsWith("-")) {
4601
- at += 1;
4602
- argv.push(REDACTED);
4603
- continue;
4604
- }
4605
- if (!option || !(option.required || option.optional))
4606
- continue;
4607
- const takes = /* @__PURE__ */ __name((next) => next !== void 0 && (option.required || !next.startsWith("-") || NUMBER.test(next)), "takes");
4608
- if (takes(words[at + 1])) {
4609
- at += 1;
4610
- argv.push(keptValue(name, words[at], option));
4611
- while (option.variadic && words[at + 1] !== void 0 && !words[at + 1].startsWith("-")) {
4612
- at += 1;
4613
- argv.push(keptValue(name, words[at], option));
4614
- }
4615
- }
4616
- continue;
4617
- }
4618
- if (!lost && positional === 0) {
4619
- const sub = current.commands.find((one) => one.name() === word || one.aliases().includes(word));
4620
- if (sub) {
4621
- argv.push(word);
4622
- current = sub;
4623
- continue;
4624
- }
4625
- if (current === program2 && !profileSeen) {
4626
- profileSeen = true;
4627
- argv.push(keep2 ? raw(word) : PROFILE.test(word) && withoutPhones(withoutSecrets(word)) === word ? word : REDACTED);
4628
- continue;
4629
- }
4630
- if (current.commands.length > 0 && current.registeredArguments.length === 0) {
4631
- lost = true;
4632
- unknownCommand = commandLike(word);
4633
- argv.push(keep2 ? raw(word) : unknownCommand);
4634
- continue;
4635
- }
4636
- }
4637
- const declared = lost ? void 0 : current.registeredArguments;
4638
- const argument = declared?.[Math.min(positional, declared.length - 1)];
4639
- positional += 1;
4640
- argv.push(secretInputs.has(current) ? REDACTED : argument ? keptValue(argument.name(), word, argument) : raw(word));
4641
- }
4642
- return { argv, ...unknownCommand === void 0 ? {} : { unknownCommand } };
4643
- }, "maskArgv");
4644
- var NUMBER = /^-?\d+(\.\d+)?$/;
4645
- var PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
4646
- var commandLike = /* @__PURE__ */ __name((word) => /^[a-z][a-z0-9-]{0,31}$/i.test(word) && withoutSecrets(word) === word ? word : REDACTED, "commandLike");
4647
- var maskedValue = /* @__PURE__ */ __name((name, value, choices) => {
4648
- if (isContentKey(name))
4649
- return REDACTED;
4650
- if (name === "profile")
4651
- return PROFILE.test(value) ? value : REDACTED;
4652
- if (name === "json" || name === "fields")
4653
- return /^[a-z0-9_.,]{1,200}$/.test(value) ? value : REDACTED;
4654
- if (choices?.includes(value))
4655
- return value;
4656
- return safeShape(value) ? value : REDACTED;
4657
- }, "maskedValue");
4658
- var safeShape = /* @__PURE__ */ __name((value) => NUMBER.test(value) && !/^\d{11,}$/.test(value) || /^\d+(ms|s|m|h|d|w)$/.test(value) || /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/.test(value) || value === "true" || value === "false", "safeShape");
4659
- var runContextOf = /* @__PURE__ */ __name(({ bin, command, program: program2, argv, env, recordInput = false }) => {
4660
- const masked = program2 && argv ? maskArgv(program2, argv, { keep: recordInput }) : void 0;
4661
- const agent = agentOf(env);
4662
- return {
4663
- cliCommand: command ? `${bin} ${command}` : bin,
4664
- ...masked ? { argv: masked.argv } : {},
4665
- ...masked?.unknownCommand === void 0 ? {} : { unknownCommand: masked.unknownCommand },
4666
- ...agent ? { agent } : {}
4667
- };
4668
- }, "runContextOf");
4669
-
4670
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/deadline.js
5402
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/deadline.js
4671
5403
  var withDeadline = /* @__PURE__ */ __name(async (ms, closeables, body) => {
4672
5404
  if (ms === void 0)
4673
5405
  return body();
@@ -4693,7 +5425,7 @@ var withDeadline = /* @__PURE__ */ __name(async (ms, closeables, body) => {
4693
5425
  }
4694
5426
  }, "withDeadline");
4695
5427
 
4696
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/profile.js
5428
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/profile.js
4697
5429
  var asFirstWord = /* @__PURE__ */ __name((profile) => `${profile} `, "asFirstWord");
4698
5430
  var PLAIN_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
4699
5431
  var isProfileName = /* @__PURE__ */ __name((word) => PLAIN_NAME.test(word), "isProfileName");
@@ -4758,10 +5490,10 @@ var sampleCommand = /* @__PURE__ */ __name((commands) => {
4758
5490
  return void 0;
4759
5491
  }, "sampleCommand");
4760
5492
 
4761
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/settings.js
5493
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/settings.js
4762
5494
  import { existsSync as existsSync3 } from "node:fs";
4763
5495
 
4764
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/models/endpoint.js
5496
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/models/endpoint.js
4765
5497
  var endpoint = /* @__PURE__ */ __name((value) => {
4766
5498
  try {
4767
5499
  const url2 = new URL(value);
@@ -4771,7 +5503,7 @@ var endpoint = /* @__PURE__ */ __name((value) => {
4771
5503
  }
4772
5504
  }, "endpoint");
4773
5505
 
4774
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/models/settings.js
5506
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/models/settings.js
4775
5507
  var MODEL_FIELDS = ["provider", "model", "base_url"];
4776
5508
  var modelSettingsShape = record(pipe(string(), regex(/^[a-z][a-z0-9-]*$/)), strictObject({
4777
5509
  provider: optional(picklist(["off", "openai", "anthropic"])),
@@ -4840,7 +5572,7 @@ var modelTarget = /* @__PURE__ */ __name((settings, purpose) => {
4840
5572
  };
4841
5573
  }, "modelTarget");
4842
5574
 
4843
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/analysis/settings.js
5575
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/analysis/settings.js
4844
5576
  var model = pipe(string(), trim(), minLength(1), maxLength(200));
4845
5577
  var url = pipe(string(), check(endpoint, "use an HTTP/S endpoint without credentials, query or fragment"));
4846
5578
  var AI_FIELDS = {
@@ -4884,7 +5616,7 @@ var resolveAISettings = /* @__PURE__ */ __name((prefix, layers, env) => {
4884
5616
  };
4885
5617
  }, "resolveAISettings");
4886
5618
 
4887
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/domain/duration.js
5619
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/domain/duration.js
4888
5620
  var DURATION = /^(\d+)(ms|s|m|h|d)$/;
4889
5621
  var UNIT_MS = { ms: 1, s: 1e3, m: 6e4, h: 36e5, d: 864e5 };
4890
5622
  var parseDuration = /* @__PURE__ */ __name((value, source) => {
@@ -4898,7 +5630,7 @@ var parseDuration = /* @__PURE__ */ __name((value, source) => {
4898
5630
  return ms;
4899
5631
  }, "parseDuration");
4900
5632
 
4901
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/embeddings/models.js
5633
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/embeddings/models.js
4902
5634
  var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`, "huggingFace");
4903
5635
  var e5 = huggingFace("Xenova/multilingual-e5-small", "761b726dd34fb83930e26aab4e9ac3899aa1fa78");
4904
5636
  var gemma = huggingFace("onnx-community/embeddinggemma-300m-ONNX", "5090578d9565bb06545b4552f76e6bc2c93e4a66");
@@ -5057,8 +5789,8 @@ var rerankModel = /* @__PURE__ */ __name((id2) => {
5057
5789
  var vectorModelKey = /* @__PURE__ */ __name((model2) => `local:${model2.id}:${model2.dims}`, "vectorModelKey");
5058
5790
  var meaningFloor = /* @__PURE__ */ __name((key) => key === "local:e5-small:384" ? 0.8 : 0, "meaningFloor");
5059
5791
 
5060
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/config-issues.js
5061
- import { readFileSync as readFileSync2 } from "node:fs";
5792
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/config-issues.js
5793
+ import { readFileSync as readFileSync3 } from "node:fs";
5062
5794
  var isNode = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isNode");
5063
5795
  var SECTIONS = ["personal", "bot"];
5064
5796
  var SHELL_SAFE = /^[A-Za-z0-9_.:@-]*$/;
@@ -5165,8 +5897,8 @@ var failureOffset = /* @__PURE__ */ __name((text2) => {
5165
5897
  value();
5166
5898
  space();
5167
5899
  return at;
5168
- } catch (stopped) {
5169
- return typeof stopped === "number" ? stopped : at;
5900
+ } catch (stopped2) {
5901
+ return typeof stopped2 === "number" ? stopped2 : at;
5170
5902
  }
5171
5903
  }, "failureOffset");
5172
5904
  var parseConfigText = /* @__PURE__ */ __name((text2, file) => {
@@ -5237,7 +5969,7 @@ var schemaIssues = /* @__PURE__ */ __name((raw, schema, context) => {
5237
5969
  return [...found.values()];
5238
5970
  }
5239
5971
  }, "schemaIssues");
5240
- var scopes = /* @__PURE__ */ __name((raw) => {
5972
+ var scopes2 = /* @__PURE__ */ __name((raw) => {
5241
5973
  if (!isNode(raw))
5242
5974
  return [];
5243
5975
  const out = [];
@@ -5259,7 +5991,7 @@ var scopes = /* @__PURE__ */ __name((raw) => {
5259
5991
  addSection([name], raw[name]);
5260
5992
  return out;
5261
5993
  }, "scopes");
5262
- var savedPermissionKeys = /* @__PURE__ */ __name((raw) => scopes(raw).flatMap(([path2, scope]) => isNode(scope.permissions) ? Object.keys(scope.permissions).map((key) => ({ key, at: [...path2, "permissions", key] })) : []), "savedPermissionKeys");
5994
+ var savedPermissionKeys = /* @__PURE__ */ __name((raw) => scopes2(raw).flatMap(([path2, scope]) => isNode(scope.permissions) ? Object.keys(scope.permissions).map((key) => ({ key, at: [...path2, "permissions", key] })) : []), "savedPermissionKeys");
5263
5995
  var permissionIssues = /* @__PURE__ */ __name((saved, known, context) => saved.filter(({ key }) => !known.has(key)).map(({ at }) => locate("unknown_permission", at, context, (key) => `${key} names no command`)), "permissionIssues");
5264
5996
  var pathId = /* @__PURE__ */ __name((path2) => path2.join("\0"), "pathId");
5265
5997
  var prune = /* @__PURE__ */ __name((raw, paths) => {
@@ -5327,7 +6059,7 @@ var checkConfigText = /* @__PURE__ */ __name((text2, { file, tool, schema, known
5327
6059
  var wholeFile = /* @__PURE__ */ __name((file, what) => ({ kind: "invalid_value", file, what }), "wholeFile");
5328
6060
  var readConfigText = /* @__PURE__ */ __name((path2) => {
5329
6061
  try {
5330
- return { text: readFileSync2(path2, "utf8") };
6062
+ return { text: readFileSync3(path2, "utf8") };
5331
6063
  } catch (error) {
5332
6064
  const code = error.code;
5333
6065
  if (code === "ENOENT")
@@ -5347,9 +6079,9 @@ var readConfigFile = /* @__PURE__ */ __name((path2) => {
5347
6079
  return "issue" in parsed ? { issue: publicIssue(parsed.issue) } : parsed;
5348
6080
  }, "readConfigFile");
5349
6081
 
5350
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/default-config.js
5351
- import { existsSync as existsSync2, linkSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
5352
- import { dirname, join as join2 } from "node:path";
6082
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/default-config.js
6083
+ import { existsSync as existsSync2, linkSync, mkdirSync as mkdirSync2, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "node:fs";
6084
+ import { dirname, join as join3 } from "node:path";
5353
6085
  var DEFAULT_CONFIG = {
5354
6086
  defaults: { limit: 20, keep_runs_for_days: 30, sends_per_hour: 30, update_check: true, skill_hint: true },
5355
6087
  profiles: {}
@@ -5358,11 +6090,11 @@ function ensureDefaultConfig(path2, config = DEFAULT_CONFIG) {
5358
6090
  if (existsSync2(path2))
5359
6091
  return;
5360
6092
  const directory = dirname(path2);
5361
- mkdirSync(directory, { recursive: true, mode: 448 });
5362
- const temporary = mkdtempSync(join2(directory, ".config-"));
5363
- const candidate = join2(temporary, "config.json");
6093
+ mkdirSync2(directory, { recursive: true, mode: 448 });
6094
+ const temporary = mkdtempSync(join3(directory, ".config-"));
6095
+ const candidate = join3(temporary, "config.json");
5364
6096
  try {
5365
- writeFileSync(candidate, `${JSON.stringify(config, null, 2)}
6097
+ writeFileSync2(candidate, `${JSON.stringify(config, null, 2)}
5366
6098
  `, { flag: "wx", mode: 384 });
5367
6099
  try {
5368
6100
  linkSync(candidate, path2);
@@ -5371,12 +6103,12 @@ function ensureDefaultConfig(path2, config = DEFAULT_CONFIG) {
5371
6103
  throw error;
5372
6104
  }
5373
6105
  } finally {
5374
- rmSync(temporary, { recursive: true, force: true });
6106
+ rmSync2(temporary, { recursive: true, force: true });
5375
6107
  }
5376
6108
  }
5377
6109
  __name(ensureDefaultConfig, "ensureDefaultConfig");
5378
6110
 
5379
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/settings.js
6111
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/settings.js
5380
6112
  var DEFAULT_LIMIT = DEFAULT_CONFIG.defaults.limit;
5381
6113
  var DEFAULT_KEEP_RUNS_FOR_DAYS = DEFAULT_CONFIG.defaults.keep_runs_for_days;
5382
6114
  var DEFAULT_SENDS_PER_HOUR = DEFAULT_CONFIG.defaults.sends_per_hour;
@@ -5393,6 +6125,7 @@ var count2 = pipe(number(wholeNumber), integer(wholeNumber), minValue(1, wholeNu
5393
6125
  var zeroOrMore = plain("has to be a whole number, 0 or more");
5394
6126
  var countOrZero = pipe(number(zeroOrMore), integer(zeroOrMore), minValue(0, zeroOrMore));
5395
6127
  var flag = boolean(plain("has to be true or false"));
6128
+ var recordInputSetting = union([boolean(), literal("failed")], plain('has to be true, false or "failed"'));
5396
6129
  var wholeOrZero = /* @__PURE__ */ __name((text2, name) => {
5397
6130
  const value = Number(text2);
5398
6131
  if (!Number.isInteger(value) || value < 0)
@@ -5409,8 +6142,10 @@ var SHARED_PROFILE_ENTRIES = {
5409
6142
  color: optional(flag),
5410
6143
  sender_colors: optional(flag),
5411
6144
  record: optional(flag),
5412
- record_input: optional(flag),
6145
+ record_input: optional(recordInputSetting),
5413
6146
  keep_runs_for_days: optional(count2),
6147
+ keep_successful_runs_for_days: optional(count2),
6148
+ runs_size_limit_mb: optional(count2),
5414
6149
  permissions: optional(permissionLevels),
5415
6150
  sends_per_hour: optional(count2),
5416
6151
  requests_per_minute: optional(countOrZero),
@@ -5424,6 +6159,13 @@ var SHARED_PROFILE_ENTRIES = {
5424
6159
  var BOT_ONLY_ENTRIES = {
5425
6160
  read_other_bots: optional(union([flag, array(string(), plain("has to be a list of profile names"))], plain("has to be true, false or a list of profile names")))
5426
6161
  };
6162
+ var MESSENGER_ONLY_SETTINGS = [
6163
+ "sender_colors",
6164
+ "sends_per_hour",
6165
+ "transcribe_with",
6166
+ "search_catch_up",
6167
+ "read_other_bots"
6168
+ ];
5427
6169
  var SHARED_DEFAULTS_ONLY = {
5428
6170
  update_check: optional(flag),
5429
6171
  skill_hint: optional(flag)
@@ -5479,8 +6221,8 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5479
6221
  const schema = strictOf(configEntries);
5480
6222
  const defaultsOnlyKeys = Object.keys(defaultsOnly);
5481
6223
  const botOnlyKeys = Object.keys(BOT_ONLY_ENTRIES);
5482
- const allSettings = [...Object.keys(profileEntries), ...botOnlyKeys, ...defaultsOnlyKeys];
5483
- const PROFILE2 = envName(app, "PROFILE");
6224
+ const allSettings = [...Object.keys(profileEntries), ...botOnlyKeys, ...defaultsOnlyKeys].filter((setting) => app.messenger !== false || !MESSENGER_ONLY_SETTINGS.includes(setting));
6225
+ const PROFILE = envName(app, "PROFILE");
5484
6226
  const PROFILE_LOCK = envName(app, "PROFILE_LOCK");
5485
6227
  const TIMEOUT = envName(app, "TIMEOUT");
5486
6228
  const REQUESTS_PER_MINUTE = envName(app, "REQUESTS_PER_MINUTE");
@@ -5502,7 +6244,7 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5502
6244
  usableProfileName(lock);
5503
6245
  if (profile.value === lock)
5504
6246
  return profile;
5505
- if (profile.from === "first word" || profile.from === PROFILE2) {
6247
+ if (profile.from === "first word" || profile.from === PROFILE) {
5506
6248
  throw new CliError("permission_error", `this process is locked to profile ${lock} (${PROFILE_LOCK}) \u2014 profile "${profile.value}" is refused`);
5507
6249
  }
5508
6250
  return { value: lock, from: PROFILE_LOCK };
@@ -5513,7 +6255,7 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5513
6255
  const here = profilesOf(config, env);
5514
6256
  if (here.length === 0)
5515
6257
  throw new NoProfileHere(app);
5516
- throw new CliError("validation_error", `name a profile: \`${app.command} <profile> \u2026\` \u2014 profiles here: ${here.join(", ")} (or set ${PROFILE2})`, { profiles: here });
6258
+ throw new CliError("validation_error", `name a profile: \`${app.command} <profile> \u2026\` \u2014 profiles here: ${here.join(", ")} (or set ${PROFILE})`, { profiles: here });
5517
6259
  }, "unnamed");
5518
6260
  const profilesOf = /* @__PURE__ */ __name((config, env) => profilesHere(app, [...namedProfiles(config), ...extension.profiles?.(env) ?? []], env), "profilesOf");
5519
6261
  const resolveSettings = /* @__PURE__ */ __name((flags = {}, options = {}) => {
@@ -5530,12 +6272,12 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5530
6272
  throw new CliError("configuration_error", issueMessage(loaded.issues));
5531
6273
  const { config } = loaded;
5532
6274
  const lock = given(env[PROFILE_LOCK]);
5533
- const named = first([
6275
+ const named2 = first([
5534
6276
  ["first word", flags.profile],
5535
- [PROFILE2, given(env[PROFILE2])],
6277
+ [PROFILE, given(env[PROFILE])],
5536
6278
  [PROFILE_LOCK, lock]
5537
6279
  ], void 0);
5538
- const profile = locked(named.value === void 0 ? unnamed(config, env, options.needsProfile !== false) : { value: named.value, from: named.from }, lock);
6280
+ const profile = locked(named2.value === void 0 ? unnamed(config, env, options.needsProfile !== false) : { value: named2.value, from: named2.from }, lock);
5539
6281
  const kind = options.kind ?? "personal";
5540
6282
  const name = usableProfileName(profile.value);
5541
6283
  const configured = config.profiles[name] ?? {};
@@ -5550,7 +6292,7 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5550
6292
  const fromLayers = /* @__PURE__ */ __name((key, fallback, only = layers) => first(only.map(([from, scope]) => [from, scope?.[key]]), fallback), "fromLayers");
5551
6293
  const kindLayers = layers.filter(([from]) => from.startsWith(`config file: ${kind}.`));
5552
6294
  const limit = flags.limit === void 0 ? fromLayers("limit", DEFAULT_LIMIT) : { value: flags.limit, from: "flag" };
5553
- const record2 = flags.record === void 0 ? fromLayers("record", false) : { value: flags.record, from: "flag" };
6295
+ const record2 = flags.record === void 0 ? fromLayers("record", true) : { value: flags.record, from: "flag" };
5554
6296
  const timeoutMs = fromLayers("timeout_ms", void 0);
5555
6297
  const color = fromLayers("color", void 0);
5556
6298
  const senderColors = fromLayers("sender_colors", false);
@@ -5559,6 +6301,8 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5559
6301
  const searchReranker = fromLayers("search_reranker", DEFAULT_RERANK_MODEL);
5560
6302
  const recordInput = fromLayers("record_input", true);
5561
6303
  const keepRunsForDays = fromLayers("keep_runs_for_days", DEFAULT_KEEP_RUNS_FOR_DAYS);
6304
+ const keepSuccessfulRunsForDays = fromLayers("keep_successful_runs_for_days", KEEP_SUCCESSFUL_RUNS_FOR_DAYS);
6305
+ const runsSizeLimitMb = fromLayers("runs_size_limit_mb", RUNS_SIZE_LIMIT_MB);
5562
6306
  const readOnlyLock = readOnlyLockOf(app, env);
5563
6307
  const sendsPerHour = kind === "bot" ? fromLayers("sends_per_hour", Number.POSITIVE_INFINITY, kindLayers) : fromLayers("sends_per_hour", DEFAULT_SENDS_PER_HOUR);
5564
6308
  const paceFromEnv = given(env[REQUESTS_PER_MINUTE]);
@@ -5604,8 +6348,10 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5604
6348
  commandTimeoutMs: timeout.value === void 0 ? void 0 : (extension.parseDuration ?? parseDuration)(timeout.value, timeout.from === TIMEOUT ? TIMEOUT : "--timeout"),
5605
6349
  record: record2.value,
5606
6350
  recordInput: recordInput.value,
5607
- keepFailedRuns: record2.value || record2.from === "default",
6351
+ keepFailedRuns: record2.value || record2.from !== "flag",
5608
6352
  keepRunsForDays: keepRunsForDays.value,
6353
+ keepSuccessfulRunsForDays: keepSuccessfulRunsForDays.value,
6354
+ runsSizeLimitMb: runsSizeLimitMb.value,
5609
6355
  ...readOnlyLock ? { readOnlyLock } : {},
5610
6356
  permissions: permissions.levels,
5611
6357
  permissionSources: permissions.sources,
@@ -5633,6 +6379,8 @@ var settingsFor = /* @__PURE__ */ __name((app, extension = {}) => {
5633
6379
  record: record2.from,
5634
6380
  recordInput: recordInput.from,
5635
6381
  keepRunsForDays: keepRunsForDays.from,
6382
+ keepSuccessfulRunsForDays: keepSuccessfulRunsForDays.from,
6383
+ runsSizeLimitMb: runsSizeLimitMb.from,
5636
6384
  sendsPerHour: sendsPerHour.from,
5637
6385
  requestsPerMinute: requestsPerMinute.from,
5638
6386
  readOtherBots: readOtherBots.from,
@@ -5750,7 +6498,7 @@ var given = /* @__PURE__ */ __name((value) => {
5750
6498
  return trimmed === void 0 || trimmed === "" ? void 0 : trimmed;
5751
6499
  }, "given");
5752
6500
 
5753
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/context.js
6501
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/context.js
5754
6502
  var setExitCode = /* @__PURE__ */ __name((command, code) => {
5755
6503
  const slot = environmentOf(command).exit;
5756
6504
  if (slot)
@@ -5822,13 +6570,22 @@ var baseContext = /* @__PURE__ */ __name((command, resolveSettings) => {
5822
6570
  program: rootOf(command),
5823
6571
  ...environment.argv ? { argv: environment.argv } : {},
5824
6572
  env,
5825
- recordInput: settings.recordInput !== false
6573
+ recordInput: settings.recordInput ?? true,
6574
+ caller: environment.agent?.caller ?? currentCaller()
5826
6575
  }),
5827
6576
  ...ranFor === void 0 ? {} : { profile: ranFor },
5828
- record: settings.record,
6577
+ record: keepsSuccess({
6578
+ record: settings.record,
6579
+ fromFlag: settings.sources?.record === "flag",
6580
+ env,
6581
+ caller: environment.agent?.caller ?? currentCaller(),
6582
+ persistent: metaOf(command).lifetime === "persistent"
6583
+ }),
5829
6584
  keepFailed: settings.keepFailedRuns,
5830
6585
  trace: settings.trace,
5831
6586
  keepDays: settings.keepRunsForDays,
6587
+ ...settings.keepSuccessfulRunsForDays === void 0 ? {} : { keepSuccessDays: settings.keepSuccessfulRunsForDays },
6588
+ ...settings.runsSizeLimitMb === void 0 ? {} : { maxBytes: settings.runsSizeLimitMb * 1024 * 1024 },
5832
6589
  processRun: !environment.agent,
5833
6590
  format,
5834
6591
  streams,
@@ -5843,12 +6600,12 @@ var baseContext = /* @__PURE__ */ __name((command, resolveSettings) => {
5843
6600
  }, "baseContext");
5844
6601
  var commandPath = /* @__PURE__ */ __name((command) => {
5845
6602
  const words = [];
5846
- for (let current = command; current?.parent; current = current.parent)
5847
- words.unshift(current.name());
6603
+ for (let current2 = command; current2?.parent; current2 = current2.parent)
6604
+ words.unshift(current2.name());
5848
6605
  return words.join(" ");
5849
6606
  }, "commandPath");
5850
6607
 
5851
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/effects.js
6608
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/effects.js
5852
6609
  var REMOTE_READ = { remote: "read", local: "read" };
5853
6610
  var FETCH = { remote: "read", local: "write" };
5854
6611
  var REMOTE_WRITE = { remote: "write", local: "write" };
@@ -5889,6 +6646,17 @@ var changesStore = /* @__PURE__ */ __name((command) => {
5889
6646
  STORE_WRITES.add(command);
5890
6647
  return command;
5891
6648
  }, "changesStore");
6649
+ var savesFiles = /* @__PURE__ */ __name((command) => command.name() === "download" || [...command.options.map((option) => option.attributeName()), ...command.registeredArguments.map((one) => one.name())].map((name) => name.toLowerCase()).some((name) => name === "dir" || name.endsWith("dir") || name === "output"), "savesFiles");
6650
+ var fetchesOnly = /* @__PURE__ */ __name((command) => {
6651
+ const effects = metaOf(command).effects;
6652
+ return effects?.remote === "read" && effects.local === "write" && !STORE_WRITES.has(command) && !changesAuthority(command) && !OTHER_SERVICE.has(command) && !savesFiles(command);
6653
+ }, "fetchesOnly");
6654
+ var fetchesOnlyAt = /* @__PURE__ */ __name((root) => (path2) => {
6655
+ let at = root;
6656
+ for (const word of path2)
6657
+ at = at?.commands.find((one) => one.name() === word);
6658
+ return at !== void 0 && fetchesOnly(at);
6659
+ }, "fetchesOnlyAt");
5892
6660
  var isStoreChange = /* @__PURE__ */ __name((command) => {
5893
6661
  const effects = metaOf(command).effects;
5894
6662
  return (effects?.remote === "none" || STORE_WRITES.has(command)) && effects?.local === "write" && !KEPT_UNDER_LOCK.has(command) && !changesAuthority(command);
@@ -5939,7 +6707,61 @@ var refuseUnderReadOnly = /* @__PURE__ */ __name((command, what) => {
5939
6707
  throw readOnlyRefusal(lock, what);
5940
6708
  }, "refuseUnderReadOnly");
5941
6709
 
5942
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/steps.js
6710
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/images/picture/models.js
6711
+ import { join as join4 } from "node:path";
6712
+ var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
6713
+ var IMAGE_MODELS = [
6714
+ {
6715
+ id: "clip-b32",
6716
+ title: "CLIP ViT-B/32, 8-bit",
6717
+ languages: "English only: translate a query before searching",
6718
+ licence: "MIT",
6719
+ dims: 512,
6720
+ key: "local:clip-b32:512",
6721
+ maxTokens: 77,
6722
+ vision: "onnx/vision_model_quantized.onnx",
6723
+ text: "onnx/text_model_quantized.onnx",
6724
+ files: [
6725
+ {
6726
+ name: "onnx/vision_model_quantized.onnx",
6727
+ url: clip("onnx/vision_model_quantized.onnx"),
6728
+ sha256: "583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299",
6729
+ bytes: 89117001
6730
+ },
6731
+ {
6732
+ name: "onnx/text_model_quantized.onnx",
6733
+ url: clip("onnx/text_model_quantized.onnx"),
6734
+ sha256: "73baab855d406190da9faa498cfedf65f15cf309f4cc7385b7b032e6d08e5c3a",
6735
+ bytes: 64504507
6736
+ },
6737
+ {
6738
+ name: "tokenizer.json",
6739
+ url: clip("tokenizer.json"),
6740
+ sha256: "f7f3b7af117d467b58374797691a6438d3e6b9e9cef800dfd5dced7f697a90cd",
6741
+ bytes: 2224119
6742
+ },
6743
+ {
6744
+ name: "tokenizer_config.json",
6745
+ url: clip("tokenizer_config.json"),
6746
+ sha256: "60ba2912bc6344c94bc16bbdec27fa1209409167b6f2fdf3cfe9e65462ea3967",
6747
+ bytes: 775
6748
+ }
6749
+ ]
6750
+ }
6751
+ ];
6752
+ var DEFAULT_IMAGE_MODEL = "clip-b32";
6753
+ var imageModel = /* @__PURE__ */ __name((id2) => {
6754
+ const found = IMAGE_MODELS.find((model2) => model2.id === id2);
6755
+ if (!found) {
6756
+ throw new CliError("validation_error", `no image model ${id2} \u2014 one of: ${IMAGE_MODELS.map((model2) => model2.id).join(", ")}`);
6757
+ }
6758
+ return found;
6759
+ }, "imageModel");
6760
+ var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("image", env), "imageModelsDirectory");
6761
+ var placedImage = /* @__PURE__ */ __name((model2, directory) => model2.files.map((file) => [file, join4(directory, model2.id, file.name)]), "placedImage");
6762
+ var isImageModelInstalled = /* @__PURE__ */ __name((model2, directory) => filesPresent(placedImage(model2, directory)), "isImageModelInstalled");
6763
+
6764
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/steps.js
5943
6765
  var STEPS2 = defineSteps([
5944
6766
  ...STEPS,
5945
6767
  {
@@ -6170,6 +6992,15 @@ var commandAt = /* @__PURE__ */ __name((root, path2) => {
6170
6992
  return at === root ? void 0 : at;
6171
6993
  }, "commandAt");
6172
6994
  var runnable = /* @__PURE__ */ __name((root, steps) => withSafety((steps ?? []).filter((step) => step.kind === "user_action" || commandAt(root, step.command) !== void 0).slice(0, MAX_NEXT_STEPS), judgedTargets(root)), "runnable");
6995
+ var failureSteps = /* @__PURE__ */ __name((root, error) => {
6996
+ const model2 = error.details?.model;
6997
+ const own = error.reason === "model.not-downloaded" && typeof model2 === "string" ? [
6998
+ nextStep(IMAGE_MODELS.some((one) => one.id === model2) ? "models.download-image" : "models.download", {
6999
+ args: { model: model2 }
7000
+ })
7001
+ ] : [];
7002
+ return runnable(root, [...error.next ?? [], ...own]);
7003
+ }, "failureSteps");
6173
7004
  var withSafety = /* @__PURE__ */ __name((steps, targets) => steps.map((step) => {
6174
7005
  if (step.kind === "user_action")
6175
7006
  return step;
@@ -6196,7 +7027,7 @@ var stepLine = /* @__PURE__ */ __name((root, step) => {
6196
7027
  ].join(" ");
6197
7028
  }, "stepLine");
6198
7029
 
6199
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/provider-refs.js
7030
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/provider-refs.js
6200
7031
  var HIDDEN = /* @__PURE__ */ new Set(["providerRef", "provider_ref"]);
6201
7032
  var withoutProviderRefs = /* @__PURE__ */ __name((value) => strip(value), "withoutProviderRefs");
6202
7033
  var strip = /* @__PURE__ */ __name((value) => {
@@ -6210,9 +7041,9 @@ var strip = /* @__PURE__ */ __name((value) => {
6210
7041
  return Object.fromEntries(Object.entries(value).flatMap(([key, inner]) => HIDDEN.has(key) ? [] : [[key, strip(inner)]]));
6211
7042
  }, "strip");
6212
7043
 
6213
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/cli/envelope.js
7044
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/cli/envelope.js
6214
7045
  var answerSchema = /* @__PURE__ */ __name((item = unknown()) => union([listEnvelopeSchema(item), itemEnvelopeSchema(item)]), "answerSchema");
6215
- var capped = /* @__PURE__ */ __name((steps) => steps.length > 0 ? { next: steps.slice(0, MAX_NEXT_STEPS) } : {}, "capped");
7046
+ var capped2 = /* @__PURE__ */ __name((steps) => steps.length > 0 ? { next: steps.slice(0, MAX_NEXT_STEPS) } : {}, "capped");
6216
7047
  var listOf = /* @__PURE__ */ __name((command, input) => {
6217
7048
  const { items, limit, has_more, cursor, paging, page, args = {}, next = [], missing, meta } = input;
6218
7049
  const byCursor = paging === "cursor" || cursor !== void 0;
@@ -6226,7 +7057,7 @@ var listOf = /* @__PURE__ */ __name((command, input) => {
6226
7057
  const body = {
6227
7058
  items,
6228
7059
  page: byCursor ? { mode: "cursor", limit, has_more, ...has_more && cursor !== void 0 ? { next_cursor: cursor } : {} } : { mode: "page", limit, has_more, ...has_more ? { next_page: (page ?? 1) + 1 } : {} },
6229
- ...capped([...more, ...next]),
7060
+ ...capped2([...more, ...next]),
6230
7061
  ...missing && missing.length > 0 ? { missing } : {},
6231
7062
  ...meta ? { meta } : {}
6232
7063
  };
@@ -6235,13 +7066,13 @@ var listOf = /* @__PURE__ */ __name((command, input) => {
6235
7066
  var itemOf = /* @__PURE__ */ __name((item, { next = [], missing, meta } = {}) => {
6236
7067
  const body = {
6237
7068
  item,
6238
- ...capped(next),
7069
+ ...capped2(next),
6239
7070
  ...missing && missing.length > 0 ? { missing } : {},
6240
7071
  ...meta ? { meta } : {}
6241
7072
  };
6242
7073
  return body;
6243
7074
  }, "itemOf");
6244
- var snake2 = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
7075
+ var snake3 = /* @__PURE__ */ __name((key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`), "snake");
6245
7076
  var snakeKeysKeeping = /* @__PURE__ */ __name((verbatim) => {
6246
7077
  const kept = new Set(verbatim);
6247
7078
  const convert = /* @__PURE__ */ __name((value) => {
@@ -6252,7 +7083,7 @@ var snakeKeysKeeping = /* @__PURE__ */ __name((verbatim) => {
6252
7083
  return Object.fromEntries(Object.entries(value).flatMap(([key, inner]) => {
6253
7084
  if (inner === void 0)
6254
7085
  return [];
6255
- const name = snake2(key);
7086
+ const name = snake3(key);
6256
7087
  return [[name, kept.has(key) || kept.has(name) ? inner : convert(inner)]];
6257
7088
  }));
6258
7089
  }, "convert");
@@ -6332,7 +7163,7 @@ var printItem = /* @__PURE__ */ __name(({ renderer, format }, item) => {
6332
7163
  renderer.result(item);
6333
7164
  }, "printItem");
6334
7165
 
6335
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/store-table.js
7166
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/store-table.js
6336
7167
  var TABLE_KINDS = ["data", "search_index", "search_index_part", "internal"];
6337
7168
  var storeTable = strictObject({
6338
7169
  name: text,
@@ -6341,7 +7172,7 @@ var storeTable = strictObject({
6341
7172
  bytes: optional(nullable(count))
6342
7173
  });
6343
7174
 
6344
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
7175
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/botcheck/reasons.js
6345
7176
  var WEIGHTS = {
6346
7177
  bot: 3,
6347
7178
  scam: 3,
@@ -6366,7 +7197,7 @@ var LINK = /https?:\/\/|t\.me\/|www\./i;
6366
7197
  var DIGITS = /\d{5,}/;
6367
7198
  var oddName = /* @__PURE__ */ __name((name) => !name?.trim() || DIGITS.test(name) || LINK.test(name), "oddName");
6368
7199
 
6369
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/task.js
7200
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/task.js
6370
7201
  var closeSuggestion = strictObject({
6371
7202
  as: picklist(["done", "dismissed"]),
6372
7203
  /** The agent's name. */
@@ -6408,7 +7239,7 @@ var task = strictObject({
6408
7239
  updated_at: optional(time)
6409
7240
  });
6410
7241
 
6411
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/agenda.js
7242
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/agenda.js
6412
7243
  var agendaChat = strictObject({
6413
7244
  chat: reference,
6414
7245
  title: nullable(text),
@@ -6468,7 +7299,7 @@ var agenda = strictObject({
6468
7299
  unlisted_categories: array(strictObject({ name: text, open_tasks: number() }))
6469
7300
  });
6470
7301
 
6471
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/conversation.js
7302
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/conversation.js
6472
7303
  var conversation = strictObject({
6473
7304
  id,
6474
7305
  chat: reference,
@@ -6483,7 +7314,7 @@ var conversation = strictObject({
6483
7314
  rules_version: count
6484
7315
  });
6485
7316
 
6486
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/attachment.js
7317
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/attachment.js
6487
7318
  var attachment = strictObject({
6488
7319
  /** The message it came with, as a locator; absent inside that message. */
6489
7320
  message: optional(reference),
@@ -6512,7 +7343,7 @@ var attachment = strictObject({
6512
7343
  }))))
6513
7344
  });
6514
7345
 
6515
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/entities/tagging.js
7346
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/entities/tagging.js
6516
7347
  var tagging = strictObject({
6517
7348
  tag: text,
6518
7349
  type: picklist(TAG_TYPES),
@@ -6525,7 +7356,7 @@ var tagging = strictObject({
6525
7356
  created_at: time
6526
7357
  });
6527
7358
 
6528
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/runs/record-log.js
7359
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/runs/record-log.js
6529
7360
  var recordLogFor = /* @__PURE__ */ __name((to, app, { traceId, command } = {}) => {
6530
7361
  const run = currentRun();
6531
7362
  const trace = traceId ?? run.traceId;
@@ -6557,18 +7388,31 @@ export {
6557
7388
  sharedCommand,
6558
7389
  customizeSharedCommand,
6559
7390
  refuseJoinedPath,
6560
- isCliFailure,
6561
- isCommanderFailure,
6562
- failureKey,
6563
- providerErrorKey,
7391
+ logAttributes,
7392
+ fromLogAttributes,
7393
+ LOG_ATTRIBUTES,
7394
+ runsDirFor,
7395
+ runtime,
7396
+ newRunId,
7397
+ listRuns,
7398
+ findRun,
7399
+ readEvents,
7400
+ currentRun,
7401
+ inRun,
7402
+ runEvent,
7403
+ typedCommand,
7404
+ useAsProcessRun,
7405
+ processRun,
7406
+ childTrace,
7407
+ withAttempt,
7408
+ currentAttempt,
6564
7409
  recorded,
6565
7410
  startRecording,
6566
7411
  wasSettled,
6567
- partialOutcome,
6568
- agentOf,
6569
- secretInput,
6570
- maskArgv,
6571
- runContextOf,
7412
+ sentIds,
7413
+ currentOperation,
7414
+ guardedWrite,
7415
+ codeOf,
6572
7416
  withDeadline,
6573
7417
  DEFAULT_COMMAND_MS,
6574
7418
  DEFAULT_COOPERATIVE_MS,
@@ -6598,6 +7442,22 @@ export {
6598
7442
  rerankModel,
6599
7443
  vectorModelKey,
6600
7444
  meaningFloor,
7445
+ LEVELS,
7446
+ skipFlagFor,
7447
+ DEFAULT_PERMISSIONS,
7448
+ AUTHORITY_KEY,
7449
+ authorityAllowed,
7450
+ BOT_API_KEY,
7451
+ isBotApi,
7452
+ botApiAllowed,
7453
+ CEILING_KEY,
7454
+ levelFor,
7455
+ keyForWrite,
7456
+ writeOfKey,
7457
+ WRITE_KEYS,
7458
+ readKeysForCommand,
7459
+ keyForCommand,
7460
+ assertRetentionEvidenceRead,
6601
7461
  permissionIssues,
6602
7462
  publicIssue,
6603
7463
  issueMessage,
@@ -6628,6 +7488,7 @@ export {
6628
7488
  isLogin,
6629
7489
  destroysNothing,
6630
7490
  changesStore,
7491
+ fetchesOnlyAt,
6631
7492
  isStoreChange,
6632
7493
  previewFlag,
6633
7494
  storeChangeRefusal,
@@ -6640,11 +7501,18 @@ export {
6640
7501
  judgedTargets,
6641
7502
  refuseUnderReadOnly,
6642
7503
  withoutProviderRefs,
7504
+ IMAGE_MODELS,
7505
+ DEFAULT_IMAGE_MODEL,
7506
+ imageModel,
7507
+ imageModelsDirectory,
7508
+ placedImage,
7509
+ isImageModelInstalled,
6643
7510
  nextStep,
6644
7511
  lineOf,
6645
7512
  rootOf2,
6646
7513
  commandAt,
6647
7514
  runnable,
7515
+ failureSteps,
6648
7516
  withLines,
6649
7517
  stepLine,
6650
7518
  answerSchema,