@waitcher/cli 0.2.32 → 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.
- package/README.md +1 -1
- package/dist/cli.mjs +426 -310
- package/dist/model-client.mjs +6 -0
- 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((
|
|
5878
|
+
return new Promise((resolve19, reject) => {
|
|
5879
5879
|
this.close((err, data) => {
|
|
5880
|
-
return err ? reject(err) :
|
|
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((
|
|
5918
|
+
return new Promise((resolve19, reject) => {
|
|
5919
5919
|
this.destroy(err, (err2, data) => {
|
|
5920
|
-
return err2 ? reject(err2) :
|
|
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((
|
|
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 =
|
|
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((
|
|
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 =
|
|
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((
|
|
13215
|
+
return new Promise((resolve19) => {
|
|
13216
13216
|
if (this[kSize]) {
|
|
13217
|
-
this[kClosedResolve] =
|
|
13217
|
+
this[kClosedResolve] = resolve19;
|
|
13218
13218
|
} else {
|
|
13219
|
-
|
|
13219
|
+
resolve19(null);
|
|
13220
13220
|
}
|
|
13221
13221
|
});
|
|
13222
13222
|
}
|
|
13223
13223
|
[kDestroy](err) {
|
|
13224
|
-
return new Promise((
|
|
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
|
-
|
|
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((
|
|
13715
|
-
this[kClosedResolve] =
|
|
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((
|
|
13785
|
-
resolveClosed =
|
|
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
|
|
14952
|
-
throw new Socks5ProxyError(`SOCKS5 connection failed: ${
|
|
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
|
|
15571
|
+
const previous2 = headersPair[key];
|
|
15572
15572
|
const values = [];
|
|
15573
|
-
if (
|
|
15574
|
-
values.push(...Array.isArray(
|
|
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((
|
|
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
|
-
|
|
16604
|
+
resolve19(null);
|
|
16605
16605
|
}
|
|
16606
16606
|
});
|
|
16607
16607
|
} else {
|
|
16608
|
-
this.on("close",
|
|
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((
|
|
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:
|
|
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:
|
|
16729
|
+
const { type, body: body2, resolve: resolve19, stream, length } = consume2;
|
|
16730
16730
|
try {
|
|
16731
16731
|
if (type === "text") {
|
|
16732
|
-
|
|
16732
|
+
resolve19(chunksDecode(body2, length, encoding));
|
|
16733
16733
|
} else if (type === "json") {
|
|
16734
|
-
|
|
16734
|
+
resolve19(JSON.parse(chunksDecode(body2, length, encoding)));
|
|
16735
16735
|
} else if (type === "arrayBuffer") {
|
|
16736
|
-
|
|
16736
|
+
resolve19(chunksConcat(body2, length).buffer);
|
|
16737
16737
|
} else if (type === "blob") {
|
|
16738
|
-
|
|
16738
|
+
resolve19(new Blob(body2, { type: stream[kContentType] }));
|
|
16739
16739
|
} else if (type === "bytes") {
|
|
16740
|
-
|
|
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((
|
|
16959
|
+
return new Promise((resolve19, reject) => {
|
|
16960
16960
|
request2.call(this, opts, (err, data) => {
|
|
16961
|
-
return err ? reject(err) :
|
|
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((
|
|
17222
|
+
return new Promise((resolve19, reject) => {
|
|
17223
17223
|
stream.call(this, opts, factory, (err, data) => {
|
|
17224
|
-
return err ? reject(err) :
|
|
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((
|
|
17524
|
+
return new Promise((resolve19, reject) => {
|
|
17525
17525
|
upgrade2.call(this, opts, (err, data) => {
|
|
17526
|
-
return err ? reject(err) :
|
|
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((
|
|
17620
|
+
return new Promise((resolve19, reject) => {
|
|
17621
17621
|
connect2.call(this, opts, (err, data) => {
|
|
17622
|
-
return err ? reject(err) :
|
|
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:
|
|
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(
|
|
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 =
|
|
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(
|
|
21362
|
-
switch (
|
|
21361
|
+
function parseHttpDate(date6) {
|
|
21362
|
+
switch (date6[3]) {
|
|
21363
21363
|
case ",":
|
|
21364
|
-
return parseImfDate(
|
|
21364
|
+
return parseImfDate(date6);
|
|
21365
21365
|
case " ":
|
|
21366
|
-
return parseAscTimeDate(
|
|
21366
|
+
return parseAscTimeDate(date6);
|
|
21367
21367
|
default:
|
|
21368
|
-
return parseRfc850Date(
|
|
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(
|
|
21379
|
-
if (
|
|
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 (
|
|
21383
|
+
if (date6[0] === "S" && date6[1] === "u" && date6[2] === "n") {
|
|
21384
21384
|
weekday = 0;
|
|
21385
|
-
} else if (
|
|
21385
|
+
} else if (date6[0] === "M" && date6[1] === "o" && date6[2] === "n") {
|
|
21386
21386
|
weekday = 1;
|
|
21387
|
-
} else if (
|
|
21387
|
+
} else if (date6[0] === "T" && date6[1] === "u" && date6[2] === "e") {
|
|
21388
21388
|
weekday = 2;
|
|
21389
|
-
} else if (
|
|
21389
|
+
} else if (date6[0] === "W" && date6[1] === "e" && date6[2] === "d") {
|
|
21390
21390
|
weekday = 3;
|
|
21391
|
-
} else if (
|
|
21391
|
+
} else if (date6[0] === "T" && date6[1] === "h" && date6[2] === "u") {
|
|
21392
21392
|
weekday = 4;
|
|
21393
|
-
} else if (
|
|
21393
|
+
} else if (date6[0] === "F" && date6[1] === "r" && date6[2] === "i") {
|
|
21394
21394
|
weekday = 5;
|
|
21395
|
-
} else if (
|
|
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 (
|
|
21402
|
-
const code =
|
|
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 =
|
|
21408
|
+
const code1 = date6.charCodeAt(5);
|
|
21409
21409
|
if (code1 < 49 || code1 > 51) {
|
|
21410
21410
|
return void 0;
|
|
21411
21411
|
}
|
|
21412
|
-
const code2 =
|
|
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 (
|
|
21419
|
+
if (date6[8] === "J" && date6[9] === "a" && date6[10] === "n") {
|
|
21420
21420
|
monthIdx = 0;
|
|
21421
|
-
} else if (
|
|
21421
|
+
} else if (date6[8] === "F" && date6[9] === "e" && date6[10] === "b") {
|
|
21422
21422
|
monthIdx = 1;
|
|
21423
|
-
} else if (
|
|
21424
|
-
if (
|
|
21423
|
+
} else if (date6[8] === "M" && date6[9] === "a") {
|
|
21424
|
+
if (date6[10] === "r") {
|
|
21425
21425
|
monthIdx = 2;
|
|
21426
|
-
} else if (
|
|
21426
|
+
} else if (date6[10] === "y") {
|
|
21427
21427
|
monthIdx = 4;
|
|
21428
21428
|
} else {
|
|
21429
21429
|
return void 0;
|
|
21430
21430
|
}
|
|
21431
|
-
} else if (
|
|
21432
|
-
if (
|
|
21431
|
+
} else if (date6[8] === "J") {
|
|
21432
|
+
if (date6[9] === "a" && date6[10] === "n") {
|
|
21433
21433
|
monthIdx = 0;
|
|
21434
|
-
} else if (
|
|
21435
|
-
if (
|
|
21434
|
+
} else if (date6[9] === "u") {
|
|
21435
|
+
if (date6[10] === "n") {
|
|
21436
21436
|
monthIdx = 5;
|
|
21437
|
-
} else if (
|
|
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 (
|
|
21446
|
-
if (
|
|
21445
|
+
} else if (date6[8] === "A") {
|
|
21446
|
+
if (date6[9] === "p" && date6[10] === "r") {
|
|
21447
21447
|
monthIdx = 3;
|
|
21448
|
-
} else if (
|
|
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 (
|
|
21453
|
+
} else if (date6[8] === "S" && date6[9] === "e" && date6[10] === "p") {
|
|
21454
21454
|
monthIdx = 8;
|
|
21455
|
-
} else if (
|
|
21455
|
+
} else if (date6[8] === "O" && date6[9] === "c" && date6[10] === "t") {
|
|
21456
21456
|
monthIdx = 9;
|
|
21457
|
-
} else if (
|
|
21457
|
+
} else if (date6[8] === "N" && date6[9] === "o" && date6[10] === "v") {
|
|
21458
21458
|
monthIdx = 10;
|
|
21459
|
-
} else if (
|
|
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 =
|
|
21464
|
+
const yearDigit1 = date6.charCodeAt(12);
|
|
21465
21465
|
if (yearDigit1 < 48 || yearDigit1 > 57) {
|
|
21466
21466
|
return void 0;
|
|
21467
21467
|
}
|
|
21468
|
-
const yearDigit2 =
|
|
21468
|
+
const yearDigit2 = date6.charCodeAt(13);
|
|
21469
21469
|
if (yearDigit2 < 48 || yearDigit2 > 57) {
|
|
21470
21470
|
return void 0;
|
|
21471
21471
|
}
|
|
21472
|
-
const yearDigit3 =
|
|
21472
|
+
const yearDigit3 = date6.charCodeAt(14);
|
|
21473
21473
|
if (yearDigit3 < 48 || yearDigit3 > 57) {
|
|
21474
21474
|
return void 0;
|
|
21475
21475
|
}
|
|
21476
|
-
const yearDigit4 =
|
|
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 (
|
|
21483
|
-
const code =
|
|
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 =
|
|
21489
|
+
const code1 = date6.charCodeAt(17);
|
|
21490
21490
|
if (code1 < 48 || code1 > 50) {
|
|
21491
21491
|
return void 0;
|
|
21492
21492
|
}
|
|
21493
|
-
const code2 =
|
|
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 (
|
|
21504
|
-
const code =
|
|
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 =
|
|
21510
|
+
const code1 = date6.charCodeAt(20);
|
|
21511
21511
|
if (code1 < 48 || code1 > 53) {
|
|
21512
21512
|
return void 0;
|
|
21513
21513
|
}
|
|
21514
|
-
const code2 =
|
|
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 (
|
|
21522
|
-
const code =
|
|
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 =
|
|
21528
|
+
const code1 = date6.charCodeAt(23);
|
|
21529
21529
|
if (code1 < 48 || code1 > 53) {
|
|
21530
21530
|
return void 0;
|
|
21531
21531
|
}
|
|
21532
|
-
const code2 =
|
|
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(
|
|
21541
|
-
if (
|
|
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 (
|
|
21545
|
+
if (date6[0] === "S" && date6[1] === "u" && date6[2] === "n") {
|
|
21546
21546
|
weekday = 0;
|
|
21547
|
-
} else if (
|
|
21547
|
+
} else if (date6[0] === "M" && date6[1] === "o" && date6[2] === "n") {
|
|
21548
21548
|
weekday = 1;
|
|
21549
|
-
} else if (
|
|
21549
|
+
} else if (date6[0] === "T" && date6[1] === "u" && date6[2] === "e") {
|
|
21550
21550
|
weekday = 2;
|
|
21551
|
-
} else if (
|
|
21551
|
+
} else if (date6[0] === "W" && date6[1] === "e" && date6[2] === "d") {
|
|
21552
21552
|
weekday = 3;
|
|
21553
|
-
} else if (
|
|
21553
|
+
} else if (date6[0] === "T" && date6[1] === "h" && date6[2] === "u") {
|
|
21554
21554
|
weekday = 4;
|
|
21555
|
-
} else if (
|
|
21555
|
+
} else if (date6[0] === "F" && date6[1] === "r" && date6[2] === "i") {
|
|
21556
21556
|
weekday = 5;
|
|
21557
|
-
} else if (
|
|
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 (
|
|
21563
|
+
if (date6[4] === "J" && date6[5] === "a" && date6[6] === "n") {
|
|
21564
21564
|
monthIdx = 0;
|
|
21565
|
-
} else if (
|
|
21565
|
+
} else if (date6[4] === "F" && date6[5] === "e" && date6[6] === "b") {
|
|
21566
21566
|
monthIdx = 1;
|
|
21567
|
-
} else if (
|
|
21568
|
-
if (
|
|
21567
|
+
} else if (date6[4] === "M" && date6[5] === "a") {
|
|
21568
|
+
if (date6[6] === "r") {
|
|
21569
21569
|
monthIdx = 2;
|
|
21570
|
-
} else if (
|
|
21570
|
+
} else if (date6[6] === "y") {
|
|
21571
21571
|
monthIdx = 4;
|
|
21572
21572
|
} else {
|
|
21573
21573
|
return void 0;
|
|
21574
21574
|
}
|
|
21575
|
-
} else if (
|
|
21576
|
-
if (
|
|
21575
|
+
} else if (date6[4] === "J") {
|
|
21576
|
+
if (date6[5] === "a" && date6[6] === "n") {
|
|
21577
21577
|
monthIdx = 0;
|
|
21578
|
-
} else if (
|
|
21579
|
-
if (
|
|
21578
|
+
} else if (date6[5] === "u") {
|
|
21579
|
+
if (date6[6] === "n") {
|
|
21580
21580
|
monthIdx = 5;
|
|
21581
|
-
} else if (
|
|
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 (
|
|
21590
|
-
if (
|
|
21589
|
+
} else if (date6[4] === "A") {
|
|
21590
|
+
if (date6[5] === "p" && date6[6] === "r") {
|
|
21591
21591
|
monthIdx = 3;
|
|
21592
|
-
} else if (
|
|
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 (
|
|
21597
|
+
} else if (date6[4] === "S" && date6[5] === "e" && date6[6] === "p") {
|
|
21598
21598
|
monthIdx = 8;
|
|
21599
|
-
} else if (
|
|
21599
|
+
} else if (date6[4] === "O" && date6[5] === "c" && date6[6] === "t") {
|
|
21600
21600
|
monthIdx = 9;
|
|
21601
|
-
} else if (
|
|
21601
|
+
} else if (date6[4] === "N" && date6[5] === "o" && date6[6] === "v") {
|
|
21602
21602
|
monthIdx = 10;
|
|
21603
|
-
} else if (
|
|
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 (
|
|
21610
|
-
const code =
|
|
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 =
|
|
21616
|
+
const code1 = date6.charCodeAt(8);
|
|
21617
21617
|
if (code1 < 49 || code1 > 51) {
|
|
21618
21618
|
return void 0;
|
|
21619
21619
|
}
|
|
21620
|
-
const code2 =
|
|
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 (
|
|
21628
|
-
const code =
|
|
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 =
|
|
21634
|
+
const code1 = date6.charCodeAt(11);
|
|
21635
21635
|
if (code1 < 48 || code1 > 50) {
|
|
21636
21636
|
return void 0;
|
|
21637
21637
|
}
|
|
21638
|
-
const code2 =
|
|
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 (
|
|
21649
|
-
const code =
|
|
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 =
|
|
21655
|
+
const code1 = date6.charCodeAt(14);
|
|
21656
21656
|
if (code1 < 48 || code1 > 53) {
|
|
21657
21657
|
return void 0;
|
|
21658
21658
|
}
|
|
21659
|
-
const code2 =
|
|
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 (
|
|
21667
|
-
const code =
|
|
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 =
|
|
21673
|
+
const code1 = date6.charCodeAt(17);
|
|
21674
21674
|
if (code1 < 48 || code1 > 53) {
|
|
21675
21675
|
return void 0;
|
|
21676
21676
|
}
|
|
21677
|
-
const code2 =
|
|
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 =
|
|
21683
|
+
const yearDigit1 = date6.charCodeAt(20);
|
|
21684
21684
|
if (yearDigit1 < 48 || yearDigit1 > 57) {
|
|
21685
21685
|
return void 0;
|
|
21686
21686
|
}
|
|
21687
|
-
const yearDigit2 =
|
|
21687
|
+
const yearDigit2 = date6.charCodeAt(21);
|
|
21688
21688
|
if (yearDigit2 < 48 || yearDigit2 > 57) {
|
|
21689
21689
|
return void 0;
|
|
21690
21690
|
}
|
|
21691
|
-
const yearDigit3 =
|
|
21691
|
+
const yearDigit3 = date6.charCodeAt(22);
|
|
21692
21692
|
if (yearDigit3 < 48 || yearDigit3 > 57) {
|
|
21693
21693
|
return void 0;
|
|
21694
21694
|
}
|
|
21695
|
-
const yearDigit4 =
|
|
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(
|
|
21702
|
+
function parseRfc850Date(date6) {
|
|
21703
21703
|
let commaIndex = -1;
|
|
21704
21704
|
let weekday = -1;
|
|
21705
|
-
if (
|
|
21706
|
-
if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
21717
|
-
if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
21738
|
-
const code =
|
|
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 =
|
|
21744
|
+
const code1 = date6.charCodeAt(commaIndex + 2);
|
|
21745
21745
|
if (code1 < 49 || code1 > 51) {
|
|
21746
21746
|
return void 0;
|
|
21747
21747
|
}
|
|
21748
|
-
const code2 =
|
|
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 (
|
|
21755
|
+
if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "n") {
|
|
21756
21756
|
monthIdx = 0;
|
|
21757
|
-
} else if (
|
|
21757
|
+
} else if (date6[commaIndex + 5] === "F" && date6[commaIndex + 6] === "e" && date6[commaIndex + 7] === "b") {
|
|
21758
21758
|
monthIdx = 1;
|
|
21759
|
-
} else if (
|
|
21759
|
+
} else if (date6[commaIndex + 5] === "M" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "r") {
|
|
21760
21760
|
monthIdx = 2;
|
|
21761
|
-
} else if (
|
|
21761
|
+
} else if (date6[commaIndex + 5] === "A" && date6[commaIndex + 6] === "p" && date6[commaIndex + 7] === "r") {
|
|
21762
21762
|
monthIdx = 3;
|
|
21763
|
-
} else if (
|
|
21763
|
+
} else if (date6[commaIndex + 5] === "M" && date6[commaIndex + 6] === "a" && date6[commaIndex + 7] === "y") {
|
|
21764
21764
|
monthIdx = 4;
|
|
21765
|
-
} else if (
|
|
21765
|
+
} else if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "n") {
|
|
21766
21766
|
monthIdx = 5;
|
|
21767
|
-
} else if (
|
|
21767
|
+
} else if (date6[commaIndex + 5] === "J" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "l") {
|
|
21768
21768
|
monthIdx = 6;
|
|
21769
|
-
} else if (
|
|
21769
|
+
} else if (date6[commaIndex + 5] === "A" && date6[commaIndex + 6] === "u" && date6[commaIndex + 7] === "g") {
|
|
21770
21770
|
monthIdx = 7;
|
|
21771
|
-
} else if (
|
|
21771
|
+
} else if (date6[commaIndex + 5] === "S" && date6[commaIndex + 6] === "e" && date6[commaIndex + 7] === "p") {
|
|
21772
21772
|
monthIdx = 8;
|
|
21773
|
-
} else if (
|
|
21773
|
+
} else if (date6[commaIndex + 5] === "O" && date6[commaIndex + 6] === "c" && date6[commaIndex + 7] === "t") {
|
|
21774
21774
|
monthIdx = 9;
|
|
21775
|
-
} else if (
|
|
21775
|
+
} else if (date6[commaIndex + 5] === "N" && date6[commaIndex + 6] === "o" && date6[commaIndex + 7] === "v") {
|
|
21776
21776
|
monthIdx = 10;
|
|
21777
|
-
} else if (
|
|
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 =
|
|
21782
|
+
const yearDigit1 = date6.charCodeAt(commaIndex + 9);
|
|
21783
21783
|
if (yearDigit1 < 48 || yearDigit1 > 57) {
|
|
21784
21784
|
return void 0;
|
|
21785
21785
|
}
|
|
21786
|
-
const yearDigit2 =
|
|
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 (
|
|
21794
|
-
const code =
|
|
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 =
|
|
21800
|
+
const code1 = date6.charCodeAt(commaIndex + 12);
|
|
21801
21801
|
if (code1 < 48 || code1 > 50) {
|
|
21802
21802
|
return void 0;
|
|
21803
21803
|
}
|
|
21804
|
-
const code2 =
|
|
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 (
|
|
21815
|
-
const code =
|
|
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 =
|
|
21821
|
+
const code1 = date6.charCodeAt(commaIndex + 15);
|
|
21822
21822
|
if (code1 < 48 || code1 > 53) {
|
|
21823
21823
|
return void 0;
|
|
21824
21824
|
}
|
|
21825
|
-
const code2 =
|
|
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 (
|
|
21833
|
-
const code =
|
|
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 =
|
|
21839
|
+
const code1 = date6.charCodeAt(commaIndex + 18);
|
|
21840
21840
|
if (code1 < 48 || code1 > 53) {
|
|
21841
21841
|
return void 0;
|
|
21842
21842
|
}
|
|
21843
|
-
const code2 =
|
|
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((
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
28670
|
-
if (typeof
|
|
28671
|
-
|
|
28669
|
+
function toIMFDate(date6) {
|
|
28670
|
+
if (typeof date6 === "number") {
|
|
28671
|
+
date6 = new Date(date6);
|
|
28672
28672
|
}
|
|
28673
|
-
return `${IMFDays[
|
|
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,
|
|
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,
|
|
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,
|
|
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 ?? (
|
|
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
|
}
|
|
@@ -54554,6 +54554,7 @@ var EXIT_CODES = Object.freeze({
|
|
|
54554
54554
|
ACCOUNT_SUSPENDED: 7,
|
|
54555
54555
|
CONFLICT: 8,
|
|
54556
54556
|
MANAGED_BY_CONFIG: 8,
|
|
54557
|
+
RUNTIME_ENDED: 8,
|
|
54557
54558
|
QUOTA_EXCEEDED: 6,
|
|
54558
54559
|
RATE_LIMITED: 6,
|
|
54559
54560
|
DAILY_SCRIPT_BUDGET: 6,
|
|
@@ -54576,6 +54577,16 @@ var AppError = class extends Error {
|
|
|
54576
54577
|
function asError(value2) {
|
|
54577
54578
|
return value2 instanceof Error ? value2 : new Error(String(value2));
|
|
54578
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
|
+
}
|
|
54579
54590
|
|
|
54580
54591
|
// src/client.ts
|
|
54581
54592
|
var defaultWorkspace;
|
|
@@ -54588,6 +54599,8 @@ var ServiceError = class extends Error {
|
|
|
54588
54599
|
exitCode;
|
|
54589
54600
|
fields;
|
|
54590
54601
|
requestId;
|
|
54602
|
+
/** Exact commands that move the agent forward, printed with the error. */
|
|
54603
|
+
next;
|
|
54591
54604
|
constructor(message, code = "SERVICE_ERROR", exitCode = 1) {
|
|
54592
54605
|
super(message);
|
|
54593
54606
|
this.code = code;
|
|
@@ -57104,7 +57117,7 @@ function selectProductResponse(value2, pointers) {
|
|
|
57104
57117
|
return result2;
|
|
57105
57118
|
}
|
|
57106
57119
|
function abortRace(pending, signal) {
|
|
57107
|
-
return new Promise((
|
|
57120
|
+
return new Promise((resolve19, reject) => {
|
|
57108
57121
|
const abort = () => reject(failure2("PRODUCT_REQUEST_CANCELLED", 403));
|
|
57109
57122
|
if (signal.aborted) {
|
|
57110
57123
|
abort();
|
|
@@ -57113,7 +57126,7 @@ function abortRace(pending, signal) {
|
|
|
57113
57126
|
return;
|
|
57114
57127
|
}
|
|
57115
57128
|
signal.addEventListener("abort", abort, { once: true });
|
|
57116
|
-
pending.then(
|
|
57129
|
+
pending.then(resolve19, reject).finally(() => signal.removeEventListener("abort", abort)).catch(() => {
|
|
57117
57130
|
});
|
|
57118
57131
|
});
|
|
57119
57132
|
}
|
|
@@ -57476,11 +57489,11 @@ async function localProductRequestBroker(input2, options = {}) {
|
|
|
57476
57489
|
server.headersTimeout = 5e3;
|
|
57477
57490
|
server.requestTimeout = 1e4;
|
|
57478
57491
|
try {
|
|
57479
|
-
await new Promise((
|
|
57492
|
+
await new Promise((resolve19, reject) => {
|
|
57480
57493
|
server.once("error", reject);
|
|
57481
57494
|
server.listen(0, "127.0.0.1", () => {
|
|
57482
57495
|
server.removeListener("error", reject);
|
|
57483
|
-
|
|
57496
|
+
resolve19();
|
|
57484
57497
|
});
|
|
57485
57498
|
});
|
|
57486
57499
|
} catch (error62) {
|
|
@@ -57517,7 +57530,7 @@ async function localProductRequestBroker(input2, options = {}) {
|
|
|
57517
57530
|
closed = true;
|
|
57518
57531
|
stop.abort();
|
|
57519
57532
|
const done = new Promise(
|
|
57520
|
-
(
|
|
57533
|
+
(resolve19, reject) => server.close((e) => e ? reject(e) : resolve19())
|
|
57521
57534
|
);
|
|
57522
57535
|
server.closeAllConnections();
|
|
57523
57536
|
await Promise.allSettled([...pending]);
|
|
@@ -57828,9 +57841,7 @@ ${failures.join("\n")}`
|
|
|
57828
57841
|
};
|
|
57829
57842
|
} catch (cause) {
|
|
57830
57843
|
if (exchange && !exchange.error) {
|
|
57831
|
-
|
|
57832
|
-
const code = error62.cause?.code;
|
|
57833
|
-
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(
|
|
57834
57845
|
0,
|
|
57835
57846
|
RUN_TRACE_LIMITS.text
|
|
57836
57847
|
);
|
|
@@ -58497,10 +58508,10 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
|
|
|
58497
58508
|
signal.throwIfAborted();
|
|
58498
58509
|
const url3 = certificateTarget(monitor.target), hostname4 = url3.hostname;
|
|
58499
58510
|
const lookupStarted = performance3.now();
|
|
58500
|
-
const addresses = await new Promise((
|
|
58511
|
+
const addresses = await new Promise((resolve19, reject) => {
|
|
58501
58512
|
const abort = () => reject(new Error("Certificate check cancelled or timed out"));
|
|
58502
58513
|
signal.addEventListener("abort", abort, { once: true });
|
|
58503
|
-
io.lookup(hostname4, { all: true, verbatim: true }).then(
|
|
58514
|
+
io.lookup(hostname4, { all: true, verbatim: true }).then(resolve19, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
58504
58515
|
if (signal.aborted) abort();
|
|
58505
58516
|
});
|
|
58506
58517
|
signal.throwIfAborted();
|
|
@@ -58517,7 +58528,7 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
|
|
|
58517
58528
|
};
|
|
58518
58529
|
const connectStarted = performance3.now();
|
|
58519
58530
|
let tcpAt = null;
|
|
58520
|
-
return await new Promise((
|
|
58531
|
+
return await new Promise((resolve19) => {
|
|
58521
58532
|
let done = false;
|
|
58522
58533
|
const socket = io.connect({
|
|
58523
58534
|
host: addresses[0].address,
|
|
@@ -58542,7 +58553,7 @@ async function certificateCheck(monitor, parentSignal, io = transport, sink = {}
|
|
|
58542
58553
|
);
|
|
58543
58554
|
signal.removeEventListener("abort", abort);
|
|
58544
58555
|
socket.destroy();
|
|
58545
|
-
|
|
58556
|
+
resolve19(result2);
|
|
58546
58557
|
};
|
|
58547
58558
|
const abort = () => finish({
|
|
58548
58559
|
status: "error",
|
|
@@ -58611,7 +58622,7 @@ import { performance as performance4 } from "node:perf_hooks";
|
|
|
58611
58622
|
// package.json
|
|
58612
58623
|
var package_default = {
|
|
58613
58624
|
name: "@waitcher/cli",
|
|
58614
|
-
version: "0.2.
|
|
58625
|
+
version: "0.2.34",
|
|
58615
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.",
|
|
58616
58627
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
58617
58628
|
author: "S\u0142awomir Radzymi\u0144ski",
|
|
@@ -59051,11 +59062,11 @@ var deadline = (monitor, parent) => AbortSignal.any([
|
|
|
59051
59062
|
...parent ? [parent] : []
|
|
59052
59063
|
]);
|
|
59053
59064
|
function race(work, signal, message) {
|
|
59054
|
-
return new Promise((
|
|
59065
|
+
return new Promise((resolve19, reject) => {
|
|
59055
59066
|
const abort = () => reject(new Error(message));
|
|
59056
59067
|
if (signal.aborted) return abort();
|
|
59057
59068
|
signal.addEventListener("abort", abort, { once: true });
|
|
59058
|
-
work.then(
|
|
59069
|
+
work.then(resolve19, reject).finally(
|
|
59059
59070
|
() => signal.removeEventListener("abort", abort)
|
|
59060
59071
|
);
|
|
59061
59072
|
});
|
|
@@ -59113,7 +59124,7 @@ async function tcpCheck(monitor, parent, io = tcpTransport, sink = {}) {
|
|
|
59113
59124
|
const address = addresses[0].address;
|
|
59114
59125
|
trace.address = address;
|
|
59115
59126
|
const connectStarted = performance5.now();
|
|
59116
|
-
return await new Promise((
|
|
59127
|
+
return await new Promise((resolve19) => {
|
|
59117
59128
|
let done = false;
|
|
59118
59129
|
const chunks = [];
|
|
59119
59130
|
let bytes2 = 0;
|
|
@@ -59126,7 +59137,7 @@ async function tcpCheck(monitor, parent, io = tcpTransport, sink = {}) {
|
|
|
59126
59137
|
socket.destroy();
|
|
59127
59138
|
if (bytes2)
|
|
59128
59139
|
trace.banner = short(Buffer.concat(chunks).toString("utf8").trim());
|
|
59129
|
-
|
|
59140
|
+
resolve19(result2);
|
|
59130
59141
|
};
|
|
59131
59142
|
const abort = () => finish(
|
|
59132
59143
|
connectedAt ? fail2(
|
|
@@ -59717,7 +59728,7 @@ async function scriptCheckInternal(m, dir, signal, options = {}) {
|
|
|
59717
59728
|
throw Error(
|
|
59718
59729
|
"AI execution requires the exact frozen binding and a private attempt grant"
|
|
59719
59730
|
);
|
|
59720
|
-
await
|
|
59731
|
+
await linkNodeModules(root, dir);
|
|
59721
59732
|
await writeFile2(
|
|
59722
59733
|
join5(dir, "package.json"),
|
|
59723
59734
|
JSON.stringify({
|
|
@@ -60062,6 +60073,19 @@ function identitySecretValues(identity) {
|
|
|
60062
60073
|
])
|
|
60063
60074
|
].filter((value2) => [...value2].length >= 6).flatMap((value2) => [value2, JSON.stringify(value2).slice(1, -1)]);
|
|
60064
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
|
+
}
|
|
60065
60089
|
async function scriptCheck(m, dir, signal, options = {}) {
|
|
60066
60090
|
if (m.type === "visual") {
|
|
60067
60091
|
const { script, web } = visualTest(m.visual, m.timeout);
|
|
@@ -60222,7 +60246,7 @@ async function execute(monitor, runDir, {
|
|
|
60222
60246
|
const error62 = asError(cause);
|
|
60223
60247
|
result2 = {
|
|
60224
60248
|
status: "error",
|
|
60225
|
-
message: monitor.httpAuth ? "Authenticated endpoint execution could not be evaluated" : error62
|
|
60249
|
+
message: monitor.httpAuth ? "Authenticated endpoint execution could not be evaluated" : errorMessage(error62),
|
|
60226
60250
|
logs: monitor.httpAuth ? "HTTP credential dispatch or transport failed. No credentials or response body are recorded." : error62.stack ?? String(error62),
|
|
60227
60251
|
...cause instanceof StorageError ? { resourceReason: cause.code } : {},
|
|
60228
60252
|
...monitor.httpAuth && !(cause instanceof StorageError) ? { resourceReason: "HTTP_AUTH_EXECUTION_ERROR" } : {},
|
|
@@ -60345,6 +60369,11 @@ var entries = {
|
|
|
60345
60369
|
meaning: "The project's runtime generation stops being supported on the date in the message. Until then it builds, deploys and runs as before.",
|
|
60346
60370
|
fix: "Run waitcher runtime upgrade --file PATH_TO_waitcher.json and follow its steps, or hand the prompt in the runtime docs to a coding agent."
|
|
60347
60371
|
},
|
|
60372
|
+
RUNTIME_ENDED: {
|
|
60373
|
+
title: "Check paused: its runtime ended",
|
|
60374
|
+
meaning: "The check's runtime generation is no longer supported and it did not pass its preview on the newest, so it is paused. Nothing runs or alerts; its history stays.",
|
|
60375
|
+
fix: "For a check in waitcher.json run waitcher runtime upgrade --file PATH_TO_waitcher.json and follow its steps; for a check made in the web app change it until its preview passes, then Move on its page or waitcher runtime move --id ID."
|
|
60376
|
+
},
|
|
60348
60377
|
SECRET_MISSING: {
|
|
60349
60378
|
title: "Secret not set for this environment",
|
|
60350
60379
|
meaning: "A script lists a CHECK_* name in settings.envNames that has no value in the environment.",
|
|
@@ -61573,11 +61602,11 @@ async function localModelBroker(input2, options = {}) {
|
|
|
61573
61602
|
server.maxConnections = 8;
|
|
61574
61603
|
server.headersTimeout = 5e3;
|
|
61575
61604
|
server.requestTimeout = 35e3;
|
|
61576
|
-
await new Promise((
|
|
61605
|
+
await new Promise((resolve19, reject) => {
|
|
61577
61606
|
server.once("error", reject);
|
|
61578
61607
|
server.listen(0, "127.0.0.1", () => {
|
|
61579
61608
|
server.removeListener("error", reject);
|
|
61580
|
-
|
|
61609
|
+
resolve19();
|
|
61581
61610
|
});
|
|
61582
61611
|
});
|
|
61583
61612
|
const origin = `http://127.0.0.1:${server.address().port}`;
|
|
@@ -61613,7 +61642,7 @@ async function localModelBroker(input2, options = {}) {
|
|
|
61613
61642
|
finishing = (async () => {
|
|
61614
61643
|
revoked = true;
|
|
61615
61644
|
const closed = new Promise(
|
|
61616
|
-
(
|
|
61645
|
+
(resolve19, reject) => server.close((e) => e ? reject(e) : resolve19())
|
|
61617
61646
|
);
|
|
61618
61647
|
server.closeAllConnections();
|
|
61619
61648
|
await Promise.allSettled([...pending]);
|
|
@@ -62696,39 +62725,37 @@ async function buildScript({
|
|
|
62696
62725
|
import { readFile as readFile7, realpath as realpath3, mkdir as mkdir7, writeFile as writeFile8, rm as rm5 } from "node:fs/promises";
|
|
62697
62726
|
import { execFile } from "node:child_process";
|
|
62698
62727
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
62699
|
-
import { dirname as dirname12, join as join12, resolve as
|
|
62728
|
+
import { dirname as dirname12, join as join12, resolve as resolve14 } from "node:path";
|
|
62700
62729
|
import { promisify } from "node:util";
|
|
62701
62730
|
|
|
62702
62731
|
// src/runtime.ts
|
|
62703
62732
|
import { spawn as spawn2 } from "node:child_process";
|
|
62704
62733
|
import { access, readFile as readFile6, writeFile as writeFile7 } from "node:fs/promises";
|
|
62705
|
-
import {
|
|
62706
|
-
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";
|
|
62707
62735
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
62708
62736
|
var RUNTIME_IGNORES = ["node_modules/", ".waitcher/", ".e2e/"];
|
|
62709
|
-
async function installedPackage(
|
|
62710
|
-
|
|
62711
|
-
|
|
62712
|
-
|
|
62713
|
-
|
|
62714
|
-
|
|
62715
|
-
|
|
62716
|
-
|
|
62717
|
-
if (meta3.name === name5) return { dir, version: meta3.version };
|
|
62718
|
-
} catch {
|
|
62719
|
-
}
|
|
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 {
|
|
62720
62745
|
}
|
|
62721
|
-
|
|
62746
|
+
const parent = dirname11(dir);
|
|
62747
|
+
if (parent === dir) return null;
|
|
62748
|
+
dir = parent;
|
|
62722
62749
|
}
|
|
62723
|
-
return null;
|
|
62724
62750
|
}
|
|
62725
62751
|
var installedVersion = async (project, name5) => (await installedPackage(project, name5))?.version ?? null;
|
|
62726
62752
|
async function chromiumInstalled(project) {
|
|
62727
62753
|
try {
|
|
62728
62754
|
const web = await installedPackage(project, "@e2e-dev/web");
|
|
62729
62755
|
if (!web) return false;
|
|
62730
|
-
const core =
|
|
62731
|
-
|
|
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);
|
|
62732
62759
|
await access((playwright.default ?? playwright).chromium.executablePath());
|
|
62733
62760
|
return true;
|
|
62734
62761
|
} catch {
|
|
@@ -62770,7 +62797,7 @@ var missingIgnores = (text4) => {
|
|
|
62770
62797
|
);
|
|
62771
62798
|
};
|
|
62772
62799
|
function run(command, args, cwd, signal) {
|
|
62773
|
-
return new Promise((
|
|
62800
|
+
return new Promise((resolve19, reject) => {
|
|
62774
62801
|
const child2 = spawn2(command, args, {
|
|
62775
62802
|
cwd,
|
|
62776
62803
|
signal,
|
|
@@ -62780,7 +62807,7 @@ function run(command, args, cwd, signal) {
|
|
|
62780
62807
|
child2.on("error", reject);
|
|
62781
62808
|
child2.on(
|
|
62782
62809
|
"exit",
|
|
62783
|
-
(code) => code === 0 ?
|
|
62810
|
+
(code) => code === 0 ? resolve19() : reject(
|
|
62784
62811
|
new ServiceError(
|
|
62785
62812
|
`${command} ${args.join(" ")} exited with ${code}; read its output above.`,
|
|
62786
62813
|
"RUNTIME_INSTALL_FAILED",
|
|
@@ -62954,7 +62981,7 @@ async function buildEntries(path2, config2) {
|
|
|
62954
62981
|
const at = `monitors[${index}].entry`;
|
|
62955
62982
|
try {
|
|
62956
62983
|
const built = await buildScript({
|
|
62957
|
-
entry: await realpath3(
|
|
62984
|
+
entry: await realpath3(resolve14(project, entry2)).catch(() => {
|
|
62958
62985
|
throw new Error(`${entry2} was not found next to waitcher.json`);
|
|
62959
62986
|
}),
|
|
62960
62987
|
project
|
|
@@ -63051,7 +63078,7 @@ async function verifyLocally(options) {
|
|
|
63051
63078
|
);
|
|
63052
63079
|
return { runs, issues: issues2 };
|
|
63053
63080
|
}
|
|
63054
|
-
var configPath = (file2) =>
|
|
63081
|
+
var configPath = (file2) => resolve14(file2 ?? CONFIG_FILE);
|
|
63055
63082
|
async function readProjectConfig(file2) {
|
|
63056
63083
|
const path2 = configPath(file2);
|
|
63057
63084
|
let text4;
|
|
@@ -63214,7 +63241,13 @@ async function upgrade(options) {
|
|
|
63214
63241
|
generations: summary2.generations,
|
|
63215
63242
|
project: { file: path2, name: name5, environment: env ?? null, generation: from, installed },
|
|
63216
63243
|
target: targetId,
|
|
63217
|
-
|
|
63244
|
+
// paused: the check's runtime ended, so it neither runs nor alerts until a deploy moves it.
|
|
63245
|
+
hosted: hosted.map(({ monitorId, key, environment, generation }) => ({
|
|
63246
|
+
key,
|
|
63247
|
+
environment,
|
|
63248
|
+
generation,
|
|
63249
|
+
paused: (summary2.ended ?? []).some((e) => e.monitorId === monitorId)
|
|
63250
|
+
}))
|
|
63218
63251
|
};
|
|
63219
63252
|
const target = RUNTIME_GENERATIONS.find((g) => g.id === targetId);
|
|
63220
63253
|
if (!target)
|
|
@@ -63232,6 +63265,8 @@ async function upgrade(options) {
|
|
|
63232
63265
|
stage: "current",
|
|
63233
63266
|
steps: ["Nothing to do: this project has no api or browser entries, so it pins no runtime."]
|
|
63234
63267
|
};
|
|
63268
|
+
const paused = base2.hosted.filter((c) => c.paused);
|
|
63269
|
+
const pausedNote = paused.length ? `Paused because their runtime ended: ${paused.map((c) => `${c.key} (${c.generation}, ${c.environment})`).join(", ")}; they run again once deployed on ${targetId}. ` : "";
|
|
63235
63270
|
if (from !== targetId) {
|
|
63236
63271
|
const between = summary2.generations.map((g) => g.id).filter((id4) => (from === null || id4 > from) && id4 <= targetId);
|
|
63237
63272
|
const changes = await findChanges(
|
|
@@ -63253,12 +63288,12 @@ async function upgrade(options) {
|
|
|
63253
63288
|
previews,
|
|
63254
63289
|
install,
|
|
63255
63290
|
steps: yes ? [
|
|
63256
|
-
|
|
63291
|
+
`${pausedNote}The project now pins runtime ${targetId}. Change the scripts as changes[] says${failed.length ? `; previews[] shows ${failed.map((p) => p.key).join(", ")} failed on ${targetId}` : ""}.`,
|
|
63257
63292
|
`waitcher config validate ${flags} --verify runs every script locally on ${targetId}; fix failures and repeat.`,
|
|
63258
63293
|
"Show the user the diff and commit package.json, package-lock.json and the script changes.",
|
|
63259
63294
|
`Then run ${again}; it lists the environments to deploy.`
|
|
63260
63295
|
] : [
|
|
63261
|
-
|
|
63296
|
+
`${pausedNote}Moving this project from runtime ${from ?? "(none installed)"} to ${targetId}. changes[] lists what changed, the lines of this project each may affect (matches) and a fix${previews.length ? `; previews[] shows how each hosted check did when Waitcher ran it on ${targetId}` : ""}.`,
|
|
63262
63297
|
`Show the user install.steps (npm install runs package install scripts${browser ? "; Chromium is downloaded" : ""}). After the user agrees, run ${again} --yes.`
|
|
63263
63298
|
]
|
|
63264
63299
|
};
|
|
@@ -63270,7 +63305,7 @@ async function upgrade(options) {
|
|
|
63270
63305
|
...base2,
|
|
63271
63306
|
stage: "deploy",
|
|
63272
63307
|
steps: [
|
|
63273
|
-
|
|
63308
|
+
`${pausedNote}The project pins runtime ${targetId}; hosted checks still run another generation in ${environments.join(", ")}: ${behind.map((c) => `${c.key} (${c.generation})`).join(", ")}.`,
|
|
63274
63309
|
...environments.map(
|
|
63275
63310
|
(e) => `waitcher deploy plan --file ${path2} --env ${e} --verify, show the user the plan (changes with field runtime), then waitcher deploy apply --file ${path2} --env ${e} --based-on BASED_ON`
|
|
63276
63311
|
),
|
|
@@ -63288,16 +63323,16 @@ async function upgrade(options) {
|
|
|
63288
63323
|
}
|
|
63289
63324
|
|
|
63290
63325
|
// ../../skills/waitcher/SKILL.md
|
|
63291
|
-
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
|
|
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";
|
|
63292
63327
|
|
|
63293
63328
|
// ../../skills/waitcher/references/authoring.md
|
|
63294
|
-
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';
|
|
63295
63330
|
|
|
63296
63331
|
// ../../skills/waitcher/references/ai-and-agents.md
|
|
63297
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";
|
|
63298
63333
|
|
|
63299
63334
|
// ../../skills/waitcher/references/deploy.md
|
|
63300
|
-
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
|
|
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';
|
|
63301
63336
|
|
|
63302
63337
|
// ../../skills/waitcher/references/diagnosis.md
|
|
63303
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';
|
|
@@ -63311,7 +63346,7 @@ var openai_default = 'interface:\n display_name: "Waitcher"\n short_descriptio
|
|
|
63311
63346
|
// src/skill.ts
|
|
63312
63347
|
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile9, rm as rm6, writeFile as writeFile9 } from "node:fs/promises";
|
|
63313
63348
|
import { homedir } from "node:os";
|
|
63314
|
-
import { join as join14, resolve as
|
|
63349
|
+
import { join as join14, resolve as resolve15 } from "node:path";
|
|
63315
63350
|
var references = {
|
|
63316
63351
|
"authoring.md": authoring_default,
|
|
63317
63352
|
"ai-and-agents.md": ai_and_agents_default,
|
|
@@ -63323,46 +63358,63 @@ var bundledSkill = { name: "waitcher", content: SKILL_default, references };
|
|
|
63323
63358
|
var MARKER = ".waitcher-skill.json";
|
|
63324
63359
|
var SkillInstallError = class extends Error {
|
|
63325
63360
|
};
|
|
63326
|
-
|
|
63327
|
-
|
|
63328
|
-
|
|
63329
|
-
|
|
63330
|
-
|
|
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) {
|
|
63331
63374
|
const existing = await lstat9(directory).catch(() => null);
|
|
63332
|
-
|
|
63333
|
-
|
|
63334
|
-
|
|
63335
|
-
|
|
63336
|
-
|
|
63337
|
-
|
|
63338
|
-
|
|
63339
|
-
|
|
63340
|
-
|
|
63341
|
-
|
|
63342
|
-
|
|
63343
|
-
|
|
63344
|
-
|
|
63345
|
-
|
|
63346
|
-
|
|
63347
|
-
|
|
63348
|
-
|
|
63349
|
-
|
|
63350
|
-
join14(directory,
|
|
63351
|
-
|
|
63352
|
-
|
|
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);
|
|
63353
63403
|
return {
|
|
63354
|
-
event:
|
|
63404
|
+
event: versions.every((version2) => version2 !== null) ? "skill_updated" : "skill_installed",
|
|
63355
63405
|
name: "waitcher",
|
|
63356
63406
|
version: options.version,
|
|
63357
|
-
...previousVersion
|
|
63358
|
-
directory,
|
|
63407
|
+
...previousVersion ? { previousVersion } : {},
|
|
63408
|
+
// directory: the first, as before; directories: every one written.
|
|
63409
|
+
directory: directories[0],
|
|
63410
|
+
directories,
|
|
63359
63411
|
files: [
|
|
63360
63412
|
"SKILL.md",
|
|
63361
63413
|
...Object.keys(references).map((n) => `references/${n}`),
|
|
63362
63414
|
"agents/openai.yaml"
|
|
63363
63415
|
],
|
|
63364
63416
|
next: options.path || options.global ? ["Run waitcher skill install again after upgrading the CLI."] : [
|
|
63365
|
-
`Commit ${join14(".claude", "skills", "waitcher")} so every agent working in this repository finds
|
|
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.`,
|
|
63366
63418
|
"Run waitcher skill install again after upgrading the CLI."
|
|
63367
63419
|
]
|
|
63368
63420
|
};
|
|
@@ -63458,6 +63510,8 @@ async function doctor(options) {
|
|
|
63458
63510
|
join15(root, ".claude", "skills", "waitcher"),
|
|
63459
63511
|
join15(homedir2(), ".claude", "skills", "waitcher"),
|
|
63460
63512
|
join15(root, ".agents", "skills", "waitcher"),
|
|
63513
|
+
join15(homedir2(), ".agents", "skills", "waitcher"),
|
|
63514
|
+
// Older Codex releases read $CODEX_HOME/skills.
|
|
63461
63515
|
join15(process.env.CODEX_HOME ?? join15(homedir2(), ".codex"), "skills", "waitcher"),
|
|
63462
63516
|
...folders.slice(1).flatMap((dir) => [
|
|
63463
63517
|
join15(dir, ".claude", "skills", "waitcher"),
|
|
@@ -63471,20 +63525,24 @@ async function doctor(options) {
|
|
|
63471
63525
|
const marker2 = await readFile10(join15(home, ".waitcher-skill.json"), "utf8").then((text4) => JSON.parse(text4)).catch(() => null);
|
|
63472
63526
|
if (marker2 && marker2.version !== options.version) stale.push(home);
|
|
63473
63527
|
}
|
|
63474
|
-
const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join15(root,
|
|
63528
|
+
const install = root === process.cwd() ? ["waitcher skill install"] : [".claude", ".agents"].map((agent) => `waitcher skill install --path ${join15(root, agent, "skills")}`);
|
|
63475
63529
|
add(
|
|
63476
63530
|
!installed.length ? {
|
|
63477
63531
|
id: "skill",
|
|
63478
63532
|
status: "warning",
|
|
63479
63533
|
message: "The waitcher agent skill is not installed where common agents look",
|
|
63480
|
-
next:
|
|
63534
|
+
next: install
|
|
63481
63535
|
} : stale.length ? {
|
|
63482
63536
|
id: "skill",
|
|
63483
63537
|
status: "warning",
|
|
63484
63538
|
message: `Agent skill at ${stale.join(", ")} comes from another CLI version than ${options.version}`,
|
|
63485
|
-
next:
|
|
63486
|
-
|
|
63487
|
-
|
|
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
|
+
]
|
|
63488
63546
|
} : { id: "skill", status: "ok", message: `Agent skill at ${installed.join(", ")}` }
|
|
63489
63547
|
);
|
|
63490
63548
|
const api = await options.session().catch(() => null);
|
|
@@ -63591,7 +63649,7 @@ function olderVersion(a, b) {
|
|
|
63591
63649
|
// src/ci.ts
|
|
63592
63650
|
import { execFile as execFile2 } from "node:child_process";
|
|
63593
63651
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
63594
|
-
import { dirname as dirname15, relative as relative4, resolve as
|
|
63652
|
+
import { dirname as dirname15, relative as relative4, resolve as resolve16 } from "node:path";
|
|
63595
63653
|
import { promisify as promisify2 } from "node:util";
|
|
63596
63654
|
async function defaultBranch(cwd) {
|
|
63597
63655
|
try {
|
|
@@ -63607,7 +63665,7 @@ async function defaultBranch(cwd) {
|
|
|
63607
63665
|
}
|
|
63608
63666
|
async function initWorkflow(options) {
|
|
63609
63667
|
const root = process.cwd();
|
|
63610
|
-
const output2 =
|
|
63668
|
+
const output2 = resolve16(options.output ?? ".github/workflows/waitcher.yml");
|
|
63611
63669
|
const config2 = relative4(root, options.config) || "waitcher.json";
|
|
63612
63670
|
if (config2.startsWith(".."))
|
|
63613
63671
|
throw new Error("Run ci init from the repository root that contains waitcher.json.");
|
|
@@ -63680,7 +63738,7 @@ jobs:
|
|
|
63680
63738
|
|
|
63681
63739
|
// src/main.ts
|
|
63682
63740
|
import { readFile as readFile12, open as open18, lstat as lstat12, unlink as unlink5 } from "node:fs/promises";
|
|
63683
|
-
import { basename as basename3, dirname as dirname18, join as join17, resolve as
|
|
63741
|
+
import { basename as basename3, dirname as dirname18, join as join17, resolve as resolve18 } from "node:path";
|
|
63684
63742
|
import { constants as constants13 } from "node:fs";
|
|
63685
63743
|
|
|
63686
63744
|
// ../../src/contracts/account-deletion.ts
|
|
@@ -63954,7 +64012,7 @@ var incidentEditSchema = external_exports.object({
|
|
|
63954
64012
|
|
|
63955
64013
|
// src/access.ts
|
|
63956
64014
|
import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
|
|
63957
|
-
import { dirname as dirname16, resolve as
|
|
64015
|
+
import { dirname as dirname16, resolve as resolve17 } from "node:path";
|
|
63958
64016
|
function accessTokenInput(text4) {
|
|
63959
64017
|
let token = text4.trim();
|
|
63960
64018
|
if (token.startsWith("{")) {
|
|
@@ -63979,7 +64037,7 @@ async function issueToFile(path2, issue3) {
|
|
|
63979
64037
|
"VALIDATION_ERROR",
|
|
63980
64038
|
2
|
|
63981
64039
|
);
|
|
63982
|
-
const file2 =
|
|
64040
|
+
const file2 = resolve17(path2), directory = await lstat10(dirname16(file2));
|
|
63983
64041
|
if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
|
|
63984
64042
|
throw new ServiceError(
|
|
63985
64043
|
"Token output requires an existing private directory (chmod 700).",
|
|
@@ -64235,26 +64293,26 @@ async function post(config2, endpoint, fields, signal) {
|
|
|
64235
64293
|
);
|
|
64236
64294
|
return data;
|
|
64237
64295
|
}
|
|
64238
|
-
function tokenSession(config2, data,
|
|
64239
|
-
if (typeof data?.token_type !== "string" || data.token_type.toLowerCase() !== "bearer" || typeof data.access_token !== "string" || !data.access_token || typeof (data.refresh_token ??
|
|
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)
|
|
64240
64298
|
throw fail("Clerk returned an invalid token response.");
|
|
64241
64299
|
return {
|
|
64242
64300
|
...config2,
|
|
64243
64301
|
accessToken: data.access_token,
|
|
64244
|
-
refreshToken: data.refresh_token ??
|
|
64302
|
+
refreshToken: data.refresh_token ?? previous2,
|
|
64245
64303
|
expiresAt: Date.now() + data.expires_in * 1e3
|
|
64246
64304
|
};
|
|
64247
64305
|
}
|
|
64248
64306
|
async function openBrowser(url3) {
|
|
64249
64307
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32" : "xdg-open";
|
|
64250
64308
|
const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url3] : [url3];
|
|
64251
|
-
await new Promise((
|
|
64309
|
+
await new Promise((resolve19, reject) => {
|
|
64252
64310
|
const child2 = spawn3(command, args, { stdio: "ignore", shell: false });
|
|
64253
64311
|
child2.unref();
|
|
64254
64312
|
child2.once("error", reject);
|
|
64255
64313
|
child2.once(
|
|
64256
64314
|
"exit",
|
|
64257
|
-
(code) => code === 0 ?
|
|
64315
|
+
(code) => code === 0 ? resolve19() : reject(new Error("Browser unavailable"))
|
|
64258
64316
|
);
|
|
64259
64317
|
});
|
|
64260
64318
|
}
|
|
@@ -64272,8 +64330,8 @@ ${url3}
|
|
|
64272
64330
|
const verifier = randomBytes3(32).toString("base64url");
|
|
64273
64331
|
let redirect = "";
|
|
64274
64332
|
let finish;
|
|
64275
|
-
const callback = new Promise((
|
|
64276
|
-
finish = { resolve:
|
|
64333
|
+
const callback = new Promise((resolve19, reject) => {
|
|
64334
|
+
finish = { resolve: resolve19, reject };
|
|
64277
64335
|
});
|
|
64278
64336
|
callback.catch(() => {
|
|
64279
64337
|
});
|
|
@@ -64315,9 +64373,9 @@ ${url3}
|
|
|
64315
64373
|
let timer;
|
|
64316
64374
|
const cancel = () => finish.reject(fail("Sign-in was canceled."));
|
|
64317
64375
|
try {
|
|
64318
|
-
await new Promise((
|
|
64376
|
+
await new Promise((resolve19, reject) => {
|
|
64319
64377
|
listener.once("error", reject);
|
|
64320
|
-
listener.listen(0, "127.0.0.1",
|
|
64378
|
+
listener.listen(0, "127.0.0.1", resolve19);
|
|
64321
64379
|
});
|
|
64322
64380
|
redirect = `http://127.0.0.1:${listener.address().port}/callback`;
|
|
64323
64381
|
timer = setTimeout(
|
|
@@ -64362,7 +64420,7 @@ ${url3}
|
|
|
64362
64420
|
clearTimeout(timer);
|
|
64363
64421
|
signal?.removeEventListener("abort", cancel);
|
|
64364
64422
|
listener.closeAllConnections();
|
|
64365
|
-
await new Promise((
|
|
64423
|
+
await new Promise((resolve19) => listener.close(() => resolve19()));
|
|
64366
64424
|
}
|
|
64367
64425
|
}
|
|
64368
64426
|
async function refreshOAuth(server, session, signal) {
|
|
@@ -64401,7 +64459,7 @@ async function revokeOAuth(session, signal) {
|
|
|
64401
64459
|
var help = `Waitcher CLI
|
|
64402
64460
|
|
|
64403
64461
|
Usage: waitcher <group> <command> [options]
|
|
64404
|
-
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;
|
|
64405
64463
|
run diagnose and run scenarios print a readable report unless --json. Help and version work offline.
|
|
64406
64464
|
waitcher help TOPIC (or waitcher GROUP --help) prints only matching sections, e.g. help deploy.
|
|
64407
64465
|
waitcher help all prints everything; waitcher --help prints an overview.
|
|
@@ -64409,9 +64467,10 @@ waitcher help all prints everything; waitcher --help prints an overview.
|
|
|
64409
64467
|
Agent skill
|
|
64410
64468
|
skill show Read the bundled skill and its references as JSON
|
|
64411
64469
|
skill install [--global | --path SKILLS_DIR]
|
|
64412
|
-
Install or update the skill in
|
|
64413
|
-
|
|
64414
|
-
|
|
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
|
|
64415
64474
|
after upgrading the CLI; never replaces a skill it did not write
|
|
64416
64475
|
|
|
64417
64476
|
Heartbeats
|
|
@@ -64518,6 +64577,9 @@ Capabilities
|
|
|
64518
64577
|
system capabilities Show account features, limits and contract versions
|
|
64519
64578
|
system diagnostics Operator resource, queue and storage diagnostics
|
|
64520
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
|
|
64521
64583
|
system plan --owner clerk:USER_ID|team:ID --plan starter|pilot|pro|business|team
|
|
64522
64584
|
Administrator: assign a plan; takes effect immediately
|
|
64523
64585
|
system suspensions Administrator: accounts whose checks are suspended
|
|
@@ -65041,14 +65103,50 @@ ${exitCodes}
|
|
|
65041
65103
|
`;
|
|
65042
65104
|
}
|
|
65043
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
|
+
|
|
65044
65140
|
// src/main.ts
|
|
65045
65141
|
var list = (text4) => (text4 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
65046
65142
|
var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
|
|
65047
65143
|
var controller = new AbortController();
|
|
65048
65144
|
process.once("SIGINT", () => controller.abort());
|
|
65049
65145
|
process.once("SIGTERM", () => controller.abort());
|
|
65050
|
-
function usage2(message) {
|
|
65051
|
-
|
|
65146
|
+
function usage2(message, next) {
|
|
65147
|
+
const error62 = new ServiceError(message, "USAGE_ERROR", 2);
|
|
65148
|
+
if (next) error62.next = next;
|
|
65149
|
+
throw error62;
|
|
65052
65150
|
}
|
|
65053
65151
|
function id3(value2) {
|
|
65054
65152
|
if (typeof value2 !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9-]{0,99}$/.test(value2))
|
|
@@ -65429,6 +65527,7 @@ async function main() {
|
|
|
65429
65527
|
"system capabilities": [],
|
|
65430
65528
|
"system diagnostics": [],
|
|
65431
65529
|
"system plans": [],
|
|
65530
|
+
"system accounts": ["plan"],
|
|
65432
65531
|
"system plan": ["owner", "plan"],
|
|
65433
65532
|
"system suspensions": [],
|
|
65434
65533
|
"system suspend": ["owner", "reason"],
|
|
@@ -65579,10 +65678,16 @@ async function main() {
|
|
|
65579
65678
|
if (command === "config init") {
|
|
65580
65679
|
if (v.server) usage2("config init works locally; omit --server.");
|
|
65581
65680
|
if (v.target) {
|
|
65582
|
-
|
|
65583
|
-
|
|
65584
|
-
|
|
65585
|
-
usage2(
|
|
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
|
+
);
|
|
65586
65691
|
}
|
|
65587
65692
|
}
|
|
65588
65693
|
const file2 = configPath(v.file);
|
|
@@ -66424,7 +66529,7 @@ async function main() {
|
|
|
66424
66529
|
usage2(
|
|
66425
66530
|
"Provide --output with a new private receipt file before confirming deletion."
|
|
66426
66531
|
);
|
|
66427
|
-
const file2 =
|
|
66532
|
+
const file2 = resolve18(v.output), directory = await lstat12(dirname18(file2));
|
|
66428
66533
|
if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
|
|
66429
66534
|
usage2(
|
|
66430
66535
|
"Receipt output needs an existing private directory (chmod 700)."
|
|
@@ -66558,7 +66663,7 @@ async function main() {
|
|
|
66558
66663
|
else if (command === "account export") {
|
|
66559
66664
|
if (!v.file) usage2("Provide --file with a new private tar output path.");
|
|
66560
66665
|
const seconds = integer2(v.timeout ?? "90", "timeout", 1, 180);
|
|
66561
|
-
const destination =
|
|
66666
|
+
const destination = resolve18(v.file);
|
|
66562
66667
|
const directory = await lstat12(dirname18(destination));
|
|
66563
66668
|
if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
|
|
66564
66669
|
usage2(
|
|
@@ -67400,7 +67505,17 @@ async function main() {
|
|
|
67400
67505
|
} else if (command === "system diagnostics")
|
|
67401
67506
|
result2 = await api("system/diagnostics");
|
|
67402
67507
|
else if (command === "system plans") result2 = await api("system/plans");
|
|
67403
|
-
else if (command === "system
|
|
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")
|
|
67404
67519
|
result2 = await api("system/suspensions");
|
|
67405
67520
|
else if (command === "account billing") result2 = await api("billing");
|
|
67406
67521
|
else if (command === "account upgrade" || command === "account billing-portal") {
|
|
@@ -67837,7 +67952,8 @@ try {
|
|
|
67837
67952
|
...error62.fields ? { fields: error62.fields } : {},
|
|
67838
67953
|
...error62.requestId ? { requestId: error62.requestId } : {},
|
|
67839
67954
|
code: interrupted ? "INTERRUPTED" : error62.code === "ENOENT" ? "FILE_NOT_FOUND" : error62 instanceof ServiceError ? error62.code : "LOCAL_ERROR",
|
|
67840
|
-
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 } : {}
|
|
67841
67957
|
}
|
|
67842
67958
|
}) + "\n"
|
|
67843
67959
|
);
|