@waitcher/cli 0.2.33 → 0.2.34

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.mjs +408 -306
  3. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -5875,9 +5875,9 @@ var require_dispatcher_base = __commonJS({
5875
5875
  }
5876
5876
  close(callback) {
5877
5877
  if (callback === void 0) {
5878
- return new Promise((resolve18, reject) => {
5878
+ return new Promise((resolve19, reject) => {
5879
5879
  this.close((err, data) => {
5880
- return err ? reject(err) : resolve18(data);
5880
+ return err ? reject(err) : resolve19(data);
5881
5881
  });
5882
5882
  });
5883
5883
  }
@@ -5915,9 +5915,9 @@ var require_dispatcher_base = __commonJS({
5915
5915
  err = null;
5916
5916
  }
5917
5917
  if (callback === void 0) {
5918
- return new Promise((resolve18, reject) => {
5918
+ return new Promise((resolve19, reject) => {
5919
5919
  this.destroy(err, (err2, data) => {
5920
- return err2 ? reject(err2) : resolve18(data);
5920
+ return err2 ? reject(err2) : resolve19(data);
5921
5921
  });
5922
5922
  });
5923
5923
  }
@@ -11320,12 +11320,12 @@ upgrade: ${upgrade2}\r
11320
11320
  cb();
11321
11321
  }
11322
11322
  }
11323
- const waitForDrain = () => new Promise((resolve18, reject) => {
11323
+ const waitForDrain = () => new Promise((resolve19, reject) => {
11324
11324
  assert2(callback === null);
11325
11325
  if (socket[kError]) {
11326
11326
  reject(socket[kError]);
11327
11327
  } else {
11328
- callback = resolve18;
11328
+ callback = resolve19;
11329
11329
  }
11330
11330
  });
11331
11331
  socket.on("close", onDrain).on("drain", onDrain);
@@ -12835,12 +12835,12 @@ var require_client_h2 = __commonJS({
12835
12835
  cb();
12836
12836
  }
12837
12837
  }
12838
- const waitForDrain = () => new Promise((resolve18, reject) => {
12838
+ const waitForDrain = () => new Promise((resolve19, reject) => {
12839
12839
  assert2(callback === null);
12840
12840
  if (socket[kError]) {
12841
12841
  reject(socket[kError]);
12842
12842
  } else {
12843
- callback = resolve18;
12843
+ callback = resolve19;
12844
12844
  }
12845
12845
  });
12846
12846
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -13212,16 +13212,16 @@ var require_client = __commonJS({
13212
13212
  return this[kNeedDrain] < 2;
13213
13213
  }
13214
13214
  [kClose]() {
13215
- return new Promise((resolve18) => {
13215
+ return new Promise((resolve19) => {
13216
13216
  if (this[kSize]) {
13217
- this[kClosedResolve] = resolve18;
13217
+ this[kClosedResolve] = resolve19;
13218
13218
  } else {
13219
- resolve18(null);
13219
+ resolve19(null);
13220
13220
  }
13221
13221
  });
13222
13222
  }
13223
13223
  [kDestroy](err) {
13224
- return new Promise((resolve18) => {
13224
+ return new Promise((resolve19) => {
13225
13225
  const requests = this[kQueue].splice(this[kPendingIdx]);
13226
13226
  for (let i = 0; i < requests.length; i++) {
13227
13227
  const request2 = requests[i];
@@ -13234,7 +13234,7 @@ var require_client = __commonJS({
13234
13234
  this[kClosedResolve]();
13235
13235
  this[kClosedResolve] = null;
13236
13236
  }
13237
- resolve18(null);
13237
+ resolve19(null);
13238
13238
  };
13239
13239
  if (this[kHTTPContext]) {
13240
13240
  this[kHTTPContext].destroy(err, callback);
@@ -13711,8 +13711,8 @@ var require_pool_base = __commonJS({
13711
13711
  if (this[kQueue].isEmpty()) {
13712
13712
  return closeClients(this);
13713
13713
  } else {
13714
- return new Promise((resolve18) => {
13715
- this[kClosedResolve] = resolve18;
13714
+ return new Promise((resolve19) => {
13715
+ this[kClosedResolve] = resolve19;
13716
13716
  });
13717
13717
  }
13718
13718
  }
@@ -13781,8 +13781,8 @@ var require_pool_base = __commonJS({
13781
13781
  }
13782
13782
  let done = false;
13783
13783
  let resolveClosed;
13784
- const closed = new Promise((resolve18) => {
13785
- resolveClosed = resolve18;
13784
+ const closed = new Promise((resolve19) => {
13785
+ resolveClosed = resolve19;
13786
13786
  });
13787
13787
  this[kRetiring].set(client, closed);
13788
13788
  client.close(() => {
@@ -14948,8 +14948,8 @@ var require_socks5_client = __commonJS({
14948
14948
  return;
14949
14949
  }
14950
14950
  if (reply !== REPLY_CODES.SUCCEEDED) {
14951
- const errorMessage = this.getReplyErrorMessage(reply);
14952
- throw new Socks5ProxyError(`SOCKS5 connection failed: ${errorMessage}`, `UND_ERR_SOCKS5_REPLY_${reply}`);
14951
+ const errorMessage2 = this.getReplyErrorMessage(reply);
14952
+ throw new Socks5ProxyError(`SOCKS5 connection failed: ${errorMessage2}`, `UND_ERR_SOCKS5_REPLY_${reply}`);
14953
14953
  }
14954
14954
  let boundAddress;
14955
14955
  let offset = 4;
@@ -15568,10 +15568,10 @@ var require_proxy_agent = __commonJS({
15568
15568
  headersPair[key] = value2;
15569
15569
  continue;
15570
15570
  }
15571
- const previous = headersPair[key];
15571
+ const previous2 = headersPair[key];
15572
15572
  const values = [];
15573
- if (previous !== void 0) {
15574
- values.push(...Array.isArray(previous) ? previous : [previous]);
15573
+ if (previous2 !== void 0) {
15574
+ values.push(...Array.isArray(previous2) ? previous2 : [previous2]);
15575
15575
  }
15576
15576
  if (value2 !== void 0) {
15577
15577
  values.push(...Array.isArray(value2) ? value2 : [value2]);
@@ -16587,7 +16587,7 @@ var require_readable = __commonJS({
16587
16587
  if (this._readableState.closeEmitted) {
16588
16588
  return Promise.resolve(null);
16589
16589
  }
16590
- return new Promise((resolve18, reject) => {
16590
+ return new Promise((resolve19, reject) => {
16591
16591
  if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
16592
16592
  this.destroy(new AbortError());
16593
16593
  }
@@ -16601,11 +16601,11 @@ var require_readable = __commonJS({
16601
16601
  if (signal.aborted) {
16602
16602
  reject(signal.reason ?? new AbortError());
16603
16603
  } else {
16604
- resolve18(null);
16604
+ resolve19(null);
16605
16605
  }
16606
16606
  });
16607
16607
  } else {
16608
- this.on("close", resolve18);
16608
+ this.on("close", resolve19);
16609
16609
  }
16610
16610
  this.on("error", noop).on("data", () => {
16611
16611
  if (this[kBytesRead] > limit) {
@@ -16633,7 +16633,7 @@ var require_readable = __commonJS({
16633
16633
  }
16634
16634
  function consume(stream, type) {
16635
16635
  assert2(!stream[kConsume]);
16636
- return new Promise((resolve18, reject) => {
16636
+ return new Promise((resolve19, reject) => {
16637
16637
  if (isUnusable(stream)) {
16638
16638
  const rState = stream._readableState;
16639
16639
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -16648,7 +16648,7 @@ var require_readable = __commonJS({
16648
16648
  stream[kConsume] = {
16649
16649
  type,
16650
16650
  stream,
16651
- resolve: resolve18,
16651
+ resolve: resolve19,
16652
16652
  reject,
16653
16653
  length: 0,
16654
16654
  body: []
@@ -16726,18 +16726,18 @@ var require_readable = __commonJS({
16726
16726
  return buffer;
16727
16727
  }
16728
16728
  function consumeEnd(consume2, encoding) {
16729
- const { type, body: body2, resolve: resolve18, stream, length } = consume2;
16729
+ const { type, body: body2, resolve: resolve19, stream, length } = consume2;
16730
16730
  try {
16731
16731
  if (type === "text") {
16732
- resolve18(chunksDecode(body2, length, encoding));
16732
+ resolve19(chunksDecode(body2, length, encoding));
16733
16733
  } else if (type === "json") {
16734
- resolve18(JSON.parse(chunksDecode(body2, length, encoding)));
16734
+ resolve19(JSON.parse(chunksDecode(body2, length, encoding)));
16735
16735
  } else if (type === "arrayBuffer") {
16736
- resolve18(chunksConcat(body2, length).buffer);
16736
+ resolve19(chunksConcat(body2, length).buffer);
16737
16737
  } else if (type === "blob") {
16738
- resolve18(new Blob(body2, { type: stream[kContentType] }));
16738
+ resolve19(new Blob(body2, { type: stream[kContentType] }));
16739
16739
  } else if (type === "bytes") {
16740
- resolve18(chunksConcat(body2, length));
16740
+ resolve19(chunksConcat(body2, length));
16741
16741
  }
16742
16742
  consumeFinish(consume2);
16743
16743
  } catch (err) {
@@ -16956,9 +16956,9 @@ var require_api_request = __commonJS({
16956
16956
  };
16957
16957
  function request2(opts, callback) {
16958
16958
  if (callback === void 0) {
16959
- return new Promise((resolve18, reject) => {
16959
+ return new Promise((resolve19, reject) => {
16960
16960
  request2.call(this, opts, (err, data) => {
16961
- return err ? reject(err) : resolve18(data);
16961
+ return err ? reject(err) : resolve19(data);
16962
16962
  });
16963
16963
  });
16964
16964
  }
@@ -17219,9 +17219,9 @@ var require_api_stream = __commonJS({
17219
17219
  };
17220
17220
  function stream(opts, factory, callback) {
17221
17221
  if (callback === void 0) {
17222
- return new Promise((resolve18, reject) => {
17222
+ return new Promise((resolve19, reject) => {
17223
17223
  stream.call(this, opts, factory, (err, data) => {
17224
- return err ? reject(err) : resolve18(data);
17224
+ return err ? reject(err) : resolve19(data);
17225
17225
  });
17226
17226
  });
17227
17227
  }
@@ -17521,9 +17521,9 @@ var require_api_upgrade = __commonJS({
17521
17521
  };
17522
17522
  function upgrade2(opts, callback) {
17523
17523
  if (callback === void 0) {
17524
- return new Promise((resolve18, reject) => {
17524
+ return new Promise((resolve19, reject) => {
17525
17525
  upgrade2.call(this, opts, (err, data) => {
17526
- return err ? reject(err) : resolve18(data);
17526
+ return err ? reject(err) : resolve19(data);
17527
17527
  });
17528
17528
  });
17529
17529
  }
@@ -17617,9 +17617,9 @@ var require_api_connect = __commonJS({
17617
17617
  };
17618
17618
  function connect2(opts, callback) {
17619
17619
  if (callback === void 0) {
17620
- return new Promise((resolve18, reject) => {
17620
+ return new Promise((resolve19, reject) => {
17621
17621
  connect2.call(this, opts, (err, data) => {
17622
- return err ? reject(err) : resolve18(data);
17622
+ return err ? reject(err) : resolve19(data);
17623
17623
  });
17624
17624
  });
17625
17625
  }
@@ -19104,7 +19104,7 @@ var require_snapshot_recorder = __commonJS({
19104
19104
  "../../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19105
19105
  "use strict";
19106
19106
  var { writeFile: writeFile10, readFile: readFile13, mkdir: mkdir11 } = __require("node:fs/promises");
19107
- var { dirname: dirname19, resolve: resolve18 } = __require("node:path");
19107
+ var { dirname: dirname19, resolve: resolve19 } = __require("node:path");
19108
19108
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19109
19109
  var { InvalidArgumentError, UndiciError } = require_errors();
19110
19110
  var { setHeader } = require_util();
@@ -19321,7 +19321,7 @@ var require_snapshot_recorder = __commonJS({
19321
19321
  throw new InvalidArgumentError("Snapshot path is required");
19322
19322
  }
19323
19323
  try {
19324
- const data = await readFile13(resolve18(path2), "utf8");
19324
+ const data = await readFile13(resolve19(path2), "utf8");
19325
19325
  const parsed = JSON.parse(data);
19326
19326
  if (Array.isArray(parsed)) {
19327
19327
  this.#snapshots.clear();
@@ -19350,7 +19350,7 @@ var require_snapshot_recorder = __commonJS({
19350
19350
  if (!path2) {
19351
19351
  throw new InvalidArgumentError("Snapshot path is required");
19352
19352
  }
19353
- const resolvedPath = resolve18(path2);
19353
+ const resolvedPath = resolve19(path2);
19354
19354
  await mkdir11(dirname19(resolvedPath), { recursive: true });
19355
19355
  const data = Array.from(this.#snapshots.entries()).map(([hash4, snapshot]) => ({
19356
19356
  hash: hash4,
@@ -21358,14 +21358,14 @@ var require_cache = __commonJS({
21358
21358
  var require_date = __commonJS({
21359
21359
  "../../node_modules/undici/lib/util/date.js"(exports, module) {
21360
21360
  "use strict";
21361
- function parseHttpDate(date5) {
21362
- switch (date5[3]) {
21361
+ function parseHttpDate(date6) {
21362
+ switch (date6[3]) {
21363
21363
  case ",":
21364
- return parseImfDate(date5);
21364
+ return parseImfDate(date6);
21365
21365
  case " ":
21366
- return parseAscTimeDate(date5);
21366
+ return parseAscTimeDate(date6);
21367
21367
  default:
21368
- return parseRfc850Date(date5);
21368
+ return parseRfc850Date(date6);
21369
21369
  }
21370
21370
  }
21371
21371
  function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
@@ -21375,66 +21375,66 @@ var require_date = __commonJS({
21375
21375
  }
21376
21376
  return result2.getUTCFullYear() === year && result2.getUTCMonth() === monthIdx && result2.getUTCDate() === day && result2.getUTCHours() === hour && result2.getUTCMinutes() === minute && result2.getUTCSeconds() === second && result2.getUTCDay() === weekday ? result2 : void 0;
21377
21377
  }
21378
- function parseImfDate(date5) {
21379
- if (date5.length !== 29 || date5[4] !== " " || date5[7] !== " " || date5[11] !== " " || date5[16] !== " " || date5[19] !== ":" || date5[22] !== ":" || date5[25] !== " " || date5[26] !== "G" || date5[27] !== "M" || date5[28] !== "T") {
21378
+ function parseImfDate(date6) {
21379
+ if (date6.length !== 29 || date6[4] !== " " || date6[7] !== " " || date6[11] !== " " || date6[16] !== " " || date6[19] !== ":" || date6[22] !== ":" || date6[25] !== " " || date6[26] !== "G" || date6[27] !== "M" || date6[28] !== "T") {
21380
21380
  return void 0;
21381
21381
  }
21382
21382
  let weekday = -1;
21383
- if (date5[0] === "S" && date5[1] === "u" && date5[2] === "n") {
21383
+ if (date6[0] === "S" && date6[1] === "u" && date6[2] === "n") {
21384
21384
  weekday = 0;
21385
- } else if (date5[0] === "M" && date5[1] === "o" && date5[2] === "n") {
21385
+ } else if (date6[0] === "M" && date6[1] === "o" && date6[2] === "n") {
21386
21386
  weekday = 1;
21387
- } else if (date5[0] === "T" && date5[1] === "u" && date5[2] === "e") {
21387
+ } else if (date6[0] === "T" && date6[1] === "u" && date6[2] === "e") {
21388
21388
  weekday = 2;
21389
- } else if (date5[0] === "W" && date5[1] === "e" && date5[2] === "d") {
21389
+ } else if (date6[0] === "W" && date6[1] === "e" && date6[2] === "d") {
21390
21390
  weekday = 3;
21391
- } else if (date5[0] === "T" && date5[1] === "h" && date5[2] === "u") {
21391
+ } else if (date6[0] === "T" && date6[1] === "h" && date6[2] === "u") {
21392
21392
  weekday = 4;
21393
- } else if (date5[0] === "F" && date5[1] === "r" && date5[2] === "i") {
21393
+ } else if (date6[0] === "F" && date6[1] === "r" && date6[2] === "i") {
21394
21394
  weekday = 5;
21395
- } else if (date5[0] === "S" && date5[1] === "a" && date5[2] === "t") {
21395
+ } else if (date6[0] === "S" && date6[1] === "a" && date6[2] === "t") {
21396
21396
  weekday = 6;
21397
21397
  } else {
21398
21398
  return void 0;
21399
21399
  }
21400
21400
  let day = 0;
21401
- if (date5[5] === "0") {
21402
- const code = date5.charCodeAt(6);
21401
+ if (date6[5] === "0") {
21402
+ const code = date6.charCodeAt(6);
21403
21403
  if (code < 49 || code > 57) {
21404
21404
  return void 0;
21405
21405
  }
21406
21406
  day = code - 48;
21407
21407
  } else {
21408
- const code1 = date5.charCodeAt(5);
21408
+ const code1 = date6.charCodeAt(5);
21409
21409
  if (code1 < 49 || code1 > 51) {
21410
21410
  return void 0;
21411
21411
  }
21412
- const code2 = date5.charCodeAt(6);
21412
+ const code2 = date6.charCodeAt(6);
21413
21413
  if (code2 < 48 || code2 > 57) {
21414
21414
  return void 0;
21415
21415
  }
21416
21416
  day = (code1 - 48) * 10 + (code2 - 48);
21417
21417
  }
21418
21418
  let monthIdx = -1;
21419
- if (date5[8] === "J" && date5[9] === "a" && date5[10] === "n") {
21419
+ if (date6[8] === "J" && date6[9] === "a" && date6[10] === "n") {
21420
21420
  monthIdx = 0;
21421
- } else if (date5[8] === "F" && date5[9] === "e" && date5[10] === "b") {
21421
+ } else if (date6[8] === "F" && date6[9] === "e" && date6[10] === "b") {
21422
21422
  monthIdx = 1;
21423
- } else if (date5[8] === "M" && date5[9] === "a") {
21424
- if (date5[10] === "r") {
21423
+ } else if (date6[8] === "M" && date6[9] === "a") {
21424
+ if (date6[10] === "r") {
21425
21425
  monthIdx = 2;
21426
- } else if (date5[10] === "y") {
21426
+ } else if (date6[10] === "y") {
21427
21427
  monthIdx = 4;
21428
21428
  } else {
21429
21429
  return void 0;
21430
21430
  }
21431
- } else if (date5[8] === "J") {
21432
- if (date5[9] === "a" && date5[10] === "n") {
21431
+ } else if (date6[8] === "J") {
21432
+ if (date6[9] === "a" && date6[10] === "n") {
21433
21433
  monthIdx = 0;
21434
- } else if (date5[9] === "u") {
21435
- if (date5[10] === "n") {
21434
+ } else if (date6[9] === "u") {
21435
+ if (date6[10] === "n") {
21436
21436
  monthIdx = 5;
21437
- } else if (date5[10] === "l") {
21437
+ } else if (date6[10] === "l") {
21438
21438
  monthIdx = 6;
21439
21439
  } else {
21440
21440
  return void 0;
@@ -21442,55 +21442,55 @@ var require_date = __commonJS({
21442
21442
  } else {
21443
21443
  return void 0;
21444
21444
  }
21445
- } else if (date5[8] === "A") {
21446
- if (date5[9] === "p" && date5[10] === "r") {
21445
+ } else if (date6[8] === "A") {
21446
+ if (date6[9] === "p" && date6[10] === "r") {
21447
21447
  monthIdx = 3;
21448
- } else if (date5[9] === "u" && date5[10] === "g") {
21448
+ } else if (date6[9] === "u" && date6[10] === "g") {
21449
21449
  monthIdx = 7;
21450
21450
  } else {
21451
21451
  return void 0;
21452
21452
  }
21453
- } else if (date5[8] === "S" && date5[9] === "e" && date5[10] === "p") {
21453
+ } else if (date6[8] === "S" && date6[9] === "e" && date6[10] === "p") {
21454
21454
  monthIdx = 8;
21455
- } else if (date5[8] === "O" && date5[9] === "c" && date5[10] === "t") {
21455
+ } else if (date6[8] === "O" && date6[9] === "c" && date6[10] === "t") {
21456
21456
  monthIdx = 9;
21457
- } else if (date5[8] === "N" && date5[9] === "o" && date5[10] === "v") {
21457
+ } else if (date6[8] === "N" && date6[9] === "o" && date6[10] === "v") {
21458
21458
  monthIdx = 10;
21459
- } else if (date5[8] === "D" && date5[9] === "e" && date5[10] === "c") {
21459
+ } else if (date6[8] === "D" && date6[9] === "e" && date6[10] === "c") {
21460
21460
  monthIdx = 11;
21461
21461
  } else {
21462
21462
  return void 0;
21463
21463
  }
21464
- const yearDigit1 = date5.charCodeAt(12);
21464
+ const yearDigit1 = date6.charCodeAt(12);
21465
21465
  if (yearDigit1 < 48 || yearDigit1 > 57) {
21466
21466
  return void 0;
21467
21467
  }
21468
- const yearDigit2 = date5.charCodeAt(13);
21468
+ const yearDigit2 = date6.charCodeAt(13);
21469
21469
  if (yearDigit2 < 48 || yearDigit2 > 57) {
21470
21470
  return void 0;
21471
21471
  }
21472
- const yearDigit3 = date5.charCodeAt(14);
21472
+ const yearDigit3 = date6.charCodeAt(14);
21473
21473
  if (yearDigit3 < 48 || yearDigit3 > 57) {
21474
21474
  return void 0;
21475
21475
  }
21476
- const yearDigit4 = date5.charCodeAt(15);
21476
+ const yearDigit4 = date6.charCodeAt(15);
21477
21477
  if (yearDigit4 < 48 || yearDigit4 > 57) {
21478
21478
  return void 0;
21479
21479
  }
21480
21480
  const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
21481
21481
  let hour = 0;
21482
- if (date5[17] === "0") {
21483
- const code = date5.charCodeAt(18);
21482
+ if (date6[17] === "0") {
21483
+ const code = date6.charCodeAt(18);
21484
21484
  if (code < 48 || code > 57) {
21485
21485
  return void 0;
21486
21486
  }
21487
21487
  hour = code - 48;
21488
21488
  } else {
21489
- const code1 = date5.charCodeAt(17);
21489
+ const code1 = date6.charCodeAt(17);
21490
21490
  if (code1 < 48 || code1 > 50) {
21491
21491
  return void 0;
21492
21492
  }
21493
- const code2 = date5.charCodeAt(18);
21493
+ const code2 = date6.charCodeAt(18);
21494
21494
  if (code2 < 48 || code2 > 57) {
21495
21495
  return void 0;
21496
21496
  }
@@ -21500,36 +21500,36 @@ var require_date = __commonJS({
21500
21500
  hour = (code1 - 48) * 10 + (code2 - 48);
21501
21501
  }
21502
21502
  let minute = 0;
21503
- if (date5[20] === "0") {
21504
- const code = date5.charCodeAt(21);
21503
+ if (date6[20] === "0") {
21504
+ const code = date6.charCodeAt(21);
21505
21505
  if (code < 48 || code > 57) {
21506
21506
  return void 0;
21507
21507
  }
21508
21508
  minute = code - 48;
21509
21509
  } else {
21510
- const code1 = date5.charCodeAt(20);
21510
+ const code1 = date6.charCodeAt(20);
21511
21511
  if (code1 < 48 || code1 > 53) {
21512
21512
  return void 0;
21513
21513
  }
21514
- const code2 = date5.charCodeAt(21);
21514
+ const code2 = date6.charCodeAt(21);
21515
21515
  if (code2 < 48 || code2 > 57) {
21516
21516
  return void 0;
21517
21517
  }
21518
21518
  minute = (code1 - 48) * 10 + (code2 - 48);
21519
21519
  }
21520
21520
  let second = 0;
21521
- if (date5[23] === "0") {
21522
- const code = date5.charCodeAt(24);
21521
+ if (date6[23] === "0") {
21522
+ const code = date6.charCodeAt(24);
21523
21523
  if (code < 48 || code > 57) {
21524
21524
  return void 0;
21525
21525
  }
21526
21526
  second = code - 48;
21527
21527
  } else {
21528
- const code1 = date5.charCodeAt(23);
21528
+ const code1 = date6.charCodeAt(23);
21529
21529
  if (code1 < 48 || code1 > 53) {
21530
21530
  return void 0;
21531
21531
  }
21532
- const code2 = date5.charCodeAt(24);
21532
+ const code2 = date6.charCodeAt(24);
21533
21533
  if (code2 < 48 || code2 > 57) {
21534
21534
  return void 0;
21535
21535
  }
@@ -21537,48 +21537,48 @@ var require_date = __commonJS({
21537
21537
  }
21538
21538
  return makeDate(year, monthIdx, day, hour, minute, second, weekday);
21539
21539
  }
21540
- function parseAscTimeDate(date5) {
21541
- if (date5.length !== 24 || date5[7] !== " " || date5[10] !== " " || date5[19] !== " ") {
21540
+ function parseAscTimeDate(date6) {
21541
+ if (date6.length !== 24 || date6[7] !== " " || date6[10] !== " " || date6[19] !== " ") {
21542
21542
  return void 0;
21543
21543
  }
21544
21544
  let weekday = -1;
21545
- if (date5[0] === "S" && date5[1] === "u" && date5[2] === "n") {
21545
+ if (date6[0] === "S" && date6[1] === "u" && date6[2] === "n") {
21546
21546
  weekday = 0;
21547
- } else if (date5[0] === "M" && date5[1] === "o" && date5[2] === "n") {
21547
+ } else if (date6[0] === "M" && date6[1] === "o" && date6[2] === "n") {
21548
21548
  weekday = 1;
21549
- } else if (date5[0] === "T" && date5[1] === "u" && date5[2] === "e") {
21549
+ } else if (date6[0] === "T" && date6[1] === "u" && date6[2] === "e") {
21550
21550
  weekday = 2;
21551
- } else if (date5[0] === "W" && date5[1] === "e" && date5[2] === "d") {
21551
+ } else if (date6[0] === "W" && date6[1] === "e" && date6[2] === "d") {
21552
21552
  weekday = 3;
21553
- } else if (date5[0] === "T" && date5[1] === "h" && date5[2] === "u") {
21553
+ } else if (date6[0] === "T" && date6[1] === "h" && date6[2] === "u") {
21554
21554
  weekday = 4;
21555
- } else if (date5[0] === "F" && date5[1] === "r" && date5[2] === "i") {
21555
+ } else if (date6[0] === "F" && date6[1] === "r" && date6[2] === "i") {
21556
21556
  weekday = 5;
21557
- } else if (date5[0] === "S" && date5[1] === "a" && date5[2] === "t") {
21557
+ } else if (date6[0] === "S" && date6[1] === "a" && date6[2] === "t") {
21558
21558
  weekday = 6;
21559
21559
  } else {
21560
21560
  return void 0;
21561
21561
  }
21562
21562
  let monthIdx = -1;
21563
- if (date5[4] === "J" && date5[5] === "a" && date5[6] === "n") {
21563
+ if (date6[4] === "J" && date6[5] === "a" && date6[6] === "n") {
21564
21564
  monthIdx = 0;
21565
- } else if (date5[4] === "F" && date5[5] === "e" && date5[6] === "b") {
21565
+ } else if (date6[4] === "F" && date6[5] === "e" && date6[6] === "b") {
21566
21566
  monthIdx = 1;
21567
- } else if (date5[4] === "M" && date5[5] === "a") {
21568
- if (date5[6] === "r") {
21567
+ } else if (date6[4] === "M" && date6[5] === "a") {
21568
+ if (date6[6] === "r") {
21569
21569
  monthIdx = 2;
21570
- } else if (date5[6] === "y") {
21570
+ } else if (date6[6] === "y") {
21571
21571
  monthIdx = 4;
21572
21572
  } else {
21573
21573
  return void 0;
21574
21574
  }
21575
- } else if (date5[4] === "J") {
21576
- if (date5[5] === "a" && date5[6] === "n") {
21575
+ } else if (date6[4] === "J") {
21576
+ if (date6[5] === "a" && date6[6] === "n") {
21577
21577
  monthIdx = 0;
21578
- } else if (date5[5] === "u") {
21579
- if (date5[6] === "n") {
21578
+ } else if (date6[5] === "u") {
21579
+ if (date6[6] === "n") {
21580
21580
  monthIdx = 5;
21581
- } else if (date5[6] === "l") {
21581
+ } else if (date6[6] === "l") {
21582
21582
  monthIdx = 6;
21583
21583
  } else {
21584
21584
  return void 0;
@@ -21586,56 +21586,56 @@ var require_date = __commonJS({
21586
21586
  } else {
21587
21587
  return void 0;
21588
21588
  }
21589
- } else if (date5[4] === "A") {
21590
- if (date5[5] === "p" && date5[6] === "r") {
21589
+ } else if (date6[4] === "A") {
21590
+ if (date6[5] === "p" && date6[6] === "r") {
21591
21591
  monthIdx = 3;
21592
- } else if (date5[5] === "u" && date5[6] === "g") {
21592
+ } else if (date6[5] === "u" && date6[6] === "g") {
21593
21593
  monthIdx = 7;
21594
21594
  } else {
21595
21595
  return void 0;
21596
21596
  }
21597
- } else if (date5[4] === "S" && date5[5] === "e" && date5[6] === "p") {
21597
+ } else if (date6[4] === "S" && date6[5] === "e" && date6[6] === "p") {
21598
21598
  monthIdx = 8;
21599
- } else if (date5[4] === "O" && date5[5] === "c" && date5[6] === "t") {
21599
+ } else if (date6[4] === "O" && date6[5] === "c" && date6[6] === "t") {
21600
21600
  monthIdx = 9;
21601
- } else if (date5[4] === "N" && date5[5] === "o" && date5[6] === "v") {
21601
+ } else if (date6[4] === "N" && date6[5] === "o" && date6[6] === "v") {
21602
21602
  monthIdx = 10;
21603
- } else if (date5[4] === "D" && date5[5] === "e" && date5[6] === "c") {
21603
+ } else if (date6[4] === "D" && date6[5] === "e" && date6[6] === "c") {
21604
21604
  monthIdx = 11;
21605
21605
  } else {
21606
21606
  return void 0;
21607
21607
  }
21608
21608
  let day = 0;
21609
- if (date5[8] === " ") {
21610
- const code = date5.charCodeAt(9);
21609
+ if (date6[8] === " ") {
21610
+ const code = date6.charCodeAt(9);
21611
21611
  if (code < 49 || code > 57) {
21612
21612
  return void 0;
21613
21613
  }
21614
21614
  day = code - 48;
21615
21615
  } else {
21616
- const code1 = date5.charCodeAt(8);
21616
+ const code1 = date6.charCodeAt(8);
21617
21617
  if (code1 < 49 || code1 > 51) {
21618
21618
  return void 0;
21619
21619
  }
21620
- const code2 = date5.charCodeAt(9);
21620
+ const code2 = date6.charCodeAt(9);
21621
21621
  if (code2 < 48 || code2 > 57) {
21622
21622
  return void 0;
21623
21623
  }
21624
21624
  day = (code1 - 48) * 10 + (code2 - 48);
21625
21625
  }
21626
21626
  let hour = 0;
21627
- if (date5[11] === "0") {
21628
- const code = date5.charCodeAt(12);
21627
+ if (date6[11] === "0") {
21628
+ const code = date6.charCodeAt(12);
21629
21629
  if (code < 48 || code > 57) {
21630
21630
  return void 0;
21631
21631
  }
21632
21632
  hour = code - 48;
21633
21633
  } else {
21634
- const code1 = date5.charCodeAt(11);
21634
+ const code1 = date6.charCodeAt(11);
21635
21635
  if (code1 < 48 || code1 > 50) {
21636
21636
  return void 0;
21637
21637
  }
21638
- const code2 = date5.charCodeAt(12);
21638
+ const code2 = date6.charCodeAt(12);
21639
21639
  if (code2 < 48 || code2 > 57) {
21640
21640
  return void 0;
21641
21641
  }
@@ -21645,163 +21645,163 @@ var require_date = __commonJS({
21645
21645
  hour = (code1 - 48) * 10 + (code2 - 48);
21646
21646
  }
21647
21647
  let minute = 0;
21648
- if (date5[14] === "0") {
21649
- const code = date5.charCodeAt(15);
21648
+ if (date6[14] === "0") {
21649
+ const code = date6.charCodeAt(15);
21650
21650
  if (code < 48 || code > 57) {
21651
21651
  return void 0;
21652
21652
  }
21653
21653
  minute = code - 48;
21654
21654
  } else {
21655
- const code1 = date5.charCodeAt(14);
21655
+ const code1 = date6.charCodeAt(14);
21656
21656
  if (code1 < 48 || code1 > 53) {
21657
21657
  return void 0;
21658
21658
  }
21659
- const code2 = date5.charCodeAt(15);
21659
+ const code2 = date6.charCodeAt(15);
21660
21660
  if (code2 < 48 || code2 > 57) {
21661
21661
  return void 0;
21662
21662
  }
21663
21663
  minute = (code1 - 48) * 10 + (code2 - 48);
21664
21664
  }
21665
21665
  let second = 0;
21666
- if (date5[17] === "0") {
21667
- const code = date5.charCodeAt(18);
21666
+ if (date6[17] === "0") {
21667
+ const code = date6.charCodeAt(18);
21668
21668
  if (code < 48 || code > 57) {
21669
21669
  return void 0;
21670
21670
  }
21671
21671
  second = code - 48;
21672
21672
  } else {
21673
- const code1 = date5.charCodeAt(17);
21673
+ const code1 = date6.charCodeAt(17);
21674
21674
  if (code1 < 48 || code1 > 53) {
21675
21675
  return void 0;
21676
21676
  }
21677
- const code2 = date5.charCodeAt(18);
21677
+ const code2 = date6.charCodeAt(18);
21678
21678
  if (code2 < 48 || code2 > 57) {
21679
21679
  return void 0;
21680
21680
  }
21681
21681
  second = (code1 - 48) * 10 + (code2 - 48);
21682
21682
  }
21683
- const yearDigit1 = date5.charCodeAt(20);
21683
+ const yearDigit1 = date6.charCodeAt(20);
21684
21684
  if (yearDigit1 < 48 || yearDigit1 > 57) {
21685
21685
  return void 0;
21686
21686
  }
21687
- const yearDigit2 = date5.charCodeAt(21);
21687
+ const yearDigit2 = date6.charCodeAt(21);
21688
21688
  if (yearDigit2 < 48 || yearDigit2 > 57) {
21689
21689
  return void 0;
21690
21690
  }
21691
- const yearDigit3 = date5.charCodeAt(22);
21691
+ const yearDigit3 = date6.charCodeAt(22);
21692
21692
  if (yearDigit3 < 48 || yearDigit3 > 57) {
21693
21693
  return void 0;
21694
21694
  }
21695
- const yearDigit4 = date5.charCodeAt(23);
21695
+ const yearDigit4 = date6.charCodeAt(23);
21696
21696
  if (yearDigit4 < 48 || yearDigit4 > 57) {
21697
21697
  return void 0;
21698
21698
  }
21699
21699
  const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
21700
21700
  return makeDate(year, monthIdx, day, hour, minute, second, weekday);
21701
21701
  }
21702
- function parseRfc850Date(date5) {
21702
+ function parseRfc850Date(date6) {
21703
21703
  let commaIndex = -1;
21704
21704
  let weekday = -1;
21705
- if (date5[0] === "S") {
21706
- if (date5[1] === "u" && date5[2] === "n" && date5[3] === "d" && date5[4] === "a" && date5[5] === "y") {
21705
+ if (date6[0] === "S") {
21706
+ if (date6[1] === "u" && date6[2] === "n" && date6[3] === "d" && date6[4] === "a" && date6[5] === "y") {
21707
21707
  weekday = 0;
21708
21708
  commaIndex = 6;
21709
- } else if (date5[1] === "a" && date5[2] === "t" && date5[3] === "u" && date5[4] === "r" && date5[5] === "d" && date5[6] === "a" && date5[7] === "y") {
21709
+ } else if (date6[1] === "a" && date6[2] === "t" && date6[3] === "u" && date6[4] === "r" && date6[5] === "d" && date6[6] === "a" && date6[7] === "y") {
21710
21710
  weekday = 6;
21711
21711
  commaIndex = 8;
21712
21712
  }
21713
- } else if (date5[0] === "M" && date5[1] === "o" && date5[2] === "n" && date5[3] === "d" && date5[4] === "a" && date5[5] === "y") {
21713
+ } else if (date6[0] === "M" && date6[1] === "o" && date6[2] === "n" && date6[3] === "d" && date6[4] === "a" && date6[5] === "y") {
21714
21714
  weekday = 1;
21715
21715
  commaIndex = 6;
21716
- } else if (date5[0] === "T") {
21717
- if (date5[1] === "u" && date5[2] === "e" && date5[3] === "s" && date5[4] === "d" && date5[5] === "a" && date5[6] === "y") {
21716
+ } else if (date6[0] === "T") {
21717
+ if (date6[1] === "u" && date6[2] === "e" && date6[3] === "s" && date6[4] === "d" && date6[5] === "a" && date6[6] === "y") {
21718
21718
  weekday = 2;
21719
21719
  commaIndex = 7;
21720
- } else if (date5[1] === "h" && date5[2] === "u" && date5[3] === "r" && date5[4] === "s" && date5[5] === "d" && date5[6] === "a" && date5[7] === "y") {
21720
+ } else if (date6[1] === "h" && date6[2] === "u" && date6[3] === "r" && date6[4] === "s" && date6[5] === "d" && date6[6] === "a" && date6[7] === "y") {
21721
21721
  weekday = 4;
21722
21722
  commaIndex = 8;
21723
21723
  }
21724
- } else if (date5[0] === "W" && date5[1] === "e" && date5[2] === "d" && date5[3] === "n" && date5[4] === "e" && date5[5] === "s" && date5[6] === "d" && date5[7] === "a" && date5[8] === "y") {
21724
+ } else if (date6[0] === "W" && date6[1] === "e" && date6[2] === "d" && date6[3] === "n" && date6[4] === "e" && date6[5] === "s" && date6[6] === "d" && date6[7] === "a" && date6[8] === "y") {
21725
21725
  weekday = 3;
21726
21726
  commaIndex = 9;
21727
- } else if (date5[0] === "F" && date5[1] === "r" && date5[2] === "i" && date5[3] === "d" && date5[4] === "a" && date5[5] === "y") {
21727
+ } else if (date6[0] === "F" && date6[1] === "r" && date6[2] === "i" && date6[3] === "d" && date6[4] === "a" && date6[5] === "y") {
21728
21728
  weekday = 5;
21729
21729
  commaIndex = 6;
21730
21730
  } else {
21731
21731
  return void 0;
21732
21732
  }
21733
- if (date5[commaIndex] !== "," || date5.length - commaIndex - 1 !== 23 || date5[commaIndex + 1] !== " " || date5[commaIndex + 4] !== "-" || date5[commaIndex + 8] !== "-" || date5[commaIndex + 11] !== " " || date5[commaIndex + 14] !== ":" || date5[commaIndex + 17] !== ":" || date5[commaIndex + 20] !== " " || date5[commaIndex + 21] !== "G" || date5[commaIndex + 22] !== "M" || date5[commaIndex + 23] !== "T") {
21733
+ if (date6[commaIndex] !== "," || date6.length - commaIndex - 1 !== 23 || date6[commaIndex + 1] !== " " || date6[commaIndex + 4] !== "-" || date6[commaIndex + 8] !== "-" || date6[commaIndex + 11] !== " " || date6[commaIndex + 14] !== ":" || date6[commaIndex + 17] !== ":" || date6[commaIndex + 20] !== " " || date6[commaIndex + 21] !== "G" || date6[commaIndex + 22] !== "M" || date6[commaIndex + 23] !== "T") {
21734
21734
  return void 0;
21735
21735
  }
21736
21736
  let day = 0;
21737
- if (date5[commaIndex + 2] === "0") {
21738
- const code = date5.charCodeAt(commaIndex + 3);
21737
+ if (date6[commaIndex + 2] === "0") {
21738
+ const code = date6.charCodeAt(commaIndex + 3);
21739
21739
  if (code < 49 || code > 57) {
21740
21740
  return void 0;
21741
21741
  }
21742
21742
  day = code - 48;
21743
21743
  } else {
21744
- const code1 = date5.charCodeAt(commaIndex + 2);
21744
+ const code1 = date6.charCodeAt(commaIndex + 2);
21745
21745
  if (code1 < 49 || code1 > 51) {
21746
21746
  return void 0;
21747
21747
  }
21748
- const code2 = date5.charCodeAt(commaIndex + 3);
21748
+ const code2 = date6.charCodeAt(commaIndex + 3);
21749
21749
  if (code2 < 48 || code2 > 57) {
21750
21750
  return void 0;
21751
21751
  }
21752
21752
  day = (code1 - 48) * 10 + (code2 - 48);
21753
21753
  }
21754
21754
  let monthIdx = -1;
21755
- if (date5[commaIndex + 5] === "J" && date5[commaIndex + 6] === "a" && date5[commaIndex + 7] === "n") {
21755
+ if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "n") {
21756
21756
  monthIdx = 0;
21757
- } else if (date5[commaIndex + 5] === "F" && date5[commaIndex + 6] === "e" && date5[commaIndex + 7] === "b") {
21757
+ } else if (date6[commaIndex + 5] === "F" && date6[commaIndex + 6] === "e" && date6[commaIndex + 7] === "b") {
21758
21758
  monthIdx = 1;
21759
- } else if (date5[commaIndex + 5] === "M" && date5[commaIndex + 6] === "a" && date5[commaIndex + 7] === "r") {
21759
+ } else if (date6[commaIndex + 5] === "M" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "r") {
21760
21760
  monthIdx = 2;
21761
- } else if (date5[commaIndex + 5] === "A" && date5[commaIndex + 6] === "p" && date5[commaIndex + 7] === "r") {
21761
+ } else if (date6[commaIndex + 5] === "A" && date6[commaIndex + 6] === "p" && date6[commaIndex + 7] === "r") {
21762
21762
  monthIdx = 3;
21763
- } else if (date5[commaIndex + 5] === "M" && date5[commaIndex + 6] === "a" && date5[commaIndex + 7] === "y") {
21763
+ } else if (date6[commaIndex + 5] === "M" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "y") {
21764
21764
  monthIdx = 4;
21765
- } else if (date5[commaIndex + 5] === "J" && date5[commaIndex + 6] === "u" && date5[commaIndex + 7] === "n") {
21765
+ } else if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "n") {
21766
21766
  monthIdx = 5;
21767
- } else if (date5[commaIndex + 5] === "J" && date5[commaIndex + 6] === "u" && date5[commaIndex + 7] === "l") {
21767
+ } else if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "l") {
21768
21768
  monthIdx = 6;
21769
- } else if (date5[commaIndex + 5] === "A" && date5[commaIndex + 6] === "u" && date5[commaIndex + 7] === "g") {
21769
+ } else if (date6[commaIndex + 5] === "A" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "g") {
21770
21770
  monthIdx = 7;
21771
- } else if (date5[commaIndex + 5] === "S" && date5[commaIndex + 6] === "e" && date5[commaIndex + 7] === "p") {
21771
+ } else if (date6[commaIndex + 5] === "S" && date6[commaIndex + 6] === "e" && date6[commaIndex + 7] === "p") {
21772
21772
  monthIdx = 8;
21773
- } else if (date5[commaIndex + 5] === "O" && date5[commaIndex + 6] === "c" && date5[commaIndex + 7] === "t") {
21773
+ } else if (date6[commaIndex + 5] === "O" && date6[commaIndex + 6] === "c" && date6[commaIndex + 7] === "t") {
21774
21774
  monthIdx = 9;
21775
- } else if (date5[commaIndex + 5] === "N" && date5[commaIndex + 6] === "o" && date5[commaIndex + 7] === "v") {
21775
+ } else if (date6[commaIndex + 5] === "N" && date6[commaIndex + 6] === "o" && date6[commaIndex + 7] === "v") {
21776
21776
  monthIdx = 10;
21777
- } else if (date5[commaIndex + 5] === "D" && date5[commaIndex + 6] === "e" && date5[commaIndex + 7] === "c") {
21777
+ } else if (date6[commaIndex + 5] === "D" && date6[commaIndex + 6] === "e" && date6[commaIndex + 7] === "c") {
21778
21778
  monthIdx = 11;
21779
21779
  } else {
21780
21780
  return void 0;
21781
21781
  }
21782
- const yearDigit1 = date5.charCodeAt(commaIndex + 9);
21782
+ const yearDigit1 = date6.charCodeAt(commaIndex + 9);
21783
21783
  if (yearDigit1 < 48 || yearDigit1 > 57) {
21784
21784
  return void 0;
21785
21785
  }
21786
- const yearDigit2 = date5.charCodeAt(commaIndex + 10);
21786
+ const yearDigit2 = date6.charCodeAt(commaIndex + 10);
21787
21787
  if (yearDigit2 < 48 || yearDigit2 > 57) {
21788
21788
  return void 0;
21789
21789
  }
21790
21790
  let year = (yearDigit1 - 48) * 10 + (yearDigit2 - 48);
21791
21791
  year += year < 70 ? 2e3 : 1900;
21792
21792
  let hour = 0;
21793
- if (date5[commaIndex + 12] === "0") {
21794
- const code = date5.charCodeAt(commaIndex + 13);
21793
+ if (date6[commaIndex + 12] === "0") {
21794
+ const code = date6.charCodeAt(commaIndex + 13);
21795
21795
  if (code < 48 || code > 57) {
21796
21796
  return void 0;
21797
21797
  }
21798
21798
  hour = code - 48;
21799
21799
  } else {
21800
- const code1 = date5.charCodeAt(commaIndex + 12);
21800
+ const code1 = date6.charCodeAt(commaIndex + 12);
21801
21801
  if (code1 < 48 || code1 > 50) {
21802
21802
  return void 0;
21803
21803
  }
21804
- const code2 = date5.charCodeAt(commaIndex + 13);
21804
+ const code2 = date6.charCodeAt(commaIndex + 13);
21805
21805
  if (code2 < 48 || code2 > 57) {
21806
21806
  return void 0;
21807
21807
  }
@@ -21811,36 +21811,36 @@ var require_date = __commonJS({
21811
21811
  hour = (code1 - 48) * 10 + (code2 - 48);
21812
21812
  }
21813
21813
  let minute = 0;
21814
- if (date5[commaIndex + 15] === "0") {
21815
- const code = date5.charCodeAt(commaIndex + 16);
21814
+ if (date6[commaIndex + 15] === "0") {
21815
+ const code = date6.charCodeAt(commaIndex + 16);
21816
21816
  if (code < 48 || code > 57) {
21817
21817
  return void 0;
21818
21818
  }
21819
21819
  minute = code - 48;
21820
21820
  } else {
21821
- const code1 = date5.charCodeAt(commaIndex + 15);
21821
+ const code1 = date6.charCodeAt(commaIndex + 15);
21822
21822
  if (code1 < 48 || code1 > 53) {
21823
21823
  return void 0;
21824
21824
  }
21825
- const code2 = date5.charCodeAt(commaIndex + 16);
21825
+ const code2 = date6.charCodeAt(commaIndex + 16);
21826
21826
  if (code2 < 48 || code2 > 57) {
21827
21827
  return void 0;
21828
21828
  }
21829
21829
  minute = (code1 - 48) * 10 + (code2 - 48);
21830
21830
  }
21831
21831
  let second = 0;
21832
- if (date5[commaIndex + 18] === "0") {
21833
- const code = date5.charCodeAt(commaIndex + 19);
21832
+ if (date6[commaIndex + 18] === "0") {
21833
+ const code = date6.charCodeAt(commaIndex + 19);
21834
21834
  if (code < 48 || code > 57) {
21835
21835
  return void 0;
21836
21836
  }
21837
21837
  second = code - 48;
21838
21838
  } else {
21839
- const code1 = date5.charCodeAt(commaIndex + 18);
21839
+ const code1 = date6.charCodeAt(commaIndex + 18);
21840
21840
  if (code1 < 48 || code1 > 53) {
21841
21841
  return void 0;
21842
21842
  }
21843
- const code2 = date5.charCodeAt(commaIndex + 19);
21843
+ const code2 = date6.charCodeAt(commaIndex + 19);
21844
21844
  if (code2 < 48 || code2 > 57) {
21845
21845
  return void 0;
21846
21846
  }
@@ -27657,7 +27657,7 @@ var require_fetch = __commonJS({
27657
27657
  const hasTrailingQuestionMark = url3.search.length === 0 && url3.href[url3.href.length - url3.hash.length - 1] === "?";
27658
27658
  return dispatchWithProtocolPreference(body2);
27659
27659
  function dispatchWithProtocolPreference(body3, allowH2) {
27660
- return new Promise((resolve18, reject) => agent.dispatch(
27660
+ return new Promise((resolve19, reject) => agent.dispatch(
27661
27661
  {
27662
27662
  path: hasTrailingQuestionMark ? `${path2}?` : path2,
27663
27663
  origin: url3.origin,
@@ -27744,7 +27744,7 @@ var require_fetch = __commonJS({
27744
27744
  }
27745
27745
  this.body = new Readable({ read: () => controller2.resume() });
27746
27746
  const onError = (err) => this.onResponseError(controller2, err);
27747
- resolve18({
27747
+ resolve19({
27748
27748
  status: status2,
27749
27749
  statusText,
27750
27750
  headersList,
@@ -27777,7 +27777,7 @@ var require_fetch = __commonJS({
27777
27777
  fetchParams.controller.off("terminated", this.abort);
27778
27778
  }
27779
27779
  if (request2.mode === "websocket" && allowH2 !== false && error62?.code === "UND_ERR_INFO" && error62?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
27780
- resolve18(dispatchWithProtocolPreference(body3, false));
27780
+ resolve19(dispatchWithProtocolPreference(body3, false));
27781
27781
  return;
27782
27782
  }
27783
27783
  this.body?.destroy(error62);
@@ -27796,7 +27796,7 @@ var require_fetch = __commonJS({
27796
27796
  const rawHeaders = controller2?.rawHeaders ?? [];
27797
27797
  const headersList = new HeadersList();
27798
27798
  appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
27799
- resolve18({
27799
+ resolve19({
27800
27800
  status: status2,
27801
27801
  statusText: STATUS_CODES[status2],
27802
27802
  headersList,
@@ -28666,11 +28666,11 @@ var require_util4 = __commonJS({
28666
28666
  "Dec"
28667
28667
  ];
28668
28668
  var IMFPaddedNumbers = Array(61).fill(0).map((_, i) => i.toString().padStart(2, "0"));
28669
- function toIMFDate(date5) {
28670
- if (typeof date5 === "number") {
28671
- date5 = new Date(date5);
28669
+ function toIMFDate(date6) {
28670
+ if (typeof date6 === "number") {
28671
+ date6 = new Date(date6);
28672
28672
  }
28673
- return `${IMFDays[date5.getUTCDay()]}, ${IMFPaddedNumbers[date5.getUTCDate()]} ${IMFMonths[date5.getUTCMonth()]} ${date5.getUTCFullYear()} ${IMFPaddedNumbers[date5.getUTCHours()]}:${IMFPaddedNumbers[date5.getUTCMinutes()]}:${IMFPaddedNumbers[date5.getUTCSeconds()]} GMT`;
28673
+ return `${IMFDays[date6.getUTCDay()]}, ${IMFPaddedNumbers[date6.getUTCDate()]} ${IMFMonths[date6.getUTCMonth()]} ${date6.getUTCFullYear()} ${IMFPaddedNumbers[date6.getUTCHours()]}:${IMFPaddedNumbers[date6.getUTCMinutes()]}:${IMFPaddedNumbers[date6.getUTCSeconds()]} GMT`;
28674
28674
  }
28675
28675
  function validateCookieMaxAge(maxAge) {
28676
28676
  if (maxAge < 0) {
@@ -37436,7 +37436,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
37436
37436
  var NONE = 0;
37437
37437
  var ASSUMED = 1;
37438
37438
  var PROVEN = 2;
37439
- function isRecursive(inst, stack, resolve18) {
37439
+ function isRecursive(inst, stack, resolve19) {
37440
37440
  const cached2 = recursive.get(inst);
37441
37441
  if (cached2 !== void 0)
37442
37442
  return cached2 ? PROVEN : NONE;
@@ -37446,7 +37446,7 @@ function isRecursive(inst, stack, resolve18) {
37446
37446
  let result2 = NONE;
37447
37447
  const check2 = (child2) => {
37448
37448
  if (result2 !== PROVEN && child2?._zod) {
37449
- const answer = isRecursive(child2, stack, resolve18);
37449
+ const answer = isRecursive(child2, stack, resolve19);
37450
37450
  if (answer > result2)
37451
37451
  result2 = answer;
37452
37452
  }
@@ -37457,7 +37457,7 @@ function isRecursive(inst, stack, resolve18) {
37457
37457
  const desc = Object.getOwnPropertyDescriptor(sh, key);
37458
37458
  if (spread && !desc.enumerable)
37459
37459
  continue;
37460
- const child2 = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve18) : NONE;
37460
+ const child2 = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve19) : NONE;
37461
37461
  if (child2 > answer)
37462
37462
  answer = child2;
37463
37463
  }
@@ -37521,7 +37521,7 @@ function isRecursive(inst, stack, resolve18) {
37521
37521
  break;
37522
37522
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
37523
37523
  case "lazy": {
37524
- const inner = def._cachedInner ?? (resolve18 ? inst._zod.innerType : void 0);
37524
+ const inner = def._cachedInner ?? (resolve19 ? inst._zod.innerType : void 0);
37525
37525
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
37526
37526
  break;
37527
37527
  }
@@ -54577,6 +54577,16 @@ var AppError = class extends Error {
54577
54577
  function asError(value2) {
54578
54578
  return value2 instanceof Error ? value2 : new Error(String(value2));
54579
54579
  }
54580
+ function errorMessage(value2) {
54581
+ const error62 = asError(value2);
54582
+ const cause = error62.cause;
54583
+ if (!(cause instanceof Error)) return error62.message;
54584
+ const first = cause.errors?.find((e) => e instanceof Error);
54585
+ let reason2 = cause.message || first?.message || "";
54586
+ if (cause.code && !reason2.includes(cause.code))
54587
+ reason2 = reason2 ? `${reason2} (${cause.code})` : cause.code;
54588
+ return reason2 && !error62.message.includes(reason2) ? `${error62.message}: ${reason2}` : error62.message;
54589
+ }
54580
54590
 
54581
54591
  // src/client.ts
54582
54592
  var defaultWorkspace;
@@ -54589,6 +54599,8 @@ var ServiceError = class extends Error {
54589
54599
  exitCode;
54590
54600
  fields;
54591
54601
  requestId;
54602
+ /** Exact commands that move the agent forward, printed with the error. */
54603
+ next;
54592
54604
  constructor(message, code = "SERVICE_ERROR", exitCode = 1) {
54593
54605
  super(message);
54594
54606
  this.code = code;
@@ -57105,7 +57117,7 @@ function selectProductResponse(value2, pointers) {
57105
57117
  return result2;
57106
57118
  }
57107
57119
  function abortRace(pending, signal) {
57108
- return new Promise((resolve18, reject) => {
57120
+ return new Promise((resolve19, reject) => {
57109
57121
  const abort = () => reject(failure2("PRODUCT_REQUEST_CANCELLED", 403));
57110
57122
  if (signal.aborted) {
57111
57123
  abort();
@@ -57114,7 +57126,7 @@ function abortRace(pending, signal) {
57114
57126
  return;
57115
57127
  }
57116
57128
  signal.addEventListener("abort", abort, { once: true });
57117
- pending.then(resolve18, reject).finally(() => signal.removeEventListener("abort", abort)).catch(() => {
57129
+ pending.then(resolve19, reject).finally(() => signal.removeEventListener("abort", abort)).catch(() => {
57118
57130
  });
57119
57131
  });
57120
57132
  }
@@ -57477,11 +57489,11 @@ async function localProductRequestBroker(input2, options = {}) {
57477
57489
  server.headersTimeout = 5e3;
57478
57490
  server.requestTimeout = 1e4;
57479
57491
  try {
57480
- await new Promise((resolve18, reject) => {
57492
+ await new Promise((resolve19, reject) => {
57481
57493
  server.once("error", reject);
57482
57494
  server.listen(0, "127.0.0.1", () => {
57483
57495
  server.removeListener("error", reject);
57484
- resolve18();
57496
+ resolve19();
57485
57497
  });
57486
57498
  });
57487
57499
  } catch (error62) {
@@ -57518,7 +57530,7 @@ async function localProductRequestBroker(input2, options = {}) {
57518
57530
  closed = true;
57519
57531
  stop.abort();
57520
57532
  const done = new Promise(
57521
- (resolve18, reject) => server.close((e) => e ? reject(e) : resolve18())
57533
+ (resolve19, reject) => server.close((e) => e ? reject(e) : resolve19())
57522
57534
  );
57523
57535
  server.closeAllConnections();
57524
57536
  await Promise.allSettled([...pending]);
@@ -57829,9 +57841,7 @@ ${failures.join("\n")}`
57829
57841
  };
57830
57842
  } catch (cause) {
57831
57843
  if (exchange && !exchange.error) {
57832
- const error62 = asError(cause);
57833
- const code = error62.cause?.code;
57834
- exchange.error = m.httpAuth ? "Request failed" : signal.aborted ? "Deadline reached before the response completed" : `${code ? `${code}: ` : ""}${error62.message}`.slice(
57844
+ exchange.error = m.httpAuth ? "Request failed" : signal.aborted ? "Deadline reached before the response completed" : errorMessage(cause).slice(
57835
57845
  0,
57836
57846
  RUN_TRACE_LIMITS.text
57837
57847
  );
@@ -58498,10 +58508,10 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
58498
58508
  signal.throwIfAborted();
58499
58509
  const url3 = certificateTarget(monitor.target), hostname4 = url3.hostname;
58500
58510
  const lookupStarted = performance3.now();
58501
- const addresses = await new Promise((resolve18, reject) => {
58511
+ const addresses = await new Promise((resolve19, reject) => {
58502
58512
  const abort = () => reject(new Error("Certificate check cancelled or timed out"));
58503
58513
  signal.addEventListener("abort", abort, { once: true });
58504
- io.lookup(hostname4, { all: true, verbatim: true }).then(resolve18, reject).finally(() => signal.removeEventListener("abort", abort));
58514
+ io.lookup(hostname4, { all: true, verbatim: true }).then(resolve19, reject).finally(() => signal.removeEventListener("abort", abort));
58505
58515
  if (signal.aborted) abort();
58506
58516
  });
58507
58517
  signal.throwIfAborted();
@@ -58518,7 +58528,7 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
58518
58528
  };
58519
58529
  const connectStarted = performance3.now();
58520
58530
  let tcpAt = null;
58521
- return await new Promise((resolve18) => {
58531
+ return await new Promise((resolve19) => {
58522
58532
  let done = false;
58523
58533
  const socket = io.connect({
58524
58534
  host: addresses[0].address,
@@ -58543,7 +58553,7 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
58543
58553
  );
58544
58554
  signal.removeEventListener("abort", abort);
58545
58555
  socket.destroy();
58546
- resolve18(result2);
58556
+ resolve19(result2);
58547
58557
  };
58548
58558
  const abort = () => finish({
58549
58559
  status: "error",
@@ -58612,7 +58622,7 @@ import { performance as performance4 } from "node:perf_hooks";
58612
58622
  // package.json
58613
58623
  var package_default = {
58614
58624
  name: "@waitcher/cli",
58615
- version: "0.2.33",
58625
+ version: "0.2.34",
58616
58626
  description: "Synthetic monitoring from your repository: deploy HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual, MCP server and coding agent checks from waitcher.json, with AI checks and status pages.",
58617
58627
  license: "SEE LICENSE IN LICENSE.txt",
58618
58628
  author: "S\u0142awomir Radzymi\u0144ski",
@@ -59052,11 +59062,11 @@ var deadline = (monitor, parent) => AbortSignal.any([
59052
59062
  ...parent ? [parent] : []
59053
59063
  ]);
59054
59064
  function race(work, signal, message) {
59055
- return new Promise((resolve18, reject) => {
59065
+ return new Promise((resolve19, reject) => {
59056
59066
  const abort = () => reject(new Error(message));
59057
59067
  if (signal.aborted) return abort();
59058
59068
  signal.addEventListener("abort", abort, { once: true });
59059
- work.then(resolve18, reject).finally(
59069
+ work.then(resolve19, reject).finally(
59060
59070
  () => signal.removeEventListener("abort", abort)
59061
59071
  );
59062
59072
  });
@@ -59114,7 +59124,7 @@ async function tcpCheck(monitor, parent, io = tcpTransport, sink = {}) {
59114
59124
  const address = addresses[0].address;
59115
59125
  trace.address = address;
59116
59126
  const connectStarted = performance5.now();
59117
- return await new Promise((resolve18) => {
59127
+ return await new Promise((resolve19) => {
59118
59128
  let done = false;
59119
59129
  const chunks = [];
59120
59130
  let bytes2 = 0;
@@ -59127,7 +59137,7 @@ async function tcpCheck(monitor, parent, io = tcpTransport, sink = {}) {
59127
59137
  socket.destroy();
59128
59138
  if (bytes2)
59129
59139
  trace.banner = short(Buffer.concat(chunks).toString("utf8").trim());
59130
- resolve18(result2);
59140
+ resolve19(result2);
59131
59141
  };
59132
59142
  const abort = () => finish(
59133
59143
  connectedAt ? fail2(
@@ -59718,7 +59728,7 @@ async function scriptCheckInternal(m, dir, signal, options = {}) {
59718
59728
  throw Error(
59719
59729
  "AI execution requires the exact frozen binding and a private attempt grant"
59720
59730
  );
59721
- await symlink(join5(root, "node_modules"), join5(dir, "node_modules"), "dir");
59731
+ await linkNodeModules(root, dir);
59722
59732
  await writeFile2(
59723
59733
  join5(dir, "package.json"),
59724
59734
  JSON.stringify({
@@ -60063,6 +60073,19 @@ function identitySecretValues(identity) {
60063
60073
  ])
60064
60074
  ].filter((value2) => [...value2].length >= 6).flatMap((value2) => [value2, JSON.stringify(value2).slice(1, -1)]);
60065
60075
  }
60076
+ async function linkNodeModules(root, dir, options = {}) {
60077
+ const platform = options.platform ?? process.platform, link2 = options.link ?? symlink;
60078
+ const target = resolve8(root, "node_modules");
60079
+ try {
60080
+ await link2(target, join5(dir, "node_modules"), platform === "win32" ? "junction" : "dir");
60081
+ } catch (cause) {
60082
+ const code = cause.code;
60083
+ throw new Error(
60084
+ `Could not link ${target} into the run folder (${code ?? "unknown error"}). ` + (platform === "win32" ? "Windows refused a directory junction; check that the run folder and the project are on local NTFS drives, or enable Developer Mode." : "Check that the project has node_modules (waitcher runtime install) and the run folder is writable."),
60085
+ { cause }
60086
+ );
60087
+ }
60088
+ }
60066
60089
  async function scriptCheck(m, dir, signal, options = {}) {
60067
60090
  if (m.type === "visual") {
60068
60091
  const { script, web } = visualTest(m.visual, m.timeout);
@@ -60223,7 +60246,7 @@ async function execute(monitor, runDir, {
60223
60246
  const error62 = asError(cause);
60224
60247
  result2 = {
60225
60248
  status: "error",
60226
- message: monitor.httpAuth ? "Authenticated endpoint execution could not be evaluated" : error62.message,
60249
+ message: monitor.httpAuth ? "Authenticated endpoint execution could not be evaluated" : errorMessage(error62),
60227
60250
  logs: monitor.httpAuth ? "HTTP credential dispatch or transport failed. No credentials or response body are recorded." : error62.stack ?? String(error62),
60228
60251
  ...cause instanceof StorageError ? { resourceReason: cause.code } : {},
60229
60252
  ...monitor.httpAuth && !(cause instanceof StorageError) ? { resourceReason: "HTTP_AUTH_EXECUTION_ERROR" } : {},
@@ -61579,11 +61602,11 @@ async function localModelBroker(input2, options = {}) {
61579
61602
  server.maxConnections = 8;
61580
61603
  server.headersTimeout = 5e3;
61581
61604
  server.requestTimeout = 35e3;
61582
- await new Promise((resolve18, reject) => {
61605
+ await new Promise((resolve19, reject) => {
61583
61606
  server.once("error", reject);
61584
61607
  server.listen(0, "127.0.0.1", () => {
61585
61608
  server.removeListener("error", reject);
61586
- resolve18();
61609
+ resolve19();
61587
61610
  });
61588
61611
  });
61589
61612
  const origin = `http://127.0.0.1:${server.address().port}`;
@@ -61619,7 +61642,7 @@ async function localModelBroker(input2, options = {}) {
61619
61642
  finishing = (async () => {
61620
61643
  revoked = true;
61621
61644
  const closed = new Promise(
61622
- (resolve18, reject) => server.close((e) => e ? reject(e) : resolve18())
61645
+ (resolve19, reject) => server.close((e) => e ? reject(e) : resolve19())
61623
61646
  );
61624
61647
  server.closeAllConnections();
61625
61648
  await Promise.allSettled([...pending]);
@@ -62702,39 +62725,37 @@ async function buildScript({
62702
62725
  import { readFile as readFile7, realpath as realpath3, mkdir as mkdir7, writeFile as writeFile8, rm as rm5 } from "node:fs/promises";
62703
62726
  import { execFile } from "node:child_process";
62704
62727
  import { randomUUID as randomUUID6 } from "node:crypto";
62705
- import { dirname as dirname12, join as join12, resolve as resolve13 } from "node:path";
62728
+ import { dirname as dirname12, join as join12, resolve as resolve14 } from "node:path";
62706
62729
  import { promisify } from "node:util";
62707
62730
 
62708
62731
  // src/runtime.ts
62709
62732
  import { spawn as spawn2 } from "node:child_process";
62710
62733
  import { access, readFile as readFile6, writeFile as writeFile7 } from "node:fs/promises";
62711
- import { createRequire as createRequire3 } from "node:module";
62712
- import { basename as basename2, dirname as dirname11, join as join11 } from "node:path";
62734
+ import { basename as basename2, dirname as dirname11, join as join11, resolve as resolve13 } from "node:path";
62713
62735
  import { pathToFileURL as pathToFileURL3 } from "node:url";
62714
62736
  var RUNTIME_IGNORES = ["node_modules/", ".waitcher/", ".e2e/"];
62715
- async function installedPackage(project, name5) {
62716
- try {
62717
- let dir = dirname11(
62718
- createRequire3(join11(project, "package.json")).resolve(name5)
62719
- );
62720
- for (let i = 0; i < 6; i++, dir = dirname11(dir)) {
62721
- try {
62722
- const meta3 = JSON.parse(await readFile6(join11(dir, "package.json"), "utf8"));
62723
- if (meta3.name === name5) return { dir, version: meta3.version };
62724
- } catch {
62725
- }
62737
+ async function installedPackage(from, name5) {
62738
+ for (let dir = resolve13(from); ; ) {
62739
+ const folder = join11(dir, "node_modules", ...name5.split("/"));
62740
+ try {
62741
+ const meta3 = JSON.parse(await readFile6(join11(folder, "package.json"), "utf8"));
62742
+ if (meta3.name === name5)
62743
+ return { dir: folder, version: meta3.version, main: meta3.main };
62744
+ } catch {
62726
62745
  }
62727
- } catch {
62746
+ const parent = dirname11(dir);
62747
+ if (parent === dir) return null;
62748
+ dir = parent;
62728
62749
  }
62729
- return null;
62730
62750
  }
62731
62751
  var installedVersion = async (project, name5) => (await installedPackage(project, name5))?.version ?? null;
62732
62752
  async function chromiumInstalled(project) {
62733
62753
  try {
62734
62754
  const web = await installedPackage(project, "@e2e-dev/web");
62735
62755
  if (!web) return false;
62736
- const core = createRequire3(join11(web.dir, "package.json")).resolve("playwright-core");
62737
- const playwright = await import(pathToFileURL3(core).href);
62756
+ const core = await installedPackage(web.dir, "playwright-core");
62757
+ if (!core) return false;
62758
+ const playwright = await import(pathToFileURL3(join11(core.dir, core.main ?? "index.js")).href);
62738
62759
  await access((playwright.default ?? playwright).chromium.executablePath());
62739
62760
  return true;
62740
62761
  } catch {
@@ -62776,7 +62797,7 @@ var missingIgnores = (text4) => {
62776
62797
  );
62777
62798
  };
62778
62799
  function run(command, args, cwd, signal) {
62779
- return new Promise((resolve18, reject) => {
62800
+ return new Promise((resolve19, reject) => {
62780
62801
  const child2 = spawn2(command, args, {
62781
62802
  cwd,
62782
62803
  signal,
@@ -62786,7 +62807,7 @@ function run(command, args, cwd, signal) {
62786
62807
  child2.on("error", reject);
62787
62808
  child2.on(
62788
62809
  "exit",
62789
- (code) => code === 0 ? resolve18() : reject(
62810
+ (code) => code === 0 ? resolve19() : reject(
62790
62811
  new ServiceError(
62791
62812
  `${command} ${args.join(" ")} exited with ${code}; read its output above.`,
62792
62813
  "RUNTIME_INSTALL_FAILED",
@@ -62960,7 +62981,7 @@ async function buildEntries(path2, config2) {
62960
62981
  const at = `monitors[${index}].entry`;
62961
62982
  try {
62962
62983
  const built = await buildScript({
62963
- entry: await realpath3(resolve13(project, entry2)).catch(() => {
62984
+ entry: await realpath3(resolve14(project, entry2)).catch(() => {
62964
62985
  throw new Error(`${entry2} was not found next to waitcher.json`);
62965
62986
  }),
62966
62987
  project
@@ -63057,7 +63078,7 @@ async function verifyLocally(options) {
63057
63078
  );
63058
63079
  return { runs, issues: issues2 };
63059
63080
  }
63060
- var configPath = (file2) => resolve13(file2 ?? CONFIG_FILE);
63081
+ var configPath = (file2) => resolve14(file2 ?? CONFIG_FILE);
63061
63082
  async function readProjectConfig(file2) {
63062
63083
  const path2 = configPath(file2);
63063
63084
  let text4;
@@ -63302,16 +63323,16 @@ async function upgrade(options) {
63302
63323
  }
63303
63324
 
63304
63325
  // ../../skills/waitcher/SKILL.md
63305
- var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual or MCP monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts or workspaces, raise limits or remove assertions to get a green result.\n- Work in the workspace the user chose. `waitcher auth status` names the active one (personal or a team) and your role; ask before `workspace use`, `--workspace` or any `member` command.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `tcp` for a database, mail or SSH port, `dns` for records that must keep their values, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey, `mcp` when the product ships a remote MCP server. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat.\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\n## Runtime upgrades\n\nChecks run on the runtime generation the project pins; nothing moves them but a deploy. When the user asks to upgrade Waitcher or its runtime, doctor names a newer generation, or you see `RUNTIME_VERSION_ENDING` or `RUNTIME_VERSION_MISMATCH`: run `waitcher runtime upgrade` in the repository and repeat it until `stage` is `current` (`--to ID` targets another supported generation). Each call reports one stage with its `steps`; do them in order. In the `upgrade` stage, `changes[]` names what changed, the lines of this project it may affect (`matches`) and a `fix`, and `previews[]` shows how each hosted check did when Waitcher ran it on the target. Before `--yes` (it installs packages and Chromium) show the user `install.steps` and wait for agreement. Then fix the scripts, run `config validate --env NAME --verify`, show the diff for a commit, and in the `deploy` stage plan and apply each environment it lists. Checks made in the web app (no `waitcher.json`) move with `waitcher runtime move --id MONITOR_ID` once their preview passed. After a generation ends its checks that did not pass their preview are paused (`RUNTIME_ENDED`, `hosted[].paused` in the upgrade output) until the project upgrades and deploys. Never upgrade unasked: a supported generation is the user's choice.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets, agent checks, public status pages, team workspaces.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
63326
+ var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual or MCP monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr, some with `next`. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts or workspaces, raise limits or remove assertions to get a green result.\n- Work in the workspace the user chose. `waitcher auth status` names the active one (personal or a team) and your role; ask before `workspace use`, `--workspace` or any `member` command.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`; the target is the deployed HTTPS site. To try an app that only runs locally first, write one monitor file instead (`waitcher monitor init --type http --file website.monitor.json --target http://localhost:PORT`, then `waitcher run local --file website.monitor.json`). Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `tcp` for a database, mail or SSH port, `dns` for records that must keep their values, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey, `mcp` when the product ships a remote MCP server. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat.\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\n## Runtime upgrades\n\nChecks run on the runtime generation the project pins; nothing moves them but a deploy. When the user asks to upgrade Waitcher or its runtime, doctor names a newer generation, or you see `RUNTIME_VERSION_ENDING` or `RUNTIME_VERSION_MISMATCH`: run `waitcher runtime upgrade` in the repository and repeat it until `stage` is `current` (`--to ID` targets another supported generation). Each call reports one stage with its `steps`; do them in order. In the `upgrade` stage, `changes[]` names what changed, the lines of this project it may affect (`matches`) and a `fix`, and `previews[]` shows how each hosted check did when Waitcher ran it on the target. Before `--yes` (it installs packages and Chromium) show the user `install.steps` and wait for agreement. Then fix the scripts, run `config validate --env NAME --verify`, show the diff for a commit, and in the `deploy` stage plan and apply each environment it lists. Checks made in the web app (no `waitcher.json`) move with `waitcher runtime move --id MONITOR_ID` once their preview passed. After a generation ends its checks that did not pass their preview are paused (`RUNTIME_ENDED`, `hosted[].paused` in the upgrade output) until the project upgrades and deploys. Never upgrade unasked: a supported generation is the user's choice.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets, agent checks, public status pages, team workspaces.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
63306
63327
 
63307
63328
  // ../../skills/waitcher/references/authoring.md
63308
- var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. For exact syntax run `waitcher help monitor` or `waitcher help run`. AI endpoints, agent outcome checks and model steps are in [ai-and-agents](ai-and-agents.md).\n\n## Choose the type\n\n- `http`: status, body text, a JSON value or latency of one request. No script.\n- `certificate`: TLS expiry and chain. No script.\n- `heartbeat`: a job reports start and success; Waitcher alerts when it does not.\n- `tcp`: a public `HOST:PORT` accepts connections (database, mail, SSH); optional `tcp.banner` the server must send first. No script.\n- `dns`: a name\'s `A`, `AAAA`, `CNAME`, `MX` or `TXT` records hold `dns.expected` (`match`: `includes` or `exact`), asked of public resolvers. In `waitcher.json` a `dns` entry without `target` checks the `baseUrl` host. Details: https://waitcher.dev/docs/network.md.\n- `mcp`: a remote MCP server (Streamable HTTP). Lists tools and checks `mcp.expectTools`; an optional `mcp.toolCall` calls one side-effect-free tool with fixed arguments and JSON-pointer `assertions` on its result. No script. `run local --file mcp.json` runs it without an account; its `mcp-report.json` lists the tool names and `mcp-tool-result.json` holds the called tool\'s answer, so read both before writing `expectTools` and assertions. Personal tool calls need verified `httpAuth` and a 30-minute interval; listing tools needs neither. Never pick a tool that writes data. Details: https://waitcher.dev/docs/mcp.md.\n- `api`: a script with several requests and an invariant between them.\n- `browser`: a script that walks a user journey in Chromium.\n- `visual`: a screenshot of one public page or element compared with a baseline the user approved. No script; see [optional capabilities](optional-capabilities.md#optional-visual-checks).\n\n`waitcher monitor init --type TYPE --file x.json` writes a paused example of every type; `api` and `browser` also write `x.e2e.ts`. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\n## Scripts in waitcher.json\n\nIn a repository, a script monitor is an entry with `entry` pointing at its test file; one test serves every environment because it reads the base URL at run time.\n\n```json\n{ "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 }\n```\n\nRun the entries of one environment locally, without an account:\n\n```sh\nwaitcher config validate --env production --verify\nwaitcher config validate --env production --verify --key checkout\n```\n\nExit 4 with `VERIFY_FAILED` names the failing assertion and the run directory to read. `run local --file` takes a single monitor manifest, not `waitcher.json`.\n\n## Browser journey\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n await app.screenshot("game");\n});\n```\n\n- `app.open(path)` resolves against the environment\'s base URL. Browser base URLs have no query or fragment; navigate to those URLs inside the script.\n- Find elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. Prefer these over CSS selectors.\n- The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods.\n- Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n## API script\n\n```ts\nimport { test, expect } from "e2e";\n\ntest("orders API keeps totals consistent", async () => {\n const target = new URL(process.env.TARGET_URL!);\n const response = await fetch(new URL("/api/orders?limit=1", target));\n expect(response.status).toBe(200);\n});\n```\n\nAPI scripts import `test, expect` from `e2e` and read `process.env.TARGET_URL`. Secrets reach them only as `CHECK_*` names listed in `settings.envNames` (see [deploy](deploy.md)). The test runs as trusted local code, not in a sandbox.\n\n## Standalone manifest\n\nWithout `waitcher.json`, a monitor is one JSON file. `monitor init --type browser --file monitor.json` writes it with `scriptFile` next to the test:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest; `monitor validate --file monitor.json` checks the actual contract. The platform receives one script per monitor, not the project directory. When the test imports shared helpers, run `monitor build --file monitors/checkout.json --project . --output build/checkout`: it needs installed `esbuild`, bundles code and JSON helpers, keeps only supported framework and Node imports, and writes `monitor.js`, `monitor.json` and `build.json` into a new directory. Unsupported dependencies and module-relative file access fail the build. Verify and apply the built `monitor.json`. The script limit is 50,000 characters and hosted dependencies are fixed.\n\n## Run locally and inspect evidence\n\nThe runtime project needs `e2e` and, for browser tests, `@e2e-dev/web` and Chromium, at the exact versions `waitcher runtime install` prints. `waitcher runtime install --file DIR/waitcher.json [--browser]` lists the npm install and Chromium download; run it with `--yes` once the user agrees. Chromium goes to the Playwright browser cache (`PLAYWRIGHT_BROWSERS_PATH` when set), not the runtime directory.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\nwaitcher run local --project /path/to/e2e-project --timeout 60\n```\n\n- `--project` runs an existing E2E project with its own config and imports; its `--output` must stay inside that project.\n- Runs are serial, never retried or replayed, and get a fresh directory under `.waitcher/runs/` (`--output DIR` chooses the parent). Traces are always requested; video is opt-in, and tests can override recording, so inspect the returned files.\n- On failure read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first, then `execution.log` and `report.json`. The `waitcher-*.mjs` files there are runtime support, not your test. Traces are Markdown, not Playwright ZIPs; there is no HAR option, and app logs hold selected console and request failures only.\n- Exit codes: 0 passed, 4 failed or error, 130 interrupted. After an interruption, inspect partial evidence before repeating a possibly completed action.\n- Fix test mistakes while preserving the user\'s assertions; never weaken an assertion just to get green.\n- Evidence can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded and are not hosted health evidence.\n\n## Apply one monitor through the API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution; applying does not run it. For an authorized single hosted run use `run start --id MONITOR_ID --wait`, then `run status`, `run trace --id RUN_ID` (steps, failed assertion, screenshots, fetch calls) and `artifact get` for evidence. Hosted scripts run under the server\'s execution policy and can differ from a local run.\n\nEdits are complete replacements: `monitor export`, change the file, then `monitor apply --file FILE --id ID --expected-revision N` with the revision from get or export. Use a stable `--request-key` to recover one uncertain create or run; never change the payload under that key or repeat a possibly executed action. Report the exact monitor and run IDs, local evidence path, observed outcome and any difference between local and hosted results.\n';
63329
+ var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. For exact syntax run `waitcher help monitor` or `waitcher help run`. AI endpoints, agent outcome checks and model steps are in [ai-and-agents](ai-and-agents.md).\n\n## Choose the type\n\n- `http`: status, body text, a JSON value or latency of one request. No script.\n- `certificate`: TLS expiry and chain. No script.\n- `heartbeat`: a job reports start and success; Waitcher alerts when it does not.\n- `tcp`: a public `HOST:PORT` accepts connections (database, mail, SSH); optional `tcp.banner` the server must send first. No script.\n- `dns`: a name\'s `A`, `AAAA`, `CNAME`, `MX` or `TXT` records hold `dns.expected` (`match`: `includes` or `exact`), asked of public resolvers. In `waitcher.json` a `dns` entry without `target` checks the `baseUrl` host. Details: https://waitcher.dev/docs/network.md.\n- `mcp`: a remote MCP server (Streamable HTTP). Lists tools and checks `mcp.expectTools`; an optional `mcp.toolCall` calls one side-effect-free tool with fixed arguments and JSON-pointer `assertions` on its result. No script. `run local --file mcp.json` runs it without an account; its `mcp-report.json` lists the tool names and `mcp-tool-result.json` holds the called tool\'s answer, so read both before writing `expectTools` and assertions. Personal tool calls need verified `httpAuth` and a 30-minute interval; listing tools needs neither. Never pick a tool that writes data. Details: https://waitcher.dev/docs/mcp.md.\n- `api`: a script with several requests and an invariant between them.\n- `browser`: a script that walks a user journey in Chromium.\n- `visual`: a screenshot of one public page or element compared with a baseline the user approved. No script; see [optional capabilities](optional-capabilities.md#optional-visual-checks).\n\n`waitcher monitor init --type TYPE --file x.json` writes a paused example of every type; `api` and `browser` also write `x.e2e.ts`. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\n## Scripts in waitcher.json\n\nIn a repository, a script monitor is an entry with `entry` pointing at its test file; one test serves every environment because it reads the base URL at run time.\n\n```json\n{ "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 }\n```\n\nRun the entries of one environment locally, without an account:\n\n```sh\nwaitcher config validate --env production --verify\nwaitcher config validate --env production --verify --key checkout\n```\n\nExit 4 with `VERIFY_FAILED` names the failing assertion and the run directory to read. `run local --file` takes a single monitor manifest, not `waitcher.json`.\n\n## Browser journey\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n await app.screenshot("game");\n});\n```\n\n- `app.open(path)` resolves against the environment\'s base URL. Browser base URLs have no query or fragment; navigate to those URLs inside the script.\n- Find elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. Prefer these over CSS selectors.\n- The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods.\n- Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n## API script\n\n```ts\nimport { test, expect } from "e2e";\n\ntest("orders API keeps totals consistent", async () => {\n const target = new URL(process.env.TARGET_URL!);\n const response = await fetch(new URL("/api/orders?limit=1", target));\n expect(response.status).toBe(200);\n});\n```\n\nAPI scripts import `test, expect` from `e2e` and read `process.env.TARGET_URL`. Secrets reach them only as `CHECK_*` names listed in `settings.envNames` (see [deploy](deploy.md)). The test runs as trusted local code, not in a sandbox.\n\n## Standalone manifest\n\nWithout `waitcher.json`, a monitor is one JSON file. `monitor init --type browser --file monitor.json` writes it with `scriptFile` next to the test:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest; `monitor validate --file monitor.json` checks the actual contract. The platform receives one script per monitor, not the project directory. When the test imports shared helpers, run `monitor build --file monitors/checkout.json --project . --output build/checkout`: it needs installed `esbuild`, bundles code and JSON helpers, keeps only supported framework and Node imports, and writes `monitor.js`, `monitor.json` and `build.json` into a new directory. Unsupported dependencies and module-relative file access fail the build. Verify and apply the built `monitor.json`. The script limit is 50,000 characters and hosted dependencies are fixed.\n\n## Run locally and inspect evidence\n\nThe runtime project needs `e2e` and, for browser tests, `@e2e-dev/web` and Chromium, at the exact versions `waitcher runtime install` prints. `waitcher runtime install --file DIR/waitcher.json [--browser]` lists the npm install and Chromium download; run it with `--yes` once the user agrees. Chromium goes to the Playwright browser cache (`PLAYWRIGHT_BROWSERS_PATH` when set), not the runtime directory.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\nwaitcher run local --project /path/to/e2e-project --timeout 60\n```\n\n- `--project` runs an existing E2E project with its own config and imports; its `--output` must stay inside that project.\n- Runs are serial, never retried or replayed, and get a fresh directory under `.waitcher/runs/` (`--output DIR` chooses the parent). Traces are always requested; video is opt-in, and tests can override recording, so inspect the returned files.\n- On failure read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first, then `execution.log` and `report.json`. The `waitcher-*.mjs` files there are runtime support, not your test. Traces are Markdown, not Playwright ZIPs; there is no HAR option, and app logs hold selected console and request failures only.\n- A `status: error` message such as `fetch failed: connect ECONNREFUSED 127.0.0.1:3000` means nothing answered at the target: start the app (or fix the URL) before changing the monitor.\n- Exit codes: 0 passed, 4 failed or error, 130 interrupted. After an interruption, inspect partial evidence before repeating a possibly completed action.\n- Fix test mistakes while preserving the user\'s assertions; never weaken an assertion just to get green.\n- Evidence can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded and are not hosted health evidence.\n\n## Apply one monitor through the API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution; applying does not run it. For an authorized single hosted run use `run start --id MONITOR_ID --wait`, then `run status`, `run trace --id RUN_ID` (steps, failed assertion, screenshots, fetch calls) and `artifact get` for evidence. Hosted scripts run under the server\'s execution policy and can differ from a local run.\n\nEdits are complete replacements: `monitor export`, change the file, then `monitor apply --file FILE --id ID --expected-revision N` with the revision from get or export. Use a stable `--request-key` to recover one uncertain create or run; never change the payload under that key or repeat a possibly executed action. Report the exact monitor and run IDs, local evidence path, observed outcome and any difference between local and hosted results.\n';
63309
63330
 
63310
63331
  // ../../skills/waitcher/references/ai-and-agents.md
63311
63332
  var ai_and_agents_default = "# AI endpoints, agent outcomes and model steps\n\nRead only when `waitcher system capabilities` reports the feature and the user needs it. Deterministic HTTP, API and browser monitors need none of this; see [authoring](authoring.md).\n\n## Agent outcome checks\n\nFor hosted scripts using `#waitcher/scenario`, first confirm `features.scenarioEvidence` through `system capabilities`, alongside script admission. Older servers may not provide this helper. Do not silently remove required scenario checks to make an unsupported run pass. Capability discovery is separate from native security, capacity and production release acceptance.\n\nFor an agent that changes application state, start with `monitor init --template agent-outcome --file outcome.json --target https://product.example/api/`. It creates a paused ordinary API script, with no model binding or paid-provider requirement. Adapt its fixed `agent/tasks` submission and `notes/{runId}` resource paths, disposable test namespace and exact expected fields. It submits one action, ignores claims of success and response-provided URLs, then independently reads the known resource at most three times. A fresh per-run random `id` and `correlationId` must both match, alongside the expected result. Action transport errors are never automatically retried. Cleanup runs in `finally` only after an independent read proves the resource belongs to this run; cleanup failures fail the test. If ownership or the action result is uncertain, it records cleanup as unverified and leaves state untouched. Reconcile possible late actions before repeating a mutating test. This pattern verifies the chosen outcome, not the agent's overall quality or the correctness of its explanation.\n\nThe starter uses the optional `#waitcher/scenario` helper with required submit/action, observe, verify and cleanup phases. `createScenario({id, phases})` returns `phase(id, callback)`, `assert(boolean)` and `incomplete(reason)`. Call signals only inside an active phase. Every scenario needs a required verify phase, and an executed verify phase must call `scenario.assert` at least once; an empty verification cannot establish pass. `assert(false)` records a business failure even if caught; ordinary callback exceptions and `incomplete(\"CLEANUP_UNVERIFIED\")` record coverage errors. Inspect `.e2e/waitcher-scenarios.json` in the private evidence: required phases that never ran or remain in flight also prevent a pass. Coverage error takes precedence while retaining failed verification facts. A false agent claim can therefore produce a failed verify phase and an overall error when cleanup remains uncertain. The helper does not automatically classify arbitrary E2E assertions or infer agent/tool traces. Use stable non-secret scenario/phase IDs, avoid raw response values in assertions, and do not use report labels as secret storage.\n\nUse the unchanged file with `monitor validate`, account-free `run local --file outcome.json --runtime YOUR_PINNED_RUNTIME`, and the existing API-script editor or `monitor apply --file outcome.json --dry-run`. Keep it paused after applying. Project authors can extract the script into `scriptFile`, keep helper imports and use `monitor build` to create one portable script; `#waitcher/scenario` stays external and is supplied by the manifest runner. The complete CLI includes `scenario-runtime.mjs`; keep package companions together. Standalone `--project` needs its own helper integration. The starter's default is credential-free. Optional local/trusted-administrator bearer tokens use `CHECK_AGENT_ACTION_TOKEN`, `CHECK_RESOURCE_READ_TOKEN` and `CHECK_RESOURCE_CLEANUP_TOKEN`, explicitly listed in `settings.envNames` and supplied outside the manifest. Hosted personal scripts receive `CHECK_*` values only from their project environment's secrets (`waitcher secret set`), never from the server's environment; do not work around that boundary. Do not log credentials or response bodies, and do not promise complete trace masking for arbitrary custom environment values. Local success does not establish hosted admission or isolation.\n\n## Scenario evidence\n\nInspect readable scenario evidence with `waitcher run scenarios --id RUN_ID`, or use `waitcher run scenarios --directory PRIVATE_RUN_DIR` for account-free local inspection without a server/runtime. Add `--json` for the exact shared report DTO. Do not combine selectors or pass `--server` for local inspection. Inspection of failed/error runs succeeds; execution exit codes remain unchanged. Keep authoritative run status separate from evidence availability: empty valid reports verify no business outcome, and pending/not-recorded/expired/invalid reports cannot establish a pass. Local evidence is checked against its recorded inventory and checksum; never edit it to manufacture a successful outcome.\n\n## AI product endpoints\n\nFor a single AI product endpoint, prefer a declarative `type: \"ai\"` fixture over an E2E script. Run `monitor init --type ai --target https://product.example/ai --file ai.json`, replace the sample request and response checks with the product contract, then `monitor validate --file ai.json`. JSON-pointer assertions support exact equality, type, existence and literal case-sensitive contains/not-contains/contains-any/contains-all checks; an optional bounded response schema checks structure. `run local --file ai.json` uses the same one-POST adapter without an account, model connection, provider key or E2E runtime. It only reaches public HTTPS endpoints and supports optional verified `httpAuth` references as described below; arbitrary custom headers and account-session inheritance are forbidden. Inspect the structured per-assertion report and distinguish transport coverage errors from product assertion failures. Applying the same file to hosted monitoring requires `features.aiEndpoints`; personal admission also requires a currently verified `httpAuth` binding; keep it paused unless scheduling is authorized. This verifies a chosen fixture, not general agent quality or a calibrated semantic judge.\n\nFor a small set of representative prompts against the same endpoint, use `aiEndpoint.adapter: \"json-http-suite-v1\"` and `cases` with 1\u20135 objects containing a stable unique `id`, readable `name`, positive `revision` (default 1), literal JSON-object `fixture`, and assertions and/or response schema. The suite `invocationBudget` equals its case count and is filled in when omitted. Validate offline and run the unchanged manifest locally before applying it; hosted capability `features.aiEndpointSuites` must be available. Cases run serially under one total monitor timeout. Assertion failures permit later cases; a transport/deadline error stops them as `not-run`. Inspect every case and coverage summary, not only the overall status. The controller reserves the full case count before any hosted request, and partial/uncertain runs retain that conservative allowance. Reported attempted requests can therefore be fewer than charged units. Deterministic suites do not provide semantic grading; do not describe text matching as semantic correctness. Single fixtures and each suite case can opt into literal variables with variables:{name:\"string\"} and exact {{name}} placeholders inside fixture string values. Without variables, braces remain literal. Use at most 16 names, ASCII letter followed by letters/digits/underscores (64 characters); prototype-related names are refused. Each value fits 4 KiB UTF-8, maps and rendered fixtures 16 KiB and complete configurations 64 KiB. No expressions, environment lookup, key/URL/assertion/rubric interpolation, matrix expansion or recursive replacement is supported. Missing/malformed placeholders reject before requests. Use non-secret data. Validate locally and preview before applying: exports keep authored maps while enqueue freezes rendered literal requests. Release comparisons use effective rendered bodies, so a changed variable value can be a changed policy even with the same case revision.\n\nFor optional semantic endpoint grading, use `json-http-graded-suite-v1`, portable schemaVersion 2 and explicit context (even the default project/environment). Set the top-level `judge` connectionId/configurationRevision/model/budget and add a rubric to each selected case: stable id/revision, criteria, outputPath, threshold and optional reference examples. Keep target credentials separate from judge keys. Hosted use requires `features.endpointJudges`; local use accepts the same private `--connections-file` map without an account, UI or E2E runtime. Only the selected output and rubric criteria/examples reach the judge. Known echoed managed product keys are refused before grading. Inspect score, verdict, rubric hash and private model-usage.json: malformed/unavailable/unknown/over-budget grading is inconclusive coverage and cannot pass or recover a product incident. There are no retries or fallback models. Every report currently marks calibration unverified; labelled reference examples do not prove accuracy. Keep calibration, pricing and release acceptance distinct from a controlled protocol pass.\n\nTo measure a rubric against labelled examples, use `monitor calibrate --id ID --file REQUEST_JSON` for a saved hosted monitor, then `monitor calibrations --id ID` or `monitor calibration --id ID --calibration-id ID` to inspect retained measurements. The request contains `caseId`, `dataset` and optional `repeats`. For account-free local measurement, use `run calibrate --file MONITOR --case-id CASE --dataset DATASET --connections-file PRIVATE_MAP`; `--dataset` is the dataset object alone. Use 2\u20134 fictional labelled outputs and 1\u20133 repeats, within the saved judge call/token budget and a total 30-second ceiling. Calibration calls only the judge, not the product endpoint, and creates no health runs, incidents or recovery. Keep known keys out of dataset/rubric identifiers, object keys and content as well as prompts. Inspect agreement over valid evaluated decisions, disagreement, repeat instability and technical coverage errors separately. A valid expected inconclusive can agree; a provider error cannot. Inspect private model usage for actual reservations. Exit 4 means disagreement, instability or coverage failure; never erase those results to obtain a green check. A small successful sample applies only to its exact dataset/rubric/model identity and does not establish general accuracy or automatically change the monitor\u2019s unverified calibration label.\n\nFor release regressions, use `project compare --id PROJECT_ID --deployment-id DEPLOYMENT_ID` and follow the opaque `next` cursor with `--before`. AI rows include case-level comparisons from frozen queued definitions and retained structured reports. Inspect each case classification and compatibility reasons. A different fixture, assertion, rubric, judge model or policy identity cannot establish a product regression; do not compare numeric scores across changed policies. Missing/invalid reports and unexecuted cases are coverage gaps. Follow the owned run references for evidence. Last passing and first failure are useful only for the matching case policy; a pass from another case or rubric is not a reproduction baseline. Display-name changes and JSON object key order do not change the evaluation policy. Comparison is read-only and never schedules another paid request.\n\n## AI steps in browser and API scripts\n\nFor personal AI-assisted browser journeys, require both `features.ai` and `features.isolatedAi` alongside script admission. Keep the `ai` model connection binding optional; deterministic scripts need no model or provider key. Hosted personal runs always use server-owned isolated policy and an explicitly model-capable isolated worker. An older worker, withdrawn capability or missing connection is a coverage failure, never a reason to switch accounts or execute through a trusted lane. Use the same version-2 manifest locally with a private connection map before applying it paused. Only attempt-scoped broker authority enters the disposable runtime; upstream keys stay controller-side. Screenshots, page content and prompts used by AI steps reach the selected provider. Inspect native assertions plus authoritative model usage/error evidence; catching an SDK error does not make a run healthy. No browser login-state import or stored application credentials are supported by this capability. API scripts have no built-in screen observation engine: do not call screen-based agent.assert/waitFor/extract on API data. In manifest mode, import {assertGrade, grade} from \"#waitcher/ai\" and pass {data: selectedJsonOrText, rubric: criteria, threshold: 0.8}. The optional judgeModel grades the selected data, otherwise model is used. Keep expected facts in versioned fixtures; send no credentials or unnecessary response fields. Selected JSON is limited to 8 KiB and rubric to 2 KiB. grade returns {verdict,score}; assertGrade throws on non-pass. Any failure, valid inconclusive or technical grading error remains authoritative even when caught or ignored. Inspect private waitcher-data-grades.json alongside model usage and the native report. No retries/fallbacks occur. The alias survives monitor build and is supplied by run local --file and hosted script execution; standalone --project needs its own integration. Deterministic scripts need no binding; fixed endpoint fixtures can use the declarative graded adapter instead.\n\nFor an existing project's custom model setup, use `--project`. A schemaVersion 2 manifest with an `ai` binding can also run unchanged locally using `--connections-file /private/connections.json`, without login. The private map has schemaVersion 1 and a connections array; each record contains id, configurationRevision, provider openrouter (the only provider for AI scripts; anthropic connections serve hosted agent checks only), projectId, environmentId, allowed models and credentialFile. Credential paths resolve relative to the map. IDs/revisions/models and explicit manifest scope must match. Keep both map and key files private (chmod 600); inline keys, provider URLs and symlinks are refused. The selected runtime also needs ai@7.0.177. The complete CLI package ships model-client.mjs and notices; copying only cli.mjs is insufficient for bound AI execution.\n\nThe local manifest runner keeps the provider key in its parent and passes a temporary loopback grant to the test. It uses the hosted transport and per-run budget/outcome rules, but no hosted account/day ledger. Read model-usage.json as well as the native report: caught provider/budget failures may leave a native passed test while Waitcher correctly records error. Unknown usage stays reserved, SDK retries count separately, and local success does not verify hosted enablement or key freshness. Provider keys are not forwarded to the child, and literal temporary broker tokens are redacted from normal text evidence; trusted local code can read its filesystem and is not a sandbox. Traces default on, video stays opt-in.\n\nIn the project's `e2e.config.ts`, construct the chosen provider's AI SDK model under `agents.default.model`, following the installed framework's types. The provider reads its local key; a key alone does not configure a model. Never copy a user's provider key into a monitor manifest or use an operator's account key.\n\nMix exact assertions with selected `agent.act`, `agent.assert`, `agent.waitFor` and schema-bound `agent.extract` calls. AI operations may transmit screen content to the provider and incur cost; preserve the user's provider/call authorization. Step-level `maxModelCalls` is not a whole-run spending limit. Hosted connection/broker/budget support is separate and must be discovered from actual capabilities rather than assumed from a local run.\n\n## Protected product requests\n\nFor protected product operations, use monitor init --template protected-agent-outcome --request-policy-file POLICY.json --project-id UUID --environment-id UUID --file monitor.json. The public policy contains connections with id, canonical HTTPS origin and httpAuth references (targetId, credentialId, credentialRevision); operations with id, connection, method, path, optional static body, responsePointers and maxCalls; and budget.calls. Paths are fixed absolute paths with at most one whole {resourceId} UUID segment. Static JSON bodies may use only exact string leaves {{resourceId}}. Callers cannot choose URLs, methods, headers, bodies, query parameters or UUIDs. GET permits at most three calls, POST and DELETE one; DELETE requires the UUID path and POST must use the run identity. Limits are four connections, eight operations and eight total calls.\n\nThe protected starter requires submit POST, observe GET (three reads), cleanup DELETE, a five-call budget and response pointers /id, /correlationId, /title, /completed. Configure the static submission body to create a note with the parent-generated UUID in both id and correlationId, title Waitcher outcome check, and completed true. The optional #waitcher/requests SDK exposes requestOperation and requestResourceId. Responses contain status and a data map keyed by configured JSON pointers. The script never trusts the agent reply as proof of resulting state, never retries the action, and only cleans up independently proven run-owned state.\n\nLocal execution uses the existing --http-credentials-file private map: schemaVersion 1 and credentials entries with targetId, credentialId, credentialRevision, origin, header and credentialFile. Header is the credential header name (for example Authorization or X-Api-Key); its raw value stays in a separate private regular file. Map and key files require mode600 and exact reference/revision/origin matches. Keys stay in the CLI parent, never script, manifest, CLI arguments or custom environment. No account, app or AI provider is required locally. Keep request-runtime.mjs with the complete CLI package. For source projects use scriptFile, monitor build, then run local --file; standalone project mode does not inject the protected helper. Hosted use requires explicit capability and isolated execution even for administrators. Combined AI or browser-state bindings need their independent authority. Inspect request-usage.json, scenario and native reports. Caught budget errors, uncertain dispatch and unfinished calls cannot establish a healthy result; never replay mutations automatically.\n\nScenario request associations are optional recorded evidence. The request helper automatically records each issued request UUID on its originating phase. In a verify phase, call `scenario.referenceRequest(response.requestId)` for a request from an earlier completed observe phase in the same scenario; use the validated response envelope UUID, never an ID from response data. The protected starter references its last independent observation before asserting the business state. Read associations with `run scenarios`; `run diagnose` joins them to this run's request records and labels each ID `matched`, `not-found` or `unavailable`. These are script-reported phase associations. A matching controller row proves accounting correspondence, not the correctness of a phase or business outcome. Local matches remain local helper reports. Older evidence without association fields is not recorded, rather than an empty verified list. UNKNOWN requests remain charged and incomplete; no association authorizes mutation replay.\n";
63312
63333
 
63313
63334
  // ../../skills/waitcher/references/deploy.md
63314
- var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e`, `@e2e-dev/web` (browser) and `esbuild` installed at the exact versions `waitcher runtime install` prints; `waitcher runtime install` sets them up and keeps the project\'s generation (ask before `--yes`); `waitcher runtime upgrade` moves the project and, through its deploys, its checks to another generation (see Runtime upgrades in the skill, [runtime updates](https://waitcher.dev/docs/runtime)). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\nListed values of at least 6 characters appear as `<secret:CHECK_NAME>` in reports, traces and logs; screenshots, video and transformed values are not masked. For a password or token typed into a page, prefer `fill(secrets.get("CHECK_NAME"))` (`import { secrets } from "e2e"`) over `process.env`: the value stays out of the test code and the run refuses `app.screenshot()` after that fill, so take screenshots before it or drop them. Read `process.env.CHECK_NAME` for values the script sends itself, such as API headers. Never log a value or assert on it.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Signed in with a project token, read `authorization.projectName` from `waitcher auth status` and use it as `waitcher.json`\'s `project` (`config init --project-name NAME`); such a token changes monitors only through `deploy apply`, so do not try `monitor apply`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
63335
+ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e`, `@e2e-dev/web` (browser) and `esbuild` installed at the exact versions `waitcher runtime install` prints; `waitcher runtime install` sets them up and keeps the project\'s generation (ask before `--yes`); `waitcher runtime upgrade` moves the project and, through its deploys, its checks to another generation (see Runtime upgrades in the skill, [runtime updates](https://waitcher.dev/docs/runtime)). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nIn Windows PowerShell pipe the same way: `$env:VALUE | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin` (the trailing newline is dropped).\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so set the same `CHECK_*` variables in the shell (bash: `export CHECK_NAME=...`, PowerShell: `$env:CHECK_NAME = "..."`, CMD: `set CHECK_NAME=...`; never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\nListed values of at least 6 characters appear as `<secret:CHECK_NAME>` in reports, traces and logs; screenshots, video and transformed values are not masked. For a password or token typed into a page, prefer `fill(secrets.get("CHECK_NAME"))` (`import { secrets } from "e2e"`) over `process.env`: the value stays out of the test code and the run refuses `app.screenshot()` after that fill, so take screenshots before it or drop them. Read `process.env.CHECK_NAME` for values the script sends itself, such as API headers. Never log a value or assert on it.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Signed in with a project token, read `authorization.projectName` from `waitcher auth status` and use it as `waitcher.json`\'s `project` (`config init --project-name NAME`); such a token changes monitors only through `deploy apply`, so do not try `monitor apply`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
63315
63336
 
63316
63337
  // ../../skills/waitcher/references/diagnosis.md
63317
63338
  var diagnosis_default = '# Diagnosing failures\n\nRead when a local, smoke or scheduled run failed or errored.\n\nFor "since when" or "how often" questions, `waitcher monitor history --id ID` gives 13 months of daily runs, failures, availability and p50/p95 for one monitor, and `waitcher report history` sums the account by month and monitor; individual runs and evidence only go back as far as the plan keeps them.\n\n## Diagnose and reproduce a retained run\n\nConfirm `features.runDiagnosis` for hosted support. Use `run diagnose --id RUN_ID` for a readable hosted packet, or add `--json` for the shared structured report. Use `run diagnose --directory PRIVATE_RUN_DIRECTORY` without an account to inspect indexed local evidence. Hosted request states come from the controller ledger; local helper observations are explicitly local and do not attest hosted accounting. A known response does not prove task success, and an unknown action may have taken effect. Do not automatically repeat a mutation because its result is unknown.\n\nA historical pass is useful only when the frozen verification policy matches. Changed scripts, targets, deadlines or protected-operation policies cannot supply a matching reference. History searches are bounded; unavailable or truncated history is not proof that the product never passed. Stored artifact checksums are metadata; inspect the actual artifact when needed. Scenario evidence is checked against its recorded checksum before display.\n\nFor a completed supported hosted script, `run reproduce --id RUN_ID --output NEW_DIRECTORY` prepares its frozen configuration in a new private folder. It never executes the test or retrieves the current edited monitor. Inspect `monitor.json` and `provenance.json`, then deliberately run `run local --file NEW_DIRECTORY/monitor.json --output FRESH_RUN_DIRECTORY` with the matching installed runtime, optionally `--runtime PROJECT`. Reproduction is a fresh run with separate provenance and does not replace the original evidence.\n\nManaged product credentials, AI keys and browser sessions are not exported. Supply existing private local mappings with `--http-credentials-file`, `--connections-file` and `--browser-identities-file` where required. Authored scripts and literal configuration can themselves be sensitive, so keep the reproduction private. Operator-injected headers, bodies or environment state make this initial portable preparation unavailable rather than silently changing the test. Older local runs without an indexed frozen manifest remain inspectable but cannot establish a captured reproduction policy.\n';
@@ -63325,7 +63346,7 @@ var openai_default = 'interface:\n display_name: "Waitcher"\n short_descriptio
63325
63346
  // src/skill.ts
63326
63347
  import { lstat as lstat9, mkdir as mkdir8, readFile as readFile9, rm as rm6, writeFile as writeFile9 } from "node:fs/promises";
63327
63348
  import { homedir } from "node:os";
63328
- import { join as join14, resolve as resolve14 } from "node:path";
63349
+ import { join as join14, resolve as resolve15 } from "node:path";
63329
63350
  var references = {
63330
63351
  "authoring.md": authoring_default,
63331
63352
  "ai-and-agents.md": ai_and_agents_default,
@@ -63337,46 +63358,63 @@ var bundledSkill = { name: "waitcher", content: SKILL_default, references };
63337
63358
  var MARKER = ".waitcher-skill.json";
63338
63359
  var SkillInstallError = class extends Error {
63339
63360
  };
63340
- async function installSkill(options) {
63341
- const parent = resolve14(
63342
- options.path ?? (options.global ? join14(homedir(), ".claude", "skills") : join14(process.cwd(), ".claude", "skills"))
63343
- );
63344
- const directory = join14(parent, "waitcher");
63361
+ function skillParents(options) {
63362
+ if (options.path) return [resolve15(options.path)];
63363
+ if (options.global)
63364
+ return [
63365
+ join14(homedir(), ".claude", "skills"),
63366
+ join14(homedir(), ".agents", "skills")
63367
+ ];
63368
+ return [
63369
+ join14(process.cwd(), ".claude", "skills"),
63370
+ join14(process.cwd(), ".agents", "skills")
63371
+ ];
63372
+ }
63373
+ async function previous(directory) {
63345
63374
  const existing = await lstat9(directory).catch(() => null);
63346
- let previousVersion = null;
63347
- if (existing) {
63348
- const marker2 = existing.isDirectory() ? await readFile9(join14(directory, MARKER), "utf8").catch(() => null) : null;
63349
- if (marker2 === null)
63350
- throw new SkillInstallError(
63351
- `${directory} exists and was not installed by waitcher. Remove it or choose another --path.`
63352
- );
63353
- previousVersion = String(JSON.parse(marker2).version ?? "unknown");
63354
- for (const owned of ["SKILL.md", "references", "agents", MARKER])
63355
- await rm6(join14(directory, owned), { recursive: true, force: true });
63356
- }
63357
- await mkdir8(join14(directory, "references"), { recursive: true });
63358
- await mkdir8(join14(directory, "agents"), { recursive: true });
63359
- await writeFile9(join14(directory, "SKILL.md"), SKILL_default);
63360
- for (const [name5, text4] of Object.entries(references))
63361
- await writeFile9(join14(directory, "references", name5), text4);
63362
- await writeFile9(join14(directory, "agents/openai.yaml"), openai_default);
63363
- await writeFile9(
63364
- join14(directory, MARKER),
63365
- JSON.stringify({ name: "waitcher", version: options.version }) + "\n"
63366
- );
63375
+ if (!existing) return null;
63376
+ const marker2 = existing.isDirectory() ? await readFile9(join14(directory, MARKER), "utf8").catch(() => null) : null;
63377
+ if (marker2 === null)
63378
+ throw new SkillInstallError(
63379
+ `${directory} exists and was not installed by waitcher. Remove it or choose another --path.`
63380
+ );
63381
+ return String(JSON.parse(marker2).version ?? "unknown");
63382
+ }
63383
+ async function installSkill(options) {
63384
+ const directories = skillParents(options).map((parent) => join14(parent, "waitcher"));
63385
+ const versions = [];
63386
+ for (const directory of directories) versions.push(await previous(directory));
63387
+ for (const [i, directory] of directories.entries()) {
63388
+ if (versions[i] !== null)
63389
+ for (const owned of ["SKILL.md", "references", "agents", MARKER])
63390
+ await rm6(join14(directory, owned), { recursive: true, force: true });
63391
+ await mkdir8(join14(directory, "references"), { recursive: true });
63392
+ await mkdir8(join14(directory, "agents"), { recursive: true });
63393
+ await writeFile9(join14(directory, "SKILL.md"), SKILL_default);
63394
+ for (const [name5, text4] of Object.entries(references))
63395
+ await writeFile9(join14(directory, "references", name5), text4);
63396
+ await writeFile9(join14(directory, "agents/openai.yaml"), openai_default);
63397
+ await writeFile9(
63398
+ join14(directory, MARKER),
63399
+ JSON.stringify({ name: "waitcher", version: options.version }) + "\n"
63400
+ );
63401
+ }
63402
+ const previousVersion = versions.find((version2) => version2 !== null);
63367
63403
  return {
63368
- event: previousVersion === null ? "skill_installed" : "skill_updated",
63404
+ event: versions.every((version2) => version2 !== null) ? "skill_updated" : "skill_installed",
63369
63405
  name: "waitcher",
63370
63406
  version: options.version,
63371
- ...previousVersion === null ? {} : { previousVersion },
63372
- directory,
63407
+ ...previousVersion ? { previousVersion } : {},
63408
+ // directory: the first, as before; directories: every one written.
63409
+ directory: directories[0],
63410
+ directories,
63373
63411
  files: [
63374
63412
  "SKILL.md",
63375
63413
  ...Object.keys(references).map((n) => `references/${n}`),
63376
63414
  "agents/openai.yaml"
63377
63415
  ],
63378
63416
  next: options.path || options.global ? ["Run waitcher skill install again after upgrading the CLI."] : [
63379
- `Commit ${join14(".claude", "skills", "waitcher")} so every agent working in this repository finds it.`,
63417
+ `Commit ${join14(".claude", "skills", "waitcher")} (Claude Code, Copilot) and ${join14(".agents", "skills", "waitcher")} (Codex) so every agent working in this repository finds the skill.`,
63380
63418
  "Run waitcher skill install again after upgrading the CLI."
63381
63419
  ]
63382
63420
  };
@@ -63472,6 +63510,8 @@ async function doctor(options) {
63472
63510
  join15(root, ".claude", "skills", "waitcher"),
63473
63511
  join15(homedir2(), ".claude", "skills", "waitcher"),
63474
63512
  join15(root, ".agents", "skills", "waitcher"),
63513
+ join15(homedir2(), ".agents", "skills", "waitcher"),
63514
+ // Older Codex releases read $CODEX_HOME/skills.
63475
63515
  join15(process.env.CODEX_HOME ?? join15(homedir2(), ".codex"), "skills", "waitcher"),
63476
63516
  ...folders.slice(1).flatMap((dir) => [
63477
63517
  join15(dir, ".claude", "skills", "waitcher"),
@@ -63485,20 +63525,24 @@ async function doctor(options) {
63485
63525
  const marker2 = await readFile10(join15(home, ".waitcher-skill.json"), "utf8").then((text4) => JSON.parse(text4)).catch(() => null);
63486
63526
  if (marker2 && marker2.version !== options.version) stale.push(home);
63487
63527
  }
63488
- const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join15(root, ".claude", "skills")}`;
63528
+ const install = root === process.cwd() ? ["waitcher skill install"] : [".claude", ".agents"].map((agent) => `waitcher skill install --path ${join15(root, agent, "skills")}`);
63489
63529
  add(
63490
63530
  !installed.length ? {
63491
63531
  id: "skill",
63492
63532
  status: "warning",
63493
63533
  message: "The waitcher agent skill is not installed where common agents look",
63494
- next: [install]
63534
+ next: install
63495
63535
  } : stale.length ? {
63496
63536
  id: "skill",
63497
63537
  status: "warning",
63498
63538
  message: `Agent skill at ${stale.join(", ")} comes from another CLI version than ${options.version}`,
63499
- next: stale.map(
63500
- (home) => home === skillHomes[0] ? install : home === skillHomes[1] ? "waitcher skill install --global" : `waitcher skill install --path ${dirname14(home)}`
63501
- )
63539
+ next: [
63540
+ ...new Set(
63541
+ stale.map(
63542
+ (home) => root === process.cwd() && (home === skillHomes[0] || home === skillHomes[2]) ? "waitcher skill install" : home === skillHomes[1] || home === skillHomes[3] ? "waitcher skill install --global" : `waitcher skill install --path ${dirname14(home)}`
63543
+ )
63544
+ )
63545
+ ]
63502
63546
  } : { id: "skill", status: "ok", message: `Agent skill at ${installed.join(", ")}` }
63503
63547
  );
63504
63548
  const api = await options.session().catch(() => null);
@@ -63605,7 +63649,7 @@ function olderVersion(a, b) {
63605
63649
  // src/ci.ts
63606
63650
  import { execFile as execFile2 } from "node:child_process";
63607
63651
  import { mkdir as mkdir9 } from "node:fs/promises";
63608
- import { dirname as dirname15, relative as relative4, resolve as resolve15 } from "node:path";
63652
+ import { dirname as dirname15, relative as relative4, resolve as resolve16 } from "node:path";
63609
63653
  import { promisify as promisify2 } from "node:util";
63610
63654
  async function defaultBranch(cwd) {
63611
63655
  try {
@@ -63621,7 +63665,7 @@ async function defaultBranch(cwd) {
63621
63665
  }
63622
63666
  async function initWorkflow(options) {
63623
63667
  const root = process.cwd();
63624
- const output2 = resolve15(options.output ?? ".github/workflows/waitcher.yml");
63668
+ const output2 = resolve16(options.output ?? ".github/workflows/waitcher.yml");
63625
63669
  const config2 = relative4(root, options.config) || "waitcher.json";
63626
63670
  if (config2.startsWith(".."))
63627
63671
  throw new Error("Run ci init from the repository root that contains waitcher.json.");
@@ -63694,7 +63738,7 @@ jobs:
63694
63738
 
63695
63739
  // src/main.ts
63696
63740
  import { readFile as readFile12, open as open18, lstat as lstat12, unlink as unlink5 } from "node:fs/promises";
63697
- import { basename as basename3, dirname as dirname18, join as join17, resolve as resolve17 } from "node:path";
63741
+ import { basename as basename3, dirname as dirname18, join as join17, resolve as resolve18 } from "node:path";
63698
63742
  import { constants as constants13 } from "node:fs";
63699
63743
 
63700
63744
  // ../../src/contracts/account-deletion.ts
@@ -63968,7 +64012,7 @@ var incidentEditSchema = external_exports.object({
63968
64012
 
63969
64013
  // src/access.ts
63970
64014
  import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
63971
- import { dirname as dirname16, resolve as resolve16 } from "node:path";
64015
+ import { dirname as dirname16, resolve as resolve17 } from "node:path";
63972
64016
  function accessTokenInput(text4) {
63973
64017
  let token = text4.trim();
63974
64018
  if (token.startsWith("{")) {
@@ -63993,7 +64037,7 @@ async function issueToFile(path2, issue3) {
63993
64037
  "VALIDATION_ERROR",
63994
64038
  2
63995
64039
  );
63996
- const file2 = resolve16(path2), directory = await lstat10(dirname16(file2));
64040
+ const file2 = resolve17(path2), directory = await lstat10(dirname16(file2));
63997
64041
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
63998
64042
  throw new ServiceError(
63999
64043
  "Token output requires an existing private directory (chmod 700).",
@@ -64249,26 +64293,26 @@ async function post(config2, endpoint, fields, signal) {
64249
64293
  );
64250
64294
  return data;
64251
64295
  }
64252
- function tokenSession(config2, data, previous) {
64253
- if (typeof data?.token_type !== "string" || data.token_type.toLowerCase() !== "bearer" || typeof data.access_token !== "string" || !data.access_token || typeof (data.refresh_token ?? previous) !== "string" || !(data.refresh_token ?? previous) || typeof data.expires_in !== "number" || !Number.isFinite(data.expires_in) || data.expires_in <= 0 || data.expires_in > 172800)
64296
+ function tokenSession(config2, data, previous2) {
64297
+ if (typeof data?.token_type !== "string" || data.token_type.toLowerCase() !== "bearer" || typeof data.access_token !== "string" || !data.access_token || typeof (data.refresh_token ?? previous2) !== "string" || !(data.refresh_token ?? previous2) || typeof data.expires_in !== "number" || !Number.isFinite(data.expires_in) || data.expires_in <= 0 || data.expires_in > 172800)
64254
64298
  throw fail("Clerk returned an invalid token response.");
64255
64299
  return {
64256
64300
  ...config2,
64257
64301
  accessToken: data.access_token,
64258
- refreshToken: data.refresh_token ?? previous,
64302
+ refreshToken: data.refresh_token ?? previous2,
64259
64303
  expiresAt: Date.now() + data.expires_in * 1e3
64260
64304
  };
64261
64305
  }
64262
64306
  async function openBrowser(url3) {
64263
64307
  const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32" : "xdg-open";
64264
64308
  const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url3] : [url3];
64265
- await new Promise((resolve18, reject) => {
64309
+ await new Promise((resolve19, reject) => {
64266
64310
  const child2 = spawn3(command, args, { stdio: "ignore", shell: false });
64267
64311
  child2.unref();
64268
64312
  child2.once("error", reject);
64269
64313
  child2.once(
64270
64314
  "exit",
64271
- (code) => code === 0 ? resolve18() : reject(new Error("Browser unavailable"))
64315
+ (code) => code === 0 ? resolve19() : reject(new Error("Browser unavailable"))
64272
64316
  );
64273
64317
  });
64274
64318
  }
@@ -64286,8 +64330,8 @@ ${url3}
64286
64330
  const verifier = randomBytes3(32).toString("base64url");
64287
64331
  let redirect = "";
64288
64332
  let finish;
64289
- const callback = new Promise((resolve18, reject) => {
64290
- finish = { resolve: resolve18, reject };
64333
+ const callback = new Promise((resolve19, reject) => {
64334
+ finish = { resolve: resolve19, reject };
64291
64335
  });
64292
64336
  callback.catch(() => {
64293
64337
  });
@@ -64329,9 +64373,9 @@ ${url3}
64329
64373
  let timer;
64330
64374
  const cancel = () => finish.reject(fail("Sign-in was canceled."));
64331
64375
  try {
64332
- await new Promise((resolve18, reject) => {
64376
+ await new Promise((resolve19, reject) => {
64333
64377
  listener.once("error", reject);
64334
- listener.listen(0, "127.0.0.1", resolve18);
64378
+ listener.listen(0, "127.0.0.1", resolve19);
64335
64379
  });
64336
64380
  redirect = `http://127.0.0.1:${listener.address().port}/callback`;
64337
64381
  timer = setTimeout(
@@ -64376,7 +64420,7 @@ ${url3}
64376
64420
  clearTimeout(timer);
64377
64421
  signal?.removeEventListener("abort", cancel);
64378
64422
  listener.closeAllConnections();
64379
- await new Promise((resolve18) => listener.close(() => resolve18()));
64423
+ await new Promise((resolve19) => listener.close(() => resolve19()));
64380
64424
  }
64381
64425
  }
64382
64426
  async function refreshOAuth(server, session, signal) {
@@ -64415,7 +64459,7 @@ async function revokeOAuth(session, signal) {
64415
64459
  var help = `Waitcher CLI
64416
64460
 
64417
64461
  Usage: waitcher <group> <command> [options]
64418
- Commands print JSON on stdout and errors as {error:{code,message}} on stderr;
64462
+ Commands print JSON on stdout and errors as {error:{code,message,next?}} on stderr;
64419
64463
  run diagnose and run scenarios print a readable report unless --json. Help and version work offline.
64420
64464
  waitcher help TOPIC (or waitcher GROUP --help) prints only matching sections, e.g. help deploy.
64421
64465
  waitcher help all prints everything; waitcher --help prints an overview.
@@ -64423,9 +64467,10 @@ waitcher help all prints everything; waitcher --help prints an overview.
64423
64467
  Agent skill
64424
64468
  skill show Read the bundled skill and its references as JSON
64425
64469
  skill install [--global | --path SKILLS_DIR]
64426
- Install or update the skill in .claude/skills/waitcher
64427
- (this project; --global: ~/.claude/skills). Codex and other
64428
- agents reading .agents/skills: --path .agents/skills. Rerun
64470
+ Install or update the skill for Claude Code and Codex in
64471
+ .claude/skills/waitcher and .agents/skills/waitcher (this
64472
+ project; --global: ~/.claude/skills and ~/.agents/skills;
64473
+ --path: only SKILLS_DIR). Rerun
64429
64474
  after upgrading the CLI; never replaces a skill it did not write
64430
64475
 
64431
64476
  Heartbeats
@@ -64532,6 +64577,9 @@ Capabilities
64532
64577
  system capabilities Show account features, limits and contract versions
64533
64578
  system diagnostics Operator resource, queue and storage diagnostics
64534
64579
  system plans Administrator: plan profiles and accounts not on starter
64580
+ system accounts [--plan pilot] [--json]
64581
+ Administrator: every account's plan, monitors, runs and
64582
+ last activity; a table, or JSON with --json
64535
64583
  system plan --owner clerk:USER_ID|team:ID --plan starter|pilot|pro|business|team
64536
64584
  Administrator: assign a plan; takes effect immediately
64537
64585
  system suspensions Administrator: accounts whose checks are suspended
@@ -65055,14 +65103,50 @@ ${exitCodes}
65055
65103
  `;
65056
65104
  }
65057
65105
 
65106
+ // src/system-accounts.ts
65107
+ var date5 = (at) => at == null ? "-" : new Date(at).toISOString().slice(0, 10);
65108
+ var time3 = (at) => at == null ? "-" : new Date(at).toISOString().slice(0, 16).replace("T", " ");
65109
+ function formatSystemAccounts(result2) {
65110
+ const s = result2.summary;
65111
+ const head = [
65112
+ `Accounts ${s.accounts}, pilot ${s.pilot}, with an active monitor ${s.active}, script runs in 24 h ${s.scriptRuns24h}, still running after 30 days ${s.retained30d}`
65113
+ ];
65114
+ if (!result2.accounts.length) return head.concat("No accounts match.", "").join("\n");
65115
+ const rows = [
65116
+ ["OWNER", "PLAN", "FIRST SEEN", "MONITORS", "SCRIPTS 24H/7D", "OK 7D", "LAST RUN (UTC)", "DEPLOY", "OPEN", "TARGETS"],
65117
+ ...result2.accounts.map((a) => [
65118
+ a.owner,
65119
+ `${a.plan} (${a.planSource})${a.suspended ? " SUSPENDED" : ""}`,
65120
+ date5(a.firstSeenAt),
65121
+ `${a.monitors.active} on / ${a.monitors.total}`,
65122
+ `${a.runs.scripts24h}/${a.runs.scripts7d}`,
65123
+ a.runs.successRate7d == null ? "-" : `${a.runs.successRate7d}%`,
65124
+ time3(a.runs.lastRunAt),
65125
+ date5(a.lastDeployAt),
65126
+ String(a.openIncidents),
65127
+ a.targets.length ? a.targets[0] + (a.targets.length > 1 ? ` +${a.targets.length - 1}` : "") : "-"
65128
+ ])
65129
+ ];
65130
+ const widths = rows[0].map((_, i) => Math.max(...rows.map((r) => r[i].length)));
65131
+ return head.concat(
65132
+ "",
65133
+ ...rows.map(
65134
+ (r) => r.map((cell, i) => i === r.length - 1 ? cell : cell.padEnd(widths[i])).join(" ")
65135
+ ),
65136
+ ""
65137
+ ).join("\n");
65138
+ }
65139
+
65058
65140
  // src/main.ts
65059
65141
  var list = (text4) => (text4 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
65060
65142
  var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
65061
65143
  var controller = new AbortController();
65062
65144
  process.once("SIGINT", () => controller.abort());
65063
65145
  process.once("SIGTERM", () => controller.abort());
65064
- function usage2(message) {
65065
- throw new ServiceError(message, "USAGE_ERROR", 2);
65146
+ function usage2(message, next) {
65147
+ const error62 = new ServiceError(message, "USAGE_ERROR", 2);
65148
+ if (next) error62.next = next;
65149
+ throw error62;
65066
65150
  }
65067
65151
  function id3(value2) {
65068
65152
  if (typeof value2 !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9-]{0,99}$/.test(value2))
@@ -65443,6 +65527,7 @@ async function main() {
65443
65527
  "system capabilities": [],
65444
65528
  "system diagnostics": [],
65445
65529
  "system plans": [],
65530
+ "system accounts": ["plan"],
65446
65531
  "system plan": ["owner", "plan"],
65447
65532
  "system suspensions": [],
65448
65533
  "system suspend": ["owner", "reason"],
@@ -65593,10 +65678,16 @@ async function main() {
65593
65678
  if (command === "config init") {
65594
65679
  if (v.server) usage2("config init works locally; omit --server.");
65595
65680
  if (v.target) {
65596
- try {
65597
- if (new URL(v.target).protocol !== "https:") throw Error();
65598
- } catch {
65599
- usage2("--target must be the HTTPS base URL of the production site.");
65681
+ const url3 = URL.parse(v.target);
65682
+ if (url3?.protocol !== "https:") {
65683
+ const local = url3 && (url3.protocol === "http:" || ["localhost", "127.0.0.1", "[::1]", "0.0.0.0"].includes(url3.hostname) || url3.hostname.endsWith(".localhost"));
65684
+ usage2(
65685
+ local ? "--target must be the HTTPS base URL of the production site. To try a local app first, write one monitor file and run it locally." : "--target must be the HTTPS base URL of the production site.",
65686
+ local ? [
65687
+ `waitcher monitor init --type http --file website.monitor.json --target ${url3.href}`,
65688
+ "waitcher run local --file website.monitor.json"
65689
+ ] : void 0
65690
+ );
65600
65691
  }
65601
65692
  }
65602
65693
  const file2 = configPath(v.file);
@@ -66438,7 +66529,7 @@ async function main() {
66438
66529
  usage2(
66439
66530
  "Provide --output with a new private receipt file before confirming deletion."
66440
66531
  );
66441
- const file2 = resolve17(v.output), directory = await lstat12(dirname18(file2));
66532
+ const file2 = resolve18(v.output), directory = await lstat12(dirname18(file2));
66442
66533
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
66443
66534
  usage2(
66444
66535
  "Receipt output needs an existing private directory (chmod 700)."
@@ -66572,7 +66663,7 @@ async function main() {
66572
66663
  else if (command === "account export") {
66573
66664
  if (!v.file) usage2("Provide --file with a new private tar output path.");
66574
66665
  const seconds = integer2(v.timeout ?? "90", "timeout", 1, 180);
66575
- const destination = resolve17(v.file);
66666
+ const destination = resolve18(v.file);
66576
66667
  const directory = await lstat12(dirname18(destination));
66577
66668
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
66578
66669
  usage2(
@@ -67414,7 +67505,17 @@ async function main() {
67414
67505
  } else if (command === "system diagnostics")
67415
67506
  result2 = await api("system/diagnostics");
67416
67507
  else if (command === "system plans") result2 = await api("system/plans");
67417
- else if (command === "system suspensions")
67508
+ else if (command === "system accounts") {
67509
+ const plan = v.plan === void 0 ? "" : String(v.plan);
67510
+ if (plan && !/^[a-z]{1,32}$/.test(plan)) usage2("--plan must be a plan name");
67511
+ result2 = await api(
67512
+ `system/accounts${plan ? `?plan=${encodeURIComponent(plan)}` : ""}`
67513
+ );
67514
+ if (!v.json) {
67515
+ process.stdout.write(formatSystemAccounts(result2));
67516
+ return;
67517
+ }
67518
+ } else if (command === "system suspensions")
67418
67519
  result2 = await api("system/suspensions");
67419
67520
  else if (command === "account billing") result2 = await api("billing");
67420
67521
  else if (command === "account upgrade" || command === "account billing-portal") {
@@ -67851,7 +67952,8 @@ try {
67851
67952
  ...error62.fields ? { fields: error62.fields } : {},
67852
67953
  ...error62.requestId ? { requestId: error62.requestId } : {},
67853
67954
  code: interrupted ? "INTERRUPTED" : error62.code === "ENOENT" ? "FILE_NOT_FOUND" : error62 instanceof ServiceError ? error62.code : "LOCAL_ERROR",
67854
- message: interrupted ? "Interrupted. Submitted work may still run on the server." : error62.message
67955
+ message: interrupted ? "Interrupted. Submitted work may still run on the server." : error62.message,
67956
+ ...!interrupted && error62 instanceof ServiceError && error62.next ? { next: error62.next } : {}
67855
67957
  }
67856
67958
  }) + "\n"
67857
67959
  );