openclaw-telegram-manager 2.1.0 → 2.2.1

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 (77) hide show
  1. package/README.md +10 -3
  2. package/dist/commands/archive.d.ts.map +1 -1
  3. package/dist/commands/archive.js +4 -6
  4. package/dist/commands/archive.js.map +1 -1
  5. package/dist/commands/autopilot.d.ts.map +1 -1
  6. package/dist/commands/autopilot.js +15 -16
  7. package/dist/commands/autopilot.js.map +1 -1
  8. package/dist/commands/daily-report.d.ts +4 -0
  9. package/dist/commands/daily-report.d.ts.map +1 -0
  10. package/dist/commands/daily-report.js +155 -0
  11. package/dist/commands/daily-report.js.map +1 -0
  12. package/dist/commands/doctor-all.d.ts.map +1 -1
  13. package/dist/commands/doctor-all.js +9 -13
  14. package/dist/commands/doctor-all.js.map +1 -1
  15. package/dist/commands/doctor.d.ts.map +1 -1
  16. package/dist/commands/doctor.js +3 -2
  17. package/dist/commands/doctor.js.map +1 -1
  18. package/dist/commands/help.d.ts.map +1 -1
  19. package/dist/commands/help.js +0 -1
  20. package/dist/commands/help.js.map +1 -1
  21. package/dist/commands/init.d.ts.map +1 -1
  22. package/dist/commands/init.js +10 -15
  23. package/dist/commands/init.js.map +1 -1
  24. package/dist/commands/list.d.ts.map +1 -1
  25. package/dist/commands/list.js +0 -1
  26. package/dist/commands/list.js.map +1 -1
  27. package/dist/commands/rename.d.ts.map +1 -1
  28. package/dist/commands/rename.js +4 -6
  29. package/dist/commands/rename.js.map +1 -1
  30. package/dist/commands/snooze.d.ts.map +1 -1
  31. package/dist/commands/snooze.js +3 -5
  32. package/dist/commands/snooze.js.map +1 -1
  33. package/dist/commands/status.js +2 -2
  34. package/dist/commands/status.js.map +1 -1
  35. package/dist/commands/sync.d.ts.map +1 -1
  36. package/dist/commands/sync.js +1 -4
  37. package/dist/commands/sync.js.map +1 -1
  38. package/dist/commands/upgrade.d.ts.map +1 -1
  39. package/dist/commands/upgrade.js +4 -8
  40. package/dist/commands/upgrade.js.map +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +5 -11
  43. package/dist/index.js.map +1 -1
  44. package/dist/lib/activity.d.ts +3 -0
  45. package/dist/lib/activity.d.ts.map +1 -0
  46. package/dist/lib/activity.js +11 -0
  47. package/dist/lib/activity.js.map +1 -0
  48. package/dist/lib/capsule.d.ts +5 -0
  49. package/dist/lib/capsule.d.ts.map +1 -1
  50. package/dist/lib/capsule.js +15 -1
  51. package/dist/lib/capsule.js.map +1 -1
  52. package/dist/lib/doctor-checks.d.ts +6 -1
  53. package/dist/lib/doctor-checks.d.ts.map +1 -1
  54. package/dist/lib/doctor-checks.js +49 -23
  55. package/dist/lib/doctor-checks.js.map +1 -1
  56. package/dist/lib/include-generator.d.ts.map +1 -1
  57. package/dist/lib/include-generator.js +10 -3
  58. package/dist/lib/include-generator.js.map +1 -1
  59. package/dist/lib/registry.d.ts.map +1 -1
  60. package/dist/lib/registry.js +11 -0
  61. package/dist/lib/registry.js.map +1 -1
  62. package/dist/lib/telegram.d.ts +20 -5
  63. package/dist/lib/telegram.d.ts.map +1 -1
  64. package/dist/lib/telegram.js +60 -32
  65. package/dist/lib/telegram.js.map +1 -1
  66. package/dist/lib/types.d.ts +5 -3
  67. package/dist/lib/types.d.ts.map +1 -1
  68. package/dist/lib/types.js +3 -2
  69. package/dist/lib/types.js.map +1 -1
  70. package/dist/plugin.js +835 -652
  71. package/dist/setup.js +80 -4
  72. package/dist/setup.js.map +1 -1
  73. package/dist/tool.d.ts.map +1 -1
  74. package/dist/tool.js +7 -4
  75. package/dist/tool.js.map +1 -1
  76. package/package.json +1 -1
  77. package/skills/tm/SKILL.md +4 -3
package/dist/plugin.js CHANGED
@@ -60,54 +60,54 @@ var require_polyfills = __commonJS({
60
60
  }
61
61
  var chdir;
62
62
  module.exports = patch;
63
- function patch(fs13) {
63
+ function patch(fs14) {
64
64
  if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
65
- patchLchmod(fs13);
66
- }
67
- if (!fs13.lutimes) {
68
- patchLutimes(fs13);
69
- }
70
- fs13.chown = chownFix(fs13.chown);
71
- fs13.fchown = chownFix(fs13.fchown);
72
- fs13.lchown = chownFix(fs13.lchown);
73
- fs13.chmod = chmodFix(fs13.chmod);
74
- fs13.fchmod = chmodFix(fs13.fchmod);
75
- fs13.lchmod = chmodFix(fs13.lchmod);
76
- fs13.chownSync = chownFixSync(fs13.chownSync);
77
- fs13.fchownSync = chownFixSync(fs13.fchownSync);
78
- fs13.lchownSync = chownFixSync(fs13.lchownSync);
79
- fs13.chmodSync = chmodFixSync(fs13.chmodSync);
80
- fs13.fchmodSync = chmodFixSync(fs13.fchmodSync);
81
- fs13.lchmodSync = chmodFixSync(fs13.lchmodSync);
82
- fs13.stat = statFix(fs13.stat);
83
- fs13.fstat = statFix(fs13.fstat);
84
- fs13.lstat = statFix(fs13.lstat);
85
- fs13.statSync = statFixSync(fs13.statSync);
86
- fs13.fstatSync = statFixSync(fs13.fstatSync);
87
- fs13.lstatSync = statFixSync(fs13.lstatSync);
88
- if (fs13.chmod && !fs13.lchmod) {
89
- fs13.lchmod = function(path14, mode, cb) {
65
+ patchLchmod(fs14);
66
+ }
67
+ if (!fs14.lutimes) {
68
+ patchLutimes(fs14);
69
+ }
70
+ fs14.chown = chownFix(fs14.chown);
71
+ fs14.fchown = chownFix(fs14.fchown);
72
+ fs14.lchown = chownFix(fs14.lchown);
73
+ fs14.chmod = chmodFix(fs14.chmod);
74
+ fs14.fchmod = chmodFix(fs14.fchmod);
75
+ fs14.lchmod = chmodFix(fs14.lchmod);
76
+ fs14.chownSync = chownFixSync(fs14.chownSync);
77
+ fs14.fchownSync = chownFixSync(fs14.fchownSync);
78
+ fs14.lchownSync = chownFixSync(fs14.lchownSync);
79
+ fs14.chmodSync = chmodFixSync(fs14.chmodSync);
80
+ fs14.fchmodSync = chmodFixSync(fs14.fchmodSync);
81
+ fs14.lchmodSync = chmodFixSync(fs14.lchmodSync);
82
+ fs14.stat = statFix(fs14.stat);
83
+ fs14.fstat = statFix(fs14.fstat);
84
+ fs14.lstat = statFix(fs14.lstat);
85
+ fs14.statSync = statFixSync(fs14.statSync);
86
+ fs14.fstatSync = statFixSync(fs14.fstatSync);
87
+ fs14.lstatSync = statFixSync(fs14.lstatSync);
88
+ if (fs14.chmod && !fs14.lchmod) {
89
+ fs14.lchmod = function(path15, mode, cb) {
90
90
  if (cb) process.nextTick(cb);
91
91
  };
92
- fs13.lchmodSync = function() {
92
+ fs14.lchmodSync = function() {
93
93
  };
94
94
  }
95
- if (fs13.chown && !fs13.lchown) {
96
- fs13.lchown = function(path14, uid, gid, cb) {
95
+ if (fs14.chown && !fs14.lchown) {
96
+ fs14.lchown = function(path15, uid, gid, cb) {
97
97
  if (cb) process.nextTick(cb);
98
98
  };
99
- fs13.lchownSync = function() {
99
+ fs14.lchownSync = function() {
100
100
  };
101
101
  }
102
102
  if (platform === "win32") {
103
- fs13.rename = typeof fs13.rename !== "function" ? fs13.rename : (function(fs$rename) {
103
+ fs14.rename = typeof fs14.rename !== "function" ? fs14.rename : (function(fs$rename) {
104
104
  function rename(from, to, cb) {
105
105
  var start = Date.now();
106
106
  var backoff = 0;
107
107
  fs$rename(from, to, function CB(er) {
108
108
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
109
109
  setTimeout(function() {
110
- fs13.stat(to, function(stater, st) {
110
+ fs14.stat(to, function(stater, st) {
111
111
  if (stater && stater.code === "ENOENT")
112
112
  fs$rename(from, to, CB);
113
113
  else
@@ -123,9 +123,9 @@ var require_polyfills = __commonJS({
123
123
  }
124
124
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
125
125
  return rename;
126
- })(fs13.rename);
126
+ })(fs14.rename);
127
127
  }
128
- fs13.read = typeof fs13.read !== "function" ? fs13.read : (function(fs$read) {
128
+ fs14.read = typeof fs14.read !== "function" ? fs14.read : (function(fs$read) {
129
129
  function read(fd, buffer, offset, length, position, callback_) {
130
130
  var callback;
131
131
  if (callback_ && typeof callback_ === "function") {
@@ -133,22 +133,22 @@ var require_polyfills = __commonJS({
133
133
  callback = function(er, _, __) {
134
134
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
135
135
  eagCounter++;
136
- return fs$read.call(fs13, fd, buffer, offset, length, position, callback);
136
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
137
137
  }
138
138
  callback_.apply(this, arguments);
139
139
  };
140
140
  }
141
- return fs$read.call(fs13, fd, buffer, offset, length, position, callback);
141
+ return fs$read.call(fs14, fd, buffer, offset, length, position, callback);
142
142
  }
143
143
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
144
144
  return read;
145
- })(fs13.read);
146
- fs13.readSync = typeof fs13.readSync !== "function" ? fs13.readSync : /* @__PURE__ */ (function(fs$readSync) {
145
+ })(fs14.read);
146
+ fs14.readSync = typeof fs14.readSync !== "function" ? fs14.readSync : /* @__PURE__ */ (function(fs$readSync) {
147
147
  return function(fd, buffer, offset, length, position) {
148
148
  var eagCounter = 0;
149
149
  while (true) {
150
150
  try {
151
- return fs$readSync.call(fs13, fd, buffer, offset, length, position);
151
+ return fs$readSync.call(fs14, fd, buffer, offset, length, position);
152
152
  } catch (er) {
153
153
  if (er.code === "EAGAIN" && eagCounter < 10) {
154
154
  eagCounter++;
@@ -158,11 +158,11 @@ var require_polyfills = __commonJS({
158
158
  }
159
159
  }
160
160
  };
161
- })(fs13.readSync);
162
- function patchLchmod(fs14) {
163
- fs14.lchmod = function(path14, mode, callback) {
164
- fs14.open(
165
- path14,
161
+ })(fs14.readSync);
162
+ function patchLchmod(fs15) {
163
+ fs15.lchmod = function(path15, mode, callback) {
164
+ fs15.open(
165
+ path15,
166
166
  constants.O_WRONLY | constants.O_SYMLINK,
167
167
  mode,
168
168
  function(err, fd) {
@@ -170,80 +170,80 @@ var require_polyfills = __commonJS({
170
170
  if (callback) callback(err);
171
171
  return;
172
172
  }
173
- fs14.fchmod(fd, mode, function(err2) {
174
- fs14.close(fd, function(err22) {
173
+ fs15.fchmod(fd, mode, function(err2) {
174
+ fs15.close(fd, function(err22) {
175
175
  if (callback) callback(err2 || err22);
176
176
  });
177
177
  });
178
178
  }
179
179
  );
180
180
  };
181
- fs14.lchmodSync = function(path14, mode) {
182
- var fd = fs14.openSync(path14, constants.O_WRONLY | constants.O_SYMLINK, mode);
181
+ fs15.lchmodSync = function(path15, mode) {
182
+ var fd = fs15.openSync(path15, constants.O_WRONLY | constants.O_SYMLINK, mode);
183
183
  var threw = true;
184
184
  var ret;
185
185
  try {
186
- ret = fs14.fchmodSync(fd, mode);
186
+ ret = fs15.fchmodSync(fd, mode);
187
187
  threw = false;
188
188
  } finally {
189
189
  if (threw) {
190
190
  try {
191
- fs14.closeSync(fd);
191
+ fs15.closeSync(fd);
192
192
  } catch (er) {
193
193
  }
194
194
  } else {
195
- fs14.closeSync(fd);
195
+ fs15.closeSync(fd);
196
196
  }
197
197
  }
198
198
  return ret;
199
199
  };
200
200
  }
201
- function patchLutimes(fs14) {
202
- if (constants.hasOwnProperty("O_SYMLINK") && fs14.futimes) {
203
- fs14.lutimes = function(path14, at, mt, cb) {
204
- fs14.open(path14, constants.O_SYMLINK, function(er, fd) {
201
+ function patchLutimes(fs15) {
202
+ if (constants.hasOwnProperty("O_SYMLINK") && fs15.futimes) {
203
+ fs15.lutimes = function(path15, at, mt, cb) {
204
+ fs15.open(path15, constants.O_SYMLINK, function(er, fd) {
205
205
  if (er) {
206
206
  if (cb) cb(er);
207
207
  return;
208
208
  }
209
- fs14.futimes(fd, at, mt, function(er2) {
210
- fs14.close(fd, function(er22) {
209
+ fs15.futimes(fd, at, mt, function(er2) {
210
+ fs15.close(fd, function(er22) {
211
211
  if (cb) cb(er2 || er22);
212
212
  });
213
213
  });
214
214
  });
215
215
  };
216
- fs14.lutimesSync = function(path14, at, mt) {
217
- var fd = fs14.openSync(path14, constants.O_SYMLINK);
216
+ fs15.lutimesSync = function(path15, at, mt) {
217
+ var fd = fs15.openSync(path15, constants.O_SYMLINK);
218
218
  var ret;
219
219
  var threw = true;
220
220
  try {
221
- ret = fs14.futimesSync(fd, at, mt);
221
+ ret = fs15.futimesSync(fd, at, mt);
222
222
  threw = false;
223
223
  } finally {
224
224
  if (threw) {
225
225
  try {
226
- fs14.closeSync(fd);
226
+ fs15.closeSync(fd);
227
227
  } catch (er) {
228
228
  }
229
229
  } else {
230
- fs14.closeSync(fd);
230
+ fs15.closeSync(fd);
231
231
  }
232
232
  }
233
233
  return ret;
234
234
  };
235
- } else if (fs14.futimes) {
236
- fs14.lutimes = function(_a, _b, _c, cb) {
235
+ } else if (fs15.futimes) {
236
+ fs15.lutimes = function(_a, _b, _c, cb) {
237
237
  if (cb) process.nextTick(cb);
238
238
  };
239
- fs14.lutimesSync = function() {
239
+ fs15.lutimesSync = function() {
240
240
  };
241
241
  }
242
242
  }
243
243
  function chmodFix(orig) {
244
244
  if (!orig) return orig;
245
245
  return function(target, mode, cb) {
246
- return orig.call(fs13, target, mode, function(er) {
246
+ return orig.call(fs14, target, mode, function(er) {
247
247
  if (chownErOk(er)) er = null;
248
248
  if (cb) cb.apply(this, arguments);
249
249
  });
@@ -253,7 +253,7 @@ var require_polyfills = __commonJS({
253
253
  if (!orig) return orig;
254
254
  return function(target, mode) {
255
255
  try {
256
- return orig.call(fs13, target, mode);
256
+ return orig.call(fs14, target, mode);
257
257
  } catch (er) {
258
258
  if (!chownErOk(er)) throw er;
259
259
  }
@@ -262,7 +262,7 @@ var require_polyfills = __commonJS({
262
262
  function chownFix(orig) {
263
263
  if (!orig) return orig;
264
264
  return function(target, uid, gid, cb) {
265
- return orig.call(fs13, target, uid, gid, function(er) {
265
+ return orig.call(fs14, target, uid, gid, function(er) {
266
266
  if (chownErOk(er)) er = null;
267
267
  if (cb) cb.apply(this, arguments);
268
268
  });
@@ -272,7 +272,7 @@ var require_polyfills = __commonJS({
272
272
  if (!orig) return orig;
273
273
  return function(target, uid, gid) {
274
274
  try {
275
- return orig.call(fs13, target, uid, gid);
275
+ return orig.call(fs14, target, uid, gid);
276
276
  } catch (er) {
277
277
  if (!chownErOk(er)) throw er;
278
278
  }
@@ -292,13 +292,13 @@ var require_polyfills = __commonJS({
292
292
  }
293
293
  if (cb) cb.apply(this, arguments);
294
294
  }
295
- return options ? orig.call(fs13, target, options, callback) : orig.call(fs13, target, callback);
295
+ return options ? orig.call(fs14, target, options, callback) : orig.call(fs14, target, callback);
296
296
  };
297
297
  }
298
298
  function statFixSync(orig) {
299
299
  if (!orig) return orig;
300
300
  return function(target, options) {
301
- var stats = options ? orig.call(fs13, target, options) : orig.call(fs13, target);
301
+ var stats = options ? orig.call(fs14, target, options) : orig.call(fs14, target);
302
302
  if (stats) {
303
303
  if (stats.uid < 0) stats.uid += 4294967296;
304
304
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -327,16 +327,16 @@ var require_legacy_streams = __commonJS({
327
327
  "node_modules/graceful-fs/legacy-streams.js"(exports, module) {
328
328
  var Stream = __require("stream").Stream;
329
329
  module.exports = legacy;
330
- function legacy(fs13) {
330
+ function legacy(fs14) {
331
331
  return {
332
332
  ReadStream,
333
333
  WriteStream
334
334
  };
335
- function ReadStream(path14, options) {
336
- if (!(this instanceof ReadStream)) return new ReadStream(path14, options);
335
+ function ReadStream(path15, options) {
336
+ if (!(this instanceof ReadStream)) return new ReadStream(path15, options);
337
337
  Stream.call(this);
338
338
  var self = this;
339
- this.path = path14;
339
+ this.path = path15;
340
340
  this.fd = null;
341
341
  this.readable = true;
342
342
  this.paused = false;
@@ -370,7 +370,7 @@ var require_legacy_streams = __commonJS({
370
370
  });
371
371
  return;
372
372
  }
373
- fs13.open(this.path, this.flags, this.mode, function(err, fd) {
373
+ fs14.open(this.path, this.flags, this.mode, function(err, fd) {
374
374
  if (err) {
375
375
  self.emit("error", err);
376
376
  self.readable = false;
@@ -381,10 +381,10 @@ var require_legacy_streams = __commonJS({
381
381
  self._read();
382
382
  });
383
383
  }
384
- function WriteStream(path14, options) {
385
- if (!(this instanceof WriteStream)) return new WriteStream(path14, options);
384
+ function WriteStream(path15, options) {
385
+ if (!(this instanceof WriteStream)) return new WriteStream(path15, options);
386
386
  Stream.call(this);
387
- this.path = path14;
387
+ this.path = path15;
388
388
  this.fd = null;
389
389
  this.writable = true;
390
390
  this.flags = "w";
@@ -409,7 +409,7 @@ var require_legacy_streams = __commonJS({
409
409
  this.busy = false;
410
410
  this._queue = [];
411
411
  if (this.fd === null) {
412
- this._open = fs13.open;
412
+ this._open = fs14.open;
413
413
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
414
414
  this.flush();
415
415
  }
@@ -444,7 +444,7 @@ var require_clone = __commonJS({
444
444
  // node_modules/graceful-fs/graceful-fs.js
445
445
  var require_graceful_fs = __commonJS({
446
446
  "node_modules/graceful-fs/graceful-fs.js"(exports, module) {
447
- var fs13 = __require("fs");
447
+ var fs14 = __require("fs");
448
448
  var polyfills = require_polyfills();
449
449
  var legacy = require_legacy_streams();
450
450
  var clone = require_clone();
@@ -476,12 +476,12 @@ var require_graceful_fs = __commonJS({
476
476
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
477
477
  console.error(m);
478
478
  };
479
- if (!fs13[gracefulQueue]) {
479
+ if (!fs14[gracefulQueue]) {
480
480
  queue = global[gracefulQueue] || [];
481
- publishQueue(fs13, queue);
482
- fs13.close = (function(fs$close) {
481
+ publishQueue(fs14, queue);
482
+ fs14.close = (function(fs$close) {
483
483
  function close(fd, cb) {
484
- return fs$close.call(fs13, fd, function(err) {
484
+ return fs$close.call(fs14, fd, function(err) {
485
485
  if (!err) {
486
486
  resetQueue();
487
487
  }
@@ -493,48 +493,48 @@ var require_graceful_fs = __commonJS({
493
493
  value: fs$close
494
494
  });
495
495
  return close;
496
- })(fs13.close);
497
- fs13.closeSync = (function(fs$closeSync) {
496
+ })(fs14.close);
497
+ fs14.closeSync = (function(fs$closeSync) {
498
498
  function closeSync2(fd) {
499
- fs$closeSync.apply(fs13, arguments);
499
+ fs$closeSync.apply(fs14, arguments);
500
500
  resetQueue();
501
501
  }
502
502
  Object.defineProperty(closeSync2, previousSymbol, {
503
503
  value: fs$closeSync
504
504
  });
505
505
  return closeSync2;
506
- })(fs13.closeSync);
506
+ })(fs14.closeSync);
507
507
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
508
508
  process.on("exit", function() {
509
- debug(fs13[gracefulQueue]);
510
- __require("assert").equal(fs13[gracefulQueue].length, 0);
509
+ debug(fs14[gracefulQueue]);
510
+ __require("assert").equal(fs14[gracefulQueue].length, 0);
511
511
  });
512
512
  }
513
513
  }
514
514
  var queue;
515
515
  if (!global[gracefulQueue]) {
516
- publishQueue(global, fs13[gracefulQueue]);
517
- }
518
- module.exports = patch(clone(fs13));
519
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs13.__patched) {
520
- module.exports = patch(fs13);
521
- fs13.__patched = true;
522
- }
523
- function patch(fs14) {
524
- polyfills(fs14);
525
- fs14.gracefulify = patch;
526
- fs14.createReadStream = createReadStream;
527
- fs14.createWriteStream = createWriteStream;
528
- var fs$readFile = fs14.readFile;
529
- fs14.readFile = readFile;
530
- function readFile(path14, options, cb) {
516
+ publishQueue(global, fs14[gracefulQueue]);
517
+ }
518
+ module.exports = patch(clone(fs14));
519
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs14.__patched) {
520
+ module.exports = patch(fs14);
521
+ fs14.__patched = true;
522
+ }
523
+ function patch(fs15) {
524
+ polyfills(fs15);
525
+ fs15.gracefulify = patch;
526
+ fs15.createReadStream = createReadStream;
527
+ fs15.createWriteStream = createWriteStream;
528
+ var fs$readFile = fs15.readFile;
529
+ fs15.readFile = readFile;
530
+ function readFile(path15, options, cb) {
531
531
  if (typeof options === "function")
532
532
  cb = options, options = null;
533
- return go$readFile(path14, options, cb);
534
- function go$readFile(path15, options2, cb2, startTime) {
535
- return fs$readFile(path15, options2, function(err) {
533
+ return go$readFile(path15, options, cb);
534
+ function go$readFile(path16, options2, cb2, startTime) {
535
+ return fs$readFile(path16, options2, function(err) {
536
536
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
537
- enqueue([go$readFile, [path15, options2, cb2], err, startTime || Date.now(), Date.now()]);
537
+ enqueue([go$readFile, [path16, options2, cb2], err, startTime || Date.now(), Date.now()]);
538
538
  else {
539
539
  if (typeof cb2 === "function")
540
540
  cb2.apply(this, arguments);
@@ -542,16 +542,16 @@ var require_graceful_fs = __commonJS({
542
542
  });
543
543
  }
544
544
  }
545
- var fs$writeFile = fs14.writeFile;
546
- fs14.writeFile = writeFile;
547
- function writeFile(path14, data, options, cb) {
545
+ var fs$writeFile = fs15.writeFile;
546
+ fs15.writeFile = writeFile;
547
+ function writeFile(path15, data, options, cb) {
548
548
  if (typeof options === "function")
549
549
  cb = options, options = null;
550
- return go$writeFile(path14, data, options, cb);
551
- function go$writeFile(path15, data2, options2, cb2, startTime) {
552
- return fs$writeFile(path15, data2, options2, function(err) {
550
+ return go$writeFile(path15, data, options, cb);
551
+ function go$writeFile(path16, data2, options2, cb2, startTime) {
552
+ return fs$writeFile(path16, data2, options2, function(err) {
553
553
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
554
- enqueue([go$writeFile, [path15, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
554
+ enqueue([go$writeFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
555
555
  else {
556
556
  if (typeof cb2 === "function")
557
557
  cb2.apply(this, arguments);
@@ -559,17 +559,17 @@ var require_graceful_fs = __commonJS({
559
559
  });
560
560
  }
561
561
  }
562
- var fs$appendFile = fs14.appendFile;
562
+ var fs$appendFile = fs15.appendFile;
563
563
  if (fs$appendFile)
564
- fs14.appendFile = appendFile;
565
- function appendFile(path14, data, options, cb) {
564
+ fs15.appendFile = appendFile;
565
+ function appendFile(path15, data, options, cb) {
566
566
  if (typeof options === "function")
567
567
  cb = options, options = null;
568
- return go$appendFile(path14, data, options, cb);
569
- function go$appendFile(path15, data2, options2, cb2, startTime) {
570
- return fs$appendFile(path15, data2, options2, function(err) {
568
+ return go$appendFile(path15, data, options, cb);
569
+ function go$appendFile(path16, data2, options2, cb2, startTime) {
570
+ return fs$appendFile(path16, data2, options2, function(err) {
571
571
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
572
- enqueue([go$appendFile, [path15, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
572
+ enqueue([go$appendFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
573
573
  else {
574
574
  if (typeof cb2 === "function")
575
575
  cb2.apply(this, arguments);
@@ -577,9 +577,9 @@ var require_graceful_fs = __commonJS({
577
577
  });
578
578
  }
579
579
  }
580
- var fs$copyFile = fs14.copyFile;
580
+ var fs$copyFile = fs15.copyFile;
581
581
  if (fs$copyFile)
582
- fs14.copyFile = copyFile;
582
+ fs15.copyFile = copyFile;
583
583
  function copyFile(src, dest, flags, cb) {
584
584
  if (typeof flags === "function") {
585
585
  cb = flags;
@@ -597,34 +597,34 @@ var require_graceful_fs = __commonJS({
597
597
  });
598
598
  }
599
599
  }
600
- var fs$readdir = fs14.readdir;
601
- fs14.readdir = readdir;
600
+ var fs$readdir = fs15.readdir;
601
+ fs15.readdir = readdir;
602
602
  var noReaddirOptionVersions = /^v[0-5]\./;
603
- function readdir(path14, options, cb) {
603
+ function readdir(path15, options, cb) {
604
604
  if (typeof options === "function")
605
605
  cb = options, options = null;
606
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path15, options2, cb2, startTime) {
607
- return fs$readdir(path15, fs$readdirCallback(
608
- path15,
606
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path16, options2, cb2, startTime) {
607
+ return fs$readdir(path16, fs$readdirCallback(
608
+ path16,
609
609
  options2,
610
610
  cb2,
611
611
  startTime
612
612
  ));
613
- } : function go$readdir2(path15, options2, cb2, startTime) {
614
- return fs$readdir(path15, options2, fs$readdirCallback(
615
- path15,
613
+ } : function go$readdir2(path16, options2, cb2, startTime) {
614
+ return fs$readdir(path16, options2, fs$readdirCallback(
615
+ path16,
616
616
  options2,
617
617
  cb2,
618
618
  startTime
619
619
  ));
620
620
  };
621
- return go$readdir(path14, options, cb);
622
- function fs$readdirCallback(path15, options2, cb2, startTime) {
621
+ return go$readdir(path15, options, cb);
622
+ function fs$readdirCallback(path16, options2, cb2, startTime) {
623
623
  return function(err, files) {
624
624
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
625
625
  enqueue([
626
626
  go$readdir,
627
- [path15, options2, cb2],
627
+ [path16, options2, cb2],
628
628
  err,
629
629
  startTime || Date.now(),
630
630
  Date.now()
@@ -639,21 +639,21 @@ var require_graceful_fs = __commonJS({
639
639
  }
640
640
  }
641
641
  if (process.version.substr(0, 4) === "v0.8") {
642
- var legStreams = legacy(fs14);
642
+ var legStreams = legacy(fs15);
643
643
  ReadStream = legStreams.ReadStream;
644
644
  WriteStream = legStreams.WriteStream;
645
645
  }
646
- var fs$ReadStream = fs14.ReadStream;
646
+ var fs$ReadStream = fs15.ReadStream;
647
647
  if (fs$ReadStream) {
648
648
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
649
649
  ReadStream.prototype.open = ReadStream$open;
650
650
  }
651
- var fs$WriteStream = fs14.WriteStream;
651
+ var fs$WriteStream = fs15.WriteStream;
652
652
  if (fs$WriteStream) {
653
653
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
654
654
  WriteStream.prototype.open = WriteStream$open;
655
655
  }
656
- Object.defineProperty(fs14, "ReadStream", {
656
+ Object.defineProperty(fs15, "ReadStream", {
657
657
  get: function() {
658
658
  return ReadStream;
659
659
  },
@@ -663,7 +663,7 @@ var require_graceful_fs = __commonJS({
663
663
  enumerable: true,
664
664
  configurable: true
665
665
  });
666
- Object.defineProperty(fs14, "WriteStream", {
666
+ Object.defineProperty(fs15, "WriteStream", {
667
667
  get: function() {
668
668
  return WriteStream;
669
669
  },
@@ -674,7 +674,7 @@ var require_graceful_fs = __commonJS({
674
674
  configurable: true
675
675
  });
676
676
  var FileReadStream = ReadStream;
677
- Object.defineProperty(fs14, "FileReadStream", {
677
+ Object.defineProperty(fs15, "FileReadStream", {
678
678
  get: function() {
679
679
  return FileReadStream;
680
680
  },
@@ -685,7 +685,7 @@ var require_graceful_fs = __commonJS({
685
685
  configurable: true
686
686
  });
687
687
  var FileWriteStream = WriteStream;
688
- Object.defineProperty(fs14, "FileWriteStream", {
688
+ Object.defineProperty(fs15, "FileWriteStream", {
689
689
  get: function() {
690
690
  return FileWriteStream;
691
691
  },
@@ -695,7 +695,7 @@ var require_graceful_fs = __commonJS({
695
695
  enumerable: true,
696
696
  configurable: true
697
697
  });
698
- function ReadStream(path14, options) {
698
+ function ReadStream(path15, options) {
699
699
  if (this instanceof ReadStream)
700
700
  return fs$ReadStream.apply(this, arguments), this;
701
701
  else
@@ -715,7 +715,7 @@ var require_graceful_fs = __commonJS({
715
715
  }
716
716
  });
717
717
  }
718
- function WriteStream(path14, options) {
718
+ function WriteStream(path15, options) {
719
719
  if (this instanceof WriteStream)
720
720
  return fs$WriteStream.apply(this, arguments), this;
721
721
  else
@@ -733,22 +733,22 @@ var require_graceful_fs = __commonJS({
733
733
  }
734
734
  });
735
735
  }
736
- function createReadStream(path14, options) {
737
- return new fs14.ReadStream(path14, options);
736
+ function createReadStream(path15, options) {
737
+ return new fs15.ReadStream(path15, options);
738
738
  }
739
- function createWriteStream(path14, options) {
740
- return new fs14.WriteStream(path14, options);
739
+ function createWriteStream(path15, options) {
740
+ return new fs15.WriteStream(path15, options);
741
741
  }
742
- var fs$open = fs14.open;
743
- fs14.open = open;
744
- function open(path14, flags, mode, cb) {
742
+ var fs$open = fs15.open;
743
+ fs15.open = open;
744
+ function open(path15, flags, mode, cb) {
745
745
  if (typeof mode === "function")
746
746
  cb = mode, mode = null;
747
- return go$open(path14, flags, mode, cb);
748
- function go$open(path15, flags2, mode2, cb2, startTime) {
749
- return fs$open(path15, flags2, mode2, function(err, fd) {
747
+ return go$open(path15, flags, mode, cb);
748
+ function go$open(path16, flags2, mode2, cb2, startTime) {
749
+ return fs$open(path16, flags2, mode2, function(err, fd) {
750
750
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
751
- enqueue([go$open, [path15, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
751
+ enqueue([go$open, [path16, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
752
752
  else {
753
753
  if (typeof cb2 === "function")
754
754
  cb2.apply(this, arguments);
@@ -756,20 +756,20 @@ var require_graceful_fs = __commonJS({
756
756
  });
757
757
  }
758
758
  }
759
- return fs14;
759
+ return fs15;
760
760
  }
761
761
  function enqueue(elem) {
762
762
  debug("ENQUEUE", elem[0].name, elem[1]);
763
- fs13[gracefulQueue].push(elem);
763
+ fs14[gracefulQueue].push(elem);
764
764
  retry();
765
765
  }
766
766
  var retryTimer;
767
767
  function resetQueue() {
768
768
  var now = Date.now();
769
- for (var i = 0; i < fs13[gracefulQueue].length; ++i) {
770
- if (fs13[gracefulQueue][i].length > 2) {
771
- fs13[gracefulQueue][i][3] = now;
772
- fs13[gracefulQueue][i][4] = now;
769
+ for (var i = 0; i < fs14[gracefulQueue].length; ++i) {
770
+ if (fs14[gracefulQueue][i].length > 2) {
771
+ fs14[gracefulQueue][i][3] = now;
772
+ fs14[gracefulQueue][i][4] = now;
773
773
  }
774
774
  }
775
775
  retry();
@@ -777,9 +777,9 @@ var require_graceful_fs = __commonJS({
777
777
  function retry() {
778
778
  clearTimeout(retryTimer);
779
779
  retryTimer = void 0;
780
- if (fs13[gracefulQueue].length === 0)
780
+ if (fs14[gracefulQueue].length === 0)
781
781
  return;
782
- var elem = fs13[gracefulQueue].shift();
782
+ var elem = fs14[gracefulQueue].shift();
783
783
  var fn = elem[0];
784
784
  var args = elem[1];
785
785
  var err = elem[2];
@@ -801,7 +801,7 @@ var require_graceful_fs = __commonJS({
801
801
  debug("RETRY", fn.name, args);
802
802
  fn.apply(null, args.concat([startTime]));
803
803
  } else {
804
- fs13[gracefulQueue].push(elem);
804
+ fs14[gracefulQueue].push(elem);
805
805
  }
806
806
  }
807
807
  if (retryTimer === void 0) {
@@ -1236,10 +1236,10 @@ var require_mtime_precision = __commonJS({
1236
1236
  "node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
1237
1237
  "use strict";
1238
1238
  var cacheSymbol = Symbol();
1239
- function probe(file, fs13, callback) {
1240
- const cachedPrecision = fs13[cacheSymbol];
1239
+ function probe(file, fs14, callback) {
1240
+ const cachedPrecision = fs14[cacheSymbol];
1241
1241
  if (cachedPrecision) {
1242
- return fs13.stat(file, (err, stat) => {
1242
+ return fs14.stat(file, (err, stat) => {
1243
1243
  if (err) {
1244
1244
  return callback(err);
1245
1245
  }
@@ -1247,16 +1247,16 @@ var require_mtime_precision = __commonJS({
1247
1247
  });
1248
1248
  }
1249
1249
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1250
- fs13.utimes(file, mtime, mtime, (err) => {
1250
+ fs14.utimes(file, mtime, mtime, (err) => {
1251
1251
  if (err) {
1252
1252
  return callback(err);
1253
1253
  }
1254
- fs13.stat(file, (err2, stat) => {
1254
+ fs14.stat(file, (err2, stat) => {
1255
1255
  if (err2) {
1256
1256
  return callback(err2);
1257
1257
  }
1258
1258
  const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1259
- Object.defineProperty(fs13, cacheSymbol, { value: precision });
1259
+ Object.defineProperty(fs14, cacheSymbol, { value: precision });
1260
1260
  callback(null, stat.mtime, precision);
1261
1261
  });
1262
1262
  });
@@ -1277,8 +1277,8 @@ var require_mtime_precision = __commonJS({
1277
1277
  var require_lockfile = __commonJS({
1278
1278
  "node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
1279
1279
  "use strict";
1280
- var path14 = __require("path");
1281
- var fs13 = require_graceful_fs();
1280
+ var path15 = __require("path");
1281
+ var fs14 = require_graceful_fs();
1282
1282
  var retry = require_retry2();
1283
1283
  var onExit = require_signal_exit();
1284
1284
  var mtimePrecision = require_mtime_precision();
@@ -1288,7 +1288,7 @@ var require_lockfile = __commonJS({
1288
1288
  }
1289
1289
  function resolveCanonicalPath(file, options, callback) {
1290
1290
  if (!options.realpath) {
1291
- return callback(null, path14.resolve(file));
1291
+ return callback(null, path15.resolve(file));
1292
1292
  }
1293
1293
  options.fs.realpath(file, callback);
1294
1294
  }
@@ -1409,7 +1409,7 @@ var require_lockfile = __commonJS({
1409
1409
  update: null,
1410
1410
  realpath: true,
1411
1411
  retries: 0,
1412
- fs: fs13,
1412
+ fs: fs14,
1413
1413
  onCompromised: (err) => {
1414
1414
  throw err;
1415
1415
  },
@@ -1453,7 +1453,7 @@ var require_lockfile = __commonJS({
1453
1453
  }
1454
1454
  function unlock(file, options, callback) {
1455
1455
  options = {
1456
- fs: fs13,
1456
+ fs: fs14,
1457
1457
  realpath: true,
1458
1458
  ...options
1459
1459
  };
@@ -1475,7 +1475,7 @@ var require_lockfile = __commonJS({
1475
1475
  options = {
1476
1476
  stale: 1e4,
1477
1477
  realpath: true,
1478
- fs: fs13,
1478
+ fs: fs14,
1479
1479
  ...options
1480
1480
  };
1481
1481
  options.stale = Math.max(options.stale || 0, 2e3);
@@ -1514,16 +1514,16 @@ var require_lockfile = __commonJS({
1514
1514
  var require_adapter = __commonJS({
1515
1515
  "node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
1516
1516
  "use strict";
1517
- var fs13 = require_graceful_fs();
1518
- function createSyncFs(fs14) {
1517
+ var fs14 = require_graceful_fs();
1518
+ function createSyncFs(fs15) {
1519
1519
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
1520
- const newFs = { ...fs14 };
1520
+ const newFs = { ...fs15 };
1521
1521
  methods.forEach((method) => {
1522
1522
  newFs[method] = (...args) => {
1523
1523
  const callback = args.pop();
1524
1524
  let ret;
1525
1525
  try {
1526
- ret = fs14[`${method}Sync`](...args);
1526
+ ret = fs15[`${method}Sync`](...args);
1527
1527
  } catch (err) {
1528
1528
  return callback(err);
1529
1529
  }
@@ -1533,12 +1533,12 @@ var require_adapter = __commonJS({
1533
1533
  return newFs;
1534
1534
  }
1535
1535
  function toPromise(method) {
1536
- return (...args) => new Promise((resolve5, reject) => {
1536
+ return (...args) => new Promise((resolve4, reject) => {
1537
1537
  args.push((err, result) => {
1538
1538
  if (err) {
1539
1539
  reject(err);
1540
1540
  } else {
1541
- resolve5(result);
1541
+ resolve4(result);
1542
1542
  }
1543
1543
  });
1544
1544
  method(...args);
@@ -1561,7 +1561,7 @@ var require_adapter = __commonJS({
1561
1561
  }
1562
1562
  function toSyncOptions(options) {
1563
1563
  options = { ...options };
1564
- options.fs = createSyncFs(options.fs || fs13);
1564
+ options.fs = createSyncFs(options.fs || fs14);
1565
1565
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
1566
1566
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1567
1567
  }
@@ -2724,8 +2724,8 @@ var require_lib = __commonJS({
2724
2724
  });
2725
2725
 
2726
2726
  // src/index.ts
2727
- import * as fs12 from "node:fs";
2728
- import * as path13 from "node:path";
2727
+ import * as fs13 from "node:fs";
2728
+ import * as path14 from "node:path";
2729
2729
 
2730
2730
  // node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2731
2731
  var value_exports = {};
@@ -6298,32 +6298,32 @@ var ValueErrorIterator = class {
6298
6298
  return next.done ? void 0 : next.value;
6299
6299
  }
6300
6300
  };
6301
- function Create(errorType, schema, path14, value, errors = []) {
6301
+ function Create(errorType, schema, path15, value, errors = []) {
6302
6302
  return {
6303
6303
  type: errorType,
6304
6304
  schema,
6305
- path: path14,
6305
+ path: path15,
6306
6306
  value,
6307
- message: GetErrorFunction()({ errorType, path: path14, schema, value, errors }),
6307
+ message: GetErrorFunction()({ errorType, path: path15, schema, value, errors }),
6308
6308
  errors
6309
6309
  };
6310
6310
  }
6311
- function* FromAny3(schema, references, path14, value) {
6311
+ function* FromAny3(schema, references, path15, value) {
6312
6312
  }
6313
- function* FromArgument3(schema, references, path14, value) {
6313
+ function* FromArgument3(schema, references, path15, value) {
6314
6314
  }
6315
- function* FromArray8(schema, references, path14, value) {
6315
+ function* FromArray8(schema, references, path15, value) {
6316
6316
  if (!IsArray2(value)) {
6317
- return yield Create(ValueErrorType.Array, schema, path14, value);
6317
+ return yield Create(ValueErrorType.Array, schema, path15, value);
6318
6318
  }
6319
6319
  if (IsDefined2(schema.minItems) && !(value.length >= schema.minItems)) {
6320
- yield Create(ValueErrorType.ArrayMinItems, schema, path14, value);
6320
+ yield Create(ValueErrorType.ArrayMinItems, schema, path15, value);
6321
6321
  }
6322
6322
  if (IsDefined2(schema.maxItems) && !(value.length <= schema.maxItems)) {
6323
- yield Create(ValueErrorType.ArrayMaxItems, schema, path14, value);
6323
+ yield Create(ValueErrorType.ArrayMaxItems, schema, path15, value);
6324
6324
  }
6325
6325
  for (let i = 0; i < value.length; i++) {
6326
- yield* Visit6(schema.items, references, `${path14}/${i}`, value[i]);
6326
+ yield* Visit6(schema.items, references, `${path15}/${i}`, value[i]);
6327
6327
  }
6328
6328
  if (schema.uniqueItems === true && !(function() {
6329
6329
  const set = /* @__PURE__ */ new Set();
@@ -6337,116 +6337,116 @@ function* FromArray8(schema, references, path14, value) {
6337
6337
  }
6338
6338
  return true;
6339
6339
  })()) {
6340
- yield Create(ValueErrorType.ArrayUniqueItems, schema, path14, value);
6340
+ yield Create(ValueErrorType.ArrayUniqueItems, schema, path15, value);
6341
6341
  }
6342
6342
  if (!(IsDefined2(schema.contains) || IsDefined2(schema.minContains) || IsDefined2(schema.maxContains))) {
6343
6343
  return;
6344
6344
  }
6345
6345
  const containsSchema = IsDefined2(schema.contains) ? schema.contains : Never();
6346
- const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${path14}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
6346
+ const containsCount = value.reduce((acc, value2, index) => Visit6(containsSchema, references, `${path15}${index}`, value2).next().done === true ? acc + 1 : acc, 0);
6347
6347
  if (containsCount === 0) {
6348
- yield Create(ValueErrorType.ArrayContains, schema, path14, value);
6348
+ yield Create(ValueErrorType.ArrayContains, schema, path15, value);
6349
6349
  }
6350
6350
  if (IsNumber2(schema.minContains) && containsCount < schema.minContains) {
6351
- yield Create(ValueErrorType.ArrayMinContains, schema, path14, value);
6351
+ yield Create(ValueErrorType.ArrayMinContains, schema, path15, value);
6352
6352
  }
6353
6353
  if (IsNumber2(schema.maxContains) && containsCount > schema.maxContains) {
6354
- yield Create(ValueErrorType.ArrayMaxContains, schema, path14, value);
6354
+ yield Create(ValueErrorType.ArrayMaxContains, schema, path15, value);
6355
6355
  }
6356
6356
  }
6357
- function* FromAsyncIterator5(schema, references, path14, value) {
6357
+ function* FromAsyncIterator5(schema, references, path15, value) {
6358
6358
  if (!IsAsyncIterator2(value))
6359
- yield Create(ValueErrorType.AsyncIterator, schema, path14, value);
6359
+ yield Create(ValueErrorType.AsyncIterator, schema, path15, value);
6360
6360
  }
6361
- function* FromBigInt3(schema, references, path14, value) {
6361
+ function* FromBigInt3(schema, references, path15, value) {
6362
6362
  if (!IsBigInt2(value))
6363
- return yield Create(ValueErrorType.BigInt, schema, path14, value);
6363
+ return yield Create(ValueErrorType.BigInt, schema, path15, value);
6364
6364
  if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
6365
- yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path14, value);
6365
+ yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path15, value);
6366
6366
  }
6367
6367
  if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
6368
- yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path14, value);
6368
+ yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path15, value);
6369
6369
  }
6370
6370
  if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
6371
- yield Create(ValueErrorType.BigIntMaximum, schema, path14, value);
6371
+ yield Create(ValueErrorType.BigIntMaximum, schema, path15, value);
6372
6372
  }
6373
6373
  if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
6374
- yield Create(ValueErrorType.BigIntMinimum, schema, path14, value);
6374
+ yield Create(ValueErrorType.BigIntMinimum, schema, path15, value);
6375
6375
  }
6376
6376
  if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) {
6377
- yield Create(ValueErrorType.BigIntMultipleOf, schema, path14, value);
6377
+ yield Create(ValueErrorType.BigIntMultipleOf, schema, path15, value);
6378
6378
  }
6379
6379
  }
6380
- function* FromBoolean3(schema, references, path14, value) {
6380
+ function* FromBoolean3(schema, references, path15, value) {
6381
6381
  if (!IsBoolean2(value))
6382
- yield Create(ValueErrorType.Boolean, schema, path14, value);
6382
+ yield Create(ValueErrorType.Boolean, schema, path15, value);
6383
6383
  }
6384
- function* FromConstructor5(schema, references, path14, value) {
6385
- yield* Visit6(schema.returns, references, path14, value.prototype);
6384
+ function* FromConstructor5(schema, references, path15, value) {
6385
+ yield* Visit6(schema.returns, references, path15, value.prototype);
6386
6386
  }
6387
- function* FromDate3(schema, references, path14, value) {
6387
+ function* FromDate3(schema, references, path15, value) {
6388
6388
  if (!IsDate2(value))
6389
- return yield Create(ValueErrorType.Date, schema, path14, value);
6389
+ return yield Create(ValueErrorType.Date, schema, path15, value);
6390
6390
  if (IsDefined2(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
6391
- yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path14, value);
6391
+ yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path15, value);
6392
6392
  }
6393
6393
  if (IsDefined2(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) {
6394
- yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path14, value);
6394
+ yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path15, value);
6395
6395
  }
6396
6396
  if (IsDefined2(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) {
6397
- yield Create(ValueErrorType.DateMaximumTimestamp, schema, path14, value);
6397
+ yield Create(ValueErrorType.DateMaximumTimestamp, schema, path15, value);
6398
6398
  }
6399
6399
  if (IsDefined2(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) {
6400
- yield Create(ValueErrorType.DateMinimumTimestamp, schema, path14, value);
6400
+ yield Create(ValueErrorType.DateMinimumTimestamp, schema, path15, value);
6401
6401
  }
6402
6402
  if (IsDefined2(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) {
6403
- yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path14, value);
6403
+ yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path15, value);
6404
6404
  }
6405
6405
  }
6406
- function* FromFunction5(schema, references, path14, value) {
6406
+ function* FromFunction5(schema, references, path15, value) {
6407
6407
  if (!IsFunction2(value))
6408
- yield Create(ValueErrorType.Function, schema, path14, value);
6408
+ yield Create(ValueErrorType.Function, schema, path15, value);
6409
6409
  }
6410
- function* FromImport2(schema, references, path14, value) {
6410
+ function* FromImport2(schema, references, path15, value) {
6411
6411
  const definitions = globalThis.Object.values(schema.$defs);
6412
6412
  const target = schema.$defs[schema.$ref];
6413
- yield* Visit6(target, [...references, ...definitions], path14, value);
6413
+ yield* Visit6(target, [...references, ...definitions], path15, value);
6414
6414
  }
6415
- function* FromInteger3(schema, references, path14, value) {
6415
+ function* FromInteger3(schema, references, path15, value) {
6416
6416
  if (!IsInteger(value))
6417
- return yield Create(ValueErrorType.Integer, schema, path14, value);
6417
+ return yield Create(ValueErrorType.Integer, schema, path15, value);
6418
6418
  if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
6419
- yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path14, value);
6419
+ yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path15, value);
6420
6420
  }
6421
6421
  if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
6422
- yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path14, value);
6422
+ yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path15, value);
6423
6423
  }
6424
6424
  if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
6425
- yield Create(ValueErrorType.IntegerMaximum, schema, path14, value);
6425
+ yield Create(ValueErrorType.IntegerMaximum, schema, path15, value);
6426
6426
  }
6427
6427
  if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
6428
- yield Create(ValueErrorType.IntegerMinimum, schema, path14, value);
6428
+ yield Create(ValueErrorType.IntegerMinimum, schema, path15, value);
6429
6429
  }
6430
6430
  if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
6431
- yield Create(ValueErrorType.IntegerMultipleOf, schema, path14, value);
6431
+ yield Create(ValueErrorType.IntegerMultipleOf, schema, path15, value);
6432
6432
  }
6433
6433
  }
6434
- function* FromIntersect10(schema, references, path14, value) {
6434
+ function* FromIntersect10(schema, references, path15, value) {
6435
6435
  let hasError = false;
6436
6436
  for (const inner of schema.allOf) {
6437
- for (const error of Visit6(inner, references, path14, value)) {
6437
+ for (const error of Visit6(inner, references, path15, value)) {
6438
6438
  hasError = true;
6439
6439
  yield error;
6440
6440
  }
6441
6441
  }
6442
6442
  if (hasError) {
6443
- return yield Create(ValueErrorType.Intersect, schema, path14, value);
6443
+ return yield Create(ValueErrorType.Intersect, schema, path15, value);
6444
6444
  }
6445
6445
  if (schema.unevaluatedProperties === false) {
6446
6446
  const keyCheck = new RegExp(KeyOfPattern(schema));
6447
6447
  for (const valueKey of Object.getOwnPropertyNames(value)) {
6448
6448
  if (!keyCheck.test(valueKey)) {
6449
- yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path14}/${valueKey}`, value);
6449
+ yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path15}/${valueKey}`, value);
6450
6450
  }
6451
6451
  }
6452
6452
  }
@@ -6454,59 +6454,59 @@ function* FromIntersect10(schema, references, path14, value) {
6454
6454
  const keyCheck = new RegExp(KeyOfPattern(schema));
6455
6455
  for (const valueKey of Object.getOwnPropertyNames(value)) {
6456
6456
  if (!keyCheck.test(valueKey)) {
6457
- const next = Visit6(schema.unevaluatedProperties, references, `${path14}/${valueKey}`, value[valueKey]).next();
6457
+ const next = Visit6(schema.unevaluatedProperties, references, `${path15}/${valueKey}`, value[valueKey]).next();
6458
6458
  if (!next.done)
6459
6459
  yield next.value;
6460
6460
  }
6461
6461
  }
6462
6462
  }
6463
6463
  }
6464
- function* FromIterator5(schema, references, path14, value) {
6464
+ function* FromIterator5(schema, references, path15, value) {
6465
6465
  if (!IsIterator2(value))
6466
- yield Create(ValueErrorType.Iterator, schema, path14, value);
6466
+ yield Create(ValueErrorType.Iterator, schema, path15, value);
6467
6467
  }
6468
- function* FromLiteral4(schema, references, path14, value) {
6468
+ function* FromLiteral4(schema, references, path15, value) {
6469
6469
  if (!(value === schema.const))
6470
- yield Create(ValueErrorType.Literal, schema, path14, value);
6470
+ yield Create(ValueErrorType.Literal, schema, path15, value);
6471
6471
  }
6472
- function* FromNever3(schema, references, path14, value) {
6473
- yield Create(ValueErrorType.Never, schema, path14, value);
6472
+ function* FromNever3(schema, references, path15, value) {
6473
+ yield Create(ValueErrorType.Never, schema, path15, value);
6474
6474
  }
6475
- function* FromNot3(schema, references, path14, value) {
6476
- if (Visit6(schema.not, references, path14, value).next().done === true)
6477
- yield Create(ValueErrorType.Not, schema, path14, value);
6475
+ function* FromNot3(schema, references, path15, value) {
6476
+ if (Visit6(schema.not, references, path15, value).next().done === true)
6477
+ yield Create(ValueErrorType.Not, schema, path15, value);
6478
6478
  }
6479
- function* FromNull3(schema, references, path14, value) {
6479
+ function* FromNull3(schema, references, path15, value) {
6480
6480
  if (!IsNull2(value))
6481
- yield Create(ValueErrorType.Null, schema, path14, value);
6481
+ yield Create(ValueErrorType.Null, schema, path15, value);
6482
6482
  }
6483
- function* FromNumber3(schema, references, path14, value) {
6483
+ function* FromNumber3(schema, references, path15, value) {
6484
6484
  if (!TypeSystemPolicy.IsNumberLike(value))
6485
- return yield Create(ValueErrorType.Number, schema, path14, value);
6485
+ return yield Create(ValueErrorType.Number, schema, path15, value);
6486
6486
  if (IsDefined2(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
6487
- yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path14, value);
6487
+ yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path15, value);
6488
6488
  }
6489
6489
  if (IsDefined2(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) {
6490
- yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path14, value);
6490
+ yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path15, value);
6491
6491
  }
6492
6492
  if (IsDefined2(schema.maximum) && !(value <= schema.maximum)) {
6493
- yield Create(ValueErrorType.NumberMaximum, schema, path14, value);
6493
+ yield Create(ValueErrorType.NumberMaximum, schema, path15, value);
6494
6494
  }
6495
6495
  if (IsDefined2(schema.minimum) && !(value >= schema.minimum)) {
6496
- yield Create(ValueErrorType.NumberMinimum, schema, path14, value);
6496
+ yield Create(ValueErrorType.NumberMinimum, schema, path15, value);
6497
6497
  }
6498
6498
  if (IsDefined2(schema.multipleOf) && !(value % schema.multipleOf === 0)) {
6499
- yield Create(ValueErrorType.NumberMultipleOf, schema, path14, value);
6499
+ yield Create(ValueErrorType.NumberMultipleOf, schema, path15, value);
6500
6500
  }
6501
6501
  }
6502
- function* FromObject9(schema, references, path14, value) {
6502
+ function* FromObject9(schema, references, path15, value) {
6503
6503
  if (!TypeSystemPolicy.IsObjectLike(value))
6504
- return yield Create(ValueErrorType.Object, schema, path14, value);
6504
+ return yield Create(ValueErrorType.Object, schema, path15, value);
6505
6505
  if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
6506
- yield Create(ValueErrorType.ObjectMinProperties, schema, path14, value);
6506
+ yield Create(ValueErrorType.ObjectMinProperties, schema, path15, value);
6507
6507
  }
6508
6508
  if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
6509
- yield Create(ValueErrorType.ObjectMaxProperties, schema, path14, value);
6509
+ yield Create(ValueErrorType.ObjectMaxProperties, schema, path15, value);
6510
6510
  }
6511
6511
  const requiredKeys = Array.isArray(schema.required) ? schema.required : [];
6512
6512
  const knownKeys = Object.getOwnPropertyNames(schema.properties);
@@ -6514,12 +6514,12 @@ function* FromObject9(schema, references, path14, value) {
6514
6514
  for (const requiredKey of requiredKeys) {
6515
6515
  if (unknownKeys.includes(requiredKey))
6516
6516
  continue;
6517
- yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path14}/${EscapeKey(requiredKey)}`, void 0);
6517
+ yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path15}/${EscapeKey(requiredKey)}`, void 0);
6518
6518
  }
6519
6519
  if (schema.additionalProperties === false) {
6520
6520
  for (const valueKey of unknownKeys) {
6521
6521
  if (!knownKeys.includes(valueKey)) {
6522
- yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path14}/${EscapeKey(valueKey)}`, value[valueKey]);
6522
+ yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path15}/${EscapeKey(valueKey)}`, value[valueKey]);
6523
6523
  }
6524
6524
  }
6525
6525
  }
@@ -6527,235 +6527,235 @@ function* FromObject9(schema, references, path14, value) {
6527
6527
  for (const valueKey of unknownKeys) {
6528
6528
  if (knownKeys.includes(valueKey))
6529
6529
  continue;
6530
- yield* Visit6(schema.additionalProperties, references, `${path14}/${EscapeKey(valueKey)}`, value[valueKey]);
6530
+ yield* Visit6(schema.additionalProperties, references, `${path15}/${EscapeKey(valueKey)}`, value[valueKey]);
6531
6531
  }
6532
6532
  }
6533
6533
  for (const knownKey of knownKeys) {
6534
6534
  const property = schema.properties[knownKey];
6535
6535
  if (schema.required && schema.required.includes(knownKey)) {
6536
- yield* Visit6(property, references, `${path14}/${EscapeKey(knownKey)}`, value[knownKey]);
6536
+ yield* Visit6(property, references, `${path15}/${EscapeKey(knownKey)}`, value[knownKey]);
6537
6537
  if (ExtendsUndefinedCheck(schema) && !(knownKey in value)) {
6538
- yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path14}/${EscapeKey(knownKey)}`, void 0);
6538
+ yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path15}/${EscapeKey(knownKey)}`, void 0);
6539
6539
  }
6540
6540
  } else {
6541
6541
  if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) {
6542
- yield* Visit6(property, references, `${path14}/${EscapeKey(knownKey)}`, value[knownKey]);
6542
+ yield* Visit6(property, references, `${path15}/${EscapeKey(knownKey)}`, value[knownKey]);
6543
6543
  }
6544
6544
  }
6545
6545
  }
6546
6546
  }
6547
- function* FromPromise5(schema, references, path14, value) {
6547
+ function* FromPromise5(schema, references, path15, value) {
6548
6548
  if (!IsPromise(value))
6549
- yield Create(ValueErrorType.Promise, schema, path14, value);
6549
+ yield Create(ValueErrorType.Promise, schema, path15, value);
6550
6550
  }
6551
- function* FromRecord5(schema, references, path14, value) {
6551
+ function* FromRecord5(schema, references, path15, value) {
6552
6552
  if (!TypeSystemPolicy.IsRecordLike(value))
6553
- return yield Create(ValueErrorType.Object, schema, path14, value);
6553
+ return yield Create(ValueErrorType.Object, schema, path15, value);
6554
6554
  if (IsDefined2(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
6555
- yield Create(ValueErrorType.ObjectMinProperties, schema, path14, value);
6555
+ yield Create(ValueErrorType.ObjectMinProperties, schema, path15, value);
6556
6556
  }
6557
6557
  if (IsDefined2(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) {
6558
- yield Create(ValueErrorType.ObjectMaxProperties, schema, path14, value);
6558
+ yield Create(ValueErrorType.ObjectMaxProperties, schema, path15, value);
6559
6559
  }
6560
6560
  const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
6561
6561
  const regex = new RegExp(patternKey);
6562
6562
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
6563
6563
  if (regex.test(propertyKey))
6564
- yield* Visit6(patternSchema, references, `${path14}/${EscapeKey(propertyKey)}`, propertyValue);
6564
+ yield* Visit6(patternSchema, references, `${path15}/${EscapeKey(propertyKey)}`, propertyValue);
6565
6565
  }
6566
6566
  if (typeof schema.additionalProperties === "object") {
6567
6567
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
6568
6568
  if (!regex.test(propertyKey))
6569
- yield* Visit6(schema.additionalProperties, references, `${path14}/${EscapeKey(propertyKey)}`, propertyValue);
6569
+ yield* Visit6(schema.additionalProperties, references, `${path15}/${EscapeKey(propertyKey)}`, propertyValue);
6570
6570
  }
6571
6571
  }
6572
6572
  if (schema.additionalProperties === false) {
6573
6573
  for (const [propertyKey, propertyValue] of Object.entries(value)) {
6574
6574
  if (regex.test(propertyKey))
6575
6575
  continue;
6576
- return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path14}/${EscapeKey(propertyKey)}`, propertyValue);
6576
+ return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path15}/${EscapeKey(propertyKey)}`, propertyValue);
6577
6577
  }
6578
6578
  }
6579
6579
  }
6580
- function* FromRef6(schema, references, path14, value) {
6581
- yield* Visit6(Deref(schema, references), references, path14, value);
6580
+ function* FromRef6(schema, references, path15, value) {
6581
+ yield* Visit6(Deref(schema, references), references, path15, value);
6582
6582
  }
6583
- function* FromRegExp3(schema, references, path14, value) {
6583
+ function* FromRegExp3(schema, references, path15, value) {
6584
6584
  if (!IsString2(value))
6585
- return yield Create(ValueErrorType.String, schema, path14, value);
6585
+ return yield Create(ValueErrorType.String, schema, path15, value);
6586
6586
  if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
6587
- yield Create(ValueErrorType.StringMinLength, schema, path14, value);
6587
+ yield Create(ValueErrorType.StringMinLength, schema, path15, value);
6588
6588
  }
6589
6589
  if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
6590
- yield Create(ValueErrorType.StringMaxLength, schema, path14, value);
6590
+ yield Create(ValueErrorType.StringMaxLength, schema, path15, value);
6591
6591
  }
6592
6592
  const regex = new RegExp(schema.source, schema.flags);
6593
6593
  if (!regex.test(value)) {
6594
- return yield Create(ValueErrorType.RegExp, schema, path14, value);
6594
+ return yield Create(ValueErrorType.RegExp, schema, path15, value);
6595
6595
  }
6596
6596
  }
6597
- function* FromString3(schema, references, path14, value) {
6597
+ function* FromString3(schema, references, path15, value) {
6598
6598
  if (!IsString2(value))
6599
- return yield Create(ValueErrorType.String, schema, path14, value);
6599
+ return yield Create(ValueErrorType.String, schema, path15, value);
6600
6600
  if (IsDefined2(schema.minLength) && !(value.length >= schema.minLength)) {
6601
- yield Create(ValueErrorType.StringMinLength, schema, path14, value);
6601
+ yield Create(ValueErrorType.StringMinLength, schema, path15, value);
6602
6602
  }
6603
6603
  if (IsDefined2(schema.maxLength) && !(value.length <= schema.maxLength)) {
6604
- yield Create(ValueErrorType.StringMaxLength, schema, path14, value);
6604
+ yield Create(ValueErrorType.StringMaxLength, schema, path15, value);
6605
6605
  }
6606
6606
  if (IsString2(schema.pattern)) {
6607
6607
  const regex = new RegExp(schema.pattern);
6608
6608
  if (!regex.test(value)) {
6609
- yield Create(ValueErrorType.StringPattern, schema, path14, value);
6609
+ yield Create(ValueErrorType.StringPattern, schema, path15, value);
6610
6610
  }
6611
6611
  }
6612
6612
  if (IsString2(schema.format)) {
6613
6613
  if (!format_exports.Has(schema.format)) {
6614
- yield Create(ValueErrorType.StringFormatUnknown, schema, path14, value);
6614
+ yield Create(ValueErrorType.StringFormatUnknown, schema, path15, value);
6615
6615
  } else {
6616
6616
  const format = format_exports.Get(schema.format);
6617
6617
  if (!format(value)) {
6618
- yield Create(ValueErrorType.StringFormat, schema, path14, value);
6618
+ yield Create(ValueErrorType.StringFormat, schema, path15, value);
6619
6619
  }
6620
6620
  }
6621
6621
  }
6622
6622
  }
6623
- function* FromSymbol3(schema, references, path14, value) {
6623
+ function* FromSymbol3(schema, references, path15, value) {
6624
6624
  if (!IsSymbol2(value))
6625
- yield Create(ValueErrorType.Symbol, schema, path14, value);
6625
+ yield Create(ValueErrorType.Symbol, schema, path15, value);
6626
6626
  }
6627
- function* FromTemplateLiteral5(schema, references, path14, value) {
6627
+ function* FromTemplateLiteral5(schema, references, path15, value) {
6628
6628
  if (!IsString2(value))
6629
- return yield Create(ValueErrorType.String, schema, path14, value);
6629
+ return yield Create(ValueErrorType.String, schema, path15, value);
6630
6630
  const regex = new RegExp(schema.pattern);
6631
6631
  if (!regex.test(value)) {
6632
- yield Create(ValueErrorType.StringPattern, schema, path14, value);
6632
+ yield Create(ValueErrorType.StringPattern, schema, path15, value);
6633
6633
  }
6634
6634
  }
6635
- function* FromThis2(schema, references, path14, value) {
6636
- yield* Visit6(Deref(schema, references), references, path14, value);
6635
+ function* FromThis2(schema, references, path15, value) {
6636
+ yield* Visit6(Deref(schema, references), references, path15, value);
6637
6637
  }
6638
- function* FromTuple7(schema, references, path14, value) {
6638
+ function* FromTuple7(schema, references, path15, value) {
6639
6639
  if (!IsArray2(value))
6640
- return yield Create(ValueErrorType.Tuple, schema, path14, value);
6640
+ return yield Create(ValueErrorType.Tuple, schema, path15, value);
6641
6641
  if (schema.items === void 0 && !(value.length === 0)) {
6642
- return yield Create(ValueErrorType.TupleLength, schema, path14, value);
6642
+ return yield Create(ValueErrorType.TupleLength, schema, path15, value);
6643
6643
  }
6644
6644
  if (!(value.length === schema.maxItems)) {
6645
- return yield Create(ValueErrorType.TupleLength, schema, path14, value);
6645
+ return yield Create(ValueErrorType.TupleLength, schema, path15, value);
6646
6646
  }
6647
6647
  if (!schema.items) {
6648
6648
  return;
6649
6649
  }
6650
6650
  for (let i = 0; i < schema.items.length; i++) {
6651
- yield* Visit6(schema.items[i], references, `${path14}/${i}`, value[i]);
6651
+ yield* Visit6(schema.items[i], references, `${path15}/${i}`, value[i]);
6652
6652
  }
6653
6653
  }
6654
- function* FromUndefined3(schema, references, path14, value) {
6654
+ function* FromUndefined3(schema, references, path15, value) {
6655
6655
  if (!IsUndefined2(value))
6656
- yield Create(ValueErrorType.Undefined, schema, path14, value);
6656
+ yield Create(ValueErrorType.Undefined, schema, path15, value);
6657
6657
  }
6658
- function* FromUnion12(schema, references, path14, value) {
6658
+ function* FromUnion12(schema, references, path15, value) {
6659
6659
  if (Check(schema, references, value))
6660
6660
  return;
6661
- const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references, path14, value)));
6662
- yield Create(ValueErrorType.Union, schema, path14, value, errors);
6661
+ const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit6(variant, references, path15, value)));
6662
+ yield Create(ValueErrorType.Union, schema, path15, value, errors);
6663
6663
  }
6664
- function* FromUint8Array3(schema, references, path14, value) {
6664
+ function* FromUint8Array3(schema, references, path15, value) {
6665
6665
  if (!IsUint8Array2(value))
6666
- return yield Create(ValueErrorType.Uint8Array, schema, path14, value);
6666
+ return yield Create(ValueErrorType.Uint8Array, schema, path15, value);
6667
6667
  if (IsDefined2(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
6668
- yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path14, value);
6668
+ yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path15, value);
6669
6669
  }
6670
6670
  if (IsDefined2(schema.minByteLength) && !(value.length >= schema.minByteLength)) {
6671
- yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path14, value);
6671
+ yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path15, value);
6672
6672
  }
6673
6673
  }
6674
- function* FromUnknown3(schema, references, path14, value) {
6674
+ function* FromUnknown3(schema, references, path15, value) {
6675
6675
  }
6676
- function* FromVoid3(schema, references, path14, value) {
6676
+ function* FromVoid3(schema, references, path15, value) {
6677
6677
  if (!TypeSystemPolicy.IsVoidLike(value))
6678
- yield Create(ValueErrorType.Void, schema, path14, value);
6678
+ yield Create(ValueErrorType.Void, schema, path15, value);
6679
6679
  }
6680
- function* FromKind2(schema, references, path14, value) {
6680
+ function* FromKind2(schema, references, path15, value) {
6681
6681
  const check2 = type_exports2.Get(schema[Kind]);
6682
6682
  if (!check2(schema, value))
6683
- yield Create(ValueErrorType.Kind, schema, path14, value);
6683
+ yield Create(ValueErrorType.Kind, schema, path15, value);
6684
6684
  }
6685
- function* Visit6(schema, references, path14, value) {
6685
+ function* Visit6(schema, references, path15, value) {
6686
6686
  const references_ = IsDefined2(schema.$id) ? [...references, schema] : references;
6687
6687
  const schema_ = schema;
6688
6688
  switch (schema_[Kind]) {
6689
6689
  case "Any":
6690
- return yield* FromAny3(schema_, references_, path14, value);
6690
+ return yield* FromAny3(schema_, references_, path15, value);
6691
6691
  case "Argument":
6692
- return yield* FromArgument3(schema_, references_, path14, value);
6692
+ return yield* FromArgument3(schema_, references_, path15, value);
6693
6693
  case "Array":
6694
- return yield* FromArray8(schema_, references_, path14, value);
6694
+ return yield* FromArray8(schema_, references_, path15, value);
6695
6695
  case "AsyncIterator":
6696
- return yield* FromAsyncIterator5(schema_, references_, path14, value);
6696
+ return yield* FromAsyncIterator5(schema_, references_, path15, value);
6697
6697
  case "BigInt":
6698
- return yield* FromBigInt3(schema_, references_, path14, value);
6698
+ return yield* FromBigInt3(schema_, references_, path15, value);
6699
6699
  case "Boolean":
6700
- return yield* FromBoolean3(schema_, references_, path14, value);
6700
+ return yield* FromBoolean3(schema_, references_, path15, value);
6701
6701
  case "Constructor":
6702
- return yield* FromConstructor5(schema_, references_, path14, value);
6702
+ return yield* FromConstructor5(schema_, references_, path15, value);
6703
6703
  case "Date":
6704
- return yield* FromDate3(schema_, references_, path14, value);
6704
+ return yield* FromDate3(schema_, references_, path15, value);
6705
6705
  case "Function":
6706
- return yield* FromFunction5(schema_, references_, path14, value);
6706
+ return yield* FromFunction5(schema_, references_, path15, value);
6707
6707
  case "Import":
6708
- return yield* FromImport2(schema_, references_, path14, value);
6708
+ return yield* FromImport2(schema_, references_, path15, value);
6709
6709
  case "Integer":
6710
- return yield* FromInteger3(schema_, references_, path14, value);
6710
+ return yield* FromInteger3(schema_, references_, path15, value);
6711
6711
  case "Intersect":
6712
- return yield* FromIntersect10(schema_, references_, path14, value);
6712
+ return yield* FromIntersect10(schema_, references_, path15, value);
6713
6713
  case "Iterator":
6714
- return yield* FromIterator5(schema_, references_, path14, value);
6714
+ return yield* FromIterator5(schema_, references_, path15, value);
6715
6715
  case "Literal":
6716
- return yield* FromLiteral4(schema_, references_, path14, value);
6716
+ return yield* FromLiteral4(schema_, references_, path15, value);
6717
6717
  case "Never":
6718
- return yield* FromNever3(schema_, references_, path14, value);
6718
+ return yield* FromNever3(schema_, references_, path15, value);
6719
6719
  case "Not":
6720
- return yield* FromNot3(schema_, references_, path14, value);
6720
+ return yield* FromNot3(schema_, references_, path15, value);
6721
6721
  case "Null":
6722
- return yield* FromNull3(schema_, references_, path14, value);
6722
+ return yield* FromNull3(schema_, references_, path15, value);
6723
6723
  case "Number":
6724
- return yield* FromNumber3(schema_, references_, path14, value);
6724
+ return yield* FromNumber3(schema_, references_, path15, value);
6725
6725
  case "Object":
6726
- return yield* FromObject9(schema_, references_, path14, value);
6726
+ return yield* FromObject9(schema_, references_, path15, value);
6727
6727
  case "Promise":
6728
- return yield* FromPromise5(schema_, references_, path14, value);
6728
+ return yield* FromPromise5(schema_, references_, path15, value);
6729
6729
  case "Record":
6730
- return yield* FromRecord5(schema_, references_, path14, value);
6730
+ return yield* FromRecord5(schema_, references_, path15, value);
6731
6731
  case "Ref":
6732
- return yield* FromRef6(schema_, references_, path14, value);
6732
+ return yield* FromRef6(schema_, references_, path15, value);
6733
6733
  case "RegExp":
6734
- return yield* FromRegExp3(schema_, references_, path14, value);
6734
+ return yield* FromRegExp3(schema_, references_, path15, value);
6735
6735
  case "String":
6736
- return yield* FromString3(schema_, references_, path14, value);
6736
+ return yield* FromString3(schema_, references_, path15, value);
6737
6737
  case "Symbol":
6738
- return yield* FromSymbol3(schema_, references_, path14, value);
6738
+ return yield* FromSymbol3(schema_, references_, path15, value);
6739
6739
  case "TemplateLiteral":
6740
- return yield* FromTemplateLiteral5(schema_, references_, path14, value);
6740
+ return yield* FromTemplateLiteral5(schema_, references_, path15, value);
6741
6741
  case "This":
6742
- return yield* FromThis2(schema_, references_, path14, value);
6742
+ return yield* FromThis2(schema_, references_, path15, value);
6743
6743
  case "Tuple":
6744
- return yield* FromTuple7(schema_, references_, path14, value);
6744
+ return yield* FromTuple7(schema_, references_, path15, value);
6745
6745
  case "Undefined":
6746
- return yield* FromUndefined3(schema_, references_, path14, value);
6746
+ return yield* FromUndefined3(schema_, references_, path15, value);
6747
6747
  case "Union":
6748
- return yield* FromUnion12(schema_, references_, path14, value);
6748
+ return yield* FromUnion12(schema_, references_, path15, value);
6749
6749
  case "Uint8Array":
6750
- return yield* FromUint8Array3(schema_, references_, path14, value);
6750
+ return yield* FromUint8Array3(schema_, references_, path15, value);
6751
6751
  case "Unknown":
6752
- return yield* FromUnknown3(schema_, references_, path14, value);
6752
+ return yield* FromUnknown3(schema_, references_, path15, value);
6753
6753
  case "Void":
6754
- return yield* FromVoid3(schema_, references_, path14, value);
6754
+ return yield* FromVoid3(schema_, references_, path15, value);
6755
6755
  default:
6756
6756
  if (!type_exports2.Has(schema_[Kind]))
6757
6757
  throw new ValueErrorsUnknownTypeError(schema);
6758
- return yield* FromKind2(schema_, references_, path14, value);
6758
+ return yield* FromKind2(schema_, references_, path15, value);
6759
6759
  }
6760
6760
  }
6761
6761
  function Errors(...args) {
@@ -7797,58 +7797,58 @@ var TransformDecodeCheckError = class extends TypeBoxError {
7797
7797
  }
7798
7798
  };
7799
7799
  var TransformDecodeError = class extends TypeBoxError {
7800
- constructor(schema, path14, value, error) {
7800
+ constructor(schema, path15, value, error) {
7801
7801
  super(error instanceof Error ? error.message : "Unknown error");
7802
7802
  this.schema = schema;
7803
- this.path = path14;
7803
+ this.path = path15;
7804
7804
  this.value = value;
7805
7805
  this.error = error;
7806
7806
  }
7807
7807
  };
7808
- function Default3(schema, path14, value) {
7808
+ function Default3(schema, path15, value) {
7809
7809
  try {
7810
7810
  return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
7811
7811
  } catch (error) {
7812
- throw new TransformDecodeError(schema, path14, value, error);
7812
+ throw new TransformDecodeError(schema, path15, value, error);
7813
7813
  }
7814
7814
  }
7815
- function FromArray14(schema, references, path14, value) {
7816
- return IsArray2(value) ? Default3(schema, path14, value.map((value2, index) => Visit11(schema.items, references, `${path14}/${index}`, value2))) : Default3(schema, path14, value);
7815
+ function FromArray14(schema, references, path15, value) {
7816
+ return IsArray2(value) ? Default3(schema, path15, value.map((value2, index) => Visit11(schema.items, references, `${path15}/${index}`, value2))) : Default3(schema, path15, value);
7817
7817
  }
7818
- function FromIntersect15(schema, references, path14, value) {
7818
+ function FromIntersect15(schema, references, path15, value) {
7819
7819
  if (!IsObject2(value) || IsValueType(value))
7820
- return Default3(schema, path14, value);
7820
+ return Default3(schema, path15, value);
7821
7821
  const knownEntries = KeyOfPropertyEntries(schema);
7822
7822
  const knownKeys = knownEntries.map((entry) => entry[0]);
7823
7823
  const knownProperties = { ...value };
7824
7824
  for (const [knownKey, knownSchema] of knownEntries)
7825
7825
  if (knownKey in knownProperties) {
7826
- knownProperties[knownKey] = Visit11(knownSchema, references, `${path14}/${knownKey}`, knownProperties[knownKey]);
7826
+ knownProperties[knownKey] = Visit11(knownSchema, references, `${path15}/${knownKey}`, knownProperties[knownKey]);
7827
7827
  }
7828
7828
  if (!IsTransform(schema.unevaluatedProperties)) {
7829
- return Default3(schema, path14, knownProperties);
7829
+ return Default3(schema, path15, knownProperties);
7830
7830
  }
7831
7831
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
7832
7832
  const unevaluatedProperties = schema.unevaluatedProperties;
7833
7833
  const unknownProperties = { ...knownProperties };
7834
7834
  for (const key of unknownKeys)
7835
7835
  if (!knownKeys.includes(key)) {
7836
- unknownProperties[key] = Default3(unevaluatedProperties, `${path14}/${key}`, unknownProperties[key]);
7836
+ unknownProperties[key] = Default3(unevaluatedProperties, `${path15}/${key}`, unknownProperties[key]);
7837
7837
  }
7838
- return Default3(schema, path14, unknownProperties);
7838
+ return Default3(schema, path15, unknownProperties);
7839
7839
  }
7840
- function FromImport7(schema, references, path14, value) {
7840
+ function FromImport7(schema, references, path15, value) {
7841
7841
  const additional = globalThis.Object.values(schema.$defs);
7842
7842
  const target = schema.$defs[schema.$ref];
7843
- const result = Visit11(target, [...references, ...additional], path14, value);
7844
- return Default3(schema, path14, result);
7843
+ const result = Visit11(target, [...references, ...additional], path15, value);
7844
+ return Default3(schema, path15, result);
7845
7845
  }
7846
- function FromNot5(schema, references, path14, value) {
7847
- return Default3(schema, path14, Visit11(schema.not, references, path14, value));
7846
+ function FromNot5(schema, references, path15, value) {
7847
+ return Default3(schema, path15, Visit11(schema.not, references, path15, value));
7848
7848
  }
7849
- function FromObject15(schema, references, path14, value) {
7849
+ function FromObject15(schema, references, path15, value) {
7850
7850
  if (!IsObject2(value))
7851
- return Default3(schema, path14, value);
7851
+ return Default3(schema, path15, value);
7852
7852
  const knownKeys = KeyOfPropertyKeys(schema);
7853
7853
  const knownProperties = { ...value };
7854
7854
  for (const key of knownKeys) {
@@ -7856,90 +7856,90 @@ function FromObject15(schema, references, path14, value) {
7856
7856
  continue;
7857
7857
  if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
7858
7858
  continue;
7859
- knownProperties[key] = Visit11(schema.properties[key], references, `${path14}/${key}`, knownProperties[key]);
7859
+ knownProperties[key] = Visit11(schema.properties[key], references, `${path15}/${key}`, knownProperties[key]);
7860
7860
  }
7861
7861
  if (!IsSchema(schema.additionalProperties)) {
7862
- return Default3(schema, path14, knownProperties);
7862
+ return Default3(schema, path15, knownProperties);
7863
7863
  }
7864
7864
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
7865
7865
  const additionalProperties = schema.additionalProperties;
7866
7866
  const unknownProperties = { ...knownProperties };
7867
7867
  for (const key of unknownKeys)
7868
7868
  if (!knownKeys.includes(key)) {
7869
- unknownProperties[key] = Default3(additionalProperties, `${path14}/${key}`, unknownProperties[key]);
7869
+ unknownProperties[key] = Default3(additionalProperties, `${path15}/${key}`, unknownProperties[key]);
7870
7870
  }
7871
- return Default3(schema, path14, unknownProperties);
7871
+ return Default3(schema, path15, unknownProperties);
7872
7872
  }
7873
- function FromRecord10(schema, references, path14, value) {
7873
+ function FromRecord10(schema, references, path15, value) {
7874
7874
  if (!IsObject2(value))
7875
- return Default3(schema, path14, value);
7875
+ return Default3(schema, path15, value);
7876
7876
  const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
7877
7877
  const knownKeys = new RegExp(pattern);
7878
7878
  const knownProperties = { ...value };
7879
7879
  for (const key of Object.getOwnPropertyNames(value))
7880
7880
  if (knownKeys.test(key)) {
7881
- knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path14}/${key}`, knownProperties[key]);
7881
+ knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path15}/${key}`, knownProperties[key]);
7882
7882
  }
7883
7883
  if (!IsSchema(schema.additionalProperties)) {
7884
- return Default3(schema, path14, knownProperties);
7884
+ return Default3(schema, path15, knownProperties);
7885
7885
  }
7886
7886
  const unknownKeys = Object.getOwnPropertyNames(knownProperties);
7887
7887
  const additionalProperties = schema.additionalProperties;
7888
7888
  const unknownProperties = { ...knownProperties };
7889
7889
  for (const key of unknownKeys)
7890
7890
  if (!knownKeys.test(key)) {
7891
- unknownProperties[key] = Default3(additionalProperties, `${path14}/${key}`, unknownProperties[key]);
7891
+ unknownProperties[key] = Default3(additionalProperties, `${path15}/${key}`, unknownProperties[key]);
7892
7892
  }
7893
- return Default3(schema, path14, unknownProperties);
7893
+ return Default3(schema, path15, unknownProperties);
7894
7894
  }
7895
- function FromRef11(schema, references, path14, value) {
7895
+ function FromRef11(schema, references, path15, value) {
7896
7896
  const target = Deref(schema, references);
7897
- return Default3(schema, path14, Visit11(target, references, path14, value));
7897
+ return Default3(schema, path15, Visit11(target, references, path15, value));
7898
7898
  }
7899
- function FromThis7(schema, references, path14, value) {
7899
+ function FromThis7(schema, references, path15, value) {
7900
7900
  const target = Deref(schema, references);
7901
- return Default3(schema, path14, Visit11(target, references, path14, value));
7901
+ return Default3(schema, path15, Visit11(target, references, path15, value));
7902
7902
  }
7903
- function FromTuple12(schema, references, path14, value) {
7904
- return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path14, schema.items.map((schema2, index) => Visit11(schema2, references, `${path14}/${index}`, value[index]))) : Default3(schema, path14, value);
7903
+ function FromTuple12(schema, references, path15, value) {
7904
+ return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path15, schema.items.map((schema2, index) => Visit11(schema2, references, `${path15}/${index}`, value[index]))) : Default3(schema, path15, value);
7905
7905
  }
7906
- function FromUnion17(schema, references, path14, value) {
7906
+ function FromUnion17(schema, references, path15, value) {
7907
7907
  for (const subschema of schema.anyOf) {
7908
7908
  if (!Check(subschema, references, value))
7909
7909
  continue;
7910
- const decoded = Visit11(subschema, references, path14, value);
7911
- return Default3(schema, path14, decoded);
7910
+ const decoded = Visit11(subschema, references, path15, value);
7911
+ return Default3(schema, path15, decoded);
7912
7912
  }
7913
- return Default3(schema, path14, value);
7913
+ return Default3(schema, path15, value);
7914
7914
  }
7915
- function Visit11(schema, references, path14, value) {
7915
+ function Visit11(schema, references, path15, value) {
7916
7916
  const references_ = Pushref(schema, references);
7917
7917
  const schema_ = schema;
7918
7918
  switch (schema[Kind]) {
7919
7919
  case "Array":
7920
- return FromArray14(schema_, references_, path14, value);
7920
+ return FromArray14(schema_, references_, path15, value);
7921
7921
  case "Import":
7922
- return FromImport7(schema_, references_, path14, value);
7922
+ return FromImport7(schema_, references_, path15, value);
7923
7923
  case "Intersect":
7924
- return FromIntersect15(schema_, references_, path14, value);
7924
+ return FromIntersect15(schema_, references_, path15, value);
7925
7925
  case "Not":
7926
- return FromNot5(schema_, references_, path14, value);
7926
+ return FromNot5(schema_, references_, path15, value);
7927
7927
  case "Object":
7928
- return FromObject15(schema_, references_, path14, value);
7928
+ return FromObject15(schema_, references_, path15, value);
7929
7929
  case "Record":
7930
- return FromRecord10(schema_, references_, path14, value);
7930
+ return FromRecord10(schema_, references_, path15, value);
7931
7931
  case "Ref":
7932
- return FromRef11(schema_, references_, path14, value);
7932
+ return FromRef11(schema_, references_, path15, value);
7933
7933
  case "Symbol":
7934
- return Default3(schema_, path14, value);
7934
+ return Default3(schema_, path15, value);
7935
7935
  case "This":
7936
- return FromThis7(schema_, references_, path14, value);
7936
+ return FromThis7(schema_, references_, path15, value);
7937
7937
  case "Tuple":
7938
- return FromTuple12(schema_, references_, path14, value);
7938
+ return FromTuple12(schema_, references_, path15, value);
7939
7939
  case "Union":
7940
- return FromUnion17(schema_, references_, path14, value);
7940
+ return FromUnion17(schema_, references_, path15, value);
7941
7941
  default:
7942
- return Default3(schema_, path14, value);
7942
+ return Default3(schema_, path15, value);
7943
7943
  }
7944
7944
  }
7945
7945
  function TransformDecode(schema, references, value) {
@@ -7956,33 +7956,33 @@ var TransformEncodeCheckError = class extends TypeBoxError {
7956
7956
  }
7957
7957
  };
7958
7958
  var TransformEncodeError = class extends TypeBoxError {
7959
- constructor(schema, path14, value, error) {
7959
+ constructor(schema, path15, value, error) {
7960
7960
  super(`${error instanceof Error ? error.message : "Unknown error"}`);
7961
7961
  this.schema = schema;
7962
- this.path = path14;
7962
+ this.path = path15;
7963
7963
  this.value = value;
7964
7964
  this.error = error;
7965
7965
  }
7966
7966
  };
7967
- function Default4(schema, path14, value) {
7967
+ function Default4(schema, path15, value) {
7968
7968
  try {
7969
7969
  return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
7970
7970
  } catch (error) {
7971
- throw new TransformEncodeError(schema, path14, value, error);
7971
+ throw new TransformEncodeError(schema, path15, value, error);
7972
7972
  }
7973
7973
  }
7974
- function FromArray15(schema, references, path14, value) {
7975
- const defaulted = Default4(schema, path14, value);
7976
- return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path14}/${index}`, value2)) : defaulted;
7974
+ function FromArray15(schema, references, path15, value) {
7975
+ const defaulted = Default4(schema, path15, value);
7976
+ return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path15}/${index}`, value2)) : defaulted;
7977
7977
  }
7978
- function FromImport8(schema, references, path14, value) {
7978
+ function FromImport8(schema, references, path15, value) {
7979
7979
  const additional = globalThis.Object.values(schema.$defs);
7980
7980
  const target = schema.$defs[schema.$ref];
7981
- const result = Default4(schema, path14, value);
7982
- return Visit12(target, [...references, ...additional], path14, result);
7981
+ const result = Default4(schema, path15, value);
7982
+ return Visit12(target, [...references, ...additional], path15, result);
7983
7983
  }
7984
- function FromIntersect16(schema, references, path14, value) {
7985
- const defaulted = Default4(schema, path14, value);
7984
+ function FromIntersect16(schema, references, path15, value) {
7985
+ const defaulted = Default4(schema, path15, value);
7986
7986
  if (!IsObject2(value) || IsValueType(value))
7987
7987
  return defaulted;
7988
7988
  const knownEntries = KeyOfPropertyEntries(schema);
@@ -7990,7 +7990,7 @@ function FromIntersect16(schema, references, path14, value) {
7990
7990
  const knownProperties = { ...defaulted };
7991
7991
  for (const [knownKey, knownSchema] of knownEntries)
7992
7992
  if (knownKey in knownProperties) {
7993
- knownProperties[knownKey] = Visit12(knownSchema, references, `${path14}/${knownKey}`, knownProperties[knownKey]);
7993
+ knownProperties[knownKey] = Visit12(knownSchema, references, `${path15}/${knownKey}`, knownProperties[knownKey]);
7994
7994
  }
7995
7995
  if (!IsTransform(schema.unevaluatedProperties)) {
7996
7996
  return knownProperties;
@@ -8000,15 +8000,15 @@ function FromIntersect16(schema, references, path14, value) {
8000
8000
  const properties = { ...knownProperties };
8001
8001
  for (const key of unknownKeys)
8002
8002
  if (!knownKeys.includes(key)) {
8003
- properties[key] = Default4(unevaluatedProperties, `${path14}/${key}`, properties[key]);
8003
+ properties[key] = Default4(unevaluatedProperties, `${path15}/${key}`, properties[key]);
8004
8004
  }
8005
8005
  return properties;
8006
8006
  }
8007
- function FromNot6(schema, references, path14, value) {
8008
- return Default4(schema.not, path14, Default4(schema, path14, value));
8007
+ function FromNot6(schema, references, path15, value) {
8008
+ return Default4(schema.not, path15, Default4(schema, path15, value));
8009
8009
  }
8010
- function FromObject16(schema, references, path14, value) {
8011
- const defaulted = Default4(schema, path14, value);
8010
+ function FromObject16(schema, references, path15, value) {
8011
+ const defaulted = Default4(schema, path15, value);
8012
8012
  if (!IsObject2(defaulted))
8013
8013
  return defaulted;
8014
8014
  const knownKeys = KeyOfPropertyKeys(schema);
@@ -8018,7 +8018,7 @@ function FromObject16(schema, references, path14, value) {
8018
8018
  continue;
8019
8019
  if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
8020
8020
  continue;
8021
- knownProperties[key] = Visit12(schema.properties[key], references, `${path14}/${key}`, knownProperties[key]);
8021
+ knownProperties[key] = Visit12(schema.properties[key], references, `${path15}/${key}`, knownProperties[key]);
8022
8022
  }
8023
8023
  if (!IsSchema(schema.additionalProperties)) {
8024
8024
  return knownProperties;
@@ -8028,12 +8028,12 @@ function FromObject16(schema, references, path14, value) {
8028
8028
  const properties = { ...knownProperties };
8029
8029
  for (const key of unknownKeys)
8030
8030
  if (!knownKeys.includes(key)) {
8031
- properties[key] = Default4(additionalProperties, `${path14}/${key}`, properties[key]);
8031
+ properties[key] = Default4(additionalProperties, `${path15}/${key}`, properties[key]);
8032
8032
  }
8033
8033
  return properties;
8034
8034
  }
8035
- function FromRecord11(schema, references, path14, value) {
8036
- const defaulted = Default4(schema, path14, value);
8035
+ function FromRecord11(schema, references, path15, value) {
8036
+ const defaulted = Default4(schema, path15, value);
8037
8037
  if (!IsObject2(value))
8038
8038
  return defaulted;
8039
8039
  const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
@@ -8041,7 +8041,7 @@ function FromRecord11(schema, references, path14, value) {
8041
8041
  const knownProperties = { ...defaulted };
8042
8042
  for (const key of Object.getOwnPropertyNames(value))
8043
8043
  if (knownKeys.test(key)) {
8044
- knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path14}/${key}`, knownProperties[key]);
8044
+ knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path15}/${key}`, knownProperties[key]);
8045
8045
  }
8046
8046
  if (!IsSchema(schema.additionalProperties)) {
8047
8047
  return knownProperties;
@@ -8051,65 +8051,65 @@ function FromRecord11(schema, references, path14, value) {
8051
8051
  const properties = { ...knownProperties };
8052
8052
  for (const key of unknownKeys)
8053
8053
  if (!knownKeys.test(key)) {
8054
- properties[key] = Default4(additionalProperties, `${path14}/${key}`, properties[key]);
8054
+ properties[key] = Default4(additionalProperties, `${path15}/${key}`, properties[key]);
8055
8055
  }
8056
8056
  return properties;
8057
8057
  }
8058
- function FromRef12(schema, references, path14, value) {
8058
+ function FromRef12(schema, references, path15, value) {
8059
8059
  const target = Deref(schema, references);
8060
- const resolved = Visit12(target, references, path14, value);
8061
- return Default4(schema, path14, resolved);
8060
+ const resolved = Visit12(target, references, path15, value);
8061
+ return Default4(schema, path15, resolved);
8062
8062
  }
8063
- function FromThis8(schema, references, path14, value) {
8063
+ function FromThis8(schema, references, path15, value) {
8064
8064
  const target = Deref(schema, references);
8065
- const resolved = Visit12(target, references, path14, value);
8066
- return Default4(schema, path14, resolved);
8065
+ const resolved = Visit12(target, references, path15, value);
8066
+ return Default4(schema, path15, resolved);
8067
8067
  }
8068
- function FromTuple13(schema, references, path14, value) {
8069
- const value1 = Default4(schema, path14, value);
8070
- return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path14}/${index}`, value1[index])) : [];
8068
+ function FromTuple13(schema, references, path15, value) {
8069
+ const value1 = Default4(schema, path15, value);
8070
+ return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path15}/${index}`, value1[index])) : [];
8071
8071
  }
8072
- function FromUnion18(schema, references, path14, value) {
8072
+ function FromUnion18(schema, references, path15, value) {
8073
8073
  for (const subschema of schema.anyOf) {
8074
8074
  if (!Check(subschema, references, value))
8075
8075
  continue;
8076
- const value1 = Visit12(subschema, references, path14, value);
8077
- return Default4(schema, path14, value1);
8076
+ const value1 = Visit12(subschema, references, path15, value);
8077
+ return Default4(schema, path15, value1);
8078
8078
  }
8079
8079
  for (const subschema of schema.anyOf) {
8080
- const value1 = Visit12(subschema, references, path14, value);
8080
+ const value1 = Visit12(subschema, references, path15, value);
8081
8081
  if (!Check(schema, references, value1))
8082
8082
  continue;
8083
- return Default4(schema, path14, value1);
8083
+ return Default4(schema, path15, value1);
8084
8084
  }
8085
- return Default4(schema, path14, value);
8085
+ return Default4(schema, path15, value);
8086
8086
  }
8087
- function Visit12(schema, references, path14, value) {
8087
+ function Visit12(schema, references, path15, value) {
8088
8088
  const references_ = Pushref(schema, references);
8089
8089
  const schema_ = schema;
8090
8090
  switch (schema[Kind]) {
8091
8091
  case "Array":
8092
- return FromArray15(schema_, references_, path14, value);
8092
+ return FromArray15(schema_, references_, path15, value);
8093
8093
  case "Import":
8094
- return FromImport8(schema_, references_, path14, value);
8094
+ return FromImport8(schema_, references_, path15, value);
8095
8095
  case "Intersect":
8096
- return FromIntersect16(schema_, references_, path14, value);
8096
+ return FromIntersect16(schema_, references_, path15, value);
8097
8097
  case "Not":
8098
- return FromNot6(schema_, references_, path14, value);
8098
+ return FromNot6(schema_, references_, path15, value);
8099
8099
  case "Object":
8100
- return FromObject16(schema_, references_, path14, value);
8100
+ return FromObject16(schema_, references_, path15, value);
8101
8101
  case "Record":
8102
- return FromRecord11(schema_, references_, path14, value);
8102
+ return FromRecord11(schema_, references_, path15, value);
8103
8103
  case "Ref":
8104
- return FromRef12(schema_, references_, path14, value);
8104
+ return FromRef12(schema_, references_, path15, value);
8105
8105
  case "This":
8106
- return FromThis8(schema_, references_, path14, value);
8106
+ return FromThis8(schema_, references_, path15, value);
8107
8107
  case "Tuple":
8108
- return FromTuple13(schema_, references_, path14, value);
8108
+ return FromTuple13(schema_, references_, path15, value);
8109
8109
  case "Union":
8110
- return FromUnion18(schema_, references_, path14, value);
8110
+ return FromUnion18(schema_, references_, path15, value);
8111
8111
  default:
8112
- return Default4(schema_, path14, value);
8112
+ return Default4(schema_, path15, value);
8113
8113
  }
8114
8114
  }
8115
8115
  function TransformEncode(schema, references, value) {
@@ -8377,18 +8377,18 @@ __export(pointer_exports, {
8377
8377
  ValuePointerRootSetError: () => ValuePointerRootSetError
8378
8378
  });
8379
8379
  var ValuePointerRootSetError = class extends TypeBoxError {
8380
- constructor(value, path14, update) {
8380
+ constructor(value, path15, update) {
8381
8381
  super("Cannot set root value");
8382
8382
  this.value = value;
8383
- this.path = path14;
8383
+ this.path = path15;
8384
8384
  this.update = update;
8385
8385
  }
8386
8386
  };
8387
8387
  var ValuePointerRootDeleteError = class extends TypeBoxError {
8388
- constructor(value, path14) {
8388
+ constructor(value, path15) {
8389
8389
  super("Cannot delete root value");
8390
8390
  this.value = value;
8391
- this.path = path14;
8391
+ this.path = path15;
8392
8392
  }
8393
8393
  };
8394
8394
  function Escape2(component) {
@@ -8532,82 +8532,82 @@ var ValueDiffError = class extends TypeBoxError {
8532
8532
  this.value = value;
8533
8533
  }
8534
8534
  };
8535
- function CreateUpdate(path14, value) {
8536
- return { type: "update", path: path14, value };
8535
+ function CreateUpdate(path15, value) {
8536
+ return { type: "update", path: path15, value };
8537
8537
  }
8538
- function CreateInsert(path14, value) {
8539
- return { type: "insert", path: path14, value };
8538
+ function CreateInsert(path15, value) {
8539
+ return { type: "insert", path: path15, value };
8540
8540
  }
8541
- function CreateDelete(path14) {
8542
- return { type: "delete", path: path14 };
8541
+ function CreateDelete(path15) {
8542
+ return { type: "delete", path: path15 };
8543
8543
  }
8544
8544
  function AssertDiffable(value) {
8545
8545
  if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
8546
8546
  throw new ValueDiffError(value, "Cannot diff objects with symbols");
8547
8547
  }
8548
- function* ObjectType4(path14, current, next) {
8548
+ function* ObjectType4(path15, current, next) {
8549
8549
  AssertDiffable(current);
8550
8550
  AssertDiffable(next);
8551
8551
  if (!IsStandardObject(next))
8552
- return yield CreateUpdate(path14, next);
8552
+ return yield CreateUpdate(path15, next);
8553
8553
  const currentKeys = globalThis.Object.getOwnPropertyNames(current);
8554
8554
  const nextKeys = globalThis.Object.getOwnPropertyNames(next);
8555
8555
  for (const key of nextKeys) {
8556
8556
  if (HasPropertyKey2(current, key))
8557
8557
  continue;
8558
- yield CreateInsert(`${path14}/${key}`, next[key]);
8558
+ yield CreateInsert(`${path15}/${key}`, next[key]);
8559
8559
  }
8560
8560
  for (const key of currentKeys) {
8561
8561
  if (!HasPropertyKey2(next, key))
8562
8562
  continue;
8563
8563
  if (Equal(current, next))
8564
8564
  continue;
8565
- yield* Visit15(`${path14}/${key}`, current[key], next[key]);
8565
+ yield* Visit15(`${path15}/${key}`, current[key], next[key]);
8566
8566
  }
8567
8567
  for (const key of currentKeys) {
8568
8568
  if (HasPropertyKey2(next, key))
8569
8569
  continue;
8570
- yield CreateDelete(`${path14}/${key}`);
8570
+ yield CreateDelete(`${path15}/${key}`);
8571
8571
  }
8572
8572
  }
8573
- function* ArrayType4(path14, current, next) {
8573
+ function* ArrayType4(path15, current, next) {
8574
8574
  if (!IsArray2(next))
8575
- return yield CreateUpdate(path14, next);
8575
+ return yield CreateUpdate(path15, next);
8576
8576
  for (let i = 0; i < Math.min(current.length, next.length); i++) {
8577
- yield* Visit15(`${path14}/${i}`, current[i], next[i]);
8577
+ yield* Visit15(`${path15}/${i}`, current[i], next[i]);
8578
8578
  }
8579
8579
  for (let i = 0; i < next.length; i++) {
8580
8580
  if (i < current.length)
8581
8581
  continue;
8582
- yield CreateInsert(`${path14}/${i}`, next[i]);
8582
+ yield CreateInsert(`${path15}/${i}`, next[i]);
8583
8583
  }
8584
8584
  for (let i = current.length - 1; i >= 0; i--) {
8585
8585
  if (i < next.length)
8586
8586
  continue;
8587
- yield CreateDelete(`${path14}/${i}`);
8587
+ yield CreateDelete(`${path15}/${i}`);
8588
8588
  }
8589
8589
  }
8590
- function* TypedArrayType2(path14, current, next) {
8590
+ function* TypedArrayType2(path15, current, next) {
8591
8591
  if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
8592
- return yield CreateUpdate(path14, next);
8592
+ return yield CreateUpdate(path15, next);
8593
8593
  for (let i = 0; i < Math.min(current.length, next.length); i++) {
8594
- yield* Visit15(`${path14}/${i}`, current[i], next[i]);
8594
+ yield* Visit15(`${path15}/${i}`, current[i], next[i]);
8595
8595
  }
8596
8596
  }
8597
- function* ValueType2(path14, current, next) {
8597
+ function* ValueType2(path15, current, next) {
8598
8598
  if (current === next)
8599
8599
  return;
8600
- yield CreateUpdate(path14, next);
8600
+ yield CreateUpdate(path15, next);
8601
8601
  }
8602
- function* Visit15(path14, current, next) {
8602
+ function* Visit15(path15, current, next) {
8603
8603
  if (IsStandardObject(current))
8604
- return yield* ObjectType4(path14, current, next);
8604
+ return yield* ObjectType4(path15, current, next);
8605
8605
  if (IsArray2(current))
8606
- return yield* ArrayType4(path14, current, next);
8606
+ return yield* ArrayType4(path15, current, next);
8607
8607
  if (IsTypedArray(current))
8608
- return yield* TypedArrayType2(path14, current, next);
8608
+ return yield* TypedArrayType2(path15, current, next);
8609
8609
  if (IsValueType(current))
8610
- return yield* ValueType2(path14, current, next);
8610
+ return yield* ValueType2(path15, current, next);
8611
8611
  throw new ValueDiffError(current, "Unable to diff value");
8612
8612
  }
8613
8613
  function Diff(current, next) {
@@ -8664,9 +8664,9 @@ var ValueMutateError = class extends TypeBoxError {
8664
8664
  super(message);
8665
8665
  }
8666
8666
  };
8667
- function ObjectType5(root, path14, current, next) {
8667
+ function ObjectType5(root, path15, current, next) {
8668
8668
  if (!IsStandardObject2(current)) {
8669
- pointer_exports.Set(root, path14, Clone2(next));
8669
+ pointer_exports.Set(root, path15, Clone2(next));
8670
8670
  } else {
8671
8671
  const currentKeys = Object.getOwnPropertyNames(current);
8672
8672
  const nextKeys = Object.getOwnPropertyNames(next);
@@ -8681,43 +8681,43 @@ function ObjectType5(root, path14, current, next) {
8681
8681
  }
8682
8682
  }
8683
8683
  for (const nextKey of nextKeys) {
8684
- Visit16(root, `${path14}/${nextKey}`, current[nextKey], next[nextKey]);
8684
+ Visit16(root, `${path15}/${nextKey}`, current[nextKey], next[nextKey]);
8685
8685
  }
8686
8686
  }
8687
8687
  }
8688
- function ArrayType5(root, path14, current, next) {
8688
+ function ArrayType5(root, path15, current, next) {
8689
8689
  if (!IsArray2(current)) {
8690
- pointer_exports.Set(root, path14, Clone2(next));
8690
+ pointer_exports.Set(root, path15, Clone2(next));
8691
8691
  } else {
8692
8692
  for (let index = 0; index < next.length; index++) {
8693
- Visit16(root, `${path14}/${index}`, current[index], next[index]);
8693
+ Visit16(root, `${path15}/${index}`, current[index], next[index]);
8694
8694
  }
8695
8695
  current.splice(next.length);
8696
8696
  }
8697
8697
  }
8698
- function TypedArrayType3(root, path14, current, next) {
8698
+ function TypedArrayType3(root, path15, current, next) {
8699
8699
  if (IsTypedArray(current) && current.length === next.length) {
8700
8700
  for (let i = 0; i < current.length; i++) {
8701
8701
  current[i] = next[i];
8702
8702
  }
8703
8703
  } else {
8704
- pointer_exports.Set(root, path14, Clone2(next));
8704
+ pointer_exports.Set(root, path15, Clone2(next));
8705
8705
  }
8706
8706
  }
8707
- function ValueType3(root, path14, current, next) {
8707
+ function ValueType3(root, path15, current, next) {
8708
8708
  if (current === next)
8709
8709
  return;
8710
- pointer_exports.Set(root, path14, next);
8710
+ pointer_exports.Set(root, path15, next);
8711
8711
  }
8712
- function Visit16(root, path14, current, next) {
8712
+ function Visit16(root, path15, current, next) {
8713
8713
  if (IsArray2(next))
8714
- return ArrayType5(root, path14, current, next);
8714
+ return ArrayType5(root, path15, current, next);
8715
8715
  if (IsTypedArray(next))
8716
- return TypedArrayType3(root, path14, current, next);
8716
+ return TypedArrayType3(root, path15, current, next);
8717
8717
  if (IsStandardObject2(next))
8718
- return ObjectType5(root, path14, current, next);
8718
+ return ObjectType5(root, path15, current, next);
8719
8719
  if (IsValueType(next))
8720
- return ValueType3(root, path14, current, next);
8720
+ return ValueType3(root, path15, current, next);
8721
8721
  }
8722
8722
  function IsNonMutableValue(value) {
8723
8723
  return IsTypedArray(value) || IsValueType(value);
@@ -8815,8 +8815,8 @@ __export(value_exports2, {
8815
8815
  });
8816
8816
 
8817
8817
  // src/lib/types.ts
8818
- var CURRENT_REGISTRY_VERSION = 3;
8819
- var CAPSULE_VERSION = 2;
8818
+ var CURRENT_REGISTRY_VERSION = 4;
8819
+ var CAPSULE_VERSION = 3;
8820
8820
  var MAX_POST_ERROR_LENGTH = 500;
8821
8821
  var MAX_NAME_LENGTH = 100;
8822
8822
  var DOCTOR_ALL_COOLDOWN_MS = 60 * 60 * 1e3;
@@ -8850,6 +8850,7 @@ var TopicEntrySchema = Type.Object({
8850
8850
  lastMessageAt: Type.Union([Type.String(), Type.Null()]),
8851
8851
  lastDoctorReportAt: Type.Union([Type.String(), Type.Null()]),
8852
8852
  lastDoctorRunAt: Type.Union([Type.String(), Type.Null()]),
8853
+ lastCapsuleWriteAt: Type.Union([Type.String(), Type.Null()]),
8853
8854
  snoozeUntil: Type.Union([Type.String(), Type.Null()]),
8854
8855
  ignoreChecks: Type.Array(Type.String()),
8855
8856
  consecutiveSilentDoctors: Type.Integer({ minimum: 0 }),
@@ -8916,6 +8917,17 @@ var migrations = {
8916
8917
  data["autopilotEnabled"] = false;
8917
8918
  }
8918
8919
  return data;
8920
+ },
8921
+ "3_to_4": (data) => {
8922
+ const topics = data["topics"];
8923
+ if (topics && typeof topics === "object" && !Array.isArray(topics)) {
8924
+ for (const entry of Object.values(topics)) {
8925
+ if (entry["lastCapsuleWriteAt"] === void 0) {
8926
+ entry["lastCapsuleWriteAt"] = null;
8927
+ }
8928
+ }
8929
+ }
8930
+ return data;
8919
8931
  }
8920
8932
  };
8921
8933
  function migrateRegistry(data) {
@@ -9124,11 +9136,13 @@ ${(/* @__PURE__ */ new Date()).toISOString()}
9124
9136
 
9125
9137
  _Waiting for first instructions._
9126
9138
 
9127
- ## Next 3 actions
9139
+ ## Next actions (now)
9140
+
9141
+ 1. _e.g. Set up project scaffolding_
9142
+
9143
+ ## Upcoming actions
9128
9144
 
9129
- 1. [T-1] _e.g. Set up project scaffolding_
9130
- 2. [T-2] _Waiting for next task_
9131
- 3. [T-3] _Waiting for next task_
9145
+ _See TODO.md for full backlog._
9132
9146
  `,
9133
9147
  "TODO.md": (name) => `# TODO: ${name}
9134
9148
 
@@ -9315,6 +9329,30 @@ function checkAuthorization(userId, command, registry, topicAllowFrom) {
9315
9329
 
9316
9330
  // src/lib/telegram.ts
9317
9331
  var TELEGRAM_MSG_LIMIT = 4096;
9332
+ function buildDailyReport(data) {
9333
+ const n = htmlEscape(data.name);
9334
+ const lines = [
9335
+ `<b>Daily Report: ${n}</b>`,
9336
+ "",
9337
+ `<b>Done today</b>`,
9338
+ htmlEscape(data.doneContent),
9339
+ "",
9340
+ `<b>New learnings</b>`,
9341
+ htmlEscape(data.learningsContent),
9342
+ "",
9343
+ `<b>Blockers/Risks</b>`,
9344
+ htmlEscape(data.blockersContent),
9345
+ "",
9346
+ `<b>Next actions (now)</b>`,
9347
+ htmlEscape(data.nextContent),
9348
+ "",
9349
+ `<b>Upcoming</b>`,
9350
+ htmlEscape(data.upcomingContent),
9351
+ "",
9352
+ `<b>Health:</b> ${data.health}`
9353
+ ];
9354
+ return truncateMessage(lines.join("\n"));
9355
+ }
9318
9356
  var DEFAULT_RATE_LIMIT = {
9319
9357
  sameGroupDelayMs: 4e3,
9320
9358
  crossGroupDelayMs: 1e3
@@ -9360,43 +9398,47 @@ function buildInitConfirmButton(groupId, threadId, secret, userId, type) {
9360
9398
  return buildInlineKeyboard([[{ text: "Confirm", callback_data: cb }]]);
9361
9399
  }
9362
9400
  function buildTopicCard(name, slug, type, capsuleVersion) {
9363
- const n = htmlEscape(name);
9364
- const s = htmlEscape(slug);
9365
- const t = htmlEscape(type);
9366
- const v = htmlEscape(String(capsuleVersion));
9367
9401
  return [
9368
- `<b>Topic: ${n}</b>`,
9369
- `Type: ${t} | Version: ${v}`,
9370
- `Capsule: projects/${s}/`,
9402
+ `**Topic: ${name}**`,
9403
+ `Type: ${type} | Version: ${capsuleVersion}`,
9404
+ `Capsule: projects/${slug}/`,
9371
9405
  "",
9372
- "<b>How it works</b>",
9406
+ "**How it works**",
9373
9407
  "Just send your instructions in this topic. The agent",
9374
9408
  "maintains STATUS.md and TODO.md automatically as it",
9375
9409
  "works \u2014 nothing is lost on reset or context compaction.",
9376
9410
  "Doctor checks run periodically and alert you if anything",
9377
9411
  "needs attention.",
9378
9412
  "",
9379
- "<b>Commands:</b>",
9413
+ "**Commands:**",
9380
9414
  "/tm status \u2014 quick STATUS.md view",
9381
9415
  "/tm doctor \u2014 run health checks",
9382
- "/tm rename &lt;name&gt; \u2014 rename this topic",
9416
+ "/tm rename <name> \u2014 rename this topic",
9383
9417
  "/tm list \u2014 all topics",
9384
9418
  "/tm archive \u2014 archive this topic",
9385
9419
  "/tm help \u2014 full command reference"
9386
9420
  ].join("\n");
9387
9421
  }
9388
- function buildDoctorReport(name, results) {
9389
- const n = htmlEscape(name);
9390
- const lines = [`<b>Doctor: ${n}</b>`, ""];
9422
+ function buildDoctorReport(name, results, format = "markdown") {
9423
+ const isHtml = format === "html";
9424
+ const n = isHtml ? htmlEscape(name) : name;
9425
+ const bold = (s) => isHtml ? `<b>${s}</b>` : `**${s}**`;
9426
+ const code = (s) => isHtml ? `<code>${s}</code>` : `\`${s}\``;
9427
+ const lines = [bold(`Doctor: ${n}`), ""];
9391
9428
  if (results.length === 0) {
9392
9429
  lines.push("All checks passed.");
9393
9430
  return lines.join("\n");
9394
9431
  }
9395
9432
  for (const r of results) {
9396
9433
  const icon = severityIcon(r.severity);
9397
- const msg = htmlEscape(r.message);
9434
+ const msg = isHtml ? htmlEscape(r.message) : r.message;
9435
+ const checkId = isHtml ? htmlEscape(r.checkId) : r.checkId;
9398
9436
  const fix = r.fixable ? " [fixable]" : "";
9399
- lines.push(`${icon} <code>${htmlEscape(r.checkId)}</code>: ${msg}${fix}`);
9437
+ lines.push(`${icon} ${code(checkId)}: ${msg}${fix}`);
9438
+ if (r.remediation) {
9439
+ const rem = isHtml ? htmlEscape(r.remediation) : r.remediation;
9440
+ lines.push(` \u2192 ${rem}`);
9441
+ }
9400
9442
  }
9401
9443
  lines.push("");
9402
9444
  lines.push("Reply /tm doctor to re-check, or use the buttons below.");
@@ -9419,38 +9461,39 @@ function severityIcon(severity) {
9419
9461
  }
9420
9462
  function buildHelpCard() {
9421
9463
  return [
9422
- "<b>Topic Manager Commands</b>",
9464
+ "**Topic Manager Commands**",
9423
9465
  "",
9424
9466
  "/tm init \u2014 register this topic",
9425
9467
  "/tm status \u2014 quick STATUS.md view",
9426
9468
  "/tm doctor \u2014 run health checks",
9427
9469
  "/tm doctor --all \u2014 check all topics",
9428
- "/tm rename &lt;name&gt; \u2014 rename this topic",
9470
+ "/tm rename <name> \u2014 rename this topic",
9429
9471
  "/tm list \u2014 all topics",
9430
9472
  "/tm sync \u2014 re-apply config",
9431
9473
  "/tm upgrade \u2014 update capsule template",
9432
- "/tm snooze &lt;Nd&gt; \u2014 snooze doctor (7d, 30d, etc.)",
9474
+ "/tm snooze <Nd> \u2014 snooze doctor (7d, 30d, etc.)",
9433
9475
  "/tm archive \u2014 archive topic",
9434
9476
  "/tm unarchive \u2014 reactivate topic",
9435
9477
  "/tm autopilot [enable|disable|status] \u2014 daily sweeps",
9478
+ "/tm daily-report \u2014 generate daily status report",
9436
9479
  "/tm help \u2014 this message"
9437
9480
  ].join("\n");
9438
9481
  }
9439
9482
  function buildListMessage(topics) {
9440
9483
  if (topics.length === 0) {
9441
- return "<b>Topic Registry</b> (0 topics)\n\nNo topics registered.";
9484
+ return "**Topic Registry** (0 topics)\n\nNo topics registered.";
9442
9485
  }
9443
9486
  const sorted = [...topics].sort((a, b) => {
9444
9487
  const order = { active: 0, snoozed: 1, archived: 2 };
9445
9488
  return (order[a.status] ?? 3) - (order[b.status] ?? 3);
9446
9489
  });
9447
- const lines = [`<b>Topic Registry</b> (${topics.length} topics)`, ""];
9490
+ const lines = [`**Topic Registry** (${topics.length} topics)`, ""];
9448
9491
  let rendered = 0;
9449
9492
  for (const t of sorted) {
9450
9493
  const entry = [
9451
- `<b>${htmlEscape(t.name)}</b> [${htmlEscape(t.type)}] ${htmlEscape(t.status)}`,
9494
+ `**${t.name}** [${t.type}] ${t.status}`,
9452
9495
  ` Last active: ${t.lastMessageAt ? relativeTime(t.lastMessageAt) : "never"}`,
9453
- ` Thread: #${htmlEscape(t.threadId)}`
9496
+ ` Thread: #${t.threadId}`
9454
9497
  ].join("\n");
9455
9498
  const tentative = [...lines, entry, ""].join("\n");
9456
9499
  if (tentative.length > TELEGRAM_MSG_LIMIT - 40) {
@@ -9500,7 +9543,7 @@ function createRateLimitedPoster(postFn, config = DEFAULT_RATE_LIMIT) {
9500
9543
  };
9501
9544
  }
9502
9545
  function sleep(ms) {
9503
- return new Promise((resolve5) => setTimeout(resolve5, ms));
9546
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
9504
9547
  }
9505
9548
  function isTooManyRequestsError(err) {
9506
9549
  if (err && typeof err === "object" && "status" in err) {
@@ -9519,11 +9562,7 @@ function getRetryAfter(err) {
9519
9562
  function truncateMessage(msg, limit = TELEGRAM_MSG_LIMIT) {
9520
9563
  if (msg.length <= limit) return msg;
9521
9564
  const suffix = "\n\n... (truncated)";
9522
- let truncated = msg.slice(0, limit - suffix.length);
9523
- const lastOpen = truncated.lastIndexOf("<");
9524
- if (lastOpen !== -1 && lastOpen > truncated.lastIndexOf(">")) {
9525
- truncated = truncated.slice(0, lastOpen);
9526
- }
9565
+ const truncated = msg.slice(0, limit - suffix.length);
9527
9566
  return truncated + suffix;
9528
9567
  }
9529
9568
 
@@ -9545,13 +9584,16 @@ Determinism rules:
9545
9584
  commands, or task state.
9546
9585
  - Before context compaction or when the conversation is long: proactively
9547
9586
  flush current progress to STATUS.md (update "Last done (UTC)" and
9548
- "Next 3 actions") so compaction cannot erase critical state.
9587
+ "Next actions (now)") so compaction cannot erase critical state.
9549
9588
  Use the standard file write tool directly \u2014 do not route through /tm.
9550
- - Keep STATUS.md accurate: always maintain "Last done (UTC)" and "Next 3 actions".
9589
+ - Keep STATUS.md accurate: always maintain "Last done (UTC)", "Next actions (now)",
9590
+ and "Upcoming actions".
9551
9591
  - When new commands appear, add them to COMMANDS.md (don't leave them only in chat).
9552
9592
  - When new links/paths/services appear, add them to LINKS.md.
9553
9593
  - If automation/cron is involved, record job IDs + schedules in CRON.md.
9554
9594
  - Task IDs (e.g., [T-1]) must stay consistent between STATUS.md and TODO.md.
9595
+ - STATUS.md has two priority sections: "Next actions (now)" for immediate work
9596
+ and "Upcoming actions" for the near-future pipeline.
9555
9597
 
9556
9598
  Learning capture:
9557
9599
  - When you discover something unexpected, a mistake, a workaround, or a
@@ -9562,7 +9604,11 @@ Learning capture:
9562
9604
  - If LEARNINGS.md exceeds ~200 lines, archive older entries to LEARNINGS-archive.md.
9563
9605
 
9564
9606
  Separation:
9565
- - Do not mix in other topics' work unless explicitly requested.
9607
+ - Your workspace is strictly projects/${slug}/. Do not read, write, or reference
9608
+ files in any other topic's capsule directory.
9609
+ - If the user mentions another topic by name or slug, ask for explicit
9610
+ confirmation before mixing work: "This references topic X \u2014 switch context?"
9611
+ - Never copy data between topic capsules without explicit user instruction.
9566
9612
  - Ask one clarifying question if the next action is ambiguous.`;
9567
9613
  }
9568
9614
  function computeRegistryHash(topics) {
@@ -9745,7 +9791,7 @@ function isHashMismatchError(err) {
9745
9791
  return false;
9746
9792
  }
9747
9793
  function sleep2(ms) {
9748
- return new Promise((resolve5) => setTimeout(resolve5, ms));
9794
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
9749
9795
  }
9750
9796
  async function getConfigWrites(rpc) {
9751
9797
  if (!rpc) return false;
@@ -9802,8 +9848,7 @@ async function handleInit(ctx, args) {
9802
9848
  const key = topicKey(groupId, threadId);
9803
9849
  if (registry.topics[key]) {
9804
9850
  return {
9805
- text: `This topic is already registered as <b>${htmlEscape(registry.topics[key].name)}</b>.`,
9806
- parseMode: "HTML"
9851
+ text: `This topic is already registered as "${registry.topics[key].name}".`
9807
9852
  };
9808
9853
  }
9809
9854
  const parts = args.trim().split(/\s+/);
@@ -9826,7 +9871,7 @@ async function handleInit(ctx, args) {
9826
9871
  return { text: "Projects base is a symlink. Aborting for security." };
9827
9872
  }
9828
9873
  if (fs6.existsSync(path6.join(projectsBase, finalSlug))) {
9829
- return { text: `Directory projects/${htmlEscape(finalSlug)}/ already exists on disk.` };
9874
+ return { text: `Directory projects/${finalSlug}/ already exists on disk.` };
9830
9875
  }
9831
9876
  const targetPath = path6.join(projectsBase, finalSlug);
9832
9877
  if (rejectSymlink(targetPath)) {
@@ -9847,6 +9892,7 @@ async function handleInit(ctx, args) {
9847
9892
  lastMessageAt: (/* @__PURE__ */ new Date()).toISOString(),
9848
9893
  lastDoctorReportAt: null,
9849
9894
  lastDoctorRunAt: null,
9895
+ lastCapsuleWriteAt: null,
9850
9896
  snoozeUntil: null,
9851
9897
  ignoreChecks: [],
9852
9898
  consecutiveSilentDoctors: 0,
@@ -9860,7 +9906,7 @@ async function handleInit(ctx, args) {
9860
9906
  });
9861
9907
  } catch (err) {
9862
9908
  const msg = err instanceof Error ? err.message : String(err);
9863
- return { text: `Failed to initialize topic: ${htmlEscape(msg)}` };
9909
+ return { text: `Failed to initialize topic: ${msg}` };
9864
9910
  }
9865
9911
  let restartMsg = "";
9866
9912
  const configWritesEnabled = await getConfigWrites(ctx.rpc);
@@ -9875,7 +9921,7 @@ async function handleInit(ctx, args) {
9875
9921
  } catch (err) {
9876
9922
  const msg = err instanceof Error ? err.message : String(err);
9877
9923
  restartMsg = `
9878
- Warning: include generation failed: ${htmlEscape(msg)}`;
9924
+ Warning: include generation failed: ${msg}`;
9879
9925
  }
9880
9926
  }
9881
9927
  appendAudit(
@@ -9890,7 +9936,6 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
9890
9936
  const autopilotTip = "\n\nTip: Enable daily health sweeps with /tm autopilot enable";
9891
9937
  return {
9892
9938
  text: `${topicCard}${adminNote}${restartMsg}${autopilotTip}`,
9893
- parseMode: "HTML",
9894
9939
  pin: true
9895
9940
  };
9896
9941
  }
@@ -9923,14 +9968,12 @@ async function buildTypePicker(ctx) {
9923
9968
  const key = topicKey(groupId, threadId);
9924
9969
  if (registry.topics[key]) {
9925
9970
  return {
9926
- text: `This topic is already registered as <b>${htmlEscape(registry.topics[key].name)}</b>.`,
9927
- parseMode: "HTML"
9971
+ text: `This topic is already registered as "${registry.topics[key].name}".`
9928
9972
  };
9929
9973
  }
9930
9974
  const keyboard = buildInitTypeButtons(groupId, threadId, registry.callbackSecret, userId);
9931
9975
  return {
9932
9976
  text: "Pick a topic type:",
9933
- parseMode: "HTML",
9934
9977
  inlineKeyboard: keyboard
9935
9978
  };
9936
9979
  }
@@ -9957,15 +10000,13 @@ async function handleInitTypeSelect(ctx, type) {
9957
10000
  const key = topicKey(groupId, threadId);
9958
10001
  if (registry.topics[key]) {
9959
10002
  return {
9960
- text: `This topic is already registered as <b>${htmlEscape(registry.topics[key].name)}</b>.`,
9961
- parseMode: "HTML"
10003
+ text: `This topic is already registered as "${registry.topics[key].name}".`
9962
10004
  };
9963
10005
  }
9964
10006
  const name = deriveTopicName("", messageContext, threadId);
9965
10007
  const keyboard = buildInitConfirmButton(groupId, threadId, registry.callbackSecret, userId, type);
9966
10008
  return {
9967
10009
  text: buildInitConfirmMessage(name, type),
9968
- parseMode: "HTML",
9969
10010
  inlineKeyboard: keyboard
9970
10011
  };
9971
10012
  }
@@ -9974,9 +10015,9 @@ async function handleInitNameConfirm(ctx, type) {
9974
10015
  }
9975
10016
  function buildInitConfirmMessage(name, type) {
9976
10017
  return [
9977
- `Name: <b>${htmlEscape(name)}</b> | Type: ${htmlEscape(type)}`,
10018
+ `Name: **${name}** | Type: ${type}`,
9978
10019
  "",
9979
- `To use a different name: /tm init &lt;name&gt; ${htmlEscape(type)}`
10020
+ `To use a different name: /tm init <name> ${type}`
9980
10021
  ].join("\n");
9981
10022
  }
9982
10023
 
@@ -9991,15 +10032,15 @@ import * as path7 from "node:path";
9991
10032
  function isIgnored(entry, checkId) {
9992
10033
  return entry.ignoreChecks.includes(checkId);
9993
10034
  }
9994
- function check(severity, checkId, message, fixable) {
9995
- return { severity, checkId, message, fixable };
10035
+ function check(severity, checkId, message, fixable, remediation) {
10036
+ return remediation ? { severity, checkId, message, fixable, remediation } : { severity, checkId, message, fixable };
9996
10037
  }
9997
10038
  function runRegistryChecks(entry, projectsBase) {
9998
10039
  const results = [];
9999
10040
  const capsuleDir = path7.join(projectsBase, entry.slug);
10000
10041
  if (!fs7.existsSync(capsuleDir)) {
10001
10042
  results.push(
10002
- check(Severity.ERROR, "pathMissing", `Capsule path does not exist: projects/${entry.slug}/`, false)
10043
+ check(Severity.ERROR, "pathMissing", `Capsule path does not exist: projects/${entry.slug}/`, false, "Run /tm init to create the capsule, or remove the registry entry")
10003
10044
  );
10004
10045
  return results;
10005
10046
  }
@@ -10023,13 +10064,13 @@ function runCapsuleChecks(entry, projectsBase) {
10023
10064
  if (!fs7.existsSync(capsuleDir)) return results;
10024
10065
  if (!fs7.existsSync(path7.join(capsuleDir, "STATUS.md"))) {
10025
10066
  results.push(
10026
- check(Severity.ERROR, "statusMissing", "STATUS.md is missing from capsule", true)
10067
+ check(Severity.ERROR, "statusMissing", "STATUS.md is missing from capsule", true, "Run /tm upgrade to recreate STATUS.md, or restore from .tm-backup/STATUS.md if available")
10027
10068
  );
10028
10069
  }
10029
10070
  if (!fs7.existsSync(path7.join(capsuleDir, "TODO.md"))) {
10030
10071
  if (!isIgnored(entry, "todoMissing")) {
10031
10072
  results.push(
10032
- check(Severity.WARN, "todoMissing", "TODO.md is missing from capsule", true)
10073
+ check(Severity.WARN, "todoMissing", "TODO.md is missing from capsule", true, "Run /tm upgrade to recreate TODO.md")
10033
10074
  );
10034
10075
  }
10035
10076
  }
@@ -10059,7 +10100,7 @@ function runCapsuleChecks(entry, projectsBase) {
10059
10100
  return results;
10060
10101
  }
10061
10102
  var LAST_DONE_RE = /^##\s*Last done\s*\(UTC\)/im;
10062
- var NEXT_ACTIONS_RE = /^##\s*Next 3 actions/im;
10103
+ var NEXT_ACTIONS_RE = /^##\s*Next (?:3 )?actions(?: \(now\))?/im;
10063
10104
  var TIMESTAMP_RE = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
10064
10105
  var TASK_ID_RE = /\[T-\d+\]/g;
10065
10106
  var ADHOC_RE = /\[AD-HOC\]/g;
@@ -10068,7 +10109,7 @@ function runStatusQualityChecks(statusContent, entry) {
10068
10109
  if (!LAST_DONE_RE.test(statusContent)) {
10069
10110
  if (!isIgnored(entry, "lastDoneMissing")) {
10070
10111
  results.push(
10071
- check(Severity.ERROR, "lastDoneMissing", 'STATUS.md missing "Last done (UTC)" section', true)
10112
+ check(Severity.ERROR, "lastDoneMissing", 'STATUS.md missing "Last done (UTC)" section', true, 'Add "## Last done (UTC)" section with a timestamp to STATUS.md, or restore from .tm-backup/STATUS.md if available')
10072
10113
  );
10073
10114
  }
10074
10115
  } else {
@@ -10079,7 +10120,7 @@ function runStatusQualityChecks(statusContent, entry) {
10079
10120
  if (!TIMESTAMP_RE.test(lastDoneSection)) {
10080
10121
  if (!isIgnored(entry, "lastDoneNoTimestamp")) {
10081
10122
  results.push(
10082
- check(Severity.ERROR, "lastDoneNoTimestamp", 'STATUS.md "Last done" section has no timestamp', true)
10123
+ check(Severity.ERROR, "lastDoneNoTimestamp", 'STATUS.md "Last done" section has no timestamp', true, 'Add a YYYY-MM-DDTHH:MM timestamp under "Last done (UTC)" in STATUS.md, or restore from .tm-backup/STATUS.md if available')
10083
10124
  );
10084
10125
  }
10085
10126
  } else if (entry.status === "active") {
@@ -10094,7 +10135,8 @@ function runStatusQualityChecks(statusContent, entry) {
10094
10135
  Severity.WARN,
10095
10136
  "lastDoneStale",
10096
10137
  `STATUS.md "Last done" timestamp is ${Math.floor(ageDays)} days old`,
10097
- false
10138
+ false,
10139
+ 'Update the "Last done (UTC)" timestamp in STATUS.md or /tm snooze 7d'
10098
10140
  )
10099
10141
  );
10100
10142
  }
@@ -10105,7 +10147,7 @@ function runStatusQualityChecks(statusContent, entry) {
10105
10147
  if (!NEXT_ACTIONS_RE.test(statusContent)) {
10106
10148
  if (!isIgnored(entry, "nextActionsMissing")) {
10107
10149
  results.push(
10108
- check(Severity.ERROR, "nextActionsMissing", 'STATUS.md missing "Next 3 actions" section', true)
10150
+ check(Severity.ERROR, "nextActionsMissing", 'STATUS.md missing "Next actions (now)" section', true, 'Add "## Next actions (now)" section with task IDs to STATUS.md')
10109
10151
  );
10110
10152
  }
10111
10153
  } else {
@@ -10121,8 +10163,9 @@ function runStatusQualityChecks(statusContent, entry) {
10121
10163
  check(
10122
10164
  Severity.WARN,
10123
10165
  "nextActionsEmpty",
10124
- '"Next 3 actions" has no task IDs or entries',
10125
- false
10166
+ '"Next actions (now)" has no task IDs or entries',
10167
+ false,
10168
+ 'Add task IDs like [T-1] under "Next actions (now)" in STATUS.md'
10126
10169
  )
10127
10170
  );
10128
10171
  }
@@ -10146,8 +10189,9 @@ function runNextVsTodoChecks(statusContent, todoContent) {
10146
10189
  check(
10147
10190
  Severity.WARN,
10148
10191
  "nextNotInTodo",
10149
- `${missing.length} task IDs in "Next 3 actions" not found in TODO.md: ${missing.join(", ")}`,
10150
- false
10192
+ `${missing.length} task IDs in "Next actions (now)" not found in TODO.md: ${missing.join(", ")}`,
10193
+ false,
10194
+ "Add missing task IDs to TODO.md or remove stale ones from STATUS.md"
10151
10195
  )
10152
10196
  );
10153
10197
  }
@@ -10160,7 +10204,7 @@ function runCommandsLinksChecks(entry, capsuleFiles) {
10160
10204
  if (commandsContent !== void 0 && isEffectivelyEmpty(commandsContent)) {
10161
10205
  if (!isIgnored(entry, "commandsEmpty")) {
10162
10206
  results.push(
10163
- check(Severity.INFO, "commandsEmpty", "COMMANDS.md is empty for a coding topic", false)
10207
+ check(Severity.INFO, "commandsEmpty", "COMMANDS.md is empty for a coding topic", false, "Add build/test/deploy commands to COMMANDS.md")
10164
10208
  );
10165
10209
  }
10166
10210
  }
@@ -10170,7 +10214,7 @@ function runCommandsLinksChecks(entry, capsuleFiles) {
10170
10214
  if (linksContent !== void 0 && isEffectivelyEmpty(linksContent)) {
10171
10215
  if (!isIgnored(entry, "linksEmpty")) {
10172
10216
  results.push(
10173
- check(Severity.INFO, "linksEmpty", "LINKS.md is empty for a coding/research topic", false)
10217
+ check(Severity.INFO, "linksEmpty", "LINKS.md is empty for a coding/research topic", false, "Add URLs and endpoints to LINKS.md")
10174
10218
  );
10175
10219
  }
10176
10220
  }
@@ -10228,7 +10272,7 @@ function runConfigChecks(entry, includeContent, registry) {
10228
10272
  if (!groupConfig) {
10229
10273
  if (!isIgnored(entry, "configGroupMissing")) {
10230
10274
  results.push(
10231
- check(Severity.WARN, "configGroupMissing", `Group ${entry.groupId} missing from generated include`, false)
10275
+ check(Severity.WARN, "configGroupMissing", `Group ${entry.groupId} missing from generated include`, false, "Run /tm sync to add group to generated include")
10232
10276
  );
10233
10277
  }
10234
10278
  return results;
@@ -10238,7 +10282,7 @@ function runConfigChecks(entry, includeContent, registry) {
10238
10282
  if (!topicConfig) {
10239
10283
  if (!isIgnored(entry, "configTopicMissing")) {
10240
10284
  results.push(
10241
- check(Severity.WARN, "configTopicMissing", `Topic config missing for thread ${entry.threadId}`, false)
10285
+ check(Severity.WARN, "configTopicMissing", `Topic config missing for thread ${entry.threadId}`, false, "Run /tm sync to add topic config to generated include")
10242
10286
  );
10243
10287
  }
10244
10288
  return results;
@@ -10246,14 +10290,14 @@ function runConfigChecks(entry, includeContent, registry) {
10246
10290
  if (!topicConfig["systemPrompt"]) {
10247
10291
  if (!isIgnored(entry, "configNoSystemPrompt")) {
10248
10292
  results.push(
10249
- check(Severity.WARN, "configNoSystemPrompt", "Per-topic systemPrompt is missing in generated include", false)
10293
+ check(Severity.WARN, "configNoSystemPrompt", "Per-topic systemPrompt is missing in generated include", false, "Run /tm sync to regenerate systemPrompt in config")
10250
10294
  );
10251
10295
  }
10252
10296
  }
10253
10297
  if (!topicConfig["skills"] || !Array.isArray(topicConfig["skills"])) {
10254
10298
  if (!isIgnored(entry, "configNoSkills")) {
10255
10299
  results.push(
10256
- check(Severity.WARN, "configNoSkills", "Per-topic skills list is missing in generated include", false)
10300
+ check(Severity.WARN, "configNoSkills", "Per-topic skills list is missing in generated include", false, "Run /tm sync to regenerate skills list in config")
10257
10301
  );
10258
10302
  }
10259
10303
  }
@@ -10268,7 +10312,8 @@ function runIncludeDriftCheck(includeFileContent, registry) {
10268
10312
  Severity.WARN,
10269
10313
  "includeDrift",
10270
10314
  "Generated include file has no registry-hash comment. Run /tm sync.",
10271
- false
10315
+ false,
10316
+ "Run /tm sync to regenerate the config include"
10272
10317
  )
10273
10318
  );
10274
10319
  return results;
@@ -10280,7 +10325,8 @@ function runIncludeDriftCheck(includeFileContent, registry) {
10280
10325
  Severity.WARN,
10281
10326
  "includeDrift",
10282
10327
  "Generated include is out of sync with registry. Run /tm sync.",
10283
- false
10328
+ false,
10329
+ "Run /tm sync to regenerate the config include"
10284
10330
  )
10285
10331
  );
10286
10332
  }
@@ -10294,7 +10340,8 @@ function runSpamControlCheck(entry) {
10294
10340
  Severity.INFO,
10295
10341
  "spamControl",
10296
10342
  `${entry.consecutiveSilentDoctors} consecutive doctor reports with no user interaction. Auto-snoozing for 30 days.`,
10297
- true
10343
+ true,
10344
+ "Interact with the topic or /tm snooze 30d to silence reports"
10298
10345
  )
10299
10346
  );
10300
10347
  }
@@ -10329,6 +10376,24 @@ function runAllChecksForTopic(entry, projectsBase, includeContent, registry, cro
10329
10376
  results.push(...runSpamControlCheck(entry));
10330
10377
  return results;
10331
10378
  }
10379
+ var BACKUP_DIR = ".tm-backup";
10380
+ var BACKUP_FILES = ["STATUS.md", "TODO.md"];
10381
+ function backupCapsuleIfHealthy(projectsBase, slug, results) {
10382
+ const hasIssues = results.some((r) => r.severity === Severity.ERROR || r.severity === Severity.WARN);
10383
+ if (hasIssues) return;
10384
+ const capsuleDir = path7.join(projectsBase, slug);
10385
+ const backupDir = path7.join(capsuleDir, BACKUP_DIR);
10386
+ if (!fs7.existsSync(backupDir)) {
10387
+ fs7.mkdirSync(backupDir, { recursive: true });
10388
+ }
10389
+ for (const file of BACKUP_FILES) {
10390
+ const src = path7.join(capsuleDir, file);
10391
+ const dst = path7.join(backupDir, file);
10392
+ if (fs7.existsSync(src)) {
10393
+ fs7.copyFileSync(src, dst);
10394
+ }
10395
+ }
10396
+ }
10332
10397
  function readCapsuleFiles(capsuleDir) {
10333
10398
  const files = /* @__PURE__ */ new Map();
10334
10399
  const filenames = [
@@ -10399,6 +10464,7 @@ async function handleDoctor(ctx) {
10399
10464
  registry,
10400
10465
  cronJobsPath
10401
10466
  );
10467
+ backupCapsuleIfHealthy(projectsBase, entry.slug, results);
10402
10468
  const reportText = buildDoctorReport(entry.name, results);
10403
10469
  const keyboard = buildDoctorButtons(
10404
10470
  groupId,
@@ -10421,7 +10487,6 @@ async function handleDoctor(ctx) {
10421
10487
  });
10422
10488
  return {
10423
10489
  text: reportText + textCommands,
10424
- parseMode: "HTML",
10425
10490
  inlineKeyboard: keyboard
10426
10491
  };
10427
10492
  }
@@ -10483,7 +10548,8 @@ async function handleDoctorAll(ctx) {
10483
10548
  if (isSpam) {
10484
10549
  logger.info(`[doctor-all] Auto-snoozing ${entry.slug} (${entry.consecutiveSilentDoctors} silent runs)`);
10485
10550
  }
10486
- const reportText = buildDoctorReport(entry.name, results);
10551
+ backupCapsuleIfHealthy(projectsBase, entry.slug, results);
10552
+ const reportText = buildDoctorReport(entry.name, results, "html");
10487
10553
  const keyboard = buildDoctorButtons(
10488
10554
  entry.groupId,
10489
10555
  entry.threadId,
@@ -10569,9 +10635,6 @@ async function handleDoctorAll(ctx) {
10569
10635
  entry.consecutiveSilentDoctors++;
10570
10636
  }
10571
10637
  entry.lastDoctorRunAt = now.toISOString();
10572
- if (!ctx.postFn) {
10573
- entry.lastDoctorReportAt = now.toISOString();
10574
- }
10575
10638
  if (entry.consecutiveSilentDoctors >= SPAM_THRESHOLD) {
10576
10639
  entry.snoozeUntil = new Date(Date.now() + 30 * 24 * 60 * 60 * 1e3).toISOString();
10577
10640
  entry.status = "snoozed";
@@ -10580,7 +10643,7 @@ async function handleDoctorAll(ctx) {
10580
10643
  }
10581
10644
  });
10582
10645
  const lines = [
10583
- `<b>Doctor All Summary</b>`,
10646
+ `**Doctor All Summary**`,
10584
10647
  "",
10585
10648
  `Processed: ${processed}`,
10586
10649
  `Skipped (ineligible): ${skipped}`,
@@ -10591,9 +10654,9 @@ async function handleDoctorAll(ctx) {
10591
10654
  }
10592
10655
  if (errors.length > 0) {
10593
10656
  lines.push("");
10594
- lines.push(`<b>Errors (${errors.length}):</b>`);
10657
+ lines.push(`**Errors (${errors.length}):**`);
10595
10658
  for (const e of errors.slice(0, 10)) {
10596
- lines.push(`- ${htmlEscape(e)}`);
10659
+ lines.push(`- ${e}`);
10597
10660
  }
10598
10661
  if (errors.length > 10) {
10599
10662
  lines.push(`... and ${errors.length - 10} more`);
@@ -10601,14 +10664,13 @@ async function handleDoctorAll(ctx) {
10601
10664
  }
10602
10665
  if (migrationGroups.length > 0) {
10603
10666
  lines.push("");
10604
- lines.push("<b>Possible group migrations detected:</b>");
10667
+ lines.push("**Possible group migrations detected:**");
10605
10668
  for (const gid of migrationGroups) {
10606
- lines.push(`- Group ${htmlEscape(gid)}: all topics failed. Check for group migration.`);
10669
+ lines.push(`- Group ${gid}: all topics failed. Check for group migration.`);
10607
10670
  }
10608
10671
  }
10609
10672
  return {
10610
- text: lines.join("\n"),
10611
- parseMode: "HTML"
10673
+ text: lines.join("\n")
10612
10674
  };
10613
10675
  }
10614
10676
  function isEligible(entry, now) {
@@ -10640,8 +10702,7 @@ async function handleList(ctx) {
10640
10702
  const topics = Object.values(registry.topics);
10641
10703
  const text = buildListMessage(topics);
10642
10704
  return {
10643
- text,
10644
- parseMode: "HTML"
10705
+ text
10645
10706
  };
10646
10707
  }
10647
10708
 
@@ -10682,7 +10743,7 @@ async function handleStatus(ctx) {
10682
10743
  };
10683
10744
  } catch (err) {
10684
10745
  const msg = err instanceof Error ? err.message : String(err);
10685
- return { text: `Failed to read STATUS.md: ${htmlEscape(msg)}` };
10746
+ return { text: `Failed to read STATUS.md: ${msg}` };
10686
10747
  }
10687
10748
  }
10688
10749
 
@@ -10702,8 +10763,7 @@ async function handleSync(ctx) {
10702
10763
  } catch (err) {
10703
10764
  const msg = err instanceof Error ? err.message : String(err);
10704
10765
  return {
10705
- text: `Sync failed: ${htmlEscape(msg)}`,
10706
- parseMode: "HTML"
10766
+ text: `Sync failed: ${msg}`
10707
10767
  };
10708
10768
  }
10709
10769
  const restartResult = await triggerRestart(rpc, logger);
@@ -10713,8 +10773,7 @@ async function handleSync(ctx) {
10713
10773
  text += "\n" + restartResult.fallbackMessage;
10714
10774
  }
10715
10775
  return {
10716
- text,
10717
- parseMode: "HTML"
10776
+ text
10718
10777
  };
10719
10778
  }
10720
10779
 
@@ -10726,7 +10785,7 @@ async function handleRename(ctx, newName) {
10726
10785
  }
10727
10786
  const trimmedName = newName.trim();
10728
10787
  if (!trimmedName) {
10729
- return { text: "Usage: /tm rename &lt;new-name&gt;" };
10788
+ return { text: "Usage: /tm rename <new-name>" };
10730
10789
  }
10731
10790
  if (trimmedName.length > MAX_NAME_LENGTH) {
10732
10791
  return { text: `Name too long (max ${MAX_NAME_LENGTH} characters).` };
@@ -10743,7 +10802,7 @@ async function handleRename(ctx, newName) {
10743
10802
  }
10744
10803
  const oldName = entry.name;
10745
10804
  if (oldName === trimmedName) {
10746
- return { text: `Topic is already named <b>${htmlEscape(oldName)}</b>.`, parseMode: "HTML" };
10805
+ return { text: `Topic is already named **${oldName}**.` };
10747
10806
  }
10748
10807
  await withRegistry(workspaceDir, (data) => {
10749
10808
  const topic = data.topics[key];
@@ -10760,7 +10819,7 @@ async function handleRename(ctx, newName) {
10760
10819
  } catch (err) {
10761
10820
  const msg = err instanceof Error ? err.message : String(err);
10762
10821
  restartMsg = `
10763
- Warning: include generation failed: ${htmlEscape(msg)}`;
10822
+ Warning: include generation failed: ${msg}`;
10764
10823
  }
10765
10824
  const result = await triggerRestart(rpc, logger);
10766
10825
  if (!result.success && result.fallbackMessage) {
@@ -10773,10 +10832,9 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
10773
10832
  );
10774
10833
  const topicCard = buildTopicCard(trimmedName, entry.slug, entry.type, entry.capsuleVersion);
10775
10834
  return {
10776
- text: `Topic renamed from <b>${htmlEscape(oldName)}</b> to <b>${htmlEscape(trimmedName)}</b>.
10835
+ text: `Topic renamed from **${oldName}** to **${trimmedName}**.
10777
10836
 
10778
- ${topicCard}${restartMsg}`,
10779
- parseMode: "HTML"
10837
+ ${topicCard}${restartMsg}`
10780
10838
  };
10781
10839
  }
10782
10840
 
@@ -10799,16 +10857,14 @@ async function handleUpgrade(ctx) {
10799
10857
  }
10800
10858
  if (entry.capsuleVersion >= CAPSULE_VERSION) {
10801
10859
  return {
10802
- text: `Topic <b>${htmlEscape(entry.name)}</b> is already at capsule version ${CAPSULE_VERSION}. No upgrade needed.`,
10803
- parseMode: "HTML"
10860
+ text: `Topic **${entry.name}** is already at capsule version ${CAPSULE_VERSION}. No upgrade needed.`
10804
10861
  };
10805
10862
  }
10806
10863
  const projectsBase = path11.join(workspaceDir, "projects");
10807
10864
  const result = upgradeCapsule(projectsBase, entry.slug, entry.name, entry.type, entry.capsuleVersion);
10808
10865
  if (!result.upgraded) {
10809
10866
  return {
10810
- text: `No upgrade needed for <b>${htmlEscape(entry.name)}</b>.`,
10811
- parseMode: "HTML"
10867
+ text: `No upgrade needed for **${entry.name}**.`
10812
10868
  };
10813
10869
  }
10814
10870
  await withRegistry(workspaceDir, (data) => {
@@ -10818,10 +10874,9 @@ async function handleUpgrade(ctx) {
10818
10874
  }
10819
10875
  });
10820
10876
  const addedList = result.addedFiles.length > 0 ? `
10821
- Added files: ${result.addedFiles.map((f) => htmlEscape(f)).join(", ")}` : "\nNo new files added.";
10877
+ Added files: ${result.addedFiles.join(", ")}` : "\nNo new files added.";
10822
10878
  return {
10823
- text: `Topic <b>${htmlEscape(entry.name)}</b> upgraded from v${entry.capsuleVersion} to v${result.newVersion}.${addedList}`,
10824
- parseMode: "HTML"
10879
+ text: `Topic **${entry.name}** upgraded from v${entry.capsuleVersion} to v${result.newVersion}.${addedList}`
10825
10880
  };
10826
10881
  }
10827
10882
 
@@ -10834,11 +10889,11 @@ async function handleSnooze(ctx, args) {
10834
10889
  }
10835
10890
  const trimmed = args.trim();
10836
10891
  if (!trimmed) {
10837
- return { text: "Usage: /tm snooze &lt;Nd&gt; (e.g., 7d, 30d)" };
10892
+ return { text: "Usage: /tm snooze <Nd> (e.g., 7d, 30d)" };
10838
10893
  }
10839
10894
  const match = DURATION_RE.exec(trimmed);
10840
10895
  if (!match) {
10841
- return { text: `Invalid duration "${htmlEscape(trimmed)}". Use format: 7d, 30d, etc.` };
10896
+ return { text: `Invalid duration "${trimmed}". Use format: 7d, 30d, etc.` };
10842
10897
  }
10843
10898
  const days = parseInt(match[1], 10);
10844
10899
  if (days <= 0 || days > 365) {
@@ -10868,8 +10923,7 @@ async function handleSnooze(ctx, args) {
10868
10923
  buildAuditEntry(userId, "snooze", entry.slug, `Snoozed for ${days} days until ${snoozeUntil}`)
10869
10924
  );
10870
10925
  return {
10871
- text: `Topic <b>${htmlEscape(entry.name)}</b> snoozed for ${days} days (until ${htmlEscape(snoozeUntil)}).`,
10872
- parseMode: "HTML"
10926
+ text: `Topic **${entry.name}** snoozed for ${days} days (until ${snoozeUntil}).`
10873
10927
  };
10874
10928
  }
10875
10929
 
@@ -10897,10 +10951,10 @@ async function handleArchiveToggle(ctx, archive) {
10897
10951
  return { text: "This topic is not registered. Run /tm init first." };
10898
10952
  }
10899
10953
  if (archive && entry.status === "archived") {
10900
- return { text: `Topic <b>${htmlEscape(entry.name)}</b> is already archived.`, parseMode: "HTML" };
10954
+ return { text: `Topic **${entry.name}** is already archived.` };
10901
10955
  }
10902
10956
  if (!archive && entry.status !== "archived") {
10903
- return { text: `Topic <b>${htmlEscape(entry.name)}</b> is not archived.`, parseMode: "HTML" };
10957
+ return { text: `Topic **${entry.name}** is not archived.` };
10904
10958
  }
10905
10959
  const newStatus = archive ? "archived" : "active";
10906
10960
  await withRegistry(workspaceDir, (data) => {
@@ -10921,7 +10975,7 @@ async function handleArchiveToggle(ctx, archive) {
10921
10975
  } catch (err) {
10922
10976
  const msg = err instanceof Error ? err.message : String(err);
10923
10977
  restartMsg = `
10924
- Warning: include generation failed: ${htmlEscape(msg)}`;
10978
+ Warning: include generation failed: ${msg}`;
10925
10979
  }
10926
10980
  const result = await triggerRestart(rpc, logger);
10927
10981
  if (!result.success && result.fallbackMessage) {
@@ -10934,8 +10988,7 @@ Warning: include generation failed: ${htmlEscape(msg)}`;
10934
10988
  );
10935
10989
  const action = archive ? "archived" : "unarchived";
10936
10990
  return {
10937
- text: `Topic <b>${htmlEscape(entry.name)}</b> ${action}.${restartMsg}`,
10938
- parseMode: "HTML"
10991
+ text: `Topic **${entry.name}** ${action}.${restartMsg}`
10939
10992
  };
10940
10993
  }
10941
10994
 
@@ -10945,10 +10998,15 @@ import * as path12 from "node:path";
10945
10998
  var MARKER_START = "<!-- TM_AUTOPILOT_START -->";
10946
10999
  var MARKER_END = "<!-- TM_AUTOPILOT_END -->";
10947
11000
  var HEARTBEAT_BLOCK = `${MARKER_START}
10948
- ## Topic Manager Daily Sweep
10949
- - [ ] If 24+ hours since the last topic sweep (check \`lastDoctorAllRunAt\` in
10950
- {workspace}/projects/topics.json), call \`topic_manager\` with command
10951
- "doctor --all" to health-check all active topics.
11001
+ ## Topic Manager \u2014 Balanced Autopilot
11002
+
11003
+ Execute these steps IN ORDER. Do not skip steps.
11004
+
11005
+ 1. CALL \`topic_manager\` with command "doctor --all" to health-check all active topics.
11006
+ This handles stale timestamps, task ID mismatches, and posting errors automatically.
11007
+ 2. For each topic where STATUS.md "Last done (UTC)" is >3 days old:
11008
+ post a brief nudge in that topic asking the user for a status update.
11009
+ 3. If no actions were taken in steps 1-2, do nothing (HEARTBEAT_OK).
10952
11010
  ${MARKER_END}`;
10953
11011
  var HEARTBEAT_FILENAME = "HEARTBEAT.md";
10954
11012
  async function handleAutopilot(ctx, args) {
@@ -10970,13 +11028,12 @@ async function handleAutopilot(ctx, args) {
10970
11028
  case "status":
10971
11029
  return handleStatus2(ctx);
10972
11030
  default:
10973
- return { text: `Unknown autopilot sub-command: "${htmlEscape(subCommand)}". Use enable, disable, or status.` };
11031
+ return { text: `Unknown autopilot sub-command: "${subCommand}". Use enable, disable, or status.` };
10974
11032
  }
10975
11033
  }
10976
11034
  async function handleEnable(ctx) {
10977
11035
  const { workspaceDir } = ctx;
10978
11036
  const heartbeatPath = path12.join(workspaceDir, HEARTBEAT_FILENAME);
10979
- const block = HEARTBEAT_BLOCK.replace("{workspace}", path12.resolve(workspaceDir));
10980
11037
  let content = "";
10981
11038
  try {
10982
11039
  if (fs11.existsSync(heartbeatPath)) {
@@ -10990,14 +11047,13 @@ async function handleEnable(ctx) {
10990
11047
  });
10991
11048
  return { text: "Autopilot is already enabled." };
10992
11049
  }
10993
- const newContent = content ? content.trimEnd() + "\n\n" + block + "\n" : block + "\n";
11050
+ const newContent = content ? content.trimEnd() + "\n\n" + HEARTBEAT_BLOCK + "\n" : HEARTBEAT_BLOCK + "\n";
10994
11051
  fs11.writeFileSync(heartbeatPath, newContent, { mode: 416 });
10995
11052
  await withRegistry(workspaceDir, (data) => {
10996
11053
  data.autopilotEnabled = true;
10997
11054
  });
10998
11055
  return {
10999
- text: "<b>Autopilot enabled.</b>\nDaily health sweeps will run via the OpenClaw heartbeat.",
11000
- parseMode: "HTML"
11056
+ text: "**Autopilot enabled.**\nDaily health sweeps will run via the OpenClaw heartbeat."
11001
11057
  };
11002
11058
  }
11003
11059
  async function handleDisable(ctx) {
@@ -11032,8 +11088,7 @@ async function handleDisable(ctx) {
11032
11088
  data.autopilotEnabled = false;
11033
11089
  });
11034
11090
  return {
11035
- text: "<b>Autopilot disabled.</b>\nDaily sweeps will no longer run automatically.",
11036
- parseMode: "HTML"
11091
+ text: "**Autopilot disabled.**\nDaily sweeps will no longer run automatically."
11037
11092
  };
11038
11093
  }
11039
11094
  async function handleStatus2(ctx) {
@@ -11042,20 +11097,152 @@ async function handleStatus2(ctx) {
11042
11097
  const enabled = registry.autopilotEnabled;
11043
11098
  const lastRun = registry.lastDoctorAllRunAt ?? "never";
11044
11099
  const lines = [
11045
- `<b>Autopilot:</b> ${enabled ? "enabled" : "disabled"}`,
11046
- `<b>Last doctor-all run:</b> ${htmlEscape(lastRun)}`
11100
+ `**Autopilot:** ${enabled ? "enabled" : "disabled"}`,
11101
+ `**Last doctor-all run:** ${lastRun}`
11047
11102
  ];
11048
11103
  return {
11049
- text: lines.join("\n"),
11050
- parseMode: "HTML"
11104
+ text: lines.join("\n")
11051
11105
  };
11052
11106
  }
11053
11107
 
11108
+ // src/commands/daily-report.ts
11109
+ import * as fs12 from "node:fs";
11110
+ import * as path13 from "node:path";
11111
+ async function handleDailyReport(ctx) {
11112
+ const { workspaceDir, groupId, threadId, logger } = ctx;
11113
+ if (!groupId || !threadId) {
11114
+ return { text: "Missing context: must be called from a topic thread." };
11115
+ }
11116
+ const key = topicKey(groupId, threadId);
11117
+ const registry = readRegistry(workspaceDir);
11118
+ const entry = registry.topics[key];
11119
+ if (!entry) {
11120
+ return { text: "This topic is not registered. Run /tm init first." };
11121
+ }
11122
+ if (entry.lastDoctorReportAt) {
11123
+ const lastReport = new Date(entry.lastDoctorReportAt);
11124
+ const now = /* @__PURE__ */ new Date();
11125
+ if (lastReport.getUTCFullYear() === now.getUTCFullYear() && lastReport.getUTCMonth() === now.getUTCMonth() && lastReport.getUTCDate() === now.getUTCDate()) {
11126
+ return { text: "Daily report already generated today. Try again tomorrow." };
11127
+ }
11128
+ }
11129
+ const projectsBase = path13.join(workspaceDir, "projects");
11130
+ const capsuleDir = path13.join(projectsBase, entry.slug);
11131
+ if (!fs12.existsSync(capsuleDir)) {
11132
+ return { text: `Capsule directory not found: projects/${entry.slug}/` };
11133
+ }
11134
+ const statusContent = readFileOrNull(path13.join(capsuleDir, "STATUS.md"));
11135
+ const todoContent = readFileOrNull(path13.join(capsuleDir, "TODO.md"));
11136
+ const learningsContent = readFileOrNull(path13.join(capsuleDir, "LEARNINGS.md"));
11137
+ const doneContent = extractDoneSection(statusContent);
11138
+ const newLearnings = extractTodayLearnings(learningsContent);
11139
+ const blockers = extractBlockers(todoContent);
11140
+ const nextContent = extractNextActions(statusContent);
11141
+ const upcomingContent = extractUpcoming(statusContent);
11142
+ const health = computeHealth(entry.lastMessageAt, statusContent, blockers);
11143
+ const reportText = buildDailyReport({
11144
+ name: entry.name,
11145
+ doneContent,
11146
+ learningsContent: newLearnings,
11147
+ blockersContent: blockers,
11148
+ nextContent,
11149
+ upcomingContent,
11150
+ health
11151
+ });
11152
+ if (ctx.postFn) {
11153
+ try {
11154
+ await ctx.postFn(groupId, threadId, reportText);
11155
+ await withRegistry(workspaceDir, (data) => {
11156
+ const e = data.topics[key];
11157
+ if (e) {
11158
+ e.lastDoctorReportAt = (/* @__PURE__ */ new Date()).toISOString();
11159
+ }
11160
+ });
11161
+ } catch (err) {
11162
+ const msg = err instanceof Error ? err.message : String(err);
11163
+ logger.error(`[daily-report] Post failed: ${msg}`);
11164
+ return { text: `Daily report generated but post failed: ${msg}` };
11165
+ }
11166
+ } else {
11167
+ await withRegistry(workspaceDir, (data) => {
11168
+ const e = data.topics[key];
11169
+ if (e) {
11170
+ e.lastDoctorReportAt = (/* @__PURE__ */ new Date()).toISOString();
11171
+ }
11172
+ });
11173
+ }
11174
+ return { text: reportText };
11175
+ }
11176
+ function readFileOrNull(filePath) {
11177
+ try {
11178
+ return fs12.readFileSync(filePath, "utf-8");
11179
+ } catch {
11180
+ return null;
11181
+ }
11182
+ }
11183
+ function extractDoneSection(statusContent) {
11184
+ if (!statusContent) return "_No STATUS.md found._";
11185
+ const match = statusContent.match(/^##\s*Last done\s*\(UTC\)\s*\n([\s\S]*?)(?=\n##\s|\n*$)/im);
11186
+ if (!match) return '_No "Last done" section found._';
11187
+ const text = match[1]?.trim();
11188
+ return text || "_Empty._";
11189
+ }
11190
+ function extractTodayLearnings(learningsContent) {
11191
+ if (!learningsContent) return "_No LEARNINGS.md found._";
11192
+ const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
11193
+ const lines = learningsContent.split("\n");
11194
+ const todayLines = [];
11195
+ let inTodaySection = false;
11196
+ for (const line of lines) {
11197
+ if (line.startsWith("## ") && line.includes(today)) {
11198
+ inTodaySection = true;
11199
+ continue;
11200
+ }
11201
+ if (inTodaySection && line.startsWith("## ")) {
11202
+ break;
11203
+ }
11204
+ if (inTodaySection && line.trim()) {
11205
+ todayLines.push(line);
11206
+ }
11207
+ }
11208
+ return todayLines.length > 0 ? todayLines.join("\n") : "_None today._";
11209
+ }
11210
+ function extractBlockers(todoContent) {
11211
+ if (!todoContent) return "_No TODO.md found._";
11212
+ const lines = todoContent.split("\n");
11213
+ const blockerLines = lines.filter(
11214
+ (l) => /\[BLOCKED\]/i.test(l) || /\bblocked\b/i.test(l)
11215
+ );
11216
+ return blockerLines.length > 0 ? blockerLines.join("\n") : "_None._";
11217
+ }
11218
+ function extractNextActions(statusContent) {
11219
+ if (!statusContent) return "_No STATUS.md found._";
11220
+ const match = statusContent.match(/^##\s*Next (?:3 )?actions(?: \(now\))?\s*\n([\s\S]*?)(?=\n##\s|\n*$)/im);
11221
+ if (!match) return '_No "Next actions" section found._';
11222
+ const text = match[1]?.trim();
11223
+ return text || "_Empty._";
11224
+ }
11225
+ function extractUpcoming(statusContent) {
11226
+ if (!statusContent) return "_No STATUS.md found._";
11227
+ const match = statusContent.match(/^##\s*Upcoming actions\s*\n([\s\S]*?)(?=\n##\s|\n*$)/im);
11228
+ if (!match) return '_No "Upcoming actions" section found._';
11229
+ const text = match[1]?.trim();
11230
+ return text || "_Empty._";
11231
+ }
11232
+ function computeHealth(lastMessageAt, statusContent, blockers) {
11233
+ if (blockers && blockers !== "_None._" && blockers !== "_No TODO.md found._") {
11234
+ return "blocked";
11235
+ }
11236
+ if (!lastMessageAt) return "stale";
11237
+ const hoursSinceActivity = (Date.now() - new Date(lastMessageAt).getTime()) / 36e5;
11238
+ if (hoursSinceActivity > 72) return "stale";
11239
+ return "fresh";
11240
+ }
11241
+
11054
11242
  // src/commands/help.ts
11055
11243
  function handleHelp(_ctx) {
11056
11244
  return {
11057
- text: buildHelpCard(),
11058
- parseMode: "HTML"
11245
+ text: buildHelpCard()
11059
11246
  };
11060
11247
  }
11061
11248
 
@@ -11125,18 +11312,20 @@ function createTopicManagerTool(deps) {
11125
11312
  return await handleUnarchive(ctx);
11126
11313
  case "autopilot":
11127
11314
  return await handleAutopilot(ctx, args);
11315
+ case "daily-report":
11316
+ return await handleDailyReport(ctx);
11128
11317
  case "help":
11129
11318
  return await handleHelp(ctx);
11130
11319
  default:
11131
11320
  return {
11132
- text: `Unknown command: "${htmlEscape(subCommand)}". Try /tm help for available commands.`
11321
+ text: `Unknown command: "${subCommand}". Try /tm help for available commands.`
11133
11322
  };
11134
11323
  }
11135
11324
  } catch (err) {
11136
11325
  const msg = err instanceof Error ? err.message : String(err);
11137
11326
  logger.error(`[topic_manager] Command "${subCommand}" failed: ${msg}`);
11138
11327
  return {
11139
- text: `Command failed: ${htmlEscape(msg)}`
11328
+ text: `Command failed: ${msg}`
11140
11329
  };
11141
11330
  }
11142
11331
  }
@@ -11246,7 +11435,7 @@ async function handleCallback(data, ctx) {
11246
11435
  };
11247
11436
  }
11248
11437
  default:
11249
- return { text: `Unknown callback action: ${htmlEscape(action)}` };
11438
+ return { text: `Unknown callback action: ${action}` };
11250
11439
  }
11251
11440
  }
11252
11441
  async function handleCallbackFix(ctx) {
@@ -11263,25 +11452,25 @@ async function handleCallbackFix(ctx) {
11263
11452
  // src/index.ts
11264
11453
  function resolveConfigDir() {
11265
11454
  const thisFile = new URL(import.meta.url).pathname;
11266
- const parts = thisFile.split(path13.sep);
11455
+ const parts = thisFile.split(path14.sep);
11267
11456
  const extIndex = parts.lastIndexOf("extensions");
11268
11457
  if (extIndex > 0) {
11269
- const candidate = parts.slice(0, extIndex).join(path13.sep);
11270
- if (fs12.existsSync(path13.join(candidate, "openclaw.json")) || fs12.existsSync(path13.join(candidate, "extensions"))) {
11458
+ const candidate = parts.slice(0, extIndex).join(path14.sep);
11459
+ if (fs13.existsSync(path14.join(candidate, "openclaw.json")) || fs13.existsSync(path14.join(candidate, "extensions"))) {
11271
11460
  return candidate;
11272
11461
  }
11273
11462
  }
11274
11463
  const envDir = process.env["OPENCLAW_CONFIG_DIR"];
11275
- if (envDir && fs12.existsSync(envDir)) return path13.resolve(envDir);
11464
+ if (envDir && fs13.existsSync(envDir)) return path14.resolve(envDir);
11276
11465
  const homeDir = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
11277
- const defaultDir = path13.join(homeDir, ".openclaw");
11278
- if (fs12.existsSync(defaultDir)) return defaultDir;
11466
+ const defaultDir = path14.join(homeDir, ".openclaw");
11467
+ if (fs13.existsSync(defaultDir)) return defaultDir;
11279
11468
  return void 0;
11280
11469
  }
11281
11470
  function register(api) {
11282
11471
  const resolvedConfigDir = resolveConfigDir();
11283
11472
  const configDir = api.configDir ?? api.pluginConfig?.configDir ?? resolvedConfigDir;
11284
- const workspaceDir = api.workspaceDir ?? api.pluginConfig?.workspaceDir ?? (resolvedConfigDir ? path13.join(resolvedConfigDir, "workspace") : void 0);
11473
+ const workspaceDir = api.workspaceDir ?? api.pluginConfig?.workspaceDir ?? (resolvedConfigDir ? path14.join(resolvedConfigDir, "workspace") : void 0);
11285
11474
  if (!configDir || !workspaceDir) {
11286
11475
  api.logger.error(
11287
11476
  "telegram-manager: configDir or workspaceDir not available. Plugin cannot initialize."
@@ -11290,7 +11479,7 @@ function register(api) {
11290
11479
  }
11291
11480
  let resolvedPostFn;
11292
11481
  const lazyPostFn = async (groupId, threadId, text, keyboard) => {
11293
- if (resolvedPostFn === null) return;
11482
+ if (resolvedPostFn === null) throw new Error("openclaw SDK unavailable \u2013 cannot post");
11294
11483
  if (resolvedPostFn === void 0) {
11295
11484
  try {
11296
11485
  const sdkPath = ["openclaw", "dist", "plugin-sdk", "index.js"].join("/");
@@ -11316,7 +11505,8 @@ function register(api) {
11316
11505
  resolvedPostFn = null;
11317
11506
  }
11318
11507
  }
11319
- if (resolvedPostFn) await resolvedPostFn(groupId, threadId, text, keyboard);
11508
+ if (!resolvedPostFn) throw new Error("openclaw SDK unavailable \u2013 cannot post");
11509
+ await resolvedPostFn(groupId, threadId, text, keyboard);
11320
11510
  };
11321
11511
  const tool = createTopicManagerTool({
11322
11512
  logger: api.logger,
@@ -11360,15 +11550,8 @@ function register(api) {
11360
11550
  const reply = {
11361
11551
  text: result.text
11362
11552
  };
11363
- const telegramData = {};
11364
11553
  if (result.inlineKeyboard) {
11365
- telegramData.buttons = result.inlineKeyboard.inline_keyboard;
11366
- }
11367
- if (result.parseMode) {
11368
- telegramData.parse_mode = result.parseMode;
11369
- }
11370
- if (Object.keys(telegramData).length > 0) {
11371
- reply.channelData = { telegram: telegramData };
11554
+ reply.channelData = { telegram: { buttons: result.inlineKeyboard.inline_keyboard } };
11372
11555
  }
11373
11556
  return reply;
11374
11557
  }