@wirecat/tg-cli 0.127.0 → 0.128.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 (97) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bundle/{adapter-EZFS2UR6.js → adapter-JOI34QLS.js} +43 -43
  3. package/dist/bundle/{all-profiles-TNIUBQK6.js → all-profiles-2BZEE7J2.js} +18 -28
  4. package/dist/bundle/{anthropic-NGIS5LTL.js → anthropic-NW7DL3S3.js} +2 -2
  5. package/dist/bundle/{app-server-RPU76G7D.js → app-server-RUTYKELF.js} +39 -54
  6. package/dist/bundle/{bot-api-QJ6U6BLG.js → bot-api-DW6NAZAQ.js} +44 -44
  7. package/dist/bundle/{bot-history-THULK2C6.js → bot-history-FAJ2W42U.js} +12 -12
  8. package/dist/bundle/{bun-QLSLLP27.js → bun-IVP5LSVI.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-SH5245ZY.js → bun-sqlite-ATPCJ4CT.js} +3 -3
  10. package/dist/bundle/{chunk-4CQ3PV3V.js → chunk-2A3TC52A.js} +7 -7
  11. package/dist/bundle/{chunk-SN52ZGFN.js → chunk-2IL4YDGG.js} +2 -2
  12. package/dist/bundle/{chunk-TGKTIDYS.js → chunk-2QHIOPSA.js} +176 -150
  13. package/dist/bundle/{chunk-ZSS3BH6Z.js → chunk-3UGRMFWK.js} +2 -2
  14. package/dist/bundle/{chunk-QPVCFSVU.js → chunk-4DSIGS2E.js} +5 -5
  15. package/dist/bundle/{chunk-BNM6KNUQ.js → chunk-5AP25FMW.js} +1 -1
  16. package/dist/bundle/{chunk-ERUB3KU3.js → chunk-7D6LI2N7.js} +5 -5
  17. package/dist/bundle/{chunk-FSDLSEZA.js → chunk-7I5NMVX7.js} +1 -1
  18. package/dist/bundle/{chunk-3WI53AA4.js → chunk-AF2XVV5P.js} +648 -239
  19. package/dist/bundle/{chunk-3I3TGKVG.js → chunk-BVCRDHI2.js} +3 -3
  20. package/dist/bundle/{chunk-JF7D2Y4K.js → chunk-E56QE3UC.js} +352 -325
  21. package/dist/bundle/{chunk-J6FHZXNS.js → chunk-EAUHYQUK.js} +40 -48
  22. package/dist/bundle/{chunk-IWJ5OLU6.js → chunk-F4UIBEQK.js} +2 -2
  23. package/dist/bundle/{chunk-DNNYE6PS.js → chunk-FHGAJK4I.js} +16 -13
  24. package/dist/bundle/{chunk-MTU3UP5U.js → chunk-G3PL3R45.js} +1 -1
  25. package/dist/bundle/{chunk-Y7UA7HGL.js → chunk-GYO4WXLG.js} +2 -2
  26. package/dist/bundle/{chunk-LOG65WHO.js → chunk-IHLNXL2D.js} +1 -1
  27. package/dist/bundle/{chunk-P5NJECXX.js → chunk-IIHCSJV2.js} +507 -340
  28. package/dist/bundle/{chunk-4FFKCC7Y.js → chunk-IV2KJQ5F.js} +16 -15
  29. package/dist/bundle/{chunk-EGNQSWPH.js → chunk-J3SX36NE.js} +1 -1
  30. package/dist/bundle/{chunk-CXWAKV2O.js → chunk-JI2PFQFL.js} +5 -5
  31. package/dist/bundle/{chunk-S3XUJPPL.js → chunk-JJGPU24U.js} +4 -4
  32. package/dist/bundle/{chunk-XUAVZ6YX.js → chunk-KF2Q776U.js} +7 -7
  33. package/dist/bundle/{chunk-3CV5TBBR.js → chunk-KKZQK6IK.js} +2 -2
  34. package/dist/bundle/{chunk-VMV5CMLH.js → chunk-LTADKMP5.js} +1 -1
  35. package/dist/bundle/{chunk-X4ECHJNG.js → chunk-MC6FOTCV.js} +98 -6
  36. package/dist/bundle/{chunk-BWHVHPAQ.js → chunk-MDGLKMLD.js} +5 -5
  37. package/dist/bundle/{chunk-APSMQIA4.js → chunk-MGBVVQTU.js} +2 -2
  38. package/dist/bundle/{chunk-JWEKUAVZ.js → chunk-MOUPWPNL.js} +10 -10
  39. package/dist/bundle/{chunk-NBN5OYXH.js → chunk-NXDQXDRN.js} +3 -3
  40. package/dist/bundle/{chunk-GHVRCLJI.js → chunk-ODBK56ZR.js} +1 -1
  41. package/dist/bundle/{chunk-7GE6KMLB.js → chunk-OX6574YV.js} +11 -11
  42. package/dist/bundle/{chunk-2R6ZSE3O.js → chunk-PJA43HVE.js} +2 -2
  43. package/dist/bundle/{chunk-5AOFOJQA.js → chunk-Q3ZO6Q3M.js} +4 -4
  44. package/dist/bundle/{chunk-FD44T7HC.js → chunk-QO4ON2X7.js} +1 -1
  45. package/dist/bundle/{chunk-Y65BQJOY.js → chunk-QYN5RDTZ.js} +2 -2
  46. package/dist/bundle/{chunk-R52ZZZKZ.js → chunk-R4QVV3LN.js} +23 -12
  47. package/dist/bundle/{chunk-UIQMBOXU.js → chunk-RIGNCUZD.js} +1 -1
  48. package/dist/bundle/{chunk-5SN6KFPC.js → chunk-RZFIQMOA.js} +55 -52
  49. package/dist/bundle/{chunk-4MKRKW6V.js → chunk-SDLJJF7E.js} +12 -12
  50. package/dist/bundle/{chunk-HPM47WO3.js → chunk-T2CWSFGY.js} +394 -378
  51. package/dist/bundle/{chunk-JFQZ6BWI.js → chunk-TGUXKG4B.js} +16 -16
  52. package/dist/bundle/{chunk-Y62I2T36.js → chunk-TQFUAKU6.js} +1 -1
  53. package/dist/bundle/{chunk-UW34Z7J3.js → chunk-UURJO46N.js} +1 -1
  54. package/dist/bundle/{chunk-K4VO7S6Q.js → chunk-WG3BF7SA.js} +1 -1
  55. package/dist/bundle/{chunk-YIPOWJPN.js → chunk-WMF6SL5D.js} +1 -1
  56. package/dist/bundle/{chunk-UY2TRFYN.js → chunk-WMUPZ3IY.js} +10 -10
  57. package/dist/bundle/{chunk-H7GAFD4N.js → chunk-WPMJQIEU.js} +1 -1
  58. package/dist/bundle/{chunk-5FDYMMEQ.js → chunk-XYAH6QQO.js} +2 -2
  59. package/dist/bundle/{chunk-YZGIQY2R.js → chunk-YSXDCSBP.js} +33 -23
  60. package/dist/bundle/{chunk-45URY64S.js → chunk-YVV5S2QA.js} +1 -1
  61. package/dist/bundle/{chunk-5KZKVKWU.js → chunk-ZVLYK6CZ.js} +6 -6
  62. package/dist/bundle/{command-contract-DY6Y4TES.js → command-contract-3BSXDYBC.js} +13 -13
  63. package/dist/bundle/{command-server-entry-UG2CLYXI.js → command-server-entry-BU3X4XNL.js} +20 -20
  64. package/dist/bundle/{decode-3NEUZJ2N.js → decode-NXB7E46F.js} +2 -2
  65. package/dist/bundle/{echarts-CN6ZVAJZ.js → echarts-NAXLKJLA.js} +2 -2
  66. package/dist/bundle/{embed-M4EHIKA5.js → embed-LB6ONWHX.js} +3 -3
  67. package/dist/bundle/{embedder-K2XL2UB4.js → embedder-WE7B2RU5.js} +6 -6
  68. package/dist/bundle/{entry-6M55YL2H.js → entry-W6Y52ZRN.js} +6 -6
  69. package/dist/bundle/{first-run-TLJILIOF.js → first-run-NVYNZZA6.js} +5 -5
  70. package/dist/bundle/{first-screen-WME7ILW2.js → first-screen-Z6TVHK6I.js} +14 -14
  71. package/dist/bundle/{instructions-QLC2AXAB.js → instructions-MRUC57NS.js} +1 -1
  72. package/dist/bundle/{node-BAA3T4CH.js → node-G7PMDYQV.js} +2 -2
  73. package/dist/bundle/{node-sqlite-FNYVHQCO.js → node-sqlite-RXWQ3SES.js} +4 -4
  74. package/dist/bundle/{oauth-32T5KL5E.js → oauth-6ZWOL6KX.js} +4 -4
  75. package/dist/bundle/{open-4VQ6FUEI.js → open-V7LMZCFI.js} +2 -2
  76. package/dist/bundle/{openai-HDOKCN3Z.js → openai-P472V4ZM.js} +12 -12
  77. package/dist/bundle/{process-GOUBIWKC.js → process-GSNPENHL.js} +1 -1
  78. package/dist/bundle/{program-QFXJL2R5.js → program-IELITPKT.js} +46 -46
  79. package/dist/bundle/{prompt-YYODWYFO.js → prompt-2CP6CQ5N.js} +2 -2
  80. package/dist/bundle/{recognize-7ZULX5HL.js → recognize-R2DEQ5TC.js} +1 -1
  81. package/dist/bundle/{remote-TUG7M5Y5.js → remote-JG3POFES.js} +6 -6
  82. package/dist/bundle/{rerank-D2EZWG66.js → rerank-TVMR3OLL.js} +4 -4
  83. package/dist/bundle/{serve-MP3GA2XX.js → serve-DBWSMLPH.js} +6 -6
  84. package/dist/bundle/{server-D277L3H3.js → server-EXJ2WNZY.js} +37 -35
  85. package/dist/bundle/server-SXNFFAIR.js +61 -0
  86. package/dist/bundle/{sqlite-runtime-XHZXEOLY.js → sqlite-runtime-AWMY7W4Q.js} +3 -3
  87. package/dist/bundle/{state-YI3W6HGO.js → state-HN44BWNQ.js} +3 -3
  88. package/dist/bundle/{store-C4RFPYPK.js → store-GIYS3LHV.js} +9 -9
  89. package/dist/bundle/{store-CIZPJFWE.js → store-LOVKYQDC.js} +11 -11
  90. package/dist/bundle/store-maintenance-command-X3VOYNCG.js +52 -0
  91. package/dist/bundle/tg.js +3 -3
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/package.json +2 -2
  95. package/dist/bundle/chunk-ZIPUVOGT.js +0 -76
  96. package/dist/bundle/server-GEP7QXGI.js +0 -62
  97. package/dist/bundle/store-maintenance-command-JNDYWFD2.js +0 -52
@@ -12,10 +12,7 @@ import {
12
12
  refuseWriteBeforeConnecting,
13
13
  registerPrompts,
14
14
  syncsFirst
15
- } from "./chunk-YZGIQY2R.js";
16
- import {
17
- answeredWire
18
- } from "./chunk-ZIPUVOGT.js";
15
+ } from "./chunk-YSXDCSBP.js";
19
16
  import {
20
17
  BinaryResource,
21
18
  Picture,
@@ -36,30 +33,31 @@ import {
36
33
  tool,
37
34
  toolKey,
38
35
  toolsFromCommands
39
- } from "./chunk-4FFKCC7Y.js";
36
+ } from "./chunk-IV2KJQ5F.js";
40
37
  import {
41
38
  agentJson,
42
39
  skillResource
43
- } from "./chunk-R52ZZZKZ.js";
40
+ } from "./chunk-R4QVV3LN.js";
44
41
  import {
45
42
  StdioServerTransport,
43
+ answeredWire,
46
44
  callerOf,
47
45
  callingAgent,
48
46
  serveStdio
49
- } from "./chunk-X4ECHJNG.js";
47
+ } from "./chunk-MC6FOTCV.js";
50
48
  import {
51
49
  instructions
52
- } from "./chunk-LOG65WHO.js";
50
+ } from "./chunk-IHLNXL2D.js";
53
51
  import {
54
52
  McpServer,
55
53
  ResourceTemplate
56
54
  } from "./chunk-5D4AEUVA.js";
57
55
  import {
58
56
  mcpHttpMarker
59
- } from "./chunk-5AOFOJQA.js";
57
+ } from "./chunk-Q3ZO6Q3M.js";
60
58
  import {
61
59
  connectedFor
62
- } from "./chunk-DNNYE6PS.js";
60
+ } from "./chunk-FHGAJK4I.js";
63
61
  import {
64
62
  capability,
65
63
  dateWindow,
@@ -69,25 +67,26 @@ import {
69
67
  servicesFor,
70
68
  storedDeps,
71
69
  wholeList
72
- } from "./chunk-P5NJECXX.js";
70
+ } from "./chunk-IIHCSJV2.js";
73
71
  import {
74
72
  warmEmbedders
75
- } from "./chunk-QPVCFSVU.js";
73
+ } from "./chunk-4DSIGS2E.js";
76
74
  import {
77
75
  stdinFieldOf
78
- } from "./chunk-GHVRCLJI.js";
76
+ } from "./chunk-ODBK56ZR.js";
79
77
  import {
80
78
  openStore,
81
79
  pdfPreviewLimits
82
- } from "./chunk-HPM47WO3.js";
80
+ } from "./chunk-T2CWSFGY.js";
83
81
  import {
84
82
  findCommand
85
- } from "./chunk-5FDYMMEQ.js";
83
+ } from "./chunk-XYAH6QQO.js";
86
84
  import {
87
85
  DEFAULT_OUTPUT_BYTES,
88
86
  changesAuthorityAt,
89
87
  describeProgram,
90
88
  environmentOf,
89
+ fetchesAt,
91
90
  fetchesOnlyAt,
92
91
  itemOf,
93
92
  judgedTargets,
@@ -98,22 +97,23 @@ import {
98
97
  rootOf2 as rootOf,
99
98
  sealed,
100
99
  snakeKeys
101
- } from "./chunk-TGKTIDYS.js";
100
+ } from "./chunk-2QHIOPSA.js";
102
101
  import {
103
102
  withCaller
104
- } from "./chunk-5KZKVKWU.js";
103
+ } from "./chunk-ZVLYK6CZ.js";
105
104
  import {
106
105
  readOnlyLockOf
107
- } from "./chunk-45URY64S.js";
106
+ } from "./chunk-YVV5S2QA.js";
108
107
  import {
109
108
  timezoneOf,
110
109
  typedCommand
111
- } from "./chunk-3WI53AA4.js";
110
+ } from "./chunk-AF2XVV5P.js";
112
111
  import {
113
112
  isCliFailure
114
- } from "./chunk-APSMQIA4.js";
113
+ } from "./chunk-MGBVVQTU.js";
115
114
  import {
116
115
  description,
116
+ errorObjectOf,
117
117
  integer,
118
118
  maxValue,
119
119
  mcpErrorResult,
@@ -136,10 +136,10 @@ import {
136
136
  __name
137
137
  } from "./chunk-ZVVMGPBJ.js";
138
138
 
139
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/server.js
139
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/server.js
140
140
  import { randomUUID } from "node:crypto";
141
141
 
142
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/agent-log.js
142
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/agent-log.js
143
143
  var agentLog = /* @__PURE__ */ __name((open) => {
144
144
  let held;
145
145
  return {
@@ -158,7 +158,7 @@ var agentLog = /* @__PURE__ */ __name((open) => {
158
158
  };
159
159
  }, "agentLog");
160
160
 
161
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/resources.js
161
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/resources.js
162
162
  var LISTED = 100;
163
163
  var registerResources = /* @__PURE__ */ __name((server, session, { command, name, limit, recorded, withStore, messenger, guard, assertRead }) => {
164
164
  server.registerResource("chat", new ResourceTemplate(`${command}://chat/{id}`, {
@@ -196,7 +196,7 @@ var registerResources = /* @__PURE__ */ __name((server, session, { command, name
196
196
  });
197
197
  }, "registerResources");
198
198
 
199
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/session.js
199
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/session.js
200
200
  var HARMLESS = /* @__PURE__ */ new Set(["validation_error", "not_found", "permission_error", "confirmation_required", "rate_limited"]);
201
201
  var harmless = /* @__PURE__ */ __name((code) => HARMLESS.has(code), "harmless");
202
202
  var MessengerSession = class {
@@ -271,7 +271,7 @@ var MessengerSession = class {
271
271
  }
272
272
  };
273
273
 
274
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/tools/attachments.js
274
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/tools/attachments.js
275
275
  var attachmentsTools = /* @__PURE__ */ __name((messenger) => {
276
276
  const _command = messenger.app.command;
277
277
  return {
@@ -325,7 +325,7 @@ var attachmentsTools = /* @__PURE__ */ __name((messenger) => {
325
325
  };
326
326
  }, "attachmentsTools");
327
327
 
328
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/tools/messages-photo.js
328
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/tools/messages-photo.js
329
329
  var PHOTO_LIMIT = 512 * 1024;
330
330
  var IMAGE_TYPES = [
331
331
  ["image/jpeg", (b) => b[0] === 255 && b[1] === 216 && b[2] === 255],
@@ -341,14 +341,16 @@ var messagesPhotoTools = /* @__PURE__ */ __name((messenger) => ({
341
341
  input: object({
342
342
  chat: chatOf(messenger),
343
343
  message,
344
- index: optional(pipe(number(), integer(), minValue(0), description("attachment index from 0; omit for the first photo")))
344
+ attachment: optional(pipe(number(), integer(), minValue(1), description("which file of the message, from 1; omit for the first photo")))
345
345
  }),
346
346
  annotations: READ,
347
347
  online: /* @__PURE__ */ __name(async (adapter, args, defaults) => {
348
348
  const { id: chatId } = await adapter.resolve(args.chat);
349
349
  const saveIt = `the owner can save it with \`${typedCommand(messenger.app.command, `messages download ${chatId} ${args.message}`)}\``;
350
350
  const { files } = await capability(adapter, "download", "download attachments")(chatId, args.message);
351
- const photo = args.index === void 0 ? files.find((file) => file.kind === "photo") : files[args.index];
351
+ if (args.attachment !== void 0 && args.attachment > files.length)
352
+ throw new CliError("not_found", `message ${args.message} has ${files.length} file${files.length === 1 ? "" : "s"}, no file ${args.attachment}`);
353
+ const photo = args.attachment === void 0 ? files.find((file) => file.kind === "photo") : files[args.attachment - 1];
352
354
  if (!photo) {
353
355
  const kinds = files.map((file) => file.kind).join(", ");
354
356
  throw new CliError(files.length === 0 ? "not_found" : "validation_error", files.length === 0 ? `message ${args.message} has no photo` : `the message has a ${kinds}, not a photo \u2014 ${saveIt}`);
@@ -379,7 +381,7 @@ var readUpTo = /* @__PURE__ */ __name(async (file, limit, saveIt) => {
379
381
  return new Uint8Array(Buffer.concat(chunks));
380
382
  }, "readUpTo");
381
383
 
382
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/tools/stats.js
384
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/tools/stats.js
383
385
  var statsTools = /* @__PURE__ */ __name((messenger) => ({
384
386
  stats_charts: tool({
385
387
  title: "A chart from a chat's statistics",
@@ -416,14 +418,14 @@ var statsTools = /* @__PURE__ */ __name((messenger) => ({
416
418
  })
417
419
  }), "statsTools");
418
420
 
419
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/tools.js
421
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/tools.js
420
422
  var pictureTools = /* @__PURE__ */ __name((messenger) => Object.fromEntries(Object.entries({
421
423
  ...messagesPhotoTools(messenger),
422
424
  ...attachmentsTools(messenger),
423
425
  ...statsTools(messenger)
424
426
  }).map(([name, definition]) => [name, { ...definition, input: strictObject(definition.input.entries) }])), "pictureTools");
425
427
 
426
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/server.js
428
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/server.js
427
429
  var PER_RUN = /* @__PURE__ */ new Set([
428
430
  "streams",
429
431
  "stdin",
@@ -482,7 +484,7 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
482
484
  return void 0;
483
485
  }
484
486
  }, "stdin");
485
- const syncAllowed = /* @__PURE__ */ __name((path) => syncsFirst(messenger) && levelOf("messages.sync-first") === "allow" && (path[0] !== "stats" || levelOf(`${path.join(".")}.sync-first`) === "allow"), "syncAllowed");
487
+ const syncAllowed = /* @__PURE__ */ __name((path) => syncsFirst(messenger) && fetchesAt(levelOf("messages.sync-first")) && (path[0] !== "stats" || fetchesAt(levelOf(`${path.join(".")}.sync-first`))), "syncAllowed");
486
488
  const generated = toolsFromCommands(program.commands, {
487
489
  includeUnavailable: true,
488
490
  exclude: [["bot"]],
@@ -588,8 +590,8 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
588
590
  });
589
591
  }), "invoke");
590
592
  let queue = Promise.resolve();
591
- const queued = /* @__PURE__ */ __name((one, input, env, caller) => {
592
- const next = queue.then(() => invoke(one, input, env, caller));
593
+ const queued = /* @__PURE__ */ __name((one, input, env, caller, signal) => {
594
+ const next = queue.then(() => signal?.aborted ? { error: errorObjectOf(new CliError("cancelled", `${one.command} was cancelled before it started`)) } : invoke(one, input, env, caller));
593
595
  queue = next.catch(() => void 0);
594
596
  return next;
595
597
  }, "queued");
@@ -605,7 +607,7 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
605
607
  const traceparent = ctx?.mcpReq?._meta?.traceparent;
606
608
  const env = typeof traceparent === "string" ? { ...context.env, TRACEPARENT: traceparent } : context.env;
607
609
  const caller = callerOf(ctx, keyOfCommand(one.command), source);
608
- const answer = await withCaller(caller, () => queued(one, args, env, caller));
610
+ const answer = await withCaller(caller, () => queued(one, args, env, caller, ctx?.mcpReq?.signal));
609
611
  const result = "error" in answer ? mcpErrorResult(JSON.parse(agentJson(answer.error))) : (() => {
610
612
  try {
611
613
  return answered(envelope(one.command, answer.result), DEFAULT_OUTPUT_BYTES, targets);
@@ -661,7 +663,7 @@ var createServer = /* @__PURE__ */ __name((command, context, messenger, sessionO
661
663
  spawnJob: sessionOptions.spawnJob,
662
664
  limit: settings.limit,
663
665
  get syncAllowed() {
664
- return syncsFirst(messenger) && levelOf("messages.sync-first") === "allow";
666
+ return syncsFirst(messenger) && fetchesAt(levelOf("messages.sync-first"));
665
667
  },
666
668
  guard,
667
669
  settings,
@@ -728,18 +730,8 @@ var serveOverStdio = /* @__PURE__ */ __name(async (command, context, messenger,
728
730
  transport: new StdioServerTransport(wire.input, wire.output),
729
731
  onerror: /* @__PURE__ */ __name((error) => context.renderer.note(`mcp: ${error.message}`), "onerror")
730
732
  });
731
- const ended = await new Promise((resolve) => {
732
- wire.ended.then(() => resolve("input"));
733
- if (own)
734
- signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
735
- else {
736
- process.once("SIGINT", () => resolve("stopped"));
737
- process.once("SIGTERM", () => resolve("stopped"));
738
- }
739
- });
733
+ await wire.finished(own ? signal : void 0);
740
734
  try {
741
- if (ended === "input")
742
- await wire.answered();
743
735
  wire.release();
744
736
  await handle.close();
745
737
  await session.close();
@@ -750,7 +742,7 @@ var serveOverStdio = /* @__PURE__ */ __name(async (command, context, messenger,
750
742
  }, "serveOverStdio");
751
743
  var serveOverHttpUntilStopped = /* @__PURE__ */ __name(async (command, context, messenger, options, http) => {
752
744
  const { session, embedders, build, log } = createServer(command, context, messenger, options);
753
- const { serveOverHttp } = await import("./serve-MP3GA2XX.js");
745
+ const { serveOverHttp } = await import("./serve-DBWSMLPH.js");
754
746
  const appName = messenger.app.command;
755
747
  const appEnvPrefix = messenger.app.envPrefix;
756
748
  const listening = await serveOverHttp(build, {
@@ -5,7 +5,7 @@ import {
5
5
  id,
6
6
  text,
7
7
  time
8
- } from "./chunk-3WI53AA4.js";
8
+ } from "./chunk-AF2XVV5P.js";
9
9
  import {
10
10
  array,
11
11
  nullable,
@@ -18,7 +18,7 @@ import {
18
18
  unknown
19
19
  } from "./chunk-XS5C5TQ7.js";
20
20
 
21
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/entities/note.js
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/entities/note.js
22
22
  var link = {
23
23
  target_text: nullable(text),
24
24
  kind: text,
@@ -16,10 +16,10 @@ import {
16
16
  servicesFor,
17
17
  throughWrapper,
18
18
  withFileLockAsync
19
- } from "./chunk-P5NJECXX.js";
19
+ } from "./chunk-IIHCSJV2.js";
20
20
  import {
21
21
  servingProfiles
22
- } from "./chunk-SN52ZGFN.js";
22
+ } from "./chunk-2IL4YDGG.js";
23
23
  import {
24
24
  chatReferenceOf,
25
25
  ensureAccount,
@@ -27,7 +27,7 @@ import {
27
27
  isId,
28
28
  openStore,
29
29
  pickPerson
30
- } from "./chunk-HPM47WO3.js";
30
+ } from "./chunk-T2CWSFGY.js";
31
31
  import {
32
32
  CEILING_KEY,
33
33
  WRITE_KEYS,
@@ -36,6 +36,7 @@ import {
36
36
  codeOf,
37
37
  currentOperation,
38
38
  environmentOf,
39
+ fetchesUnder,
39
40
  issueMessage,
40
41
  keyForCommand,
41
42
  levelFor,
@@ -47,13 +48,13 @@ import {
47
48
  rememberAccount,
48
49
  rootOf2 as rootOf,
49
50
  skipFlagFor
50
- } from "./chunk-TGKTIDYS.js";
51
+ } from "./chunk-2QHIOPSA.js";
51
52
  import {
52
53
  providerErrorKey
53
- } from "./chunk-5KZKVKWU.js";
54
+ } from "./chunk-ZVLYK6CZ.js";
54
55
  import {
55
56
  isCliFailure
56
- } from "./chunk-APSMQIA4.js";
57
+ } from "./chunk-MGBVVQTU.js";
57
58
  import {
58
59
  resolvePaths
59
60
  } from "./chunk-NM5GBJME.js";
@@ -64,7 +65,7 @@ import {
64
65
  __name
65
66
  } from "./chunk-ZVVMGPBJ.js";
66
67
 
67
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
68
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
68
69
  import { openSync } from "node:fs";
69
70
  import { createInterface } from "node:readline";
70
71
  import { ReadStream } from "node:tty";
@@ -119,7 +120,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
119
120
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
120
121
  }, "terminalAsker");
121
122
 
122
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/sends/pace.js
123
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/pace.js
123
124
  import { readFileSync, renameSync, writeFileSync } from "node:fs";
124
125
  import { join } from "node:path";
125
126
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -214,7 +215,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
214
215
  await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
215
216
  }, "waitForTurn");
216
217
 
217
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
218
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
218
219
  var pathOf = /* @__PURE__ */ __name((command) => {
219
220
  const words = [];
220
221
  for (let at = command; at?.parent; at = at.parent)
@@ -274,7 +275,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
274
275
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
275
276
  }, "refuseUnknownPermissionKeys");
276
277
 
277
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
278
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
278
279
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
279
280
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
280
281
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -371,7 +372,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
371
372
  });
372
373
  }, "flooded");
373
374
 
374
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
375
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
375
376
  var observed = /* @__PURE__ */ __name((messenger, events) => {
376
377
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
377
378
  const write = currentOperation();
@@ -470,7 +471,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
470
471
  counts[part] = (counts[part] ?? 0) + items.length;
471
472
  }, "byPart");
472
473
 
473
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
474
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
474
475
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
475
476
  var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
476
477
  let warned = false;
@@ -1046,7 +1047,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1046
1047
  }
1047
1048
  }, "keep");
1048
1049
 
1049
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1050
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1050
1051
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1051
1052
  let opened;
1052
1053
  return {
@@ -1324,6 +1325,8 @@ var refuseLocalWrite = /* @__PURE__ */ __name((context, command, permission) =>
1324
1325
  const { level, key } = levelFor(settings.permissions, permission);
1325
1326
  if (level === "allow" || level === "ask" && context.agent)
1326
1327
  return;
1328
+ if (fetchesUnder(level, permission))
1329
+ return;
1327
1330
  if (key === CEILING_KEY)
1328
1331
  throw ceilingRefusal(permission, command);
1329
1332
  throw new CliError(level === "ask" ? "confirmation_required" : "permission_error", `profile ${settings.profile} does not let ${permission} write (permissions.${key} is ${level}, from the ${settings.permissionSources[key ?? ""] ?? "default"}); to allow it: ${command} ${settings.profile} config set permissions.${permission} allow`, { permission });
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
8
8
  var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
9
9
  `The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
10
10
  "Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",
@@ -4,7 +4,7 @@ import {
4
4
  MAX_SECRET_INPUT,
5
5
  bufferedInput,
6
6
  inputPolicy
7
- } from "./chunk-FSDLSEZA.js";
7
+ } from "./chunk-7I5NMVX7.js";
8
8
  import {
9
9
  CliError
10
10
  } from "./chunk-7KCBPAQS.js";
@@ -12,7 +12,7 @@ import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
16
16
  import { createInterface } from "node:readline";
17
17
  import { Writable } from "node:stream";
18
18
  var EMPTY_TRIES = 3;
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
8
8
  var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
9
9
  const all = typeof profile !== "string";
10
10
  const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");