@wirecat/tg-cli 0.114.0 → 0.115.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 (96) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bin/tg.js.map +1 -1
  3. package/dist/bundle/{adapter-YAEHX3QB.js → adapter-ODK7R4LY.js} +52 -49
  4. package/dist/bundle/{all-profiles-R5CW42HQ.js → all-profiles-AQYM65BS.js} +6 -5
  5. package/dist/bundle/{anthropic-F25RHYV2.js → anthropic-VBDSVNIM.js} +5 -4
  6. package/dist/bundle/{app-server-FAG6FNXR.js → app-server-YOIHLBNS.js} +41 -38
  7. package/dist/bundle/{bot-api-KOIAXTQR.js → bot-api-TRYLGQKK.js} +45 -41
  8. package/dist/bundle/{bot-history-PRAOZEWC.js → bot-history-7DTJLBBJ.js} +16 -15
  9. package/dist/bundle/{bun-sqlite-DSUCO4TR.js → bun-sqlite-6B3BL5IV.js} +4 -3
  10. package/dist/bundle/{chunk-EQJG44KE.js → chunk-2TC76TLJ.js} +1 -1
  11. package/dist/bundle/{chunk-ZFMOPKPT.js → chunk-5ROWSRK7.js} +2 -2
  12. package/dist/bundle/{chunk-TRRRRGMI.js → chunk-63YKD7YA.js} +1 -1
  13. package/dist/bundle/{chunk-EARO464A.js → chunk-77M3IAVU.js} +187 -125
  14. package/dist/bundle/{chunk-NMVFFWF2.js → chunk-A4BQGSKI.js} +6 -6
  15. package/dist/bundle/{chunk-P4YBABUC.js → chunk-AICS3TSF.js} +5 -3
  16. package/dist/bundle/{chunk-ULFTCR5W.js → chunk-AVWPMJ6E.js} +1 -1
  17. package/dist/bundle/{chunk-NJ2I4KFZ.js → chunk-BEQPZA3S.js} +2 -2
  18. package/dist/bundle/{chunk-NUVBC3LJ.js → chunk-BIEBJLYO.js} +2 -2
  19. package/dist/bundle/{chunk-7FOT4XD2.js → chunk-BPPRR7TV.js} +32 -32
  20. package/dist/bundle/chunk-CCHHEMPM.js +71 -0
  21. package/dist/bundle/{chunk-M3IWROIF.js → chunk-CNO3R4O4.js} +6 -4
  22. package/dist/bundle/{chunk-C34IDOA5.js → chunk-D4E345BC.js} +1 -1
  23. package/dist/bundle/{chunk-LPUFOWL3.js → chunk-D72URWJE.js} +1 -39
  24. package/dist/bundle/{chunk-Y4LCSCSH.js → chunk-DIABP7ZP.js} +2 -2
  25. package/dist/bundle/chunk-EW3XTUPB.js +166 -0
  26. package/dist/bundle/{chunk-NTF34HJP.js → chunk-GCFU6WBE.js} +1 -1
  27. package/dist/bundle/{chunk-DQQEN3X4.js → chunk-GWDMKEDY.js} +2 -2
  28. package/dist/bundle/{chunk-CS5DQ6KM.js → chunk-GX4DMI4H.js} +9 -9
  29. package/dist/bundle/{chunk-2PAKHXIV.js → chunk-HZKWB6WS.js} +25 -25
  30. package/dist/bundle/chunk-ILHTNOIV.js +23 -0
  31. package/dist/bundle/{chunk-4JOKO4IW.js → chunk-IUDIRZVU.js} +46 -44
  32. package/dist/bundle/{chunk-QCXYJKPF.js → chunk-JZXQZW2D.js} +1 -1
  33. package/dist/bundle/{chunk-3R43O3GG.js → chunk-KDOBY524.js} +12 -10
  34. package/dist/bundle/{chunk-VHO66SMY.js → chunk-LUIPXRKN.js} +30 -28
  35. package/dist/bundle/{chunk-AL36NHO6.js → chunk-M7B5IMH3.js} +22 -20
  36. package/dist/bundle/{chunk-E2IRSRTB.js → chunk-MUZ4KYGY.js} +4 -2
  37. package/dist/bundle/{chunk-34USFPBF.js → chunk-NTW5ZE47.js} +150 -262
  38. package/dist/bundle/{chunk-TTTDZOBW.js → chunk-OMP6ALBT.js} +2 -2
  39. package/dist/bundle/{chunk-OFDMD3YF.js → chunk-OSP335AJ.js} +1 -1
  40. package/dist/bundle/{chunk-J5U2HKGZ.js → chunk-OUX3QMYI.js} +16 -14
  41. package/dist/bundle/{chunk-HA35XN2Z.js → chunk-PEJHI7QO.js} +2 -2
  42. package/dist/bundle/{chunk-YQ64ZNLD.js → chunk-PEKTB3FQ.js} +15 -13
  43. package/dist/bundle/{chunk-YPABTT7A.js → chunk-POKTQZOM.js} +4 -2
  44. package/dist/bundle/chunk-PQLBPYJR.js +46 -0
  45. package/dist/bundle/{chunk-WIRDTH3J.js → chunk-PZAEI4NM.js} +8 -8
  46. package/dist/bundle/{chunk-I6BKSGZQ.js → chunk-QK6VLKG5.js} +7 -7
  47. package/dist/bundle/{chunk-OWHF6BON.js → chunk-RHUNMU4Q.js} +3 -3
  48. package/dist/bundle/{chunk-NKP3RUM4.js → chunk-TMATSEP5.js} +13 -11
  49. package/dist/bundle/{chunk-RBC7JQ4Y.js → chunk-TQYMLXDS.js} +4 -2
  50. package/dist/bundle/{chunk-TKNCJMYN.js → chunk-U67TSAAO.js} +85 -81
  51. package/dist/bundle/{chunk-6SPLZI5P.js → chunk-UBQ3LOF6.js} +3 -3
  52. package/dist/bundle/{chunk-ALHKUQDZ.js → chunk-UY7GJRGY.js} +1 -1
  53. package/dist/bundle/{chunk-XDOPONC3.js → chunk-VQCWVZWG.js} +3 -3
  54. package/dist/bundle/{chunk-MQTTVQ3V.js → chunk-WDNNN3J4.js} +4 -4
  55. package/dist/bundle/{chunk-KZQXOZFC.js → chunk-WINKEV4F.js} +6 -19
  56. package/dist/bundle/{chunk-C7K7AP6G.js → chunk-WMG4IGEB.js} +11 -11
  57. package/dist/bundle/{chunk-5HKMEXVQ.js → chunk-WMRFAK5B.js} +1 -1
  58. package/dist/bundle/{chunk-IN25CJ3D.js → chunk-XIYRHIBK.js} +1 -1
  59. package/dist/bundle/{chunk-CDCBFMEI.js → chunk-XY7IGVVS.js} +1 -1
  60. package/dist/bundle/{chunk-3EZ43DAF.js → chunk-YCUQKFGD.js} +2 -2
  61. package/dist/bundle/{command-contract-SOTDPG22.js → command-contract-YF4KGFXC.js} +13 -12
  62. package/dist/bundle/{decode-7U4SXPAN.js → decode-2GATBZGH.js} +6 -5
  63. package/dist/bundle/dispatch-MJMW7WDH.js +411 -0
  64. package/dist/bundle/{embed-IDZDQMSW.js → embed-TBQPLA4Y.js} +6 -5
  65. package/dist/bundle/{embedder-RY5R2PGO.js → embedder-B5DTNCRO.js} +8 -7
  66. package/dist/bundle/{entry-P6YZ3ZV6.js → entry-A6DEW2TD.js} +6 -5
  67. package/dist/bundle/failure-TLF3SISS.js +24 -0
  68. package/dist/bundle/first-run-3N5AABEY.js +27 -0
  69. package/dist/bundle/first-screen-HANARM67.js +30 -0
  70. package/dist/bundle/{mcp-FUSDPAOL.js → mcp-MNI62HHE.js} +4 -2
  71. package/dist/bundle/{node-sqlite-VUXFVPJ6.js → node-sqlite-GIDPALK3.js} +4 -3
  72. package/dist/bundle/{oauth-7SQIPMOY.js → oauth-C57W4IMD.js} +6 -5
  73. package/dist/bundle/{open-W3BN2SIO.js → open-E6Q4WRPU.js} +4 -3
  74. package/dist/bundle/{openai-LQTK3ZMC.js → openai-5WMXY2KP.js} +11 -10
  75. package/dist/bundle/{program-DIPSLR6O.js → program-FEUDU6GF.js} +58 -53
  76. package/dist/bundle/{prompt-GESHKSM5.js → prompt-4NGAZGHE.js} +5 -4
  77. package/dist/bundle/{proxy-transport-C2EUUT32.js → proxy-transport-MGCJ7JAW.js} +5 -4
  78. package/dist/bundle/{recognize-FEQTIJET.js → recognize-EUHRBA7V.js} +4 -3
  79. package/dist/bundle/{remote-UXOPBPKS.js → remote-3JHLB2FV.js} +7 -6
  80. package/dist/bundle/{rerank-L4JM4REK.js → rerank-ZZ45SZPC.js} +6 -5
  81. package/dist/bundle/{serve-DDWW44DB.js → serve-XOGX5FC5.js} +7 -6
  82. package/dist/bundle/server-DRE5MJ76.js +59 -0
  83. package/dist/bundle/{server-UTWBIZHB.js → server-I6O72XP5.js} +31 -29
  84. package/dist/bundle/{state-EV7FGEK4.js → state-BIUYTGH6.js} +5 -4
  85. package/dist/bundle/{store-EXBUF4OG.js → store-FOJFYOMR.js} +10 -9
  86. package/dist/bundle/store-maintenance-command-YKV2C34N.js +49 -0
  87. package/dist/bundle/tg.js +159 -14
  88. package/dist/version.d.ts +1 -1
  89. package/dist/version.js +1 -1
  90. package/package.json +3 -2
  91. package/skills/tg-cli/SKILL.md +2 -0
  92. package/dist/bundle/first-run-66KTCVQK.js +0 -24
  93. package/dist/bundle/first-screen-NY46X6QU.js +0 -29
  94. package/dist/bundle/identity-GXVKGCNU.js +0 -11
  95. package/dist/bundle/server-ZI7WDAW6.js +0 -56
  96. package/dist/bundle/store-maintenance-command-UBZE2Z6T.js +0 -46
@@ -1,42 +1,33 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ errorCodes,
5
+ isCliError,
6
+ visibleControls
7
+ } from "./chunk-CCHHEMPM.js";
3
8
  import {
4
9
  __name
5
10
  } from "./chunk-ZVVMGPBJ.js";
6
11
 
7
- // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
8
- var errorCodes = [
9
- "validation_error",
10
- "configuration_error",
11
- "authentication_error",
12
- "permission_error",
13
- "not_found",
14
- "confirmation_required",
15
- "rate_limited",
16
- "timeout",
17
- "network_error",
18
- "provider_error",
19
- "provider_unavailable",
20
- "invalid_response",
21
- "outcome_unknown",
22
- "cancelled"
23
- ];
24
- var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
25
- var CliError = class extends Error {
26
- static {
27
- __name(this, "CliError");
28
- }
29
- code;
30
- details;
31
- constructor(code, message, details = {}) {
32
- super(message);
33
- this.name = "CliError";
34
- this.code = code;
35
- this.details = details;
36
- Object.defineProperty(this, BRAND, { value: true });
37
- }
12
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
13
+ var EXIT_CODES = {
14
+ validation_error: 2,
15
+ configuration_error: 3,
16
+ authentication_error: 4,
17
+ permission_error: 5,
18
+ not_found: 6,
19
+ confirmation_required: 7,
20
+ rate_limited: 8,
21
+ timeout: 9,
22
+ network_error: 10,
23
+ provider_error: 11,
24
+ provider_unavailable: 12,
25
+ invalid_response: 13,
26
+ outcome_unknown: 14,
27
+ cancelled: 130
38
28
  };
39
- var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
29
+ var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
30
+ var GENERIC_FAILURE = 1;
40
31
 
41
32
  // node_modules/.pnpm/valibot@1.5.0_typescript@7.0.2/node_modules/valibot/dist/index.mjs
42
33
  var store$4;
@@ -1289,6 +1280,14 @@ function unwrap(schema) {
1289
1280
  }
1290
1281
  __name(unwrap, "unwrap");
1291
1282
 
1283
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
1284
+ var EFFECT_LEVELS = ["none", "read", "write"];
1285
+ var effectsSchema = strictObject({
1286
+ remote: picklist(EFFECT_LEVELS),
1287
+ local: picklist(EFFECT_LEVELS)
1288
+ });
1289
+ var writes = /* @__PURE__ */ __name((effects) => effects === void 0 || effects.remote === "write" || effects.local === "write", "writes");
1290
+
1292
1291
  // node_modules/.pnpm/@valibot+to-json-schema@1.8.0_valibot@1.5.0_typescript@7.0.2_/node_modules/@valibot/to-json-schema/dist/index.mjs
1293
1292
  function addError(errors, message) {
1294
1293
  if (errors) {
@@ -1960,14 +1959,6 @@ var fill = /* @__PURE__ */ __name((template, values) => template.replace(PLACEHO
1960
1959
  return String(value);
1961
1960
  }), "fill");
1962
1961
 
1963
- // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
1964
- var EFFECT_LEVELS = ["none", "read", "write"];
1965
- var effectsSchema = strictObject({
1966
- remote: picklist(EFFECT_LEVELS),
1967
- local: picklist(EFFECT_LEVELS)
1968
- });
1969
- var writes = /* @__PURE__ */ __name((effects) => effects === void 0 || effects.remote === "write" || effects.local === "write", "writes");
1970
-
1971
1962
  // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
1972
1963
  var MAX_NEXT_STEPS = 2;
1973
1964
  var COMPACT_FLAG = "--compact";
@@ -2235,88 +2226,157 @@ var STEPS = defineSteps([
2235
2226
  }
2236
2227
  ]);
2237
2228
 
2238
- // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2239
- var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
2240
- var logRecordSchema = strictObject({
2241
- time: isoTime,
2242
- severity: picklist(LOG_SEVERITIES),
2243
- /** The registered event id, `provider.request.failed`: never a sentence, so never content. */
2244
- body: string(),
2245
- run_id: text,
2246
- /** From an MCP caller's `_meta.traceparent`, when it sent one. */
2247
- trace_id: optional(pipe(string(), regex(/^[0-9a-f]{32}$/, "32 lower-case hex digits"))),
2248
- command: string(),
2249
- attributes: record(string(), unknown()),
2250
- resource: strictObject({ service: text, version: text })
2251
- });
2252
- var logEventSchema = strictObject({
2253
- id: dottedId,
2254
- meaning: text,
2255
- /** Attribute keys every record of this event carries. */
2256
- keys: array(string())
2257
- });
2258
- var defineLogEvents = /* @__PURE__ */ __name((input) => parseRegistry("log events", array(logEventSchema), input, (events) => [
2259
- ...duplicates(events.map((event) => event.id)).map((id) => `"${id}" is listed twice`),
2260
- ...events.flatMap((event) => duplicates(event.keys).map((key) => `${event.id}: key "${key}" is listed twice`))
2261
- ]), "defineLogEvents");
2262
- var LOG_EVENTS = defineLogEvents([
2263
- { id: "command.failed", meaning: "a command ended with an error", keys: ["code", "reason"] }
2264
- ]);
2265
- var LOG_ATTRIBUTE_KEYS = [
2266
- "code",
2267
- "count",
2268
- "durationMs",
2269
- "errorClass",
2270
- "errorCode",
2271
- "event",
2272
- "frames",
2273
- "operation",
2274
- "outcome",
2275
- "reason",
2276
- "status"
2277
- ];
2278
- var CONTENT_WORDS = /* @__PURE__ */ new Set([
2279
- "authorization",
2280
- "body",
2281
- "caption",
2282
- "content",
2283
- "cookie",
2284
- "credential",
2285
- "credentials",
2286
- "email",
2287
- "password",
2288
- "phone",
2289
- "query",
2290
- "secret",
2291
- "text",
2292
- "title",
2293
- "token"
2294
- ]);
2295
- var CONTENT_LAST_WORDS = /* @__PURE__ */ new Set(["message", "name"]);
2296
- var wordsOf = /* @__PURE__ */ __name((key) => key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_.-]+/).filter(Boolean).map((word2) => word2.toLowerCase()), "wordsOf");
2297
- var isContentKey = /* @__PURE__ */ __name((key) => {
2298
- const words = wordsOf(key);
2299
- return words.some((word2) => CONTENT_WORDS.has(word2)) || CONTENT_LAST_WORDS.has(words.at(-1) ?? "");
2300
- }, "isContentKey");
2301
- var TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;
2302
- var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
2303
- if (typeof traceparent !== "string")
2304
- return void 0;
2305
- const match = TRACEPARENT.exec(traceparent.trim());
2306
- if (!match)
2307
- return void 0;
2308
- const [, version, traceId = "", parentId = "", , rest] = match;
2309
- if (version === "ff" || version === "00" && rest !== void 0)
2229
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
2230
+ var recognise = /* @__PURE__ */ __name((failure) => {
2231
+ if (isCliError(failure))
2232
+ return failure;
2233
+ if (!(failure instanceof Error) || failure.name !== "CliError")
2310
2234
  return void 0;
2311
- if (/^0+$/.test(traceId) || /^0+$/.test(parentId))
2235
+ const { code, details } = failure;
2236
+ if (!errorCodes.includes(code))
2312
2237
  return void 0;
2313
- return traceId;
2314
- }, "traceIdOf");
2238
+ return {
2239
+ code,
2240
+ message: failure.message,
2241
+ details: typeof details === "object" && details !== null ? details : {}
2242
+ };
2243
+ }, "recognise");
2244
+ var reasonFor = /* @__PURE__ */ __name((code, named, reasons) => reasons.find((entry) => entry.reason === named && entry.code === code) ?? BASE_REASONS.find((entry) => entry.reason === named && entry.code === code) ?? // The first base reason for each code is its fallback.
2245
+ BASE_REASONS.find((entry) => entry.code === code), "reasonFor");
2246
+ var nextFor = /* @__PURE__ */ __name((reason, details, context) => {
2247
+ const definition = reason.step ? context.steps?.find((step) => step.id === reason.step) : void 0;
2248
+ if (!definition)
2249
+ return [];
2250
+ const known = new Set(definition.kind === "command" ? definition.args.map((arg) => arg.name) : []);
2251
+ const args = Object.fromEntries(Object.entries(details).filter(([key, value]) => known.has(key) && value !== void 0));
2252
+ try {
2253
+ return [stepOf(definition, { args, ...context.targets ? { targets: context.targets } : {} })];
2254
+ } catch {
2255
+ return [];
2256
+ }
2257
+ }, "nextFor");
2258
+ var TRANSIENT = [
2259
+ "rate_limited",
2260
+ "timeout",
2261
+ "network_error",
2262
+ "provider_unavailable"
2263
+ ];
2264
+ var retryOf = /* @__PURE__ */ __name((code, details, effects) => {
2265
+ const transient = details.retryable !== false && (TRANSIENT.includes(code) || code === "provider_error" && details.retryable === true);
2266
+ const safe = code !== "outcome_unknown" && transient && (!writes(effects) || details.sent === false);
2267
+ const after = details.retry_after_ms;
2268
+ return safe && typeof after === "number" && Number.isInteger(after) && after >= 0 ? { safe, after_ms: after } : { safe };
2269
+ }, "retryOf");
2270
+ var errorObjectOf = /* @__PURE__ */ __name((failure, context = {}) => {
2271
+ const reasons = context.reasons ?? [];
2272
+ const recognised = recognise(failure);
2273
+ if (!recognised) {
2274
+ const reason2 = reasonFor(CRASH_CODE, CRASH_REASON, reasons);
2275
+ return {
2276
+ error: {
2277
+ code: CRASH_CODE,
2278
+ reason: reason2.reason,
2279
+ message: reason2.message,
2280
+ retry: { safe: false },
2281
+ ...context.runId ? { run_id: context.runId } : {}
2282
+ }
2283
+ };
2284
+ }
2285
+ const { code, message, details } = recognised;
2286
+ const reason = reasonFor(code, details.reason, reasons);
2287
+ const allowed = /* @__PURE__ */ new Set([...COMMON_DETAILS, ...context.details ?? [], ...reason.details]);
2288
+ allowed.delete("cause");
2289
+ const kept = Object.fromEntries(Object.entries(details).filter(([key, value]) => allowed.has(key) && value !== void 0));
2290
+ const next = nextFor(reason, details, context);
2291
+ const runId = context.runId ?? (typeof details.run_id === "string" ? details.run_id : void 0);
2292
+ return {
2293
+ error: {
2294
+ code,
2295
+ reason: reason.reason,
2296
+ message,
2297
+ ...typeof details.param === "string" ? { param: details.param } : {},
2298
+ ...Object.keys(kept).length > 0 ? { details: kept } : {},
2299
+ ...next.length > 0 ? { next } : {},
2300
+ retry: retryOf(code, details, context.effects),
2301
+ ...runId ? { run_id: runId } : {}
2302
+ }
2303
+ };
2304
+ }, "errorObjectOf");
2305
+ var exitCodeOfError = /* @__PURE__ */ __name(({ error }) => error.code === CRASH_CODE ? GENERIC_FAILURE : EXIT_CODES[error.code], "exitCodeOfError");
2306
+ var exitCodeOfAnswer = /* @__PURE__ */ __name((meta, partial2 = false) => {
2307
+ if (meta.complete || partial2)
2308
+ return 0;
2309
+ const code = meta.issues?.[0]?.code;
2310
+ return code === void 0 ? GENERIC_FAILURE : EXIT_CODES[code];
2311
+ }, "exitCodeOfAnswer");
2312
+ var kebab = /* @__PURE__ */ __name((name) => name.replaceAll("_", "-"), "kebab");
2313
+ var commandLine = /* @__PURE__ */ __name((cli, step) => [
2314
+ cli,
2315
+ step.command,
2316
+ ...Object.entries(step.args).map(([name, value]) => value === true ? `--${kebab(name)}` : `--${kebab(name)} ${JSON.stringify(value)}`)
2317
+ ].join(" "), "commandLine");
2318
+ var STACK_FRAMES = 10;
2319
+ var errorRecordOf = /* @__PURE__ */ __name((failure, object2, options) => {
2320
+ const thrown = failure instanceof Error ? failure : void 0;
2321
+ const { cause, ...details } = recognise(failure)?.details ?? {};
2322
+ const stack = thrown?.stack?.split("\n").slice(1, STACK_FRAMES + 1).map((line) => visibleControls(line.trim()));
2323
+ const reason = thrown?.cause ?? cause;
2324
+ return {
2325
+ time: (options.time ?? /* @__PURE__ */ new Date()).toISOString(),
2326
+ severity: "error",
2327
+ body: "command.failed",
2328
+ ...object2.error.run_id ? { run_id: object2.error.run_id } : {},
2329
+ command: options.command,
2330
+ attributes: {
2331
+ code: object2.error.code,
2332
+ reason: object2.error.reason,
2333
+ message: object2.error.message,
2334
+ ...Object.keys(details).length > 0 ? { details } : {},
2335
+ ...thrown ? { name: thrown.name, thrown_message: visibleControls(thrown.message) } : { thrown: String(failure) },
2336
+ ...reason === void 0 ? {} : { cause: visibleControls(reason instanceof Error ? reason.message : String(reason)) },
2337
+ ...stack && stack.length > 0 ? { stack } : {}
2338
+ },
2339
+ resource: { service: options.service, version: options.version }
2340
+ };
2341
+ }, "errorRecordOf");
2342
+ var renderError = /* @__PURE__ */ __name((object2, options) => {
2343
+ if (!options.interactive)
2344
+ return [JSON.stringify(object2), ...options.record ? [JSON.stringify(options.record)] : []].join("\n");
2345
+ const { message, next, run_id: runId } = object2.error;
2346
+ const step = next?.[0];
2347
+ return [
2348
+ `\u2717 ${visibleControls(message)}`,
2349
+ ...step?.kind === "command" ? [`\u2192 ${visibleControls(step.why)}: ${visibleControls(step.line ?? commandLine(options.cli, step))}`] : step ? [`\u2192 ${visibleControls(step.why)}`] : [],
2350
+ ...options.record ? [JSON.stringify(options.record, null, 2)] : runId ? [`details: ${options.cli} runs show ${runId}`] : []
2351
+ ].join("\n");
2352
+ }, "renderError");
2353
+ var mcpErrorResult = /* @__PURE__ */ __name((object2) => ({
2354
+ content: [{ type: "text", text: JSON.stringify(object2) }],
2355
+ structuredContent: object2,
2356
+ isError: true
2357
+ }), "mcpErrorResult");
2358
+ var catchCrashes = /* @__PURE__ */ __name((options) => {
2359
+ const target = options.target ?? process;
2360
+ const write = options.write ?? ((text2) => process.stderr.write(`${text2}
2361
+ `));
2362
+ const exit = options.exit ?? ((code) => process.exit(code));
2363
+ const crashed = /* @__PURE__ */ __name((failure) => {
2364
+ const object2 = errorObjectOf(failure, options);
2365
+ write(renderError(object2, { cli: options.cli, interactive: options.interactive }));
2366
+ exit(exitCodeOfError(object2));
2367
+ }, "crashed");
2368
+ target.on("uncaughtException", crashed);
2369
+ target.on("unhandledRejection", crashed);
2370
+ return () => {
2371
+ target.off("uncaughtException", crashed);
2372
+ target.off("unhandledRejection", crashed);
2373
+ };
2374
+ }, "catchCrashes");
2315
2375
 
2316
2376
  export {
2317
- errorCodes,
2318
- CliError,
2319
- isCliError,
2377
+ EXIT_CODES,
2378
+ exitCodeFor,
2379
+ GENERIC_FAILURE,
2320
2380
  getDotPath,
2321
2381
  check,
2322
2382
  description,
@@ -2369,6 +2429,7 @@ export {
2369
2429
  word,
2370
2430
  SNAKE_CASE,
2371
2431
  text,
2432
+ dottedId,
2372
2433
  RegistryError,
2373
2434
  parseRegistry,
2374
2435
  duplicates,
@@ -2382,16 +2443,17 @@ export {
2382
2443
  itemEnvelopeSchema,
2383
2444
  jsonlOf,
2384
2445
  CRASH_CODE,
2385
- CRASH_REASON,
2386
2446
  errorObjectSchema,
2387
2447
  defineReasons,
2388
- COMMON_DETAILS,
2389
- BASE_REASONS,
2390
2448
  defineSteps,
2391
2449
  stepOf,
2392
2450
  STEPS,
2393
- defineLogEvents,
2394
- LOG_ATTRIBUTE_KEYS,
2395
- isContentKey,
2396
- traceIdOf
2451
+ retryOf,
2452
+ errorObjectOf,
2453
+ exitCodeOfError,
2454
+ exitCodeOfAnswer,
2455
+ errorRecordOf,
2456
+ renderError,
2457
+ mcpErrorResult,
2458
+ catchCrashes
2397
2459
  };
@@ -2,14 +2,14 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  storePath
5
- } from "./chunk-TRRRRGMI.js";
5
+ } from "./chunk-63YKD7YA.js";
6
6
  import {
7
- resolvePaths,
8
- singleLine
9
- } from "./chunk-34USFPBF.js";
7
+ resolvePaths
8
+ } from "./chunk-NTW5ZE47.js";
10
9
  import {
11
- CliError
12
- } from "./chunk-EARO464A.js";
10
+ CliError,
11
+ singleLine
12
+ } from "./chunk-CCHHEMPM.js";
13
13
  import {
14
14
  __name
15
15
  } from "./chunk-ZVVMGPBJ.js";
@@ -7,11 +7,13 @@ import {
7
7
  describeOptions,
8
8
  keyForCommand,
9
9
  metaOf
10
- } from "./chunk-AL36NHO6.js";
10
+ } from "./chunk-M7B5IMH3.js";
11
11
  import {
12
- CliError,
13
12
  jsonSchemaOf
14
- } from "./chunk-EARO464A.js";
13
+ } from "./chunk-77M3IAVU.js";
14
+ import {
15
+ CliError
16
+ } from "./chunk-CCHHEMPM.js";
15
17
  import {
16
18
  __name
17
19
  } from "./chunk-ZVVMGPBJ.js";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EARO464A.js";
5
+ } from "./chunk-CCHHEMPM.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  openCache
5
- } from "./chunk-XDOPONC3.js";
5
+ } from "./chunk-VQCWVZWG.js";
6
6
  import {
7
7
  CliError,
8
8
  isCliError
9
- } from "./chunk-EARO464A.js";
9
+ } from "./chunk-CCHHEMPM.js";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  defineReasons
5
- } from "./chunk-EARO464A.js";
5
+ } from "./chunk-77M3IAVU.js";
6
6
 
7
7
  // dist/reasons.js
8
8
  var REASONS = defineReasons([
@@ -26,7 +26,7 @@ var REASONS = defineReasons([
26
26
  ].map(([reason, code, message]) => ({ reason, code, message, details: [] })));
27
27
 
28
28
  // dist/version.js
29
- var VERSION = "0.114.0";
29
+ var VERSION = "0.115.0";
30
30
 
31
31
  // dist/identity.js
32
32
  var TG = {
@@ -63,7 +63,7 @@ import {
63
63
  validateQuery,
64
64
  walkQuery,
65
65
  zonedMoment
66
- } from "./chunk-I6BKSGZQ.js";
66
+ } from "./chunk-QK6VLKG5.js";
67
67
  import {
68
68
  DEFAULT_STEMMERS,
69
69
  DEFAULT_STEMMERS_VERSION,
@@ -76,25 +76,50 @@ import {
76
76
  fold,
77
77
  normalize,
78
78
  parseStemmers
79
- } from "./chunk-OFDMD3YF.js";
79
+ } from "./chunk-OSP335AJ.js";
80
80
  import {
81
81
  DEFAULT_TASK_CATEGORIES,
82
82
  sharedConfigPath,
83
83
  storedTaskCategories,
84
84
  taskCategoriesReader
85
- } from "./chunk-NMVFFWF2.js";
85
+ } from "./chunk-A4BQGSKI.js";
86
86
  import {
87
87
  storePath
88
- } from "./chunk-TRRRRGMI.js";
88
+ } from "./chunk-63YKD7YA.js";
89
89
  import {
90
90
  quietSqliteWarning,
91
91
  storeCapable
92
- } from "./chunk-XDOPONC3.js";
92
+ } from "./chunk-VQCWVZWG.js";
93
93
  import {
94
94
  PRAGMAS,
95
95
  TIME_LIMIT_FUNCTION,
96
96
  TimeLimitReached
97
97
  } from "./chunk-L4CMCC3V.js";
98
+ import {
99
+ array,
100
+ boolean,
101
+ literal,
102
+ maxLength,
103
+ minLength,
104
+ minValue,
105
+ nullable,
106
+ number,
107
+ picklist,
108
+ pipe,
109
+ regex,
110
+ safeInteger,
111
+ safeParse,
112
+ strictObject,
113
+ string
114
+ } from "./chunk-77M3IAVU.js";
115
+ import {
116
+ resolveFrom
117
+ } from "./chunk-Y5E2WNWB.js";
118
+ import {
119
+ CliError,
120
+ isCliError,
121
+ singleLine
122
+ } from "./chunk-CCHHEMPM.js";
98
123
  import {
99
124
  SQLiteTable,
100
125
  TableAliasProxyHandler,
@@ -120,31 +145,6 @@ import {
120
145
  sqliteTable,
121
146
  text
122
147
  } from "./chunk-O7CBGHI7.js";
123
- import {
124
- singleLine
125
- } from "./chunk-34USFPBF.js";
126
- import {
127
- CliError,
128
- array,
129
- boolean,
130
- isCliError,
131
- literal,
132
- maxLength,
133
- minLength,
134
- minValue,
135
- nullable,
136
- number,
137
- picklist,
138
- pipe,
139
- regex,
140
- safeInteger,
141
- safeParse,
142
- strictObject,
143
- string
144
- } from "./chunk-EARO464A.js";
145
- import {
146
- resolveFrom
147
- } from "./chunk-Y5E2WNWB.js";
148
148
  import {
149
149
  __name
150
150
  } from "./chunk-ZVVMGPBJ.js";
@@ -36360,7 +36360,7 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
36360
36360
  var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
36361
36361
  quietSqliteWarning();
36362
36362
  const { drizzle } = await import("./node-GKPRXS5Y.js");
36363
- const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-VUXFVPJ6.js");
36363
+ const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-GIDPALK3.js");
36364
36364
  const client = await nodeClient(path, { readOnly });
36365
36365
  try {
36366
36366
  return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
@@ -36370,7 +36370,7 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
36370
36370
  }
36371
36371
  }, "openUnderNode");
36372
36372
  var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
36373
- const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-DSUCO4TR.js");
36373
+ const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-6B3BL5IV.js");
36374
36374
  const { drizzle } = await import("./bun-XIMM6EHD.js");
36375
36375
  const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
36376
36376
  try {
@@ -0,0 +1,71 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
8
+ var errorCodes = [
9
+ "validation_error",
10
+ "configuration_error",
11
+ "authentication_error",
12
+ "permission_error",
13
+ "not_found",
14
+ "confirmation_required",
15
+ "rate_limited",
16
+ "timeout",
17
+ "network_error",
18
+ "provider_error",
19
+ "provider_unavailable",
20
+ "invalid_response",
21
+ "outcome_unknown",
22
+ "cancelled"
23
+ ];
24
+ var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
25
+ var CliError = class extends Error {
26
+ static {
27
+ __name(this, "CliError");
28
+ }
29
+ code;
30
+ details;
31
+ constructor(code, message, details = {}) {
32
+ super(message);
33
+ this.name = "CliError";
34
+ this.code = code;
35
+ this.details = details;
36
+ Object.defineProperty(this, BRAND, { value: true });
37
+ }
38
+ };
39
+ var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
40
+
41
+ // node_modules/.pnpm/@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
42
+ var CONTROL = (
43
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
44
+ /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
45
+ );
46
+ var SUBDIVISION_FLAG = /\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}/gu;
47
+ var LINE_BREAKS = /[\t\n\u2028\u2029]/g;
48
+ var escaped = /* @__PURE__ */ __name((c) => {
49
+ const code = c.codePointAt(0) ?? 0;
50
+ if (code > 65535)
51
+ return `\\u{${code.toString(16)}}`;
52
+ return code > 255 ? `\\u${code.toString(16).padStart(4, "0")}` : `\\x${code.toString(16).padStart(2, "0")}`;
53
+ }, "escaped");
54
+ var visibleControls = /* @__PURE__ */ __name((text) => {
55
+ let at = 0;
56
+ let result = "";
57
+ for (const flag of text.matchAll(SUBDIVISION_FLAG)) {
58
+ result += text.slice(at, flag.index).replace(CONTROL, escaped) + flag[0];
59
+ at = flag.index + flag[0].length;
60
+ }
61
+ return result + text.slice(at).replace(CONTROL, escaped);
62
+ }, "visibleControls");
63
+ var singleLine = /* @__PURE__ */ __name((text) => visibleControls(text).replace(LINE_BREAKS, escaped), "singleLine");
64
+
65
+ export {
66
+ errorCodes,
67
+ CliError,
68
+ isCliError,
69
+ visibleControls,
70
+ singleLine
71
+ };
@@ -7,7 +7,7 @@ import {
7
7
  commandPathOf,
8
8
  findCommand,
9
9
  outputOf
10
- } from "./chunk-P4YBABUC.js";
10
+ } from "./chunk-AICS3TSF.js";
11
11
  import {
12
12
  Command,
13
13
  Help,
@@ -18,11 +18,13 @@ import {
18
18
  environmentOf,
19
19
  metaOf,
20
20
  takesProfile
21
- } from "./chunk-AL36NHO6.js";
21
+ } from "./chunk-M7B5IMH3.js";
22
22
  import {
23
- CliError,
24
23
  writes
25
- } from "./chunk-EARO464A.js";
24
+ } from "./chunk-77M3IAVU.js";
25
+ import {
26
+ CliError
27
+ } from "./chunk-CCHHEMPM.js";
26
28
  import {
27
29
  __name
28
30
  } from "./chunk-ZVVMGPBJ.js";
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EARO464A.js";
5
+ } from "./chunk-CCHHEMPM.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";